@macalinao/clients-mpl-bubblegum 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/accounts/index.d.ts +2 -1
- package/dist/generated/accounts/treeConfig.d.ts +22 -7
- package/dist/generated/accounts/treeConfig.d.ts.map +1 -1
- package/dist/generated/accounts/treeConfig.js +7 -0
- package/dist/generated/accounts/treeConfig.js.map +1 -1
- package/dist/generated/accounts/voucher.d.ts +14 -7
- package/dist/generated/accounts/voucher.d.ts.map +1 -1
- package/dist/generated/accounts/voucher.js +7 -0
- package/dist/generated/accounts/voucher.js.map +1 -1
- package/dist/generated/errors/bubblegum.d.ts +0 -1
- package/dist/generated/errors/bubblegum.d.ts.map +1 -1
- package/dist/generated/errors/bubblegum.js +66 -59
- package/dist/generated/errors/bubblegum.js.map +1 -1
- package/dist/generated/errors/index.d.ts +2 -1
- package/dist/generated/index.d.ts +8 -1
- package/dist/generated/instructions/burn.d.ts +141 -17
- package/dist/generated/instructions/burn.d.ts.map +1 -1
- package/dist/generated/instructions/burn.js +23 -0
- package/dist/generated/instructions/burn.js.map +1 -1
- package/dist/generated/instructions/burnV2.d.ts +179 -31
- package/dist/generated/instructions/burnV2.d.ts.map +1 -1
- package/dist/generated/instructions/burnV2.js +21 -0
- package/dist/generated/instructions/burnV2.js.map +1 -1
- package/dist/generated/instructions/cancelRedeem.d.ts +99 -13
- package/dist/generated/instructions/cancelRedeem.d.ts.map +1 -1
- package/dist/generated/instructions/cancelRedeem.js +19 -0
- package/dist/generated/instructions/cancelRedeem.js.map +1 -1
- package/dist/generated/instructions/closeTreeV2.d.ts +85 -19
- package/dist/generated/instructions/closeTreeV2.d.ts.map +1 -1
- package/dist/generated/instructions/closeTreeV2.js +21 -0
- package/dist/generated/instructions/closeTreeV2.js.map +1 -1
- package/dist/generated/instructions/collectV2.d.ts +20 -7
- package/dist/generated/instructions/collectV2.d.ts.map +1 -1
- package/dist/generated/instructions/collectV2.js +10 -0
- package/dist/generated/instructions/collectV2.js.map +1 -1
- package/dist/generated/instructions/compress.d.ts +119 -9
- package/dist/generated/instructions/compress.d.ts.map +1 -1
- package/dist/generated/instructions/compress.js +21 -0
- package/dist/generated/instructions/compress.js.map +1 -1
- package/dist/generated/instructions/createTree.d.ts +117 -11
- package/dist/generated/instructions/createTree.d.ts.map +1 -1
- package/dist/generated/instructions/createTree.js +23 -0
- package/dist/generated/instructions/createTree.js.map +1 -1
- package/dist/generated/instructions/createTreeV2.d.ts +109 -14
- package/dist/generated/instructions/createTreeV2.d.ts.map +1 -1
- package/dist/generated/instructions/createTreeV2.js +23 -0
- package/dist/generated/instructions/createTreeV2.js.map +1 -1
- package/dist/generated/instructions/decompressV1.d.ts +106 -11
- package/dist/generated/instructions/decompressV1.d.ts.map +1 -1
- package/dist/generated/instructions/decompressV1.js +25 -0
- package/dist/generated/instructions/decompressV1.js.map +1 -1
- package/dist/generated/instructions/delegate.d.ts +140 -17
- package/dist/generated/instructions/delegate.d.ts.map +1 -1
- package/dist/generated/instructions/delegate.js +19 -0
- package/dist/generated/instructions/delegate.js.map +1 -1
- package/dist/generated/instructions/delegateAndFreezeV2.d.ts +171 -27
- package/dist/generated/instructions/delegateAndFreezeV2.d.ts.map +1 -1
- package/dist/generated/instructions/delegateAndFreezeV2.js +17 -0
- package/dist/generated/instructions/delegateAndFreezeV2.js.map +1 -1
- package/dist/generated/instructions/delegateV2.d.ts +169 -27
- package/dist/generated/instructions/delegateV2.d.ts.map +1 -1
- package/dist/generated/instructions/delegateV2.js +15 -0
- package/dist/generated/instructions/delegateV2.js.map +1 -1
- package/dist/generated/instructions/freezeV2.d.ts +174 -28
- package/dist/generated/instructions/freezeV2.d.ts.map +1 -1
- package/dist/generated/instructions/freezeV2.js +23 -0
- package/dist/generated/instructions/freezeV2.js.map +1 -1
- package/dist/generated/instructions/index.d.ts +2 -1
- package/dist/generated/instructions/mintToCollectionV1.d.ts +171 -20
- package/dist/generated/instructions/mintToCollectionV1.d.ts.map +1 -1
- package/dist/generated/instructions/mintToCollectionV1.js +23 -0
- package/dist/generated/instructions/mintToCollectionV1.js.map +1 -1
- package/dist/generated/instructions/mintV1.d.ts +109 -11
- package/dist/generated/instructions/mintV1.d.ts.map +1 -1
- package/dist/generated/instructions/mintV1.js +21 -0
- package/dist/generated/instructions/mintV1.js.map +1 -1
- package/dist/generated/instructions/mintV2.d.ts +163 -17
- package/dist/generated/instructions/mintV2.d.ts.map +1 -1
- package/dist/generated/instructions/mintV2.js +45 -0
- package/dist/generated/instructions/mintV2.js.map +1 -1
- package/dist/generated/instructions/redeem.d.ts +153 -17
- package/dist/generated/instructions/redeem.d.ts.map +1 -1
- package/dist/generated/instructions/redeem.js +23 -0
- package/dist/generated/instructions/redeem.js.map +1 -1
- package/dist/generated/instructions/setAndVerifyCollection.d.ts +222 -38
- package/dist/generated/instructions/setAndVerifyCollection.d.ts.map +1 -1
- package/dist/generated/instructions/setAndVerifyCollection.js +21 -0
- package/dist/generated/instructions/setAndVerifyCollection.js.map +1 -1
- package/dist/generated/instructions/setCollectionV2.d.ts +186 -39
- package/dist/generated/instructions/setCollectionV2.d.ts.map +1 -1
- package/dist/generated/instructions/setCollectionV2.js +21 -0
- package/dist/generated/instructions/setCollectionV2.js.map +1 -1
- package/dist/generated/instructions/setDecompressableState.d.ts +40 -9
- package/dist/generated/instructions/setDecompressableState.d.ts.map +1 -1
- package/dist/generated/instructions/setDecompressableState.js +13 -0
- package/dist/generated/instructions/setDecompressableState.js.map +1 -1
- package/dist/generated/instructions/setDecompressibleState.d.ts +41 -9
- package/dist/generated/instructions/setDecompressibleState.d.ts.map +1 -1
- package/dist/generated/instructions/setDecompressibleState.js +14 -0
- package/dist/generated/instructions/setDecompressibleState.js.map +1 -1
- package/dist/generated/instructions/setNonTransferableV2.d.ts +166 -31
- package/dist/generated/instructions/setNonTransferableV2.d.ts.map +1 -1
- package/dist/generated/instructions/setNonTransferableV2.js +23 -0
- package/dist/generated/instructions/setNonTransferableV2.js.map +1 -1
- package/dist/generated/instructions/setTreeDelegate.d.ts +65 -9
- package/dist/generated/instructions/setTreeDelegate.d.ts.map +1 -1
- package/dist/generated/instructions/setTreeDelegate.js +21 -0
- package/dist/generated/instructions/setTreeDelegate.js.map +1 -1
- package/dist/generated/instructions/thawAndRevokeV2.d.ts +158 -24
- package/dist/generated/instructions/thawAndRevokeV2.d.ts.map +1 -1
- package/dist/generated/instructions/thawAndRevokeV2.js +17 -0
- package/dist/generated/instructions/thawAndRevokeV2.js.map +1 -1
- package/dist/generated/instructions/thawV2.d.ts +166 -28
- package/dist/generated/instructions/thawV2.d.ts.map +1 -1
- package/dist/generated/instructions/thawV2.js +15 -0
- package/dist/generated/instructions/thawV2.js.map +1 -1
- package/dist/generated/instructions/transfer.d.ts +140 -17
- package/dist/generated/instructions/transfer.d.ts.map +1 -1
- package/dist/generated/instructions/transfer.js +19 -0
- package/dist/generated/instructions/transfer.js.map +1 -1
- package/dist/generated/instructions/transferV2.d.ts +167 -31
- package/dist/generated/instructions/transferV2.d.ts.map +1 -1
- package/dist/generated/instructions/transferV2.js +21 -0
- package/dist/generated/instructions/transferV2.js.map +1 -1
- package/dist/generated/instructions/unverifyCollection.d.ts +215 -38
- package/dist/generated/instructions/unverifyCollection.d.ts.map +1 -1
- package/dist/generated/instructions/unverifyCollection.js +19 -0
- package/dist/generated/instructions/unverifyCollection.js.map +1 -1
- package/dist/generated/instructions/unverifyCreator.d.ts +161 -17
- package/dist/generated/instructions/unverifyCreator.d.ts.map +1 -1
- package/dist/generated/instructions/unverifyCreator.js +19 -0
- package/dist/generated/instructions/unverifyCreator.js.map +1 -1
- package/dist/generated/instructions/unverifyCreatorV2.d.ts +143 -21
- package/dist/generated/instructions/unverifyCreatorV2.d.ts.map +1 -1
- package/dist/generated/instructions/unverifyCreatorV2.js +19 -0
- package/dist/generated/instructions/unverifyCreatorV2.js.map +1 -1
- package/dist/generated/instructions/updateAssetDataV2.d.ts +180 -28
- package/dist/generated/instructions/updateAssetDataV2.d.ts.map +1 -1
- package/dist/generated/instructions/updateAssetDataV2.js +21 -0
- package/dist/generated/instructions/updateAssetDataV2.js.map +1 -1
- package/dist/generated/instructions/updateMetadata.d.ts +183 -28
- package/dist/generated/instructions/updateMetadata.d.ts.map +1 -1
- package/dist/generated/instructions/updateMetadata.js +21 -0
- package/dist/generated/instructions/updateMetadata.js.map +1 -1
- package/dist/generated/instructions/updateMetadataV2.d.ts +162 -27
- package/dist/generated/instructions/updateMetadataV2.d.ts.map +1 -1
- package/dist/generated/instructions/updateMetadataV2.js +19 -0
- package/dist/generated/instructions/updateMetadataV2.js.map +1 -1
- package/dist/generated/instructions/verifyCollection.d.ts +215 -38
- package/dist/generated/instructions/verifyCollection.d.ts.map +1 -1
- package/dist/generated/instructions/verifyCollection.js +19 -0
- package/dist/generated/instructions/verifyCollection.js.map +1 -1
- package/dist/generated/instructions/verifyCreator.d.ts +161 -17
- package/dist/generated/instructions/verifyCreator.d.ts.map +1 -1
- package/dist/generated/instructions/verifyCreator.js +19 -0
- package/dist/generated/instructions/verifyCreator.js.map +1 -1
- package/dist/generated/instructions/verifyCreatorV2.d.ts +143 -21
- package/dist/generated/instructions/verifyCreatorV2.d.ts.map +1 -1
- package/dist/generated/instructions/verifyCreatorV2.js +19 -0
- package/dist/generated/instructions/verifyCreatorV2.js.map +1 -1
- package/dist/generated/pdas/assetId.d.ts +2 -3
- package/dist/generated/pdas/assetId.d.ts.map +1 -1
- package/dist/generated/pdas/assetId.js +7 -0
- package/dist/generated/pdas/assetId.js.map +1 -1
- package/dist/generated/pdas/bubblegumSigner.d.ts +0 -1
- package/dist/generated/pdas/bubblegumSigner.d.ts.map +1 -1
- package/dist/generated/pdas/bubblegumSigner.js +7 -0
- package/dist/generated/pdas/bubblegumSigner.js.map +1 -1
- package/dist/generated/pdas/index.d.ts +2 -1
- package/dist/generated/pdas/masterEdition.d.ts +2 -3
- package/dist/generated/pdas/masterEdition.d.ts.map +1 -1
- package/dist/generated/pdas/masterEdition.js +7 -0
- package/dist/generated/pdas/masterEdition.js.map +1 -1
- package/dist/generated/pdas/metadata.d.ts +2 -3
- package/dist/generated/pdas/metadata.d.ts.map +1 -1
- package/dist/generated/pdas/metadata.js +7 -0
- package/dist/generated/pdas/metadata.js.map +1 -1
- package/dist/generated/pdas/mintAuthority.d.ts +2 -3
- package/dist/generated/pdas/mintAuthority.d.ts.map +1 -1
- package/dist/generated/pdas/mintAuthority.js +7 -0
- package/dist/generated/pdas/mintAuthority.js.map +1 -1
- package/dist/generated/pdas/treeConfig.d.ts +2 -3
- package/dist/generated/pdas/treeConfig.d.ts.map +1 -1
- package/dist/generated/pdas/treeConfig.js +7 -0
- package/dist/generated/pdas/treeConfig.js.map +1 -1
- package/dist/generated/pdas/voucher.d.ts +2 -3
- package/dist/generated/pdas/voucher.d.ts.map +1 -1
- package/dist/generated/pdas/voucher.js +7 -0
- package/dist/generated/pdas/voucher.js.map +1 -1
- package/dist/generated/programs/bubblegum.d.ts +17 -12
- package/dist/generated/programs/bubblegum.d.ts.map +1 -1
- package/dist/generated/programs/bubblegum.js +11 -1
- package/dist/generated/programs/bubblegum.js.map +1 -1
- package/dist/generated/programs/index.d.ts +2 -1
- package/dist/generated/programs/mplTokenMetadata.d.ts +8 -8
- package/dist/generated/programs/mplTokenMetadata.d.ts.map +1 -1
- package/dist/generated/programs/mplTokenMetadata.js +7 -0
- package/dist/generated/programs/mplTokenMetadata.js.map +1 -1
- package/dist/generated/types/assetDataSchema.d.ts +4 -1
- package/dist/generated/types/assetDataSchema.d.ts.map +1 -1
- package/dist/generated/types/assetDataSchema.js +11 -0
- package/dist/generated/types/assetDataSchema.js.map +1 -1
- package/dist/generated/types/bubblegumEventType.d.ts +4 -1
- package/dist/generated/types/bubblegumEventType.d.ts.map +1 -1
- package/dist/generated/types/bubblegumEventType.js +11 -0
- package/dist/generated/types/bubblegumEventType.js.map +1 -1
- package/dist/generated/types/collection.d.ts +9 -3
- package/dist/generated/types/collection.d.ts.map +1 -1
- package/dist/generated/types/collection.js +7 -0
- package/dist/generated/types/collection.js.map +1 -1
- package/dist/generated/types/creator.d.ts +9 -7
- package/dist/generated/types/creator.d.ts.map +1 -1
- package/dist/generated/types/creator.js +7 -0
- package/dist/generated/types/creator.js.map +1 -1
- package/dist/generated/types/decompressibleState.d.ts +5 -1
- package/dist/generated/types/decompressibleState.d.ts.map +1 -1
- package/dist/generated/types/decompressibleState.js +12 -0
- package/dist/generated/types/decompressibleState.js.map +1 -1
- package/dist/generated/types/index.d.ts +2 -1
- package/dist/generated/types/instructionName.d.ts +4 -1
- package/dist/generated/types/instructionName.d.ts.map +1 -1
- package/dist/generated/types/instructionName.js +11 -0
- package/dist/generated/types/instructionName.js.map +1 -1
- package/dist/generated/types/leafSchema.d.ts +51 -13
- package/dist/generated/types/leafSchema.d.ts.map +1 -1
- package/dist/generated/types/leafSchema.js +7 -0
- package/dist/generated/types/leafSchema.js.map +1 -1
- package/dist/generated/types/metadataArgs.d.ts +19 -7
- package/dist/generated/types/metadataArgs.d.ts.map +1 -1
- package/dist/generated/types/metadataArgs.js +7 -0
- package/dist/generated/types/metadataArgs.js.map +1 -1
- package/dist/generated/types/metadataArgsV2.d.ts +14 -7
- package/dist/generated/types/metadataArgsV2.d.ts.map +1 -1
- package/dist/generated/types/metadataArgsV2.js +7 -0
- package/dist/generated/types/metadataArgsV2.js.map +1 -1
- package/dist/generated/types/tokenProgramVersion.d.ts +1 -1
- package/dist/generated/types/tokenProgramVersion.d.ts.map +1 -1
- package/dist/generated/types/tokenProgramVersion.js +8 -0
- package/dist/generated/types/tokenProgramVersion.js.map +1 -1
- package/dist/generated/types/tokenStandard.d.ts +5 -1
- package/dist/generated/types/tokenStandard.d.ts.map +1 -1
- package/dist/generated/types/tokenStandard.js +12 -0
- package/dist/generated/types/tokenStandard.js.map +1 -1
- package/dist/generated/types/updateArgs.d.ts +26 -7
- package/dist/generated/types/updateArgs.d.ts.map +1 -1
- package/dist/generated/types/updateArgs.js +7 -0
- package/dist/generated/types/updateArgs.js.map +1 -1
- package/dist/generated/types/useMethod.d.ts +1 -1
- package/dist/generated/types/useMethod.d.ts.map +1 -1
- package/dist/generated/types/useMethod.js +8 -0
- package/dist/generated/types/useMethod.js.map +1 -1
- package/dist/generated/types/uses.d.ts +16 -5
- package/dist/generated/types/uses.d.ts.map +1 -1
- package/dist/generated/types/uses.js +7 -0
- package/dist/generated/types/uses.js.map +1 -1
- package/dist/generated/types/version.d.ts +5 -1
- package/dist/generated/types/version.d.ts.map +1 -1
- package/dist/generated/types/version.js +12 -0
- package/dist/generated/types/version.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +6 -6
- package/src/generated/accounts/treeConfig.ts +36 -27
- package/src/generated/accounts/voucher.ts +30 -23
- package/src/generated/errors/bubblegum.ts +121 -154
- package/src/generated/instructions/burn.ts +157 -35
- package/src/generated/instructions/burnV2.ts +197 -52
- package/src/generated/instructions/cancelRedeem.ts +116 -32
- package/src/generated/instructions/closeTreeV2.ts +96 -35
- package/src/generated/instructions/collectV2.ts +34 -23
- package/src/generated/instructions/compress.ts +136 -30
- package/src/generated/instructions/createTree.ts +137 -33
- package/src/generated/instructions/createTreeV2.ts +128 -36
- package/src/generated/instructions/decompressV1.ts +124 -31
- package/src/generated/instructions/delegate.ts +159 -38
- package/src/generated/instructions/delegateAndFreezeV2.ts +191 -51
- package/src/generated/instructions/delegateV2.ts +189 -51
- package/src/generated/instructions/freezeV2.ts +193 -49
- package/src/generated/instructions/mintToCollectionV1.ts +186 -37
- package/src/generated/instructions/mintV1.ts +127 -31
- package/src/generated/instructions/mintV2.ts +184 -45
- package/src/generated/instructions/redeem.ts +172 -38
- package/src/generated/instructions/setAndVerifyCollection.ts +236 -54
- package/src/generated/instructions/setCollectionV2.ts +202 -58
- package/src/generated/instructions/setDecompressableState.ts +59 -31
- package/src/generated/instructions/setDecompressibleState.ts +60 -31
- package/src/generated/instructions/setNonTransferableV2.ts +184 -52
- package/src/generated/instructions/setTreeDelegate.ts +82 -28
- package/src/generated/instructions/thawAndRevokeV2.ts +179 -48
- package/src/generated/instructions/thawV2.ts +185 -49
- package/src/generated/instructions/transfer.ts +156 -35
- package/src/generated/instructions/transferV2.ts +185 -52
- package/src/generated/instructions/unverifyCollection.ts +229 -54
- package/src/generated/instructions/unverifyCreator.ts +181 -39
- package/src/generated/instructions/unverifyCreatorV2.ts +164 -46
- package/src/generated/instructions/updateAssetDataV2.ts +200 -50
- package/src/generated/instructions/updateMetadata.ts +200 -52
- package/src/generated/instructions/updateMetadataV2.ts +183 -54
- package/src/generated/instructions/verifyCollection.ts +229 -54
- package/src/generated/instructions/verifyCreator.ts +181 -39
- package/src/generated/instructions/verifyCreatorV2.ts +164 -46
- package/src/generated/pdas/assetId.ts +4 -3
- package/src/generated/pdas/bubblegumSigner.ts +6 -2
- package/src/generated/pdas/masterEdition.ts +4 -3
- package/src/generated/pdas/metadata.ts +4 -3
- package/src/generated/pdas/mintAuthority.ts +8 -4
- package/src/generated/pdas/treeConfig.ts +8 -4
- package/src/generated/pdas/voucher.ts +4 -3
- package/src/generated/programs/bubblegum.ts +146 -144
- package/src/generated/programs/mplTokenMetadata.ts +5 -10
- package/src/generated/types/assetDataSchema.ts +14 -8
- package/src/generated/types/bubblegumEventType.ts +13 -7
- package/src/generated/types/collection.ts +13 -8
- package/src/generated/types/creator.ts +11 -10
- package/src/generated/types/decompressibleState.ts +14 -7
- package/src/generated/types/instructionName.ts +46 -40
- package/src/generated/types/leafSchema.ts +59 -22
- package/src/generated/types/metadataArgs.ts +35 -27
- package/src/generated/types/metadataArgsV2.ts +23 -20
- package/src/generated/types/tokenProgramVersion.ts +10 -7
- package/src/generated/types/tokenStandard.ts +16 -9
- package/src/generated/types/updateArgs.ts +36 -15
- package/src/generated/types/useMethod.ts +11 -8
- package/src/generated/types/uses.ts +24 -11
- package/src/generated/types/version.ts +14 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redeem.js","names":[],"sources":["../../../src/generated/instructions/redeem.ts"],"sourcesContent":["/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport type {\n AccountMeta,\n AccountSignerMeta,\n Address,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n Instruction,\n InstructionWithAccounts,\n InstructionWithData,\n ReadonlyAccount,\n ReadonlyUint8Array,\n TransactionSigner,\n WritableAccount,\n WritableSignerAccount,\n} from \"@solana/kit\";\nimport type { ResolvedInstructionAccount } from \"@solana/program-client-core\";\nimport {\n combineCodec,\n fixDecoderSize,\n fixEncoderSize,\n getArrayDecoder,\n getArrayEncoder,\n getBytesDecoder,\n getBytesEncoder,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n getU32Decoder,\n getU32Encoder,\n getU64Decoder,\n getU64Encoder,\n SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,\n SolanaError,\n transformEncoder,\n} from \"@solana/kit\";\nimport {\n getAccountMetaFactory,\n getAddressFromResolvedInstructionAccount,\n} from \"@solana/program-client-core\";\nimport { findTreeConfigPda } from \"../pdas/index.js\";\nimport { BUBBLEGUM_PROGRAM_ADDRESS } from \"../programs/index.js\";\n\nexport const REDEEM_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([\n 184, 12, 86, 149, 70, 196, 97, 225,\n]);\n\nexport function getRedeemDiscriminatorBytes(): ReadonlyUint8Array {\n return fixEncoderSize(getBytesEncoder(), 8).encode(REDEEM_DISCRIMINATOR);\n}\n\nexport type RedeemInstruction<\n TProgram extends string = typeof BUBBLEGUM_PROGRAM_ADDRESS,\n TAccountTreeAuthority extends string | AccountMeta<string> = string,\n TAccountLeafOwner extends string | AccountMeta<string> = string,\n TAccountLeafDelegate extends string | AccountMeta<string> = string,\n TAccountMerkleTree extends string | AccountMeta<string> = string,\n TAccountVoucher extends string | AccountMeta<string> = string,\n TAccountLogWrapper extends string | AccountMeta<string> =\n \"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV\",\n TAccountCompressionProgram extends string | AccountMeta<string> =\n \"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK\",\n TAccountSystemProgram extends string | AccountMeta<string> =\n \"11111111111111111111111111111111\",\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<\n [\n TAccountTreeAuthority extends string\n ? ReadonlyAccount<TAccountTreeAuthority>\n : TAccountTreeAuthority,\n TAccountLeafOwner extends string\n ? WritableSignerAccount<TAccountLeafOwner> &\n AccountSignerMeta<TAccountLeafOwner>\n : TAccountLeafOwner,\n TAccountLeafDelegate extends string\n ? ReadonlyAccount<TAccountLeafDelegate>\n : TAccountLeafDelegate,\n TAccountMerkleTree extends string\n ? WritableAccount<TAccountMerkleTree>\n : TAccountMerkleTree,\n TAccountVoucher extends string\n ? WritableAccount<TAccountVoucher>\n : TAccountVoucher,\n TAccountLogWrapper extends string\n ? ReadonlyAccount<TAccountLogWrapper>\n : TAccountLogWrapper,\n TAccountCompressionProgram extends string\n ? ReadonlyAccount<TAccountCompressionProgram>\n : TAccountCompressionProgram,\n TAccountSystemProgram extends string\n ? ReadonlyAccount<TAccountSystemProgram>\n : TAccountSystemProgram,\n ...TRemainingAccounts,\n ]\n >;\n\nexport interface RedeemInstructionData {\n discriminator: ReadonlyUint8Array;\n root: number[];\n dataHash: number[];\n creatorHash: number[];\n nonce: bigint;\n index: number;\n}\n\nexport interface RedeemInstructionDataArgs {\n root: number[];\n dataHash: number[];\n creatorHash: number[];\n nonce: number | bigint;\n index: number;\n}\n\nexport function getRedeemInstructionDataEncoder(): FixedSizeEncoder<RedeemInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n [\"discriminator\", fixEncoderSize(getBytesEncoder(), 8)],\n [\"root\", getArrayEncoder(getU8Encoder(), { size: 32 })],\n [\"dataHash\", getArrayEncoder(getU8Encoder(), { size: 32 })],\n [\"creatorHash\", getArrayEncoder(getU8Encoder(), { size: 32 })],\n [\"nonce\", getU64Encoder()],\n [\"index\", getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: REDEEM_DISCRIMINATOR }),\n );\n}\n\nexport function getRedeemInstructionDataDecoder(): FixedSizeDecoder<RedeemInstructionData> {\n return getStructDecoder([\n [\"discriminator\", fixDecoderSize(getBytesDecoder(), 8)],\n [\"root\", getArrayDecoder(getU8Decoder(), { size: 32 })],\n [\"dataHash\", getArrayDecoder(getU8Decoder(), { size: 32 })],\n [\"creatorHash\", getArrayDecoder(getU8Decoder(), { size: 32 })],\n [\"nonce\", getU64Decoder()],\n [\"index\", getU32Decoder()],\n ]);\n}\n\nexport function getRedeemInstructionDataCodec(): FixedSizeCodec<\n RedeemInstructionDataArgs,\n RedeemInstructionData\n> {\n return combineCodec(\n getRedeemInstructionDataEncoder(),\n getRedeemInstructionDataDecoder(),\n );\n}\n\nexport interface RedeemAsyncInput<\n TAccountTreeAuthority extends string = string,\n TAccountLeafOwner extends string = string,\n TAccountLeafDelegate extends string = string,\n TAccountMerkleTree extends string = string,\n TAccountVoucher extends string = string,\n TAccountLogWrapper extends string = string,\n TAccountCompressionProgram extends string = string,\n TAccountSystemProgram extends string = string,\n> {\n treeAuthority?: Address<TAccountTreeAuthority>;\n leafOwner: TransactionSigner<TAccountLeafOwner>;\n leafDelegate: Address<TAccountLeafDelegate>;\n merkleTree: Address<TAccountMerkleTree>;\n voucher: Address<TAccountVoucher>;\n logWrapper?: Address<TAccountLogWrapper>;\n compressionProgram?: Address<TAccountCompressionProgram>;\n systemProgram?: Address<TAccountSystemProgram>;\n root: RedeemInstructionDataArgs[\"root\"];\n dataHash: RedeemInstructionDataArgs[\"dataHash\"];\n creatorHash: RedeemInstructionDataArgs[\"creatorHash\"];\n nonce: RedeemInstructionDataArgs[\"nonce\"];\n index: RedeemInstructionDataArgs[\"index\"];\n}\n\nexport async function getRedeemInstructionAsync<\n TAccountTreeAuthority extends string,\n TAccountLeafOwner extends string,\n TAccountLeafDelegate extends string,\n TAccountMerkleTree extends string,\n TAccountVoucher extends string,\n TAccountLogWrapper extends string,\n TAccountCompressionProgram extends string,\n TAccountSystemProgram extends string,\n TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS,\n>(\n input: RedeemAsyncInput<\n TAccountTreeAuthority,\n TAccountLeafOwner,\n TAccountLeafDelegate,\n TAccountMerkleTree,\n TAccountVoucher,\n TAccountLogWrapper,\n TAccountCompressionProgram,\n TAccountSystemProgram\n >,\n config?: { programAddress?: TProgramAddress },\n): Promise<\n RedeemInstruction<\n TProgramAddress,\n TAccountTreeAuthority,\n TAccountLeafOwner,\n TAccountLeafDelegate,\n TAccountMerkleTree,\n TAccountVoucher,\n TAccountLogWrapper,\n TAccountCompressionProgram,\n TAccountSystemProgram\n >\n> {\n // Program address.\n const programAddress = config?.programAddress ?? BUBBLEGUM_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n treeAuthority: { value: input.treeAuthority ?? null, isWritable: false },\n leafOwner: { value: input.leafOwner ?? null, isWritable: true },\n leafDelegate: { value: input.leafDelegate ?? null, isWritable: false },\n merkleTree: { value: input.merkleTree ?? null, isWritable: true },\n voucher: { value: input.voucher ?? null, isWritable: true },\n logWrapper: { value: input.logWrapper ?? null, isWritable: false },\n compressionProgram: {\n value: input.compressionProgram ?? null,\n isWritable: false,\n },\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedInstructionAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.treeAuthority.value) {\n accounts.treeAuthority.value = await findTreeConfigPda({\n merkleTree: getAddressFromResolvedInstructionAccount(\n \"merkleTree\",\n accounts.merkleTree.value,\n ),\n });\n }\n if (!accounts.logWrapper.value) {\n accounts.logWrapper.value =\n \"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV\" as Address<\"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV\">;\n }\n if (!accounts.compressionProgram.value) {\n accounts.compressionProgram.value =\n \"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK\" as Address<\"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK\">;\n }\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n \"11111111111111111111111111111111\" as Address<\"11111111111111111111111111111111\">;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, \"programId\");\n return Object.freeze({\n accounts: [\n getAccountMeta(\"treeAuthority\", accounts.treeAuthority),\n getAccountMeta(\"leafOwner\", accounts.leafOwner),\n getAccountMeta(\"leafDelegate\", accounts.leafDelegate),\n getAccountMeta(\"merkleTree\", accounts.merkleTree),\n getAccountMeta(\"voucher\", accounts.voucher),\n getAccountMeta(\"logWrapper\", accounts.logWrapper),\n getAccountMeta(\"compressionProgram\", accounts.compressionProgram),\n getAccountMeta(\"systemProgram\", accounts.systemProgram),\n ],\n data: getRedeemInstructionDataEncoder().encode(\n args as RedeemInstructionDataArgs,\n ),\n programAddress,\n } as RedeemInstruction<\n TProgramAddress,\n TAccountTreeAuthority,\n TAccountLeafOwner,\n TAccountLeafDelegate,\n TAccountMerkleTree,\n TAccountVoucher,\n TAccountLogWrapper,\n TAccountCompressionProgram,\n TAccountSystemProgram\n >);\n}\n\nexport interface RedeemInput<\n TAccountTreeAuthority extends string = string,\n TAccountLeafOwner extends string = string,\n TAccountLeafDelegate extends string = string,\n TAccountMerkleTree extends string = string,\n TAccountVoucher extends string = string,\n TAccountLogWrapper extends string = string,\n TAccountCompressionProgram extends string = string,\n TAccountSystemProgram extends string = string,\n> {\n treeAuthority: Address<TAccountTreeAuthority>;\n leafOwner: TransactionSigner<TAccountLeafOwner>;\n leafDelegate: Address<TAccountLeafDelegate>;\n merkleTree: Address<TAccountMerkleTree>;\n voucher: Address<TAccountVoucher>;\n logWrapper?: Address<TAccountLogWrapper>;\n compressionProgram?: Address<TAccountCompressionProgram>;\n systemProgram?: Address<TAccountSystemProgram>;\n root: RedeemInstructionDataArgs[\"root\"];\n dataHash: RedeemInstructionDataArgs[\"dataHash\"];\n creatorHash: RedeemInstructionDataArgs[\"creatorHash\"];\n nonce: RedeemInstructionDataArgs[\"nonce\"];\n index: RedeemInstructionDataArgs[\"index\"];\n}\n\nexport function getRedeemInstruction<\n TAccountTreeAuthority extends string,\n TAccountLeafOwner extends string,\n TAccountLeafDelegate extends string,\n TAccountMerkleTree extends string,\n TAccountVoucher extends string,\n TAccountLogWrapper extends string,\n TAccountCompressionProgram extends string,\n TAccountSystemProgram extends string,\n TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS,\n>(\n input: RedeemInput<\n TAccountTreeAuthority,\n TAccountLeafOwner,\n TAccountLeafDelegate,\n TAccountMerkleTree,\n TAccountVoucher,\n TAccountLogWrapper,\n TAccountCompressionProgram,\n TAccountSystemProgram\n >,\n config?: { programAddress?: TProgramAddress },\n): RedeemInstruction<\n TProgramAddress,\n TAccountTreeAuthority,\n TAccountLeafOwner,\n TAccountLeafDelegate,\n TAccountMerkleTree,\n TAccountVoucher,\n TAccountLogWrapper,\n TAccountCompressionProgram,\n TAccountSystemProgram\n> {\n // Program address.\n const programAddress = config?.programAddress ?? BUBBLEGUM_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n treeAuthority: { value: input.treeAuthority ?? null, isWritable: false },\n leafOwner: { value: input.leafOwner ?? null, isWritable: true },\n leafDelegate: { value: input.leafDelegate ?? null, isWritable: false },\n merkleTree: { value: input.merkleTree ?? null, isWritable: true },\n voucher: { value: input.voucher ?? null, isWritable: true },\n logWrapper: { value: input.logWrapper ?? null, isWritable: false },\n compressionProgram: {\n value: input.compressionProgram ?? null,\n isWritable: false,\n },\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedInstructionAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.logWrapper.value) {\n accounts.logWrapper.value =\n \"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV\" as Address<\"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV\">;\n }\n if (!accounts.compressionProgram.value) {\n accounts.compressionProgram.value =\n \"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK\" as Address<\"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK\">;\n }\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n \"11111111111111111111111111111111\" as Address<\"11111111111111111111111111111111\">;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, \"programId\");\n return Object.freeze({\n accounts: [\n getAccountMeta(\"treeAuthority\", accounts.treeAuthority),\n getAccountMeta(\"leafOwner\", accounts.leafOwner),\n getAccountMeta(\"leafDelegate\", accounts.leafDelegate),\n getAccountMeta(\"merkleTree\", accounts.merkleTree),\n getAccountMeta(\"voucher\", accounts.voucher),\n getAccountMeta(\"logWrapper\", accounts.logWrapper),\n getAccountMeta(\"compressionProgram\", accounts.compressionProgram),\n getAccountMeta(\"systemProgram\", accounts.systemProgram),\n ],\n data: getRedeemInstructionDataEncoder().encode(\n args as RedeemInstructionDataArgs,\n ),\n programAddress,\n } as RedeemInstruction<\n TProgramAddress,\n TAccountTreeAuthority,\n TAccountLeafOwner,\n TAccountLeafDelegate,\n TAccountMerkleTree,\n TAccountVoucher,\n TAccountLogWrapper,\n TAccountCompressionProgram,\n TAccountSystemProgram\n >);\n}\n\nexport interface ParsedRedeemInstruction<\n TProgram extends string = typeof BUBBLEGUM_PROGRAM_ADDRESS,\n TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],\n> {\n programAddress: Address<TProgram>;\n accounts: {\n treeAuthority: TAccountMetas[0];\n leafOwner: TAccountMetas[1];\n leafDelegate: TAccountMetas[2];\n merkleTree: TAccountMetas[3];\n voucher: TAccountMetas[4];\n logWrapper: TAccountMetas[5];\n compressionProgram: TAccountMetas[6];\n systemProgram: TAccountMetas[7];\n };\n data: RedeemInstructionData;\n}\n\nexport function parseRedeemInstruction<\n TProgram extends string,\n TAccountMetas extends readonly AccountMeta[],\n>(\n instruction: Instruction<TProgram> &\n InstructionWithAccounts<TAccountMetas> &\n InstructionWithData<ReadonlyUint8Array>,\n): ParsedRedeemInstruction<TProgram, TAccountMetas> {\n if (instruction.accounts.length < 8) {\n throw new SolanaError(\n SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,\n {\n actualAccountMetas: instruction.accounts.length,\n expectedAccountMetas: 8,\n },\n );\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n treeAuthority: getNextAccount(),\n leafOwner: getNextAccount(),\n leafDelegate: getNextAccount(),\n merkleTree: getNextAccount(),\n voucher: getNextAccount(),\n logWrapper: getNextAccount(),\n compressionProgram: getNextAccount(),\n systemProgram: getNextAccount(),\n },\n data: getRedeemInstructionDataDecoder().decode(instruction.data),\n };\n}\n"],"mappings":";;;;;AAoDA,MAAa,uBAA2C,IAAI,WAAW;CACrE;CAAK;CAAI;CAAI;CAAK;CAAI;CAAK;CAAI;AACjC,CAAC;AAED,SAAgB,8BAAkD;CAChE,OAAO,eAAe,gBAAgB,GAAG,CAAC,CAAC,CAAC,OAAO,oBAAoB;AACzE;AAkEA,SAAgB,kCAA+E;CAC7F,OAAO,iBACL,iBAAiB;EACf,CAAC,iBAAiB,eAAe,gBAAgB,GAAG,CAAC,CAAC;EACtD,CAAC,QAAQ,gBAAgB,aAAa,GAA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
1
|
+
{"version":3,"file":"redeem.js","names":[],"sources":["../../../src/generated/instructions/redeem.ts"],"sourcesContent":["/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n fixDecoderSize,\n fixEncoderSize,\n getArrayDecoder,\n getArrayEncoder,\n getBytesDecoder,\n getBytesEncoder,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,\n SolanaError,\n transformEncoder,\n type AccountMeta,\n type AccountSignerMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyAccount,\n type ReadonlyUint8Array,\n type TransactionSigner,\n type WritableAccount,\n type WritableSignerAccount,\n} from \"@solana/kit\";\nimport {\n getAccountMetaFactory,\n getAddressFromResolvedInstructionAccount,\n type ResolvedInstructionAccount,\n} from \"@solana/program-client-core\";\nimport { findTreeConfigPda } from \"../pdas/index.js\";\nimport { BUBBLEGUM_PROGRAM_ADDRESS } from \"../programs/index.js\";\n\nexport const REDEEM_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([\n 184, 12, 86, 149, 70, 196, 97, 225,\n]);\n\nexport function getRedeemDiscriminatorBytes(): ReadonlyUint8Array {\n return fixEncoderSize(getBytesEncoder(), 8).encode(REDEEM_DISCRIMINATOR);\n}\n\nexport type RedeemInstruction<\n TProgram extends string = typeof BUBBLEGUM_PROGRAM_ADDRESS,\n TAccountTreeAuthority extends string | AccountMeta<string> = string,\n TAccountLeafOwner extends string | AccountMeta<string> = string,\n TAccountLeafDelegate extends string | AccountMeta<string> = string,\n TAccountMerkleTree extends string | AccountMeta<string> = string,\n TAccountVoucher extends string | AccountMeta<string> = string,\n TAccountLogWrapper extends string | AccountMeta<string> =\n \"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV\",\n TAccountCompressionProgram extends string | AccountMeta<string> =\n \"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK\",\n TAccountSystemProgram extends string | AccountMeta<string> =\n \"11111111111111111111111111111111\",\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<\n [\n TAccountTreeAuthority extends string\n ? ReadonlyAccount<TAccountTreeAuthority>\n : TAccountTreeAuthority,\n TAccountLeafOwner extends string\n ? WritableSignerAccount<TAccountLeafOwner> &\n AccountSignerMeta<TAccountLeafOwner>\n : TAccountLeafOwner,\n TAccountLeafDelegate extends string\n ? ReadonlyAccount<TAccountLeafDelegate>\n : TAccountLeafDelegate,\n TAccountMerkleTree extends string\n ? WritableAccount<TAccountMerkleTree>\n : TAccountMerkleTree,\n TAccountVoucher extends string\n ? WritableAccount<TAccountVoucher>\n : TAccountVoucher,\n TAccountLogWrapper extends string\n ? ReadonlyAccount<TAccountLogWrapper>\n : TAccountLogWrapper,\n TAccountCompressionProgram extends string\n ? ReadonlyAccount<TAccountCompressionProgram>\n : TAccountCompressionProgram,\n TAccountSystemProgram extends string\n ? ReadonlyAccount<TAccountSystemProgram>\n : TAccountSystemProgram,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type RedeemInstructionData = {\n discriminator: ReadonlyUint8Array;\n /**\n * Current Merkle root of the tree, used together with the Merkle proof\n * (passed as remaining accounts) to verify the leaf being operated on.\n */\n root: Array<number>;\n /**\n * Keccak256 hash of the leaf's metadata, used together with `root` to\n * verify the leaf before it is modified.\n */\n dataHash: Array<number>;\n /**\n * Keccak256 hash of the leaf's creators array, used together with\n * `root` to verify the leaf before it is modified.\n */\n creatorHash: Array<number>;\n /**\n * Tree-scoped nonce identifying the leaf, equal to the tree's\n * `numMinted` at the time the leaf was minted. Combined with the tree\n * address to derive the leaf's asset id.\n */\n nonce: bigint;\n /**\n * Position of the leaf within the Merkle tree, used with the Merkle\n * proof to locate and verify the leaf.\n */\n index: number;\n};\n\nexport type RedeemInstructionDataArgs = {\n /**\n * Current Merkle root of the tree, used together with the Merkle proof\n * (passed as remaining accounts) to verify the leaf being operated on.\n */\n root: Array<number>;\n /**\n * Keccak256 hash of the leaf's metadata, used together with `root` to\n * verify the leaf before it is modified.\n */\n dataHash: Array<number>;\n /**\n * Keccak256 hash of the leaf's creators array, used together with\n * `root` to verify the leaf before it is modified.\n */\n creatorHash: Array<number>;\n /**\n * Tree-scoped nonce identifying the leaf, equal to the tree's\n * `numMinted` at the time the leaf was minted. Combined with the tree\n * address to derive the leaf's asset id.\n */\n nonce: number | bigint;\n /**\n * Position of the leaf within the Merkle tree, used with the Merkle\n * proof to locate and verify the leaf.\n */\n index: number;\n};\n\nexport function getRedeemInstructionDataEncoder(): FixedSizeEncoder<RedeemInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n [\"discriminator\", fixEncoderSize(getBytesEncoder(), 8)],\n [\"root\", getArrayEncoder(getU8Encoder(), { size: 32 })],\n [\"dataHash\", getArrayEncoder(getU8Encoder(), { size: 32 })],\n [\"creatorHash\", getArrayEncoder(getU8Encoder(), { size: 32 })],\n [\"nonce\", getU64Encoder()],\n [\"index\", getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: REDEEM_DISCRIMINATOR }),\n );\n}\n\nexport function getRedeemInstructionDataDecoder(): FixedSizeDecoder<RedeemInstructionData> {\n return getStructDecoder([\n [\"discriminator\", fixDecoderSize(getBytesDecoder(), 8)],\n [\"root\", getArrayDecoder(getU8Decoder(), { size: 32 })],\n [\"dataHash\", getArrayDecoder(getU8Decoder(), { size: 32 })],\n [\"creatorHash\", getArrayDecoder(getU8Decoder(), { size: 32 })],\n [\"nonce\", getU64Decoder()],\n [\"index\", getU32Decoder()],\n ]);\n}\n\nexport function getRedeemInstructionDataCodec(): FixedSizeCodec<\n RedeemInstructionDataArgs,\n RedeemInstructionData\n> {\n return combineCodec(\n getRedeemInstructionDataEncoder(),\n getRedeemInstructionDataDecoder(),\n );\n}\n\nexport type RedeemAsyncInput<\n TAccountTreeAuthority extends string = string,\n TAccountLeafOwner extends string = string,\n TAccountLeafDelegate extends string = string,\n TAccountMerkleTree extends string = string,\n TAccountVoucher extends string = string,\n TAccountLogWrapper extends string = string,\n TAccountCompressionProgram extends string = string,\n TAccountSystemProgram extends string = string,\n> = {\n /**\n * The tree's `TreeConfig` PDA, which stores its configuration and acts\n * as the tree's authority for CPIs into the compression program.\n */\n treeAuthority?: Address<TAccountTreeAuthority>;\n /** Owner of the compressed NFT leaf being operated on. */\n leafOwner: TransactionSigner<TAccountLeafOwner>;\n /**\n * Delegate authority for the leaf; defaults to the leaf owner when no\n * delegate is set.\n */\n leafDelegate: Address<TAccountLeafDelegate>;\n /**\n * The concurrent Merkle tree account storing the compressed leaves,\n * owned by the account compression program.\n */\n merkleTree: Address<TAccountMerkleTree>;\n /**\n * Voucher PDA created by this instruction to record the redeemed\n * leaf's data until it is decompressed or the redeem is cancelled.\n */\n voucher: Address<TAccountVoucher>;\n /**\n * The SPL/MPL Noop program, used to log leaf data so off-chain indexers\n * can reconstruct the tree.\n */\n logWrapper?: Address<TAccountLogWrapper>;\n /**\n * The SPL/MPL Account Compression program that owns and manages the\n * Merkle tree.\n */\n compressionProgram?: Address<TAccountCompressionProgram>;\n /** The Solana System program. */\n systemProgram?: Address<TAccountSystemProgram>;\n root: RedeemInstructionDataArgs[\"root\"];\n dataHash: RedeemInstructionDataArgs[\"dataHash\"];\n creatorHash: RedeemInstructionDataArgs[\"creatorHash\"];\n nonce: RedeemInstructionDataArgs[\"nonce\"];\n index: RedeemInstructionDataArgs[\"index\"];\n};\n\n/**\n * Redeems (vouches for) a leaf, removing it from the tree and recording\n * its data in a new `voucher` PDA.\n *\n * This is the first step of decompression: once redeemed, the leaf slot\n * in the tree is emptied and the leaf's data is preserved in `voucher`\n * until `decompressV1` consumes it, or `cancelRedeem` restores it.\n */\nexport async function getRedeemInstructionAsync<\n TAccountTreeAuthority extends string,\n TAccountLeafOwner extends string,\n TAccountLeafDelegate extends string,\n TAccountMerkleTree extends string,\n TAccountVoucher extends string,\n TAccountLogWrapper extends string,\n TAccountCompressionProgram extends string,\n TAccountSystemProgram extends string,\n TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS,\n>(\n input: RedeemAsyncInput<\n TAccountTreeAuthority,\n TAccountLeafOwner,\n TAccountLeafDelegate,\n TAccountMerkleTree,\n TAccountVoucher,\n TAccountLogWrapper,\n TAccountCompressionProgram,\n TAccountSystemProgram\n >,\n config?: { programAddress?: TProgramAddress },\n): Promise<\n RedeemInstruction<\n TProgramAddress,\n TAccountTreeAuthority,\n TAccountLeafOwner,\n TAccountLeafDelegate,\n TAccountMerkleTree,\n TAccountVoucher,\n TAccountLogWrapper,\n TAccountCompressionProgram,\n TAccountSystemProgram\n >\n> {\n // Program address.\n const programAddress = config?.programAddress ?? BUBBLEGUM_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n treeAuthority: { value: input.treeAuthority ?? null, isWritable: false },\n leafOwner: { value: input.leafOwner ?? null, isWritable: true },\n leafDelegate: { value: input.leafDelegate ?? null, isWritable: false },\n merkleTree: { value: input.merkleTree ?? null, isWritable: true },\n voucher: { value: input.voucher ?? null, isWritable: true },\n logWrapper: { value: input.logWrapper ?? null, isWritable: false },\n compressionProgram: {\n value: input.compressionProgram ?? null,\n isWritable: false,\n },\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedInstructionAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.treeAuthority.value) {\n accounts.treeAuthority.value = await findTreeConfigPda({\n merkleTree: getAddressFromResolvedInstructionAccount(\n \"merkleTree\",\n accounts.merkleTree.value,\n ),\n });\n }\n if (!accounts.logWrapper.value) {\n accounts.logWrapper.value =\n \"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV\" as Address<\"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV\">;\n }\n if (!accounts.compressionProgram.value) {\n accounts.compressionProgram.value =\n \"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK\" as Address<\"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK\">;\n }\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n \"11111111111111111111111111111111\" as Address<\"11111111111111111111111111111111\">;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, \"programId\");\n return Object.freeze({\n accounts: [\n getAccountMeta(\"treeAuthority\", accounts.treeAuthority),\n getAccountMeta(\"leafOwner\", accounts.leafOwner),\n getAccountMeta(\"leafDelegate\", accounts.leafDelegate),\n getAccountMeta(\"merkleTree\", accounts.merkleTree),\n getAccountMeta(\"voucher\", accounts.voucher),\n getAccountMeta(\"logWrapper\", accounts.logWrapper),\n getAccountMeta(\"compressionProgram\", accounts.compressionProgram),\n getAccountMeta(\"systemProgram\", accounts.systemProgram),\n ],\n data: getRedeemInstructionDataEncoder().encode(\n args as RedeemInstructionDataArgs,\n ),\n programAddress,\n } as RedeemInstruction<\n TProgramAddress,\n TAccountTreeAuthority,\n TAccountLeafOwner,\n TAccountLeafDelegate,\n TAccountMerkleTree,\n TAccountVoucher,\n TAccountLogWrapper,\n TAccountCompressionProgram,\n TAccountSystemProgram\n >);\n}\n\nexport type RedeemInput<\n TAccountTreeAuthority extends string = string,\n TAccountLeafOwner extends string = string,\n TAccountLeafDelegate extends string = string,\n TAccountMerkleTree extends string = string,\n TAccountVoucher extends string = string,\n TAccountLogWrapper extends string = string,\n TAccountCompressionProgram extends string = string,\n TAccountSystemProgram extends string = string,\n> = {\n /**\n * The tree's `TreeConfig` PDA, which stores its configuration and acts\n * as the tree's authority for CPIs into the compression program.\n */\n treeAuthority: Address<TAccountTreeAuthority>;\n /** Owner of the compressed NFT leaf being operated on. */\n leafOwner: TransactionSigner<TAccountLeafOwner>;\n /**\n * Delegate authority for the leaf; defaults to the leaf owner when no\n * delegate is set.\n */\n leafDelegate: Address<TAccountLeafDelegate>;\n /**\n * The concurrent Merkle tree account storing the compressed leaves,\n * owned by the account compression program.\n */\n merkleTree: Address<TAccountMerkleTree>;\n /**\n * Voucher PDA created by this instruction to record the redeemed\n * leaf's data until it is decompressed or the redeem is cancelled.\n */\n voucher: Address<TAccountVoucher>;\n /**\n * The SPL/MPL Noop program, used to log leaf data so off-chain indexers\n * can reconstruct the tree.\n */\n logWrapper?: Address<TAccountLogWrapper>;\n /**\n * The SPL/MPL Account Compression program that owns and manages the\n * Merkle tree.\n */\n compressionProgram?: Address<TAccountCompressionProgram>;\n /** The Solana System program. */\n systemProgram?: Address<TAccountSystemProgram>;\n root: RedeemInstructionDataArgs[\"root\"];\n dataHash: RedeemInstructionDataArgs[\"dataHash\"];\n creatorHash: RedeemInstructionDataArgs[\"creatorHash\"];\n nonce: RedeemInstructionDataArgs[\"nonce\"];\n index: RedeemInstructionDataArgs[\"index\"];\n};\n\n/**\n * Redeems (vouches for) a leaf, removing it from the tree and recording\n * its data in a new `voucher` PDA.\n *\n * This is the first step of decompression: once redeemed, the leaf slot\n * in the tree is emptied and the leaf's data is preserved in `voucher`\n * until `decompressV1` consumes it, or `cancelRedeem` restores it.\n */\nexport function getRedeemInstruction<\n TAccountTreeAuthority extends string,\n TAccountLeafOwner extends string,\n TAccountLeafDelegate extends string,\n TAccountMerkleTree extends string,\n TAccountVoucher extends string,\n TAccountLogWrapper extends string,\n TAccountCompressionProgram extends string,\n TAccountSystemProgram extends string,\n TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS,\n>(\n input: RedeemInput<\n TAccountTreeAuthority,\n TAccountLeafOwner,\n TAccountLeafDelegate,\n TAccountMerkleTree,\n TAccountVoucher,\n TAccountLogWrapper,\n TAccountCompressionProgram,\n TAccountSystemProgram\n >,\n config?: { programAddress?: TProgramAddress },\n): RedeemInstruction<\n TProgramAddress,\n TAccountTreeAuthority,\n TAccountLeafOwner,\n TAccountLeafDelegate,\n TAccountMerkleTree,\n TAccountVoucher,\n TAccountLogWrapper,\n TAccountCompressionProgram,\n TAccountSystemProgram\n> {\n // Program address.\n const programAddress = config?.programAddress ?? BUBBLEGUM_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n treeAuthority: { value: input.treeAuthority ?? null, isWritable: false },\n leafOwner: { value: input.leafOwner ?? null, isWritable: true },\n leafDelegate: { value: input.leafDelegate ?? null, isWritable: false },\n merkleTree: { value: input.merkleTree ?? null, isWritable: true },\n voucher: { value: input.voucher ?? null, isWritable: true },\n logWrapper: { value: input.logWrapper ?? null, isWritable: false },\n compressionProgram: {\n value: input.compressionProgram ?? null,\n isWritable: false,\n },\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<\n keyof typeof originalAccounts,\n ResolvedInstructionAccount\n >;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.logWrapper.value) {\n accounts.logWrapper.value =\n \"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV\" as Address<\"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV\">;\n }\n if (!accounts.compressionProgram.value) {\n accounts.compressionProgram.value =\n \"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK\" as Address<\"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK\">;\n }\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n \"11111111111111111111111111111111\" as Address<\"11111111111111111111111111111111\">;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, \"programId\");\n return Object.freeze({\n accounts: [\n getAccountMeta(\"treeAuthority\", accounts.treeAuthority),\n getAccountMeta(\"leafOwner\", accounts.leafOwner),\n getAccountMeta(\"leafDelegate\", accounts.leafDelegate),\n getAccountMeta(\"merkleTree\", accounts.merkleTree),\n getAccountMeta(\"voucher\", accounts.voucher),\n getAccountMeta(\"logWrapper\", accounts.logWrapper),\n getAccountMeta(\"compressionProgram\", accounts.compressionProgram),\n getAccountMeta(\"systemProgram\", accounts.systemProgram),\n ],\n data: getRedeemInstructionDataEncoder().encode(\n args as RedeemInstructionDataArgs,\n ),\n programAddress,\n } as RedeemInstruction<\n TProgramAddress,\n TAccountTreeAuthority,\n TAccountLeafOwner,\n TAccountLeafDelegate,\n TAccountMerkleTree,\n TAccountVoucher,\n TAccountLogWrapper,\n TAccountCompressionProgram,\n TAccountSystemProgram\n >);\n}\n\nexport type ParsedRedeemInstruction<\n TProgram extends string = typeof BUBBLEGUM_PROGRAM_ADDRESS,\n TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],\n> = {\n programAddress: Address<TProgram>;\n accounts: {\n /**\n * The tree's `TreeConfig` PDA, which stores its configuration and acts\n * as the tree's authority for CPIs into the compression program.\n */\n treeAuthority: TAccountMetas[0];\n /** Owner of the compressed NFT leaf being operated on. */\n leafOwner: TAccountMetas[1];\n /**\n * Delegate authority for the leaf; defaults to the leaf owner when no\n * delegate is set.\n */\n leafDelegate: TAccountMetas[2];\n /**\n * The concurrent Merkle tree account storing the compressed leaves,\n * owned by the account compression program.\n */\n merkleTree: TAccountMetas[3];\n /**\n * Voucher PDA created by this instruction to record the redeemed\n * leaf's data until it is decompressed or the redeem is cancelled.\n */\n voucher: TAccountMetas[4];\n /**\n * The SPL/MPL Noop program, used to log leaf data so off-chain indexers\n * can reconstruct the tree.\n */\n logWrapper: TAccountMetas[5];\n /**\n * The SPL/MPL Account Compression program that owns and manages the\n * Merkle tree.\n */\n compressionProgram: TAccountMetas[6];\n /** The Solana System program. */\n systemProgram: TAccountMetas[7];\n };\n data: RedeemInstructionData;\n};\n\nexport function parseRedeemInstruction<\n TProgram extends string,\n TAccountMetas extends readonly AccountMeta[],\n>(\n instruction: Instruction<TProgram> &\n InstructionWithAccounts<TAccountMetas> &\n InstructionWithData<ReadonlyUint8Array>,\n): ParsedRedeemInstruction<TProgram, TAccountMetas> {\n if (instruction.accounts.length < 8) {\n throw new SolanaError(\n SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,\n {\n actualAccountMetas: instruction.accounts.length,\n expectedAccountMetas: 8,\n },\n );\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n treeAuthority: getNextAccount(),\n leafOwner: getNextAccount(),\n leafDelegate: getNextAccount(),\n merkleTree: getNextAccount(),\n voucher: getNextAccount(),\n logWrapper: getNextAccount(),\n compressionProgram: getNextAccount(),\n systemProgram: getNextAccount(),\n },\n data: getRedeemInstructionDataDecoder().decode(instruction.data),\n };\n}\n"],"mappings":";;;;;;;;;;;;AAkDA,MAAa,uBAA2C,IAAI,WAAW;CACrE;CAAK;CAAI;CAAI;CAAK;CAAI;CAAK;CAAI;AACjC,CAAC;AAED,SAAgB,8BAAkD;CAChE,OAAO,eAAe,gBAAgB,GAAG,CAAC,CAAC,CAAC,OAAO,oBAAoB;AACzE;AA4GA,SAAgB,kCAA+E;CAC7F,OAAO,iBACL,iBAAiB;EACf,CAAC,iBAAiB,eAAe,gBAAgB,GAAG,CAAC,CAAC;EACtD,CAAC,QAAQ,gBAAgB,aAAa,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;EACtD,CAAC,YAAY,gBAAgB,aAAa,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;EAC1D,CAAC,eAAe,gBAAgB,aAAa,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;EAC7D,CAAC,SAAS,cAAc,CAAC;EACzB,CAAC,SAAS,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;CAEJ,IAAI,CAAC,SAAS,mBAAmB,OAC/B,SAAS,mBAAmB,QAC1B;CAEJ,IAAI,CAAC,SAAS,cAAc,OAC1B,SAAS,cAAc,QACrB;CAGJ,MAAM,iBAAiB,sBAAsB,gBAAgB,WAAW;CACxE,OAAO,OAAO,OAAO;EACnB,UAAU;GACR,eAAe,iBAAiB,SAAS,aAAa;GACtD,eAAe,aAAa,SAAS,SAAS;GAC9C,eAAe,gBAAgB,SAAS,YAAY;GACpD,eAAe,cAAc,SAAS,UAAU;GAChD,eAAe,WAAW,SAAS,OAAO;GAC1C,eAAe,cAAc,SAAS,UAAU;GAChD,eAAe,sBAAsB,SAAS,kBAAkB;GAChE,eAAe,iBAAiB,SAAS,aAAa;EACxD;EACA,MAAM,gCAAgC,CAAC,CAAC,OACtC,IACF;EACA;CACF,CAUC;AACH;AA8CA,SAAgB,uBAId,aAGkD;CAClD,IAAI,YAAY,SAAS,SAAS,GAChC,MAAM,IAAI,YACR,2DACA;EACE,oBAAoB,YAAY,SAAS;EACzC,sBAAsB;CACxB,CACF;CAEF,IAAI,eAAe;CACnB,MAAM,uBAAuB;EAC3B,MAAM,cAAe,YAAY,SAA2B;EAC5D,gBAAgB;EAChB,OAAO;CACT;CACA,OAAO;EACL,gBAAgB,YAAY;EAC5B,UAAU;GACR,eAAe,eAAe;GAC9B,WAAW,eAAe;GAC1B,cAAc,eAAe;GAC7B,YAAY,eAAe;GAC3B,SAAS,eAAe;GACxB,YAAY,eAAe;GAC3B,oBAAoB,eAAe;GACnC,eAAe,eAAe;EAChC;EACA,MAAM,gCAAgC,CAAC,CAAC,OAAO,YAAY,IAAI;CACjE;AACF"}
|
|
@@ -1,58 +1,154 @@
|
|
|
1
1
|
import { MetadataArgs, MetadataArgsArgs } from "../types/metadataArgs.js";
|
|
2
|
+
import "../types/index.js";
|
|
2
3
|
import { BUBBLEGUM_PROGRAM_ADDRESS } from "../programs/bubblegum.js";
|
|
4
|
+
import "../programs/index.js";
|
|
3
5
|
import { AccountMeta, AccountSignerMeta, Address, Codec, Decoder, Encoder, Instruction, InstructionWithAccounts, InstructionWithData, ReadonlyAccount, ReadonlySignerAccount, ReadonlyUint8Array, TransactionSigner, WritableAccount } from "@solana/kit";
|
|
4
|
-
|
|
5
6
|
//#region src/generated/instructions/setAndVerifyCollection.d.ts
|
|
6
7
|
declare const SET_AND_VERIFY_COLLECTION_DISCRIMINATOR: ReadonlyUint8Array;
|
|
7
8
|
declare function getSetAndVerifyCollectionDiscriminatorBytes(): ReadonlyUint8Array;
|
|
8
9
|
type SetAndVerifyCollectionInstruction<TProgram extends string = typeof BUBBLEGUM_PROGRAM_ADDRESS, TAccountTreeAuthority extends string | AccountMeta<string> = string, TAccountLeafOwner extends string | AccountMeta<string> = string, TAccountLeafDelegate extends string | AccountMeta<string> = string, TAccountMerkleTree extends string | AccountMeta<string> = string, TAccountPayer extends string | AccountMeta<string> = string, TAccountTreeDelegate extends string | AccountMeta<string> = string, TAccountCollectionAuthority extends string | AccountMeta<string> = string, TAccountCollectionAuthorityRecordPda extends string | AccountMeta<string> = "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY", TAccountCollectionMint extends string | AccountMeta<string> = string, TAccountCollectionMetadata extends string | AccountMeta<string> = string, TAccountEditionAccount extends string | AccountMeta<string> = string, TAccountBubblegumSigner extends string | AccountMeta<string> = string, TAccountLogWrapper extends string | AccountMeta<string> = "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV", TAccountCompressionProgram extends string | AccountMeta<string> = "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK", TAccountTokenMetadataProgram extends string | AccountMeta<string> = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[TAccountTreeAuthority extends string ? ReadonlyAccount<TAccountTreeAuthority> : TAccountTreeAuthority, TAccountLeafOwner extends string ? ReadonlyAccount<TAccountLeafOwner> : TAccountLeafOwner, TAccountLeafDelegate extends string ? ReadonlyAccount<TAccountLeafDelegate> : TAccountLeafDelegate, TAccountMerkleTree extends string ? WritableAccount<TAccountMerkleTree> : TAccountMerkleTree, TAccountPayer extends string ? ReadonlySignerAccount<TAccountPayer> & AccountSignerMeta<TAccountPayer> : TAccountPayer, TAccountTreeDelegate extends string ? ReadonlyAccount<TAccountTreeDelegate> : TAccountTreeDelegate, TAccountCollectionAuthority extends string ? ReadonlySignerAccount<TAccountCollectionAuthority> & AccountSignerMeta<TAccountCollectionAuthority> : TAccountCollectionAuthority, TAccountCollectionAuthorityRecordPda extends string ? ReadonlyAccount<TAccountCollectionAuthorityRecordPda> : TAccountCollectionAuthorityRecordPda, TAccountCollectionMint extends string ? ReadonlyAccount<TAccountCollectionMint> : TAccountCollectionMint, TAccountCollectionMetadata extends string ? WritableAccount<TAccountCollectionMetadata> : TAccountCollectionMetadata, TAccountEditionAccount extends string ? ReadonlyAccount<TAccountEditionAccount> : TAccountEditionAccount, TAccountBubblegumSigner extends string ? ReadonlyAccount<TAccountBubblegumSigner> : TAccountBubblegumSigner, TAccountLogWrapper extends string ? ReadonlyAccount<TAccountLogWrapper> : TAccountLogWrapper, TAccountCompressionProgram extends string ? ReadonlyAccount<TAccountCompressionProgram> : TAccountCompressionProgram, TAccountTokenMetadataProgram extends string ? ReadonlyAccount<TAccountTokenMetadataProgram> : TAccountTokenMetadataProgram, TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram, ...TRemainingAccounts]>;
|
|
9
|
-
|
|
10
|
+
type SetAndVerifyCollectionInstructionData = {
|
|
10
11
|
discriminator: ReadonlyUint8Array;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Current Merkle root of the tree, used together with the Merkle proof
|
|
14
|
+
* (passed as remaining accounts) to verify the leaf being operated on.
|
|
15
|
+
*/
|
|
16
|
+
root: Array<number>;
|
|
17
|
+
/**
|
|
18
|
+
* Keccak256 hash of the leaf's metadata, used together with `root` to
|
|
19
|
+
* verify the leaf before it is modified.
|
|
20
|
+
*/
|
|
21
|
+
dataHash: Array<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Keccak256 hash of the leaf's creators array, used together with
|
|
24
|
+
* `root` to verify the leaf before it is modified.
|
|
25
|
+
*/
|
|
26
|
+
creatorHash: Array<number>;
|
|
27
|
+
/**
|
|
28
|
+
* Tree-scoped nonce identifying the leaf, equal to the tree's
|
|
29
|
+
* `numMinted` at the time the leaf was minted. Combined with the tree
|
|
30
|
+
* address to derive the leaf's asset id.
|
|
31
|
+
*/
|
|
14
32
|
nonce: bigint;
|
|
33
|
+
/**
|
|
34
|
+
* Position of the leaf within the Merkle tree, used with the Merkle
|
|
35
|
+
* proof to locate and verify the leaf.
|
|
36
|
+
*/
|
|
15
37
|
index: number;
|
|
38
|
+
/**
|
|
39
|
+
* The leaf's current metadata args, verified against `dataHash` before
|
|
40
|
+
* `collection` is set and marked verified.
|
|
41
|
+
*/
|
|
16
42
|
message: MetadataArgs;
|
|
43
|
+
/**
|
|
44
|
+
* Collection mint to set on the leaf's metadata and mark verified in
|
|
45
|
+
* the same instruction.
|
|
46
|
+
*/
|
|
17
47
|
collection: Address;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
48
|
+
};
|
|
49
|
+
type SetAndVerifyCollectionInstructionDataArgs = {
|
|
50
|
+
/**
|
|
51
|
+
* Current Merkle root of the tree, used together with the Merkle proof
|
|
52
|
+
* (passed as remaining accounts) to verify the leaf being operated on.
|
|
53
|
+
*/
|
|
54
|
+
root: Array<number>;
|
|
55
|
+
/**
|
|
56
|
+
* Keccak256 hash of the leaf's metadata, used together with `root` to
|
|
57
|
+
* verify the leaf before it is modified.
|
|
58
|
+
*/
|
|
59
|
+
dataHash: Array<number>;
|
|
60
|
+
/**
|
|
61
|
+
* Keccak256 hash of the leaf's creators array, used together with
|
|
62
|
+
* `root` to verify the leaf before it is modified.
|
|
63
|
+
*/
|
|
64
|
+
creatorHash: Array<number>;
|
|
65
|
+
/**
|
|
66
|
+
* Tree-scoped nonce identifying the leaf, equal to the tree's
|
|
67
|
+
* `numMinted` at the time the leaf was minted. Combined with the tree
|
|
68
|
+
* address to derive the leaf's asset id.
|
|
69
|
+
*/
|
|
23
70
|
nonce: number | bigint;
|
|
71
|
+
/**
|
|
72
|
+
* Position of the leaf within the Merkle tree, used with the Merkle
|
|
73
|
+
* proof to locate and verify the leaf.
|
|
74
|
+
*/
|
|
24
75
|
index: number;
|
|
76
|
+
/**
|
|
77
|
+
* The leaf's current metadata args, verified against `dataHash` before
|
|
78
|
+
* `collection` is set and marked verified.
|
|
79
|
+
*/
|
|
25
80
|
message: MetadataArgsArgs;
|
|
81
|
+
/**
|
|
82
|
+
* Collection mint to set on the leaf's metadata and mark verified in
|
|
83
|
+
* the same instruction.
|
|
84
|
+
*/
|
|
26
85
|
collection: Address;
|
|
27
|
-
}
|
|
86
|
+
};
|
|
28
87
|
declare function getSetAndVerifyCollectionInstructionDataEncoder(): Encoder<SetAndVerifyCollectionInstructionDataArgs>;
|
|
29
88
|
declare function getSetAndVerifyCollectionInstructionDataDecoder(): Decoder<SetAndVerifyCollectionInstructionData>;
|
|
30
89
|
declare function getSetAndVerifyCollectionInstructionDataCodec(): Codec<SetAndVerifyCollectionInstructionDataArgs, SetAndVerifyCollectionInstructionData>;
|
|
31
|
-
|
|
90
|
+
type SetAndVerifyCollectionAsyncInput<TAccountTreeAuthority extends string = string, TAccountLeafOwner extends string = string, TAccountLeafDelegate extends string = string, TAccountMerkleTree extends string = string, TAccountPayer extends string = string, TAccountTreeDelegate extends string = string, TAccountCollectionAuthority extends string = string, TAccountCollectionAuthorityRecordPda extends string = string, TAccountCollectionMint extends string = string, TAccountCollectionMetadata extends string = string, TAccountEditionAccount extends string = string, TAccountBubblegumSigner extends string = string, TAccountLogWrapper extends string = string, TAccountCompressionProgram extends string = string, TAccountTokenMetadataProgram extends string = string, TAccountSystemProgram extends string = string> = {
|
|
91
|
+
/**
|
|
92
|
+
* The tree's `TreeConfig` PDA, which stores its configuration and acts
|
|
93
|
+
* as the tree's authority for CPIs into the compression program.
|
|
94
|
+
*/
|
|
32
95
|
treeAuthority?: Address<TAccountTreeAuthority>;
|
|
96
|
+
/** Owner of the compressed NFT leaf being operated on. */
|
|
33
97
|
leafOwner: Address<TAccountLeafOwner>;
|
|
98
|
+
/**
|
|
99
|
+
* Delegate authority for the leaf; defaults to the leaf owner when no
|
|
100
|
+
* delegate is set.
|
|
101
|
+
*/
|
|
34
102
|
leafDelegate: Address<TAccountLeafDelegate>;
|
|
103
|
+
/**
|
|
104
|
+
* The concurrent Merkle tree account storing the compressed leaves,
|
|
105
|
+
* owned by the account compression program.
|
|
106
|
+
*/
|
|
35
107
|
merkleTree: Address<TAccountMerkleTree>;
|
|
108
|
+
/** Account that pays for the transaction and any account rent. */
|
|
36
109
|
payer: TransactionSigner<TAccountPayer>;
|
|
37
110
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*/
|
|
111
|
+
* Checked as a signer here because `setAndVerifyCollection` actually
|
|
112
|
+
* changes the leaf's metadata, unlike plain collection verification.
|
|
113
|
+
*/
|
|
42
114
|
treeDelegate: Address<TAccountTreeDelegate>;
|
|
115
|
+
/**
|
|
116
|
+
* Authority of the collection the asset is being added to or removed
|
|
117
|
+
* from (typically the collection's update authority or a delegate).
|
|
118
|
+
*/
|
|
43
119
|
collectionAuthority: TransactionSigner<TAccountCollectionAuthority>;
|
|
44
120
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
121
|
+
* If there is no collection authority record PDA, pass the Bubblegum
|
|
122
|
+
* program address instead.
|
|
123
|
+
*/
|
|
48
124
|
collectionAuthorityRecordPda?: Address<TAccountCollectionAuthorityRecordPda>;
|
|
125
|
+
/** Mint account of the Token Metadata collection NFT. */
|
|
49
126
|
collectionMint: Address<TAccountCollectionMint>;
|
|
127
|
+
/** Metadata account of the Token Metadata collection NFT. */
|
|
50
128
|
collectionMetadata?: Address<TAccountCollectionMetadata>;
|
|
129
|
+
/** Master edition account of the Token Metadata collection NFT. */
|
|
51
130
|
editionAccount?: Address<TAccountEditionAccount>;
|
|
131
|
+
/**
|
|
132
|
+
* PDA Bubblegum uses to sign the CPI into the Token Metadata program
|
|
133
|
+
* that (un)verifies the collection.
|
|
134
|
+
*/
|
|
52
135
|
bubblegumSigner?: Address<TAccountBubblegumSigner>;
|
|
136
|
+
/**
|
|
137
|
+
* The SPL/MPL Noop program, used to log leaf data so off-chain indexers
|
|
138
|
+
* can reconstruct the tree.
|
|
139
|
+
*/
|
|
53
140
|
logWrapper?: Address<TAccountLogWrapper>;
|
|
141
|
+
/**
|
|
142
|
+
* The SPL/MPL Account Compression program that owns and manages the
|
|
143
|
+
* Merkle tree.
|
|
144
|
+
*/
|
|
54
145
|
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
146
|
+
/**
|
|
147
|
+
* The Token Metadata program, invoked to read or (un)verify the
|
|
148
|
+
* legacy collection accounts.
|
|
149
|
+
*/
|
|
55
150
|
tokenMetadataProgram?: Address<TAccountTokenMetadataProgram>;
|
|
151
|
+
/** The Solana System program. */
|
|
56
152
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
57
153
|
root: SetAndVerifyCollectionInstructionDataArgs["root"];
|
|
58
154
|
dataHash: SetAndVerifyCollectionInstructionDataArgs["dataHash"];
|
|
@@ -61,35 +157,79 @@ interface SetAndVerifyCollectionAsyncInput<TAccountTreeAuthority extends string
|
|
|
61
157
|
index: SetAndVerifyCollectionInstructionDataArgs["index"];
|
|
62
158
|
message: SetAndVerifyCollectionInstructionDataArgs["message"];
|
|
63
159
|
collection: SetAndVerifyCollectionInstructionDataArgs["collection"];
|
|
64
|
-
}
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Sets a collection on a leaf's metadata and verifies it in one
|
|
163
|
+
* instruction.
|
|
164
|
+
*
|
|
165
|
+
* Equivalent to updating the leaf's `collection` field to `collection`
|
|
166
|
+
* and then verifying it, without a separate `verifyCollection` call.
|
|
167
|
+
*/
|
|
65
168
|
declare function getSetAndVerifyCollectionInstructionAsync<TAccountTreeAuthority extends string, TAccountLeafOwner extends string, TAccountLeafDelegate extends string, TAccountMerkleTree extends string, TAccountPayer extends string, TAccountTreeDelegate extends string, TAccountCollectionAuthority extends string, TAccountCollectionAuthorityRecordPda extends string, TAccountCollectionMint extends string, TAccountCollectionMetadata extends string, TAccountEditionAccount extends string, TAccountBubblegumSigner extends string, TAccountLogWrapper extends string, TAccountCompressionProgram extends string, TAccountTokenMetadataProgram extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS>(input: SetAndVerifyCollectionAsyncInput<TAccountTreeAuthority, TAccountLeafOwner, TAccountLeafDelegate, TAccountMerkleTree, TAccountPayer, TAccountTreeDelegate, TAccountCollectionAuthority, TAccountCollectionAuthorityRecordPda, TAccountCollectionMint, TAccountCollectionMetadata, TAccountEditionAccount, TAccountBubblegumSigner, TAccountLogWrapper, TAccountCompressionProgram, TAccountTokenMetadataProgram, TAccountSystemProgram>, config?: {
|
|
66
169
|
programAddress?: TProgramAddress;
|
|
67
170
|
}): Promise<SetAndVerifyCollectionInstruction<TProgramAddress, TAccountTreeAuthority, TAccountLeafOwner, TAccountLeafDelegate, TAccountMerkleTree, TAccountPayer, TAccountTreeDelegate, TAccountCollectionAuthority, TAccountCollectionAuthorityRecordPda, TAccountCollectionMint, TAccountCollectionMetadata, TAccountEditionAccount, TAccountBubblegumSigner, TAccountLogWrapper, TAccountCompressionProgram, TAccountTokenMetadataProgram, TAccountSystemProgram>>;
|
|
68
|
-
|
|
171
|
+
type SetAndVerifyCollectionInput<TAccountTreeAuthority extends string = string, TAccountLeafOwner extends string = string, TAccountLeafDelegate extends string = string, TAccountMerkleTree extends string = string, TAccountPayer extends string = string, TAccountTreeDelegate extends string = string, TAccountCollectionAuthority extends string = string, TAccountCollectionAuthorityRecordPda extends string = string, TAccountCollectionMint extends string = string, TAccountCollectionMetadata extends string = string, TAccountEditionAccount extends string = string, TAccountBubblegumSigner extends string = string, TAccountLogWrapper extends string = string, TAccountCompressionProgram extends string = string, TAccountTokenMetadataProgram extends string = string, TAccountSystemProgram extends string = string> = {
|
|
172
|
+
/**
|
|
173
|
+
* The tree's `TreeConfig` PDA, which stores its configuration and acts
|
|
174
|
+
* as the tree's authority for CPIs into the compression program.
|
|
175
|
+
*/
|
|
69
176
|
treeAuthority: Address<TAccountTreeAuthority>;
|
|
177
|
+
/** Owner of the compressed NFT leaf being operated on. */
|
|
70
178
|
leafOwner: Address<TAccountLeafOwner>;
|
|
179
|
+
/**
|
|
180
|
+
* Delegate authority for the leaf; defaults to the leaf owner when no
|
|
181
|
+
* delegate is set.
|
|
182
|
+
*/
|
|
71
183
|
leafDelegate: Address<TAccountLeafDelegate>;
|
|
184
|
+
/**
|
|
185
|
+
* The concurrent Merkle tree account storing the compressed leaves,
|
|
186
|
+
* owned by the account compression program.
|
|
187
|
+
*/
|
|
72
188
|
merkleTree: Address<TAccountMerkleTree>;
|
|
189
|
+
/** Account that pays for the transaction and any account rent. */
|
|
73
190
|
payer: TransactionSigner<TAccountPayer>;
|
|
74
191
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*/
|
|
192
|
+
* Checked as a signer here because `setAndVerifyCollection` actually
|
|
193
|
+
* changes the leaf's metadata, unlike plain collection verification.
|
|
194
|
+
*/
|
|
79
195
|
treeDelegate: Address<TAccountTreeDelegate>;
|
|
196
|
+
/**
|
|
197
|
+
* Authority of the collection the asset is being added to or removed
|
|
198
|
+
* from (typically the collection's update authority or a delegate).
|
|
199
|
+
*/
|
|
80
200
|
collectionAuthority: TransactionSigner<TAccountCollectionAuthority>;
|
|
81
201
|
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
202
|
+
* If there is no collection authority record PDA, pass the Bubblegum
|
|
203
|
+
* program address instead.
|
|
204
|
+
*/
|
|
85
205
|
collectionAuthorityRecordPda?: Address<TAccountCollectionAuthorityRecordPda>;
|
|
206
|
+
/** Mint account of the Token Metadata collection NFT. */
|
|
86
207
|
collectionMint: Address<TAccountCollectionMint>;
|
|
208
|
+
/** Metadata account of the Token Metadata collection NFT. */
|
|
87
209
|
collectionMetadata: Address<TAccountCollectionMetadata>;
|
|
210
|
+
/** Master edition account of the Token Metadata collection NFT. */
|
|
88
211
|
editionAccount: Address<TAccountEditionAccount>;
|
|
212
|
+
/**
|
|
213
|
+
* PDA Bubblegum uses to sign the CPI into the Token Metadata program
|
|
214
|
+
* that (un)verifies the collection.
|
|
215
|
+
*/
|
|
89
216
|
bubblegumSigner: Address<TAccountBubblegumSigner>;
|
|
217
|
+
/**
|
|
218
|
+
* The SPL/MPL Noop program, used to log leaf data so off-chain indexers
|
|
219
|
+
* can reconstruct the tree.
|
|
220
|
+
*/
|
|
90
221
|
logWrapper?: Address<TAccountLogWrapper>;
|
|
222
|
+
/**
|
|
223
|
+
* The SPL/MPL Account Compression program that owns and manages the
|
|
224
|
+
* Merkle tree.
|
|
225
|
+
*/
|
|
91
226
|
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
227
|
+
/**
|
|
228
|
+
* The Token Metadata program, invoked to read or (un)verify the
|
|
229
|
+
* legacy collection accounts.
|
|
230
|
+
*/
|
|
92
231
|
tokenMetadataProgram?: Address<TAccountTokenMetadataProgram>;
|
|
232
|
+
/** The Solana System program. */
|
|
93
233
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
94
234
|
root: SetAndVerifyCollectionInstructionDataArgs["root"];
|
|
95
235
|
dataHash: SetAndVerifyCollectionInstructionDataArgs["dataHash"];
|
|
@@ -98,41 +238,85 @@ interface SetAndVerifyCollectionInput<TAccountTreeAuthority extends string = str
|
|
|
98
238
|
index: SetAndVerifyCollectionInstructionDataArgs["index"];
|
|
99
239
|
message: SetAndVerifyCollectionInstructionDataArgs["message"];
|
|
100
240
|
collection: SetAndVerifyCollectionInstructionDataArgs["collection"];
|
|
101
|
-
}
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Sets a collection on a leaf's metadata and verifies it in one
|
|
244
|
+
* instruction.
|
|
245
|
+
*
|
|
246
|
+
* Equivalent to updating the leaf's `collection` field to `collection`
|
|
247
|
+
* and then verifying it, without a separate `verifyCollection` call.
|
|
248
|
+
*/
|
|
102
249
|
declare function getSetAndVerifyCollectionInstruction<TAccountTreeAuthority extends string, TAccountLeafOwner extends string, TAccountLeafDelegate extends string, TAccountMerkleTree extends string, TAccountPayer extends string, TAccountTreeDelegate extends string, TAccountCollectionAuthority extends string, TAccountCollectionAuthorityRecordPda extends string, TAccountCollectionMint extends string, TAccountCollectionMetadata extends string, TAccountEditionAccount extends string, TAccountBubblegumSigner extends string, TAccountLogWrapper extends string, TAccountCompressionProgram extends string, TAccountTokenMetadataProgram extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS>(input: SetAndVerifyCollectionInput<TAccountTreeAuthority, TAccountLeafOwner, TAccountLeafDelegate, TAccountMerkleTree, TAccountPayer, TAccountTreeDelegate, TAccountCollectionAuthority, TAccountCollectionAuthorityRecordPda, TAccountCollectionMint, TAccountCollectionMetadata, TAccountEditionAccount, TAccountBubblegumSigner, TAccountLogWrapper, TAccountCompressionProgram, TAccountTokenMetadataProgram, TAccountSystemProgram>, config?: {
|
|
103
250
|
programAddress?: TProgramAddress;
|
|
104
251
|
}): SetAndVerifyCollectionInstruction<TProgramAddress, TAccountTreeAuthority, TAccountLeafOwner, TAccountLeafDelegate, TAccountMerkleTree, TAccountPayer, TAccountTreeDelegate, TAccountCollectionAuthority, TAccountCollectionAuthorityRecordPda, TAccountCollectionMint, TAccountCollectionMetadata, TAccountEditionAccount, TAccountBubblegumSigner, TAccountLogWrapper, TAccountCompressionProgram, TAccountTokenMetadataProgram, TAccountSystemProgram>;
|
|
105
|
-
|
|
252
|
+
type ParsedSetAndVerifyCollectionInstruction<TProgram extends string = typeof BUBBLEGUM_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
106
253
|
programAddress: Address<TProgram>;
|
|
107
254
|
accounts: {
|
|
255
|
+
/**
|
|
256
|
+
* The tree's `TreeConfig` PDA, which stores its configuration and acts
|
|
257
|
+
* as the tree's authority for CPIs into the compression program.
|
|
258
|
+
*/
|
|
108
259
|
treeAuthority: TAccountMetas[0];
|
|
260
|
+
/** Owner of the compressed NFT leaf being operated on. */
|
|
109
261
|
leafOwner: TAccountMetas[1];
|
|
262
|
+
/**
|
|
263
|
+
* Delegate authority for the leaf; defaults to the leaf owner when no
|
|
264
|
+
* delegate is set.
|
|
265
|
+
*/
|
|
110
266
|
leafDelegate: TAccountMetas[2];
|
|
267
|
+
/**
|
|
268
|
+
* The concurrent Merkle tree account storing the compressed leaves,
|
|
269
|
+
* owned by the account compression program.
|
|
270
|
+
*/
|
|
111
271
|
merkleTree: TAccountMetas[3];
|
|
272
|
+
/** Account that pays for the transaction and any account rent. */
|
|
112
273
|
payer: TAccountMetas[4];
|
|
113
274
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
*/
|
|
275
|
+
* Checked as a signer here because `setAndVerifyCollection` actually
|
|
276
|
+
* changes the leaf's metadata, unlike plain collection verification.
|
|
277
|
+
*/
|
|
118
278
|
treeDelegate: TAccountMetas[5];
|
|
279
|
+
/**
|
|
280
|
+
* Authority of the collection the asset is being added to or removed
|
|
281
|
+
* from (typically the collection's update authority or a delegate).
|
|
282
|
+
*/
|
|
119
283
|
collectionAuthority: TAccountMetas[6];
|
|
120
284
|
/**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
285
|
+
* If there is no collection authority record PDA, pass the Bubblegum
|
|
286
|
+
* program address instead.
|
|
287
|
+
*/
|
|
124
288
|
collectionAuthorityRecordPda: TAccountMetas[7];
|
|
289
|
+
/** Mint account of the Token Metadata collection NFT. */
|
|
125
290
|
collectionMint: TAccountMetas[8];
|
|
291
|
+
/** Metadata account of the Token Metadata collection NFT. */
|
|
126
292
|
collectionMetadata: TAccountMetas[9];
|
|
293
|
+
/** Master edition account of the Token Metadata collection NFT. */
|
|
127
294
|
editionAccount: TAccountMetas[10];
|
|
295
|
+
/**
|
|
296
|
+
* PDA Bubblegum uses to sign the CPI into the Token Metadata program
|
|
297
|
+
* that (un)verifies the collection.
|
|
298
|
+
*/
|
|
128
299
|
bubblegumSigner: TAccountMetas[11];
|
|
300
|
+
/**
|
|
301
|
+
* The SPL/MPL Noop program, used to log leaf data so off-chain indexers
|
|
302
|
+
* can reconstruct the tree.
|
|
303
|
+
*/
|
|
129
304
|
logWrapper: TAccountMetas[12];
|
|
305
|
+
/**
|
|
306
|
+
* The SPL/MPL Account Compression program that owns and manages the
|
|
307
|
+
* Merkle tree.
|
|
308
|
+
*/
|
|
130
309
|
compressionProgram: TAccountMetas[13];
|
|
310
|
+
/**
|
|
311
|
+
* The Token Metadata program, invoked to read or (un)verify the
|
|
312
|
+
* legacy collection accounts.
|
|
313
|
+
*/
|
|
131
314
|
tokenMetadataProgram: TAccountMetas[14];
|
|
315
|
+
/** The Solana System program. */
|
|
132
316
|
systemProgram: TAccountMetas[15];
|
|
133
317
|
};
|
|
134
318
|
data: SetAndVerifyCollectionInstructionData;
|
|
135
|
-
}
|
|
319
|
+
};
|
|
136
320
|
declare function parseSetAndVerifyCollectionInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedSetAndVerifyCollectionInstruction<TProgram, TAccountMetas>;
|
|
137
321
|
//#endregion
|
|
138
322
|
export { ParsedSetAndVerifyCollectionInstruction, SET_AND_VERIFY_COLLECTION_DISCRIMINATOR, SetAndVerifyCollectionAsyncInput, SetAndVerifyCollectionInput, SetAndVerifyCollectionInstruction, SetAndVerifyCollectionInstructionData, SetAndVerifyCollectionInstructionDataArgs, getSetAndVerifyCollectionDiscriminatorBytes, getSetAndVerifyCollectionInstruction, getSetAndVerifyCollectionInstructionAsync, getSetAndVerifyCollectionInstructionDataCodec, getSetAndVerifyCollectionInstructionDataDecoder, getSetAndVerifyCollectionInstructionDataEncoder, parseSetAndVerifyCollectionInstruction };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setAndVerifyCollection.d.ts","names":[],"sources":["../../../src/generated/instructions/setAndVerifyCollection.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"setAndVerifyCollection.d.ts","names":[],"sources":["../../../src/generated/instructions/setAndVerifyCollection.ts"],"mappings":";;;;;;cAgEa,yCAAyC;iBAGtC,+CAA+C;KAMnD,kCACV,iCAAiC,2BACjC,uCAAuC,8BACvC,mCAAmC,8BACnC,sCAAsC,8BACtC,oCAAoC,8BACpC,+BAA+B,8BAC/B,sCAAsC,8BACtC,6CAA6C,8BAC7C,sDAAsD,sEAEtD,wCAAwC,8BACxC,4CAA4C,8BAC5C,wCAAwC,8BACxC,yCAAyC,8BACzC,oCAAoC,qEAEpC,4CAA4C,qEAE5C,8CAA8C,qEAE9C,uCAAuC,0DAEvC,oCAAoC,8BAClC,YAAY,YACd,oBAAoB,sBACpB,yBAEI,uCACI,gBAAgB,yBAChB,uBACJ,mCACI,gBAAgB,qBAChB,mBACJ,sCACI,gBAAgB,wBAChB,sBACJ,oCACI,gBAAgB,sBAChB,oBACJ,+BACI,sBAAsB,iBACpB,kBAAkB,iBACpB,eACJ,sCACI,gBAAgB,wBAChB,sBACJ,6CACI,sBAAsB,+BACpB,kBAAkB,+BACpB,6BACJ,sDACI,gBAAgB,wCAChB,sCACJ,wCACI,gBAAgB,0BAChB,wBACJ,4CACI,gBAAgB,8B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+B,yBAAyB;EAExD,gBAAgB,QAAQ;EACxB;;;;;IAKE,eAAe;;IAEf,WAAW;;;;;IAKX,cAAc;;;;;IAKd,YAAY;;IAEZ,OAAO;;;;;IAKP,cAAc;;;;;IAKd,qBAAqB;;;;;IAKrB,8BAA8B;;IAE9B,gBAAgB;;IAEhB,oBAAoB;;IAEpB,gBAAgB;;;;;IAKhB,iBAAiB;;;;;IAKjB,YAAY;;;;;IAKZ,oBAAoB;;;;;IAKpB,sBAAsB;;IAEtB,eAAe;;EAEjB,MAAM;;iBAGQ,uCACd,yBACA,+BAA+B,eAE/B,aAAa,YAAY,YACvB,wBAAwB,iBACxB,oBAAoB,sBACrB,wCAAwC,UAAU"}
|
|
@@ -7,6 +7,13 @@ import "../programs/bubblegum.js";
|
|
|
7
7
|
import { SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, SolanaError, address, combineCodec, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder } from "@solana/kit";
|
|
8
8
|
import { getAccountMetaFactory, getAddressFromResolvedInstructionAccount } from "@solana/program-client-core";
|
|
9
9
|
//#region src/generated/instructions/setAndVerifyCollection.ts
|
|
10
|
+
/**
|
|
11
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
12
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
13
|
+
* to add features, then rerun Codama to update it.
|
|
14
|
+
*
|
|
15
|
+
* @see https://github.com/codama-idl/codama
|
|
16
|
+
*/
|
|
10
17
|
const SET_AND_VERIFY_COLLECTION_DISCRIMINATOR = new Uint8Array([
|
|
11
18
|
235,
|
|
12
19
|
242,
|
|
@@ -50,6 +57,13 @@ function getSetAndVerifyCollectionInstructionDataDecoder() {
|
|
|
50
57
|
function getSetAndVerifyCollectionInstructionDataCodec() {
|
|
51
58
|
return combineCodec(getSetAndVerifyCollectionInstructionDataEncoder(), getSetAndVerifyCollectionInstructionDataDecoder());
|
|
52
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Sets a collection on a leaf's metadata and verifies it in one
|
|
62
|
+
* instruction.
|
|
63
|
+
*
|
|
64
|
+
* Equivalent to updating the leaf's `collection` field to `collection`
|
|
65
|
+
* and then verifying it, without a separate `verifyCollection` call.
|
|
66
|
+
*/
|
|
53
67
|
async function getSetAndVerifyCollectionInstructionAsync(input, config) {
|
|
54
68
|
const programAddress = config?.programAddress ?? "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY";
|
|
55
69
|
const accounts = {
|
|
@@ -161,6 +175,13 @@ async function getSetAndVerifyCollectionInstructionAsync(input, config) {
|
|
|
161
175
|
programAddress
|
|
162
176
|
});
|
|
163
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Sets a collection on a leaf's metadata and verifies it in one
|
|
180
|
+
* instruction.
|
|
181
|
+
*
|
|
182
|
+
* Equivalent to updating the leaf's `collection` field to `collection`
|
|
183
|
+
* and then verifying it, without a separate `verifyCollection` call.
|
|
184
|
+
*/
|
|
164
185
|
function getSetAndVerifyCollectionInstruction(input, config) {
|
|
165
186
|
const programAddress = config?.programAddress ?? "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY";
|
|
166
187
|
const accounts = {
|