@solana-program/token-wrap 2.4.0 → 2.5.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/package.json +18 -15
- package/src/create-mint.ts +125 -0
- package/src/examples/multisig.ts +295 -0
- package/src/examples/single-signer.ts +175 -0
- package/src/examples/sync-spl-to-token2022.ts +96 -0
- package/src/examples/sync-token2022-to-spl.ts +101 -0
- package/src/generated/accounts/backpointer.ts +125 -0
- package/{dist/types/src/generated/accounts/index.d.ts → src/generated/accounts/index.ts} +1 -0
- package/{dist/types/src/generated/errors/index.d.ts → src/generated/errors/index.ts} +1 -0
- package/src/generated/errors/tokenWrap.ts +89 -0
- package/{dist/types/src/generated/index.d.ts → src/generated/index.ts} +1 -0
- package/src/generated/instructions/closeStuckEscrow.ts +235 -0
- package/src/generated/instructions/createMint.ts +250 -0
- package/{dist/types/src/generated/instructions/index.d.ts → src/generated/instructions/index.ts} +1 -0
- package/src/generated/instructions/syncMetadataToSplToken.ts +305 -0
- package/src/generated/instructions/syncMetadataToToken2022.ts +253 -0
- package/src/generated/instructions/unwrap.ts +326 -0
- package/src/generated/instructions/wrap.ts +326 -0
- package/src/generated/pdas/backpointer.ts +32 -0
- package/{dist/types/src/generated/pdas/index.d.ts → src/generated/pdas/index.ts} +1 -0
- package/src/generated/pdas/wrappedMint.ts +37 -0
- package/src/generated/pdas/wrappedMintAuthority.ts +32 -0
- package/{dist/types/src/generated/programs/index.d.ts → src/generated/programs/index.ts} +1 -0
- package/src/generated/programs/tokenWrap.ts +228 -0
- package/src/global.d.ts +8 -0
- package/src/index.ts +23 -0
- package/src/unwrap.ts +208 -0
- package/src/utilities.ts +234 -0
- package/src/wrap.ts +211 -0
- package/dist/src/index.js +0 -1222
- package/dist/src/index.js.map +0 -1
- package/dist/src/index.mjs +0 -1135
- package/dist/src/index.mjs.map +0 -1
- package/dist/types/src/create-mint.d.ts +0 -16
- package/dist/types/src/examples/multisig.d.ts +0 -1
- package/dist/types/src/examples/single-signer.d.ts +0 -1
- package/dist/types/src/examples/sync-spl-to-token2022.d.ts +0 -1
- package/dist/types/src/examples/sync-token2022-to-spl.d.ts +0 -1
- package/dist/types/src/generated/accounts/backpointer.d.ts +0 -33
- package/dist/types/src/generated/errors/tokenWrap.d.ts +0 -35
- package/dist/types/src/generated/instructions/closeStuckEscrow.d.ts +0 -63
- package/dist/types/src/generated/instructions/createMint.d.ts +0 -76
- package/dist/types/src/generated/instructions/syncMetadataToSplToken.d.ts +0 -92
- package/dist/types/src/generated/instructions/syncMetadataToToken2022.d.ts +0 -75
- package/dist/types/src/generated/instructions/unwrap.d.ts +0 -103
- package/dist/types/src/generated/instructions/wrap.d.ts +0 -103
- package/dist/types/src/generated/pdas/backpointer.d.ts +0 -14
- package/dist/types/src/generated/pdas/wrappedMint.d.ts +0 -15
- package/dist/types/src/generated/pdas/wrappedMintAuthority.d.ts +0 -14
- package/dist/types/src/generated/programs/tokenWrap.d.ts +0 -38
- package/dist/types/src/generated/shared/index.d.ts +0 -49
- package/dist/types/src/index.d.ts +0 -5
- package/dist/types/src/unwrap.d.ts +0 -44
- package/dist/types/src/utilities.d.ts +0 -37
- package/dist/types/src/wrap.d.ts +0 -41
- package/dist/types/tsup.config.d.ts +0 -3
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/generated/pdas/backpointer.ts","../../src/generated/pdas/wrappedMint.ts","../../src/generated/pdas/wrappedMintAuthority.ts","../../src/generated/accounts/backpointer.ts","../../src/generated/shared/index.ts","../../src/generated/instructions/closeStuckEscrow.ts","../../src/generated/instructions/createMint.ts","../../src/generated/instructions/syncMetadataToSplToken.ts","../../src/generated/instructions/syncMetadataToToken2022.ts","../../src/generated/instructions/unwrap.ts","../../src/generated/instructions/wrap.ts","../../src/generated/programs/tokenWrap.ts","../../src/generated/errors/tokenWrap.ts","../../src/create-mint.ts","../../src/utilities.ts","../../src/wrap.ts","../../src/unwrap.ts"],"names":["getProgramDerivedAddress","getUtf8Encoder","getAddressEncoder","getStructEncoder","getStructDecoder","getAddressDecoder","combineCodec","decodeAccount","assertAccountExists","fetchEncodedAccount","assertAccountsExist","fetchEncodedAccounts","AccountRole","upgradeRoleToSigner","kitIsTransactionSigner","getU8Encoder","transformEncoder","getU8Decoder","getBooleanEncoder","getBooleanDecoder","getU64Encoder","getU64Decoder","TokenWrapAccount","TokenWrapInstruction","containsBytes","assertIsInstructionWithAccounts","isProgramError","extension","getMintSize","TOKEN_2022_PROGRAM_ADDRESS","getTransferSolInstruction","findAssociatedTokenPda","fetchMaybeToken","getCreateAssociatedTokenInstruction","getTokenDecoder","assertIsFullySignedTransaction","assertIsSendableTransaction","pipe","createTransactionMessage","setTransactionMessageFeePayerSigner","setTransactionMessageLifetimeUsingBlockhash","appendTransactionMessageInstructions"],"mappings":";;;;;;;;AAoBA,eAAsB,kBAAA,CAClB,KAAA,EACA,MAAA,GAAmD,EAAC,EACtB;AAC9B,EAAA,MAAM;AAAA,IACF,cAAA,GAAiB;AAAA,GACrB,GAAI,MAAA;AACJ,EAAA,OAAO,MAAMA,4BAAA,CAAyB;AAAA,IAClC,cAAA;AAAA,IACA,KAAA,EAAO,CAACC,kBAAA,EAAe,CAAE,MAAA,CAAO,aAAa,CAAA,EAAGC,qBAAA,EAAkB,CAAE,MAAA,CAAO,KAAA,CAAM,WAAW,CAAC;AAAA,GAChG,CAAA;AACL;ACVA,eAAsB,kBAAA,CAClB,KAAA,EACA,MAAA,GAAmD,EAAC,EACtB;AAC9B,EAAA,MAAM;AAAA,IACF,cAAA,GAAiB;AAAA,GACrB,GAAI,MAAA;AACJ,EAAA,OAAO,MAAMF,4BAAAA,CAAyB;AAAA,IAClC,cAAA;AAAA,IACA,KAAA,EAAO;AAAA,MACHC,kBAAAA,EAAe,CAAE,MAAA,CAAO,MAAM,CAAA;AAAA,MAC9BC,qBAAAA,EAAkB,CAAE,MAAA,CAAO,KAAA,CAAM,aAAa,CAAA;AA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AAA,CAAoC,IAAA,CAAK,KAAA,EAAO,EAAE,CAAA;AAAA,IACxD,CAAA,EAAA,KAAMC,+CAAAA,CAA4C,IAAA,CAAK,SAAA,EAAW,EAAE,CAAA;AAAA,IACpE,CAAA,EAAA,KAAMC,wCAAAA,CAAqC,CAAC,QAAQ,GAAG,EAAE;AAAA,GAC7D;AACJ","file":"index.js","sourcesContent":["/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n getAddressEncoder,\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/kit';\n\nexport type BackpointerSeeds = {\n wrappedMint: Address;\n};\n\nexport async function findBackpointerPda(\n seeds: BackpointerSeeds,\n config: { programAddress?: Address | undefined } = {},\n): Promise<ProgramDerivedAddress> {\n const {\n programAddress = 'TwRapQCDhWkZRrDaHfZGuHxkZ91gHDRkyuzNqeU5MgR' as Address<'TwRapQCDhWkZRrDaHfZGuHxkZ91gHDRkyuzNqeU5MgR'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [getUtf8Encoder().encode('backpointer'), getAddressEncoder().encode(seeds.wrappedMint)],\n });\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n getAddressEncoder,\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/kit';\n\nexport type WrappedMintSeeds = {\n unwrappedMint: Address;\n wrappedTokenProgram: Address;\n};\n\nexport async function findWrappedMintPda(\n seeds: WrappedMintSeeds,\n config: { programAddress?: Address | undefined } = {},\n): Promise<ProgramDerivedAddress> {\n const {\n programAddress = 'TwRapQCDhWkZRrDaHfZGuHxkZ91gHDRkyuzNqeU5MgR' as Address<'TwRapQCDhWkZRrDaHfZGuHxkZ91gHDRkyuzNqeU5MgR'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [\n getUtf8Encoder().encode('mint'),\n getAddressEncoder().encode(seeds.unwrappedMint),\n getAddressEncoder().encode(seeds.wrappedTokenProgram),\n ],\n });\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n getAddressEncoder,\n getProgramDerivedAddress,\n getUtf8Encoder,\n type Address,\n type ProgramDerivedAddress,\n} from '@solana/kit';\n\nexport type WrappedMintAuthoritySeeds = {\n wrappedMint: Address;\n};\n\nexport async function findWrappedMintAuthorityPda(\n seeds: WrappedMintAuthoritySeeds,\n config: { programAddress?: Address | undefined } = {},\n): Promise<ProgramDerivedAddress> {\n const {\n programAddress = 'TwRapQCDhWkZRrDaHfZGuHxkZ91gHDRkyuzNqeU5MgR' as Address<'TwRapQCDhWkZRrDaHfZGuHxkZ91gHDRkyuzNqeU5MgR'>,\n } = config;\n return await getProgramDerivedAddress({\n programAddress,\n seeds: [getUtf8Encoder().encode('authority'), getAddressEncoder().encode(seeds.wrappedMint)],\n });\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n assertAccountExists,\n assertAccountsExist,\n combineCodec,\n decodeAccount,\n fetchEncodedAccount,\n fetchEncodedAccounts,\n getAddressDecoder,\n getAddressEncoder,\n getStructDecoder,\n getStructEncoder,\n type Account,\n type Address,\n type EncodedAccount,\n type FetchAccountConfig,\n type FetchAccountsConfig,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type MaybeAccount,\n type MaybeEncodedAccount,\n} from '@solana/kit';\nimport { BackpointerSeeds, findBackpointerPda } from '../pdas';\n\n/** Account to store the address of the unwrapped mint. */\nexport type Backpointer = { unwrappedMint: Address };\n\nexport type BackpointerArgs = Backpointer;\n\n/** Gets the encoder for {@link BackpointerArgs} account data. */\nexport function getBackpointerEncoder(): FixedSizeEncoder<BackpointerArgs> {\n return getStructEncoder([['unwrappedMint', getAddressEncoder()]]);\n}\n\n/** Gets the decoder for {@link Backpointer} account data. */\nexport function getBackpointerDecoder(): FixedSizeDecoder<Backpointer> {\n return getStructDecoder([['unwrappedMint', getAddressDecoder()]]);\n}\n\n/** Gets the codec for {@link Backpointer} account data. */\nexport function getBackpointerCodec(): FixedSizeCodec<BackpointerArgs, Backpointer> {\n return combineCodec(getBackpointerEncoder(), getBackpointerDecoder());\n}\n\nexport function decodeBackpointer<TAddress extends string = string>(\n encodedAccount: EncodedAccount<TAddress>,\n): Account<Backpointer, TAddress>;\nexport function decodeBackpointer<TAddress extends string = string>(\n encodedAccount: MaybeEncodedAccount<TAddress>,\n): MaybeAccount<Backpointer, TAddress>;\nexport function decodeBackpointer<TAddress extends string = string>(\n encodedAccount: EncodedAccount<TAddress> | MaybeEncodedAccount<TAddress>,\n): Account<Backpointer, TAddress> | MaybeAccount<Backpointer, TAddress> {\n return decodeAccount(encodedAccount as MaybeEncodedAccount<TAddress>, getBackpointerDecoder());\n}\n\nexport async function fetchBackpointer<TAddress extends string = string>(\n rpc: Parameters<typeof fetchEncodedAccount>[0],\n address: Address<TAddress>,\n config?: FetchAccountConfig,\n): Promise<Account<Backpointer, TAddress>> {\n const maybeAccount = await fetchMaybeBackpointer(rpc, address, config);\n assertAccountExists(maybeAccount);\n return maybeAccount;\n}\n\nexport async function fetchMaybeBackpointer<TAddress extends string = string>(\n rpc: Parameters<typeof fetchEncodedAccount>[0],\n address: Address<TAddress>,\n config?: FetchAccountConfig,\n): Promise<MaybeAccount<Backpointer, TAddress>> {\n const maybeAccount = await fetchEncodedAccount(rpc, address, config);\n return decodeBackpointer(maybeAccount);\n}\n\nexport async function fetchAllBackpointer(\n rpc: Parameters<typeof fetchEncodedAccounts>[0],\n addresses: Array<Address>,\n config?: FetchAccountsConfig,\n): Promise<Account<Backpointer>[]> {\n const maybeAccounts = await fetchAllMaybeBackpointer(rpc, addresses, config);\n assertAccountsExist(maybeAccounts);\n return maybeAccounts;\n}\n\nexport async function fetchAllMaybeBackpointer(\n rpc: Parameters<typeof fetchEncodedAccounts>[0],\n addresses: Array<Address>,\n config?: FetchAccountsConfig,\n): Promise<MaybeAccount<Backpointer>[]> {\n const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);\n return maybeAccounts.map(maybeAccount => decodeBackpointer(maybeAccount));\n}\n\nexport function getBackpointerSize(): number {\n return 32;\n}\n\nexport async function fetchBackpointerFromSeeds(\n rpc: Parameters<typeof fetchEncodedAccount>[0],\n seeds: BackpointerSeeds,\n config: FetchAccountConfig & { programAddress?: Address } = {},\n): Promise<Account<Backpointer>> {\n const maybeAccount = await fetchMaybeBackpointerFromSeeds(rpc, seeds, config);\n assertAccountExists(maybeAccount);\n return maybeAccount;\n}\n\nexport async function fetchMaybeBackpointerFromSeeds(\n rpc: Parameters<typeof fetchEncodedAccount>[0],\n seeds: BackpointerSeeds,\n config: FetchAccountConfig & { programAddress?: Address } = {},\n): Promise<MaybeAccount<Backpointer>> {\n const { programAddress, ...fetchConfig } = config;\n const [address] = await findBackpointerPda(seeds, { programAddress });\n return await fetchMaybeBackpointer(rpc, address, fetchConfig);\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n AccountRole,\n isProgramDerivedAddress,\n isTransactionSigner as kitIsTransactionSigner,\n type AccountMeta,\n type AccountSignerMeta,\n type Address,\n type ProgramDerivedAddress,\n type TransactionSigner,\n upgradeRoleToSigner,\n} from '@solana/kit';\n\n/**\n * Asserts that the given value is not null or undefined.\n * @internal\n */\nexport function expectSome<T>(value: T | null | undefined): T {\n if (value === null || value === undefined) {\n throw new Error('Expected a value but received null or undefined.');\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a PublicKey.\n * @internal\n */\nexport function expectAddress<T extends string = string>(\n value: Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null | undefined,\n): Address<T> {\n if (!value) {\n throw new Error('Expected a Address.');\n }\n if (typeof value === 'object' && 'address' in value) {\n return value.address;\n }\n if (Array.isArray(value)) {\n return value[0] as Address<T>;\n }\n return value as Address<T>;\n}\n\n/**\n * Asserts that the given value is a PDA.\n * @internal\n */\nexport function expectProgramDerivedAddress<T extends string = string>(\n value: Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null | undefined,\n): ProgramDerivedAddress<T> {\n if (!value || !Array.isArray(value) || !isProgramDerivedAddress(value)) {\n throw new Error('Expected a ProgramDerivedAddress.');\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a TransactionSigner.\n * @internal\n */\nexport function expectTransactionSigner<T extends string = string>(\n value: Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null | undefined,\n): TransactionSigner<T> {\n if (!value || !isTransactionSigner(value)) {\n throw new Error('Expected a TransactionSigner.');\n }\n return value;\n}\n\n/**\n * Defines an instruction account to resolve.\n * @internal\n */\nexport type ResolvedAccount<\n T extends string = string,\n U extends Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null =\n | Address<T>\n | ProgramDerivedAddress<T>\n | TransactionSigner<T>\n | null,\n> = {\n isWritable: boolean;\n value: U;\n};\n\n/**\n * Defines an instruction that stores additional bytes on-chain.\n * @internal\n */\nexport type InstructionWithByteDelta = {\n byteDelta: number;\n};\n\n/**\n * Get account metas and signers from resolved accounts.\n * @internal\n */\nexport function getAccountMetaFactory(programAddress: Address, optionalAccountStrategy: 'omitted' | 'programId') {\n return (account: ResolvedAccount): AccountMeta | AccountSignerMeta | undefined => {\n if (!account.value) {\n if (optionalAccountStrategy === 'omitted') return;\n return Object.freeze({ address: programAddress, role: AccountRole.READONLY });\n }\n\n const writableRole = account.isWritable ? AccountRole.WRITABLE : AccountRole.READONLY;\n return Object.freeze({\n address: expectAddress(account.value),\n role: isTransactionSigner(account.value) ? upgradeRoleToSigner(writableRole) : writableRole,\n ...(isTransactionSigner(account.value) ? { signer: account.value } : {}),\n });\n };\n}\n\nexport function isTransactionSigner<TAddress extends string = string>(\n value: Address<TAddress> | ProgramDerivedAddress<TAddress> | TransactionSigner<TAddress>,\n): value is TransactionSigner<TAddress> {\n return !!value && typeof value === 'object' && 'address' in value && kitIsTransactionSigner(value);\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyAccount,\n type ReadonlyUint8Array,\n type WritableAccount,\n} from '@solana/kit';\nimport { TOKEN_WRAP_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport const CLOSE_STUCK_ESCROW_DISCRIMINATOR = 3;\n\nexport function getCloseStuckEscrowDiscriminatorBytes() {\n return getU8Encoder().encode(CLOSE_STUCK_ESCROW_DISCRIMINATOR);\n}\n\nexport type CloseStuckEscrowInstruction<\n TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n TAccountEscrow extends string | AccountMeta<string> = string,\n TAccountDestination extends string | AccountMeta<string> = string,\n TAccountUnwrappedMint extends string | AccountMeta<string> = string,\n TAccountWrappedMint extends string | AccountMeta<string> = string,\n TAccountWrappedMintAuthority extends string | AccountMeta<string> = string,\n TAccountToken2022Program extends string | AccountMeta<string> = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<\n [\n TAccountEscrow extends string ? WritableAccount<TAccountEscrow> : TAccountEscrow,\n TAccountDestination extends string ? WritableAccount<TAccountDestination> : TAccountDestination,\n TAccountUnwrappedMint extends string ? ReadonlyAccount<TAccountUnwrappedMint> : TAccountUnwrappedMint,\n TAccountWrappedMint extends string ? ReadonlyAccount<TAccountWrappedMint> : TAccountWrappedMint,\n TAccountWrappedMintAuthority extends string\n ? ReadonlyAccount<TAccountWrappedMintAuthority>\n : TAccountWrappedMintAuthority,\n TAccountToken2022Program extends string\n ? ReadonlyAccount<TAccountToken2022Program>\n : TAccountToken2022Program,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type CloseStuckEscrowInstructionData = { discriminator: number };\n\nexport type CloseStuckEscrowInstructionDataArgs = {};\n\nexport function getCloseStuckEscrowInstructionDataEncoder(): FixedSizeEncoder<CloseStuckEscrowInstructionDataArgs> {\n return transformEncoder(getStructEncoder([['discriminator', getU8Encoder()]]), value => ({\n ...value,\n discriminator: CLOSE_STUCK_ESCROW_DISCRIMINATOR,\n }));\n}\n\nexport function getCloseStuckEscrowInstructionDataDecoder(): FixedSizeDecoder<CloseStuckEscrowInstructionData> {\n return getStructDecoder([['discriminator', getU8Decoder()]]);\n}\n\nexport function getCloseStuckEscrowInstructionDataCodec(): FixedSizeCodec<\n CloseStuckEscrowInstructionDataArgs,\n CloseStuckEscrowInstructionData\n> {\n return combineCodec(getCloseStuckEscrowInstructionDataEncoder(), getCloseStuckEscrowInstructionDataDecoder());\n}\n\nexport type CloseStuckEscrowInput<\n TAccountEscrow extends string = string,\n TAccountDestination extends string = string,\n TAccountUnwrappedMint extends string = string,\n TAccountWrappedMint extends string = string,\n TAccountWrappedMintAuthority extends string = string,\n TAccountToken2022Program extends string = string,\n> = {\n /** Escrow account to close (ATA) */\n escrow: Address<TAccountEscrow>;\n /** Destination for lamports from closed account */\n destination: Address<TAccountDestination>;\n /** Unwrapped mint */\n unwrappedMint: Address<TAccountUnwrappedMint>;\n /** Wrapped mint */\n wrappedMint: Address<TAccountWrappedMint>;\n /** Wrapped mint authority (PDA) */\n wrappedMintAuthority: Address<TAccountWrappedMintAuthority>;\n /** Token-2022 program */\n token2022Program?: Address<TAccountToken2022Program>;\n};\n\nexport function getCloseStuckEscrowInstruction<\n TAccountEscrow extends string,\n TAccountDestination extends string,\n TAccountUnwrappedMint extends string,\n TAccountWrappedMint extends string,\n TAccountWrappedMintAuthority extends string,\n TAccountToken2022Program extends string,\n TProgramAddress extends Address = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n>(\n input: CloseStuckEscrowInput<\n TAccountEscrow,\n TAccountDestination,\n TAccountUnwrappedMint,\n TAccountWrappedMint,\n TAccountWrappedMintAuthority,\n TAccountToken2022Program\n >,\n config?: { programAddress?: TProgramAddress },\n): CloseStuckEscrowInstruction<\n TProgramAddress,\n TAccountEscrow,\n TAccountDestination,\n TAccountUnwrappedMint,\n TAccountWrappedMint,\n TAccountWrappedMintAuthority,\n TAccountToken2022Program\n> {\n // Program address.\n const programAddress = config?.programAddress ?? TOKEN_WRAP_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n escrow: { value: input.escrow ?? null, isWritable: true },\n destination: { value: input.destination ?? null, isWritable: true },\n unwrappedMint: { value: input.unwrappedMint ?? null, isWritable: false },\n wrappedMint: { value: input.wrappedMint ?? null, isWritable: false },\n wrappedMintAuthority: { value: input.wrappedMintAuthority ?? null, isWritable: false },\n token2022Program: { value: input.token2022Program ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedAccount>;\n\n // Resolve default values.\n if (!accounts.token2022Program.value) {\n accounts.token2022Program.value =\n 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' as Address<'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n return Object.freeze({\n accounts: [\n getAccountMeta(accounts.escrow),\n getAccountMeta(accounts.destination),\n getAccountMeta(accounts.unwrappedMint),\n getAccountMeta(accounts.wrappedMint),\n getAccountMeta(accounts.wrappedMintAuthority),\n getAccountMeta(accounts.token2022Program),\n ],\n data: getCloseStuckEscrowInstructionDataEncoder().encode({}),\n programAddress,\n } as CloseStuckEscrowInstruction<\n TProgramAddress,\n TAccountEscrow,\n TAccountDestination,\n TAccountUnwrappedMint,\n TAccountWrappedMint,\n TAccountWrappedMintAuthority,\n TAccountToken2022Program\n >);\n}\n\nexport type ParsedCloseStuckEscrowInstruction<\n TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],\n> = {\n programAddress: Address<TProgram>;\n accounts: {\n /** Escrow account to close (ATA) */\n escrow: TAccountMetas[0];\n /** Destination for lamports from closed account */\n destination: TAccountMetas[1];\n /** Unwrapped mint */\n unwrappedMint: TAccountMetas[2];\n /** Wrapped mint */\n wrappedMint: TAccountMetas[3];\n /** Wrapped mint authority (PDA) */\n wrappedMintAuthority: TAccountMetas[4];\n /** Token-2022 program */\n token2022Program?: TAccountMetas[5] | undefined;\n };\n data: CloseStuckEscrowInstructionData;\n};\n\nexport function parseCloseStuckEscrowInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(\n instruction: Instruction<TProgram> &\n InstructionWithAccounts<TAccountMetas> &\n InstructionWithData<ReadonlyUint8Array>,\n): ParsedCloseStuckEscrowInstruction<TProgram, TAccountMetas> {\n if (instruction.accounts.length < 6) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n const getNextOptionalAccount = () => {\n const accountMeta = getNextAccount();\n return accountMeta.address === TOKEN_WRAP_PROGRAM_ADDRESS ? undefined : accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n escrow: getNextAccount(),\n destination: getNextAccount(),\n unwrappedMint: getNextAccount(),\n wrappedMint: getNextAccount(),\n wrappedMintAuthority: getNextAccount(),\n token2022Program: getNextOptionalAccount(),\n },\n data: getCloseStuckEscrowInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getBooleanDecoder,\n getBooleanEncoder,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyAccount,\n type ReadonlyUint8Array,\n type WritableAccount,\n} from '@solana/kit';\nimport { TOKEN_WRAP_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport const CREATE_MINT_DISCRIMINATOR = 0;\n\nexport function getCreateMintDiscriminatorBytes() {\n return getU8Encoder().encode(CREATE_MINT_DISCRIMINATOR);\n}\n\nexport type CreateMintInstruction<\n TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n TAccountWrappedMint extends string | AccountMeta<string> = string,\n TAccountBackpointer extends string | AccountMeta<string> = string,\n TAccountUnwrappedMint extends string | AccountMeta<string> = string,\n TAccountSystemProgram extends string | AccountMeta<string> = '11111111111111111111111111111111',\n TAccountWrappedTokenProgram extends string | AccountMeta<string> = string,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<\n [\n TAccountWrappedMint extends string ? WritableAccount<TAccountWrappedMint> : TAccountWrappedMint,\n TAccountBackpointer extends string ? WritableAccount<TAccountBackpointer> : TAccountBackpointer,\n TAccountUnwrappedMint extends string ? ReadonlyAccount<TAccountUnwrappedMint> : TAccountUnwrappedMint,\n TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,\n TAccountWrappedTokenProgram extends string\n ? ReadonlyAccount<TAccountWrappedTokenProgram>\n : TAccountWrappedTokenProgram,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type CreateMintInstructionData = {\n discriminator: number;\n /** Whether the creation should fail if the wrapped mint already exists. */\n idempotent: boolean;\n};\n\nexport type CreateMintInstructionDataArgs = {\n /** Whether the creation should fail if the wrapped mint already exists. */\n idempotent?: boolean;\n};\n\nexport function getCreateMintInstructionDataEncoder(): FixedSizeEncoder<CreateMintInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['idempotent', getBooleanEncoder()],\n ]),\n value => ({ ...value, discriminator: CREATE_MINT_DISCRIMINATOR, idempotent: value.idempotent ?? false }),\n );\n}\n\nexport function getCreateMintInstructionDataDecoder(): FixedSizeDecoder<CreateMintInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['idempotent', getBooleanDecoder()],\n ]);\n}\n\nexport function getCreateMintInstructionDataCodec(): FixedSizeCodec<\n CreateMintInstructionDataArgs,\n CreateMintInstructionData\n> {\n return combineCodec(getCreateMintInstructionDataEncoder(), getCreateMintInstructionDataDecoder());\n}\n\nexport type CreateMintInput<\n TAccountWrappedMint extends string = string,\n TAccountBackpointer extends string = string,\n TAccountUnwrappedMint extends string = string,\n TAccountSystemProgram extends string = string,\n TAccountWrappedTokenProgram extends string = string,\n> = {\n /**\n * Unallocated wrapped mint account to create (PDA), address must be:\n * `get_wrapped_mint_address(unwrapped_mint_address, wrapped_token_program_id)`\n */\n wrappedMint: Address<TAccountWrappedMint>;\n /**\n * Unallocated wrapped backpointer account to create (PDA)\n * `get_wrapped_mint_backpointer_address(wrapped_mint_address)`\n */\n backpointer: Address<TAccountBackpointer>;\n /** The existing mint */\n unwrappedMint: Address<TAccountUnwrappedMint>;\n /** The system program */\n systemProgram?: Address<TAccountSystemProgram>;\n /** The token program used to create the wrapped mint */\n wrappedTokenProgram: Address<TAccountWrappedTokenProgram>;\n idempotent?: CreateMintInstructionDataArgs['idempotent'];\n};\n\nexport function getCreateMintInstruction<\n TAccountWrappedMint extends string,\n TAccountBackpointer extends string,\n TAccountUnwrappedMint extends string,\n TAccountSystemProgram extends string,\n TAccountWrappedTokenProgram extends string,\n TProgramAddress extends Address = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n>(\n input: CreateMintInput<\n TAccountWrappedMint,\n TAccountBackpointer,\n TAccountUnwrappedMint,\n TAccountSystemProgram,\n TAccountWrappedTokenProgram\n >,\n config?: { programAddress?: TProgramAddress },\n): CreateMintInstruction<\n TProgramAddress,\n TAccountWrappedMint,\n TAccountBackpointer,\n TAccountUnwrappedMint,\n TAccountSystemProgram,\n TAccountWrappedTokenProgram\n> {\n // Program address.\n const programAddress = config?.programAddress ?? TOKEN_WRAP_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n wrappedMint: { value: input.wrappedMint ?? null, isWritable: true },\n backpointer: { value: input.backpointer ?? null, isWritable: true },\n unwrappedMint: { value: input.unwrappedMint ?? null, isWritable: false },\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n wrappedTokenProgram: { value: input.wrappedTokenProgram ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedAccount>;\n\n // Original args.\n const args = { ...input };\n\n // Resolve default values.\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n return Object.freeze({\n accounts: [\n getAccountMeta(accounts.wrappedMint),\n getAccountMeta(accounts.backpointer),\n getAccountMeta(accounts.unwrappedMint),\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.wrappedTokenProgram),\n ],\n data: getCreateMintInstructionDataEncoder().encode(args as CreateMintInstructionDataArgs),\n programAddress,\n } as CreateMintInstruction<\n TProgramAddress,\n TAccountWrappedMint,\n TAccountBackpointer,\n TAccountUnwrappedMint,\n TAccountSystemProgram,\n TAccountWrappedTokenProgram\n >);\n}\n\nexport type ParsedCreateMintInstruction<\n TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],\n> = {\n programAddress: Address<TProgram>;\n accounts: {\n /**\n * Unallocated wrapped mint account to create (PDA), address must be:\n * `get_wrapped_mint_address(unwrapped_mint_address, wrapped_token_program_id)`\n */\n wrappedMint: TAccountMetas[0];\n /**\n * Unallocated wrapped backpointer account to create (PDA)\n * `get_wrapped_mint_backpointer_address(wrapped_mint_address)`\n */\n backpointer: TAccountMetas[1];\n /** The existing mint */\n unwrappedMint: TAccountMetas[2];\n /** The system program */\n systemProgram?: TAccountMetas[3] | undefined;\n /** The token program used to create the wrapped mint */\n wrappedTokenProgram: TAccountMetas[4];\n };\n data: CreateMintInstructionData;\n};\n\nexport function parseCreateMintInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(\n instruction: Instruction<TProgram> &\n InstructionWithAccounts<TAccountMetas> &\n InstructionWithData<ReadonlyUint8Array>,\n): ParsedCreateMintInstruction<TProgram, TAccountMetas> {\n if (instruction.accounts.length < 5) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n const getNextOptionalAccount = () => {\n const accountMeta = getNextAccount();\n return accountMeta.address === TOKEN_WRAP_PROGRAM_ADDRESS ? undefined : accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n wrappedMint: getNextAccount(),\n backpointer: getNextAccount(),\n unwrappedMint: getNextAccount(),\n systemProgram: getNextOptionalAccount(),\n wrappedTokenProgram: getNextAccount(),\n },\n data: getCreateMintInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyAccount,\n type ReadonlyUint8Array,\n type WritableAccount,\n} from '@solana/kit';\nimport { TOKEN_WRAP_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport const SYNC_METADATA_TO_SPL_TOKEN_DISCRIMINATOR = 5;\n\nexport function getSyncMetadataToSplTokenDiscriminatorBytes() {\n return getU8Encoder().encode(SYNC_METADATA_TO_SPL_TOKEN_DISCRIMINATOR);\n}\n\nexport type SyncMetadataToSplTokenInstruction<\n TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n TAccountMetaplexMetadata extends string | AccountMeta<string> = string,\n TAccountWrappedMintAuthority extends string | AccountMeta<string> = string,\n TAccountWrappedMint extends string | AccountMeta<string> = string,\n TAccountUnwrappedMint extends string | AccountMeta<string> = string,\n TAccountMetaplexProgram extends string | AccountMeta<string> = 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s',\n TAccountSystemProgram extends string | AccountMeta<string> = '11111111111111111111111111111111',\n TAccountRentSysvar extends string | AccountMeta<string> = 'SysvarRent111111111111111111111111111111111',\n TAccountSourceMetadata extends string | AccountMeta<string> = string,\n TAccountOwnerProgram extends string | AccountMeta<string> = string,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<\n [\n TAccountMetaplexMetadata extends string\n ? WritableAccount<TAccountMetaplexMetadata>\n : TAccountMetaplexMetadata,\n TAccountWrappedMintAuthority extends string\n ? WritableAccount<TAccountWrappedMintAuthority>\n : TAccountWrappedMintAuthority,\n TAccountWrappedMint extends string ? ReadonlyAccount<TAccountWrappedMint> : TAccountWrappedMint,\n TAccountUnwrappedMint extends string ? ReadonlyAccount<TAccountUnwrappedMint> : TAccountUnwrappedMint,\n TAccountMetaplexProgram extends string ? ReadonlyAccount<TAccountMetaplexProgram> : TAccountMetaplexProgram,\n TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,\n TAccountRentSysvar extends string ? ReadonlyAccount<TAccountRentSysvar> : TAccountRentSysvar,\n TAccountSourceMetadata extends string ? ReadonlyAccount<TAccountSourceMetadata> : TAccountSourceMetadata,\n TAccountOwnerProgram extends string ? ReadonlyAccount<TAccountOwnerProgram> : TAccountOwnerProgram,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type SyncMetadataToSplTokenInstructionData = { discriminator: number };\n\nexport type SyncMetadataToSplTokenInstructionDataArgs = {};\n\nexport function getSyncMetadataToSplTokenInstructionDataEncoder(): FixedSizeEncoder<SyncMetadataToSplTokenInstructionDataArgs> {\n return transformEncoder(getStructEncoder([['discriminator', getU8Encoder()]]), value => ({\n ...value,\n discriminator: SYNC_METADATA_TO_SPL_TOKEN_DISCRIMINATOR,\n }));\n}\n\nexport function getSyncMetadataToSplTokenInstructionDataDecoder(): FixedSizeDecoder<SyncMetadataToSplTokenInstructionData> {\n return getStructDecoder([['discriminator', getU8Decoder()]]);\n}\n\nexport function getSyncMetadataToSplTokenInstructionDataCodec(): FixedSizeCodec<\n SyncMetadataToSplTokenInstructionDataArgs,\n SyncMetadataToSplTokenInstructionData\n> {\n return combineCodec(\n getSyncMetadataToSplTokenInstructionDataEncoder(),\n getSyncMetadataToSplTokenInstructionDataDecoder(),\n );\n}\n\nexport type SyncMetadataToSplTokenInput<\n TAccountMetaplexMetadata extends string = string,\n TAccountWrappedMintAuthority extends string = string,\n TAccountWrappedMint extends string = string,\n TAccountUnwrappedMint extends string = string,\n TAccountMetaplexProgram extends string = string,\n TAccountSystemProgram extends string = string,\n TAccountRentSysvar extends string = string,\n TAccountSourceMetadata extends string = string,\n TAccountOwnerProgram extends string = string,\n> = {\n /** `Metaplex` metadata account */\n metaplexMetadata: Address<TAccountMetaplexMetadata>;\n /** Wrapped mint authority (PDA) */\n wrappedMintAuthority: Address<TAccountWrappedMintAuthority>;\n /** Wrapped SPL Token mint */\n wrappedMint: Address<TAccountWrappedMint>;\n /** Unwrapped mint */\n unwrappedMint: Address<TAccountUnwrappedMint>;\n /** `Metaplex` Token Metadata Program */\n metaplexProgram?: Address<TAccountMetaplexProgram>;\n /** System program */\n systemProgram?: Address<TAccountSystemProgram>;\n /** Rent sysvar */\n rentSysvar?: Address<TAccountRentSysvar>;\n /**\n * Source metadata account. Required if unwrapped mint\n * is an SPL-Token or, if a Token-2022, its metadata pointer indicates\n * an external account.\n */\n sourceMetadata?: Address<TAccountSourceMetadata>;\n /**\n * Owner program. Required when metadata account is\n * owned by a third-party program.\n */\n ownerProgram?: Address<TAccountOwnerProgram>;\n};\n\nexport function getSyncMetadataToSplTokenInstruction<\n TAccountMetaplexMetadata extends string,\n TAccountWrappedMintAuthority extends string,\n TAccountWrappedMint extends string,\n TAccountUnwrappedMint extends string,\n TAccountMetaplexProgram extends string,\n TAccountSystemProgram extends string,\n TAccountRentSysvar extends string,\n TAccountSourceMetadata extends string,\n TAccountOwnerProgram extends string,\n TProgramAddress extends Address = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n>(\n input: SyncMetadataToSplTokenInput<\n TAccountMetaplexMetadata,\n TAccountWrappedMintAuthority,\n TAccountWrappedMint,\n TAccountUnwrappedMint,\n TAccountMetaplexProgram,\n TAccountSystemProgram,\n TAccountRentSysvar,\n TAccountSourceMetadata,\n TAccountOwnerProgram\n >,\n config?: { programAddress?: TProgramAddress },\n): SyncMetadataToSplTokenInstruction<\n TProgramAddress,\n TAccountMetaplexMetadata,\n TAccountWrappedMintAuthority,\n TAccountWrappedMint,\n TAccountUnwrappedMint,\n TAccountMetaplexProgram,\n TAccountSystemProgram,\n TAccountRentSysvar,\n TAccountSourceMetadata,\n TAccountOwnerProgram\n> {\n // Program address.\n const programAddress = config?.programAddress ?? TOKEN_WRAP_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n metaplexMetadata: { value: input.metaplexMetadata ?? null, isWritable: true },\n wrappedMintAuthority: { value: input.wrappedMintAuthority ?? null, isWritable: true },\n wrappedMint: { value: input.wrappedMint ?? null, isWritable: false },\n unwrappedMint: { value: input.unwrappedMint ?? null, isWritable: false },\n metaplexProgram: { value: input.metaplexProgram ?? null, isWritable: false },\n systemProgram: { value: input.systemProgram ?? null, isWritable: false },\n rentSysvar: { value: input.rentSysvar ?? null, isWritable: false },\n sourceMetadata: { value: input.sourceMetadata ?? null, isWritable: false },\n ownerProgram: { value: input.ownerProgram ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedAccount>;\n\n // Resolve default values.\n if (!accounts.metaplexProgram.value) {\n accounts.metaplexProgram.value =\n 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s' as Address<'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'>;\n }\n if (!accounts.systemProgram.value) {\n accounts.systemProgram.value =\n '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;\n }\n if (!accounts.rentSysvar.value) {\n accounts.rentSysvar.value =\n 'SysvarRent111111111111111111111111111111111' as Address<'SysvarRent111111111111111111111111111111111'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n return Object.freeze({\n accounts: [\n getAccountMeta(accounts.metaplexMetadata),\n getAccountMeta(accounts.wrappedMintAuthority),\n getAccountMeta(accounts.wrappedMint),\n getAccountMeta(accounts.unwrappedMint),\n getAccountMeta(accounts.metaplexProgram),\n getAccountMeta(accounts.systemProgram),\n getAccountMeta(accounts.rentSysvar),\n getAccountMeta(accounts.sourceMetadata),\n getAccountMeta(accounts.ownerProgram),\n ],\n data: getSyncMetadataToSplTokenInstructionDataEncoder().encode({}),\n programAddress,\n } as SyncMetadataToSplTokenInstruction<\n TProgramAddress,\n TAccountMetaplexMetadata,\n TAccountWrappedMintAuthority,\n TAccountWrappedMint,\n TAccountUnwrappedMint,\n TAccountMetaplexProgram,\n TAccountSystemProgram,\n TAccountRentSysvar,\n TAccountSourceMetadata,\n TAccountOwnerProgram\n >);\n}\n\nexport type ParsedSyncMetadataToSplTokenInstruction<\n TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],\n> = {\n programAddress: Address<TProgram>;\n accounts: {\n /** `Metaplex` metadata account */\n metaplexMetadata: TAccountMetas[0];\n /** Wrapped mint authority (PDA) */\n wrappedMintAuthority: TAccountMetas[1];\n /** Wrapped SPL Token mint */\n wrappedMint: TAccountMetas[2];\n /** Unwrapped mint */\n unwrappedMint: TAccountMetas[3];\n /** `Metaplex` Token Metadata Program */\n metaplexProgram: TAccountMetas[4];\n /** System program */\n systemProgram: TAccountMetas[5];\n /** Rent sysvar */\n rentSysvar: TAccountMetas[6];\n /**\n * Source metadata account. Required if unwrapped mint\n * is an SPL-Token or, if a Token-2022, its metadata pointer indicates\n * an external account.\n */\n sourceMetadata?: TAccountMetas[7] | undefined;\n /**\n * Owner program. Required when metadata account is\n * owned by a third-party program.\n */\n ownerProgram?: TAccountMetas[8] | undefined;\n };\n data: SyncMetadataToSplTokenInstructionData;\n};\n\nexport function parseSyncMetadataToSplTokenInstruction<\n TProgram extends string,\n TAccountMetas extends readonly AccountMeta[],\n>(\n instruction: Instruction<TProgram> &\n InstructionWithAccounts<TAccountMetas> &\n InstructionWithData<ReadonlyUint8Array>,\n): ParsedSyncMetadataToSplTokenInstruction<TProgram, TAccountMetas> {\n if (instruction.accounts.length < 9) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n const getNextOptionalAccount = () => {\n const accountMeta = getNextAccount();\n return accountMeta.address === TOKEN_WRAP_PROGRAM_ADDRESS ? undefined : accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n metaplexMetadata: getNextAccount(),\n wrappedMintAuthority: getNextAccount(),\n wrappedMint: getNextAccount(),\n unwrappedMint: getNextAccount(),\n metaplexProgram: getNextAccount(),\n systemProgram: getNextAccount(),\n rentSysvar: getNextAccount(),\n sourceMetadata: getNextOptionalAccount(),\n ownerProgram: getNextOptionalAccount(),\n },\n data: getSyncMetadataToSplTokenInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyAccount,\n type ReadonlyUint8Array,\n type WritableAccount,\n} from '@solana/kit';\nimport { TOKEN_WRAP_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport const SYNC_METADATA_TO_TOKEN2022_DISCRIMINATOR = 4;\n\nexport function getSyncMetadataToToken2022DiscriminatorBytes() {\n return getU8Encoder().encode(SYNC_METADATA_TO_TOKEN2022_DISCRIMINATOR);\n}\n\nexport type SyncMetadataToToken2022Instruction<\n TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n TAccountWrappedMint extends string | AccountMeta<string> = string,\n TAccountWrappedMintAuthority extends string | AccountMeta<string> = string,\n TAccountUnwrappedMint extends string | AccountMeta<string> = string,\n TAccountToken2022Program extends string | AccountMeta<string> = 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',\n TAccountSourceMetadata extends string | AccountMeta<string> = string,\n TAccountOwnerProgram extends string | AccountMeta<string> = string,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<\n [\n TAccountWrappedMint extends string ? WritableAccount<TAccountWrappedMint> : TAccountWrappedMint,\n TAccountWrappedMintAuthority extends string\n ? ReadonlyAccount<TAccountWrappedMintAuthority>\n : TAccountWrappedMintAuthority,\n TAccountUnwrappedMint extends string ? ReadonlyAccount<TAccountUnwrappedMint> : TAccountUnwrappedMint,\n TAccountToken2022Program extends string\n ? ReadonlyAccount<TAccountToken2022Program>\n : TAccountToken2022Program,\n TAccountSourceMetadata extends string ? ReadonlyAccount<TAccountSourceMetadata> : TAccountSourceMetadata,\n TAccountOwnerProgram extends string ? ReadonlyAccount<TAccountOwnerProgram> : TAccountOwnerProgram,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type SyncMetadataToToken2022InstructionData = { discriminator: number };\n\nexport type SyncMetadataToToken2022InstructionDataArgs = {};\n\nexport function getSyncMetadataToToken2022InstructionDataEncoder(): FixedSizeEncoder<SyncMetadataToToken2022InstructionDataArgs> {\n return transformEncoder(getStructEncoder([['discriminator', getU8Encoder()]]), value => ({\n ...value,\n discriminator: SYNC_METADATA_TO_TOKEN2022_DISCRIMINATOR,\n }));\n}\n\nexport function getSyncMetadataToToken2022InstructionDataDecoder(): FixedSizeDecoder<SyncMetadataToToken2022InstructionData> {\n return getStructDecoder([['discriminator', getU8Decoder()]]);\n}\n\nexport function getSyncMetadataToToken2022InstructionDataCodec(): FixedSizeCodec<\n SyncMetadataToToken2022InstructionDataArgs,\n SyncMetadataToToken2022InstructionData\n> {\n return combineCodec(\n getSyncMetadataToToken2022InstructionDataEncoder(),\n getSyncMetadataToToken2022InstructionDataDecoder(),\n );\n}\n\nexport type SyncMetadataToToken2022Input<\n TAccountWrappedMint extends string = string,\n TAccountWrappedMintAuthority extends string = string,\n TAccountUnwrappedMint extends string = string,\n TAccountToken2022Program extends string = string,\n TAccountSourceMetadata extends string = string,\n TAccountOwnerProgram extends string = string,\n> = {\n /** Wrapped mint */\n wrappedMint: Address<TAccountWrappedMint>;\n /** Wrapped mint authority PDA */\n wrappedMintAuthority: Address<TAccountWrappedMintAuthority>;\n /** Unwrapped mint */\n unwrappedMint: Address<TAccountUnwrappedMint>;\n /** Token-2022 program */\n token2022Program?: Address<TAccountToken2022Program>;\n /**\n * Source metadata account. Required if metadata pointer\n * indicates external account.\n */\n sourceMetadata?: Address<TAccountSourceMetadata>;\n /**\n * Owner program. Required when metadata account is\n * owned by a third-party program.\n */\n ownerProgram?: Address<TAccountOwnerProgram>;\n};\n\nexport function getSyncMetadataToToken2022Instruction<\n TAccountWrappedMint extends string,\n TAccountWrappedMintAuthority extends string,\n TAccountUnwrappedMint extends string,\n TAccountToken2022Program extends string,\n TAccountSourceMetadata extends string,\n TAccountOwnerProgram extends string,\n TProgramAddress extends Address = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n>(\n input: SyncMetadataToToken2022Input<\n TAccountWrappedMint,\n TAccountWrappedMintAuthority,\n TAccountUnwrappedMint,\n TAccountToken2022Program,\n TAccountSourceMetadata,\n TAccountOwnerProgram\n >,\n config?: { programAddress?: TProgramAddress },\n): SyncMetadataToToken2022Instruction<\n TProgramAddress,\n TAccountWrappedMint,\n TAccountWrappedMintAuthority,\n TAccountUnwrappedMint,\n TAccountToken2022Program,\n TAccountSourceMetadata,\n TAccountOwnerProgram\n> {\n // Program address.\n const programAddress = config?.programAddress ?? TOKEN_WRAP_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n wrappedMint: { value: input.wrappedMint ?? null, isWritable: true },\n wrappedMintAuthority: { value: input.wrappedMintAuthority ?? null, isWritable: false },\n unwrappedMint: { value: input.unwrappedMint ?? null, isWritable: false },\n token2022Program: { value: input.token2022Program ?? null, isWritable: false },\n sourceMetadata: { value: input.sourceMetadata ?? null, isWritable: false },\n ownerProgram: { value: input.ownerProgram ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedAccount>;\n\n // Resolve default values.\n if (!accounts.token2022Program.value) {\n accounts.token2022Program.value =\n 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb' as Address<'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb'>;\n }\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n return Object.freeze({\n accounts: [\n getAccountMeta(accounts.wrappedMint),\n getAccountMeta(accounts.wrappedMintAuthority),\n getAccountMeta(accounts.unwrappedMint),\n getAccountMeta(accounts.token2022Program),\n getAccountMeta(accounts.sourceMetadata),\n getAccountMeta(accounts.ownerProgram),\n ],\n data: getSyncMetadataToToken2022InstructionDataEncoder().encode({}),\n programAddress,\n } as SyncMetadataToToken2022Instruction<\n TProgramAddress,\n TAccountWrappedMint,\n TAccountWrappedMintAuthority,\n TAccountUnwrappedMint,\n TAccountToken2022Program,\n TAccountSourceMetadata,\n TAccountOwnerProgram\n >);\n}\n\nexport type ParsedSyncMetadataToToken2022Instruction<\n TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],\n> = {\n programAddress: Address<TProgram>;\n accounts: {\n /** Wrapped mint */\n wrappedMint: TAccountMetas[0];\n /** Wrapped mint authority PDA */\n wrappedMintAuthority: TAccountMetas[1];\n /** Unwrapped mint */\n unwrappedMint: TAccountMetas[2];\n /** Token-2022 program */\n token2022Program: TAccountMetas[3];\n /**\n * Source metadata account. Required if metadata pointer\n * indicates external account.\n */\n sourceMetadata?: TAccountMetas[4] | undefined;\n /**\n * Owner program. Required when metadata account is\n * owned by a third-party program.\n */\n ownerProgram?: TAccountMetas[5] | undefined;\n };\n data: SyncMetadataToToken2022InstructionData;\n};\n\nexport function parseSyncMetadataToToken2022Instruction<\n TProgram extends string,\n TAccountMetas extends readonly AccountMeta[],\n>(\n instruction: Instruction<TProgram> &\n InstructionWithAccounts<TAccountMetas> &\n InstructionWithData<ReadonlyUint8Array>,\n): ParsedSyncMetadataToToken2022Instruction<TProgram, TAccountMetas> {\n if (instruction.accounts.length < 6) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n const getNextOptionalAccount = () => {\n const accountMeta = getNextAccount();\n return accountMeta.address === TOKEN_WRAP_PROGRAM_ADDRESS ? undefined : accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n wrappedMint: getNextAccount(),\n wrappedMintAuthority: getNextAccount(),\n unwrappedMint: getNextAccount(),\n token2022Program: getNextAccount(),\n sourceMetadata: getNextOptionalAccount(),\n ownerProgram: getNextOptionalAccount(),\n },\n data: getSyncMetadataToToken2022InstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n AccountRole,\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type AccountSignerMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type ReadonlyUint8Array,\n type TransactionSigner,\n type WritableAccount,\n} from '@solana/kit';\nimport { TOKEN_WRAP_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport const UNWRAP_DISCRIMINATOR = 2;\n\nexport function getUnwrapDiscriminatorBytes() {\n return getU8Encoder().encode(UNWRAP_DISCRIMINATOR);\n}\n\nexport type UnwrapInstruction<\n TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n TAccountUnwrappedEscrow extends string | AccountMeta<string> = string,\n TAccountRecipientUnwrappedToken extends string | AccountMeta<string> = string,\n TAccountWrappedMintAuthority extends string | AccountMeta<string> = string,\n TAccountUnwrappedMint extends string | AccountMeta<string> = string,\n TAccountWrappedTokenProgram extends string | AccountMeta<string> = string,\n TAccountUnwrappedTokenProgram extends string | AccountMeta<string> = string,\n TAccountWrappedTokenAccount extends string | AccountMeta<string> = string,\n TAccountWrappedMint extends string | AccountMeta<string> = string,\n TAccountTransferAuthority extends string | AccountMeta<string> = string,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<\n [\n TAccountUnwrappedEscrow extends string ? WritableAccount<TAccountUnwrappedEscrow> : TAccountUnwrappedEscrow,\n TAccountRecipientUnwrappedToken extends string\n ? WritableAccount<TAccountRecipientUnwrappedToken>\n : TAccountRecipientUnwrappedToken,\n TAccountWrappedMintAuthority extends string\n ? ReadonlyAccount<TAccountWrappedMintAuthority>\n : TAccountWrappedMintAuthority,\n TAccountUnwrappedMint extends string ? ReadonlyAccount<TAccountUnwrappedMint> : TAccountUnwrappedMint,\n TAccountWrappedTokenProgram extends string\n ? ReadonlyAccount<TAccountWrappedTokenProgram>\n : TAccountWrappedTokenProgram,\n TAccountUnwrappedTokenProgram extends string\n ? ReadonlyAccount<TAccountUnwrappedTokenProgram>\n : TAccountUnwrappedTokenProgram,\n TAccountWrappedTokenAccount extends string\n ? WritableAccount<TAccountWrappedTokenAccount>\n : TAccountWrappedTokenAccount,\n TAccountWrappedMint extends string ? WritableAccount<TAccountWrappedMint> : TAccountWrappedMint,\n TAccountTransferAuthority extends string\n ? ReadonlyAccount<TAccountTransferAuthority>\n : TAccountTransferAuthority,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type UnwrapInstructionData = {\n discriminator: number;\n /** The amount of tokens to unwrap. */\n amount: bigint;\n};\n\nexport type UnwrapInstructionDataArgs = {\n /** The amount of tokens to unwrap. */\n amount: number | bigint;\n};\n\nexport function getUnwrapInstructionDataEncoder(): FixedSizeEncoder<UnwrapInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['amount', getU64Encoder()],\n ]),\n value => ({ ...value, discriminator: UNWRAP_DISCRIMINATOR }),\n );\n}\n\nexport function getUnwrapInstructionDataDecoder(): FixedSizeDecoder<UnwrapInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['amount', getU64Decoder()],\n ]);\n}\n\nexport function getUnwrapInstructionDataCodec(): FixedSizeCodec<UnwrapInstructionDataArgs, UnwrapInstructionData> {\n return combineCodec(getUnwrapInstructionDataEncoder(), getUnwrapInstructionDataDecoder());\n}\n\nexport type UnwrapInput<\n TAccountUnwrappedEscrow extends string = string,\n TAccountRecipientUnwrappedToken extends string = string,\n TAccountWrappedMintAuthority extends string = string,\n TAccountUnwrappedMint extends string = string,\n TAccountWrappedTokenProgram extends string = string,\n TAccountUnwrappedTokenProgram extends string = string,\n TAccountWrappedTokenAccount extends string = string,\n TAccountWrappedMint extends string = string,\n TAccountTransferAuthority extends string = string,\n> = {\n /**\n * The escrow account holding the unwrapped tokens.\n * Address must be ATA: get_escrow_address(unwrapped_mint, unwrapped_token_program, wrapped_token_program)\n */\n unwrappedEscrow: Address<TAccountUnwrappedEscrow>;\n /** The account to receive the unwrapped tokens. */\n recipientUnwrappedToken: Address<TAccountRecipientUnwrappedToken>;\n /**\n * The PDA authority of the wrapped mint,\n * address must be: `get_wrapped_mint_authority(wrapped_mint)`\n */\n wrappedMintAuthority: Address<TAccountWrappedMintAuthority>;\n /** The mint of the unwrapped tokens */\n unwrappedMint: Address<TAccountUnwrappedMint>;\n /** The token program of the wrapped tokens */\n wrappedTokenProgram: Address<TAccountWrappedTokenProgram>;\n /** The token program of the unwrapped tokens */\n unwrappedTokenProgram: Address<TAccountUnwrappedTokenProgram>;\n /** The source token account for the wrapped tokens */\n wrappedTokenAccount: Address<TAccountWrappedTokenAccount>;\n /**\n * The wrapped mint account, address must be:\n * `get_wrapped_mint_address(unwrapped_mint_address, wrapped_token_program_id)`\n */\n wrappedMint: Address<TAccountWrappedMint>;\n /** The authority to burn the wrapped tokens. */\n transferAuthority: Address<TAccountTransferAuthority> | TransactionSigner<TAccountTransferAuthority>;\n amount: UnwrapInstructionDataArgs['amount'];\n multiSigners?: Array<TransactionSigner>;\n};\n\nexport function getUnwrapInstruction<\n TAccountUnwrappedEscrow extends string,\n TAccountRecipientUnwrappedToken extends string,\n TAccountWrappedMintAuthority extends string,\n TAccountUnwrappedMint extends string,\n TAccountWrappedTokenProgram extends string,\n TAccountUnwrappedTokenProgram extends string,\n TAccountWrappedTokenAccount extends string,\n TAccountWrappedMint extends string,\n TAccountTransferAuthority extends string,\n TProgramAddress extends Address = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n>(\n input: UnwrapInput<\n TAccountUnwrappedEscrow,\n TAccountRecipientUnwrappedToken,\n TAccountWrappedMintAuthority,\n TAccountUnwrappedMint,\n TAccountWrappedTokenProgram,\n TAccountUnwrappedTokenProgram,\n TAccountWrappedTokenAccount,\n TAccountWrappedMint,\n TAccountTransferAuthority\n >,\n config?: { programAddress?: TProgramAddress },\n): UnwrapInstruction<\n TProgramAddress,\n TAccountUnwrappedEscrow,\n TAccountRecipientUnwrappedToken,\n TAccountWrappedMintAuthority,\n TAccountUnwrappedMint,\n TAccountWrappedTokenProgram,\n TAccountUnwrappedTokenProgram,\n TAccountWrappedTokenAccount,\n TAccountWrappedMint,\n (typeof input)['transferAuthority'] extends TransactionSigner<TAccountTransferAuthority>\n ? ReadonlySignerAccount<TAccountTransferAuthority> & AccountSignerMeta<TAccountTransferAuthority>\n : TAccountTransferAuthority\n> {\n // Program address.\n const programAddress = config?.programAddress ?? TOKEN_WRAP_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n unwrappedEscrow: { value: input.unwrappedEscrow ?? null, isWritable: true },\n recipientUnwrappedToken: { value: input.recipientUnwrappedToken ?? null, isWritable: true },\n wrappedMintAuthority: { value: input.wrappedMintAuthority ?? null, isWritable: false },\n unwrappedMint: { value: input.unwrappedMint ?? null, isWritable: false },\n wrappedTokenProgram: { value: input.wrappedTokenProgram ?? null, isWritable: false },\n unwrappedTokenProgram: { value: input.unwrappedTokenProgram ?? null, isWritable: false },\n wrappedTokenAccount: { value: input.wrappedTokenAccount ?? null, isWritable: true },\n wrappedMint: { value: input.wrappedMint ?? null, isWritable: true },\n transferAuthority: { value: input.transferAuthority ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedAccount>;\n\n // Original args.\n const args = { ...input };\n\n // Remaining accounts.\n const remainingAccounts: AccountMeta[] = (args.multiSigners ?? []).map(signer => ({\n address: signer.address,\n role: AccountRole.READONLY_SIGNER,\n signer,\n }));\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n return Object.freeze({\n accounts: [\n getAccountMeta(accounts.unwrappedEscrow),\n getAccountMeta(accounts.recipientUnwrappedToken),\n getAccountMeta(accounts.wrappedMintAuthority),\n getAccountMeta(accounts.unwrappedMint),\n getAccountMeta(accounts.wrappedTokenProgram),\n getAccountMeta(accounts.unwrappedTokenProgram),\n getAccountMeta(accounts.wrappedTokenAccount),\n getAccountMeta(accounts.wrappedMint),\n getAccountMeta(accounts.transferAuthority),\n ...remainingAccounts,\n ],\n data: getUnwrapInstructionDataEncoder().encode(args as UnwrapInstructionDataArgs),\n programAddress,\n } as UnwrapInstruction<\n TProgramAddress,\n TAccountUnwrappedEscrow,\n TAccountRecipientUnwrappedToken,\n TAccountWrappedMintAuthority,\n TAccountUnwrappedMint,\n TAccountWrappedTokenProgram,\n TAccountUnwrappedTokenProgram,\n TAccountWrappedTokenAccount,\n TAccountWrappedMint,\n (typeof input)['transferAuthority'] extends TransactionSigner<TAccountTransferAuthority>\n ? ReadonlySignerAccount<TAccountTransferAuthority> & AccountSignerMeta<TAccountTransferAuthority>\n : TAccountTransferAuthority\n >);\n}\n\nexport type ParsedUnwrapInstruction<\n TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],\n> = {\n programAddress: Address<TProgram>;\n accounts: {\n /**\n * The escrow account holding the unwrapped tokens.\n * Address must be ATA: get_escrow_address(unwrapped_mint, unwrapped_token_program, wrapped_token_program)\n */\n unwrappedEscrow: TAccountMetas[0];\n /** The account to receive the unwrapped tokens. */\n recipientUnwrappedToken: TAccountMetas[1];\n /**\n * The PDA authority of the wrapped mint,\n * address must be: `get_wrapped_mint_authority(wrapped_mint)`\n */\n wrappedMintAuthority: TAccountMetas[2];\n /** The mint of the unwrapped tokens */\n unwrappedMint: TAccountMetas[3];\n /** The token program of the wrapped tokens */\n wrappedTokenProgram: TAccountMetas[4];\n /** The token program of the unwrapped tokens */\n unwrappedTokenProgram: TAccountMetas[5];\n /** The source token account for the wrapped tokens */\n wrappedTokenAccount: TAccountMetas[6];\n /**\n * The wrapped mint account, address must be:\n * `get_wrapped_mint_address(unwrapped_mint_address, wrapped_token_program_id)`\n */\n wrappedMint: TAccountMetas[7];\n /** The authority to burn the wrapped tokens. */\n transferAuthority: TAccountMetas[8];\n };\n data: UnwrapInstructionData;\n};\n\nexport function parseUnwrapInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(\n instruction: Instruction<TProgram> &\n InstructionWithAccounts<TAccountMetas> &\n InstructionWithData<ReadonlyUint8Array>,\n): ParsedUnwrapInstruction<TProgram, TAccountMetas> {\n if (instruction.accounts.length < 9) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n unwrappedEscrow: getNextAccount(),\n recipientUnwrappedToken: getNextAccount(),\n wrappedMintAuthority: getNextAccount(),\n unwrappedMint: getNextAccount(),\n wrappedTokenProgram: getNextAccount(),\n unwrappedTokenProgram: getNextAccount(),\n wrappedTokenAccount: getNextAccount(),\n wrappedMint: getNextAccount(),\n transferAuthority: getNextAccount(),\n },\n data: getUnwrapInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n AccountRole,\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type AccountSignerMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyAccount,\n type ReadonlySignerAccount,\n type ReadonlyUint8Array,\n type TransactionSigner,\n type WritableAccount,\n} from '@solana/kit';\nimport { TOKEN_WRAP_PROGRAM_ADDRESS } from '../programs';\nimport { getAccountMetaFactory, type ResolvedAccount } from '../shared';\n\nexport const WRAP_DISCRIMINATOR = 1;\n\nexport function getWrapDiscriminatorBytes() {\n return getU8Encoder().encode(WRAP_DISCRIMINATOR);\n}\n\nexport type WrapInstruction<\n TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n TAccountRecipientWrappedTokenAccount extends string | AccountMeta<string> = string,\n TAccountWrappedMint extends string | AccountMeta<string> = string,\n TAccountWrappedMintAuthority extends string | AccountMeta<string> = string,\n TAccountUnwrappedTokenProgram extends string | AccountMeta<string> = string,\n TAccountWrappedTokenProgram extends string | AccountMeta<string> = string,\n TAccountUnwrappedTokenAccount extends string | AccountMeta<string> = string,\n TAccountUnwrappedMint extends string | AccountMeta<string> = string,\n TAccountUnwrappedEscrow extends string | AccountMeta<string> = string,\n TAccountTransferAuthority extends string | AccountMeta<string> = string,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<\n [\n TAccountRecipientWrappedTokenAccount extends string\n ? WritableAccount<TAccountRecipientWrappedTokenAccount>\n : TAccountRecipientWrappedTokenAccount,\n TAccountWrappedMint extends string ? WritableAccount<TAccountWrappedMint> : TAccountWrappedMint,\n TAccountWrappedMintAuthority extends string\n ? ReadonlyAccount<TAccountWrappedMintAuthority>\n : TAccountWrappedMintAuthority,\n TAccountUnwrappedTokenProgram extends string\n ? ReadonlyAccount<TAccountUnwrappedTokenProgram>\n : TAccountUnwrappedTokenProgram,\n TAccountWrappedTokenProgram extends string\n ? ReadonlyAccount<TAccountWrappedTokenProgram>\n : TAccountWrappedTokenProgram,\n TAccountUnwrappedTokenAccount extends string\n ? WritableAccount<TAccountUnwrappedTokenAccount>\n : TAccountUnwrappedTokenAccount,\n TAccountUnwrappedMint extends string ? ReadonlyAccount<TAccountUnwrappedMint> : TAccountUnwrappedMint,\n TAccountUnwrappedEscrow extends string ? WritableAccount<TAccountUnwrappedEscrow> : TAccountUnwrappedEscrow,\n TAccountTransferAuthority extends string\n ? ReadonlyAccount<TAccountTransferAuthority>\n : TAccountTransferAuthority,\n ...TRemainingAccounts,\n ]\n >;\n\nexport type WrapInstructionData = {\n discriminator: number;\n /** The amount of tokens to wrap. */\n amount: bigint;\n};\n\nexport type WrapInstructionDataArgs = {\n /** The amount of tokens to wrap. */\n amount: number | bigint;\n};\n\nexport function getWrapInstructionDataEncoder(): FixedSizeEncoder<WrapInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['amount', getU64Encoder()],\n ]),\n value => ({ ...value, discriminator: WRAP_DISCRIMINATOR }),\n );\n}\n\nexport function getWrapInstructionDataDecoder(): FixedSizeDecoder<WrapInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['amount', getU64Decoder()],\n ]);\n}\n\nexport function getWrapInstructionDataCodec(): FixedSizeCodec<WrapInstructionDataArgs, WrapInstructionData> {\n return combineCodec(getWrapInstructionDataEncoder(), getWrapInstructionDataDecoder());\n}\n\nexport type WrapInput<\n TAccountRecipientWrappedTokenAccount extends string = string,\n TAccountWrappedMint extends string = string,\n TAccountWrappedMintAuthority extends string = string,\n TAccountUnwrappedTokenProgram extends string = string,\n TAccountWrappedTokenProgram extends string = string,\n TAccountUnwrappedTokenAccount extends string = string,\n TAccountUnwrappedMint extends string = string,\n TAccountUnwrappedEscrow extends string = string,\n TAccountTransferAuthority extends string = string,\n> = {\n /** The token account to receive the wrapped tokens. */\n recipientWrappedTokenAccount: Address<TAccountRecipientWrappedTokenAccount>;\n /**\n * Wrapped mint, must be initialized, address must be:\n * `get_wrapped_mint_address(unwrapped_mint_address, wrapped_token_program_id)`\n */\n wrappedMint: Address<TAccountWrappedMint>;\n /**\n * The PDA authority of the wrapped mint, address must be\n * `get_wrapped_mint_authority(wrapped_mint)`\n */\n wrappedMintAuthority: Address<TAccountWrappedMintAuthority>;\n /** The token program of the unwrapped tokens. */\n unwrappedTokenProgram: Address<TAccountUnwrappedTokenProgram>;\n /** The token program of the wrapped tokens. */\n wrappedTokenProgram: Address<TAccountWrappedTokenProgram>;\n /** The source token account for the unwrapped tokens. */\n unwrappedTokenAccount: Address<TAccountUnwrappedTokenAccount>;\n /** The mint of the unwrapped tokens. */\n unwrappedMint: Address<TAccountUnwrappedMint>;\n /**\n * The escrow account that holds the unwrapped tokens.\n * Address must be ATA: get_escrow_address(unwrapped_mint, unwrapped_token_program, wrapped_token_program)\n */\n unwrappedEscrow: Address<TAccountUnwrappedEscrow>;\n /** The authority to transfer the unwrapped tokens. */\n transferAuthority: Address<TAccountTransferAuthority> | TransactionSigner<TAccountTransferAuthority>;\n amount: WrapInstructionDataArgs['amount'];\n multiSigners?: Array<TransactionSigner>;\n};\n\nexport function getWrapInstruction<\n TAccountRecipientWrappedTokenAccount extends string,\n TAccountWrappedMint extends string,\n TAccountWrappedMintAuthority extends string,\n TAccountUnwrappedTokenProgram extends string,\n TAccountWrappedTokenProgram extends string,\n TAccountUnwrappedTokenAccount extends string,\n TAccountUnwrappedMint extends string,\n TAccountUnwrappedEscrow extends string,\n TAccountTransferAuthority extends string,\n TProgramAddress extends Address = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n>(\n input: WrapInput<\n TAccountRecipientWrappedTokenAccount,\n TAccountWrappedMint,\n TAccountWrappedMintAuthority,\n TAccountUnwrappedTokenProgram,\n TAccountWrappedTokenProgram,\n TAccountUnwrappedTokenAccount,\n TAccountUnwrappedMint,\n TAccountUnwrappedEscrow,\n TAccountTransferAuthority\n >,\n config?: { programAddress?: TProgramAddress },\n): WrapInstruction<\n TProgramAddress,\n TAccountRecipientWrappedTokenAccount,\n TAccountWrappedMint,\n TAccountWrappedMintAuthority,\n TAccountUnwrappedTokenProgram,\n TAccountWrappedTokenProgram,\n TAccountUnwrappedTokenAccount,\n TAccountUnwrappedMint,\n TAccountUnwrappedEscrow,\n (typeof input)['transferAuthority'] extends TransactionSigner<TAccountTransferAuthority>\n ? ReadonlySignerAccount<TAccountTransferAuthority> & AccountSignerMeta<TAccountTransferAuthority>\n : TAccountTransferAuthority\n> {\n // Program address.\n const programAddress = config?.programAddress ?? TOKEN_WRAP_PROGRAM_ADDRESS;\n\n // Original accounts.\n const originalAccounts = {\n recipientWrappedTokenAccount: { value: input.recipientWrappedTokenAccount ?? null, isWritable: true },\n wrappedMint: { value: input.wrappedMint ?? null, isWritable: true },\n wrappedMintAuthority: { value: input.wrappedMintAuthority ?? null, isWritable: false },\n unwrappedTokenProgram: { value: input.unwrappedTokenProgram ?? null, isWritable: false },\n wrappedTokenProgram: { value: input.wrappedTokenProgram ?? null, isWritable: false },\n unwrappedTokenAccount: { value: input.unwrappedTokenAccount ?? null, isWritable: true },\n unwrappedMint: { value: input.unwrappedMint ?? null, isWritable: false },\n unwrappedEscrow: { value: input.unwrappedEscrow ?? null, isWritable: true },\n transferAuthority: { value: input.transferAuthority ?? null, isWritable: false },\n };\n const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedAccount>;\n\n // Original args.\n const args = { ...input };\n\n // Remaining accounts.\n const remainingAccounts: AccountMeta[] = (args.multiSigners ?? []).map(signer => ({\n address: signer.address,\n role: AccountRole.READONLY_SIGNER,\n signer,\n }));\n\n const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');\n return Object.freeze({\n accounts: [\n getAccountMeta(accounts.recipientWrappedTokenAccount),\n getAccountMeta(accounts.wrappedMint),\n getAccountMeta(accounts.wrappedMintAuthority),\n getAccountMeta(accounts.unwrappedTokenProgram),\n getAccountMeta(accounts.wrappedTokenProgram),\n getAccountMeta(accounts.unwrappedTokenAccount),\n getAccountMeta(accounts.unwrappedMint),\n getAccountMeta(accounts.unwrappedEscrow),\n getAccountMeta(accounts.transferAuthority),\n ...remainingAccounts,\n ],\n data: getWrapInstructionDataEncoder().encode(args as WrapInstructionDataArgs),\n programAddress,\n } as WrapInstruction<\n TProgramAddress,\n TAccountRecipientWrappedTokenAccount,\n TAccountWrappedMint,\n TAccountWrappedMintAuthority,\n TAccountUnwrappedTokenProgram,\n TAccountWrappedTokenProgram,\n TAccountUnwrappedTokenAccount,\n TAccountUnwrappedMint,\n TAccountUnwrappedEscrow,\n (typeof input)['transferAuthority'] extends TransactionSigner<TAccountTransferAuthority>\n ? ReadonlySignerAccount<TAccountTransferAuthority> & AccountSignerMeta<TAccountTransferAuthority>\n : TAccountTransferAuthority\n >);\n}\n\nexport type ParsedWrapInstruction<\n TProgram extends string = typeof TOKEN_WRAP_PROGRAM_ADDRESS,\n TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],\n> = {\n programAddress: Address<TProgram>;\n accounts: {\n /** The token account to receive the wrapped tokens. */\n recipientWrappedTokenAccount: TAccountMetas[0];\n /**\n * Wrapped mint, must be initialized, address must be:\n * `get_wrapped_mint_address(unwrapped_mint_address, wrapped_token_program_id)`\n */\n wrappedMint: TAccountMetas[1];\n /**\n * The PDA authority of the wrapped mint, address must be\n * `get_wrapped_mint_authority(wrapped_mint)`\n */\n wrappedMintAuthority: TAccountMetas[2];\n /** The token program of the unwrapped tokens. */\n unwrappedTokenProgram: TAccountMetas[3];\n /** The token program of the wrapped tokens. */\n wrappedTokenProgram: TAccountMetas[4];\n /** The source token account for the unwrapped tokens. */\n unwrappedTokenAccount: TAccountMetas[5];\n /** The mint of the unwrapped tokens. */\n unwrappedMint: TAccountMetas[6];\n /**\n * The escrow account that holds the unwrapped tokens.\n * Address must be ATA: get_escrow_address(unwrapped_mint, unwrapped_token_program, wrapped_token_program)\n */\n unwrappedEscrow: TAccountMetas[7];\n /** The authority to transfer the unwrapped tokens. */\n transferAuthority: TAccountMetas[8];\n };\n data: WrapInstructionData;\n};\n\nexport function parseWrapInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(\n instruction: Instruction<TProgram> &\n InstructionWithAccounts<TAccountMetas> &\n InstructionWithData<ReadonlyUint8Array>,\n): ParsedWrapInstruction<TProgram, TAccountMetas> {\n if (instruction.accounts.length < 9) {\n // TODO: Coded error.\n throw new Error('Not enough accounts');\n }\n let accountIndex = 0;\n const getNextAccount = () => {\n const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;\n accountIndex += 1;\n return accountMeta;\n };\n return {\n programAddress: instruction.programAddress,\n accounts: {\n recipientWrappedTokenAccount: getNextAccount(),\n wrappedMint: getNextAccount(),\n wrappedMintAuthority: getNextAccount(),\n unwrappedTokenProgram: getNextAccount(),\n wrappedTokenProgram: getNextAccount(),\n unwrappedTokenAccount: getNextAccount(),\n unwrappedMint: getNextAccount(),\n unwrappedEscrow: getNextAccount(),\n transferAuthority: getNextAccount(),\n },\n data: getWrapInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n assertIsInstructionWithAccounts,\n containsBytes,\n getU8Encoder,\n type Address,\n type Instruction,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport {\n parseCloseStuckEscrowInstruction,\n parseCreateMintInstruction,\n parseSyncMetadataToSplTokenInstruction,\n parseSyncMetadataToToken2022Instruction,\n parseUnwrapInstruction,\n parseWrapInstruction,\n type ParsedCloseStuckEscrowInstruction,\n type ParsedCreateMintInstruction,\n type ParsedSyncMetadataToSplTokenInstruction,\n type ParsedSyncMetadataToToken2022Instruction,\n type ParsedUnwrapInstruction,\n type ParsedWrapInstruction,\n} from '../instructions';\n\nexport const TOKEN_WRAP_PROGRAM_ADDRESS =\n 'TwRapQCDhWkZRrDaHfZGuHxkZ91gHDRkyuzNqeU5MgR' as Address<'TwRapQCDhWkZRrDaHfZGuHxkZ91gHDRkyuzNqeU5MgR'>;\n\nexport enum TokenWrapAccount {\n Backpointer,\n}\n\nexport enum TokenWrapInstruction {\n CreateMint,\n Wrap,\n Unwrap,\n CloseStuckEscrow,\n SyncMetadataToToken2022,\n SyncMetadataToSplToken,\n}\n\nexport function identifyTokenWrapInstruction(\n instruction: { data: ReadonlyUint8Array } | ReadonlyUint8Array,\n): TokenWrapInstruction {\n const data = 'data' in instruction ? instruction.data : instruction;\n if (containsBytes(data, getU8Encoder().encode(0), 0)) {\n return TokenWrapInstruction.CreateMint;\n }\n if (containsBytes(data, getU8Encoder().encode(1), 0)) {\n return TokenWrapInstruction.Wrap;\n }\n if (containsBytes(data, getU8Encoder().encode(2), 0)) {\n return TokenWrapInstruction.Unwrap;\n }\n if (containsBytes(data, getU8Encoder().encode(3), 0)) {\n return TokenWrapInstruction.CloseStuckEscrow;\n }\n if (containsBytes(data, getU8Encoder().encode(4), 0)) {\n return TokenWrapInstruction.SyncMetadataToToken2022;\n }\n if (containsBytes(data, getU8Encoder().encode(5), 0)) {\n return TokenWrapInstruction.SyncMetadataToSplToken;\n }\n throw new Error('The provided instruction could not be identified as a tokenWrap instruction.');\n}\n\nexport type ParsedTokenWrapInstruction<TProgram extends string = 'TwRapQCDhWkZRrDaHfZGuHxkZ91gHDRkyuzNqeU5MgR'> =\n | ({ instructionType: TokenWrapInstruction.CreateMint } & ParsedCreateMintInstruction<TProgram>)\n | ({ instructionType: TokenWrapInstruction.Wrap } & ParsedWrapInstruction<TProgram>)\n | ({ instructionType: TokenWrapInstruction.Unwrap } & ParsedUnwrapInstruction<TProgram>)\n | ({ instructionType: TokenWrapInstruction.CloseStuckEscrow } & ParsedCloseStuckEscrowInstruction<TProgram>)\n | ({\n instructionType: TokenWrapInstruction.SyncMetadataToToken2022;\n } & ParsedSyncMetadataToToken2022Instruction<TProgram>)\n | ({\n instructionType: TokenWrapInstruction.SyncMetadataToSplToken;\n } & ParsedSyncMetadataToSplTokenInstruction<TProgram>);\n\nexport function parseTokenWrapInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,\n): ParsedTokenWrapInstruction<TProgram> {\n const instructionType = identifyTokenWrapInstruction(instruction);\n switch (instructionType) {\n case TokenWrapInstruction.CreateMint: {\n assertIsInstructionWithAccounts(instruction);\n return { instructionType: TokenWrapInstruction.CreateMint, ...parseCreateMintInstruction(instruction) };\n }\n case TokenWrapInstruction.Wrap: {\n assertIsInstructionWithAccounts(instruction);\n return { instructionType: TokenWrapInstruction.Wrap, ...parseWrapInstruction(instruction) };\n }\n case TokenWrapInstruction.Unwrap: {\n assertIsInstructionWithAccounts(instruction);\n return { instructionType: TokenWrapInstruction.Unwrap, ...parseUnwrapInstruction(instruction) };\n }\n case TokenWrapInstruction.CloseStuckEscrow: {\n assertIsInstructionWithAccounts(instruction);\n return {\n instructionType: TokenWrapInstruction.CloseStuckEscrow,\n ...parseCloseStuckEscrowInstruction(instruction),\n };\n }\n case TokenWrapInstruction.SyncMetadataToToken2022: {\n assertIsInstructionWithAccounts(instruction);\n return {\n instructionType: TokenWrapInstruction.SyncMetadataToToken2022,\n ...parseSyncMetadataToToken2022Instruction(instruction),\n };\n }\n case TokenWrapInstruction.SyncMetadataToSplToken: {\n assertIsInstructionWithAccounts(instruction);\n return {\n instructionType: TokenWrapInstruction.SyncMetadataToSplToken,\n ...parseSyncMetadataToSplTokenInstruction(instruction),\n };\n }\n default:\n throw new Error(`Unrecognized instruction type: ${instructionType as string}`);\n }\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n isProgramError,\n type Address,\n type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM,\n type SolanaError,\n} from '@solana/kit';\nimport { TOKEN_WRAP_PROGRAM_ADDRESS } from '../programs';\n\nexport const TOKEN_WRAP_ERROR__WRAPPED_MINT_MISMATCH = 0x0; // 0\nexport const TOKEN_WRAP_ERROR__BACKPOINTER_MISMATCH = 0x1; // 1\nexport const TOKEN_WRAP_ERROR__ZERO_WRAP_AMOUNT = 0x2; // 2\nexport const TOKEN_WRAP_ERROR__MINT_AUTHORITY_MISMATCH = 0x3; // 3\nexport const TOKEN_WRAP_ERROR__ESCROW_OWNER_MISMATCH = 0x4; // 4\nexport const TOKEN_WRAP_ERROR__INVALID_WRAPPED_MINT_OWNER = 0x5; // 5\nexport const TOKEN_WRAP_ERROR__INVALID_BACKPOINTER_OWNER = 0x6; // 6\nexport const TOKEN_WRAP_ERROR__ESCROW_MISMATCH = 0x7; // 7\nexport const TOKEN_WRAP_ERROR__ESCROW_IN_GOOD_STATE = 0x8; // 8\nexport const TOKEN_WRAP_ERROR__UNWRAPPED_MINT_HAS_NO_METADATA = 0x9; // 9\nexport const TOKEN_WRAP_ERROR__METAPLEX_METADATA_MISMATCH = 0xa; // 10\nexport const TOKEN_WRAP_ERROR__METADATA_POINTER_MISSING = 0xb; // 11\nexport const TOKEN_WRAP_ERROR__METADATA_POINTER_UNSET = 0xc; // 12\nexport const TOKEN_WRAP_ERROR__METADATA_POINTER_MISMATCH = 0xd; // 13\nexport const TOKEN_WRAP_ERROR__EXTERNAL_PROGRAM_RETURNED_NO_DATA = 0xe; // 14\nexport const TOKEN_WRAP_ERROR__NO_SYNCING_TO_TOKEN2022 = 0xf; // 15\n\nexport type TokenWrapError =\n | typeof TOKEN_WRAP_ERROR__BACKPOINTER_MISMATCH\n | typeof TOKEN_WRAP_ERROR__ESCROW_IN_GOOD_STATE\n | typeof TOKEN_WRAP_ERROR__ESCROW_MISMATCH\n | typeof TOKEN_WRAP_ERROR__ESCROW_OWNER_MISMATCH\n | typeof TOKEN_WRAP_ERROR__EXTERNAL_PROGRAM_RETURNED_NO_DATA\n | typeof TOKEN_WRAP_ERROR__INVALID_BACKPOINTER_OWNER\n | typeof TOKEN_WRAP_ERROR__INVALID_WRAPPED_MINT_OWNER\n | typeof TOKEN_WRAP_ERROR__METADATA_POINTER_MISMATCH\n | typeof TOKEN_WRAP_ERROR__METADATA_POINTER_MISSING\n | typeof TOKEN_WRAP_ERROR__METADATA_POINTER_UNSET\n | typeof TOKEN_WRAP_ERROR__METAPLEX_METADATA_MISMATCH\n | typeof TOKEN_WRAP_ERROR__MINT_AUTHORITY_MISMATCH\n | typeof TOKEN_WRAP_ERROR__NO_SYNCING_TO_TOKEN2022\n | typeof TOKEN_WRAP_ERROR__UNWRAPPED_MINT_HAS_NO_METADATA\n | typeof TOKEN_WRAP_ERROR__WRAPPED_MINT_MISMATCH\n | typeof TOKEN_WRAP_ERROR__ZERO_WRAP_AMOUNT;\n\nlet tokenWrapErrorMessages: Record<TokenWrapError, string> | undefined;\nif (process.env.NODE_ENV !== 'production') {\n tokenWrapErrorMessages = {\n [TOKEN_WRAP_ERROR__BACKPOINTER_MISMATCH]: `Wrapped backpointer account address does not match expected PDA`,\n [TOKEN_WRAP_ERROR__ESCROW_IN_GOOD_STATE]: `The escrow account is in a good state and cannot be recreated`,\n [TOKEN_WRAP_ERROR__ESCROW_MISMATCH]: `Escrow account address does not match expected ATA`,\n [TOKEN_WRAP_ERROR__ESCROW_OWNER_MISMATCH]: `Unwrapped escrow token owner is not set to expected PDA`,\n [TOKEN_WRAP_ERROR__EXTERNAL_PROGRAM_RETURNED_NO_DATA]: `External metadata program returned no data`,\n [TOKEN_WRAP_ERROR__INVALID_BACKPOINTER_OWNER]: `Wrapped backpointer account owner is not the expected token wrap program`,\n [TOKEN_WRAP_ERROR__INVALID_WRAPPED_MINT_OWNER]: `Wrapped mint account owner is not the expected token program`,\n [TOKEN_WRAP_ERROR__METADATA_POINTER_MISMATCH]: `Provided source metadata account does not match pointer`,\n [TOKEN_WRAP_ERROR__METADATA_POINTER_MISSING]: `Metadata pointer extension missing on mint`,\n [TOKEN_WRAP_ERROR__METADATA_POINTER_UNSET]: `Metadata pointer is unset (None)`,\n [TOKEN_WRAP_ERROR__METAPLEX_METADATA_MISMATCH]: `Metaplex metadata account address does not match expected PDA`,\n [TOKEN_WRAP_ERROR__MINT_AUTHORITY_MISMATCH]: `Wrapped mint authority does not match expected PDA`,\n [TOKEN_WRAP_ERROR__NO_SYNCING_TO_TOKEN2022]: `Instruction can only be used with spl-token wrapped mints`,\n [TOKEN_WRAP_ERROR__UNWRAPPED_MINT_HAS_NO_METADATA]: `Unwrapped mint does not have the TokenMetadata extension`,\n [TOKEN_WRAP_ERROR__WRAPPED_MINT_MISMATCH]: `Wrapped mint account address does not match expected PDA`,\n [TOKEN_WRAP_ERROR__ZERO_WRAP_AMOUNT]: `Wrap amount should be positive`,\n };\n}\n\nexport function getTokenWrapErrorMessage(code: TokenWrapError): string {\n if (process.env.NODE_ENV !== 'production') {\n return (tokenWrapErrorMessages as Record<TokenWrapError, string>)[code];\n }\n\n return 'Error message not available in production bundles.';\n}\n\nexport function isTokenWrapError<TProgramErrorCode extends TokenWrapError>(\n error: unknown,\n transactionMessage: { instructions: Record<number, { programAddress: Address }> },\n code?: TProgramErrorCode,\n): error is SolanaError<typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM> &\n Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> {\n return isProgramError<TProgramErrorCode>(error, transactionMessage, TOKEN_WRAP_PROGRAM_ADDRESS, code);\n}\n","import {\n Address,\n fetchEncodedAccount,\n GetAccountInfoApi,\n GetMinimumBalanceForRentExemptionApi,\n Instruction,\n KeyPairSigner,\n Rpc,\n} from '@solana/kit';\nimport { getMintSize, TOKEN_2022_PROGRAM_ADDRESS, extension } from '@solana-program/token-2022';\nimport { getTransferSolInstruction } from '@solana-program/system';\nimport { findBackpointerPda, findWrappedMintPda, getBackpointerSize, getCreateMintInstruction } from './generated';\n\nexport interface CreateMintArgs {\n rpc: Rpc<GetAccountInfoApi & GetMinimumBalanceForRentExemptionApi>;\n unwrappedMint: Address;\n wrappedTokenProgram: Address;\n payer: KeyPairSigner;\n idempotent: boolean;\n}\n\nexport interface CreateMintResult {\n wrappedMint: Address;\n backpointer: Address;\n fundedWrappedMintLamports: bigint;\n fundedBackpointerLamports: bigint;\n ixs: Instruction[];\n}\n\n// The on-chain program adds these two extensions by default. We must account for\n// their size here. The `getMintSize` function from the library expects extension\n// data objects, but since the size of these extensions is fixed, we can pass\n// dummy/default values.\nconst DEFAULT_EXTENSIONS = [\n extension('ConfidentialTransferMint', {\n autoApproveNewAccounts: true,\n authority: null,\n auditorElgamalPubkey: null,\n }),\n extension('MetadataPointer', {\n authority: null,\n metadataAddress: null,\n }),\n];\n\nexport async function createMint({\n rpc,\n unwrappedMint,\n wrappedTokenProgram,\n payer,\n idempotent = false,\n}: CreateMintArgs): Promise<CreateMintResult> {\n const [wrappedMint] = await findWrappedMintPda({\n unwrappedMint,\n wrappedTokenProgram: wrappedTokenProgram,\n });\n const [backpointer] = await findBackpointerPda({ wrappedMint });\n\n const instructions: Instruction[] = [];\n\n // Fund wrapped mint account if needed\n let fundedWrappedMintLamports = 0n;\n\n let mintSize = BigInt(getMintSize());\n if (wrappedTokenProgram === TOKEN_2022_PROGRAM_ADDRESS) {\n mintSize = BigInt(getMintSize(DEFAULT_EXTENSIONS));\n }\n\n const [wrappedMintAccount, wrappedMintRent] = await Promise.all([\n fetchEncodedAccount(rpc, wrappedMint),\n rpc.getMinimumBalanceForRentExemption(mintSize).send(),\n ]);\n\n const wrappedMintLamports = wrappedMintAccount.exists ? wrappedMintAccount.lamports : 0n;\n if (wrappedMintLamports < wrappedMintRent) {\n fundedWrappedMintLamports = wrappedMintRent - wrappedMintLamports;\n instructions.push(\n getTransferSolInstruction({\n source: payer,\n destination: wrappedMint,\n amount: fundedWrappedMintLamports,\n }),\n );\n }\n\n // Fund backpointer account if needed\n let fundedBackpointerLamports = 0n;\n\n const backpointerSize = BigInt(getBackpointerSize());\n const [backpointerAccount, backpointerRent] = await Promise.all([\n fetchEncodedAccount(rpc, backpointer),\n rpc.getMinimumBalanceForRentExemption(backpointerSize).send(),\n ]);\n\n const backpointerLamports = backpointerAccount.exists ? backpointerAccount.lamports : 0n;\n if (backpointerLamports < backpointerRent) {\n fundedBackpointerLamports = backpointerRent - backpointerLamports;\n instructions.push(\n getTransferSolInstruction({\n source: payer,\n destination: backpointer,\n amount: fundedBackpointerLamports,\n }),\n );\n }\n\n // Add create_mint instruction\n instructions.push(\n getCreateMintInstruction({\n wrappedMint,\n backpointer,\n unwrappedMint,\n wrappedTokenProgram,\n idempotent,\n }),\n );\n\n return {\n wrappedMint,\n backpointer,\n ixs: instructions,\n fundedWrappedMintLamports,\n fundedBackpointerLamports,\n };\n}\n","import { getCreateAccountInstruction } from '@solana-program/system';\nimport { getInitializeAccountInstruction as initializeToken, TOKEN_PROGRAM_ADDRESS } from '@solana-program/token';\nimport {\n fetchMaybeToken,\n findAssociatedTokenPda,\n getCreateAssociatedTokenInstruction,\n getTokenDecoder,\n InitializeAccountInput,\n getInitializeAccountInstruction as initializeToken2022,\n Token,\n TOKEN_2022_PROGRAM_ADDRESS,\n} from '@solana-program/token-2022';\nimport {\n Account,\n Address,\n assertIsFullySignedTransaction,\n assertIsSendableTransaction,\n Blockhash,\n containsBytes,\n fetchEncodedAccount,\n FullySignedTransaction,\n generateKeyPairSigner,\n GetAccountInfoApi,\n GetMinimumBalanceForRentExemptionApi,\n Instruction,\n KeyPairSigner,\n Rpc,\n SignatureBytes,\n Transaction,\n TransactionWithBlockhashLifetime,\n TransactionWithinSizeLimit,\n} from '@solana/kit';\nimport { findWrappedMintAuthorityPda, findWrappedMintPda } from './generated';\n\nfunction getInitializeTokenFn(tokenProgram: Address): (input: InitializeAccountInput) => Instruction {\n if (tokenProgram === TOKEN_PROGRAM_ADDRESS) return initializeToken;\n if (tokenProgram === TOKEN_2022_PROGRAM_ADDRESS) return initializeToken2022;\n throw new Error(`${tokenProgram} is not a valid token program.`);\n}\n\nexport async function createTokenAccount({\n rpc,\n payer,\n mint,\n owner,\n tokenProgram,\n}: {\n rpc: Rpc<GetMinimumBalanceForRentExemptionApi>;\n payer: KeyPairSigner;\n mint: Address;\n owner: Address;\n tokenProgram: Address;\n}): Promise<{ ixs: Instruction[]; keyPair: KeyPairSigner }> {\n const [keyPair, lamports] = await Promise.all([\n generateKeyPairSigner(),\n rpc.getMinimumBalanceForRentExemption(165n).send(),\n ]);\n\n const createAccountIx = getCreateAccountInstruction({\n payer,\n newAccount: keyPair,\n lamports,\n space: 165,\n programAddress: tokenProgram,\n });\n\n const initializeAccountIx = getInitializeTokenFn(tokenProgram)({\n account: keyPair.address,\n mint,\n owner,\n });\n\n return {\n ixs: [createAccountIx, initializeAccountIx],\n keyPair,\n };\n}\n\nexport interface CreateEscrowAccountArgs {\n rpc: Rpc<GetAccountInfoApi & GetMinimumBalanceForRentExemptionApi>;\n payer: KeyPairSigner;\n unwrappedMint: Address;\n wrappedTokenProgram: Address;\n}\n\nexport type CreateEscrowAccountResult =\n | { kind: 'already_exists'; account: Account<Token> }\n | {\n kind: 'instructions_to_create';\n address: Address;\n ixs: Instruction[];\n };\n\nexport async function createEscrowAccount({\n rpc,\n payer,\n unwrappedMint,\n wrappedTokenProgram,\n}: CreateEscrowAccountArgs): Promise<CreateEscrowAccountResult> {\n const [wrappedMint] = await findWrappedMintPda({ unwrappedMint, wrappedTokenProgram });\n const [wrappedMintAuthority] = await findWrappedMintAuthorityPda({ wrappedMint });\n const unwrappedTokenProgram = await getOwnerFromAccount(rpc, unwrappedMint);\n\n const [escrowAta] = await findAssociatedTokenPda({\n owner: wrappedMintAuthority,\n mint: unwrappedMint,\n tokenProgram: unwrappedTokenProgram,\n });\n\n const escrowResult = await fetchMaybeToken(rpc, escrowAta);\n if (escrowResult.exists) {\n return { kind: 'already_exists', account: escrowResult };\n }\n\n const ix = getCreateAssociatedTokenInstruction({\n payer,\n owner: wrappedMintAuthority,\n mint: unwrappedMint,\n ata: escrowAta,\n tokenProgram: unwrappedTokenProgram,\n }) as Instruction;\n\n return { address: escrowAta, ixs: [ix], kind: 'instructions_to_create' };\n}\n\nexport async function getOwnerFromAccount(rpc: Rpc<GetAccountInfoApi>, accountAddress: Address): Promise<Address> {\n const accountInfo = await rpc.getAccountInfo(accountAddress, { encoding: 'base64' }).send();\n if (!accountInfo.value) {\n throw new Error(`Account ${accountAddress} not found.`);\n }\n return accountInfo.value.owner;\n}\n\nexport async function getMintFromTokenAccount(\n rpc: Rpc<GetAccountInfoApi>,\n tokenAccountAddress: Address,\n): Promise<Address> {\n const account = await fetchEncodedAccount(rpc, tokenAccountAddress);\n if (!account.exists) {\n throw new Error(`Unwrapped token account ${tokenAccountAddress} not found.`);\n }\n return getTokenDecoder().decode(account.data).mint;\n}\n\nfunction messageBytesEqual(results: (Transaction & TransactionWithBlockhashLifetime)[]): boolean {\n // If array has only one element, return true\n if (results.length === 1) {\n return true;\n }\n\n // Use the first result as reference\n const reference = results[0];\n if (!reference) throw new Error('No transactions in input');\n\n // Compare each result with the reference\n return results.every(\n c =>\n reference.messageBytes.length === c.messageBytes.length &&\n containsBytes(reference.messageBytes, c.messageBytes, 0),\n );\n}\n\nfunction combineSignatures(\n signedTxs: (Transaction & TransactionWithBlockhashLifetime)[],\n): Record<string, SignatureBytes> {\n // Step 1: Determine the canonical signer order from the first signed transaction.\n // Insertion order is the way to re-create this. Without it, verification will fail.\n const firstSignedTx = signedTxs[0];\n if (!firstSignedTx) {\n throw new Error('No signed transactions provided');\n }\n\n const allSignatures: Record<string, SignatureBytes | null> = {};\n\n // Step 1: Insert a null signature for each signer, maintaining the order of the signatures from the first signed transaction\n for (const pubkey of Object.keys(firstSignedTx.signatures)) {\n allSignatures[pubkey] = null;\n }\n\n // Step 2: Gather all signatures from all transactions\n for (const signedTx of signedTxs) {\n for (const [address, signature] of Object.entries(signedTx.signatures)) {\n if (signature) {\n // only store non-null signers\n allSignatures[address] = signature;\n }\n }\n }\n\n // Step 3: Assert all signatures are set\n const missingSigners: string[] = [];\n for (const [pubkey, signature] of Object.entries(allSignatures)) {\n if (signature === null) {\n missingSigners.push(pubkey);\n }\n }\n if (missingSigners.length > 0) {\n throw new Error(`Missing signatures for: ${missingSigners.join(', ')}`);\n }\n\n return allSignatures as Record<string, SignatureBytes>;\n}\n\nexport interface MultiSigCombineArgs {\n signedTxs: (Transaction & TransactionWithBlockhashLifetime)[];\n blockhash: {\n blockhash: Blockhash;\n lastValidBlockHeight: bigint;\n };\n}\n\n// Combines, validates, and broadcasts outputs of multisig offline partially signed txs\nexport function combinedMultisigTx({\n signedTxs,\n blockhash,\n}: MultiSigCombineArgs): Transaction &\n FullySignedTransaction &\n TransactionWithBlockhashLifetime &\n TransactionWithinSizeLimit {\n const messagesEqual = messageBytesEqual(signedTxs);\n if (!messagesEqual) throw new Error('Messages are not all the same');\n if (!signedTxs[0]) throw new Error('No signed transactions provided');\n\n const tx = {\n messageBytes: signedTxs[0].messageBytes,\n signatures: combineSignatures(signedTxs),\n lifetimeConstraint: blockhash,\n };\n\n assertIsFullySignedTransaction(tx);\n assertIsSendableTransaction(tx);\n\n return tx;\n}\n","import { findAssociatedTokenPda } from '@solana-program/token-2022';\nimport {\n Address,\n appendTransactionMessageInstructions,\n Blockhash,\n createTransactionMessage,\n GetAccountInfoApi,\n Instruction,\n pipe,\n Rpc,\n setTransactionMessageFeePayerSigner,\n setTransactionMessageLifetimeUsingBlockhash,\n TransactionMessage,\n TransactionMessageWithBlockhashLifetime,\n TransactionMessageWithFeePayerSigner,\n TransactionSigner,\n} from '@solana/kit';\nimport { findWrappedMintAuthorityPda, findWrappedMintPda, getWrapInstruction, WrapInput } from './generated';\nimport { getMintFromTokenAccount, getOwnerFromAccount } from './utilities';\n\ninterface IxBuilderArgs {\n unwrappedTokenAccount: Address;\n wrappedTokenProgram: Address;\n amount: bigint | number;\n wrappedMint: Address;\n wrappedMintAuthority: Address;\n transferAuthority: Address | TransactionSigner;\n unwrappedMint: Address;\n recipientWrappedTokenAccount: Address;\n unwrappedTokenProgram: Address;\n multiSigners?: TransactionSigner[];\n}\n\nexport interface MultiSignerWrapIxBuilderArgs extends IxBuilderArgs {\n payer: TransactionSigner;\n blockhash: {\n blockhash: Blockhash;\n lastValidBlockHeight: bigint;\n };\n multiSigners: TransactionSigner[];\n}\n\n// Used to collect signatures\nexport async function multisigOfflineSignWrap(\n args: MultiSignerWrapIxBuilderArgs,\n): Promise<TransactionMessage & TransactionMessageWithBlockhashLifetime & TransactionMessageWithFeePayerSigner> {\n const wrapIx = await buildWrapIx(args);\n\n return pipe(\n createTransactionMessage({ version: 0 }),\n tx => setTransactionMessageFeePayerSigner(args.payer, tx),\n tx => setTransactionMessageLifetimeUsingBlockhash(args.blockhash, tx),\n tx => appendTransactionMessageInstructions([wrapIx], tx),\n );\n}\n\nexport interface SingleSignerWrapArgs {\n rpc: Rpc<GetAccountInfoApi>;\n payer: TransactionSigner; // Fee payer and default transfer authority\n unwrappedTokenAccount: Address;\n wrappedTokenProgram: Address;\n amount: bigint | number;\n transferAuthority?: Address | TransactionSigner; // Defaults to payer if not provided\n unwrappedMint?: Address; // Will fetch from unwrappedTokenAccount if not provided\n recipientWrappedTokenAccount?: Address; // Defaults to payer's ATA if not provided\n unwrappedTokenProgram?: Address; // Will fetch from unwrappedTokenAccount owner if not provided\n}\n\nexport interface SingleSignerWrapResult {\n ixs: Instruction[];\n recipientWrappedTokenAccount: Address;\n escrowAccount: Address;\n amount: bigint;\n}\n\nexport async function singleSignerWrap({\n rpc,\n payer,\n unwrappedTokenAccount,\n wrappedTokenProgram,\n amount,\n transferAuthority: inputTransferAuthority,\n unwrappedMint: inputUnwrappedMint,\n recipientWrappedTokenAccount: inputRecipientTokenAccount,\n unwrappedTokenProgram: inputUnwrappedTokenProgram,\n}: SingleSignerWrapArgs): Promise<SingleSignerWrapResult> {\n const {\n unwrappedMint,\n unwrappedTokenProgram,\n wrappedMint,\n wrappedMintAuthority,\n recipientWrappedTokenAccount,\n transferAuthority,\n unwrappedEscrow,\n } = await resolveAddrs({\n rpc,\n payer,\n inputTransferAuthority,\n inputUnwrappedMint,\n unwrappedTokenAccount,\n inputUnwrappedTokenProgram,\n wrappedTokenProgram,\n inputRecipientTokenAccount,\n });\n\n const ix = await buildWrapIx({\n unwrappedTokenAccount,\n wrappedTokenProgram,\n amount,\n transferAuthority,\n unwrappedMint,\n wrappedMint,\n wrappedMintAuthority,\n recipientWrappedTokenAccount,\n unwrappedTokenProgram,\n });\n\n return {\n ixs: [ix],\n recipientWrappedTokenAccount,\n escrowAccount: unwrappedEscrow,\n amount: BigInt(amount),\n };\n}\n\n// Meant to handle all of the potential default values\nasync function resolveAddrs({\n rpc,\n payer,\n unwrappedTokenAccount,\n wrappedTokenProgram,\n inputTransferAuthority,\n inputUnwrappedMint,\n inputRecipientTokenAccount,\n inputUnwrappedTokenProgram,\n}: {\n rpc: Rpc<GetAccountInfoApi>;\n payer: TransactionSigner;\n unwrappedTokenAccount: Address;\n wrappedTokenProgram: Address;\n inputTransferAuthority?: Address | TransactionSigner;\n inputUnwrappedMint?: Address;\n inputRecipientTokenAccount?: Address;\n inputUnwrappedTokenProgram?: Address;\n}) {\n const unwrappedMint = inputUnwrappedMint ?? (await getMintFromTokenAccount(rpc, unwrappedTokenAccount));\n const unwrappedTokenProgram = inputUnwrappedTokenProgram ?? (await getOwnerFromAccount(rpc, unwrappedTokenAccount));\n const [wrappedMint] = await findWrappedMintPda({ unwrappedMint, wrappedTokenProgram });\n const [wrappedMintAuthority] = await findWrappedMintAuthorityPda({ wrappedMint });\n const recipientWrappedTokenAccount =\n inputRecipientTokenAccount ??\n (\n await findAssociatedTokenPda({\n owner: payer.address,\n mint: wrappedMint,\n tokenProgram: wrappedTokenProgram,\n })\n )[0];\n const [unwrappedEscrow] = await findAssociatedTokenPda({\n owner: wrappedMintAuthority,\n mint: unwrappedMint,\n tokenProgram: unwrappedTokenProgram,\n });\n\n const transferAuthority = inputTransferAuthority ?? payer;\n\n return {\n unwrappedEscrow,\n transferAuthority,\n unwrappedMint,\n unwrappedTokenProgram,\n wrappedMint,\n wrappedMintAuthority,\n recipientWrappedTokenAccount,\n };\n}\n\nasync function buildWrapIx({\n unwrappedTokenAccount,\n wrappedTokenProgram,\n amount,\n transferAuthority,\n unwrappedMint,\n recipientWrappedTokenAccount,\n unwrappedTokenProgram,\n wrappedMint,\n wrappedMintAuthority,\n multiSigners = [],\n}: IxBuilderArgs): Promise<Instruction> {\n const [unwrappedEscrow] = await findAssociatedTokenPda({\n owner: wrappedMintAuthority,\n mint: unwrappedMint,\n tokenProgram: unwrappedTokenProgram,\n });\n\n const wrapInstructionInput: WrapInput = {\n recipientWrappedTokenAccount,\n wrappedMint,\n wrappedMintAuthority,\n unwrappedTokenProgram,\n wrappedTokenProgram,\n unwrappedTokenAccount,\n unwrappedMint,\n unwrappedEscrow,\n transferAuthority,\n amount: BigInt(amount),\n multiSigners,\n };\n\n return getWrapInstruction(wrapInstructionInput);\n}\n","import { findAssociatedTokenPda, getTokenDecoder } from '@solana-program/token-2022';\nimport {\n Address,\n appendTransactionMessageInstructions,\n Blockhash,\n createTransactionMessage,\n fetchEncodedAccount,\n GetAccountInfoApi,\n Instruction,\n pipe,\n Rpc,\n setTransactionMessageFeePayerSigner,\n setTransactionMessageLifetimeUsingBlockhash,\n TransactionMessage,\n TransactionMessageWithBlockhashLifetime,\n TransactionMessageWithFeePayerSigner,\n TransactionSigner,\n} from '@solana/kit';\nimport { findWrappedMintAuthorityPda, getUnwrapInstruction, UnwrapInput } from './generated';\nimport { getMintFromTokenAccount, getOwnerFromAccount } from './utilities';\n\nexport interface SingleSignerUnwrapArgs {\n rpc: Rpc<GetAccountInfoApi>;\n payer: TransactionSigner; // Fee payer and default transfer authority\n wrappedTokenAccount: Address;\n amount: bigint | number;\n recipientUnwrappedToken: Address;\n // Optional arguments below (will be derived/defaulted if not provided)\n transferAuthority?: Address | TransactionSigner; // Defaults to payer\n unwrappedMint?: Address; // Will derive from unwrappedEscrow if not provided\n wrappedTokenProgram?: Address; // Will derive from wrappedTokenAccount if not provided\n unwrappedTokenProgram?: Address; // Will derive from unwrappedEscrow if not provided\n}\n\nasync function resolveUnwrapAddrs({\n rpc,\n payer,\n wrappedTokenAccount,\n recipientUnwrappedToken,\n inputUnwrappedMint,\n inputTransferAuthority,\n inputWrappedTokenProgram,\n inputUnwrappedTokenProgram,\n}: {\n rpc: Rpc<GetAccountInfoApi>;\n payer: TransactionSigner;\n wrappedTokenAccount: Address;\n recipientUnwrappedToken: Address;\n inputUnwrappedMint?: Address;\n inputTransferAuthority?: Address | TransactionSigner;\n inputWrappedTokenProgram?: Address;\n inputUnwrappedTokenProgram?: Address;\n}) {\n const wrappedTokenProgram = inputWrappedTokenProgram ?? (await getOwnerFromAccount(rpc, wrappedTokenAccount));\n const unwrappedTokenProgram =\n inputUnwrappedTokenProgram ?? (await getOwnerFromAccount(rpc, recipientUnwrappedToken));\n const unwrappedMint = inputUnwrappedMint ?? (await getMintFromTokenAccount(rpc, recipientUnwrappedToken));\n\n // Get wrapped mint from the token account being burned\n const wrappedAccountInfo = await fetchEncodedAccount(rpc, wrappedTokenAccount);\n if (!wrappedAccountInfo.exists) {\n throw new Error(`Wrapped token account ${wrappedTokenAccount} not found.`);\n }\n const wrappedMint = getTokenDecoder().decode(wrappedAccountInfo.data).mint;\n\n const [wrappedMintAuthority] = await findWrappedMintAuthorityPda({ wrappedMint });\n\n // Default transfer authority to payer if not provided\n const transferAuthority = inputTransferAuthority ?? payer;\n\n return {\n unwrappedMint,\n wrappedMint,\n wrappedMintAuthority,\n transferAuthority,\n wrappedTokenProgram,\n unwrappedTokenProgram,\n };\n}\n\ninterface UnwrapTxBuilderArgs {\n wrappedTokenAccount: Address;\n amount: bigint | number;\n wrappedMint: Address;\n wrappedMintAuthority: Address;\n unwrappedMint: Address;\n recipientUnwrappedToken: Address;\n unwrappedTokenProgram: Address;\n wrappedTokenProgram: Address;\n transferAuthority: Address | TransactionSigner;\n multiSigners?: TransactionSigner[];\n}\n\nasync function buildUnwrapTransaction({\n recipientUnwrappedToken,\n wrappedMintAuthority,\n unwrappedMint,\n wrappedTokenProgram,\n unwrappedTokenProgram,\n wrappedTokenAccount,\n wrappedMint,\n transferAuthority,\n amount,\n multiSigners = [],\n}: UnwrapTxBuilderArgs): Promise<Instruction> {\n const [unwrappedEscrow] = await findAssociatedTokenPda({\n owner: wrappedMintAuthority,\n mint: unwrappedMint,\n tokenProgram: unwrappedTokenProgram,\n });\n\n const unwrapInstructionInput: UnwrapInput = {\n unwrappedEscrow,\n recipientUnwrappedToken,\n wrappedMintAuthority,\n unwrappedMint,\n wrappedTokenProgram,\n unwrappedTokenProgram,\n wrappedTokenAccount,\n wrappedMint,\n transferAuthority,\n amount: BigInt(amount),\n multiSigners,\n };\n\n return getUnwrapInstruction(unwrapInstructionInput);\n}\n\nexport interface SingleSignerUnwrapResult {\n ixs: Instruction[];\n recipientUnwrappedToken: Address;\n amount: bigint;\n}\n\n/**\n * Creates, signs (single signer or default authority), and sends an unwrap transaction.\n * Derives necessary PDAs and default accounts if not provided.\n */\nexport async function singleSignerUnwrap({\n rpc,\n payer,\n wrappedTokenAccount,\n amount,\n recipientUnwrappedToken,\n transferAuthority: inputTransferAuthority,\n unwrappedMint: inputUnwrappedMint,\n wrappedTokenProgram: inputWrappedTokenProgram,\n unwrappedTokenProgram: inputUnwrappedTokenProgram,\n}: SingleSignerUnwrapArgs): Promise<SingleSignerUnwrapResult> {\n const {\n wrappedMint,\n wrappedMintAuthority,\n transferAuthority,\n unwrappedTokenProgram,\n unwrappedMint,\n wrappedTokenProgram,\n } = await resolveUnwrapAddrs({\n rpc,\n payer,\n wrappedTokenAccount,\n recipientUnwrappedToken,\n inputUnwrappedMint,\n inputTransferAuthority,\n inputWrappedTokenProgram,\n inputUnwrappedTokenProgram,\n });\n\n const ix = await buildUnwrapTransaction({\n recipientUnwrappedToken,\n wrappedMintAuthority,\n unwrappedMint,\n wrappedTokenProgram,\n unwrappedTokenProgram,\n wrappedTokenAccount,\n wrappedMint,\n transferAuthority,\n amount,\n });\n\n return {\n recipientUnwrappedToken,\n amount: BigInt(amount),\n ixs: [ix],\n };\n}\n\nexport interface MultiSignerUnWrapTxBuilderArgs extends UnwrapTxBuilderArgs {\n payer: TransactionSigner;\n blockhash: {\n blockhash: Blockhash;\n lastValidBlockHeight: bigint;\n };\n multiSigners: TransactionSigner[];\n}\n\n// Used to collect signatures\nexport async function multisigOfflineSignUnwrap(\n args: MultiSignerUnWrapTxBuilderArgs,\n): Promise<TransactionMessage & TransactionMessageWithBlockhashLifetime & TransactionMessageWithFeePayerSigner> {\n const unwrapIx = await buildUnwrapTransaction(args);\n\n return pipe(\n createTransactionMessage({ version: 0 }),\n tx => setTransactionMessageFeePayerSigner(args.payer, tx),\n tx => setTransactionMessageLifetimeUsingBlockhash(args.blockhash, tx),\n tx => appendTransactionMessageInstructions([unwrapIx], tx),\n );\n}\n"]}
|