Skip to content

Commit

Permalink
saving-progress-before-splitting-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
crypto-vincent committed Jun 14, 2024
1 parent 9a66231 commit 45f55a8
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 191 deletions.
2 changes: 1 addition & 1 deletion clients/bolt-sdk/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PublicKey } from "@solana/web3.js";
import BN from "bn.js";
import { PROGRAM_ID } from "generated";
import { PROGRAM_ID } from "./generated";
export * from "./generated/accounts";
export * from "./generated/instructions";
export * from "./world/transactions";
Expand Down
18 changes: 8 additions & 10 deletions clients/bolt-sdk/src/world/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import BN from "bn.js";
import type web3 from "@solana/web3.js";
import { type Connection, type PublicKey, Transaction } from "@solana/web3.js";
import { PROGRAM_ID } from "generated";
import { PROGRAM_ID } from "../generated";

const MAX_COMPONENTS = 5;

Expand All @@ -35,11 +35,10 @@ export async function InitializeNewWorld({
}: {
payer: PublicKey;
connection: Connection;
}): Promise<{ transaction: Transaction; worldPda: PublicKey; worldId: BN }> {
}): Promise<{ transaction: Transaction; worldPda: PublicKey }> {
const registryPda = FindWorldRegistryPda();
const registry = await Registry.fromAccountAddress(connection, registryPda);
const worldId = new BN(registry.worlds);
const worldPda = FindWorldPda(new BN(worldId));
const worldPda = FindWorldPda(new BN(registry.worlds));
const initializeWorldIx = createInitializeNewWorldInstruction({
world: worldPda,
registry: registryPda,
Expand All @@ -48,7 +47,6 @@ export async function InitializeNewWorld({
return {
transaction: new Transaction().add(initializeWorldIx),
worldPda,
worldId,
};
}

Expand All @@ -69,11 +67,12 @@ export async function AddEntity({
world: PublicKey;
seed?: string;
connection: Connection;
}): Promise<{ transaction: Transaction; entityPda: PublicKey; entityId: BN }> {
}): Promise<{ transaction: Transaction; entityPda: PublicKey }> {
const worldInstance = await World.fromAccountAddress(connection, world);
const entityId = new BN(worldInstance.entities);
const entityPda = FindEntityPda(new BN(worldInstance.id), entityId);

const entityPda = FindEntityPda(
new BN(worldInstance.id),
new BN(worldInstance.entities)
);
const createEntityIx = createAddEntityInstruction(
{
world,
Expand All @@ -85,7 +84,6 @@ export async function AddEntity({
return {
transaction: new Transaction().add(createEntityIx),
entityPda,
entityId,
};
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
},
"license": "MIT",
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
}
Loading

0 comments on commit 45f55a8

Please sign in to comment.