diff --git a/clients/bolt-sdk/src/generated/idl/world.json b/clients/bolt-sdk/src/generated/idl/world.json index 1554550..7bb261d 100644 --- a/clients/bolt-sdk/src/generated/idl/world.json +++ b/clients/bolt-sdk/src/generated/idl/world.json @@ -80,7 +80,7 @@ { "name": "extra_seed", "type": { - "option": "string" + "option": "bytes" } } ] diff --git a/clients/bolt-sdk/src/generated/instructions/addEntity.ts b/clients/bolt-sdk/src/generated/instructions/addEntity.ts index 98fd60a..fb7914c 100644 --- a/clients/bolt-sdk/src/generated/instructions/addEntity.ts +++ b/clients/bolt-sdk/src/generated/instructions/addEntity.ts @@ -14,7 +14,7 @@ import * as web3 from "@solana/web3.js"; * @category generated */ export interface AddEntityInstructionArgs { - extraSeed: beet.COption; + extraSeed: beet.COption; } /** * @category Instructions @@ -28,7 +28,7 @@ export const addEntityStruct = new beet.FixableBeetArgsStruct< >( [ ["instructionDiscriminator", beet.uniformFixedSizeArray(beet.u8, 8)], - ["extraSeed", beet.coption(beet.utf8String)], + ["extraSeed", beet.coption(beet.bytes)], ], "AddEntityInstructionArgs", ); diff --git a/clients/bolt-sdk/src/generated/types/world.ts b/clients/bolt-sdk/src/generated/types/world.ts index e9092d8..4c8cc3f 100644 --- a/clients/bolt-sdk/src/generated/types/world.ts +++ b/clients/bolt-sdk/src/generated/types/world.ts @@ -68,7 +68,7 @@ export type World = { { name: "extraSeed"; type: { - option: "string"; + option: "bytes"; }; }, ]; diff --git a/clients/bolt-sdk/src/index.ts b/clients/bolt-sdk/src/index.ts index 006bfd5..da9a0d9 100644 --- a/clients/bolt-sdk/src/index.ts +++ b/clients/bolt-sdk/src/index.ts @@ -42,7 +42,7 @@ export function FindEntityPda({ }: { worldId: BN; entityId?: BN; - seed?: string; + seed?: Uint8Array; programId?: PublicKey; }) { const worldIdBuffer = Buffer.from(worldId.toArrayLike(Buffer, "be", 8)); diff --git a/clients/bolt-sdk/src/world/transactions.ts b/clients/bolt-sdk/src/world/transactions.ts index 7635475..5f86f35 100644 --- a/clients/bolt-sdk/src/world/transactions.ts +++ b/clients/bolt-sdk/src/world/transactions.ts @@ -229,7 +229,7 @@ export async function AddEntity({ }: { payer: PublicKey; world: PublicKey; - seed?: string; + seed?: Uint8Array; connection: Connection; }): Promise<{ instruction: TransactionInstruction; diff --git a/programs/world/src/lib.rs b/programs/world/src/lib.rs index d3e1bf5..b97f4a9 100644 --- a/programs/world/src/lib.rs +++ b/programs/world/src/lib.rs @@ -247,7 +247,7 @@ pub mod world { } #[allow(unused_variables)] - pub fn add_entity(ctx: Context, extra_seed: Option) -> Result<()> { + pub fn add_entity(ctx: Context, extra_seed: Option>) -> Result<()> { require!( ctx.accounts.world.key() == ctx.accounts.world.pda().0, WorldError::WorldAccountMismatch @@ -403,7 +403,7 @@ pub struct RemoveSystem<'info> { } #[derive(Accounts)] -#[instruction(extra_seed: Option)] +#[instruction(extra_seed: Option>)] pub struct AddEntity<'info> { #[account(mut)] pub payer: Signer<'info>, @@ -413,7 +413,7 @@ pub struct AddEntity<'info> { None => world.entities.to_be_bytes() }, match extra_seed { - Some(ref seed) => seed.as_bytes(), + Some(ref seed) => seed, None => &[], }], bump)] pub entity: Account<'info, Entity>, diff --git a/tests/bolt.ts b/tests/bolt.ts index ebd15c4..fd784fe 100644 --- a/tests/bolt.ts +++ b/tests/bolt.ts @@ -215,7 +215,7 @@ describe("bolt", () => { const addEntity = await AddEntity({ payer: provider.wallet.publicKey, world: worldPda, - seed: "extra-seed", + seed: Buffer.from("extra-seed"), connection: provider.connection, }); await provider.sendAndConfirm(addEntity.transaction);