@solana/transactions 2.0.0-experimental.0099b2a

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.
Files changed (42) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +334 -0
  3. package/dist/index.browser.cjs +1098 -0
  4. package/dist/index.browser.cjs.map +1 -0
  5. package/dist/index.browser.js +1080 -0
  6. package/dist/index.browser.js.map +1 -0
  7. package/dist/index.development.js +1778 -0
  8. package/dist/index.development.js.map +1 -0
  9. package/dist/index.native.js +1080 -0
  10. package/dist/index.native.js.map +1 -0
  11. package/dist/index.node.cjs +1098 -0
  12. package/dist/index.node.cjs.map +1 -0
  13. package/dist/index.node.js +1080 -0
  14. package/dist/index.node.js.map +1 -0
  15. package/dist/index.production.min.js +29 -0
  16. package/dist/types/accounts.d.ts +28 -0
  17. package/dist/types/blockhash.d.ts +18 -0
  18. package/dist/types/compile-address-table-lookups.d.ts +10 -0
  19. package/dist/types/compile-header.d.ts +9 -0
  20. package/dist/types/compile-instructions.d.ts +10 -0
  21. package/dist/types/compile-lifetime-token.d.ts +3 -0
  22. package/dist/types/compile-static-accounts.d.ts +4 -0
  23. package/dist/types/compile-transaction.d.ts +11 -0
  24. package/dist/types/create-transaction.d.ts +9 -0
  25. package/dist/types/decompile-transaction.d.ts +7 -0
  26. package/dist/types/durable-nonce.d.ts +35 -0
  27. package/dist/types/fee-payer.d.ts +9 -0
  28. package/dist/types/index.d.ts +10 -0
  29. package/dist/types/instructions.d.ts +5 -0
  30. package/dist/types/message.d.ts +30 -0
  31. package/dist/types/serializers/address-table-lookup.d.ts +8 -0
  32. package/dist/types/serializers/header.d.ts +8 -0
  33. package/dist/types/serializers/index.d.ts +2 -0
  34. package/dist/types/serializers/instruction.d.ts +8 -0
  35. package/dist/types/serializers/message.d.ts +6 -0
  36. package/dist/types/serializers/transaction-version.d.ts +6 -0
  37. package/dist/types/serializers/transaction.d.ts +9 -0
  38. package/dist/types/signatures.d.ts +20 -0
  39. package/dist/types/types.d.ts +26 -0
  40. package/dist/types/unsigned-transaction.d.ts +4 -0
  41. package/dist/types/wire-transaction.d.ts +6 -0
  42. package/package.json +103 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../build-scripts/env-shim.ts","../src/blockhash.ts","../src/unsigned-transaction.ts","../src/create-transaction.ts","../../instructions/src/roles.ts","../src/durable-nonce.ts","../src/fee-payer.ts","../src/instructions.ts","../src/serializers/transaction.ts","../src/accounts.ts","../src/compile-address-table-lookups.ts","../src/compile-header.ts","../src/compile-instructions.ts","../src/compile-lifetime-token.ts","../src/compile-static-accounts.ts","../src/message.ts","../src/compile-transaction.ts","../src/decompile-transaction.ts","../src/serializers/message.ts","../src/serializers/address-table-lookup.ts","../src/serializers/header.ts","../src/serializers/instruction.ts","../src/serializers/transaction-version.ts","../src/signatures.ts","../src/wire-transaction.ts"],"names":["AccountRole","combineCodec","mapDecoder","mapEncoder","getArrayDecoder","getArrayEncoder","getBytesDecoder","getBytesEncoder","getStructDecoder","getStructEncoder","getShortU16Decoder","getShortU16Encoder","getAddressComparator","getAddressDecoder","getAddressEncoder","getBase58Encoder","getU8Decoder","getU8Encoder","getBase58Decoder","base58Encoder","transactionSignature"],"mappings":";AACO,IAAM,UAA2B,uBAAO,QAAgB,KAAU,EAAE,aAAa,eAAe;;;ACAvG,SAAS,wBAAwB;;;ACE1B,SAAS,uBACZ,aACgG;AAChG,MAAI,gBAAgB,aAAa;AAE7B,UAAM;AAAA,MACF,YAAY;AAAA;AAAA,MACZ,GAAG;AAAA,IACP,IAAI;AACJ,WAAO;AAAA,EACX,OAAO;AACH,WAAO;AAAA,EACX;AACJ;;;ADGA,IAAI;AAEG,SAAS,kBAAkB,mBAAmE;AACjG,MAAI,CAAC;AAAe,oBAAgB,iBAAiB;AACrD,MAAI;AAEA;AAAA;AAAA,MAEI,kBAAkB,SAAS;AAAA,MAE3B,kBAAkB,SAAS;AAAA,MAC7B;AACE,YAAM,IAAI,MAAM,+DAA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AAO;AACvB,QAAM,kBAAkB,oBAAI,IAAI,CAAC,YAAY,UAAU,GAAG,+BAA+B,CAAC;AAE1F,kBAAgB,QAAQ,aAAW;AAC/B,QAAI,CAAC,YAAY,WAAW,OAAO,GAAG;AAElC,YAAM,IAAI,MAAM,kDAAkD,OAAO,IAAI;AAAA,IACjF;AAAA,EACJ,CAAC;AACL;;;AC/HO,SAAS,gCACZ,aAC4B;AAC5B,QAAM,uBAAuB,sBAAsB,EAAE,OAAO,WAAW;AACvE,MAAI,MAAY;AACZ,WAAO,OAAO,KAAK,oBAAoB,EAAE,SAAS,QAAQ;AAAA,EAC9D,OAAO;AACH,WAAQ,KAAwB,OAAO,aAAa,GAAG,oBAAoB,CAAC;AAAA,EAChF;AACJ","sourcesContent":["// Clever obfuscation to prevent the build system from inlining the value of `NODE_ENV`\nexport const __DEV__ = /* @__PURE__ */ (() => (process as any)['en' + 'v'].NODE_ENV === 'development')();\n","import { Encoder } from '@solana/codecs-core';\nimport { getBase58Encoder } from '@solana/codecs-strings';\n\nimport { IDurableNonceTransaction } from './durable-nonce';\nimport { ITransactionWithSignatures } from './signatures';\nimport { BaseTransaction } from './types';\nimport { getUnsignedTransaction } from './unsigned-transaction';\n\nexport type Blockhash = string & { readonly __brand: unique symbol };\n\ntype BlockhashLifetimeConstraint = Readonly<{\n blockhash: Blockhash;\n lastValidBlockHeight: bigint;\n}>;\n\nexport interface ITransactionWithBlockhashLifetime {\n readonly lifetimeConstraint: BlockhashLifetimeConstraint;\n}\n\nlet base58Encoder: Encoder<string> | undefined;\n\nexport function assertIsBlockhash(putativeBlockhash: string): asserts putativeBlockhash is Blockhash {\n if (!base58Encoder) base58Encoder = getBase58Encoder();\n try {\n // Fast-path; see if the input string is of an acceptable length.\n if (\n // Lowest value (32 bytes of zeroes)\n putativeBlockhash.length < 32 ||\n // Highest value (32 bytes of 255)\n putativeBlockhash.length > 44\n ) {\n throw new Error('Expected input string to decode to a byte array of length 32.');\n }\n // Slow-path; actually attempt to decode the input string.\n const bytes = base58Encoder.encode(putativeBlockhash);\n const numBytes = bytes.byteLength;\n if (numBytes !== 32) {\n throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);\n }\n } catch (e) {\n throw new Error(`\\`${putativeBlockhash}\\` is not a blockhash`, {\n cause: e,\n });\n }\n}\n\nexport function setTransactionLifetimeUsingBlockhash<TTransaction extends BaseTransaction & IDurableNonceTransaction>(\n blockhashLifetimeConstraint: BlockhashLifetimeConstraint,\n transaction: TTransaction | (TTransaction & ITransactionWithSignatures)\n): Omit<TTransaction, keyof ITransactionWithSignatures | 'lifetimeConstraint'> & ITransactionWithBlockhashLifetime;\n\nexport function setTransactionLifetimeUsingBlockhash<\n TTransaction extends BaseTransaction | (BaseTransaction & ITransactionWithBlockhashLifetime)\n>(\n blockhashLifetimeConstraint: BlockhashLifetimeConstraint,\n transaction: TTransaction | (TTransaction & ITransactionWithSignatures)\n): Omit<TTransaction, keyof ITransactionWithSignatures> & ITransactionWithBlockhashLifetime;\n\nexport function setTransactionLifetimeUsingBlockhash(\n blockhashLifetimeConstraint: BlockhashLifetimeConstraint,\n transaction: BaseTransaction | (BaseTransaction & ITransactionWithBlockhashLifetime)\n) {\n if (\n 'lifetimeConstraint' in transaction &&\n transaction.lifetimeConstraint.blockhash === blockhashLifetimeConstraint.blockhash &&\n transaction.lifetimeConstraint.lastValidBlockHeight === blockhashLifetimeConstraint.lastValidBlockHeight\n ) {\n return transaction;\n }\n const out = {\n ...getUnsignedTransaction(transaction),\n lifetimeConstraint: blockhashLifetimeConstraint,\n };\n Object.freeze(out);\n return out;\n}\n","import { ITransactionWithSignatures } from '.';\nimport { BaseTransaction } from './types';\n\nexport function getUnsignedTransaction<TTransaction extends BaseTransaction>(\n transaction: TTransaction | (TTransaction & ITransactionWithSignatures)\n): TTransaction | Omit<TTransaction & ITransactionWithSignatures, keyof ITransactionWithSignatures> {\n if ('signatures' in transaction) {\n // The implication of the lifetime constraint changing is that any existing signatures are invalid.\n const {\n signatures: _, // eslint-disable-line @typescript-eslint/no-unused-vars\n ...unsignedTransaction\n } = transaction;\n return unsignedTransaction;\n } else {\n return transaction;\n }\n}\n","import { Transaction, TransactionVersion } from './types';\n\ntype TransactionConfig<TVersion extends TransactionVersion> = Readonly<{\n version: TVersion;\n}>;\n\nexport function createTransaction<TVersion extends TransactionVersion>(\n config: TransactionConfig<TVersion>\n): Extract<Transaction, { version: TVersion }>;\nexport function createTransaction<TVersion extends TransactionVersion>({\n version,\n}: TransactionConfig<TVersion>): Transaction {\n const out: Transaction = {\n instructions: [],\n version,\n };\n Object.freeze(out);\n return out;\n}\n","/**\n * Quick primer on bitwise operations: https://stackoverflow.com/a/1436448/802047\n */\n\nexport enum AccountRole {\n // Bitflag guide: is signer ⌄⌄ is writable\n WRITABLE_SIGNER = /* 3 */ 0b11, // prettier-ignore\n READONLY_SIGNER = /* 2 */ 0b10, // prettier-ignore\n WRITABLE = /* 1 */ 0b01, // prettier-ignore\n READONLY = /* 0 */ 0b00, // prettier-ignore\n}\n\nconst IS_SIGNER_BITMASK = 0b10;\nconst IS_WRITABLE_BITMASK = 0b01;\n\nexport function downgradeRoleToNonSigner(role: AccountRole.READONLY_SIGNER): AccountRole.READONLY;\nexport function downgradeRoleToNonSigner(role: AccountRole.WRITABLE_SIGNER): AccountRole.WRITABLE;\nexport function downgradeRoleToNonSigner(role: AccountRole): AccountRole;\nexport function downgradeRoleToNonSigner(role: AccountRole): AccountRole {\n return role & ~IS_SIGNER_BITMASK;\n}\n\nexport function downgradeRoleToReadonly(role: AccountRole.WRITABLE): AccountRole.READONLY;\nexport function downgradeRoleToReadonly(role: AccountRole.WRITABLE_SIGNER): AccountRole.READONLY_SIGNER;\nexport function downgradeRoleToReadonly(role: AccountRole): AccountRole;\nexport function downgradeRoleToReadonly(role: AccountRole): AccountRole {\n return role & ~IS_WRITABLE_BITMASK;\n}\n\nexport function isSignerRole(role: AccountRole): role is AccountRole.READONLY_SIGNER | AccountRole.WRITABLE_SIGNER {\n return role >= AccountRole.READONLY_SIGNER;\n}\n\nexport function isWritableRole(role: AccountRole): role is AccountRole.WRITABLE | AccountRole.WRITABLE_SIGNER {\n return (role & IS_WRITABLE_BITMASK) !== 0;\n}\n\nexport function mergeRoles(roleA: AccountRole.WRITABLE, roleB: AccountRole.READONLY_SIGNER): AccountRole.WRITABLE_SIGNER; // prettier-ignore\nexport function mergeRoles(roleA: AccountRole.READONLY_SIGNER, roleB: AccountRole.WRITABLE): AccountRole.WRITABLE_SIGNER; // prettier-ignore\nexport function mergeRoles(roleA: AccountRole, roleB: AccountRole.WRITABLE_SIGNER): AccountRole.WRITABLE_SIGNER; // prettier-ignore\nexport function mergeRoles(roleA: AccountRole.WRITABLE_SIGNER, roleB: AccountRole): AccountRole.WRITABLE_SIGNER; // prettier-ignore\nexport function mergeRoles(roleA: AccountRole, roleB: AccountRole.READONLY_SIGNER): AccountRole.READONLY_SIGNER; // prettier-ignore\nexport function mergeRoles(roleA: AccountRole.READONLY_SIGNER, roleB: AccountRole): AccountRole.READONLY_SIGNER; // prettier-ignore\nexport function mergeRoles(roleA: AccountRole, roleB: AccountRole.WRITABLE): AccountRole.WRITABLE; // prettier-ignore\nexport function mergeRoles(roleA: AccountRole.WRITABLE, roleB: AccountRole): AccountRole.WRITABLE; // prettier-ignore\nexport function mergeRoles(roleA: AccountRole.READONLY, roleB: AccountRole.READONLY): AccountRole.READONLY; // prettier-ignore\nexport function mergeRoles(roleA: AccountRole, roleB: AccountRole): AccountRole; // prettier-ignore\nexport function mergeRoles(roleA: AccountRole, roleB: AccountRole): AccountRole {\n return roleA | roleB;\n}\n\nexport function upgradeRoleToSigner(role: AccountRole.READONLY): AccountRole.READONLY_SIGNER;\nexport function upgradeRoleToSigner(role: AccountRole.WRITABLE): AccountRole.WRITABLE_SIGNER;\nexport function upgradeRoleToSigner(role: AccountRole): AccountRole;\nexport function upgradeRoleToSigner(role: AccountRole): AccountRole {\n return role | IS_SIGNER_BITMASK;\n}\n\nexport function upgradeRoleToWritable(role: AccountRole.READONLY): AccountRole.WRITABLE;\nexport function upgradeRoleToWritable(role: AccountRole.READONLY_SIGNER): AccountRole.WRITABLE_SIGNER;\nexport function upgradeRoleToWritable(role: AccountRole): AccountRole;\nexport function upgradeRoleToWritable(role: AccountRole): AccountRole {\n return role | IS_WRITABLE_BITMASK;\n}\n","import { Base58EncodedAddress } from '@solana/addresses';\nimport {\n AccountRole,\n IInstruction,\n IInstructionWithAccounts,\n IInstructionWithData,\n isSignerRole,\n ReadonlyAccount,\n ReadonlySignerAccount,\n WritableAccount,\n WritableSignerAccount,\n} from '@solana/instructions';\n\nimport { ITransactionWithSignatures } from './signatures';\nimport { BaseTransaction } from './types';\nimport { getUnsignedTransaction } from './unsigned-transaction';\n\ntype AdvanceNonceAccountInstruction<\n TNonceAccountAddress extends string = string,\n TNonceAuthorityAddress extends string = string\n> = IInstruction<'11111111111111111111111111111111'> &\n IInstructionWithAccounts<\n readonly [\n WritableAccount<TNonceAccountAddress>,\n ReadonlyAccount<'SysvarRecentB1ockHashes11111111111111111111'>,\n ReadonlySignerAccount<TNonceAuthorityAddress> | WritableSignerAccount<TNonceAuthorityAddress>\n ]\n > &\n IInstructionWithData<AdvanceNonceAccountInstructionData>;\ntype AdvanceNonceAccountInstructionData = Uint8Array & {\n readonly __brand: unique symbol;\n};\ntype DurableNonceConfig<\n TNonceAccountAddress extends string = string,\n TNonceAuthorityAddress extends string = string,\n TNonceValue extends string = string\n> = Readonly<{\n readonly nonce: Nonce<TNonceValue>;\n readonly nonceAccountAddress: Base58EncodedAddress<TNonceAccountAddress>;\n readonly nonceAuthorityAddress: Base58EncodedAddress<TNonceAuthorityAddress>;\n}>;\nexport type Nonce<TNonceValue extends string = string> = TNonceValue & { readonly __brand: unique symbol };\ntype NonceLifetimeConstraint<TNonceValue extends string = string> = Readonly<{\n nonce: Nonce<TNonceValue>;\n}>;\n\nconst RECENT_BLOCKHASHES_SYSVAR_ADDRESS =\n 'SysvarRecentB1ockHashes11111111111111111111' as Base58EncodedAddress<'SysvarRecentB1ockHashes11111111111111111111'>;\nconst SYSTEM_PROGRAM_ADDRESS =\n '11111111111111111111111111111111' as Base58EncodedAddress<'11111111111111111111111111111111'>;\n\nexport interface IDurableNonceTransaction<\n TNonceAccountAddress extends string = string,\n TNonceAuthorityAddress extends string = string,\n TNonceValue extends string = string\n> {\n readonly instructions: readonly [\n // The first instruction *must* be the system program's `AdvanceNonceAccount` instruction.\n AdvanceNonceAccountInstruction<TNonceAccountAddress, TNonceAuthorityAddress>,\n ...IInstruction[]\n ];\n readonly lifetimeConstraint: NonceLifetimeConstraint<TNonceValue>;\n}\n\nexport function assertIsDurableNonceTransaction(\n transaction: BaseTransaction | (BaseTransaction & IDurableNonceTransaction)\n): asserts transaction is BaseTransaction & IDurableNonceTransaction {\n if (!isDurableNonceTransaction(transaction)) {\n // TODO: Coded error.\n throw new Error('Transaction is not a durable nonce transaction');\n }\n}\n\nfunction createAdvanceNonceAccountInstruction<\n TNonceAccountAddress extends string = string,\n TNonceAuthorityAddress extends string = string\n>(\n nonceAccountAddress: Base58EncodedAddress<TNonceAccountAddress>,\n nonceAuthorityAddress: Base58EncodedAddress<TNonceAuthorityAddress>\n): AdvanceNonceAccountInstruction<TNonceAccountAddress, TNonceAuthorityAddress> {\n return {\n accounts: [\n { address: nonceAccountAddress, role: AccountRole.WRITABLE },\n {\n address: RECENT_BLOCKHASHES_SYSVAR_ADDRESS,\n role: AccountRole.READONLY,\n },\n { address: nonceAuthorityAddress, role: AccountRole.READONLY_SIGNER },\n ],\n data: new Uint8Array([4, 0, 0, 0]) as AdvanceNonceAccountInstructionData,\n programAddress: SYSTEM_PROGRAM_ADDRESS,\n };\n}\n\nexport function isAdvanceNonceAccountInstruction(\n instruction: IInstruction\n): instruction is AdvanceNonceAccountInstruction {\n return (\n instruction.programAddress === SYSTEM_PROGRAM_ADDRESS &&\n // Test for `AdvanceNonceAccount` instruction data\n instruction.data != null &&\n isAdvanceNonceAccountInstructionData(instruction.data) &&\n // Test for exactly 3 accounts\n instruction.accounts?.length === 3 &&\n // First account is nonce account address\n instruction.accounts[0].address != null &&\n instruction.accounts[0].role === AccountRole.WRITABLE &&\n // Second account is recent blockhashes sysvar\n instruction.accounts[1].address === RECENT_BLOCKHASHES_SYSVAR_ADDRESS &&\n instruction.accounts[1].role === AccountRole.READONLY &&\n // Third account is nonce authority account\n instruction.accounts[2].address != null &&\n isSignerRole(instruction.accounts[2].role)\n );\n}\n\nfunction isAdvanceNonceAccountInstructionData(data: Uint8Array): data is AdvanceNonceAccountInstructionData {\n // AdvanceNonceAccount is the fifth instruction in the System Program (index 4)\n return data.byteLength === 4 && data[0] === 4 && data[1] === 0 && data[2] === 0 && data[3] === 0;\n}\n\nfunction isDurableNonceTransaction(\n transaction: BaseTransaction | (BaseTransaction & IDurableNonceTransaction)\n): transaction is BaseTransaction & IDurableNonceTransaction {\n return (\n 'lifetimeConstraint' in transaction &&\n typeof transaction.lifetimeConstraint.nonce === 'string' &&\n transaction.instructions[0] != null &&\n isAdvanceNonceAccountInstruction(transaction.instructions[0])\n );\n}\n\nfunction isAdvanceNonceAccountInstructionForNonce<\n TNonceAccountAddress extends Base58EncodedAddress = Base58EncodedAddress,\n TNonceAuthorityAddress extends Base58EncodedAddress = Base58EncodedAddress\n>(\n instruction: AdvanceNonceAccountInstruction,\n nonceAccountAddress: TNonceAccountAddress,\n nonceAuthorityAddress: TNonceAuthorityAddress\n): instruction is AdvanceNonceAccountInstruction<TNonceAccountAddress, TNonceAuthorityAddress> {\n return (\n instruction.accounts[0].address === nonceAccountAddress &&\n instruction.accounts[2].address === nonceAuthorityAddress\n );\n}\n\nexport function setTransactionLifetimeUsingDurableNonce<\n TTransaction extends BaseTransaction,\n TNonceAccountAddress extends string = string,\n TNonceAuthorityAddress extends string = string,\n TNonceValue extends string = string\n>(\n {\n nonce,\n nonceAccountAddress,\n nonceAuthorityAddress,\n }: DurableNonceConfig<TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue>,\n transaction: TTransaction | (TTransaction & IDurableNonceTransaction)\n): Omit<TTransaction, keyof ITransactionWithSignatures> &\n IDurableNonceTransaction<TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue> {\n let newInstructions: [\n AdvanceNonceAccountInstruction<TNonceAccountAddress, TNonceAuthorityAddress>,\n ...IInstruction[]\n ];\n\n const firstInstruction = transaction.instructions[0];\n if (firstInstruction && isAdvanceNonceAccountInstruction(firstInstruction)) {\n if (isAdvanceNonceAccountInstructionForNonce(firstInstruction, nonceAccountAddress, nonceAuthorityAddress)) {\n if (isDurableNonceTransaction(transaction) && transaction.lifetimeConstraint.nonce === nonce) {\n return transaction as TTransaction &\n IDurableNonceTransaction<TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue>;\n } else {\n // we already have the right first instruction, leave it as-is\n newInstructions = [firstInstruction, ...transaction.instructions.slice(1)];\n }\n } else {\n // we have a different advance nonce instruction as the first instruction, replace it\n newInstructions = [\n createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),\n ...transaction.instructions.slice(1),\n ];\n }\n } else {\n // we don't have an existing advance nonce instruction as the first instruction, prepend one\n newInstructions = [\n createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),\n ...transaction.instructions,\n ];\n }\n\n const out = {\n ...getUnsignedTransaction(transaction),\n instructions: newInstructions,\n lifetimeConstraint: {\n nonce,\n },\n } as TTransaction & IDurableNonceTransaction<TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue>;\n Object.freeze(out);\n return out;\n}\n","import { Base58EncodedAddress } from '@solana/addresses';\n\nimport { ITransactionWithSignatures } from './signatures';\nimport { BaseTransaction } from './types';\nimport { getUnsignedTransaction } from './unsigned-transaction';\n\nexport interface ITransactionWithFeePayer<TAddress extends string = string> {\n readonly feePayer: Base58EncodedAddress<TAddress>;\n}\n\nexport function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(\n feePayer: Base58EncodedAddress<TFeePayerAddress>,\n transaction:\n | (TTransaction & ITransactionWithSignatures)\n | (TTransaction & ITransactionWithFeePayer<string> & ITransactionWithSignatures)\n): Omit<TTransaction, keyof ITransactionWithSignatures> & ITransactionWithFeePayer<TFeePayerAddress>;\n\nexport function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(\n feePayer: Base58EncodedAddress<TFeePayerAddress>,\n transaction: TTransaction | (TTransaction & ITransactionWithFeePayer<string>)\n): TTransaction & ITransactionWithFeePayer<TFeePayerAddress>;\n\nexport function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(\n feePayer: Base58EncodedAddress<TFeePayerAddress>,\n transaction:\n | TTransaction\n | (TTransaction & ITransactionWithFeePayer<string>)\n | (TTransaction & ITransactionWithSignatures)\n | (TTransaction & ITransactionWithFeePayer<string> & ITransactionWithSignatures)\n) {\n if ('feePayer' in transaction && feePayer === transaction.feePayer) {\n return transaction;\n }\n const out = {\n ...getUnsignedTransaction(transaction),\n feePayer,\n };\n Object.freeze(out);\n return out;\n}\n","import { ITransactionWithSignatures } from './signatures';\nimport { BaseTransaction } from './types';\nimport { getUnsignedTransaction } from './unsigned-transaction';\n\nexport function appendTransactionInstruction<TTransaction extends BaseTransaction>(\n instruction: TTransaction['instructions'][number],\n transaction: TTransaction | (TTransaction & ITransactionWithSignatures)\n): TTransaction | Omit<TTransaction, keyof ITransactionWithSignatures> {\n const out = {\n ...getUnsignedTransaction(transaction),\n instructions: [...transaction.instructions, instruction],\n };\n Object.freeze(out);\n return out;\n}\n\nexport function prependTransactionInstruction<TTransaction extends BaseTransaction>(\n instruction: TTransaction['instructions'][number],\n transaction: TTransaction | (TTransaction & ITransactionWithSignatures)\n): TTransaction | Omit<TTransaction, keyof ITransactionWithSignatures> {\n const out = {\n ...getUnsignedTransaction(transaction),\n instructions: [instruction, ...transaction.instructions],\n };\n Object.freeze(out);\n return out;\n}\n","import { Codec, combineCodec, Decoder, Encoder, mapDecoder, mapEncoder } from '@solana/codecs-core';\nimport {\n getArrayDecoder,\n getArrayEncoder,\n getBytesDecoder,\n getBytesEncoder,\n getStructDecoder,\n getStructEncoder,\n} from '@solana/codecs-data-structures';\nimport { getShortU16Decoder, getShortU16Encoder } from '@solana/codecs-numbers';\nimport { Ed25519Signature } from '@solana/keys';\n\nimport { getCompiledTransaction } from '../compile-transaction';\nimport { decompileTransaction } from '../decompile-transaction';\nimport { compileMessage } from '../message';\nimport { ITransactionWithSignatures } from '../signatures';\nimport { getCompiledMessageDecoder, getCompiledMessageEncoder } from './message';\n\ntype CompilableTransaction = Parameters<typeof compileMessage>[0];\ntype CompiledTransaction = ReturnType<typeof getCompiledTransaction>;\n\nconst signaturesDescription = __DEV__ ? 'A compact array of 64-byte, base-64 encoded Ed25519 signatures' : 'signatures';\nconst transactionDescription = __DEV__ ? 'The wire format of a Solana transaction' : 'transaction';\n\nfunction getCompiledTransactionEncoder(): Encoder<CompiledTransaction> {\n return getStructEncoder(\n [\n [\n 'signatures',\n getArrayEncoder(getBytesEncoder({ size: 64 }), {\n description: signaturesDescription,\n size: getShortU16Encoder(),\n }),\n ],\n ['compiledMessage', getCompiledMessageEncoder()],\n ],\n {\n description: transactionDescription,\n }\n );\n}\n\nfunction getSignatureDecoder(): Decoder<Ed25519Signature> {\n return mapDecoder(getBytesDecoder({ size: 64 }), bytes => bytes as Ed25519Signature);\n}\n\nfunction getCompiledTransactionDecoder(): Decoder<CompiledTransaction> {\n return getStructDecoder(\n [\n [\n 'signatures',\n getArrayDecoder(getSignatureDecoder(), {\n description: signaturesDescription,\n size: getShortU16Decoder(),\n }),\n ],\n ['compiledMessage', getCompiledMessageDecoder()],\n ],\n {\n description: transactionDescription,\n }\n );\n}\n\nexport function getTransactionEncoder(): Encoder<\n CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)\n> {\n return mapEncoder(getCompiledTransactionEncoder(), getCompiledTransaction);\n}\n\nexport function getTransactionDecoder(\n lastValidBlockHeight?: bigint\n): Decoder<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)> {\n return mapDecoder(getCompiledTransactionDecoder(), compiledTransaction =>\n decompileTransaction(compiledTransaction, lastValidBlockHeight)\n );\n}\n\nexport function getTransactionCodec(\n lastValidBlockHeight?: bigint\n): Codec<CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)> {\n return combineCodec(getTransactionEncoder(), getTransactionDecoder(lastValidBlockHeight));\n}\n","import { Base58EncodedAddress, getAddressComparator } from '@solana/addresses';\nimport {\n AccountRole,\n IAccountLookupMeta,\n IAccountMeta,\n IInstruction,\n isSignerRole,\n isWritableRole,\n mergeRoles,\n ReadonlyAccount,\n ReadonlyAccountLookup,\n ReadonlySignerAccount,\n WritableAccount,\n WritableAccountLookup,\n WritableSignerAccount,\n} from '@solana/instructions';\n\nexport const enum AddressMapEntryType {\n FEE_PAYER,\n LOOKUP_TABLE,\n STATIC,\n}\n\ntype AddressMap = {\n [address: string]: FeePayerAccountEntry | LookupTableAccountEntry | StaticAccountEntry;\n};\ntype FeePayerAccountEntry = Omit<WritableSignerAccount, 'address'> & {\n [TYPE]: AddressMapEntryType.FEE_PAYER;\n};\ntype LookupTableAccountEntry = Omit<ReadonlyAccountLookup | WritableAccountLookup, 'address'> & {\n [TYPE]: AddressMapEntryType.LOOKUP_TABLE;\n};\nexport type OrderedAccounts = (IAccountMeta | IAccountLookupMeta)[] & { readonly __brand: unique symbol };\ntype StaticAccountEntry = Omit<\n ReadonlyAccount | ReadonlySignerAccount | WritableAccount | WritableSignerAccount,\n 'address'\n> & { [TYPE]: AddressMapEntryType.STATIC };\n\nfunction upsert(\n addressMap: AddressMap,\n address: Base58EncodedAddress,\n update: (\n entry: FeePayerAccountEntry | LookupTableAccountEntry | StaticAccountEntry | Record<never, never>\n ) => AddressMap[Base58EncodedAddress]\n) {\n addressMap[address] = update(addressMap[address] ?? { role: AccountRole.READONLY });\n}\n\nconst TYPE = Symbol('AddressMapTypeProperty');\nexport const ADDRESS_MAP_TYPE_PROPERTY: typeof TYPE = TYPE;\n\nexport function getAddressMapFromInstructions(\n feePayer: Base58EncodedAddress,\n instructions: readonly IInstruction[]\n): AddressMap {\n const addressMap: AddressMap = {\n [feePayer]: { [TYPE]: AddressMapEntryType.FEE_PAYER, role: AccountRole.WRITABLE_SIGNER },\n };\n const addressesOfInvokedPrograms = new Set<Base58EncodedAddress>();\n for (const instruction of instructions) {\n upsert(addressMap, instruction.programAddress, entry => {\n addressesOfInvokedPrograms.add(instruction.programAddress);\n if (TYPE in entry) {\n if (isWritableRole(entry.role)) {\n switch (entry[TYPE]) {\n case AddressMapEntryType.FEE_PAYER:\n // TODO: Coded error.\n throw new Error(\n 'This transaction includes an address ' +\n `(\\`${instruction.programAddress}\\`) which is both invoked ` +\n 'and set as the fee payer. Program addresses may not pay fees.'\n );\n default:\n // TODO: Coded error.\n throw new Error(\n 'This transaction includes an address ' +\n `(\\`${instruction.programAddress}\\`) which is both invoked ` +\n 'and marked writable. Program addresses may not be writable.'\n );\n }\n }\n if (entry[TYPE] === AddressMapEntryType.STATIC) {\n return entry;\n }\n }\n return { [TYPE]: AddressMapEntryType.STATIC, role: AccountRole.READONLY };\n });\n let addressComparator: ReturnType<typeof getAddressComparator>;\n if (!instruction.accounts) {\n continue;\n }\n for (const account of instruction.accounts) {\n upsert(addressMap, account.address, entry => {\n const {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n address: _,\n ...accountMeta\n } = account;\n if (TYPE in entry) {\n switch (entry[TYPE]) {\n case AddressMapEntryType.FEE_PAYER:\n // The fee payer already has the highest rank -- it is by definition\n // writable-signer. Return it, no matter how `account` is configured\n return entry as FeePayerAccountEntry;\n case AddressMapEntryType.LOOKUP_TABLE: {\n const nextRole = mergeRoles(entry.role, accountMeta.role);\n if ('lookupTableAddress' in accountMeta) {\n const shouldReplaceEntry =\n // Consider using the new LOOKUP_TABLE if its address is different...\n entry.lookupTableAddress !== accountMeta.lookupTableAddress &&\n // ...and sorts before the existing one.\n (addressComparator ||= getAddressComparator())(\n accountMeta.lookupTableAddress,\n entry.lookupTableAddress\n ) < 0;\n if (shouldReplaceEntry) {\n return {\n [TYPE]: AddressMapEntryType.LOOKUP_TABLE,\n ...accountMeta,\n role: nextRole,\n } as LookupTableAccountEntry;\n }\n } else if (isSignerRole(accountMeta.role)) {\n // Upgrade this LOOKUP_TABLE entry to a static entry if it must sign.\n return {\n [TYPE]: AddressMapEntryType.STATIC,\n role: nextRole,\n } as StaticAccountEntry;\n }\n if (entry.role !== nextRole) {\n return {\n ...entry,\n role: nextRole,\n } as LookupTableAccountEntry;\n } else {\n return entry as LookupTableAccountEntry;\n }\n }\n case AddressMapEntryType.STATIC: {\n const nextRole = mergeRoles(entry.role, accountMeta.role);\n if (\n // Check to see if this address represents a program that is invoked\n // in this transaction.\n addressesOfInvokedPrograms.has(account.address)\n ) {\n if (isWritableRole(accountMeta.role)) {\n // TODO: Coded error.\n throw new Error(\n 'This transaction includes an address ' +\n `(\\`${account.address}\\`) which is both invoked and ` +\n 'marked writable. Program addresses may not be ' +\n 'writable.'\n );\n }\n if (entry.role !== nextRole) {\n return {\n ...entry,\n role: nextRole,\n } as StaticAccountEntry;\n } else {\n return entry as StaticAccountEntry;\n }\n } else if (\n 'lookupTableAddress' in accountMeta &&\n // Static accounts can be 'upgraded' to lookup table accounts as\n // long as they are not require to sign the transaction.\n !isSignerRole(entry.role)\n ) {\n return {\n ...accountMeta,\n [TYPE]: AddressMapEntryType.LOOKUP_TABLE,\n role: nextRole,\n } as LookupTableAccountEntry;\n } else {\n if (entry.role !== nextRole) {\n // The account's role ranks higher than the current entry's.\n return {\n ...entry,\n role: nextRole,\n } as StaticAccountEntry;\n } else {\n return entry as StaticAccountEntry;\n }\n }\n }\n }\n }\n if ('lookupTableAddress' in accountMeta) {\n return {\n ...accountMeta,\n [TYPE]: AddressMapEntryType.LOOKUP_TABLE,\n };\n } else {\n return {\n ...accountMeta,\n [TYPE]: AddressMapEntryType.STATIC,\n };\n }\n });\n }\n }\n return addressMap;\n}\n\nexport function getOrderedAccountsFromAddressMap(addressMap: AddressMap): OrderedAccounts {\n let addressComparator: ReturnType<typeof getAddressComparator>;\n const orderedAccounts: (IAccountMeta | IAccountLookupMeta)[] = Object.entries(addressMap)\n .sort(([leftAddress, leftEntry], [rightAddress, rightEntry]) => {\n // STEP 1: Rapid precedence check. Fee payer, then static addresses, then lookups.\n if (leftEntry[TYPE] !== rightEntry[TYPE]) {\n if (leftEntry[TYPE] === AddressMapEntryType.FEE_PAYER) {\n return -1;\n } else if (rightEntry[TYPE] === AddressMapEntryType.FEE_PAYER) {\n return 1;\n } else if (leftEntry[TYPE] === AddressMapEntryType.STATIC) {\n return -1;\n } else if (rightEntry[TYPE] === AddressMapEntryType.STATIC) {\n return 1;\n }\n }\n // STEP 2: Sort by signer-writability.\n const leftIsSigner = isSignerRole(leftEntry.role);\n if (leftIsSigner !== isSignerRole(rightEntry.role)) {\n return leftIsSigner ? -1 : 1;\n }\n const leftIsWritable = isWritableRole(leftEntry.role);\n if (leftIsWritable !== isWritableRole(rightEntry.role)) {\n return leftIsWritable ? -1 : 1;\n }\n // STEP 3: Sort by address.\n addressComparator ||= getAddressComparator();\n if (\n leftEntry[TYPE] === AddressMapEntryType.LOOKUP_TABLE &&\n rightEntry[TYPE] === AddressMapEntryType.LOOKUP_TABLE &&\n leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress\n ) {\n return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);\n } else {\n return addressComparator(leftAddress, rightAddress);\n }\n })\n .map(([address, addressMeta]) => ({\n address: address as Base58EncodedAddress<typeof address>,\n ...addressMeta,\n }));\n return orderedAccounts as unknown as OrderedAccounts;\n}\n","import { Base58EncodedAddress, getAddressComparator } from '@solana/addresses';\nimport { AccountRole } from '@solana/instructions';\n\nimport { OrderedAccounts } from './accounts';\n\ntype AddressTableLookup = Readonly<{\n lookupTableAddress: Base58EncodedAddress;\n readableIndices: readonly number[];\n writableIndices: readonly number[];\n}>;\n\nexport function getCompiledAddressTableLookups(orderedAccounts: OrderedAccounts): AddressTableLookup[] {\n const index: Record<\n Base58EncodedAddress,\n { readonly readableIndices: number[]; readonly writableIndices: number[] }\n > = {};\n for (const account of orderedAccounts) {\n if (!('lookupTableAddress' in account)) {\n continue;\n }\n const entry = (index[account.lookupTableAddress] ||= {\n readableIndices: [],\n writableIndices: [],\n });\n if (account.role === AccountRole.WRITABLE) {\n entry.writableIndices.push(account.addressIndex);\n } else {\n entry.readableIndices.push(account.addressIndex);\n }\n }\n return Object.keys(index)\n .sort(getAddressComparator())\n .map(lookupTableAddress => ({\n lookupTableAddress: lookupTableAddress as Base58EncodedAddress,\n ...index[lookupTableAddress as unknown as Base58EncodedAddress],\n }));\n}\n","import { isSignerRole, isWritableRole } from '@solana/instructions';\n\nimport { OrderedAccounts } from './accounts';\n\ntype MessageHeader = Readonly<{\n numReadonlyNonSignerAccounts: number;\n numReadonlySignerAccounts: number;\n numSignerAccounts: number;\n}>;\n\nexport function getCompiledMessageHeader(orderedAccounts: OrderedAccounts): MessageHeader {\n let numReadonlyNonSignerAccounts = 0;\n let numReadonlySignerAccounts = 0;\n let numSignerAccounts = 0;\n for (const account of orderedAccounts) {\n if ('lookupTableAddress' in account) {\n break;\n }\n const accountIsWritable = isWritableRole(account.role);\n if (isSignerRole(account.role)) {\n numSignerAccounts++;\n if (!accountIsWritable) {\n numReadonlySignerAccounts++;\n }\n } else if (!accountIsWritable) {\n numReadonlyNonSignerAccounts++;\n }\n }\n return {\n numReadonlyNonSignerAccounts,\n numReadonlySignerAccounts,\n numSignerAccounts,\n };\n}\n","import { Base58EncodedAddress } from '@solana/addresses';\nimport { IInstruction } from '@solana/instructions';\n\nimport { OrderedAccounts } from './accounts';\n\ntype CompiledInstruction = Readonly<{\n accountIndices?: number[];\n data?: Uint8Array;\n programAddressIndex: number;\n}>;\n\nfunction getAccountIndex(orderedAccounts: OrderedAccounts) {\n const out: Record<Base58EncodedAddress, number> = {};\n for (const [index, account] of orderedAccounts.entries()) {\n out[account.address] = index;\n }\n return out;\n}\n\nexport function getCompiledInstructions(\n instructions: readonly IInstruction[],\n orderedAccounts: OrderedAccounts\n): CompiledInstruction[] {\n const accountIndex = getAccountIndex(orderedAccounts);\n return instructions.map(({ accounts, data, programAddress }) => {\n return {\n programAddressIndex: accountIndex[programAddress],\n ...(accounts ? { accountIndices: accounts.map(({ address }) => accountIndex[address]) } : null),\n ...(data ? { data } : null),\n };\n });\n}\n","import { IDurableNonceTransaction, ITransactionWithBlockhashLifetime } from './index';\n\nexport function getCompiledLifetimeToken(\n lifetimeConstraint: (ITransactionWithBlockhashLifetime | IDurableNonceTransaction)['lifetimeConstraint']\n): string {\n if ('nonce' in lifetimeConstraint) {\n return lifetimeConstraint.nonce;\n }\n return lifetimeConstraint.blockhash;\n}\n","import { Base58EncodedAddress } from '@solana/addresses';\n\nimport { OrderedAccounts } from './accounts';\n\nexport function getCompiledStaticAccounts(orderedAccounts: OrderedAccounts): Base58EncodedAddress[] {\n const firstLookupTableAccountIndex = orderedAccounts.findIndex(account => 'lookupTableAddress' in account);\n const orderedStaticAccounts =\n firstLookupTableAccountIndex === -1 ? orderedAccounts : orderedAccounts.slice(0, firstLookupTableAccountIndex);\n return orderedStaticAccounts.map(({ address }) => address);\n}\n","import { getAddressMapFromInstructions, getOrderedAccountsFromAddressMap } from './accounts';\nimport { ITransactionWithBlockhashLifetime } from './blockhash';\nimport { getCompiledAddressTableLookups } from './compile-address-table-lookups';\nimport { getCompiledMessageHeader } from './compile-header';\nimport { getCompiledInstructions } from './compile-instructions';\nimport { getCompiledLifetimeToken } from './compile-lifetime-token';\nimport { getCompiledStaticAccounts } from './compile-static-accounts';\nimport { IDurableNonceTransaction } from './durable-nonce';\nimport { ITransactionWithFeePayer } from './fee-payer';\nimport { BaseTransaction } from './types';\n\ntype BaseCompiledMessage = Readonly<{\n header: ReturnType<typeof getCompiledMessageHeader>;\n instructions: ReturnType<typeof getCompiledInstructions>;\n lifetimeToken: ReturnType<typeof getCompiledLifetimeToken>;\n staticAccounts: ReturnType<typeof getCompiledStaticAccounts>;\n}>;\n\ntype CompilableTransaction = BaseTransaction &\n ITransactionWithFeePayer &\n (ITransactionWithBlockhashLifetime | IDurableNonceTransaction);\n\nexport type CompiledMessage = LegacyCompiledMessage | VersionedCompiledMessage;\n\ntype LegacyCompiledMessage = BaseCompiledMessage &\n Readonly<{\n version: 'legacy';\n }>;\n\ntype VersionedCompiledMessage = BaseCompiledMessage &\n Readonly<{\n addressTableLookups?: ReturnType<typeof getCompiledAddressTableLookups>;\n version: number;\n }>;\n\nexport function compileMessage(\n transaction: CompilableTransaction & Readonly<{ version: 'legacy' }>\n): LegacyCompiledMessage;\nexport function compileMessage(transaction: CompilableTransaction): VersionedCompiledMessage;\nexport function compileMessage(transaction: CompilableTransaction): CompiledMessage {\n const addressMap = getAddressMapFromInstructions(transaction.feePayer, transaction.instructions);\n const orderedAccounts = getOrderedAccountsFromAddressMap(addressMap);\n return {\n ...(transaction.version !== 'legacy'\n ? { addressTableLookups: getCompiledAddressTableLookups(orderedAccounts) }\n : null),\n header: getCompiledMessageHeader(orderedAccounts),\n instructions: getCompiledInstructions(transaction.instructions, orderedAccounts),\n lifetimeToken: getCompiledLifetimeToken(transaction.lifetimeConstraint),\n staticAccounts: getCompiledStaticAccounts(orderedAccounts),\n version: transaction.version,\n };\n}\n","import { Ed25519Signature } from '@solana/keys';\n\nimport { CompiledMessage, compileMessage } from './message';\nimport { ITransactionWithSignatures } from './signatures';\n\ntype CompiledTransaction = Readonly<{\n compiledMessage: CompiledMessage;\n signatures: Ed25519Signature[];\n}>;\n\ntype CompilableTransaction = Parameters<typeof compileMessage>[0];\n\nexport function getCompiledTransaction(\n transaction: CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)\n): CompiledTransaction {\n const compiledMessage = compileMessage(transaction);\n let signatures;\n if ('signatures' in transaction) {\n signatures = [];\n for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {\n signatures[ii] =\n transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));\n }\n } else {\n signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));\n }\n return {\n compiledMessage,\n signatures,\n };\n}\n","import { assertIsAddress, Base58EncodedAddress } from '@solana/addresses';\nimport { pipe } from '@solana/functional';\nimport { AccountRole, IAccountMeta, IInstruction } from '@solana/instructions';\nimport { Ed25519Signature } from '@solana/keys';\n\nimport { Blockhash, setTransactionLifetimeUsingBlockhash } from './blockhash';\nimport { getCompiledTransaction } from './compile-transaction';\nimport { createTransaction } from './create-transaction';\nimport { isAdvanceNonceAccountInstruction, Nonce, setTransactionLifetimeUsingDurableNonce } from './durable-nonce';\nimport { setTransactionFeePayer } from './fee-payer';\nimport { appendTransactionInstruction } from './instructions';\nimport { CompiledMessage } from './message';\nimport { ITransactionWithSignatures } from './signatures';\nimport { TransactionVersion } from './types';\n\ntype CompiledTransaction = ReturnType<typeof getCompiledTransaction>;\ntype CompilableTransaction = Parameters<typeof getCompiledTransaction>[0];\n\nfunction getAccountMetas(message: CompiledMessage): IAccountMeta[] {\n const { header } = message;\n const numWritableSignerAccounts = header.numSignerAccounts - header.numReadonlySignerAccounts;\n const numWritableNonSignerAccounts =\n message.staticAccounts.length - header.numSignerAccounts - header.numReadonlyNonSignerAccounts;\n\n const accountMetas: IAccountMeta[] = [];\n\n let accountIndex = 0;\n for (let i = 0; i < numWritableSignerAccounts; i++) {\n accountMetas.push({\n address: message.staticAccounts[accountIndex],\n role: AccountRole.WRITABLE_SIGNER,\n });\n accountIndex++;\n }\n\n for (let i = 0; i < header.numReadonlySignerAccounts; i++) {\n accountMetas.push({\n address: message.staticAccounts[accountIndex],\n role: AccountRole.READONLY_SIGNER,\n });\n accountIndex++;\n }\n\n for (let i = 0; i < numWritableNonSignerAccounts; i++) {\n accountMetas.push({\n address: message.staticAccounts[accountIndex],\n role: AccountRole.WRITABLE,\n });\n accountIndex++;\n }\n\n for (let i = 0; i < header.numReadonlyNonSignerAccounts; i++) {\n accountMetas.push({\n address: message.staticAccounts[accountIndex],\n role: AccountRole.READONLY,\n });\n accountIndex++;\n }\n\n return accountMetas;\n}\n\nfunction convertInstruction(\n instruction: CompiledMessage['instructions'][0],\n accountMetas: IAccountMeta[]\n): IInstruction {\n const programAddress = accountMetas[instruction.programAddressIndex]?.address;\n if (!programAddress) {\n // TODO coded error\n throw new Error(`Could not find program address at index ${instruction.programAddressIndex}`);\n }\n\n const accounts = instruction.accountIndices?.map(accountIndex => accountMetas[accountIndex]);\n const { data } = instruction;\n\n return {\n programAddress,\n ...(accounts && accounts.length ? { accounts } : {}),\n ...(data && data.length ? { data } : {}),\n };\n}\n\ntype LifetimeConstraint =\n | {\n blockhash: Blockhash;\n lastValidBlockHeight: bigint;\n }\n | {\n nonce: Nonce;\n nonceAccountAddress: Base58EncodedAddress;\n nonceAuthorityAddress: Base58EncodedAddress;\n };\n\nfunction getLifetimeConstraint(\n messageLifetimeToken: string,\n firstInstruction?: IInstruction,\n lastValidBlockHeight?: bigint\n): LifetimeConstraint {\n if (!firstInstruction || !isAdvanceNonceAccountInstruction(firstInstruction)) {\n // first instruction is not advance durable nonce, so use blockhash lifetime constraint\n return {\n blockhash: messageLifetimeToken as Blockhash,\n lastValidBlockHeight: lastValidBlockHeight ?? 2n ** 64n - 1n, // U64 MAX\n };\n } else {\n // We know these accounts are defined because we checked `isAdvanceNonceAccountInstruction`\n const nonceAccountAddress = firstInstruction.accounts![0].address;\n assertIsAddress(nonceAccountAddress);\n\n const nonceAuthorityAddress = firstInstruction.accounts![2].address;\n assertIsAddress(nonceAuthorityAddress);\n\n return {\n nonce: messageLifetimeToken as Nonce,\n nonceAccountAddress,\n nonceAuthorityAddress,\n };\n }\n}\n\nfunction convertSignatures(compiledTransaction: CompiledTransaction): ITransactionWithSignatures['signatures'] {\n const {\n compiledMessage: { staticAccounts },\n signatures,\n } = compiledTransaction;\n return signatures.reduce((acc, sig, index) => {\n // compiled transaction includes a fake all 0 signature if it hasn't been signed\n // we don't store those for the new tx model. So just skip if it's all 0s\n const allZeros = sig.every(byte => byte === 0);\n if (allZeros) return acc;\n\n const address = staticAccounts[index];\n return { ...acc, [address]: sig as Ed25519Signature };\n }, {});\n}\n\nexport function decompileTransaction(\n compiledTransaction: CompiledTransaction,\n lastValidBlockHeight?: bigint\n): CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures) {\n const { compiledMessage } = compiledTransaction;\n\n // TODO: add support for address lookup tables\n if ('addressTableLookups' in compiledMessage && compiledMessage.addressTableLookups!.length > 0) {\n // TODO: coded error\n throw new Error('Cannot convert transaction with addressTableLookups');\n }\n\n const feePayer = compiledMessage.staticAccounts[0];\n // TODO: coded error\n if (!feePayer) throw new Error('No fee payer set in CompiledTransaction');\n\n const accountMetas = getAccountMetas(compiledMessage);\n\n const instructions: IInstruction[] = compiledMessage.instructions.map(compiledInstruction =>\n convertInstruction(compiledInstruction, accountMetas)\n );\n\n const firstInstruction = instructions[0];\n const lifetimeConstraint = getLifetimeConstraint(\n compiledMessage.lifetimeToken,\n firstInstruction,\n lastValidBlockHeight\n );\n\n const signatures = convertSignatures(compiledTransaction);\n\n return pipe(\n createTransaction({ version: compiledMessage.version as TransactionVersion }),\n tx => setTransactionFeePayer(feePayer, tx),\n tx =>\n instructions.reduce((acc, instruction) => {\n return appendTransactionInstruction(instruction, acc);\n }, tx),\n tx =>\n 'blockhash' in lifetimeConstraint\n ? setTransactionLifetimeUsingBlockhash(lifetimeConstraint, tx)\n : setTransactionLifetimeUsingDurableNonce(lifetimeConstraint, tx),\n tx => (compiledTransaction.signatures.length ? { ...tx, signatures } : tx)\n );\n}\n","import { getAddressDecoder, getAddressEncoder } from '@solana/addresses';\nimport { Codec, combineCodec, Decoder, Encoder, mapDecoder, mapEncoder } from '@solana/codecs-core';\nimport {\n getArrayDecoder,\n getArrayEncoder,\n getStructDecoder,\n getStructEncoder,\n StructToDecoderTuple,\n StructToEncoderTuple,\n} from '@solana/codecs-data-structures';\nimport { getShortU16Decoder, getShortU16Encoder } from '@solana/codecs-numbers';\nimport { getBase58Decoder, getBase58Encoder, getStringDecoder, getStringEncoder } from '@solana/codecs-strings';\n\nimport { getCompiledAddressTableLookups } from '../compile-address-table-lookups';\nimport { CompiledMessage } from '../message';\nimport { SerializedMessageBytes } from '../types';\nimport { getAddressTableLookupDecoder, getAddressTableLookupEncoder } from './address-table-lookup';\nimport { getMessageHeaderDecoder, getMessageHeaderEncoder } from './header';\nimport { getInstructionDecoder, getInstructionEncoder } from './instruction';\nimport { getTransactionVersionDecoder, getTransactionVersionEncoder } from './transaction-version';\n\nconst staticAccountsDescription = __DEV__\n ? 'A compact-array of static account addresses belonging to this transaction'\n : 'staticAccounts';\nconst lifetimeTokenDescription = __DEV__\n ? 'A 32-byte token that specifies the lifetime of this transaction (eg. a ' +\n 'recent blockhash, or a durable nonce)'\n : 'lifetimeToken';\nconst instructionsDescription = __DEV__\n ? 'A compact-array of instructions belonging to this transaction'\n : 'instructions';\nconst addressTableLookupsDescription = __DEV__\n ? 'A compact array of address table lookups belonging to this transaction'\n : 'addressTableLookups';\n\nfunction getCompiledMessageLegacyEncoder(): Encoder<CompiledMessage> {\n return getStructEncoder(getPreludeStructEncoderTuple());\n}\n\nfunction getCompiledMessageVersionedEncoder(): Encoder<CompiledMessage> {\n return mapEncoder(\n getStructEncoder([\n ...getPreludeStructEncoderTuple(),\n ['addressTableLookups', getAddressTableLookupArrayEncoder()],\n ] as StructToEncoderTuple<CompiledMessage>),\n (value: CompiledMessage) => {\n if (value.version === 'legacy') {\n return value;\n }\n return {\n ...value,\n addressTableLookups: value.addressTableLookups ?? [],\n } as Exclude<CompiledMessage, { readonly version: 'legacy' }>;\n }\n );\n}\n\nfunction getPreludeStructEncoderTuple(): StructToEncoderTuple<CompiledMessage> {\n return [\n ['version', getTransactionVersionEncoder()],\n ['header', getMessageHeaderEncoder()],\n [\n 'staticAccounts',\n getArrayEncoder(getAddressEncoder(), {\n description: staticAccountsDescription,\n size: getShortU16Encoder(),\n }),\n ],\n [\n 'lifetimeToken',\n getStringEncoder({\n description: lifetimeTokenDescription,\n encoding: getBase58Encoder(),\n size: 32,\n }),\n ],\n [\n 'instructions',\n getArrayEncoder(getInstructionEncoder(), {\n description: instructionsDescription,\n size: getShortU16Encoder(),\n }),\n ],\n ];\n}\n\nfunction getPreludeStructDecoderTuple(): StructToDecoderTuple<\n CompiledMessage & { addressTableLookups?: ReturnType<typeof getCompiledAddressTableLookups> }\n> {\n return [\n ['version', getTransactionVersionDecoder() as Decoder<number>],\n ['header', getMessageHeaderDecoder()],\n [\n 'staticAccounts',\n getArrayDecoder(getAddressDecoder(), {\n description: staticAccountsDescription,\n size: getShortU16Decoder(),\n }),\n ],\n [\n 'lifetimeToken',\n getStringDecoder({\n description: lifetimeTokenDescription,\n encoding: getBase58Decoder(),\n size: 32,\n }),\n ],\n [\n 'instructions',\n getArrayDecoder(getInstructionDecoder(), {\n description: instructionsDescription,\n size: getShortU16Decoder(),\n }),\n ],\n ['addressTableLookups', getAddressTableLookupArrayDecoder()],\n ];\n}\n\nfunction getAddressTableLookupArrayEncoder() {\n return getArrayEncoder(getAddressTableLookupEncoder(), {\n description: addressTableLookupsDescription,\n size: getShortU16Encoder(),\n });\n}\n\nfunction getAddressTableLookupArrayDecoder() {\n return getArrayDecoder(getAddressTableLookupDecoder(), {\n description: addressTableLookupsDescription,\n size: getShortU16Decoder(),\n });\n}\n\nconst messageDescription = __DEV__ ? 'The wire format of a Solana transaction message' : 'message';\n\nexport function getCompiledMessageEncoder(): Encoder<CompiledMessage> {\n return {\n description: messageDescription,\n encode: compiledMessage => {\n if (compiledMessage.version === 'legacy') {\n return getCompiledMessageLegacyEncoder().encode(compiledMessage) as SerializedMessageBytes;\n } else {\n return getCompiledMessageVersionedEncoder().encode(compiledMessage) as SerializedMessageBytes;\n }\n },\n fixedSize: null,\n maxSize: null,\n };\n}\n\nexport function getCompiledMessageDecoder(): Decoder<CompiledMessage> {\n return mapDecoder(\n getStructDecoder(getPreludeStructDecoderTuple(), {\n description: messageDescription,\n }),\n ({ addressTableLookups, ...restOfMessage }) => {\n if (restOfMessage.version === 'legacy' || !addressTableLookups?.length) {\n return restOfMessage;\n }\n return { ...restOfMessage, addressTableLookups } as Exclude<\n CompiledMessage,\n { readonly version: 'legacy' }\n >;\n }\n );\n}\n\nexport function getCompiledMessageCodec(): Codec<CompiledMessage> {\n return combineCodec(getCompiledMessageEncoder(), getCompiledMessageDecoder());\n}\n","import { getAddressDecoder, getAddressEncoder } from '@solana/addresses';\nimport { type Codec, combineCodec, type Decoder, type Encoder } from '@solana/codecs-core';\nimport { getArrayDecoder, getArrayEncoder, getStructDecoder, getStructEncoder } from '@solana/codecs-data-structures';\nimport { getShortU16Decoder, getShortU16Encoder, getU8Decoder, getU8Encoder } from '@solana/codecs-numbers';\n\nimport type { getCompiledAddressTableLookups } from '../compile-address-table-lookups';\n\ntype AddressTableLookup = ReturnType<typeof getCompiledAddressTableLookups>[number];\n\nconst lookupTableAddressDescription = __DEV__\n ? 'The address of the address lookup table account from which instruction addresses should be looked up'\n : 'lookupTableAddress';\n\nconst writableIndicesDescription = __DEV__\n ? 'The indices of the accounts in the lookup table that should be loaded as writeable'\n : 'writableIndices';\n\nconst readableIndicesDescription = __DEV__\n ? 'The indices of the accounts in the lookup table that should be loaded as read-only'\n : 'readableIndices';\n\nconst addressTableLookupDescription = __DEV__\n ? 'A pointer to the address of an address lookup table, along with the ' +\n 'readonly/writeable indices of the addresses that should be loaded from it'\n : 'addressTableLookup';\n\nlet memoizedAddressTableLookupEncoder: Encoder<AddressTableLookup> | undefined;\nexport function getAddressTableLookupEncoder(): Encoder<AddressTableLookup> {\n if (!memoizedAddressTableLookupEncoder) {\n memoizedAddressTableLookupEncoder = getStructEncoder(\n [\n ['lookupTableAddress', getAddressEncoder({ description: lookupTableAddressDescription })],\n [\n 'writableIndices',\n getArrayEncoder(getU8Encoder(), {\n description: writableIndicesDescription,\n size: getShortU16Encoder(),\n }) as Encoder<readonly number[]>,\n ],\n [\n 'readableIndices',\n getArrayEncoder(getU8Encoder(), {\n description: readableIndicesDescription,\n size: getShortU16Encoder(),\n }) as Encoder<readonly number[]>,\n ],\n ],\n { description: addressTableLookupDescription }\n );\n }\n\n return memoizedAddressTableLookupEncoder;\n}\n\nlet memoizedAddressTableLookupDecoder: Decoder<AddressTableLookup> | undefined;\nexport function getAddressTableLookupDecoder(): Decoder<AddressTableLookup> {\n if (!memoizedAddressTableLookupDecoder) {\n memoizedAddressTableLookupDecoder = getStructDecoder(\n [\n ['lookupTableAddress', getAddressDecoder({ description: lookupTableAddressDescription })],\n [\n 'writableIndices',\n getArrayDecoder(getU8Decoder(), {\n description: writableIndicesDescription,\n size: getShortU16Decoder(),\n }),\n ],\n [\n 'readableIndices',\n getArrayDecoder(getU8Decoder(), {\n description: readableIndicesDescription,\n size: getShortU16Decoder(),\n }),\n ],\n ],\n { description: addressTableLookupDescription }\n );\n }\n\n return memoizedAddressTableLookupDecoder;\n}\n\nexport function getAddressTableLookupCodec(): Codec<AddressTableLookup> {\n return combineCodec(getAddressTableLookupEncoder(), getAddressTableLookupDecoder());\n}\n","import { Codec, Decoder, Encoder } from '@solana/codecs-core';\nimport { getStructCodec, getStructDecoder, getStructEncoder } from '@solana/codecs-data-structures';\nimport { getU8Codec, getU8Decoder, getU8Encoder } from '@solana/codecs-numbers';\n\nimport { getCompiledMessageHeader } from '../compile-header';\n\ntype MessageHeader = ReturnType<typeof getCompiledMessageHeader>;\n\nlet memoizedU8Encoder: Encoder<number> | undefined;\nfunction getMemoizedU8Encoder(): Encoder<number> {\n if (!memoizedU8Encoder) memoizedU8Encoder = getU8Encoder();\n return memoizedU8Encoder;\n}\n\nfunction getMemoizedU8EncoderDescription(description?: string): Encoder<number> {\n const encoder = getMemoizedU8Encoder();\n return {\n ...encoder,\n description: description ?? encoder.description,\n };\n}\n\nlet memoizedU8Decoder: Decoder<number> | undefined;\nfunction getMemoizedU8Decoder(): Decoder<number> {\n if (!memoizedU8Decoder) memoizedU8Decoder = getU8Decoder();\n return memoizedU8Decoder;\n}\n\nfunction getMemoizedU8DecoderDescription(description?: string): Decoder<number> {\n const decoder = getMemoizedU8Decoder();\n return {\n ...decoder,\n description: description ?? decoder.description,\n };\n}\n\nlet memoizedU8Codec: Codec<number> | undefined;\nfunction getMemoizedU8Codec(): Codec<number> {\n if (!memoizedU8Codec) memoizedU8Codec = getU8Codec();\n return memoizedU8Codec;\n}\n\nfunction getMemoizedU8CodecDescription(description?: string): Codec<number> {\n const codec = getMemoizedU8Codec();\n return {\n ...codec,\n description: description ?? codec.description,\n };\n}\n\nconst numSignerAccountsDescription = __DEV__\n ? 'The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction'\n : undefined;\n\nconst numReadonlySignerAccountsDescription = __DEV__\n ? 'The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction, but may not be writable'\n : undefined;\n\nconst numReadonlyNonSignerAccountsDescription = __DEV__\n ? 'The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable'\n : undefined;\n\nconst messageHeaderDescription = __DEV__\n ? 'The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses'\n : undefined;\n\nexport function getMessageHeaderEncoder(): Encoder<MessageHeader> {\n return getStructEncoder(\n [\n ['numSignerAccounts', getMemoizedU8EncoderDescription(numSignerAccountsDescription)],\n ['numReadonlySignerAccounts', getMemoizedU8EncoderDescription(numReadonlySignerAccountsDescription)],\n ['numReadonlyNonSignerAccounts', getMemoizedU8EncoderDescription(numReadonlyNonSignerAccountsDescription)],\n ],\n {\n description: messageHeaderDescription,\n }\n );\n}\n\nexport function getMessageHeaderDecoder(): Decoder<MessageHeader> {\n return getStructDecoder(\n [\n ['numSignerAccounts', getMemoizedU8DecoderDescription(numSignerAccountsDescription)],\n ['numReadonlySignerAccounts', getMemoizedU8DecoderDescription(numReadonlySignerAccountsDescription)],\n ['numReadonlyNonSignerAccounts', getMemoizedU8DecoderDescription(numReadonlyNonSignerAccountsDescription)],\n ],\n {\n description: messageHeaderDescription,\n }\n );\n}\n\nexport function getMessageHeaderCodec(): Codec<MessageHeader> {\n return getStructCodec(\n [\n ['numSignerAccounts', getMemoizedU8CodecDescription(numSignerAccountsDescription)],\n ['numReadonlySignerAccounts', getMemoizedU8CodecDescription(numReadonlySignerAccountsDescription)],\n ['numReadonlyNonSignerAccounts', getMemoizedU8CodecDescription(numReadonlyNonSignerAccountsDescription)],\n ],\n {\n description: messageHeaderDescription,\n }\n );\n}\n","import { Codec, combineCodec, Decoder, Encoder, mapDecoder, mapEncoder } from '@solana/codecs-core';\nimport {\n getArrayDecoder,\n getArrayEncoder,\n getBytesDecoder,\n getBytesEncoder,\n getStructDecoder,\n getStructEncoder,\n} from '@solana/codecs-data-structures';\nimport { getShortU16Decoder, getShortU16Encoder, getU8Decoder, getU8Encoder } from '@solana/codecs-numbers';\n\nimport { getCompiledInstructions } from '../compile-instructions';\n\ntype Instruction = ReturnType<typeof getCompiledInstructions>[number];\n\nconst programAddressIndexDescription = __DEV__\n ? 'The index of the program being called, according to the well-ordered accounts list for this transaction'\n : 'programAddressIndex';\n\nconst accountIndexDescription = __DEV__\n ? 'The index of an account, according to the well-ordered accounts list for this transaction'\n : undefined;\n\nconst accountIndicesDescription = __DEV__\n ? 'An optional list of account indices, according to the ' +\n 'well-ordered accounts list for this transaction, in the order in ' +\n 'which the program being called expects them'\n : 'accountIndices';\n\nconst dataDescription = __DEV__ ? 'An optional buffer of data passed to the instruction' : 'data';\n\nlet memoizedGetInstructionEncoder: Encoder<Instruction> | undefined;\nexport function getInstructionEncoder(): Encoder<Instruction> {\n if (!memoizedGetInstructionEncoder) {\n memoizedGetInstructionEncoder = mapEncoder<Required<Instruction>, Instruction>(\n getStructEncoder([\n ['programAddressIndex', getU8Encoder({ description: programAddressIndexDescription })],\n [\n 'accountIndices',\n getArrayEncoder(getU8Encoder({ description: accountIndexDescription }), {\n description: accountIndicesDescription,\n size: getShortU16Encoder(),\n }),\n ],\n ['data', getBytesEncoder({ description: dataDescription, size: getShortU16Encoder() })],\n ]),\n // Convert an instruction to have all fields defined\n (instruction: Instruction): Required<Instruction> => {\n if (instruction.accountIndices !== undefined && instruction.data !== undefined) {\n return instruction as Required<Instruction>;\n }\n return {\n ...instruction,\n accountIndices: instruction.accountIndices ?? [],\n data: instruction.data ?? new Uint8Array(0),\n } as Required<Instruction>;\n }\n );\n }\n\n return memoizedGetInstructionEncoder;\n}\n\nlet memoizedGetInstructionDecoder: Decoder<Instruction> | undefined;\nexport function getInstructionDecoder(): Decoder<Instruction> {\n if (!memoizedGetInstructionDecoder) {\n memoizedGetInstructionDecoder = mapDecoder<Required<Instruction>, Instruction>(\n getStructDecoder([\n ['programAddressIndex', getU8Decoder({ description: programAddressIndexDescription })],\n [\n 'accountIndices',\n getArrayDecoder(getU8Decoder({ description: accountIndexDescription }), {\n description: accountIndicesDescription,\n size: getShortU16Decoder(),\n }),\n ],\n ['data', getBytesDecoder({ description: dataDescription, size: getShortU16Decoder() })],\n ]),\n // Convert an instruction to exclude optional fields if they are empty\n (instruction: Required<Instruction>): Instruction => {\n if (instruction.accountIndices.length && instruction.data.byteLength) {\n return instruction;\n }\n const { accountIndices, data, ...rest } = instruction;\n return {\n ...rest,\n ...(accountIndices.length ? { accountIndices } : null),\n ...(data.byteLength ? { data } : null),\n };\n }\n );\n }\n return memoizedGetInstructionDecoder;\n}\n\nexport function getInstructionCodec(): Codec<Instruction> {\n return combineCodec(getInstructionEncoder(), getInstructionDecoder());\n}\n","import { Codec, combineCodec, Decoder, Encoder } from '@solana/codecs-core';\n\nimport { TransactionVersion } from '../types';\n\nconst VERSION_FLAG_MASK = 0x80;\n\nconst BASE_CONFIG = {\n description: __DEV__ ? 'A single byte that encodes the version of the transaction' : '',\n fixedSize: null,\n maxSize: 1,\n} as const;\n\nfunction decode(bytes: Uint8Array, offset = 0): [TransactionVersion, number] {\n const firstByte = bytes[offset];\n if ((firstByte & VERSION_FLAG_MASK) === 0) {\n // No version flag set; it's a legacy (unversioned) transaction.\n return ['legacy', offset];\n } else {\n const version = (firstByte ^ VERSION_FLAG_MASK) as TransactionVersion;\n return [version, offset + 1];\n }\n}\n\nfunction encode(value: TransactionVersion): Uint8Array {\n if (value === 'legacy') {\n return new Uint8Array();\n }\n if (value < 0 || value > 127) {\n // TODO: Coded error.\n throw new Error(`Transaction version must be in the range [0, 127]. \\`${value}\\` given.`);\n }\n return new Uint8Array([value | VERSION_FLAG_MASK]);\n}\n\nexport function getTransactionVersionDecoder(): Decoder<TransactionVersion> {\n return {\n ...BASE_CONFIG,\n decode,\n };\n}\n\nexport function getTransactionVersionEncoder(): Encoder<TransactionVersion> {\n return {\n ...BASE_CONFIG,\n encode,\n };\n}\n\nexport function getTransactionVersionCodec(): Codec<TransactionVersion> {\n return combineCodec(getTransactionVersionEncoder(), getTransactionVersionDecoder());\n}\n","import { Base58EncodedAddress, getAddressFromPublicKey } from '@solana/addresses';\nimport { Decoder, Encoder } from '@solana/codecs-core';\nimport { getBase58Decoder, getBase58Encoder } from '@solana/codecs-strings';\nimport { isSignerRole } from '@solana/instructions';\nimport { Ed25519Signature, signBytes } from '@solana/keys';\n\nimport { ITransactionWithFeePayer } from './fee-payer';\nimport { compileMessage } from './message';\nimport { getCompiledMessageEncoder } from './serializers/message';\n\nexport interface IFullySignedTransaction extends ITransactionWithSignatures {\n readonly __brand: unique symbol;\n}\nexport interface ITransactionWithSignatures {\n readonly signatures: Readonly<Record<Base58EncodedAddress, Ed25519Signature>>;\n}\n\nexport type TransactionSignature = string & { readonly __brand: unique symbol };\n\nlet base58Encoder: Encoder<string> | undefined;\nlet base58Decoder: Decoder<string> | undefined;\n\nexport function assertIsTransactionSignature(\n putativeTransactionSignature: string\n): asserts putativeTransactionSignature is TransactionSignature {\n if (!base58Encoder) base58Encoder = getBase58Encoder();\n\n try {\n // Fast-path; see if the input string is of an acceptable length.\n if (\n // Lowest value (64 bytes of zeroes)\n putativeTransactionSignature.length < 64 ||\n // Highest value (64 bytes of 255)\n putativeTransactionSignature.length > 88\n ) {\n throw new Error('Expected input string to decode to a byte array of length 64.');\n }\n // Slow-path; actually attempt to decode the input string.\n const bytes = base58Encoder.encode(putativeTransactionSignature);\n const numBytes = bytes.byteLength;\n if (numBytes !== 64) {\n throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);\n }\n } catch (e) {\n throw new Error(`\\`${putativeTransactionSignature}\\` is not a transaction signature`, {\n cause: e,\n });\n }\n}\n\nexport function isTransactionSignature(\n putativeTransactionSignature: string\n): putativeTransactionSignature is TransactionSignature {\n if (!base58Encoder) base58Encoder = getBase58Encoder();\n\n // Fast-path; see if the input string is of an acceptable length.\n if (\n // Lowest value (64 bytes of zeroes)\n putativeTransactionSignature.length < 64 ||\n // Highest value (64 bytes of 255)\n putativeTransactionSignature.length > 88\n ) {\n return false;\n }\n // Slow-path; actually attempt to decode the input string.\n const bytes = base58Encoder.encode(putativeTransactionSignature);\n const numBytes = bytes.byteLength;\n if (numBytes !== 64) {\n return false;\n }\n return true;\n}\n\nexport function getSignatureFromTransaction(\n transaction: ITransactionWithFeePayer & ITransactionWithSignatures\n): TransactionSignature {\n if (!base58Decoder) base58Decoder = getBase58Decoder();\n\n const signatureBytes = transaction.signatures[transaction.feePayer];\n if (!signatureBytes) {\n // TODO: Coded error.\n throw new Error(\n \"Could not determine this transaction's signature. Make sure that the transaction \" +\n 'has been signed by its fee payer.'\n );\n }\n const transactionSignature = base58Decoder.decode(signatureBytes)[0];\n return transactionSignature as TransactionSignature;\n}\n\nexport async function signTransaction<TTransaction extends Parameters<typeof compileMessage>[0]>(\n keyPairs: CryptoKeyPair[],\n transaction: TTransaction | (TTransaction & ITransactionWithSignatures)\n): Promise<TTransaction & ITransactionWithSignatures> {\n const compiledMessage = compileMessage(transaction);\n const nextSignatures: Record<Base58EncodedAddress, Ed25519Signature> =\n 'signatures' in transaction ? { ...transaction.signatures } : {};\n const wireMessageBytes = getCompiledMessageEncoder().encode(compiledMessage);\n const publicKeySignaturePairs = await Promise.all(\n keyPairs.map(keyPair =>\n Promise.all([getAddressFromPublicKey(keyPair.publicKey), signBytes(keyPair.privateKey, wireMessageBytes)])\n )\n );\n for (const [signerPublicKey, signature] of publicKeySignaturePairs) {\n nextSignatures[signerPublicKey] = signature;\n }\n const out = {\n ...transaction,\n signatures: nextSignatures,\n };\n Object.freeze(out);\n return out;\n}\n\nexport function transactionSignature(putativeTransactionSignature: string): TransactionSignature {\n assertIsTransactionSignature(putativeTransactionSignature);\n return putativeTransactionSignature;\n}\n\nexport function assertTransactionIsFullySigned<TTransaction extends Parameters<typeof compileMessage>[0]>(\n transaction: TTransaction & ITransactionWithSignatures\n): asserts transaction is TTransaction & IFullySignedTransaction {\n const signerAddressesFromInstructions = transaction.instructions\n .flatMap(i => i.accounts?.filter(a => isSignerRole(a.role)) ?? [])\n .map(a => a.address);\n const requiredSigners = new Set([transaction.feePayer, ...signerAddressesFromInstructions]);\n\n requiredSigners.forEach(address => {\n if (!transaction.signatures[address]) {\n // TODO coded error\n throw new Error(`Transaction is missing signature for address \\`${address}\\``);\n }\n });\n}\n","import { getTransactionEncoder } from './serializers/transaction';\n\nexport type Base64EncodedWireTransaction = string & {\n readonly __brand: unique symbol;\n};\n\nexport function getBase64EncodedWireTransaction(\n transaction: Parameters<ReturnType<typeof getTransactionEncoder>['encode']>[0]\n): Base64EncodedWireTransaction {\n const wireTransactionBytes = getTransactionEncoder().encode(transaction);\n if (__NODEJS__) {\n return Buffer.from(wireTransactionBytes).toString('base64') as Base64EncodedWireTransaction;\n } else {\n return (btoa as Window['btoa'])(String.fromCharCode(...wireTransactionBytes)) as Base64EncodedWireTransaction;\n }\n}\n"]}
@@ -0,0 +1,29 @@
1
+ this.globalThis = this.globalThis || {};
2
+ this.globalThis.solanaWeb3 = (function (exports) {
3
+ 'use strict';
4
+
5
+ function N(e,n,r=0){if(n.length-r<=0)throw new Error(`Codec [${e}] cannot decode empty byte arrays.`)}function w(e,n,r,t=0){let o=r.length-t;if(o<n)throw new Error(`Codec [${e}] expected ${n} bytes, got ${o}.`)}var k=e=>{let n=e.filter(i=>i.length);if(n.length===0)return e.length?e[0]:new Uint8Array;if(n.length===1)return n[0];let r=n.reduce((i,s)=>i+s.length,0),t=new Uint8Array(r),o=0;return n.forEach(i=>{t.set(i,o),o+=i.length;}),t},Bn=(e,n)=>{if(e.length>=n)return e;let r=new Uint8Array(n).fill(0);return r.set(e),r},Z=(e,n)=>Bn(e.length<=n?e:e.slice(0,n),n);function z(e,n,r){if(e.fixedSize!==n.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${e.fixedSize}] and [${n.fixedSize}].`);if(e.maxSize!==n.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${e.maxSize}] and [${n.maxSize}].`);if(r===void 0&&e.description!==n.description)throw new Error(`Encoder and decoder must have the same description, got [${e.description}] and [${n.description}]. Pass a custom description as a third argument if you want to override the description and bypass this error.`);return {decode:n.decode,description:r??e.description,encode:e.encode,fixedSize:e.fixedSize,maxSize:e.maxSize}}function ge(e,n,r){return {description:r??`fixed(${n}, ${e.description})`,fixedSize:n,maxSize:n}}function U(e,n,r){return {...ge(e,n,r),encode:t=>Z(e.encode(t),n)}}function O(e,n,r){return {...ge(e,n,r),decode:(t,o=0)=>{w("fixCodec",n,t,o),(o>0||t.length>n)&&(t=t.slice(o,o+n)),e.fixedSize!==null&&(t=Z(t,e.fixedSize));let[i]=e.decode(t,0);return [i,o+n]}}}function B(e,n){return {description:e.description,encode:r=>e.encode(n(r)),fixedSize:e.fixedSize,maxSize:e.maxSize}}function D(e,n){return {decode:(r,t=0)=>{let[o,i]=e.decode(r,t);return [n(o,r,t),i]},description:e.description,fixedSize:e.fixedSize,maxSize:e.maxSize}}function pe(e,n,r,t){if(t<n||t>r)throw new Error(`Codec [${e}] expected number to be in the range [${n}, ${r}], got ${t}.`)}function me(e){let n,r=e.name;return e.size>1&&(n=!("endian"in e.options)||e.options.endian===0,r+=n?"(le)":"(be)"),{description:e.options.description??r,fixedSize:e.size,littleEndian:n,maxSize:e.size}}function Te(e){let n=me(e);return {description:n.description,encode(r){e.range&&pe(e.name,e.range[0],e.range[1],r);let t=new ArrayBuffer(e.size);return e.set(new DataView(t),r,n.littleEndian),new Uint8Array(t)},fixedSize:n.fixedSize,maxSize:n.maxSize}}function ye(e){let n=me(e);return {decode(r,t=0){N(n.description,r,t),w(n.description,e.size,r,t);let o=new DataView(wn(r,t,e.size));return [e.get(o,n.littleEndian),t+e.size]},description:n.description,fixedSize:n.fixedSize,maxSize:n.maxSize}}function wn(e,n,r){let t=e.byteOffset+(n??0),o=r??e.byteLength;return e.buffer.slice(t,t+o)}var m=(e={})=>({description:e.description??"shortU16",encode:n=>{pe("shortU16",0,65535,n);let r=[0];for(let t=0;;t+=1){let o=n>>t*7;if(o===0)break;let i=127&o;r[t]=i,t>0&&(r[t-1]|=128);}return new Uint8Array(r)},fixedSize:null,maxSize:3}),T=(e={})=>({decode:(n,r=0)=>{let t=0,o=0;for(;++o;){let i=o-1,s=n[r+i],c=127&s;if(t|=c<<i*7,!(s&128))break}return [t,r+o]},description:e.description??"shortU16",fixedSize:null,maxSize:3});var P=(e={})=>Te({name:"u32",options:e,range:[0,+"0xffffffff"],set:(n,r,t)=>n.setUint32(0,r,t),size:4}),W=(e={})=>ye({get:(n,r)=>n.getUint32(0,r),name:"u32",options:e,size:4});var S=(e={})=>Te({name:"u8",options:e,range:[0,+"0xff"],set:(n,r)=>n.setUint8(0,r),size:1}),x=(e={})=>ye({get:n=>n.getUint8(0),name:"u8",options:e,size:1});function Dn(e,n,r=n){if(!n.match(new RegExp(`^[${e}]*$`)))throw new Error(`Expected a string of base ${e.length}, got [${r}].`)}var vn=e=>{let n=e.length,r=BigInt(n);return {description:`base${n}`,encode(t){if(Dn(e,t),t==="")return new Uint8Array;let o=[...t],i=o.findIndex(p=>p!==e[0]);i=i===-1?o.length:i;let s=Array(i).fill(0);if(i===o.length)return Uint8Array.from(s);let c=o.slice(i),u=0n,a=1n;for(let p=c.length-1;p>=0;p-=1)u+=a*BigInt(e.indexOf(c[p])),a*=r;let l=[];for(;u>0n;)l.unshift(Number(u%256n)),u/=256n;return Uint8Array.from(s.concat(l))},fixedSize:null,maxSize:null}},Nn=e=>{let n=e.length,r=BigInt(n);return {decode(t,o=0){let i=o===0?t:t.slice(o);if(i.length===0)return ["",0];let s=i.findIndex(l=>l!==0);s=s===-1?i.length:s;let c=e[0].repeat(s);if(s===i.length)return [c,t.length];let u=i.slice(s).reduce((l,p)=>l*256n+BigInt(p),0n),a=[];for(;u>0n;)a.unshift(e[Number(u%r)]),u/=r;return [c+a.join(""),t.length]},description:`base${n}`,fixedSize:null,maxSize:null}};var Ae="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",I=()=>vn(Ae),_=()=>Nn(Ae);var kn=e=>e.replace(/\u0000/g,"");var _n=globalThis.TextDecoder,Ln=globalThis.TextEncoder,Rn=()=>{let e;return {description:"utf8",encode:n=>new Uint8Array((e||(e=new Ln)).encode(n)),fixedSize:null,maxSize:null}},Mn=()=>{let e;return {decode(n,r=0){let t=(e||(e=new _n)).decode(n.slice(r));return [kn(t),n.length]},description:"utf8",fixedSize:null,maxSize:null}};var $=(e={})=>{let n=e.size??P(),r=e.encoding??Rn(),t=e.description??`string(${r.description}; ${he(n)})`;return n==="variable"?{...r,description:t}:typeof n=="number"?U(r,n,t):{description:t,encode:o=>{let i=r.encode(o),s=n.encode(i.length);return k([s,i])},fixedSize:null,maxSize:null}},V=(e={})=>{let n=e.size??W(),r=e.encoding??Mn(),t=e.description??`string(${r.description}; ${he(n)})`;return n==="variable"?{...r,description:t}:typeof n=="number"?O(r,n,t):{decode:(o,i=0)=>{N("string",o,i);let[s,c]=n.decode(o,i),u=Number(s);i=c;let a=o.slice(i,i+u);w("string",u,a);let[l,p]=r.decode(a);return i+=p,[l,i]},description:t,fixedSize:null,maxSize:null}};function he(e){return typeof e=="object"?e.description:`${e}`}function C(e){if("signatures"in e){let{signatures:n,...r}=e;return r}else return e}var J;function Cr(e){J||(J=I());try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let r=J.encode(e).byteLength;if(r!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${r}`)}catch(n){throw new Error(`\`${e}\` is not a blockhash`,{cause:n})}}function be(e,n){if("lifetimeConstraint"in n&&n.lifetimeConstraint.blockhash===e.blockhash&&n.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight)return n;let r={...C(n),lifetimeConstraint:e};return Object.freeze(r),r}function Ee({version:e}){let n={instructions:[],version:e};return Object.freeze(n),n}var g=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(g||{});var Un=1;function y(e){return e>=2}function v(e){return (e&Un)!==0}function Q(e,n){return e|n}var xe="SysvarRecentB1ockHashes11111111111111111111",Ie="11111111111111111111111111111111";function $r(e){if(!Ce(e))throw new Error("Transaction is not a durable nonce transaction")}function Se(e,n){return {accounts:[{address:e,role:g.WRITABLE},{address:xe,role:g.READONLY},{address:n,role:g.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:Ie}}function F(e){return e.programAddress===Ie&&e.data!=null&&On(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===g.WRITABLE&&e.accounts[1].address===xe&&e.accounts[1].role===g.READONLY&&e.accounts[2].address!=null&&y(e.accounts[2].role)}function On(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function Ce(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&F(e.instructions[0])}function Pn(e,n,r){return e.accounts[0].address===n&&e.accounts[2].address===r}function ze({nonce:e,nonceAccountAddress:n,nonceAuthorityAddress:r},t){let o,i=t.instructions[0];if(i&&F(i))if(Pn(i,n,r)){if(Ce(t)&&t.lifetimeConstraint.nonce===e)return t;o=[i,...t.instructions.slice(1)];}else o=[Se(n,r),...t.instructions.slice(1)];else o=[Se(n,r),...t.instructions];let s={...C(t),instructions:o,lifetimeConstraint:{nonce:e}};return Object.freeze(s),s}function Be(e,n){if("feePayer"in n&&e===n.feePayer)return n;let r={...C(n),feePayer:e};return Object.freeze(r),r}function we(e,n){let r={...C(n),instructions:[...n.instructions,e]};return Object.freeze(r),r}function qr(e,n){let r={...C(n),instructions:[e,...n.instructions]};return Object.freeze(r),r}function H(e){return e.reduce((n,r)=>n===null||r===null?null:n+r,0)}function Wn(e,n,r,t){if(typeof e=="number")return [e,t];if(typeof e=="object")return e.decode(r,t);if(e==="remainder"){let o=H(n);if(o===null)throw new Error('Codecs of "remainder" size must have fixed-size items.');let i=r.slice(t).length;if(i%o!==0)throw new Error(`The remainder of the byte array (${i} bytes) cannot be split into chunks of ${o} bytes. Codecs of "remainder" size must have a remainder that is a multiple of its item size. In other words, ${i} modulo ${o} should be equal to zero.`);return [i/o,t]}throw new Error(`Unrecognized array-like codec size: ${JSON.stringify(e)}`)}function $n(e){return typeof e=="object"?e.description:`${e}`}function De(e,n){if(typeof e!="number")return null;if(e===0)return 0;let r=H(n);return r===null?null:r*e}function Vn(e,n){return typeof e=="object"?e.encode(n):new Uint8Array}function Fn(e,n,r){if(n!==r)throw new Error(`Expected [${e}] to have ${n} items, got ${r}.`)}function ve(e,n,r){if(n==="remainder"&&e.fixedSize===null)throw new Error('Codecs of "remainder" size must have fixed-size items.');return {description:r??`array(${e.description}; ${$n(n)})`,fixedSize:De(n,[e.fixedSize]),maxSize:De(n,[e.maxSize])}}function A(e,n={}){let r=n.size??P();return {...ve(e,r,n.description),encode:t=>(typeof r=="number"&&Fn("array",r,t.length),k([Vn(r,t.length),...t.map(o=>e.encode(o))]))}}function h(e,n={}){let r=n.size??W();return {...ve(e,r,n.description),decode:(t,o=0)=>{if(typeof r=="object"&&t.slice(o).length===0)return [[],o];let[i,s]=Wn(r,[e.fixedSize],t,o);o=s;let c=[];for(let u=0;u<i;u+=1){let[a,l]=e.decode(t,o);c.push(a),o=l;}return [c,o]}}}function K(e={}){let n=e.size??"variable",r=typeof n=="object"?n.description:`${n}`,t=e.description??`bytes(${r})`,o={description:t,encode:i=>i,fixedSize:null,maxSize:null};return n==="variable"?o:typeof n=="number"?U(o,n,t):{...o,encode:i=>{let s=o.encode(i),c=n.encode(s.length);return k([c,s])}}}function j(e={}){let n=e.size??"variable",r=typeof n=="object"?n.description:`${n}`,t=e.description??`bytes(${r})`,o={decode:(i,s=0)=>{let c=i.slice(s);return [c,s+c.length]},description:t,fixedSize:null,maxSize:null};return n==="variable"?o:typeof n=="number"?O(o,n,t):{...o,decode:(i,s=0)=>{N("bytes",i,s);let[c,u]=n.decode(i,s),a=Number(c);s=u;let l=i.slice(s,s+a);w("bytes",a,l);let[p,zn]=o.decode(l);return s+=zn,[p,s]}}}function Ne(e,n){let r=e.map(([t,o])=>`${String(t)}: ${o.description}`).join(", ");return {description:n??`struct(${r})`,fixedSize:H(e.map(([,t])=>t.fixedSize)),maxSize:H(e.map(([,t])=>t.maxSize))}}function b(e,n={}){return {...Ne(e,n.description),encode:r=>{let t=e.map(([o,i])=>i.encode(r[o]));return k(t)}}}function E(e,n={}){return {...Ne(e,n.description),decode:(r,t=0)=>{let o={};return e.forEach(([i,s])=>{let[c,u]=s.decode(r,t);t=u,o[i]=c;}),[o,t]}}}function ke(){if(!globalThis.isSecureContext)throw new Error("Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts")}async function _e(){if(ke(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function Le(){if(ke(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}var ee,ne;function Re(){return ee||(ee=I()),ee}function Hn(){return ne||(ne=_()),ne}function Y(e){try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let t=Re().encode(e).byteLength;if(t!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${t}`)}catch(n){throw new Error(`\`${e}\` is not a base-58 encoded address`,{cause:n})}}function Kn(e){return Y(e),e}function q(e){return B($({description:e?.description??"Base58EncodedAddress",encoding:Re(),size:32}),n=>Kn(n))}function R(e){return V({description:e?.description??"Base58EncodedAddress",encoding:Hn(),size:32})}function M(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}async function Me(e){if(await _e(),e.type!=="public"||e.algorithm.name!=="Ed25519")throw new Error("The `CryptoKey` must be an `Ed25519` public key");let n=await crypto.subtle.exportKey("raw",e),[r]=R().decode(new Uint8Array(n));return r}function Ue(e,n,r){e[n]=r(e[n]??{role:g.READONLY});}var f=Symbol("AddressMapTypeProperty");function Oe(e,n){let r={[e]:{[f]:0,role:g.WRITABLE_SIGNER}},t=new Set;for(let o of n){Ue(r,o.programAddress,s=>{if(t.add(o.programAddress),f in s){if(v(s.role))switch(s[f]){case 0:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and set as the fee payer. Program addresses may not pay fees.`);default:throw new Error(`This transaction includes an address (\`${o.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`)}if(s[f]===2)return s}return {[f]:2,role:g.READONLY}});let i;if(o.accounts)for(let s of o.accounts)Ue(r,s.address,c=>{let{address:u,...a}=s;if(f in c)switch(c[f]){case 0:return c;case 1:{let l=Q(c.role,a.role);if("lookupTableAddress"in a){if(c.lookupTableAddress!==a.lookupTableAddress&&(i||(i=M()))(a.lookupTableAddress,c.lookupTableAddress)<0)return {[f]:1,...a,role:l}}else if(y(a.role))return {[f]:2,role:l};return c.role!==l?{...c,role:l}:c}case 2:{let l=Q(c.role,a.role);if(t.has(s.address)){if(v(a.role))throw new Error(`This transaction includes an address (\`${s.address}\`) which is both invoked and marked writable. Program addresses may not be writable.`);return c.role!==l?{...c,role:l}:c}else return "lookupTableAddress"in a&&!y(c.role)?{...a,[f]:1,role:l}:c.role!==l?{...c,role:l}:c}}return "lookupTableAddress"in a?{...a,[f]:1}:{...a,[f]:2}});}return r}function Pe(e){let n;return Object.entries(e).sort(([t,o],[i,s])=>{if(o[f]!==s[f]){if(o[f]===0)return -1;if(s[f]===0)return 1;if(o[f]===2)return -1;if(s[f]===2)return 1}let c=y(o.role);if(c!==y(s.role))return c?-1:1;let u=v(o.role);return u!==v(s.role)?u?-1:1:(n||(n=M()),o[f]===1&&s[f]===1&&o.lookupTableAddress!==s.lookupTableAddress?n(o.lookupTableAddress,s.lookupTableAddress):n(t,i))}).map(([t,o])=>({address:t,...o}))}function We(e){var r;let n={};for(let t of e){if(!("lookupTableAddress"in t))continue;let o=n[r=t.lookupTableAddress]||(n[r]={readableIndices:[],writableIndices:[]});t.role===g.WRITABLE?o.writableIndices.push(t.addressIndex):o.readableIndices.push(t.addressIndex);}return Object.keys(n).sort(M()).map(t=>({lookupTableAddress:t,...n[t]}))}function $e(e){let n=0,r=0,t=0;for(let o of e){if("lookupTableAddress"in o)break;let i=v(o.role);y(o.role)?(t++,i||r++):i||n++;}return {numReadonlyNonSignerAccounts:n,numReadonlySignerAccounts:r,numSignerAccounts:t}}function jn(e){let n={};for(let[r,t]of e.entries())n[t.address]=r;return n}function Ve(e,n){let r=jn(n);return e.map(({accounts:t,data:o,programAddress:i})=>({programAddressIndex:r[i],...t?{accountIndices:t.map(({address:s})=>r[s])}:null,...o?{data:o}:null}))}function Fe(e){return "nonce"in e?e.nonce:e.blockhash}function He(e){let n=e.findIndex(t=>"lookupTableAddress"in t);return (n===-1?e:e.slice(0,n)).map(({address:t})=>t)}function G(e){let n=Oe(e.feePayer,e.instructions),r=Pe(n);return {...e.version!=="legacy"?{addressTableLookups:We(r)}:null,header:$e(r),instructions:Ve(e.instructions,r),lifetimeToken:Fe(e.lifetimeConstraint),staticAccounts:He(r),version:e.version}}function Ke(e){let n=G(e),r;if("signatures"in e){r=[];for(let t=0;t<n.header.numSignerAccounts;t++)r[t]=e.signatures[n.staticAccounts[t]]??new Uint8Array(Array(64).fill(0));}else r=Array(n.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));return {compiledMessage:n,signatures:r}}function je(e,...n){return n.reduce((r,t)=>t(r),e)}function Yn(e){let{header:n}=e,r=n.numSignerAccounts-n.numReadonlySignerAccounts,t=e.staticAccounts.length-n.numSignerAccounts-n.numReadonlyNonSignerAccounts,o=[],i=0;for(let s=0;s<r;s++)o.push({address:e.staticAccounts[i],role:g.WRITABLE_SIGNER}),i++;for(let s=0;s<n.numReadonlySignerAccounts;s++)o.push({address:e.staticAccounts[i],role:g.READONLY_SIGNER}),i++;for(let s=0;s<t;s++)o.push({address:e.staticAccounts[i],role:g.WRITABLE}),i++;for(let s=0;s<n.numReadonlyNonSignerAccounts;s++)o.push({address:e.staticAccounts[i],role:g.READONLY}),i++;return o}function qn(e,n){let r=n[e.programAddressIndex]?.address;if(!r)throw new Error(`Could not find program address at index ${e.programAddressIndex}`);let t=e.accountIndices?.map(i=>n[i]),{data:o}=e;return {programAddress:r,...t&&t.length?{accounts:t}:{},...o&&o.length?{data:o}:{}}}function Gn(e,n,r){if(!n||!F(n))return {blockhash:e,lastValidBlockHeight:r??2n**64n-1n};{let t=n.accounts[0].address;Y(t);let o=n.accounts[2].address;return Y(o),{nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:o}}}function Xn(e){let{compiledMessage:{staticAccounts:n},signatures:r}=e;return r.reduce((t,o,i)=>{if(o.every(u=>u===0))return t;let c=n[i];return {...t,[c]:o}},{})}function Ye(e,n){let{compiledMessage:r}=e;if("addressTableLookups"in r&&r.addressTableLookups.length>0)throw new Error("Cannot convert transaction with addressTableLookups");let t=r.staticAccounts[0];if(!t)throw new Error("No fee payer set in CompiledTransaction");let o=Yn(r),i=r.instructions.map(a=>qn(a,o)),s=i[0],c=Gn(r.lifetimeToken,s,n),u=Xn(e);return je(Ee({version:r.version}),a=>Be(t,a),a=>i.reduce((l,p)=>we(p,l),a),a=>"blockhash"in c?be(c,a):ze(c,a),a=>e.signatures.length?{...a,signatures:u}:a)}var qe="lookupTableAddress",Ge="writableIndices",Xe="readableIndices",Ze="addressTableLookup",re;function Je(){return re||(re=b([["lookupTableAddress",q({description:qe})],["writableIndices",A(S(),{description:Ge,size:m()})],["readableIndices",A(S(),{description:Xe,size:m()})]],{description:Ze})),re}var te;function Qe(){return te||(te=E([["lookupTableAddress",R({description:qe})],["writableIndices",h(x(),{description:Ge,size:T()})],["readableIndices",h(x(),{description:Xe,size:T()})]],{description:Ze})),te}var oe;function Zn(){return oe||(oe=S()),oe}function ie(e){let n=Zn();return {...n,description:e??n.description}}var se;function Jn(){return se||(se=x()),se}function ce(e){let n=Jn();return {...n,description:e??n.description}}var en=void 0,nn=void 0,rn=void 0,tn=void 0;function on(){return b([["numSignerAccounts",ie(en)],["numReadonlySignerAccounts",ie(nn)],["numReadonlyNonSignerAccounts",ie(rn)]],{description:tn})}function sn(){return E([["numSignerAccounts",ce(en)],["numReadonlySignerAccounts",ce(nn)],["numReadonlyNonSignerAccounts",ce(rn)]],{description:tn})}var cn="programAddressIndex",an=void 0,dn="accountIndices",un="data",ae;function ln(){return ae||(ae=B(b([["programAddressIndex",S({description:cn})],["accountIndices",A(S({description:an}),{description:dn,size:m()})],["data",K({description:un,size:m()})]]),e=>e.accountIndices!==void 0&&e.data!==void 0?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)})),ae}var de;function fn(){return de||(de=D(E([["programAddressIndex",x({description:cn})],["accountIndices",h(x({description:an}),{description:dn,size:T()})],["data",j({description:un,size:T()})]]),e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:n,data:r,...t}=e;return {...t,...n.length?{accountIndices:n}:null,...r.byteLength?{data:r}:null}})),de}var ue=128,gn={description:"",fixedSize:null,maxSize:1};function Qn(e,n=0){let r=e[n];return r&ue?[r^ue,n+1]:["legacy",n]}function er(e){if(e==="legacy")return new Uint8Array;if(e<0||e>127)throw new Error(`Transaction version must be in the range [0, 127]. \`${e}\` given.`);return new Uint8Array([e|ue])}function pn(){return {...gn,decode:Qn}}function mn(){return {...gn,encode:er}}var Tn="staticAccounts",yn="lifetimeToken",An="instructions",hn="addressTableLookups";function nr(){return b(bn())}function rr(){return B(b([...bn(),["addressTableLookups",or()]]),e=>e.version==="legacy"?e:{...e,addressTableLookups:e.addressTableLookups??[]})}function bn(){return [["version",mn()],["header",on()],["staticAccounts",A(q(),{description:Tn,size:m()})],["lifetimeToken",$({description:yn,encoding:I(),size:32})],["instructions",A(ln(),{description:An,size:m()})]]}function tr(){return [["version",pn()],["header",sn()],["staticAccounts",h(R(),{description:Tn,size:T()})],["lifetimeToken",V({description:yn,encoding:_(),size:32})],["instructions",h(fn(),{description:An,size:T()})],["addressTableLookups",ir()]]}function or(){return A(Je(),{description:hn,size:m()})}function ir(){return h(Qe(),{description:hn,size:T()})}var En="message";function X(){return {description:En,encode:e=>e.version==="legacy"?nr().encode(e):rr().encode(e),fixedSize:null,maxSize:null}}function Sn(){return D(E(tr(),{description:En}),({addressTableLookups:e,...n})=>n.version==="legacy"||!e?.length?n:{...n,addressTableLookups:e})}var xn="signatures",In="transaction";function sr(){return b([["signatures",A(K({size:64}),{description:xn,size:m()})],["compiledMessage",X()]],{description:In})}function cr(){return D(j({size:64}),e=>e)}function ar(){return E([["signatures",h(cr(),{description:xn,size:T()})],["compiledMessage",Sn()]],{description:In})}function le(){return B(sr(),Ke)}function dr(e){return D(ar(),n=>Ye(n,e))}function si(e){return z(le(),dr(e))}async function Cn(e,n){await Le();let r=await crypto.subtle.sign("Ed25519",e,n);return new Uint8Array(r)}var L,fe;function ur(e){L||(L=I());try{if(e.length<64||e.length>88)throw new Error("Expected input string to decode to a byte array of length 64.");let r=L.encode(e).byteLength;if(r!==64)throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${r}`)}catch(n){throw new Error(`\`${e}\` is not a transaction signature`,{cause:n})}}function Si(e){return L||(L=I()),!(e.length<64||e.length>88||L.encode(e).byteLength!==64)}function xi(e){fe||(fe=_());let n=e.signatures[e.feePayer];if(!n)throw new Error("Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.");return fe.decode(n)[0]}async function Ii(e,n){let r=G(n),t="signatures"in n?{...n.signatures}:{},o=X().encode(r),i=await Promise.all(e.map(c=>Promise.all([Me(c.publicKey),Cn(c.privateKey,o)])));for(let[c,u]of i)t[c]=u;let s={...n,signatures:t};return Object.freeze(s),s}function Ci(e){return ur(e),e}function zi(e){let n=e.instructions.flatMap(t=>t.accounts?.filter(o=>y(o.role))??[]).map(t=>t.address);new Set([e.feePayer,...n]).forEach(t=>{if(!e.signatures[t])throw new Error(`Transaction is missing signature for address \`${t}\``)});}function vi(e){let n=le().encode(e);return btoa(String.fromCharCode(...n))}
6
+
7
+ exports.appendTransactionInstruction = we;
8
+ exports.assertIsBlockhash = Cr;
9
+ exports.assertIsDurableNonceTransaction = $r;
10
+ exports.assertIsTransactionSignature = ur;
11
+ exports.assertTransactionIsFullySigned = zi;
12
+ exports.createTransaction = Ee;
13
+ exports.getBase64EncodedWireTransaction = vi;
14
+ exports.getSignatureFromTransaction = xi;
15
+ exports.getTransactionCodec = si;
16
+ exports.getTransactionDecoder = dr;
17
+ exports.getTransactionEncoder = le;
18
+ exports.isAdvanceNonceAccountInstruction = F;
19
+ exports.isTransactionSignature = Si;
20
+ exports.prependTransactionInstruction = qr;
21
+ exports.setTransactionFeePayer = Be;
22
+ exports.setTransactionLifetimeUsingBlockhash = be;
23
+ exports.setTransactionLifetimeUsingDurableNonce = ze;
24
+ exports.signTransaction = Ii;
25
+ exports.transactionSignature = Ci;
26
+
27
+ return exports;
28
+
29
+ })({});
@@ -0,0 +1,28 @@
1
+ import { Base58EncodedAddress } from '@solana/addresses';
2
+ import { IAccountLookupMeta, IAccountMeta, IInstruction, ReadonlyAccount, ReadonlyAccountLookup, ReadonlySignerAccount, WritableAccount, WritableAccountLookup, WritableSignerAccount } from '@solana/instructions';
3
+ export declare const enum AddressMapEntryType {
4
+ FEE_PAYER = 0,
5
+ LOOKUP_TABLE = 1,
6
+ STATIC = 2
7
+ }
8
+ type AddressMap = {
9
+ [address: string]: FeePayerAccountEntry | LookupTableAccountEntry | StaticAccountEntry;
10
+ };
11
+ type FeePayerAccountEntry = Omit<WritableSignerAccount, 'address'> & {
12
+ [TYPE]: AddressMapEntryType.FEE_PAYER;
13
+ };
14
+ type LookupTableAccountEntry = Omit<ReadonlyAccountLookup | WritableAccountLookup, 'address'> & {
15
+ [TYPE]: AddressMapEntryType.LOOKUP_TABLE;
16
+ };
17
+ export type OrderedAccounts = (IAccountMeta | IAccountLookupMeta)[] & {
18
+ readonly __brand: unique symbol;
19
+ };
20
+ type StaticAccountEntry = Omit<ReadonlyAccount | ReadonlySignerAccount | WritableAccount | WritableSignerAccount, 'address'> & {
21
+ [TYPE]: AddressMapEntryType.STATIC;
22
+ };
23
+ declare const TYPE: unique symbol;
24
+ export declare const ADDRESS_MAP_TYPE_PROPERTY: typeof TYPE;
25
+ export declare function getAddressMapFromInstructions(feePayer: Base58EncodedAddress, instructions: readonly IInstruction[]): AddressMap;
26
+ export declare function getOrderedAccountsFromAddressMap(addressMap: AddressMap): OrderedAccounts;
27
+ export {};
28
+ //# sourceMappingURL=accounts.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { IDurableNonceTransaction } from './durable-nonce';
2
+ import { ITransactionWithSignatures } from './signatures';
3
+ import { BaseTransaction } from './types';
4
+ export type Blockhash = string & {
5
+ readonly __brand: unique symbol;
6
+ };
7
+ type BlockhashLifetimeConstraint = Readonly<{
8
+ blockhash: Blockhash;
9
+ lastValidBlockHeight: bigint;
10
+ }>;
11
+ export interface ITransactionWithBlockhashLifetime {
12
+ readonly lifetimeConstraint: BlockhashLifetimeConstraint;
13
+ }
14
+ export declare function assertIsBlockhash(putativeBlockhash: string): asserts putativeBlockhash is Blockhash;
15
+ export declare function setTransactionLifetimeUsingBlockhash<TTransaction extends BaseTransaction & IDurableNonceTransaction>(blockhashLifetimeConstraint: BlockhashLifetimeConstraint, transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): Omit<TTransaction, keyof ITransactionWithSignatures | 'lifetimeConstraint'> & ITransactionWithBlockhashLifetime;
16
+ export declare function setTransactionLifetimeUsingBlockhash<TTransaction extends BaseTransaction | (BaseTransaction & ITransactionWithBlockhashLifetime)>(blockhashLifetimeConstraint: BlockhashLifetimeConstraint, transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): Omit<TTransaction, keyof ITransactionWithSignatures> & ITransactionWithBlockhashLifetime;
17
+ export {};
18
+ //# sourceMappingURL=blockhash.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { Base58EncodedAddress } from '@solana/addresses';
2
+ import { OrderedAccounts } from './accounts';
3
+ type AddressTableLookup = Readonly<{
4
+ lookupTableAddress: Base58EncodedAddress;
5
+ readableIndices: readonly number[];
6
+ writableIndices: readonly number[];
7
+ }>;
8
+ export declare function getCompiledAddressTableLookups(orderedAccounts: OrderedAccounts): AddressTableLookup[];
9
+ export {};
10
+ //# sourceMappingURL=compile-address-table-lookups.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { OrderedAccounts } from './accounts';
2
+ type MessageHeader = Readonly<{
3
+ numReadonlyNonSignerAccounts: number;
4
+ numReadonlySignerAccounts: number;
5
+ numSignerAccounts: number;
6
+ }>;
7
+ export declare function getCompiledMessageHeader(orderedAccounts: OrderedAccounts): MessageHeader;
8
+ export {};
9
+ //# sourceMappingURL=compile-header.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { IInstruction } from '@solana/instructions';
2
+ import { OrderedAccounts } from './accounts';
3
+ type CompiledInstruction = Readonly<{
4
+ accountIndices?: number[];
5
+ data?: Uint8Array;
6
+ programAddressIndex: number;
7
+ }>;
8
+ export declare function getCompiledInstructions(instructions: readonly IInstruction[], orderedAccounts: OrderedAccounts): CompiledInstruction[];
9
+ export {};
10
+ //# sourceMappingURL=compile-instructions.d.ts.map
@@ -0,0 +1,3 @@
1
+ import { IDurableNonceTransaction, ITransactionWithBlockhashLifetime } from './index';
2
+ export declare function getCompiledLifetimeToken(lifetimeConstraint: (ITransactionWithBlockhashLifetime | IDurableNonceTransaction)['lifetimeConstraint']): string;
3
+ //# sourceMappingURL=compile-lifetime-token.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { Base58EncodedAddress } from '@solana/addresses';
2
+ import { OrderedAccounts } from './accounts';
3
+ export declare function getCompiledStaticAccounts(orderedAccounts: OrderedAccounts): Base58EncodedAddress[];
4
+ //# sourceMappingURL=compile-static-accounts.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { Ed25519Signature } from '@solana/keys';
2
+ import { CompiledMessage, compileMessage } from './message';
3
+ import { ITransactionWithSignatures } from './signatures';
4
+ type CompiledTransaction = Readonly<{
5
+ compiledMessage: CompiledMessage;
6
+ signatures: Ed25519Signature[];
7
+ }>;
8
+ type CompilableTransaction = Parameters<typeof compileMessage>[0];
9
+ export declare function getCompiledTransaction(transaction: CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures)): CompiledTransaction;
10
+ export {};
11
+ //# sourceMappingURL=compile-transaction.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { Transaction, TransactionVersion } from './types';
2
+ type TransactionConfig<TVersion extends TransactionVersion> = Readonly<{
3
+ version: TVersion;
4
+ }>;
5
+ export declare function createTransaction<TVersion extends TransactionVersion>(config: TransactionConfig<TVersion>): Extract<Transaction, {
6
+ version: TVersion;
7
+ }>;
8
+ export {};
9
+ //# sourceMappingURL=create-transaction.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { getCompiledTransaction } from './compile-transaction';
2
+ import { ITransactionWithSignatures } from './signatures';
3
+ type CompiledTransaction = ReturnType<typeof getCompiledTransaction>;
4
+ type CompilableTransaction = Parameters<typeof getCompiledTransaction>[0];
5
+ export declare function decompileTransaction(compiledTransaction: CompiledTransaction, lastValidBlockHeight?: bigint): CompilableTransaction | (CompilableTransaction & ITransactionWithSignatures);
6
+ export {};
7
+ //# sourceMappingURL=decompile-transaction.d.ts.map
@@ -0,0 +1,35 @@
1
+ import { Base58EncodedAddress } from '@solana/addresses';
2
+ import { IInstruction, IInstructionWithAccounts, IInstructionWithData, ReadonlyAccount, ReadonlySignerAccount, WritableAccount, WritableSignerAccount } from '@solana/instructions';
3
+ import { ITransactionWithSignatures } from './signatures';
4
+ import { BaseTransaction } from './types';
5
+ type AdvanceNonceAccountInstruction<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string> = IInstruction<'11111111111111111111111111111111'> & IInstructionWithAccounts<readonly [
6
+ WritableAccount<TNonceAccountAddress>,
7
+ ReadonlyAccount<'SysvarRecentB1ockHashes11111111111111111111'>,
8
+ ReadonlySignerAccount<TNonceAuthorityAddress> | WritableSignerAccount<TNonceAuthorityAddress>
9
+ ]> & IInstructionWithData<AdvanceNonceAccountInstructionData>;
10
+ type AdvanceNonceAccountInstructionData = Uint8Array & {
11
+ readonly __brand: unique symbol;
12
+ };
13
+ type DurableNonceConfig<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string> = Readonly<{
14
+ readonly nonce: Nonce<TNonceValue>;
15
+ readonly nonceAccountAddress: Base58EncodedAddress<TNonceAccountAddress>;
16
+ readonly nonceAuthorityAddress: Base58EncodedAddress<TNonceAuthorityAddress>;
17
+ }>;
18
+ export type Nonce<TNonceValue extends string = string> = TNonceValue & {
19
+ readonly __brand: unique symbol;
20
+ };
21
+ type NonceLifetimeConstraint<TNonceValue extends string = string> = Readonly<{
22
+ nonce: Nonce<TNonceValue>;
23
+ }>;
24
+ export interface IDurableNonceTransaction<TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string> {
25
+ readonly instructions: readonly [
26
+ AdvanceNonceAccountInstruction<TNonceAccountAddress, TNonceAuthorityAddress>,
27
+ ...IInstruction[]
28
+ ];
29
+ readonly lifetimeConstraint: NonceLifetimeConstraint<TNonceValue>;
30
+ }
31
+ export declare function assertIsDurableNonceTransaction(transaction: BaseTransaction | (BaseTransaction & IDurableNonceTransaction)): asserts transaction is BaseTransaction & IDurableNonceTransaction;
32
+ export declare function isAdvanceNonceAccountInstruction(instruction: IInstruction): instruction is AdvanceNonceAccountInstruction;
33
+ export declare function setTransactionLifetimeUsingDurableNonce<TTransaction extends BaseTransaction, TNonceAccountAddress extends string = string, TNonceAuthorityAddress extends string = string, TNonceValue extends string = string>({ nonce, nonceAccountAddress, nonceAuthorityAddress, }: DurableNonceConfig<TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue>, transaction: TTransaction | (TTransaction & IDurableNonceTransaction)): Omit<TTransaction, keyof ITransactionWithSignatures> & IDurableNonceTransaction<TNonceAccountAddress, TNonceAuthorityAddress, TNonceValue>;
34
+ export {};
35
+ //# sourceMappingURL=durable-nonce.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { Base58EncodedAddress } from '@solana/addresses';
2
+ import { ITransactionWithSignatures } from './signatures';
3
+ import { BaseTransaction } from './types';
4
+ export interface ITransactionWithFeePayer<TAddress extends string = string> {
5
+ readonly feePayer: Base58EncodedAddress<TAddress>;
6
+ }
7
+ export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Base58EncodedAddress<TFeePayerAddress>, transaction: (TTransaction & ITransactionWithSignatures) | (TTransaction & ITransactionWithFeePayer<string> & ITransactionWithSignatures)): Omit<TTransaction, keyof ITransactionWithSignatures> & ITransactionWithFeePayer<TFeePayerAddress>;
8
+ export declare function setTransactionFeePayer<TFeePayerAddress extends string, TTransaction extends BaseTransaction>(feePayer: Base58EncodedAddress<TFeePayerAddress>, transaction: TTransaction | (TTransaction & ITransactionWithFeePayer<string>)): TTransaction & ITransactionWithFeePayer<TFeePayerAddress>;
9
+ //# sourceMappingURL=fee-payer.d.ts.map
@@ -0,0 +1,10 @@
1
+ export * from './blockhash';
2
+ export * from './create-transaction';
3
+ export * from './durable-nonce';
4
+ export * from './fee-payer';
5
+ export * from './instructions';
6
+ export * from './serializers';
7
+ export * from './signatures';
8
+ export * from './types';
9
+ export * from './wire-transaction';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { ITransactionWithSignatures } from './signatures';
2
+ import { BaseTransaction } from './types';
3
+ export declare function appendTransactionInstruction<TTransaction extends BaseTransaction>(instruction: TTransaction['instructions'][number], transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): TTransaction | Omit<TTransaction, keyof ITransactionWithSignatures>;
4
+ export declare function prependTransactionInstruction<TTransaction extends BaseTransaction>(instruction: TTransaction['instructions'][number], transaction: TTransaction | (TTransaction & ITransactionWithSignatures)): TTransaction | Omit<TTransaction, keyof ITransactionWithSignatures>;
5
+ //# sourceMappingURL=instructions.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { ITransactionWithBlockhashLifetime } from './blockhash';
2
+ import { getCompiledAddressTableLookups } from './compile-address-table-lookups';
3
+ import { getCompiledMessageHeader } from './compile-header';
4
+ import { getCompiledInstructions } from './compile-instructions';
5
+ import { getCompiledLifetimeToken } from './compile-lifetime-token';
6
+ import { getCompiledStaticAccounts } from './compile-static-accounts';
7
+ import { IDurableNonceTransaction } from './durable-nonce';
8
+ import { ITransactionWithFeePayer } from './fee-payer';
9
+ import { BaseTransaction } from './types';
10
+ type BaseCompiledMessage = Readonly<{
11
+ header: ReturnType<typeof getCompiledMessageHeader>;
12
+ instructions: ReturnType<typeof getCompiledInstructions>;
13
+ lifetimeToken: ReturnType<typeof getCompiledLifetimeToken>;
14
+ staticAccounts: ReturnType<typeof getCompiledStaticAccounts>;
15
+ }>;
16
+ type CompilableTransaction = BaseTransaction & ITransactionWithFeePayer & (ITransactionWithBlockhashLifetime | IDurableNonceTransaction);
17
+ export type CompiledMessage = LegacyCompiledMessage | VersionedCompiledMessage;
18
+ type LegacyCompiledMessage = BaseCompiledMessage & Readonly<{
19
+ version: 'legacy';
20
+ }>;
21
+ type VersionedCompiledMessage = BaseCompiledMessage & Readonly<{
22
+ addressTableLookups?: ReturnType<typeof getCompiledAddressTableLookups>;
23
+ version: number;
24
+ }>;
25
+ export declare function compileMessage(transaction: CompilableTransaction & Readonly<{
26
+ version: 'legacy';
27
+ }>): LegacyCompiledMessage;
28
+ export declare function compileMessage(transaction: CompilableTransaction): VersionedCompiledMessage;
29
+ export {};
30
+ //# sourceMappingURL=message.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { type Codec, type Decoder, type Encoder } from '@solana/codecs-core';
2
+ import type { getCompiledAddressTableLookups } from '../compile-address-table-lookups';
3
+ type AddressTableLookup = ReturnType<typeof getCompiledAddressTableLookups>[number];
4
+ export declare function getAddressTableLookupEncoder(): Encoder<AddressTableLookup>;
5
+ export declare function getAddressTableLookupDecoder(): Decoder<AddressTableLookup>;
6
+ export declare function getAddressTableLookupCodec(): Codec<AddressTableLookup>;
7
+ export {};
8
+ //# sourceMappingURL=address-table-lookup.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { Codec, Decoder, Encoder } from '@solana/codecs-core';
2
+ import { getCompiledMessageHeader } from '../compile-header';
3
+ type MessageHeader = ReturnType<typeof getCompiledMessageHeader>;
4
+ export declare function getMessageHeaderEncoder(): Encoder<MessageHeader>;
5
+ export declare function getMessageHeaderDecoder(): Decoder<MessageHeader>;
6
+ export declare function getMessageHeaderCodec(): Codec<MessageHeader>;
7
+ export {};
8
+ //# sourceMappingURL=header.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './transaction';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { Codec, Decoder, Encoder } from '@solana/codecs-core';
2
+ import { getCompiledInstructions } from '../compile-instructions';
3
+ type Instruction = ReturnType<typeof getCompiledInstructions>[number];
4
+ export declare function getInstructionEncoder(): Encoder<Instruction>;
5
+ export declare function getInstructionDecoder(): Decoder<Instruction>;
6
+ export declare function getInstructionCodec(): Codec<Instruction>;
7
+ export {};
8
+ //# sourceMappingURL=instruction.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { Codec, Decoder, Encoder } from '@solana/codecs-core';
2
+ import { CompiledMessage } from '../message';
3
+ export declare function getCompiledMessageEncoder(): Encoder<CompiledMessage>;
4
+ export declare function getCompiledMessageDecoder(): Decoder<CompiledMessage>;
5
+ export declare function getCompiledMessageCodec(): Codec<CompiledMessage>;
6
+ //# sourceMappingURL=message.d.ts.map