@macalinao/clients-mpl-bubblegum 0.2.0 → 0.3.0
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 -5
- 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 +155 -11
- package/src/generated/instructions/burnV2.ts +226 -16
- package/src/generated/instructions/cancelRedeem.ts +151 -11
- package/src/generated/instructions/closeTreeV2.ts +150 -11
- package/src/generated/instructions/collectV2.ts +3 -3
- package/src/generated/instructions/compress.ts +219 -18
- package/src/generated/instructions/createTree.ts +153 -11
- package/src/generated/instructions/createTreeV2.ts +154 -11
- package/src/generated/instructions/decompressV1.ts +258 -16
- package/src/generated/instructions/delegate.ts +170 -12
- package/src/generated/instructions/delegateAndFreezeV2.ts +184 -13
- package/src/generated/instructions/delegateV2.ts +184 -13
- package/src/generated/instructions/freezeV2.ts +188 -14
- package/src/generated/instructions/mintToCollectionV1.ts +296 -21
- package/src/generated/instructions/mintV1.ts +169 -13
- package/src/generated/instructions/mintV2.ts +231 -17
- package/src/generated/instructions/redeem.ts +164 -12
- package/src/generated/instructions/setAndVerifyCollection.ts +307 -21
- package/src/generated/instructions/setCollectionV2.ts +253 -19
- package/src/generated/instructions/setDecompressableState.ts +3 -3
- package/src/generated/instructions/setDecompressibleState.ts +3 -3
- package/src/generated/instructions/setNonTransferableV2.ts +189 -14
- package/src/generated/instructions/setTreeDelegate.ts +105 -7
- package/src/generated/instructions/thawAndRevokeV2.ts +168 -12
- package/src/generated/instructions/thawV2.ts +188 -14
- package/src/generated/instructions/transfer.ts +164 -12
- package/src/generated/instructions/transferV2.ts +198 -15
- package/src/generated/instructions/unverifyCollection.ts +306 -21
- package/src/generated/instructions/unverifyCreator.ts +174 -13
- package/src/generated/instructions/unverifyCreatorV2.ts +176 -13
- package/src/generated/instructions/updateAssetDataV2.ts +190 -14
- package/src/generated/instructions/updateMetadata.ts +233 -17
- package/src/generated/instructions/updateMetadataV2.ts +189 -14
- package/src/generated/instructions/verifyCollection.ts +306 -21
- package/src/generated/instructions/verifyCreator.ts +174 -13
- package/src/generated/instructions/verifyCreatorV2.ts +176 -13
- 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,20 @@ 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
|
|
62
|
-
|
|
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
|
|
66
|
+
| string
|
|
67
|
+
| AccountMeta<string> = "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV",
|
|
68
|
+
TAccountCompressionProgram extends
|
|
69
|
+
| string
|
|
70
|
+
| AccountMeta<string> = "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK",
|
|
63
71
|
TAccountSystemProgram extends
|
|
64
72
|
| string
|
|
65
|
-
| AccountMeta = "11111111111111111111111111111111",
|
|
66
|
-
TRemainingAccounts extends readonly AccountMeta[] = [],
|
|
73
|
+
| AccountMeta<string> = "11111111111111111111111111111111",
|
|
74
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
67
75
|
> = Instruction<TProgram> &
|
|
68
76
|
InstructionWithData<ReadonlyUint8Array> &
|
|
69
77
|
InstructionWithAccounts<
|
|
@@ -130,6 +138,130 @@ export function getCancelRedeemInstructionDataCodec(): FixedSizeCodec<
|
|
|
130
138
|
);
|
|
131
139
|
}
|
|
132
140
|
|
|
141
|
+
export interface CancelRedeemAsyncInput<
|
|
142
|
+
TAccountTreeAuthority extends string = string,
|
|
143
|
+
TAccountLeafOwner extends string = string,
|
|
144
|
+
TAccountMerkleTree extends string = string,
|
|
145
|
+
TAccountVoucher extends string = string,
|
|
146
|
+
TAccountLogWrapper extends string = string,
|
|
147
|
+
TAccountCompressionProgram extends string = string,
|
|
148
|
+
TAccountSystemProgram extends string = string,
|
|
149
|
+
> {
|
|
150
|
+
treeAuthority?: Address<TAccountTreeAuthority>;
|
|
151
|
+
leafOwner: TransactionSigner<TAccountLeafOwner>;
|
|
152
|
+
merkleTree: Address<TAccountMerkleTree>;
|
|
153
|
+
voucher: Address<TAccountVoucher>;
|
|
154
|
+
logWrapper?: Address<TAccountLogWrapper>;
|
|
155
|
+
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
156
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
157
|
+
root: CancelRedeemInstructionDataArgs["root"];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export async function getCancelRedeemInstructionAsync<
|
|
161
|
+
TAccountTreeAuthority extends string,
|
|
162
|
+
TAccountLeafOwner extends string,
|
|
163
|
+
TAccountMerkleTree extends string,
|
|
164
|
+
TAccountVoucher extends string,
|
|
165
|
+
TAccountLogWrapper extends string,
|
|
166
|
+
TAccountCompressionProgram extends string,
|
|
167
|
+
TAccountSystemProgram extends string,
|
|
168
|
+
TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS,
|
|
169
|
+
>(
|
|
170
|
+
input: CancelRedeemAsyncInput<
|
|
171
|
+
TAccountTreeAuthority,
|
|
172
|
+
TAccountLeafOwner,
|
|
173
|
+
TAccountMerkleTree,
|
|
174
|
+
TAccountVoucher,
|
|
175
|
+
TAccountLogWrapper,
|
|
176
|
+
TAccountCompressionProgram,
|
|
177
|
+
TAccountSystemProgram
|
|
178
|
+
>,
|
|
179
|
+
config?: { programAddress?: TProgramAddress },
|
|
180
|
+
): Promise<
|
|
181
|
+
CancelRedeemInstruction<
|
|
182
|
+
TProgramAddress,
|
|
183
|
+
TAccountTreeAuthority,
|
|
184
|
+
TAccountLeafOwner,
|
|
185
|
+
TAccountMerkleTree,
|
|
186
|
+
TAccountVoucher,
|
|
187
|
+
TAccountLogWrapper,
|
|
188
|
+
TAccountCompressionProgram,
|
|
189
|
+
TAccountSystemProgram
|
|
190
|
+
>
|
|
191
|
+
> {
|
|
192
|
+
// Program address.
|
|
193
|
+
const programAddress = config?.programAddress ?? BUBBLEGUM_PROGRAM_ADDRESS;
|
|
194
|
+
|
|
195
|
+
// Original accounts.
|
|
196
|
+
const originalAccounts = {
|
|
197
|
+
treeAuthority: { value: input.treeAuthority ?? null, isWritable: false },
|
|
198
|
+
leafOwner: { value: input.leafOwner ?? null, isWritable: true },
|
|
199
|
+
merkleTree: { value: input.merkleTree ?? null, isWritable: true },
|
|
200
|
+
voucher: { value: input.voucher ?? null, isWritable: true },
|
|
201
|
+
logWrapper: { value: input.logWrapper ?? null, isWritable: false },
|
|
202
|
+
compressionProgram: {
|
|
203
|
+
value: input.compressionProgram ?? null,
|
|
204
|
+
isWritable: false,
|
|
205
|
+
},
|
|
206
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
207
|
+
};
|
|
208
|
+
const accounts = originalAccounts as Record<
|
|
209
|
+
keyof typeof originalAccounts,
|
|
210
|
+
ResolvedInstructionAccount
|
|
211
|
+
>;
|
|
212
|
+
|
|
213
|
+
// Original args.
|
|
214
|
+
const args = { ...input };
|
|
215
|
+
|
|
216
|
+
// Resolve default values.
|
|
217
|
+
if (!accounts.treeAuthority.value) {
|
|
218
|
+
accounts.treeAuthority.value = await findTreeConfigPda({
|
|
219
|
+
merkleTree: getAddressFromResolvedInstructionAccount(
|
|
220
|
+
"merkleTree",
|
|
221
|
+
accounts.merkleTree.value,
|
|
222
|
+
),
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
if (!accounts.logWrapper.value) {
|
|
226
|
+
accounts.logWrapper.value =
|
|
227
|
+
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" as Address<"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV">;
|
|
228
|
+
}
|
|
229
|
+
if (!accounts.compressionProgram.value) {
|
|
230
|
+
accounts.compressionProgram.value =
|
|
231
|
+
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" as Address<"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK">;
|
|
232
|
+
}
|
|
233
|
+
if (!accounts.systemProgram.value) {
|
|
234
|
+
accounts.systemProgram.value =
|
|
235
|
+
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
239
|
+
return Object.freeze({
|
|
240
|
+
accounts: [
|
|
241
|
+
getAccountMeta("treeAuthority", accounts.treeAuthority),
|
|
242
|
+
getAccountMeta("leafOwner", accounts.leafOwner),
|
|
243
|
+
getAccountMeta("merkleTree", accounts.merkleTree),
|
|
244
|
+
getAccountMeta("voucher", accounts.voucher),
|
|
245
|
+
getAccountMeta("logWrapper", accounts.logWrapper),
|
|
246
|
+
getAccountMeta("compressionProgram", accounts.compressionProgram),
|
|
247
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
248
|
+
],
|
|
249
|
+
data: getCancelRedeemInstructionDataEncoder().encode(
|
|
250
|
+
args as CancelRedeemInstructionDataArgs,
|
|
251
|
+
),
|
|
252
|
+
programAddress,
|
|
253
|
+
} as CancelRedeemInstruction<
|
|
254
|
+
TProgramAddress,
|
|
255
|
+
TAccountTreeAuthority,
|
|
256
|
+
TAccountLeafOwner,
|
|
257
|
+
TAccountMerkleTree,
|
|
258
|
+
TAccountVoucher,
|
|
259
|
+
TAccountLogWrapper,
|
|
260
|
+
TAccountCompressionProgram,
|
|
261
|
+
TAccountSystemProgram
|
|
262
|
+
>);
|
|
263
|
+
}
|
|
264
|
+
|
|
133
265
|
export interface CancelRedeemInput<
|
|
134
266
|
TAccountTreeAuthority extends string = string,
|
|
135
267
|
TAccountLeafOwner extends string = string,
|
|
@@ -143,8 +275,8 @@ export interface CancelRedeemInput<
|
|
|
143
275
|
leafOwner: TransactionSigner<TAccountLeafOwner>;
|
|
144
276
|
merkleTree: Address<TAccountMerkleTree>;
|
|
145
277
|
voucher: Address<TAccountVoucher>;
|
|
146
|
-
logWrapper
|
|
147
|
-
compressionProgram
|
|
278
|
+
logWrapper?: Address<TAccountLogWrapper>;
|
|
279
|
+
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
148
280
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
149
281
|
root: CancelRedeemInstructionDataArgs["root"];
|
|
150
282
|
}
|
|
@@ -204,6 +336,14 @@ export function getCancelRedeemInstruction<
|
|
|
204
336
|
const args = { ...input };
|
|
205
337
|
|
|
206
338
|
// Resolve default values.
|
|
339
|
+
if (!accounts.logWrapper.value) {
|
|
340
|
+
accounts.logWrapper.value =
|
|
341
|
+
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" as Address<"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV">;
|
|
342
|
+
}
|
|
343
|
+
if (!accounts.compressionProgram.value) {
|
|
344
|
+
accounts.compressionProgram.value =
|
|
345
|
+
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" as Address<"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK">;
|
|
346
|
+
}
|
|
207
347
|
if (!accounts.systemProgram.value) {
|
|
208
348
|
accounts.systemProgram.value =
|
|
209
349
|
"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,20 @@ 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
|
|
58
|
-
|
|
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
|
|
62
|
+
| string
|
|
63
|
+
| AccountMeta<string> = "mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW",
|
|
64
|
+
TAccountLogWrapper extends
|
|
65
|
+
| string
|
|
66
|
+
| AccountMeta<string> = "mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3",
|
|
59
67
|
TAccountSystemProgram extends
|
|
60
68
|
| string
|
|
61
|
-
| AccountMeta = "11111111111111111111111111111111",
|
|
62
|
-
TRemainingAccounts extends readonly AccountMeta[] = [],
|
|
69
|
+
| AccountMeta<string> = "11111111111111111111111111111111",
|
|
70
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
63
71
|
> = Instruction<TProgram> &
|
|
64
72
|
InstructionWithData<ReadonlyUint8Array> &
|
|
65
73
|
InstructionWithAccounts<
|
|
@@ -119,6 +127,129 @@ export function getCloseTreeV2InstructionDataCodec(): FixedSizeCodec<
|
|
|
119
127
|
);
|
|
120
128
|
}
|
|
121
129
|
|
|
130
|
+
export interface CloseTreeV2AsyncInput<
|
|
131
|
+
TAccountTreeAuthority extends string = string,
|
|
132
|
+
TAccountAuthority extends string = string,
|
|
133
|
+
TAccountMerkleTree extends string = string,
|
|
134
|
+
TAccountRecipient extends string = string,
|
|
135
|
+
TAccountCompressionProgram extends string = string,
|
|
136
|
+
TAccountLogWrapper extends string = string,
|
|
137
|
+
TAccountSystemProgram extends string = string,
|
|
138
|
+
> {
|
|
139
|
+
treeAuthority?: Address<TAccountTreeAuthority>;
|
|
140
|
+
/** Tree creator or delegate. */
|
|
141
|
+
authority: TransactionSigner<TAccountAuthority>;
|
|
142
|
+
merkleTree: Address<TAccountMerkleTree>;
|
|
143
|
+
/**
|
|
144
|
+
* Recipient for reclaimed lamports (tree + config PDA). Must be the creator
|
|
145
|
+
* or the delegate.
|
|
146
|
+
*/
|
|
147
|
+
recipient: Address<TAccountRecipient>;
|
|
148
|
+
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
149
|
+
logWrapper?: Address<TAccountLogWrapper>;
|
|
150
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export async function getCloseTreeV2InstructionAsync<
|
|
154
|
+
TAccountTreeAuthority extends string,
|
|
155
|
+
TAccountAuthority extends string,
|
|
156
|
+
TAccountMerkleTree extends string,
|
|
157
|
+
TAccountRecipient extends string,
|
|
158
|
+
TAccountCompressionProgram extends string,
|
|
159
|
+
TAccountLogWrapper extends string,
|
|
160
|
+
TAccountSystemProgram extends string,
|
|
161
|
+
TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS,
|
|
162
|
+
>(
|
|
163
|
+
input: CloseTreeV2AsyncInput<
|
|
164
|
+
TAccountTreeAuthority,
|
|
165
|
+
TAccountAuthority,
|
|
166
|
+
TAccountMerkleTree,
|
|
167
|
+
TAccountRecipient,
|
|
168
|
+
TAccountCompressionProgram,
|
|
169
|
+
TAccountLogWrapper,
|
|
170
|
+
TAccountSystemProgram
|
|
171
|
+
>,
|
|
172
|
+
config?: { programAddress?: TProgramAddress },
|
|
173
|
+
): Promise<
|
|
174
|
+
CloseTreeV2Instruction<
|
|
175
|
+
TProgramAddress,
|
|
176
|
+
TAccountTreeAuthority,
|
|
177
|
+
TAccountAuthority,
|
|
178
|
+
TAccountMerkleTree,
|
|
179
|
+
TAccountRecipient,
|
|
180
|
+
TAccountCompressionProgram,
|
|
181
|
+
TAccountLogWrapper,
|
|
182
|
+
TAccountSystemProgram
|
|
183
|
+
>
|
|
184
|
+
> {
|
|
185
|
+
// Program address.
|
|
186
|
+
const programAddress = config?.programAddress ?? BUBBLEGUM_PROGRAM_ADDRESS;
|
|
187
|
+
|
|
188
|
+
// Original accounts.
|
|
189
|
+
const originalAccounts = {
|
|
190
|
+
treeAuthority: { value: input.treeAuthority ?? null, isWritable: true },
|
|
191
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
192
|
+
merkleTree: { value: input.merkleTree ?? null, isWritable: true },
|
|
193
|
+
recipient: { value: input.recipient ?? null, isWritable: true },
|
|
194
|
+
compressionProgram: {
|
|
195
|
+
value: input.compressionProgram ?? null,
|
|
196
|
+
isWritable: false,
|
|
197
|
+
},
|
|
198
|
+
logWrapper: { value: input.logWrapper ?? null, isWritable: false },
|
|
199
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
200
|
+
};
|
|
201
|
+
const accounts = originalAccounts as Record<
|
|
202
|
+
keyof typeof originalAccounts,
|
|
203
|
+
ResolvedInstructionAccount
|
|
204
|
+
>;
|
|
205
|
+
|
|
206
|
+
// Resolve default values.
|
|
207
|
+
if (!accounts.treeAuthority.value) {
|
|
208
|
+
accounts.treeAuthority.value = await findTreeConfigPda({
|
|
209
|
+
merkleTree: getAddressFromResolvedInstructionAccount(
|
|
210
|
+
"merkleTree",
|
|
211
|
+
accounts.merkleTree.value,
|
|
212
|
+
),
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
if (!accounts.compressionProgram.value) {
|
|
216
|
+
accounts.compressionProgram.value =
|
|
217
|
+
"mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW" as Address<"mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW">;
|
|
218
|
+
}
|
|
219
|
+
if (!accounts.logWrapper.value) {
|
|
220
|
+
accounts.logWrapper.value =
|
|
221
|
+
"mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3" as Address<"mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3">;
|
|
222
|
+
}
|
|
223
|
+
if (!accounts.systemProgram.value) {
|
|
224
|
+
accounts.systemProgram.value =
|
|
225
|
+
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
229
|
+
return Object.freeze({
|
|
230
|
+
accounts: [
|
|
231
|
+
getAccountMeta("treeAuthority", accounts.treeAuthority),
|
|
232
|
+
getAccountMeta("authority", accounts.authority),
|
|
233
|
+
getAccountMeta("merkleTree", accounts.merkleTree),
|
|
234
|
+
getAccountMeta("recipient", accounts.recipient),
|
|
235
|
+
getAccountMeta("compressionProgram", accounts.compressionProgram),
|
|
236
|
+
getAccountMeta("logWrapper", accounts.logWrapper),
|
|
237
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
238
|
+
],
|
|
239
|
+
data: getCloseTreeV2InstructionDataEncoder().encode({}),
|
|
240
|
+
programAddress,
|
|
241
|
+
} as CloseTreeV2Instruction<
|
|
242
|
+
TProgramAddress,
|
|
243
|
+
TAccountTreeAuthority,
|
|
244
|
+
TAccountAuthority,
|
|
245
|
+
TAccountMerkleTree,
|
|
246
|
+
TAccountRecipient,
|
|
247
|
+
TAccountCompressionProgram,
|
|
248
|
+
TAccountLogWrapper,
|
|
249
|
+
TAccountSystemProgram
|
|
250
|
+
>);
|
|
251
|
+
}
|
|
252
|
+
|
|
122
253
|
export interface CloseTreeV2Input<
|
|
123
254
|
TAccountTreeAuthority extends string = string,
|
|
124
255
|
TAccountAuthority extends string = string,
|
|
@@ -137,8 +268,8 @@ export interface CloseTreeV2Input<
|
|
|
137
268
|
* or the delegate.
|
|
138
269
|
*/
|
|
139
270
|
recipient: Address<TAccountRecipient>;
|
|
140
|
-
compressionProgram
|
|
141
|
-
logWrapper
|
|
271
|
+
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
272
|
+
logWrapper?: Address<TAccountLogWrapper>;
|
|
142
273
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
143
274
|
}
|
|
144
275
|
|
|
@@ -194,6 +325,14 @@ export function getCloseTreeV2Instruction<
|
|
|
194
325
|
>;
|
|
195
326
|
|
|
196
327
|
// Resolve default values.
|
|
328
|
+
if (!accounts.compressionProgram.value) {
|
|
329
|
+
accounts.compressionProgram.value =
|
|
330
|
+
"mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW" as Address<"mcmt6YrQEMKw8Mw43FmpRLmf7BqRnFMKmAcbxE3xkAW">;
|
|
331
|
+
}
|
|
332
|
+
if (!accounts.logWrapper.value) {
|
|
333
|
+
accounts.logWrapper.value =
|
|
334
|
+
"mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3" as Address<"mnoopTCrg4p8ry25e4bcWA9XZjbNjMTfgYVGGEdRsf3">;
|
|
335
|
+
}
|
|
197
336
|
if (!accounts.systemProgram.value) {
|
|
198
337
|
accounts.systemProgram.value =
|
|
199
338
|
"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,31 @@ 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
|
|
62
|
-
|
|
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
|
|
66
|
+
| string
|
|
67
|
+
| AccountMeta<string> = "noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV",
|
|
68
|
+
TAccountCompressionProgram extends
|
|
69
|
+
| string
|
|
70
|
+
| AccountMeta<string> = "cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK",
|
|
63
71
|
TAccountTokenProgram extends
|
|
64
72
|
| string
|
|
65
|
-
| AccountMeta = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
|
73
|
+
| AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
|
|
66
74
|
TAccountTokenMetadataProgram extends
|
|
67
75
|
| string
|
|
68
|
-
| AccountMeta = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s",
|
|
76
|
+
| AccountMeta<string> = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s",
|
|
69
77
|
TAccountSystemProgram extends
|
|
70
78
|
| string
|
|
71
|
-
| AccountMeta = "11111111111111111111111111111111",
|
|
72
|
-
TRemainingAccounts extends readonly AccountMeta[] = [],
|
|
79
|
+
| AccountMeta<string> = "11111111111111111111111111111111",
|
|
80
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
73
81
|
> = Instruction<TProgram> &
|
|
74
82
|
InstructionWithData<ReadonlyUint8Array> &
|
|
75
83
|
InstructionWithAccounts<
|
|
@@ -151,6 +159,191 @@ export function getCompressInstructionDataCodec(): FixedSizeCodec<
|
|
|
151
159
|
);
|
|
152
160
|
}
|
|
153
161
|
|
|
162
|
+
export interface CompressAsyncInput<
|
|
163
|
+
TAccountTreeAuthority extends string = string,
|
|
164
|
+
TAccountLeafOwner extends string = string,
|
|
165
|
+
TAccountLeafDelegate extends string = string,
|
|
166
|
+
TAccountMerkleTree extends string = string,
|
|
167
|
+
TAccountTokenAccount extends string = string,
|
|
168
|
+
TAccountMint extends string = string,
|
|
169
|
+
TAccountMetadata extends string = string,
|
|
170
|
+
TAccountMasterEdition extends string = string,
|
|
171
|
+
TAccountPayer extends string = string,
|
|
172
|
+
TAccountLogWrapper extends string = string,
|
|
173
|
+
TAccountCompressionProgram extends string = string,
|
|
174
|
+
TAccountTokenProgram extends string = string,
|
|
175
|
+
TAccountTokenMetadataProgram extends string = string,
|
|
176
|
+
TAccountSystemProgram extends string = string,
|
|
177
|
+
> {
|
|
178
|
+
treeAuthority?: Address<TAccountTreeAuthority>;
|
|
179
|
+
leafOwner: TransactionSigner<TAccountLeafOwner>;
|
|
180
|
+
leafDelegate: Address<TAccountLeafDelegate>;
|
|
181
|
+
merkleTree: Address<TAccountMerkleTree>;
|
|
182
|
+
tokenAccount: Address<TAccountTokenAccount>;
|
|
183
|
+
mint: Address<TAccountMint>;
|
|
184
|
+
metadata: Address<TAccountMetadata>;
|
|
185
|
+
masterEdition: Address<TAccountMasterEdition>;
|
|
186
|
+
payer: TransactionSigner<TAccountPayer>;
|
|
187
|
+
logWrapper?: Address<TAccountLogWrapper>;
|
|
188
|
+
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
189
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
190
|
+
tokenMetadataProgram?: Address<TAccountTokenMetadataProgram>;
|
|
191
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export async function getCompressInstructionAsync<
|
|
195
|
+
TAccountTreeAuthority extends string,
|
|
196
|
+
TAccountLeafOwner extends string,
|
|
197
|
+
TAccountLeafDelegate extends string,
|
|
198
|
+
TAccountMerkleTree extends string,
|
|
199
|
+
TAccountTokenAccount extends string,
|
|
200
|
+
TAccountMint extends string,
|
|
201
|
+
TAccountMetadata extends string,
|
|
202
|
+
TAccountMasterEdition extends string,
|
|
203
|
+
TAccountPayer extends string,
|
|
204
|
+
TAccountLogWrapper extends string,
|
|
205
|
+
TAccountCompressionProgram extends string,
|
|
206
|
+
TAccountTokenProgram extends string,
|
|
207
|
+
TAccountTokenMetadataProgram extends string,
|
|
208
|
+
TAccountSystemProgram extends string,
|
|
209
|
+
TProgramAddress extends Address = typeof BUBBLEGUM_PROGRAM_ADDRESS,
|
|
210
|
+
>(
|
|
211
|
+
input: CompressAsyncInput<
|
|
212
|
+
TAccountTreeAuthority,
|
|
213
|
+
TAccountLeafOwner,
|
|
214
|
+
TAccountLeafDelegate,
|
|
215
|
+
TAccountMerkleTree,
|
|
216
|
+
TAccountTokenAccount,
|
|
217
|
+
TAccountMint,
|
|
218
|
+
TAccountMetadata,
|
|
219
|
+
TAccountMasterEdition,
|
|
220
|
+
TAccountPayer,
|
|
221
|
+
TAccountLogWrapper,
|
|
222
|
+
TAccountCompressionProgram,
|
|
223
|
+
TAccountTokenProgram,
|
|
224
|
+
TAccountTokenMetadataProgram,
|
|
225
|
+
TAccountSystemProgram
|
|
226
|
+
>,
|
|
227
|
+
config?: { programAddress?: TProgramAddress },
|
|
228
|
+
): Promise<
|
|
229
|
+
CompressInstruction<
|
|
230
|
+
TProgramAddress,
|
|
231
|
+
TAccountTreeAuthority,
|
|
232
|
+
TAccountLeafOwner,
|
|
233
|
+
TAccountLeafDelegate,
|
|
234
|
+
TAccountMerkleTree,
|
|
235
|
+
TAccountTokenAccount,
|
|
236
|
+
TAccountMint,
|
|
237
|
+
TAccountMetadata,
|
|
238
|
+
TAccountMasterEdition,
|
|
239
|
+
TAccountPayer,
|
|
240
|
+
TAccountLogWrapper,
|
|
241
|
+
TAccountCompressionProgram,
|
|
242
|
+
TAccountTokenProgram,
|
|
243
|
+
TAccountTokenMetadataProgram,
|
|
244
|
+
TAccountSystemProgram
|
|
245
|
+
>
|
|
246
|
+
> {
|
|
247
|
+
// Program address.
|
|
248
|
+
const programAddress = config?.programAddress ?? BUBBLEGUM_PROGRAM_ADDRESS;
|
|
249
|
+
|
|
250
|
+
// Original accounts.
|
|
251
|
+
const originalAccounts = {
|
|
252
|
+
treeAuthority: { value: input.treeAuthority ?? null, isWritable: false },
|
|
253
|
+
leafOwner: { value: input.leafOwner ?? null, isWritable: false },
|
|
254
|
+
leafDelegate: { value: input.leafDelegate ?? null, isWritable: false },
|
|
255
|
+
merkleTree: { value: input.merkleTree ?? null, isWritable: false },
|
|
256
|
+
tokenAccount: { value: input.tokenAccount ?? null, isWritable: true },
|
|
257
|
+
mint: { value: input.mint ?? null, isWritable: true },
|
|
258
|
+
metadata: { value: input.metadata ?? null, isWritable: true },
|
|
259
|
+
masterEdition: { value: input.masterEdition ?? null, isWritable: true },
|
|
260
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
261
|
+
logWrapper: { value: input.logWrapper ?? null, isWritable: false },
|
|
262
|
+
compressionProgram: {
|
|
263
|
+
value: input.compressionProgram ?? null,
|
|
264
|
+
isWritable: false,
|
|
265
|
+
},
|
|
266
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
267
|
+
tokenMetadataProgram: {
|
|
268
|
+
value: input.tokenMetadataProgram ?? null,
|
|
269
|
+
isWritable: false,
|
|
270
|
+
},
|
|
271
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
272
|
+
};
|
|
273
|
+
const accounts = originalAccounts as Record<
|
|
274
|
+
keyof typeof originalAccounts,
|
|
275
|
+
ResolvedInstructionAccount
|
|
276
|
+
>;
|
|
277
|
+
|
|
278
|
+
// Resolve default values.
|
|
279
|
+
if (!accounts.treeAuthority.value) {
|
|
280
|
+
accounts.treeAuthority.value = await findTreeConfigPda({
|
|
281
|
+
merkleTree: getAddressFromResolvedInstructionAccount(
|
|
282
|
+
"merkleTree",
|
|
283
|
+
accounts.merkleTree.value,
|
|
284
|
+
),
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
if (!accounts.logWrapper.value) {
|
|
288
|
+
accounts.logWrapper.value =
|
|
289
|
+
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" as Address<"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV">;
|
|
290
|
+
}
|
|
291
|
+
if (!accounts.compressionProgram.value) {
|
|
292
|
+
accounts.compressionProgram.value =
|
|
293
|
+
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" as Address<"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK">;
|
|
294
|
+
}
|
|
295
|
+
if (!accounts.tokenProgram.value) {
|
|
296
|
+
accounts.tokenProgram.value =
|
|
297
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
|
|
298
|
+
}
|
|
299
|
+
if (!accounts.tokenMetadataProgram.value) {
|
|
300
|
+
accounts.tokenMetadataProgram.value =
|
|
301
|
+
"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" as Address<"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s">;
|
|
302
|
+
}
|
|
303
|
+
if (!accounts.systemProgram.value) {
|
|
304
|
+
accounts.systemProgram.value =
|
|
305
|
+
"11111111111111111111111111111111" as Address<"11111111111111111111111111111111">;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
309
|
+
return Object.freeze({
|
|
310
|
+
accounts: [
|
|
311
|
+
getAccountMeta("treeAuthority", accounts.treeAuthority),
|
|
312
|
+
getAccountMeta("leafOwner", accounts.leafOwner),
|
|
313
|
+
getAccountMeta("leafDelegate", accounts.leafDelegate),
|
|
314
|
+
getAccountMeta("merkleTree", accounts.merkleTree),
|
|
315
|
+
getAccountMeta("tokenAccount", accounts.tokenAccount),
|
|
316
|
+
getAccountMeta("mint", accounts.mint),
|
|
317
|
+
getAccountMeta("metadata", accounts.metadata),
|
|
318
|
+
getAccountMeta("masterEdition", accounts.masterEdition),
|
|
319
|
+
getAccountMeta("payer", accounts.payer),
|
|
320
|
+
getAccountMeta("logWrapper", accounts.logWrapper),
|
|
321
|
+
getAccountMeta("compressionProgram", accounts.compressionProgram),
|
|
322
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
323
|
+
getAccountMeta("tokenMetadataProgram", accounts.tokenMetadataProgram),
|
|
324
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
325
|
+
],
|
|
326
|
+
data: getCompressInstructionDataEncoder().encode({}),
|
|
327
|
+
programAddress,
|
|
328
|
+
} as CompressInstruction<
|
|
329
|
+
TProgramAddress,
|
|
330
|
+
TAccountTreeAuthority,
|
|
331
|
+
TAccountLeafOwner,
|
|
332
|
+
TAccountLeafDelegate,
|
|
333
|
+
TAccountMerkleTree,
|
|
334
|
+
TAccountTokenAccount,
|
|
335
|
+
TAccountMint,
|
|
336
|
+
TAccountMetadata,
|
|
337
|
+
TAccountMasterEdition,
|
|
338
|
+
TAccountPayer,
|
|
339
|
+
TAccountLogWrapper,
|
|
340
|
+
TAccountCompressionProgram,
|
|
341
|
+
TAccountTokenProgram,
|
|
342
|
+
TAccountTokenMetadataProgram,
|
|
343
|
+
TAccountSystemProgram
|
|
344
|
+
>);
|
|
345
|
+
}
|
|
346
|
+
|
|
154
347
|
export interface CompressInput<
|
|
155
348
|
TAccountTreeAuthority extends string = string,
|
|
156
349
|
TAccountLeafOwner extends string = string,
|
|
@@ -176,8 +369,8 @@ export interface CompressInput<
|
|
|
176
369
|
metadata: Address<TAccountMetadata>;
|
|
177
370
|
masterEdition: Address<TAccountMasterEdition>;
|
|
178
371
|
payer: TransactionSigner<TAccountPayer>;
|
|
179
|
-
logWrapper
|
|
180
|
-
compressionProgram
|
|
372
|
+
logWrapper?: Address<TAccountLogWrapper>;
|
|
373
|
+
compressionProgram?: Address<TAccountCompressionProgram>;
|
|
181
374
|
tokenProgram?: Address<TAccountTokenProgram>;
|
|
182
375
|
tokenMetadataProgram?: Address<TAccountTokenMetadataProgram>;
|
|
183
376
|
systemProgram?: Address<TAccountSystemProgram>;
|
|
@@ -266,6 +459,14 @@ export function getCompressInstruction<
|
|
|
266
459
|
>;
|
|
267
460
|
|
|
268
461
|
// Resolve default values.
|
|
462
|
+
if (!accounts.logWrapper.value) {
|
|
463
|
+
accounts.logWrapper.value =
|
|
464
|
+
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV" as Address<"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV">;
|
|
465
|
+
}
|
|
466
|
+
if (!accounts.compressionProgram.value) {
|
|
467
|
+
accounts.compressionProgram.value =
|
|
468
|
+
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK" as Address<"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK">;
|
|
469
|
+
}
|
|
269
470
|
if (!accounts.tokenProgram.value) {
|
|
270
471
|
accounts.tokenProgram.value =
|
|
271
472
|
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" as Address<"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA">;
|