@aurora-is-near/intents-swap-widget 3.17.0 → 3.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/components/Input.d.ts +8 -2
  2. package/dist/components/Input.js +88 -84
  3. package/dist/components/Input.js.map +1 -1
  4. package/dist/{config-BMe2x51b.js → config-BVaLnxO9.js} +804 -788
  5. package/dist/config-BVaLnxO9.js.map +1 -0
  6. package/dist/config.js +6 -5
  7. package/dist/config.js.map +1 -1
  8. package/dist/errors.js +1 -1
  9. package/dist/ext/alchemy/index.js +1 -1
  10. package/dist/ext/index.js +1 -1
  11. package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
  12. package/dist/features/BalanceRpcLoader/index.js +1 -1
  13. package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
  14. package/dist/features/ChainsDropdown/index.js +1 -1
  15. package/dist/features/DepositMethodSwitcher.js +1 -1
  16. package/dist/features/ErrorBoundary.js +1 -1
  17. package/dist/features/ExternalDeposit.js +5 -4
  18. package/dist/features/ExternalDeposit.js.map +1 -1
  19. package/dist/features/SendAddress/index.js +1 -1
  20. package/dist/features/SendAddress/useNotification.js +1 -1
  21. package/dist/features/SubmitButton/index.js +1 -1
  22. package/dist/features/SuccessScreen/index.js +1 -1
  23. package/dist/features/SwapDirectionSwitcher.js +1 -1
  24. package/dist/features/SwapQuote/SwapQuote.js +1 -1
  25. package/dist/features/SwapQuote/index.js +1 -1
  26. package/dist/features/TokenInput/TokenInput.js +1 -1
  27. package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
  28. package/dist/features/TokenInput/TokenInputSource.js +1 -1
  29. package/dist/features/TokenInput/TokenInputTarget.js +1 -1
  30. package/dist/features/TokenInput/WalletBalance.js +1 -1
  31. package/dist/features/TokenInput/hooks/index.js +1 -1
  32. package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
  33. package/dist/features/TokenInput/index.js +1 -1
  34. package/dist/features/TokensList/TokenItem.js +1 -1
  35. package/dist/features/TokensList/TokensList.js +1 -1
  36. package/dist/features/TokensList/index.js +1 -1
  37. package/dist/features/TokensModal.js +64 -55
  38. package/dist/features/TokensModal.js.map +1 -1
  39. package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +3 -3
  40. package/dist/features/WalletCompatibilityCheck/index.js +1 -1
  41. package/dist/features/index.js +1 -1
  42. package/dist/hooks/index.js +1 -1
  43. package/dist/hooks/useAllTokens.js +1 -1
  44. package/dist/hooks/useChains.js +1 -1
  45. package/dist/hooks/useCompatibilityCheck.js +1 -1
  46. package/dist/hooks/useDefaultToken.js +1 -1
  47. package/dist/hooks/useExternalDepositStatus/index.js +1 -1
  48. package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
  49. package/dist/hooks/useHandleKeyDown.d.ts +1 -1
  50. package/dist/hooks/useHandleKeyDown.js +12 -8
  51. package/dist/hooks/useHandleKeyDown.js.map +1 -1
  52. package/dist/hooks/useIntentsBalance.js +1 -1
  53. package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
  54. package/dist/hooks/useMakeDepositAddress.js +1 -1
  55. package/dist/hooks/useMakeIntentsTransfer.js +4 -3
  56. package/dist/hooks/useMakeIntentsTransfer.js.map +1 -1
  57. package/dist/hooks/useMakeNEARFtTransferCall.js +4 -2
  58. package/dist/hooks/useMakeNEARFtTransferCall.js.map +1 -1
  59. package/dist/hooks/useMakeQuote.js +1 -1
  60. package/dist/hooks/useMakeQuoteTransfer.js +3 -2
  61. package/dist/hooks/useMakeQuoteTransfer.js.map +1 -1
  62. package/dist/hooks/useMakeSolanaTransfer.js +1 -1
  63. package/dist/hooks/useMakeTransfer.js +1 -1
  64. package/dist/hooks/useMergedBalance.js +1 -1
  65. package/dist/hooks/useSwitchChain.js +1 -1
  66. package/dist/hooks/useTheme.js +1 -1
  67. package/dist/hooks/useTokenInputPair.js +1 -1
  68. package/dist/hooks/useTokens.js +1 -1
  69. package/dist/hooks/useTokensFiltered.js +1 -1
  70. package/dist/hooks/useTokensIntentsUnique.js +1 -1
  71. package/dist/{index-Ce9bzNHX.js → index-JGjxyZXI.js} +70 -70
  72. package/dist/index-JGjxyZXI.js.map +1 -0
  73. package/dist/index.browser.esm-COWShN0a.js.map +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/machine/effects/index.js +1 -1
  76. package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
  77. package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
  78. package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
  79. package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
  80. package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
  81. package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
  82. package/dist/machine/effects/useWalletConnEffect.js +1 -1
  83. package/dist/machine/events/index.js +1 -1
  84. package/dist/machine/events/tokenSelect.js +1 -1
  85. package/dist/machine/events/validateInputAndMoveTo.js +1 -1
  86. package/dist/machine/events/validateInputs.js +1 -1
  87. package/dist/machine/index.js +1 -1
  88. package/dist/machine/snap.js +1 -1
  89. package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
  90. package/dist/machine/subscriptions/index.js +1 -1
  91. package/dist/theme/ThemeProvider.js +1 -1
  92. package/dist/utils/checkers/isUserDeniedSigning.d.ts +2 -1
  93. package/dist/utils/checkers/isUserDeniedSigning.js +6 -4
  94. package/dist/utils/checkers/isUserDeniedSigning.js.map +1 -1
  95. package/dist/utils/index.d.ts +1 -0
  96. package/dist/utils/index.js +26 -24
  97. package/dist/utils/index.js.map +1 -1
  98. package/dist/utils/intents/signers/near.d.ts +1 -1
  99. package/dist/utils/intents/signers/near.js +2 -2
  100. package/dist/utils/intents/signers/privy.d.ts +1 -1
  101. package/dist/utils/intents/signers/privy.js +1 -1
  102. package/dist/utils/intents/signers/solana.d.ts +1 -1
  103. package/dist/utils/intents/signers/solana.js.map +1 -1
  104. package/dist/utils/isErrorLikeObject.d.ts +4 -0
  105. package/dist/utils/isErrorLikeObject.js +5 -0
  106. package/dist/utils/isErrorLikeObject.js.map +1 -0
  107. package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
  108. package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +5 -4
  109. package/dist/widgets/WidgetDeposit/WidgetDepositContent.js.map +1 -1
  110. package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
  111. package/dist/widgets/WidgetSwap/WidgetSwapContent.js +5 -4
  112. package/dist/widgets/WidgetSwap/WidgetSwapContent.js.map +1 -1
  113. package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
  114. package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +5 -4
  115. package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js.map +1 -1
  116. package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
  117. package/package.json +2 -2
  118. package/src/components/Input.tsx +111 -96
  119. package/src/features/TokensModal.tsx +19 -2
  120. package/src/hooks/useHandleKeyDown.ts +25 -3
  121. package/src/hooks/useMakeIntentsTransfer.ts +40 -29
  122. package/src/hooks/useMakeNEARFtTransferCall.ts +10 -0
  123. package/src/hooks/useMakeQuoteTransfer.ts +2 -1
  124. package/src/utils/checkers/isUserDeniedSigning.ts +11 -3
  125. package/src/utils/index.ts +1 -0
  126. package/src/utils/intents/signers/near.ts +1 -1
  127. package/src/utils/intents/signers/privy.ts +1 -1
  128. package/src/utils/intents/signers/solana.ts +1 -1
  129. package/src/utils/isErrorLikeObject.ts +11 -0
  130. package/dist/config-BMe2x51b.js.map +0 -1
  131. package/dist/index-Ce9bzNHX.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-JGjxyZXI.js","sources":["../../../node_modules/@solana/spl-token/lib/esm/constants.js","../../../node_modules/@solana/buffer-layout-utils/lib/esm/base.mjs","../../../node_modules/bigint-buffer/dist/browser.js","../../../node_modules/@solana/buffer-layout-utils/lib/esm/bigint.mjs","../../../node_modules/@solana/buffer-layout-utils/lib/esm/native.mjs","../../../node_modules/@solana/buffer-layout-utils/lib/esm/web3.mjs","../../../node_modules/@solana/spl-token/lib/esm/errors.js","../../../node_modules/@solana/spl-token/lib/esm/instructions/types.js","../../../node_modules/@solana/spl-token/lib/esm/instructions/internal.js","../../../node_modules/@solana/spl-token/lib/esm/state/mint.js","../../../node_modules/@solana/spl-token/lib/esm/instructions/transfer.js"],"sourcesContent":["import { PublicKey } from '@solana/web3.js';\n/** Address of the SPL Token program */\nexport const TOKEN_PROGRAM_ID = new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA');\n/** Address of the SPL Token 2022 program */\nexport const TOKEN_2022_PROGRAM_ID = new PublicKey('TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb');\n/** Address of the SPL Associated Token Account program */\nexport const ASSOCIATED_TOKEN_PROGRAM_ID = new PublicKey('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL');\n/** Address of the special mint for wrapped native SOL in spl-token */\nexport const NATIVE_MINT = new PublicKey('So11111111111111111111111111111111111111112');\n/** Address of the special mint for wrapped native SOL in spl-token-2022 */\nexport const NATIVE_MINT_2022 = new PublicKey('9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP');\n/** Check that the token program provided is not `Tokenkeg...`, useful when using extensions */\nexport function programSupportsExtensions(programId) {\n if (programId === TOKEN_PROGRAM_ID) {\n return false;\n }\n else {\n return true;\n }\n}\n//# sourceMappingURL=constants.js.map","export const encodeDecode = (layout) => {\n const decode = layout.decode.bind(layout);\n const encode = layout.encode.bind(layout);\n return { decode, encode };\n};\n//# sourceMappingURL=base.js.map","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nlet converter;\n/**\n * Convert a little-endian buffer into a BigInt.\n * @param buf The little-endian buffer to convert\n * @returns A BigInt with the little-endian representation of buf.\n */\nfunction toBigIntLE(buf) {\n {\n const reversed = Buffer.from(buf);\n reversed.reverse();\n const hex = reversed.toString('hex');\n if (hex.length === 0) {\n return BigInt(0);\n }\n return BigInt(`0x${hex}`);\n }\n return converter.toBigInt(buf, false);\n}\nexports.toBigIntLE = toBigIntLE;\n/**\n * Convert a big-endian buffer into a BigInt\n * @param buf The big-endian buffer to convert.\n * @returns A BigInt with the big-endian representation of buf.\n */\nfunction toBigIntBE(buf) {\n {\n const hex = buf.toString('hex');\n if (hex.length === 0) {\n return BigInt(0);\n }\n return BigInt(`0x${hex}`);\n }\n return converter.toBigInt(buf, true);\n}\nexports.toBigIntBE = toBigIntBE;\n/**\n * Convert a BigInt to a little-endian buffer.\n * @param num The BigInt to convert.\n * @param width The number of bytes that the resulting buffer should be.\n * @returns A little-endian buffer representation of num.\n */\nfunction toBufferLE(num, width) {\n {\n const hex = num.toString(16);\n const buffer = Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');\n buffer.reverse();\n return buffer;\n }\n // Allocation is done here, since it is slower using napi in C\n return converter.fromBigInt(num, Buffer.allocUnsafe(width), false);\n}\nexports.toBufferLE = toBufferLE;\n/**\n * Convert a BigInt to a big-endian buffer.\n * @param num The BigInt to convert.\n * @param width The number of bytes that the resulting buffer should be.\n * @returns A big-endian buffer representation of num.\n */\nfunction toBufferBE(num, width) {\n {\n const hex = num.toString(16);\n return Buffer.from(hex.padStart(width * 2, '0').slice(0, width * 2), 'hex');\n }\n return converter.fromBigInt(num, Buffer.allocUnsafe(width), true);\n}\nexports.toBufferBE = toBufferBE;\n","import { blob } from '@solana/buffer-layout';\nimport { toBigIntBE, toBigIntLE, toBufferBE, toBufferLE } from 'bigint-buffer';\nimport { encodeDecode } from './base.mjs';\nexport const bigInt = (length) => (property) => {\n const layout = blob(length, property);\n const { encode, decode } = encodeDecode(layout);\n const bigIntLayout = layout;\n bigIntLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return toBigIntLE(Buffer.from(src));\n };\n bigIntLayout.encode = (bigInt, buffer, offset) => {\n const src = toBufferLE(bigInt, length);\n return encode(src, buffer, offset);\n };\n return bigIntLayout;\n};\nexport const bigIntBE = (length) => (property) => {\n const layout = blob(length, property);\n const { encode, decode } = encodeDecode(layout);\n const bigIntLayout = layout;\n bigIntLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return toBigIntBE(Buffer.from(src));\n };\n bigIntLayout.encode = (bigInt, buffer, offset) => {\n const src = toBufferBE(bigInt, length);\n return encode(src, buffer, offset);\n };\n return bigIntLayout;\n};\nexport const u64 = bigInt(8);\nexport const u64be = bigIntBE(8);\nexport const u128 = bigInt(16);\nexport const u128be = bigIntBE(16);\nexport const u192 = bigInt(24);\nexport const u192be = bigIntBE(24);\nexport const u256 = bigInt(32);\nexport const u256be = bigIntBE(32);\n//# sourceMappingURL=bigint.js.map","import { u8 } from '@solana/buffer-layout';\nimport { encodeDecode } from './base.mjs';\nexport const bool = (property) => {\n const layout = u8(property);\n const { encode, decode } = encodeDecode(layout);\n const boolLayout = layout;\n boolLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return !!src;\n };\n boolLayout.encode = (bool, buffer, offset) => {\n const src = Number(bool);\n return encode(src, buffer, offset);\n };\n return boolLayout;\n};\n//# sourceMappingURL=native.js.map","import { blob } from '@solana/buffer-layout';\nimport { PublicKey } from '@solana/web3.js';\nimport { encodeDecode } from './base.mjs';\nexport const publicKey = (property) => {\n const layout = blob(32, property);\n const { encode, decode } = encodeDecode(layout);\n const publicKeyLayout = layout;\n publicKeyLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return new PublicKey(src);\n };\n publicKeyLayout.encode = (publicKey, buffer, offset) => {\n const src = publicKey.toBuffer();\n return encode(src, buffer, offset);\n };\n return publicKeyLayout;\n};\n//# sourceMappingURL=web3.js.map","/** Base class for errors */\nexport class TokenError extends Error {\n constructor(message) {\n super(message);\n }\n}\n/** Thrown if an account is not found at the expected address */\nexport class TokenAccountNotFoundError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenAccountNotFoundError';\n }\n}\n/** Thrown if a program state account is not a valid Account */\nexport class TokenInvalidAccountError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidAccountError';\n }\n}\n/** Thrown if a program state account does not contain valid data */\nexport class TokenInvalidAccountDataError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidAccountDataError';\n }\n}\n/** Thrown if a program state account is not owned by the expected token program */\nexport class TokenInvalidAccountOwnerError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidAccountOwnerError';\n }\n}\n/** Thrown if the byte length of an program state account doesn't match the expected size */\nexport class TokenInvalidAccountSizeError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidAccountSizeError';\n }\n}\n/** Thrown if the mint of a token account doesn't match the expected mint */\nexport class TokenInvalidMintError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidMintError';\n }\n}\n/** Thrown if the owner of a token account doesn't match the expected owner */\nexport class TokenInvalidOwnerError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidOwnerError';\n }\n}\n/** Thrown if the owner of a token account is a PDA (Program Derived Address) */\nexport class TokenOwnerOffCurveError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenOwnerOffCurveError';\n }\n}\n/** Thrown if an instruction's program is invalid */\nexport class TokenInvalidInstructionProgramError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidInstructionProgramError';\n }\n}\n/** Thrown if an instruction's keys are invalid */\nexport class TokenInvalidInstructionKeysError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidInstructionKeysError';\n }\n}\n/** Thrown if an instruction's data is invalid */\nexport class TokenInvalidInstructionDataError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidInstructionDataError';\n }\n}\n/** Thrown if an instruction's type is invalid */\nexport class TokenInvalidInstructionTypeError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenInvalidInstructionTypeError';\n }\n}\n/** Thrown if the program does not support the desired instruction */\nexport class TokenUnsupportedInstructionError extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenUnsupportedInstructionError';\n }\n}\n/** Thrown if the transfer hook extra accounts contains an invalid account index */\nexport class TokenTransferHookAccountNotFound extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenTransferHookAccountNotFound';\n }\n}\n/** Thrown if the transfer hook extra accounts contains an invalid seed */\nexport class TokenTransferHookInvalidSeed extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenTransferHookInvalidSeed';\n }\n}\n/** Thrown if account data required by an extra account meta seed config could not be fetched */\nexport class TokenTransferHookAccountDataNotFound extends TokenError {\n constructor() {\n super(...arguments);\n this.name = 'TokenTransferHookAccountDataNotFound';\n }\n}\n//# sourceMappingURL=errors.js.map","/** Instructions defined by the program */\nexport var TokenInstruction;\n(function (TokenInstruction) {\n TokenInstruction[TokenInstruction[\"InitializeMint\"] = 0] = \"InitializeMint\";\n TokenInstruction[TokenInstruction[\"InitializeAccount\"] = 1] = \"InitializeAccount\";\n TokenInstruction[TokenInstruction[\"InitializeMultisig\"] = 2] = \"InitializeMultisig\";\n TokenInstruction[TokenInstruction[\"Transfer\"] = 3] = \"Transfer\";\n TokenInstruction[TokenInstruction[\"Approve\"] = 4] = \"Approve\";\n TokenInstruction[TokenInstruction[\"Revoke\"] = 5] = \"Revoke\";\n TokenInstruction[TokenInstruction[\"SetAuthority\"] = 6] = \"SetAuthority\";\n TokenInstruction[TokenInstruction[\"MintTo\"] = 7] = \"MintTo\";\n TokenInstruction[TokenInstruction[\"Burn\"] = 8] = \"Burn\";\n TokenInstruction[TokenInstruction[\"CloseAccount\"] = 9] = \"CloseAccount\";\n TokenInstruction[TokenInstruction[\"FreezeAccount\"] = 10] = \"FreezeAccount\";\n TokenInstruction[TokenInstruction[\"ThawAccount\"] = 11] = \"ThawAccount\";\n TokenInstruction[TokenInstruction[\"TransferChecked\"] = 12] = \"TransferChecked\";\n TokenInstruction[TokenInstruction[\"ApproveChecked\"] = 13] = \"ApproveChecked\";\n TokenInstruction[TokenInstruction[\"MintToChecked\"] = 14] = \"MintToChecked\";\n TokenInstruction[TokenInstruction[\"BurnChecked\"] = 15] = \"BurnChecked\";\n TokenInstruction[TokenInstruction[\"InitializeAccount2\"] = 16] = \"InitializeAccount2\";\n TokenInstruction[TokenInstruction[\"SyncNative\"] = 17] = \"SyncNative\";\n TokenInstruction[TokenInstruction[\"InitializeAccount3\"] = 18] = \"InitializeAccount3\";\n TokenInstruction[TokenInstruction[\"InitializeMultisig2\"] = 19] = \"InitializeMultisig2\";\n TokenInstruction[TokenInstruction[\"InitializeMint2\"] = 20] = \"InitializeMint2\";\n TokenInstruction[TokenInstruction[\"GetAccountDataSize\"] = 21] = \"GetAccountDataSize\";\n TokenInstruction[TokenInstruction[\"InitializeImmutableOwner\"] = 22] = \"InitializeImmutableOwner\";\n TokenInstruction[TokenInstruction[\"AmountToUiAmount\"] = 23] = \"AmountToUiAmount\";\n TokenInstruction[TokenInstruction[\"UiAmountToAmount\"] = 24] = \"UiAmountToAmount\";\n TokenInstruction[TokenInstruction[\"InitializeMintCloseAuthority\"] = 25] = \"InitializeMintCloseAuthority\";\n TokenInstruction[TokenInstruction[\"TransferFeeExtension\"] = 26] = \"TransferFeeExtension\";\n TokenInstruction[TokenInstruction[\"ConfidentialTransferExtension\"] = 27] = \"ConfidentialTransferExtension\";\n TokenInstruction[TokenInstruction[\"DefaultAccountStateExtension\"] = 28] = \"DefaultAccountStateExtension\";\n TokenInstruction[TokenInstruction[\"Reallocate\"] = 29] = \"Reallocate\";\n TokenInstruction[TokenInstruction[\"MemoTransferExtension\"] = 30] = \"MemoTransferExtension\";\n TokenInstruction[TokenInstruction[\"CreateNativeMint\"] = 31] = \"CreateNativeMint\";\n TokenInstruction[TokenInstruction[\"InitializeNonTransferableMint\"] = 32] = \"InitializeNonTransferableMint\";\n TokenInstruction[TokenInstruction[\"InterestBearingMintExtension\"] = 33] = \"InterestBearingMintExtension\";\n TokenInstruction[TokenInstruction[\"CpiGuardExtension\"] = 34] = \"CpiGuardExtension\";\n TokenInstruction[TokenInstruction[\"InitializePermanentDelegate\"] = 35] = \"InitializePermanentDelegate\";\n TokenInstruction[TokenInstruction[\"TransferHookExtension\"] = 36] = \"TransferHookExtension\";\n // ConfidentialTransferFeeExtension = 37,\n // WithdrawalExcessLamports = 38,\n TokenInstruction[TokenInstruction[\"MetadataPointerExtension\"] = 39] = \"MetadataPointerExtension\";\n})(TokenInstruction || (TokenInstruction = {}));\n//# sourceMappingURL=types.js.map","import { PublicKey } from '@solana/web3.js';\n/** @internal */\nexport function addSigners(keys, ownerOrAuthority, multiSigners) {\n if (multiSigners.length) {\n keys.push({ pubkey: ownerOrAuthority, isSigner: false, isWritable: false });\n for (const signer of multiSigners) {\n keys.push({\n pubkey: signer instanceof PublicKey ? signer : signer.publicKey,\n isSigner: true,\n isWritable: false,\n });\n }\n }\n else {\n keys.push({ pubkey: ownerOrAuthority, isSigner: true, isWritable: false });\n }\n return keys;\n}\n//# sourceMappingURL=internal.js.map","import { struct, u32, u8 } from '@solana/buffer-layout';\nimport { bool, publicKey, u64 } from '@solana/buffer-layout-utils';\nimport { PublicKey } from '@solana/web3.js';\nimport { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenAccountNotFoundError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError, TokenInvalidMintError, TokenOwnerOffCurveError, } from '../errors.js';\nimport { ACCOUNT_TYPE_SIZE, AccountType } from '../extensions/accountType.js';\nimport { getMintLen } from '../extensions/extensionType.js';\nimport { ACCOUNT_SIZE } from './account.js';\nimport { MULTISIG_SIZE } from './multisig.js';\n/** Buffer layout for de/serializing a mint */\nexport const MintLayout = struct([\n u32('mintAuthorityOption'),\n publicKey('mintAuthority'),\n u64('supply'),\n u8('decimals'),\n bool('isInitialized'),\n u32('freezeAuthorityOption'),\n publicKey('freezeAuthority'),\n]);\n/** Byte length of a mint */\nexport const MINT_SIZE = MintLayout.span;\n/**\n * Retrieve information about a mint\n *\n * @param connection Connection to use\n * @param address Mint account\n * @param commitment Desired level of commitment for querying the state\n * @param programId SPL Token program account\n *\n * @return Mint information\n */\nexport async function getMint(connection, address, commitment, programId = TOKEN_PROGRAM_ID) {\n const info = await connection.getAccountInfo(address, commitment);\n return unpackMint(address, info, programId);\n}\n/**\n * Unpack a mint\n *\n * @param address Mint account\n * @param info Mint account data\n * @param programId SPL Token program account\n *\n * @return Unpacked mint\n */\nexport function unpackMint(address, info, programId = TOKEN_PROGRAM_ID) {\n if (!info)\n throw new TokenAccountNotFoundError();\n if (!info.owner.equals(programId))\n throw new TokenInvalidAccountOwnerError();\n if (info.data.length < MINT_SIZE)\n throw new TokenInvalidAccountSizeError();\n const rawMint = MintLayout.decode(info.data.slice(0, MINT_SIZE));\n let tlvData = Buffer.alloc(0);\n if (info.data.length > MINT_SIZE) {\n if (info.data.length <= ACCOUNT_SIZE)\n throw new TokenInvalidAccountSizeError();\n if (info.data.length === MULTISIG_SIZE)\n throw new TokenInvalidAccountSizeError();\n if (info.data[ACCOUNT_SIZE] != AccountType.Mint)\n throw new TokenInvalidMintError();\n tlvData = info.data.slice(ACCOUNT_SIZE + ACCOUNT_TYPE_SIZE);\n }\n return {\n address,\n mintAuthority: rawMint.mintAuthorityOption ? rawMint.mintAuthority : null,\n supply: rawMint.supply,\n decimals: rawMint.decimals,\n isInitialized: rawMint.isInitialized,\n freezeAuthority: rawMint.freezeAuthorityOption ? rawMint.freezeAuthority : null,\n tlvData,\n };\n}\n/** Get the minimum lamport balance for a mint to be rent exempt\n *\n * @param connection Connection to use\n * @param commitment Desired level of commitment for querying the state\n *\n * @return Amount of lamports required\n */\nexport async function getMinimumBalanceForRentExemptMint(connection, commitment) {\n return await getMinimumBalanceForRentExemptMintWithExtensions(connection, [], commitment);\n}\n/** Get the minimum lamport balance for a rent-exempt mint with extensions\n *\n * @param connection Connection to use\n * @param extensions Extension types included in the mint\n * @param commitment Desired level of commitment for querying the state\n *\n * @return Amount of lamports required\n */\nexport async function getMinimumBalanceForRentExemptMintWithExtensions(connection, extensions, commitment) {\n const mintLen = getMintLen(extensions);\n return await connection.getMinimumBalanceForRentExemption(mintLen, commitment);\n}\n/**\n * Async version of getAssociatedTokenAddressSync\n * For backwards compatibility\n *\n * @param mint Token mint account\n * @param owner Owner of the new account\n * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address)\n * @param programId SPL Token program account\n * @param associatedTokenProgramId SPL Associated Token program account\n *\n * @return Promise containing the address of the associated token account\n */\nexport async function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {\n if (!allowOwnerOffCurve && !PublicKey.isOnCurve(owner.toBuffer()))\n throw new TokenOwnerOffCurveError();\n const [address] = await PublicKey.findProgramAddress([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId);\n return address;\n}\n/**\n * Get the address of the associated token account for a given mint and owner\n *\n * @param mint Token mint account\n * @param owner Owner of the new account\n * @param allowOwnerOffCurve Allow the owner account to be a PDA (Program Derived Address)\n * @param programId SPL Token program account\n * @param associatedTokenProgramId SPL Associated Token program account\n *\n * @return Address of the associated token account\n */\nexport function getAssociatedTokenAddressSync(mint, owner, allowOwnerOffCurve = false, programId = TOKEN_PROGRAM_ID, associatedTokenProgramId = ASSOCIATED_TOKEN_PROGRAM_ID) {\n if (!allowOwnerOffCurve && !PublicKey.isOnCurve(owner.toBuffer()))\n throw new TokenOwnerOffCurveError();\n const [address] = PublicKey.findProgramAddressSync([owner.toBuffer(), programId.toBuffer(), mint.toBuffer()], associatedTokenProgramId);\n return address;\n}\n//# sourceMappingURL=mint.js.map","import { struct, u8 } from '@solana/buffer-layout';\nimport { u64 } from '@solana/buffer-layout-utils';\nimport { TransactionInstruction } from '@solana/web3.js';\nimport { TOKEN_PROGRAM_ID } from '../constants.js';\nimport { TokenInvalidInstructionDataError, TokenInvalidInstructionKeysError, TokenInvalidInstructionProgramError, TokenInvalidInstructionTypeError, } from '../errors.js';\nimport { addSigners } from './internal.js';\nimport { TokenInstruction } from './types.js';\n/** TODO: docs */\nexport const transferInstructionData = struct([u8('instruction'), u64('amount')]);\n/**\n * Construct a Transfer instruction\n *\n * @param source Source account\n * @param destination Destination account\n * @param owner Owner of the source account\n * @param amount Number of tokens to transfer\n * @param multiSigners Signing accounts if `owner` is a multisig\n * @param programId SPL Token program account\n *\n * @return Instruction to add to a transaction\n */\nexport function createTransferInstruction(source, destination, owner, amount, multiSigners = [], programId = TOKEN_PROGRAM_ID) {\n const keys = addSigners([\n { pubkey: source, isSigner: false, isWritable: true },\n { pubkey: destination, isSigner: false, isWritable: true },\n ], owner, multiSigners);\n const data = Buffer.alloc(transferInstructionData.span);\n transferInstructionData.encode({\n instruction: TokenInstruction.Transfer,\n amount: BigInt(amount),\n }, data);\n return new TransactionInstruction({ keys, programId, data });\n}\n/**\n * Decode a Transfer instruction and validate it\n *\n * @param instruction Transaction instruction to decode\n * @param programId SPL Token program account\n *\n * @return Decoded, valid instruction\n */\nexport function decodeTransferInstruction(instruction, programId = TOKEN_PROGRAM_ID) {\n if (!instruction.programId.equals(programId))\n throw new TokenInvalidInstructionProgramError();\n if (instruction.data.length !== transferInstructionData.span)\n throw new TokenInvalidInstructionDataError();\n const { keys: { source, destination, owner, multiSigners }, data, } = decodeTransferInstructionUnchecked(instruction);\n if (data.instruction !== TokenInstruction.Transfer)\n throw new TokenInvalidInstructionTypeError();\n if (!source || !destination || !owner)\n throw new TokenInvalidInstructionKeysError();\n // TODO: key checks?\n return {\n programId,\n keys: {\n source,\n destination,\n owner,\n multiSigners,\n },\n data,\n };\n}\n/**\n * Decode a Transfer instruction without validating it\n *\n * @param instruction Transaction instruction to decode\n *\n * @return Decoded, non-validated instruction\n */\nexport function decodeTransferInstructionUnchecked({ programId, keys: [source, destination, owner, ...multiSigners], data, }) {\n return {\n programId,\n keys: {\n source,\n destination,\n owner,\n multiSigners,\n },\n data: transferInstructionData.decode(data),\n };\n}\n//# sourceMappingURL=transfer.js.map"],"names":["TOKEN_PROGRAM_ID","PublicKey","ASSOCIATED_TOKEN_PROGRAM_ID","encodeDecode","layout","decode","encode","browser","toBigIntLE","buf","reversed","Buffer","hex","toBigIntBE","toBufferLE","num","width","buffer","toBufferBE","bigInt","length","property","blob","bigIntLayout","offset","src","u64","bool","u8","boolLayout","publicKey","publicKeyLayout","TokenError","message","TokenOwnerOffCurveError","TokenInstruction","addSigners","keys","ownerOrAuthority","multiSigners","signer","MintLayout","struct","u32","getAssociatedTokenAddress","mint","owner","allowOwnerOffCurve","programId","associatedTokenProgramId","address","transferInstructionData","createTransferInstruction","source","destination","amount","data","TransactionInstruction"],"mappings":";;AAEY,MAACA,IAAmB,IAAIC,EAAU,6CAA6C;AAEtD,IAAIA,EAAU,6CAA6C;AAEpF,MAACC,IAA8B,IAAID,EAAU,8CAA8C;AAE5E,IAAIA,EAAU,6CAA6C;AAEtD,IAAIA,EAAU,8CAA8C;ACVrF,MAAME,IAAe,CAACC,MAAW;AACpC,QAAMC,IAASD,EAAO,OAAO,KAAKA,CAAM,GAClCE,IAASF,EAAO,OAAO,KAAKA,CAAM;AACxC,SAAO,EAAE,QAAAC,GAAQ,QAAAC,EAAM;AAC3B;;;;SCFA,OAAO,eAAeC,GAAS,cAAc,EAAE,OAAO,IAAM;AAO5D,WAASC,EAAWC,GAAK;AACrB;AACI,YAAMC,IAAWC,EAAO,KAAKF,CAAG;AAChC,MAAAC,EAAS,QAAO;AAChB,YAAME,IAAMF,EAAS,SAAS,KAAK;AACnC,aAAIE,EAAI,WAAW,IACR,OAAO,CAAC,IAEZ,OAAO,KAAKA,CAAG,EAAE;AAAA,IAChC;AAAA,EAEA;AACA,EAAA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