Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add safe deserialize impl #66

Merged
merged 3 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,28 +90,36 @@ export function approveCollectionAuthority(
const resolvedAccounts = {
collectionAuthorityRecord: {
index: 0,
isWritable: true,
isWritable: true as boolean,
value: input.collectionAuthorityRecord ?? null,
},
newCollectionAuthority: {
index: 1,
isWritable: false,
isWritable: false as boolean,
value: input.newCollectionAuthority ?? null,
},
updateAuthority: {
index: 2,
isWritable: true,
isWritable: true as boolean,
value: input.updateAuthority ?? null,
},
payer: { index: 3, isWritable: true, value: input.payer ?? null },
metadata: { index: 4, isWritable: false, value: input.metadata ?? null },
mint: { index: 5, isWritable: false, value: input.mint ?? null },
payer: {
index: 3,
isWritable: true as boolean,
value: input.payer ?? null,
},
metadata: {
index: 4,
isWritable: false as boolean,
value: input.metadata ?? null,
},
mint: { index: 5, isWritable: false as boolean, value: input.mint ?? null },
systemProgram: {
index: 6,
isWritable: false,
isWritable: false as boolean,
value: input.systemProgram ?? null,
},
rent: { index: 7, isWritable: false, value: input.rent ?? null },
rent: { index: 7, isWritable: false as boolean, value: input.rent ?? null },
} satisfies ResolvedAccountsWithIndices;

// Default values.
Expand Down
42 changes: 31 additions & 11 deletions clients/js/src/generated/instructions/approveUseAuthority.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,51 @@ export function approveUseAuthority(
const resolvedAccounts = {
useAuthorityRecord: {
index: 0,
isWritable: true,
isWritable: true as boolean,
value: input.useAuthorityRecord ?? null,
},
owner: { index: 1, isWritable: true, value: input.owner ?? null },
payer: { index: 2, isWritable: true, value: input.payer ?? null },
user: { index: 3, isWritable: false, value: input.user ?? null },
owner: {
index: 1,
isWritable: true as boolean,
value: input.owner ?? null,
},
payer: {
index: 2,
isWritable: true as boolean,
value: input.payer ?? null,
},
user: { index: 3, isWritable: false as boolean, value: input.user ?? null },
ownerTokenAccount: {
index: 4,
isWritable: true,
isWritable: true as boolean,
value: input.ownerTokenAccount ?? null,
},
metadata: { index: 5, isWritable: false, value: input.metadata ?? null },
mint: { index: 6, isWritable: false, value: input.mint ?? null },
burner: { index: 7, isWritable: false, value: input.burner ?? null },
metadata: {
index: 5,
isWritable: false as boolean,
value: input.metadata ?? null,
},
mint: { index: 6, isWritable: false as boolean, value: input.mint ?? null },
burner: {
index: 7,
isWritable: false as boolean,
value: input.burner ?? null,
},
tokenProgram: {
index: 8,
isWritable: false,
isWritable: false as boolean,
value: input.tokenProgram ?? null,
},
systemProgram: {
index: 9,
isWritable: false,
isWritable: false as boolean,
value: input.systemProgram ?? null,
},
rent: { index: 10, isWritable: false, value: input.rent ?? null },
rent: {
index: 10,
isWritable: false as boolean,
value: input.rent ?? null,
},
} satisfies ResolvedAccountsWithIndices;

// Arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,27 @@ export function bubblegumSetCollectionSize(
const resolvedAccounts = {
collectionMetadata: {
index: 0,
isWritable: true,
isWritable: true as boolean,
value: input.collectionMetadata ?? null,
},
collectionAuthority: {
index: 1,
isWritable: true,
isWritable: true as boolean,
value: input.collectionAuthority ?? null,
},
collectionMint: {
index: 2,
isWritable: false,
isWritable: false as boolean,
value: input.collectionMint ?? null,
},
bubblegumSigner: {
index: 3,
isWritable: false,
isWritable: false as boolean,
value: input.bubblegumSigner ?? null,
},
collectionAuthorityRecord: {
index: 4,
isWritable: false,
isWritable: false as boolean,
value: input.collectionAuthorityRecord ?? null,
},
} satisfies ResolvedAccountsWithIndices;
Expand Down
28 changes: 18 additions & 10 deletions clients/js/src/generated/instructions/burnEditionNft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,46 +87,54 @@ export function burnEditionNft(

// Accounts.
const resolvedAccounts = {
metadata: { index: 0, isWritable: true, value: input.metadata ?? null },
owner: { index: 1, isWritable: true, value: input.owner ?? null },
metadata: {
index: 0,
isWritable: true as boolean,
value: input.metadata ?? null,
},
owner: {
index: 1,
isWritable: true as boolean,
value: input.owner ?? null,
},
printEditionMint: {
index: 2,
isWritable: true,
isWritable: true as boolean,
value: input.printEditionMint ?? null,
},
masterEditionMint: {
index: 3,
isWritable: false,
isWritable: false as boolean,
value: input.masterEditionMint ?? null,
},
printEditionTokenAccount: {
index: 4,
isWritable: true,
isWritable: true as boolean,
value: input.printEditionTokenAccount ?? null,
},
masterEditionTokenAccount: {
index: 5,
isWritable: false,
isWritable: false as boolean,
value: input.masterEditionTokenAccount ?? null,
},
masterEditionAccount: {
index: 6,
isWritable: true,
isWritable: true as boolean,
value: input.masterEditionAccount ?? null,
},
printEditionAccount: {
index: 7,
isWritable: true,
isWritable: true as boolean,
value: input.printEditionAccount ?? null,
},
editionMarkerAccount: {
index: 8,
isWritable: true,
isWritable: true as boolean,
value: input.editionMarkerAccount ?? null,
},
splTokenProgram: {
index: 9,
isWritable: false,
isWritable: false as boolean,
value: input.splTokenProgram ?? null,
},
} satisfies ResolvedAccountsWithIndices;
Expand Down
22 changes: 15 additions & 7 deletions clients/js/src/generated/instructions/burnNft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,35 @@ export function burnNft(

// Accounts.
const resolvedAccounts = {
metadata: { index: 0, isWritable: true, value: input.metadata ?? null },
owner: { index: 1, isWritable: true, value: input.owner ?? null },
mint: { index: 2, isWritable: true, value: input.mint ?? null },
metadata: {
index: 0,
isWritable: true as boolean,
value: input.metadata ?? null,
},
owner: {
index: 1,
isWritable: true as boolean,
value: input.owner ?? null,
},
mint: { index: 2, isWritable: true as boolean, value: input.mint ?? null },
tokenAccount: {
index: 3,
isWritable: true,
isWritable: true as boolean,
value: input.tokenAccount ?? null,
},
masterEditionAccount: {
index: 4,
isWritable: true,
isWritable: true as boolean,
value: input.masterEditionAccount ?? null,
},
splTokenProgram: {
index: 5,
isWritable: false,
isWritable: false as boolean,
value: input.splTokenProgram ?? null,
},
collectionMetadata: {
index: 6,
isWritable: true,
isWritable: true as boolean,
value: input.collectionMetadata ?? null,
},
} satisfies ResolvedAccountsWithIndices;
Expand Down
44 changes: 30 additions & 14 deletions clients/js/src/generated/instructions/burnV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,54 +127,70 @@ export function burnV1(

// Accounts.
const resolvedAccounts = {
authority: { index: 0, isWritable: true, value: input.authority ?? null },
authority: {
index: 0,
isWritable: true as boolean,
value: input.authority ?? null,
},
collectionMetadata: {
index: 1,
isWritable: true,
isWritable: true as boolean,
value: input.collectionMetadata ?? null,
},
metadata: { index: 2, isWritable: true, value: input.metadata ?? null },
edition: { index: 3, isWritable: true, value: input.edition ?? null },
mint: { index: 4, isWritable: true, value: input.mint ?? null },
token: { index: 5, isWritable: true, value: input.token ?? null },
metadata: {
index: 2,
isWritable: true as boolean,
value: input.metadata ?? null,
},
edition: {
index: 3,
isWritable: true as boolean,
value: input.edition ?? null,
},
mint: { index: 4, isWritable: true as boolean, value: input.mint ?? null },
token: {
index: 5,
isWritable: true as boolean,
value: input.token ?? null,
},
masterEdition: {
index: 6,
isWritable: true,
isWritable: true as boolean,
value: input.masterEdition ?? null,
},
masterEditionMint: {
index: 7,
isWritable: false,
isWritable: false as boolean,
value: input.masterEditionMint ?? null,
},
masterEditionToken: {
index: 8,
isWritable: false,
isWritable: false as boolean,
value: input.masterEditionToken ?? null,
},
editionMarker: {
index: 9,
isWritable: true,
isWritable: true as boolean,
value: input.editionMarker ?? null,
},
tokenRecord: {
index: 10,
isWritable: true,
isWritable: true as boolean,
value: input.tokenRecord ?? null,
},
systemProgram: {
index: 11,
isWritable: false,
isWritable: false as boolean,
value: input.systemProgram ?? null,
},
sysvarInstructions: {
index: 12,
isWritable: false,
isWritable: false as boolean,
value: input.sysvarInstructions ?? null,
},
splTokenProgram: {
index: 13,
isWritable: false,
isWritable: false as boolean,
value: input.splTokenProgram ?? null,
},
} satisfies ResolvedAccountsWithIndices;
Expand Down
32 changes: 24 additions & 8 deletions clients/js/src/generated/instructions/closeEscrowAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,40 @@ export function closeEscrowAccount(

// Accounts.
const resolvedAccounts = {
escrow: { index: 0, isWritable: true, value: input.escrow ?? null },
metadata: { index: 1, isWritable: true, value: input.metadata ?? null },
mint: { index: 2, isWritable: false, value: input.mint ?? null },
escrow: {
index: 0,
isWritable: true as boolean,
value: input.escrow ?? null,
},
metadata: {
index: 1,
isWritable: true as boolean,
value: input.metadata ?? null,
},
mint: { index: 2, isWritable: false as boolean, value: input.mint ?? null },
tokenAccount: {
index: 3,
isWritable: false,
isWritable: false as boolean,
value: input.tokenAccount ?? null,
},
edition: { index: 4, isWritable: false, value: input.edition ?? null },
payer: { index: 5, isWritable: true, value: input.payer ?? null },
edition: {
index: 4,
isWritable: false as boolean,
value: input.edition ?? null,
},
payer: {
index: 5,
isWritable: true as boolean,
value: input.payer ?? null,
},
systemProgram: {
index: 6,
isWritable: false,
isWritable: false as boolean,
value: input.systemProgram ?? null,
},
sysvarInstructions: {
index: 7,
isWritable: false,
isWritable: false as boolean,
value: input.sysvarInstructions ?? null,
},
} satisfies ResolvedAccountsWithIndices;
Expand Down
8 changes: 6 additions & 2 deletions clients/js/src/generated/instructions/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ export function collect(

// Accounts.
const resolvedAccounts = {
authority: { index: 0, isWritable: false, value: input.authority ?? null },
authority: {
index: 0,
isWritable: false as boolean,
value: input.authority ?? null,
},
pdaAccount: {
index: 1,
isWritable: false,
isWritable: false as boolean,
value: input.pdaAccount ?? null,
},
} satisfies ResolvedAccountsWithIndices;
Expand Down
Loading
Loading