@macalinao/clients-mpl-bubblegum 0.2.0 → 0.3.1
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 -10
- package/dist/generated/accounts/treeConfig.d.ts +42 -38
- package/dist/generated/accounts/treeConfig.d.ts.map +1 -1
- package/dist/generated/accounts/treeConfig.js +70 -53
- package/dist/generated/accounts/treeConfig.js.map +1 -1
- package/dist/generated/accounts/voucher.d.ts +33 -30
- package/dist/generated/accounts/voucher.d.ts.map +1 -1
- package/dist/generated/accounts/voucher.js +61 -45
- package/dist/generated/accounts/voucher.js.map +1 -1
- package/dist/generated/errors/bubblegum.d.ts +71 -74
- package/dist/generated/errors/bubblegum.d.ts.map +1 -1
- package/dist/generated/errors/bubblegum.js +126 -133
- package/dist/generated/errors/bubblegum.js.map +1 -1
- package/dist/generated/errors/index.d.ts +1 -9
- package/dist/generated/index.d.ts +63 -13
- package/dist/generated/instructions/burn.d.ts +70 -65
- package/dist/generated/instructions/burn.d.ts.map +1 -1
- package/dist/generated/instructions/burn.js +168 -98
- package/dist/generated/instructions/burn.js.map +1 -1
- package/dist/generated/instructions/burnV2.d.ts +107 -96
- package/dist/generated/instructions/burnV2.d.ts.map +1 -1
- package/dist/generated/instructions/burnV2.js +239 -136
- package/dist/generated/instructions/burnV2.js.map +1 -1
- package/dist/generated/instructions/cancelRedeem.d.ts +54 -53
- package/dist/generated/instructions/cancelRedeem.d.ts.map +1 -1
- package/dist/generated/instructions/cancelRedeem.js +154 -90
- package/dist/generated/instructions/cancelRedeem.js.map +1 -1
- package/dist/generated/instructions/closeTreeV2.d.ts +64 -60
- package/dist/generated/instructions/closeTreeV2.d.ts.map +1 -1
- package/dist/generated/instructions/closeTreeV2.js +152 -84
- package/dist/generated/instructions/closeTreeV2.js.map +1 -1
- package/dist/generated/instructions/collectV2.d.ts +28 -35
- package/dist/generated/instructions/collectV2.d.ts.map +1 -1
- package/dist/generated/instructions/collectV2.js +63 -60
- package/dist/generated/instructions/collectV2.js.map +1 -1
- package/dist/generated/instructions/compress.d.ts +71 -71
- package/dist/generated/instructions/compress.d.ts.map +1 -1
- package/dist/generated/instructions/compress.js +233 -116
- package/dist/generated/instructions/compress.js.map +1 -1
- package/dist/generated/instructions/createTree.d.ts +62 -59
- package/dist/generated/instructions/createTree.d.ts.map +1 -1
- package/dist/generated/instructions/createTree.js +164 -94
- package/dist/generated/instructions/createTree.js.map +1 -1
- package/dist/generated/instructions/createTreeV2.d.ts +64 -61
- package/dist/generated/instructions/createTreeV2.d.ts.map +1 -1
- package/dist/generated/instructions/createTreeV2.js +168 -100
- package/dist/generated/instructions/createTreeV2.js.map +1 -1
- package/dist/generated/instructions/decompressV1.d.ts +73 -72
- package/dist/generated/instructions/decompressV1.d.ts.map +1 -1
- package/dist/generated/instructions/decompressV1.js +251 -128
- package/dist/generated/instructions/decompressV1.js.map +1 -1
- package/dist/generated/instructions/delegate.d.ts +73 -68
- package/dist/generated/instructions/delegate.d.ts.map +1 -1
- package/dist/generated/instructions/delegate.js +179 -107
- package/dist/generated/instructions/delegate.js.map +1 -1
- package/dist/generated/instructions/delegateAndFreezeV2.d.ts +92 -84
- package/dist/generated/instructions/delegateAndFreezeV2.d.ts.map +1 -1
- package/dist/generated/instructions/delegateAndFreezeV2.js +201 -136
- package/dist/generated/instructions/delegateAndFreezeV2.js.map +1 -1
- package/dist/generated/instructions/delegateV2.d.ts +92 -84
- package/dist/generated/instructions/delegateV2.d.ts.map +1 -1
- package/dist/generated/instructions/delegateV2.js +200 -134
- package/dist/generated/instructions/delegateV2.js.map +1 -1
- package/dist/generated/instructions/freezeV2.d.ts +99 -88
- package/dist/generated/instructions/freezeV2.d.ts.map +1 -1
- package/dist/generated/instructions/freezeV2.js +209 -123
- package/dist/generated/instructions/freezeV2.js.map +1 -1
- package/dist/generated/instructions/index.d.ts +36 -44
- package/dist/generated/instructions/mintToCollectionV1.d.ts +94 -89
- package/dist/generated/instructions/mintToCollectionV1.d.ts.map +1 -1
- package/dist/generated/instructions/mintToCollectionV1.js +277 -139
- package/dist/generated/instructions/mintToCollectionV1.js.map +1 -1
- package/dist/generated/instructions/mintV1.d.ts +61 -60
- package/dist/generated/instructions/mintV1.d.ts.map +1 -1
- package/dist/generated/instructions/mintV1.js +177 -97
- package/dist/generated/instructions/mintV1.js.map +1 -1
- package/dist/generated/instructions/mintV2.d.ts +86 -82
- package/dist/generated/instructions/mintV2.d.ts.map +1 -1
- package/dist/generated/instructions/mintV2.js +244 -135
- package/dist/generated/instructions/mintV2.js.map +1 -1
- package/dist/generated/instructions/redeem.d.ts +73 -68
- package/dist/generated/instructions/redeem.d.ts.map +1 -1
- package/dist/generated/instructions/redeem.js +179 -101
- package/dist/generated/instructions/redeem.js.map +1 -1
- package/dist/generated/instructions/setAndVerifyCollection.d.ts +133 -117
- package/dist/generated/instructions/setAndVerifyCollection.d.ts.map +1 -1
- package/dist/generated/instructions/setAndVerifyCollection.js +295 -151
- package/dist/generated/instructions/setAndVerifyCollection.js.map +1 -1
- package/dist/generated/instructions/setCollectionV2.d.ts +125 -110
- package/dist/generated/instructions/setCollectionV2.d.ts.map +1 -1
- package/dist/generated/instructions/setCollectionV2.js +257 -146
- package/dist/generated/instructions/setCollectionV2.js.map +1 -1
- package/dist/generated/instructions/setDecompressableState.d.ts +32 -39
- package/dist/generated/instructions/setDecompressableState.d.ts.map +1 -1
- package/dist/generated/instructions/setDecompressableState.js +66 -69
- package/dist/generated/instructions/setDecompressableState.js.map +1 -1
- package/dist/generated/instructions/setDecompressibleState.d.ts +32 -39
- package/dist/generated/instructions/setDecompressibleState.d.ts.map +1 -1
- package/dist/generated/instructions/setDecompressibleState.js +66 -69
- package/dist/generated/instructions/setDecompressibleState.js.map +1 -1
- package/dist/generated/instructions/setNonTransferableV2.d.ts +101 -90
- package/dist/generated/instructions/setNonTransferableV2.d.ts.map +1 -1
- package/dist/generated/instructions/setNonTransferableV2.js +210 -125
- package/dist/generated/instructions/setNonTransferableV2.js.map +1 -1
- package/dist/generated/instructions/setTreeDelegate.d.ts +44 -44
- package/dist/generated/instructions/setTreeDelegate.d.ts.map +1 -1
- package/dist/generated/instructions/setTreeDelegate.js +127 -77
- package/dist/generated/instructions/setTreeDelegate.js.map +1 -1
- package/dist/generated/instructions/thawAndRevokeV2.d.ts +87 -79
- package/dist/generated/instructions/thawAndRevokeV2.d.ts.map +1 -1
- package/dist/generated/instructions/thawAndRevokeV2.js +190 -124
- package/dist/generated/instructions/thawAndRevokeV2.js.map +1 -1
- package/dist/generated/instructions/thawV2.d.ts +99 -88
- package/dist/generated/instructions/thawV2.d.ts.map +1 -1
- package/dist/generated/instructions/thawV2.js +209 -123
- package/dist/generated/instructions/thawV2.js.map +1 -1
- package/dist/generated/instructions/transfer.d.ts +73 -68
- package/dist/generated/instructions/transfer.d.ts.map +1 -1
- package/dist/generated/instructions/transfer.js +179 -101
- package/dist/generated/instructions/transfer.js.map +1 -1
- package/dist/generated/instructions/transferV2.d.ts +104 -93
- package/dist/generated/instructions/transferV2.d.ts.map +1 -1
- package/dist/generated/instructions/transferV2.js +220 -126
- package/dist/generated/instructions/transferV2.js.map +1 -1
- package/dist/generated/instructions/unverifyCollection.d.ts +129 -114
- package/dist/generated/instructions/unverifyCollection.d.ts.map +1 -1
- package/dist/generated/instructions/unverifyCollection.js +293 -146
- package/dist/generated/instructions/unverifyCollection.js.map +1 -1
- package/dist/generated/instructions/unverifyCreator.d.ts +81 -75
- package/dist/generated/instructions/unverifyCreator.d.ts.map +1 -1
- package/dist/generated/instructions/unverifyCreator.js +194 -106
- package/dist/generated/instructions/unverifyCreator.js.map +1 -1
- package/dist/generated/instructions/unverifyCreatorV2.d.ts +85 -79
- package/dist/generated/instructions/unverifyCreatorV2.d.ts.map +1 -1
- package/dist/generated/instructions/unverifyCreatorV2.js +198 -118
- package/dist/generated/instructions/unverifyCreatorV2.js.map +1 -1
- package/dist/generated/instructions/updateAssetDataV2.d.ts +108 -95
- package/dist/generated/instructions/updateAssetDataV2.d.ts.map +1 -1
- package/dist/generated/instructions/updateAssetDataV2.js +215 -136
- package/dist/generated/instructions/updateAssetDataV2.js.map +1 -1
- package/dist/generated/instructions/updateMetadata.d.ts +106 -96
- package/dist/generated/instructions/updateMetadata.d.ts.map +1 -1
- package/dist/generated/instructions/updateMetadata.js +243 -135
- package/dist/generated/instructions/updateMetadata.js.map +1 -1
- package/dist/generated/instructions/updateMetadataV2.d.ts +103 -91
- package/dist/generated/instructions/updateMetadataV2.d.ts.map +1 -1
- package/dist/generated/instructions/updateMetadataV2.js +212 -123
- package/dist/generated/instructions/updateMetadataV2.js.map +1 -1
- package/dist/generated/instructions/verifyCollection.d.ts +129 -114
- package/dist/generated/instructions/verifyCollection.d.ts.map +1 -1
- package/dist/generated/instructions/verifyCollection.js +293 -146
- package/dist/generated/instructions/verifyCollection.js.map +1 -1
- package/dist/generated/instructions/verifyCreator.d.ts +81 -75
- package/dist/generated/instructions/verifyCreator.d.ts.map +1 -1
- package/dist/generated/instructions/verifyCreator.js +193 -107
- package/dist/generated/instructions/verifyCreator.js.map +1 -1
- package/dist/generated/instructions/verifyCreatorV2.d.ts +85 -79
- package/dist/generated/instructions/verifyCreatorV2.d.ts.map +1 -1
- package/dist/generated/instructions/verifyCreatorV2.js +198 -118
- package/dist/generated/instructions/verifyCreatorV2.js.map +1 -1
- package/dist/generated/pdas/assetId.d.ts +16 -0
- package/dist/generated/pdas/assetId.d.ts.map +1 -0
- package/dist/generated/pdas/assetId.js +18 -0
- package/dist/generated/pdas/assetId.js.map +1 -0
- package/dist/generated/pdas/bubblegumSigner.d.ts +10 -0
- package/dist/generated/pdas/bubblegumSigner.d.ts.map +1 -0
- package/dist/generated/pdas/bubblegumSigner.js +14 -0
- package/dist/generated/pdas/bubblegumSigner.js.map +1 -0
- package/dist/generated/pdas/index.d.ts +7 -0
- package/dist/generated/pdas/masterEdition.d.ts +14 -0
- package/dist/generated/pdas/masterEdition.d.ts.map +1 -0
- package/dist/generated/pdas/masterEdition.js +19 -0
- package/dist/generated/pdas/masterEdition.js.map +1 -0
- package/dist/generated/pdas/metadata.d.ts +14 -0
- package/dist/generated/pdas/metadata.d.ts.map +1 -0
- package/dist/generated/pdas/metadata.js +18 -0
- package/dist/generated/pdas/metadata.js.map +1 -0
- package/dist/generated/pdas/mintAuthority.d.ts +14 -0
- package/dist/generated/pdas/mintAuthority.d.ts.map +1 -0
- package/dist/generated/pdas/mintAuthority.js +14 -0
- package/dist/generated/pdas/mintAuthority.js.map +1 -0
- package/dist/generated/pdas/treeConfig.d.ts +14 -0
- package/dist/generated/pdas/treeConfig.d.ts.map +1 -0
- package/dist/generated/pdas/treeConfig.js +14 -0
- package/dist/generated/pdas/treeConfig.js.map +1 -0
- package/dist/generated/pdas/voucher.d.ts +16 -0
- package/dist/generated/pdas/voucher.d.ts.map +1 -0
- package/dist/generated/pdas/voucher.js +18 -0
- package/dist/generated/pdas/voucher.js.map +1 -0
- package/dist/generated/programs/bubblegum.d.ts +186 -143
- package/dist/generated/programs/bubblegum.d.ts.map +1 -1
- package/dist/generated/programs/bubblegum.js +839 -561
- package/dist/generated/programs/bubblegum.js.map +1 -1
- package/dist/generated/programs/index.d.ts +2 -9
- package/dist/generated/programs/mplTokenMetadata.d.ts +20 -0
- package/dist/generated/programs/mplTokenMetadata.d.ts.map +1 -0
- package/dist/generated/programs/mplTokenMetadata.js +17 -0
- package/dist/generated/programs/mplTokenMetadata.js.map +1 -0
- package/dist/generated/types/assetDataSchema.d.ts +13 -16
- package/dist/generated/types/assetDataSchema.d.ts.map +1 -1
- package/dist/generated/types/assetDataSchema.js +16 -19
- package/dist/generated/types/assetDataSchema.js.map +1 -1
- package/dist/generated/types/bubblegumEventType.d.ts +12 -15
- package/dist/generated/types/bubblegumEventType.d.ts.map +1 -1
- package/dist/generated/types/bubblegumEventType.js +15 -18
- package/dist/generated/types/bubblegumEventType.js.map +1 -1
- package/dist/generated/types/collection.d.ts +12 -15
- package/dist/generated/types/collection.d.ts.map +1 -1
- package/dist/generated/types/collection.js +11 -20
- package/dist/generated/types/collection.js.map +1 -1
- package/dist/generated/types/creator.d.ts +18 -21
- package/dist/generated/types/creator.d.ts.map +1 -1
- package/dist/generated/types/creator.js +19 -22
- package/dist/generated/types/creator.js.map +1 -1
- package/dist/generated/types/decompressibleState.d.ts +12 -15
- package/dist/generated/types/decompressibleState.d.ts.map +1 -1
- package/dist/generated/types/decompressibleState.js +15 -18
- package/dist/generated/types/decompressibleState.js.map +1 -1
- package/dist/generated/types/index.d.ts +15 -23
- package/dist/generated/types/instructionName.d.ts +45 -48
- package/dist/generated/types/instructionName.d.ts.map +1 -1
- package/dist/generated/types/instructionName.js +48 -51
- package/dist/generated/types/instructionName.js.map +1 -1
- package/dist/generated/types/leafSchema.d.ts +48 -51
- package/dist/generated/types/leafSchema.d.ts.map +1 -1
- package/dist/generated/types/leafSchema.js +55 -72
- package/dist/generated/types/leafSchema.js.map +1 -1
- package/dist/generated/types/metadataArgs.d.ts +59 -58
- package/dist/generated/types/metadataArgs.d.ts.map +1 -1
- package/dist/generated/types/metadataArgs.js +42 -41
- package/dist/generated/types/metadataArgs.js.map +1 -1
- package/dist/generated/types/metadataArgsV2.d.ts +48 -50
- package/dist/generated/types/metadataArgsV2.d.ts.map +1 -1
- package/dist/generated/types/metadataArgsV2.js +33 -35
- package/dist/generated/types/metadataArgsV2.js.map +1 -1
- package/dist/generated/types/tokenProgramVersion.d.ts +12 -15
- package/dist/generated/types/tokenProgramVersion.d.ts.map +1 -1
- package/dist/generated/types/tokenProgramVersion.js +15 -18
- package/dist/generated/types/tokenProgramVersion.js.map +1 -1
- package/dist/generated/types/tokenStandard.d.ts +14 -17
- package/dist/generated/types/tokenStandard.d.ts.map +1 -1
- package/dist/generated/types/tokenStandard.js +17 -20
- package/dist/generated/types/tokenStandard.js.map +1 -1
- package/dist/generated/types/updateArgs.d.ts +25 -28
- package/dist/generated/types/updateArgs.d.ts.map +1 -1
- package/dist/generated/types/updateArgs.js +28 -49
- package/dist/generated/types/updateArgs.js.map +1 -1
- package/dist/generated/types/useMethod.d.ts +13 -16
- package/dist/generated/types/useMethod.d.ts.map +1 -1
- package/dist/generated/types/useMethod.js +16 -19
- package/dist/generated/types/useMethod.js.map +1 -1
- package/dist/generated/types/uses.d.ts +17 -20
- package/dist/generated/types/uses.d.ts.map +1 -1
- package/dist/generated/types/uses.js +20 -23
- package/dist/generated/types/uses.js.map +1 -1
- package/dist/generated/types/version.d.ts +12 -15
- package/dist/generated/types/version.d.ts.map +1 -1
- package/dist/generated/types/version.js +15 -18
- package/dist/generated/types/version.js.map +1 -1
- package/dist/index.d.ts +64 -8
- package/dist/index.js +64 -8
- package/package.json +7 -9
- package/src/generated/accounts/treeConfig.ts +22 -0
- package/src/generated/accounts/voucher.ts +22 -0
- package/src/generated/errors/bubblegum.ts +1 -1
- package/src/generated/index.ts +1 -0
- package/src/generated/instructions/burn.ts +154 -13
- package/src/generated/instructions/burnV2.ts +226 -20
- package/src/generated/instructions/cancelRedeem.ts +150 -13
- package/src/generated/instructions/closeTreeV2.ts +149 -13
- package/src/generated/instructions/collectV2.ts +3 -3
- package/src/generated/instructions/compress.ts +220 -24
- package/src/generated/instructions/createTree.ts +152 -13
- package/src/generated/instructions/createTreeV2.ts +153 -13
- package/src/generated/instructions/decompressV1.ts +262 -26
- package/src/generated/instructions/delegate.ts +169 -14
- package/src/generated/instructions/delegateAndFreezeV2.ts +183 -15
- package/src/generated/instructions/delegateV2.ts +183 -15
- package/src/generated/instructions/freezeV2.ts +187 -16
- package/src/generated/instructions/mintToCollectionV1.ts +295 -25
- package/src/generated/instructions/mintV1.ts +168 -15
- package/src/generated/instructions/mintV2.ts +231 -21
- package/src/generated/instructions/redeem.ts +163 -14
- package/src/generated/instructions/setAndVerifyCollection.ts +306 -25
- package/src/generated/instructions/setCollectionV2.ts +252 -23
- package/src/generated/instructions/setDecompressableState.ts +3 -3
- package/src/generated/instructions/setDecompressibleState.ts +3 -3
- package/src/generated/instructions/setNonTransferableV2.ts +188 -16
- package/src/generated/instructions/setTreeDelegate.ts +106 -9
- package/src/generated/instructions/thawAndRevokeV2.ts +167 -14
- package/src/generated/instructions/thawV2.ts +187 -16
- package/src/generated/instructions/transfer.ts +163 -14
- package/src/generated/instructions/transferV2.ts +197 -17
- package/src/generated/instructions/unverifyCollection.ts +305 -25
- package/src/generated/instructions/unverifyCreator.ts +173 -15
- package/src/generated/instructions/unverifyCreatorV2.ts +175 -15
- package/src/generated/instructions/updateAssetDataV2.ts +189 -16
- package/src/generated/instructions/updateMetadata.ts +232 -21
- package/src/generated/instructions/updateMetadataV2.ts +188 -16
- package/src/generated/instructions/verifyCollection.ts +305 -25
- package/src/generated/instructions/verifyCreator.ts +173 -15
- package/src/generated/instructions/verifyCreatorV2.ts +175 -15
- package/src/generated/pdas/assetId.ts +40 -0
- package/src/generated/pdas/bubblegumSigner.ts +23 -0
- package/{dist/generated/accounts/index.js → src/generated/pdas/index.ts} +6 -1
- package/src/generated/pdas/masterEdition.ts +38 -0
- package/src/generated/pdas/metadata.ts +37 -0
- package/src/generated/pdas/mintAuthority.ts +29 -0
- package/src/generated/pdas/treeConfig.ts +29 -0
- package/src/generated/pdas/voucher.ts +40 -0
- package/src/generated/programs/bubblegum.ts +208 -165
- package/src/generated/programs/index.ts +1 -0
- package/src/generated/programs/mplTokenMetadata.ts +42 -0
- package/dist/.tsbuildinfo +0 -1
- package/dist/generated/accounts/index.d.ts.map +0 -1
- package/dist/generated/accounts/index.js.map +0 -1
- package/dist/generated/errors/index.d.ts.map +0 -1
- package/dist/generated/errors/index.js +0 -9
- package/dist/generated/errors/index.js.map +0 -1
- package/dist/generated/index.d.ts.map +0 -1
- package/dist/generated/index.js +0 -13
- package/dist/generated/index.js.map +0 -1
- package/dist/generated/instructions/index.d.ts.map +0 -1
- package/dist/generated/instructions/index.js +0 -44
- package/dist/generated/instructions/index.js.map +0 -1
- package/dist/generated/programs/index.d.ts.map +0 -1
- package/dist/generated/programs/index.js +0 -9
- package/dist/generated/programs/index.js.map +0 -1
- package/dist/generated/types/index.d.ts.map +0 -1
- package/dist/generated/types/index.js +0 -23
- package/dist/generated/types/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -39,7 +39,11 @@ import {
|
|
|
39
39
|
SolanaError,
|
|
40
40
|
transformEncoder,
|
|
41
41
|
} from "@solana/kit";
|
|
42
|
-
import {
|
|
42
|
+
import {
|
|
43
|
+
getAccountMetaFactory,
|
|
44
|
+
getAddressFromResolvedInstructionAccount,
|
|
45
|
+
} from "@solana/program-client-core";
|
|
46
|
+
import { findTreeConfigPda } from "../pdas/index.js";
|
|
43
47
|
import { BUBBLEGUM_PROGRAM_ADDRESS } from "../programs/index.js";
|
|
44
48
|
|
|
45
49
|
export const CANCEL_REDEEM_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
|
|
@@ -54,16 +58,17 @@ export function getCancelRedeemDiscriminatorBytes(): ReadonlyUint8Array {
|
|
|
54
58
|
|
|
55
59
|
export type CancelRedeemInstruction<
|
|
56
60
|
TProgram extends string = typeof BUBBLEGUM_PROGRAM_ADDRESS,
|
|
57
|
-
TAccountTreeAuthority extends string | AccountMeta = string,
|
|
58
|
-
TAccountLeafOwner extends string | AccountMeta = string,
|
|
59
|
-
TAccountMerkleTree extends string | AccountMeta = string,
|
|
60
|
-
TAccountVoucher extends string | AccountMeta = string,
|
|
61
|
-
TAccountLogWrapper extends string | AccountMeta =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
TAccountTreeAuthority extends string | AccountMeta<string> = string,
|
|
62
|
+
TAccountLeafOwner extends string | AccountMeta<string> = string,
|
|
63
|
+
TAccountMerkleTree extends string | AccountMeta<string> = string,
|
|
64
|
+
TAccountVoucher extends string | AccountMeta<string> = string,
|
|
65
|
+
TAccountLogWrapper extends string | AccountMeta<string> =
|
|
66
|
+
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV",
|
|
67
|
+
TAccountCompressionProgram extends string | AccountMeta<string> =
|
|
68
|
+
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK",
|
|
69
|
+
TAccountSystemProgram extends string | AccountMeta<string> =
|
|
70
|
+
"11111111111111111111111111111111",
|
|
71
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
67
72
|
> = Instruction<TProgram> &
|
|
68
73
|
InstructionWithData<ReadonlyUint8Array> &
|
|
69
74
|
InstructionWithAccounts<
|
|
@@ -130,6 +135,130 @@ export function getCancelRedeemInstructionDataCodec(): FixedSizeCodec<
|
|
|
130
135
|
);
|
|
131
136
|
}
|
|
132
137
|
|
|
138
|
+
export interface CancelRedeemAsyncInput<
|
|
139
|
+
TAccountTreeAuthority extends string = string,
|
|
140
|
+
TAccountLeafOwner extends string = string,
|
|
141
|
+
TAccountMerkleTree extends string = string,
|
|
142
|
+
TAccountVoucher extends string = string,
|
|
143
|
+
TAccountLogWrapper extends string = string,
|
|
144
|
+
TAccountCompressionProgram extends string = string,
|
|
145
|
+
TAccountSystemProgram extends string = string,
|
|
146
|
+
> {
|
|
147
|
+
treeAuthority?: Address<TAccountTreeAuthority>;
|
|
148
|
+
leafOwner: TransactionSigner<TAccountLeafOwner>;
|
|
149
|
+
merkleTree: Address<TAccountMerkleTree>;
|
|
150
|
+
voucher: Address<TAccountVoucher>;
|
|
151
|
+
logWrapper?: Address<TAccountLogWrapper>;
|
|
152
|
+
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
153
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
154
|
+
root: CancelRedeemInstructionDataArgs["root"];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export async function getCancelRedeemInstructionAsync<
|
|
158
|
+
TAccountTreeAuthority extends string,
|
|
159
|
+
TAccountLeafOwner extends string,
|
|
160
|
+
TAccountMerkleTree extends string,
|
|
161
|
+
TAccountVoucher extends string,
|
|
162
|
+
TAccountLogWrapper extends string,
|
|
163
|
+
TAccountCompressionProgram extends string,
|
|
164
|
+
TAccountSystemProgram extends string,
|
|
165
|
+
TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS,
|
|
166
|
+
>(
|
|
167
|
+
input: CancelRedeemAsyncInput<
|
|
168
|
+
TAccountTreeAuthority,
|
|
169
|
+
TAccountLeafOwner,
|
|
170
|
+
TAccountMerkleTree,
|
|
171
|
+
TAccountVoucher,
|
|
172
|
+
TAccountLogWrapper,
|
|
173
|
+
TAccountCompressionProgram,
|
|
174
|
+
TAccountSystemProgram
|
|
175
|
+
>,
|
|
176
|
+
config?: { programAddress?: TProgramAddress },
|
|
177
|
+
): Promise<
|
|
178
|
+
CancelRedeemInstruction<
|
|
179
|
+
TProgramAddress,
|
|
180
|
+
TAccountTreeAuthority,
|
|
181
|
+
TAccountLeafOwner,
|
|
182
|
+
TAccountMerkleTree,
|
|
183
|
+
TAccountVoucher,
|
|
184
|
+
TAccountLogWrapper,
|
|
185
|
+
TAccountCompressionProgram,
|
|
186
|
+
TAccountSystemProgram
|
|
187
|
+
>
|
|
188
|
+
> {
|
|
189
|
+
// Program address.
|
|
190
|
+
const programAddress = config?.programAddress ?? BUBBLEGUM_PROGRAM_ADDRESS;
|
|
191
|
+
|
|
192
|
+
// Original accounts.
|
|
193
|
+
const originalAccounts = {
|
|
194
|
+
treeAuthority: { value: input.treeAuthority ?? null, isWritable: false },
|
|
195
|
+
leafOwner: { value: input.leafOwner ?? null, isWritable: true },
|
|
196
|
+
merkleTree: { value: input.merkleTree ?? null, isWritable: true },
|
|
197
|
+
voucher: { value: input.voucher ?? null, isWritable: true },
|
|
198
|
+
logWrapper: { value: input.logWrapper ?? null, isWritable: false },
|
|
199
|
+
compressionProgram: {
|
|
200
|
+
value: input.compressionProgram ?? null,
|
|
201
|
+
isWritable: false,
|
|
202
|
+
},
|
|
203
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
204
|
+
};
|
|
205
|
+
const accounts = originalAccounts as Record<
|
|
206
|
+
keyof typeof originalAccounts,
|
|
207
|
+
ResolvedInstructionAccount
|
|
208
|
+
>;
|
|
209
|
+
|
|
210
|
+
// Original args.
|
|
211
|
+
const args = { ...input };
|
|
212
|
+
|
|
213
|
+
// Resolve default values.
|
|
214
|
+
if (!accounts.treeAuthority.value) {
|
|
215
|
+
accounts.treeAuthority.value = await findTreeConfigPda({
|
|
216
|
+
merkleTree: getAddressFromResolvedInstructionAccount(
|
|
217
|
+
"merkleTree",
|
|
218
|
+
accounts.merkleTree.value,
|
|
219
|
+
),
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
if (!accounts.logWrapper.value) {
|
|
223
|
+
accounts.logWrapper.value =
|
|
224
|
+
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" as Address<"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV">;
|
|
225
|
+
}
|
|
226
|
+
if (!accounts.compressionProgram.value) {
|
|
227
|
+
accounts.compressionProgram.value =
|
|
228
|
+
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" as Address<"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK">;
|
|
229
|
+
}
|
|
230
|
+
if (!accounts.systemProgram.value) {
|
|
231
|
+
accounts.systemProgram.value =
|
|
232
|
+
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
236
|
+
return Object.freeze({
|
|
237
|
+
accounts: [
|
|
238
|
+
getAccountMeta("treeAuthority", accounts.treeAuthority),
|
|
239
|
+
getAccountMeta("leafOwner", accounts.leafOwner),
|
|
240
|
+
getAccountMeta("merkleTree", accounts.merkleTree),
|
|
241
|
+
getAccountMeta("voucher", accounts.voucher),
|
|
242
|
+
getAccountMeta("logWrapper", accounts.logWrapper),
|
|
243
|
+
getAccountMeta("compressionProgram", accounts.compressionProgram),
|
|
244
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
245
|
+
],
|
|
246
|
+
data: getCancelRedeemInstructionDataEncoder().encode(
|
|
247
|
+
args as CancelRedeemInstructionDataArgs,
|
|
248
|
+
),
|
|
249
|
+
programAddress,
|
|
250
|
+
} as CancelRedeemInstruction<
|
|
251
|
+
TProgramAddress,
|
|
252
|
+
TAccountTreeAuthority,
|
|
253
|
+
TAccountLeafOwner,
|
|
254
|
+
TAccountMerkleTree,
|
|
255
|
+
TAccountVoucher,
|
|
256
|
+
TAccountLogWrapper,
|
|
257
|
+
TAccountCompressionProgram,
|
|
258
|
+
TAccountSystemProgram
|
|
259
|
+
>);
|
|
260
|
+
}
|
|
261
|
+
|
|
133
262
|
export interface CancelRedeemInput<
|
|
134
263
|
TAccountTreeAuthority extends string = string,
|
|
135
264
|
TAccountLeafOwner extends string = string,
|
|
@@ -143,8 +272,8 @@ export interface CancelRedeemInput<
|
|
|
143
272
|
leafOwner: TransactionSigner<TAccountLeafOwner>;
|
|
144
273
|
merkleTree: Address<TAccountMerkleTree>;
|
|
145
274
|
voucher: Address<TAccountVoucher>;
|
|
146
|
-
logWrapper
|
|
147
|
-
compressionProgram
|
|
275
|
+
logWrapper?: Address<TAccountLogWrapper>;
|
|
276
|
+
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
148
277
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
149
278
|
root: CancelRedeemInstructionDataArgs["root"];
|
|
150
279
|
}
|
|
@@ -204,6 +333,14 @@ export function getCancelRedeemInstruction<
|
|
|
204
333
|
const args = { ...input };
|
|
205
334
|
|
|
206
335
|
// Resolve default values.
|
|
336
|
+
if (!accounts.logWrapper.value) {
|
|
337
|
+
accounts.logWrapper.value =
|
|
338
|
+
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" as Address<"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV">;
|
|
339
|
+
}
|
|
340
|
+
if (!accounts.compressionProgram.value) {
|
|
341
|
+
accounts.compressionProgram.value =
|
|
342
|
+
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" as Address<"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK">;
|
|
343
|
+
}
|
|
207
344
|
if (!accounts.systemProgram.value) {
|
|
208
345
|
accounts.systemProgram.value =
|
|
209
346
|
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
@@ -35,7 +35,11 @@ import {
|
|
|
35
35
|
SolanaError,
|
|
36
36
|
transformEncoder,
|
|
37
37
|
} from "@solana/kit";
|
|
38
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
getAccountMetaFactory,
|
|
40
|
+
getAddressFromResolvedInstructionAccount,
|
|
41
|
+
} from "@solana/program-client-core";
|
|
42
|
+
import { findTreeConfigPda } from "../pdas/index.js";
|
|
39
43
|
import { BUBBLEGUM_PROGRAM_ADDRESS } from "../programs/index.js";
|
|
40
44
|
|
|
41
45
|
export const CLOSE_TREE_V2_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
|
|
@@ -50,16 +54,17 @@ export function getCloseTreeV2DiscriminatorBytes(): ReadonlyUint8Array {
|
|
|
50
54
|
|
|
51
55
|
export type CloseTreeV2Instruction<
|
|
52
56
|
TProgram extends string = typeof BUBBLEGUM_PROGRAM_ADDRESS,
|
|
53
|
-
TAccountTreeAuthority extends string | AccountMeta = string,
|
|
54
|
-
TAccountAuthority extends string | AccountMeta = string,
|
|
55
|
-
TAccountMerkleTree extends string | AccountMeta = string,
|
|
56
|
-
TAccountRecipient extends string | AccountMeta = string,
|
|
57
|
-
TAccountCompressionProgram extends string | AccountMeta =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
TAccountTreeAuthority extends string | AccountMeta<string> = string,
|
|
58
|
+
TAccountAuthority extends string | AccountMeta<string> = string,
|
|
59
|
+
TAccountMerkleTree extends string | AccountMeta<string> = string,
|
|
60
|
+
TAccountRecipient extends string | AccountMeta<string> = string,
|
|
61
|
+
TAccountCompressionProgram extends string | AccountMeta<string> =
|
|
62
|
+
"mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW",
|
|
63
|
+
TAccountLogWrapper extends string | AccountMeta<string> =
|
|
64
|
+
"mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3",
|
|
65
|
+
TAccountSystemProgram extends string | AccountMeta<string> =
|
|
66
|
+
"11111111111111111111111111111111",
|
|
67
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
63
68
|
> = Instruction<TProgram> &
|
|
64
69
|
InstructionWithData<ReadonlyUint8Array> &
|
|
65
70
|
InstructionWithAccounts<
|
|
@@ -119,6 +124,129 @@ export function getCloseTreeV2InstructionDataCodec(): FixedSizeCodec<
|
|
|
119
124
|
);
|
|
120
125
|
}
|
|
121
126
|
|
|
127
|
+
export interface CloseTreeV2AsyncInput<
|
|
128
|
+
TAccountTreeAuthority extends string = string,
|
|
129
|
+
TAccountAuthority extends string = string,
|
|
130
|
+
TAccountMerkleTree extends string = string,
|
|
131
|
+
TAccountRecipient extends string = string,
|
|
132
|
+
TAccountCompressionProgram extends string = string,
|
|
133
|
+
TAccountLogWrapper extends string = string,
|
|
134
|
+
TAccountSystemProgram extends string = string,
|
|
135
|
+
> {
|
|
136
|
+
treeAuthority?: Address<TAccountTreeAuthority>;
|
|
137
|
+
/** Tree creator or delegate. */
|
|
138
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
139
|
+
merkleTree: Address<TAccountMerkleTree>;
|
|
140
|
+
/**
|
|
141
|
+
* Recipient for reclaimed lamports (tree + config PDA). Must be the creator
|
|
142
|
+
* or the delegate.
|
|
143
|
+
*/
|
|
144
|
+
recipient: Address<TAccountRecipient>;
|
|
145
|
+
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
146
|
+
logWrapper?: Address<TAccountLogWrapper>;
|
|
147
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export async function getCloseTreeV2InstructionAsync<
|
|
151
|
+
TAccountTreeAuthority extends string,
|
|
152
|
+
TAccountAuthority extends string,
|
|
153
|
+
TAccountMerkleTree extends string,
|
|
154
|
+
TAccountRecipient extends string,
|
|
155
|
+
TAccountCompressionProgram extends string,
|
|
156
|
+
TAccountLogWrapper extends string,
|
|
157
|
+
TAccountSystemProgram extends string,
|
|
158
|
+
TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS,
|
|
159
|
+
>(
|
|
160
|
+
input: CloseTreeV2AsyncInput<
|
|
161
|
+
TAccountTreeAuthority,
|
|
162
|
+
TAccountAuthority,
|
|
163
|
+
TAccountMerkleTree,
|
|
164
|
+
TAccountRecipient,
|
|
165
|
+
TAccountCompressionProgram,
|
|
166
|
+
TAccountLogWrapper,
|
|
167
|
+
TAccountSystemProgram
|
|
168
|
+
>,
|
|
169
|
+
config?: { programAddress?: TProgramAddress },
|
|
170
|
+
): Promise<
|
|
171
|
+
CloseTreeV2Instruction<
|
|
172
|
+
TProgramAddress,
|
|
173
|
+
TAccountTreeAuthority,
|
|
174
|
+
TAccountAuthority,
|
|
175
|
+
TAccountMerkleTree,
|
|
176
|
+
TAccountRecipient,
|
|
177
|
+
TAccountCompressionProgram,
|
|
178
|
+
TAccountLogWrapper,
|
|
179
|
+
TAccountSystemProgram
|
|
180
|
+
>
|
|
181
|
+
> {
|
|
182
|
+
// Program address.
|
|
183
|
+
const programAddress = config?.programAddress ?? BUBBLEGUM_PROGRAM_ADDRESS;
|
|
184
|
+
|
|
185
|
+
// Original accounts.
|
|
186
|
+
const originalAccounts = {
|
|
187
|
+
treeAuthority: { value: input.treeAuthority ?? null, isWritable: true },
|
|
188
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
189
|
+
merkleTree: { value: input.merkleTree ?? null, isWritable: true },
|
|
190
|
+
recipient: { value: input.recipient ?? null, isWritable: true },
|
|
191
|
+
compressionProgram: {
|
|
192
|
+
value: input.compressionProgram ?? null,
|
|
193
|
+
isWritable: false,
|
|
194
|
+
},
|
|
195
|
+
logWrapper: { value: input.logWrapper ?? null, isWritable: false },
|
|
196
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
197
|
+
};
|
|
198
|
+
const accounts = originalAccounts as Record<
|
|
199
|
+
keyof typeof originalAccounts,
|
|
200
|
+
ResolvedInstructionAccount
|
|
201
|
+
>;
|
|
202
|
+
|
|
203
|
+
// Resolve default values.
|
|
204
|
+
if (!accounts.treeAuthority.value) {
|
|
205
|
+
accounts.treeAuthority.value = await findTreeConfigPda({
|
|
206
|
+
merkleTree: getAddressFromResolvedInstructionAccount(
|
|
207
|
+
"merkleTree",
|
|
208
|
+
accounts.merkleTree.value,
|
|
209
|
+
),
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
if (!accounts.compressionProgram.value) {
|
|
213
|
+
accounts.compressionProgram.value =
|
|
214
|
+
"mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW" as Address<"mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW">;
|
|
215
|
+
}
|
|
216
|
+
if (!accounts.logWrapper.value) {
|
|
217
|
+
accounts.logWrapper.value =
|
|
218
|
+
"mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3" as Address<"mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3">;
|
|
219
|
+
}
|
|
220
|
+
if (!accounts.systemProgram.value) {
|
|
221
|
+
accounts.systemProgram.value =
|
|
222
|
+
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
226
|
+
return Object.freeze({
|
|
227
|
+
accounts: [
|
|
228
|
+
getAccountMeta("treeAuthority", accounts.treeAuthority),
|
|
229
|
+
getAccountMeta("authority", accounts.authority),
|
|
230
|
+
getAccountMeta("merkleTree", accounts.merkleTree),
|
|
231
|
+
getAccountMeta("recipient", accounts.recipient),
|
|
232
|
+
getAccountMeta("compressionProgram", accounts.compressionProgram),
|
|
233
|
+
getAccountMeta("logWrapper", accounts.logWrapper),
|
|
234
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
235
|
+
],
|
|
236
|
+
data: getCloseTreeV2InstructionDataEncoder().encode({}),
|
|
237
|
+
programAddress,
|
|
238
|
+
} as CloseTreeV2Instruction<
|
|
239
|
+
TProgramAddress,
|
|
240
|
+
TAccountTreeAuthority,
|
|
241
|
+
TAccountAuthority,
|
|
242
|
+
TAccountMerkleTree,
|
|
243
|
+
TAccountRecipient,
|
|
244
|
+
TAccountCompressionProgram,
|
|
245
|
+
TAccountLogWrapper,
|
|
246
|
+
TAccountSystemProgram
|
|
247
|
+
>);
|
|
248
|
+
}
|
|
249
|
+
|
|
122
250
|
export interface CloseTreeV2Input<
|
|
123
251
|
TAccountTreeAuthority extends string = string,
|
|
124
252
|
TAccountAuthority extends string = string,
|
|
@@ -137,8 +265,8 @@ export interface CloseTreeV2Input<
|
|
|
137
265
|
* or the delegate.
|
|
138
266
|
*/
|
|
139
267
|
recipient: Address<TAccountRecipient>;
|
|
140
|
-
compressionProgram
|
|
141
|
-
logWrapper
|
|
268
|
+
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
269
|
+
logWrapper?: Address<TAccountLogWrapper>;
|
|
142
270
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
143
271
|
}
|
|
144
272
|
|
|
@@ -194,6 +322,14 @@ export function getCloseTreeV2Instruction<
|
|
|
194
322
|
>;
|
|
195
323
|
|
|
196
324
|
// Resolve default values.
|
|
325
|
+
if (!accounts.compressionProgram.value) {
|
|
326
|
+
accounts.compressionProgram.value =
|
|
327
|
+
"mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW" as Address<"mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW">;
|
|
328
|
+
}
|
|
329
|
+
if (!accounts.logWrapper.value) {
|
|
330
|
+
accounts.logWrapper.value =
|
|
331
|
+
"mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3" as Address<"mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3">;
|
|
332
|
+
}
|
|
197
333
|
if (!accounts.systemProgram.value) {
|
|
198
334
|
accounts.systemProgram.value =
|
|
199
335
|
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
@@ -44,9 +44,9 @@ export function getCollectV2DiscriminatorBytes(): ReadonlyUint8Array {
|
|
|
44
44
|
|
|
45
45
|
export type CollectV2Instruction<
|
|
46
46
|
TProgram extends string = typeof BUBBLEGUM_PROGRAM_ADDRESS,
|
|
47
|
-
TAccountTreeAuthority extends string | AccountMeta = string,
|
|
48
|
-
TAccountDestination extends string | AccountMeta = string,
|
|
49
|
-
TRemainingAccounts extends readonly AccountMeta[] = [],
|
|
47
|
+
TAccountTreeAuthority extends string | AccountMeta<string> = string,
|
|
48
|
+
TAccountDestination extends string | AccountMeta<string> = string,
|
|
49
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
50
50
|
> = Instruction<TProgram> &
|
|
51
51
|
InstructionWithData<ReadonlyUint8Array> &
|
|
52
52
|
InstructionWithAccounts<
|
|
@@ -36,7 +36,11 @@ import {
|
|
|
36
36
|
SolanaError,
|
|
37
37
|
transformEncoder,
|
|
38
38
|
} from "@solana/kit";
|
|
39
|
-
import {
|
|
39
|
+
import {
|
|
40
|
+
getAccountMetaFactory,
|
|
41
|
+
getAddressFromResolvedInstructionAccount,
|
|
42
|
+
} from "@solana/program-client-core";
|
|
43
|
+
import { findTreeConfigPda } from "../pdas/index.js";
|
|
40
44
|
import { BUBBLEGUM_PROGRAM_ADDRESS } from "../programs/index.js";
|
|
41
45
|
|
|
42
46
|
export const COMPRESS_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([
|
|
@@ -49,27 +53,26 @@ export function getCompressDiscriminatorBytes(): ReadonlyUint8Array {
|
|
|
49
53
|
|
|
50
54
|
export type CompressInstruction<
|
|
51
55
|
TProgram extends string = typeof BUBBLEGUM_PROGRAM_ADDRESS,
|
|
52
|
-
TAccountTreeAuthority extends string | AccountMeta = string,
|
|
53
|
-
TAccountLeafOwner extends string | AccountMeta = string,
|
|
54
|
-
TAccountLeafDelegate extends string | AccountMeta = string,
|
|
55
|
-
TAccountMerkleTree extends string | AccountMeta = string,
|
|
56
|
-
TAccountTokenAccount extends string | AccountMeta = string,
|
|
57
|
-
TAccountMint extends string | AccountMeta = string,
|
|
58
|
-
TAccountMetadata extends string | AccountMeta = string,
|
|
59
|
-
TAccountMasterEdition extends string | AccountMeta = string,
|
|
60
|
-
TAccountPayer extends string | AccountMeta = string,
|
|
61
|
-
TAccountLogWrapper extends string | AccountMeta =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
TAccountSystemProgram extends
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
TRemainingAccounts extends readonly AccountMeta[] = [],
|
|
56
|
+
TAccountTreeAuthority extends string | AccountMeta<string> = string,
|
|
57
|
+
TAccountLeafOwner extends string | AccountMeta<string> = string,
|
|
58
|
+
TAccountLeafDelegate extends string | AccountMeta<string> = string,
|
|
59
|
+
TAccountMerkleTree extends string | AccountMeta<string> = string,
|
|
60
|
+
TAccountTokenAccount extends string | AccountMeta<string> = string,
|
|
61
|
+
TAccountMint extends string | AccountMeta<string> = string,
|
|
62
|
+
TAccountMetadata extends string | AccountMeta<string> = string,
|
|
63
|
+
TAccountMasterEdition extends string | AccountMeta<string> = string,
|
|
64
|
+
TAccountPayer extends string | AccountMeta<string> = string,
|
|
65
|
+
TAccountLogWrapper extends string | AccountMeta<string> =
|
|
66
|
+
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV",
|
|
67
|
+
TAccountCompressionProgram extends string | AccountMeta<string> =
|
|
68
|
+
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK",
|
|
69
|
+
TAccountTokenProgram extends string | AccountMeta<string> =
|
|
70
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
|
71
|
+
TAccountTokenMetadataProgram extends string | AccountMeta<string> =
|
|
72
|
+
"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s",
|
|
73
|
+
TAccountSystemProgram extends string | AccountMeta<string> =
|
|
74
|
+
"11111111111111111111111111111111",
|
|
75
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
73
76
|
> = Instruction<TProgram> &
|
|
74
77
|
InstructionWithData<ReadonlyUint8Array> &
|
|
75
78
|
InstructionWithAccounts<
|
|
@@ -151,6 +154,191 @@ export function getCompressInstructionDataCodec(): FixedSizeCodec<
|
|
|
151
154
|
);
|
|
152
155
|
}
|
|
153
156
|
|
|
157
|
+
export interface CompressAsyncInput<
|
|
158
|
+
TAccountTreeAuthority extends string = string,
|
|
159
|
+
TAccountLeafOwner extends string = string,
|
|
160
|
+
TAccountLeafDelegate extends string = string,
|
|
161
|
+
TAccountMerkleTree extends string = string,
|
|
162
|
+
TAccountTokenAccount extends string = string,
|
|
163
|
+
TAccountMint extends string = string,
|
|
164
|
+
TAccountMetadata extends string = string,
|
|
165
|
+
TAccountMasterEdition extends string = string,
|
|
166
|
+
TAccountPayer extends string = string,
|
|
167
|
+
TAccountLogWrapper extends string = string,
|
|
168
|
+
TAccountCompressionProgram extends string = string,
|
|
169
|
+
TAccountTokenProgram extends string = string,
|
|
170
|
+
TAccountTokenMetadataProgram extends string = string,
|
|
171
|
+
TAccountSystemProgram extends string = string,
|
|
172
|
+
> {
|
|
173
|
+
treeAuthority?: Address<TAccountTreeAuthority>;
|
|
174
|
+
leafOwner: TransactionSigner<TAccountLeafOwner>;
|
|
175
|
+
leafDelegate: Address<TAccountLeafDelegate>;
|
|
176
|
+
merkleTree: Address<TAccountMerkleTree>;
|
|
177
|
+
tokenAccount: Address<TAccountTokenAccount>;
|
|
178
|
+
mint: Address<TAccountMint>;
|
|
179
|
+
metadata: Address<TAccountMetadata>;
|
|
180
|
+
masterEdition: Address<TAccountMasterEdition>;
|
|
181
|
+
payer: TransactionSigner<TAccountPayer>;
|
|
182
|
+
logWrapper?: Address<TAccountLogWrapper>;
|
|
183
|
+
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
184
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
185
|
+
tokenMetadataProgram?: Address<TAccountTokenMetadataProgram>;
|
|
186
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export async function getCompressInstructionAsync<
|
|
190
|
+
TAccountTreeAuthority extends string,
|
|
191
|
+
TAccountLeafOwner extends string,
|
|
192
|
+
TAccountLeafDelegate extends string,
|
|
193
|
+
TAccountMerkleTree extends string,
|
|
194
|
+
TAccountTokenAccount extends string,
|
|
195
|
+
TAccountMint extends string,
|
|
196
|
+
TAccountMetadata extends string,
|
|
197
|
+
TAccountMasterEdition extends string,
|
|
198
|
+
TAccountPayer extends string,
|
|
199
|
+
TAccountLogWrapper extends string,
|
|
200
|
+
TAccountCompressionProgram extends string,
|
|
201
|
+
TAccountTokenProgram extends string,
|
|
202
|
+
TAccountTokenMetadataProgram extends string,
|
|
203
|
+
TAccountSystemProgram extends string,
|
|
204
|
+
TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS,
|
|
205
|
+
>(
|
|
206
|
+
input: CompressAsyncInput<
|
|
207
|
+
TAccountTreeAuthority,
|
|
208
|
+
TAccountLeafOwner,
|
|
209
|
+
TAccountLeafDelegate,
|
|
210
|
+
TAccountMerkleTree,
|
|
211
|
+
TAccountTokenAccount,
|
|
212
|
+
TAccountMint,
|
|
213
|
+
TAccountMetadata,
|
|
214
|
+
TAccountMasterEdition,
|
|
215
|
+
TAccountPayer,
|
|
216
|
+
TAccountLogWrapper,
|
|
217
|
+
TAccountCompressionProgram,
|
|
218
|
+
TAccountTokenProgram,
|
|
219
|
+
TAccountTokenMetadataProgram,
|
|
220
|
+
TAccountSystemProgram
|
|
221
|
+
>,
|
|
222
|
+
config?: { programAddress?: TProgramAddress },
|
|
223
|
+
): Promise<
|
|
224
|
+
CompressInstruction<
|
|
225
|
+
TProgramAddress,
|
|
226
|
+
TAccountTreeAuthority,
|
|
227
|
+
TAccountLeafOwner,
|
|
228
|
+
TAccountLeafDelegate,
|
|
229
|
+
TAccountMerkleTree,
|
|
230
|
+
TAccountTokenAccount,
|
|
231
|
+
TAccountMint,
|
|
232
|
+
TAccountMetadata,
|
|
233
|
+
TAccountMasterEdition,
|
|
234
|
+
TAccountPayer,
|
|
235
|
+
TAccountLogWrapper,
|
|
236
|
+
TAccountCompressionProgram,
|
|
237
|
+
TAccountTokenProgram,
|
|
238
|
+
TAccountTokenMetadataProgram,
|
|
239
|
+
TAccountSystemProgram
|
|
240
|
+
>
|
|
241
|
+
> {
|
|
242
|
+
// Program address.
|
|
243
|
+
const programAddress = config?.programAddress ?? BUBBLEGUM_PROGRAM_ADDRESS;
|
|
244
|
+
|
|
245
|
+
// Original accounts.
|
|
246
|
+
const originalAccounts = {
|
|
247
|
+
treeAuthority: { value: input.treeAuthority ?? null, isWritable: false },
|
|
248
|
+
leafOwner: { value: input.leafOwner ?? null, isWritable: false },
|
|
249
|
+
leafDelegate: { value: input.leafDelegate ?? null, isWritable: false },
|
|
250
|
+
merkleTree: { value: input.merkleTree ?? null, isWritable: false },
|
|
251
|
+
tokenAccount: { value: input.tokenAccount ?? null, isWritable: true },
|
|
252
|
+
mint: { value: input.mint ?? null, isWritable: true },
|
|
253
|
+
metadata: { value: input.metadata ?? null, isWritable: true },
|
|
254
|
+
masterEdition: { value: input.masterEdition ?? null, isWritable: true },
|
|
255
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
256
|
+
logWrapper: { value: input.logWrapper ?? null, isWritable: false },
|
|
257
|
+
compressionProgram: {
|
|
258
|
+
value: input.compressionProgram ?? null,
|
|
259
|
+
isWritable: false,
|
|
260
|
+
},
|
|
261
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
262
|
+
tokenMetadataProgram: {
|
|
263
|
+
value: input.tokenMetadataProgram ?? null,
|
|
264
|
+
isWritable: false,
|
|
265
|
+
},
|
|
266
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
267
|
+
};
|
|
268
|
+
const accounts = originalAccounts as Record<
|
|
269
|
+
keyof typeof originalAccounts,
|
|
270
|
+
ResolvedInstructionAccount
|
|
271
|
+
>;
|
|
272
|
+
|
|
273
|
+
// Resolve default values.
|
|
274
|
+
if (!accounts.treeAuthority.value) {
|
|
275
|
+
accounts.treeAuthority.value = await findTreeConfigPda({
|
|
276
|
+
merkleTree: getAddressFromResolvedInstructionAccount(
|
|
277
|
+
"merkleTree",
|
|
278
|
+
accounts.merkleTree.value,
|
|
279
|
+
),
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
if (!accounts.logWrapper.value) {
|
|
283
|
+
accounts.logWrapper.value =
|
|
284
|
+
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" as Address<"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV">;
|
|
285
|
+
}
|
|
286
|
+
if (!accounts.compressionProgram.value) {
|
|
287
|
+
accounts.compressionProgram.value =
|
|
288
|
+
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" as Address<"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK">;
|
|
289
|
+
}
|
|
290
|
+
if (!accounts.tokenProgram.value) {
|
|
291
|
+
accounts.tokenProgram.value =
|
|
292
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
|
|
293
|
+
}
|
|
294
|
+
if (!accounts.tokenMetadataProgram.value) {
|
|
295
|
+
accounts.tokenMetadataProgram.value =
|
|
296
|
+
"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" as Address<"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s">;
|
|
297
|
+
}
|
|
298
|
+
if (!accounts.systemProgram.value) {
|
|
299
|
+
accounts.systemProgram.value =
|
|
300
|
+
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
304
|
+
return Object.freeze({
|
|
305
|
+
accounts: [
|
|
306
|
+
getAccountMeta("treeAuthority", accounts.treeAuthority),
|
|
307
|
+
getAccountMeta("leafOwner", accounts.leafOwner),
|
|
308
|
+
getAccountMeta("leafDelegate", accounts.leafDelegate),
|
|
309
|
+
getAccountMeta("merkleTree", accounts.merkleTree),
|
|
310
|
+
getAccountMeta("tokenAccount", accounts.tokenAccount),
|
|
311
|
+
getAccountMeta("mint", accounts.mint),
|
|
312
|
+
getAccountMeta("metadata", accounts.metadata),
|
|
313
|
+
getAccountMeta("masterEdition", accounts.masterEdition),
|
|
314
|
+
getAccountMeta("payer", accounts.payer),
|
|
315
|
+
getAccountMeta("logWrapper", accounts.logWrapper),
|
|
316
|
+
getAccountMeta("compressionProgram", accounts.compressionProgram),
|
|
317
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
318
|
+
getAccountMeta("tokenMetadataProgram", accounts.tokenMetadataProgram),
|
|
319
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
320
|
+
],
|
|
321
|
+
data: getCompressInstructionDataEncoder().encode({}),
|
|
322
|
+
programAddress,
|
|
323
|
+
} as CompressInstruction<
|
|
324
|
+
TProgramAddress,
|
|
325
|
+
TAccountTreeAuthority,
|
|
326
|
+
TAccountLeafOwner,
|
|
327
|
+
TAccountLeafDelegate,
|
|
328
|
+
TAccountMerkleTree,
|
|
329
|
+
TAccountTokenAccount,
|
|
330
|
+
TAccountMint,
|
|
331
|
+
TAccountMetadata,
|
|
332
|
+
TAccountMasterEdition,
|
|
333
|
+
TAccountPayer,
|
|
334
|
+
TAccountLogWrapper,
|
|
335
|
+
TAccountCompressionProgram,
|
|
336
|
+
TAccountTokenProgram,
|
|
337
|
+
TAccountTokenMetadataProgram,
|
|
338
|
+
TAccountSystemProgram
|
|
339
|
+
>);
|
|
340
|
+
}
|
|
341
|
+
|
|
154
342
|
export interface CompressInput<
|
|
155
343
|
TAccountTreeAuthority extends string = string,
|
|
156
344
|
TAccountLeafOwner extends string = string,
|
|
@@ -176,8 +364,8 @@ export interface CompressInput<
|
|
|
176
364
|
metadata: Address<TAccountMetadata>;
|
|
177
365
|
masterEdition: Address<TAccountMasterEdition>;
|
|
178
366
|
payer: TransactionSigner<TAccountPayer>;
|
|
179
|
-
logWrapper
|
|
180
|
-
compressionProgram
|
|
367
|
+
logWrapper?: Address<TAccountLogWrapper>;
|
|
368
|
+
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
181
369
|
tokenProgram?: Address<TAccountTokenProgram>;
|
|
182
370
|
tokenMetadataProgram?: Address<TAccountTokenMetadataProgram>;
|
|
183
371
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
@@ -266,6 +454,14 @@ export function getCompressInstruction<
|
|
|
266
454
|
>;
|
|
267
455
|
|
|
268
456
|
// Resolve default values.
|
|
457
|
+
if (!accounts.logWrapper.value) {
|
|
458
|
+
accounts.logWrapper.value =
|
|
459
|
+
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" as Address<"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV">;
|
|
460
|
+
}
|
|
461
|
+
if (!accounts.compressionProgram.value) {
|
|
462
|
+
accounts.compressionProgram.value =
|
|
463
|
+
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" as Address<"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK">;
|
|
464
|
+
}
|
|
269
465
|
if (!accounts.tokenProgram.value) {
|
|
270
466
|
accounts.tokenProgram.value =
|
|
271
467
|
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
|