@trustware/sdk-staging 1.1.8-staging.3 → 1.1.8-staging.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/blockchain-BONedEsU.d.cts +110 -0
- package/dist/blockchain-BONedEsU.d.ts +110 -0
- package/dist/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/{core-u95iahDO.d.cts → core-BcoaMbJ6.d.cts} +3 -2
- package/dist/{core-CVbN3gJy.d.ts → core-BqqBQ5nF.d.ts} +3 -2
- package/dist/core.cjs +2290 -2247
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +4 -3
- package/dist/core.d.ts +4 -3
- package/dist/core.mjs +2277 -2244
- package/dist/core.mjs.map +1 -1
- package/dist/{detect-6MRR4B7g.d.ts → detect-F6garpnf.d.ts} +2 -2
- package/dist/{detect-DVIWcXpl.d.cts → detect-srLQtIzU.d.cts} +2 -2
- package/dist/index.cjs +22382 -3552
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -10
- package/dist/index.d.ts +28 -10
- package/dist/index.mjs +28327 -9497
- package/dist/index.mjs.map +1 -1
- package/dist/{manager-CXSw1h5e.d.cts → manager-BWmNEeZb.d.cts} +72 -121
- package/dist/{manager-CXSw1h5e.d.ts → manager-BojJyYIt.d.ts} +72 -121
- package/dist/smart-account.cjs +14707 -0
- package/dist/smart-account.cjs.map +1 -0
- package/dist/smart-account.d.cts +3962 -0
- package/dist/smart-account.d.ts +3962 -0
- package/dist/smart-account.mjs +14686 -0
- package/dist/smart-account.mjs.map +1 -0
- package/dist/types-B3nKHW6H.d.cts +32 -0
- package/dist/types-MtdjJgwT.d.ts +32 -0
- package/dist/wallet.cjs +29 -9
- package/dist/wallet.cjs.map +1 -1
- package/dist/wallet.d.cts +4 -3
- package/dist/wallet.d.ts +4 -3
- package/dist/wallet.mjs +16 -6
- package/dist/wallet.mjs.map +1 -1
- package/dist/widget.cjs +33067 -14246
- package/dist/widget.cjs.map +1 -1
- package/dist/widget.d.cts +5 -4
- package/dist/widget.d.ts +5 -4
- package/dist/widget.mjs +33007 -14182
- package/dist/widget.mjs.map +1 -1
- package/package.json +17 -4
- package/dist/types-BrVfNxND.d.cts +0 -14
- package/dist/types-BrVfNxND.d.ts +0 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/@aa-sdk/core/src/abis/EntryPointAbi_v6.ts","../node_modules/@aa-sdk/core/src/abis/EntryPointAbi_v7.ts","../node_modules/@aa-sdk/core/src/version.ts","../node_modules/@aa-sdk/core/src/errors/base.ts","../node_modules/@aa-sdk/core/src/errors/client.ts","../node_modules/@aa-sdk/core/src/utils/stateOverride.ts","../node_modules/@aa-sdk/core/src/actions/bundler/estimateUserOperationGas.ts","../node_modules/@aa-sdk/core/src/actions/bundler/getSupportedEntryPoints.ts","../node_modules/@aa-sdk/core/src/actions/bundler/getUserOperationByHash.ts","../node_modules/@aa-sdk/core/src/actions/bundler/getUserOperationReceipt.ts","../node_modules/@aa-sdk/core/src/actions/bundler/sendRawUserOperation.ts","../node_modules/@aa-sdk/core/src/client/decorators/bundlerClient.ts","../node_modules/@aa-sdk/core/src/client/bundlerClient.ts","../node_modules/@aa-sdk/core/src/errors/account.ts","../node_modules/@aa-sdk/core/src/errors/entrypoint.ts","../node_modules/@aa-sdk/core/src/logger.ts","../node_modules/@aa-sdk/core/src/signer/utils.ts","../node_modules/@aa-sdk/core/src/account/smartContractAccount.ts","../node_modules/@aa-sdk/core/src/errors/transaction.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/buildUserOperationFromTx.ts","../node_modules/zod/v3/helpers/util.js","../node_modules/zod/v3/ZodError.js","../node_modules/zod/v3/locales/en.js","../node_modules/zod/v3/errors.js","../node_modules/zod/v3/helpers/parseUtil.js","../node_modules/zod/v3/helpers/typeAliases.js","../node_modules/zod/v3/helpers/errorUtil.js","../node_modules/zod/v3/types.js","../node_modules/zod/v3/external.js","../node_modules/zod/index.js","../node_modules/@aa-sdk/core/src/utils/schema.ts","../node_modules/@aa-sdk/core/src/utils/bigint.ts","../node_modules/@aa-sdk/core/src/utils/bytes.ts","../node_modules/@aa-sdk/core/src/utils/defaults.ts","../node_modules/@aa-sdk/core/src/utils/userop.ts","../node_modules/@aa-sdk/core/src/utils/index.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/buildUserOperationFromTxs.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/checkGasSponsorshipEligibility.ts","../node_modules/@aa-sdk/core/src/middleware/noopMiddleware.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/internal/runMiddlewareStack.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/signUserOperation.ts","../node_modules/@aa-sdk/core/src/entrypoint/0.7.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/getUserOperationError.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/internal/sendUserOperation.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/dropAndReplaceUserOperation.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/getAddress.ts","../node_modules/@aa-sdk/core/src/errors/useroperation.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/waitForUserOperationTransacation.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/sendTransaction.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/sendTransactions.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/sendUserOperation.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/signMessage.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/signTypedData.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/upgradeAccount.ts","../node_modules/@aa-sdk/core/src/client/decorators/smartAccountClient.ts","../node_modules/@aa-sdk/core/src/client/isSmartAccountClient.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/internal/initUserOperation.ts","../node_modules/@aa-sdk/core/src/client/addBreadcrumb.ts","../node_modules/@aa-sdk/core/src/actions/smartAccount/buildUserOperation.ts","../node_modules/@aa-sdk/core/src/client/schema.ts","../node_modules/@aa-sdk/core/src/middleware/defaults/feeEstimator.ts","../node_modules/@aa-sdk/core/src/middleware/defaults/gasEstimator.ts","../node_modules/@aa-sdk/core/src/middleware/defaults/paymasterAndData.ts","../node_modules/@aa-sdk/core/src/middleware/defaults/userOpSigner.ts","../node_modules/@aa-sdk/core/src/middleware/actions.ts","../node_modules/@aa-sdk/core/src/client/smartAccountClient.ts","../node_modules/@aa-sdk/core/src/entrypoint/0.6.ts","../node_modules/@aa-sdk/core/src/entrypoint/index.ts","../node_modules/@aa-sdk/core/src/errors/signer.ts","../node_modules/@aa-sdk/core/src/middleware/erc7677middleware.ts","../node_modules/@aa-sdk/core/src/signer/wallet-client.ts","../node_modules/@aa-sdk/core/src/transport/split.ts","../node_modules/@aa-sdk/core/src/utils/traceHeader.ts","../node_modules/@aa-sdk/core/src/index.ts","../node_modules/@account-kit/smart-contracts/src/light-account/abis/LightAccountAbi_v1.ts","../node_modules/@account-kit/smart-contracts/src/light-account/abis/LightAccountAbi_v2.ts","../node_modules/@account-kit/smart-contracts/src/light-account/abis/LightAccountFactoryAbi_v1.ts","../node_modules/@account-kit/smart-contracts/src/light-account/abis/LightAccountFactoryAbi_v2.ts","../node_modules/@account-kit/smart-contracts/src/light-account/utils.ts","../node_modules/@account-kit/smart-contracts/src/light-account/accounts/base.ts","../node_modules/@account-kit/smart-contracts/src/light-account/abis/OZ_ERC1967Proxy.ts","../node_modules/@account-kit/smart-contracts/src/light-account/accounts/predictAddress.ts","../node_modules/@account-kit/smart-contracts/src/light-account/accounts/account.ts","../node_modules/@account-kit/smart-contracts/src/light-account/actions/transferOwnership.ts","../node_modules/@account-kit/infra/src/client/isAlchemySmartAccountClient.ts","../node_modules/@account-kit/infra/src/actions/simulateUserOperationChanges.ts","../node_modules/@account-kit/infra/src/alchemyTrackerHeaders.ts","../node_modules/@account-kit/infra/src/schema.ts","../node_modules/@account-kit/infra/src/version.ts","../node_modules/@account-kit/infra/src/alchemyTransport.ts","../node_modules/@account-kit/infra/src/chains.ts","../node_modules/@account-kit/logging/src/noop.ts","../node_modules/@account-kit/logging/src/index.ts","../node_modules/@account-kit/infra/src/metrics.ts","../node_modules/@account-kit/infra/src/client/decorators/smartAccount.ts","../node_modules/@account-kit/infra/src/defaults.ts","../node_modules/@account-kit/infra/src/middleware/feeEstimator.ts","../node_modules/@account-kit/infra/src/gas-manager.ts","../node_modules/@account-kit/infra/src/errors/base.ts","../node_modules/@account-kit/infra/src/errors/invalidSignedPermit.ts","../node_modules/@account-kit/infra/src/middleware/gasManager.ts","../node_modules/@account-kit/infra/src/middleware/userOperationSimulator.ts","../node_modules/@account-kit/infra/src/client/smartAccountClient.ts","../node_modules/@account-kit/infra/src/exports/index.ts","../node_modules/@account-kit/smart-contracts/src/light-account/decorators/lightAccount.ts","../node_modules/@account-kit/smart-contracts/src/light-account/clients/client.ts","../node_modules/@account-kit/smart-contracts/src/index.ts","../src/constants.ts","../src/config/defaults.ts","../src/types/config.ts","../src/config/store.ts","../node_modules/@solana/errors/src/codes.ts","../node_modules/@solana/errors/src/context.ts","../node_modules/@solana/errors/src/messages.ts","../node_modules/@solana/errors/src/message-formatter.ts","../node_modules/@solana/errors/src/error.ts","../node_modules/@solana/errors/src/stack-trace.ts","../node_modules/@solana/errors/src/rpc-enum-errors.ts","../node_modules/@solana/errors/src/instruction-error.ts","../node_modules/@solana/errors/src/transaction-error.ts","../node_modules/@solana/errors/src/json-rpc-error.ts","../node_modules/@solana/errors/src/simulation-errors.ts","../node_modules/@solana/codecs-core/src/bytes.ts","../node_modules/@solana/codecs-core/src/codec.ts","../node_modules/@solana/codecs-core/src/combine-codec.ts","../node_modules/@solana/codecs-core/src/add-codec-sentinel.ts","../node_modules/@solana/codecs-core/src/assertions.ts","../node_modules/@solana/codecs-core/src/add-codec-size-prefix.ts","../node_modules/@solana/codecs-core/src/array-buffers.ts","../node_modules/@solana/codecs-core/src/decoder-entire-byte-array.ts","../node_modules/@solana/codecs-core/src/fix-codec-size.ts","../node_modules/@solana/codecs-core/src/offset-codec.ts","../node_modules/@solana/codecs-core/src/resize-codec.ts","../node_modules/@solana/codecs-core/src/pad-codec.ts","../node_modules/@solana/codecs-core/src/reverse-codec.ts","../node_modules/@solana/codecs-core/src/transform-codec.ts","../node_modules/@solana/codecs-strings/src/assertions.ts","../node_modules/@solana/codecs-strings/src/baseX.ts","../node_modules/@solana/codecs-strings/src/base10.ts","../node_modules/@solana/codecs-strings/src/base16.ts","../node_modules/@solana/codecs-strings/src/base58.ts","../node_modules/@solana/codecs-strings/src/baseX-reslice.ts","../node_modules/@solana/codecs-strings/src/base64.ts","../node_modules/@solana/codecs-strings/src/null-characters.ts","../node_modules/@solana/text-encoding-impl/src/index.node.ts","../node_modules/@solana/codecs-strings/src/utf8.ts","../node_modules/@solana/addresses/src/address.ts","../node_modules/@solana/addresses/src/vendor/noble/ed25519.ts","../node_modules/@solana/addresses/src/curve-internal.ts","../node_modules/@solana/addresses/src/curve.ts","../node_modules/@solana/addresses/src/program-derived-address.ts","../node_modules/@solana/addresses/src/public-key.ts","../src/utils/chains.ts","../src/validation/address.ts","../src/identity/index.ts","../src/core/routes.ts","../src/types/routes.ts","../src/types/wallets.ts","../src/types/theme.ts","../src/types/blockchain.ts","../src/types/identity.ts","../src/types/index.ts","../src/index.ts","../src/config/merge.ts","../src/config/index.ts","../src/core/http.ts","../src/smart-account/client.ts","../src/smart-account/fee-utils.ts","../src/smart-account/permit2.ts","../src/smart-account/uniswap.ts","../src/smart-account/send.ts","../src/smart-account/index.ts","../src/smart-account.ts"],"sourcesContent":["export const EntryPointAbi_v6 = [\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"preOpGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"paid\",\n type: \"uint256\",\n },\n {\n internalType: \"uint48\",\n name: \"validAfter\",\n type: \"uint48\",\n },\n {\n internalType: \"uint48\",\n name: \"validUntil\",\n type: \"uint48\",\n },\n {\n internalType: \"bool\",\n name: \"targetSuccess\",\n type: \"bool\",\n },\n {\n internalType: \"bytes\",\n name: \"targetResult\",\n type: \"bytes\",\n },\n ],\n name: \"ExecutionResult\",\n type: \"error\",\n },\n {\n inputs: [\n {\n internalType: \"uint256\",\n name: \"opIndex\",\n type: \"uint256\",\n },\n {\n internalType: \"string\",\n name: \"reason\",\n type: \"string\",\n },\n ],\n name: \"FailedOp\",\n type: \"error\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n ],\n name: \"SenderAddressResult\",\n type: \"error\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"aggregator\",\n type: \"address\",\n },\n ],\n name: \"SignatureValidationFailed\",\n type: \"error\",\n },\n {\n inputs: [\n {\n components: [\n {\n internalType: \"uint256\",\n name: \"preOpGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"prefund\",\n type: \"uint256\",\n },\n {\n internalType: \"bool\",\n name: \"sigFailed\",\n type: \"bool\",\n },\n {\n internalType: \"uint48\",\n name: \"validAfter\",\n type: \"uint48\",\n },\n {\n internalType: \"uint48\",\n name: \"validUntil\",\n type: \"uint48\",\n },\n {\n internalType: \"bytes\",\n name: \"paymasterContext\",\n type: \"bytes\",\n },\n ],\n internalType: \"struct IEntryPoint.ReturnInfo\",\n name: \"returnInfo\",\n type: \"tuple\",\n },\n {\n components: [\n {\n internalType: \"uint256\",\n name: \"stake\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"unstakeDelaySec\",\n type: \"uint256\",\n },\n ],\n internalType: \"struct IStakeManager.StakeInfo\",\n name: \"senderInfo\",\n type: \"tuple\",\n },\n {\n components: [\n {\n internalType: \"uint256\",\n name: \"stake\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"unstakeDelaySec\",\n type: \"uint256\",\n },\n ],\n internalType: \"struct IStakeManager.StakeInfo\",\n name: \"factoryInfo\",\n type: \"tuple\",\n },\n {\n components: [\n {\n internalType: \"uint256\",\n name: \"stake\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"unstakeDelaySec\",\n type: \"uint256\",\n },\n ],\n internalType: \"struct IStakeManager.StakeInfo\",\n name: \"paymasterInfo\",\n type: \"tuple\",\n },\n ],\n name: \"ValidationResult\",\n type: \"error\",\n },\n {\n inputs: [\n {\n components: [\n {\n internalType: \"uint256\",\n name: \"preOpGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"prefund\",\n type: \"uint256\",\n },\n {\n internalType: \"bool\",\n name: \"sigFailed\",\n type: \"bool\",\n },\n {\n internalType: \"uint48\",\n name: \"validAfter\",\n type: \"uint48\",\n },\n {\n internalType: \"uint48\",\n name: \"validUntil\",\n type: \"uint48\",\n },\n {\n internalType: \"bytes\",\n name: \"paymasterContext\",\n type: \"bytes\",\n },\n ],\n internalType: \"struct IEntryPoint.ReturnInfo\",\n name: \"returnInfo\",\n type: \"tuple\",\n },\n {\n components: [\n {\n internalType: \"uint256\",\n name: \"stake\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"unstakeDelaySec\",\n type: \"uint256\",\n },\n ],\n internalType: \"struct IStakeManager.StakeInfo\",\n name: \"senderInfo\",\n type: \"tuple\",\n },\n {\n components: [\n {\n internalType: \"uint256\",\n name: \"stake\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"unstakeDelaySec\",\n type: \"uint256\",\n },\n ],\n internalType: \"struct IStakeManager.StakeInfo\",\n name: \"factoryInfo\",\n type: \"tuple\",\n },\n {\n components: [\n {\n internalType: \"uint256\",\n name: \"stake\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"unstakeDelaySec\",\n type: \"uint256\",\n },\n ],\n internalType: \"struct IStakeManager.StakeInfo\",\n name: \"paymasterInfo\",\n type: \"tuple\",\n },\n {\n components: [\n {\n internalType: \"address\",\n name: \"aggregator\",\n type: \"address\",\n },\n {\n components: [\n {\n internalType: \"uint256\",\n name: \"stake\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"unstakeDelaySec\",\n type: \"uint256\",\n },\n ],\n internalType: \"struct IStakeManager.StakeInfo\",\n name: \"stakeInfo\",\n type: \"tuple\",\n },\n ],\n internalType: \"struct IEntryPoint.AggregatorStakeInfo\",\n name: \"aggregatorInfo\",\n type: \"tuple\",\n },\n ],\n name: \"ValidationResultWithAggregation\",\n type: \"error\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"bytes32\",\n name: \"userOpHash\",\n type: \"bytes32\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"factory\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"paymaster\",\n type: \"address\",\n },\n ],\n name: \"AccountDeployed\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [],\n name: \"BeforeExecution\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"totalDeposit\",\n type: \"uint256\",\n },\n ],\n name: \"Deposited\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"aggregator\",\n type: \"address\",\n },\n ],\n name: \"SignatureAggregatorChanged\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"totalStaked\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"unstakeDelaySec\",\n type: \"uint256\",\n },\n ],\n name: \"StakeLocked\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"withdrawTime\",\n type: \"uint256\",\n },\n ],\n name: \"StakeUnlocked\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"withdrawAddress\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"StakeWithdrawn\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"bytes32\",\n name: \"userOpHash\",\n type: \"bytes32\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"paymaster\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"bool\",\n name: \"success\",\n type: \"bool\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"actualGasCost\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"actualGasUsed\",\n type: \"uint256\",\n },\n ],\n name: \"UserOperationEvent\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"bytes32\",\n name: \"userOpHash\",\n type: \"bytes32\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"bytes\",\n name: \"revertReason\",\n type: \"bytes\",\n },\n ],\n name: \"UserOperationRevertReason\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"withdrawAddress\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"Withdrawn\",\n type: \"event\",\n },\n {\n inputs: [],\n name: \"SIG_VALIDATION_FAILED\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"bytes\",\n name: \"initCode\",\n type: \"bytes\",\n },\n {\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n internalType: \"bytes\",\n name: \"paymasterAndData\",\n type: \"bytes\",\n },\n ],\n name: \"_validateSenderAndPaymaster\",\n outputs: [],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint32\",\n name: \"unstakeDelaySec\",\n type: \"uint32\",\n },\n ],\n name: \"addStake\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n ],\n name: \"balanceOf\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n ],\n name: \"depositTo\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"\",\n type: \"address\",\n },\n ],\n name: \"deposits\",\n outputs: [\n {\n internalType: \"uint112\",\n name: \"deposit\",\n type: \"uint112\",\n },\n {\n internalType: \"bool\",\n name: \"staked\",\n type: \"bool\",\n },\n {\n internalType: \"uint112\",\n name: \"stake\",\n type: \"uint112\",\n },\n {\n internalType: \"uint32\",\n name: \"unstakeDelaySec\",\n type: \"uint32\",\n },\n {\n internalType: \"uint48\",\n name: \"withdrawTime\",\n type: \"uint48\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n ],\n name: \"getDepositInfo\",\n outputs: [\n {\n components: [\n {\n internalType: \"uint112\",\n name: \"deposit\",\n type: \"uint112\",\n },\n {\n internalType: \"bool\",\n name: \"staked\",\n type: \"bool\",\n },\n {\n internalType: \"uint112\",\n name: \"stake\",\n type: \"uint112\",\n },\n {\n internalType: \"uint32\",\n name: \"unstakeDelaySec\",\n type: \"uint32\",\n },\n {\n internalType: \"uint48\",\n name: \"withdrawTime\",\n type: \"uint48\",\n },\n ],\n internalType: \"struct IStakeManager.DepositInfo\",\n name: \"info\",\n type: \"tuple\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n internalType: \"uint192\",\n name: \"key\",\n type: \"uint192\",\n },\n ],\n name: \"getNonce\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"bytes\",\n name: \"initCode\",\n type: \"bytes\",\n },\n ],\n name: \"getSenderAddress\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n {\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"initCode\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"callData\",\n type: \"bytes\",\n },\n {\n internalType: \"uint256\",\n name: \"callGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"verificationGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"maxFeePerGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"maxPriorityFeePerGas\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"paymasterAndData\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"signature\",\n type: \"bytes\",\n },\n ],\n internalType: \"struct UserOperation\",\n name: \"userOp\",\n type: \"tuple\",\n },\n ],\n name: \"getUserOpHash\",\n outputs: [\n {\n internalType: \"bytes32\",\n name: \"\",\n type: \"bytes32\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n {\n components: [\n {\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"initCode\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"callData\",\n type: \"bytes\",\n },\n {\n internalType: \"uint256\",\n name: \"callGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"verificationGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"maxFeePerGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"maxPriorityFeePerGas\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"paymasterAndData\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"signature\",\n type: \"bytes\",\n },\n ],\n internalType: \"struct UserOperation[]\",\n name: \"userOps\",\n type: \"tuple[]\",\n },\n {\n internalType: \"contract IAggregator\",\n name: \"aggregator\",\n type: \"address\",\n },\n {\n internalType: \"bytes\",\n name: \"signature\",\n type: \"bytes\",\n },\n ],\n internalType: \"struct IEntryPoint.UserOpsPerAggregator[]\",\n name: \"opsPerAggregator\",\n type: \"tuple[]\",\n },\n {\n internalType: \"address payable\",\n name: \"beneficiary\",\n type: \"address\",\n },\n ],\n name: \"handleAggregatedOps\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n {\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"initCode\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"callData\",\n type: \"bytes\",\n },\n {\n internalType: \"uint256\",\n name: \"callGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"verificationGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"maxFeePerGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"maxPriorityFeePerGas\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"paymasterAndData\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"signature\",\n type: \"bytes\",\n },\n ],\n internalType: \"struct UserOperation[]\",\n name: \"ops\",\n type: \"tuple[]\",\n },\n {\n internalType: \"address payable\",\n name: \"beneficiary\",\n type: \"address\",\n },\n ],\n name: \"handleOps\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"uint192\",\n name: \"key\",\n type: \"uint192\",\n },\n ],\n name: \"incrementNonce\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"bytes\",\n name: \"callData\",\n type: \"bytes\",\n },\n {\n components: [\n {\n components: [\n {\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"callGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"verificationGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n {\n internalType: \"address\",\n name: \"paymaster\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"maxFeePerGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"maxPriorityFeePerGas\",\n type: \"uint256\",\n },\n ],\n internalType: \"struct EntryPoint.MemoryUserOp\",\n name: \"mUserOp\",\n type: \"tuple\",\n },\n {\n internalType: \"bytes32\",\n name: \"userOpHash\",\n type: \"bytes32\",\n },\n {\n internalType: \"uint256\",\n name: \"prefund\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"contextOffset\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"preOpGas\",\n type: \"uint256\",\n },\n ],\n internalType: \"struct EntryPoint.UserOpInfo\",\n name: \"opInfo\",\n type: \"tuple\",\n },\n {\n internalType: \"bytes\",\n name: \"context\",\n type: \"bytes\",\n },\n ],\n name: \"innerHandleOp\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"actualGasCost\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"\",\n type: \"address\",\n },\n {\n internalType: \"uint192\",\n name: \"\",\n type: \"uint192\",\n },\n ],\n name: \"nonceSequenceNumber\",\n outputs: [\n {\n internalType: \"uint256\",\n name: \"\",\n type: \"uint256\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n {\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"initCode\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"callData\",\n type: \"bytes\",\n },\n {\n internalType: \"uint256\",\n name: \"callGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"verificationGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"maxFeePerGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"maxPriorityFeePerGas\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"paymasterAndData\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"signature\",\n type: \"bytes\",\n },\n ],\n internalType: \"struct UserOperation\",\n name: \"op\",\n type: \"tuple\",\n },\n {\n internalType: \"address\",\n name: \"target\",\n type: \"address\",\n },\n {\n internalType: \"bytes\",\n name: \"targetCallData\",\n type: \"bytes\",\n },\n ],\n name: \"simulateHandleOp\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n {\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"initCode\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"callData\",\n type: \"bytes\",\n },\n {\n internalType: \"uint256\",\n name: \"callGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"verificationGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"maxFeePerGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"maxPriorityFeePerGas\",\n type: \"uint256\",\n },\n {\n internalType: \"bytes\",\n name: \"paymasterAndData\",\n type: \"bytes\",\n },\n {\n internalType: \"bytes\",\n name: \"signature\",\n type: \"bytes\",\n },\n ],\n internalType: \"struct UserOperation\",\n name: \"userOp\",\n type: \"tuple\",\n },\n ],\n name: \"simulateValidation\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"unlockStake\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address payable\",\n name: \"withdrawAddress\",\n type: \"address\",\n },\n ],\n name: \"withdrawStake\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address payable\",\n name: \"withdrawAddress\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"withdrawAmount\",\n type: \"uint256\",\n },\n ],\n name: \"withdrawTo\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n stateMutability: \"payable\",\n type: \"receive\",\n },\n] as const;\n","// https://etherscan.io/address/0x0000000071727de22e5e9d8baf0edac6f37da032\nexport const EntryPointAbi_v7 = [\n {\n inputs: [\n { internalType: \"bool\", name: \"success\", type: \"bool\" },\n { internalType: \"bytes\", name: \"ret\", type: \"bytes\" },\n ],\n name: \"DelegateAndRevert\",\n type: \"error\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"opIndex\", type: \"uint256\" },\n { internalType: \"string\", name: \"reason\", type: \"string\" },\n ],\n name: \"FailedOp\",\n type: \"error\",\n },\n {\n inputs: [\n { internalType: \"uint256\", name: \"opIndex\", type: \"uint256\" },\n { internalType: \"string\", name: \"reason\", type: \"string\" },\n { internalType: \"bytes\", name: \"inner\", type: \"bytes\" },\n ],\n name: \"FailedOpWithRevert\",\n type: \"error\",\n },\n {\n inputs: [{ internalType: \"bytes\", name: \"returnData\", type: \"bytes\" }],\n name: \"PostOpReverted\",\n type: \"error\",\n },\n { inputs: [], name: \"ReentrancyGuardReentrantCall\", type: \"error\" },\n {\n inputs: [{ internalType: \"address\", name: \"sender\", type: \"address\" }],\n name: \"SenderAddressResult\",\n type: \"error\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"aggregator\", type: \"address\" }],\n name: \"SignatureValidationFailed\",\n type: \"error\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"bytes32\",\n name: \"userOpHash\",\n type: \"bytes32\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"factory\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"paymaster\",\n type: \"address\",\n },\n ],\n name: \"AccountDeployed\",\n type: \"event\",\n },\n { anonymous: false, inputs: [], name: \"BeforeExecution\", type: \"event\" },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"totalDeposit\",\n type: \"uint256\",\n },\n ],\n name: \"Deposited\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"bytes32\",\n name: \"userOpHash\",\n type: \"bytes32\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"bytes\",\n name: \"revertReason\",\n type: \"bytes\",\n },\n ],\n name: \"PostOpRevertReason\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"aggregator\",\n type: \"address\",\n },\n ],\n name: \"SignatureAggregatorChanged\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"totalStaked\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"unstakeDelaySec\",\n type: \"uint256\",\n },\n ],\n name: \"StakeLocked\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"withdrawTime\",\n type: \"uint256\",\n },\n ],\n name: \"StakeUnlocked\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"withdrawAddress\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"StakeWithdrawn\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"bytes32\",\n name: \"userOpHash\",\n type: \"bytes32\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"paymaster\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n { indexed: false, internalType: \"bool\", name: \"success\", type: \"bool\" },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"actualGasCost\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"actualGasUsed\",\n type: \"uint256\",\n },\n ],\n name: \"UserOperationEvent\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"bytes32\",\n name: \"userOpHash\",\n type: \"bytes32\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n ],\n name: \"UserOperationPrefundTooLow\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"bytes32\",\n name: \"userOpHash\",\n type: \"bytes32\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"sender\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"nonce\",\n type: \"uint256\",\n },\n {\n indexed: false,\n internalType: \"bytes\",\n name: \"revertReason\",\n type: \"bytes\",\n },\n ],\n name: \"UserOperationRevertReason\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"account\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"withdrawAddress\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"uint256\",\n name: \"amount\",\n type: \"uint256\",\n },\n ],\n name: \"Withdrawn\",\n type: \"event\",\n },\n {\n inputs: [\n { internalType: \"uint32\", name: \"unstakeDelaySec\", type: \"uint32\" },\n ],\n name: \"addStake\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"balanceOf\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"target\", type: \"address\" },\n { internalType: \"bytes\", name: \"data\", type: \"bytes\" },\n ],\n name: \"delegateAndRevert\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"depositTo\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"\", type: \"address\" }],\n name: \"deposits\",\n outputs: [\n { internalType: \"uint256\", name: \"deposit\", type: \"uint256\" },\n { internalType: \"bool\", name: \"staked\", type: \"bool\" },\n { internalType: \"uint112\", name: \"stake\", type: \"uint112\" },\n { internalType: \"uint32\", name: \"unstakeDelaySec\", type: \"uint32\" },\n { internalType: \"uint48\", name: \"withdrawTime\", type: \"uint48\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"account\", type: \"address\" }],\n name: \"getDepositInfo\",\n outputs: [\n {\n components: [\n { internalType: \"uint256\", name: \"deposit\", type: \"uint256\" },\n { internalType: \"bool\", name: \"staked\", type: \"bool\" },\n { internalType: \"uint112\", name: \"stake\", type: \"uint112\" },\n { internalType: \"uint32\", name: \"unstakeDelaySec\", type: \"uint32\" },\n { internalType: \"uint48\", name: \"withdrawTime\", type: \"uint48\" },\n ],\n internalType: \"struct IStakeManager.DepositInfo\",\n name: \"info\",\n type: \"tuple\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"sender\", type: \"address\" },\n { internalType: \"uint192\", name: \"key\", type: \"uint192\" },\n ],\n name: \"getNonce\",\n outputs: [{ internalType: \"uint256\", name: \"nonce\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"bytes\", name: \"initCode\", type: \"bytes\" }],\n name: \"getSenderAddress\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n { internalType: \"address\", name: \"sender\", type: \"address\" },\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n { internalType: \"bytes\", name: \"initCode\", type: \"bytes\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n {\n internalType: \"bytes32\",\n name: \"accountGasLimits\",\n type: \"bytes32\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n { internalType: \"bytes32\", name: \"gasFees\", type: \"bytes32\" },\n { internalType: \"bytes\", name: \"paymasterAndData\", type: \"bytes\" },\n { internalType: \"bytes\", name: \"signature\", type: \"bytes\" },\n ],\n internalType: \"struct PackedUserOperation\",\n name: \"userOp\",\n type: \"tuple\",\n },\n ],\n name: \"getUserOpHash\",\n outputs: [{ internalType: \"bytes32\", name: \"\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n {\n components: [\n { internalType: \"address\", name: \"sender\", type: \"address\" },\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n { internalType: \"bytes\", name: \"initCode\", type: \"bytes\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n {\n internalType: \"bytes32\",\n name: \"accountGasLimits\",\n type: \"bytes32\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n { internalType: \"bytes32\", name: \"gasFees\", type: \"bytes32\" },\n {\n internalType: \"bytes\",\n name: \"paymasterAndData\",\n type: \"bytes\",\n },\n { internalType: \"bytes\", name: \"signature\", type: \"bytes\" },\n ],\n internalType: \"struct PackedUserOperation[]\",\n name: \"userOps\",\n type: \"tuple[]\",\n },\n {\n internalType: \"contract IAggregator\",\n name: \"aggregator\",\n type: \"address\",\n },\n { internalType: \"bytes\", name: \"signature\", type: \"bytes\" },\n ],\n internalType: \"struct IEntryPoint.UserOpsPerAggregator[]\",\n name: \"opsPerAggregator\",\n type: \"tuple[]\",\n },\n { internalType: \"address payable\", name: \"beneficiary\", type: \"address\" },\n ],\n name: \"handleAggregatedOps\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n { internalType: \"address\", name: \"sender\", type: \"address\" },\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n { internalType: \"bytes\", name: \"initCode\", type: \"bytes\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n {\n internalType: \"bytes32\",\n name: \"accountGasLimits\",\n type: \"bytes32\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n { internalType: \"bytes32\", name: \"gasFees\", type: \"bytes32\" },\n { internalType: \"bytes\", name: \"paymasterAndData\", type: \"bytes\" },\n { internalType: \"bytes\", name: \"signature\", type: \"bytes\" },\n ],\n internalType: \"struct PackedUserOperation[]\",\n name: \"ops\",\n type: \"tuple[]\",\n },\n { internalType: \"address payable\", name: \"beneficiary\", type: \"address\" },\n ],\n name: \"handleOps\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"uint192\", name: \"key\", type: \"uint192\" }],\n name: \"incrementNonce\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n {\n components: [\n {\n components: [\n { internalType: \"address\", name: \"sender\", type: \"address\" },\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n {\n internalType: \"uint256\",\n name: \"verificationGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"callGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"paymasterVerificationGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"paymasterPostOpGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n { internalType: \"address\", name: \"paymaster\", type: \"address\" },\n {\n internalType: \"uint256\",\n name: \"maxFeePerGas\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"maxPriorityFeePerGas\",\n type: \"uint256\",\n },\n ],\n internalType: \"struct EntryPoint.MemoryUserOp\",\n name: \"mUserOp\",\n type: \"tuple\",\n },\n { internalType: \"bytes32\", name: \"userOpHash\", type: \"bytes32\" },\n { internalType: \"uint256\", name: \"prefund\", type: \"uint256\" },\n { internalType: \"uint256\", name: \"contextOffset\", type: \"uint256\" },\n { internalType: \"uint256\", name: \"preOpGas\", type: \"uint256\" },\n ],\n internalType: \"struct EntryPoint.UserOpInfo\",\n name: \"opInfo\",\n type: \"tuple\",\n },\n { internalType: \"bytes\", name: \"context\", type: \"bytes\" },\n ],\n name: \"innerHandleOp\",\n outputs: [\n { internalType: \"uint256\", name: \"actualGasCost\", type: \"uint256\" },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"\", type: \"address\" },\n { internalType: \"uint192\", name: \"\", type: \"uint192\" },\n ],\n name: \"nonceSequenceNumber\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"bytes4\", name: \"interfaceId\", type: \"bytes4\" }],\n name: \"supportsInterface\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"unlockStake\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address payable\",\n name: \"withdrawAddress\",\n type: \"address\",\n },\n ],\n name: \"withdrawStake\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address payable\",\n name: \"withdrawAddress\",\n type: \"address\",\n },\n { internalType: \"uint256\", name: \"withdrawAmount\", type: \"uint256\" },\n ],\n name: \"withdrawTo\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n { stateMutability: \"payable\", type: \"receive\" },\n] as const;\n","// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.88.4\";\n","import { BaseError as ViemBaseError } from \"viem\";\nimport { VERSION } from \"../version.js\";\n\ntype BaseErrorParameters = {\n docsPath?: string;\n docsSlug?: string;\n metaMessages?: string[];\n} & (\n | {\n cause?: never;\n details?: string;\n }\n | {\n cause: BaseError | Error;\n details?: never;\n }\n);\n\n/**\n * A custom error class that extends from `ViemBaseError`. This class allows for error messages to include links to relevant documentation based on provided `docsPath` and `docsSlug` parameters.\n * This is based on on viem's BaseError type (obviously from the import and extend)\n * we want the errors here to point to our docs if we supply a docsPath though\n */\nexport class BaseError extends ViemBaseError {\n override name = \"AASDKError\";\n override version = VERSION;\n\n constructor(shortMessage: string, args: BaseErrorParameters = {}) {\n super(shortMessage, args);\n\n const docsPath =\n args.cause instanceof BaseError\n ? args.cause.docsPath || args.docsPath\n : args.docsPath;\n\n this.message = [\n shortMessage || \"An error occurred.\",\n \"\",\n ...(args.metaMessages ? [...args.metaMessages, \"\"] : []),\n ...(docsPath\n ? [\n `Docs: https://www.alchemy.com/docs/wallets${docsPath}${\n args.docsSlug ? `#${args.docsSlug}` : \"\"\n }`,\n ]\n : []),\n ...(this.details ? [`Details: ${this.details}`] : []),\n `Version: ${this.version}`,\n ].join(\"\\n\");\n }\n}\n","import type { Client } from \"viem\";\nimport { maxUint32 } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * Represents an error thrown when a client is not compatible with the expected client type for a specific method. The error message provides guidance on how to create a compatible client.\n */\nexport class IncompatibleClientError extends BaseError {\n override name = \"IncompatibleClientError\";\n\n /**\n * Throws an error when the client type does not match the expected client type.\n *\n * @param {string} expectedClient The expected type of the client.\n * @param {string} method The method that was called.\n * @param {Client} client The client instance.\n */\n constructor(expectedClient: string, method: string, client: Client) {\n super(\n [\n `Client of type (${client.type}) is not a ${expectedClient}.`,\n `Create one with \\`createSmartAccountClient\\` first before using \\`${method}\\``,\n ].join(\"\\n\"),\n );\n }\n}\n\n/**\n * Represents an error that occurs when an invalid RPC URL is provided. This class extends the `BaseError` class and includes the invalid URL in the error message.\n */\nexport class InvalidRpcUrlError extends BaseError {\n override name = \"InvalidRpcUrlError\";\n\n /**\n * Creates an instance of an error with a message indicating an invalid RPC URL.\n *\n * @param {string} [rpcUrl] The invalid RPC URL that caused the error\n */\n constructor(rpcUrl?: string) {\n super(`Invalid RPC URL ${rpcUrl}`);\n }\n}\n\n/**\n * Error class representing a \"Chain Not Found\" error, typically thrown when no chain is supplied to the client.\n */\nexport class ChainNotFoundError extends BaseError {\n override name = \"ChainNotFoundError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that no chain was supplied to the client.\n */\n constructor() {\n super(\"No chain supplied to the client\");\n }\n}\n\n/**\n * Error class denoting that the provided entity id is invalid because it's too large.\n */\nexport class InvalidEntityIdError extends BaseError {\n override name = \"InvalidEntityIdError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the entity id is invalid because it's too large.\n *\n * @param {number} entityId the invalid entityId used\n * @param {number | bigint} [maxAllowedInclusive] inclusive upper bound the entityId must not exceed. Defaults to `uint32.max`.\n */\n constructor(\n entityId: number,\n maxAllowedInclusive: number | bigint = maxUint32,\n ) {\n super(\n `Entity ID used is ${entityId}, but must be less than or equal to ${maxAllowedInclusive}`,\n );\n }\n}\n\n/**\n * Error class denoting that the nonce key is invalid because its too large.\n */\nexport class InvalidNonceKeyError extends BaseError {\n override name = \"InvalidNonceKeyError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the nonce key is invalid.\n *\n * @param {bigint} nonceKey the invalid nonceKey used\n */\n constructor(nonceKey: bigint) {\n super(\n `Nonce key is ${nonceKey} but has to be less than or equal to 2**152`,\n );\n }\n}\n\n/**\n * Error class denoting that the provided entity id is invalid because it's overriding the native entity id.\n */\nexport class EntityIdOverrideError extends BaseError {\n override name = \"EntityIdOverrideError\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the nonce key is invalid.\n */\n constructor() {\n super(`EntityId of 0 is reserved for the owner and cannot be used`);\n }\n}\n\n/**\n * Error class denoting that the provided ma v2 account mode is invalid.\n */\nexport class InvalidModularAccountV2Mode extends BaseError {\n override name = \"InvalidModularAccountV2Mode\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the provided ma v2 account mode is invalid.\n */\n constructor() {\n super(`The provided account mode is invalid for ModularAccount V2`);\n }\n}\n\n/**\n * Error class denoting that the deferred action nonce used is invalid.\n */\nexport class InvalidDeferredActionNonce extends BaseError {\n override name = \"InvalidDeferredActionNonce\";\n\n /**\n * Initializes a new instance of the error message with a default message indicating that the provided deferred action nonce is invalid.\n */\n constructor() {\n super(`The provided deferred action nonce is invalid`);\n }\n}\n","import type { Address } from \"abitype\";\nimport {\n AccountStateConflictError,\n InvalidAddressError,\n StateAssignmentConflictError,\n isAddress,\n numberToHex,\n type RpcAccountStateOverride,\n type RpcStateMapping,\n type RpcStateOverride,\n type StateMapping,\n type StateOverride,\n} from \"viem\";\n\n// Copied from Viem's utils/stateOverride.ts, which does not expose these\n// functions.\n\ntype SerializeStateMappingParameters = StateMapping | undefined;\n\nfunction serializeStateMapping(\n stateMapping: SerializeStateMappingParameters,\n): RpcStateMapping | undefined {\n if (!stateMapping || stateMapping.length === 0) return undefined;\n return stateMapping.reduce((acc, { slot, value }) => {\n validateBytes32HexLength(slot);\n validateBytes32HexLength(value);\n acc[slot] = value;\n return acc;\n }, {} as RpcStateMapping);\n}\n\nfunction validateBytes32HexLength(value: Address): void {\n if (value.length !== 66) {\n // This is the error message from Viem's non-exported InvalidBytesLengthError.\n throw new Error(\n `Hex is expected to be 66 hex long, but is ${value.length} hex long.`,\n );\n }\n}\n\ntype SerializeAccountStateOverrideParameters = Omit<\n StateOverride[number],\n \"address\"\n>;\n\nfunction serializeAccountStateOverride(\n parameters: SerializeAccountStateOverrideParameters,\n): RpcAccountStateOverride {\n const { balance, nonce, state, stateDiff, code } = parameters;\n const rpcAccountStateOverride: RpcAccountStateOverride = {};\n if (code !== undefined) rpcAccountStateOverride.code = code;\n if (balance !== undefined)\n rpcAccountStateOverride.balance = numberToHex(balance);\n if (nonce !== undefined) rpcAccountStateOverride.nonce = numberToHex(nonce);\n if (state !== undefined)\n rpcAccountStateOverride.state = serializeStateMapping(state);\n if (stateDiff !== undefined) {\n if (rpcAccountStateOverride.state) throw new StateAssignmentConflictError();\n rpcAccountStateOverride.stateDiff = serializeStateMapping(stateDiff);\n }\n return rpcAccountStateOverride;\n}\n\ntype SerializeStateOverrideParameters = StateOverride | undefined;\n\n// eslint-disable-next-line jsdoc/require-jsdoc\nexport function serializeStateOverride(\n parameters?: SerializeStateOverrideParameters,\n): RpcStateOverride | undefined {\n if (!parameters) return undefined;\n const rpcStateOverride: RpcStateOverride = {};\n for (const { address, ...accountState } of parameters) {\n if (!isAddress(address, { strict: false }))\n throw new InvalidAddressError({ address });\n if (rpcStateOverride[address])\n throw new AccountStateConflictError({ address: address });\n rpcStateOverride[address] = serializeAccountStateOverride(accountState);\n }\n return rpcStateOverride;\n}\n","import type { Address, Chain, Client, StateOverride, Transport } from \"viem\";\nimport type { BundlerRpcSchema } from \"../../client/decorators/bundlerClient\";\nimport type { EntryPointVersion } from \"../../entrypoint/types\";\nimport type {\n UserOperationEstimateGasResponse,\n UserOperationRequest,\n} from \"../../types\";\nimport { serializeStateOverride } from \"../../utils/stateOverride.js\";\n\nexport const estimateUserOperationGas = async <\n TClient extends Client<Transport, Chain | undefined, any, BundlerRpcSchema>,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n>(\n client: TClient,\n args: {\n request: UserOperationRequest<TEntryPointVersion>;\n entryPoint: Address;\n stateOverride?: StateOverride;\n },\n): Promise<UserOperationEstimateGasResponse<TEntryPointVersion>> => {\n return client.request({\n method: \"eth_estimateUserOperationGas\",\n params:\n args.stateOverride != null\n ? [\n args.request,\n args.entryPoint,\n serializeStateOverride(args.stateOverride),\n ]\n : [args.request, args.entryPoint],\n });\n};\n","import type { Address, Chain, Client, Transport } from \"viem\";\nimport type { BundlerRpcSchema } from \"../../client/decorators/bundlerClient\";\n\nexport const getSupportedEntryPoints = async <\n TClient extends Client<Transport, Chain | undefined, any, BundlerRpcSchema>,\n>(\n client: TClient,\n): Promise<Address[]> => {\n return client.request({\n method: \"eth_supportedEntryPoints\",\n params: [],\n });\n};\n","import type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { BundlerRpcSchema } from \"../../client/decorators/bundlerClient\";\nimport type { UserOperationResponse } from \"../../types\";\n\nexport const getUserOperationByHash = async <\n TClient extends Client<Transport, Chain | undefined, any, BundlerRpcSchema>,\n>(\n client: TClient,\n args: {\n hash: Hex;\n },\n): Promise<UserOperationResponse | null> => {\n return client.request({\n method: \"eth_getUserOperationByHash\",\n params: [args.hash],\n });\n};\n","import type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { BundlerRpcSchema } from \"../../client/decorators/bundlerClient\";\nimport type { UserOperationReceipt } from \"../../types\";\n\nexport const getUserOperationReceipt = async <\n TClient extends Client<Transport, Chain | undefined, any, BundlerRpcSchema>,\n>(\n client: TClient,\n args: {\n hash: Hex;\n tag: \"pending\" | \"latest\" | undefined;\n },\n): Promise<UserOperationReceipt | null> => {\n if (args.tag === undefined) {\n return client.request({\n method: \"eth_getUserOperationReceipt\",\n params: [args.hash],\n });\n }\n return client.request({\n method: \"eth_getUserOperationReceipt\",\n params: [args.hash, args.tag],\n });\n};\n","import type { Address, Chain, Client, Hex, Transport } from \"viem\";\nimport type { BundlerRpcSchema } from \"../../client/decorators/bundlerClient\";\nimport type { EntryPointVersion } from \"../../entrypoint/types\";\nimport type { UserOperationRequest } from \"../../types\";\n\nexport const sendRawUserOperation = async <\n TClient extends Client<Transport, Chain | undefined, any, BundlerRpcSchema>,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n>(\n client: TClient,\n args: {\n request: UserOperationRequest<TEntryPointVersion>;\n entryPoint: Address;\n },\n): Promise<Hex> => {\n return client.request({\n method: \"eth_sendUserOperation\",\n params: [args.request, args.entryPoint],\n });\n};\n","import type {\n Address,\n Chain,\n Client,\n Hash,\n PublicRpcSchema,\n RpcStateOverride,\n StateOverride,\n Transport,\n} from \"viem\";\nimport { estimateUserOperationGas } from \"../../actions/bundler/estimateUserOperationGas.js\";\nimport { getSupportedEntryPoints } from \"../../actions/bundler/getSupportedEntryPoints.js\";\nimport { getUserOperationByHash } from \"../../actions/bundler/getUserOperationByHash.js\";\nimport { getUserOperationReceipt } from \"../../actions/bundler/getUserOperationReceipt.js\";\nimport { sendRawUserOperation } from \"../../actions/bundler/sendRawUserOperation.js\";\nimport type { EntryPointVersion } from \"../../entrypoint/types.js\";\nimport type {\n UserOperationEstimateGasResponse,\n UserOperationReceipt,\n UserOperationRequest,\n UserOperationResponse,\n} from \"../../types.js\";\n\n// Reference: https://eips.ethereum.org/EIPS/eip-4337#rpc-methods-eth-namespace\nexport type BundlerRpcSchema = [\n {\n Method: \"eth_sendUserOperation\";\n Parameters: [UserOperationRequest, Address];\n ReturnType: Hash;\n },\n {\n Method: \"eth_estimateUserOperationGas\";\n Parameters: [UserOperationRequest, Address, RpcStateOverride?];\n ReturnType: UserOperationEstimateGasResponse;\n },\n {\n Method: \"eth_getUserOperationReceipt\";\n Parameters: [Hash, (\"pending\" | \"latest\")?];\n ReturnType: UserOperationReceipt | null;\n },\n {\n Method: \"eth_getUserOperationByHash\";\n Parameters: [Hash];\n ReturnType: UserOperationResponse | null;\n },\n {\n Method: \"eth_supportedEntryPoints\";\n Parameters: [];\n ReturnType: Address[];\n },\n];\n\nexport type BundlerActions = {\n /**\n * calls `eth_estimateUserOperationGas` and returns the result\n *\n * @param request - the UserOperationRequest to estimate gas for\n * @param entryPoint - the entry point address the op will be sent to\n * @param stateOverride - the state override to use for the estimation\n * @returns the gas estimates for the given response\n */\n estimateUserOperationGas<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n >(\n request: UserOperationRequest<TEntryPointVersion>,\n entryPoint: Address,\n stateOverride?: StateOverride,\n ): Promise<UserOperationEstimateGasResponse<TEntryPointVersion>>;\n\n /**\n * calls `eth_sendUserOperation` and returns the hash of the sent UserOperation\n *\n * @param request - the UserOperationRequest to send\n * @param entryPoint - the entry point address the op will be sent to\n * @returns the hash of the sent UserOperation\n */\n sendRawUserOperation<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n >(\n request: UserOperationRequest<TEntryPointVersion>,\n entryPoint: Address,\n ): Promise<Hash>;\n\n /**\n * calls `eth_getUserOperationByHash` and returns the UserOperationResponse\n *\n * @param hash - the hash of the UserOperation to fetch\n * @returns - the user operation if found or null\n */\n getUserOperationByHash(hash: Hash): Promise<UserOperationResponse | null>;\n\n /**\n * calls `eth_getUserOperationReceipt` and returns the UserOperationReceipt\n *\n * @param hash - the hash of the UserOperation to get the receipt for\n * @param tag - if client want to get receipt for different block tag.\n * @returns - a user operation receipt or null if not found\n */\n getUserOperationReceipt(\n hash: Hash,\n tag?: \"pending\" | \"latest\",\n ): Promise<UserOperationReceipt | null>;\n\n /**\n * calls `eth_supportedEntryPoints` and returns the entry points the RPC supports\n *\n * @returns - an array of the entrypoint addresses supported\n */\n getSupportedEntryPoints(): Promise<Address[]>;\n};\n\n/**\n * A viem client decorator that provides Bundler specific actions.\n * These actions include estimating gas for user operations, sending raw user operations, retrieving user operations by hash, getting supported entry points, and getting user operation receipts.\n *\n * NOTE: this is already added to the client returned from `createBundlerClient`\n *\n * @param {TClient} client The client instance that will be used to perform bundler actions\n * @returns {BundlerActions} An object containing various bundler-related actions that can be executed using the provided client\n */\nexport const bundlerActions: <\n TClient extends Client<\n Transport,\n Chain | undefined,\n any,\n [...PublicRpcSchema, ...BundlerRpcSchema]\n >,\n>(\n client: TClient,\n) => BundlerActions = (client) => ({\n estimateUserOperationGas: async (request, entryPoint, stateOverride) =>\n estimateUserOperationGas(client, { request, entryPoint, stateOverride }),\n sendRawUserOperation: async (request, entryPoint) =>\n sendRawUserOperation(client, { request, entryPoint }),\n getUserOperationByHash: async (hash) =>\n getUserOperationByHash(client, { hash }),\n getSupportedEntryPoints: async () => getSupportedEntryPoints(client),\n getUserOperationReceipt: async (hash, tag?) =>\n getUserOperationReceipt(client, {\n hash,\n tag,\n }),\n});\n","import {\n createClient,\n http,\n publicActions,\n type Chain,\n type Client,\n type FallbackTransport,\n type HttpTransportConfig,\n type PublicActions,\n type PublicClient,\n type PublicClientConfig,\n type PublicRpcSchema,\n type Transport,\n} from \"viem\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport { VERSION } from \"../version.js\";\nimport {\n bundlerActions,\n type BundlerActions,\n type BundlerRpcSchema,\n} from \"./decorators/bundlerClient.js\";\n\nexport type BundlerClient<T extends Transport = Transport> = Client<\n T,\n Chain,\n undefined,\n [...PublicRpcSchema, ...BundlerRpcSchema],\n PublicActions<T, Chain> & BundlerActions\n>;\n\n/**\n * Creates a bundler client from an existing public client with the provided transport and chain.\n *\n * @example\n * ```ts\n * import { createPublicClient } from \"viem\";\n * import { createBundlerClientFromExisting } from \"@aa-sdk/core\";\n *\n * const publicClient = createPublicClient(...);\n * const bundlerClient = createBundlerClientFromExisting(publicClient);\n * ```\n *\n * @param {PublicClient<T, Chain>} client The existing public client to be extended with bundler actions\n * @returns {BundlerClient<T>} A bundler client that extends the functionality of the provided public client\n */\nexport const createBundlerClientFromExisting: <\n T extends Transport | FallbackTransport = Transport,\n>(\n client: PublicClient<T, Chain>,\n) => BundlerClient<T> = <T extends Transport | FallbackTransport = Transport>(\n client: PublicClient<T, Chain>,\n): BundlerClient<T> => {\n return client.extend(bundlerActions);\n};\n\n/**\n * Creates a PublicClient with methods for calling Bundler RPC methods\n *\n * @param {PublicClientConfig<TTransport, Chain> & { type?: string }} args - configuration for the client\n * @returns {BundlerClient<TTransport>} a PublicClient with methods for calling Bundler RPC methods\n */\nexport function createBundlerClient<TTransport extends Transport>(\n args: PublicClientConfig<TTransport, Chain> & { type?: string },\n): BundlerClient<TTransport>;\n\n/**\n * Creates a Bundler Client using the provided configuration parameters, including chain and optional type.\n *\n * @example\n * ```ts\n * import { createBundlerClient } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createBundlerClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * });\n * ```\n *\n * @param {PublicClientConfig & { type?: string }} args Configuration for creating the Bundler Client, including parameters for the chain, transport, and optional type\n * @returns {BundlerClient} The created Bundler Client with extended public and bundler actions\n */\nexport function createBundlerClient(\n args: PublicClientConfig & { type?: string },\n): BundlerClient {\n if (!args.chain) {\n throw new ChainNotFoundError();\n }\n const {\n key = \"bundler-public\",\n name = \"Public Bundler Client\",\n type = \"bundlerClient\",\n } = args;\n\n const { transport, ...opts } = args;\n const resolvedTransport = transport({\n chain: args.chain,\n pollingInterval: opts.pollingInterval,\n });\n\n const baseParameters = {\n ...args,\n key,\n name,\n type,\n };\n\n const client = (() => {\n if (resolvedTransport.config.type === \"http\") {\n const { url, fetchOptions: fetchOptions_ } = resolvedTransport.value as {\n fetchOptions: HttpTransportConfig[\"fetchOptions\"];\n url: string;\n };\n\n const fetchOptions = fetchOptions_ ?? {};\n\n if (url.toLowerCase().indexOf(\"alchemy\") > -1) {\n fetchOptions.headers = {\n ...fetchOptions.headers,\n \"Alchemy-AA-Sdk-Version\": VERSION,\n };\n }\n\n return createClient<Transport, Chain>({\n ...baseParameters,\n transport: http(url, {\n ...resolvedTransport.config,\n fetchOptions,\n }),\n });\n }\n\n return createClient<Transport, Chain>(baseParameters);\n })();\n\n return client.extend(publicActions).extend(bundlerActions);\n}\n","import type { Chain } from \"viem\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * This error is thrown when an account could not be found to execute a specific action. It extends the `BaseError` class.\n */\nexport class AccountNotFoundError extends BaseError {\n override name = \"AccountNotFoundError\";\n\n // TODO: extend this further using docs path as well\n\n /**\n * Constructor for initializing an error message indicating that an account could not be found to execute the specified action.\n */ constructor() {\n super(\"Could not find an Account to execute with this Action.\");\n }\n}\n\n/**\n * This error is thrown when an account is not a Modular Account V2\n */\n\nexport class NotAModularAccountV2Error extends BaseError {\n override name = \"NotAModularAccountV2Error\";\n /**\n * Constructor for initializing an error message indicating that the account is not a Modular Account V2.\n */\n constructor() {\n super(\"This is not a Modular Account V2 account.\");\n }\n}\n\n/**\n * Represents an error that is thrown when no default factory is defined for a specific account type on a given chain and entry point version.\n * This error suggests providing an override via the `factoryAddress` parameter when creating an account.\n */\nexport class DefaultFactoryNotDefinedError extends BaseError {\n override name = \"DefaultFactoryNotDefinedError\";\n\n /**\n * Constructs an error message indicating that no default factory was found for the given account type, chain, and entry point version.\n *\n * @param {string} accountType the type of account\n * @param {Chain} chain the blockchain chain\n * @param {EntryPointVersion} version the entry point version\n */\n constructor(accountType: string, chain: Chain, version: EntryPointVersion) {\n super(\n [\n `No default factory for ${accountType} found on chain ${chain.name} for entrypoint version ${version}`,\n \"Supply an override via the `factoryAddress` parameter when creating an account\",\n ].join(\"\\n\"),\n );\n }\n}\n\n/**\n * Custom error class for handling errors when getting a counterfactual address. This extends the `BaseError` class and provides a custom error message and name.\n */\nexport class GetCounterFactualAddressError extends BaseError {\n override name = \"GetCounterFactualAddressError\";\n\n /**\n * Constructor for initializing an error message indicating the failure of fetching the counter-factual address.\n */ constructor() {\n super(\"getCounterFactualAddress failed\");\n }\n}\n\n/**\n * An error class representing the condition where upgrades are not supported for a specific account type. This error extends the `BaseError` class and provides a custom error message based on the account type.\n */\nexport class UpgradesNotSupportedError extends BaseError {\n override name = \"UpgradesNotSupported\";\n\n /**\n * Error constructor for indicating that upgrades are not supported by the given account type.\n *\n * @param {string} accountType The type of account that does not support upgrades\n */\n constructor(accountType: string) {\n super(`Upgrades are not supported by ${accountType}`);\n }\n}\n\n/**\n * Error thrown when attempting to sign a transaction that is not supported by smart contracts.\n */\nexport class SignTransactionNotSupportedError extends BaseError {\n override name = \"SignTransactionNotSupported\";\n\n /**\n * Throws an error indicating that signing a transaction is not supported by smart contracts.\n *\n \n */ constructor() {\n super(`SignTransaction is not supported by smart contracts`);\n }\n}\n\n/**\n * Custom error class `FailedToGetStorageSlotError` which is used to signal a failure when attempting to retrieve a storage slot. This error includes the slot and slot descriptor in its message and inherits from `BaseError`.\n */\nexport class FailedToGetStorageSlotError extends BaseError {\n override name = \"FailedToGetStorageSlotError\";\n\n /**\n * Custom error message constructor for failing to get a specific storage slot.\n *\n * @param {string} slot The storage slot that failed to be accessed or retrieved\n * @param {string} slotDescriptor A description of the storage slot, for additional context in the error message\n */\n constructor(slot: string, slotDescriptor: string) {\n super(`Failed to get storage slot ${slot} (${slotDescriptor})`);\n }\n}\n\n/**\n * Represents an error indicating that batch execution is not supported for a specific account type.\n */\nexport class BatchExecutionNotSupportedError extends BaseError {\n override name = \"BatchExecutionNotSupportedError\";\n\n /**\n * Constructs an error message indicating that batch execution is not supported by the specified account type.\n *\n * @param {string} accountType the type of account that does not support batch execution\n */\n constructor(accountType: string) {\n super(`Batch execution is not supported by ${accountType}`);\n }\n}\n\n/**\n * Represents an error that occurs when an account requires an owner to execute but none is provided.\n */\nexport class AccountRequiresOwnerError extends BaseError {\n override name = \"AccountRequiresOwnerError\";\n\n /**\n * Constructs an error indicating that an account of the specified type requires an owner to execute.\n *\n * @param {string} accountType The type of account that requires an owner\n */\n constructor(accountType: string) {\n super(`Account of type ${accountType} requires an owner to execute`);\n }\n}\n\n/**\n * Represents an error that occurs when an attempt is made to call `UpgradeToAndCall` on an account type that does not support it. Includes the account type in the error message.\n */\nexport class UpgradeToAndCallNotSupportedError extends BaseError {\n override name = \"UpgradeToAndCallNotSupportedError\";\n\n /**\n * Constructs an error message indicating that `UpgradeToAndCall` is not supported by the specified account type.\n *\n * @param {string} accountType The type of account that does not support `UpgradeToAndCall`\n */\n constructor(accountType: string) {\n super(`UpgradeToAndCall is not supported by ${accountType}`);\n }\n}\n\n/**\n * Represents an error thrown when an account type does not match the expected type.\n */\nexport class IncorrectAccountType extends BaseError {\n override name = \"IncorrectAccountTypeError\";\n\n /**\n * Constructs an error object indicating that the expected account type does not match the actual account type.\n *\n * @param {string} expected the expected account type\n * @param {string} actual the actual account type that was received\n */\n constructor(expected: string, actual: string) {\n super(`Expected account type ${expected}, got ${actual}`);\n }\n}\n\n/**\n * Error class indicating that a smart account operation requires a signer.\n */\nexport class SmartAccountWithSignerRequiredError extends BaseError {\n override name = \"SmartAccountWithSignerRequiredError\";\n\n /**\n * Initializes a new instance of the error class with a predefined error message indicating that a smart account requires a signer.\n */ constructor() {\n super(\"Smart account requires a signer\");\n }\n}\n","import type { Chain } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * Represents an error thrown when an entry point is not found for a specific chain and entry point version. This error indicates that a default entry point does not exist for the given chain and version, and suggests providing an override.\n */\nexport class EntryPointNotFoundError extends BaseError {\n override name = \"EntryPointNotFoundError\";\n\n /**\n * Constructs an error message indicating that no default entry point exists for the given chain and entry point version.\n *\n * @param {Chain} chain The blockchain network for which the entry point is being queried\n * @param {any} entryPointVersion The version of the entry point for which no default exists\n */\n constructor(chain: Chain, entryPointVersion: any) {\n super(\n [\n `No default entry point v${entryPointVersion} exists for ${chain.name}.`,\n `Supply an override.`,\n ].join(\"\\n\"),\n );\n }\n}\n\n/**\n * Represents an error thrown when an invalid entry point version is encountered for a specific chain. This error extends the `BaseError` class.\n */\nexport class InvalidEntryPointError extends BaseError {\n override name = \"InvalidEntryPointError\";\n\n /**\n * Constructs an error indicating an invalid entry point version for a specific chain.\n *\n * @param {Chain} chain The chain object containing information about the blockchain\n * @param {any} entryPointVersion The entry point version that is invalid\n */\n constructor(chain: Chain, entryPointVersion: any) {\n super(\n `Invalid entry point: unexpected version ${entryPointVersion} for ${chain.name}.`,\n );\n }\n}\n","export enum LogLevel {\n VERBOSE = 5,\n DEBUG = 4,\n INFO = 3,\n WARN = 2,\n ERROR = 1,\n NONE = 0,\n}\n\n/**\n * Logger class provides static methods for logging at different levels such as error, warn, debug, info, and verbose. This class allows setting log levels and log filters to control the logging behavior.\n */\nexport class Logger {\n static logLevel: LogLevel = LogLevel.INFO;\n static logFilter?: string;\n\n /**\n * Sets the log level for logging purposes.\n *\n * @example\n * ```ts\n * import { Logger, LogLevel } from \"@aa-sdk/core\";\n * Logger.setLogLevel(LogLevel.DEBUG);\n * ```\n *\n * @param {LogLevel} logLevel The desired log level\n */\n static setLogLevel(logLevel: LogLevel) {\n this.logLevel = logLevel;\n }\n\n /**\n * Sets the log filter pattern.\n *\n * @example\n * ```ts\n * import { Logger } from \"@aa-sdk/core\";\n *\n * Logger.setLogFilter(\"error\");\n * ```\n *\n * @param {string} pattern The pattern to set as the log filter\n */\n static setLogFilter(pattern: string) {\n this.logFilter = pattern;\n }\n\n /**\n * Logs an error message to the console if the logging condition is met.\n *\n * @example\n * ```ts\n * import { Logger } from \"@aa-sdk/core\";\n *\n * Logger.error(\"An error occurred while processing the request\");\n * ```\n *\n * @param {string} msg The primary error message to be logged\n * @param {...any[]} args Additional arguments to be logged along with the error message\n */\n static error(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.ERROR)) return;\n\n console.error(msg, ...args);\n }\n\n /**\n * Logs a warning message if the logging conditions are met.\n *\n * @example\n * ```ts\n * import { Logger } from \"@aa-sdk/core\";\n *\n * Logger.warn(\"Careful...\");\n * ```\n *\n * @param {string} msg The message to log as a warning\n * @param {...any[]} args Additional parameters to log along with the message\n */\n static warn(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.WARN)) return;\n\n console.warn(msg, ...args);\n }\n\n /**\n * Logs a debug message to the console if the log level allows it.\n *\n * @example\n * ```ts\n * import { Logger } from \"@aa-sdk/core\";\n *\n * Logger.debug(\"Something is happening\");\n * ```\n *\n * @param {string} msg The message to log\n * @param {...any[]} args Additional arguments to pass to the console.debug method\n */\n static debug(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.DEBUG)) return;\n\n console.debug(msg, ...args);\n }\n\n /**\n * Logs an informational message to the console if the logging level is set to INFO.\n *\n * @example\n * ```ts\n * import { Logger } from \"@aa-sdk/core\";\n *\n * Logger.info(\"Something is happening\");\n * ```\n *\n * @param {string} msg the message to log\n * @param {...any[]} args additional arguments to log alongside the message\n */\n static info(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.INFO)) return;\n\n console.info(msg, ...args);\n }\n\n /**\n * Logs a message with additional arguments if the logging level permits it.\n *\n * @example\n * ```ts\n * import { Logger } from \"@aa-sdk/core\";\n *\n * Logger.verbose(\"Something is happening\");\n * ```\n *\n * @param {string} msg The message to log\n * @param {...any[]} args Additional arguments to be logged\n */\n static verbose(msg: string, ...args: any[]) {\n if (!this.shouldLog(msg, LogLevel.VERBOSE)) return;\n\n console.log(msg, ...args);\n }\n\n private static shouldLog(msg: string, level: LogLevel) {\n if (this.logLevel < level) return false;\n if (this.logFilter && !msg.includes(this.logFilter)) return false;\n\n return true;\n }\n}\n","import {\n concat,\n encodeAbiParameters,\n parseAbiParameters,\n type Address,\n type Hash,\n type Hex,\n} from \"viem\";\n\nexport type SignWith6492Params = {\n factoryAddress: Address;\n factoryCalldata: Hex;\n signature: Hash;\n};\n\n/**\n * Wraps a given signature with additional data following the EIP-6492 standard.\n *\n * @example\n * ```ts\n * import { wrapSignatureWith6492 } from \"@aa-sdk/core\";\n *\n * const signature = wrapSignatureWith6492({\n * factoryAddress: \"0x...\",\n * factoryCalldata: \"0x...\",\n * signature: \"0x...\",\n * });\n * ```\n *\n * @param {SignWith6492Params} params The parameters to wrap the signature\n * @param {Hex} params.factoryAddress The address of the factory\n * @param {Hex} params.factoryCalldata The calldata for the factory\n * @param {Hex} params.signature The original signature that needs to be wrapped\n * @returns {Hash} The wrapped signature\n */\nexport const wrapSignatureWith6492 = ({\n factoryAddress,\n factoryCalldata,\n signature,\n}: SignWith6492Params): Hash => {\n // wrap the signature as follows: https://eips.ethereum.org/EIPS/eip-6492\n // concat(\n // abi.encode(\n // (create2Factory, factoryCalldata, originalERC1271Signature),\n // (address, bytes, bytes)),\n // magicBytes\n // )\n return concat([\n encodeAbiParameters(parseAbiParameters(\"address, bytes, bytes\"), [\n factoryAddress,\n factoryCalldata,\n signature,\n ]),\n \"0x6492649264926492649264926492649264926492649264926492649264926492\",\n ]);\n};\n","import {\n getContract,\n hexToBytes,\n type Address,\n type Chain,\n type CustomSource,\n type Hex,\n type LocalAccount,\n type PublicClient,\n type SignableMessage,\n type Transport,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport { toAccount } from \"viem/accounts\";\nimport { createBundlerClient } from \"../client/bundlerClient.js\";\nimport type {\n EntryPointDef,\n EntryPointRegistryBase,\n EntryPointVersion,\n} from \"../entrypoint/types.js\";\nimport {\n BatchExecutionNotSupportedError,\n FailedToGetStorageSlotError,\n GetCounterFactualAddressError,\n SignTransactionNotSupportedError,\n UpgradesNotSupportedError,\n} from \"../errors/account.js\";\nimport { InvalidRpcUrlError } from \"../errors/client.js\";\nimport { InvalidEntryPointError } from \"../errors/entrypoint.js\";\nimport { Logger } from \"../logger.js\";\nimport type { SmartAccountSigner } from \"../signer/types.js\";\nimport { wrapSignatureWith6492 } from \"../signer/utils.js\";\nimport type { NullAddress } from \"../types.js\";\nimport type { IsUndefined, Never } from \"../utils/types.js\";\n\nexport type AccountOp = {\n target: Address;\n value?: bigint;\n data: Hex | \"0x\";\n};\n\nexport enum DeploymentState {\n UNDEFINED = \"0x0\",\n NOT_DEPLOYED = \"0x1\",\n DEPLOYED = \"0x2\",\n}\n\nexport type SignatureRequest =\n | {\n type: \"personal_sign\";\n data: SignableMessage;\n }\n | {\n type: \"eth_signTypedData_v4\";\n data: TypedDataDefinition;\n };\n\nexport type SigningMethods = {\n prepareSign: (request: SignatureRequest) => Promise<SignatureRequest>;\n formatSign: (signature: Hex) => Promise<Hex>;\n};\n\nexport type GetEntryPointFromAccount<\n TAccount extends SmartContractAccount | undefined,\n TAccountOverride extends SmartContractAccount = SmartContractAccount,\n> =\n GetAccountParameter<TAccount, TAccountOverride> extends SmartContractAccount<\n string,\n infer TEntryPointVersion\n >\n ? TEntryPointVersion\n : EntryPointVersion;\n\nexport type GetAccountParameter<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TAccountOverride extends SmartContractAccount = SmartContractAccount,\n> =\n IsUndefined<TAccount> extends true\n ? { account: TAccountOverride }\n : { account?: TAccountOverride };\n\nexport type UpgradeToAndCallParams = {\n upgradeToAddress: Address;\n upgradeToInitData: Hex;\n};\n\nexport type SmartContractAccountWithSigner<\n Name extends string = string,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n> = SmartContractAccount<Name, TEntryPointVersion> & {\n getSigner: () => TSigner;\n};\n\n/**\n * Determines if the given SmartContractAccount has a signer associated with it.\n *\n * @example\n * ```ts\n * import { toSmartContractAccount } from \"@aa-sdk/core\";\n *\n * const account = await toSmartContractAccount(...);\n *\n * console.log(isSmartAccountWithSigner(account)); // false: the base account does not have a publicly accessible signer\n * ```\n *\n * @param {SmartContractAccount} account The account to check.\n * @returns {boolean} true if the account has a signer, otherwise false.\n */\nexport const isSmartAccountWithSigner = (\n account: SmartContractAccount,\n): account is SmartContractAccountWithSigner => {\n return \"getSigner\" in account;\n};\n\nexport type SmartContractAccount<\n Name extends string = string,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n> = LocalAccount<Name> & {\n source: Name;\n getDummySignature: () => Hex | Promise<Hex>;\n encodeExecute: (tx: AccountOp) => Promise<Hex>;\n encodeBatchExecute: (txs: AccountOp[]) => Promise<Hex>;\n signUserOperationHash: (uoHash: Hex) => Promise<Hex>;\n signMessageWith6492: (params: { message: SignableMessage }) => Promise<Hex>;\n signTypedDataWith6492: <\n const typedData extends TypedData | Record<string, unknown>,\n primaryType extends keyof typedData | \"EIP712Domain\" = keyof typedData,\n >(\n typedDataDefinition: TypedDataDefinition<typedData, primaryType>,\n ) => Promise<Hex>;\n encodeUpgradeToAndCall: (params: UpgradeToAndCallParams) => Promise<Hex>;\n getAccountNonce(nonceKey?: bigint): Promise<bigint>;\n getInitCode: () => Promise<Hex>;\n isAccountDeployed: () => Promise<boolean>;\n getFactoryAddress: () => Promise<Address>;\n getFactoryData: () => Promise<Hex>;\n getEntryPoint: () => EntryPointDef<TEntryPointVersion>;\n getImplementationAddress: () => Promise<NullAddress | Address>;\n} & SigningMethods;\n\nexport interface AccountEntryPointRegistry<Name extends string = string>\n extends EntryPointRegistryBase<\n SmartContractAccount<Name, EntryPointVersion>\n > {\n \"0.6.0\": SmartContractAccount<Name, \"0.6.0\">;\n \"0.7.0\": SmartContractAccount<Name, \"0.7.0\">;\n}\n\nexport type ToSmartContractAccountParams<\n Name extends string = string,\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n> = {\n source: Name;\n transport: TTransport;\n chain: TChain;\n entryPoint: EntryPointDef<TEntryPointVersion, TChain>;\n accountAddress?: Address;\n getAccountInitCode: () => Promise<Hex>;\n getDummySignature: () => Hex | Promise<Hex>;\n encodeExecute: (tx: AccountOp) => Promise<Hex>;\n encodeBatchExecute?: (txs: AccountOp[]) => Promise<Hex>;\n getNonce?: (nonceKey?: bigint) => Promise<bigint>;\n // if not provided, will default to just using signMessage over the Hex\n signUserOperationHash?: (uoHash: Hex) => Promise<Hex>;\n encodeUpgradeToAndCall?: (params: UpgradeToAndCallParams) => Promise<Hex>;\n getImplementationAddress?: () => Promise<NullAddress | Address>;\n} & Omit<CustomSource, \"signTransaction\" | \"address\"> &\n (SigningMethods | Never<SigningMethods>);\n\n/**\n * Parses the factory address and factory calldata from the provided account initialization code (initCode).\n *\n * @example\n * ```ts\n * import { parseFactoryAddressFromAccountInitCode } from \"@aa-sdk/core\";\n *\n * const [address, calldata] = parseFactoryAddressFromAccountInitCode(\"0xAddressCalldata\");\n * ```\n *\n * @param {Hex} initCode The initialization code from which to parse the factory address and calldata\n * @returns {[Address, Hex]} A tuple containing the parsed factory address and factory calldata\n */\nexport const parseFactoryAddressFromAccountInitCode = (\n initCode: Hex,\n): [Address, Hex] => {\n const factoryAddress: Address = `0x${initCode.substring(2, 42)}`;\n const factoryCalldata: Hex = `0x${initCode.substring(42)}`;\n return [factoryAddress, factoryCalldata];\n};\n\nexport type GetAccountAddressParams = {\n client: PublicClient;\n entryPoint: EntryPointDef;\n accountAddress?: Address;\n getAccountInitCode: () => Promise<Hex>;\n};\n\n/**\n * Retrieves the account address. Uses a provided `accountAddress` if available; otherwise, it computes the address using the entry point contract and the initial code.\n *\n * @example\n * ```ts\n * import { getEntryPoint, getAccountAddress } from \"@aa-sdk/core\";\n *\n * const accountAddress = await getAccountAddress({\n * client,\n * entryPoint: getEntryPoint(chain),\n * getAccountInitCode: async () => \"0x{factoryAddress}{factoryCallData}\",\n * });\n * ```\n *\n * @param {GetAccountAddressParams} params The configuration object\n * @param {PublicClient} params.client A public client instance to interact with the blockchain\n * @param {EntryPointDef} params.entryPoint The entry point definition which includes the address and ABI\n * @param {Address} params.accountAddress Optional existing account address\n * @param {() => Promise<Hex>} params.getAccountInitCode A function that returns a Promise resolving to a Hex string representing the initial code of the account\n * @returns {Promise<Address>} A promise that resolves to the account address\n */\nexport const getAccountAddress = async ({\n client,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n}: GetAccountAddressParams) => {\n if (accountAddress) return accountAddress;\n\n const entryPointContract = getContract({\n address: entryPoint.address,\n abi: entryPoint.abi,\n client,\n });\n\n const initCode = await getAccountInitCode();\n Logger.verbose(\"[BaseSmartContractAccount](getAddress) initCode: \", initCode);\n\n try {\n await entryPointContract.simulate.getSenderAddress([initCode]);\n } catch (err: any) {\n Logger.verbose(\n \"[BaseSmartContractAccount](getAddress) getSenderAddress err: \",\n err,\n );\n if (err.cause?.data?.errorName === \"SenderAddressResult\") {\n Logger.verbose(\n \"[BaseSmartContractAccount](getAddress) entryPoint.getSenderAddress result:\",\n err.cause.data.args[0],\n );\n\n return err.cause.data.args[0] as Address;\n }\n\n if (err.details === \"Invalid URL\") {\n throw new InvalidRpcUrlError();\n }\n }\n\n throw new GetCounterFactualAddressError();\n};\n\nexport async function toSmartContractAccount<\n Name extends string = string,\n TTransport extends Transport = Transport,\n TChain extends Chain = Chain,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n>({\n transport,\n chain,\n entryPoint,\n source,\n accountAddress,\n getAccountInitCode,\n getNonce,\n signMessage,\n signTypedData,\n encodeBatchExecute,\n encodeExecute,\n getDummySignature,\n signUserOperationHash,\n encodeUpgradeToAndCall,\n}: ToSmartContractAccountParams<\n Name,\n TTransport,\n TChain,\n TEntryPointVersion\n>): Promise<SmartContractAccount<Name, TEntryPointVersion>>;\n\n/**\n * Converts an account to a smart contract account and sets up various account-related methods using the provided parameters like transport, chain, entry point, and other utilities.\n *\n * @example\n * ```ts\n * import { http, type SignableMessage } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const myAccount = await toSmartContractAccount({\n * /// REQUIRED PARAMS ///\n * source: \"MyAccount\",\n * transport: http(\"RPC_URL\"),\n * chain: sepolia,\n * // The EntryPointDef that your account is com\"patible with\n * entryPoint: getEntryPoint(sepolia, { version: \"0.6.0\" }),\n * // This should return a concatenation of your `factoryAddress` and the `callData` for your factory's create account method\n * getAccountInitCode: async () => \"0x{factoryAddress}{callData}\",\n * // an invalid signature that doesn't cause your account to revert during validation\n * getDummySignature: () => \"0x1234...\",\n * // given a UO in the form of {target, data, value} should output the calldata for calling your contract's execution method\n * encodeExecute: async (uo) => \"0xcalldata\",\n * signMessage: async ({ message }: { message: SignableMessage }) => \"0x...\",\n * signTypedData: async (typedData) => \"0x000\",\n *\n * /// OPTIONAL PARAMS ///\n * // if you already know your account's address, pass that in here to avoid generating a new counterfactual\n * accountAddress: \"0xaddressoverride\",\n * // if your account supports batching, this should take an array of UOs and return the calldata for calling your contract's batchExecute method\n * encodeBatchExecute: async (uos) => \"0x...\",\n * // if your contract expects a different signing scheme than the default signMessage scheme, you can override that here\n * signUserOperationHash: async (hash) => \"0x...\",\n * // allows you to define the calldata for upgrading your account\n * encodeUpgradeToAndCall: async (params) => \"0x...\",\n * });\n * ```\n *\n * @param {ToSmartContractAccountParams} params the parameters required for converting to a smart contract account\n * @param {Transport} params.transport the transport mechanism used for communication\n * @param {Chain} params.chain the blockchain chain used in the account\n * @param {EntryPoint} params.entryPoint the entry point of the smart contract\n * @param {string} params.source the source identifier for the account\n * @param {Address} [params.accountAddress] the address of the account\n * @param {() => Promise<Hex>} params.getAccountInitCode a function to get the initial state code of the account\n * @param {(message: { message: SignableMessage }) => Promise<Hex>} params.signMessage a function to sign a message\n * @param {(typedDataDefinition: TypedDataDefinition<typedData, primaryType>) => Promise<Hex>} params.signTypedData a function to sign typed data\n * @param {(transactions: Transaction[]) => Hex} [params.encodeBatchExecute] a function to encode batch transactions\n * @param {(tx: Transaction) => Hex} params.encodeExecute a function to encode a single transaction\n * @param {() => Promise<Hex>} params.getDummySignature a function to get a dummy signature\n * @param {(uoHash: Hex) => Promise<Hex>} [params.signUserOperationHash] a function to sign user operations\n * @param {(implementationAddress: Address, implementationCallData: Hex) => Hex} [params.encodeUpgradeToAndCall] a function to encode upgrade call\n * @returns {Promise<SmartContractAccount>} a promise that resolves to a SmartContractAccount object with methods and properties for interacting with the smart contract account\n */\nexport async function toSmartContractAccount(\n params: ToSmartContractAccountParams,\n): Promise<SmartContractAccount> {\n const {\n transport,\n chain,\n entryPoint,\n source,\n accountAddress,\n getAccountInitCode,\n signMessage,\n signTypedData,\n encodeExecute,\n encodeBatchExecute,\n getNonce,\n getDummySignature,\n signUserOperationHash,\n encodeUpgradeToAndCall,\n getImplementationAddress,\n prepareSign: prepareSign_,\n formatSign: formatSign_,\n } = params;\n\n const client = createBundlerClient({\n // we set the retry count to 0 so that viem doesn't retry during\n // getting the address. That call always reverts and without this\n // viem will retry 3 times, making this call very slow\n transport: (opts) => transport({ ...opts, chain, retryCount: 0 }),\n chain,\n });\n\n const entryPointContract = getContract({\n address: entryPoint.address,\n abi: entryPoint.abi,\n client,\n });\n\n const accountAddress_ = await getAccountAddress({\n client,\n entryPoint: entryPoint,\n accountAddress,\n getAccountInitCode,\n });\n\n let deploymentState = DeploymentState.UNDEFINED;\n\n const getInitCode = async () => {\n if (deploymentState === DeploymentState.DEPLOYED) {\n return \"0x\";\n }\n const contractCode = await client.getCode({\n address: accountAddress_,\n });\n\n if ((contractCode?.length ?? 0) > 2) {\n deploymentState = DeploymentState.DEPLOYED;\n return \"0x\";\n } else {\n deploymentState = DeploymentState.NOT_DEPLOYED;\n }\n\n return getAccountInitCode();\n };\n\n const signUserOperationHash_ =\n signUserOperationHash ??\n (async (uoHash: Hex) => {\n return signMessage({ message: { raw: hexToBytes(uoHash) } });\n });\n\n const getFactoryAddress = async (): Promise<Address> =>\n parseFactoryAddressFromAccountInitCode(await getAccountInitCode())[0];\n\n const getFactoryData = async (): Promise<Hex> =>\n parseFactoryAddressFromAccountInitCode(await getAccountInitCode())[1];\n\n const encodeUpgradeToAndCall_ =\n encodeUpgradeToAndCall ??\n (() => {\n throw new UpgradesNotSupportedError(source);\n });\n\n const isAccountDeployed = async () => {\n const initCode = await getInitCode();\n return initCode === \"0x\";\n };\n\n const getNonce_ =\n getNonce ??\n (async (nonceKey = 0n): Promise<bigint> => {\n return entryPointContract.read.getNonce([\n accountAddress_,\n nonceKey,\n ]) as Promise<bigint>;\n });\n\n const account = toAccount({\n address: accountAddress_,\n signMessage,\n signTypedData,\n signTransaction: () => {\n throw new SignTransactionNotSupportedError();\n },\n });\n\n const create6492Signature = async (isDeployed: boolean, signature: Hex) => {\n if (isDeployed) {\n return signature;\n }\n\n const [factoryAddress, factoryCalldata] =\n parseFactoryAddressFromAccountInitCode(await getAccountInitCode());\n\n return wrapSignatureWith6492({\n factoryAddress,\n factoryCalldata,\n signature,\n });\n };\n\n const signMessageWith6492 = async (message: { message: SignableMessage }) => {\n const [isDeployed, signature] = await Promise.all([\n isAccountDeployed(),\n account.signMessage(message),\n ]);\n\n return create6492Signature(isDeployed, signature);\n };\n\n const signTypedDataWith6492 = async <\n const typedData extends TypedData | Record<string, unknown>,\n primaryType extends keyof typedData | \"EIP712Domain\" = keyof typedData,\n >(\n typedDataDefinition: TypedDataDefinition<typedData, primaryType>,\n ): Promise<Hex> => {\n const [isDeployed, signature] = await Promise.all([\n isAccountDeployed(),\n account.signTypedData(typedDataDefinition),\n ]);\n\n return create6492Signature(isDeployed, signature);\n };\n\n const getImplementationAddress_ =\n getImplementationAddress ??\n (async () => {\n const storage = await client.getStorageAt({\n address: account.address,\n // This is the default slot for the implementation address for Proxies\n slot: \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n });\n\n if (storage == null) {\n throw new FailedToGetStorageSlotError(\n \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n \"Proxy Implementation Address\",\n );\n }\n\n // The storage slot contains a full bytes32, but we want only the last 20 bytes.\n // So, slice off the leading `0x` and the first 12 bytes (24 characters), leaving the last 20 bytes, then prefix with `0x`.\n return `0x${storage.slice(26)}`;\n });\n\n if (entryPoint.version !== \"0.6.0\" && entryPoint.version !== \"0.7.0\") {\n throw new InvalidEntryPointError(chain, entryPoint.version);\n }\n\n if ((prepareSign_ && !formatSign_) || (!prepareSign_ && formatSign_)) {\n throw new Error(\n \"Must implement both prepareSign and formatSign or neither\",\n );\n }\n\n const prepareSign =\n prepareSign_ ??\n (() => {\n throw new Error(\"prepareSign not implemented\");\n });\n\n const formatSign =\n formatSign_ ??\n (() => {\n throw new Error(\"formatSign not implemented\");\n });\n\n return {\n ...account,\n source,\n // TODO: I think this should probably be signUserOperation instead\n // and allow for generating the UO hash based on the EP version\n signUserOperationHash: signUserOperationHash_,\n getFactoryAddress,\n getFactoryData,\n encodeBatchExecute:\n encodeBatchExecute ??\n (() => {\n throw new BatchExecutionNotSupportedError(source);\n }),\n encodeExecute,\n getDummySignature,\n getInitCode,\n encodeUpgradeToAndCall: encodeUpgradeToAndCall_,\n getEntryPoint: () => entryPoint,\n isAccountDeployed,\n getAccountNonce: getNonce_,\n signMessageWith6492,\n signTypedDataWith6492,\n getImplementationAddress: getImplementationAddress_,\n prepareSign,\n formatSign,\n };\n}\n","import type { Hex } from \"viem\";\nimport { BaseError } from \"./base.js\";\n\n/**\n * Error thrown when a transaction is missing the `to` address parameter. This class extends the `BaseError` class.\n */\nexport class TransactionMissingToParamError extends BaseError {\n override name = \"TransactionMissingToParamError\";\n\n /**\n * Throws an error indicating that a transaction is missing the `to` address in the request.\n */ constructor() {\n super(\"Transaction is missing `to` address set on request\");\n }\n}\n\n/**\n * Represents an error that occurs when a transaction cannot be found for a given user operation. This error extends from `BaseError`. The `hash` of the transaction is provided to indicate which transaction could not be found.\n */\nexport class FailedToFindTransactionError extends BaseError {\n override name = \"FailedToFindTransactionError\";\n\n /**\n * Constructs a new error message indicating a failure to find the transaction for the specified user operation hash.\n *\n * @param {Hex} hash The hexadecimal value representing the user operation hash.\n */\n constructor(hash: Hex) {\n super(`Failed to find transaction for user operation ${hash}`);\n }\n}\n","import {\n type Chain,\n type Client,\n type SendTransactionParameters,\n type Transport,\n} from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { TransactionMissingToParamError } from \"../../errors/transaction.js\";\nimport type {\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../../types.js\";\nimport { buildUserOperation } from \"./buildUserOperation.js\";\nimport type { UserOperationContext } from \"./types.js\";\nimport { clientHeaderTrack } from \"../../index.js\";\n\n/**\n * Performs `buildUserOperationFromTx` in batch and builds into a single, yet to be signed `UserOperation` (UO) struct. The output user operation struct will be filled with all gas fields (and paymaster data if a paymaster is used) based on the transactions data (`to`, `data`, `value`, `maxFeePerGas`, `maxPriorityFeePerGas`) computed using the configured `ClientMiddlewares` on the `SmartAccountClient`\n *\n * @example\n * ```ts\n * import type { RpcTransactionRequest } from \"viem\";\n * import { smartAccountClient } from \"./smartAccountClient\";\n * // [!code focus:99]\n * // buildUserOperationFromTx converts a traditional Ethereum transaction and returns\n * // the unsigned user operation struct after constructing the user operation struct\n * // through the middleware pipeline\n * const tx: RpcTransactionRequest = {\n * from, // ignored\n * to,\n * data: encodeFunctionData({\n * abi: ContractABI.abi,\n * functionName: \"func\",\n * args: [arg1, arg2, ...],\n * }),\n * };\n * const uoStruct = await smartAccountClient.buildUserOperationFromTx(tx);\n *\n * // signUserOperation signs the above unsigned user operation struct built\n * // using the account connected to the smart account client\n * const request = await smartAccountClient.signUserOperation({ uoStruct });\n *\n * // You can use the BundlerAction `sendRawUserOperation` (packages/core/src/actions/bundler/sendRawUserOperation.ts)\n * // to send the signed user operation request to the bundler, requesting the bundler to send the signed uo to the\n * // EntryPoint contract pointed at by the entryPoint address parameter\n * const entryPointAddress = client.account.getEntryPoint().address;\n * const uoHash = await smartAccountClient.sendRawUserOperation({ request, entryPoint: entryPointAddress });\n * ```\n *\n * @param {Client<Transport, TChain, TAccount>} client_ the smart account client to use for RPC requests\n * @param {SendTransactionParameters} args the send tx parameters\n * @param {UserOperationOverrides} overrides optional overrides to use for any of the fields\n * @param {TContext} context if the smart account client requires additinoal context for building UOs\n * @returns {Promise<UserOperationStruct<TEntryPointVersion>>} a Promise containing the built user operation\n */\nexport async function buildUserOperationFromTx<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TChainOverride extends Chain | undefined = Chain | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client_: Client<Transport, TChain, TAccount>,\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext,\n): Promise<UserOperationStruct<TEntryPointVersion>> {\n const client = clientHeaderTrack(client_, \"buildUserOperationFromTx\");\n const { account = client.account, ...request } = args;\n if (!account || typeof account === \"string\") {\n throw new AccountNotFoundError();\n }\n\n if (!request.to) {\n throw new TransactionMissingToParamError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"buildUserOperationFromTx\",\n client,\n );\n }\n\n const _overrides = {\n ...overrides,\n maxFeePerGas: request.maxFeePerGas ? request.maxFeePerGas : undefined,\n maxPriorityFeePerGas: request.maxPriorityFeePerGas\n ? request.maxPriorityFeePerGas\n : undefined,\n } as UserOperationOverrides<TEntryPointVersion>;\n\n return buildUserOperation(client, {\n uo: {\n target: request.to,\n data: request.data ?? \"0x\",\n value: request.value ? request.value : 0n,\n },\n account: account as SmartContractAccount,\n context,\n overrides: _overrides,\n });\n}\n","export var util;\n(function (util) {\n util.assertEqual = (_) => { };\n function assertIs(_arg) { }\n util.assertIs = assertIs;\n function assertNever(_x) {\n throw new Error();\n }\n util.assertNever = assertNever;\n util.arrayToEnum = (items) => {\n const obj = {};\n for (const item of items) {\n obj[item] = item;\n }\n return obj;\n };\n util.getValidEnumValues = (obj) => {\n const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== \"number\");\n const filtered = {};\n for (const k of validKeys) {\n filtered[k] = obj[k];\n }\n return util.objectValues(filtered);\n };\n util.objectValues = (obj) => {\n return util.objectKeys(obj).map(function (e) {\n return obj[e];\n });\n };\n util.objectKeys = typeof Object.keys === \"function\" // eslint-disable-line ban/ban\n ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban\n : (object) => {\n const keys = [];\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n keys.push(key);\n }\n }\n return keys;\n };\n util.find = (arr, checker) => {\n for (const item of arr) {\n if (checker(item))\n return item;\n }\n return undefined;\n };\n util.isInteger = typeof Number.isInteger === \"function\"\n ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban\n : (val) => typeof val === \"number\" && Number.isFinite(val) && Math.floor(val) === val;\n function joinValues(array, separator = \" | \") {\n return array.map((val) => (typeof val === \"string\" ? `'${val}'` : val)).join(separator);\n }\n util.joinValues = joinValues;\n util.jsonStringifyReplacer = (_, value) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n };\n})(util || (util = {}));\nexport var objectUtil;\n(function (objectUtil) {\n objectUtil.mergeShapes = (first, second) => {\n return {\n ...first,\n ...second, // second overwrites first\n };\n };\n})(objectUtil || (objectUtil = {}));\nexport const ZodParsedType = util.arrayToEnum([\n \"string\",\n \"nan\",\n \"number\",\n \"integer\",\n \"float\",\n \"boolean\",\n \"date\",\n \"bigint\",\n \"symbol\",\n \"function\",\n \"undefined\",\n \"null\",\n \"array\",\n \"object\",\n \"unknown\",\n \"promise\",\n \"void\",\n \"never\",\n \"map\",\n \"set\",\n]);\nexport const getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return ZodParsedType.undefined;\n case \"string\":\n return ZodParsedType.string;\n case \"number\":\n return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;\n case \"boolean\":\n return ZodParsedType.boolean;\n case \"function\":\n return ZodParsedType.function;\n case \"bigint\":\n return ZodParsedType.bigint;\n case \"symbol\":\n return ZodParsedType.symbol;\n case \"object\":\n if (Array.isArray(data)) {\n return ZodParsedType.array;\n }\n if (data === null) {\n return ZodParsedType.null;\n }\n if (data.then && typeof data.then === \"function\" && data.catch && typeof data.catch === \"function\") {\n return ZodParsedType.promise;\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return ZodParsedType.map;\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return ZodParsedType.set;\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return ZodParsedType.date;\n }\n return ZodParsedType.object;\n default:\n return ZodParsedType.unknown;\n }\n};\n","import { util } from \"./helpers/util.js\";\nexport const ZodIssueCode = util.arrayToEnum([\n \"invalid_type\",\n \"invalid_literal\",\n \"custom\",\n \"invalid_union\",\n \"invalid_union_discriminator\",\n \"invalid_enum_value\",\n \"unrecognized_keys\",\n \"invalid_arguments\",\n \"invalid_return_type\",\n \"invalid_date\",\n \"invalid_string\",\n \"too_small\",\n \"too_big\",\n \"invalid_intersection_types\",\n \"not_multiple_of\",\n \"not_finite\",\n]);\nexport const quotelessJson = (obj) => {\n const json = JSON.stringify(obj, null, 2);\n return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};\nexport class ZodError extends Error {\n get errors() {\n return this.issues;\n }\n constructor(issues) {\n super();\n this.issues = [];\n this.addIssue = (sub) => {\n this.issues = [...this.issues, sub];\n };\n this.addIssues = (subs = []) => {\n this.issues = [...this.issues, ...subs];\n };\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n // eslint-disable-next-line ban/ban\n Object.setPrototypeOf(this, actualProto);\n }\n else {\n this.__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }\n format(_mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n }\n else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n }\n else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n }\n else if (issue.path.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i];\n const terminal = i === issue.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n // if (typeof el === \"string\") {\n // curr[el] = curr[el] || { _errors: [] };\n // } else if (typeof el === \"number\") {\n // const errorArray: any = [];\n // errorArray._errors = [];\n // curr[el] = curr[el] || errorArray;\n // }\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n };\n processError(this);\n return fieldErrors;\n }\n static assert(value) {\n if (!(value instanceof ZodError)) {\n throw new Error(`Not a ZodError: ${value}`);\n }\n }\n toString() {\n return this.message;\n }\n get message() {\n return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);\n }\n get isEmpty() {\n return this.issues.length === 0;\n }\n flatten(mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n const firstEl = sub.path[0];\n fieldErrors[firstEl] = fieldErrors[firstEl] || [];\n fieldErrors[firstEl].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }\n get formErrors() {\n return this.flatten();\n }\n}\nZodError.create = (issues) => {\n const error = new ZodError(issues);\n return error;\n};\n","import { ZodIssueCode } from \"../ZodError.js\";\nimport { util, ZodParsedType } from \"../helpers/util.js\";\nconst errorMap = (issue, _ctx) => {\n let message;\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n if (issue.received === ZodParsedType.undefined) {\n message = \"Required\";\n }\n else {\n message = `Expected ${issue.expected}, received ${issue.received}`;\n }\n break;\n case ZodIssueCode.invalid_literal:\n message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;\n break;\n case ZodIssueCode.unrecognized_keys:\n message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, \", \")}`;\n break;\n case ZodIssueCode.invalid_union:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_union_discriminator:\n message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;\n break;\n case ZodIssueCode.invalid_enum_value:\n message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;\n break;\n case ZodIssueCode.invalid_arguments:\n message = `Invalid function arguments`;\n break;\n case ZodIssueCode.invalid_return_type:\n message = `Invalid function return type`;\n break;\n case ZodIssueCode.invalid_date:\n message = `Invalid date`;\n break;\n case ZodIssueCode.invalid_string:\n if (typeof issue.validation === \"object\") {\n if (\"includes\" in issue.validation) {\n message = `Invalid input: must include \"${issue.validation.includes}\"`;\n if (typeof issue.validation.position === \"number\") {\n message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;\n }\n }\n else if (\"startsWith\" in issue.validation) {\n message = `Invalid input: must start with \"${issue.validation.startsWith}\"`;\n }\n else if (\"endsWith\" in issue.validation) {\n message = `Invalid input: must end with \"${issue.validation.endsWith}\"`;\n }\n else {\n util.assertNever(issue.validation);\n }\n }\n else if (issue.validation !== \"regex\") {\n message = `Invalid ${issue.validation}`;\n }\n else {\n message = \"Invalid\";\n }\n break;\n case ZodIssueCode.too_small:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;\n else if (issue.type === \"bigint\")\n message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.too_big:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;\n else if (issue.type === \"bigint\")\n message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodIssueCode.custom:\n message = `Invalid input`;\n break;\n case ZodIssueCode.invalid_intersection_types:\n message = `Intersection results could not be merged`;\n break;\n case ZodIssueCode.not_multiple_of:\n message = `Number must be a multiple of ${issue.multipleOf}`;\n break;\n case ZodIssueCode.not_finite:\n message = \"Number must be finite\";\n break;\n default:\n message = _ctx.defaultError;\n util.assertNever(issue);\n }\n return { message };\n};\nexport default errorMap;\n","import defaultErrorMap from \"./locales/en.js\";\nlet overrideErrorMap = defaultErrorMap;\nexport { defaultErrorMap };\nexport function setErrorMap(map) {\n overrideErrorMap = map;\n}\nexport function getErrorMap() {\n return overrideErrorMap;\n}\n","import { getErrorMap } from \"../errors.js\";\nimport defaultErrorMap from \"../locales/en.js\";\nexport const makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n if (issueData.message !== undefined) {\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message,\n };\n }\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: errorMessage,\n };\n};\nexport const EMPTY_PATH = [];\nexport function addIssueToContext(ctx, issueData) {\n const overrideMap = getErrorMap();\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap, // contextual error map is first priority\n ctx.schemaErrorMap, // then schema-bound map if available\n overrideMap, // then global override map\n overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}\nexport class ParseStatus {\n constructor() {\n this.value = \"valid\";\n }\n dirty() {\n if (this.value === \"valid\")\n this.value = \"dirty\";\n }\n abort() {\n if (this.value !== \"aborted\")\n this.value = \"aborted\";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s of results) {\n if (s.status === \"aborted\")\n return INVALID;\n if (s.status === \"dirty\")\n status.dirty();\n arrayValue.push(s.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\")\n return INVALID;\n if (value.status === \"aborted\")\n return INVALID;\n if (key.status === \"dirty\")\n status.dirty();\n if (value.status === \"dirty\")\n status.dirty();\n if (key.value !== \"__proto__\" && (typeof value.value !== \"undefined\" || pair.alwaysSet)) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nexport const INVALID = Object.freeze({\n status: \"aborted\",\n});\nexport const DIRTY = (value) => ({ status: \"dirty\", value });\nexport const OK = (value) => ({ status: \"valid\", value });\nexport const isAborted = (x) => x.status === \"aborted\";\nexport const isDirty = (x) => x.status === \"dirty\";\nexport const isValid = (x) => x.status === \"valid\";\nexport const isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\n","export {};\n","export var errorUtil;\n(function (errorUtil) {\n errorUtil.errToObj = (message) => typeof message === \"string\" ? { message } : message || {};\n // biome-ignore lint:\n errorUtil.toString = (message) => typeof message === \"string\" ? message : message?.message;\n})(errorUtil || (errorUtil = {}));\n","import { ZodError, ZodIssueCode, } from \"./ZodError.js\";\nimport { defaultErrorMap, getErrorMap } from \"./errors.js\";\nimport { errorUtil } from \"./helpers/errorUtil.js\";\nimport { DIRTY, INVALID, OK, ParseStatus, addIssueToContext, isAborted, isAsync, isDirty, isValid, makeIssue, } from \"./helpers/parseUtil.js\";\nimport { util, ZodParsedType, getParsedType } from \"./helpers/util.js\";\nclass ParseInputLazyPath {\n constructor(parent, value, path, key) {\n this._cachedPath = [];\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }\n get path() {\n if (!this._cachedPath.length) {\n if (Array.isArray(this._key)) {\n this._cachedPath.push(...this._path, ...this._key);\n }\n else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n return this._cachedPath;\n }\n}\nconst handleResult = (ctx, result) => {\n if (isValid(result)) {\n return { success: true, data: result.value };\n }\n else {\n if (!ctx.common.issues.length) {\n throw new Error(\"Validation failed but no issues detected.\");\n }\n return {\n success: false,\n get error() {\n if (this._error)\n return this._error;\n const error = new ZodError(ctx.common.issues);\n this._error = error;\n return this._error;\n },\n };\n }\n};\nfunction processCreateParams(params) {\n if (!params)\n return {};\n const { errorMap, invalid_type_error, required_error, description } = params;\n if (errorMap && (invalid_type_error || required_error)) {\n throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);\n }\n if (errorMap)\n return { errorMap: errorMap, description };\n const customMap = (iss, ctx) => {\n const { message } = params;\n if (iss.code === \"invalid_enum_value\") {\n return { message: message ?? ctx.defaultError };\n }\n if (typeof ctx.data === \"undefined\") {\n return { message: message ?? required_error ?? ctx.defaultError };\n }\n if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n return { message: message ?? invalid_type_error ?? ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nexport class ZodType {\n get description() {\n return this._def.description;\n }\n _getType(input) {\n return getParsedType(input.data);\n }\n _getOrReturnCtx(input, ctx) {\n return (ctx || {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n });\n }\n _processInputParams(input) {\n return {\n status: new ParseStatus(),\n ctx: {\n common: input.parent.common,\n data: input.data,\n parsedType: getParsedType(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n },\n };\n }\n _parseSync(input) {\n const result = this._parse(input);\n if (isAsync(result)) {\n throw new Error(\"Synchronous parse encountered promise.\");\n }\n return result;\n }\n _parseAsync(input) {\n const result = this._parse(input);\n return Promise.resolve(result);\n }\n parse(data, params) {\n const result = this.safeParse(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n safeParse(data, params) {\n const ctx = {\n common: {\n issues: [],\n async: params?.async ?? false,\n contextualErrorMap: params?.errorMap,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n return handleResult(ctx, result);\n }\n \"~validate\"(data) {\n const ctx = {\n common: {\n issues: [],\n async: !!this[\"~standard\"].async,\n },\n path: [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n if (!this[\"~standard\"].async) {\n try {\n const result = this._parseSync({ data, path: [], parent: ctx });\n return isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n };\n }\n catch (err) {\n if (err?.message?.toLowerCase()?.includes(\"encountered\")) {\n this[\"~standard\"].async = true;\n }\n ctx.common = {\n issues: [],\n async: true,\n };\n }\n }\n return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result)\n ? {\n value: result.value,\n }\n : {\n issues: ctx.common.issues,\n });\n }\n async parseAsync(data, params) {\n const result = await this.safeParseAsync(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n async safeParseAsync(data, params) {\n const ctx = {\n common: {\n issues: [],\n contextualErrorMap: params?.errorMap,\n async: true,\n },\n path: params?.path || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: getParsedType(data),\n };\n const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));\n return handleResult(ctx, result);\n }\n refine(check, message) {\n const getIssueProperties = (val) => {\n if (typeof message === \"string\" || typeof message === \"undefined\") {\n return { message };\n }\n else if (typeof message === \"function\") {\n return message(val);\n }\n else {\n return message;\n }\n };\n return this._refinement((val, ctx) => {\n const result = check(val);\n const setError = () => ctx.addIssue({\n code: ZodIssueCode.custom,\n ...getIssueProperties(val),\n });\n if (typeof Promise !== \"undefined\" && result instanceof Promise) {\n return result.then((data) => {\n if (!data) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n if (!result) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n refinement(check, refinementData) {\n return this._refinement((val, ctx) => {\n if (!check(val)) {\n ctx.addIssue(typeof refinementData === \"function\" ? refinementData(val, ctx) : refinementData);\n return false;\n }\n else {\n return true;\n }\n });\n }\n _refinement(refinement) {\n return new ZodEffects({\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"refinement\", refinement },\n });\n }\n superRefine(refinement) {\n return this._refinement(refinement);\n }\n constructor(def) {\n /** Alias of safeParseAsync */\n this.spa = this.safeParseAsync;\n this._def = def;\n this.parse = this.parse.bind(this);\n this.safeParse = this.safeParse.bind(this);\n this.parseAsync = this.parseAsync.bind(this);\n this.safeParseAsync = this.safeParseAsync.bind(this);\n this.spa = this.spa.bind(this);\n this.refine = this.refine.bind(this);\n this.refinement = this.refinement.bind(this);\n this.superRefine = this.superRefine.bind(this);\n this.optional = this.optional.bind(this);\n this.nullable = this.nullable.bind(this);\n this.nullish = this.nullish.bind(this);\n this.array = this.array.bind(this);\n this.promise = this.promise.bind(this);\n this.or = this.or.bind(this);\n this.and = this.and.bind(this);\n this.transform = this.transform.bind(this);\n this.brand = this.brand.bind(this);\n this.default = this.default.bind(this);\n this.catch = this.catch.bind(this);\n this.describe = this.describe.bind(this);\n this.pipe = this.pipe.bind(this);\n this.readonly = this.readonly.bind(this);\n this.isNullable = this.isNullable.bind(this);\n this.isOptional = this.isOptional.bind(this);\n this[\"~standard\"] = {\n version: 1,\n vendor: \"zod\",\n validate: (data) => this[\"~validate\"](data),\n };\n }\n optional() {\n return ZodOptional.create(this, this._def);\n }\n nullable() {\n return ZodNullable.create(this, this._def);\n }\n nullish() {\n return this.nullable().optional();\n }\n array() {\n return ZodArray.create(this);\n }\n promise() {\n return ZodPromise.create(this, this._def);\n }\n or(option) {\n return ZodUnion.create([this, option], this._def);\n }\n and(incoming) {\n return ZodIntersection.create(this, incoming, this._def);\n }\n transform(transform) {\n return new ZodEffects({\n ...processCreateParams(this._def),\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"transform\", transform },\n });\n }\n default(def) {\n const defaultValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodDefault({\n ...processCreateParams(this._def),\n innerType: this,\n defaultValue: defaultValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n });\n }\n brand() {\n return new ZodBranded({\n typeName: ZodFirstPartyTypeKind.ZodBranded,\n type: this,\n ...processCreateParams(this._def),\n });\n }\n catch(def) {\n const catchValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodCatch({\n ...processCreateParams(this._def),\n innerType: this,\n catchValue: catchValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n });\n }\n describe(description) {\n const This = this.constructor;\n return new This({\n ...this._def,\n description,\n });\n }\n pipe(target) {\n return ZodPipeline.create(this, target);\n }\n readonly() {\n return ZodReadonly.create(this);\n }\n isOptional() {\n return this.safeParse(undefined).success;\n }\n isNullable() {\n return this.safeParse(null).success;\n }\n}\nconst cuidRegex = /^c[^\\s-]{8,}$/i;\nconst cuid2Regex = /^[0-9a-z]+$/;\nconst ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;\n// const uuidRegex =\n// /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;\nconst uuidRegex = /^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i;\nconst nanoidRegex = /^[a-z0-9_-]{21}$/i;\nconst jwtRegex = /^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/;\nconst durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/;\n// from https://stackoverflow.com/a/46181/1550155\n// old version: too slow, didn't support unicode\n// const emailRegex = /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i;\n//old email regex\n// const emailRegex = /^(([^<>()[\\].,;:\\s@\"]+(\\.[^<>()[\\].,;:\\s@\"]+)*)|(\".+\"))@((?!-)([^<>()[\\].,;:\\s@\"]+\\.)+[^<>()[\\].,;:\\s@\"]{1,})[^-<>()[\\].,;:\\s@\"]$/i;\n// eslint-disable-next-line\n// const emailRegex =\n// /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\])|(\\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\\.[A-Za-z]{2,})+))$/;\n// const emailRegex =\n// /^[a-zA-Z0-9\\.\\!\\#\\$\\%\\&\\'\\*\\+\\/\\=\\?\\^\\_\\`\\{\\|\\}\\~\\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n// const emailRegex =\n// /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$/i;\nconst emailRegex = /^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i;\n// const emailRegex =\n// /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\\.[a-z0-9\\-]+)*$/i;\n// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression\nconst _emojiRegex = `^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$`;\nlet emojiRegex;\n// faster, simpler, safer\nconst ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;\nconst ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/;\n// const ipv6Regex =\n// /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;\nconst ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;\nconst ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;\n// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript\nconst base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;\n// https://base64.guru/standards/base64url\nconst base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;\n// simple\n// const dateRegexSource = `\\\\d{4}-\\\\d{2}-\\\\d{2}`;\n// no leap year validation\n// const dateRegexSource = `\\\\d{4}-((0[13578]|10|12)-31|(0[13-9]|1[0-2])-30|(0[1-9]|1[0-2])-(0[1-9]|1\\\\d|2\\\\d))`;\n// with leap year validation\nconst dateRegexSource = `((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))`;\nconst dateRegex = new RegExp(`^${dateRegexSource}$`);\nfunction timeRegexSource(args) {\n let secondsRegexSource = `[0-5]\\\\d`;\n if (args.precision) {\n secondsRegexSource = `${secondsRegexSource}\\\\.\\\\d{${args.precision}}`;\n }\n else if (args.precision == null) {\n secondsRegexSource = `${secondsRegexSource}(\\\\.\\\\d+)?`;\n }\n const secondsQuantifier = args.precision ? \"+\" : \"?\"; // require seconds if precision is nonzero\n return `([01]\\\\d|2[0-3]):[0-5]\\\\d(:${secondsRegexSource})${secondsQuantifier}`;\n}\nfunction timeRegex(args) {\n return new RegExp(`^${timeRegexSource(args)}$`);\n}\n// Adapted from https://stackoverflow.com/a/3143231\nexport function datetimeRegex(args) {\n let regex = `${dateRegexSource}T${timeRegexSource(args)}`;\n const opts = [];\n opts.push(args.local ? `Z?` : `Z`);\n if (args.offset)\n opts.push(`([+-]\\\\d{2}:?\\\\d{2})`);\n regex = `${regex}(${opts.join(\"|\")})`;\n return new RegExp(`^${regex}$`);\n}\nfunction isValidIP(ip, version) {\n if ((version === \"v4\" || !version) && ipv4Regex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6Regex.test(ip)) {\n return true;\n }\n return false;\n}\nfunction isValidJWT(jwt, alg) {\n if (!jwtRegex.test(jwt))\n return false;\n try {\n const [header] = jwt.split(\".\");\n if (!header)\n return false;\n // Convert base64url to base64\n const base64 = header\n .replace(/-/g, \"+\")\n .replace(/_/g, \"/\")\n .padEnd(header.length + ((4 - (header.length % 4)) % 4), \"=\");\n const decoded = JSON.parse(atob(base64));\n if (typeof decoded !== \"object\" || decoded === null)\n return false;\n if (\"typ\" in decoded && decoded?.typ !== \"JWT\")\n return false;\n if (!decoded.alg)\n return false;\n if (alg && decoded.alg !== alg)\n return false;\n return true;\n }\n catch {\n return false;\n }\n}\nfunction isValidCidr(ip, version) {\n if ((version === \"v4\" || !version) && ipv4CidrRegex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6CidrRegex.test(ip)) {\n return true;\n }\n return false;\n}\nexport class ZodString extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = String(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.string) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.string,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.length < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.length > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"length\") {\n const tooBig = input.data.length > check.value;\n const tooSmall = input.data.length < check.value;\n if (tooBig || tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n if (tooBig) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n else if (tooSmall) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n status.dirty();\n }\n }\n else if (check.kind === \"email\") {\n if (!emailRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"email\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"emoji\") {\n if (!emojiRegex) {\n emojiRegex = new RegExp(_emojiRegex, \"u\");\n }\n if (!emojiRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"emoji\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"uuid\") {\n if (!uuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"uuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"nanoid\") {\n if (!nanoidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"nanoid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid\") {\n if (!cuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid2\") {\n if (!cuid2Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cuid2\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ulid\") {\n if (!ulidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ulid\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"url\") {\n try {\n new URL(input.data);\n }\n catch {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"regex\") {\n check.regex.lastIndex = 0;\n const testResult = check.regex.test(input.data);\n if (!testResult) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"regex\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"trim\") {\n input.data = input.data.trim();\n }\n else if (check.kind === \"includes\") {\n if (!input.data.includes(check.value, check.position)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { includes: check.value, position: check.position },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"toLowerCase\") {\n input.data = input.data.toLowerCase();\n }\n else if (check.kind === \"toUpperCase\") {\n input.data = input.data.toUpperCase();\n }\n else if (check.kind === \"startsWith\") {\n if (!input.data.startsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { startsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"endsWith\") {\n if (!input.data.endsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: { endsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"datetime\") {\n const regex = datetimeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"datetime\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"date\") {\n const regex = dateRegex;\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"date\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"time\") {\n const regex = timeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_string,\n validation: \"time\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"duration\") {\n if (!durationRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"duration\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ip\") {\n if (!isValidIP(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"ip\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"jwt\") {\n if (!isValidJWT(input.data, check.alg)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"jwt\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cidr\") {\n if (!isValidCidr(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"cidr\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64\") {\n if (!base64Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"base64url\") {\n if (!base64urlRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n validation: \"base64url\",\n code: ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _regex(regex, validation, message) {\n return this.refinement((data) => regex.test(data), {\n validation,\n code: ZodIssueCode.invalid_string,\n ...errorUtil.errToObj(message),\n });\n }\n _addCheck(check) {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n email(message) {\n return this._addCheck({ kind: \"email\", ...errorUtil.errToObj(message) });\n }\n url(message) {\n return this._addCheck({ kind: \"url\", ...errorUtil.errToObj(message) });\n }\n emoji(message) {\n return this._addCheck({ kind: \"emoji\", ...errorUtil.errToObj(message) });\n }\n uuid(message) {\n return this._addCheck({ kind: \"uuid\", ...errorUtil.errToObj(message) });\n }\n nanoid(message) {\n return this._addCheck({ kind: \"nanoid\", ...errorUtil.errToObj(message) });\n }\n cuid(message) {\n return this._addCheck({ kind: \"cuid\", ...errorUtil.errToObj(message) });\n }\n cuid2(message) {\n return this._addCheck({ kind: \"cuid2\", ...errorUtil.errToObj(message) });\n }\n ulid(message) {\n return this._addCheck({ kind: \"ulid\", ...errorUtil.errToObj(message) });\n }\n base64(message) {\n return this._addCheck({ kind: \"base64\", ...errorUtil.errToObj(message) });\n }\n base64url(message) {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return this._addCheck({\n kind: \"base64url\",\n ...errorUtil.errToObj(message),\n });\n }\n jwt(options) {\n return this._addCheck({ kind: \"jwt\", ...errorUtil.errToObj(options) });\n }\n ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil.errToObj(options) });\n }\n cidr(options) {\n return this._addCheck({ kind: \"cidr\", ...errorUtil.errToObj(options) });\n }\n datetime(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: false,\n local: false,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"datetime\",\n precision: typeof options?.precision === \"undefined\" ? null : options?.precision,\n offset: options?.offset ?? false,\n local: options?.local ?? false,\n ...errorUtil.errToObj(options?.message),\n });\n }\n date(message) {\n return this._addCheck({ kind: \"date\", message });\n }\n time(options) {\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"time\",\n precision: null,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"time\",\n precision: typeof options?.precision === \"undefined\" ? null : options?.precision,\n ...errorUtil.errToObj(options?.message),\n });\n }\n duration(message) {\n return this._addCheck({ kind: \"duration\", ...errorUtil.errToObj(message) });\n }\n regex(regex, message) {\n return this._addCheck({\n kind: \"regex\",\n regex: regex,\n ...errorUtil.errToObj(message),\n });\n }\n includes(value, options) {\n return this._addCheck({\n kind: \"includes\",\n value: value,\n position: options?.position,\n ...errorUtil.errToObj(options?.message),\n });\n }\n startsWith(value, message) {\n return this._addCheck({\n kind: \"startsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n endsWith(value, message) {\n return this._addCheck({\n kind: \"endsWith\",\n value: value,\n ...errorUtil.errToObj(message),\n });\n }\n min(minLength, message) {\n return this._addCheck({\n kind: \"min\",\n value: minLength,\n ...errorUtil.errToObj(message),\n });\n }\n max(maxLength, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxLength,\n ...errorUtil.errToObj(message),\n });\n }\n length(len, message) {\n return this._addCheck({\n kind: \"length\",\n value: len,\n ...errorUtil.errToObj(message),\n });\n }\n /**\n * Equivalent to `.min(1)`\n */\n nonempty(message) {\n return this.min(1, errorUtil.errToObj(message));\n }\n trim() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"trim\" }],\n });\n }\n toLowerCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toLowerCase\" }],\n });\n }\n toUpperCase() {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toUpperCase\" }],\n });\n }\n get isDatetime() {\n return !!this._def.checks.find((ch) => ch.kind === \"datetime\");\n }\n get isDate() {\n return !!this._def.checks.find((ch) => ch.kind === \"date\");\n }\n get isTime() {\n return !!this._def.checks.find((ch) => ch.kind === \"time\");\n }\n get isDuration() {\n return !!this._def.checks.find((ch) => ch.kind === \"duration\");\n }\n get isEmail() {\n return !!this._def.checks.find((ch) => ch.kind === \"email\");\n }\n get isURL() {\n return !!this._def.checks.find((ch) => ch.kind === \"url\");\n }\n get isEmoji() {\n return !!this._def.checks.find((ch) => ch.kind === \"emoji\");\n }\n get isUUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"uuid\");\n }\n get isNANOID() {\n return !!this._def.checks.find((ch) => ch.kind === \"nanoid\");\n }\n get isCUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid\");\n }\n get isCUID2() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid2\");\n }\n get isULID() {\n return !!this._def.checks.find((ch) => ch.kind === \"ulid\");\n }\n get isIP() {\n return !!this._def.checks.find((ch) => ch.kind === \"ip\");\n }\n get isCIDR() {\n return !!this._def.checks.find((ch) => ch.kind === \"cidr\");\n }\n get isBase64() {\n return !!this._def.checks.find((ch) => ch.kind === \"base64\");\n }\n get isBase64url() {\n // base64url encoding is a modification of base64 that can safely be used in URLs and filenames\n return !!this._def.checks.find((ch) => ch.kind === \"base64url\");\n }\n get minLength() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxLength() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodString.create = (params) => {\n return new ZodString({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodString,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params),\n });\n};\n// https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034\nfunction floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n const stepDecCount = (step.toString().split(\".\")[1] || \"\").length;\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = Number.parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n const stepInt = Number.parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n return (valInt % stepInt) / 10 ** decCount;\n}\nexport class ZodNumber extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n this.step = this.multipleOf;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = Number(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.number) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.number,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"int\") {\n if (!util.isInteger(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: \"integer\",\n received: \"float\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"min\") {\n const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (floatSafeRemainder(input.data, check.value) !== 0) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"finite\") {\n if (!Number.isFinite(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_finite,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodNumber({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodNumber({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n int(message) {\n return this._addCheck({\n kind: \"int\",\n message: errorUtil.toString(message),\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value: value,\n message: errorUtil.toString(message),\n });\n }\n finite(message) {\n return this._addCheck({\n kind: \"finite\",\n message: errorUtil.toString(message),\n });\n }\n safe(message) {\n return this._addCheck({\n kind: \"min\",\n inclusive: true,\n value: Number.MIN_SAFE_INTEGER,\n message: errorUtil.toString(message),\n })._addCheck({\n kind: \"max\",\n inclusive: true,\n value: Number.MAX_SAFE_INTEGER,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n get isInt() {\n return !!this._def.checks.find((ch) => ch.kind === \"int\" || (ch.kind === \"multipleOf\" && util.isInteger(ch.value)));\n }\n get isFinite() {\n let max = null;\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"finite\" || ch.kind === \"int\" || ch.kind === \"multipleOf\") {\n return true;\n }\n else if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n else if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return Number.isFinite(min) && Number.isFinite(max);\n }\n}\nZodNumber.create = (params) => {\n return new ZodNumber({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodNumber,\n coerce: params?.coerce || false,\n ...processCreateParams(params),\n });\n};\nexport class ZodBigInt extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n }\n _parse(input) {\n if (this._def.coerce) {\n try {\n input.data = BigInt(input.data);\n }\n catch {\n return this._getInvalidInput(input);\n }\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.bigint) {\n return this._getInvalidInput(input);\n }\n let ctx = undefined;\n const status = new ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n type: \"bigint\",\n minimum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n type: \"bigint\",\n maximum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (input.data % check.value !== BigInt(0)) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _getInvalidInput(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.bigint,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodBigInt({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodBigInt({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value,\n message: errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nZodBigInt.create = (params) => {\n return new ZodBigInt({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodBigInt,\n coerce: params?.coerce ?? false,\n ...processCreateParams(params),\n });\n};\nexport class ZodBoolean extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = Boolean(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.boolean) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.boolean,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodBoolean.create = (params) => {\n return new ZodBoolean({\n typeName: ZodFirstPartyTypeKind.ZodBoolean,\n coerce: params?.coerce || false,\n ...processCreateParams(params),\n });\n};\nexport class ZodDate extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = new Date(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.date) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.date,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (Number.isNaN(input.data.getTime())) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_date,\n });\n return INVALID;\n }\n const status = new ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.getTime() < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n message: check.message,\n inclusive: true,\n exact: false,\n minimum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.getTime() > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n message: check.message,\n inclusive: true,\n exact: false,\n maximum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else {\n util.assertNever(check);\n }\n }\n return {\n status: status.value,\n value: new Date(input.data.getTime()),\n };\n }\n _addCheck(check) {\n return new ZodDate({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n min(minDate, message) {\n return this._addCheck({\n kind: \"min\",\n value: minDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n max(maxDate, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxDate.getTime(),\n message: errorUtil.toString(message),\n });\n }\n get minDate() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min != null ? new Date(min) : null;\n }\n get maxDate() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max != null ? new Date(max) : null;\n }\n}\nZodDate.create = (params) => {\n return new ZodDate({\n checks: [],\n coerce: params?.coerce || false,\n typeName: ZodFirstPartyTypeKind.ZodDate,\n ...processCreateParams(params),\n });\n};\nexport class ZodSymbol extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.symbol) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.symbol,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodSymbol.create = (params) => {\n return new ZodSymbol({\n typeName: ZodFirstPartyTypeKind.ZodSymbol,\n ...processCreateParams(params),\n });\n};\nexport class ZodUndefined extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.undefined,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodUndefined.create = (params) => {\n return new ZodUndefined({\n typeName: ZodFirstPartyTypeKind.ZodUndefined,\n ...processCreateParams(params),\n });\n};\nexport class ZodNull extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.null) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.null,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodNull.create = (params) => {\n return new ZodNull({\n typeName: ZodFirstPartyTypeKind.ZodNull,\n ...processCreateParams(params),\n });\n};\nexport class ZodAny extends ZodType {\n constructor() {\n super(...arguments);\n // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.\n this._any = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodAny.create = (params) => {\n return new ZodAny({\n typeName: ZodFirstPartyTypeKind.ZodAny,\n ...processCreateParams(params),\n });\n};\nexport class ZodUnknown extends ZodType {\n constructor() {\n super(...arguments);\n // required\n this._unknown = true;\n }\n _parse(input) {\n return OK(input.data);\n }\n}\nZodUnknown.create = (params) => {\n return new ZodUnknown({\n typeName: ZodFirstPartyTypeKind.ZodUnknown,\n ...processCreateParams(params),\n });\n};\nexport class ZodNever extends ZodType {\n _parse(input) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.never,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n}\nZodNever.create = (params) => {\n return new ZodNever({\n typeName: ZodFirstPartyTypeKind.ZodNever,\n ...processCreateParams(params),\n });\n};\nexport class ZodVoid extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.void,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n}\nZodVoid.create = (params) => {\n return new ZodVoid({\n typeName: ZodFirstPartyTypeKind.ZodVoid,\n ...processCreateParams(params),\n });\n};\nexport class ZodArray extends ZodType {\n _parse(input) {\n const { ctx, status } = this._processInputParams(input);\n const def = this._def;\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (def.exactLength !== null) {\n const tooBig = ctx.data.length > def.exactLength.value;\n const tooSmall = ctx.data.length < def.exactLength.value;\n if (tooBig || tooSmall) {\n addIssueToContext(ctx, {\n code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,\n minimum: (tooSmall ? def.exactLength.value : undefined),\n maximum: (tooBig ? def.exactLength.value : undefined),\n type: \"array\",\n inclusive: true,\n exact: true,\n message: def.exactLength.message,\n });\n status.dirty();\n }\n }\n if (def.minLength !== null) {\n if (ctx.data.length < def.minLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.minLength.message,\n });\n status.dirty();\n }\n }\n if (def.maxLength !== null) {\n if (ctx.data.length > def.maxLength.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.maxLength.message,\n });\n status.dirty();\n }\n }\n if (ctx.common.async) {\n return Promise.all([...ctx.data].map((item, i) => {\n return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n })).then((result) => {\n return ParseStatus.mergeArray(status, result);\n });\n }\n const result = [...ctx.data].map((item, i) => {\n return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n });\n return ParseStatus.mergeArray(status, result);\n }\n get element() {\n return this._def.type;\n }\n min(minLength, message) {\n return new ZodArray({\n ...this._def,\n minLength: { value: minLength, message: errorUtil.toString(message) },\n });\n }\n max(maxLength, message) {\n return new ZodArray({\n ...this._def,\n maxLength: { value: maxLength, message: errorUtil.toString(message) },\n });\n }\n length(len, message) {\n return new ZodArray({\n ...this._def,\n exactLength: { value: len, message: errorUtil.toString(message) },\n });\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodArray.create = (schema, params) => {\n return new ZodArray({\n type: schema,\n minLength: null,\n maxLength: null,\n exactLength: null,\n typeName: ZodFirstPartyTypeKind.ZodArray,\n ...processCreateParams(params),\n });\n};\nfunction deepPartialify(schema) {\n if (schema instanceof ZodObject) {\n const newShape = {};\n for (const key in schema.shape) {\n const fieldSchema = schema.shape[key];\n newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));\n }\n return new ZodObject({\n ...schema._def,\n shape: () => newShape,\n });\n }\n else if (schema instanceof ZodArray) {\n return new ZodArray({\n ...schema._def,\n type: deepPartialify(schema.element),\n });\n }\n else if (schema instanceof ZodOptional) {\n return ZodOptional.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodNullable) {\n return ZodNullable.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodTuple) {\n return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));\n }\n else {\n return schema;\n }\n}\nexport class ZodObject extends ZodType {\n constructor() {\n super(...arguments);\n this._cached = null;\n /**\n * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.\n * If you want to pass through unknown properties, use `.passthrough()` instead.\n */\n this.nonstrict = this.passthrough;\n // extend<\n // Augmentation extends ZodRawShape,\n // NewOutput extends util.flatten<{\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // }>,\n // NewInput extends util.flatten<{\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }>\n // >(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<T, Augmentation>,\n // UnknownKeys,\n // Catchall,\n // NewOutput,\n // NewInput\n // > {\n // return new ZodObject({\n // ...this._def,\n // shape: () => ({\n // ...this._def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // }\n /**\n * @deprecated Use `.extend` instead\n * */\n this.augment = this.extend;\n }\n _getCached() {\n if (this._cached !== null)\n return this._cached;\n const shape = this._def.shape();\n const keys = util.objectKeys(shape);\n this._cached = { shape, keys };\n return this._cached;\n }\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.object) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const { status, ctx } = this._processInputParams(input);\n const { shape, keys: shapeKeys } = this._getCached();\n const extraKeys = [];\n if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === \"strip\")) {\n for (const key in ctx.data) {\n if (!shapeKeys.includes(key)) {\n extraKeys.push(key);\n }\n }\n }\n const pairs = [];\n for (const key of shapeKeys) {\n const keyValidator = shape[key];\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (this._def.catchall instanceof ZodNever) {\n const unknownKeys = this._def.unknownKeys;\n if (unknownKeys === \"passthrough\") {\n for (const key of extraKeys) {\n pairs.push({\n key: { status: \"valid\", value: key },\n value: { status: \"valid\", value: ctx.data[key] },\n });\n }\n }\n else if (unknownKeys === \"strict\") {\n if (extraKeys.length > 0) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.unrecognized_keys,\n keys: extraKeys,\n });\n status.dirty();\n }\n }\n else if (unknownKeys === \"strip\") {\n }\n else {\n throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);\n }\n }\n else {\n // run catchall validation\n const catchall = this._def.catchall;\n for (const key of extraKeys) {\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)\n ),\n alwaysSet: key in ctx.data,\n });\n }\n }\n if (ctx.common.async) {\n return Promise.resolve()\n .then(async () => {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n alwaysSet: pair.alwaysSet,\n });\n }\n return syncPairs;\n })\n .then((syncPairs) => {\n return ParseStatus.mergeObjectSync(status, syncPairs);\n });\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get shape() {\n return this._def.shape();\n }\n strict(message) {\n errorUtil.errToObj;\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strict\",\n ...(message !== undefined\n ? {\n errorMap: (issue, ctx) => {\n const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;\n if (issue.code === \"unrecognized_keys\")\n return {\n message: errorUtil.errToObj(message).message ?? defaultError,\n };\n return {\n message: defaultError,\n };\n },\n }\n : {}),\n });\n }\n strip() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strip\",\n });\n }\n passthrough() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"passthrough\",\n });\n }\n // const AugmentFactory =\n // <Def extends ZodObjectDef>(def: Def) =>\n // <Augmentation extends ZodRawShape>(\n // augmentation: Augmentation\n // ): ZodObject<\n // extendShape<ReturnType<Def[\"shape\"]>, Augmentation>,\n // Def[\"unknownKeys\"],\n // Def[\"catchall\"]\n // > => {\n // return new ZodObject({\n // ...def,\n // shape: () => ({\n // ...def.shape(),\n // ...augmentation,\n // }),\n // }) as any;\n // };\n extend(augmentation) {\n return new ZodObject({\n ...this._def,\n shape: () => ({\n ...this._def.shape(),\n ...augmentation,\n }),\n });\n }\n /**\n * Prior to zod@1.0.12 there was a bug in the\n * inferred type of merged objects. Please\n * upgrade if you are experiencing issues.\n */\n merge(merging) {\n const merged = new ZodObject({\n unknownKeys: merging._def.unknownKeys,\n catchall: merging._def.catchall,\n shape: () => ({\n ...this._def.shape(),\n ...merging._def.shape(),\n }),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n });\n return merged;\n }\n // merge<\n // Incoming extends AnyZodObject,\n // Augmentation extends Incoming[\"shape\"],\n // NewOutput extends {\n // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation\n // ? Augmentation[k][\"_output\"]\n // : k extends keyof Output\n // ? Output[k]\n // : never;\n // },\n // NewInput extends {\n // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation\n // ? Augmentation[k][\"_input\"]\n // : k extends keyof Input\n // ? Input[k]\n // : never;\n // }\n // >(\n // merging: Incoming\n // ): ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"],\n // NewOutput,\n // NewInput\n // > {\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n setKey(key, schema) {\n return this.augment({ [key]: schema });\n }\n // merge<Incoming extends AnyZodObject>(\n // merging: Incoming\n // ): //ZodObject<T & Incoming[\"_shape\"], UnknownKeys, Catchall> = (merging) => {\n // ZodObject<\n // extendShape<T, ReturnType<Incoming[\"_def\"][\"shape\"]>>,\n // Incoming[\"_def\"][\"unknownKeys\"],\n // Incoming[\"_def\"][\"catchall\"]\n // > {\n // // const mergedShape = objectUtil.mergeShapes(\n // // this._def.shape(),\n // // merging._def.shape()\n // // );\n // const merged: any = new ZodObject({\n // unknownKeys: merging._def.unknownKeys,\n // catchall: merging._def.catchall,\n // shape: () =>\n // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),\n // typeName: ZodFirstPartyTypeKind.ZodObject,\n // }) as any;\n // return merged;\n // }\n catchall(index) {\n return new ZodObject({\n ...this._def,\n catchall: index,\n });\n }\n pick(mask) {\n const shape = {};\n for (const key of util.objectKeys(mask)) {\n if (mask[key] && this.shape[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n omit(mask) {\n const shape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (!mask[key]) {\n shape[key] = this.shape[key];\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n /**\n * @deprecated\n */\n deepPartial() {\n return deepPartialify(this);\n }\n partial(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n const fieldSchema = this.shape[key];\n if (mask && !mask[key]) {\n newShape[key] = fieldSchema;\n }\n else {\n newShape[key] = fieldSchema.optional();\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n required(mask) {\n const newShape = {};\n for (const key of util.objectKeys(this.shape)) {\n if (mask && !mask[key]) {\n newShape[key] = this.shape[key];\n }\n else {\n const fieldSchema = this.shape[key];\n let newField = fieldSchema;\n while (newField instanceof ZodOptional) {\n newField = newField._def.innerType;\n }\n newShape[key] = newField;\n }\n }\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n keyof() {\n return createZodEnum(util.objectKeys(this.shape));\n }\n}\nZodObject.create = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.strictCreate = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strict\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.lazycreate = (shape, params) => {\n return new ZodObject({\n shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nexport class ZodUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const options = this._def.options;\n function handleResults(results) {\n // return first issue-free validation if it exists\n for (const result of results) {\n if (result.result.status === \"valid\") {\n return result.result;\n }\n }\n for (const result of results) {\n if (result.result.status === \"dirty\") {\n // add issues from dirty option\n ctx.common.issues.push(...result.ctx.common.issues);\n return result.result;\n }\n }\n // return invalid\n const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return Promise.all(options.map(async (option) => {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n return {\n result: await option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n }),\n ctx: childCtx,\n };\n })).then(handleResults);\n }\n else {\n let dirty = undefined;\n const issues = [];\n for (const option of options) {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n const result = option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n });\n if (result.status === \"valid\") {\n return result;\n }\n else if (result.status === \"dirty\" && !dirty) {\n dirty = { result, ctx: childCtx };\n }\n if (childCtx.common.issues.length) {\n issues.push(childCtx.common.issues);\n }\n }\n if (dirty) {\n ctx.common.issues.push(...dirty.ctx.common.issues);\n return dirty.result;\n }\n const unionErrors = issues.map((issues) => new ZodError(issues));\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union,\n unionErrors,\n });\n return INVALID;\n }\n }\n get options() {\n return this._def.options;\n }\n}\nZodUnion.create = (types, params) => {\n return new ZodUnion({\n options: types,\n typeName: ZodFirstPartyTypeKind.ZodUnion,\n ...processCreateParams(params),\n });\n};\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\n////////// //////////\n////////// ZodDiscriminatedUnion //////////\n////////// //////////\n/////////////////////////////////////////////////////\n/////////////////////////////////////////////////////\nconst getDiscriminator = (type) => {\n if (type instanceof ZodLazy) {\n return getDiscriminator(type.schema);\n }\n else if (type instanceof ZodEffects) {\n return getDiscriminator(type.innerType());\n }\n else if (type instanceof ZodLiteral) {\n return [type.value];\n }\n else if (type instanceof ZodEnum) {\n return type.options;\n }\n else if (type instanceof ZodNativeEnum) {\n // eslint-disable-next-line ban/ban\n return util.objectValues(type.enum);\n }\n else if (type instanceof ZodDefault) {\n return getDiscriminator(type._def.innerType);\n }\n else if (type instanceof ZodUndefined) {\n return [undefined];\n }\n else if (type instanceof ZodNull) {\n return [null];\n }\n else if (type instanceof ZodOptional) {\n return [undefined, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodNullable) {\n return [null, ...getDiscriminator(type.unwrap())];\n }\n else if (type instanceof ZodBranded) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodReadonly) {\n return getDiscriminator(type.unwrap());\n }\n else if (type instanceof ZodCatch) {\n return getDiscriminator(type._def.innerType);\n }\n else {\n return [];\n }\n};\nexport class ZodDiscriminatedUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const discriminator = this.discriminator;\n const discriminatorValue = ctx.data[discriminator];\n const option = this.optionsMap.get(discriminatorValue);\n if (!option) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_union_discriminator,\n options: Array.from(this.optionsMap.keys()),\n path: [discriminator],\n });\n return INVALID;\n }\n if (ctx.common.async) {\n return option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n else {\n return option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n get discriminator() {\n return this._def.discriminator;\n }\n get options() {\n return this._def.options;\n }\n get optionsMap() {\n return this._def.optionsMap;\n }\n /**\n * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.\n * However, it only allows a union of objects, all of which need to share a discriminator property. This property must\n * have a different value for each object in the union.\n * @param discriminator the name of the discriminator property\n * @param types an array of object schemas\n * @param params\n */\n static create(discriminator, options, params) {\n // Get all the valid discriminator values\n const optionsMap = new Map();\n // try {\n for (const type of options) {\n const discriminatorValues = getDiscriminator(type.shape[discriminator]);\n if (!discriminatorValues.length) {\n throw new Error(`A discriminator value for key \\`${discriminator}\\` could not be extracted from all schema options`);\n }\n for (const value of discriminatorValues) {\n if (optionsMap.has(value)) {\n throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);\n }\n optionsMap.set(value, type);\n }\n }\n return new ZodDiscriminatedUnion({\n typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,\n discriminator,\n options,\n optionsMap,\n ...processCreateParams(params),\n });\n }\n}\nfunction mergeValues(a, b) {\n const aType = getParsedType(a);\n const bType = getParsedType(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {\n const bKeys = util.objectKeys(b);\n const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {\n if (a.length !== b.length) {\n return { valid: false };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {\n return { valid: true, data: a };\n }\n else {\n return { valid: false };\n }\n}\nexport class ZodIntersection extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const handleParsed = (parsedLeft, parsedRight) => {\n if (isAborted(parsedLeft) || isAborted(parsedRight)) {\n return INVALID;\n }\n const merged = mergeValues(parsedLeft.value, parsedRight.value);\n if (!merged.valid) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_intersection_types,\n });\n return INVALID;\n }\n if (isDirty(parsedLeft) || isDirty(parsedRight)) {\n status.dirty();\n }\n return { status: status.value, value: merged.data };\n };\n if (ctx.common.async) {\n return Promise.all([\n this._def.left._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n this._def.right._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n ]).then(([left, right]) => handleParsed(left, right));\n }\n else {\n return handleParsed(this._def.left._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }), this._def.right._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }));\n }\n }\n}\nZodIntersection.create = (left, right, params) => {\n return new ZodIntersection({\n left: left,\n right: right,\n typeName: ZodFirstPartyTypeKind.ZodIntersection,\n ...processCreateParams(params),\n });\n};\n// type ZodTupleItems = [ZodTypeAny, ...ZodTypeAny[]];\nexport class ZodTuple extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.array) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.array,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n if (ctx.data.length < this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n return INVALID;\n }\n const rest = this._def.rest;\n if (!rest && ctx.data.length > this._def.items.length) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n status.dirty();\n }\n const items = [...ctx.data]\n .map((item, itemIndex) => {\n const schema = this._def.items[itemIndex] || this._def.rest;\n if (!schema)\n return null;\n return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));\n })\n .filter((x) => !!x); // filter nulls\n if (ctx.common.async) {\n return Promise.all(items).then((results) => {\n return ParseStatus.mergeArray(status, results);\n });\n }\n else {\n return ParseStatus.mergeArray(status, items);\n }\n }\n get items() {\n return this._def.items;\n }\n rest(rest) {\n return new ZodTuple({\n ...this._def,\n rest,\n });\n }\n}\nZodTuple.create = (schemas, params) => {\n if (!Array.isArray(schemas)) {\n throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");\n }\n return new ZodTuple({\n items: schemas,\n typeName: ZodFirstPartyTypeKind.ZodTuple,\n rest: null,\n ...processCreateParams(params),\n });\n};\nexport class ZodRecord extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.object) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.object,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const pairs = [];\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n for (const key in ctx.data) {\n pairs.push({\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),\n value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (ctx.common.async) {\n return ParseStatus.mergeObjectAsync(status, pairs);\n }\n else {\n return ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get element() {\n return this._def.valueType;\n }\n static create(first, second, third) {\n if (second instanceof ZodType) {\n return new ZodRecord({\n keyType: first,\n valueType: second,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(third),\n });\n }\n return new ZodRecord({\n keyType: ZodString.create(),\n valueType: first,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(second),\n });\n }\n}\nexport class ZodMap extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.map) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.map,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n const pairs = [...ctx.data.entries()].map(([key, value], index) => {\n return {\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, \"key\"])),\n value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, \"value\"])),\n };\n });\n if (ctx.common.async) {\n const finalMap = new Map();\n return Promise.resolve().then(async () => {\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n });\n }\n else {\n const finalMap = new Map();\n for (const pair of pairs) {\n const key = pair.key;\n const value = pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n }\n }\n}\nZodMap.create = (keyType, valueType, params) => {\n return new ZodMap({\n valueType,\n keyType,\n typeName: ZodFirstPartyTypeKind.ZodMap,\n ...processCreateParams(params),\n });\n};\nexport class ZodSet extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.set) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.set,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const def = this._def;\n if (def.minSize !== null) {\n if (ctx.data.size < def.minSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_small,\n minimum: def.minSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.minSize.message,\n });\n status.dirty();\n }\n }\n if (def.maxSize !== null) {\n if (ctx.data.size > def.maxSize.value) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.too_big,\n maximum: def.maxSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.maxSize.message,\n });\n status.dirty();\n }\n }\n const valueType = this._def.valueType;\n function finalizeSet(elements) {\n const parsedSet = new Set();\n for (const element of elements) {\n if (element.status === \"aborted\")\n return INVALID;\n if (element.status === \"dirty\")\n status.dirty();\n parsedSet.add(element.value);\n }\n return { status: status.value, value: parsedSet };\n }\n const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));\n if (ctx.common.async) {\n return Promise.all(elements).then((elements) => finalizeSet(elements));\n }\n else {\n return finalizeSet(elements);\n }\n }\n min(minSize, message) {\n return new ZodSet({\n ...this._def,\n minSize: { value: minSize, message: errorUtil.toString(message) },\n });\n }\n max(maxSize, message) {\n return new ZodSet({\n ...this._def,\n maxSize: { value: maxSize, message: errorUtil.toString(message) },\n });\n }\n size(size, message) {\n return this.min(size, message).max(size, message);\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nZodSet.create = (valueType, params) => {\n return new ZodSet({\n valueType,\n minSize: null,\n maxSize: null,\n typeName: ZodFirstPartyTypeKind.ZodSet,\n ...processCreateParams(params),\n });\n};\nexport class ZodFunction extends ZodType {\n constructor() {\n super(...arguments);\n this.validate = this.implement;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.function) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.function,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n function makeArgsIssue(args, error) {\n return makeIssue({\n data: args,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_arguments,\n argumentsError: error,\n },\n });\n }\n function makeReturnsIssue(returns, error) {\n return makeIssue({\n data: returns,\n path: ctx.path,\n errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), defaultErrorMap].filter((x) => !!x),\n issueData: {\n code: ZodIssueCode.invalid_return_type,\n returnTypeError: error,\n },\n });\n }\n const params = { errorMap: ctx.common.contextualErrorMap };\n const fn = ctx.data;\n if (this._def.returns instanceof ZodPromise) {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(async function (...args) {\n const error = new ZodError([]);\n const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {\n error.addIssue(makeArgsIssue(args, e));\n throw error;\n });\n const result = await Reflect.apply(fn, this, parsedArgs);\n const parsedReturns = await me._def.returns._def.type\n .parseAsync(result, params)\n .catch((e) => {\n error.addIssue(makeReturnsIssue(result, e));\n throw error;\n });\n return parsedReturns;\n });\n }\n else {\n // Would love a way to avoid disabling this rule, but we need\n // an alias (using an arrow function was what caused 2651).\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const me = this;\n return OK(function (...args) {\n const parsedArgs = me._def.args.safeParse(args, params);\n if (!parsedArgs.success) {\n throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);\n }\n const result = Reflect.apply(fn, this, parsedArgs.data);\n const parsedReturns = me._def.returns.safeParse(result, params);\n if (!parsedReturns.success) {\n throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);\n }\n return parsedReturns.data;\n });\n }\n }\n parameters() {\n return this._def.args;\n }\n returnType() {\n return this._def.returns;\n }\n args(...items) {\n return new ZodFunction({\n ...this._def,\n args: ZodTuple.create(items).rest(ZodUnknown.create()),\n });\n }\n returns(returnType) {\n return new ZodFunction({\n ...this._def,\n returns: returnType,\n });\n }\n implement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n strictImplement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n static create(args, returns, params) {\n return new ZodFunction({\n args: (args ? args : ZodTuple.create([]).rest(ZodUnknown.create())),\n returns: returns || ZodUnknown.create(),\n typeName: ZodFirstPartyTypeKind.ZodFunction,\n ...processCreateParams(params),\n });\n }\n}\nexport class ZodLazy extends ZodType {\n get schema() {\n return this._def.getter();\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const lazySchema = this._def.getter();\n return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });\n }\n}\nZodLazy.create = (getter, params) => {\n return new ZodLazy({\n getter: getter,\n typeName: ZodFirstPartyTypeKind.ZodLazy,\n ...processCreateParams(params),\n });\n};\nexport class ZodLiteral extends ZodType {\n _parse(input) {\n if (input.data !== this._def.value) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_literal,\n expected: this._def.value,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n get value() {\n return this._def.value;\n }\n}\nZodLiteral.create = (value, params) => {\n return new ZodLiteral({\n value: value,\n typeName: ZodFirstPartyTypeKind.ZodLiteral,\n ...processCreateParams(params),\n });\n};\nfunction createZodEnum(values, params) {\n return new ZodEnum({\n values,\n typeName: ZodFirstPartyTypeKind.ZodEnum,\n ...processCreateParams(params),\n });\n}\nexport class ZodEnum extends ZodType {\n _parse(input) {\n if (typeof input.data !== \"string\") {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!this._cache) {\n this._cache = new Set(this._def.values);\n }\n if (!this._cache.has(input.data)) {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get options() {\n return this._def.values;\n }\n get enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Values() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n extract(values, newDef = this._def) {\n return ZodEnum.create(values, {\n ...this._def,\n ...newDef,\n });\n }\n exclude(values, newDef = this._def) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {\n ...this._def,\n ...newDef,\n });\n }\n}\nZodEnum.create = createZodEnum;\nexport class ZodNativeEnum extends ZodType {\n _parse(input) {\n const nativeEnumValues = util.getValidEnumValues(this._def.values);\n const ctx = this._getOrReturnCtx(input);\n if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n expected: util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodIssueCode.invalid_type,\n });\n return INVALID;\n }\n if (!this._cache) {\n this._cache = new Set(util.getValidEnumValues(this._def.values));\n }\n if (!this._cache.has(input.data)) {\n const expectedValues = util.objectValues(nativeEnumValues);\n addIssueToContext(ctx, {\n received: ctx.data,\n code: ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return INVALID;\n }\n return OK(input.data);\n }\n get enum() {\n return this._def.values;\n }\n}\nZodNativeEnum.create = (values, params) => {\n return new ZodNativeEnum({\n values: values,\n typeName: ZodFirstPartyTypeKind.ZodNativeEnum,\n ...processCreateParams(params),\n });\n};\nexport class ZodPromise extends ZodType {\n unwrap() {\n return this._def.type;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.promise,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);\n return OK(promisified.then((data) => {\n return this._def.type.parseAsync(data, {\n path: ctx.path,\n errorMap: ctx.common.contextualErrorMap,\n });\n }));\n }\n}\nZodPromise.create = (schema, params) => {\n return new ZodPromise({\n type: schema,\n typeName: ZodFirstPartyTypeKind.ZodPromise,\n ...processCreateParams(params),\n });\n};\nexport class ZodEffects extends ZodType {\n innerType() {\n return this._def.schema;\n }\n sourceType() {\n return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects\n ? this._def.schema.sourceType()\n : this._def.schema;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const effect = this._def.effect || null;\n const checkCtx = {\n addIssue: (arg) => {\n addIssueToContext(ctx, arg);\n if (arg.fatal) {\n status.abort();\n }\n else {\n status.dirty();\n }\n },\n get path() {\n return ctx.path;\n },\n };\n checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);\n if (effect.type === \"preprocess\") {\n const processed = effect.transform(ctx.data, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(processed).then(async (processed) => {\n if (status.value === \"aborted\")\n return INVALID;\n const result = await this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n });\n }\n else {\n if (status.value === \"aborted\")\n return INVALID;\n const result = this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n if (result.status === \"aborted\")\n return INVALID;\n if (result.status === \"dirty\")\n return DIRTY(result.value);\n if (status.value === \"dirty\")\n return DIRTY(result.value);\n return result;\n }\n }\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc) => {\n const result = effect.refinement(acc, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(result);\n }\n if (result instanceof Promise) {\n throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");\n }\n return acc;\n };\n if (ctx.common.async === false) {\n const inner = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n // return value is ignored\n executeRefinement(inner.value);\n return { status: status.value, value: inner.value };\n }\n else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {\n if (inner.status === \"aborted\")\n return INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n return executeRefinement(inner.value).then(() => {\n return { status: status.value, value: inner.value };\n });\n });\n }\n }\n if (effect.type === \"transform\") {\n if (ctx.common.async === false) {\n const base = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (!isValid(base))\n return INVALID;\n const result = effect.transform(base.value, checkCtx);\n if (result instanceof Promise) {\n throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);\n }\n return { status: status.value, value: result };\n }\n else {\n return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {\n if (!isValid(base))\n return INVALID;\n return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({\n status: status.value,\n value: result,\n }));\n });\n }\n }\n util.assertNever(effect);\n }\n}\nZodEffects.create = (schema, effect, params) => {\n return new ZodEffects({\n schema,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect,\n ...processCreateParams(params),\n });\n};\nZodEffects.createWithPreprocess = (preprocess, schema, params) => {\n return new ZodEffects({\n schema,\n effect: { type: \"preprocess\", transform: preprocess },\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n ...processCreateParams(params),\n });\n};\nexport { ZodEffects as ZodTransformer };\nexport class ZodOptional extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.undefined) {\n return OK(undefined);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodOptional.create = (type, params) => {\n return new ZodOptional({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodOptional,\n ...processCreateParams(params),\n });\n};\nexport class ZodNullable extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === ZodParsedType.null) {\n return OK(null);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodNullable.create = (type, params) => {\n return new ZodNullable({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodNullable,\n ...processCreateParams(params),\n });\n};\nexport class ZodDefault extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n let data = ctx.data;\n if (ctx.parsedType === ZodParsedType.undefined) {\n data = this._def.defaultValue();\n }\n return this._def.innerType._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n removeDefault() {\n return this._def.innerType;\n }\n}\nZodDefault.create = (type, params) => {\n return new ZodDefault({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n defaultValue: typeof params.default === \"function\" ? params.default : () => params.default,\n ...processCreateParams(params),\n });\n};\nexport class ZodCatch extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n // newCtx is used to not collect issues from inner types in ctx\n const newCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n };\n const result = this._def.innerType._parse({\n data: newCtx.data,\n path: newCtx.path,\n parent: {\n ...newCtx,\n },\n });\n if (isAsync(result)) {\n return result.then((result) => {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n });\n }\n else {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n }\n }\n removeCatch() {\n return this._def.innerType;\n }\n}\nZodCatch.create = (type, params) => {\n return new ZodCatch({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n catchValue: typeof params.catch === \"function\" ? params.catch : () => params.catch,\n ...processCreateParams(params),\n });\n};\nexport class ZodNaN extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== ZodParsedType.nan) {\n const ctx = this._getOrReturnCtx(input);\n addIssueToContext(ctx, {\n code: ZodIssueCode.invalid_type,\n expected: ZodParsedType.nan,\n received: ctx.parsedType,\n });\n return INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n}\nZodNaN.create = (params) => {\n return new ZodNaN({\n typeName: ZodFirstPartyTypeKind.ZodNaN,\n ...processCreateParams(params),\n });\n};\nexport const BRAND = Symbol(\"zod_brand\");\nexport class ZodBranded extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const data = ctx.data;\n return this._def.type._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n unwrap() {\n return this._def.type;\n }\n}\nexport class ZodPipeline extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.common.async) {\n const handleAsync = async () => {\n const inResult = await this._def.in._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return DIRTY(inResult.value);\n }\n else {\n return this._def.out._parseAsync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n };\n return handleAsync();\n }\n else {\n const inResult = this._def.in._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return {\n status: \"dirty\",\n value: inResult.value,\n };\n }\n else {\n return this._def.out._parseSync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n }\n static create(a, b) {\n return new ZodPipeline({\n in: a,\n out: b,\n typeName: ZodFirstPartyTypeKind.ZodPipeline,\n });\n }\n}\nexport class ZodReadonly extends ZodType {\n _parse(input) {\n const result = this._def.innerType._parse(input);\n const freeze = (data) => {\n if (isValid(data)) {\n data.value = Object.freeze(data.value);\n }\n return data;\n };\n return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nZodReadonly.create = (type, params) => {\n return new ZodReadonly({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodReadonly,\n ...processCreateParams(params),\n });\n};\n////////////////////////////////////////\n////////////////////////////////////////\n////////// //////////\n////////// z.custom //////////\n////////// //////////\n////////////////////////////////////////\n////////////////////////////////////////\nfunction cleanParams(params, data) {\n const p = typeof params === \"function\" ? params(data) : typeof params === \"string\" ? { message: params } : params;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n return p2;\n}\nexport function custom(check, _params = {}, \n/**\n * @deprecated\n *\n * Pass `fatal` into the params object instead:\n *\n * ```ts\n * z.string().custom((val) => val.length > 5, { fatal: false })\n * ```\n *\n */\nfatal) {\n if (check)\n return ZodAny.create().superRefine((data, ctx) => {\n const r = check(data);\n if (r instanceof Promise) {\n return r.then((r) => {\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = params.fatal ?? fatal ?? true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n });\n }\n if (!r) {\n const params = cleanParams(_params, data);\n const _fatal = params.fatal ?? fatal ?? true;\n ctx.addIssue({ code: \"custom\", ...params, fatal: _fatal });\n }\n return;\n });\n return ZodAny.create();\n}\nexport { ZodType as Schema, ZodType as ZodSchema };\nexport const late = {\n object: ZodObject.lazycreate,\n};\nexport var ZodFirstPartyTypeKind;\n(function (ZodFirstPartyTypeKind) {\n ZodFirstPartyTypeKind[\"ZodString\"] = \"ZodString\";\n ZodFirstPartyTypeKind[\"ZodNumber\"] = \"ZodNumber\";\n ZodFirstPartyTypeKind[\"ZodNaN\"] = \"ZodNaN\";\n ZodFirstPartyTypeKind[\"ZodBigInt\"] = \"ZodBigInt\";\n ZodFirstPartyTypeKind[\"ZodBoolean\"] = \"ZodBoolean\";\n ZodFirstPartyTypeKind[\"ZodDate\"] = \"ZodDate\";\n ZodFirstPartyTypeKind[\"ZodSymbol\"] = \"ZodSymbol\";\n ZodFirstPartyTypeKind[\"ZodUndefined\"] = \"ZodUndefined\";\n ZodFirstPartyTypeKind[\"ZodNull\"] = \"ZodNull\";\n ZodFirstPartyTypeKind[\"ZodAny\"] = \"ZodAny\";\n ZodFirstPartyTypeKind[\"ZodUnknown\"] = \"ZodUnknown\";\n ZodFirstPartyTypeKind[\"ZodNever\"] = \"ZodNever\";\n ZodFirstPartyTypeKind[\"ZodVoid\"] = \"ZodVoid\";\n ZodFirstPartyTypeKind[\"ZodArray\"] = \"ZodArray\";\n ZodFirstPartyTypeKind[\"ZodObject\"] = \"ZodObject\";\n ZodFirstPartyTypeKind[\"ZodUnion\"] = \"ZodUnion\";\n ZodFirstPartyTypeKind[\"ZodDiscriminatedUnion\"] = \"ZodDiscriminatedUnion\";\n ZodFirstPartyTypeKind[\"ZodIntersection\"] = \"ZodIntersection\";\n ZodFirstPartyTypeKind[\"ZodTuple\"] = \"ZodTuple\";\n ZodFirstPartyTypeKind[\"ZodRecord\"] = \"ZodRecord\";\n ZodFirstPartyTypeKind[\"ZodMap\"] = \"ZodMap\";\n ZodFirstPartyTypeKind[\"ZodSet\"] = \"ZodSet\";\n ZodFirstPartyTypeKind[\"ZodFunction\"] = \"ZodFunction\";\n ZodFirstPartyTypeKind[\"ZodLazy\"] = \"ZodLazy\";\n ZodFirstPartyTypeKind[\"ZodLiteral\"] = \"ZodLiteral\";\n ZodFirstPartyTypeKind[\"ZodEnum\"] = \"ZodEnum\";\n ZodFirstPartyTypeKind[\"ZodEffects\"] = \"ZodEffects\";\n ZodFirstPartyTypeKind[\"ZodNativeEnum\"] = \"ZodNativeEnum\";\n ZodFirstPartyTypeKind[\"ZodOptional\"] = \"ZodOptional\";\n ZodFirstPartyTypeKind[\"ZodNullable\"] = \"ZodNullable\";\n ZodFirstPartyTypeKind[\"ZodDefault\"] = \"ZodDefault\";\n ZodFirstPartyTypeKind[\"ZodCatch\"] = \"ZodCatch\";\n ZodFirstPartyTypeKind[\"ZodPromise\"] = \"ZodPromise\";\n ZodFirstPartyTypeKind[\"ZodBranded\"] = \"ZodBranded\";\n ZodFirstPartyTypeKind[\"ZodPipeline\"] = \"ZodPipeline\";\n ZodFirstPartyTypeKind[\"ZodReadonly\"] = \"ZodReadonly\";\n})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));\n// requires TS 4.4+\nclass Class {\n constructor(..._) { }\n}\nconst instanceOfType = (\n// const instanceOfType = <T extends new (...args: any[]) => any>(\ncls, params = {\n message: `Input not instance of ${cls.name}`,\n}) => custom((data) => data instanceof cls, params);\nconst stringType = ZodString.create;\nconst numberType = ZodNumber.create;\nconst nanType = ZodNaN.create;\nconst bigIntType = ZodBigInt.create;\nconst booleanType = ZodBoolean.create;\nconst dateType = ZodDate.create;\nconst symbolType = ZodSymbol.create;\nconst undefinedType = ZodUndefined.create;\nconst nullType = ZodNull.create;\nconst anyType = ZodAny.create;\nconst unknownType = ZodUnknown.create;\nconst neverType = ZodNever.create;\nconst voidType = ZodVoid.create;\nconst arrayType = ZodArray.create;\nconst objectType = ZodObject.create;\nconst strictObjectType = ZodObject.strictCreate;\nconst unionType = ZodUnion.create;\nconst discriminatedUnionType = ZodDiscriminatedUnion.create;\nconst intersectionType = ZodIntersection.create;\nconst tupleType = ZodTuple.create;\nconst recordType = ZodRecord.create;\nconst mapType = ZodMap.create;\nconst setType = ZodSet.create;\nconst functionType = ZodFunction.create;\nconst lazyType = ZodLazy.create;\nconst literalType = ZodLiteral.create;\nconst enumType = ZodEnum.create;\nconst nativeEnumType = ZodNativeEnum.create;\nconst promiseType = ZodPromise.create;\nconst effectsType = ZodEffects.create;\nconst optionalType = ZodOptional.create;\nconst nullableType = ZodNullable.create;\nconst preprocessType = ZodEffects.createWithPreprocess;\nconst pipelineType = ZodPipeline.create;\nconst ostring = () => stringType().optional();\nconst onumber = () => numberType().optional();\nconst oboolean = () => booleanType().optional();\nexport const coerce = {\n string: ((arg) => ZodString.create({ ...arg, coerce: true })),\n number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),\n boolean: ((arg) => ZodBoolean.create({\n ...arg,\n coerce: true,\n })),\n bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),\n date: ((arg) => ZodDate.create({ ...arg, coerce: true })),\n};\nexport { anyType as any, arrayType as array, bigIntType as bigint, booleanType as boolean, dateType as date, discriminatedUnionType as discriminatedUnion, effectsType as effect, enumType as enum, functionType as function, instanceOfType as instanceof, intersectionType as intersection, lazyType as lazy, literalType as literal, mapType as map, nanType as nan, nativeEnumType as nativeEnum, neverType as never, nullType as null, nullableType as nullable, numberType as number, objectType as object, oboolean, onumber, optionalType as optional, ostring, pipelineType as pipeline, preprocessType as preprocess, promiseType as promise, recordType as record, setType as set, strictObjectType as strictObject, stringType as string, symbolType as symbol, effectsType as transformer, tupleType as tuple, undefinedType as undefined, unionType as union, unknownType as unknown, voidType as void, };\nexport const NEVER = INVALID;\n","export * from \"./errors.js\";\nexport * from \"./helpers/parseUtil.js\";\nexport * from \"./helpers/typeAliases.js\";\nexport * from \"./helpers/util.js\";\nexport * from \"./types.js\";\nexport * from \"./ZodError.js\";\n","import * as z from \"./v3/external.js\";\nexport * from \"./v3/external.js\";\nexport { z };\nexport default z;\n","import { isHex, type Chain } from \"viem\";\nimport { z } from \"zod\";\nimport type { BigNumberish, Multiplier } from \"../types\";\n\nexport const ChainSchema = z.custom<Chain>(\n (chain) =>\n chain != null &&\n typeof chain === \"object\" &&\n \"id\" in chain &&\n typeof chain.id === \"number\",\n);\n\nexport const HexSchema = z.custom<`0x${string}` | \"0x\">((val) => {\n return isHex(val, { strict: true });\n});\n\nexport const BigNumberishSchema = z.union([HexSchema, z.number(), z.bigint()]);\n\nexport const BigNumberishRangeSchema = z\n .object({\n min: BigNumberishSchema.optional(),\n max: BigNumberishSchema.optional(),\n })\n .strict();\n\nexport const MultiplierSchema = z\n .object({\n /**\n * Multiplier value with max precision of 4 decimal places\n */\n multiplier: z.number().refine(\n (n) => {\n return (n.toString().split(\".\")[1]?.length ?? 0) <= 4;\n },\n { message: \"Max precision is 4 decimal places\" },\n ),\n })\n .strict();\n\nexport function isBigNumberish(x: any): x is BigNumberish {\n return x != null && BigNumberishSchema.safeParse(x).success;\n}\n\nexport function isMultiplier(x: any): x is Multiplier {\n return x != null && MultiplierSchema.safeParse(x).success;\n}\n","import { keccak256, toHex } from \"viem\";\nimport type { BigNumberish, Multiplier } from \"../types\";\nimport { isMultiplier } from \"./schema.js\";\n\n/**\n * Returns the max bigint in a list of bigints\n *\n * @param {bigint[]} args a list of bigints to get the max of\n * @returns {bigint} the max bigint in the list\n */\nexport const bigIntMax = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new Error(\"bigIntMax requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m > c ? m : c));\n};\n\n/**\n * Returns the min bigint in a list of bigints\n *\n * @param {bigint[]} args a list of bigints to get the max of\n * @returns {bigint} the min bigint in the list\n */\nexport const bigIntMin = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new Error(\"bigIntMin requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m < c ? m : c));\n};\n\n/**\n * Given a bigint and a min-max range, returns the min-max clamped bigint value\n *\n * @param {BigNumberish} value a bigint value to clamp\n * @param {BigNumberish | undefined} lower lower bound min max tuple value\n * @param {BigNumberish | undefined} upper upper bound min max tuple value\n * @returns {bigint} the clamped bigint value per given range\n */\nexport const bigIntClamp = (\n value: BigNumberish,\n lower: BigNumberish | null | undefined,\n upper: BigNumberish | null | undefined,\n): bigint => {\n lower = lower != null ? BigInt(lower) : null;\n upper = upper != null ? BigInt(upper) : null;\n\n if (upper != null && lower != null && upper < lower) {\n throw new Error(\n `invalid range: upper bound ${upper} is less than lower bound ${lower}`,\n );\n }\n\n let ret = BigInt(value);\n if (lower != null && lower > ret) {\n ret = lower;\n }\n if (upper != null && upper < ret) {\n ret = upper;\n }\n return ret;\n};\n\nexport enum RoundingMode {\n ROUND_DOWN = 0,\n ROUND_UP = 1,\n}\n\n/**\n * Given a bigint and a number (which can be a float), returns the bigint value.\n * Note: this function has loss and will round down to the nearest integer.\n *\n * @param {BigNumberish} base - the number to be multiplied\n * @param {number} multiplier - the amount to multiply by\n * @param {RoundingMode} roundingMode - the rounding mode to use when calculating the percent. defaults to ROUND_UP\n * @returns {bigint} the bigint value of the multiplication with the number rounded by the rounding mode\n */\nexport const bigIntMultiply = (\n base: BigNumberish,\n multiplier: Multiplier[\"multiplier\"],\n roundingMode: RoundingMode = RoundingMode.ROUND_UP,\n) => {\n if (!isMultiplier({ multiplier })) {\n throw new Error(\n \"bigIntMultiply requires a multiplier validated number as the second argument\",\n );\n }\n\n // Get decimal places of b. Max decimal places is defined by the MultiplerSchema.\n const decimalPlaces = multiplier.toString().split(\".\")[1]?.length ?? 0;\n const val =\n roundingMode === RoundingMode.ROUND_UP\n ? BigInt(base) * BigInt(Math.round(multiplier * 10 ** decimalPlaces)) +\n BigInt(10 ** decimalPlaces - 1)\n : BigInt(base) * BigInt(Math.round(multiplier * 10 ** decimalPlaces));\n\n return val / BigInt(10 ** decimalPlaces);\n};\n\n/**\n * Useful if you want to use a string, such as a user's email address, as salt to generate a unique SmartAccount per user.\n *\n * example:\n * ```\n * const salt = stringToIndex(\"alice@example.com\");\n *\n * export const account = new SimpleSmartContractAccount({\n * index: salt,\n * // other args omitted...\n * });\n * ```\n *\n * @param {string} phrase -- any string value.\n * @returns {bigint} the bigint value of the hashed string\n */\nexport const stringToIndex = (phrase: string): bigint =>\n BigInt(keccak256(toHex(phrase)));\n","import type { Hex } from \"viem\";\n\ntype TakeBytesOpts = {\n count?: number;\n offset?: number;\n};\n\n/**\n * Given a bytes string, returns a slice of the bytes\n *\n * @param {Hex} bytes - the hex string representing bytes\n * @param {TakeBytesOpts} opts - optional parameters for slicing the bytes\n * @param {number} opts.offset - the offset in bytes to start slicing from\n * @param {number} opts.count - the number of bytes to slice\n * @returns {Hex} the sliced bytes\n */\nexport const takeBytes = (bytes: Hex, opts: TakeBytesOpts = {}): Hex => {\n const { offset, count } = opts;\n const start = (offset ? offset * 2 : 0) + 2; // add 2 to skip the 0x prefix\n const end = count ? start + count * 2 : undefined;\n\n return `0x${bytes.slice(start, end)}`;\n};\n\nexport type UnpackedSignature = {\n r: `0x${string}`;\n s: `0x${string}`;\n v: bigint;\n};\n\nexport const unpackSignRawMessageBytes = (\n hex: `0x${string}`,\n): UnpackedSignature => {\n return {\n r: takeBytes(hex, { count: 32 }),\n s: takeBytes(hex, { count: 32, offset: 32 }),\n v: BigInt(takeBytes(hex, { count: 1, offset: 64 })),\n };\n};\n","import { type Chain } from \"viem\";\nimport { arbitrum, arbitrumGoerli, arbitrumSepolia } from \"viem/chains\";\nimport type { UserOperationFeeOptions } from \"../types.js\";\n\nexport const minPriorityFeePerBidDefaults = new Map<number, bigint>([\n [arbitrum.id, 10_000_000n],\n [arbitrumGoerli.id, 10_000_000n],\n [arbitrumSepolia.id, 10_000_000n],\n]);\n\nexport const getDefaultUserOperationFeeOptions = (\n chain: Chain,\n): UserOperationFeeOptions => {\n return {\n maxPriorityFeePerGas: {\n min: minPriorityFeePerBidDefaults.get(chain.id) ?? 100_000_000n,\n multiplier: 1.33,\n },\n };\n};\n","import { concat, type Address, type Hex } from \"viem\";\nimport type { EntryPointVersion } from \"../entrypoint/types\";\nimport type {\n BigNumberish,\n Multiplier,\n UserOperationFeeOptionsField,\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n UserOperationStruct_v6,\n UserOperationStruct_v7,\n} from \"../types\";\nimport { bigIntClamp, bigIntMultiply } from \"./bigint.js\";\nimport { allEqual, isBigNumberish } from \"./index.js\";\n\n/**\n * Utility method for asserting a UserOperationStruct has valid fields for the given entry point version\n *\n * @param {UserOperationStruct} request a UserOperationStruct to validate\n * @returns {boolean} a type guard that asserts the UserOperationRequest is valid\n */\nexport function isValidRequest<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n>(\n request: UserOperationStruct<TEntryPointVersion>,\n): request is UserOperationRequest<TEntryPointVersion> {\n // These are the only ones marked as optional in the interface above\n return (\n request.callGasLimit != null &&\n request.preVerificationGas != null &&\n request.verificationGasLimit != null &&\n request.maxFeePerGas != null &&\n request.maxPriorityFeePerGas != null &&\n isValidPaymasterAndData(request) &&\n isValidFactoryAndData(request)\n );\n}\n\n/**\n * Utility method for asserting a UserOperationRequest has valid fields for the paymaster data\n *\n * @param {UserOperationRequest} request a UserOperationRequest to validate\n * @returns {boolean} a type guard that asserts the UserOperationRequest is a UserOperationRequest\n */\nexport function isValidPaymasterAndData<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n>(request: UserOperationStruct<TEntryPointVersion>): boolean {\n if (\"paymasterAndData\" in request) {\n return (request as UserOperationStruct_v6).paymasterAndData != null;\n }\n\n // either all exist, or none.\n return allEqual(\n (request as UserOperationStruct_v7).paymaster == null,\n (request as UserOperationStruct_v7).paymasterData == null,\n (request as UserOperationStruct_v7).paymasterPostOpGasLimit == null,\n (request as UserOperationStruct_v7).paymasterVerificationGasLimit == null,\n );\n}\n\n/**\n * Utility method for asserting a UserOperationStruct has valid fields for the paymaster data\n *\n * @param {UserOperationRequest} request a UserOperationRequest to validate\n * @returns {boolean} a type guard that asserts the UserOperationStruct is a UserOperationRequest\n */\nexport function isValidFactoryAndData<\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n>(request: UserOperationStruct<TEntryPointVersion>): boolean {\n if (\"initCode\" in request) {\n const { initCode } = request as UserOperationStruct_v6;\n return initCode != null;\n }\n\n // either all exist, or none.\n return allEqual(\n (request as UserOperationStruct_v7).factory == null,\n (request as UserOperationStruct_v7).factoryData == null,\n );\n}\n\n/**\n * Utility method for applying a UserOperationOverrides field value\n * over the current value set for the field\n *\n * @param {BigNumberish} value the current value of the field\n * @param {BigNumberish | Multiplier} override the override value to apply\n * @returns {BigNumberish} the new value of the field after applying the override\n */\nexport function applyUserOpOverride<TValue extends BigNumberish | undefined>(\n value: TValue,\n override?: BigNumberish | Multiplier,\n): TValue | BigNumberish {\n if (override == null) {\n return value;\n }\n\n if (isBigNumberish(override)) {\n return override;\n }\n\n // multiplier override\n else {\n return value != null ? bigIntMultiply(value, override.multiplier) : value;\n }\n}\n\n/**\n * Utility method for applying a UserOperationFeeOptionsField value\n * over the current value set for the field\n *\n * @param {BigNumberish} value the current value of the field\n * @param {UserOperationFeeOptionsField} feeOption the override value to apply\n * @returns {BigNumberish} the new value of the field after applying the override\n */\nexport function applyUserOpFeeOption<TValue extends BigNumberish | undefined>(\n value: TValue,\n feeOption?: UserOperationFeeOptionsField,\n): TValue | BigNumberish {\n if (feeOption == null) {\n return value;\n }\n\n return value != null\n ? bigIntClamp(\n feeOption.multiplier\n ? bigIntMultiply(value, feeOption.multiplier)\n : value,\n feeOption.min,\n feeOption.max,\n )\n : (feeOption.min ?? 0n);\n}\n\n/**\n * Utility method for applying a UserOperationOverrides field value and\n * a UserOperationFeeOptionsField value over the current value set for the field,\n * with the override taking precedence over the fee option\n *\n * @param {BigNumberish} value the current value of the field\n * @param {BigNumberish | Multiplier} [override] the override value to apply\n * @param {UserOperationFeeOptionsField} [feeOption] the fee option field value to apply\n * @returns {BigNumberish} the new value of the field after applying the override or fee option\n */\nexport function applyUserOpOverrideOrFeeOption<\n TValue extends BigNumberish | undefined,\n>(\n value: TValue,\n override?: BigNumberish | Multiplier,\n feeOption?: UserOperationFeeOptionsField,\n): TValue | BigNumberish {\n return value != null && override != null\n ? applyUserOpOverride(value, override)!\n : applyUserOpFeeOption(value, feeOption);\n}\n\n/**\n * Utility method for checking whether the middleware pipeline should\n * bypass the paymaster middleware for the user operation with the given overrides,\n * either because the UserOp is paying for its own gas, or passing a specific paymaster\n *\n * @template EntryPointVersion TEntryPointVersion\n * @param {UserOperationOverrides<TEntryPointVersion> | undefined} overrides the user operation overrides to check\n * @returns {boolean} whether the paymaster middleware should be bypassed\n */\nexport const bypassPaymasterAndData = <\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n>(\n overrides: UserOperationOverrides<TEntryPointVersion> | undefined,\n): boolean =>\n !!overrides &&\n (\"paymasterAndData\" in overrides || \"paymasterData\" in overrides);\n\n/**\n * An alternative to `bypassPaymasterAndData` which only returns true if the data parameter\n * is \"0x,\" this is useful for cases when middleware should be bypassed ONLY IF the UserOp will\n * pay for its own gas\n *\n * @template EntryPointVersion TEntryPointVersion\n * @param {UserOperationOverrides<TEntryPointVersion> | undefined} overrides the user operation overrides to check\n * @returns {boolean} whether the paymaster middleware should be bypassed\n */\nexport const bypassPaymasterAndDataEmptyHex = <\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n>(\n overrides: UserOperationOverrides<TEntryPointVersion> | undefined,\n): boolean =>\n overrides !== undefined &&\n ((\"paymasterAndData\" in overrides && overrides.paymasterAndData === \"0x\") ||\n (\"paymasterData\" in overrides && overrides.paymasterData === \"0x\"));\n\n/**\n * Utility method for parsing the paymaster address and paymasterData from the paymasterAndData hex string\n *\n * @param {Hex} paymasterAndData the paymaster and data hex string to parse.\n * The hex string refers to the paymasterAndData field of entrypoint v0.6 user operation request\n * @returns {{ paymaster: Hex; paymasterData: Hex}} the parsed paymaster and paymasterData fields of entrypoint v0.7 user operation request paymaster and paymasterData field\n */\nexport const parsePaymasterAndData = (\n paymasterAndData: Hex,\n): Pick<UserOperationRequest<\"0.7.0\">, \"paymaster\" | \"paymasterData\"> => ({\n paymaster: paymasterAndData.substring(0, 42) as Address,\n paymasterData: `0x${paymasterAndData.substring(42)}` as Hex,\n});\n\n/**\n * Utility method for converting the object containing the paymaster address and paymaster data\n * to the paymaster and data concatenated hex string\n *\n * @param {{ paymaster: Hex; paymasterData: Hex}} paymasterAndData the object containing the picked paymaster and paymasterData fields of\n * entrypoint v0.7 user operation request\n * @param {Hex} paymasterAndData.paymaster the paymaster address\n * @param {Hex} paymasterAndData.paymasterData the paymaster data\n * @returns {Hex} the paymasterAndData hex value of entrypoint v0.6 user operation request paymasterAndData field\n */\nexport const concatPaymasterAndData = ({\n paymaster = \"0x\",\n paymasterData = \"0x\",\n}: Pick<UserOperationRequest<\"0.7.0\">, \"paymaster\" | \"paymasterData\">): Hex =>\n concat([paymaster, paymasterData]);\n","import { toHex } from \"viem\";\nimport type { PromiseOrValue } from \"../types.js\";\nimport type { RecordableKeys } from \"./types.js\";\n\n/**\n * Utility function that allows for piping a series of async functions together\n *\n * @param {((s: S, o?: O, f?: F) => Promise<S>)[]} fns - functions to pipe\n * @returns {S} result of the pipe\n */\nexport const asyncPipe =\n <S, O, F>(...fns: ((s: S, o?: O, f?: F) => Promise<S>)[]) =>\n async (s: S, o?: O, f?: F) => {\n let result = s;\n for (const fn of fns) {\n result = await fn(result, o, f);\n }\n return result;\n };\n\n// based on @ethersproject/properties, but pulled in here to minize the dependency on ethers\nexport type Deferrable<T> = {\n [K in keyof T]: PromiseOrValue<T[K]>;\n};\n\n/**\n * Used to ensure type doesn't extend another, for use in & chaining of properties\n */\nexport type NotType<A, B> = A extends B ? never : unknown;\n\n/**\n * Await all of the properties of a Deferrable object\n *\n * @param {Deferrable<T>} object - a Deferrable object\n * @returns {Promise<T>} the object with its properties resolved\n */\nexport async function resolveProperties<T>(object: Deferrable<T>): Promise<T> {\n const promises = Object.keys(object).map((key) => {\n const value = object[key as keyof Deferrable<T>];\n return Promise.resolve(value).then((v) => ({ key: key, value: v }));\n });\n\n const results = await Promise.all(promises);\n\n return filterUndefined<T>(\n results.reduce((accum, curr) => {\n accum[curr.key as keyof T] = curr.value;\n return accum;\n }, {} as T),\n );\n}\n\n/**\n * Recursively converts all values in an object to hex strings\n *\n * @param {any} obj - obj to deep hexlify\n * @returns {any} object with all of its values hexlified\n */\nexport function deepHexlify(obj: any): any {\n if (typeof obj === \"function\") {\n return undefined;\n }\n if (obj == null || typeof obj === \"string\" || typeof obj === \"boolean\") {\n return obj;\n } else if (typeof obj === \"bigint\") {\n return toHex(obj);\n } else if (obj._isBigNumber != null || typeof obj !== \"object\") {\n return toHex(obj).replace(/^0x0/, \"0x\");\n }\n if (Array.isArray(obj)) {\n return obj.map((member) => deepHexlify(member));\n }\n return Object.keys(obj).reduce(\n (set, key) => ({\n ...set,\n [key]: deepHexlify(obj[key]),\n }),\n {},\n );\n}\n\n/**\n * Filters out properties with undefined or null values from the provided object.\n *\n * @example\n * ```ts\n * import { filterUndefined } from \"@aa-sdk/core\";\n *\n * const result = filterUndefined({\n * foo: undefined,\n * bar: null,\n * baz: \"baz\",\n * }); // { baz: \"baz\" }\n * ```\n *\n * @param {T} obj the object from which to remove properties with undefined or null values\n * @returns {T} the object with undefined or null properties removed\n */\nexport function filterUndefined<T>(obj: T): T {\n for (const key in obj) {\n if (obj[key] == null) {\n delete obj[key];\n }\n }\n return obj as T;\n}\n\n/**\n * Picks the specified keys from an object and returns a new object containing only those key-value pairs.\n *\n * @example\n * ```ts\n * import { pick } from \"@aa-sdk/core\";\n *\n * const picked = pick({\n * foo: \"foo\",\n * bar: \"bar\",\n * }, [\"foo\"]); // { foo: \"foo\" }\n * ```\n *\n * @param {Record<string, unknown>} obj The object from which to pick keys\n * @param {string|string[]} keys A single key or an array of keys to pick from the object\n * @returns {Record<string, unknown>} A new object containing only the picked key-value pairs\n */\nexport function pick(obj: Record<string, unknown>, keys: string | string[]) {\n return Object.keys(obj)\n .filter((k) => keys.includes(k))\n .reduce((res, k) => Object.assign(res, { [k]: obj[k] }), {});\n}\n\n/**\n * Utility method for checking if the passed in values are all equal (strictly)\n *\n * @param {...any[]} params - values to check\n * @returns {boolean} a boolean indicating if all values are the same\n * @throws if no values are passed in\n */\nexport const allEqual = (...params: any[]): boolean => {\n if (params.length === 0) {\n throw new Error(\"no values passed in\");\n }\n return params.every((v) => v === params[0]);\n};\n\n/**\n * Utility method for checking the condition and return the value if condition holds true, undefined if not.\n *\n * @param {Promise<boolean>} condition - condition to check\n * @param {() => Promise<T>} value - value to return when condition holds true\n * @returns {Promise<T | undefined>} the value if condition holds true, undefined if not\n */\nexport const conditionalReturn = <T>(\n condition: Promise<boolean>,\n value: () => Promise<T>,\n): Promise<T | undefined> => condition.then((t) => (t ? value() : undefined));\n\n/**\n * Converts an array of objects into a record (object) where each key is determined by the specified selector and the value is determined by the provided function.\n *\n * @example\n * ```ts\n * import { toRecord } from \"@aa-sdk/core\";\n * import { sepolia, mainnet } from \"viem/chains\";\n *\n * const addressesByChain = toRecord(\n * [sepolia, mainnet],\n * \"id\",\n * () => \"0x...\"\n * ); // { [sepolia.id]: \"0x...\", [mainnet.id]: \"0x...\" }\n * ```\n *\n * @param {T[]} array The array of objects to convert to a record\n * @param {K} selector The key used to select the property that will become the record's key\n * @param {(item: T) => V} fn The function that transforms each item in the array into the record's value\n * @returns {Record<T[K], V>} The resulting record object\n */\nexport const toRecord = <\n T extends { [K in RecordableKeys<T>]: string | number | symbol },\n K extends RecordableKeys<T>,\n V,\n>(\n array: T[],\n selector: K,\n fn: (item: T) => V,\n): Record<T[K], V> =>\n array.reduce(\n (acc, item) => {\n acc[item[selector]] = fn(item);\n return acc;\n },\n {} as Record<T[K], V>,\n );\n\nexport * from \"./bigint.js\";\nexport * from \"./bytes.js\";\nexport * from \"./defaults.js\";\nexport * from \"./schema.js\";\nexport type * from \"./types.js\";\nexport * from \"./userop.js\";\n","import { fromHex, type Chain, type Client, type Transport } from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { TransactionMissingToParamError } from \"../../errors/transaction.js\";\nimport type { UserOperationOverrides } from \"../../types\";\nimport { bigIntMax } from \"../../utils/index.js\";\nimport { buildUserOperation } from \"./buildUserOperation.js\";\nimport type {\n BuildTransactionParameters,\n BuildUserOperationFromTransactionsResult,\n UserOperationContext,\n} from \"./types\";\nimport { clientHeaderTrack } from \"../../index.js\";\n\n/**\n * Performs `buildUserOperationFromTx` in batch and builds into a single,\n * yet to be signed `UserOperation` (UO) struct. The output user operation struct\n * will be filled with all gas fields (and paymaster data if a paymaster is used)\n * based on the transactions data (`to`, `data`, `value`, `maxFeePerGas`,\n * `maxPriorityFeePerGas`) computed using the configured ClientMiddlewares on the SmartAccountClient.\n *\n * @example\n * ```ts\n * import type { RpcTransactionRequest } from \"viem\";\n * import { smartAccountClient } from \"./smartAccountClient\";\n *\n * const requests: RpcTransactionRequest[] = [\n * {\n * from, // ignored\n * to,\n * data: encodeFunctionData({\n * abi: ContractABI.abi,\n * functionName: \"func\",\n * args: [arg1, arg2, ...],\n * }),\n * },\n * {\n * from, // ignored\n * to,\n * data: encodeFunctionData({\n * abi: ContractABI.abi,\n * functionName: \"func\",\n * args: [arg1, arg2, ...],\n * }),\n * },\n * ];\n * const uoStruct = await smartAccountClient.buildUserOperationFromTxs({\n * requests,\n * });\n *\n * // signUserOperation signs the above unsigned user operation struct built\n * // using the account connected to the smart account client\n * const request = await smartAccountClient.signUserOperation({ uoStruct });\n *\n * // You can use the BundlerAction `sendRawUserOperation` (packages/core/src/actions/bundler/sendRawUserOperation.ts)\n * // to send the signed user operation request to the bundler, requesting the bundler to send the signed uo to the\n * // EntryPoint contract pointed at by the entryPoint address parameter\n * const entryPointAddress = client.account.getEntryPoint().address;\n * const uoHash = await smartAccountClient.sendRawUserOperation({\n * request,\n * entryPoint: entryPointAddress,\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client_ the smart account client to use to make RPC calls\n * @param {BuildTransactionParameters} args an object containing the requests to build as well as, the account if not hoisted, the context, the overrides, and optionally a flag to enable signing of the UO via the underlying middleware\n * @returns {Promise<BuildUserOperationFromTransactionsResult<TEntryPointVersion>>} a Promise containing the built user operation\n */\nexport async function buildUserOperationFromTxs<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n client_: Client<TTransport, TChain, TAccount>,\n args: BuildTransactionParameters<TAccount, TContext, TEntryPointVersion>,\n): Promise<BuildUserOperationFromTransactionsResult<TEntryPointVersion>> {\n const client = clientHeaderTrack(client_, \"buildUserOperationFromTxs\");\n const { account = client.account, requests, overrides, context } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"buildUserOperationFromTxs\",\n client,\n );\n }\n\n const batch = requests.map((request) => {\n if (!request.to) {\n throw new TransactionMissingToParamError();\n }\n\n return {\n target: request.to,\n data: request.data ?? \"0x\",\n value: request.value ? fromHex(request.value, \"bigint\") : 0n,\n };\n });\n\n const mfpgOverridesInTx = () =>\n requests\n .filter((x) => x.maxFeePerGas != null)\n .map((x) => fromHex(x.maxFeePerGas!, \"bigint\"));\n const maxFeePerGas =\n overrides?.maxFeePerGas != null\n ? overrides?.maxFeePerGas\n : mfpgOverridesInTx().length > 0\n ? bigIntMax(...mfpgOverridesInTx())\n : undefined;\n\n const mpfpgOverridesInTx = () =>\n requests\n .filter((x) => x.maxPriorityFeePerGas != null)\n .map((x) => fromHex(x.maxPriorityFeePerGas!, \"bigint\"));\n const maxPriorityFeePerGas =\n overrides?.maxPriorityFeePerGas != null\n ? overrides?.maxPriorityFeePerGas\n : mpfpgOverridesInTx().length > 0\n ? bigIntMax(...mpfpgOverridesInTx())\n : undefined;\n\n const _overrides = {\n maxFeePerGas,\n maxPriorityFeePerGas,\n } as UserOperationOverrides<TEntryPointVersion>;\n\n const uoStruct = await buildUserOperation(client, {\n uo: batch,\n account,\n context,\n overrides: _overrides,\n });\n\n return {\n uoStruct,\n // TODO: in v4 major version update, remove these as below parameters are not needed\n batch,\n overrides: _overrides,\n };\n}\n","import type { Chain, Client, Transport } from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport type { UserOperationStruct } from \"../../types.js\";\nimport { buildUserOperation } from \"./buildUserOperation.js\";\nimport type {\n SendUserOperationParameters,\n UserOperationContext,\n} from \"./types\";\nimport { clientHeaderTrack } from \"../../index.js\";\n\nexport type CheckGasSponsorshipEligibilityResult<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n> = {\n eligible: boolean;\n request?: UserOperationStruct<TEntryPointVersion>;\n};\n\n/**\n * This function verifies the eligibility of the connected account for gas sponsorship concerning the upcoming `UserOperation` (UO) that is intended to be sent.\n * Internally, this method invokes `buildUserOperation`, which navigates through the middleware pipeline, including the `PaymasterMiddleware`. Its purpose is to construct the UO struct meant for transmission to the bundler. Following the construction of the UO struct, this function verifies if the resulting structure contains a non-empty `paymasterAndData` field.\n * You can utilize this method before sending the user operation to confirm its eligibility for gas sponsorship. Depending on the outcome, it allows you to tailor the user experience accordingly, based on eligibility.\n *\n * @example\n * ```ts\n * import { smartAccountClient } from \"./smartAccountClient\";\n * // [!code focus:99]\n * const { eligible } = await smartAccountClient.checkGasSponsorshipEligibility({\n * uo: {\n * data: \"0xCalldata\",\n * target: \"0xTarget\",\n * value: 0n,\n * },\n * });\n *\n * console.log(\n * `User Operation is ${\n * eligible ? \"eligible\" : \"ineligible\"\n * } for gas sponsorship.`\n * );\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client_ the smart account client to use for making RPC calls\n * @param {SendUserOperationParameters} args containing the user operation, account, context, and overrides\n * @returns {Promise<CheckGasSponsorshipEligibilityResult<TAccount>>} a Promise containing a boolean indicating if the account is elgibile for sponsorship and the sponsored UO\n */\nexport function checkGasSponsorshipEligibility<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n client_: Client<TTransport, TChain, TAccount>,\n args: SendUserOperationParameters<TAccount, TContext>,\n): Promise<CheckGasSponsorshipEligibilityResult<TAccount>> {\n const client = clientHeaderTrack(client_, \"checkGasSponsorshipEligibility\");\n const { account = client.account, overrides, context } = args;\n\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"checkGasSponsorshipEligibility\",\n client,\n );\n }\n\n return buildUserOperation(client, {\n uo: args.uo,\n account,\n overrides,\n context,\n })\n .then((userOperationStruct) => ({\n eligible:\n account.getEntryPoint().version === \"0.6.0\"\n ? (userOperationStruct as UserOperationStruct<\"0.6.0\">)\n .paymasterAndData !== \"0x\" &&\n (userOperationStruct as UserOperationStruct<\"0.6.0\">)\n .paymasterAndData !== null\n : (userOperationStruct as UserOperationStruct<\"0.7.0\">)\n .paymasterData !== \"0x\" &&\n (userOperationStruct as UserOperationStruct<\"0.7.0\">)\n .paymasterData !== null,\n request: userOperationStruct,\n }))\n .catch(() => ({\n eligible: false,\n }));\n}\n","import type { UserOperationContext } from \"../actions/smartAccount/types\";\nimport type { ClientMiddlewareFn } from \"./types\";\n\n/**\n * Noop middleware that does nothing and passes the arguments through\n *\n * @param {Deferrable<UserOperationStruct<TEntryPointVersion>>} args the client middleware arguments passed to the middleware\n * @returns {Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>} the arguments passed to the middleware and returned as is without modification\n */\nexport const noopMiddleware: ClientMiddlewareFn<\n UserOperationContext | undefined\n> = async (args) => {\n return args;\n};\n","import type { Chain, Transport } from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../../account/smartContractAccount\";\nimport type { BaseSmartAccountClient } from \"../../../client/smartAccountClient\";\nimport { AccountNotFoundError } from \"../../../errors/account.js\";\nimport { noopMiddleware } from \"../../../middleware/noopMiddleware.js\";\nimport type { ClientMiddleware } from \"../../../middleware/types\";\nimport type {\n UserOperationOverridesParameter,\n UserOperationStruct,\n} from \"../../../types\";\nimport {\n bypassPaymasterAndData,\n resolveProperties,\n type Deferrable,\n} from \"../../../utils/index.js\";\nimport type { UserOperationContext } from \"../types\";\n\nconst asyncPipe =\n <S, Opts>(...fns: ((s: S, opts: Opts) => Promise<S>)[]) =>\n async (s: S, opts: Opts) => {\n let result = s;\n for (const fn of fns) {\n result = await fn(result, opts);\n }\n return result;\n };\n\nexport async function _runMiddlewareStack<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client: BaseSmartAccountClient<TTransport, TChain, TAccount>,\n args: {\n uo: Deferrable<UserOperationStruct<TEntryPointVersion>>;\n context?: TContext;\n } & GetAccountParameter<TAccount> &\n UserOperationOverridesParameter<TEntryPointVersion>,\n): Promise<UserOperationStruct<TEntryPointVersion>> {\n const { uo, overrides, account = client.account, context } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n const {\n dummyPaymasterAndData,\n paymasterAndData,\n }: Pick<\n ClientMiddleware<TContext>,\n \"dummyPaymasterAndData\" | \"paymasterAndData\"\n > = bypassPaymasterAndData(overrides)\n ? {\n dummyPaymasterAndData: async (uo, { overrides }) => {\n return {\n ...uo,\n ...(\"paymasterAndData\" in overrides!\n ? { paymasterAndData: overrides.paymasterAndData }\n : \"paymasterData\" in overrides! &&\n \"paymaster\" in overrides &&\n overrides.paymasterData !== \"0x\"\n ? {\n paymasterData: overrides.paymasterData,\n paymaster: overrides.paymaster,\n }\n : // At this point, nothing has run so no fields are set\n // for 0.7 when not using a paymaster, all fields should be undefined\n undefined),\n };\n },\n paymasterAndData: noopMiddleware,\n }\n : {\n dummyPaymasterAndData: client.middleware.dummyPaymasterAndData,\n paymasterAndData: client.middleware.paymasterAndData,\n };\n\n const result = await asyncPipe(\n dummyPaymasterAndData,\n client.middleware.feeEstimator,\n client.middleware.gasEstimator,\n client.middleware.customMiddleware,\n paymasterAndData,\n client.middleware.userOperationSimulator,\n )(uo, { overrides, feeOptions: client.feeOptions, account, client, context });\n\n return resolveProperties<\n UserOperationStruct<GetEntryPointFromAccount<TAccount>>\n >(result);\n}\n","import type { Chain, Client, Transport } from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport {\n ChainNotFoundError,\n IncompatibleClientError,\n} from \"../../errors/client.js\";\nimport type { UserOperationRequest } from \"../../types\";\nimport { deepHexlify, resolveProperties } from \"../../utils/index.js\";\nimport type { SignUserOperationParameters } from \"./types\";\n\nexport async function signUserOperation<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: SignUserOperationParameters<TAccount>,\n): Promise<UserOperationRequest<TEntryPointVersion>> {\n const { account = client.account, context } = args;\n\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"signUserOperation\",\n client,\n );\n }\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n return await client.middleware\n .signUserOperation(args.uoStruct, {\n ...args,\n account,\n client,\n context,\n })\n .then(resolveProperties)\n .then(deepHexlify);\n}\n","import {\n concat,\n encodeAbiParameters,\n hexToBigInt,\n isAddress,\n keccak256,\n pad,\n type Address,\n type Chain,\n type Hash,\n type Hex,\n} from \"viem\";\nimport { EntryPointAbi_v7 } from \"../abis/EntryPointAbi_v7.js\";\nimport type {\n UserOperationRequest,\n UserOperationRequest_v7,\n} from \"../types.js\";\nimport type { SupportedEntryPoint } from \"./types.js\";\n\nconst packUserOperation = (request: UserOperationRequest<\"0.7.0\">): Hex => {\n const initCode =\n request.factory && request.factoryData\n ? concat([request.factory, request.factoryData])\n : \"0x\";\n const accountGasLimits = packAccountGasLimits({\n verificationGasLimit: request.verificationGasLimit,\n callGasLimit: request.callGasLimit,\n });\n\n const gasFees = packAccountGasLimits({\n maxPriorityFeePerGas: request.maxPriorityFeePerGas,\n maxFeePerGas: request.maxFeePerGas,\n });\n\n const paymasterAndData =\n request.paymaster && isAddress(request.paymaster)\n ? packPaymasterData({\n paymaster: request.paymaster,\n paymasterVerificationGasLimit: request.paymasterVerificationGasLimit,\n paymasterPostOpGasLimit: request.paymasterPostOpGasLimit,\n paymasterData: request.paymasterData,\n })\n : \"0x\";\n\n return encodeAbiParameters(\n [\n { type: \"address\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n ],\n [\n request.sender as Address,\n hexToBigInt(request.nonce),\n keccak256(initCode),\n keccak256(request.callData),\n accountGasLimits,\n hexToBigInt(request.preVerificationGas),\n gasFees,\n keccak256(paymasterAndData),\n ],\n );\n};\n\nexport default {\n version: \"0.7.0\",\n\n address: {\n default: \"0x0000000071727De22E5E9d8BAf0edAc6f37da032\",\n },\n\n abi: EntryPointAbi_v7,\n\n getUserOperationHash: (\n request: UserOperationRequest<\"0.7.0\">,\n entryPointAddress: Address,\n chainId: number,\n ): Hash => {\n const encoded = encodeAbiParameters(\n [{ type: \"bytes32\" }, { type: \"address\" }, { type: \"uint256\" }],\n [\n keccak256(packUserOperation(request)),\n entryPointAddress,\n BigInt(chainId),\n ],\n );\n\n return keccak256(encoded);\n },\n\n packUserOperation,\n} satisfies SupportedEntryPoint<\"0.7.0\", Chain, typeof EntryPointAbi_v7>;\n\nexport function packAccountGasLimits(\n data:\n | Pick<UserOperationRequest_v7, \"verificationGasLimit\" | \"callGasLimit\">\n | Pick<UserOperationRequest_v7, \"maxPriorityFeePerGas\" | \"maxFeePerGas\">,\n): Hex {\n return concat(Object.values(data).map((v) => pad(v, { size: 16 })));\n}\n\nexport function packPaymasterData({\n paymaster,\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit,\n paymasterData,\n}: Pick<\n UserOperationRequest_v7,\n | \"paymaster\"\n | \"paymasterVerificationGasLimit\"\n | \"paymasterPostOpGasLimit\"\n | \"paymasterData\"\n>): Hex {\n if (\n !paymaster ||\n !paymasterVerificationGasLimit ||\n !paymasterPostOpGasLimit ||\n !paymasterData\n ) {\n return \"0x\";\n }\n return concat([\n paymaster,\n pad(paymasterVerificationGasLimit, { size: 16 }),\n pad(paymasterPostOpGasLimit, { size: 16 }),\n paymasterData,\n ]);\n}\n\nexport function unpackAccountGasLimits(accountGasLimits: string): {\n verificationGasLimit: number;\n callGasLimit: number;\n} {\n return {\n verificationGasLimit: parseInt(accountGasLimits.slice(2, 34), 16),\n callGasLimit: parseInt(accountGasLimits.slice(34), 16),\n };\n}\n","import {\n fromHex,\n concat,\n isAddress,\n decodeErrorResult,\n type Chain,\n type Transport,\n} from \"viem\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport type { BaseSmartAccountClient } from \"../../client/smartAccountClient\";\nimport type { SmartContractAccount } from \"../../account/smartContractAccount.js\";\nimport type { UserOperationRequest } from \"../../types.js\";\nimport type { EntryPointDef } from \"../../index.js\";\nimport { deepHexlify } from \"../../utils/index.js\";\nimport {\n packAccountGasLimits,\n packPaymasterData,\n} from \"../../entrypoint/0.7.js\";\n\n/**\n * Retrieves the error message from an entrypoint for a User Operation.\n *\n * @param {Client<TTransport, TChain, TAccount>} client the smart account client to use for RPC requests\n * @param {UserOperationRequest} request the uo request to get the error for\n * @param {EntryPointDef} entryPoint the entrypoint instance to send the uo to\n * @returns {string} the error message from the entrypoint\n */\nexport async function getUserOperationError<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n>(\n client: BaseSmartAccountClient<TTransport, TChain, TAccount>,\n request: UserOperationRequest,\n entryPoint: EntryPointDef,\n) {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n\n const uo = deepHexlify(request);\n\n try {\n switch (entryPoint.version) {\n case \"0.6.0\":\n // TODO\n break;\n case \"0.7.0\":\n await client.simulateContract({\n address: entryPoint.address,\n abi: entryPoint.abi,\n functionName: \"handleOps\",\n args: [\n [\n {\n sender: client.account.address,\n nonce: fromHex(uo.nonce, \"bigint\"),\n initCode:\n uo.factory && uo.factoryData\n ? concat([uo.factory, uo.factoryData])\n : \"0x\",\n callData: uo.callData,\n accountGasLimits: packAccountGasLimits({\n verificationGasLimit: uo.verificationGasLimit,\n callGasLimit: uo.callGasLimit,\n }),\n preVerificationGas: fromHex(uo.preVerificationGas, \"bigint\"),\n gasFees: packAccountGasLimits({\n maxPriorityFeePerGas: uo.maxPriorityFeePerGas,\n maxFeePerGas: uo.maxFeePerGas,\n }),\n paymasterAndData:\n uo.paymaster && isAddress(uo.paymaster)\n ? packPaymasterData({\n paymaster: uo.paymaster,\n paymasterVerificationGasLimit:\n uo.paymasterVerificationGasLimit,\n paymasterPostOpGasLimit: uo.paymasterPostOpGasLimit,\n paymasterData: uo.paymasterData,\n })\n : \"0x\",\n signature: uo.signature,\n },\n ],\n client.account.address,\n ],\n });\n }\n } catch (err: any) {\n if (err?.cause && err?.cause?.raw) {\n try {\n const { errorName, args } = decodeErrorResult({\n abi: entryPoint.abi,\n data: err.cause.raw,\n });\n console.error(`Failed with '${errorName}':`);\n switch (errorName) {\n case \"FailedOpWithRevert\":\n case \"FailedOp\":\n // TODO: if we pass in abi we could decode and print this too\n const argsIdx = errorName === \"FailedOp\" ? 1 : 2;\n console.error(\n args && args[argsIdx]\n ? `Smart contract account reverted with error: ${args[argsIdx]}`\n : \"No revert data from smart contract account\",\n );\n break;\n default:\n args && args.forEach((arg) => console.error(`\\n${arg}`));\n }\n return;\n } catch (err) {}\n }\n console.error(\"Entrypoint reverted with error: \");\n console.error(err);\n }\n}\n","import type { Chain, Transport } from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../../account/smartContractAccount\";\nimport type { BaseSmartAccountClient } from \"../../../client/smartAccountClient\";\nimport type { SendUserOperationResult } from \"../../../client/types\";\nimport { AccountNotFoundError } from \"../../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../../errors/client.js\";\nimport type {\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../../../types\";\nimport { signUserOperation } from \"../signUserOperation.js\";\nimport type { GetContextParameter, UserOperationContext } from \"../types\";\nimport { getUserOperationError } from \"../getUserOperationError.js\";\n\nexport async function _sendUserOperation<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client: BaseSmartAccountClient<TTransport, TChain, TAccount>,\n args: {\n uoStruct: UserOperationStruct<TEntryPointVersion>;\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n } & GetAccountParameter<TAccount> &\n GetContextParameter<TContext>,\n): Promise<SendUserOperationResult<TEntryPointVersion>> {\n const { account = client.account, uoStruct, context, overrides } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const entryPoint = account.getEntryPoint();\n const request = await signUserOperation(client, {\n uoStruct,\n account,\n context,\n overrides,\n });\n\n try {\n return {\n hash: await client.sendRawUserOperation(request, entryPoint.address),\n request,\n };\n } catch (err) {\n getUserOperationError(client, request, entryPoint);\n throw err;\n }\n}\n","import type { Chain, Client, Transport } from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport type { SendUserOperationResult } from \"../../client/types\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport type {\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../../types\";\nimport {\n bigIntMax,\n bigIntMultiply,\n resolveProperties,\n} from \"../../utils/index.js\";\nimport { _runMiddlewareStack } from \"./internal/runMiddlewareStack.js\";\nimport { _sendUserOperation } from \"./internal/sendUserOperation.js\";\nimport type {\n DropAndReplaceUserOperationParameters,\n UserOperationContext,\n} from \"./types\";\nimport { clientHeaderTrack } from \"../../index.js\";\n\n/**\n * Drops an existing user operation and replaces it with a new one while ensuring the appropriate fees and overrides are applied.\n *\n * @example\n * ```ts\n * import {\n * createSmartAccountClient,\n * } from \"@aa-sdk/core\";\n *\n * // smart account client is already extended with dropAndReplaceUserOperation\n * const client = createSmartAccountClient(...);\n * const { request } = await client.sendUserOperation(...);\n * const result = await client.dropAndReplaceUserOperation({\n * uoToDrop: request,\n * account, // only required if the client above is not connected to an account\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client_ The client instance with the transport, chain, and account information\n * @param {DropAndReplaceUserOperationParameters<TAccount, TContext>} args The parameters required for dropping and replacing the user operation including the account, operation to drop, overrides, and context\n * @returns {Promise<SendUserOperationResult<TEntryPointVersion>>} A promise that resolves to the result of sending the new user operation\n */\nexport async function dropAndReplaceUserOperation<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client_: Client<TTransport, TChain, TAccount>,\n args: DropAndReplaceUserOperationParameters<TAccount, TContext>,\n): Promise<SendUserOperationResult<TEntryPointVersion>> {\n const client = clientHeaderTrack(client_, \"dropAndReplaceUserOperation\");\n const { account = client.account, uoToDrop, overrides, context } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"dropAndReplaceUserOperation\",\n client,\n );\n }\n\n const entryPoint = account.getEntryPoint();\n\n const uoToSubmit = (\n entryPoint.version === \"0.6.0\"\n ? {\n initCode: (uoToDrop as UserOperationRequest<\"0.6.0\">).initCode,\n sender: (uoToDrop as UserOperationRequest<\"0.6.0\">).sender,\n nonce: (uoToDrop as UserOperationRequest<\"0.6.0\">).nonce,\n callData: (uoToDrop as UserOperationRequest<\"0.6.0\">).callData,\n signature: await account.getDummySignature(),\n }\n : {\n ...((uoToDrop as UserOperationRequest<\"0.7.0\">).factory &&\n (uoToDrop as UserOperationRequest<\"0.7.0\">).factoryData\n ? {\n factory: (uoToDrop as UserOperationRequest<\"0.7.0\">).factory,\n factoryData: (uoToDrop as UserOperationRequest<\"0.7.0\">)\n .factoryData,\n }\n : {}),\n sender: (uoToDrop as UserOperationRequest<\"0.7.0\">).sender,\n nonce: (uoToDrop as UserOperationRequest<\"0.7.0\">).nonce,\n callData: (uoToDrop as UserOperationRequest<\"0.7.0\">).callData,\n signature: await account.getDummySignature(),\n }\n ) as UserOperationStruct<TEntryPointVersion>;\n\n // If the fee estimator is not the one estimating fees, then this won't work\n // however, we have migrated to using erc7677middleware for alchemy paymaster flows\n // and most of the other paymasters we've seen don't do fee estimation\n const { maxFeePerGas, maxPriorityFeePerGas } = await resolveProperties(\n await client.middleware.feeEstimator(uoToSubmit, { account, client }),\n );\n\n const _overrides = {\n ...overrides,\n maxFeePerGas: bigIntMax(\n BigInt(maxFeePerGas ?? 0n),\n bigIntMultiply(uoToDrop.maxFeePerGas, 1.1),\n ),\n maxPriorityFeePerGas: bigIntMax(\n BigInt(maxPriorityFeePerGas ?? 0n),\n bigIntMultiply(uoToDrop.maxPriorityFeePerGas, 1.1),\n ),\n } as UserOperationOverrides<TEntryPointVersion>;\n\n const uoToSend = await _runMiddlewareStack(client, {\n uo: uoToSubmit,\n overrides: _overrides,\n account,\n });\n\n return _sendUserOperation(client, {\n uoStruct: uoToSend,\n account,\n context,\n overrides: _overrides,\n });\n}\n","import type { Address } from \"abitype\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport type {\n GetAccountParameter,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\n\nexport const getAddress: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: GetAccountParameter<TAccount>,\n) => Address = (client, args) => {\n const { account } = args ?? { account: client.account };\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n return account.address;\n};\n","import type { UserOperationRequest, UserOperationStruct } from \"../types.js\";\nimport { BaseError } from \"./base.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\n/**\n * Thrown when a UserOperationStruct is not a valid request\n *\n * extends viem BaseError\n */\nexport class InvalidUserOperationError extends BaseError {\n /**\n * @inheritdoc\n */\n override name = \"InvalidUserOperationError\";\n /**\n * Creates an instance of InvalidUserOperationError.\n *\n * InvalidUserOperationError constructor\n *\n * @param {UserOperationStruct} uo the invalid user operation struct\n */\n constructor(uo: UserOperationStruct) {\n super(\n `Request is missing parameters. All properties on UserOperationStruct must be set. uo: ${JSON.stringify(\n uo,\n (_key, value) =>\n typeof value === \"bigint\"\n ? {\n type: \"bigint\",\n value: value.toString(),\n }\n : value,\n 2,\n )}`,\n );\n }\n}\n\n/**\n * Error thrown when waiting for user operation request to be mined.\n *\n * Includes the internal error as well as the request that failed. This request\n * can then be used with dropAndReplaceUserOperation to retry the operation.\n */\nexport class WaitForUserOperationError extends BaseError {\n /**\n * @param {UserOperationRequest} request the user operation request that failed\n * @param {Error} error the underlying error that caused the failure\n */\n constructor(\n public request: UserOperationRequest,\n error: Error,\n ) {\n super(`Failed to find User Operation: ${error.message}`);\n }\n}\n","import type { Chain, Client, Hex, Transport } from \"viem\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { FailedToFindTransactionError } from \"../../errors/transaction.js\";\nimport { Logger } from \"../../logger.js\";\nimport type { WaitForUserOperationTxParameters } from \"./types.js\";\nimport { clientHeaderTrack } from \"../../index.js\";\n\n/**\n * Waits for a user operation transaction to be confirmed by checking the receipt periodically until it is found or a maximum number of retries is reached.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * // smart account client is already extended with waitForUserOperationTransaction\n * const client = createSmartAccountClient(...);\n * const result = await client.waitForUserOperationTransaction({\n * hash: \"0x...\",\n * retries: {...} // optional param to configure the retry amounts\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, any>} client_ The client instance used to interact with the blockchain\n * @param {WaitForUserOperationTxParameters} args The parameters for the transaction to wait for\n * @param {Hex} args.hash The transaction hash to wait for\n * @param {string} args.tag The tag to use for the UO status. \"pending\" or \"latest\". Defaults to \"latest\".\n * @param {WaitForUserOperationTxParameters[\"retries\"]} [args.retries] Optional retry parameters\n * @param {number} [args.retries.maxRetries] The maximum number of retry attempts\n * @param {number} [args.retries.intervalMs] The interval in milliseconds between retries\n * @param {number} [args.retries.multiplier] The multiplier for the interval between retries\n * @returns {Promise<Hex>} A promise that resolves to the transaction hash when the transaction is confirmed\n */\nexport const waitForUserOperationTransaction: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n>(\n client: Client<TTransport, TChain, any>,\n args: WaitForUserOperationTxParameters,\n) => Promise<Hex> = async (client_, args) => {\n const client = clientHeaderTrack(client_, \"waitForUserOperationTransaction\");\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"waitForUserOperationTransaction\",\n client,\n );\n }\n\n const {\n hash,\n retries = {\n maxRetries: client.txMaxRetries,\n intervalMs: client.txRetryIntervalMs,\n multiplier: client.txRetryMultiplier,\n },\n } = args;\n\n for (let i = 0; i < retries.maxRetries; i++) {\n const txRetryIntervalWithJitterMs =\n retries.intervalMs * Math.pow(retries.multiplier, i) +\n Math.random() * 100;\n\n await new Promise((resolve) =>\n setTimeout(resolve, txRetryIntervalWithJitterMs),\n );\n\n const receipt = await client\n .getUserOperationReceipt(hash as `0x${string}`, args.tag)\n .catch((e) => {\n Logger.error(\n `[SmartAccountProvider] waitForUserOperationTransaction error fetching receipt for ${hash}: ${e}`,\n );\n });\n\n if (receipt) {\n return receipt?.receipt.transactionHash;\n }\n }\n\n throw new FailedToFindTransactionError(hash);\n};\n","import type {\n Chain,\n Client,\n Hex,\n SendTransactionParameters,\n Transport,\n} from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { TransactionMissingToParamError } from \"../../errors/transaction.js\";\nimport { WaitForUserOperationError } from \"../../errors/useroperation.js\";\nimport type { UserOperationOverrides } from \"../../types.js\";\nimport { buildUserOperationFromTx } from \"./buildUserOperationFromTx.js\";\nimport { _sendUserOperation } from \"./internal/sendUserOperation.js\";\nimport type { UserOperationContext } from \"./types.js\";\nimport { waitForUserOperationTransaction } from \"./waitForUserOperationTransacation.js\";\nimport { clientHeaderTrack } from \"../../index.js\";\n\n/**\n * Sends a transaction using the provided client, arguments, optional overrides, and context.\n * This sends a UO and then waits for it to be mined\n *\n * @example\n * ```ts\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * // smart account client is already extended with sendTransaction\n * const client = createSmartAccountClient(...);\n * const result = await client.sendTransaction({\n * to: \"0x...\",\n * data: \"0x...\", // or \"0x\",\n * value: 0n, // optional\n * account, // only required if the client above is not connected to an account\n * });\n * ```\n *\n * @param {Client<Transport, TChain, TAccount>} client_ The client to send the transaction through\n * @param {SendTransactionParameters<TChain, TAccount, TChainOverride>} args The parameters required to send the transaction\n * @param {UserOperationOverrides<TEntryPointVersion>} [overrides] Optional overrides for the user operation\n * @param {UserOperationContext} [context] Optional context for the user operation\n * @returns {Promise<Hex>} A promise that resolves to a hex string representing the transaction hash\n */\nexport async function sendTransaction<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TChainOverride extends Chain | undefined = Chain | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client_: Client<Transport, TChain, TAccount>,\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext,\n): Promise<Hex> {\n const client = clientHeaderTrack(client_, \"estimateUserOperationGas\");\n const { account = client.account } = args;\n if (!account || typeof account === \"string\") {\n throw new AccountNotFoundError();\n }\n\n if (!args.to) {\n throw new TransactionMissingToParamError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"sendTransaction\",\n client,\n );\n }\n\n const uoStruct = await buildUserOperationFromTx(\n client,\n args,\n overrides,\n context,\n );\n\n const { hash, request } = await _sendUserOperation(client, {\n account: account as SmartContractAccount,\n uoStruct,\n context,\n overrides,\n });\n\n return waitForUserOperationTransaction(client, { hash }).catch((e) => {\n throw new WaitForUserOperationError(request, e);\n });\n}\n","import type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { SmartContractAccount } from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { WaitForUserOperationError } from \"../../errors/useroperation.js\";\nimport { buildUserOperationFromTxs } from \"./buildUserOperationFromTxs.js\";\nimport { _sendUserOperation } from \"./internal/sendUserOperation.js\";\nimport type { SendTransactionsParameters, UserOperationContext } from \"./types\";\nimport { waitForUserOperationTransaction } from \"./waitForUserOperationTransacation.js\";\nimport { clientHeaderTrack } from \"../../index.js\";\n\n/**\n * Sends transactions using the provided client and transaction parameters. This function builds user operations from the transactions, sends them, and waits for the transaction to be mined.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * // smart account client is already extended with sendTransactions\n * const client = createSmartAccountClient(...);\n * const result = await client.sendTransactions({\n * requests: [{\n * to: \"0x...\",\n * data: \"0x...\", // or \"0x\",\n * value: 0n, // optional\n * }],\n * account, // only required if the client above is not connected to an account\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client_ The client used to send the transactions\n * @param {SendTransactionsParameters<TAccount, TContext>} args The parameters for sending the transactions, including requests, overrides, account, and context\n * @returns {Promise<Hex>} A promise that resolves to the transaction hash of the sent transactions\n */\nexport async function sendTransactions<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined = UserOperationContext,\n>(\n client_: Client<TTransport, TChain, TAccount>,\n args: SendTransactionsParameters<TAccount, TContext>,\n): Promise<Hex> {\n const client = clientHeaderTrack(client_, \"estimateUserOperationGas\");\n const { requests, overrides, account = client.account, context } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"sendTransactions\",\n client,\n );\n }\n\n const { uoStruct } = await buildUserOperationFromTxs(client, {\n requests,\n overrides,\n account,\n context,\n });\n\n const { hash, request } = await _sendUserOperation(client, {\n account,\n uoStruct,\n context,\n overrides,\n });\n\n return waitForUserOperationTransaction(client, { hash }).catch((e) => {\n throw new WaitForUserOperationError(request, e);\n });\n}\n","import type { Chain, Client, Transport } from \"viem\";\nimport type {\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport type { SendUserOperationResult } from \"../../client/types.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { buildUserOperation } from \"./buildUserOperation.js\";\nimport { _sendUserOperation } from \"./internal/sendUserOperation.js\";\nimport type {\n SendUserOperationParameters,\n UserOperationContext,\n} from \"./types.js\";\nimport { clientHeaderTrack } from \"../../index.js\";\n\n/**\n * Sends a user operation or batch of user operations using the connected account. Before executing, sendUserOperation will run the user operation through the middleware pipeline.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, toSmartContractAccount } from \"@aa-sdk/core\";\n *\n * const account = await toSmartContractAccount(...);\n * const result = await createSmartAccountClient(...).sendUserOperation({\n * uo: {\n * target: \"0x...\",\n * data: \"0x...\", // or \"0x\",\n * value: 0n, // optional\n * }\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client_ the smart account client to use for RPC requests\n * @param {SendUserOperationParameters<TAccount, TContext>} args contains the UO or batch to send, context, overrides, and account if not hoisted on the client\n * @returns {Promise<SendUserOperationResult<TEntryPointVersion>>} a Promise containing the result of the user operation\n */\nexport async function sendUserOperation<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client_: Client<TTransport, TChain, TAccount>,\n args: SendUserOperationParameters<TAccount, TContext>,\n): Promise<SendUserOperationResult<TEntryPointVersion>> {\n const client = clientHeaderTrack(client_, \"sendUserOperation\");\n const { account = client.account, context, overrides } = args;\n\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"sendUserOperation\",\n client,\n );\n }\n\n const uoStruct = await buildUserOperation(client, {\n uo: args.uo,\n account,\n context,\n overrides,\n });\n\n return _sendUserOperation(client, {\n account,\n uoStruct,\n context,\n overrides,\n });\n}\n","import type { Chain, Client, Hex, SignableMessage, Transport } from \"viem\";\nimport type {\n GetAccountParameter,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\n\nexport type SignMessageParameters<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n> = { message: SignableMessage } & GetAccountParameter<TAccount>;\n\nexport const signMessage: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: SignMessageParameters<TAccount>,\n) => Promise<Hex> = async (client, { account = client.account, message }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n return account.signMessageWith6492({ message });\n};\n","import type {\n Chain,\n Client,\n Hex,\n Transport,\n TypedData,\n TypedDataDefinition,\n} from \"viem\";\nimport type {\n GetAccountParameter,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\n\nexport type SignTypedDataParameters<\n TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n> = {\n typedData: TypedDataDefinition<TTypedData, TPrimaryType>;\n} & GetAccountParameter<TAccount>;\n\nexport const signTypedData: <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string,\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>,\n) => Promise<Hex> = async (client, { account = client.account, typedData }) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n return account.signTypedDataWith6492(typedData);\n};\n","import type { Chain, Client, Hash, Transport } from \"viem\";\nimport type { SmartContractAccount } from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport { sendUserOperation } from \"./sendUserOperation.js\";\nimport type { UpgradeAccountParams, UserOperationContext } from \"./types.js\";\nimport { waitForUserOperationTransaction } from \"./waitForUserOperationTransacation.js\";\nimport { clientHeaderTrack } from \"../../index.js\";\n\nexport const upgradeAccount: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: UpgradeAccountParams<TAccount, TContext>,\n) => Promise<Hash> = async (client_, args) => {\n const client = clientHeaderTrack(client_, \"upgradeAccount\");\n const {\n account = client.account,\n upgradeTo,\n overrides,\n waitForTx,\n context,\n } = args;\n\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n \"upgradeAccount\",\n client,\n );\n }\n\n const { implAddress: accountImplAddress, initializationData } = upgradeTo;\n\n const encodeUpgradeData = await account.encodeUpgradeToAndCall({\n upgradeToAddress: accountImplAddress,\n upgradeToInitData: initializationData,\n });\n\n const result = await sendUserOperation(client, {\n uo: {\n target: account.address,\n data: encodeUpgradeData,\n },\n account,\n overrides,\n context,\n });\n\n let hash = result.hash;\n if (waitForTx) {\n hash = await waitForUserOperationTransaction(client, result);\n }\n\n return hash;\n};\n","import {\n type Address,\n type Chain,\n type Client,\n type Hex,\n type SendTransactionParameters,\n type Transport,\n type TypedData,\n} from \"viem\";\nimport type {\n GetAccountParameter,\n GetEntryPointFromAccount,\n SmartContractAccount,\n} from \"../../account/smartContractAccount\";\nimport { buildUserOperation } from \"../../actions/smartAccount/buildUserOperation.js\";\nimport { buildUserOperationFromTx } from \"../../actions/smartAccount/buildUserOperationFromTx.js\";\nimport { buildUserOperationFromTxs } from \"../../actions/smartAccount/buildUserOperationFromTxs.js\";\nimport {\n checkGasSponsorshipEligibility,\n type CheckGasSponsorshipEligibilityResult,\n} from \"../../actions/smartAccount/checkGasSponsorshipEligibility.js\";\nimport { dropAndReplaceUserOperation } from \"../../actions/smartAccount/dropAndReplaceUserOperation.js\";\nimport { getAddress } from \"../../actions/smartAccount/getAddress.js\";\nimport { sendTransaction } from \"../../actions/smartAccount/sendTransaction.js\";\nimport { sendTransactions } from \"../../actions/smartAccount/sendTransactions.js\";\nimport { sendUserOperation } from \"../../actions/smartAccount/sendUserOperation.js\";\nimport {\n signMessage,\n type SignMessageParameters,\n} from \"../../actions/smartAccount/signMessage.js\";\nimport {\n signTypedData,\n type SignTypedDataParameters,\n} from \"../../actions/smartAccount/signTypedData.js\";\nimport { signUserOperation } from \"../../actions/smartAccount/signUserOperation.js\";\nimport type {\n BuildTransactionParameters,\n BuildUserOperationFromTransactionsResult,\n BuildUserOperationParameters,\n DropAndReplaceUserOperationParameters,\n SendTransactionsParameters,\n SendUserOperationParameters,\n SignUserOperationParameters,\n UpgradeAccountParams,\n UserOperationContext,\n WaitForUserOperationTxParameters,\n} from \"../../actions/smartAccount/types\";\nimport { upgradeAccount } from \"../../actions/smartAccount/upgradeAccount.js\";\nimport { waitForUserOperationTransaction } from \"../../actions/smartAccount/waitForUserOperationTransacation.js\";\nimport type {\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../../types\";\nimport type { IsUndefined } from \"../../utils\";\nimport type { SendUserOperationResult } from \"../types\";\n\n//#region SmartAccountClientActions\nexport type BaseSmartAccountClientActions<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n> = {\n buildUserOperation: (\n args: BuildUserOperationParameters<TAccount, TContext>,\n ) => Promise<UserOperationStruct<TEntryPointVersion>>;\n buildUserOperationFromTx: (\n args: SendTransactionParameters<TChain, TAccount>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext,\n ) => Promise<UserOperationStruct<TEntryPointVersion>>;\n buildUserOperationFromTxs: (\n args: BuildTransactionParameters<TAccount, TContext>,\n ) => Promise<BuildUserOperationFromTransactionsResult<TEntryPointVersion>>;\n checkGasSponsorshipEligibility: <\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n >(\n args: SendUserOperationParameters<TAccount, TContext>,\n ) => Promise<\n CheckGasSponsorshipEligibilityResult<TAccount, TEntryPointVersion>\n >;\n signUserOperation: (\n args: SignUserOperationParameters<TAccount, TEntryPointVersion, TContext>,\n ) => Promise<UserOperationRequest<TEntryPointVersion>>;\n dropAndReplaceUserOperation: (\n args: DropAndReplaceUserOperationParameters<TAccount, TContext>,\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n // TODO: for v4 we should combine override and context into an `opts` parameter\n // which wraps both of these properties so we can use GetContextParameter\n sendTransaction: <TChainOverride extends Chain | undefined = undefined>(\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext,\n ) => Promise<Hex>;\n sendTransactions: (\n args: SendTransactionsParameters<TAccount, TContext>,\n ) => Promise<Hex>;\n sendUserOperation: (\n args: SendUserOperationParameters<\n TAccount,\n TContext,\n GetEntryPointFromAccount<TAccount>\n >,\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n waitForUserOperationTransaction: (\n args: WaitForUserOperationTxParameters,\n ) => Promise<Hex>;\n upgradeAccount: (\n args: UpgradeAccountParams<TAccount, TContext>,\n ) => Promise<Hex>;\n signMessage: (args: SignMessageParameters<TAccount>) => Promise<Hex>;\n signTypedData: <\n const TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string,\n >(\n args: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>,\n ) => Promise<Hex>;\n} & (IsUndefined<TAccount> extends false\n ? { getAddress: () => Address }\n : {\n getAddress: (args: GetAccountParameter<TAccount>) => Address;\n });\n// #endregion SmartAccountClientActions\n\n/**\n * Provides a set of smart account client actions to decorate the provided client. These actions include building and signing user operations, sending transactions, and more.\n *\n * NOTE: this is already added to clients returned from `createSmartAccountClient`\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client to bind the smart account actions to\n * @returns {BaseSmartAccountClientActions<TChain, TAccount, TContext>} An object containing various smart account client actions\n */\nexport const smartAccountClientActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n) => BaseSmartAccountClientActions<TChain, TAccount, TContext> = (client) => ({\n buildUserOperation: (args) => buildUserOperation(client, args),\n buildUserOperationFromTx: (args, overrides, context) =>\n buildUserOperationFromTx(client, args, overrides, context),\n buildUserOperationFromTxs: (args) => buildUserOperationFromTxs(client, args),\n checkGasSponsorshipEligibility: (args) =>\n checkGasSponsorshipEligibility(client, args),\n signUserOperation: (args) => signUserOperation(client, args),\n dropAndReplaceUserOperation: (args) =>\n dropAndReplaceUserOperation(client, args),\n sendTransaction: (args, overrides, context) =>\n sendTransaction(client, args, overrides, context),\n sendTransactions: (args) => sendTransactions(client, args),\n sendUserOperation: (args) => sendUserOperation(client, args),\n waitForUserOperationTransaction: (args) =>\n waitForUserOperationTransaction.bind(client)(client, args),\n upgradeAccount: (args) => upgradeAccount(client, args),\n getAddress: (args) => getAddress(client, args),\n signMessage: (args) => signMessage(client, args),\n signTypedData: (args) => signTypedData(client, args),\n});\n\nexport const smartAccountClientMethodKeys = Object.keys(\n // @ts-expect-error we just want to get the keys\n smartAccountClientActions(undefined),\n).reduce((accum, curr) => {\n accum.add(curr);\n return accum;\n}, new Set<string>());\n","import type { Chain, Client, Transport } from \"viem\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount\";\nimport { smartAccountClientMethodKeys } from \"./decorators/smartAccountClient.js\";\nimport type {\n BaseSmartAccountClient,\n SmartAccountClient,\n} from \"./smartAccountClient\";\n\n/**\n * Use this method to assert that a client is a BaseSmartAccountClient.\n * Useful for narrowing the type of the client down when used within the\n * smart account client decorators\n *\n * @param {Client<TTransport, TChain, TAccount>} client a viem client\n * @returns {boolean} true if the client is a SmartAccountClient\n */\nexport function isSmartAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n): client is SmartAccountClient<TTransport, TChain, TAccount> {\n for (const key of smartAccountClientMethodKeys) {\n if (!(key in client)) {\n return false;\n }\n }\n\n return client && \"middleware\" in client;\n}\n\n/**\n * Use this method to assert that a client is a BaseSmartAccountClient.\n * Useful for narrowing the type of the client down when used within the\n * smart account action decorators\n *\n * @param {Client<TTransport, TChain, TAccount>} client a viem client\n * @returns {boolean} true if the account is a BaseSmartAccountClient\n */\nexport function isBaseSmartAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n): client is BaseSmartAccountClient<TTransport, TChain, TAccount> {\n return client && \"middleware\" in client;\n}\n","import { type Chain, type Transport, concatHex, toHex, zeroHash } from \"viem\";\nimport {\n isSmartAccountWithSigner,\n type GetEntryPointFromAccount,\n type SmartContractAccount,\n} from \"../../../account/smartContractAccount.js\";\nimport type { BaseSmartAccountClient } from \"../../../client/smartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../../errors/client.js\";\nimport type { UserOperationStruct } from \"../../../types.js\";\nimport { conditionalReturn, type Deferrable } from \"../../../utils/index.js\";\nimport type {\n BuildUserOperationParameters,\n SendUserOperationParameters,\n UserOperationContext,\n} from \"../types.js\";\n\n/**\n * Description internal action function of SmartAccountClient for initializing\n * a user operation for the sender account\n *\n * @template {Transport} TTransport\n * @template {Chain | undefined} TChain\n * @template {SmartContractAccount | undefined} TAccount\n * @template {UserOperationContext | undefined} TContext\n * @template {GetEntryPointFromAccount} TEntryPointVersion\n * @param {BaseSmartAccountClient<TTransport, TChain, TAccount>} client smart account client\n * @param {SendUserOperationParameters<TAccount, TContext, TEntryPointVersion> | BuildUserOperationParameters<TAccount, TContext, TEntryPointVersion>} args send user operation parameters\n * @returns {Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>>} initialized user operation struct\n */\nexport async function _initUserOperation<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client: BaseSmartAccountClient<TTransport, TChain, TAccount>,\n args:\n | SendUserOperationParameters<TAccount, TContext, TEntryPointVersion>\n | BuildUserOperationParameters<TAccount, TContext, TEntryPointVersion>,\n): Promise<Deferrable<UserOperationStruct<TEntryPointVersion>>> {\n const { account = client.account, uo, overrides } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const entryPoint = account.getEntryPoint();\n\n const callData = Array.isArray(uo)\n ? account.encodeBatchExecute(uo)\n : typeof uo === \"string\"\n ? uo\n : account.encodeExecute(uo);\n\n const signature = account.getDummySignature();\n\n const nonce =\n overrides?.nonce ?? account.getAccountNonce(overrides?.nonceKey);\n\n const struct =\n entryPoint.version === \"0.6.0\"\n ? ({\n initCode: account.getInitCode(),\n sender: account.address,\n nonce,\n callData,\n signature,\n } as Deferrable<UserOperationStruct<TEntryPointVersion>>)\n : ({\n factory: conditionalReturn(\n account.isAccountDeployed().then((deployed) => !deployed),\n account.getFactoryAddress,\n ),\n factoryData: conditionalReturn(\n account.isAccountDeployed().then((deployed) => !deployed),\n account.getFactoryData,\n ),\n sender: account.address,\n nonce,\n callData,\n signature,\n } as Deferrable<UserOperationStruct<TEntryPointVersion>>);\n\n const is7702 =\n account.source === \"ModularAccountV2\" &&\n isSmartAccountWithSigner(account) &&\n (await account.getSigner().getAddress()).toLowerCase() ===\n account.address.toLowerCase();\n\n if (is7702) {\n if (entryPoint.version !== \"0.7.0\") {\n throw new Error(\"7702 is only compatible with EntryPoint v0.7.0\");\n }\n\n const [implementationAddress, code = \"0x\", nonce] = await Promise.all([\n account.getImplementationAddress(),\n client.getCode({ address: account.address }),\n client.getTransactionCount({ address: account.address }),\n ]);\n\n const isAlreadyDelegated =\n code.toLowerCase() ===\n concatHex([\"0xef0100\", implementationAddress]).toLowerCase();\n\n if (!isAlreadyDelegated) {\n (struct as UserOperationStruct<\"0.7.0\">).eip7702Auth = {\n chainId: toHex(client.chain.id),\n nonce: toHex(nonce),\n address: implementationAddress,\n r: zeroHash, // aka `bytes32(0)`\n s: zeroHash,\n yParity: \"0x0\",\n };\n }\n }\n\n return struct;\n}\n","/**\n * The symbol that is used to add a breadcrumb to the headers. Is an optional\n * function that is used to add a breadcrumb to the headers.\n */\nexport const ADD_BREADCRUMB = Symbol(\"addBreadcrumb\");\n\nfunction hasAddBreadcrumb<A extends {}>(\n a: A,\n): a is A & { [ADD_BREADCRUMB]: (breadcrumb: string) => A } {\n return ADD_BREADCRUMB in a;\n}\n\n/**\n * Add a crumb to the breadcrumb.\n *\n * @param {X} client Clients are somethings like viem, that we are adding breadcrumbs to, and could be owning the transport. Usually a alchemy client.\n * @param {string} crumb The crumb to add to the breadcrumb\n * @returns {Function} The updated client\n */\nexport function clientHeaderTrack<X extends {}>(client: X, crumb: string): X {\n if (hasAddBreadcrumb(client)) {\n return client[ADD_BREADCRUMB](crumb);\n }\n return client;\n}\n","import { type Chain, type Client, type Transport } from \"viem\";\nimport {\n type GetEntryPointFromAccount,\n type SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { isBaseSmartAccountClient } from \"../../client/isSmartAccountClient.js\";\nimport { AccountNotFoundError } from \"../../errors/account.js\";\nimport { IncompatibleClientError } from \"../../errors/client.js\";\nimport type { UserOperationStruct } from \"../../types.js\";\nimport { _initUserOperation } from \"./internal/initUserOperation.js\";\nimport { _runMiddlewareStack } from \"./internal/runMiddlewareStack.js\";\nimport type {\n BuildUserOperationParameters,\n UserOperationContext,\n} from \"./types\";\nimport { clientHeaderTrack } from \"../../client/addBreadcrumb.js\";\n\nconst USER_OPERATION_METHOD = \"buildUserOperation\";\n/**\n * Builds a user operation using the provided client and operation parameters. Ensures that the account exists and the client is compatible.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * // smart account client is already extended with buildUserOperation\n * const client = createSmartAccountClient(...);\n * const result = await client.buildUserOperation({\n * uo: {\n * target: \"0x...\",\n * data: \"0x...\", // or \"0x\",\n * value: 0n, // optional\n * },\n * account, // only required if the client above is not connected to an account\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client_ the client instance used to build the user operation\n * @param {BuildUserOperationParameters<TAccount, TContext, TEntryPointVersion>} args the parameters required to build the user operation, including account, overrides, and context\n * @returns {Promise<UserOperationStruct<TEntryPointVersion>>} a promise that resolves to a `UserOperationStruct` object containing the built user operation details\n */\nexport async function buildUserOperation<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n>(\n client_: Client<TTransport, TChain, TAccount>,\n args: BuildUserOperationParameters<TAccount, TContext, TEntryPointVersion>,\n): Promise<UserOperationStruct<TEntryPointVersion>> {\n const client = clientHeaderTrack(client_, USER_OPERATION_METHOD);\n const { account = client.account, overrides, context } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isBaseSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"BaseSmartAccountClient\",\n USER_OPERATION_METHOD,\n client,\n );\n }\n\n return _initUserOperation(client, args).then((_uo) =>\n _runMiddlewareStack(client, {\n uo: _uo,\n overrides,\n account,\n context,\n }),\n );\n}\n","import type { Transport } from \"viem\";\nimport { z } from \"zod\";\n\nimport { BigNumberishRangeSchema, MultiplierSchema } from \"../utils/index.js\";\nimport type { BundlerClient } from \"./bundlerClient.js\";\n\nexport const createPublicErc4337ClientSchema = <\n TTransport extends Transport = Transport,\n>() =>\n z.custom<BundlerClient<TTransport>>((provider) => {\n return (\n provider != null &&\n typeof provider === \"object\" &&\n \"request\" in provider &&\n \"type\" in provider &&\n \"key\" in provider &&\n \"name\" in provider\n );\n });\n\n// TODO: in v5 either remove this or simplify it (either way this should be moved out of aa-sdk/core)\nexport const ConnectionConfigSchema = z.intersection(\n z.union([\n z.object({\n rpcUrl: z.never().optional(),\n apiKey: z.string(),\n jwt: z.never().optional(),\n }),\n z.object({\n rpcUrl: z.never().optional(),\n apiKey: z.never().optional(),\n jwt: z.string(),\n }),\n z.object({\n rpcUrl: z.string(),\n apiKey: z.never().optional(),\n jwt: z.never().optional(),\n }),\n z.object({\n rpcUrl: z.string(),\n apiKey: z.never().optional(),\n jwt: z.string(),\n }),\n ]),\n z.object({\n chainAgnosticUrl: z.string().optional(),\n }),\n);\n\nexport const UserOperationFeeOptionsFieldSchema =\n BigNumberishRangeSchema.merge(MultiplierSchema).partial();\n\nexport const UserOperationFeeOptionsSchema_v6 = z\n .object({\n maxFeePerGas: UserOperationFeeOptionsFieldSchema,\n maxPriorityFeePerGas: UserOperationFeeOptionsFieldSchema,\n callGasLimit: UserOperationFeeOptionsFieldSchema,\n verificationGasLimit: UserOperationFeeOptionsFieldSchema,\n preVerificationGas: UserOperationFeeOptionsFieldSchema,\n })\n .partial()\n .strict();\n\nexport const UserOperationFeeOptionsSchema_v7 =\n UserOperationFeeOptionsSchema_v6.extend({\n paymasterVerificationGasLimit: UserOperationFeeOptionsFieldSchema,\n paymasterPostOpGasLimit: UserOperationFeeOptionsFieldSchema,\n })\n .partial()\n .strict();\n\nexport const UserOperationFeeOptionsSchema = UserOperationFeeOptionsSchema_v7;\n\nexport const SmartAccountClientOptsSchema = z\n .object({\n /**\n * The maximum number of times to try fetching a transaction receipt before giving up (default: 5)\n */\n txMaxRetries: z.number().min(0).optional().default(5),\n\n /**\n * The interval in milliseconds to wait between retries while waiting for tx receipts (default: 2_000)\n */\n txRetryIntervalMs: z.number().min(0).optional().default(2_000),\n\n /**\n * The multiplier on interval length to wait between retries while waiting for tx receipts (default: 1.5)\n */\n txRetryMultiplier: z.number().min(0).optional().default(1.5),\n\n /**\n * Optional user operation fee options to be set globally at the provider level\n */\n feeOptions: UserOperationFeeOptionsSchema.optional(),\n })\n .strict();\n","import type { BigNumberish } from \"../../types\";\nimport { applyUserOpOverrideOrFeeOption } from \"../../utils/index.js\";\nimport type { MiddlewareClient } from \"../actions\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\n/**\n * Default fee estimator middleware function that estimates the maximum fee per gas and maximum priority fee per gas for a given client and applies the necessary overrides and fee options.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, defaultFeeEstimator, createBundlerClient } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n *\n * // NOTE: this is already provided by the smart account client\n * const client = createSmartAccountClient({\n * feeEstimator: defaultFeeEstimator(bundlerClient),\n * ...otherParams\n * });\n * ```\n *\n * @template {MiddlewareClient} C The type of the client\n * @param {C} client The client to perform the fee estimation\n * @returns {ClientMiddlewareFn} A middleware function that takes in the struct and options, estimates the fees, and updates the struct with the estimated fees\n */\nexport function defaultFeeEstimator<C extends MiddlewareClient>(\n client: C,\n): ClientMiddlewareFn {\n return async (struct, { overrides, feeOptions }) => {\n // maxFeePerGas must be at least the sum of maxPriorityFeePerGas and baseFee\n // so we need to accommodate for the fee option applied maxPriorityFeePerGas for the maxFeePerGas\n //\n // Note that if maxFeePerGas is not at least the sum of maxPriorityFeePerGas and required baseFee\n // after applying the fee options, then the transaction will fail\n //\n // Refer to https://alchemy.com/docs/maxpriorityfeepergas-vs-maxfeepergas\n // for more information about maxFeePerGas and maxPriorityFeePerGas\n\n const feeData = await client.estimateFeesPerGas();\n if (!feeData.maxFeePerGas || feeData.maxPriorityFeePerGas == null) {\n throw new Error(\n \"feeData is missing maxFeePerGas or maxPriorityFeePerGas\",\n );\n }\n\n let maxPriorityFeePerGas: BigNumberish =\n await client.estimateMaxPriorityFeePerGas();\n\n maxPriorityFeePerGas = applyUserOpOverrideOrFeeOption(\n maxPriorityFeePerGas,\n overrides?.maxPriorityFeePerGas,\n feeOptions?.maxPriorityFeePerGas,\n );\n\n let maxFeePerGas: BigNumberish =\n feeData.maxFeePerGas -\n feeData.maxPriorityFeePerGas +\n BigInt(maxPriorityFeePerGas);\n\n maxFeePerGas = applyUserOpOverrideOrFeeOption(\n maxFeePerGas,\n overrides?.maxFeePerGas,\n feeOptions?.maxFeePerGas,\n );\n\n struct.maxFeePerGas = maxFeePerGas;\n struct.maxPriorityFeePerGas = maxPriorityFeePerGas;\n return struct;\n };\n}\n","import type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationStruct,\n} from \"../../types.js\";\nimport { deepHexlify, resolveProperties } from \"../../utils/index.js\";\nimport { applyUserOpOverrideOrFeeOption } from \"../../utils/userop.js\";\nimport type { MiddlewareClient } from \"../actions.js\";\nimport type { ClientMiddlewareFn } from \"../types.js\";\n\n/**\n * Description default gas estimator middleware for `SmartAccountClient`\n * You can override this middleware with your custom gas estimator middleware\n * by passing it to the client constructor\n *\n * @param {MiddlewareClient} client smart account client instance to apply the middleware to\n * @returns {ClientMiddlewareFn} middleware execution function used to estimate gas for user operations\n */\nexport const defaultGasEstimator: <C extends MiddlewareClient>(\n client: C,\n) => ClientMiddlewareFn =\n (client: MiddlewareClient): ClientMiddlewareFn =>\n async (struct, { account, overrides, feeOptions }) => {\n const request = deepHexlify(await resolveProperties(struct));\n\n const estimates = await client.estimateUserOperationGas(\n request,\n account.getEntryPoint().address,\n overrides?.stateOverride,\n );\n\n const callGasLimit = applyUserOpOverrideOrFeeOption(\n estimates.callGasLimit,\n overrides?.callGasLimit,\n feeOptions?.callGasLimit,\n );\n const verificationGasLimit = applyUserOpOverrideOrFeeOption(\n estimates.verificationGasLimit,\n overrides?.verificationGasLimit,\n feeOptions?.verificationGasLimit,\n );\n const preVerificationGas = applyUserOpOverrideOrFeeOption(\n estimates.preVerificationGas,\n overrides?.preVerificationGas,\n feeOptions?.preVerificationGas,\n );\n\n struct.callGasLimit = callGasLimit;\n struct.verificationGasLimit = verificationGasLimit;\n struct.preVerificationGas = preVerificationGas;\n\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version === \"0.7.0\") {\n const paymasterVerificationGasLimit = applyUserOpOverrideOrFeeOption(\n estimates.paymasterVerificationGasLimit,\n (overrides as UserOperationOverrides<\"0.7.0\">)\n ?.paymasterVerificationGasLimit,\n (feeOptions as UserOperationFeeOptions<\"0.7.0\">)\n ?.paymasterVerificationGasLimit,\n );\n const uo_v7 = struct as UserOperationStruct<\"0.7.0\">;\n\n uo_v7.paymasterVerificationGasLimit = paymasterVerificationGasLimit;\n\n uo_v7.paymasterPostOpGasLimit =\n uo_v7.paymasterPostOpGasLimit ?? (uo_v7.paymaster ? \"0x0\" : undefined);\n }\n\n return struct;\n };\n","import type { UserOperationStruct } from \"../../types\";\nimport type { ClientMiddlewareFn } from \"../types\";\n\n/**\n * Middleware function that sets the `paymasterAndData` field in the given struct based on the entry point version of the account.\n * This is the default used by `createSmartAccountClient` and is not necessary to be used directly.\n *\n * @param {UserOperationStruct} struct the user operation structure to be modified\n * @param {{ account: Account }} context an object containing the account information\n * @returns {Promise<UserOperationStruct>} a promise that resolves to the modified user operation structure\n */\nexport const defaultPaymasterAndData: ClientMiddlewareFn = async (\n struct,\n { account },\n) => {\n const entryPoint = account.getEntryPoint();\n if (entryPoint.version === \"0.6.0\") {\n (struct as UserOperationStruct<\"0.6.0\">).paymasterAndData = \"0x\";\n }\n return struct;\n};\n","import { AccountNotFoundError } from \"../../errors/account.js\";\nimport { ChainNotFoundError } from \"../../errors/client.js\";\nimport { InvalidUserOperationError } from \"../../errors/useroperation.js\";\nimport {\n deepHexlify,\n isValidRequest,\n resolveProperties,\n} from \"../../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"../types\";\nimport { type Authorization, type Hex, hexToNumber, toHex } from \"viem\";\nimport {\n isSmartAccountWithSigner,\n type SmartContractAccount,\n} from \"../../account/smartContractAccount.js\";\nimport { BaseError } from \"../../errors/base.js\";\n\n/**\n * Provides a default middleware function for signing user operations with a client account. This function validates the request and adds the signature to it.\n * This is already included in the client returned from `createSmartAccountClient`\n *\n * @param {UserOperationStruct} struct The user operation structure to be signed\n * @param {*} context The middleware context containing the client and account information\n * @param {Client} context.client The client object, which should include account and chain information\n * @param {Account} [context.account] Optional, the account used for signing, defaults to the client's account if not provided\n * @returns {Promise<UserOperationStruct>} A promise that resolves to the signed user operation structure\n */\nexport const defaultUserOpSigner: ClientMiddlewareFn = async (\n struct,\n { client, account = client.account },\n) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!client?.chain) {\n throw new ChainNotFoundError();\n }\n\n const resolvedStruct = await resolveProperties(struct);\n const request = deepHexlify(resolvedStruct);\n if (!isValidRequest(request)) {\n throw new InvalidUserOperationError(resolvedStruct);\n }\n\n return {\n ...resolvedStruct,\n signature: await account.signUserOperationHash(\n account.getEntryPoint().getUserOperationHash(request),\n ),\n ...(resolvedStruct.eip7702Auth && {\n eip7702Auth: await signAuthorization(account, resolvedStruct.eip7702Auth),\n }),\n };\n};\n\nconst signAuthorization = async (\n account: SmartContractAccount,\n unsignedAuthorization: Authorization<Hex, false>,\n) => {\n if (!account || !isSmartAccountWithSigner(account)) {\n throw new AccountNotFoundError();\n }\n\n const signer = account.getSigner();\n if (!signer.signAuthorization) {\n throw new BaseError(\n \"Signer must implement signAuthorization to sign EIP-7702 authorizations.\",\n );\n }\n\n const signedAuthorization = await signer.signAuthorization({\n chainId: hexToNumber(unsignedAuthorization.chainId),\n contractAddress: unsignedAuthorization.address,\n nonce: hexToNumber(unsignedAuthorization.nonce),\n });\n\n return {\n chainId: toHex(signedAuthorization.chainId),\n nonce: toHex(signedAuthorization.nonce),\n address: signedAuthorization.address,\n r: signedAuthorization.r,\n s: signedAuthorization.s,\n yParity: toHex(signedAuthorization.yParity ?? signedAuthorization.v - 27n),\n };\n};\n","import {\n type Chain,\n type Client,\n type PublicActions,\n type PublicRpcSchema,\n type Transport,\n} from \"viem\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type {\n BundlerActions,\n BundlerRpcSchema,\n} from \"../client/decorators/bundlerClient.js\";\nimport type { ClientMiddlewareConfig } from \"../client/types.js\";\nimport { defaultFeeEstimator } from \"./defaults/feeEstimator.js\";\nimport { defaultGasEstimator } from \"./defaults/gasEstimator.js\";\nimport { defaultPaymasterAndData } from \"./defaults/paymasterAndData.js\";\nimport { defaultUserOpSigner } from \"./defaults/userOpSigner.js\";\nimport { noopMiddleware } from \"./noopMiddleware.js\";\nimport type { ClientMiddleware } from \"./types.js\";\n\n/**\n * Middleware client type\n *\n * @template {Transport} TTransport\n * @template {Chain | undefined} TChain\n * @template {SmartContractAccount | undefined} TAccount\n */\nexport type MiddlewareClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n> = Client<\n TTransport,\n TChain,\n TAccount,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n PublicActions & BundlerActions\n>;\n\n/**\n * function that takes in ClientMiddlewareConfig used during client initiation\n * and returns the middleware actions object that the smart account client extends with\n *\n * @param {ClientMiddlewareConfig} overrides config used during client initiation for overriding default middlewares\n * @returns {(client: MiddlewareClient<TTransport, TChain, TAccount>) => { middleware: ClientMiddleware }} middleware actions object\n */\nexport const middlewareActions =\n (overrides: ClientMiddlewareConfig) =>\n <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n >(\n client: MiddlewareClient<TTransport, TChain, TAccount>,\n ): { middleware: ClientMiddleware } => ({\n middleware: {\n customMiddleware: overrides.customMiddleware ?? noopMiddleware,\n dummyPaymasterAndData:\n overrides.dummyPaymasterAndData ?? defaultPaymasterAndData,\n feeEstimator: overrides.feeEstimator ?? defaultFeeEstimator(client),\n gasEstimator: overrides.gasEstimator ?? defaultGasEstimator(client),\n paymasterAndData: overrides.paymasterAndData ?? defaultPaymasterAndData,\n userOperationSimulator:\n overrides.userOperationSimulator ?? noopMiddleware,\n signUserOperation: overrides.signUserOperation ?? defaultUserOpSigner,\n },\n });\n","import {\n custom,\n type Chain,\n type Client,\n type ClientConfig,\n type CustomTransport,\n type FormattedTransactionRequest,\n type PublicActions,\n type PublicRpcSchema,\n type RpcSchema,\n type Transport,\n} from \"viem\";\nimport { z } from \"zod\";\nimport type { SmartContractAccount } from \"../account/smartContractAccount.js\";\nimport type { UserOperationContext } from \"../actions/smartAccount/types.js\";\nimport { AccountNotFoundError } from \"../errors/account.js\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport { middlewareActions } from \"../middleware/actions.js\";\nimport type { ClientMiddleware } from \"../middleware/types.js\";\nimport type { Prettify } from \"../utils/index.js\";\nimport { createBundlerClient, type BundlerClient } from \"./bundlerClient.js\";\nimport {\n type BundlerActions,\n type BundlerRpcSchema,\n} from \"./decorators/bundlerClient.js\";\nimport {\n smartAccountClientActions,\n type BaseSmartAccountClientActions,\n} from \"./decorators/smartAccountClient.js\";\nimport { SmartAccountClientOptsSchema } from \"./schema.js\";\nimport type { ClientMiddlewareConfig } from \"./types.js\";\nimport { ADD_BREADCRUMB } from \"./addBreadcrumb.js\";\n\ntype SmartAccountClientOpts = z.output<typeof SmartAccountClientOptsSchema>;\n\nexport type SmartAccountClientConfig<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n Pick<\n ClientConfig<transport, chain, account>,\n | \"cacheTime\"\n | \"chain\"\n | \"key\"\n | \"name\"\n | \"pollingInterval\"\n | \"transport\"\n | \"type\"\n > & {\n account?: account;\n opts?: z.input<typeof SmartAccountClientOptsSchema>;\n /**\n * A function that adds a breadcrumb to the current context\n * Note, most implementations will override the client with the default alchemy transport and this\n * leads to the fact that a transport could be overwritten and not known until later.\n *\n * @param crumb A crumb, or span is telling that we are in a next step part of a multi step action\n * @returns\n */\n addBreadCrumb?: <T>(crumb: string) => T;\n } & ClientMiddlewareConfig<context>\n>;\n\nexport type SmartAccountClientRpcSchema = [\n ...BundlerRpcSchema,\n ...PublicRpcSchema,\n];\n\nexport type SmartAccountClientActions<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = BaseSmartAccountClientActions<chain, account, context> &\n BundlerActions &\n PublicActions;\n\nexport type SmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n rpcSchema extends RpcSchema = SmartAccountClientRpcSchema,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n rpcSchema,\n actions & SmartAccountClientActions<chain, account, context>\n >\n>;\n\nexport type BaseSmartAccountClient<\n transport extends Transport = Transport,\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n Client<\n transport,\n chain,\n account,\n [...BundlerRpcSchema, ...PublicRpcSchema],\n {\n middleware: ClientMiddleware<context>;\n } & SmartAccountClientOpts &\n BundlerActions &\n PublicActions\n >\n>;\n\nexport function createSmartAccountClient<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n config: SmartAccountClientConfig<TTransport, TChain, TAccount, TContext>,\n): SmartAccountClient<TTransport, TChain, TAccount>;\n\n/**\n * Creates a smart account client using the provided configuration. This client handles various Ethereum transactions and message signing operations.\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, toSmartContractAccount } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * // optionally hoist the account\n * account: toSmartContractAccount(...),\n * });\n * ```\n *\n * @param {SmartAccountClientConfig} config The configuration for creating the smart account client\n * @returns {SmartAccountClient} A smart account client capable of handling transactions, message signing, and other operations on a smart account\n */\nexport function createSmartAccountClient(\n config: SmartAccountClientConfig,\n): SmartAccountClient {\n const {\n key = \"account\",\n name = \"account provider\",\n transport,\n type = \"SmartAccountClient\",\n addBreadCrumb,\n ...params\n } = config;\n\n const client: SmartAccountClient = createBundlerClient({\n ...params,\n key,\n name,\n // we start out with this because the base methods for a SmartAccountClient\n // require a smart account client, but once we have completed building everything\n // we want to override this value with the one passed in by the extender\n type: \"SmartAccountClient\",\n // TODO: this needs to be tested\n transport: (opts) => {\n const rpcTransport = transport(opts);\n\n return custom(\n {\n name: \"SmartAccountClientTransport\",\n async request({ method, params }) {\n switch (method) {\n case \"eth_accounts\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n\n return [client.account.address];\n }\n case \"eth_sendTransaction\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n const [tx] = params as [FormattedTransactionRequest];\n return client.sendTransaction({\n ...tx,\n account: client.account,\n chain: client.chain,\n });\n case \"eth_sign\":\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, data] = params!;\n if (\n address?.toLowerCase() !==\n client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\",\n );\n }\n return client.signMessage({\n message: data,\n account: client.account,\n });\n case \"personal_sign\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [data, address] = params!;\n if (\n address?.toLowerCase() !==\n client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\",\n );\n }\n return client.signMessage({\n message: data,\n account: client.account,\n });\n }\n case \"eth_signTypedData_v4\": {\n if (!client.account) {\n throw new AccountNotFoundError();\n }\n const [address, dataParams] = params!;\n if (\n address?.toLowerCase() !==\n client.account.address.toLowerCase()\n ) {\n throw new Error(\n \"cannot sign for address that is not the current account\",\n );\n }\n try {\n return client.signTypedData({\n account: client.account,\n typedData:\n typeof dataParams === \"string\"\n ? JSON.parse(dataParams)\n : dataParams,\n });\n } catch {\n throw new Error(\"invalid JSON data params\");\n }\n }\n case \"eth_chainId\":\n if (!opts.chain) {\n throw new ChainNotFoundError();\n }\n\n return opts.chain.id;\n default:\n // TODO: there's probably a number of methods we just don't support, will need to test most of them out\n // first let's get something working though\n return rpcTransport.request(\n { method, params },\n // Retry count must be 0 here in order to respect the retry\n // count that is already specified on the underlying transport.\n { retryCount: 0 },\n );\n }\n },\n },\n // Retry count must be 0 here in order to respect the retry\n // count that is already specified on the underlying transport.\n { retryCount: 0 },\n )(opts);\n },\n })\n .extend(() => {\n const addBreadCrumbs = addBreadCrumb\n ? {\n [ADD_BREADCRUMB]: addBreadCrumb,\n }\n : {};\n return {\n ...SmartAccountClientOptsSchema.parse(config.opts ?? {}),\n ...addBreadCrumbs,\n };\n })\n .extend(middlewareActions(config))\n .extend(smartAccountClientActions);\n\n return { ...client, type };\n}\n\nexport function createSmartAccountClientFromExisting<\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TClient extends BundlerClient<TTransport> = BundlerClient<TTransport>,\n TActions extends SmartAccountClientActions<\n TChain,\n TAccount,\n TContext\n > = SmartAccountClientActions<TChain, TAccount>,\n TRpcSchema extends SmartAccountClientRpcSchema = SmartAccountClientRpcSchema,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n config: Omit<\n SmartAccountClientConfig<Transport, TChain, TAccount, TContext>,\n \"transport\" | \"chain\"\n > & { client: TClient },\n): SmartAccountClient<\n CustomTransport,\n TChain,\n TAccount,\n TActions,\n TRpcSchema,\n TContext\n>;\n\n/**\n * Creates a smart account client using an existing client and specific configuration. This function can be used to reuse a pre-existing BundlerClient while customizing other aspects of the smart account.\n *\n * @example\n * ```ts\n * import {\n * createBundlerClient,\n * createSmartAccountClientFromExisting,\n * toSmartContractAccount\n * } from \"@aa-sdk/core\";\n *\n * const bundlerClient = createBundlerClient(...);\n * const client = createSmartAccountClientFromExisting({\n * client,\n * account: toSmartContractAccount(...),\n * })\n * ```\n *\n * @param {Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {client: BundlerClient}} config the configuration object which includes the client\n * @returns {SmartAccountClient} A smart account client created from the existing BundlerClient\n */\nexport function createSmartAccountClientFromExisting(\n config: Omit<SmartAccountClientConfig, \"transport\" | \"chain\"> & {\n client: BundlerClient;\n },\n): SmartAccountClient {\n return createSmartAccountClient({\n ...config,\n chain: config.client.chain,\n transport: custom(config.client),\n });\n}\n","import {\n encodeAbiParameters,\n hexToBigInt,\n keccak256,\n type Address,\n type Chain,\n type Hash,\n type Hex,\n} from \"viem\";\nimport { EntryPointAbi_v6 } from \"../abis/EntryPointAbi_v6.js\";\nimport type { UserOperationRequest } from \"../types.js\";\nimport type { SupportedEntryPoint } from \"./types.js\";\n\nconst packUserOperation = (request: UserOperationRequest<\"0.6.0\">): Hex => {\n const hashedInitCode = keccak256(request.initCode);\n const hashedCallData = keccak256(request.callData);\n const hashedPaymasterAndData = keccak256(request.paymasterAndData);\n\n return encodeAbiParameters(\n [\n { type: \"address\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n { type: \"bytes32\" },\n ],\n [\n request.sender as Address,\n hexToBigInt(request.nonce),\n hashedInitCode,\n hashedCallData,\n hexToBigInt(request.callGasLimit),\n hexToBigInt(request.verificationGasLimit),\n hexToBigInt(request.preVerificationGas),\n hexToBigInt(request.maxFeePerGas),\n hexToBigInt(request.maxPriorityFeePerGas),\n hashedPaymasterAndData,\n ],\n );\n};\n\nexport default {\n version: \"0.6.0\",\n\n address: {\n default: \"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\",\n },\n\n abi: EntryPointAbi_v6,\n\n getUserOperationHash: (\n request: UserOperationRequest<\"0.6.0\">,\n entryPointAddress: Address,\n chainId: number,\n ): Hash => {\n const encoded = encodeAbiParameters(\n [{ type: \"bytes32\" }, { type: \"address\" }, { type: \"uint256\" }],\n [\n keccak256(packUserOperation(request)),\n entryPointAddress,\n BigInt(chainId),\n ],\n );\n\n return keccak256(encoded);\n },\n\n packUserOperation,\n} satisfies SupportedEntryPoint<\"0.6.0\", Chain, typeof EntryPointAbi_v6>;\n","import { type Chain } from \"viem\";\nimport { EntryPointNotFoundError } from \"../errors/entrypoint.js\";\nimport EntryPoint_v6 from \"./0.6.js\";\nimport EntryPoint_v7 from \"./0.7.js\";\nimport type {\n DefaultEntryPointVersion,\n EntryPointDefRegistry,\n EntryPointRegistry,\n EntryPointVersion,\n GetEntryPointOptions,\n} from \"./types.js\";\n\nexport const defaultEntryPointVersion: DefaultEntryPointVersion = \"0.6.0\";\n\nexport const entryPointRegistry: EntryPointRegistry = {\n \"0.6.0\": EntryPoint_v6,\n \"0.7.0\": EntryPoint_v7,\n};\n\n/**\n * Checks if the given value is a valid key of the EntryPointRegistry.\n *\n * @example\n * ```ts\n * import { isEntryPointVersion } from \"@aa-sdk/core\";\n *\n * const valid = isEntryPointVersion(\"0.6.0\");\n * const invalid = isEntryPointVersion(\"0.8.0\");\n * ```\n *\n * @param {*} value The value to be checked\n * @returns {boolean} true if the value is a valid key of EntryPointRegistry, false otherwise\n */\nexport const isEntryPointVersion = (\n value: any,\n): value is keyof EntryPointRegistry => {\n return Object.keys(entryPointRegistry).includes(value);\n};\n\nexport function getEntryPoint<\n TEntryPointVersion extends EntryPointVersion = DefaultEntryPointVersion,\n TChain extends Chain = Chain,\n>(\n chain: TChain,\n options: GetEntryPointOptions<TEntryPointVersion>,\n): EntryPointDefRegistry<TChain>[TEntryPointVersion];\n\nexport function getEntryPoint<\n TEntryPointVersion extends\n DefaultEntryPointVersion = DefaultEntryPointVersion,\n TChain extends Chain = Chain,\n>(\n chain: TChain,\n options?: GetEntryPointOptions<TEntryPointVersion>,\n): EntryPointDefRegistry<TChain>[TEntryPointVersion];\n\nexport function getEntryPoint<TChain extends Chain = Chain>(\n chain: TChain,\n options?: GetEntryPointOptions<DefaultEntryPointVersion>,\n): EntryPointDefRegistry<TChain>[DefaultEntryPointVersion];\n\n/**\n * Retrieves the entry point definition for the specified chain and version, falling back to the default version if not provided. Throws an error if the entry point address cannot be found.\n *\n * @example\n * ```ts\n * import { getEntryPoint } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const entryPoint060 = getEntryPoint(sepolia);\n * const entryPoint070 = getEntryPoint(sepolia, { version: \"0.7.0\" });\n * ```\n *\n * @param {Chain} chain The chain for which the entry point is being retrieved\n * @param {GetEntryPointOptions<TEntryPointVersion>} options Options containing the version and address overrides for the entry point\n * @returns {EntryPointDefRegistry<TChain>[EntryPointVersion]} The entry point definition for the specified chain and version\n */\nexport function getEntryPoint<\n TEntryPointVersion extends EntryPointVersion,\n TChain extends Chain = Chain,\n>(\n chain: TChain,\n options: GetEntryPointOptions<TEntryPointVersion>,\n): EntryPointDefRegistry<TChain>[EntryPointVersion] {\n const { version = defaultEntryPointVersion, addressOverride } = options ?? {\n version: defaultEntryPointVersion,\n };\n\n const entryPoint = entryPointRegistry[version ?? defaultEntryPointVersion];\n const address =\n addressOverride ??\n entryPoint.address[chain.id] ??\n entryPoint.address.default;\n if (!address) {\n throw new EntryPointNotFoundError(chain, version);\n }\n\n if (entryPoint.version === \"0.6.0\") {\n return {\n version: entryPoint.version,\n address,\n chain,\n abi: entryPoint.abi,\n getUserOperationHash: (r) =>\n entryPoint.getUserOperationHash(r, address, chain.id),\n packUserOperation: entryPoint.packUserOperation,\n };\n } else if (entryPoint.version === \"0.7.0\") {\n return {\n version: entryPoint.version,\n address,\n chain,\n abi: entryPoint.abi,\n getUserOperationHash: (r) =>\n entryPoint.getUserOperationHash(r, address, chain.id),\n packUserOperation: entryPoint.packUserOperation,\n };\n }\n\n throw new EntryPointNotFoundError(chain, version);\n}\n","import { BaseError } from \"./base.js\";\n\n/**\n * Represents an error thrown when an invalid signer type is provided to the SmartAccountSigner.\n */\nexport class InvalidSignerTypeError extends BaseError {\n override name = \"InvalidSignerTypeError\";\n\n /**\n * Constructs an error message when an invalid signer type is passed to SmartAccountSigner.\n *\n * @param {string} [signerType] An optional parameter specifying the signer type. If not provided, a default error message will be used.\n */\n constructor(signerType?: string) {\n super(\n [\n \"Invalid signer type parameter passed to SmartAccountSigner.\",\n signerType ?? \"A signerType must be provided.\",\n ].join(\"\\n\"),\n );\n }\n}\n","import {\n toHex,\n type Address,\n type Chain,\n type Client,\n type Hex,\n type Transport,\n} from \"viem\";\nimport type { ClientMiddlewareConfig } from \"../client/types\";\nimport type { EntryPointVersion } from \"../entrypoint/types\";\nimport { ChainNotFoundError } from \"../errors/client.js\";\nimport type {\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationRequest,\n UserOperationStruct,\n} from \"../types\";\nimport {\n deepHexlify,\n resolveProperties,\n type Deferrable,\n} from \"../utils/index.js\";\nimport type { ClientMiddlewareFn } from \"./types\";\n\nexport type Erc7677RpcSchema<\n TContext extends Record<string, any> = Record<string, any>,\n> = [\n {\n Method: \"pm_getPaymasterStubData\";\n Parameters: [UserOperationRequest, Address, Hex, TContext];\n ReturnType: {\n sponsor?: { name: string; icon?: string }; // Sponsor info\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterVerificationGasLimit?: Hex; // Paymaster validation gas (entrypoint v0.7)\n paymasterPostOpGasLimit?: Hex; // Paymaster post-op gas (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n isFinal?: boolean; // Indicates that the caller does not need to call pm_getPaymasterData\n };\n },\n {\n Method: \"pm_getPaymasterData\";\n Parameters: [UserOperationRequest, Address, Hex, TContext];\n ReturnType: {\n paymaster?: Address; // Paymaster address (entrypoint v0.7)\n paymasterData?: Hex; // Paymaster data (entrypoint v0.7)\n paymasterVerificationGasLimit?: Hex; // Paymaster validation gas (entrypoint v0.7)\n paymasterPostOpGasLimit?: Hex; // Paymaster post-op gas (entrypoint v0.7)\n paymasterAndData?: Hex; // Paymaster and data (entrypoint v0.6)\n };\n },\n];\n\nexport type Erc7677Client<\n T extends Transport = Transport,\n TContext extends Record<string, any> = Record<string, any>,\n> = Client<T, Chain, undefined, Erc7677RpcSchema<TContext>>;\n\nexport type Erc7677MiddlewareParams<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined,\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n> = {\n context?:\n | ((\n struct: Deferrable<UserOperationStruct<TEntryPointVersion>>,\n args: {\n overrides?: UserOperationOverrides<TEntryPointVersion>;\n feeOptions?: UserOperationFeeOptions;\n },\n ) => Promise<TContext>)\n | TContext;\n};\n\n/**\n * Middleware function for interacting with ERC-7677 enabled clients. It supports resolving paymaster and data fields for user operations.\n * This middleware assumes that your RPC provider supports the ERC-7677 methods (pm_getPaymasterStubData and pm_getPaymasterData).\n *\n * @example\n * ```ts\n * import { createSmartAccountClient, erc7677Middleware } from \"@aa-sdk/core\";\n * import { http } from \"viem\";\n * import { sepolia } from \"viem/chains\";\n *\n * const client = createSmartAccountClient({\n * transport: http(\"rpc-url\"),\n * chain: sepolia,\n * // this assumes that your RPC provider supports the ERC-7677 methods AND takes no context\n * ...erc7677Middleware(),\n * })\n * ```\n *\n * @param {Erc7677MiddlewareParams<TContext>} params Middleware parameters including context function or object. Context can be resolved dynamically by passing in a function which takes in the context at the time of sending a user op\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">} An object containing middleware functions `dummyPaymasterAndData` and `paymasterAndData` for processing user operations with the paymaster data\n */\nexport function erc7677Middleware<\n TContext extends Record<string, any> | undefined =\n | Record<string, any>\n | undefined,\n>(\n params?: Erc7677MiddlewareParams<TContext>,\n): Required<\n Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">\n> {\n const dummyPaymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides },\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n\n // Those values will be set after fee estimation.\n userOp.maxFeePerGas = \"0x0\";\n userOp.maxPriorityFeePerGas = \"0x0\";\n userOp.callGasLimit = \"0x0\";\n userOp.verificationGasLimit = \"0x0\";\n userOp.preVerificationGas = \"0x0\";\n\n const entrypoint = account.getEntryPoint();\n\n if (entrypoint.version === \"0.7.0\") {\n userOp.paymasterVerificationGasLimit = \"0x0\";\n userOp.paymasterPostOpGasLimit = \"0x0\";\n }\n\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n // TODO: probably need to handle the sponsor and isFinal fields\n const {\n paymaster,\n paymasterAndData,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n } = await erc7677client.request({\n method: \"pm_getPaymasterStubData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n // these values are currently not override-able, so can be set here directly\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit,\n };\n };\n\n const paymasterAndData: ClientMiddlewareFn = async (\n uo,\n { client, account, feeOptions, overrides },\n ) => {\n const userOp = deepHexlify(await resolveProperties(uo));\n const context =\n (typeof params?.context === \"function\"\n ? await params?.context(userOp, { overrides, feeOptions })\n : params?.context) ?? {};\n\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const erc7677client = client as Erc7677Client;\n\n const entrypoint = account.getEntryPoint();\n const {\n paymaster,\n paymasterAndData,\n paymasterData,\n paymasterPostOpGasLimit,\n paymasterVerificationGasLimit,\n } = await erc7677client.request({\n method: \"pm_getPaymasterData\",\n params: [userOp, entrypoint.address, toHex(client.chain.id), context],\n });\n\n if (entrypoint.version === \"0.6.0\") {\n return {\n ...uo,\n paymasterAndData,\n };\n }\n\n return {\n ...uo,\n paymaster,\n paymasterData,\n // if these fields are returned they should override the ones set by user operation gas estimation,\n // otherwise they shouldn't modify\n ...(paymasterVerificationGasLimit\n ? { paymasterVerificationGasLimit }\n : {}),\n ...(paymasterPostOpGasLimit ? { paymasterPostOpGasLimit } : {}),\n };\n };\n\n return {\n dummyPaymasterAndData,\n paymasterAndData,\n };\n}\n","import {\n getAddress,\n type Hex,\n type SignableMessage,\n type TypedData,\n type TypedDataDefinition,\n type WalletClient,\n type SignedAuthorization,\n} from \"viem\";\nimport type { Account } from \"viem/accounts\";\nimport type { SignTypedDataParameters } from \"viem/actions\";\nimport { InvalidSignerTypeError } from \"../errors/signer.js\";\nimport type { SmartAccountSigner, AuthorizationRequest } from \"./types\";\n\n/**\n * Represents a wallet client signer for smart accounts, providing methods to get the address, sign messages, sign typed data, and sign 7702 authorizations.\n */\nexport class WalletClientSigner implements SmartAccountSigner<WalletClient> {\n signerType: string;\n inner: WalletClient;\n\n /**\n * Initializes a signer with a given wallet client and signer type.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * ```\n *\n * @param {WalletClient} client The wallet client to interact with\n * @param {string} signerType The type of signer; must be a valid signer type, otherwise an error will be thrown\n * @throws {InvalidSignerTypeError} If the signer type is invalid\n */\n constructor(client: WalletClient, signerType: string) {\n this.inner = client;\n if (!signerType) {\n throw new InvalidSignerTypeError(signerType);\n }\n this.signerType = signerType;\n }\n\n /**\n * Asynchronously retrieves addresses from the inner object and returns the first address after applying the `getAddress` function.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.getAddress());\n * ```\n *\n * @returns {Promise<string>} A promise that resolves to the first address after being processed by the `getAddress` function.\n */\n getAddress: () => Promise<`0x${string}`> = async () => {\n let addresses = await this.inner.getAddresses();\n return getAddress(addresses[0]);\n };\n\n /**\n * Signs a message using the account's signing method.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.signMessage(\"hello\"));\n * ```\n *\n * @param {string} message the message string that needs to be signed\n * @returns {Promise<string>} a promise that resolves to the signed message\n */\n readonly signMessage: (message: SignableMessage) => Promise<`0x${string}`> =\n async (message) => {\n const account = this.inner.account ?? (await this.getAddress());\n\n return this.inner.signMessage({ message, account });\n };\n\n /**\n * Signs the provided typed data using the account's private key.\n *\n * @example\n * ```ts\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem'\n * import { mainnet } from 'viem/chains'\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n * console.log(await signer.signTypedData({\n * types: {\n * \"Message\": [{ name: \"content\", type: \"string\" }]\n * },\n * primaryType: \"Message\",\n * message: { content: \"Hello\" },\n * }));\n * ```\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} typedData The typed data to be signed\n * @returns {Promise<Hex>} A promise that resolves to a hex string representing the signed data\n */\n signTypedData = async <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" | string = string,\n >(\n typedData: TypedDataDefinition<TTypedData, TPrimaryType>,\n ): Promise<Hex> => {\n const account = this.inner.account ?? (await this.getAddress());\n\n const params = {\n account,\n ...typedData,\n } as SignTypedDataParameters<TTypedData, string, Account | undefined>;\n\n return this.inner.signTypedData<TTypedData, string>(params);\n };\n\n /**\n * Signs an EIP-7702 Authorization\n *\n * @example\n * ```ts twoslash\n * import { WalletClientSigner } from \"@aa-sdk/core\";\n * import { createWalletClient, custom } from 'viem';\n * import { mainnet } from 'viem/chains';\n *\n * const client = createWalletClient({\n * chain: mainnet,\n * transport: custom(window.ethereum!)\n * });\n *\n * const signer = new WalletClientSigner(client, 'wallet');\n *\n * const authorization = await signer.signAuthorization({\n * contractAddress: \"0x1234123412341234123412341234123412341234\",\n * chainId: 1,\n * nonce: 0,\n * });\n * ```\n *\n * @param {AuthorizationRequest<number>} unsignedAuthorization the authorization to be signed\n * @returns {Promise<SignedAuthorization<number>>} a promise that resolves to the signed authorization\n */\n signAuthorization = async (\n unsignedAuthorization: AuthorizationRequest<number>,\n ): Promise<SignedAuthorization<number>> => {\n const account = this.inner.account ?? (await this.getAddress());\n return this.inner.signAuthorization({ ...unsignedAuthorization, account });\n };\n}\n","import { custom, type CustomTransport, type Transport } from \"viem\";\n\nexport interface SplitTransportParams {\n overrides: {\n methods: string[];\n transport: Transport;\n }[];\n fallback: Transport;\n}\n\n/**\n * The Split Transport allows you to split RPC traffic for specific methods across\n * different RPC providers. This is done by specifying the methods you want handled\n * specially as overrides and providing a fallback transport for all other methods.\n *\n * @example\n * ```ts\n * import { createPublicClient, http } from \"viem\";\n * import { split } from \"@aa-sdk/core\";\n *\n * const bundlerMethods = [\n * \"eth_sendUserOperation\",\n * \"eth_estimateUserOperationGas\",\n * \"eth_getUserOperationReceipt\",\n * \"eth_getUserOperationByHash\",\n * \"eth_supportedEntryPoints\"\n * ];\n *\n * const clientWithSplit = createPublicClient({\n * transport: split({\n * overrides: [{\n * methods: bundlerMethods,\n * transport: http(BUNDLER_RPC_URL)\n * }],\n * fallback: http(OTHER_RPC_URL)\n * }),\n * });\n * ```\n *\n * @param {SplitTransportParams} params split transport configuration containing the methods overrides and fallback transport\n * @returns {CustomTransport} a viem Transport that splits traffic\n */\nexport const split = (params: SplitTransportParams): CustomTransport => {\n const overrideMap = params.overrides.reduce((accum, curr) => {\n curr.methods.forEach((method) => {\n if (accum.has(method) && accum.get(method) !== curr.transport) {\n throw new Error(\n \"A method cannot be handled by more than one transport\",\n );\n }\n\n accum.set(method, curr.transport);\n });\n\n return accum;\n }, new Map<string, Transport>());\n\n return (opts) =>\n custom({\n request: async (args) => {\n const transportOverride = overrideMap.get(args.method);\n if (transportOverride != null) {\n return transportOverride(opts).request(args);\n }\n\n return params.fallback(opts).request(args);\n },\n })(opts);\n};\n","function generateRandomHexString(numBytes: number) {\n const hexPairs = new Array(numBytes).fill(0).map(() =>\n Math.floor(Math.random() * 16)\n .toString(16)\n .padStart(2, \"0\"),\n );\n return hexPairs.join(\"\");\n}\n\n/**\n * These are the headers that are used in the trace headers, could be found in the spec\n *\n * @see https://www.w3.org/TR/trace-context/#design-overview\n */\n\nexport const TRACE_HEADER_NAME = \"traceparent\";\n/**\n * These are the headers that are used in the trace headers, could be found in the spec\n *\n * @see https://www.w3.org/TR/trace-context/#design-overview\n */\nexport const TRACE_HEADER_STATE = \"tracestate\";\n\nconst clientTraceId = generateRandomHexString(16);\n/**\n * Some tools that are useful when dealing with the values\n * of the trace header. Follows the W3C trace context standard.\n *\n * @see https://www.w3.org/TR/trace-context/\n */\nexport class TraceHeader {\n readonly traceId: string;\n readonly parentId: string;\n readonly traceFlags: string;\n readonly traceState: Record<string, string>;\n\n /**\n * Initializes a new instance with the provided trace identifiers and state information.\n *\n * @param {string} traceId The unique identifier for the trace\n * @param {string} parentId The identifier of the parent trace\n * @param {string} traceFlags Flags containing trace-related options\n * @param {TraceHeader[\"traceState\"]} traceState The trace state information for additional trace context\n */\n constructor(\n traceId: string,\n parentId: string,\n traceFlags: string,\n traceState: TraceHeader[\"traceState\"],\n ) {\n this.traceId = traceId;\n this.parentId = parentId;\n this.traceFlags = traceFlags;\n this.traceState = traceState;\n }\n\n /**\n * Creating a default trace id that is a random setup for both trace id and parent id\n *\n * @example\n * ```ts\n * const traceHeader = TraceHeader.fromTraceHeader(headers) || TraceHeader.default();\n * ```\n *\n * @returns {TraceHeader} A default trace header\n */\n static default() {\n return new TraceHeader(\n clientTraceId,\n generateRandomHexString(8),\n \"00\", //Means no flag have been set, and no sampled state https://www.w3.org/TR/trace-context/#trace-flags\n {},\n );\n }\n /**\n * Should be able to consume a trace header from the headers of an http request\n *\n * @example\n * ```ts\n * const traceHeader = TraceHeader.fromTraceHeader(headers);\n * ```\n *\n * @param {Record<string,string>} headers The headers from the http request\n * @returns {TraceHeader | undefined} The trace header object, or nothing if not found\n */\n static fromTraceHeader(\n headers: Record<string, string>,\n ): TraceHeader | undefined {\n if (!headers[TRACE_HEADER_NAME]) {\n return undefined;\n }\n const [version, traceId, parentId, traceFlags] =\n headers[TRACE_HEADER_NAME]?.split(\"-\");\n\n const traceState =\n headers[TRACE_HEADER_STATE]?.split(\",\").reduce(\n (acc, curr) => {\n const [key, value] = curr.split(\"=\");\n acc[key] = value;\n return acc;\n },\n {} as Record<string, string>,\n ) || {};\n if (version !== \"00\") {\n console.debug(\n new Error(\n `Invalid version for traceheader: ${headers[TRACE_HEADER_NAME]}`,\n ),\n );\n return undefined;\n }\n return new TraceHeader(traceId, parentId, traceFlags, traceState);\n }\n\n /**\n * Should be able to convert the trace header to the format that is used in the headers of an http request\n *\n * @example\n * ```ts\n * const traceHeader = TraceHeader.fromTraceHeader(headers) || TraceHeader.default();\n * const headers = traceHeader.toTraceHeader();\n * ```\n *\n * @returns {{traceparent: string, tracestate: string}} The trace header in the format of a record, used in our http client\n */\n toTraceHeader() {\n return {\n [TRACE_HEADER_NAME]: `00-${this.traceId}-${this.parentId}-${this.traceFlags}`,\n [TRACE_HEADER_STATE]: Object.entries(this.traceState)\n .map(([key, value]) => `${key}=${value}`)\n .join(\",\"),\n } as const;\n }\n\n /**\n * Should be able to create a new trace header with a new event in the trace state,\n * as the key of the eventName as breadcrumbs appending onto previous breadcrumbs with the - infix if exists. And the\n * trace parent gets updated as according to the docs\n *\n * @example\n * ```ts\n * const traceHeader = TraceHeader.fromTraceHeader(headers) || TraceHeader.default();\n * const newTraceHeader = traceHeader.withEvent(\"newEvent\");\n * ```\n *\n * @param {string} eventName The key of the new event\n * @returns {TraceHeader} The new trace header\n */\n withEvent(eventName: string): TraceHeader {\n const breadcrumbs = this.traceState.breadcrumbs\n ? `${this.traceState.breadcrumbs}-${eventName}`\n : eventName;\n return new TraceHeader(this.traceId, this.parentId, this.traceFlags, {\n ...this.traceState,\n breadcrumbs,\n });\n }\n}\n","export type { Abi } from \"abitype\";\nexport type { Address, HttpTransport } from \"viem\";\n\nexport { EntryPointAbi_v6 } from \"./abis/EntryPointAbi_v6.js\";\nexport { EntryPointAbi_v7 } from \"./abis/EntryPointAbi_v7.js\";\nexport { SimpleAccountAbi_v6 } from \"./abis/SimpleAccountAbi_v6.js\";\nexport { SimpleAccountAbi_v7 } from \"./abis/SimpleAccountAbi_v7.js\";\nexport { SimpleAccountFactoryAbi } from \"./abis/SimpleAccountFactoryAbi.js\";\nexport type * from \"./account/smartContractAccount.js\";\nexport {\n getAccountAddress,\n isSmartAccountWithSigner,\n parseFactoryAddressFromAccountInitCode,\n toSmartContractAccount,\n} from \"./account/smartContractAccount.js\";\nexport { buildUserOperation } from \"./actions/smartAccount/buildUserOperation.js\";\nexport { buildUserOperationFromTx } from \"./actions/smartAccount/buildUserOperationFromTx.js\";\nexport { buildUserOperationFromTxs } from \"./actions/smartAccount/buildUserOperationFromTxs.js\";\nexport { checkGasSponsorshipEligibility } from \"./actions/smartAccount/checkGasSponsorshipEligibility.js\";\nexport { dropAndReplaceUserOperation } from \"./actions/smartAccount/dropAndReplaceUserOperation.js\";\nexport { sendTransaction } from \"./actions/smartAccount/sendTransaction.js\";\nexport { sendTransactions } from \"./actions/smartAccount/sendTransactions.js\";\nexport { sendUserOperation } from \"./actions/smartAccount/sendUserOperation.js\";\nexport type * from \"./actions/smartAccount/types.js\";\nexport { waitForUserOperationTransaction } from \"./actions/smartAccount/waitForUserOperationTransacation.js\";\nexport type * from \"./client/bundlerClient.js\";\nexport {\n createBundlerClient,\n createBundlerClientFromExisting,\n} from \"./client/bundlerClient.js\";\nexport type * from \"./client/decorators/bundlerClient.js\";\nexport { bundlerActions } from \"./client/decorators/bundlerClient.js\";\nexport type * from \"./client/decorators/smartAccountClient.js\";\nexport { smartAccountClientActions } from \"./client/decorators/smartAccountClient.js\";\nexport { isSmartAccountClient } from \"./client/isSmartAccountClient.js\";\nexport {\n ConnectionConfigSchema,\n SmartAccountClientOptsSchema,\n} from \"./client/schema.js\";\nexport type * from \"./client/smartAccountClient.js\";\nexport {\n createSmartAccountClient,\n createSmartAccountClientFromExisting,\n} from \"./client/smartAccountClient.js\";\nexport type * from \"./client/types.js\";\nexport {\n convertChainIdToCoinType,\n convertCoinTypeToChain,\n convertCoinTypeToChainId,\n} from \"./ens/utils.js\";\nexport {\n defaultEntryPointVersion,\n entryPointRegistry,\n getEntryPoint,\n isEntryPointVersion,\n} from \"./entrypoint/index.js\";\nexport type * from \"./entrypoint/types.js\";\nexport {\n AccountNotFoundError,\n NotAModularAccountV2Error,\n AccountRequiresOwnerError,\n BatchExecutionNotSupportedError,\n DefaultFactoryNotDefinedError,\n FailedToGetStorageSlotError,\n GetCounterFactualAddressError,\n IncorrectAccountType,\n SignTransactionNotSupportedError,\n SmartAccountWithSignerRequiredError,\n UpgradeToAndCallNotSupportedError,\n UpgradesNotSupportedError,\n} from \"./errors/account.js\";\nexport { BaseError } from \"./errors/base.js\";\nexport {\n ChainNotFoundError,\n IncompatibleClientError,\n InvalidRpcUrlError,\n InvalidEntityIdError,\n InvalidNonceKeyError,\n EntityIdOverrideError,\n InvalidModularAccountV2Mode,\n InvalidDeferredActionNonce,\n} from \"./errors/client.js\";\nexport {\n EntryPointNotFoundError,\n InvalidEntryPointError,\n} from \"./errors/entrypoint.js\";\nexport { InvalidSignerTypeError } from \"./errors/signer.js\";\nexport {\n FailedToFindTransactionError,\n TransactionMissingToParamError,\n} from \"./errors/transaction.js\";\nexport {\n InvalidUserOperationError,\n WaitForUserOperationError,\n} from \"./errors/useroperation.js\";\nexport * from \"./client/addBreadcrumb.js\";\nexport { LogLevel, Logger } from \"./logger.js\";\nexport type * from \"./middleware/types.js\";\nexport { middlewareActions } from \"./middleware/actions.js\";\nexport { default7702UserOpSigner } from \"./middleware/defaults/7702signer.js\";\nexport { default7702GasEstimator } from \"./middleware/defaults/7702gasEstimator.js\";\nexport { webauthnGasEstimator } from \"./middleware/defaults/webauthnGasEstimator.js\";\nexport { defaultFeeEstimator } from \"./middleware/defaults/feeEstimator.js\";\nexport { defaultGasEstimator } from \"./middleware/defaults/gasEstimator.js\";\nexport { defaultPaymasterAndData } from \"./middleware/defaults/paymasterAndData.js\";\nexport { defaultUserOpSigner } from \"./middleware/defaults/userOpSigner.js\";\nexport type * from \"./middleware/erc7677middleware.js\";\nexport { erc7677Middleware } from \"./middleware/erc7677middleware.js\";\nexport { noopMiddleware } from \"./middleware/noopMiddleware.js\";\nexport type * from \"./middleware/actions.js\";\nexport { LocalAccountSigner } from \"./signer/local-account.js\";\nexport { SignerSchema, isSigner } from \"./signer/schema.js\";\nexport type {\n SmartAccountAuthenticator,\n SmartAccountSigner,\n AuthorizationRequest,\n} from \"./signer/types.js\";\nexport { wrapSignatureWith6492 } from \"./signer/utils.js\";\nexport { WalletClientSigner } from \"./signer/wallet-client.js\";\nexport { split, type SplitTransportParams } from \"./transport/split.js\";\nexport type * from \"./types.js\";\nexport type * from \"./utils/index.js\";\nexport {\n TraceHeader,\n TRACE_HEADER_NAME,\n TRACE_HEADER_STATE,\n} from \"./utils/traceHeader.js\";\nexport {\n BigNumberishRangeSchema,\n BigNumberishSchema,\n ChainSchema,\n HexSchema,\n MultiplierSchema,\n allEqual,\n applyUserOpFeeOption,\n applyUserOpOverride,\n applyUserOpOverrideOrFeeOption,\n asyncPipe,\n bigIntMax,\n bigIntMultiply,\n bypassPaymasterAndData,\n bypassPaymasterAndDataEmptyHex,\n concatPaymasterAndData,\n deepHexlify,\n filterUndefined,\n getDefaultUserOperationFeeOptions,\n isBigNumberish,\n isMultiplier,\n isValidRequest,\n parsePaymasterAndData,\n pick,\n resolveProperties,\n takeBytes,\n unpackSignRawMessageBytes,\n toRecord,\n} from \"./utils/index.js\";\nexport { getUserOperationError } from \"./actions/smartAccount/getUserOperationError.js\";\n","export const LightAccountAbi_v1 = [\n {\n inputs: [\n {\n internalType: \"contract IEntryPoint\",\n name: \"anEntryPoint\",\n type: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"constructor\",\n },\n { inputs: [], name: \"ArrayLengthMismatch\", type: \"error\" },\n { inputs: [], name: \"InvalidInitialization\", type: \"error\" },\n {\n inputs: [{ internalType: \"address\", name: \"owner\", type: \"address\" }],\n name: \"InvalidOwner\",\n type: \"error\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"caller\", type: \"address\" }],\n name: \"NotAuthorized\",\n type: \"error\",\n },\n { inputs: [], name: \"NotInitializing\", type: \"error\" },\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n internalType: \"address\",\n name: \"previousAdmin\",\n type: \"address\",\n },\n {\n indexed: false,\n internalType: \"address\",\n name: \"newAdmin\",\n type: \"address\",\n },\n ],\n name: \"AdminChanged\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"beacon\",\n type: \"address\",\n },\n ],\n name: \"BeaconUpgraded\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: false,\n internalType: \"uint64\",\n name: \"version\",\n type: \"uint64\",\n },\n ],\n name: \"Initialized\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"contract IEntryPoint\",\n name: \"entryPoint\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"owner\",\n type: \"address\",\n },\n ],\n name: \"LightAccountInitialized\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"previousOwner\",\n type: \"address\",\n },\n {\n indexed: true,\n internalType: \"address\",\n name: \"newOwner\",\n type: \"address\",\n },\n ],\n name: \"OwnershipTransferred\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n internalType: \"address\",\n name: \"implementation\",\n type: \"address\",\n },\n ],\n name: \"Upgraded\",\n type: \"event\",\n },\n {\n inputs: [],\n name: \"addDeposit\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"domainSeparator\",\n outputs: [{ internalType: \"bytes32\", name: \"\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"bytes\", name: \"message\", type: \"bytes\" }],\n name: \"encodeMessageData\",\n outputs: [{ internalType: \"bytes\", name: \"\", type: \"bytes\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"entryPoint\",\n outputs: [\n { internalType: \"contract IEntryPoint\", name: \"\", type: \"address\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"dest\", type: \"address\" },\n { internalType: \"uint256\", name: \"value\", type: \"uint256\" },\n { internalType: \"bytes\", name: \"func\", type: \"bytes\" },\n ],\n name: \"execute\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address[]\", name: \"dest\", type: \"address[]\" },\n { internalType: \"bytes[]\", name: \"func\", type: \"bytes[]\" },\n ],\n name: \"executeBatch\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address[]\", name: \"dest\", type: \"address[]\" },\n { internalType: \"uint256[]\", name: \"value\", type: \"uint256[]\" },\n { internalType: \"bytes[]\", name: \"func\", type: \"bytes[]\" },\n ],\n name: \"executeBatch\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getDeposit\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"bytes\", name: \"message\", type: \"bytes\" }],\n name: \"getMessageHash\",\n outputs: [{ internalType: \"bytes32\", name: \"\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"getNonce\",\n outputs: [{ internalType: \"uint256\", name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"anOwner\", type: \"address\" }],\n name: \"initialize\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"bytes32\", name: \"digest\", type: \"bytes32\" },\n { internalType: \"bytes\", name: \"signature\", type: \"bytes\" },\n ],\n name: \"isValidSignature\",\n outputs: [{ internalType: \"bytes4\", name: \"\", type: \"bytes4\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"\", type: \"address\" },\n { internalType: \"address\", name: \"\", type: \"address\" },\n { internalType: \"uint256[]\", name: \"\", type: \"uint256[]\" },\n { internalType: \"uint256[]\", name: \"\", type: \"uint256[]\" },\n { internalType: \"bytes\", name: \"\", type: \"bytes\" },\n ],\n name: \"onERC1155BatchReceived\",\n outputs: [{ internalType: \"bytes4\", name: \"\", type: \"bytes4\" }],\n stateMutability: \"pure\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"\", type: \"address\" },\n { internalType: \"address\", name: \"\", type: \"address\" },\n { internalType: \"uint256\", name: \"\", type: \"uint256\" },\n { internalType: \"uint256\", name: \"\", type: \"uint256\" },\n { internalType: \"bytes\", name: \"\", type: \"bytes\" },\n ],\n name: \"onERC1155Received\",\n outputs: [{ internalType: \"bytes4\", name: \"\", type: \"bytes4\" }],\n stateMutability: \"pure\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"\", type: \"address\" },\n { internalType: \"address\", name: \"\", type: \"address\" },\n { internalType: \"uint256\", name: \"\", type: \"uint256\" },\n { internalType: \"bytes\", name: \"\", type: \"bytes\" },\n ],\n name: \"onERC721Received\",\n outputs: [{ internalType: \"bytes4\", name: \"\", type: \"bytes4\" }],\n stateMutability: \"pure\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"owner\",\n outputs: [{ internalType: \"address\", name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"proxiableUUID\",\n outputs: [{ internalType: \"bytes32\", name: \"\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"bytes4\", name: \"interfaceId\", type: \"bytes4\" }],\n name: \"supportsInterface\",\n outputs: [{ internalType: \"bool\", name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"\", type: \"address\" },\n { internalType: \"address\", name: \"\", type: \"address\" },\n { internalType: \"address\", name: \"\", type: \"address\" },\n { internalType: \"uint256\", name: \"\", type: \"uint256\" },\n { internalType: \"bytes\", name: \"\", type: \"bytes\" },\n { internalType: \"bytes\", name: \"\", type: \"bytes\" },\n ],\n name: \"tokensReceived\",\n outputs: [],\n stateMutability: \"pure\",\n type: \"function\",\n },\n {\n inputs: [{ internalType: \"address\", name: \"newOwner\", type: \"address\" }],\n name: \"transferOwnership\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"newImplementation\", type: \"address\" },\n ],\n name: \"upgradeTo\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"newImplementation\", type: \"address\" },\n { internalType: \"bytes\", name: \"data\", type: \"bytes\" },\n ],\n name: \"upgradeToAndCall\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n { internalType: \"address\", name: \"sender\", type: \"address\" },\n { internalType: \"uint256\", name: \"nonce\", type: \"uint256\" },\n { internalType: \"bytes\", name: \"initCode\", type: \"bytes\" },\n { internalType: \"bytes\", name: \"callData\", type: \"bytes\" },\n { internalType: \"uint256\", name: \"callGasLimit\", type: \"uint256\" },\n {\n internalType: \"uint256\",\n name: \"verificationGasLimit\",\n type: \"uint256\",\n },\n {\n internalType: \"uint256\",\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n { internalType: \"uint256\", name: \"maxFeePerGas\", type: \"uint256\" },\n {\n internalType: \"uint256\",\n name: \"maxPriorityFeePerGas\",\n type: \"uint256\",\n },\n { internalType: \"bytes\", name: \"paymasterAndData\", type: \"bytes\" },\n { internalType: \"bytes\", name: \"signature\", type: \"bytes\" },\n ],\n internalType: \"struct UserOperation\",\n name: \"userOp\",\n type: \"tuple\",\n },\n { internalType: \"bytes32\", name: \"userOpHash\", type: \"bytes32\" },\n { internalType: \"uint256\", name: \"missingAccountFunds\", type: \"uint256\" },\n ],\n name: \"validateUserOp\",\n outputs: [\n { internalType: \"uint256\", name: \"validationData\", type: \"uint256\" },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address payable\",\n name: \"withdrawAddress\",\n type: \"address\",\n },\n { internalType: \"uint256\", name: \"amount\", type: \"uint256\" },\n ],\n name: \"withdrawDepositTo\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n { stateMutability: \"payable\", type: \"receive\" },\n] as const;\n","export const LightAccountAbi_v2 = [\n {\n type: \"constructor\",\n inputs: [\n {\n name: \"entryPoint_\",\n type: \"address\",\n internalType: \"contract IEntryPoint\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n { type: \"receive\", stateMutability: \"payable\" },\n {\n type: \"function\",\n name: \"addDeposit\",\n inputs: [],\n outputs: [],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"eip712Domain\",\n inputs: [],\n outputs: [\n { name: \"fields\", type: \"bytes1\", internalType: \"bytes1\" },\n { name: \"name\", type: \"string\", internalType: \"string\" },\n { name: \"version\", type: \"string\", internalType: \"string\" },\n { name: \"chainId\", type: \"uint256\", internalType: \"uint256\" },\n {\n name: \"verifyingContract\",\n type: \"address\",\n internalType: \"address\",\n },\n { name: \"salt\", type: \"bytes32\", internalType: \"bytes32\" },\n {\n name: \"extensions\",\n type: \"uint256[]\",\n internalType: \"uint256[]\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"entryPoint\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"contract IEntryPoint\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"execute\",\n inputs: [\n { name: \"dest\", type: \"address\", internalType: \"address\" },\n { name: \"value\", type: \"uint256\", internalType: \"uint256\" },\n { name: \"func\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"executeBatch\",\n inputs: [\n { name: \"dest\", type: \"address[]\", internalType: \"address[]\" },\n { name: \"func\", type: \"bytes[]\", internalType: \"bytes[]\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"executeBatch\",\n inputs: [\n { name: \"dest\", type: \"address[]\", internalType: \"address[]\" },\n { name: \"value\", type: \"uint256[]\", internalType: \"uint256[]\" },\n { name: \"func\", type: \"bytes[]\", internalType: \"bytes[]\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"getDeposit\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"getNonce\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"initialize\",\n inputs: [{ name: \"owner_\", type: \"address\", internalType: \"address\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"isValidSignature\",\n inputs: [\n { name: \"hash\", type: \"bytes32\", internalType: \"bytes32\" },\n { name: \"signature\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"result\", type: \"bytes4\", internalType: \"bytes4\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"onERC1155BatchReceived\",\n inputs: [\n { name: \"\", type: \"address\", internalType: \"address\" },\n { name: \"\", type: \"address\", internalType: \"address\" },\n { name: \"\", type: \"uint256[]\", internalType: \"uint256[]\" },\n { name: \"\", type: \"uint256[]\", internalType: \"uint256[]\" },\n { name: \"\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"\", type: \"bytes4\", internalType: \"bytes4\" }],\n stateMutability: \"pure\",\n },\n {\n type: \"function\",\n name: \"onERC1155Received\",\n inputs: [\n { name: \"\", type: \"address\", internalType: \"address\" },\n { name: \"\", type: \"address\", internalType: \"address\" },\n { name: \"\", type: \"uint256\", internalType: \"uint256\" },\n { name: \"\", type: \"uint256\", internalType: \"uint256\" },\n { name: \"\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"\", type: \"bytes4\", internalType: \"bytes4\" }],\n stateMutability: \"pure\",\n },\n {\n type: \"function\",\n name: \"onERC721Received\",\n inputs: [\n { name: \"\", type: \"address\", internalType: \"address\" },\n { name: \"\", type: \"address\", internalType: \"address\" },\n { name: \"\", type: \"uint256\", internalType: \"uint256\" },\n { name: \"\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"\", type: \"bytes4\", internalType: \"bytes4\" }],\n stateMutability: \"pure\",\n },\n {\n type: \"function\",\n name: \"owner\",\n inputs: [],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"proxiableUUID\",\n inputs: [],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"bytes32\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"supportsInterface\",\n inputs: [{ name: \"interfaceId\", type: \"bytes4\", internalType: \"bytes4\" }],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"transferOwnership\",\n inputs: [{ name: \"newOwner\", type: \"address\", internalType: \"address\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"upgradeToAndCall\",\n inputs: [\n {\n name: \"newImplementation\",\n type: \"address\",\n internalType: \"address\",\n },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"validateUserOp\",\n inputs: [\n {\n name: \"userOp\",\n type: \"tuple\",\n internalType: \"struct PackedUserOperation\",\n components: [\n { name: \"sender\", type: \"address\", internalType: \"address\" },\n { name: \"nonce\", type: \"uint256\", internalType: \"uint256\" },\n { name: \"initCode\", type: \"bytes\", internalType: \"bytes\" },\n { name: \"callData\", type: \"bytes\", internalType: \"bytes\" },\n {\n name: \"accountGasLimits\",\n type: \"bytes32\",\n internalType: \"bytes32\",\n },\n {\n name: \"preVerificationGas\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n { name: \"gasFees\", type: \"bytes32\", internalType: \"bytes32\" },\n {\n name: \"paymasterAndData\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n { name: \"signature\", type: \"bytes\", internalType: \"bytes\" },\n ],\n },\n { name: \"userOpHash\", type: \"bytes32\", internalType: \"bytes32\" },\n {\n name: \"missingAccountFunds\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n outputs: [\n {\n name: \"validationData\",\n type: \"uint256\",\n internalType: \"uint256\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"withdrawDepositTo\",\n inputs: [\n {\n name: \"withdrawAddress\",\n type: \"address\",\n internalType: \"address payable\",\n },\n { name: \"amount\", type: \"uint256\", internalType: \"uint256\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"event\",\n name: \"Initialized\",\n inputs: [\n {\n name: \"version\",\n type: \"uint64\",\n indexed: false,\n internalType: \"uint64\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"LightAccountInitialized\",\n inputs: [\n {\n name: \"entryPoint\",\n type: \"address\",\n indexed: true,\n internalType: \"contract IEntryPoint\",\n },\n {\n name: \"owner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferred\",\n inputs: [\n {\n name: \"previousOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"newOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Upgraded\",\n inputs: [\n {\n name: \"implementation\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n { type: \"error\", name: \"ArrayLengthMismatch\", inputs: [] },\n { type: \"error\", name: \"ECDSAInvalidSignature\", inputs: [] },\n {\n type: \"error\",\n name: \"ECDSAInvalidSignatureLength\",\n inputs: [{ name: \"length\", type: \"uint256\", internalType: \"uint256\" }],\n },\n {\n type: \"error\",\n name: \"ECDSAInvalidSignatureS\",\n inputs: [{ name: \"s\", type: \"bytes32\", internalType: \"bytes32\" }],\n },\n { type: \"error\", name: \"InvalidInitialization\", inputs: [] },\n {\n type: \"error\",\n name: \"InvalidOwner\",\n inputs: [{ name: \"owner\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"InvalidSignatureType\", inputs: [] },\n {\n type: \"error\",\n name: \"NotAuthorized\",\n inputs: [{ name: \"caller\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"NotInitializing\", inputs: [] },\n { type: \"error\", name: \"UnauthorizedCallContext\", inputs: [] },\n { type: \"error\", name: \"UpgradeFailed\", inputs: [] },\n { type: \"error\", name: \"ZeroAddressNotAllowed\", inputs: [] },\n] as const;\n","export const LightAccountFactoryAbi_v1 = [\n {\n inputs: [\n {\n internalType: \"contract IEntryPoint\",\n name: \"_entryPoint\",\n type: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"constructor\",\n },\n {\n inputs: [],\n name: \"accountImplementation\",\n outputs: [\n {\n internalType: \"contract LightAccount\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"owner\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"salt\",\n type: \"uint256\",\n },\n ],\n name: \"createAccount\",\n outputs: [\n {\n internalType: \"contract LightAccount\",\n name: \"ret\",\n type: \"address\",\n },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n internalType: \"address\",\n name: \"owner\",\n type: \"address\",\n },\n {\n internalType: \"uint256\",\n name: \"salt\",\n type: \"uint256\",\n },\n ],\n name: \"getAddress\",\n outputs: [\n {\n internalType: \"address\",\n name: \"\",\n type: \"address\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n] as const;\n","export const LightAccountFactoryAbi_v2 = [\n {\n type: \"constructor\",\n inputs: [\n { name: \"owner\", type: \"address\", internalType: \"address\" },\n {\n name: \"entryPoint\",\n type: \"address\",\n internalType: \"contract IEntryPoint\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n { type: \"receive\", stateMutability: \"payable\" },\n {\n type: \"function\",\n name: \"ACCOUNT_IMPLEMENTATION\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"contract LightAccount\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"ENTRY_POINT\",\n inputs: [],\n outputs: [\n {\n name: \"\",\n type: \"address\",\n internalType: \"contract IEntryPoint\",\n },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"acceptOwnership\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"addStake\",\n inputs: [\n { name: \"unstakeDelay\", type: \"uint32\", internalType: \"uint32\" },\n { name: \"amount\", type: \"uint256\", internalType: \"uint256\" },\n ],\n outputs: [],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"createAccount\",\n inputs: [\n { name: \"owner\", type: \"address\", internalType: \"address\" },\n { name: \"salt\", type: \"uint256\", internalType: \"uint256\" },\n ],\n outputs: [\n {\n name: \"account\",\n type: \"address\",\n internalType: \"contract LightAccount\",\n },\n ],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"getAddress\",\n inputs: [\n { name: \"owner\", type: \"address\", internalType: \"address\" },\n { name: \"salt\", type: \"uint256\", internalType: \"uint256\" },\n ],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"owner\",\n inputs: [],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"pendingOwner\",\n inputs: [],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"renounceOwnership\",\n inputs: [],\n outputs: [],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"transferOwnership\",\n inputs: [{ name: \"newOwner\", type: \"address\", internalType: \"address\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unlockStake\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"withdraw\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address payable\" },\n { name: \"token\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"uint256\", internalType: \"uint256\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"withdrawStake\",\n inputs: [{ name: \"to\", type: \"address\", internalType: \"address payable\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"event\",\n name: \"OwnershipTransferStarted\",\n inputs: [\n {\n name: \"previousOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"newOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferred\",\n inputs: [\n {\n name: \"previousOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n {\n name: \"newOwner\",\n type: \"address\",\n indexed: true,\n internalType: \"address\",\n },\n ],\n anonymous: false,\n },\n {\n type: \"error\",\n name: \"AddressEmptyCode\",\n inputs: [{ name: \"target\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"AddressInsufficientBalance\",\n inputs: [{ name: \"account\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"FailedInnerCall\", inputs: [] },\n { type: \"error\", name: \"InvalidAction\", inputs: [] },\n {\n type: \"error\",\n name: \"InvalidEntryPoint\",\n inputs: [{ name: \"entryPoint\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"OwnableInvalidOwner\",\n inputs: [{ name: \"owner\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"OwnableUnauthorizedAccount\",\n inputs: [{ name: \"account\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"SafeERC20FailedOperation\",\n inputs: [{ name: \"token\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"TransferFailed\", inputs: [] },\n { type: \"error\", name: \"ZeroAddressNotAllowed\", inputs: [] },\n] as const;\n","import type { GetEntryPointFromAccount } from \"@aa-sdk/core\";\nimport { fromHex, type Address, type Chain } from \"viem\";\nimport type { LightAccountBase } from \"./accounts/base\";\nimport type {\n LightAccountType,\n LightAccountVersion,\n LightAccountVersionConfig,\n LightAccountVersionConfigs,\n} from \"./types\";\n\n/**\n * Account version registry interface that defines the light account versions\n * and the version definition for each light account type\n *\n */\nexport const AccountVersionRegistry: LightAccountVersionConfigs = {\n LightAccount: {\n \"v1.0.1\": {\n entryPointVersion: \"0.6.0\",\n addresses: {\n default: {\n factory:\n \"0x000000893A26168158fbeaDD9335Be5bC96592E2\".toLowerCase() as Address,\n impl: \"0xc1b2fc4197c9187853243e6e4eb5a4af8879a1c0\".toLowerCase() as Address,\n },\n },\n },\n \"v1.0.2\": {\n entryPointVersion: \"0.6.0\",\n addresses: {\n default: {\n factory:\n \"0x00000055C0b4fA41dde26A74435ff03692292FBD\".toLowerCase() as Address,\n impl: \"0x5467b1947F47d0646704EB801E075e72aeAe8113\".toLowerCase() as Address,\n },\n },\n },\n \"v1.1.0\": {\n entryPointVersion: \"0.6.0\",\n addresses: {\n default: {\n factory:\n \"0x00004EC70002a32400f8ae005A26081065620D20\".toLowerCase() as Address,\n impl: \"0xae8c656ad28F2B59a196AB61815C16A0AE1c3cba\".toLowerCase() as Address,\n },\n },\n },\n \"v2.0.0\": {\n entryPointVersion: \"0.7.0\",\n addresses: {\n default: {\n factory:\n \"0x0000000000400CdFef5E2714E63d8040b700BC24\".toLowerCase() as Address,\n impl: \"0x8E8e658E22B12ada97B402fF0b044D6A325013C7\".toLowerCase() as Address,\n },\n },\n },\n },\n MultiOwnerLightAccount: {\n \"v2.0.0\": {\n entryPointVersion: \"0.7.0\",\n addresses: {\n default: {\n factory:\n \"0x000000000019d2Ee9F2729A65AfE20bb0020AefC\".toLowerCase() as Address,\n impl: \"0xd2c27F9eE8E4355f71915ffD5568cB3433b6823D\".toLowerCase() as Address,\n },\n },\n },\n },\n};\n\n/**\n * Get the default light account version for the given light account type\n *\n * @template {LightAccountType} TLightAccountType\n * @returns {LightAccountVersion<TLightAccountType>} the default version for the given light account type\n */\nexport const defaultLightAccountVersion = <\n TLightAccountType extends LightAccountType,\n>(): LightAccountVersion<TLightAccountType> => \"v2.0.0\";\n\n/**\n * Utility method returning the default light account factory address given a Chain object\n *\n * @param {Chain} chain - a Chain object\n * @param {LightAccountVersion} version - the version of the light account to get the factory address for\n * @returns {Address} an for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultLightAccountFactoryAddress = (\n chain: Chain,\n version: LightAccountVersion<\"LightAccount\">,\n): Address => {\n return (\n AccountVersionRegistry.LightAccount[version].addresses.overrides?.[chain.id]\n ?.factory ??\n AccountVersionRegistry.LightAccount[version].addresses.default.factory\n );\n};\n\n/**\n * Utility method returning the default multi owner light account factory address given a Chain object\n *\n * @param {Chain} chain - a Chain object\n * @param {string} version - the version of the light account to get the factory address for\n * @returns {Address} an Address for the given chain\n */\nexport const getDefaultMultiOwnerLightAccountFactoryAddress = (\n chain: Chain,\n version: LightAccountVersion<\"MultiOwnerLightAccount\">,\n) => {\n return (\n AccountVersionRegistry.MultiOwnerLightAccount[version].addresses\n .overrides?.[chain.id]?.factory ??\n AccountVersionRegistry.MultiOwnerLightAccount[version].addresses.default\n .factory\n );\n};\n\n/**\n * Can be used to check if the account with one of the following implementation addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Impls = [\n AccountVersionRegistry.LightAccount[\"v1.0.1\"],\n AccountVersionRegistry.LightAccount[\"v1.0.2\"],\n];\n\n/**\n * Can be used to check if the account with one of the following factory addresses\n * to not support 1271 signing.\n *\n * Light accounts with versions v1.0.1 and v1.0.2 do not support 1271 signing.\n */\nexport const LightAccountUnsupported1271Factories = new Set(\n LightAccountUnsupported1271Impls.map((x) => [\n x.addresses.default.factory,\n ...Object.values(x.addresses.overrides ?? {}).map((z) => z.factory),\n ]).flat(),\n);\n\n/**\n * Get the light account version definition for the given light account and chain\n *\n * @template {LightAccountBase} TAccount\n * @param {LightAccountBase} account the light account to get the version for\n * @param {Chain} chain - the chain to get the version for\n * @returns {Promise<LightAccountVersionConfig>} the light account version definition for the given light account and chain\n */\nexport async function getLightAccountVersionForAccount<\n TAccount extends LightAccountBase,\n>(account: TAccount, chain: Chain): Promise<LightAccountVersionConfig> {\n const accountType = account.source as LightAccountType;\n const factoryAddress = await account.getFactoryAddress();\n const implAddress = await account.getImplementationAddress();\n const implToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType]).map((pair) => {\n const [version, def] = pair as [\n LightAccountVersion<LightAccountType>,\n LightAccountVersionConfig<GetEntryPointFromAccount<TAccount>>,\n ];\n\n if (\n def.addresses.overrides != null &&\n chain.id in def.addresses.overrides!\n ) {\n return [def.addresses.overrides[chain.id].impl, version];\n }\n\n return [def.addresses.default.impl, version];\n }),\n );\n\n const factoryToVersion = new Map(\n Object.entries(AccountVersionRegistry[accountType]).map((pair) => {\n const [version, def] = pair as [\n LightAccountVersion<LightAccountType>,\n LightAccountVersionConfig<GetEntryPointFromAccount<TAccount>>,\n ];\n\n if (\n def.addresses.overrides != null &&\n chain.id in def.addresses.overrides!\n ) {\n return [def.addresses.overrides[chain.id].factory, version];\n }\n\n return [def.addresses.default.factory, version];\n }),\n );\n\n const version =\n fromHex(implAddress, \"bigint\") === 0n\n ? factoryToVersion.get(factoryAddress.toLowerCase() as Address)\n : implToVersion.get(implAddress.toLowerCase() as Address);\n\n if (!version) {\n throw new Error(\n `Could not determine ${account.source} version for chain ${chain.id}`,\n );\n }\n\n return AccountVersionRegistry[accountType][version];\n}\n","import {\n FailedToGetStorageSlotError,\n createBundlerClient,\n toSmartContractAccount,\n type Abi,\n type EntryPointDef,\n type SmartAccountSigner,\n type SmartContractAccountWithSigner,\n type ToSmartContractAccountParams,\n type UpgradeToAndCallParams,\n} from \"@aa-sdk/core\";\nimport {\n concat,\n encodeFunctionData,\n fromHex,\n hashMessage,\n hashTypedData,\n trim,\n type Address,\n type Chain,\n type Hex,\n type Transport,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport type {\n LightAccountEntryPointVersion,\n LightAccountType,\n LightAccountVersion,\n} from \"../types.js\";\nimport { AccountVersionRegistry } from \"../utils.js\";\nimport type { SignatureRequest } from \"@aa-sdk/core\";\n\nenum SignatureType {\n EOA = \"0x00\",\n CONTRACT = \"0x01\",\n CONTRACT_WITH_ADDR = \"0x02\",\n}\n\nexport type LightAccountBase<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountType extends LightAccountType = LightAccountType,\n TLightAccountVersion extends\n LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,\n> = SmartContractAccountWithSigner<\n TLightAccountType,\n TSigner,\n LightAccountEntryPointVersion<TLightAccountType, TLightAccountVersion>\n> & {\n getLightAccountVersion: () => TLightAccountVersion;\n};\n\n//#region CreateLightAccountBaseParams\nexport type CreateLightAccountBaseParams<\n TLightAccountType extends LightAccountType,\n TLightAccountVersion extends\n LightAccountVersion<TLightAccountType> = LightAccountVersion<TLightAccountType>,\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n> = Pick<\n ToSmartContractAccountParams<TLightAccountType, TTransport, Chain>,\n \"transport\" | \"chain\" | \"getAccountInitCode\"\n> & {\n abi: Abi;\n signer: TSigner;\n accountAddress: Address;\n type: TLightAccountType;\n version: TLightAccountVersion;\n entryPoint: EntryPointDef<\n LightAccountEntryPointVersion<TLightAccountType, TLightAccountVersion>,\n Chain\n >;\n};\n//#endregion CreateLightAccountBaseParams\n\nexport async function createLightAccountBase<\n TLightAccountType extends LightAccountType,\n TLightAccountVersion extends LightAccountVersion<TLightAccountType>,\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n>({\n transport,\n chain,\n signer,\n abi,\n version,\n type,\n entryPoint,\n accountAddress,\n getAccountInitCode,\n}: CreateLightAccountBaseParams<\n TLightAccountType,\n TLightAccountVersion,\n TTransport,\n TSigner\n>): Promise<\n LightAccountBase<TSigner, TLightAccountType, TLightAccountVersion>\n> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const encodeUpgradeToAndCall = async ({\n upgradeToAddress,\n upgradeToInitData,\n }: UpgradeToAndCallParams): Promise<Hex> => {\n const storage = await client.getStorageAt({\n address: accountAddress,\n // the slot at which impl addresses are stored by UUPS\n slot: \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n });\n\n if (storage == null) {\n throw new FailedToGetStorageSlotError(\n \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\",\n \"Proxy Implementation Address\",\n );\n }\n\n const implementationAddresses = Object.values(\n AccountVersionRegistry[type],\n ).map(\n (x) =>\n x.addresses.overrides?.[chain.id]?.impl ?? x.addresses.default.impl,\n );\n\n // only upgrade undeployed accounts (storage 0) or deployed light accounts, error otherwise\n if (\n fromHex(storage, \"number\") !== 0 &&\n !implementationAddresses.some((x) => x === trim(storage))\n ) {\n throw new Error(\n `could not determine if smart account implementation is ${type} ${String(\n version,\n )}`,\n );\n }\n\n return encodeFunctionData({\n abi,\n functionName: \"upgradeToAndCall\",\n args: [upgradeToAddress, upgradeToInitData],\n });\n };\n\n const get1271Wrapper = (\n hashedMessage: Hex,\n version: string,\n ): TypedDataDefinition => {\n return {\n // EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\n // https://github.com/alchemyplatform/light-account/blob/main/src/LightAccount.sol#L236\n domain: {\n chainId: Number(client.chain.id),\n name: type,\n verifyingContract: accountAddress,\n version,\n },\n types: {\n LightAccountMessage: [{ name: \"message\", type: \"bytes\" }],\n },\n message: {\n message: hashedMessage,\n },\n primaryType: \"LightAccountMessage\",\n };\n };\n\n const prepareSign = async (\n params: SignatureRequest,\n ): Promise<SignatureRequest> => {\n const messageHash =\n params.type === \"personal_sign\"\n ? hashMessage(params.data)\n : hashTypedData(params.data);\n\n switch (version as string) {\n case \"v1.0.1\":\n return params;\n case \"v1.0.2\":\n throw new Error(\n `Version ${String(version)} of LightAccount doesn't support 1271`,\n );\n case \"v1.1.0\":\n return {\n type: \"eth_signTypedData_v4\",\n data: get1271Wrapper(messageHash, \"1\"),\n };\n case \"v2.0.0\":\n return {\n type: \"eth_signTypedData_v4\",\n data: get1271Wrapper(messageHash, \"2\"),\n };\n default:\n throw new Error(`Unknown version ${String(version)} of LightAccount`);\n }\n };\n\n const formatSign = async (\n signature: `0x${string}`,\n ): Promise<`0x${string}`> => {\n return version === \"v2.0.0\"\n ? concat([SignatureType.EOA, signature])\n : signature;\n };\n\n const account = await toSmartContractAccount({\n transport,\n chain,\n entryPoint,\n accountAddress,\n source: type,\n getAccountInitCode,\n prepareSign,\n formatSign,\n encodeExecute: async ({ target, data, value }) => {\n return encodeFunctionData({\n abi,\n functionName: \"execute\",\n args: [target, value ?? 0n, data],\n });\n },\n encodeBatchExecute: async (txs) => {\n const [targets, values, datas] = txs.reduce(\n (accum, curr) => {\n accum[0].push(curr.target);\n accum[1].push(curr.value ?? 0n);\n accum[2].push(curr.data);\n\n return accum;\n },\n [[], [], []] as [Address[], bigint[], Hex[]],\n );\n return encodeFunctionData({\n abi,\n functionName: \"executeBatch\",\n args: [targets, values, datas],\n });\n },\n signUserOperationHash: async (uoHash: Hex) => {\n const signature = await signer.signMessage({ raw: uoHash });\n switch (version) {\n case \"v2.0.0\":\n // TODO: handle case where signer is an SCA.\n return concat([SignatureType.EOA, signature]);\n default:\n return signature;\n }\n },\n async signMessage({ message }) {\n const { type, data } = await prepareSign({\n type: \"personal_sign\",\n data: message,\n });\n\n const sig =\n type === \"personal_sign\"\n ? await signer.signMessage(data)\n : await signer.signTypedData(data);\n\n return formatSign(sig);\n },\n async signTypedData<\n const typedData extends TypedData | Record<string, unknown>,\n primaryType extends keyof typedData | \"EIP712Domain\" = keyof typedData,\n >(params: TypedDataDefinition<typedData, primaryType>) {\n const { type, data } = await prepareSign({\n type: \"eth_signTypedData_v4\",\n data: params as TypedDataDefinition,\n });\n\n const sig =\n type === \"personal_sign\"\n ? await signer.signMessage(data)\n : await signer.signTypedData(data);\n\n return formatSign(sig);\n },\n getDummySignature: (): Hex => {\n const signature =\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\";\n switch (version as string) {\n case \"v1.0.1\":\n case \"v1.0.2\":\n case \"v1.1.0\":\n return signature;\n case \"v2.0.0\":\n return concat([SignatureType.EOA, signature]);\n default:\n throw new Error(`Unknown version ${type} of ${String(version)}`);\n }\n },\n encodeUpgradeToAndCall,\n });\n\n return {\n ...account,\n source: type,\n getLightAccountVersion: () => version,\n getSigner: () => signer,\n };\n}\n","// Trimmed ABI containing only the constructor for the OpenZeppelin ERC1967Proxy contract.\nexport const OZ_ERC1967Proxy_ConstructorAbi = [\n {\n type: \"constructor\",\n inputs: [\n {\n name: \"_logic\",\n type: \"address\",\n internalType: \"address\",\n },\n {\n name: \"_data\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n stateMutability: \"payable\",\n },\n] as const;\n","import {\n encodeAbiParameters,\n encodeDeployData,\n keccak256,\n getContractAddress,\n type Address,\n type Hex,\n toHex,\n encodeFunctionData,\n} from \"viem\";\nimport type { LightAccountVersionConfigs } from \"../types\";\nimport { OZ_ERC1967Proxy_ConstructorAbi } from \"../abis/OZ_ERC1967Proxy.js\";\nimport { AccountVersionRegistry } from \"../utils.js\";\nimport { LightAccountAbi_v1 } from \"../abis/LightAccountAbi_v1.js\";\n\nexport type PredictLightAccountAddressParams = {\n factoryAddress: Address;\n salt: bigint;\n ownerAddress: Address;\n version: keyof LightAccountVersionConfigs[\"LightAccount\"];\n};\n\n/**\n * Predicts the address of a light account based on provided parameters such as factory address, salt, owner address, and version.\n *\n * @param {PredictLightAccountAddressParams} params The parameters required to predict the light account address, including factory address, salt, owner address, and version\n * @returns {Address} The predicted address of the light account calculated based on the provided parameters\n */\nexport function predictLightAccountAddress({\n factoryAddress,\n salt,\n ownerAddress,\n version,\n}: PredictLightAccountAddressParams): Address {\n const implementationAddress =\n // If we aren't using the default factory address, we compute the implementation address from the factory's `create` deployment.\n // This is accurate for both LA v1 and v2 factories. If we are using the default factory address, we use the implementation address from the registry.\n factoryAddress !==\n AccountVersionRegistry.LightAccount[version].addresses.default.factory\n ? getContractAddress({\n from: factoryAddress,\n nonce: 1n,\n })\n : AccountVersionRegistry.LightAccount[version].addresses.default.impl;\n\n switch (version) {\n case \"v1.0.1\":\n case \"v1.0.2\":\n case \"v1.1.0\":\n // Same proxy initcode for all LA v1 factories\n const LAv1_proxy_bytecode: Hex =\n \"0x60406080815261042c908138038061001681610218565b93843982019181818403126102135780516001600160a01b038116808203610213576020838101516001600160401b0394919391858211610213570186601f820112156102135780519061007161006c83610253565b610218565b918083528583019886828401011161021357888661008f930161026e565b813b156101b9577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b031916841790556000927fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8480a28051158015906101b2575b61010b575b855160e790816103458239f35b855194606086019081118682101761019e578697849283926101889952602788527f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c87890152660819985a5b195960ca1b8a8901525190845af4913d15610194573d9061017a61006c83610253565b91825281943d92013e610291565b508038808080806100fe565b5060609250610291565b634e487b7160e01b84526041600452602484fd5b50826100f9565b855162461bcd60e51b815260048101859052602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b600080fd5b6040519190601f01601f191682016001600160401b0381118382101761023d57604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b03811161023d57601f01601f191660200190565b60005b8381106102815750506000910152565b8181015183820152602001610271565b919290156102f357508151156102a5575090565b3b156102ae5790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156103065750805190602001fd5b6044604051809262461bcd60e51b825260206004830152610336815180928160248601526020868601910161026e565b601f01601f19168101030190fdfe60806040523615605f5773ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54166000808092368280378136915af43d82803e15605b573d90f35b3d90fd5b73ffffffffffffffffffffffffffffffffffffffff7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54166000808092368280378136915af43d82803e15605b573d90f3fea26469706673582212205da2750cd2b0cadfd354d8a1ca4752ed7f22214c8069d852f7dc6b8e9e5ee66964736f6c63430008150033\";\n\n return getContractAddress({\n from: factoryAddress,\n opcode: \"CREATE2\",\n salt: toHex(salt, { size: 32 }),\n bytecode: encodeDeployData({\n bytecode: LAv1_proxy_bytecode,\n abi: OZ_ERC1967Proxy_ConstructorAbi,\n args: [\n implementationAddress,\n encodeFunctionData({\n abi: LightAccountAbi_v1,\n functionName: \"initialize\",\n args: [ownerAddress],\n }),\n ],\n }),\n });\n\n case \"v2.0.0\":\n // Logic ported from LA factory v2.0.0\n const combinedSalt = keccak256(\n encodeAbiParameters(\n [{ type: \"address\" }, { type: \"uint256\" }],\n [ownerAddress, salt],\n ),\n );\n\n const initCode: Hex = getLAv2ProxyBytecode(implementationAddress);\n\n return getContractAddress({\n from: factoryAddress,\n opcode: \"CREATE2\",\n salt: combinedSalt,\n bytecode: initCode,\n });\n\n default:\n assertNeverLightAccountVersion(version);\n }\n}\n\nexport type PredictMultiOwnerLightAccountAddressParams = {\n factoryAddress: Address;\n salt: bigint;\n ownerAddresses: Address[];\n // There's just one version of the MultiOwnerLightAccount for now, so skip requiring the version as a parameter.\n};\n\n// Note: assumes the owner addresses are already deduped, sorted in ascending order, and have the signer address included.\n/**\n * Predicts the address of a **Multi-Owner Light Account** given the factory, salt\n * and the set of owner addresses.\n *\n * Internally replicates the CREATE2 calculation performed by the factory so\n * you can obtain the counter-factual account address before deployment (useful\n * for funding or displaying to users).\n *\n * @param {PredictMultiOwnerLightAccountAddressParams} params Object containing:\n * – `factoryAddress` Factory contract that will deploy the account.\n * – `salt` Arbitrary salt used when calling the factory.\n * – `ownerAddresses` Array of owner EOAs (must be deduped & sorted).\n * @returns {Address} Predicted account address for the multi-owner light account.\n */\nexport function predictMultiOwnerLightAccountAddress({\n factoryAddress,\n salt,\n ownerAddresses,\n}: PredictMultiOwnerLightAccountAddressParams): Address {\n const implementationAddress =\n // If we aren't using the default factory address, we compute the implementation address from the factory's `create` deployment.\n // This is accurate for both LA v1 and v2 factories. If we are using the default factory address, we use the implementation address from the registry.\n factoryAddress !==\n AccountVersionRegistry.MultiOwnerLightAccount[\"v2.0.0\"].addresses.default\n .factory\n ? getContractAddress({\n from: factoryAddress,\n nonce: 1n,\n })\n : AccountVersionRegistry.MultiOwnerLightAccount[\"v2.0.0\"].addresses\n .default.impl;\n\n const combinedSalt = keccak256(\n encodeAbiParameters(\n [{ type: \"address[]\" }, { type: \"uint256\" }],\n [ownerAddresses, salt],\n ),\n );\n\n const initCode: Hex = getLAv2ProxyBytecode(implementationAddress);\n\n return getContractAddress({\n from: factoryAddress,\n opcode: \"CREATE2\",\n salt: combinedSalt,\n bytecode: initCode,\n });\n}\n\n// Bytecode from https://github.com/Vectorized/solady/blob/c6e5238e5f3b621789c59e1a443f43b6606394b2/src/utils/LibClone.sol#L721\n\nfunction getLAv2ProxyBytecode(implementationAddress: Address): Hex {\n return `0x603d3d8160223d3973${implementationAddress.slice(\n 2,\n )}60095155f3363d3d373d3d363d7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e6038573d6000fd5b3d6000f3`;\n}\n\nfunction assertNeverLightAccountVersion(version: never): never {\n throw new Error(`Unknown light account version: ${version}`);\n}\n","import {\n createBundlerClient,\n getEntryPoint,\n type Address,\n type EntryPointDef,\n type SmartAccountSigner,\n} from \"@aa-sdk/core\";\nimport {\n concatHex,\n encodeFunctionData,\n type Chain,\n type Hex,\n type Transport,\n} from \"viem\";\nimport { LightAccountAbi_v1 } from \"../abis/LightAccountAbi_v1.js\";\nimport { LightAccountAbi_v2 } from \"../abis/LightAccountAbi_v2.js\";\nimport { LightAccountFactoryAbi_v1 } from \"../abis/LightAccountFactoryAbi_v1.js\";\nimport { LightAccountFactoryAbi_v2 } from \"../abis/LightAccountFactoryAbi_v2.js\";\nimport type {\n LightAccountEntryPointVersion,\n LightAccountVersion,\n} from \"../types.js\";\nimport {\n AccountVersionRegistry,\n LightAccountUnsupported1271Factories,\n defaultLightAccountVersion,\n getDefaultLightAccountFactoryAddress,\n} from \"../utils.js\";\nimport {\n createLightAccountBase,\n type CreateLightAccountBaseParams,\n type LightAccountBase,\n} from \"./base.js\";\nimport { predictLightAccountAddress } from \"./predictAddress.js\";\n\nexport type LightAccount<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends\n LightAccountVersion<\"LightAccount\"> = LightAccountVersion<\"LightAccount\">,\n> = LightAccountBase<TSigner, \"LightAccount\", TLightAccountVersion> & {\n encodeTransferOwnership: (newOwner: Address) => Hex;\n getOwnerAddress: () => Promise<Address>;\n};\n\nexport type CreateLightAccountParams<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends\n LightAccountVersion<\"LightAccount\"> = LightAccountVersion<\"LightAccount\">,\n> = Omit<\n CreateLightAccountBaseParams<\n \"LightAccount\",\n TLightAccountVersion,\n TTransport,\n TSigner\n >,\n | \"getAccountInitCode\"\n | \"entryPoint\"\n | \"version\"\n | \"abi\"\n | \"accountAddress\"\n | \"type\"\n> & {\n salt?: bigint;\n initCode?: Hex;\n accountAddress?: Address;\n factoryAddress?: Address;\n version?: TLightAccountVersion;\n entryPoint?: EntryPointDef<\n LightAccountEntryPointVersion<\"LightAccount\", TLightAccountVersion>,\n Chain\n >;\n};\n\nexport async function createLightAccount<\n TTransport extends Transport = Transport,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TLightAccountVersion extends LightAccountVersion<\"LightAccount\"> = \"v2.0.0\",\n>(\n config: CreateLightAccountParams<TTransport, TSigner, TLightAccountVersion>,\n): Promise<LightAccount<TSigner, TLightAccountVersion>>;\n\n/**\n * Creates a light account based on the provided parameters such as transport, chain, signer, init code, and more. Ensures that an account is configured and returned with various capabilities, such as transferring ownership and retrieving the owner's address.\n *\n * @example\n * ```ts\n * import { createLightAccount } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createLightAccount({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateLightAccountParams} config The parameters for creating a light account\n * @returns {Promise<LightAccount>} A promise that resolves to a `LightAccount` object containing the created account information and methods\n */\nexport async function createLightAccount({\n transport,\n chain,\n signer,\n initCode,\n version = defaultLightAccountVersion(),\n entryPoint = getEntryPoint(chain, {\n version: AccountVersionRegistry[\"LightAccount\"][version]\n .entryPointVersion as any,\n }),\n accountAddress,\n factoryAddress = getDefaultLightAccountFactoryAddress(chain, version),\n salt: salt_ = 0n,\n}: CreateLightAccountParams): Promise<LightAccount> {\n const client = createBundlerClient({\n transport,\n chain,\n });\n\n const accountAbi =\n version === \"v2.0.0\" ? LightAccountAbi_v2 : LightAccountAbi_v1;\n const factoryAbi =\n version === \"v2.0.0\"\n ? LightAccountFactoryAbi_v1\n : LightAccountFactoryAbi_v2;\n\n const signerAddress = await signer.getAddress();\n\n const salt = LightAccountUnsupported1271Factories.has(\n factoryAddress.toLowerCase() as Address,\n )\n ? 0n\n : salt_;\n\n const getAccountInitCode = async () => {\n if (initCode) return initCode;\n\n return concatHex([\n factoryAddress,\n encodeFunctionData({\n abi: factoryAbi,\n functionName: \"createAccount\",\n args: [signerAddress, salt],\n }),\n ]);\n };\n\n const address =\n accountAddress ??\n predictLightAccountAddress({\n factoryAddress,\n salt,\n ownerAddress: signerAddress,\n version,\n });\n\n const account = await createLightAccountBase<\n \"LightAccount\",\n LightAccountVersion<\"LightAccount\">,\n Transport,\n SmartAccountSigner\n >({\n transport,\n chain,\n signer,\n abi: accountAbi,\n type: \"LightAccount\",\n version,\n entryPoint,\n accountAddress: address,\n getAccountInitCode,\n });\n\n return {\n ...account,\n\n encodeTransferOwnership: (newOwner: Address) => {\n return encodeFunctionData({\n abi: accountAbi,\n functionName: \"transferOwnership\",\n args: [newOwner],\n });\n },\n async getOwnerAddress(): Promise<Address> {\n const callResult = await client.readContract({\n address,\n abi: accountAbi,\n functionName: \"owner\",\n });\n\n if (callResult == null) {\n throw new Error(\"could not get on-chain owner\");\n }\n\n return callResult;\n },\n };\n}\n","import {\n AccountNotFoundError,\n IncompatibleClientError,\n isSmartAccountClient,\n type GetAccountParameter,\n type GetEntryPointFromAccount,\n type SmartAccountSigner,\n type UserOperationOverridesParameter,\n} from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { LightAccount } from \"../accounts/account\";\n\nexport type TransferLightAccountOwnershipParams<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n> = {\n newOwner: TSigner;\n waitForTxn?: boolean;\n} & GetAccountParameter<TAccount, LightAccount<TSigner>> &\n UserOperationOverridesParameter<TEntryPointVersion>;\n\n/**\n * Transfers the ownership of a light account to a new owner.\n * This function ensures that the client is a compatible smart acccount client and that a Light Account is provided.\n * If the waitForTxn parameter is true, it will wait for the transaction to be completed before returning.\n *\n * @example\n * ```ts\n * import { transferOwnership, createLightAccountClient } from \"@account-kit/smart-contracts\";\n *\n * const lightAccountClient = createLightAccountClient({\n * signer,\n * transport,\n * chain,\n * });\n *\n * const txHash = await transferOwnership(lightAccountClient, {\n * newOwner: newOwnerSigner,\n * waitForTxn: true, // set to false to return a uoHash instead\n * });\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The smart account client instance used to execute the transfer\n * @param {TransferLightAccountOwnershipParams<TSigner, TAccount>} args The parameters for transferring ownership\n * @returns {Promise<Hex>} The transaction or UO hash as a Hex string\n */\nexport const transferOwnership = async <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n args: TransferLightAccountOwnershipParams<TSigner, TAccount>,\n): Promise<Hex> => {\n const { newOwner, waitForTxn, overrides, account = client.account } = args;\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isSmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"SmartAccountClient\",\n \"transferOwnership\",\n client,\n );\n }\n\n const data = account.encodeTransferOwnership(await newOwner.getAddress());\n\n const result = await client.sendUserOperation({\n uo: {\n target: account.address,\n data,\n },\n account,\n overrides,\n });\n\n if (waitForTxn) {\n return client.waitForUserOperationTransaction(result);\n }\n\n return result.hash;\n};\n","import { type SmartContractAccount } from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport type { AlchemySmartAccountClient } from \"./smartAccountClient\";\n\n/**\n * Checks if a given client is an Alchemy Smart Account Client. The goal of this check is to ensure that the client supports certain RPC methods.\n *\n * @example\n * ```ts\n * import { isAlchemySmartAccountClient } from \"@account-kit/infra\";\n *\n * if (isAlchemySmartAccountClient(client)) {\n * // do things with the client as an Alchemy Smart Account Client\n * }\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance to be checked\n * @returns {boolean} `true` if the client is an Alchemy Smart Account Client, otherwise `false`\n */\nexport function isAlchemySmartAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n>(\n client: Client<Transport, TChain, TAccount>,\n): client is AlchemySmartAccountClient<TChain, TAccount> {\n return client.transport.type === \"alchemy\";\n}\n","import {\n AccountNotFoundError,\n IncompatibleClientError,\n deepHexlify,\n type SendUserOperationParameters,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport type { Chain, Client, Transport } from \"viem\";\nimport { isAlchemySmartAccountClient } from \"../client/isAlchemySmartAccountClient.js\";\nimport type { AlchemyRpcSchema } from \"../client/types.js\";\nimport type { SimulateUserOperationAssetChangesResponse } from \"./types.js\";\n\n/**\n * Simulates user operation changes including asset changes for a specified user operation and returns the resulting state changes.\n *\n * @example\n * ```ts\n * import { simulateUserOperationChanges, createAlchemyPublicRpcClient } from \"@account-kit/infra\";\n *\n * const client = createAlchemyPublicRpcClient(...);\n * const response = await simulateUserOperationChanges(client, {\n * uo: ...\n * });\n * ```\n *\n * @param {Client<Transport, TChain, TAccount, AlchemyRpcSchema>} client The client instance used to send the simulation request\n * @param {SendUserOperationParameters<TAccount>} args The parameters of the user operation including the account and other overrides\n * @returns {Promise<SimulateUserOperationAssetChangesResponse>} A promise that resolves to the response of the simulation showing the asset changes\n */\nexport const simulateUserOperationChanges: <\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n>(\n client: Client<Transport, TChain, TAccount, AlchemyRpcSchema>,\n args: SendUserOperationParameters<TAccount>,\n) => Promise<SimulateUserOperationAssetChangesResponse> = async (\n client,\n { account = client.account, overrides, ...params },\n) => {\n if (!account) {\n throw new AccountNotFoundError();\n }\n\n if (!isAlchemySmartAccountClient(client)) {\n throw new IncompatibleClientError(\n \"AlchemySmartAccountClient\",\n \"SimulateUserOperationAssetChanges\",\n client,\n );\n }\n\n const uoStruct = deepHexlify(\n await client.buildUserOperation({\n ...params,\n account,\n overrides,\n }),\n );\n\n return client.request({\n method: \"alchemy_simulateUserOperationAssetChanges\",\n params: [uoStruct, account.getEntryPoint().address],\n });\n};\n","import { TRACE_HEADER_NAME } from \"@aa-sdk/core\";\nimport { TRACE_HEADER_STATE } from \"@aa-sdk/core\";\nimport { TraceHeader } from \"@aa-sdk/core\";\n\n/**\n * The header that is used to track the trace id.\n * We use a client specific one to not mess with the span tracing of the servers.\n *\n * @see headersUpdate\n */\nconst TRACKER_HEADER = \"X-Alchemy-Client-Trace-Id\";\n\n/**\n * The header that is used to track the breadcrumb.\n *\n * @see headersUpdate\n */\nconst TRACKER_BREADCRUMB = \"X-Alchemy-Client-Breadcrumb\";\n\n/**\n * Remove the tracking headers. This is used in our split transport to ensure that we remove the headers that\n * are not used by the other systems.\n *\n * @param {unknown} x The headers to remove the tracking headers from\n */\nexport function mutateRemoveTrackingHeaders(x?: unknown) {\n if (!x) return;\n if (Array.isArray(x)) return;\n if (typeof x !== \"object\") return;\n TRACKER_HEADER in x && delete x[TRACKER_HEADER];\n TRACKER_BREADCRUMB in x && delete x[TRACKER_BREADCRUMB];\n TRACE_HEADER_NAME in x && delete x[TRACE_HEADER_NAME];\n TRACE_HEADER_STATE in x && delete x[TRACE_HEADER_STATE];\n}\n\nfunction addCrumb(previous: string | undefined, crumb: string): string {\n if (!previous) return crumb;\n return `${previous} > ${crumb}`;\n}\n/**\n * Update the headers with the trace header and breadcrumb.\n *\n * These trace headers are used in the imply ingestion pipeline to trace the request.\n * And the breadcrumb is used to get finer grain details in the trace.\n *\n * Then there are the trace headers that are part of the W3C trace context standard.\n *\n * @param {string} crumb The crumb to add to the breadcrumb\n * @returns {Function} A function that updates the headers\n */\nexport function headersUpdate(crumb: string) {\n const headerUpdate_ = (x: Record<string, string>) => {\n const traceHeader = (\n TraceHeader.fromTraceHeader(x) || TraceHeader.default()\n ).withEvent(crumb);\n return {\n [TRACKER_HEADER]: traceHeader.parentId,\n ...x,\n [TRACKER_BREADCRUMB]: addCrumb(x[TRACKER_BREADCRUMB], crumb),\n ...traceHeader.toTraceHeader(),\n };\n };\n return headerUpdate_;\n}\n","import { ChainSchema } from \"@aa-sdk/core\";\nimport type { Chain } from \"viem\";\nimport z from \"zod\";\n\nexport const AlchemyChainSchema = z.custom<Chain>((chain) => {\n const chain_ = ChainSchema.parse(chain);\n\n return chain_.rpcUrls.alchemy != null;\n}, \"chain must include an alchemy rpc url. See `defineAlchemyChain` or import a chain from `@account-kit/infra`.\");\n","// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.88.4\";\n","import {\n ChainNotFoundError,\n ConnectionConfigSchema,\n split,\n type ConnectionConfig,\n type NoUndefined,\n} from \"@aa-sdk/core\";\nimport {\n createTransport,\n http,\n type Chain,\n type EIP1193RequestFn,\n type HttpTransportConfig,\n type PublicRpcSchema,\n type Transport,\n type TransportConfig,\n} from \"viem\";\nimport { mutateRemoveTrackingHeaders } from \"./alchemyTrackerHeaders.js\";\nimport type { AlchemyRpcSchema } from \"./client/types.js\";\nimport { AlchemyChainSchema } from \"./schema.js\";\nimport { VERSION } from \"./version.js\";\n\ntype Never<T> = T extends object\n ? {\n [K in keyof T]?: never;\n }\n : never;\n\ntype AlchemyConnectionConfig = ConnectionConfig;\n\ntype SplitTransportConfig = {\n alchemyConnection: AlchemyConnectionConfig;\n nodeRpcUrl: string;\n};\n\nconst alchemyMethods = [\n \"eth_sendUserOperation\",\n \"eth_estimateUserOperationGas\",\n \"eth_getUserOperationReceipt\",\n \"eth_getUserOperationByHash\",\n \"eth_supportedEntryPoints\",\n \"rundler_maxPriorityFeePerGas\",\n \"pm_getPaymasterData\",\n \"pm_getPaymasterStubData\",\n \"alchemy_requestGasAndPaymasterAndData\",\n];\n\nconst chainAgnosticMethods = [\n \"wallet_prepareCalls\",\n \"wallet_sendPreparedCalls\",\n \"wallet_requestAccount\",\n \"wallet_createAccount\",\n \"wallet_listAccounts\",\n \"wallet_createSession\",\n \"wallet_getCallsStatus\",\n \"wallet_requestQuote_v0\",\n];\n\nexport type AlchemyTransportConfig = (\n | (AlchemyConnectionConfig & Never<SplitTransportConfig>)\n | (SplitTransportConfig & Never<AlchemyConnectionConfig>)\n) & {\n /** The max number of times to retry. */\n retryCount?: TransportConfig[\"retryCount\"] | undefined;\n /** The base delay (in ms) between retries. */\n retryDelay?: TransportConfig[\"retryDelay\"] | undefined;\n fetchOptions?: NoUndefined<HttpTransportConfig[\"fetchOptions\"]>;\n};\n\ntype AlchemyTransportBase = Transport<\n \"alchemy\",\n {\n alchemyRpcUrl: string;\n fetchOptions?: AlchemyTransportConfig[\"fetchOptions\"];\n },\n EIP1193RequestFn<[...PublicRpcSchema, ...AlchemyRpcSchema]>\n>;\n\nexport type AlchemyTransport = AlchemyTransportBase & {\n updateHeaders(newHeaders: HeadersInit): void;\n config: AlchemyTransportConfig;\n dynamicFetchOptions: AlchemyTransportConfig[\"fetchOptions\"];\n};\n\n/**\n * A type guard for the transport to determine if it is an Alchemy transport.\n * Used in cases where we would like to do switching depending on the transport, where there used\n * to be two clients for an alchemy and a non-alchemy, and with this switch we don't need the two seperate clients. *\n *\n * @param {Transport} transport The transport to check\n * @param {Chain} chain Chain for the transport to run its function to return the transport config\n * @returns {boolean} `true` if the transport is an Alchemy transport, otherwise `false`\n */\nexport function isAlchemyTransport(\n transport: Transport,\n chain: Chain,\n): transport is AlchemyTransport {\n return transport({ chain }).config.type === \"alchemy\";\n}\n\n/**\n * Creates an Alchemy transport with the specified configuration options.\n * When sending all traffic to Alchemy, you must pass in one of rpcUrl, apiKey, or jwt.\n * If you want to send Bundler and Paymaster traffic to Alchemy and Node traffic to a different RPC, you must pass in alchemyConnection and nodeRpcUrl.\n *\n * @example\n * ### Basic Example\n * If the chain you're using is supported for both Bundler and Node RPCs, then you can do the following:\n * ```ts\n * import { alchemy } from \"@account-kit/infra\";\n *\n * const transport = alchemy({\n * // NOTE: you can also pass in an rpcUrl or jwt here or rpcUrl and jwt\n * apiKey: \"your-api-key\",\n * });\n * ```\n *\n * ### AA Only Chains\n * For AA-only chains, you need to specify the alchemyConnection and nodeRpcUrl since Alchemy only\n * handles the Bundler and Paymaster RPCs for these chains.\n * ```ts\n * import { alchemy } from \"@account-kit/infra\";\n *\n * const transport = alchemy({\n * alchemyConnection: {\n * apiKey: \"your-api-key\",\n * },\n * nodeRpcUrl: \"https://zora.rpc.url\",\n * });\n * ```\n *\n * @param {AlchemyTransportConfig} config The configuration object for the Alchemy transport.\n * @param {number} config.retryDelay Optional The delay between retries, in milliseconds.\n * @param {number} config.retryCount Optional The number of retry attempts.\n * @param {string} [config.alchemyConnection] Optional Alchemy connection configuration (if this is passed in, nodeRpcUrl is required).\n * @param {string} [config.fetchOptions] Optional fetch options for HTTP requests.\n * @param {string} [config.nodeRpcUrl] Optional RPC URL for node (if this is passed in, alchemyConnection is required).\n * @param {string} [config.rpcUrl] Optional RPC URL.\n * @param {string} [config.apiKey] Optional API key for Alchemy.\n * @param {string} [config.jwt] Optional JSON Web Token for authorization.\n * @returns {AlchemyTransport} The configured Alchemy transport object.\n */\nexport function alchemy(config: AlchemyTransportConfig): AlchemyTransport {\n const { retryDelay, retryCount = 0 } = config;\n // we create a copy here in case we create a split transport down below\n // we don't want to add alchemy headers to 3rd party nodes\n const fetchOptions = { ...config.fetchOptions };\n\n const connectionConfig = ConnectionConfigSchema.parse(\n config.alchemyConnection ?? config,\n );\n\n const headersAsObject = convertHeadersToObject(fetchOptions.headers);\n\n // TODO: we probably should just log these headers during telemetry logging instead of doing this mutable header stuff\n fetchOptions.headers = {\n ...headersAsObject,\n \"Alchemy-AA-Sdk-Version\": VERSION,\n };\n\n if (connectionConfig.jwt != null || connectionConfig.apiKey != null) {\n fetchOptions.headers = {\n ...fetchOptions.headers,\n Authorization: `Bearer ${\n connectionConfig.jwt ?? connectionConfig.apiKey\n }`,\n };\n }\n\n const transport: AlchemyTransportBase = (opts) => {\n const { chain: chain_ } = opts;\n if (!chain_) {\n throw new ChainNotFoundError();\n }\n const chain = AlchemyChainSchema.parse(chain_);\n\n const rpcUrl =\n connectionConfig.rpcUrl == null\n ? chain.rpcUrls.alchemy.http[0]\n : connectionConfig.rpcUrl;\n\n const chainAgnosticRpcUrl =\n connectionConfig.rpcUrl == null\n ? \"https://api.g.alchemy.com/v2\"\n : (connectionConfig.chainAgnosticUrl ?? connectionConfig.rpcUrl);\n\n const innerTransport = (() => {\n mutateRemoveTrackingHeaders(config?.fetchOptions?.headers);\n if (config.alchemyConnection && config.nodeRpcUrl) {\n return split({\n overrides: [\n {\n methods: alchemyMethods,\n transport: http(rpcUrl, { fetchOptions, retryCount }),\n },\n {\n methods: chainAgnosticMethods,\n transport: http(chainAgnosticRpcUrl, {\n fetchOptions,\n retryCount,\n retryDelay,\n }),\n },\n ],\n fallback: http(config.nodeRpcUrl, {\n fetchOptions: config.fetchOptions,\n retryCount,\n retryDelay,\n }),\n });\n }\n\n return split({\n overrides: [\n {\n methods: chainAgnosticMethods,\n transport: http(chainAgnosticRpcUrl, {\n fetchOptions,\n retryCount,\n retryDelay,\n }),\n },\n ],\n fallback: http(rpcUrl, { fetchOptions, retryCount, retryDelay }),\n });\n })();\n\n return createTransport(\n {\n key: \"alchemy\",\n name: \"Alchemy Transport\",\n request: innerTransport({\n ...opts,\n // Retries are already handled above within the split transport,\n // so `retryCount` must be 0 here for the expected behavior.\n retryCount: 0,\n }).request,\n // Retries are already handled above within the split transport,\n // so `retryCount` must be 0 here too for the expected behavior.\n retryCount: 0,\n retryDelay,\n type: \"alchemy\",\n },\n { alchemyRpcUrl: rpcUrl, fetchOptions },\n );\n };\n\n return Object.assign(transport, {\n dynamicFetchOptions: fetchOptions,\n updateHeaders(newHeaders_: HeadersInit) {\n const newHeaders = convertHeadersToObject(newHeaders_);\n\n fetchOptions.headers = {\n ...fetchOptions.headers,\n ...newHeaders,\n };\n },\n config,\n });\n}\n\nexport const convertHeadersToObject = (\n headers?: HeadersInit,\n): Record<string, string> => {\n if (!headers) {\n return {};\n }\n\n if (headers instanceof Headers) {\n const headersObject = {} as Record<string, string>;\n headers.forEach((value, key) => {\n headersObject[key] = value;\n });\n return headersObject;\n }\n\n if (Array.isArray(headers)) {\n return headers.reduce(\n (acc, header) => {\n acc[header[0]] = header[1];\n return acc;\n },\n {} as Record<string, string>,\n );\n }\n\n return headers;\n};\n","import type { Chain } from \"viem\";\n\nimport { defineChain } from \"viem\";\nimport {\n arbitrum as vab,\n arbitrumGoerli as vabg,\n arbitrumSepolia as vabs,\n base as vbase,\n baseGoerli as vbaseg,\n baseSepolia as vbases,\n bsc as vbsc,\n bscTestnet as vbsct,\n fraxtal as vfrax,\n goerli as vgo,\n mainnet as vmain,\n optimism as vop,\n optimismGoerli as vopg,\n optimismSepolia as vops,\n polygon as vpg,\n polygonAmoy as vpga,\n polygonMumbai as vpgm,\n sepolia as vsep,\n zora as vzora,\n zoraSepolia as vzoras,\n worldchain as vwc,\n worldchainSepolia as vwcs,\n hyperliquid as vhyperliquid,\n hyperliquidEvmTestnet as vhyperliquidEvmTestnet,\n cronos as vCronos,\n cronosTestnet as vCronosTesnet,\n} from \"viem/chains\";\n\nexport type AlchemyChainConfig = {\n chain: Chain;\n rpcBaseUrl: string;\n};\n\n/**\n * Defines an Alchemy chain configuration by adding an Alchemy-specific RPC base URL to the chain's RPC URLs.\n *\n * @example\n * ```ts\n * import { defineAlchemyChain } from \"@account-kit/infra\";\n * import { sepolia } from \"viem/chains\";\n *\n * const chain = defineAlchemyChain({\n * chain: sepolia,\n * rpcBaseUrl: \"https://eth-sepolia.g.alchemy.com/v2\"\n * });\n * ```\n *\n * @param {AlchemyChainConfig} params The parameters for defining the Alchemy chain\n * @param {Chain} params.chain The original chain configuration\n * @param {string} params.rpcBaseUrl The Alchemy-specific RPC base URL\n * @returns {Chain} The updated chain configuration with the Alchemy RPC URL added\n */\nexport const defineAlchemyChain = ({\n chain,\n rpcBaseUrl,\n}: {\n chain: Chain;\n rpcBaseUrl: string;\n}): Chain => {\n return {\n ...chain,\n rpcUrls: {\n ...chain.rpcUrls,\n alchemy: {\n http: [rpcBaseUrl],\n },\n },\n };\n};\n\nexport const arbitrum: Chain = {\n ...vab,\n rpcUrls: {\n ...vab.rpcUrls,\n alchemy: {\n http: [\"https://arb-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const arbitrumGoerli: Chain = {\n ...vabg,\n rpcUrls: {\n ...vabg.rpcUrls,\n alchemy: {\n http: [\"https://arb-goerli.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const arbitrumSepolia: Chain = {\n ...vabs,\n rpcUrls: {\n ...vabs.rpcUrls,\n alchemy: {\n http: [\"https://arb-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\nexport const goerli: Chain = {\n ...vgo,\n rpcUrls: {\n ...vgo.rpcUrls,\n alchemy: {\n http: [\"https://eth-goerli.g.alchemy.com/v2\"],\n },\n },\n};\nexport const mainnet: Chain = {\n ...vmain,\n rpcUrls: {\n ...vmain.rpcUrls,\n alchemy: {\n http: [\"https://eth-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\nexport const optimism: Chain = {\n ...vop,\n rpcUrls: {\n ...vop.rpcUrls,\n alchemy: {\n http: [\"https://opt-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\nexport const optimismGoerli: Chain = {\n ...vopg,\n rpcUrls: {\n ...vopg.rpcUrls,\n alchemy: {\n http: [\"https://opt-goerli.g.alchemy.com/v2\"],\n },\n },\n};\nexport const optimismSepolia: Chain = {\n ...vops,\n rpcUrls: {\n ...vops.rpcUrls,\n alchemy: {\n http: [\"https://opt-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\nexport const sepolia: Chain = {\n ...vsep,\n rpcUrls: {\n ...vsep.rpcUrls,\n alchemy: {\n http: [\"https://eth-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\nexport const base: Chain = {\n ...vbase,\n rpcUrls: {\n ...vbase.rpcUrls,\n alchemy: {\n http: [\"https://base-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\nexport const baseGoerli: Chain = {\n ...vbaseg,\n rpcUrls: {\n ...vbaseg.rpcUrls,\n alchemy: {\n http: [\"https://base-goerli.g.alchemy.com/v2\"],\n },\n },\n};\nexport const baseSepolia: Chain = {\n ...vbases,\n rpcUrls: {\n ...vbases.rpcUrls,\n alchemy: {\n http: [\"https://base-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const bsc: Chain = {\n ...vbsc,\n rpcUrls: {\n ...vbsc.rpcUrls,\n alchemy: {\n http: [\"https://bnb-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const bscTestnet: Chain = {\n ...vbsct,\n rpcUrls: {\n ...vbsct.rpcUrls,\n alchemy: {\n http: [\"https://bnb-testnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const polygonMumbai: Chain = {\n ...vpgm,\n rpcUrls: {\n ...vpgm.rpcUrls,\n alchemy: {\n http: [\"https://polygon-mumbai.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const polygonAmoy: Chain = {\n ...vpga,\n rpcUrls: {\n ...vpga.rpcUrls,\n alchemy: {\n http: [\"https://polygon-amoy.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const polygon: Chain = {\n ...vpg,\n rpcUrls: {\n ...vpg.rpcUrls,\n alchemy: {\n http: [\"https://polygon-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const fraxtal: Chain = {\n ...vfrax,\n rpcUrls: {\n ...vfrax.rpcUrls,\n },\n};\n\nexport const fraxtalSepolia: Chain = defineChain({\n id: 2523,\n name: \"Fraxtal Sepolia\",\n nativeCurrency: { name: \"Frax Ether\", symbol: \"frxETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://rpc.testnet-sepolia.frax.com\"],\n },\n },\n});\n\nexport const zora: Chain = {\n ...vzora,\n rpcUrls: {\n ...vzora.rpcUrls,\n },\n};\n\nexport const zoraSepolia: Chain = {\n ...vzoras,\n rpcUrls: {\n ...vzoras.rpcUrls,\n },\n};\n\nexport const worldChainSepolia: Chain = {\n ...vwcs,\n rpcUrls: {\n ...vwcs.rpcUrls,\n alchemy: {\n http: [\"https://worldchain-sepolia.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const worldChain: Chain = {\n ...vwc,\n rpcUrls: {\n ...vwc.rpcUrls,\n alchemy: {\n http: [\"https://worldchain-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const shapeSepolia: Chain = defineChain({\n id: 11011,\n name: \"Shape Sepolia\",\n network: \"Shape Sepolia\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://shape-sepolia.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://shape-sepolia.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://shape-sepolia.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const shape: Chain = defineChain({\n id: 360,\n name: \"Shape\",\n network: \"Shape\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://shape-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://shape-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://shape-mainnet.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const unichainMainnet: Chain = defineChain({\n id: 130,\n name: \"Unichain Mainnet\",\n network: \"Unichain Mainnet\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://unichain-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://unichain-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://unichain-mainnet.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const unichainSepolia: Chain = defineChain({\n id: 1301,\n name: \"Unichain Sepolia\",\n network: \"Unichain Sepolia\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://unichain-sepolia.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://unichain-sepolia.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://unichain-sepolia.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const soneiumMinato: Chain = defineChain({\n id: 1946,\n name: \"Soneium Minato\",\n network: \"Soneium Minato\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://soneium-minato.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://soneium-minato.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://soneium-minato.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const soneiumMainnet: Chain = defineChain({\n id: 1868,\n name: \"Soneium Mainnet\",\n network: \"Soneium Mainnet\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://soneium-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://soneium-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://soneium-mainnet.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const opbnbTestnet: Chain = defineChain({\n id: 5611,\n name: \"OPBNB Testnet\",\n network: \"OPBNB Testnet\",\n nativeCurrency: { name: \"BNB\", symbol: \"BNB\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://opbnb-testnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://opbnb-testnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://opbnb-testnet.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const opbnbMainnet: Chain = defineChain({\n id: 204,\n name: \"OPBNB Mainnet\",\n network: \"OPBNB Mainnet\",\n nativeCurrency: { name: \"BNB\", symbol: \"BNB\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://opbnb-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://opbnb-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://opbnb-mainnet.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const beraChainBartio: Chain = defineChain({\n id: 80084,\n name: \"BeraChain Bartio\",\n network: \"BeraChain Bartio\",\n nativeCurrency: { name: \"Bera\", symbol: \"BERA\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://berachain-bartio.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://berachain-bartio.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://berachain-bartio.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const inkMainnet: Chain = defineChain({\n id: 57073,\n name: \"Ink Mainnet\",\n network: \"Ink Mainnet\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://ink-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://ink-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://ink-mainnet.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const inkSepolia: Chain = defineChain({\n id: 763373,\n name: \"Ink Sepolia\",\n network: \"Ink Sepolia\",\n nativeCurrency: { name: \"Ether\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://ink-sepolia.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://ink-sepolia.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://ink-sepolia.g.alchemy.com/v2\"],\n },\n },\n});\n\nexport const monadTestnet: Chain = defineChain({\n id: 10143,\n name: \"Monad Testnet\",\n nativeCurrency: { name: \"Monad\", symbol: \"MON\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://monad-testnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://monad-testnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://monad-testnet.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://testnet.monadexplorer.com\",\n },\n },\n testnet: true,\n});\n\nexport const monadMainnet: Chain = defineChain({\n id: 143,\n name: \"Monad Mainnet\",\n nativeCurrency: { name: \"Monad\", symbol: \"MON\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://monad-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://monad-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://monad-mainnet.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://mainnet-beta.monvision.io\",\n },\n },\n testnet: false,\n});\n\nexport const mekong: Chain = defineChain({\n id: 7078815900,\n name: \"Mekong Pectra Devnet\",\n nativeCurrency: { name: \"eth\", symbol: \"eth\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://rpc.mekong.ethpandaops.io\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://explorer.mekong.ethpandaops.io\",\n },\n },\n testnet: true,\n});\n\nexport const openlootSepolia: Chain = defineChain({\n id: 905905,\n name: \"Openloot Sepolia\",\n nativeCurrency: { name: \"Openloot\", symbol: \"OL\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://openloot-sepolia.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://openloot-sepolia.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://openloot-sepolia.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://openloot-sepolia.explorer.alchemy.com\",\n },\n },\n testnet: true,\n});\n\nexport const gensynTestnet: Chain = defineChain({\n id: 685685,\n name: \"Gensyn Testnet\",\n nativeCurrency: { name: \"eth\", symbol: \"eth\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://gensyn-testnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://gensyn-testnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://gensyn-testnet.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://gensyn-testnet.explorer.alchemy.com\",\n },\n },\n testnet: true,\n});\n\nexport const riseTestnet: Chain = defineChain({\n id: 11155931,\n name: \"Rise Testnet\",\n nativeCurrency: { name: \"eth\", symbol: \"eth\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://rise-testnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://rise-testnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://rise-testnet.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://explorer.testnet.riselabs.xyz\",\n },\n },\n testnet: true,\n});\n\nexport const storyMainnet: Chain = defineChain({\n id: 1514,\n name: \"Story Mainnet\",\n nativeCurrency: { name: \"IP\", symbol: \"IP\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://story-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://story-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://story-mainnet.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://www.storyscan.io\",\n },\n },\n testnet: false,\n});\n\nexport const storyAeneid: Chain = defineChain({\n id: 1315,\n name: \"Story Aeneid\",\n nativeCurrency: { name: \"IP\", symbol: \"IP\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://story-aeneid.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://story-aeneid.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://story-aeneid.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://aeneid.storyscan.io\",\n },\n },\n testnet: true,\n});\n\nexport const celoMainnet: Chain = defineChain({\n id: 42220,\n name: \"Celo Mainnet\",\n nativeCurrency: { name: \"Celo native asset\", symbol: \"CELO\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://celo-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://celo-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://celo-mainnet.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://celo.blockscout.com/\",\n },\n },\n testnet: false,\n});\n\nexport const celoSepolia: Chain = defineChain({\n id: 11142220,\n name: \"Celo Sepolia\",\n nativeCurrency: { name: \"Celo native asset\", symbol: \"CELO\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://celo-sepolia.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://celo-sepolia.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://celo-sepolia.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://celo-sepolia.blockscout.com/\",\n },\n },\n testnet: true,\n});\n\nexport const teaSepolia: Chain = defineChain({\n id: 10218,\n name: \"Tea Sepolia\",\n nativeCurrency: { name: \"TEA\", symbol: \"TEA\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://tea-sepolia.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://tea-sepolia.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://tea-sepolia.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://sepolia.tea.xyz/\",\n },\n },\n testnet: true,\n});\n\nexport const bobaSepolia: Chain = defineChain({\n id: 28882,\n name: \"Boba Sepolia\",\n nativeCurrency: { name: \"eth\", symbol: \"eth\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://boba-sepolia.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://boba-sepolia.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://boba-sepolia.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://sepolia.testnet.bobascan.com/\",\n },\n },\n testnet: true,\n});\n\nexport const bobaMainnet: Chain = defineChain({\n id: 288,\n name: \"Boba Mainnet\",\n nativeCurrency: { name: \"eth\", symbol: \"eth\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://boba-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://boba-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://boba-mainnet.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://bobascan.com/\",\n },\n },\n testnet: false,\n});\n\nexport const edgeMainnet: Chain = defineChain({\n id: 3343,\n name: \"Edge Mainnet\",\n nativeCurrency: { name: \"eth\", symbol: \"eth\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://edge-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://edge-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://edge-mainnet.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://edge-mainnet.blockscout.com/\",\n },\n },\n testnet: false,\n});\n\nexport const worldl3devnet: Chain = defineChain({\n id: 48011,\n name: \"WorldL3 Devnet\",\n nativeCurrency: { name: \"eth\", symbol: \"eth\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://worldl3-devnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://worldl3-devnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://worldl3-devnet.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://worldl3-devnet.blockscout.com/\",\n },\n },\n testnet: true,\n});\n\nexport const stableMainnet: Chain = defineChain({\n id: 988,\n name: \"Stable Mainnet\",\n nativeCurrency: { name: \"gUSDT\", symbol: \"gUSDT\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://stable-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://stable-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://stable-mainnet.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://stablescan.xyz/\",\n },\n },\n testnet: false,\n});\n\nexport const mythosMainnet: Chain = defineChain({\n id: 42018,\n name: \"Mythos Mainnet\",\n nativeCurrency: { name: \"eth\", symbol: \"eth\", decimals: 18 },\n rpcUrls: {\n default: {\n http: [\"https://mythos-mainnet.g.alchemy.com/v2\"],\n },\n public: {\n http: [\"https://mythos-mainnet.g.alchemy.com/v2\"],\n },\n alchemy: {\n http: [\"https://mythos-mainnet.g.alchemy.com/v2\"],\n },\n },\n blockExplorers: {\n default: {\n name: \"Block Explorer\",\n url: \"https://mythos-mainnet.explorer.alchemy.com/\",\n },\n },\n testnet: false,\n});\n\nexport const hyperliquid: Chain = {\n ...vhyperliquid,\n rpcUrls: {\n ...vhyperliquid.rpcUrls,\n alchemy: {\n http: [\"https://hyperliquid-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const hyperliquidEvmTestnet: Chain = {\n ...vhyperliquidEvmTestnet,\n rpcUrls: {\n ...vhyperliquidEvmTestnet.rpcUrls,\n alchemy: {\n http: [\"https://hyperliquid-testnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const cronos: Chain = {\n ...vCronos,\n rpcUrls: {\n ...vCronos.rpcUrls,\n alchemy: {\n http: [\"https://cronos-mainnet.g.alchemy.com/v2\"],\n },\n },\n};\n\nexport const cronosTestnet: Chain = {\n ...vCronosTesnet,\n rpcUrls: {\n ...vCronosTesnet.rpcUrls,\n alchemy: {\n http: [\"https://cronos-testnet.g.alchemy.com/v2\"],\n },\n },\n};\n","import type { InnerLogger } from \"./types\";\n\nexport const noopLogger: InnerLogger<any> = {\n trackEvent: async () => {},\n _internal: {\n ready: Promise.resolve(),\n anonId: \"\",\n },\n};\n","import { noopLogger } from \"./noop.js\";\nimport type { EventLogger, EventsSchema, LoggerContext } from \"./types\";\n\nexport type * from \"./types.js\";\n\nexport function createLogger<Schema extends EventsSchema = []>(\n context: LoggerContext,\n): EventLogger<Schema>;\n\nexport function createLogger(_context: LoggerContext): EventLogger {\n // We are currently not logging events from the SDK (as Sept 2, 2025), so\n // a no-op logger is always used. This will be further explored in v5.\n const innerLogger = noopLogger;\n\n const logger: EventLogger = {\n ...innerLogger,\n profiled<TArgs extends any[], TRet>(\n name: string,\n func: (...args: TArgs) => TRet,\n ): (...args: TArgs) => TRet {\n return function (this: any, ...args: TArgs): TRet {\n const start = Date.now();\n const result = func.apply(this, args);\n if (result instanceof Promise) {\n return result.then((res) => {\n innerLogger.trackEvent({\n name: \"performance\",\n data: {\n executionTimeMs: Date.now() - start,\n functionName: name,\n },\n });\n\n return res;\n }) as TRet;\n }\n\n innerLogger.trackEvent({\n name: \"performance\",\n data: {\n executionTimeMs: Date.now() - start,\n functionName: name,\n },\n });\n return result;\n };\n },\n };\n\n return logger;\n}\n","import { createLogger } from \"@account-kit/logging\";\nimport type { Address } from \"viem\";\nimport { VERSION } from \"./version.js\";\n\nexport type InfraEventsSchema = [\n {\n EventName: \"client_send_uo\";\n EventData: {\n signerType: string;\n chainId: number;\n entryPoint: Address;\n };\n },\n];\n\nexport const InfraLogger = createLogger<InfraEventsSchema>({\n package: \"@account-kit/infra\",\n version: VERSION,\n});\n","import {\n isSmartAccountWithSigner,\n sendTransaction,\n sendTransactions,\n sendUserOperation,\n type GetEntryPointFromAccount,\n type SendTransactionsParameters,\n type SendUserOperationParameters,\n type SendUserOperationResult,\n type SmartContractAccount,\n type UserOperationContext,\n type UserOperationOverrides,\n clientHeaderTrack,\n} from \"@aa-sdk/core\";\nimport type {\n Chain,\n Client,\n Hex,\n SendTransactionParameters,\n Transport,\n} from \"viem\";\nimport { simulateUserOperationChanges } from \"../../actions/simulateUserOperationChanges.js\";\nimport type { SimulateUserOperationAssetChangesResponse } from \"../../actions/types.js\";\nimport { InfraLogger } from \"../../metrics.js\";\n\nexport type AlchemySmartAccountClientActions<\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n TChain extends Chain | undefined = Chain | undefined,\n TEntryPointVersion extends\n GetEntryPointFromAccount<TAccount> = GetEntryPointFromAccount<TAccount>,\n> = {\n simulateUserOperation: (\n args: SendUserOperationParameters<TAccount, TContext>,\n ) => Promise<SimulateUserOperationAssetChangesResponse>;\n sendUserOperation: (\n args: SendUserOperationParameters<\n TAccount,\n TContext,\n GetEntryPointFromAccount<TAccount>\n >,\n ) => Promise<SendUserOperationResult<TEntryPointVersion>>;\n sendTransaction: <TChainOverride extends Chain | undefined = undefined>(\n args: SendTransactionParameters<TChain, TAccount, TChainOverride>,\n overrides?: UserOperationOverrides<TEntryPointVersion>,\n context?: TContext,\n ) => Promise<Hex>;\n sendTransactions: (\n args: SendTransactionsParameters<TAccount, TContext>,\n ) => Promise<Hex>;\n};\n\n/**\n * Provides a set of actions for interacting with the Alchemy Smart Account client, including the ability to simulate user operations.\n *\n * @example\n * ```ts\n * import { alchemyActions } from \"@account-kit/infra\";\n * import { createPublicClient } from \"viem\";\n *\n * const client = createPublicClient(...);\n * const clientWithAlchemyActions = client.extend(alchemyActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client_ The client instance used to perform actions\n * @returns {AlchemySmartAccountClientActions<TAccount, TContext>} An object containing Alchemy Smart Account client actions\n */\nexport const alchemyActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n) => AlchemySmartAccountClientActions<TAccount, TContext, TChain> = (\n client_,\n) => ({\n simulateUserOperation: async (args) => {\n const client = clientHeaderTrack(client_, \"simulateUserOperation\");\n return simulateUserOperationChanges(client, args);\n },\n async sendUserOperation(args) {\n const client = clientHeaderTrack(client_, \"infraSendUserOperation\");\n const { account = client.account } = args;\n\n const result = sendUserOperation(client, args);\n logSendUoEvent(client.chain!.id, account!);\n return result;\n },\n sendTransaction: async (args, overrides, context) => {\n const client = clientHeaderTrack(client_, \"sendTransaction\");\n const { account = client.account } = args;\n\n const result = await sendTransaction(client, args, overrides, context);\n logSendUoEvent(client.chain!.id, account as SmartContractAccount);\n return result;\n },\n async sendTransactions(args) {\n const client = clientHeaderTrack(client_, \"sendTransactions\");\n const { account = client.account } = args;\n\n const result = sendTransactions(client, args);\n logSendUoEvent(client.chain!.id, account!);\n return result;\n },\n});\n\nfunction logSendUoEvent(chainId: number, account: SmartContractAccount) {\n const signerType = isSmartAccountWithSigner(account)\n ? account.getSigner().signerType\n : \"unknown\";\n\n InfraLogger.trackEvent({\n name: \"client_send_uo\",\n data: {\n chainId,\n signerType: signerType,\n entryPoint: account.getEntryPoint().address,\n },\n });\n}\n","import { type UserOperationFeeOptions } from \"@aa-sdk/core\";\nimport type { Chain } from \"viem\";\nimport {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n optimism,\n optimismGoerli,\n optimismSepolia,\n} from \"./chains.js\";\n\n/**\n * Retrieves the default user operation fee options for a given chain. Adjusts fees for specific chains like Arbitrum and Optimism.\n *\n * @example\n * ```ts\n * import { getDefaultUserOperationFeeOptions } from \"@account-kit/infra\";\n * import { arbitrum } from \"@account-kit/infra\";\n *\n * const feeOpts = getDefaultUserOperationFeeOptions(arbitrum);\n * ```\n *\n * @param {Chain} chain The blockchain chain for which to get the fee options\n * @returns {UserOperationFeeOptions} An object containing the default fee options for user operations on the specified chain\n */\nexport const getDefaultUserOperationFeeOptions = (\n chain: Chain,\n): UserOperationFeeOptions => {\n const feeOptions: UserOperationFeeOptions = {\n maxFeePerGas: { multiplier: 1.5 },\n maxPriorityFeePerGas: { multiplier: 1.05 },\n };\n\n if (\n new Set<number>([\n arbitrum.id,\n arbitrumGoerli.id,\n arbitrumSepolia.id,\n optimism.id,\n optimismGoerli.id,\n optimismSepolia.id,\n ]).has(chain.id)\n ) {\n feeOptions.preVerificationGas = { multiplier: 1.05 };\n }\n\n return feeOptions;\n};\n","import type { ClientMiddlewareFn } from \"@aa-sdk/core\";\nimport {\n applyUserOpOverrideOrFeeOption,\n bigIntMultiply,\n clientHeaderTrack,\n} from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"../alchemyTransport\";\n\n/**\n * Function that estimates the transaction fees using Alchemy methods for a given client.\n * It fetches the latest block and estimates the max priority fee per gas, applying any overrides or fee options provided.\n *\n * @example\n * ```ts\n * import { alchemyFeeEstimator, alchemy } from \"@account-kit/infra\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const alchemyTransport = alchemy({\n * chain: sepolia,\n * apiKey: \"your-api-key\"\n * });\n *\n * const client = createSmartAccountClient({\n * feeEstimator: alchemyFeeEstimator(alchemyTransport),\n * ...otherParams\n * });\n * ```\n *\n * @param {AlchemyTransport} transport An alchemy transport for making Alchemy specific RPC calls\n * @returns {ClientMiddlewareFn} A middleware function that takes a transaction structure and fee options, and returns the augmented structure with estimated fees\n */\nexport const alchemyFeeEstimator: (\n transport: AlchemyTransport,\n) => ClientMiddlewareFn =\n (transport) =>\n async (struct, { overrides, feeOptions, client: client_ }) => {\n const client = clientHeaderTrack(client_, \"alchemyFeeEstimator\");\n const transport_ = transport({ chain: client.chain });\n let [block, maxPriorityFeePerGasEstimate] = await Promise.all([\n client.getBlock({ blockTag: \"latest\" }),\n // it is a fair assumption that if someone is using this Alchemy Middleware, then they are using Alchemy RPC\n transport_.request({\n method: \"rundler_maxPriorityFeePerGas\",\n params: [],\n }),\n ]);\n\n const baseFeePerGas = block.baseFeePerGas;\n if (baseFeePerGas == null) {\n throw new Error(\"baseFeePerGas is null\");\n }\n\n const maxPriorityFeePerGas = applyUserOpOverrideOrFeeOption(\n maxPriorityFeePerGasEstimate,\n overrides?.maxPriorityFeePerGas,\n feeOptions?.maxPriorityFeePerGas,\n );\n const maxFeePerGas = applyUserOpOverrideOrFeeOption(\n bigIntMultiply(baseFeePerGas, 1.5) + BigInt(maxPriorityFeePerGas),\n overrides?.maxFeePerGas,\n feeOptions?.maxFeePerGas,\n );\n\n return {\n ...struct,\n maxPriorityFeePerGas,\n maxFeePerGas,\n };\n };\n","import { encodeFunctionData, type Address, type Chain, type Hex } from \"viem\";\nimport {\n arbitrum,\n arbitrumSepolia,\n base,\n baseSepolia,\n fraxtal,\n fraxtalSepolia,\n mainnet,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n unichainSepolia,\n worldChainSepolia,\n sepolia,\n zora,\n zoraSepolia,\n shapeSepolia,\n optimismGoerli,\n arbitrumGoerli,\n baseGoerli,\n beraChainBartio,\n celoMainnet,\n gensynTestnet,\n goerli,\n inkMainnet,\n inkSepolia,\n monadTestnet,\n opbnbMainnet,\n opbnbTestnet,\n openlootSepolia,\n polygonMumbai,\n riseTestnet,\n shape,\n soneiumMainnet,\n soneiumMinato,\n storyAeneid,\n storyMainnet,\n teaSepolia,\n unichainMainnet,\n worldChain,\n} from \"./chains.js\";\nimport type { EntryPointVersion } from \"@aa-sdk/core\";\nexport const AlchemyPaymasterAddressV06Unify =\n \"0x0000000000ce04e2359130e7d0204A5249958921\";\nexport const AlchemyPaymasterAddressV07Unify =\n \"0x00000000000667F27D4DB42334ec11a25db7EBb4\";\n\nexport const AlchemyPaymasterAddressV4 =\n \"0xEaf0Cde110a5d503f2dD69B3a49E031e29b3F9D2\";\nexport const AlchemyPaymasterAddressV3 =\n \"0x4f84a207A80c39E9e8BaE717c1F25bA7AD1fB08F\";\nexport const AlchemyPaymasterAddressV2 =\n \"0x4Fd9098af9ddcB41DA48A1d78F91F1398965addc\";\nexport const ArbSepoliaPaymasterAddress =\n \"0x0804Afe6EEFb73ce7F93CD0d5e7079a5a8068592\";\nexport const AlchemyPaymasterAddressV1 =\n \"0xc03aac639bb21233e0139381970328db8bceeb67\";\n\nexport const AlchemyPaymasterAddressV07V2 =\n \"0x2cc0c7981D846b9F2a16276556f6e8cb52BfB633\";\nexport const AlchemyPaymasterAddressV07V1 =\n \"0xEF725Aa22d43Ea69FB22bE2EBe6ECa205a6BCf5B\";\n\n/**\n * Retrieves the Alchemy paymaster address for the given chain. Returns different addresses based on the chain ID.\n *\n * @example\n * ```ts\n * import { sepolia, getAlchemyPaymasterAddress } from \"@account-kit/infra\";\n *\n * const paymasterAddress = getAlchemyPaymasterAddress(sepolia, \"0.6.0\");\n * ```\n *\n * @param {Chain} chain The chain for which the paymaster address is required\n * @param {EntryPointVersion} version The version of the entry point\n * @returns {Address} The Alchemy paymaster address corresponding to the specified chain\n */\nexport const getAlchemyPaymasterAddress = (\n chain: Chain,\n version: EntryPointVersion,\n): Address => {\n switch (version) {\n case \"0.6.0\":\n switch (chain.id) {\n case fraxtalSepolia.id:\n case worldChainSepolia.id:\n case shapeSepolia.id:\n case unichainSepolia.id:\n case opbnbTestnet.id:\n case inkSepolia.id:\n case monadTestnet.id:\n case openlootSepolia.id:\n case gensynTestnet.id:\n case riseTestnet.id:\n case storyAeneid.id:\n case teaSepolia.id:\n case arbitrumGoerli.id:\n case goerli.id:\n case optimismGoerli.id:\n case baseGoerli.id:\n case polygonMumbai.id:\n case worldChain.id:\n case shape.id:\n case unichainMainnet.id:\n case soneiumMinato.id:\n case soneiumMainnet.id:\n case opbnbMainnet.id:\n case beraChainBartio.id:\n case inkMainnet.id:\n case storyMainnet.id:\n case celoMainnet.id:\n return AlchemyPaymasterAddressV4;\n case polygonAmoy.id:\n case optimismSepolia.id:\n case baseSepolia.id:\n case zora.id:\n case zoraSepolia.id:\n case fraxtal.id:\n return AlchemyPaymasterAddressV3;\n case mainnet.id:\n case arbitrum.id:\n case optimism.id:\n case polygon.id:\n case base.id:\n return AlchemyPaymasterAddressV2;\n case arbitrumSepolia.id:\n return ArbSepoliaPaymasterAddress;\n case sepolia.id:\n return AlchemyPaymasterAddressV1;\n default:\n return AlchemyPaymasterAddressV06Unify;\n }\n case \"0.7.0\":\n switch (chain.id) {\n case celoMainnet.id:\n case gensynTestnet.id:\n case inkMainnet.id:\n case inkSepolia.id:\n case monadTestnet.id:\n case opbnbMainnet.id:\n case opbnbTestnet.id:\n case openlootSepolia.id:\n case riseTestnet.id:\n case shape.id:\n case shapeSepolia.id:\n case soneiumMainnet.id:\n case soneiumMinato.id:\n case storyAeneid.id:\n case storyMainnet.id:\n case teaSepolia.id:\n case unichainMainnet.id:\n case unichainSepolia.id:\n case worldChain.id:\n case worldChainSepolia.id:\n return AlchemyPaymasterAddressV07V1;\n case arbitrum.id:\n case arbitrumGoerli.id:\n case arbitrumSepolia.id:\n case base.id:\n case baseGoerli.id:\n case baseSepolia.id:\n case beraChainBartio.id:\n case fraxtal.id:\n case fraxtalSepolia.id:\n case goerli.id:\n case mainnet.id:\n case optimism.id:\n case optimismGoerli.id:\n case optimismSepolia.id:\n case polygon.id:\n case polygonAmoy.id:\n case polygonMumbai.id:\n case sepolia.id:\n case zora.id:\n case zoraSepolia.id:\n return AlchemyPaymasterAddressV07V2;\n default:\n return AlchemyPaymasterAddressV07Unify;\n }\n default:\n throw new Error(`Unsupported EntryPointVersion: ${version}`);\n }\n};\n\nexport const PermitTypes = {\n EIP712Domain: [\n { name: \"name\", type: \"string\" },\n { name: \"version\", type: \"string\" },\n { name: \"chainId\", type: \"uint256\" },\n { name: \"verifyingContract\", type: \"address\" },\n ],\n Permit: [\n { name: \"owner\", type: \"address\" },\n { name: \"spender\", type: \"address\" },\n { name: \"value\", type: \"uint256\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n} as const;\n\nexport const ERC20Abis = [\n \"function decimals() public view returns (uint8)\",\n \"function balanceOf(address owner) external view returns (uint256)\",\n \"function allowance(address owner, address spender) external view returns (uint256)\",\n \"function approve(address spender, uint256 amount) external returns (bool)\",\n] as const;\n\nexport const EIP7597Abis = [\n \"function nonces(address owner) external view returns (uint)\",\n] as const;\n\nexport const approveTokenCallData = (\n paymasterAddress: Address,\n allowance: BigInt,\n) => {\n return encodeFunctionData({\n abi: ERC20Abis,\n functionName: \"approve\",\n args: [paymasterAddress, allowance],\n });\n};\n\nexport type PermitMessage = {\n owner: Hex;\n spender: Hex;\n value: bigint;\n nonce: bigint;\n deadline: bigint;\n};\n\nexport type PermitDomain = {\n name: string;\n version: string;\n chainId: bigint;\n verifyingContract: Hex;\n};\n","import { BaseError as CoreBaseError } from \"@aa-sdk/core\";\nimport { VERSION } from \"../version.js\";\n\nexport abstract class BaseError extends CoreBaseError {\n // This version could be different from the aa-core version so we overwrite this here.\n override version = VERSION;\n}\n","import { BaseError } from \"./base.js\";\n\nexport class InvalidSignedPermit extends BaseError {\n override name = \"InvalidSignedPermit\";\n\n constructor(reason: string) {\n super([\"Invalid signed permit\"].join(\"\\n\"), {\n details: [reason, \"Please provide a valid signed permit\"].join(\"\\n\"),\n });\n }\n}\n","import type {\n Address,\n ClientMiddlewareConfig,\n ClientMiddlewareFn,\n EntryPointVersion,\n Multiplier,\n SmartContractAccount,\n UserOperationContext,\n UserOperationFeeOptions,\n UserOperationOverrides,\n UserOperationRequest,\n} from \"@aa-sdk/core\";\nimport {\n bypassPaymasterAndData,\n ChainNotFoundError,\n clientHeaderTrack,\n deepHexlify,\n defaultGasEstimator,\n erc7677Middleware,\n filterUndefined,\n isBigNumberish,\n isMultiplier,\n noopMiddleware,\n resolveProperties,\n} from \"@aa-sdk/core\";\nimport {\n fromHex,\n isHex,\n type Hex,\n encodeAbiParameters,\n encodeFunctionData,\n parseAbi,\n} from \"viem\";\nimport type { AlchemySmartAccountClient } from \"../client/smartAccountClient.js\";\nimport type { AlchemyTransport } from \"../alchemyTransport.js\";\nimport { alchemyFeeEstimator } from \"./feeEstimator.js\";\nimport type { RequestGasAndPaymasterAndDataRequest } from \"../actions/types.js\";\n\nimport {\n PermitTypes,\n EIP7597Abis,\n ERC20Abis,\n getAlchemyPaymasterAddress,\n} from \"../gas-manager.js\";\nimport type { PermitMessage, PermitDomain } from \"../gas-manager.js\";\nimport type { MiddlewareClient } from \"@aa-sdk/core\";\nimport { InvalidSignedPermit } from \"../errors/invalidSignedPermit.js\";\n\nexport type PaymasterContext = {\n policyId: string | string[];\n erc20Context?: {\n tokenAddress: Address;\n maxTokenAmount?: bigint;\n permit?: Hex;\n };\n webhookData?: string;\n};\n\nexport type PolicyToken = {\n address: Address;\n maxTokenAmount: bigint;\n permit?: {\n paymasterAddress?: Address;\n autoPermitApproveTo: bigint;\n autoPermitBelow: bigint;\n erc20Name: string;\n version: string;\n };\n};\n\n/**\n * Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring\n * transactions. Adheres to the ERC-7677 standardized communication protocol.\n *\n * @example\n * ```ts\n * import { sepolia, alchemyGasManagerMiddleware } from \"@account-kit/infra\";\n * import { http } from \"viem\";\n *\n * const client = createSmartAccountClient({\n * transport: http(\"rpc-url\"),\n * chain: sepolia,\n * ...alchemyGasManagerMiddleware(\"policyId\")\n * });\n * ```\n *\n * @param {string | string[]} policyId - The policyId (or list of policyIds) for Alchemy's gas manager\n * @param {PolicyToken | undefined} policyToken - The policy token configuration\n * @param {string | undefined} webhookData - The webhook data to include in the request\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">} Partial client middleware configuration containing `dummyPaymasterAndData` and `paymasterAndData`\n */\nexport function alchemyGasManagerMiddleware(\n policyId: string | string[],\n policyToken?: PolicyToken,\n webhookData?: string,\n): Required<\n Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"paymasterAndData\">\n> {\n const buildContext = async (\n args: Parameters<ClientMiddlewareFn>[1],\n ): Promise<PaymasterContext> => {\n const context: PaymasterContext = { policyId };\n\n const { account, client } = args;\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n if (policyToken !== undefined) {\n context.erc20Context = {\n tokenAddress: policyToken.address,\n maxTokenAmount: policyToken.maxTokenAmount,\n };\n\n if (policyToken.permit !== undefined) {\n const permit = await generateSignedPermit(client, account, policyToken);\n if (permit !== undefined) {\n context.erc20Context.permit = permit;\n }\n } else if (args.context !== undefined) {\n context.erc20Context.permit = extractSignedPermitFromContext(\n args.context,\n );\n }\n }\n\n if (webhookData !== undefined) {\n context.webhookData = webhookData;\n }\n\n return context;\n };\n return {\n dummyPaymasterAndData: async (uo, args) => {\n const context = await buildContext(args);\n const baseMiddleware = erc7677Middleware({ context });\n return baseMiddleware.dummyPaymasterAndData(uo, args);\n },\n\n paymasterAndData: async (uo, args) => {\n const context = await buildContext(args);\n const baseMiddleware = erc7677Middleware({ context });\n return baseMiddleware.paymasterAndData(uo, args);\n },\n };\n}\n\ninterface AlchemyGasAndPaymasterAndDataMiddlewareParams {\n policyId: string | string[];\n policyToken?: PolicyToken;\n webhookData?: string;\n transport: AlchemyTransport;\n gasEstimatorOverride?: ClientMiddlewareFn;\n feeEstimatorOverride?: ClientMiddlewareFn;\n}\n\n/**\n * Paymaster middleware factory that uses Alchemy's Gas Manager for sponsoring\n * transactions. Uses Alchemy's custom `alchemy_requestGasAndPaymasterAndData`\n * method instead of conforming to the standard ERC-7677 interface. Note that\n * if you use `createAlchemySmartAccountClient`, this middleware is already\n * used by default and you do not need to manually include it.\n *\n * @example\n * ```ts twoslash\n * import { sepolia, alchemy, alchemyGasAndPaymasterAndDataMiddleware } from \"@account-kit/infra\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const client = createSmartAccountClient({\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * chain: sepolia,\n * ...alchemyGasAndPaymasterAndDataMiddleware({\n * policyId: \"policyId\",\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * })\n * });\n * ```\n *\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams} params configuration params\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams.policyId} params.policyId the policyId for Alchemy's gas manager\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams.transport} params.transport fallback transport to use for fee estimation when not using the paymaster\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams.gasEstimatorOverride} params.gasEstimatorOverride custom gas estimator middleware\n * @param {AlchemyGasAndPaymasterAndDataMiddlewareParams.feeEstimatorOverride} params.feeEstimatorOverride custom fee estimator middleware\n * @returns {Pick<ClientMiddlewareConfig, \"dummyPaymasterAndData\" | \"feeEstimator\" | \"gasEstimator\" | \"paymasterAndData\">} partial client middleware configuration containing `dummyPaymasterAndData`, `feeEstimator`, `gasEstimator`, and `paymasterAndData`\n */\nexport function alchemyGasAndPaymasterAndDataMiddleware(\n params: AlchemyGasAndPaymasterAndDataMiddlewareParams,\n): Pick<\n ClientMiddlewareConfig,\n \"dummyPaymasterAndData\" | \"feeEstimator\" | \"gasEstimator\" | \"paymasterAndData\"\n> {\n const {\n policyId,\n policyToken,\n transport,\n webhookData,\n gasEstimatorOverride,\n feeEstimatorOverride,\n } = params;\n return {\n dummyPaymasterAndData: async (uo, args) => {\n if (\n // No reason to generate dummy data if we are bypassing the paymaster.\n bypassPaymasterAndData(args.overrides) ||\n // When using alchemy_requestGasAndPaymasterAndData, there is generally no reason to generate dummy\n // data. However, if the gas/feeEstimator is overriden, then this option should be enabled.\n !(gasEstimatorOverride || feeEstimatorOverride)\n ) {\n return noopMiddleware(uo, args);\n }\n\n // Fall back to the default 7677 dummyPaymasterAndData middleware.\n return alchemyGasManagerMiddleware(\n policyId,\n policyToken,\n webhookData,\n ).dummyPaymasterAndData(uo, args);\n },\n feeEstimator: (uo, args) => {\n return feeEstimatorOverride\n ? feeEstimatorOverride(uo, args)\n : bypassPaymasterAndData(args.overrides)\n ? alchemyFeeEstimator(transport)(uo, args)\n : noopMiddleware(uo, args);\n },\n gasEstimator: (uo, args) => {\n return gasEstimatorOverride\n ? gasEstimatorOverride(uo, args)\n : bypassPaymasterAndData(args.overrides)\n ? defaultGasEstimator(args.client)(uo, args)\n : noopMiddleware(uo, args);\n },\n paymasterAndData: async (\n uo,\n {\n account,\n client: client_,\n feeOptions,\n overrides: overrides_,\n context: uoContext,\n },\n ) => {\n const client = clientHeaderTrack(client_, \"alchemyFeeEstimator\");\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n\n const userOp = deepHexlify(await resolveProperties(uo));\n\n const overrides: UserOperationOverrides = filterUndefined({\n maxFeePerGas: overrideField(\n \"maxFeePerGas\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp,\n ),\n maxPriorityFeePerGas: overrideField(\n \"maxPriorityFeePerGas\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp,\n ),\n callGasLimit: overrideField(\n \"callGasLimit\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp,\n ),\n verificationGasLimit: overrideField(\n \"verificationGasLimit\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp,\n ),\n preVerificationGas: overrideField(\n \"preVerificationGas\",\n overrides_ as UserOperationOverrides,\n feeOptions,\n userOp,\n ),\n ...(account.getEntryPoint().version === \"0.7.0\"\n ? {\n paymasterVerificationGasLimit: overrideField<\"0.7.0\">(\n \"paymasterVerificationGasLimit\",\n overrides_ as UserOperationOverrides<\"0.7.0\">,\n feeOptions,\n userOp,\n ),\n paymasterPostOpGasLimit: overrideField<\"0.7.0\">(\n \"paymasterPostOpGasLimit\",\n overrides_ as UserOperationOverrides<\"0.7.0\">,\n feeOptions,\n userOp,\n ),\n }\n : {}),\n });\n\n let erc20Context: RequestGasAndPaymasterAndDataRequest[0][\"erc20Context\"] =\n undefined;\n if (policyToken !== undefined) {\n erc20Context = {\n tokenAddress: policyToken.address,\n maxTokenAmount: policyToken.maxTokenAmount,\n };\n if (policyToken.permit !== undefined) {\n const permit = await generateSignedPermit(\n client,\n account,\n policyToken,\n );\n if (permit !== undefined) {\n erc20Context.permit = permit;\n }\n } else if (uoContext !== undefined) {\n erc20Context.permit = extractSignedPermitFromContext(uoContext);\n }\n }\n\n const result = await (client as AlchemySmartAccountClient).request({\n method: \"alchemy_requestGasAndPaymasterAndData\",\n params: [\n {\n policyId,\n entryPoint: account.getEntryPoint().address,\n userOperation: userOp,\n dummySignature: await account.getDummySignature(),\n overrides,\n webhookData,\n ...(erc20Context\n ? {\n erc20Context,\n }\n : {}),\n },\n ],\n });\n\n return {\n ...uo,\n ...result,\n };\n },\n };\n}\n\n/**\n * Utility function to override a field in the user operation request with the overrides or fee options\n *\n * @template {EntryPointVersion} TEntryPointVersion\n * @param {keyof UserOperationFeeOptions<TEntryPointVersion>} field the field to override\n * @param {UserOperationOverrides<TEntryPointVersion> | undefined} overrides the overrides object\n * @param {UserOperationFeeOptions<TEntryPointVersion> | undefined} feeOptions the fee options object from the client\n * @param {UserOperationRequest<TEntryPointVersion>} userOperation the user operation request\n * @returns {Hex | Multiplier | undefined} the overridden field value\n */\nconst overrideField = <\n TEntryPointVersion extends EntryPointVersion = EntryPointVersion,\n>(\n field: keyof UserOperationFeeOptions<TEntryPointVersion>,\n overrides: UserOperationOverrides<TEntryPointVersion> | undefined,\n feeOptions: UserOperationFeeOptions<TEntryPointVersion> | undefined,\n userOperation: UserOperationRequest<TEntryPointVersion>,\n): Hex | Multiplier | undefined => {\n let _field = field as keyof UserOperationOverrides<TEntryPointVersion>;\n\n if (overrides?.[_field] != null) {\n // one-off absolute override\n if (isBigNumberish(overrides[_field])) {\n return deepHexlify(overrides[_field]);\n }\n // one-off multiplier overrides\n else {\n return {\n multiplier: Number((overrides[_field] as Multiplier).multiplier),\n };\n }\n }\n\n // provider level fee options with multiplier\n if (isMultiplier(feeOptions?.[field])) {\n return {\n multiplier: Number((feeOptions![field] as Multiplier).multiplier),\n };\n }\n\n const userOpField =\n userOperation[field as keyof UserOperationRequest<TEntryPointVersion>];\n if (isHex(userOpField) && fromHex(userOpField as Hex, \"bigint\") > 0n) {\n return userOpField;\n }\n return undefined;\n};\n\n/**\n * Utility function to generate a signed Permit for erc20 transaction\n *\n * @param {MiddlewareClient} client - The Alchemy smart account client\n * @param {TAccount} account - The smart account instance\n * @param {PolicyToken} policyToken - The policy token configuration\n * @returns {Promise<Hex>} Returns a Promise containing the signed EIP2612 permit\n */\nconst generateSignedPermit = async <TAccount extends SmartContractAccount>(\n client: MiddlewareClient,\n account: TAccount,\n policyToken: PolicyToken,\n): Promise<Hex | undefined> => {\n if (!client.chain) {\n throw new ChainNotFoundError();\n }\n if (!policyToken.permit) {\n throw new Error(\"permit is missing\");\n }\n\n if (!policyToken.permit?.erc20Name || !policyToken.permit?.version) {\n throw new Error(\"erc20Name or version is missing\");\n }\n\n const paymasterAddress =\n policyToken.permit.paymasterAddress ??\n getAlchemyPaymasterAddress(client.chain, account.getEntryPoint().version);\n\n if (paymasterAddress === undefined || paymasterAddress === \"0x\") {\n throw new Error(\"no paymaster contract address available\");\n }\n\n let allowanceFuture = client.call({\n to: policyToken.address,\n data: encodeFunctionData({\n abi: parseAbi(ERC20Abis),\n functionName: \"allowance\",\n args: [account.address, paymasterAddress],\n }),\n });\n\n let nonceFuture = client.call({\n to: policyToken.address,\n data: encodeFunctionData({\n abi: parseAbi(EIP7597Abis),\n functionName: \"nonces\",\n args: [account.address],\n }),\n });\n\n const [allowanceResponse, nonceResponse] = await Promise.all([\n allowanceFuture,\n nonceFuture,\n ]);\n\n if (!allowanceResponse.data) {\n throw new Error(\"No allowance returned from erc20 contract call\");\n }\n\n if (!nonceResponse.data) {\n throw new Error(\"No nonces returned from erc20 contract call\");\n }\n\n const permitLimit = policyToken.permit.autoPermitApproveTo;\n const currentAllowance: bigint = BigInt(allowanceResponse.data);\n if (currentAllowance > policyToken.permit.autoPermitBelow) {\n // no need to generate permit\n return undefined;\n }\n\n const nonce = BigInt(nonceResponse.data);\n\n const deadline = BigInt(Math.floor(Date.now() / 1000) + 60 * 10);\n\n const typedPermitData = {\n types: PermitTypes,\n primaryType: \"Permit\" as const,\n domain: {\n name: policyToken.permit.erc20Name ?? \"\",\n version: policyToken.permit.version ?? \"\",\n chainId: BigInt(client.chain.id),\n verifyingContract: policyToken.address,\n } satisfies PermitDomain,\n message: {\n owner: account.address,\n spender: paymasterAddress,\n value: permitLimit as bigint,\n nonce: nonce,\n deadline,\n } satisfies PermitMessage,\n } as const;\n\n const signedPermit = await account.signTypedData(typedPermitData);\n return encodeSignedPermit(permitLimit, deadline, signedPermit);\n};\n\nfunction extractSignedPermitFromContext(\n context: UserOperationContext,\n): Hex | undefined {\n if (context.signedPermit === undefined) {\n return undefined;\n }\n\n if (typeof context.signedPermit !== \"object\") {\n throw new InvalidSignedPermit(\"signedPermit is not an object\");\n }\n if (typeof context.signedPermit.value !== \"bigint\") {\n throw new InvalidSignedPermit(\"signedPermit.value is not a bigint\");\n }\n if (typeof context.signedPermit.deadline !== \"bigint\") {\n throw new InvalidSignedPermit(\"signedPermit.deadline is not a bigint\");\n }\n if (!isHex(context.signedPermit.signature)) {\n throw new InvalidSignedPermit(\"signedPermit.signature is not a hex string\");\n }\n return encodeSignedPermit(\n context.signedPermit.value,\n context.signedPermit.deadline,\n context.signedPermit.signature,\n );\n}\n\nfunction encodeSignedPermit(\n value: bigint,\n deadline: bigint,\n signedPermit: Hex,\n) {\n return encodeAbiParameters(\n [{ type: \"uint256\" }, { type: \"uint256\" }, { type: \"bytes\" }],\n [value, deadline, signedPermit],\n );\n}\n","import {\n deepHexlify,\n resolveProperties,\n type ClientMiddlewareFn,\n type UserOperationContext,\n} from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"../alchemyTransport\";\n\n/**\n * A middleware function to be used during simulation of user operations which leverages Alchemy's RPC uo simulation method.\n *\n * @example\n * ```ts\n * import { alchemyUserOperationSimulator, alchemy, sepolia } from \"@account-kit/infra\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const alchemyTransport = alchemy({\n * chain: sepolia,\n * apiKey: \"your-api-key\"\n * });\n *\n * const client = createSmartAccountClient({\n * chain: sepolia,\n * userOperationSimulator: alchemyUserOperationSimulator(alchemyTransport),\n * ...otherParams\n * });\n * ```\n *\n * @param {AlchemyTransport} transport An Alchemy Transport that can be used for making RPC calls to alchemy\n * @returns {ClientMiddlewareFn} A middleware function to simulate and process user operations\n */\nexport function alchemyUserOperationSimulator<\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(transport: AlchemyTransport): ClientMiddlewareFn<TContext> {\n return async (struct, { account, client }) => {\n const uoSimResult = await transport({ chain: client.chain }).request({\n method: \"alchemy_simulateUserOperationAssetChanges\",\n params: [\n deepHexlify(await resolveProperties(struct)),\n account.getEntryPoint().address,\n ],\n });\n\n if (uoSimResult.error) {\n throw new Error(uoSimResult.error.message);\n }\n\n return struct;\n };\n}\n","import {\n ChainNotFoundError,\n clientHeaderTrack,\n createSmartAccountClient,\n isSmartAccountWithSigner,\n type Prettify,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountClientRpcSchema,\n type SmartContractAccount,\n type SmartContractAccountWithSigner,\n type UserOperationContext,\n} from \"@aa-sdk/core\";\nimport { type Chain } from \"viem\";\nimport {\n alchemy,\n convertHeadersToObject,\n type AlchemyTransport,\n} from \"../alchemyTransport.js\";\nimport { getDefaultUserOperationFeeOptions } from \"../defaults.js\";\nimport { alchemyFeeEstimator } from \"../middleware/feeEstimator.js\";\nimport { alchemyGasAndPaymasterAndDataMiddleware } from \"../middleware/gasManager.js\";\nimport { alchemyUserOperationSimulator } from \"../middleware/userOperationSimulator.js\";\nimport {\n alchemyActions,\n type AlchemySmartAccountClientActions,\n} from \"./decorators/smartAccount.js\";\nimport type { AlchemyRpcSchema } from \"./types.js\";\nimport { headersUpdate } from \"../alchemyTrackerHeaders.js\";\nimport type { PolicyToken } from \"../middleware/gasManager.js\";\n\nexport function getSignerTypeHeader<\n TAccount extends SmartContractAccountWithSigner,\n>(account: TAccount) {\n return { \"Alchemy-Aa-Sdk-Signer\": account.getSigner().signerType };\n}\n\n// #region AlchemySmartAccountClientConfig\nexport type AlchemySmartAccountClientConfig<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = {\n account?: account;\n useSimulation?: boolean;\n policyId?: string | string[];\n policyToken?: PolicyToken;\n} & Pick<\n SmartAccountClientConfig<AlchemyTransport, chain, account, context>,\n | \"customMiddleware\"\n | \"feeEstimator\"\n | \"gasEstimator\"\n | \"signUserOperation\"\n | \"transport\"\n | \"chain\"\n | \"opts\"\n>;\n// #endregion AlchemySmartAccountClientConfig\n\nexport type BaseAlchemyActions<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = SmartAccountClientActions<chain, account, context> &\n AlchemySmartAccountClientActions<account, context>;\n\nexport type AlchemySmartAccountClient_Base<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<\n SmartAccountClient<\n AlchemyTransport,\n chain,\n account,\n actions & BaseAlchemyActions<chain, account, context>,\n [...SmartAccountClientRpcSchema, ...AlchemyRpcSchema],\n context\n >\n>;\n\nexport type AlchemySmartAccountClient<\n chain extends Chain | undefined = Chain | undefined,\n account extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n actions extends Record<string, unknown> = Record<string, unknown>,\n context extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n> = Prettify<AlchemySmartAccountClient_Base<chain, account, actions, context>>;\n\nexport function createAlchemySmartAccountClient<\n TChain extends Chain = Chain,\n TAccount extends SmartContractAccount | undefined =\n | SmartContractAccount\n | undefined,\n TContext extends UserOperationContext | undefined =\n | UserOperationContext\n | undefined,\n>(\n params: AlchemySmartAccountClientConfig<TChain, TAccount, TContext>,\n): AlchemySmartAccountClient<TChain, TAccount, Record<string, never>, TContext>;\n\n/**\n * Creates an Alchemy smart account client using the provided configuration options, including account details, gas manager configuration, and custom middleware.\n *\n * @example\n * ```ts\n * import { createAlchemySmartAccountClient, alchemy } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra/chain\";\n *\n * const client = createAlchemySmartAccountClient({\n * chain: sepolia,\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * });\n * ```\n *\n * @param {AlchemySmartAccountClientConfig} config The configuration for creating the Alchemy smart account client\n * @returns {AlchemySmartAccountClient} An instance of `AlchemySmartAccountClient` configured based on the provided options\n */\nexport function createAlchemySmartAccountClient(\n config: AlchemySmartAccountClientConfig,\n): AlchemySmartAccountClient {\n if (!config.chain) {\n throw new ChainNotFoundError();\n }\n\n const feeOptions =\n config.opts?.feeOptions ?? getDefaultUserOperationFeeOptions(config.chain);\n\n const scaClient = createSmartAccountClient({\n account: config.account,\n transport: config.transport,\n chain: config.chain,\n type: \"AlchemySmartAccountClient\",\n opts: {\n ...config.opts,\n feeOptions,\n },\n feeEstimator: config.feeEstimator ?? alchemyFeeEstimator(config.transport),\n gasEstimator: config.gasEstimator,\n customMiddleware: async (struct, args) => {\n if (isSmartAccountWithSigner(args.account)) {\n config.transport.updateHeaders(getSignerTypeHeader(args.account));\n }\n return config.customMiddleware\n ? config.customMiddleware(struct, args)\n : struct;\n },\n ...(config.policyId\n ? alchemyGasAndPaymasterAndDataMiddleware({\n policyId: config.policyId,\n policyToken: config.policyToken,\n transport: config.transport,\n gasEstimatorOverride: config.gasEstimator,\n feeEstimatorOverride: config.feeEstimator,\n })\n : {}),\n userOperationSimulator: config.useSimulation\n ? alchemyUserOperationSimulator(config.transport)\n : undefined,\n signUserOperation: config.signUserOperation,\n addBreadCrumb(breadcrumb: string) {\n const oldConfig = config.transport.config;\n const dynamicFetchOptions = config.transport.dynamicFetchOptions;\n const newTransport = alchemy({ ...oldConfig });\n newTransport.updateHeaders(\n headersUpdate(breadcrumb)(\n convertHeadersToObject(dynamicFetchOptions?.headers),\n ),\n );\n return createAlchemySmartAccountClient({\n ...config,\n transport: newTransport,\n }) as any;\n },\n })\n .extend(alchemyActions)\n .extend((client_) => ({\n addBreadcrumb(breadcrumb: string) {\n return clientHeaderTrack(client_, breadcrumb);\n },\n }));\n\n if (config.account && isSmartAccountWithSigner(config.account)) {\n config.transport.updateHeaders(getSignerTypeHeader(config.account));\n }\n\n return scaClient;\n}\n","export type * from \"../actions/simulateUserOperationChanges.js\";\nexport { simulateUserOperationChanges } from \"../actions/simulateUserOperationChanges.js\";\nexport type * from \"../actions/types.js\";\nexport type * from \"../alchemyTransport.js\";\nexport { alchemy, isAlchemyTransport } from \"../alchemyTransport.js\";\nexport type * from \"../chains.js\";\nexport {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n bsc,\n bscTestnet,\n defineAlchemyChain,\n fraxtal,\n fraxtalSepolia,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n shape,\n shapeSepolia,\n worldChain,\n worldChainSepolia,\n zora,\n zoraSepolia,\n beraChainBartio,\n opbnbMainnet,\n opbnbTestnet,\n soneiumMinato,\n soneiumMainnet,\n unichainMainnet,\n unichainSepolia,\n inkMainnet,\n inkSepolia,\n mekong,\n monadTestnet,\n monadMainnet,\n openlootSepolia,\n gensynTestnet,\n riseTestnet,\n storyMainnet,\n storyAeneid,\n celoMainnet,\n celoSepolia,\n teaSepolia,\n bobaSepolia,\n bobaMainnet,\n edgeMainnet,\n stableMainnet,\n mythosMainnet,\n worldl3devnet,\n hyperliquid,\n hyperliquidEvmTestnet,\n cronos,\n cronosTestnet,\n} from \"../chains.js\";\nexport type * from \"../client/decorators/smartAccount.js\";\nexport { alchemyActions } from \"../client/decorators/smartAccount.js\";\nexport { isAlchemySmartAccountClient } from \"../client/isAlchemySmartAccountClient.js\";\nexport type * from \"../client/rpcClient.js\";\nexport { createAlchemyPublicRpcClient } from \"../client/rpcClient.js\";\nexport type * from \"../client/smartAccountClient.js\";\nexport { createAlchemySmartAccountClient } from \"../client/smartAccountClient.js\";\nexport type * from \"../client/types.js\";\nexport { getDefaultUserOperationFeeOptions } from \"../defaults.js\";\nexport { getAlchemyPaymasterAddress } from \"../gas-manager.js\";\nexport { alchemyFeeEstimator } from \"../middleware/feeEstimator.js\";\nexport type * from \"../middleware/gasManager.js\";\nexport * from \"../alchemyTrackerHeaders.js\";\nexport {\n alchemyGasManagerMiddleware,\n alchemyGasAndPaymasterAndDataMiddleware,\n type PolicyToken,\n} from \"../middleware/gasManager.js\";\nexport { alchemyUserOperationSimulator } from \"../middleware/userOperationSimulator.js\";\nexport type * from \"../schema.js\";\n","import type { SmartAccountSigner } from \"@aa-sdk/core\";\nimport type { Chain, Client, Hex, Transport } from \"viem\";\nimport type { LightAccount } from \"../accounts/account\";\nimport {\n transferOwnership,\n type TransferLightAccountOwnershipParams,\n} from \"../actions/transferOwnership.js\";\n\nexport type LightAccountClientActions<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined,\n> = {\n transferOwnership: (\n args: TransferLightAccountOwnershipParams<TSigner, TAccount>,\n ) => Promise<Hex>;\n};\n\n/**\n * Provides a set of actions for managing a light account client, including transferring ownership.\n *\n * @example\n * ```ts\n * import { lightAccountClientActions, createLightAccount } from \"@account-kit/smart-contracts\";\n * import { createAlchemySmartAccountClient } from \"@account-kit/infra\";\n * import { sepolia } from \"@account-kit/infra\";\n *\n * const smartAccountClient = createAlchemySmartAccountClient({\n * account: await createLightAccount(...),\n * apiKey: \"your-api-key\",\n * chain: sepolia,\n * }).extend(lightAccountClientActions);\n * ```\n *\n * @param {Client<TTransport, TChain, TAccount>} client The client instance for which to provide the light account actions\n * @returns {LightAccountClientActions<TSigner, TAccount>} An object containing the available light account client actions\n */\nexport const lightAccountClientActions: <\n TTransport extends Transport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TAccount extends LightAccount<TSigner> | undefined =\n | LightAccount<TSigner>\n | undefined,\n>(\n client: Client<TTransport, TChain, TAccount>,\n) => LightAccountClientActions<TSigner, TAccount> = (client) => ({\n transferOwnership: async (args) => transferOwnership(client, args),\n});\n","import {\n createSmartAccountClient,\n type NotType,\n type SmartAccountClient,\n type SmartAccountClientActions,\n type SmartAccountClientConfig,\n type SmartAccountSigner,\n type SmartContractAccount,\n} from \"@aa-sdk/core\";\nimport { type Chain, type CustomTransport, type Transport } from \"viem\";\nimport {\n createLightAccount,\n type CreateLightAccountParams,\n type LightAccount,\n} from \"@account-kit/smart-contracts\";\nimport {\n lightAccountClientActions,\n type LightAccountClientActions,\n} from \"../decorators/lightAccount.js\";\nimport {\n isAlchemyTransport,\n createAlchemySmartAccountClient,\n type AlchemySmartAccountClient,\n type AlchemyTransport,\n} from \"@account-kit/infra\";\nimport { type AlchemyLightAccountClientConfig } from \"./alchemyClient.js\";\n\nexport type CreateLightAccountClientParams<\n TTransport extends Transport | AlchemyTransport = Transport,\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n> = {\n transport: CreateLightAccountParams<TTransport, TSigner>[\"transport\"];\n chain: CreateLightAccountParams<TTransport, TSigner>[\"chain\"];\n} & Omit<CreateLightAccountParams<TTransport, TSigner>, \"transport\" | \"chain\"> &\n Omit<\n SmartAccountClientConfig<TTransport, TChain>,\n \"transport\" | \"account\" | \"chain\"\n >;\n\nexport function createLightAccountClient<\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n>(\n params: AlchemyLightAccountClientConfig<TSigner> & {\n transport: AlchemyTransport;\n },\n): Promise<\n AlchemySmartAccountClient<\n Chain | undefined,\n LightAccount<TSigner>,\n LightAccountClientActions<TSigner>\n >\n>;\nexport function createLightAccountClient<\n TChain extends Chain | undefined = Chain | undefined,\n TSigner extends SmartAccountSigner = SmartAccountSigner,\n TTransport extends Transport = Transport,\n>(\n args: CreateLightAccountClientParams<TTransport, TChain, TSigner> &\n NotType<TTransport, AlchemyTransport>,\n): Promise<\n SmartAccountClient<\n CustomTransport,\n TChain,\n LightAccount<TSigner>,\n SmartAccountClientActions<Chain, SmartContractAccount> &\n LightAccountClientActions<TSigner, LightAccount<TSigner>>\n >\n>;\n\n/**\n * Creates a light account client using the provided parameters, including account information, transport mechanism, blockchain chain, and additional client configurations. This function first creates a light account and then uses it to create a smart account client, extending it with light account client actions.\n *\n * Also, we modified the return type to be the light account alchemy client if the transport is alchemy.\n *\n * @example\n * ```ts\n * import { createLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n * import { http, generatePrivateKey } from \"viem\"\n *\n * const account = await createLightAccountClient({\n * chain: sepolia,\n * transport: http(\"RPC_URL\"),\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n * @example\n * ```ts\n * import { createLightAccountClient } from \"@account-kit/smart-contracts\";\n * import { sepolia, alchemy } from \"@account-kit/infra\";\n * import { LocalAccountSigner } from \"@aa-sdk/core\";\n * import { generatePrivateKey } from \"viem\"\n *\n * const lightAlchemyAccountClient = await createLightAccountClient({\n * transport: alchemy({ apiKey: \"your-api-key\" }),\n * chain: sepolia,\n * signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey())\n * });\n * ```\n *\n * @param {CreateLightAccountClientParams} params The parameters for creating a light account client\n * @returns {Promise<SmartAccountClient>} A promise that resolves to a `SmartAccountClient` object containing the created account information and methods\n */\nexport async function createLightAccountClient(\n params: CreateLightAccountClientParams,\n): Promise<SmartAccountClient | AlchemySmartAccountClient> {\n const { transport, chain } = params;\n\n const lightAccount = await createLightAccount({\n ...params,\n transport,\n chain,\n });\n if (isAlchemyTransport(transport, chain)) {\n return createAlchemySmartAccountClient({\n ...params,\n transport,\n chain,\n account: lightAccount,\n }).extend(lightAccountClientActions);\n }\n\n return createSmartAccountClient({\n ...params,\n transport,\n chain: chain,\n account: lightAccount,\n }).extend(lightAccountClientActions);\n}\n","// Add you exports here, make sure to export types separately from impls and use the `type` keyword when exporting them\n// Don't use wildcard exports, instead use named exports\n\n//light-account exports\nexport type * from \"./light-account/accounts/account.js\";\nexport { createLightAccount } from \"./light-account/accounts/account.js\";\nexport { transferOwnership as transferLightAccountOwnership } from \"./light-account/actions/transferOwnership.js\";\nexport {\n createLightAccountAlchemyClient,\n type AlchemyLightAccountClientConfig,\n} from \"./light-account/clients/alchemyClient.js\";\nexport { createLightAccountClient } from \"./light-account/clients/client.js\";\nexport {\n createMultiOwnerLightAccountAlchemyClient,\n type AlchemyMultiOwnerLightAccountClientConfig,\n} from \"./light-account/clients/multiOwnerAlchemyClient.js\";\nexport type * from \"./light-account/decorators/lightAccount.js\";\nexport { lightAccountClientActions } from \"./light-account/decorators/lightAccount.js\";\nexport type * from \"./light-account/types.js\";\nexport { predictLightAccountAddress } from \"./light-account/accounts/predictAddress.js\";\nexport { predictMultiOwnerLightAccountAddress } from \"./light-account/accounts/predictAddress.js\";\n\nexport {\n AccountVersionRegistry,\n LightAccountUnsupported1271Factories,\n LightAccountUnsupported1271Impls,\n defaultLightAccountVersion,\n getDefaultLightAccountFactoryAddress,\n getDefaultMultiOwnerLightAccountFactoryAddress,\n getLightAccountVersionForAccount,\n} from \"./light-account/utils.js\";\n\n//multi-owner-light-account exports\nexport type * from \"./light-account/accounts/multiOwner.js\";\nexport { createMultiOwnerLightAccount } from \"./light-account/accounts/multiOwner.js\";\nexport { updateOwners as updateMultiOwnerLightAccountOwners } from \"./light-account/actions/updateOwners.js\";\nexport { createMultiOwnerLightAccountClient } from \"./light-account/clients/multiOwnerLightAccount.js\";\nexport type * from \"./light-account/decorators/multiOwnerLightAccount.js\";\nexport { multiOwnerLightAccountClientActions } from \"./light-account/decorators/multiOwnerLightAccount.js\";\n\n// msca exports\nexport { IAccountLoupeAbi } from \"./msca/abis/IAccountLoupe.js\";\nexport { IPluginAbi } from \"./msca/abis/IPlugin.js\";\nexport { IPluginManagerAbi } from \"./msca/abis/IPluginManager.js\";\nexport { IStandardExecutorAbi } from \"./msca/abis/IStandardExecutor.js\";\nexport { MultiOwnerModularAccountFactoryAbi } from \"./msca/abis/MultiOwnerModularAccountFactory.js\";\nexport { MultisigModularAccountFactoryAbi } from \"./msca/abis/MultisigModularAccountFactory.js\";\nexport { UpgradeableModularAccountAbi } from \"./msca/abis/UpgradeableModularAccount.js\";\nexport type * from \"./msca/account-loupe/decorator.js\";\nexport { accountLoupeActions } from \"./msca/account-loupe/decorator.js\";\nexport type * from \"./msca/account-loupe/types.js\";\nexport type * from \"./msca/account/multiOwnerAccount.js\";\nexport { createMultiOwnerModularAccount } from \"./msca/account/multiOwnerAccount.js\";\nexport type * from \"./msca/account/multisigAccount.js\";\nexport { createMultisigModularAccount } from \"./msca/account/multisigAccount.js\";\nexport { standardExecutor } from \"./msca/account/standardExecutor.js\";\nexport {\n createModularAccountAlchemyClient,\n type AlchemyModularAccountClientConfig,\n} from \"./msca/client/alchemyClient.js\";\nexport {\n createMultiOwnerModularAccountClient,\n createMultisigModularAccountClient,\n} from \"./msca/client/client.js\";\nexport {\n createMultisigAccountAlchemyClient,\n type AlchemyMultisigAccountClientConfig,\n} from \"./msca/client/multiSigAlchemyClient.js\";\nexport {\n InvalidAggregatedSignatureError,\n InvalidContextSignatureError,\n MultisigAccountExpectedError,\n MultisigMissingSignatureError,\n} from \"./msca/errors.js\";\nexport type * from \"./msca/plugin-manager/decorator.js\";\nexport { pluginManagerActions } from \"./msca/plugin-manager/decorator.js\";\nexport { installPlugin } from \"./msca/plugin-manager/installPlugin.js\";\nexport { multiOwnerPluginActions } from \"./msca/plugins/multi-owner/extension.js\";\nexport type * from \"./msca/plugins/multi-owner/index.js\";\nexport {\n MultiOwnerPlugin,\n MultiOwnerPluginAbi,\n MultiOwnerPluginExecutionFunctionAbi,\n} from \"./msca/plugins/multi-owner/plugin.js\";\nexport type * from \"./msca/plugins/multisig/index.js\";\nexport {\n MultisigPlugin,\n MultisigPluginAbi,\n MultisigPluginExecutionFunctionAbi,\n multisigPluginActions,\n multisigSignatureMiddleware,\n} from \"./msca/plugins/multisig/index.js\";\nexport {\n combineSignatures,\n formatSignatures,\n getSignerType,\n splitAggregatedSignature,\n} from \"./msca/plugins/multisig/utils/index.js\";\nexport { sessionKeyPluginActions } from \"./msca/plugins/session-key/extension.js\";\nexport type * from \"./msca/plugins/session-key/index.js\";\nexport type * from \"./msca/plugins/session-key/permissions.js\";\nexport {\n SessionKeyAccessListType,\n SessionKeyPermissionsBuilder,\n} from \"./msca/plugins/session-key/permissions.js\";\nexport {\n SessionKeyPlugin,\n SessionKeyPluginAbi,\n SessionKeyPluginExecutionFunctionAbi,\n} from \"./msca/plugins/session-key/plugin.js\";\nexport { SessionKeySigner } from \"./msca/plugins/session-key/signer.js\";\nexport { buildSessionKeysToRemoveStruct } from \"./msca/plugins/session-key/utils.js\";\nexport type * from \"./msca/plugins/types.js\";\nexport {\n getDefaultMultiOwnerModularAccountFactoryAddress,\n getDefaultMultisigModularAccountFactoryAddress,\n getMAInitializationData,\n getMSCAUpgradeToData,\n} from \"./msca/utils.js\";\n\n// ma v2 exports\nexport type * from \"./ma-v2/account/modularAccountV2.js\";\nexport type * from \"./ma-v2/account/common/modularAccountV2Base.js\";\nexport { createModularAccountV2 } from \"./ma-v2/account/modularAccountV2.js\";\nexport type * from \"./ma-v2/client/client.js\";\nexport { createModularAccountV2Client } from \"./ma-v2/client/client.js\";\nexport type * from \"./ma-v2/utils.js\";\nexport { getMAV2UpgradeToData } from \"./ma-v2/utils.js\";\nexport { predictModularAccountV2Address } from \"./ma-v2/account/predictAddress.js\";\nexport { semiModularAccountBytecodeAbi } from \"./ma-v2/abis/semiModularAccountBytecodeAbi.js\";\n","// constants.ts\ndeclare const __SDK_VERSION__: string;\ndeclare const __API_ROOT__: string;\ndeclare const __GTM_ID__: string;\ndeclare const __WALLETCONNECT_PROJECT_ID__: string;\n\nexport const SDK_NAME = \"@trustware/sdk\";\nexport const SDK_VERSION: string = __SDK_VERSION__;\nexport const API_ROOT: string = __API_ROOT__;\nexport const GTM_ID: string = __GTM_ID__;\nexport const API_PREFIX = \"/api\";\nexport const WALLETCONNECT_PROJECT_ID = __WALLETCONNECT_PROJECT_ID__;\n\n// Assets base URL for wallet logos and other static assets\nexport const ASSETS_BASE_URL = \"https://app.trustware.io\";\n\n// WalletConnect Cloud project ID - built into the SDK for seamless wallet connections\n// This is a public identifier (not a secret) registered with WalletConnect Cloud\n// export const WALLETCONNECT_PROJECT_ID = \"4ead125c-63be-4b1a-a835-cef2dce67b84\";\n","import { TrustwareWidgetTheme, TrustwareWidgetMessages } from \"../types/\";\n\nexport const DEFAULT_SLIPPAGE = 1;\nexport const DEFAULT_AUTO_DETECT_PROVIDER = false;\n\nexport const DEFAULT_THEME: TrustwareWidgetTheme = {\n primaryColor: \"#4F46E5\",\n secondaryColor: \"#6366F1\",\n backgroundColor: \"#FFFFFF\",\n textColor: \"#111827\",\n borderColor: \"#E5E7EB\",\n radius: 8,\n};\n\nexport const DEFAULT_MESSAGES: TrustwareWidgetMessages = {\n title: \"Trustware SDK\",\n description: \"Seamlessly bridge assets across chains with Trustware.\",\n};\n","import { TrustwareError } from \"src/errors/TrustwareError\";\nimport { TrustwareWidgetTheme, TrustwareWidgetMessages } from \"./theme\";\nimport { TrustwareEvent } from \"src/events/events\";\nimport { Transaction } from \"./routes\";\n\n/** WalletConnect configuration options (all optional - SDK has built-in defaults) */\nexport type WalletConnectConfig = {\n /** Override the built-in WalletConnect project ID (optional - SDK includes one) */\n projectId?: string;\n /** Chain IDs to support (defaults to [1] for Ethereum mainnet) */\n chains?: number[];\n /** Optional chain IDs (chains that can be switched to) */\n optionalChains?: number[];\n /** dApp metadata shown in wallet */\n metadata?: {\n name: string;\n description?: string;\n url: string;\n icons?: string[];\n };\n /** Custom relay URL (defaults to WalletConnect's relay) */\n relayUrl?: string;\n /** Whether to show our custom QR modal (default: true) */\n showQrModal?: boolean;\n /** Disable WalletConnect entirely (default: false) */\n disabled?: boolean;\n};\n\n/** Resolved WalletConnect config with defaults applied */\nexport type ResolvedWalletConnectConfig = {\n projectId: string;\n chains: number[];\n optionalChains: number[];\n metadata: {\n name: string;\n description: string;\n url: string;\n icons: string[];\n };\n relayUrl?: string;\n showQrModal: boolean;\n};\n\nexport type TrustwareConfigOptions = {\n apiKey: string; // Required API key for authentication\n routes: {\n toChain: string; // Default destination chain\n toToken: string; // Default destination token\n fromToken?: string; // Default source token (optional)\n fromChain?: string; // Default source chain (optional)\n fromAddress?: string; // Default source address (optional)\n toAddress?: string; // Default destination address (optional; can be updated later via Trustware.setDestinationAddress)\n defaultSlippage?: number; // Default slippage percentage (optional) defautts to 1\n routeType?: string; // Route type: \"swap\" | \"deposit\" | \"withdraw\" | \"cross\" (default: \"swap\")\n options?: {\n routeRefreshMs?: number; // Route refresh interval in milliseconds (optional)\n fixedFromAmount?: string | number;\n minAmountOut?: string | number;\n maxAmountOut?: string | number;\n };\n };\n autoDetectProvider?: boolean; // Whether to auto-detect wallet provider (optional, default: false.)\n theme?: TrustwareWidgetTheme; // Optional theme customization\n messages?: Partial<TrustwareWidgetMessages>; // Optional message customization\n retry?: RetryConfig; // Optional retry configuration for rate-limited requests\n walletConnect?: WalletConnectConfig; // Optional WalletConnect configuration\n features?: FeatureFlags; // Optional feature rollout controls\n\n onError?: (error: TrustwareError) => void;\n onSuccess?: (transaction: Transaction) => void;\n onEvent?: (event: TrustwareEvent) => void;\n};\n\nexport type ResolvedTrustwareConfig = {\n apiKey: string;\n routes: {\n toChain: string;\n toToken: string;\n fromToken?: string;\n fromAddress?: string;\n toAddress?: string;\n defaultSlippage: number; // resolved\n routeType: string; // resolved\n options: {\n routeRefreshMs?: number;\n fixedFromAmount?: string | number;\n minAmountOut?: string | number;\n maxAmountOut?: string | number;\n };\n };\n autoDetectProvider: boolean;\n theme: TrustwareWidgetTheme;\n messages: TrustwareWidgetMessages;\n retry: ResolvedRetryConfig;\n walletConnect?: ResolvedWalletConnectConfig | WalletConnectConfig | undefined;\n features: ResolvedFeatureFlags;\n onError?: (error: TrustwareError) => void;\n onSuccess?: (transaction: Transaction) => void;\n onEvent?: (event: TrustwareEvent) => void;\n};\n\n/** A token identified by contract address + chain ID. Used for swap mode configuration. */\nexport type SwapTokenRef = {\n /** EVM contract address (or native placeholder, e.g. \"0xeeee...\") */\n address: string;\n /** Numeric chain ID, e.g. 8453 for Base */\n chainId: number;\n};\n\nexport type FeatureFlags = {\n tokensPagination?: boolean;\n balanceStreaming?: boolean;\n shouldAllowGA4?: boolean;\n swapMode?: boolean;\n /**\n * Pre-selects the destination token in swap mode. When set, the widget opens\n * with this token already chosen as the \"buy\" side.\n * Example: `{ address: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\", chainId: 8453 }` (Base USDC)\n */\n swapDefaultDestToken?: SwapTokenRef;\n /**\n * When true (and `swapDefaultDestToken` is set), the destination token is fixed\n * and the user cannot change it. The \"select token to buy\" button is disabled.\n */\n swapLockDestToken?: boolean;\n /**\n * Restricts the destination (\"buy\") token selector to only these tokens. The user\n * can still sell any token from their wallet; only the buy side is limited.\n * Each entry is a token address + chain ID pair. When omitted, all tokens are selectable.\n * Example: `[{ address: \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\", chainId: 1 }]`\n */\n swapAllowedDestTokens?: SwapTokenRef[];\n};\n\nexport type ResolvedFeatureFlags = {\n tokensPagination: boolean;\n balanceStreaming: boolean;\n shouldAllowGA4: boolean;\n swapMode: boolean;\n swapDefaultDestToken: SwapTokenRef | null;\n swapLockDestToken: boolean;\n swapAllowedDestTokens: SwapTokenRef[] | null;\n};\n\nexport const DEFAULT_SLIPPAGE = 1; // Default slippage percentage\nexport const DEFAULT_AUTO_DETECT_PROVIDER = false; // Default auto-detect provider setting\n\n// Rate limit types for SDK rate limit handling\nexport type RateLimitInfo = {\n /** Maximum requests allowed in the current window */\n limit: number;\n /** Requests remaining in the current window */\n remaining: number;\n /** Unix timestamp when the rate limit window resets */\n reset: number;\n /** Seconds until rate limit resets (only present on 429 responses) */\n retryAfter?: number;\n};\n\nexport type RetryConfig = {\n /** Enable automatic retry on 429 responses (default: true). Note: This does NOT disable backend rate limits, only client-side retry behavior. */\n autoRetry?: boolean;\n /** Maximum number of retries on 429 (default: 3) */\n maxRetries?: number;\n /** Base delay in ms for exponential backoff (default: 1000) */\n baseDelayMs?: number;\n /** Callback when rate limit info is received from server */\n onRateLimitInfo?: (info: RateLimitInfo) => void;\n /** Callback when rate limit is hit (429 received) */\n onRateLimited?: (info: RateLimitInfo, retryCount: number) => void;\n /** Callback when remaining requests fall below threshold */\n onRateLimitApproaching?: (info: RateLimitInfo, threshold: number) => void;\n /** Threshold for onRateLimitApproaching callback (default: 5) */\n approachingThreshold?: number;\n};\n\nexport type ResolvedRetryConfig = {\n autoRetry: boolean;\n maxRetries: number;\n baseDelayMs: number;\n approachingThreshold: number;\n onRateLimitInfo?: (info: RateLimitInfo) => void;\n onRateLimited?: (info: RateLimitInfo, retryCount: number) => void;\n onRateLimitApproaching?: (info: RateLimitInfo, threshold: number) => void;\n};\n\nexport const DEFAULT_RETRY_CONFIG: ResolvedRetryConfig = {\n autoRetry: true,\n maxRetries: 3,\n baseDelayMs: 1000,\n approachingThreshold: 5,\n};\n\nexport const DEFAULT_FEATURE_FLAGS: ResolvedFeatureFlags = {\n tokensPagination: true,\n balanceStreaming: false,\n shouldAllowGA4: true,\n swapMode: false,\n swapDefaultDestToken: null,\n swapLockDestToken: false,\n swapAllowedDestTokens: null,\n};\n","import type {\n ResolvedTrustwareConfig,\n TrustwareConfigOptions,\n} from \"../types/\";\nimport { resolveConfig } from \"./merge\";\n\ntype Listener = (cfg: ResolvedTrustwareConfig) => void;\n\nclass ConfigStore {\n private _cfg: ResolvedTrustwareConfig | null = null;\n private _listeners = new Set<Listener>();\n\n isInitialized(): boolean {\n return this._cfg != null;\n }\n\n peek(): ResolvedTrustwareConfig | null {\n return this._cfg;\n }\n\n /** Initialize or replace the config */\n init(opts: TrustwareConfigOptions) {\n this._cfg = resolveConfig(opts);\n this.emit();\n }\n\n /** Partially update by re-resolving from last + patch */\n update(patch: Partial<TrustwareConfigOptions>) {\n if (!this._cfg) throw new Error(\"TrustwareConfig: call init() first.\");\n const next = resolveConfig({\n ...this._cfg,\n ...patch,\n routes: { ...this._cfg.routes, ...(patch.routes ?? {}) },\n theme: {\n ...this._cfg.theme,\n ...(patch.theme ?? {}),\n } as ResolvedTrustwareConfig[\"theme\"],\n messages: {\n ...this._cfg.messages,\n ...(patch.messages ?? {}),\n } as ResolvedTrustwareConfig[\"messages\"],\n retry: { ...this._cfg.retry, ...(patch.retry ?? {}) },\n features: { ...this._cfg.features, ...(patch.features ?? {}) },\n walletConnect: patch.walletConnect\n ? { ...this._cfg.walletConnect, ...patch.walletConnect }\n : this._cfg.walletConnect,\n } as TrustwareConfigOptions);\n this._cfg = next;\n this.emit();\n }\n\n get(): ResolvedTrustwareConfig {\n if (!this._cfg) throw new Error(\"TrustwareConfig: not initialized.\");\n return this._cfg;\n }\n\n getTheme() {\n return this.get().theme;\n }\n\n getMessages() {\n return this.get().messages;\n }\n\n subscribe(fn: (cfg: ResolvedTrustwareConfig) => void) {\n this._listeners.add(fn);\n if (this._cfg) fn(this._cfg);\n return () => {\n this._listeners.delete(fn);\n };\n }\n\n private emit() {\n if (!this._cfg) return;\n for (const fn of this._listeners) fn(this._cfg);\n }\n}\nexport const TrustwareConfigStore = new ConfigStore();\n\n/** Convenience for non-React environments */\nexport const TrustwareConfig = {\n init: (opts: TrustwareConfigOptions) => TrustwareConfigStore.init(opts),\n update: (patch: Partial<TrustwareConfigOptions>) =>\n TrustwareConfigStore.update(patch),\n get: () => TrustwareConfigStore.get(),\n getTheme: () => TrustwareConfigStore.get().theme,\n getMessages: () => TrustwareConfigStore.get().messages,\n subscribe: (fn: (cfg: ResolvedTrustwareConfig) => void) =>\n TrustwareConfigStore.subscribe(fn),\n};\n","/**\n * To add a new error, follow the instructions at\n * https://github.com/anza-xyz/kit/tree/main/packages/errors/#adding-a-new-error\n *\n * @module\n * @privateRemarks\n * WARNING:\n * - Don't remove error codes\n * - Don't change or reorder error codes.\n *\n * Good naming conventions:\n * - Prefixing common errors — e.g. under the same package — can be a good way to namespace them. E.g. All codec-related errors start with `SOLANA_ERROR__CODECS__`.\n * - Use consistent names — e.g. choose `PDA` or `PROGRAM_DERIVED_ADDRESS` and stick with it. Ensure your names are consistent with existing error codes. The decision might have been made for you.\n * - Recommended prefixes and suffixes:\n * - `MALFORMED_`: Some input was not constructed properly. E.g. `MALFORMED_BASE58_ENCODED_ADDRESS`.\n * - `INVALID_`: Some input is invalid (other than because it was MALFORMED). E.g. `INVALID_NUMBER_OF_BYTES`.\n * - `EXPECTED_`: Some input was different than expected, no need to specify the \"GOT\" part unless necessary. E.g. `EXPECTED_DECODED_ACCOUNT`.\n * - `_CANNOT_`: Some operation cannot be performed or some input cannot be used due to some condition. E.g. `CANNOT_DECODE_EMPTY_BYTE_ARRAY` or `PDA_CANNOT_END_WITH_PDA_MARKER`.\n * - `_MUST_BE_`: Some condition must be true. E.g. `NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE`.\n * - `_FAILED_TO_`: Tried to perform some operation and failed. E.g. `FAILED_TO_DECODE_ACCOUNT`.\n * - `_NOT_FOUND`: Some operation lead to not finding something. E.g. `ACCOUNT_NOT_FOUND`.\n * - `_OUT_OF_RANGE`: Some value is out of range. E.g. `ENUM_DISCRIMINATOR_OUT_OF_RANGE`.\n * - `_EXCEEDED`: Some limit was exceeded. E.g. `PDA_MAX_SEED_LENGTH_EXCEEDED`.\n * - `_MISMATCH`: Some elements do not match. E.g. `ENCODER_DECODER_FIXED_SIZE_MISMATCH`.\n * - `_MISSING`: Some required input is missing. E.g. `TRANSACTION_FEE_PAYER_MISSING`.\n * - `_UNIMPLEMENTED`: Some required component is not available in the environment. E.g. `SUBTLE_CRYPTO_VERIFY_FUNCTION_UNIMPLEMENTED`.\n */\nexport const SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED = 1;\nexport const SOLANA_ERROR__INVALID_NONCE = 2;\nexport const SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND = 3;\nexport const SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE = 4;\nexport const SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH = 5;\nexport const SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE = 6;\nexport const SOLANA_ERROR__MALFORMED_BIGINT_STRING = 7;\nexport const SOLANA_ERROR__MALFORMED_NUMBER_STRING = 8;\nexport const SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE = 9;\nexport const SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR = 10;\n\n// JSON-RPC-related errors.\n// Reserve error codes in the range [-32768, -32000]\n// Keep in sync with https://github.com/anza-xyz/agave/blob/master/rpc-client-api/src/custom_error.rs\nexport const SOLANA_ERROR__JSON_RPC__PARSE_ERROR = -32700;\nexport const SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR = -32603;\nexport const SOLANA_ERROR__JSON_RPC__INVALID_PARAMS = -32602;\nexport const SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND = -32601;\nexport const SOLANA_ERROR__JSON_RPC__INVALID_REQUEST = -32600;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE = -32019;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY = -32018;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE = -32017;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED = -32016;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION = -32015;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET = -32014;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH = -32013;\nexport const SOLANA_ERROR__JSON_RPC__SCAN_ERROR = -32012;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE = -32011;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX = -32010;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED = -32009;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT = -32008;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED = -32007;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE = -32006;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY = -32005;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE = -32004;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE = -32003;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE = -32002;\nexport const SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP = -32001;\n\n// Addresses-related errors.\n// Reserve error codes in the range [2800000-2800999].\nexport const SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH = 2800000;\nexport const SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE = 2800001;\nexport const SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS = 2800002;\nexport const SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY = 2800003;\nexport const SOLANA_ERROR__ADDRESSES__MALFORMED_PDA = 2800004;\nexport const SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE = 2800005;\nexport const SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED = 2800006;\nexport const SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED = 2800007;\nexport const SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE = 2800008;\nexport const SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED = 2800009;\nexport const SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER = 2800010;\nexport const SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS = 2800011;\n\n// Account-related errors.\n// Reserve error codes in the range [3230000-3230999].\nexport const SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND = 3230000;\nexport const SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND = 32300001;\nexport const SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT = 3230002;\nexport const SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT = 3230003;\nexport const SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED = 3230004;\n\n// Subtle-Crypto-related errors.\n// Reserve error codes in the range [3610000-3610999].\nexport const SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT = 3610000;\nexport const SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED = 3610001;\nexport const SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED = 3610002;\nexport const SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED = 3610003;\nexport const SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED = 3610004;\nexport const SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED = 3610005;\nexport const SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED = 3610006;\nexport const SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY = 3610007;\n\n// Crypto-related errors.\n// Reserve error codes in the range [3611000-3611050].\nexport const SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED = 3611000;\n\n// Key-related errors.\n// Reserve error codes in the range [3704000-3704999].\nexport const SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH = 3704000;\nexport const SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH = 3704001;\nexport const SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH = 3704002;\nexport const SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE = 3704003;\nexport const SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY = 3704004;\n\n// Instruction-related errors.\n// Reserve error codes in the range [4128000-4128999].\nexport const SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS = 4128000;\nexport const SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA = 4128001;\nexport const SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH = 4128002;\n\n// Instruction errors.\n// Reserve error codes starting with [4615000-4615999] for the Rust enum `InstructionError`.\n// Error names here are dictated by the RPC (see ./instruction-error.ts).\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN = 4615000;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR = 4615001;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT = 4615002;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA = 4615003;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA = 4615004;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL = 4615005;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS = 4615006;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID = 4615007;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE = 4615008;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED = 4615009;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT = 4615010;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION = 4615011;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID = 4615012;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND = 4615013;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED = 4615014;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE = 4615015;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED = 4615016;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX = 4615017;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED = 4615018;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED = 4615019;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS = 4615020;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED = 4615021;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE = 4615022;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED = 4615023;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING = 4615024;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC = 4615025;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM = 4615026;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR = 4615027;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED = 4615028;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE = 4615029;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT = 4615030;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID = 4615031;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH = 4615032;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT = 4615033;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED = 4615034;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED = 4615035;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS = 4615036;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC = 4615037;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED = 4615038;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION = 4615039;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE = 4615040;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE = 4615041;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE = 4615042;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE = 4615043;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY = 4615044;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR = 4615045;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT = 4615046;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER = 4615047;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW = 4615048;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR = 4615049;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER = 4615050;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED = 4615051;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED = 4615052;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED = 4615053;\nexport const SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS = 4615054;\n\n// Signer-related errors.\n// Reserve error codes in the range [5508000-5508999].\nexport const SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS = 5508000;\nexport const SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER = 5508001;\nexport const SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER = 5508002;\nexport const SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER = 5508003;\nexport const SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER = 5508004;\nexport const SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER = 5508005;\nexport const SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER = 5508006;\nexport const SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER = 5508007;\nexport const SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER = 5508008;\nexport const SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS = 5508009;\nexport const SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING = 5508010;\nexport const SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED = 5508011;\n\n// Offchain-message-related errors.\n// Reserve error codes in the range [5607000-5607999].\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED = 5607000;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__RESTRICTED_ASCII_BODY_CHARACTER_OUT_OF_RANGE = 5607001;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE = 5607002;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH = 5607003;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH = 5607004;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO = 5607005;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED = 5607006;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH = 5607007;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH = 5607008;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY = 5607009;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO = 5607010;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING = 5607011;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH = 5607012;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE = 5607013;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION = 5607014;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_SORTED = 5607015;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE = 5607016;\nexport const SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE = 5607017;\n\n// Transaction-related errors.\n// Reserve error codes in the range [5663000-5663999].\nexport const SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES = 5663000;\nexport const SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE = 5663001;\nexport const SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME = 5663002;\nexport const SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME = 5663003;\nexport const SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE = 5663004;\nexport const SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING = 5663005;\nexport const SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE = 5663006;\nexport const SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND = 5663007;\nexport const SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING = 5663008;\nexport const SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING = 5663009;\nexport const SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING = 5663010;\nexport const SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING = 5663011;\nexport const SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING = 5663012;\nexport const SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING = 5663013;\nexport const SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE = 5663014;\nexport const SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION = 5663015;\nexport const SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES = 5663016;\nexport const SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH = 5663017;\nexport const SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT = 5663018;\nexport const SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT = 5663019;\nexport const SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT = 5663020;\nexport const SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED = 5663021;\nexport const SOLANA_ERROR__TRANSACTION__NONCE_ACCOUNT_CANNOT_BE_IN_LOOKUP_TABLE = 5663022;\n\n// Transaction errors.\n// Reserve error codes starting with [7050000-7050999] for the Rust enum `TransactionError`.\n// Error names here are dictated by the RPC (see ./transaction-error.ts).\nexport const SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN = 7050000;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE = 7050001;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE = 7050002;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND = 7050003;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND = 7050004;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE = 7050005;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE = 7050006;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED = 7050007;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND = 7050008;\n// `InstructionError` intentionally omitted.\nexport const SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP = 7050009;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE = 7050010;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX = 7050011;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE = 7050012;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION = 7050013;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE = 7050014;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE = 7050015;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING = 7050016;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT = 7050017;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION = 7050018;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT = 7050019;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT = 7050020;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT = 7050021;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS = 7050022;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND = 7050023;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER = 7050024;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA = 7050025;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX = 7050026;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT = 7050027;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT = 7050028;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT = 7050029;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION = 7050030;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT = 7050031;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED = 7050032;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT = 7050033;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED = 7050034;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED = 7050035;\nexport const SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION = 7050036;\n\n// Instruction plan related errors.\n// Reserve error codes in the range [7618000-7618999].\nexport const SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_CANNOT_ACCOMMODATE_PLAN = 7618000;\nexport const SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_PACKER_ALREADY_COMPLETE = 7618001;\nexport const SOLANA_ERROR__INSTRUCTION_PLANS__EMPTY_INSTRUCTION_PLAN = 7618002;\nexport const SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN = 7618003;\nexport const SOLANA_ERROR__INSTRUCTION_PLANS__NON_DIVISIBLE_TRANSACTION_PLANS_NOT_SUPPORTED = 7618004;\nexport const SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_SINGLE_TRANSACTION_PLAN_RESULT_NOT_FOUND = 7618005;\nexport const SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_INSTRUCTION_PLAN = 7618006;\nexport const SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN = 7618007;\nexport const SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN_RESULT = 7618008;\nexport const SOLANA_ERROR__INSTRUCTION_PLANS__EXPECTED_SUCCESSFUL_TRANSACTION_PLAN_RESULT = 7618009;\n\n// Codec-related errors.\n// Reserve error codes in the range [8078000-8078999].\nexport const SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY = 8078000;\nexport const SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH = 8078001;\nexport const SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH = 8078002;\nexport const SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH = 8078003;\nexport const SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH = 8078004;\nexport const SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH = 8078005;\nexport const SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH = 8078006;\nexport const SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS = 8078007;\nexport const SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE = 8078008;\nexport const SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT = 8078009;\nexport const SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT = 8078010;\nexport const SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE = 8078011;\nexport const SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE = 8078012;\nexport const SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH = 8078013;\nexport const SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE = 8078014;\nexport const SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT = 8078015;\nexport const SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE = 8078016;\nexport const SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE = 8078017;\nexport const SOLANA_ERROR__CODECS__INVALID_CONSTANT = 8078018;\nexport const SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE = 8078019;\nexport const SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL = 8078020;\nexport const SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES = 8078021;\nexport const SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS = 8078022;\nexport const SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY = 8078023;\n\n// RPC-related errors.\n// Reserve error codes in the range [8100000-8100999].\nexport const SOLANA_ERROR__RPC__INTEGER_OVERFLOW = 8100000;\nexport const SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN = 8100001;\nexport const SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR = 8100002;\nexport const SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD = 8100003;\n\n// RPC-Subscriptions-related errors.\n// Reserve error codes in the range [8190000-8190999].\nexport const SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN = 8190000;\nexport const SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID = 8190001;\nexport const SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED = 8190002;\nexport const SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED = 8190003;\nexport const SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT = 8190004;\n\n// Invariant violation errors.\n// Reserve error codes in the range [9900000-9900999].\n// These errors should only be thrown when there is a bug with the\n// library itself and should, in theory, never reach the end user.\nexport const SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING = 9900000;\nexport const SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE = 9900001;\nexport const SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING = 9900002;\nexport const SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE = 9900003;\nexport const SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED = 9900004;\nexport const SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_INSTRUCTION_PLAN_KIND = 9900005;\nexport const SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_TRANSACTION_PLAN_KIND = 9900006;\n\n/**\n * A union of every Solana error code\n *\n * @privateRemarks\n * You might be wondering why this is not a TypeScript enum or const enum.\n *\n * One of the goals of this library is to enable people to use some or none of it without having to\n * bundle all of it.\n *\n * If we made the set of error codes an enum then anyone who imported it (even if to only use a\n * single error code) would be forced to bundle every code and its label.\n *\n * Const enums appear to solve this problem by letting the compiler inline only the codes that are\n * actually used. Unfortunately exporting ambient (const) enums from a library like `@solana/errors`\n * is not safe, for a variety of reasons covered here: https://stackoverflow.com/a/28818850\n */\nexport type SolanaErrorCode =\n | typeof SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND\n | typeof SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED\n | typeof SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT\n | typeof SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT\n | typeof SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND\n | typeof SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED\n | typeof SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS\n | typeof SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH\n | typeof SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY\n | typeof SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS\n | typeof SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE\n | typeof SOLANA_ERROR__ADDRESSES__MALFORMED_PDA\n | typeof SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED\n | typeof SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED\n | typeof SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE\n | typeof SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER\n | typeof SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE\n | typeof SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED\n | typeof SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE\n | typeof SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY\n | typeof SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS\n | typeof SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL\n | typeof SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH\n | typeof SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH\n | typeof SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH\n | typeof SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE\n | typeof SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY\n | typeof SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH\n | typeof SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH\n | typeof SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH\n | typeof SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE\n | typeof SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH\n | typeof SOLANA_ERROR__CODECS__INVALID_CONSTANT\n | typeof SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT\n | typeof SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT\n | typeof SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT\n | typeof SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS\n | typeof SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE\n | typeof SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE\n | typeof SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE\n | typeof SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE\n | typeof SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES\n | typeof SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE\n | typeof SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED\n | typeof SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS\n | typeof SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA\n | typeof SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR\n | typeof SOLANA_ERROR__INSTRUCTION_PLANS__EMPTY_INSTRUCTION_PLAN\n | typeof SOLANA_ERROR__INSTRUCTION_PLANS__EXPECTED_SUCCESSFUL_TRANSACTION_PLAN_RESULT\n | typeof SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_SINGLE_TRANSACTION_PLAN_RESULT_NOT_FOUND\n | typeof SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN\n | typeof SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_CANNOT_ACCOMMODATE_PLAN\n | typeof SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_PACKER_ALREADY_COMPLETE\n | typeof SOLANA_ERROR__INSTRUCTION_PLANS__NON_DIVISIBLE_TRANSACTION_PLANS_NOT_SUPPORTED\n | typeof SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_INSTRUCTION_PLAN\n | typeof SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN\n | typeof SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN_RESULT\n | typeof SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH\n | typeof SOLANA_ERROR__INVALID_NONCE\n | typeof SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING\n | typeof SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED\n | typeof SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_INSTRUCTION_PLAN_KIND\n | typeof SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_TRANSACTION_PLAN_KIND\n | typeof SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE\n | typeof SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING\n | typeof SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE\n | typeof SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR\n | typeof SOLANA_ERROR__JSON_RPC__INVALID_PARAMS\n | typeof SOLANA_ERROR__JSON_RPC__INVALID_REQUEST\n | typeof SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND\n | typeof SOLANA_ERROR__JSON_RPC__PARSE_ERROR\n | typeof SOLANA_ERROR__JSON_RPC__SCAN_ERROR\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE\n | typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION\n | typeof SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH\n | typeof SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH\n | typeof SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH\n | typeof SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY\n | typeof SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE\n | typeof SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE\n | typeof SOLANA_ERROR__MALFORMED_BIGINT_STRING\n | typeof SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR\n | typeof SOLANA_ERROR__MALFORMED_NUMBER_STRING\n | typeof SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__RESTRICTED_ASCII_BODY_CHARACTER_OUT_OF_RANGE\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_SORTED\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION\n | typeof SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED\n | typeof SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD\n | typeof SOLANA_ERROR__RPC__INTEGER_OVERFLOW\n | typeof SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR\n | typeof SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN\n | typeof SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN\n | typeof SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED\n | typeof SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED\n | typeof SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT\n | typeof SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID\n | typeof SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS\n | typeof SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER\n | typeof SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER\n | typeof SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER\n | typeof SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER\n | typeof SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER\n | typeof SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER\n | typeof SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER\n | typeof SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER\n | typeof SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS\n | typeof SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING\n | typeof SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED\n | typeof SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY\n | typeof SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED\n | typeof SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT\n | typeof SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED\n | typeof SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED\n | typeof SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED\n | typeof SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED\n | typeof SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED\n | typeof SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE\n | typeof SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING\n | typeof SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION\n | typeof SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES\n | typeof SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT\n | typeof SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME\n | typeof SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME\n | typeof SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING\n | typeof SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE\n | typeof SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING\n | typeof SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND\n | typeof SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT\n | typeof SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT\n | typeof SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING\n | typeof SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING\n | typeof SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE\n | typeof SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING\n | typeof SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES\n | typeof SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE\n | typeof SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH\n | typeof SOLANA_ERROR__TRANSACTION__NONCE_ACCOUNT_CANNOT_BE_IN_LOOKUP_TABLE\n | typeof SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING\n | typeof SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED\n | typeof SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT\n | typeof SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT;\n\n/**\n * Errors of this type are understood to have an optional {@link SolanaError} nested inside as\n * `cause`.\n */\nexport type SolanaErrorCodeWithCause = typeof SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE;\n\n/**\n * Errors of this type have a deprecated `cause` property. Consumers should use the error's\n * `context` instead to access relevant error information.\n */\nexport type SolanaErrorCodeWithDeprecatedCause =\n typeof SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN;\n","/**\n * To add a new error, follow the instructions at\n * https://github.com/anza-xyz/kit/tree/main/packages/errors/#adding-a-new-error\n *\n * @privateRemarks\n * WARNING:\n * - Don't change or remove members of an error's context.\n */\nimport {\n SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND,\n SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED,\n SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT,\n SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT,\n SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND,\n SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS,\n SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH,\n SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED,\n SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED,\n SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE,\n SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE,\n SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED,\n SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE,\n SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY,\n SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS,\n SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL,\n SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH,\n SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH,\n SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE,\n SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY,\n SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH,\n SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE,\n SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH,\n SOLANA_ERROR__CODECS__INVALID_CONSTANT,\n SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT,\n SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT,\n SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT,\n SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS,\n SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE,\n SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE,\n SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE,\n SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE,\n SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES,\n SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE,\n SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS,\n SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA,\n SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT,\n SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW,\n SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR,\n SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS,\n SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH,\n SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED,\n SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM,\n SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX,\n SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC,\n SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT,\n SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED,\n SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE,\n SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED,\n SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED,\n SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND,\n SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR,\n SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER,\n SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE,\n SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY,\n SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID,\n SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS,\n SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED,\n SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED,\n SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED,\n SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED,\n SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT,\n SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE,\n SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID,\n SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS,\n SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION,\n SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE,\n SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE,\n SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE,\n SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED,\n SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE,\n SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED,\n SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED,\n SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION,\n SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT,\n SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN,\n SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID,\n SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR,\n SOLANA_ERROR__INSTRUCTION_PLANS__EXPECTED_SUCCESSFUL_TRANSACTION_PLAN_RESULT,\n SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_SINGLE_TRANSACTION_PLAN_RESULT_NOT_FOUND,\n SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN,\n SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_CANNOT_ACCOMMODATE_PLAN,\n SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_INSTRUCTION_PLAN,\n SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN,\n SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN_RESULT,\n SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH,\n SOLANA_ERROR__INVALID_NONCE,\n SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING,\n SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED,\n SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_INSTRUCTION_PLAN_KIND,\n SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_TRANSACTION_PLAN_KIND,\n SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE,\n SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR,\n SOLANA_ERROR__JSON_RPC__INVALID_PARAMS,\n SOLANA_ERROR__JSON_RPC__INVALID_REQUEST,\n SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND,\n SOLANA_ERROR__JSON_RPC__PARSE_ERROR,\n SOLANA_ERROR__JSON_RPC__SCAN_ERROR,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION,\n SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH,\n SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH,\n SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH,\n SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE,\n SOLANA_ERROR__MALFORMED_BIGINT_STRING,\n SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR,\n SOLANA_ERROR__MALFORMED_NUMBER_STRING,\n SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED,\n SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD,\n SOLANA_ERROR__RPC__INTEGER_OVERFLOW,\n SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR,\n SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN,\n SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN,\n SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT,\n SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS,\n SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER,\n SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY,\n SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE,\n SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING,\n SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION,\n SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,\n SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES,\n SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE,\n SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH,\n SOLANA_ERROR__TRANSACTION__NONCE_ACCOUNT_CANNOT_BE_IN_LOOKUP_TABLE,\n SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING,\n SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED,\n SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE,\n SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION,\n SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT,\n SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED,\n SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN,\n SolanaErrorCode,\n} from './codes';\nimport { RpcSimulateTransactionResult } from './json-rpc-error';\n\ntype BasicInstructionErrorContext<T extends SolanaErrorCode> = { [P in T]: { index: number } };\n\ntype DefaultUnspecifiedErrorContextToUndefined<T> = {\n [P in SolanaErrorCode]: P extends keyof T ? T[P] : undefined;\n};\n\ntype ReadonlyContextValue<T> = {\n [P in keyof T]: Readonly<T[P]>;\n};\n\ntype TypedArrayMutableProperties = 'copyWithin' | 'fill' | 'reverse' | 'set' | 'sort';\ninterface ReadonlyUint8Array extends Omit<Uint8Array, TypedArrayMutableProperties> {\n readonly [n: number]: number;\n}\n\n/** A amount of bytes. */\ntype Bytes = number;\n\n/**\n * A map of every {@link SolanaError} code to the type of its `context` property.\n */\nexport type SolanaErrorContext = ReadonlyContextValue<\n DefaultUnspecifiedErrorContextToUndefined<\n BasicInstructionErrorContext<\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID\n | typeof SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR\n > & {\n [SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND]: {\n address: string;\n };\n [SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED]: {\n addresses: readonly string[];\n };\n [SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT]: {\n address: string;\n };\n [SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT]: {\n address: string;\n };\n [SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND]: {\n addresses: readonly string[];\n };\n [SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS]: {\n putativeAddress: string;\n };\n [SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH]: {\n actualLength: number;\n };\n [SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED]: {\n actual: number;\n maxSeeds: number;\n };\n [SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED]: {\n actual: number;\n index: number;\n maxSeedLength: number;\n };\n [SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE]: {\n bump: number;\n };\n [SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE]: {\n actualLength: number;\n };\n [SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE]: {\n actualLength: number;\n };\n [SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: {\n currentBlockHeight: bigint;\n lastValidBlockHeight: bigint;\n };\n [SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY]: {\n codecDescription: string;\n };\n [SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS]: {\n stringValues: readonly string[];\n };\n [SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL]: {\n encodedBytes: ReadonlyUint8Array;\n hexEncodedBytes: string;\n hexSentinel: string;\n sentinel: ReadonlyUint8Array;\n };\n [SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH]: {\n decoderFixedSize: number;\n encoderFixedSize: number;\n };\n [SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH]: {\n decoderMaxSize: number | undefined;\n encoderMaxSize: number | undefined;\n };\n [SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE]: {\n discriminator: bigint | number;\n formattedValidDiscriminators: string;\n validDiscriminators: readonly number[];\n };\n [SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY]: {\n expectedLength: number;\n numExcessBytes: number;\n };\n [SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH]: {\n bytesLength: number;\n codecDescription: string;\n };\n [SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE]: {\n codecDescription: string;\n expectedSize: number;\n hexZeroValue: string;\n zeroValue: ReadonlyUint8Array;\n };\n [SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH]: {\n bytesLength: number;\n codecDescription: string;\n expected: number;\n };\n [SOLANA_ERROR__CODECS__INVALID_CONSTANT]: {\n constant: ReadonlyUint8Array;\n data: ReadonlyUint8Array;\n hexConstant: string;\n hexData: string;\n offset: number;\n };\n [SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT]: {\n value: bigint | boolean | number | string | null | undefined;\n variants: readonly (bigint | boolean | number | string | null | undefined)[];\n };\n [SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT]: {\n formattedNumericalValues: string;\n numericalValues: readonly number[];\n stringValues: readonly string[];\n variant: number | string | symbol;\n };\n [SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT]: {\n value: bigint | boolean | number | string | null | undefined;\n variants: readonly (bigint | boolean | number | string | null | undefined)[];\n };\n [SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS]: {\n actual: bigint | number;\n codecDescription: string;\n expected: bigint | number;\n };\n [SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE]: {\n alphabet: string;\n base: number;\n value: string;\n };\n [SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE]: {\n discriminator: bigint | number;\n maxRange: number;\n minRange: number;\n };\n [SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE]: {\n codecDescription: string;\n max: bigint | number;\n min: bigint | number;\n value: bigint | number;\n };\n [SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE]: {\n bytesLength: number;\n codecDescription: string;\n offset: number;\n };\n [SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES]: {\n decodedBytes: ReadonlyUint8Array;\n hexDecodedBytes: string;\n hexSentinel: string;\n sentinel: ReadonlyUint8Array;\n };\n [SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE]: {\n maxRange: number;\n minRange: number;\n variant: number;\n };\n [SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR]: {\n index: number;\n };\n [SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM]: {\n code: number;\n index: number;\n };\n [SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN]: {\n errorName: string;\n index: number;\n instructionErrorContext?: unknown;\n };\n [SOLANA_ERROR__INSTRUCTION_PLANS__EXPECTED_SUCCESSFUL_TRANSACTION_PLAN_RESULT]: {\n transactionPlanResult: unknown;\n };\n [SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_SINGLE_TRANSACTION_PLAN_RESULT_NOT_FOUND]: {\n transactionPlanResult: unknown;\n };\n [SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN]: {\n transactionPlanResult: unknown;\n };\n [SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_CANNOT_ACCOMMODATE_PLAN]: {\n numBytesRequired: number;\n numFreeBytes: number;\n };\n [SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_INSTRUCTION_PLAN]: {\n actualKind: string;\n expectedKind: string;\n instructionPlan: unknown;\n };\n [SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN]: {\n actualKind: string;\n expectedKind: string;\n transactionPlan: unknown;\n };\n [SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN_RESULT]: {\n actualKind: string;\n expectedKind: string;\n transactionPlanResult: unknown;\n };\n [SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS]: {\n data?: ReadonlyUint8Array;\n programAddress: string;\n };\n [SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA]: {\n accountAddresses?: readonly string[];\n programAddress: string;\n };\n [SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH]: {\n actualProgramAddress: string;\n expectedProgramAddress: string;\n };\n [SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH]: {\n actualLength: number;\n };\n [SOLANA_ERROR__INVALID_NONCE]: {\n actualNonceValue: string;\n expectedNonceValue: string;\n };\n [SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING]: {\n cacheKey: string;\n };\n [SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED]: {\n channelName: string;\n supportedChannelNames: readonly string[];\n };\n [SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_INSTRUCTION_PLAN_KIND]: {\n kind: string;\n };\n [SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_TRANSACTION_PLAN_KIND]: {\n kind: string;\n };\n [SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE]: {\n unexpectedValue: unknown;\n };\n [SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__INVALID_PARAMS]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__INVALID_REQUEST]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__PARSE_ERROR]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__SCAN_ERROR]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE]: {\n currentBlockHeight: bigint;\n rewardsCompleteBlockHeight: bigint;\n slot: bigint;\n };\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED]: {\n contextSlot: bigint;\n };\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY]: {\n numSlotsBehind?: number;\n };\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE]: Omit<\n RpcSimulateTransactionResult,\n 'err'\n >;\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY]: {\n slot: bigint;\n };\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION]: {\n __serverMessage: string;\n };\n [SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH]: {\n byteLength: number;\n };\n [SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH]: {\n actualLength: number;\n };\n [SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH]: {\n actualLength: number;\n };\n [SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE]: {\n actualLength: number;\n };\n [SOLANA_ERROR__MALFORMED_BIGINT_STRING]: {\n value: string;\n };\n [SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR]: {\n error: unknown;\n message: string;\n };\n [SOLANA_ERROR__MALFORMED_NUMBER_STRING]: {\n value: string;\n };\n [SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: {\n nonceAccountAddress: string;\n };\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE]: {\n expectedAddresses: readonly string[];\n unexpectedAddresses: readonly string[];\n };\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE]: {\n actualLength: number;\n };\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH]: {\n missingRequiredSigners: readonly string[];\n unexpectedSigners: readonly string[];\n };\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH]: {\n actualLength: number;\n };\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED]: {\n actualBytes: number;\n maxBytes: number;\n };\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH]: {\n actualMessageFormat: number;\n expectedMessageFormat: number;\n };\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH]: {\n actualLength: number;\n specifiedLength: number;\n };\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH]: {\n numRequiredSignatures: number;\n signatoryAddresses: readonly string[];\n signaturesLength: number;\n };\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING]: {\n addresses: readonly string[];\n };\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE]: {\n signatoriesWithInvalidSignatures: readonly string[];\n signatoriesWithMissingSignatures: readonly string[];\n };\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION]: {\n actualVersion: number;\n expectedVersion: number;\n };\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED]: {\n unsupportedVersion: number;\n };\n [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN]: {\n notificationName: string;\n };\n [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT]: {\n errorEvent: Event;\n };\n [SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD]: {\n method: string;\n params: readonly unknown[];\n };\n [SOLANA_ERROR__RPC__INTEGER_OVERFLOW]: {\n argumentLabel: string;\n keyPath: readonly (number | string | symbol)[];\n methodName: string;\n optionalPathLabel: string;\n path?: string;\n value: bigint;\n };\n [SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR]: {\n headers: Headers;\n message: string;\n statusCode: number;\n };\n [SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN]: {\n headers: readonly string[];\n };\n [SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS]: {\n address: string;\n };\n [SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER]: {\n address: string;\n };\n [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER]: {\n address: string;\n };\n [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER]: {\n address: string;\n };\n [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER]: {\n address: string;\n };\n [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER]: {\n address: string;\n };\n [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER]: {\n address: string;\n };\n [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER]: {\n address: string;\n };\n [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER]: {\n address: string;\n };\n [SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY]: {\n key: CryptoKey;\n };\n [SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE]: {\n value: bigint;\n };\n [SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION]: {\n index: number;\n };\n [SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT]: {\n accountIndex: number;\n };\n [SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED]: {\n accountIndex: number;\n };\n [SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN]: {\n errorName: string;\n transactionErrorContext?: unknown;\n };\n [SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION]: {\n expectedAddresses: readonly string[];\n unexpectedAddresses: readonly string[];\n };\n [SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING]: {\n index: number;\n };\n [SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT]: {\n transactionSize: Bytes;\n transactionSizeLimit: Bytes;\n };\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING]: {\n lookupTableAddresses: readonly string[];\n };\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE]: {\n highestKnownIndex: number;\n highestRequestedIndex: number;\n lookupTableAddress: string;\n };\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND]: {\n index: number;\n };\n [SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT]: {\n unitsConsumed: number;\n };\n [SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES]: {\n programAddress: string;\n };\n [SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE]: {\n programAddress: string;\n };\n [SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH]: {\n numRequiredSignatures: number;\n signaturesLength: number;\n signerAddresses: readonly string[];\n };\n [SOLANA_ERROR__TRANSACTION__NONCE_ACCOUNT_CANNOT_BE_IN_LOOKUP_TABLE]: {\n nonce: string;\n };\n [SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING]: {\n addresses: readonly string[];\n };\n [SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED]: {\n unsupportedVersion: number;\n };\n [SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE]: {\n actualVersion: number;\n };\n }\n >\n>;\n\nexport function decodeEncodedContext(encodedContext: string): object {\n const decodedUrlString = __NODEJS__ ? Buffer.from(encodedContext, 'base64').toString('utf8') : atob(encodedContext);\n return Object.fromEntries(new URLSearchParams(decodedUrlString).entries());\n}\n\nfunction encodeValue(value: unknown): string {\n if (Array.isArray(value)) {\n const commaSeparatedValues = value.map(encodeValue).join('%2C%20' /* \", \" */);\n return '%5B' /* \"[\" */ + commaSeparatedValues + /* \"]\" */ '%5D';\n } else if (typeof value === 'bigint') {\n return `${value}n`;\n } else {\n return encodeURIComponent(\n String(\n value != null && Object.getPrototypeOf(value) === null\n ? // Plain objects with no prototype don't have a `toString` method.\n // Convert them before stringifying them.\n { ...(value as object) }\n : value,\n ),\n );\n }\n}\n\nfunction encodeObjectContextEntry([key, value]: [string, unknown]): `${typeof key}=${string}` {\n return `${key}=${encodeValue(value)}`;\n}\n\nexport function encodeContextObject(context: object): string {\n const searchParamsString = Object.entries(context).map(encodeObjectContextEntry).join('&');\n return __NODEJS__ ? Buffer.from(searchParamsString, 'utf8').toString('base64') : btoa(searchParamsString);\n}\n","/* eslint-disable sort-keys-fix/sort-keys-fix */\n/**\n * To add a new error, follow the instructions at\n * https://github.com/anza-xyz/kit/tree/main/packages/errors#adding-a-new-error\n *\n * WARNING:\n * - Don't change the meaning of an error message.\n */\nimport {\n SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND,\n SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED,\n SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT,\n SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT,\n SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND,\n SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED,\n SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS,\n SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH,\n SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY,\n SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS,\n SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE,\n SOLANA_ERROR__ADDRESSES__MALFORMED_PDA,\n SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED,\n SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED,\n SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE,\n SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER,\n SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE,\n SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED,\n SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE,\n SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY,\n SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS,\n SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL,\n SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH,\n SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH,\n SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH,\n SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE,\n SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY,\n SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH,\n SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH,\n SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH,\n SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE,\n SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH,\n SOLANA_ERROR__CODECS__INVALID_CONSTANT,\n SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT,\n SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT,\n SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT,\n SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS,\n SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE,\n SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE,\n SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE,\n SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE,\n SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES,\n SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE,\n SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED,\n SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS,\n SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA,\n SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE,\n SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT,\n SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW,\n SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR,\n SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS,\n SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH,\n SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED,\n SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM,\n SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX,\n SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC,\n SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT,\n SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED,\n SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE,\n SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED,\n SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED,\n SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND,\n SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR,\n SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER,\n SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE,\n SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY,\n SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID,\n SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC,\n SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS,\n SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED,\n SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED,\n SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED,\n SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED,\n SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT,\n SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE,\n SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID,\n SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS,\n SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION,\n SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE,\n SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE,\n SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE,\n SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED,\n SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE,\n SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED,\n SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED,\n SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION,\n SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT,\n SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN,\n SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID,\n SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR,\n SOLANA_ERROR__INSTRUCTION_PLANS__EMPTY_INSTRUCTION_PLAN,\n SOLANA_ERROR__INSTRUCTION_PLANS__EXPECTED_SUCCESSFUL_TRANSACTION_PLAN_RESULT,\n SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_SINGLE_TRANSACTION_PLAN_RESULT_NOT_FOUND,\n SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN,\n SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_CANNOT_ACCOMMODATE_PLAN,\n SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_PACKER_ALREADY_COMPLETE,\n SOLANA_ERROR__INSTRUCTION_PLANS__NON_DIVISIBLE_TRANSACTION_PLANS_NOT_SUPPORTED,\n SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_INSTRUCTION_PLAN,\n SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN,\n SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN_RESULT,\n SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH,\n SOLANA_ERROR__INVALID_NONCE,\n SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING,\n SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED,\n SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_INSTRUCTION_PLAN_KIND,\n SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_TRANSACTION_PLAN_KIND,\n SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE,\n SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING,\n SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE,\n SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR,\n SOLANA_ERROR__JSON_RPC__INVALID_PARAMS,\n SOLANA_ERROR__JSON_RPC__INVALID_REQUEST,\n SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND,\n SOLANA_ERROR__JSON_RPC__PARSE_ERROR,\n SOLANA_ERROR__JSON_RPC__SCAN_ERROR,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION,\n SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH,\n SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH,\n SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH,\n SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY,\n SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE,\n SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE,\n SOLANA_ERROR__MALFORMED_BIGINT_STRING,\n SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR,\n SOLANA_ERROR__MALFORMED_NUMBER_STRING,\n SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__RESTRICTED_ASCII_BODY_CHARACTER_OUT_OF_RANGE,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_SORTED,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION,\n SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED,\n SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD,\n SOLANA_ERROR__RPC__INTEGER_OVERFLOW,\n SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR,\n SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN,\n SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN,\n SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED,\n SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED,\n SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT,\n SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID,\n SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS,\n SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER,\n SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER,\n SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS,\n SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING,\n SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED,\n SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY,\n SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED,\n SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT,\n SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED,\n SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED,\n SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED,\n SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED,\n SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED,\n SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE,\n SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING,\n SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION,\n SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES,\n SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT,\n SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME,\n SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,\n SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING,\n SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING,\n SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE,\n SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING,\n SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES,\n SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE,\n SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH,\n SOLANA_ERROR__TRANSACTION__NONCE_ACCOUNT_CANNOT_BE_IN_LOOKUP_TABLE,\n SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING,\n SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED,\n SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE,\n SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING,\n SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE,\n SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE,\n SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND,\n SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND,\n SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED,\n SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND,\n SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP,\n SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE,\n SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION,\n SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE,\n SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT,\n SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE,\n SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX,\n SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA,\n SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX,\n SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER,\n SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT,\n SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION,\n SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT,\n SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT,\n SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED,\n SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE,\n SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND,\n SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED,\n SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED,\n SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE,\n SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE,\n SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS,\n SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION,\n SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN,\n SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION,\n SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT,\n SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT,\n SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT,\n SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT,\n SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT,\n SolanaErrorCode,\n} from './codes';\n\n/**\n * A map of every {@link SolanaError} code to the error message shown to developers in development\n * mode.\n */\nexport const SolanaErrorMessages: Readonly<{\n // This type makes this data structure exhaustive with respect to `SolanaErrorCode`.\n // TypeScript will fail to build this project if add an error code without a message.\n [P in SolanaErrorCode]: string;\n}> = {\n [SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND]: 'Account not found at address: $address',\n [SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED]:\n 'Not all accounts were decoded. Encoded accounts found at addresses: $addresses.',\n [SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT]: 'Expected decoded account at address: $address',\n [SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT]: 'Failed to decode account data at address: $address',\n [SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND]: 'Accounts not found at addresses: $addresses',\n [SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED]:\n 'Unable to find a viable program address bump seed.',\n [SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS]: '$putativeAddress is not a base58-encoded address.',\n [SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH]:\n 'Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.',\n [SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY]: 'The `CryptoKey` must be an `Ed25519` public key.',\n [SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS]:\n '$putativeOffCurveAddress is not a base58-encoded off-curve address.',\n [SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE]: 'Invalid seeds; point must fall off the Ed25519 curve.',\n [SOLANA_ERROR__ADDRESSES__MALFORMED_PDA]:\n 'Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].',\n [SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED]:\n 'A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.',\n [SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED]:\n 'The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.',\n [SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE]:\n 'Expected program derived address bump to be in the range [0, 255], got: $bump.',\n [SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER]: 'Program address cannot end with PDA marker.',\n [SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE]:\n 'Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.',\n [SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE]:\n 'Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.',\n [SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]:\n 'The network has progressed past the last block for which this transaction could have been committed.',\n [SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY]:\n 'Codec [$codecDescription] cannot decode empty byte arrays.',\n [SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS]:\n 'Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.',\n [SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL]:\n 'Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].',\n [SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH]:\n 'Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].',\n [SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH]:\n 'Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].',\n [SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH]:\n 'Encoder and decoder must either both be fixed-size or variable-size.',\n [SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE]:\n 'Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.',\n [SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH]: 'Expected a fixed-size codec, got a variable-size one.',\n [SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH]:\n 'Codec [$codecDescription] expected a positive byte length, got $bytesLength.',\n [SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH]: 'Expected a variable-size codec, got a fixed-size one.',\n [SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE]:\n 'Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].',\n [SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH]:\n 'Codec [$codecDescription] expected $expected bytes, got $bytesLength.',\n [SOLANA_ERROR__CODECS__INVALID_CONSTANT]:\n 'Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].',\n [SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT]:\n 'Invalid discriminated union variant. Expected one of [$variants], got $value.',\n [SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT]:\n 'Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.',\n [SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT]:\n 'Invalid literal union variant. Expected one of [$variants], got $value.',\n [SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS]:\n 'Expected [$codecDescription] to have $expected items, got $actual.',\n [SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE]: 'Invalid value $value for base $base with alphabet $alphabet.',\n [SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE]:\n 'Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.',\n [SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE]:\n 'Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.',\n [SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE]:\n 'Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.',\n [SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES]:\n 'Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].',\n [SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE]:\n 'Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.',\n [SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY]:\n 'This decoder expected a byte array of exactly $expectedLength bytes, but $numExcessBytes unexpected excess bytes remained after decoding. Are you sure that you have chosen the correct decoder for this data?',\n [SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED]: 'No random values implementation could be found.',\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED]: 'instruction requires an uninitialized account',\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED]:\n 'instruction tries to borrow reference for an account which is already borrowed',\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING]:\n 'instruction left account with an outstanding borrowed reference',\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED]:\n \"program other than the account's owner changed the size of the account data\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL]: 'account data too small for instruction',\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE]: 'instruction expected an executable account',\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT]:\n 'An account does not have enough lamports to be rent-exempt',\n [SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW]: 'Program arithmetic overflowed',\n [SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR]: 'Failed to serialize or deserialize account data: $encodedData',\n [SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS]:\n 'Builtin programs must consume compute units',\n [SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH]: 'Cross-program invocation call depth too deep',\n [SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED]: 'Computational budget exceeded',\n [SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM]: 'custom program error: #$code',\n [SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX]: 'instruction contains duplicate accounts',\n [SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC]:\n 'instruction modifications of multiply-passed account differ',\n [SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT]: 'executable accounts must be rent exempt',\n [SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED]: 'instruction changed executable accounts data',\n [SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE]:\n 'instruction changed the balance of an executable account',\n [SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED]: 'instruction changed executable bit of an account',\n [SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED]:\n 'instruction modified data of an account it does not own',\n [SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND]:\n 'instruction spent from the balance of an account it does not own',\n [SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR]: 'generic instruction error',\n [SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER]: 'Provided owner is not allowed',\n [SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE]: 'Account is immutable',\n [SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY]: 'Incorrect authority provided',\n [SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID]: 'incorrect program id for instruction',\n [SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS]: 'insufficient funds for instruction',\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA]: 'invalid account data for instruction',\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER]: 'Invalid account owner',\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT]: 'invalid program argument',\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR]: 'program returned invalid error code',\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA]: 'invalid instruction data',\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC]: 'Failed to reallocate account data',\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS]: 'Provided seeds do not result in a valid address',\n [SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED]:\n 'Accounts data allocations exceeded the maximum allowed per transaction',\n [SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED]: 'Max accounts exceeded',\n [SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED]: 'Max instruction trace length exceeded',\n [SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED]:\n 'Length of the seed is too long for address generation',\n [SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT]: 'An account required by the instruction is missing',\n [SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE]: 'missing required signature for instruction',\n [SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID]:\n 'instruction illegally modified the program id of an account',\n [SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS]: 'insufficient account keys for instruction',\n [SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION]:\n 'Cross-program invocation with unauthorized signer or writable account',\n [SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE]:\n 'Failed to create program execution environment',\n [SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE]: 'Program failed to compile',\n [SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE]: 'Program failed to complete',\n [SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED]: 'instruction modified data of a read-only account',\n [SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE]:\n 'instruction changed the balance of a read-only account',\n [SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED]:\n 'Cross-program invocation reentrancy not allowed for this instruction',\n [SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED]: 'instruction modified rent epoch of an account',\n [SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION]:\n 'sum of account balances before and after instruction do not match',\n [SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT]: 'instruction requires an initialized account',\n [SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN]: '',\n [SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID]: 'Unsupported program id',\n [SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR]: 'Unsupported sysvar',\n [SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_INSTRUCTION_PLAN_KIND]: 'Invalid instruction plan kind: $kind.',\n [SOLANA_ERROR__INSTRUCTION_PLANS__EMPTY_INSTRUCTION_PLAN]: 'The provided instruction plan is empty.',\n [SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_SINGLE_TRANSACTION_PLAN_RESULT_NOT_FOUND]:\n 'No failed transaction plan result was found in the provided transaction plan result.',\n [SOLANA_ERROR__INSTRUCTION_PLANS__NON_DIVISIBLE_TRANSACTION_PLANS_NOT_SUPPORTED]:\n 'This transaction plan executor does not support non-divisible sequential plans. To support them, you may create your own executor such that multi-transaction atomicity is preserved — e.g. by targetting RPCs that support transaction bundles.',\n [SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN]:\n 'The provided transaction plan failed to execute. See the `transactionPlanResult` attribute for more details. Note that the `cause` property is deprecated, and a future version will not set it.',\n [SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_CANNOT_ACCOMMODATE_PLAN]:\n 'The provided message has insufficient capacity to accommodate the next instruction(s) in this plan. Expected at least $numBytesRequired free byte(s), got $numFreeBytes byte(s).',\n [SOLANA_ERROR__INVARIANT_VIOLATION__INVALID_TRANSACTION_PLAN_KIND]: 'Invalid transaction plan kind: $kind.',\n [SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_PACKER_ALREADY_COMPLETE]:\n 'No more instructions to pack; the message packer has completed the instruction plan.',\n [SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_INSTRUCTION_PLAN]:\n 'Unexpected instruction plan. Expected $expectedKind plan, got $actualKind plan.',\n [SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN]:\n 'Unexpected transaction plan. Expected $expectedKind plan, got $actualKind plan.',\n [SOLANA_ERROR__INSTRUCTION_PLANS__UNEXPECTED_TRANSACTION_PLAN_RESULT]:\n 'Unexpected transaction plan result. Expected $expectedKind plan, got $actualKind plan.',\n [SOLANA_ERROR__INSTRUCTION_PLANS__EXPECTED_SUCCESSFUL_TRANSACTION_PLAN_RESULT]:\n 'Expected a successful transaction plan result. I.e. there is at least one failed or cancelled transaction in the plan.',\n [SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS]: 'The instruction does not have any accounts.',\n [SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA]: 'The instruction does not have any data.',\n [SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH]:\n 'Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.',\n [SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH]:\n 'Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.',\n [SOLANA_ERROR__INVALID_NONCE]:\n 'The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`',\n [SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING]:\n 'Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It ' +\n 'should be impossible to hit this error; please file an issue at ' +\n 'https://sola.na/web3invariant',\n [SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED]:\n 'Invariant violation: This data publisher does not publish to the channel named ' +\n '`$channelName`. Supported channels include $supportedChannelNames.',\n [SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE]:\n 'Invariant violation: WebSocket message iterator state is corrupt; iterated without first ' +\n 'resolving existing message promise. It should be impossible to hit this error; please ' +\n 'file an issue at https://sola.na/web3invariant',\n [SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING]:\n 'Invariant violation: WebSocket message iterator is missing state storage. It should be ' +\n 'impossible to hit this error; please file an issue at https://sola.na/web3invariant',\n [SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE]:\n 'Invariant violation: Switch statement non-exhaustive. Received unexpected value ' +\n '`$unexpectedValue`. It should be impossible to hit this error; please file an issue at ' +\n 'https://sola.na/web3invariant',\n [SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR]: 'JSON-RPC error: Internal JSON-RPC error ($__serverMessage)',\n [SOLANA_ERROR__JSON_RPC__INVALID_PARAMS]: 'JSON-RPC error: Invalid method parameter(s) ($__serverMessage)',\n [SOLANA_ERROR__JSON_RPC__INVALID_REQUEST]:\n 'JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)',\n [SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND]:\n 'JSON-RPC error: The method does not exist / is not available ($__serverMessage)',\n [SOLANA_ERROR__JSON_RPC__PARSE_ERROR]:\n 'JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)',\n [SOLANA_ERROR__JSON_RPC__SCAN_ERROR]: '$__serverMessage',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP]: '$__serverMessage',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE]: '$__serverMessage',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET]: '$__serverMessage',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_EPOCH_REWARDS_PERIOD_ACTIVE]:\n 'Epoch rewards period still active at slot $slot',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX]: '$__serverMessage',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED]: '$__serverMessage',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_UNREACHABLE]:\n 'Failed to query long-term storage; please try again',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED]: 'Minimum context slot has not been reached',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY]: 'Node is unhealthy; behind by $numSlotsBehind slots',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT]: 'No snapshot',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE]: 'Transaction simulation failed',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_NOT_EPOCH_BOUNDARY]:\n \"Rewards cannot be found because slot $slot is not the epoch boundary. This may be due to gap in the queried node's local ledger or long-term storage\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED]: '$__serverMessage',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE]:\n 'Transaction history is not available from this node',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE]: '$__serverMessage',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH]: 'Transaction signature length mismatch',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE]:\n 'Transaction signature verification failure',\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION]: '$__serverMessage',\n [SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH]: 'Key pair bytes must be of length 64, got $byteLength.',\n [SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH]:\n 'Expected private key bytes with length 32. Actual length: $actualLength.',\n [SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH]:\n 'Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.',\n [SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY]:\n 'The provided private key does not match the provided public key.',\n [SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE]:\n 'Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.',\n [SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE]: 'Lamports value must be in the range [0, 2e64-1]',\n [SOLANA_ERROR__MALFORMED_BIGINT_STRING]: '`$value` cannot be parsed as a `BigInt`',\n [SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR]: '$message',\n [SOLANA_ERROR__MALFORMED_NUMBER_STRING]: '`$value` cannot be parsed as a `Number`',\n [SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: 'No nonce account could be found at address `$nonceAccountAddress`',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__INVALID_APPLICATION_DOMAIN_BYTE_LENGTH]:\n 'Expected base58 encoded application domain to decode to a byte array of length 32. Actual length: $actualLength.',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__ADDRESSES_CANNOT_SIGN_OFFCHAIN_MESSAGE]:\n 'Attempted to sign an offchain message with an address that is not a signer for it',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__APPLICATION_DOMAIN_STRING_LENGTH_OUT_OF_RANGE]:\n 'Expected base58-encoded application domain string of length in the range [32, 44]. Actual length: $actualLength.',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__ENVELOPE_SIGNERS_MISMATCH]:\n 'The signer addresses in this offchain message envelope do not match the list of ' +\n 'required signers in the message preamble. These unexpected signers were present in the ' +\n 'envelope: `[$unexpectedSigners]`. These required signers were missing from the envelope ' +\n '`[$missingSigners]`.',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__MAXIMUM_LENGTH_EXCEEDED]:\n 'The message body provided has a byte-length of $actualBytes. The maximum allowable ' +\n 'byte-length is $maxBytes',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_FORMAT_MISMATCH]:\n 'Expected message format $expectedMessageFormat, got $actualMessageFormat',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_LENGTH_MISMATCH]:\n 'The message length specified in the message preamble is $specifiedLength bytes. The actual length of the message is $actualLength bytes.',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__MESSAGE_MUST_BE_NON_EMPTY]: 'Offchain message content must be non-empty',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_REQUIRED_SIGNERS_CANNOT_BE_ZERO]:\n 'Offchain message must specify the address of at least one required signer',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_ENVELOPE_SIGNATURES_CANNOT_BE_ZERO]:\n 'Offchain message envelope must reserve space for at least one signature',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__NUM_SIGNATURES_MISMATCH]:\n 'The offchain message preamble specifies $numRequiredSignatures required signature(s), got $signaturesLength.',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_SORTED]:\n 'The signatories of this offchain message must be listed in lexicographical order',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATORIES_MUST_BE_UNIQUE]:\n 'An address must be listed no more than once among the signatories of an offchain message',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURES_MISSING]:\n 'Offchain message is missing signatures for addresses: $addresses.',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__SIGNATURE_VERIFICATION_FAILURE]:\n 'Offchain message signature verification failed. Signature mismatch for required ' +\n 'signatories [$signatoriesWithInvalidSignatures]. Missing signatures for signatories ' +\n '[$signatoriesWithMissingSignatures]',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__RESTRICTED_ASCII_BODY_CHARACTER_OUT_OF_RANGE]:\n 'The message body provided contains characters whose codes fall outside the allowed ' +\n 'range. In order to ensure clear-signing compatiblity with hardware wallets, the message ' +\n 'may only contain line feeds and characters in the range [\\\\x20-\\\\x7e].',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__UNEXPECTED_VERSION]:\n 'Expected offchain message version $expectedVersion. Got $actualVersion.',\n [SOLANA_ERROR__OFFCHAIN_MESSAGE__VERSION_NUMBER_NOT_SUPPORTED]:\n 'This version of Kit does not support decoding offchain messages with version ' +\n '$unsupportedVersion. The current max supported version is 0.',\n [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN]:\n \"The notification name must end in 'Notifications' and the API must supply a \" +\n \"subscription plan creator function for the notification '$notificationName'.\",\n [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED]:\n 'WebSocket was closed before payload could be added to the send buffer',\n [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED]: 'WebSocket connection closed',\n [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT]: 'WebSocket failed to connect',\n [SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID]:\n 'Failed to obtain a subscription id from the server',\n [SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD]: 'Could not find an API plan for RPC method: `$method`',\n [SOLANA_ERROR__RPC__INTEGER_OVERFLOW]:\n 'The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was ' +\n '`$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds ' +\n '`Number.MAX_SAFE_INTEGER`.',\n [SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR]: 'HTTP error ($statusCode): $message',\n [SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN]:\n 'HTTP header(s) forbidden: $headers. Learn more at ' +\n 'https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.',\n [SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS]:\n 'Multiple distinct signers were identified for address `$address`. Please ensure that ' +\n 'you are using the same signer instance for each address.',\n [SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER]:\n 'The provided value does not implement the `KeyPairSigner` interface',\n [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER]:\n 'The provided value does not implement the `MessageModifyingSigner` interface',\n [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER]:\n 'The provided value does not implement the `MessagePartialSigner` interface',\n [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER]:\n 'The provided value does not implement any of the `MessageSigner` interfaces',\n [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER]:\n 'The provided value does not implement the `TransactionModifyingSigner` interface',\n [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER]:\n 'The provided value does not implement the `TransactionPartialSigner` interface',\n [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER]:\n 'The provided value does not implement the `TransactionSendingSigner` interface',\n [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER]:\n 'The provided value does not implement any of the `TransactionSigner` interfaces',\n [SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS]:\n 'More than one `TransactionSendingSigner` was identified.',\n [SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING]:\n 'No `TransactionSendingSigner` was identified. Please provide a valid ' +\n '`TransactionWithSingleSendingSigner` transaction.',\n [SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED]:\n 'Wallet account signers do not support signing multiple messages/transactions in a single operation',\n [SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY]: 'Cannot export a non-extractable key.',\n [SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED]: 'No digest implementation could be found.',\n [SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT]:\n 'Cryptographic operations are only allowed in secure browser contexts. Read more ' +\n 'here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.',\n [SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED]:\n 'This runtime does not support the generation of Ed25519 key pairs.\\n\\nInstall ' +\n '@solana/webcrypto-ed25519-polyfill and call its `install` function before generating keys in ' +\n 'environments that do not support Ed25519.\\n\\nFor a list of runtimes that ' +\n 'currently support Ed25519 operations, visit ' +\n 'https://github.com/WICG/webcrypto-secure-curves/issues/20.',\n [SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED]:\n 'No signature verification implementation could be found.',\n [SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED]: 'No key generation implementation could be found.',\n [SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED]: 'No signing implementation could be found.',\n [SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED]: 'No key export implementation could be found.',\n [SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE]:\n 'Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given',\n [SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING]:\n 'Transaction processing left an account with an outstanding borrowed reference',\n [SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE]: 'Account in use',\n [SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE]: 'Account loaded twice',\n [SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND]:\n 'Attempt to debit an account but found no record of a prior credit.',\n [SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND]:\n \"Transaction loads an address table account that doesn't exist\",\n [SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED]: 'This transaction has already been processed',\n [SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND]: 'Blockhash not found',\n [SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP]: 'Loader call chain is too deep',\n [SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE]:\n 'Transactions are currently disabled due to cluster maintenance',\n [SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION]:\n 'Transaction contains a duplicate instruction ($index) that is not allowed',\n [SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE]: 'Insufficient funds for fee',\n [SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT]:\n 'Transaction results in an account ($accountIndex) with insufficient funds for rent',\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE]: 'This account may not be used to pay transaction fees',\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX]: 'Transaction contains an invalid account reference',\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA]:\n 'Transaction loads an address table account with invalid data',\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX]:\n 'Transaction address table lookup uses an invalid index',\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER]:\n 'Transaction loads an address table account with an invalid owner',\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT]:\n 'LoadedAccountsDataSizeLimit set for transaction must be greater than 0.',\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION]:\n 'This program may not be used for executing instructions',\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT]:\n 'Transaction leaves an account with a lower balance than rent-exempt minimum',\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT]:\n 'Transaction loads a writable account that cannot be written',\n [SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED]:\n 'Transaction exceeded max loaded accounts data size cap',\n [SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE]:\n 'Transaction requires a fee but has no signature present',\n [SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND]: 'Attempt to load a program that does not exist',\n [SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED]:\n 'Execution of the program referenced by account at index $accountIndex is temporarily restricted.',\n [SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED]: 'ResanitizationNeeded',\n [SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE]: 'Transaction failed to sanitize accounts offsets correctly',\n [SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE]: 'Transaction did not pass signature verification',\n [SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS]: 'Transaction locked too many accounts',\n [SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION]:\n 'Sum of account balances before and after transaction do not match',\n [SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN]: 'The transaction failed with the error `$errorName`',\n [SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION]: 'Transaction version is unsupported',\n [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT]:\n 'Transaction would exceed account data limit within the block',\n [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT]:\n 'Transaction would exceed total account data limit',\n [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT]:\n 'Transaction would exceed max account limit within the block',\n [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT]:\n 'Transaction would exceed max Block Cost Limit',\n [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT]: 'Transaction would exceed max Vote Cost Limit',\n [SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION]:\n 'Attempted to sign a transaction with an address that is not a signer for it',\n [SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING]: 'Transaction is missing an address at index: $index.',\n [SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES]:\n 'Transaction has no expected signers therefore it cannot be encoded',\n [SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT]:\n 'Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes',\n [SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME]: 'Transaction does not have a blockhash lifetime',\n [SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME]: 'Transaction is not a durable nonce transaction',\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING]:\n 'Contents of these address lookup tables unknown: $lookupTableAddresses',\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE]:\n 'Lookup of address at index $highestRequestedIndex failed for lookup table ' +\n '`$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table ' +\n 'may have been extended since its contents were retrieved',\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING]: 'No fee payer set in CompiledTransaction',\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND]:\n 'Could not find program address at index $index',\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT]:\n 'Failed to estimate the compute unit consumption for this transaction message. This is ' +\n 'likely because simulating the transaction failed. Inspect the `cause` property of this ' +\n 'error to learn more',\n [SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT]:\n 'Transaction failed when it was simulated in order to estimate the compute unit consumption. ' +\n 'The compute unit estimate provided is for a transaction that failed when simulated and may not ' +\n 'be representative of the compute units this transaction would consume if successful. Inspect the ' +\n '`cause` property of this error to learn more',\n [SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING]: 'Transaction is missing a fee payer.',\n [SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING]:\n \"Could not determine this transaction's signature. Make sure that the transaction has \" +\n 'been signed by its fee payer.',\n [SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE]:\n 'Transaction first instruction is not advance nonce account instruction.',\n [SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING]:\n 'Transaction with no instructions cannot be durable nonce transaction.',\n [SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES]:\n 'This transaction includes an address (`$programAddress`) which is both ' +\n 'invoked and set as the fee payer. Program addresses may not pay fees',\n [SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE]:\n 'This transaction includes an address (`$programAddress`) which is both invoked and ' +\n 'marked writable. Program addresses may not be writable',\n [SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH]:\n 'The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.',\n [SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING]: 'Transaction is missing signatures for addresses: $addresses.',\n [SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE]:\n 'Transaction version must be in the range [0, 127]. `$actualVersion` given',\n [SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED]:\n 'This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.',\n [SOLANA_ERROR__TRANSACTION__NONCE_ACCOUNT_CANNOT_BE_IN_LOOKUP_TABLE]:\n 'The transaction has a durable nonce lifetime (with nonce `$nonce`), but the nonce account address is in a lookup table. The lifetime constraint cannot be constructed without fetching the lookup tables for the transaction.',\n};\n","import { SolanaErrorCode } from './codes';\nimport { encodeContextObject } from './context';\nimport { SolanaErrorMessages } from './messages';\n\nconst enum StateType {\n EscapeSequence,\n Text,\n Variable,\n}\ntype State = Readonly<{\n [START_INDEX]: number;\n [TYPE]: StateType;\n}>;\nconst START_INDEX = 'i';\nconst TYPE = 't';\n\nexport function getHumanReadableErrorMessage<TErrorCode extends SolanaErrorCode>(\n code: TErrorCode,\n context: object = {},\n): string {\n const messageFormatString = SolanaErrorMessages[code];\n if (messageFormatString.length === 0) {\n return '';\n }\n let state: State;\n function commitStateUpTo(endIndex?: number) {\n if (state[TYPE] === StateType.Variable) {\n const variableName = messageFormatString.slice(state[START_INDEX] + 1, endIndex);\n\n fragments.push(\n variableName in context\n ? // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `${context[variableName as keyof typeof context]}`\n : `$${variableName}`,\n );\n } else if (state[TYPE] === StateType.Text) {\n fragments.push(messageFormatString.slice(state[START_INDEX], endIndex));\n }\n }\n const fragments: string[] = [];\n messageFormatString.split('').forEach((char, ii) => {\n if (ii === 0) {\n state = {\n [START_INDEX]: 0,\n [TYPE]:\n messageFormatString[0] === '\\\\'\n ? StateType.EscapeSequence\n : messageFormatString[0] === '$'\n ? StateType.Variable\n : StateType.Text,\n };\n return;\n }\n let nextState;\n switch (state[TYPE]) {\n case StateType.EscapeSequence:\n nextState = { [START_INDEX]: ii, [TYPE]: StateType.Text };\n break;\n case StateType.Text:\n if (char === '\\\\') {\n nextState = { [START_INDEX]: ii, [TYPE]: StateType.EscapeSequence };\n } else if (char === '$') {\n nextState = { [START_INDEX]: ii, [TYPE]: StateType.Variable };\n }\n break;\n case StateType.Variable:\n if (char === '\\\\') {\n nextState = { [START_INDEX]: ii, [TYPE]: StateType.EscapeSequence };\n } else if (char === '$') {\n nextState = { [START_INDEX]: ii, [TYPE]: StateType.Variable };\n } else if (!char.match(/\\w/)) {\n nextState = { [START_INDEX]: ii, [TYPE]: StateType.Text };\n }\n break;\n }\n if (nextState) {\n if (state !== nextState) {\n commitStateUpTo(ii);\n }\n state = nextState;\n }\n });\n commitStateUpTo();\n return fragments.join('');\n}\n\nexport function getErrorMessage<TErrorCode extends SolanaErrorCode>(\n code: TErrorCode,\n context: Record<string, unknown> = {},\n): string {\n if (process.env.NODE_ENV !== \"production\") {\n return getHumanReadableErrorMessage(code, context);\n } else {\n let decodingAdviceMessage = `Solana error #${code}; Decode this error by running \\`npx @solana/errors decode -- ${code}`;\n if (Object.keys(context).length) {\n /**\n * DANGER: Be sure that the shell command is escaped in such a way that makes it\n * impossible for someone to craft malicious context values that would result in\n * an exploit against anyone who bindly copy/pastes it into their terminal.\n */\n decodingAdviceMessage += ` '${encodeContextObject(context)}'`;\n }\n return `${decodingAdviceMessage}\\``;\n }\n}\n","import { SolanaErrorCode, SolanaErrorCodeWithCause, SolanaErrorCodeWithDeprecatedCause } from './codes';\nimport { SolanaErrorContext } from './context';\nimport { getErrorMessage } from './message-formatter';\n\n/**\n * A variant of {@link SolanaError} where the `cause` property is deprecated.\n *\n * This type is returned by {@link isSolanaError} when checking for error codes in\n * {@link SolanaErrorCodeWithDeprecatedCause}. Accessing `cause` on these errors will show\n * a deprecation warning in IDEs that support JSDoc `@deprecated` tags.\n */\nexport interface SolanaErrorWithDeprecatedCause<\n TErrorCode extends SolanaErrorCodeWithDeprecatedCause = SolanaErrorCodeWithDeprecatedCause,\n> extends Omit<SolanaError<TErrorCode>, 'cause'> {\n /**\n * @deprecated The `cause` property is deprecated for this error code.\n * Use the error's `context` property instead to access relevant error information.\n */\n readonly cause?: unknown;\n}\n\n/**\n * A type guard that returns `true` if the input is a {@link SolanaError}, optionally with a\n * particular error code.\n *\n * When the `code` argument is supplied and the input is a {@link SolanaError}, TypeScript will\n * refine the error's {@link SolanaError#context | `context`} property to the type associated with\n * that error code. You can use that context to render useful error messages, or to make\n * context-aware decisions that help your application to recover from the error.\n *\n * @example\n * ```ts\n * import {\n * SOLANA_ERROR__TRANSACTION__MISSING_SIGNATURE,\n * SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING,\n * isSolanaError,\n * } from '@solana/errors';\n * import { assertIsFullySignedTransaction, getSignatureFromTransaction } from '@solana/transactions';\n *\n * try {\n * const transactionSignature = getSignatureFromTransaction(tx);\n * assertIsFullySignedTransaction(tx);\n * /* ... *\\/\n * } catch (e) {\n * if (isSolanaError(e, SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING)) {\n * displayError(\n * \"We can't send this transaction without signatures for these addresses:\\n- %s\",\n * // The type of the `context` object is now refined to contain `addresses`.\n * e.context.addresses.join('\\n- '),\n * );\n * return;\n * } else if (isSolanaError(e, SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING)) {\n * if (!tx.feePayer) {\n * displayError('Choose a fee payer for this transaction before sending it');\n * } else {\n * displayError('The fee payer still needs to sign for this transaction');\n * }\n * return;\n * }\n * throw e;\n * }\n * ```\n */\nexport function isSolanaError<TErrorCode extends SolanaErrorCodeWithDeprecatedCause>(\n e: unknown,\n code: TErrorCode,\n): e is SolanaErrorWithDeprecatedCause<TErrorCode>;\nexport function isSolanaError<TErrorCode extends SolanaErrorCode>(\n e: unknown,\n code?: TErrorCode,\n): e is SolanaError<TErrorCode>;\nexport function isSolanaError<TErrorCode extends SolanaErrorCode>(\n e: unknown,\n /**\n * When supplied, this function will require that the input is a {@link SolanaError} _and_ that\n * its error code is exactly this value.\n */\n code?: TErrorCode,\n): e is SolanaError<TErrorCode> {\n const isSolanaError = e instanceof Error && e.name === 'SolanaError';\n if (isSolanaError) {\n if (code !== undefined) {\n return (e as SolanaError<TErrorCode>).context.__code === code;\n }\n return true;\n }\n return false;\n}\n\ntype SolanaErrorCodedContext = {\n [P in SolanaErrorCode]: Readonly<{\n __code: P;\n }> &\n (SolanaErrorContext[P] extends undefined ? object : SolanaErrorContext[P]);\n};\n\n/**\n * Encapsulates an error's stacktrace, a Solana-specific numeric code that indicates what went\n * wrong, and optional context if the type of error indicated by the code supports it.\n */\nexport class SolanaError<TErrorCode extends SolanaErrorCode = SolanaErrorCode> extends Error {\n /**\n * Indicates the root cause of this {@link SolanaError}, if any.\n *\n * For example, a transaction error might have an instruction error as its root cause. In this\n * case, you will be able to access the instruction error on the transaction error as `cause`.\n */\n readonly cause?: TErrorCode extends SolanaErrorCodeWithCause ? SolanaError : unknown = this.cause;\n /**\n * Contains context that can assist in understanding or recovering from a {@link SolanaError}.\n */\n readonly context: SolanaErrorCodedContext[TErrorCode];\n constructor(\n ...[code, contextAndErrorOptions]: SolanaErrorContext[TErrorCode] extends undefined\n ? [code: TErrorCode, errorOptions?: ErrorOptions | undefined]\n : [code: TErrorCode, contextAndErrorOptions: SolanaErrorContext[TErrorCode] & (ErrorOptions | undefined)]\n ) {\n let context: SolanaErrorContext[TErrorCode] | undefined;\n let errorOptions: ErrorOptions | undefined;\n if (contextAndErrorOptions) {\n Object.entries(Object.getOwnPropertyDescriptors(contextAndErrorOptions)).forEach(([name, descriptor]) => {\n // If the `ErrorOptions` type ever changes, update this code.\n if (name === 'cause') {\n errorOptions = { cause: descriptor.value };\n } else {\n if (context === undefined) {\n context = {\n __code: code,\n } as unknown as SolanaErrorContext[TErrorCode];\n }\n Object.defineProperty(context, name, descriptor);\n }\n });\n }\n const message = getErrorMessage(code, context);\n super(message, errorOptions);\n this.context = Object.freeze(\n context === undefined\n ? {\n __code: code,\n }\n : context,\n ) as SolanaErrorCodedContext[TErrorCode];\n // This is necessary so that `isSolanaError()` can identify a `SolanaError` without having\n // to import the class for use in an `instanceof` check.\n this.name = 'SolanaError';\n }\n}\n","export function safeCaptureStackTrace(...args: Parameters<typeof Error.captureStackTrace>): void {\n if ('captureStackTrace' in Error && typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(...args);\n }\n}\n","import { SolanaErrorCode } from './codes';\nimport { SolanaErrorContext } from './context';\nimport { SolanaError } from './error';\nimport { safeCaptureStackTrace } from './stack-trace';\n\ntype Config = Readonly<{\n /**\n * Oh, hello. You might wonder what in tarnation is going on here. Allow us to explain.\n *\n * One of the goals of `@solana/errors` is to allow errors that are not interesting to your\n * application to shake out of your app bundle in production. This means that we must never\n * export large hardcoded maps of error codes/messages.\n *\n * Unfortunately, where instruction and transaction errors from the RPC are concerned, we have\n * no choice but to keep a map between the RPC `rpcEnumError` enum name and its corresponding\n * `SolanaError` code. In the interest of implementing that map in as few bytes of source code\n * as possible, we do the following:\n *\n * 1. Reserve a block of sequential error codes for the enum in question\n * 2. Hardcode the list of enum names in that same order\n * 3. Match the enum error name from the RPC with its index in that list, and reconstruct the\n * `SolanaError` code by adding the `errorCodeBaseOffset` to that index\n */\n errorCodeBaseOffset: number;\n getErrorContext: (\n errorCode: SolanaErrorCode,\n rpcErrorName: string,\n rpcErrorContext?: unknown,\n ) => SolanaErrorContext[SolanaErrorCode];\n orderedErrorNames: string[];\n rpcEnumError: string | { [key: string]: unknown };\n}>;\n\nexport function getSolanaErrorFromRpcError(\n { errorCodeBaseOffset, getErrorContext, orderedErrorNames, rpcEnumError }: Config,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n constructorOpt: Function,\n): SolanaError {\n let rpcErrorName;\n let rpcErrorContext;\n if (typeof rpcEnumError === 'string') {\n rpcErrorName = rpcEnumError;\n } else {\n rpcErrorName = Object.keys(rpcEnumError)[0];\n rpcErrorContext = rpcEnumError[rpcErrorName];\n }\n const codeOffset = orderedErrorNames.indexOf(rpcErrorName);\n const errorCode = (errorCodeBaseOffset + codeOffset) as SolanaErrorCode;\n const errorContext = getErrorContext(errorCode, rpcErrorName, rpcErrorContext);\n const err = new SolanaError(errorCode, errorContext);\n safeCaptureStackTrace(err, constructorOpt);\n return err;\n}\n","import { SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN } from './codes';\nimport { SolanaError } from './error';\nimport { getSolanaErrorFromRpcError } from './rpc-enum-errors';\n\nconst ORDERED_ERROR_NAMES = [\n // Keep synced with RPC source: https://github.com/anza-xyz/solana-sdk/blob/master/instruction-error/src/lib.rs\n // If this list ever gets too large, consider implementing a compression strategy like this:\n // https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47\n 'GenericError',\n 'InvalidArgument',\n 'InvalidInstructionData',\n 'InvalidAccountData',\n 'AccountDataTooSmall',\n 'InsufficientFunds',\n 'IncorrectProgramId',\n 'MissingRequiredSignature',\n 'AccountAlreadyInitialized',\n 'UninitializedAccount',\n 'UnbalancedInstruction',\n 'ModifiedProgramId',\n 'ExternalAccountLamportSpend',\n 'ExternalAccountDataModified',\n 'ReadonlyLamportChange',\n 'ReadonlyDataModified',\n 'DuplicateAccountIndex',\n 'ExecutableModified',\n 'RentEpochModified',\n 'NotEnoughAccountKeys',\n 'AccountDataSizeChanged',\n 'AccountNotExecutable',\n 'AccountBorrowFailed',\n 'AccountBorrowOutstanding',\n 'DuplicateAccountOutOfSync',\n 'Custom',\n 'InvalidError',\n 'ExecutableDataModified',\n 'ExecutableLamportChange',\n 'ExecutableAccountNotRentExempt',\n 'UnsupportedProgramId',\n 'CallDepth',\n 'MissingAccount',\n 'ReentrancyNotAllowed',\n 'MaxSeedLengthExceeded',\n 'InvalidSeeds',\n 'InvalidRealloc',\n 'ComputationalBudgetExceeded',\n 'PrivilegeEscalation',\n 'ProgramEnvironmentSetupFailure',\n 'ProgramFailedToComplete',\n 'ProgramFailedToCompile',\n 'Immutable',\n 'IncorrectAuthority',\n 'BorshIoError',\n 'AccountNotRentExempt',\n 'InvalidAccountOwner',\n 'ArithmeticOverflow',\n 'UnsupportedSysvar',\n 'IllegalOwner',\n 'MaxAccountsDataAllocationsExceeded',\n 'MaxAccountsExceeded',\n 'MaxInstructionTraceLengthExceeded',\n 'BuiltinProgramsMustConsumeComputeUnits',\n];\n\nexport function getSolanaErrorFromInstructionError(\n /**\n * The index of the instruction inside the transaction.\n */\n index: bigint | number,\n instructionError: string | { [key: string]: unknown },\n): SolanaError {\n const numberIndex = Number(index);\n return getSolanaErrorFromRpcError(\n {\n errorCodeBaseOffset: 4615001,\n getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {\n if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN) {\n return {\n errorName: rpcErrorName,\n index: numberIndex,\n ...(rpcErrorContext !== undefined ? { instructionErrorContext: rpcErrorContext } : null),\n };\n } else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM) {\n return {\n code: Number(rpcErrorContext as bigint | number),\n index: numberIndex,\n };\n }\n return { index: numberIndex };\n },\n orderedErrorNames: ORDERED_ERROR_NAMES,\n rpcEnumError: instructionError,\n },\n getSolanaErrorFromInstructionError,\n );\n}\n","import {\n SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION,\n SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT,\n SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED,\n SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN,\n} from './codes';\nimport { SolanaError } from './error';\nimport { getSolanaErrorFromInstructionError } from './instruction-error';\nimport { getSolanaErrorFromRpcError } from './rpc-enum-errors';\n\n/**\n * How to add an error when an entry is added to the RPC `TransactionError` enum:\n *\n * 1. Follow the instructions in `./codes.ts` to add a corresponding Solana error code\n * 2. Add the `TransactionError` enum name in the same order as it appears in `./codes.ts`\n * 3. Add the new error name/code mapping to `./__tests__/transaction-error-test.ts`\n */\nconst ORDERED_ERROR_NAMES = [\n // Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/src/transaction/error.rs\n // If this list ever gets too large, consider implementing a compression strategy like this:\n // https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47\n 'AccountInUse',\n 'AccountLoadedTwice',\n 'AccountNotFound',\n 'ProgramAccountNotFound',\n 'InsufficientFundsForFee',\n 'InvalidAccountForFee',\n 'AlreadyProcessed',\n 'BlockhashNotFound',\n // `InstructionError` intentionally omitted; delegated to `getSolanaErrorFromInstructionError`\n 'CallChainTooDeep',\n 'MissingSignatureForFee',\n 'InvalidAccountIndex',\n 'SignatureFailure',\n 'InvalidProgramForExecution',\n 'SanitizeFailure',\n 'ClusterMaintenance',\n 'AccountBorrowOutstanding',\n 'WouldExceedMaxBlockCostLimit',\n 'UnsupportedVersion',\n 'InvalidWritableAccount',\n 'WouldExceedMaxAccountCostLimit',\n 'WouldExceedAccountDataBlockLimit',\n 'TooManyAccountLocks',\n 'AddressLookupTableNotFound',\n 'InvalidAddressLookupTableOwner',\n 'InvalidAddressLookupTableData',\n 'InvalidAddressLookupTableIndex',\n 'InvalidRentPayingAccount',\n 'WouldExceedMaxVoteCostLimit',\n 'WouldExceedAccountDataTotalLimit',\n 'DuplicateInstruction',\n 'InsufficientFundsForRent',\n 'MaxLoadedAccountsDataSizeExceeded',\n 'InvalidLoadedAccountsDataSizeLimit',\n 'ResanitizationNeeded',\n 'ProgramExecutionTemporarilyRestricted',\n 'UnbalancedTransaction',\n];\n\nexport function getSolanaErrorFromTransactionError(transactionError: string | { [key: string]: unknown }): SolanaError {\n if (typeof transactionError === 'object' && 'InstructionError' in transactionError) {\n return getSolanaErrorFromInstructionError(\n ...(transactionError.InstructionError as Parameters<typeof getSolanaErrorFromInstructionError>),\n );\n }\n return getSolanaErrorFromRpcError(\n {\n errorCodeBaseOffset: 7050001,\n getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {\n if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN) {\n return {\n errorName: rpcErrorName,\n ...(rpcErrorContext !== undefined ? { transactionErrorContext: rpcErrorContext } : null),\n };\n } else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION) {\n return {\n index: Number(rpcErrorContext as bigint | number),\n };\n } else if (\n errorCode === SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT ||\n errorCode === SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED\n ) {\n return {\n accountIndex: Number((rpcErrorContext as { account_index: bigint | number }).account_index),\n };\n }\n },\n orderedErrorNames: ORDERED_ERROR_NAMES,\n rpcEnumError: transactionError,\n },\n getSolanaErrorFromTransactionError,\n );\n}\n","import {\n SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR,\n SOLANA_ERROR__JSON_RPC__INVALID_PARAMS,\n SOLANA_ERROR__JSON_RPC__INVALID_REQUEST,\n SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND,\n SOLANA_ERROR__JSON_RPC__PARSE_ERROR,\n SOLANA_ERROR__JSON_RPC__SCAN_ERROR,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE,\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION,\n SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR,\n SolanaErrorCode,\n} from './codes';\nimport { SolanaErrorContext } from './context';\nimport { SolanaError } from './error';\nimport { safeCaptureStackTrace } from './stack-trace';\nimport { getSolanaErrorFromTransactionError } from './transaction-error';\n\ninterface RpcErrorResponse {\n code: bigint | number;\n data?: unknown;\n message: string;\n}\n\ntype TransactionError = string | { [key: string]: unknown };\n\n/**\n * Keep in sync with https://github.com/anza-xyz/agave/blob/master/rpc-client-types/src/response.rs\n * @hidden\n */\nexport interface RpcSimulateTransactionResult {\n accounts:\n | ({\n data:\n | string // LegacyBinary\n | {\n // Json\n parsed: unknown;\n program: string;\n space: bigint;\n }\n // Binary\n | [encodedBytes: string, encoding: 'base58' | 'base64' | 'base64+zstd' | 'binary' | 'jsonParsed'];\n executable: boolean;\n lamports: bigint;\n owner: string;\n rentEpoch: bigint;\n space?: bigint;\n } | null)[]\n | null;\n err: TransactionError | null;\n // Enabled by `enable_cpi_recording`\n innerInstructions?:\n | {\n index: number;\n instructions: (\n | {\n // Compiled\n accounts: number[];\n data: string;\n programIdIndex: number;\n stackHeight?: number;\n }\n | {\n // Parsed\n parsed: unknown;\n program: string;\n programId: string;\n stackHeight?: number;\n }\n | {\n // PartiallyDecoded\n accounts: string[];\n data: string;\n programId: string;\n stackHeight?: number;\n }\n )[];\n }[]\n | null;\n loadedAccountsDataSize: number | null;\n logs: string[] | null;\n replacementBlockhash: string | null;\n returnData: {\n data: [string, 'base64'];\n programId: string;\n } | null;\n unitsConsumed: bigint | null;\n}\n\nexport function getSolanaErrorFromJsonRpcError(putativeErrorResponse: unknown): SolanaError {\n let out: SolanaError;\n if (isRpcErrorResponse(putativeErrorResponse)) {\n const { code: rawCode, data, message } = putativeErrorResponse;\n const code = Number(rawCode);\n if (code === SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE) {\n const { err, ...preflightErrorContext } = data as RpcSimulateTransactionResult;\n const causeObject = err ? { cause: getSolanaErrorFromTransactionError(err) } : null;\n out = new SolanaError(SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE, {\n ...preflightErrorContext,\n ...causeObject,\n });\n } else {\n let errorContext;\n switch (code) {\n case SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR:\n case SOLANA_ERROR__JSON_RPC__INVALID_PARAMS:\n case SOLANA_ERROR__JSON_RPC__INVALID_REQUEST:\n case SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND:\n case SOLANA_ERROR__JSON_RPC__PARSE_ERROR:\n case SOLANA_ERROR__JSON_RPC__SCAN_ERROR:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:\n // The server supplies no structured data, but rather a pre-formatted message. Put\n // the server message in `context` so as not to completely lose the data. The long\n // term fix for this is to add data to the server responses and modify the\n // messages in `@solana/errors` to be actual format strings.\n errorContext = { __serverMessage: message };\n break;\n default:\n if (typeof data === 'object' && !Array.isArray(data)) {\n errorContext = data;\n }\n }\n out = new SolanaError(code as SolanaErrorCode, errorContext as SolanaErrorContext[SolanaErrorCode]);\n }\n } else {\n const message =\n typeof putativeErrorResponse === 'object' &&\n putativeErrorResponse !== null &&\n 'message' in putativeErrorResponse &&\n typeof putativeErrorResponse.message === 'string'\n ? putativeErrorResponse.message\n : 'Malformed JSON-RPC error with no message attribute';\n out = new SolanaError(SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR, { error: putativeErrorResponse, message });\n }\n safeCaptureStackTrace(out, getSolanaErrorFromJsonRpcError);\n return out;\n}\n\nfunction isRpcErrorResponse(value: unknown): value is RpcErrorResponse {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'code' in value &&\n 'message' in value &&\n (typeof value.code === 'number' || typeof value.code === 'bigint') &&\n typeof value.message === 'string'\n );\n}\n","import {\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,\n SolanaErrorCode,\n} from './codes';\nimport { isSolanaError } from './error';\n\n/**\n * Extracts the underlying cause from a simulation-related error.\n *\n * When a transaction simulation fails, the error is often wrapped in a\n * simulation-specific {@link SolanaError}. This function unwraps such errors\n * by returning the `cause` property, giving you access to the actual error\n * that triggered the simulation failure.\n *\n * If the provided error is not a simulation-related error, it is returned unchanged.\n *\n * The following error codes are considered simulation errors:\n * - {@link SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE}\n * - {@link SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT}\n *\n * @param error - The error to unwrap.\n * @return The underlying cause if the error is a simulation error, otherwise the original error.\n *\n * @example\n * Unwrapping a preflight failure to access the root cause.\n * ```ts\n * import { unwrapSimulationError } from '@solana/errors';\n *\n * try {\n * await sendTransaction(signedTransaction);\n * } catch (e) {\n * const cause = unwrapSimulationError(e);\n * console.log('Send transaction failed due to:', cause);\n * }\n * ```\n */\nexport function unwrapSimulationError(error: unknown): unknown {\n const simulationCodes: SolanaErrorCode[] = [\n SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,\n ];\n if (isSolanaError(error) && !!error.cause && simulationCodes.includes(error.context.__code)) {\n return error.cause;\n }\n return error;\n}\n","import { ReadonlyUint8Array } from './readonly-uint8array';\n\n/**\n * Concatenates an array of `Uint8Array`s into a single `Uint8Array`.\n * Reuses the original byte array when applicable.\n *\n * @param byteArrays - The array of byte arrays to concatenate.\n *\n * @example\n * ```ts\n * const bytes1 = new Uint8Array([0x01, 0x02]);\n * const bytes2 = new Uint8Array([]);\n * const bytes3 = new Uint8Array([0x03, 0x04]);\n * const bytes = mergeBytes([bytes1, bytes2, bytes3]);\n * // ^ [0x01, 0x02, 0x03, 0x04]\n * ```\n */\nexport const mergeBytes = (byteArrays: Uint8Array[]): Uint8Array => {\n const nonEmptyByteArrays = byteArrays.filter(arr => arr.length);\n if (nonEmptyByteArrays.length === 0) {\n return byteArrays.length ? byteArrays[0] : new Uint8Array();\n }\n\n if (nonEmptyByteArrays.length === 1) {\n return nonEmptyByteArrays[0];\n }\n\n const totalLength = nonEmptyByteArrays.reduce((total, arr) => total + arr.length, 0);\n const result = new Uint8Array(totalLength);\n let offset = 0;\n nonEmptyByteArrays.forEach(arr => {\n result.set(arr, offset);\n offset += arr.length;\n });\n return result;\n};\n\n/**\n * Pads a `Uint8Array` with zeroes to the specified length.\n * If the array is longer than the specified length, it is returned as-is.\n *\n * @param bytes - The byte array to pad.\n * @param length - The desired length of the byte array.\n *\n * @example\n * Adds zeroes to the end of the byte array to reach the desired length.\n * ```ts\n * const bytes = new Uint8Array([0x01, 0x02]);\n * const paddedBytes = padBytes(bytes, 4);\n * // ^ [0x01, 0x02, 0x00, 0x00]\n * ```\n *\n * @example\n * Returns the original byte array if it is already at the desired length.\n * ```ts\n * const bytes = new Uint8Array([0x01, 0x02]);\n * const paddedBytes = padBytes(bytes, 2);\n * // bytes === paddedBytes\n * ```\n */\nexport function padBytes(bytes: Uint8Array, length: number): Uint8Array;\nexport function padBytes(bytes: ReadonlyUint8Array, length: number): ReadonlyUint8Array;\nexport function padBytes(bytes: ReadonlyUint8Array, length: number): ReadonlyUint8Array {\n if (bytes.length >= length) return bytes;\n const paddedBytes = new Uint8Array(length).fill(0);\n paddedBytes.set(bytes);\n return paddedBytes;\n}\n\n/**\n * Fixes a `Uint8Array` to the specified length.\n * If the array is longer than the specified length, it is truncated.\n * If the array is shorter than the specified length, it is padded with zeroes.\n *\n * @param bytes - The byte array to truncate or pad.\n * @param length - The desired length of the byte array.\n *\n * @example\n * Truncates the byte array to the desired length.\n * ```ts\n * const bytes = new Uint8Array([0x01, 0x02, 0x03, 0x04]);\n * const fixedBytes = fixBytes(bytes, 2);\n * // ^ [0x01, 0x02]\n * ```\n *\n * @example\n * Adds zeroes to the end of the byte array to reach the desired length.\n * ```ts\n * const bytes = new Uint8Array([0x01, 0x02]);\n * const fixedBytes = fixBytes(bytes, 4);\n * // ^ [0x01, 0x02, 0x00, 0x00]\n * ```\n *\n * @example\n * Returns the original byte array if it is already at the desired length.\n * ```ts\n * const bytes = new Uint8Array([0x01, 0x02]);\n * const fixedBytes = fixBytes(bytes, 2);\n * // bytes === fixedBytes\n * ```\n */\nexport const fixBytes = (bytes: ReadonlyUint8Array | Uint8Array, length: number): ReadonlyUint8Array | Uint8Array =>\n padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);\n\n/**\n * Returns true if and only if the provided `data` byte array contains\n * the provided `bytes` byte array at the specified `offset`.\n *\n * @param data - The byte sequence to search for.\n * @param bytes - The byte array in which to search for `data`.\n * @param offset - The position in `bytes` where the search begins.\n *\n * @example\n * ```ts\n * const bytes = new Uint8Array([0x01, 0x02, 0x03, 0x04]);\n * const data = new Uint8Array([0x02, 0x03]);\n * containsBytes(bytes, data, 1); // true\n * containsBytes(bytes, data, 2); // false\n * ```\n */\nexport function containsBytes(\n data: ReadonlyUint8Array | Uint8Array,\n bytes: ReadonlyUint8Array | Uint8Array,\n offset: number,\n): boolean {\n const slice = offset === 0 && data.length === bytes.length ? data : data.slice(offset, offset + bytes.length);\n return bytesEqual(slice, bytes);\n}\n\n/**\n * Returns true if and only if the provided `bytes1` and `bytes2` byte arrays are equal.\n *\n * @param bytes1 - The first byte array to compare.\n * @param bytes2 - The second byte array to compare.\n *\n * @example\n * ```ts\n * const bytes1 = new Uint8Array([0x01, 0x02, 0x03, 0x04]);\n * const bytes2 = new Uint8Array([0x01, 0x02, 0x03, 0x04]);\n * bytesEqual(bytes1, bytes2); // true\n * ```\n */\nexport function bytesEqual(bytes1: ReadonlyUint8Array | Uint8Array, bytes2: ReadonlyUint8Array | Uint8Array): boolean {\n return bytes1.length === bytes2.length && bytes1.every((value, index) => value === bytes2[index]);\n}\n","import {\n SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH,\n SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH,\n SolanaError,\n} from '@solana/errors';\n\nimport { ReadonlyUint8Array } from './readonly-uint8array';\n\n/**\n * Defines an offset in bytes.\n */\nexport type Offset = number;\n\n/**\n * An object that can encode a value of type {@link TFrom} into a {@link ReadonlyUint8Array}.\n *\n * This is a common interface for {@link FixedSizeEncoder} and {@link VariableSizeEncoder}.\n *\n * @interface\n * @typeParam TFrom - The type of the value to encode.\n *\n * @see {@link FixedSizeEncoder}\n * @see {@link VariableSizeEncoder}\n */\ntype BaseEncoder<TFrom> = {\n /** Encode the provided value and return the encoded bytes directly. */\n readonly encode: (value: TFrom) => ReadonlyUint8Array<ArrayBuffer>;\n /**\n * Writes the encoded value into the provided byte array at the given offset.\n * Returns the offset of the next byte after the encoded value.\n */\n readonly write: (value: TFrom, bytes: Uint8Array, offset: Offset) => Offset;\n};\n\n/**\n * An object that can encode a value of type {@link TFrom} into a fixed-size {@link ReadonlyUint8Array}.\n *\n * See {@link Encoder} to learn more about creating and composing encoders.\n *\n * @interface\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TSize - The fixed size of the encoded value in bytes.\n *\n * @example\n * ```ts\n * const encoder: FixedSizeEncoder<number, 4>;\n * const bytes = encoder.encode(42);\n * const size = encoder.fixedSize; // 4\n * ```\n *\n * @see {@link Encoder}\n * @see {@link VariableSizeEncoder}\n */\nexport type FixedSizeEncoder<TFrom, TSize extends number = number> = BaseEncoder<TFrom> & {\n /** The fixed size of the encoded value in bytes. */\n readonly fixedSize: TSize;\n};\n\n/**\n * An object that can encode a value of type {@link TFrom} into a variable-size {@link ReadonlyUint8Array}.\n *\n * See {@link Encoder} to learn more about creating and composing encoders.\n *\n * @interface\n * @typeParam TFrom - The type of the value to encode.\n *\n * @example\n * ```ts\n * const encoder: VariableSizeEncoder<string>;\n * const bytes = encoder.encode('hello');\n * const size = encoder.getSizeFromValue('hello');\n * ```\n *\n * @see {@link Encoder}\n * @see {@link FixedSizeEncoder}\n */\nexport type VariableSizeEncoder<TFrom> = BaseEncoder<TFrom> & {\n /** Returns the size of the encoded value in bytes for a given input. */\n readonly getSizeFromValue: (value: TFrom) => number;\n /** The maximum possible size of an encoded value in bytes, if applicable. */\n readonly maxSize?: number;\n};\n\n/**\n * An object that can encode a value of type {@link TFrom} into a {@link ReadonlyUint8Array}.\n *\n * An `Encoder` can be either:\n * - A {@link FixedSizeEncoder}, where all encoded values have the same fixed size.\n * - A {@link VariableSizeEncoder}, where encoded values can vary in size.\n *\n * @typeParam TFrom - The type of the value to encode.\n *\n * @example\n * Encoding a value into a new byte array.\n * ```ts\n * const encoder: Encoder<string>;\n * const bytes = encoder.encode('hello');\n * ```\n *\n * @example\n * Writing the encoded value into an existing byte array.\n * ```ts\n * const encoder: Encoder<string>;\n * const bytes = new Uint8Array(100);\n * const nextOffset = encoder.write('hello', bytes, 20);\n * ```\n *\n * @remarks\n * You may create `Encoders` manually using the {@link createEncoder} function but it is more common\n * to compose multiple `Encoders` together using the various helpers of the `@solana/codecs` package.\n *\n * For instance, here's how you might create an `Encoder` for a `Person` object type that contains\n * a `name` string and an `age` number:\n *\n * ```ts\n * import { getStructEncoder, addEncoderSizePrefix, getUtf8Encoder, getU32Encoder } from '@solana/codecs';\n *\n * type Person = { name: string; age: number };\n * const getPersonEncoder = (): Encoder<Person> =>\n * getStructEncoder([\n * ['name', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n * ['age', getU32Encoder()],\n * ]);\n * ```\n *\n * Note that composed `Encoder` types are clever enough to understand whether\n * they are fixed-size or variable-size. In the example above, `getU32Encoder()` is\n * a fixed-size encoder, while `addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())`\n * is a variable-size encoder. This makes the final `Person` encoder a variable-size encoder.\n *\n * @see {@link FixedSizeEncoder}\n * @see {@link VariableSizeEncoder}\n * @see {@link createEncoder}\n */\nexport type Encoder<TFrom> = FixedSizeEncoder<TFrom> | VariableSizeEncoder<TFrom>;\n\n/**\n * An object that can decode a byte array into a value of type {@link TTo}.\n *\n * This is a common interface for {@link FixedSizeDecoder} and {@link VariableSizeDecoder}.\n *\n * @interface\n * @typeParam TTo - The type of the decoded value.\n *\n * @see {@link FixedSizeDecoder}\n * @see {@link VariableSizeDecoder}\n */\ntype BaseDecoder<TTo> = {\n /** Decodes the provided byte array at the given offset (or zero) and returns the value directly. */\n readonly decode: (bytes: ReadonlyUint8Array | Uint8Array, offset?: Offset) => TTo;\n /**\n * Reads the encoded value from the provided byte array at the given offset.\n * Returns the decoded value and the offset of the next byte after the encoded value.\n */\n readonly read: (bytes: ReadonlyUint8Array | Uint8Array, offset: Offset) => [TTo, Offset];\n};\n\n/**\n * An object that can decode a fixed-size byte array into a value of type {@link TTo}.\n *\n * See {@link Decoder} to learn more about creating and composing decoders.\n *\n * @interface\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the encoded value in bytes.\n *\n * @example\n * ```ts\n * const decoder: FixedSizeDecoder<number, 4>;\n * const value = decoder.decode(bytes);\n * const size = decoder.fixedSize; // 4\n * ```\n *\n * @see {@link Decoder}\n * @see {@link VariableSizeDecoder}\n */\nexport type FixedSizeDecoder<TTo, TSize extends number = number> = BaseDecoder<TTo> & {\n /** The fixed size of the encoded value in bytes. */\n readonly fixedSize: TSize;\n};\n\n/**\n * An object that can decode a variable-size byte array into a value of type {@link TTo}.\n *\n * See {@link Decoder} to learn more about creating and composing decoders.\n *\n * @interface\n * @typeParam TTo - The type of the decoded value.\n *\n * @example\n * ```ts\n * const decoder: VariableSizeDecoder<number>;\n * const value = decoder.decode(bytes);\n * ```\n *\n * @see {@link Decoder}\n * @see {@link VariableSizeDecoder}\n */\nexport type VariableSizeDecoder<TTo> = BaseDecoder<TTo> & {\n /** The maximum possible size of an encoded value in bytes, if applicable. */\n readonly maxSize?: number;\n};\n\n/**\n * An object that can decode a byte array into a value of type {@link TTo}.\n *\n * An `Decoder` can be either:\n * - A {@link FixedSizeDecoder}, where all byte arrays have the same fixed size.\n * - A {@link VariableSizeDecoder}, where byte arrays can vary in size.\n *\n * @typeParam TTo - The type of the decoded value.\n *\n * @example\n * Getting the decoded value from a byte array.\n * ```ts\n * const decoder: Decoder<string>;\n * const value = decoder.decode(bytes);\n * ```\n *\n * @example\n * Reading the decoded value from a byte array at a specific offset\n * and getting the offset of the next byte to read.\n * ```ts\n * const decoder: Decoder<string>;\n * const [value, nextOffset] = decoder.read('hello', bytes, 20);\n * ```\n *\n * @remarks\n * You may create `Decoders` manually using the {@link createDecoder} function but it is more common\n * to compose multiple `Decoders` together using the various helpers of the `@solana/codecs` package.\n *\n * For instance, here's how you might create an `Decoder` for a `Person` object type that contains\n * a `name` string and an `age` number:\n *\n * ```ts\n * import { getStructDecoder, addDecoderSizePrefix, getUtf8Decoder, getU32Decoder } from '@solana/codecs';\n *\n * type Person = { name: string; age: number };\n * const getPersonDecoder = (): Decoder<Person> =>\n * getStructDecoder([\n * ['name', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n * ['age', getU32Decoder()],\n * ]);\n * ```\n *\n * Note that composed `Decoder` types are clever enough to understand whether\n * they are fixed-size or variable-size. In the example above, `getU32Decoder()` is\n * a fixed-size decoder, while `addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())`\n * is a variable-size decoder. This makes the final `Person` decoder a variable-size decoder.\n *\n * @see {@link FixedSizeDecoder}\n * @see {@link VariableSizeDecoder}\n * @see {@link createDecoder}\n */\nexport type Decoder<TTo> = FixedSizeDecoder<TTo> | VariableSizeDecoder<TTo>;\n\n/**\n * An object that can encode and decode a value to and from a fixed-size byte array.\n *\n * See {@link Codec} to learn more about creating and composing codecs.\n *\n * @interface\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the encoded value in bytes.\n *\n * @example\n * ```ts\n * const codec: FixedSizeCodec<number | bigint, bigint, 8>;\n * const bytes = codec.encode(42);\n * const value = codec.decode(bytes); // 42n\n * const size = codec.fixedSize; // 8\n * ```\n *\n * @see {@link Codec}\n * @see {@link VariableSizeCodec}\n */\nexport type FixedSizeCodec<TFrom, TTo extends TFrom = TFrom, TSize extends number = number> = FixedSizeDecoder<\n TTo,\n TSize\n> &\n FixedSizeEncoder<TFrom, TSize>;\n\n/**\n * An object that can encode and decode a value to and from a variable-size byte array.\n *\n * See {@link Codec} to learn more about creating and composing codecs.\n *\n * @interface\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n *\n * @example\n * ```ts\n * const codec: VariableSizeCodec<number | bigint, bigint>;\n * const bytes = codec.encode(42);\n * const value = codec.decode(bytes); // 42n\n * const size = codec.getSizeFromValue(42);\n * ```\n *\n * @see {@link Codec}\n * @see {@link FixedSizeCodec}\n */\nexport type VariableSizeCodec<TFrom, TTo extends TFrom = TFrom> = VariableSizeDecoder<TTo> & VariableSizeEncoder<TFrom>;\n\n/**\n * An object that can encode and decode a value to and from a byte array.\n *\n * A `Codec` can be either:\n * - A {@link FixedSizeCodec}, where all encoded values have the same fixed size.\n * - A {@link VariableSizeCodec}, where encoded values can vary in size.\n *\n * @example\n * ```ts\n * const codec: Codec<string>;\n * const bytes = codec.encode('hello');\n * const value = codec.decode(bytes); // 'hello'\n * ```\n *\n * @remarks\n * For convenience, codecs can encode looser types than they decode.\n * That is, type {@link TFrom} can be a superset of type {@link TTo}.\n * For instance, a `Codec<bigint | number, bigint>` can encode both\n * `bigint` and `number` values, but will always decode to a `bigint`.\n *\n * ```ts\n * const codec: Codec<bigint | number, bigint>;\n * const bytes = codec.encode(42);\n * const value = codec.decode(bytes); // 42n\n * ```\n *\n * It is worth noting that codecs are the union of encoders and decoders.\n * This means that a `Codec<TFrom, TTo>` can be combined from an `Encoder<TFrom>`\n * and a `Decoder<TTo>` using the {@link combineCodec} function. This is particularly\n * useful for library authors who want to expose all three types of objects to their users.\n *\n * ```ts\n * const encoder: Encoder<bigint | number>;\n * const decoder: Decoder<bigint>;\n * const codec: Codec<bigint | number, bigint> = combineCodec(encoder, decoder);\n * ```\n *\n * Aside from combining encoders and decoders, codecs can also be created from scratch using\n * the {@link createCodec} function but it is more common to compose multiple codecs together\n * using the various helpers of the `@solana/codecs` package.\n *\n * For instance, here's how you might create a `Codec` for a `Person` object type that contains\n * a `name` string and an `age` number:\n *\n * ```ts\n * import { getStructCodec, addCodecSizePrefix, getUtf8Codec, getU32Codec } from '@solana/codecs';\n *\n * type Person = { name: string; age: number };\n * const getPersonCodec = (): Codec<Person> =>\n * getStructCodec([\n * ['name', addCodecSizePrefix(getUtf8Codec(), getU32Codec())],\n * ['age', getU32Codec()],\n * ]);\n * ```\n *\n * Note that composed `Codec` types are clever enough to understand whether\n * they are fixed-size or variable-size. In the example above, `getU32Codec()` is\n * a fixed-size codec, while `addCodecSizePrefix(getUtf8Codec(), getU32Codec())`\n * is a variable-size codec. This makes the final `Person` codec a variable-size codec.\n *\n * @see {@link FixedSizeCodec}\n * @see {@link VariableSizeCodec}\n * @see {@link combineCodec}\n * @see {@link createCodec}\n */\nexport type Codec<TFrom, TTo extends TFrom = TFrom> = FixedSizeCodec<TFrom, TTo> | VariableSizeCodec<TFrom, TTo>;\n\n/**\n * Gets the encoded size of a given value in bytes using the provided encoder.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @param value - The value to be encoded.\n * @param encoder - The encoder used to determine the encoded size.\n * @returns The size of the encoded value in bytes.\n *\n * @example\n * ```ts\n * const fixedSizeEncoder = { fixedSize: 4 };\n * getEncodedSize(123, fixedSizeEncoder); // Returns 4.\n *\n * const variableSizeEncoder = { getSizeFromValue: (value: string) => value.length };\n * getEncodedSize(\"hello\", variableSizeEncoder); // Returns 5.\n * ```\n *\n * @see {@link Encoder}\n */\nexport function getEncodedSize<TFrom>(\n value: TFrom,\n encoder: { fixedSize: number } | { getSizeFromValue: (value: TFrom) => number },\n): number {\n return 'fixedSize' in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);\n}\n\n/**\n * Creates an `Encoder` by filling in the missing `encode` function using the provided `write` function and\n * either the `fixedSize` property (for {@link FixedSizeEncoder | FixedSizeEncoders}) or\n * the `getSizeFromValue` function (for {@link VariableSizeEncoder | VariableSizeEncoders}).\n *\n * Instead of manually implementing `encode`, this utility leverages the existing `write` function\n * and the size helpers to generate a complete encoder. The provided `encode` method will allocate\n * a new `Uint8Array` of the correct size and use `write` to populate it.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TSize - The fixed size of the encoded value in bytes (for fixed-size encoders).\n *\n * @param encoder - An encoder object that implements `write`, but not `encode`.\n * - If the encoder has a `fixedSize` property, it is treated as a {@link FixedSizeEncoder}.\n * - Otherwise, it is treated as a {@link VariableSizeEncoder}.\n *\n * @returns A fully functional `Encoder` with both `write` and `encode` methods.\n *\n * @example\n * Creating a custom fixed-size encoder.\n * ```ts\n * const encoder = createEncoder({\n * fixedSize: 4,\n * write: (value: number, bytes, offset) => {\n * bytes.set(new Uint8Array([value]), offset);\n * return offset + 4;\n * },\n * });\n *\n * const bytes = encoder.encode(42);\n * // 0x2a000000\n * ```\n *\n * @example\n * Creating a custom variable-size encoder:\n * ```ts\n * const encoder = createEncoder({\n * getSizeFromValue: (value: string) => value.length,\n * write: (value: string, bytes, offset) => {\n * const encodedValue = new TextEncoder().encode(value);\n * bytes.set(encodedValue, offset);\n * return offset + encodedValue.length;\n * },\n * });\n *\n * const bytes = encoder.encode(\"hello\");\n * // 0x68656c6c6f\n * ```\n *\n * @remarks\n * Note that, while `createEncoder` is useful for defining more complex encoders, it is more common to compose\n * encoders together using the various helpers and primitives of the `@solana/codecs` package.\n *\n * Here are some alternative examples using codec primitives instead of `createEncoder`.\n *\n * ```ts\n * // Fixed-size encoder for unsigned 32-bit integers.\n * const encoder = getU32Encoder();\n * const bytes = encoder.encode(42);\n * // 0x2a000000\n *\n * // Variable-size encoder for 32-bytes prefixed UTF-8 strings.\n * const encoder = addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder());\n * const bytes = encoder.encode(\"hello\");\n * // 0x0500000068656c6c6f\n *\n * // Variable-size encoder for custom objects.\n * type Person = { name: string; age: number };\n * const encoder: Encoder<Person> = getStructEncoder([\n * ['name', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],\n * ['age', getU32Encoder()],\n * ]);\n * const bytes = encoder.encode({ name: \"Bob\", age: 42 });\n * // 0x03000000426f622a000000\n * ```\n *\n * @see {@link Encoder}\n * @see {@link FixedSizeEncoder}\n * @see {@link VariableSizeEncoder}\n * @see {@link getStructEncoder}\n * @see {@link getU32Encoder}\n * @see {@link getUtf8Encoder}\n * @see {@link addEncoderSizePrefix}\n */\nexport function createEncoder<TFrom, TSize extends number>(\n encoder: Omit<FixedSizeEncoder<TFrom, TSize>, 'encode'>,\n): FixedSizeEncoder<TFrom, TSize>;\nexport function createEncoder<TFrom>(encoder: Omit<VariableSizeEncoder<TFrom>, 'encode'>): VariableSizeEncoder<TFrom>;\nexport function createEncoder<TFrom>(\n encoder: Omit<FixedSizeEncoder<TFrom>, 'encode'> | Omit<VariableSizeEncoder<TFrom>, 'encode'>,\n): Encoder<TFrom>;\nexport function createEncoder<TFrom>(\n encoder: Omit<FixedSizeEncoder<TFrom>, 'encode'> | Omit<VariableSizeEncoder<TFrom>, 'encode'>,\n): Encoder<TFrom> {\n return Object.freeze({\n ...encoder,\n encode: value => {\n const bytes = new Uint8Array(getEncodedSize(value, encoder));\n encoder.write(value, bytes, 0);\n return bytes;\n },\n });\n}\n\n/**\n * Creates a `Decoder` by filling in the missing `decode` function using the provided `read` function.\n *\n * Instead of manually implementing `decode`, this utility leverages the existing `read` function\n * and the size properties to generate a complete decoder. The provided `decode` method will read\n * from a `Uint8Array` at the given offset and return the decoded value.\n *\n * If the `fixedSize` property is provided, a {@link FixedSizeDecoder} will be created, otherwise\n * a {@link VariableSizeDecoder} will be created.\n *\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the encoded value in bytes (for fixed-size decoders).\n *\n * @param decoder - A decoder object that implements `read`, but not `decode`.\n * - If the decoder has a `fixedSize` property, it is treated as a {@link FixedSizeDecoder}.\n * - Otherwise, it is treated as a {@link VariableSizeDecoder}.\n *\n * @returns A fully functional `Decoder` with both `read` and `decode` methods.\n *\n * @example\n * Creating a custom fixed-size decoder.\n * ```ts\n * const decoder = createDecoder({\n * fixedSize: 4,\n * read: (bytes, offset) => {\n * const value = bytes[offset];\n * return [value, offset + 4];\n * },\n * });\n *\n * const value = decoder.decode(new Uint8Array([42, 0, 0, 0]));\n * // 42\n * ```\n *\n * @example\n * Creating a custom variable-size decoder:\n * ```ts\n * const decoder = createDecoder({\n * read: (bytes, offset) => {\n * const decodedValue = new TextDecoder().decode(bytes.subarray(offset));\n * return [decodedValue, bytes.length];\n * },\n * });\n *\n * const value = decoder.decode(new Uint8Array([104, 101, 108, 108, 111]));\n * // \"hello\"\n * ```\n *\n * @remarks\n * Note that, while `createDecoder` is useful for defining more complex decoders, it is more common to compose\n * decoders together using the various helpers and primitives of the `@solana/codecs` package.\n *\n * Here are some alternative examples using codec primitives instead of `createDecoder`.\n *\n * ```ts\n * // Fixed-size decoder for unsigned 32-bit integers.\n * const decoder = getU32Decoder();\n * const value = decoder.decode(new Uint8Array([42, 0, 0, 0]));\n * // 42\n *\n * // Variable-size decoder for 32-bytes prefixed UTF-8 strings.\n * const decoder = addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder());\n * const value = decoder.decode(new Uint8Array([5, 0, 0, 0, 104, 101, 108, 108, 111]));\n * // \"hello\"\n *\n * // Variable-size decoder for custom objects.\n * type Person = { name: string; age: number };\n * const decoder: Decoder<Person> = getStructDecoder([\n * ['name', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],\n * ['age', getU32Decoder()],\n * ]);\n * const value = decoder.decode(new Uint8Array([3, 0, 0, 0, 66, 111, 98, 42, 0, 0, 0]));\n * // { name: \"Bob\", age: 42 }\n * ```\n *\n * @see {@link Decoder}\n * @see {@link FixedSizeDecoder}\n * @see {@link VariableSizeDecoder}\n * @see {@link getStructDecoder}\n * @see {@link getU32Decoder}\n * @see {@link getUtf8Decoder}\n * @see {@link addDecoderSizePrefix}\n */\nexport function createDecoder<TTo, TSize extends number>(\n decoder: Omit<FixedSizeDecoder<TTo, TSize>, 'decode'>,\n): FixedSizeDecoder<TTo, TSize>;\nexport function createDecoder<TTo>(decoder: Omit<VariableSizeDecoder<TTo>, 'decode'>): VariableSizeDecoder<TTo>;\nexport function createDecoder<TTo>(\n decoder: Omit<FixedSizeDecoder<TTo>, 'decode'> | Omit<VariableSizeDecoder<TTo>, 'decode'>,\n): Decoder<TTo>;\nexport function createDecoder<TTo>(\n decoder: Omit<FixedSizeDecoder<TTo>, 'decode'> | Omit<VariableSizeDecoder<TTo>, 'decode'>,\n): Decoder<TTo> {\n return Object.freeze({\n ...decoder,\n decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0],\n });\n}\n\n/**\n * Creates a `Codec` by filling in the missing `encode` and `decode` functions using the provided `write` and `read` functions.\n *\n * This utility combines the behavior of {@link createEncoder} and {@link createDecoder} to produce a fully functional `Codec`.\n * The `encode` method is derived from the `write` function, while the `decode` method is derived from the `read` function.\n *\n * If the `fixedSize` property is provided, a {@link FixedSizeCodec} will be created, otherwise\n * a {@link VariableSizeCodec} will be created.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the encoded value in bytes (for fixed-size codecs).\n *\n * @param codec - A codec object that implements `write` and `read`, but not `encode` or `decode`.\n * - If the codec has a `fixedSize` property, it is treated as a {@link FixedSizeCodec}.\n * - Otherwise, it is treated as a {@link VariableSizeCodec}.\n *\n * @returns A fully functional `Codec` with `write`, `read`, `encode`, and `decode` methods.\n *\n * @example\n * Creating a custom fixed-size codec.\n * ```ts\n * const codec = createCodec({\n * fixedSize: 4,\n * read: (bytes, offset) => {\n * const value = bytes[offset];\n * return [value, offset + 4];\n * },\n * write: (value: number, bytes, offset) => {\n * bytes.set(new Uint8Array([value]), offset);\n * return offset + 4;\n * },\n * });\n *\n * const bytes = codec.encode(42);\n * // 0x2a000000\n * const value = codec.decode(bytes);\n * // 42\n * ```\n *\n * @example\n * Creating a custom variable-size codec:\n * ```ts\n * const codec = createCodec({\n * getSizeFromValue: (value: string) => value.length,\n * read: (bytes, offset) => {\n * const decodedValue = new TextDecoder().decode(bytes.subarray(offset));\n * return [decodedValue, bytes.length];\n * },\n * write: (value: string, bytes, offset) => {\n * const encodedValue = new TextEncoder().encode(value);\n * bytes.set(encodedValue, offset);\n * return offset + encodedValue.length;\n * },\n * });\n *\n * const bytes = codec.encode(\"hello\");\n * // 0x68656c6c6f\n * const value = codec.decode(bytes);\n * // \"hello\"\n * ```\n *\n * @remarks\n * This function effectively combines the behavior of {@link createEncoder} and {@link createDecoder}.\n * If you only need to encode or decode (but not both), consider using those functions instead.\n *\n * Here are some alternative examples using codec primitives instead of `createCodec`.\n *\n * ```ts\n * // Fixed-size codec for unsigned 32-bit integers.\n * const codec = getU32Codec();\n * const bytes = codec.encode(42);\n * // 0x2a000000\n * const value = codec.decode(bytes);\n * // 42\n *\n * // Variable-size codec for 32-bytes prefixed UTF-8 strings.\n * const codec = addCodecSizePrefix(getUtf8Codec(), getU32Codec());\n * const bytes = codec.encode(\"hello\");\n * // 0x0500000068656c6c6f\n * const value = codec.decode(bytes);\n * // \"hello\"\n *\n * // Variable-size codec for custom objects.\n * type Person = { name: string; age: number };\n * const codec: Codec<PersonInput, Person> = getStructCodec([\n * ['name', addCodecSizePrefix(getUtf8Codec(), getU32Codec())],\n * ['age', getU32Codec()],\n * ]);\n * const bytes = codec.encode({ name: \"Bob\", age: 42 });\n * // 0x03000000426f622a000000\n * const value = codec.decode(bytes);\n * // { name: \"Bob\", age: 42 }\n * ```\n *\n * @see {@link Codec}\n * @see {@link FixedSizeCodec}\n * @see {@link VariableSizeCodec}\n * @see {@link createEncoder}\n * @see {@link createDecoder}\n * @see {@link getStructCodec}\n * @see {@link getU32Codec}\n * @see {@link getUtf8Codec}\n * @see {@link addCodecSizePrefix}\n */\nexport function createCodec<TFrom, TTo extends TFrom = TFrom, TSize extends number = number>(\n codec: Omit<FixedSizeCodec<TFrom, TTo, TSize>, 'decode' | 'encode'>,\n): FixedSizeCodec<TFrom, TTo, TSize>;\nexport function createCodec<TFrom, TTo extends TFrom = TFrom>(\n codec: Omit<VariableSizeCodec<TFrom, TTo>, 'decode' | 'encode'>,\n): VariableSizeCodec<TFrom, TTo>;\nexport function createCodec<TFrom, TTo extends TFrom = TFrom>(\n codec:\n | Omit<FixedSizeCodec<TFrom, TTo>, 'decode' | 'encode'>\n | Omit<VariableSizeCodec<TFrom, TTo>, 'decode' | 'encode'>,\n): Codec<TFrom, TTo>;\nexport function createCodec<TFrom, TTo extends TFrom = TFrom>(\n codec:\n | Omit<FixedSizeCodec<TFrom, TTo>, 'decode' | 'encode'>\n | Omit<VariableSizeCodec<TFrom, TTo>, 'decode' | 'encode'>,\n): Codec<TFrom, TTo> {\n return Object.freeze({\n ...codec,\n decode: (bytes, offset = 0) => codec.read(bytes, offset)[0],\n encode: value => {\n const bytes = new Uint8Array(getEncodedSize(value, codec));\n codec.write(value, bytes, 0);\n return bytes;\n },\n });\n}\n\n/**\n * Determines whether the given codec, encoder, or decoder is fixed-size.\n *\n * A fixed-size object is identified by the presence of a `fixedSize` property.\n * If this property exists, the object is considered a {@link FixedSizeCodec},\n * {@link FixedSizeEncoder}, or {@link FixedSizeDecoder}.\n * Otherwise, it is assumed to be a {@link VariableSizeCodec},\n * {@link VariableSizeEncoder}, or {@link VariableSizeDecoder}.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the encoded value in bytes.\n * @returns `true` if the object is fixed-size, `false` otherwise.\n *\n * @example\n * Checking a fixed-size encoder.\n * ```ts\n * const encoder = getU32Encoder();\n * isFixedSize(encoder); // true\n * ```\n *\n * @example\n * Checking a variable-size encoder.\n * ```ts\n * const encoder = addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder());\n * isFixedSize(encoder); // false\n * ```\n *\n * @remarks\n * This function is commonly used to distinguish between fixed-size and variable-size objects at runtime.\n * If you need to enforce this distinction with type assertions, consider using {@link assertIsFixedSize}.\n *\n * @see {@link assertIsFixedSize}\n */\nexport function isFixedSize<TFrom, TSize extends number>(\n encoder: FixedSizeEncoder<TFrom, TSize> | VariableSizeEncoder<TFrom>,\n): encoder is FixedSizeEncoder<TFrom, TSize>;\nexport function isFixedSize<TTo, TSize extends number>(\n decoder: FixedSizeDecoder<TTo, TSize> | VariableSizeDecoder<TTo>,\n): decoder is FixedSizeDecoder<TTo, TSize>;\nexport function isFixedSize<TFrom, TTo extends TFrom, TSize extends number>(\n codec: FixedSizeCodec<TFrom, TTo, TSize> | VariableSizeCodec<TFrom, TTo>,\n): codec is FixedSizeCodec<TFrom, TTo, TSize>;\nexport function isFixedSize<TSize extends number>(\n codec: { fixedSize: TSize } | { maxSize?: number },\n): codec is { fixedSize: TSize };\nexport function isFixedSize(codec: { fixedSize: number } | { maxSize?: number }): codec is { fixedSize: number } {\n return 'fixedSize' in codec && typeof codec.fixedSize === 'number';\n}\n\n/**\n * Asserts that the given codec, encoder, or decoder is fixed-size.\n *\n * If the object is not fixed-size (i.e., it lacks a `fixedSize` property),\n * this function throws a {@link SolanaError} with the code `SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH`.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the encoded value in bytes.\n * @throws {SolanaError} If the object is not fixed-size.\n *\n * @example\n * Asserting a fixed-size encoder.\n * ```ts\n * const encoder = getU32Encoder();\n * assertIsFixedSize(encoder); // Passes\n * ```\n *\n * @example\n * Attempting to assert a variable-size encoder.\n * ```ts\n * const encoder = addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder());\n * assertIsFixedSize(encoder); // Throws SolanaError\n * ```\n *\n * @remarks\n * This function is the assertion-based counterpart of {@link isFixedSize}.\n * If you only need to check whether an object is fixed-size without throwing an error, use {@link isFixedSize} instead.\n *\n * @see {@link isFixedSize}\n */\nexport function assertIsFixedSize<TFrom, TSize extends number>(\n encoder: FixedSizeEncoder<TFrom, TSize> | VariableSizeEncoder<TFrom>,\n): asserts encoder is FixedSizeEncoder<TFrom, TSize>;\nexport function assertIsFixedSize<TTo, TSize extends number>(\n decoder: FixedSizeDecoder<TTo, TSize> | VariableSizeDecoder<TTo>,\n): asserts decoder is FixedSizeDecoder<TTo, TSize>;\nexport function assertIsFixedSize<TFrom, TTo extends TFrom, TSize extends number>(\n codec: FixedSizeCodec<TFrom, TTo, TSize> | VariableSizeCodec<TFrom, TTo>,\n): asserts codec is FixedSizeCodec<TFrom, TTo, TSize>;\nexport function assertIsFixedSize<TSize extends number>(\n codec: { fixedSize: TSize } | { maxSize?: number },\n): asserts codec is { fixedSize: TSize };\nexport function assertIsFixedSize(\n codec: { fixedSize: number } | { maxSize?: number },\n): asserts codec is { fixedSize: number } {\n if (!isFixedSize(codec)) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH);\n }\n}\n\n/**\n * Determines whether the given codec, encoder, or decoder is variable-size.\n *\n * A variable-size object is identified by the absence of a `fixedSize` property.\n * If this property is missing, the object is considered a {@link VariableSizeCodec},\n * {@link VariableSizeEncoder}, or {@link VariableSizeDecoder}.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the encoded value in bytes.\n * @returns `true` if the object is variable-size, `false` otherwise.\n *\n * @example\n * Checking a variable-size encoder.\n * ```ts\n * const encoder = addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder());\n * isVariableSize(encoder); // true\n * ```\n *\n * @example\n * Checking a fixed-size encoder.\n * ```ts\n * const encoder = getU32Encoder();\n * isVariableSize(encoder); // false\n * ```\n *\n * @remarks\n * This function is the inverse of {@link isFixedSize}.\n *\n * @see {@link isFixedSize}\n * @see {@link assertIsVariableSize}\n */\nexport function isVariableSize<TFrom>(encoder: Encoder<TFrom>): encoder is VariableSizeEncoder<TFrom>;\nexport function isVariableSize<TTo>(decoder: Decoder<TTo>): decoder is VariableSizeDecoder<TTo>;\nexport function isVariableSize<TFrom, TTo extends TFrom>(\n codec: Codec<TFrom, TTo>,\n): codec is VariableSizeCodec<TFrom, TTo>;\nexport function isVariableSize(codec: { fixedSize: number } | { maxSize?: number }): codec is { maxSize?: number };\nexport function isVariableSize(codec: { fixedSize: number } | { maxSize?: number }): codec is { maxSize?: number } {\n return !isFixedSize(codec);\n}\n\n/**\n * Asserts that the given codec, encoder, or decoder is variable-size.\n *\n * If the object is not variable-size (i.e., it has a `fixedSize` property),\n * this function throws a {@link SolanaError} with the code `SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH`.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the encoded value in bytes.\n * @throws {SolanaError} If the object is not variable-size.\n *\n * @example\n * Asserting a variable-size encoder.\n * ```ts\n * const encoder = addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder());\n * assertIsVariableSize(encoder); // Passes\n * ```\n *\n * @example\n * Attempting to assert a fixed-size encoder.\n * ```ts\n * const encoder = getU32Encoder();\n * assertIsVariableSize(encoder); // Throws SolanaError\n * ```\n *\n * @remarks\n * This function is the assertion-based counterpart of {@link isVariableSize}.\n * If you only need to check whether an object is variable-size without throwing an error, use {@link isVariableSize} instead.\n *\n * Also note that this function is the inverse of {@link assertIsFixedSize}.\n *\n * @see {@link isVariableSize}\n * @see {@link assertIsFixedSize}\n */\nexport function assertIsVariableSize<TFrom>(encoder: Encoder<TFrom>): asserts encoder is VariableSizeEncoder<TFrom>;\nexport function assertIsVariableSize<TTo>(decoder: Decoder<TTo>): asserts decoder is VariableSizeDecoder<TTo>;\nexport function assertIsVariableSize<TFrom, TTo extends TFrom>(\n codec: Codec<TFrom, TTo>,\n): asserts codec is VariableSizeCodec<TFrom, TTo>;\nexport function assertIsVariableSize(\n codec: { fixedSize: number } | { maxSize?: number },\n): asserts codec is { maxSize?: number };\nexport function assertIsVariableSize(\n codec: { fixedSize: number } | { maxSize?: number },\n): asserts codec is { maxSize?: number } {\n if (!isVariableSize(codec)) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH);\n }\n}\n","import {\n SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH,\n SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH,\n SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH,\n SolanaError,\n} from '@solana/errors';\n\nimport {\n Codec,\n Decoder,\n Encoder,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n isFixedSize,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from './codec';\n\n/**\n * Combines an `Encoder` and a `Decoder` into a `Codec`.\n *\n * That is, given a `Encoder<TFrom>` and a `Decoder<TTo>`, this function returns a `Codec<TFrom, TTo>`.\n *\n * This allows for modular composition by keeping encoding and decoding logic separate\n * while still offering a convenient way to bundle them into a single `Codec`.\n * This is particularly useful for library maintainers who want to expose `Encoders`,\n * `Decoders`, and `Codecs` separately, enabling tree-shaking of unused logic.\n *\n * The provided `Encoder` and `Decoder` must be compatible in terms of:\n * - **Fixed Size:** If both are fixed-size, they must have the same `fixedSize` value.\n * - **Variable Size:** If either has a `maxSize` attribute, it must match the other.\n *\n * If these conditions are not met, a {@link SolanaError} will be thrown.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the encoded value in bytes (for fixed-size codecs).\n *\n * @param encoder - The `Encoder` to combine.\n * @param decoder - The `Decoder` to combine.\n * @returns A `Codec` that provides both `encode` and `decode` methods.\n *\n * @throws {SolanaError}\n * - `SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH`\n * Thrown if the encoder and decoder have mismatched size types (fixed vs. variable).\n * - `SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH`\n * Thrown if both are fixed-size but have different `fixedSize` values.\n * - `SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH`\n * Thrown if the `maxSize` attributes do not match.\n *\n * @example\n * Creating a fixed-size `Codec` from an encoder and a decoder.\n * ```ts\n * const encoder = getU32Encoder();\n * const decoder = getU32Decoder();\n * const codec = combineCodec(encoder, decoder);\n *\n * const bytes = codec.encode(42); // 0x2a000000\n * const value = codec.decode(bytes); // 42\n * ```\n *\n * @example\n * Creating a variable-size `Codec` from an encoder and a decoder.\n * ```ts\n * const encoder = addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder());\n * const decoder = addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder());\n * const codec = combineCodec(encoder, decoder);\n *\n * const bytes = codec.encode(\"hello\"); // 0x0500000068656c6c6f\n * const value = codec.decode(bytes); // \"hello\"\n * ```\n *\n * @remarks\n * The recommended pattern for defining codecs in libraries is to expose separate functions for the encoder, decoder, and codec.\n * This allows users to import only what they need, improving tree-shaking efficiency.\n *\n * ```ts\n * type MyType = \\/* ... *\\/;\n * const getMyTypeEncoder = (): Encoder<MyType> => { \\/* ... *\\/ };\n * const getMyTypeDecoder = (): Decoder<MyType> => { \\/* ... *\\/ };\n * const getMyTypeCodec = (): Codec<MyType> =>\n * combineCodec(getMyTypeEncoder(), getMyTypeDecoder());\n * ```\n *\n * @see {@link Codec}\n * @see {@link Encoder}\n * @see {@link Decoder}\n */\nexport function combineCodec<TFrom, TTo extends TFrom, TSize extends number>(\n encoder: FixedSizeEncoder<TFrom, TSize>,\n decoder: FixedSizeDecoder<TTo, TSize>,\n): FixedSizeCodec<TFrom, TTo, TSize>;\nexport function combineCodec<TFrom, TTo extends TFrom>(\n encoder: VariableSizeEncoder<TFrom>,\n decoder: VariableSizeDecoder<TTo>,\n): VariableSizeCodec<TFrom, TTo>;\nexport function combineCodec<TFrom, TTo extends TFrom>(\n encoder: Encoder<TFrom>,\n decoder: Decoder<TTo>,\n): Codec<TFrom, TTo>;\nexport function combineCodec<TFrom, TTo extends TFrom>(\n encoder: Encoder<TFrom>,\n decoder: Decoder<TTo>,\n): Codec<TFrom, TTo> {\n if (isFixedSize(encoder) !== isFixedSize(decoder)) {\n throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH);\n }\n\n if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {\n throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH, {\n decoderFixedSize: decoder.fixedSize,\n encoderFixedSize: encoder.fixedSize,\n });\n }\n\n if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {\n throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH, {\n decoderMaxSize: decoder.maxSize,\n encoderMaxSize: encoder.maxSize,\n });\n }\n\n return {\n ...decoder,\n ...encoder,\n decode: decoder.decode,\n encode: encoder.encode,\n read: decoder.read,\n write: encoder.write,\n };\n}\n","import {\n SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL,\n SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES,\n SolanaError,\n} from '@solana/errors';\n\nimport { containsBytes } from './bytes';\nimport {\n Codec,\n createDecoder,\n createEncoder,\n Decoder,\n Encoder,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n isFixedSize,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from './codec';\nimport { combineCodec } from './combine-codec';\nimport { ReadonlyUint8Array } from './readonly-uint8array';\n\n/**\n * Creates an encoder that writes a `Uint8Array` sentinel after the encoded value.\n * This is useful to delimit the encoded value when being read by a decoder.\n *\n * See {@link addCodecSentinel} for more information.\n *\n * @typeParam TFrom - The type of the value to encode.\n *\n * @see {@link addCodecSentinel}\n */\nexport function addEncoderSentinel<TFrom>(\n encoder: FixedSizeEncoder<TFrom>,\n sentinel: ReadonlyUint8Array,\n): FixedSizeEncoder<TFrom>;\nexport function addEncoderSentinel<TFrom>(\n encoder: Encoder<TFrom>,\n sentinel: ReadonlyUint8Array,\n): VariableSizeEncoder<TFrom>;\nexport function addEncoderSentinel<TFrom>(encoder: Encoder<TFrom>, sentinel: ReadonlyUint8Array): Encoder<TFrom> {\n const write = ((value, bytes, offset) => {\n // Here we exceptionally use the `encode` function instead of the `write`\n // function to contain the content of the encoder within its own bounds\n // and to avoid writing the sentinel as part of the encoded value.\n const encoderBytes = encoder.encode(value);\n if (findSentinelIndex(encoderBytes, sentinel) >= 0) {\n throw new SolanaError(SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL, {\n encodedBytes: encoderBytes,\n hexEncodedBytes: hexBytes(encoderBytes),\n hexSentinel: hexBytes(sentinel),\n sentinel,\n });\n }\n bytes.set(encoderBytes, offset);\n offset += encoderBytes.length;\n bytes.set(sentinel, offset);\n offset += sentinel.length;\n return offset;\n }) as Encoder<TFrom>['write'];\n\n if (isFixedSize(encoder)) {\n return createEncoder({ ...encoder, fixedSize: encoder.fixedSize + sentinel.length, write });\n }\n\n return createEncoder({\n ...encoder,\n ...(encoder.maxSize != null ? { maxSize: encoder.maxSize + sentinel.length } : {}),\n getSizeFromValue: value => encoder.getSizeFromValue(value) + sentinel.length,\n write,\n });\n}\n\n/**\n * Creates a decoder that continues reading until\n * a given `Uint8Array` sentinel is found.\n *\n * See {@link addCodecSentinel} for more information.\n *\n * @typeParam TTo - The type of the decoded value.\n *\n * @see {@link addCodecSentinel}\n */\nexport function addDecoderSentinel<TTo>(\n decoder: FixedSizeDecoder<TTo>,\n sentinel: ReadonlyUint8Array,\n): FixedSizeDecoder<TTo>;\nexport function addDecoderSentinel<TTo>(decoder: Decoder<TTo>, sentinel: ReadonlyUint8Array): VariableSizeDecoder<TTo>;\nexport function addDecoderSentinel<TTo>(decoder: Decoder<TTo>, sentinel: ReadonlyUint8Array): Decoder<TTo> {\n const read = ((bytes, offset) => {\n const candidateBytes = offset === 0 ? bytes : bytes.slice(offset);\n const sentinelIndex = findSentinelIndex(candidateBytes, sentinel);\n if (sentinelIndex === -1) {\n throw new SolanaError(SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES, {\n decodedBytes: candidateBytes,\n hexDecodedBytes: hexBytes(candidateBytes),\n hexSentinel: hexBytes(sentinel),\n sentinel,\n });\n }\n const preSentinelBytes = candidateBytes.slice(0, sentinelIndex);\n // Here we exceptionally use the `decode` function instead of the `read`\n // function to contain the content of the decoder within its own bounds\n // and ensure that the sentinel is not part of the decoded value.\n return [decoder.decode(preSentinelBytes), offset + preSentinelBytes.length + sentinel.length];\n }) as Decoder<TTo>['read'];\n\n if (isFixedSize(decoder)) {\n return createDecoder({ ...decoder, fixedSize: decoder.fixedSize + sentinel.length, read });\n }\n\n return createDecoder({\n ...decoder,\n ...(decoder.maxSize != null ? { maxSize: decoder.maxSize + sentinel.length } : {}),\n read,\n });\n}\n\n/**\n * Creates a Codec that writes a given `Uint8Array` sentinel after the encoded\n * value and, when decoding, continues reading until the sentinel is found.\n *\n * This sets a limit on variable-size codecs and tells us when to stop decoding.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n *\n * @example\n * ```ts\n * const codec = addCodecSentinel(getUtf8Codec(), new Uint8Array([255, 255]));\n * codec.encode('hello');\n * // 0x68656c6c6fffff\n * // | └-- Our sentinel.\n * // └-- Our encoded string.\n * ```\n *\n * @remarks\n * Note that the sentinel _must not_ be present in the encoded data and\n * _must_ be present in the decoded data for this to work.\n * If this is not the case, dedicated errors will be thrown.\n *\n * ```ts\n * const sentinel = new Uint8Array([108, 108]); // 'll'\n * const codec = addCodecSentinel(getUtf8Codec(), sentinel);\n *\n * codec.encode('hello'); // Throws: sentinel is in encoded data.\n * codec.decode(new Uint8Array([1, 2, 3])); // Throws: sentinel missing in decoded data.\n * ```\n *\n * Separate {@link addEncoderSentinel} and {@link addDecoderSentinel} functions are also available.\n *\n * ```ts\n * const bytes = addEncoderSentinel(getUtf8Encoder(), sentinel).encode('hello');\n * const value = addDecoderSentinel(getUtf8Decoder(), sentinel).decode(bytes);\n * ```\n *\n * @see {@link addEncoderSentinel}\n * @see {@link addDecoderSentinel}\n */\nexport function addCodecSentinel<TFrom, TTo extends TFrom>(\n codec: FixedSizeCodec<TFrom, TTo>,\n sentinel: ReadonlyUint8Array,\n): FixedSizeCodec<TFrom, TTo>;\nexport function addCodecSentinel<TFrom, TTo extends TFrom>(\n codec: Codec<TFrom, TTo>,\n sentinel: ReadonlyUint8Array,\n): VariableSizeCodec<TFrom, TTo>;\nexport function addCodecSentinel<TFrom, TTo extends TFrom>(\n codec: Codec<TFrom, TTo>,\n sentinel: ReadonlyUint8Array,\n): Codec<TFrom, TTo> {\n return combineCodec(addEncoderSentinel(codec, sentinel), addDecoderSentinel(codec, sentinel));\n}\n\nfunction findSentinelIndex(bytes: ReadonlyUint8Array, sentinel: ReadonlyUint8Array) {\n return bytes.findIndex((byte, index, arr) => {\n if (sentinel.length === 1) return byte === sentinel[0];\n return containsBytes(arr, sentinel, index);\n });\n}\n\nfunction hexBytes(bytes: ReadonlyUint8Array): string {\n return bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');\n}\n","import {\n SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY,\n SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH,\n SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE,\n SolanaError,\n} from '@solana/errors';\n\nimport { ReadonlyUint8Array } from './readonly-uint8array';\n\n/**\n * Asserts that a given byte array is not empty (after the optional provided offset).\n *\n * Returns void if the byte array is not empty but throws a {@link SolanaError} otherwise.\n *\n * @param codecDescription - A description of the codec used by the assertion error.\n * @param bytes - The byte array to check.\n * @param offset - The offset from which to start checking the byte array.\n * If provided, the byte array is considered empty if it has no bytes after the offset.\n *\n * @example\n * ```ts\n * const bytes = new Uint8Array([0x01, 0x02, 0x03]);\n * assertByteArrayIsNotEmptyForCodec('myCodec', bytes); // OK\n * assertByteArrayIsNotEmptyForCodec('myCodec', bytes, 1); // OK\n * assertByteArrayIsNotEmptyForCodec('myCodec', bytes, 3); // Throws\n * ```\n */\nexport function assertByteArrayIsNotEmptyForCodec(\n codecDescription: string,\n bytes: ReadonlyUint8Array | Uint8Array,\n offset = 0,\n) {\n if (bytes.length - offset <= 0) {\n throw new SolanaError(SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, {\n codecDescription,\n });\n }\n}\n\n/**\n * Asserts that a given byte array has enough bytes to decode\n * (after the optional provided offset).\n *\n * Returns void if the byte array has at least the expected number\n * of bytes but throws a {@link SolanaError} otherwise.\n *\n * @param codecDescription - A description of the codec used by the assertion error.\n * @param expected - The minimum number of bytes expected in the byte array.\n * @param bytes - The byte array to check.\n * @param offset - The offset from which to start checking the byte array.\n *\n * @example\n * ```ts\n * const bytes = new Uint8Array([0x01, 0x02, 0x03]);\n * assertByteArrayHasEnoughBytesForCodec('myCodec', 3, bytes); // OK\n * assertByteArrayHasEnoughBytesForCodec('myCodec', 4, bytes); // Throws\n * assertByteArrayHasEnoughBytesForCodec('myCodec', 2, bytes, 1); // OK\n * assertByteArrayHasEnoughBytesForCodec('myCodec', 3, bytes, 1); // Throws\n * ```\n */\nexport function assertByteArrayHasEnoughBytesForCodec(\n codecDescription: string,\n expected: number,\n bytes: ReadonlyUint8Array | Uint8Array,\n offset = 0,\n) {\n const bytesLength = bytes.length - offset;\n if (bytesLength < expected) {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, {\n bytesLength,\n codecDescription,\n expected,\n });\n }\n}\n\n/**\n * Asserts that a given offset is within the byte array bounds.\n * This range is between 0 and the byte array length and is inclusive.\n * An offset equals to the byte array length is considered a valid offset\n * as it allows the post-offset of codecs to signal the end of the byte array.\n *\n * @param codecDescription - A description of the codec used by the assertion error.\n * @param offset - The offset to check.\n * @param bytesLength - The length of the byte array from which the offset should be within bounds.\n *\n * @example\n * ```ts\n * const bytes = new Uint8Array([0x01, 0x02, 0x03]);\n * assertByteArrayOffsetIsNotOutOfRange('myCodec', 0, bytes.length); // OK\n * assertByteArrayOffsetIsNotOutOfRange('myCodec', 3, bytes.length); // OK\n * assertByteArrayOffsetIsNotOutOfRange('myCodec', 4, bytes.length); // Throws\n * ```\n */\nexport function assertByteArrayOffsetIsNotOutOfRange(codecDescription: string, offset: number, bytesLength: number) {\n if (offset < 0 || offset > bytesLength) {\n throw new SolanaError(SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE, {\n bytesLength,\n codecDescription,\n offset,\n });\n }\n}\n","import { assertByteArrayHasEnoughBytesForCodec } from './assertions';\nimport {\n Codec,\n createDecoder,\n createEncoder,\n Decoder,\n Encoder,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n getEncodedSize,\n isFixedSize,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from './codec';\nimport { combineCodec } from './combine-codec';\n\ntype NumberEncoder = Encoder<bigint | number> | Encoder<number>;\ntype FixedSizeNumberEncoder<TSize extends number = number> =\n | FixedSizeEncoder<bigint | number, TSize>\n | FixedSizeEncoder<number, TSize>;\ntype NumberDecoder = Decoder<bigint> | Decoder<number>;\ntype FixedSizeNumberDecoder<TSize extends number = number> =\n | FixedSizeDecoder<bigint, TSize>\n | FixedSizeDecoder<number, TSize>;\ntype NumberCodec = Codec<bigint | number, bigint> | Codec<number>;\ntype FixedSizeNumberCodec<TSize extends number = number> =\n | FixedSizeCodec<bigint | number, bigint, TSize>\n | FixedSizeCodec<number, number, TSize>;\n\n/**\n * Stores the size of the `encoder` in bytes as a prefix using the `prefix` encoder.\n *\n * See {@link addCodecSizePrefix} for more information.\n *\n * @typeParam TFrom - The type of the value to encode.\n *\n * @see {@link addCodecSizePrefix}\n */\nexport function addEncoderSizePrefix<TFrom>(\n encoder: FixedSizeEncoder<TFrom>,\n prefix: FixedSizeNumberEncoder,\n): FixedSizeEncoder<TFrom>;\nexport function addEncoderSizePrefix<TFrom>(encoder: Encoder<TFrom>, prefix: NumberEncoder): VariableSizeEncoder<TFrom>;\nexport function addEncoderSizePrefix<TFrom>(encoder: Encoder<TFrom>, prefix: NumberEncoder): Encoder<TFrom> {\n const write = ((value, bytes, offset) => {\n // Here we exceptionally use the `encode` function instead of the `write`\n // function to contain the content of the encoder within its own bounds.\n const encoderBytes = encoder.encode(value);\n offset = prefix.write(encoderBytes.length, bytes, offset);\n bytes.set(encoderBytes, offset);\n return offset + encoderBytes.length;\n }) as Encoder<TFrom>['write'];\n\n if (isFixedSize(prefix) && isFixedSize(encoder)) {\n return createEncoder({ ...encoder, fixedSize: prefix.fixedSize + encoder.fixedSize, write });\n }\n\n const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : (prefix.maxSize ?? null);\n const encoderMaxSize = isFixedSize(encoder) ? encoder.fixedSize : (encoder.maxSize ?? null);\n const maxSize = prefixMaxSize !== null && encoderMaxSize !== null ? prefixMaxSize + encoderMaxSize : null;\n\n return createEncoder({\n ...encoder,\n ...(maxSize !== null ? { maxSize } : {}),\n getSizeFromValue: value => {\n const encoderSize = getEncodedSize(value, encoder);\n return getEncodedSize(encoderSize, prefix) + encoderSize;\n },\n write,\n });\n}\n\n/**\n * Bounds the size of the nested `decoder` by reading its encoded `prefix`.\n *\n * See {@link addCodecSizePrefix} for more information.\n *\n * @typeParam TTo - The type of the decoded value.\n *\n * @see {@link addCodecSizePrefix}\n */\nexport function addDecoderSizePrefix<TTo>(\n decoder: FixedSizeDecoder<TTo>,\n prefix: FixedSizeNumberDecoder,\n): FixedSizeDecoder<TTo>;\nexport function addDecoderSizePrefix<TTo>(decoder: Decoder<TTo>, prefix: NumberDecoder): VariableSizeDecoder<TTo>;\nexport function addDecoderSizePrefix<TTo>(decoder: Decoder<TTo>, prefix: NumberDecoder): Decoder<TTo> {\n const read = ((bytes, offset) => {\n const [bigintSize, decoderOffset] = prefix.read(bytes, offset);\n const size = Number(bigintSize);\n offset = decoderOffset;\n // Slice the byte array to the contained size if necessary.\n if (offset > 0 || bytes.length > size) {\n bytes = bytes.slice(offset, offset + size);\n }\n assertByteArrayHasEnoughBytesForCodec('addDecoderSizePrefix', size, bytes);\n // Here we exceptionally use the `decode` function instead of the `read`\n // function to contain the content of the decoder within its own bounds.\n return [decoder.decode(bytes), offset + size];\n }) as Decoder<TTo>['read'];\n\n if (isFixedSize(prefix) && isFixedSize(decoder)) {\n return createDecoder({ ...decoder, fixedSize: prefix.fixedSize + decoder.fixedSize, read });\n }\n\n const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : (prefix.maxSize ?? null);\n const decoderMaxSize = isFixedSize(decoder) ? decoder.fixedSize : (decoder.maxSize ?? null);\n const maxSize = prefixMaxSize !== null && decoderMaxSize !== null ? prefixMaxSize + decoderMaxSize : null;\n return createDecoder({ ...decoder, ...(maxSize !== null ? { maxSize } : {}), read });\n}\n\n/**\n * Stores the byte size of any given codec as an encoded number prefix.\n *\n * This sets a limit on variable-size codecs and tells us when to stop decoding.\n * When encoding, the size of the encoded data is stored before the encoded data itself.\n * When decoding, the size is read first to know how many bytes to read next.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n *\n * @example\n * For example, say we want to bound a variable-size base-58 string using a `u32` size prefix.\n * Here’s how you can use the `addCodecSizePrefix` function to achieve that.\n *\n * ```ts\n * const getU32Base58Codec = () => addCodecSizePrefix(getBase58Codec(), getU32Codec());\n *\n * getU32Base58Codec().encode('hello world');\n * // 0x0b00000068656c6c6f20776f726c64\n * // | └-- Our encoded base-58 string.\n * // └-- Our encoded u32 size prefix.\n * ```\n *\n * @remarks\n * Separate {@link addEncoderSizePrefix} and {@link addDecoderSizePrefix} functions are also available.\n *\n * ```ts\n * const bytes = addEncoderSizePrefix(getBase58Encoder(), getU32Encoder()).encode('hello');\n * const value = addDecoderSizePrefix(getBase58Decoder(), getU32Decoder()).decode(bytes);\n * ```\n *\n * @see {@link addEncoderSizePrefix}\n * @see {@link addDecoderSizePrefix}\n */\nexport function addCodecSizePrefix<TFrom, TTo extends TFrom>(\n codec: FixedSizeCodec<TFrom, TTo>,\n prefix: FixedSizeNumberCodec,\n): FixedSizeCodec<TFrom, TTo>;\nexport function addCodecSizePrefix<TFrom, TTo extends TFrom>(\n codec: Codec<TFrom, TTo>,\n prefix: NumberCodec,\n): VariableSizeCodec<TFrom, TTo>;\nexport function addCodecSizePrefix<TFrom, TTo extends TFrom>(\n codec: Codec<TFrom, TTo>,\n prefix: NumberCodec,\n): Codec<TFrom, TTo> {\n return combineCodec(addEncoderSizePrefix(codec, prefix), addDecoderSizePrefix(codec, prefix));\n}\n","import { ReadonlyUint8Array } from './readonly-uint8array';\n\n/**\n * Converts a `Uint8Array` to an `ArrayBuffer`. If the underlying buffer is a `SharedArrayBuffer`,\n * it will be copied to a non-shared buffer, for safety.\n *\n * @remarks\n * Source: https://stackoverflow.com/questions/37228285/uint8array-to-arraybuffer\n */\nexport function toArrayBuffer(bytes: ReadonlyUint8Array | Uint8Array, offset?: number, length?: number): ArrayBuffer {\n const bytesOffset = bytes.byteOffset + (offset ?? 0);\n const bytesLength = length ?? bytes.byteLength;\n let buffer: ArrayBuffer;\n if (typeof SharedArrayBuffer === 'undefined') {\n buffer = bytes.buffer as ArrayBuffer;\n } else if (bytes.buffer instanceof SharedArrayBuffer) {\n buffer = new ArrayBuffer(bytes.length);\n new Uint8Array(buffer).set(new Uint8Array(bytes));\n } else {\n buffer = bytes.buffer;\n }\n return (bytesOffset === 0 || bytesOffset === -bytes.byteLength) && bytesLength === bytes.byteLength\n ? buffer\n : buffer.slice(bytesOffset, bytesOffset + bytesLength);\n}\n","import { SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY, SolanaError } from '@solana/errors';\n\nimport { createDecoder, Decoder } from './codec';\n\n/**\n * Create a {@link Decoder} that asserts that the bytes provided to `decode` or `read` are fully consumed by the inner decoder\n * @param decoder A decoder to wrap\n * @returns A new decoder that will throw if provided with a byte array that it does not fully consume\n *\n * @typeParam T - The type of the decoder\n *\n * @remarks\n * Note that this compares the offset after encoding to the length of the input byte array\n *\n * The `offset` parameter to `decode` and `read` is still considered, and will affect the new offset that is compared to the byte array length\n *\n * The error that is thrown by the returned decoder is a {@link SolanaError} with the code `SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY`\n *\n * @example\n * Create a decoder that decodes a `u32` (4 bytes) and ensures the entire byte array is consumed\n * ```ts\n * const decoder = createDecoderThatUsesExactByteArray(getU32Decoder());\n * decoder.decode(new Uint8Array([0, 0, 0, 0])); // 0\n * decoder.decode(new Uint8Array([0, 0, 0, 0, 0])); // throws\n *\n * // with an offset\n * decoder.decode(new Uint8Array([0, 0, 0, 0, 0]), 1); // 0\n * decoder.decode(new Uint8Array([0, 0, 0, 0, 0, 0]), 1); // throws\n * ```\n */\nexport function createDecoderThatConsumesEntireByteArray<T>(decoder: Decoder<T>): Decoder<T> {\n return createDecoder({\n ...decoder,\n read(bytes, offset) {\n const [value, newOffset] = decoder.read(bytes, offset);\n if (bytes.length > newOffset) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_DECODER_TO_CONSUME_ENTIRE_BYTE_ARRAY, {\n expectedLength: newOffset,\n numExcessBytes: bytes.length - newOffset,\n });\n }\n return [value, newOffset];\n },\n });\n}\n","import { assertByteArrayHasEnoughBytesForCodec } from './assertions';\nimport { fixBytes } from './bytes';\nimport {\n Codec,\n createDecoder,\n createEncoder,\n Decoder,\n Encoder,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n isFixedSize,\n Offset,\n} from './codec';\nimport { combineCodec } from './combine-codec';\n\n/**\n * Creates a fixed-size encoder from a given encoder.\n *\n * The resulting encoder ensures that encoded values always have the specified number of bytes.\n * If the original encoded value is larger than `fixedBytes`, it is truncated.\n * If it is smaller, it is padded with trailing zeroes.\n *\n * For more details, see {@link fixCodecSize}.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TSize - The fixed size of the encoded value in bytes.\n *\n * @param encoder - The encoder to wrap into a fixed-size encoder.\n * @param fixedBytes - The fixed number of bytes to write.\n * @returns A `FixedSizeEncoder` that ensures a consistent output size.\n *\n * @example\n * ```ts\n * const encoder = fixEncoderSize(getUtf8Encoder(), 4);\n * encoder.encode(\"Hello\"); // 0x48656c6c (truncated)\n * encoder.encode(\"Hi\"); // 0x48690000 (padded)\n * encoder.encode(\"Hiya\"); // 0x48697961 (same length)\n * ```\n *\n * @remarks\n * If you need a full codec with both encoding and decoding, use {@link fixCodecSize}.\n *\n * @see {@link fixCodecSize}\n * @see {@link fixDecoderSize}\n */\nexport function fixEncoderSize<TFrom, TSize extends number>(\n encoder: Encoder<TFrom>,\n fixedBytes: TSize,\n): FixedSizeEncoder<TFrom, TSize> {\n return createEncoder({\n fixedSize: fixedBytes,\n write: (value: TFrom, bytes: Uint8Array, offset: Offset) => {\n // Here we exceptionally use the `encode` function instead of the `write`\n // function as using the nested `write` function on a fixed-sized byte\n // array may result in a out-of-bounds error on the nested encoder.\n const variableByteArray = encoder.encode(value);\n const fixedByteArray =\n variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;\n bytes.set(fixedByteArray, offset);\n return offset + fixedBytes;\n },\n });\n}\n\n/**\n * Creates a fixed-size decoder from a given decoder.\n *\n * The resulting decoder always reads exactly `fixedBytes` bytes from the input.\n * If the nested decoder is also fixed-size, the bytes are truncated or padded as needed.\n *\n * For more details, see {@link fixCodecSize}.\n *\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the encoded value in bytes.\n *\n * @param decoder - The decoder to wrap into a fixed-size decoder.\n * @param fixedBytes - The fixed number of bytes to read.\n * @returns A `FixedSizeDecoder` that ensures a consistent input size.\n *\n * @example\n * ```ts\n * const decoder = fixDecoderSize(getUtf8Decoder(), 4);\n * decoder.decode(new Uint8Array([72, 101, 108, 108, 111])); // \"Hell\" (truncated)\n * decoder.decode(new Uint8Array([72, 105, 0, 0])); // \"Hi\" (zeroes ignored)\n * decoder.decode(new Uint8Array([72, 105, 121, 97])); // \"Hiya\" (same length)\n * ```\n *\n * @remarks\n * If you need a full codec with both encoding and decoding, use {@link fixCodecSize}.\n *\n * @see {@link fixCodecSize}\n * @see {@link fixEncoderSize}\n */\nexport function fixDecoderSize<TTo, TSize extends number>(\n decoder: Decoder<TTo>,\n fixedBytes: TSize,\n): FixedSizeDecoder<TTo, TSize> {\n return createDecoder({\n fixedSize: fixedBytes,\n read: (bytes, offset) => {\n assertByteArrayHasEnoughBytesForCodec('fixCodecSize', fixedBytes, bytes, offset);\n // Slice the byte array to the fixed size if necessary.\n if (offset > 0 || bytes.length > fixedBytes) {\n bytes = bytes.slice(offset, offset + fixedBytes);\n }\n // If the nested decoder is fixed-size, pad and truncate the byte array accordingly.\n if (isFixedSize(decoder)) {\n bytes = fixBytes(bytes, decoder.fixedSize);\n }\n // Decode the value using the nested decoder.\n const [value] = decoder.read(bytes, 0);\n return [value, offset + fixedBytes];\n },\n });\n}\n\n/**\n * Creates a fixed-size codec from a given codec.\n *\n * The resulting codec ensures that both encoding and decoding operate on a fixed number of bytes.\n * When encoding:\n * - If the encoded value is larger than `fixedBytes`, it is truncated.\n * - If it is smaller, it is padded with trailing zeroes.\n * - If it is exactly `fixedBytes`, it remains unchanged.\n *\n * When decoding:\n * - Exactly `fixedBytes` bytes are read from the input.\n * - If the nested decoder has a smaller fixed size, bytes are truncated or padded as necessary.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the encoded value in bytes.\n *\n * @param codec - The codec to wrap into a fixed-size codec.\n * @param fixedBytes - The fixed number of bytes to read/write.\n * @returns A `FixedSizeCodec` that ensures both encoding and decoding conform to a fixed size.\n *\n * @example\n * ```ts\n * const codec = fixCodecSize(getUtf8Codec(), 4);\n *\n * const bytes1 = codec.encode(\"Hello\"); // 0x48656c6c (truncated)\n * const value1 = codec.decode(bytes1); // \"Hell\"\n *\n * const bytes2 = codec.encode(\"Hi\"); // 0x48690000 (padded)\n * const value2 = codec.decode(bytes2); // \"Hi\"\n *\n * const bytes3 = codec.encode(\"Hiya\"); // 0x48697961 (same length)\n * const value3 = codec.decode(bytes3); // \"Hiya\"\n * ```\n *\n * @remarks\n * If you only need to enforce a fixed size for encoding, use {@link fixEncoderSize}.\n * If you only need to enforce a fixed size for decoding, use {@link fixDecoderSize}.\n *\n * ```ts\n * const bytes = fixEncoderSize(getUtf8Encoder(), 4).encode(\"Hiya\");\n * const value = fixDecoderSize(getUtf8Decoder(), 4).decode(bytes);\n * ```\n *\n * @see {@link fixEncoderSize}\n * @see {@link fixDecoderSize}\n */\nexport function fixCodecSize<TFrom, TTo extends TFrom, TSize extends number>(\n codec: Codec<TFrom, TTo>,\n fixedBytes: TSize,\n): FixedSizeCodec<TFrom, TTo, TSize> {\n return combineCodec(fixEncoderSize(codec, fixedBytes), fixDecoderSize(codec, fixedBytes));\n}\n","import { assertByteArrayOffsetIsNotOutOfRange } from './assertions';\nimport { Codec, createDecoder, createEncoder, Decoder, Encoder, Offset } from './codec';\nimport { combineCodec } from './combine-codec';\nimport { ReadonlyUint8Array } from './readonly-uint8array';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyEncoder = Encoder<any>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyDecoder = Decoder<any>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyCodec = Codec<any>;\n\n/**\n * Configuration object for modifying the offset of an encoder, decoder, or codec.\n *\n * This type defines optional functions for adjusting the **pre-offset** (before encoding/decoding)\n * and the **post-offset** (after encoding/decoding). These functions allow precise control\n * over where data is written or read within a byte array.\n *\n * @property preOffset - A function that modifies the offset before encoding or decoding.\n * @property postOffset - A function that modifies the offset after encoding or decoding.\n *\n * @example\n * Moving the pre-offset forward by 2 bytes.\n * ```ts\n * const config: OffsetConfig = {\n * preOffset: ({ preOffset }) => preOffset + 2,\n * };\n * ```\n *\n * @example\n * Moving the post-offset forward by 2 bytes.\n * ```ts\n * const config: OffsetConfig = {\n * postOffset: ({ postOffset }) => postOffset + 2,\n * };\n * ```\n *\n * @example\n * Using both pre-offset and post-offset together.\n * ```ts\n * const config: OffsetConfig = {\n * preOffset: ({ preOffset }) => preOffset + 2,\n * postOffset: ({ postOffset }) => postOffset + 4,\n * };\n * ```\n *\n * @see {@link offsetEncoder}\n * @see {@link offsetDecoder}\n * @see {@link offsetCodec}\n */\ntype OffsetConfig = {\n postOffset?: PostOffsetFunction;\n preOffset?: PreOffsetFunction;\n};\n\n/**\n * Scope provided to the `preOffset` and `postOffset` functions,\n * containing contextual information about the current encoding or decoding process.\n *\n * The pre-offset function modifies where encoding or decoding begins,\n * while the post-offset function modifies where the next operation continues.\n *\n * @property bytes - The entire byte array being encoded or decoded.\n * @property preOffset - The original offset before encoding or decoding starts.\n * @property wrapBytes - A helper function that wraps offsets around the byte array length.\n *\n * @example\n * Using `wrapBytes` to wrap a negative offset to the end of the byte array.\n * ```ts\n * const config: OffsetConfig = {\n * preOffset: ({ wrapBytes }) => wrapBytes(-4), // Moves to last 4 bytes\n * };\n * ```\n *\n * @example\n * Adjusting the offset dynamically based on the byte array size.\n * ```ts\n * const config: OffsetConfig = {\n * preOffset: ({ bytes }) => bytes.length > 10 ? 4 : 2,\n * };\n * ```\n *\n * @see {@link PreOffsetFunction}\n * @see {@link PostOffsetFunction}\n */\ntype PreOffsetFunctionScope = {\n /** The entire byte array. */\n bytes: ReadonlyUint8Array | Uint8Array;\n /** The original offset prior to encode or decode. */\n preOffset: Offset;\n /** Wraps the offset to the byte array length. */\n wrapBytes: (offset: Offset) => Offset;\n};\n\n/**\n * A function that modifies the pre-offset before encoding or decoding.\n *\n * This function is used to adjust the starting position before writing\n * or reading data in a byte array.\n *\n * @param scope - The current encoding or decoding context.\n * @returns The new offset at which encoding or decoding should start.\n *\n * @example\n * Skipping the first 2 bytes before writing or reading.\n * ```ts\n * const preOffset: PreOffsetFunction = ({ preOffset }) => preOffset + 2;\n * ```\n *\n * @example\n * Wrapping the offset to ensure it stays within bounds.\n * ```ts\n * const preOffset: PreOffsetFunction = ({ wrapBytes, preOffset }) => wrapBytes(preOffset + 10);\n * ```\n *\n * @see {@link OffsetConfig}\n * @see {@link PreOffsetFunctionScope}\n */\ntype PreOffsetFunction = (scope: PreOffsetFunctionScope) => Offset;\n\n/**\n * A function that modifies the post-offset after encoding or decoding.\n *\n * This function adjusts where the next encoder or decoder should start\n * after the current operation has completed.\n *\n * @param scope - The current encoding or decoding context, including the modified pre-offset\n * and the original post-offset.\n * @returns The new offset at which the next operation should begin.\n *\n * @example\n * Moving the post-offset forward by 4 bytes.\n * ```ts\n * const postOffset: PostOffsetFunction = ({ postOffset }) => postOffset + 4;\n * ```\n *\n * @example\n * Wrapping the post-offset within the byte array length.\n * ```ts\n * const postOffset: PostOffsetFunction = ({ wrapBytes, postOffset }) => wrapBytes(postOffset);\n * ```\n *\n * @example\n * Ensuring a minimum spacing of 8 bytes between values.\n * ```ts\n * const postOffset: PostOffsetFunction = ({ postOffset, newPreOffset }) =>\n * Math.max(postOffset, newPreOffset + 8);\n * ```\n *\n * @see {@link OffsetConfig}\n * @see {@link PreOffsetFunctionScope}\n */\ntype PostOffsetFunction = (\n scope: PreOffsetFunctionScope & {\n /** The modified offset used to encode or decode. */\n newPreOffset: Offset;\n /** The original offset returned by the encoder or decoder. */\n postOffset: Offset;\n },\n) => Offset;\n\n/**\n * Moves the offset of a given encoder before and/or after encoding.\n *\n * This function allows an encoder to write its encoded value at a different offset\n * than the one originally provided. It supports both pre-offset adjustments\n * (before encoding) and post-offset adjustments (after encoding).\n *\n * The pre-offset function determines where encoding should start, while the\n * post-offset function adjusts where the next encoder should continue writing.\n *\n * For more details, see {@link offsetCodec}.\n *\n * @typeParam TFrom - The type of the value to encode.\n *\n * @param encoder - The encoder to adjust.\n * @param config - An object specifying how the offset should be modified.\n * @returns A new encoder with adjusted offsets.\n *\n * @example\n * Moving the pre-offset forward by 2 bytes.\n * ```ts\n * const encoder = offsetEncoder(getU32Encoder(), {\n * preOffset: ({ preOffset }) => preOffset + 2,\n * });\n * const bytes = new Uint8Array(10);\n * encoder.write(42, bytes, 0); // Actually written at offset 2\n * ```\n *\n * @example\n * Moving the post-offset forward by 2 bytes.\n * ```ts\n * const encoder = offsetEncoder(getU32Encoder(), {\n * postOffset: ({ postOffset }) => postOffset + 2,\n * });\n * const bytes = new Uint8Array(10);\n * const nextOffset = encoder.write(42, bytes, 0); // Next encoder starts at offset 6 instead of 4\n * ```\n *\n * @example\n * Using `wrapBytes` to ensure an offset wraps around the byte array length.\n * ```ts\n * const encoder = offsetEncoder(getU32Encoder(), {\n * preOffset: ({ wrapBytes }) => wrapBytes(-4), // Moves offset to last 4 bytes of the array\n * });\n * const bytes = new Uint8Array(10);\n * encoder.write(42, bytes, 0); // Writes at bytes.length - 4\n * ```\n *\n * @remarks\n * If you need both encoding and decoding offsets to be adjusted, use {@link offsetCodec}.\n *\n * @see {@link offsetCodec}\n * @see {@link offsetDecoder}\n */\nexport function offsetEncoder<TEncoder extends AnyEncoder>(encoder: TEncoder, config: OffsetConfig): TEncoder {\n return createEncoder({\n ...encoder,\n write: (value, bytes, preOffset) => {\n const wrapBytes = (offset: Offset) => modulo(offset, bytes.length);\n const newPreOffset = config.preOffset ? config.preOffset({ bytes, preOffset, wrapBytes }) : preOffset;\n assertByteArrayOffsetIsNotOutOfRange('offsetEncoder', newPreOffset, bytes.length);\n const postOffset = encoder.write(value, bytes, newPreOffset);\n const newPostOffset = config.postOffset\n ? config.postOffset({ bytes, newPreOffset, postOffset, preOffset, wrapBytes })\n : postOffset;\n assertByteArrayOffsetIsNotOutOfRange('offsetEncoder', newPostOffset, bytes.length);\n return newPostOffset;\n },\n }) as TEncoder;\n}\n\n/**\n * Moves the offset of a given decoder before and/or after decoding.\n *\n * This function allows a decoder to read its input from a different offset\n * than the one originally provided. It supports both pre-offset adjustments\n * (before decoding) and post-offset adjustments (after decoding).\n *\n * The pre-offset function determines where decoding should start, while the\n * post-offset function adjusts where the next decoder should continue reading.\n *\n * For more details, see {@link offsetCodec}.\n *\n * @typeParam TTo - The type of the decoded value.\n *\n * @param decoder - The decoder to adjust.\n * @param config - An object specifying how the offset should be modified.\n * @returns A new decoder with adjusted offsets.\n *\n * @example\n * Moving the pre-offset forward by 2 bytes.\n * ```ts\n * const decoder = offsetDecoder(getU32Decoder(), {\n * preOffset: ({ preOffset }) => preOffset + 2,\n * });\n * const bytes = new Uint8Array([0, 0, 42, 0]); // Value starts at offset 2\n * decoder.read(bytes, 0); // Actually reads from offset 2\n * ```\n *\n * @example\n * Moving the post-offset forward by 2 bytes.\n * ```ts\n * const decoder = offsetDecoder(getU32Decoder(), {\n * postOffset: ({ postOffset }) => postOffset + 2,\n * });\n * const bytes = new Uint8Array([42, 0, 0, 0]);\n * const [value, nextOffset] = decoder.read(bytes, 0); // Next decoder starts at offset 6 instead of 4\n * ```\n *\n * @example\n * Using `wrapBytes` to read from the last 4 bytes of an array.\n * ```ts\n * const decoder = offsetDecoder(getU32Decoder(), {\n * preOffset: ({ wrapBytes }) => wrapBytes(-4), // Moves offset to last 4 bytes of the array\n * });\n * const bytes = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 42]); // Value stored at the last 4 bytes\n * decoder.read(bytes, 0); // Reads from bytes.length - 4\n * ```\n *\n * @remarks\n * If you need both encoding and decoding offsets to be adjusted, use {@link offsetCodec}.\n *\n * @see {@link offsetCodec}\n * @see {@link offsetEncoder}\n */\nexport function offsetDecoder<TDecoder extends AnyDecoder>(decoder: TDecoder, config: OffsetConfig): TDecoder {\n return createDecoder({\n ...decoder,\n read: (bytes, preOffset) => {\n const wrapBytes = (offset: Offset) => modulo(offset, bytes.length);\n const newPreOffset = config.preOffset ? config.preOffset({ bytes, preOffset, wrapBytes }) : preOffset;\n assertByteArrayOffsetIsNotOutOfRange('offsetDecoder', newPreOffset, bytes.length);\n const [value, postOffset] = decoder.read(bytes, newPreOffset);\n const newPostOffset = config.postOffset\n ? config.postOffset({ bytes, newPreOffset, postOffset, preOffset, wrapBytes })\n : postOffset;\n assertByteArrayOffsetIsNotOutOfRange('offsetDecoder', newPostOffset, bytes.length);\n return [value, newPostOffset];\n },\n }) as TDecoder;\n}\n\n/**\n * Moves the offset of a given codec before and/or after encoding and decoding.\n *\n * This function allows a codec to encode and decode values at custom offsets\n * within a byte array. It modifies both the **pre-offset** (where encoding/decoding starts)\n * and the **post-offset** (where the next operation should continue).\n *\n * This is particularly useful when working with structured binary formats\n * that require skipping reserved bytes, inserting padding, or aligning fields at\n * specific locations.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n *\n * @param codec - The codec to adjust.\n * @param config - An object specifying how the offset should be modified.\n * @returns A new codec with adjusted offsets.\n *\n * @example\n * Moving the pre-offset forward by 2 bytes when encoding and decoding.\n * ```ts\n * const codec = offsetCodec(getU32Codec(), {\n * preOffset: ({ preOffset }) => preOffset + 2,\n * });\n * const bytes = new Uint8Array(10);\n * codec.write(42, bytes, 0); // Actually written at offset 2\n * codec.read(bytes, 0); // Actually read from offset 2\n * ```\n *\n * @example\n * Moving the post-offset forward by 2 bytes when encoding and decoding.\n * ```ts\n * const codec = offsetCodec(getU32Codec(), {\n * postOffset: ({ postOffset }) => postOffset + 2,\n * });\n * const bytes = new Uint8Array(10);\n * codec.write(42, bytes, 0);\n * // Next encoding starts at offset 6 instead of 4\n * codec.read(bytes, 0);\n * // Next decoding starts at offset 6 instead of 4\n * ```\n *\n * @example\n * Using `wrapBytes` to loop around negative offsets.\n * ```ts\n * const codec = offsetCodec(getU32Codec(), {\n * preOffset: ({ wrapBytes }) => wrapBytes(-4), // Moves offset to last 4 bytes\n * });\n * const bytes = new Uint8Array(10);\n * codec.write(42, bytes, 0); // Writes at bytes.length - 4\n * codec.read(bytes, 0); // Reads from bytes.length - 4\n * ```\n *\n * @remarks\n * If you only need to adjust offsets for encoding, use {@link offsetEncoder}.\n * If you only need to adjust offsets for decoding, use {@link offsetDecoder}.\n *\n * ```ts\n * const bytes = new Uint8Array(10);\n * offsetEncoder(getU32Encoder(), { preOffset: ({ preOffset }) => preOffset + 2 }).write(42, bytes, 0);\n * const [value] = offsetDecoder(getU32Decoder(), { preOffset: ({ preOffset }) => preOffset + 2 }).read(bytes, 0);\n * ```\n *\n * @see {@link offsetEncoder}\n * @see {@link offsetDecoder}\n */\nexport function offsetCodec<TCodec extends AnyCodec>(codec: TCodec, config: OffsetConfig): TCodec {\n return combineCodec(offsetEncoder(codec, config), offsetDecoder(codec, config)) as TCodec;\n}\n\n/** A modulo function that handles negative dividends and zero divisors. */\nfunction modulo(dividend: number, divisor: number) {\n if (divisor === 0) return 0;\n return ((dividend % divisor) + divisor) % divisor;\n}\n","import { SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, SolanaError } from '@solana/errors';\n\nimport {\n Codec,\n createDecoder,\n createEncoder,\n Decoder,\n Encoder,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n isFixedSize,\n} from './codec';\nimport { combineCodec } from './combine-codec';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyEncoder = Encoder<any>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyDecoder = Decoder<any>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyCodec = Codec<any>;\n\n/**\n * Updates the size of a given encoder.\n *\n * This function modifies the size of an encoder using a provided transformation function.\n * For fixed-size encoders, it updates the `fixedSize` property, and for variable-size\n * encoders, it adjusts the size calculation based on the encoded value.\n *\n * If the new size is negative, an error will be thrown.\n *\n * For more details, see {@link resizeCodec}.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TSize - The original fixed size of the encoded value.\n * @typeParam TNewSize - The new fixed size after resizing.\n *\n * @param encoder - The encoder whose size will be updated.\n * @param resize - A function that takes the current size and returns the new size.\n * @returns A new encoder with the updated size.\n *\n * @example\n * Increasing the size of a `u16` encoder by 2 bytes.\n * ```ts\n * const encoder = resizeEncoder(getU16Encoder(), size => size + 2);\n * encoder.encode(0xffff); // 0xffff0000 (two extra bytes added)\n * ```\n *\n * @example\n * Shrinking a `u32` encoder to only use 2 bytes.\n * ```ts\n * const encoder = resizeEncoder(getU32Encoder(), () => 2);\n * encoder.fixedSize; // 2\n * ```\n *\n * @see {@link resizeCodec}\n * @see {@link resizeDecoder}\n */\nexport function resizeEncoder<TFrom, TSize extends number, TNewSize extends number>(\n encoder: FixedSizeEncoder<TFrom, TSize>,\n resize: (size: TSize) => TNewSize,\n): FixedSizeEncoder<TFrom, TNewSize>;\nexport function resizeEncoder<TEncoder extends AnyEncoder>(\n encoder: TEncoder,\n resize: (size: number) => number,\n): TEncoder;\nexport function resizeEncoder<TEncoder extends AnyEncoder>(\n encoder: TEncoder,\n resize: (size: number) => number,\n): TEncoder {\n if (isFixedSize(encoder)) {\n const fixedSize = resize(encoder.fixedSize);\n if (fixedSize < 0) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, {\n bytesLength: fixedSize,\n codecDescription: 'resizeEncoder',\n });\n }\n return createEncoder({ ...encoder, fixedSize }) as TEncoder;\n }\n return createEncoder({\n ...encoder,\n getSizeFromValue: value => {\n const newSize = resize(encoder.getSizeFromValue(value));\n if (newSize < 0) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, {\n bytesLength: newSize,\n codecDescription: 'resizeEncoder',\n });\n }\n return newSize;\n },\n }) as TEncoder;\n}\n\n/**\n * Updates the size of a given decoder.\n *\n * This function modifies the size of a decoder using a provided transformation function.\n * For fixed-size decoders, it updates the `fixedSize` property to reflect the new size.\n * Variable-size decoders remain unchanged, as their size is determined dynamically.\n *\n * If the new size is negative, an error will be thrown.\n *\n * For more details, see {@link resizeCodec}.\n *\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The original fixed size of the decoded value.\n * @typeParam TNewSize - The new fixed size after resizing.\n *\n * @param decoder - The decoder whose size will be updated.\n * @param resize - A function that takes the current size and returns the new size.\n * @returns A new decoder with the updated size.\n *\n * @example\n * Expanding a `u16` decoder to read 4 bytes instead of 2.\n * ```ts\n * const decoder = resizeDecoder(getU16Decoder(), size => size + 2);\n * decoder.fixedSize; // 4\n * ```\n *\n * @example\n * Shrinking a `u32` decoder to only read 2 bytes.\n * ```ts\n * const decoder = resizeDecoder(getU32Decoder(), () => 2);\n * decoder.fixedSize; // 2\n * ```\n *\n * @see {@link resizeCodec}\n * @see {@link resizeEncoder}\n */\nexport function resizeDecoder<TFrom, TSize extends number, TNewSize extends number>(\n decoder: FixedSizeDecoder<TFrom, TSize>,\n resize: (size: TSize) => TNewSize,\n): FixedSizeDecoder<TFrom, TNewSize>;\nexport function resizeDecoder<TDecoder extends AnyDecoder>(\n decoder: TDecoder,\n resize: (size: number) => number,\n): TDecoder;\nexport function resizeDecoder<TDecoder extends AnyDecoder>(\n decoder: TDecoder,\n resize: (size: number) => number,\n): TDecoder {\n if (isFixedSize(decoder)) {\n const fixedSize = resize(decoder.fixedSize);\n if (fixedSize < 0) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, {\n bytesLength: fixedSize,\n codecDescription: 'resizeDecoder',\n });\n }\n return createDecoder({ ...decoder, fixedSize }) as TDecoder;\n }\n return decoder;\n}\n\n/**\n * Updates the size of a given codec.\n *\n * This function modifies the size of both the codec using a provided\n * transformation function. It is useful for adjusting the allocated byte size for\n * encoding and decoding without altering the underlying data structure.\n *\n * If the new size is negative, an error will be thrown.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The original fixed size of the encoded/decoded value (for fixed-size codecs).\n * @typeParam TNewSize - The new fixed size after resizing (for fixed-size codecs).\n *\n * @param codec - The codec whose size will be updated.\n * @param resize - A function that takes the current size and returns the new size.\n * @returns A new codec with the updated size.\n *\n * @example\n * Expanding a `u16` codec from 2 to 4 bytes.\n * ```ts\n * const codec = resizeCodec(getU16Codec(), size => size + 2);\n * const bytes = codec.encode(0xffff); // 0xffff0000 (two extra bytes added)\n * const value = codec.decode(bytes); // 0xffff (reads original two bytes)\n * ```\n *\n * @example\n * Shrinking a `u32` codec to only use 2 bytes.\n * ```ts\n * const codec = resizeCodec(getU32Codec(), () => 2);\n * codec.fixedSize; // 2\n * ```\n *\n * @remarks\n * If you only need to resize an encoder, use {@link resizeEncoder}.\n * If you only need to resize a decoder, use {@link resizeDecoder}.\n *\n * ```ts\n * const bytes = resizeEncoder(getU32Encoder(), (size) => size + 2).encode(0xffff);\n * const value = resizeDecoder(getU32Decoder(), (size) => size + 2).decode(bytes);\n * ```\n *\n * @see {@link resizeEncoder}\n * @see {@link resizeDecoder}\n */\nexport function resizeCodec<TFrom, TTo extends TFrom, TSize extends number, TNewSize extends number>(\n codec: FixedSizeCodec<TFrom, TTo, TSize>,\n resize: (size: TSize) => TNewSize,\n): FixedSizeCodec<TFrom, TTo, TNewSize>;\nexport function resizeCodec<TCodec extends AnyCodec>(codec: TCodec, resize: (size: number) => number): TCodec;\nexport function resizeCodec<TCodec extends AnyCodec>(codec: TCodec, resize: (size: number) => number): TCodec {\n return combineCodec(resizeEncoder(codec, resize), resizeDecoder(codec, resize)) as TCodec;\n}\n","import { Codec, Decoder, Encoder, Offset } from './codec';\nimport { combineCodec } from './combine-codec';\nimport { offsetDecoder, offsetEncoder } from './offset-codec';\nimport { resizeDecoder, resizeEncoder } from './resize-codec';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyEncoder = Encoder<any>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyDecoder = Decoder<any>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyCodec = Codec<any>;\n\n/**\n * Adds left padding to the given encoder, shifting the encoded value forward\n * by `offset` bytes whilst increasing the size of the encoder accordingly.\n *\n * For more details, see {@link padLeftCodec}.\n *\n * @typeParam TFrom - The type of the value to encode.\n *\n * @param encoder - The encoder to pad.\n * @param offset - The number of padding bytes to add before encoding.\n * @returns A new encoder with left padding applied.\n *\n * @example\n * ```ts\n * const encoder = padLeftEncoder(getU16Encoder(), 2);\n * const bytes = encoder.encode(0xffff); // 0x0000ffff (0xffff written at offset 2)\n * ```\n *\n * @see {@link padLeftCodec}\n * @see {@link padLeftDecoder}\n */\nexport function padLeftEncoder<TEncoder extends AnyEncoder>(encoder: TEncoder, offset: Offset): TEncoder {\n return offsetEncoder(\n resizeEncoder(encoder, size => size + offset),\n { preOffset: ({ preOffset }) => preOffset + offset },\n );\n}\n\n/**\n * Adds right padding to the given encoder, extending the encoded value by `offset`\n * bytes whilst increasing the size of the encoder accordingly.\n *\n * For more details, see {@link padRightCodec}.\n *\n * @typeParam TFrom - The type of the value to encode.\n *\n * @param encoder - The encoder to pad.\n * @param offset - The number of padding bytes to add after encoding.\n * @returns A new encoder with right padding applied.\n *\n * @example\n * ```ts\n * const encoder = padRightEncoder(getU16Encoder(), 2);\n * const bytes = encoder.encode(0xffff); // 0xffff0000 (two extra bytes added at the end)\n * ```\n *\n * @see {@link padRightCodec}\n * @see {@link padRightDecoder}\n */\nexport function padRightEncoder<TEncoder extends AnyEncoder>(encoder: TEncoder, offset: Offset): TEncoder {\n return offsetEncoder(\n resizeEncoder(encoder, size => size + offset),\n { postOffset: ({ postOffset }) => postOffset + offset },\n );\n}\n\n/**\n * Adds left padding to the given decoder, shifting the decoding position forward\n * by `offset` bytes whilst increasing the size of the decoder accordingly.\n *\n * For more details, see {@link padLeftCodec}.\n *\n * @typeParam TTo - The type of the decoded value.\n *\n * @param decoder - The decoder to pad.\n * @param offset - The number of padding bytes to skip before decoding.\n * @returns A new decoder with left padding applied.\n *\n * @example\n * ```ts\n * const decoder = padLeftDecoder(getU16Decoder(), 2);\n * const value = decoder.decode(new Uint8Array([0, 0, 0x12, 0x34])); // 0xffff (reads from offset 2)\n * ```\n *\n * @see {@link padLeftCodec}\n * @see {@link padLeftEncoder}\n */\nexport function padLeftDecoder<TDecoder extends AnyDecoder>(decoder: TDecoder, offset: Offset): TDecoder {\n return offsetDecoder(\n resizeDecoder(decoder, size => size + offset),\n { preOffset: ({ preOffset }) => preOffset + offset },\n );\n}\n\n/**\n * Adds right padding to the given decoder, extending the post-offset by `offset`\n * bytes whilst increasing the size of the decoder accordingly.\n *\n * For more details, see {@link padRightCodec}.\n *\n * @typeParam TTo - The type of the decoded value.\n *\n * @param decoder - The decoder to pad.\n * @param offset - The number of padding bytes to skip after decoding.\n * @returns A new decoder with right padding applied.\n *\n * @example\n * ```ts\n * const decoder = padRightDecoder(getU16Decoder(), 2);\n * const value = decoder.decode(new Uint8Array([0x12, 0x34, 0, 0])); // 0xffff (ignores trailing bytes)\n * ```\n *\n * @see {@link padRightCodec}\n * @see {@link padRightEncoder}\n */\nexport function padRightDecoder<TDecoder extends AnyDecoder>(decoder: TDecoder, offset: Offset): TDecoder {\n return offsetDecoder(\n resizeDecoder(decoder, size => size + offset),\n { postOffset: ({ postOffset }) => postOffset + offset },\n );\n}\n\n/**\n * Adds left padding to the given codec, shifting the encoding and decoding positions\n * forward by `offset` bytes whilst increasing the size of the codec accordingly.\n *\n * This ensures that values are read and written at a later position in the byte array,\n * while the padding bytes remain unused.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n *\n * @param codec - The codec to pad.\n * @param offset - The number of padding bytes to add before encoding and decoding.\n * @returns A new codec with left padding applied.\n *\n * @example\n * ```ts\n * const codec = padLeftCodec(getU16Codec(), 2);\n * const bytes = codec.encode(0xffff); // 0x0000ffff (0xffff written at offset 2)\n * const value = codec.decode(bytes); // 0xffff (reads from offset 2)\n * ```\n *\n * @remarks\n * If you only need to apply padding for encoding, use {@link padLeftEncoder}.\n * If you only need to apply padding for decoding, use {@link padLeftDecoder}.\n *\n * ```ts\n * const bytes = padLeftEncoder(getU16Encoder(), 2).encode(0xffff);\n * const value = padLeftDecoder(getU16Decoder(), 2).decode(bytes);\n * ```\n *\n * @see {@link padLeftEncoder}\n * @see {@link padLeftDecoder}\n */\nexport function padLeftCodec<TCodec extends AnyCodec>(codec: TCodec, offset: Offset): TCodec {\n return combineCodec(padLeftEncoder(codec, offset), padLeftDecoder(codec, offset)) as TCodec;\n}\n\n/**\n * Adds right padding to the given codec, extending the encoded and decoded value\n * by `offset` bytes whilst increasing the size of the codec accordingly.\n *\n * The extra bytes remain unused, ensuring that the next operation starts further\n * along the byte array.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n *\n * @param codec - The codec to pad.\n * @param offset - The number of padding bytes to add after encoding and decoding.\n * @returns A new codec with right padding applied.\n *\n * @example\n * ```ts\n * const codec = padRightCodec(getU16Codec(), 2);\n * const bytes = codec.encode(0xffff); // 0xffff0000 (two extra bytes added)\n * const value = codec.decode(bytes); // 0xffff (ignores padding bytes)\n * ```\n *\n * @remarks\n * If you only need to apply padding for encoding, use {@link padRightEncoder}.\n * If you only need to apply padding for decoding, use {@link padRightDecoder}.\n *\n * ```ts\n * const bytes = padRightEncoder(getU16Encoder(), 2).encode(0xffff);\n * const value = padRightDecoder(getU16Decoder(), 2).decode(bytes);\n * ```\n *\n * @see {@link padRightEncoder}\n * @see {@link padRightDecoder}\n */\nexport function padRightCodec<TCodec extends AnyCodec>(codec: TCodec, offset: Offset): TCodec {\n return combineCodec(padRightEncoder(codec, offset), padRightDecoder(codec, offset)) as TCodec;\n}\n","import {\n assertIsFixedSize,\n createDecoder,\n createEncoder,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n} from './codec';\nimport { combineCodec } from './combine-codec';\nimport { ReadonlyUint8Array } from './readonly-uint8array';\n\nfunction copySourceToTargetInReverse(\n source: ReadonlyUint8Array,\n target_WILL_MUTATE: Uint8Array,\n sourceOffset: number,\n sourceLength: number,\n targetOffset: number = 0,\n) {\n while (sourceOffset < --sourceLength) {\n const leftValue = source[sourceOffset];\n target_WILL_MUTATE[sourceOffset + targetOffset] = source[sourceLength];\n target_WILL_MUTATE[sourceLength + targetOffset] = leftValue;\n sourceOffset++;\n }\n if (sourceOffset === sourceLength) {\n target_WILL_MUTATE[sourceOffset + targetOffset] = source[sourceOffset];\n }\n}\n\n/**\n * Reverses the bytes of a fixed-size encoder.\n *\n * Given a `FixedSizeEncoder`, this function returns a new `FixedSizeEncoder` that\n * reverses the bytes within the fixed-size byte array when encoding.\n *\n * This can be useful to modify endianness or for other byte-order transformations.\n *\n * For more details, see {@link reverseCodec}.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TSize - The fixed size of the encoded value in bytes.\n *\n * @param encoder - The fixed-size encoder to reverse.\n * @returns A new encoder that writes bytes in reverse order.\n *\n * @example\n * Encoding a `u16` value in reverse order.\n * ```ts\n * const encoder = reverseEncoder(getU16Encoder({ endian: Endian.Big }));\n * const bytes = encoder.encode(0x1234); // 0x3412 (bytes are flipped)\n * ```\n *\n * @see {@link reverseCodec}\n * @see {@link reverseDecoder}\n */\nexport function reverseEncoder<TFrom, TSize extends number>(\n encoder: FixedSizeEncoder<TFrom, TSize>,\n): FixedSizeEncoder<TFrom, TSize> {\n assertIsFixedSize(encoder);\n return createEncoder({\n ...encoder,\n write: (value: TFrom, bytes, offset) => {\n const newOffset = encoder.write(value, bytes, offset);\n copySourceToTargetInReverse(\n bytes /* source */,\n bytes /* target_WILL_MUTATE */,\n offset /* sourceOffset */,\n offset + encoder.fixedSize /* sourceLength */,\n );\n return newOffset;\n },\n });\n}\n\n/**\n * Reverses the bytes of a fixed-size decoder.\n *\n * Given a `FixedSizeDecoder`, this function returns a new `FixedSizeDecoder` that\n * reverses the bytes within the fixed-size byte array before decoding.\n *\n * This can be useful to modify endianness or for other byte-order transformations.\n *\n * For more details, see {@link reverseCodec}.\n *\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the decoded value in bytes.\n *\n * @param decoder - The fixed-size decoder to reverse.\n * @returns A new decoder that reads bytes in reverse order.\n *\n * @example\n * Decoding a reversed `u16` value.\n * ```ts\n * const decoder = reverseDecoder(getU16Decoder({ endian: Endian.Big }));\n * const value = decoder.decode(new Uint8Array([0x34, 0x12])); // 0x1234 (bytes are flipped back)\n * ```\n *\n * @see {@link reverseCodec}\n * @see {@link reverseEncoder}\n */\nexport function reverseDecoder<TTo, TSize extends number>(\n decoder: FixedSizeDecoder<TTo, TSize>,\n): FixedSizeDecoder<TTo, TSize> {\n assertIsFixedSize(decoder);\n return createDecoder({\n ...decoder,\n read: (bytes, offset) => {\n const reversedBytes = bytes.slice();\n copySourceToTargetInReverse(\n bytes /* source */,\n reversedBytes /* target_WILL_MUTATE */,\n offset /* sourceOffset */,\n offset + decoder.fixedSize /* sourceLength */,\n );\n return decoder.read(reversedBytes, offset);\n },\n });\n}\n\n/**\n * Reverses the bytes of a fixed-size codec.\n *\n * Given a `FixedSizeCodec`, this function returns a new `FixedSizeCodec` that\n * reverses the bytes within the fixed-size byte array during encoding and decoding.\n *\n * This can be useful to modify endianness or for other byte-order transformations.\n *\n * @typeParam TFrom - The type of the value to encode.\n * @typeParam TTo - The type of the decoded value.\n * @typeParam TSize - The fixed size of the encoded/decoded value in bytes.\n *\n * @param codec - The fixed-size codec to reverse.\n * @returns A new codec that encodes and decodes bytes in reverse order.\n *\n * @example\n * Reversing a `u16` codec.\n * ```ts\n * const codec = reverseCodec(getU16Codec({ endian: Endian.Big }));\n * const bytes = codec.encode(0x1234); // 0x3412 (bytes are flipped)\n * const value = codec.decode(bytes); // 0x1234 (bytes are flipped back)\n * ```\n *\n * @remarks\n * If you only need to reverse an encoder, use {@link reverseEncoder}.\n * If you only need to reverse a decoder, use {@link reverseDecoder}.\n *\n * ```ts\n * const bytes = reverseEncoder(getU16Encoder()).encode(0x1234);\n * const value = reverseDecoder(getU16Decoder()).decode(bytes);\n * ```\n *\n * @see {@link reverseEncoder}\n * @see {@link reverseDecoder}\n */\nexport function reverseCodec<TFrom, TTo extends TFrom, TSize extends number>(\n codec: FixedSizeCodec<TFrom, TTo, TSize>,\n): FixedSizeCodec<TFrom, TTo, TSize> {\n return combineCodec(reverseEncoder(codec), reverseDecoder(codec));\n}\n","import {\n Codec,\n createCodec,\n createDecoder,\n createEncoder,\n Decoder,\n Encoder,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n isVariableSize,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from './codec';\nimport { ReadonlyUint8Array } from './readonly-uint8array';\n\n/**\n * Transforms an encoder by mapping its input values.\n *\n * This function takes an existing `Encoder<A>` and returns an `Encoder<B>`, allowing values of type `B`\n * to be converted into values of type `A` before encoding. The transformation is applied via the `unmap` function.\n *\n * This is useful for handling type conversions, applying default values, or structuring data before encoding.\n *\n * For more details, see {@link transformCodec}.\n *\n * @typeParam TOldFrom - The original type expected by the encoder.\n * @typeParam TNewFrom - The new type that will be transformed before encoding.\n *\n * @param encoder - The encoder to transform.\n * @param unmap - A function that converts values of `TNewFrom` into `TOldFrom` before encoding.\n * @returns A new encoder that accepts `TNewFrom` values and transforms them before encoding.\n *\n * @example\n * Encoding a string by counting its characters and storing the length as a `u32`.\n * ```ts\n * const encoder = transformEncoder(getU32Encoder(), (value: string) => value.length);\n * encoder.encode(\"hello\"); // 0x05000000 (stores length 5)\n * ```\n *\n * @see {@link transformCodec}\n * @see {@link transformDecoder}\n */\nexport function transformEncoder<TOldFrom, TNewFrom, TSize extends number>(\n encoder: FixedSizeEncoder<TOldFrom, TSize>,\n unmap: (value: TNewFrom) => TOldFrom,\n): FixedSizeEncoder<TNewFrom, TSize>;\nexport function transformEncoder<TOldFrom, TNewFrom>(\n encoder: VariableSizeEncoder<TOldFrom>,\n unmap: (value: TNewFrom) => TOldFrom,\n): VariableSizeEncoder<TNewFrom>;\nexport function transformEncoder<TOldFrom, TNewFrom>(\n encoder: Encoder<TOldFrom>,\n unmap: (value: TNewFrom) => TOldFrom,\n): Encoder<TNewFrom>;\nexport function transformEncoder<TOldFrom, TNewFrom>(\n encoder: Encoder<TOldFrom>,\n unmap: (value: TNewFrom) => TOldFrom,\n): Encoder<TNewFrom> {\n return createEncoder({\n ...(isVariableSize(encoder)\n ? { ...encoder, getSizeFromValue: (value: TNewFrom) => encoder.getSizeFromValue(unmap(value)) }\n : encoder),\n write: (value: TNewFrom, bytes, offset) => encoder.write(unmap(value), bytes, offset),\n });\n}\n\n/**\n * Transforms a decoder by mapping its output values.\n *\n * This function takes an existing `Decoder<A>` and returns a `Decoder<B>`, allowing values of type `A`\n * to be converted into values of type `B` after decoding. The transformation is applied via the `map` function.\n *\n * This is useful for post-processing, type conversions, or enriching decoded data.\n *\n * For more details, see {@link transformCodec}.\n *\n * @typeParam TOldTo - The original type returned by the decoder.\n * @typeParam TNewTo - The new type that will be transformed after decoding.\n *\n * @param decoder - The decoder to transform.\n * @param map - A function that converts values of `TOldTo` into `TNewTo` after decoding.\n * @returns A new decoder that decodes into `TNewTo`.\n *\n * @example\n * Decoding a stored `u32` length into a string of `'x'` characters.\n * ```ts\n * const decoder = transformDecoder(getU32Decoder(), (length) => 'x'.repeat(length));\n * decoder.decode(new Uint8Array([0x05, 0x00, 0x00, 0x00])); // \"xxxxx\"\n * ```\n *\n * @see {@link transformCodec}\n * @see {@link transformEncoder}\n */\nexport function transformDecoder<TOldTo, TNewTo, TSize extends number>(\n decoder: FixedSizeDecoder<TOldTo, TSize>,\n map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo,\n): FixedSizeDecoder<TNewTo, TSize>;\nexport function transformDecoder<TOldTo, TNewTo>(\n decoder: VariableSizeDecoder<TOldTo>,\n map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo,\n): VariableSizeDecoder<TNewTo>;\nexport function transformDecoder<TOldTo, TNewTo>(\n decoder: Decoder<TOldTo>,\n map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo,\n): Decoder<TNewTo>;\nexport function transformDecoder<TOldTo, TNewTo>(\n decoder: Decoder<TOldTo>,\n map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo,\n): Decoder<TNewTo> {\n return createDecoder({\n ...decoder,\n read: (bytes: ReadonlyUint8Array | Uint8Array, offset) => {\n const [value, newOffset] = decoder.read(bytes, offset);\n return [map(value, bytes, offset), newOffset];\n },\n });\n}\n\n/**\n * Transforms a codec by mapping its input and output values.\n *\n * This function takes an existing `Codec<A, B>` and returns a `Codec<C, D>`, allowing:\n * - Values of type `C` to be transformed into `A` before encoding.\n * - Values of type `B` to be transformed into `D` after decoding.\n *\n * This is useful for adapting codecs to work with different representations, handling default values, or\n * converting between primitive and structured types.\n *\n * @typeParam TOldFrom - The original type expected by the codec.\n * @typeParam TNewFrom - The new type that will be transformed before encoding.\n * @typeParam TOldTo - The original type returned by the codec.\n * @typeParam TNewTo - The new type that will be transformed after decoding.\n *\n * @param codec - The codec to transform.\n * @param unmap - A function that converts values of `TNewFrom` into `TOldFrom` before encoding.\n * @param map - A function that converts values of `TOldTo` into `TNewTo` after decoding (optional).\n * @returns A new codec that encodes `TNewFrom` and decodes into `TNewTo`.\n *\n * @example\n * Mapping a `u32` codec to encode string lengths and decode them into `'x'` characters.\n * ```ts\n * const codec = transformCodec(\n * getU32Codec(),\n * (value: string) => value.length, // Encode string length\n * (length) => 'x'.repeat(length) // Decode length into a string of 'x's\n * );\n *\n * const bytes = codec.encode(\"hello\"); // 0x05000000 (stores length 5)\n * const value = codec.decode(bytes); // \"xxxxx\"\n * ```\n *\n * @remarks\n * If only input transformation is needed, use {@link transformEncoder}.\n * If only output transformation is needed, use {@link transformDecoder}.\n *\n * ```ts\n * const bytes = transformEncoder(getU32Encoder(), (value: string) => value.length).encode(\"hello\");\n * const value = transformDecoder(getU32Decoder(), (length) => 'x'.repeat(length)).decode(bytes);\n * ```\n *\n * @see {@link transformEncoder}\n * @see {@link transformDecoder}\n */\nexport function transformCodec<TOldFrom, TNewFrom, TTo extends TNewFrom & TOldFrom, TSize extends number>(\n codec: FixedSizeCodec<TOldFrom, TTo, TSize>,\n unmap: (value: TNewFrom) => TOldFrom,\n): FixedSizeCodec<TNewFrom, TTo, TSize>;\nexport function transformCodec<TOldFrom, TNewFrom, TTo extends TNewFrom & TOldFrom>(\n codec: VariableSizeCodec<TOldFrom, TTo>,\n unmap: (value: TNewFrom) => TOldFrom,\n): VariableSizeCodec<TNewFrom, TTo>;\nexport function transformCodec<TOldFrom, TNewFrom, TTo extends TNewFrom & TOldFrom>(\n codec: Codec<TOldFrom, TTo>,\n unmap: (value: TNewFrom) => TOldFrom,\n): Codec<TNewFrom, TTo>;\nexport function transformCodec<\n TOldFrom,\n TNewFrom,\n TOldTo extends TOldFrom,\n TNewTo extends TNewFrom,\n TSize extends number,\n>(\n codec: FixedSizeCodec<TOldFrom, TOldTo, TSize>,\n unmap: (value: TNewFrom) => TOldFrom,\n map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo,\n): FixedSizeCodec<TNewFrom, TNewTo, TSize>;\nexport function transformCodec<TOldFrom, TNewFrom, TOldTo extends TOldFrom, TNewTo extends TNewFrom>(\n codec: VariableSizeCodec<TOldFrom, TOldTo>,\n unmap: (value: TNewFrom) => TOldFrom,\n map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo,\n): VariableSizeCodec<TNewFrom, TNewTo>;\nexport function transformCodec<TOldFrom, TNewFrom, TOldTo extends TOldFrom, TNewTo extends TNewFrom>(\n codec: Codec<TOldFrom, TOldTo>,\n unmap: (value: TNewFrom) => TOldFrom,\n map: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo,\n): Codec<TNewFrom, TNewTo>;\nexport function transformCodec<TOldFrom, TNewFrom, TOldTo extends TOldFrom, TNewTo extends TNewFrom>(\n codec: Codec<TOldFrom, TOldTo>,\n unmap: (value: TNewFrom) => TOldFrom,\n map?: (value: TOldTo, bytes: ReadonlyUint8Array | Uint8Array, offset: number) => TNewTo,\n): Codec<TNewFrom, TNewTo> {\n return createCodec({\n ...transformEncoder(codec, unmap),\n read: map ? transformDecoder(codec, map).read : (codec.read as unknown as Decoder<TNewTo>['read']),\n });\n}\n","import { SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, SolanaError } from '@solana/errors';\n\n/**\n * Asserts that a given string contains only characters from the specified alphabet.\n *\n * This function validates whether a string consists exclusively of characters\n * from the provided `alphabet`. If the validation fails, it throws an error\n * indicating the invalid base string.\n *\n * @param alphabet - The allowed set of characters for the base encoding.\n * @param testValue - The string to validate against the given alphabet.\n * @param givenValue - The original string provided by the user (defaults to `testValue`).\n *\n * @throws {SolanaError} If `testValue` contains characters not present in `alphabet`.\n *\n * @example\n * Validating a base-8 encoded string.\n * ```ts\n * assertValidBaseString('01234567', '123047'); // Passes\n * assertValidBaseString('01234567', '128'); // Throws error\n * ```\n */\nexport function assertValidBaseString(alphabet: string, testValue: string, givenValue = testValue) {\n if (!testValue.match(new RegExp(`^[${alphabet}]*$`))) {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {\n alphabet,\n base: alphabet.length,\n value: givenValue,\n });\n }\n}\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\n\nimport { assertValidBaseString } from './assertions';\n\n/**\n * Returns an encoder for base-X encoded strings.\n *\n * This encoder serializes strings using a custom alphabet, treating the length of the alphabet as the base.\n * The encoding process involves converting the input string to a numeric value in base-X, then\n * encoding that value into bytes while preserving leading zeroes.\n *\n * For more details, see {@link getBaseXCodec}.\n *\n * @param alphabet - The set of characters defining the base-X encoding.\n * @returns A `VariableSizeEncoder<string>` for encoding base-X strings.\n *\n * @example\n * Encoding a base-X string using a custom alphabet.\n * ```ts\n * const encoder = getBaseXEncoder('0123456789abcdef');\n * const bytes = encoder.encode('deadface'); // 0xdeadface\n * ```\n *\n * @see {@link getBaseXCodec}\n */\nexport const getBaseXEncoder = (alphabet: string): VariableSizeEncoder<string> => {\n return createEncoder({\n getSizeFromValue: (value: string): number => {\n const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet[0]);\n if (!tailChars) return value.length;\n\n const base10Number = getBigIntFromBaseX(tailChars, alphabet);\n return leadingZeroes.length + Math.ceil(base10Number.toString(16).length / 2);\n },\n write(value: string, bytes, offset) {\n // Check if the value is valid.\n assertValidBaseString(alphabet, value);\n if (value === '') return offset;\n\n // Handle leading zeroes.\n const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet[0]);\n if (!tailChars) {\n bytes.set(new Uint8Array(leadingZeroes.length).fill(0), offset);\n return offset + leadingZeroes.length;\n }\n\n // From baseX to base10.\n let base10Number = getBigIntFromBaseX(tailChars, alphabet);\n\n // From base10 to bytes.\n const tailBytes: number[] = [];\n while (base10Number > 0n) {\n tailBytes.unshift(Number(base10Number % 256n));\n base10Number /= 256n;\n }\n\n const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes];\n bytes.set(bytesToAdd, offset);\n return offset + bytesToAdd.length;\n },\n });\n};\n\n/**\n * Returns a decoder for base-X encoded strings.\n *\n * This decoder deserializes base-X encoded strings from a byte array using a custom alphabet.\n * The decoding process converts the byte array into a numeric value in base-10, then\n * maps that value back to characters in the specified base-X alphabet.\n *\n * For more details, see {@link getBaseXCodec}.\n *\n * @param alphabet - The set of characters defining the base-X encoding.\n * @returns A `VariableSizeDecoder<string>` for decoding base-X strings.\n *\n * @example\n * Decoding a base-X string using a custom alphabet.\n * ```ts\n * const decoder = getBaseXDecoder('0123456789abcdef');\n * const value = decoder.decode(new Uint8Array([0xde, 0xad, 0xfa, 0xce])); // \"deadface\"\n * ```\n *\n * @see {@link getBaseXCodec}\n */\nexport const getBaseXDecoder = (alphabet: string): VariableSizeDecoder<string> => {\n return createDecoder({\n read(rawBytes, offset): [string, number] {\n const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);\n if (bytes.length === 0) return ['', 0];\n\n // Handle leading zeroes.\n let trailIndex = bytes.findIndex(n => n !== 0);\n trailIndex = trailIndex === -1 ? bytes.length : trailIndex;\n const leadingZeroes = alphabet[0].repeat(trailIndex);\n if (trailIndex === bytes.length) return [leadingZeroes, rawBytes.length];\n\n // From bytes to base10.\n const base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);\n\n // From base10 to baseX.\n const tailChars = getBaseXFromBigInt(base10Number, alphabet);\n\n return [leadingZeroes + tailChars, rawBytes.length];\n },\n });\n};\n\n/**\n * Returns a codec for encoding and decoding base-X strings.\n *\n * This codec serializes strings using a custom alphabet, treating the length of the alphabet as the base.\n * The encoding process converts the input string into a numeric value in base-X, which is then encoded as bytes.\n * The decoding process reverses this transformation to reconstruct the original string.\n *\n * This codec supports leading zeroes by treating the first character of the alphabet as the zero character.\n *\n * @param alphabet - The set of characters defining the base-X encoding.\n * @returns A `VariableSizeCodec<string>` for encoding and decoding base-X strings.\n *\n * @example\n * Encoding and decoding a base-X string using a custom alphabet.\n * ```ts\n * const codec = getBaseXCodec('0123456789abcdef');\n * const bytes = codec.encode('deadface'); // 0xdeadface\n * const value = codec.decode(bytes); // \"deadface\"\n * ```\n *\n * @remarks\n * This codec does not enforce a size boundary. It will encode and decode all bytes necessary to represent the string.\n *\n * If you need a fixed-size base-X codec, consider using {@link fixCodecSize}.\n *\n * ```ts\n * const codec = fixCodecSize(getBaseXCodec('0123456789abcdef'), 8);\n * ```\n *\n * If you need a size-prefixed base-X codec, consider using {@link addCodecSizePrefix}.\n *\n * ```ts\n * const codec = addCodecSizePrefix(getBaseXCodec('0123456789abcdef'), getU32Codec());\n * ```\n *\n * Separate {@link getBaseXEncoder} and {@link getBaseXDecoder} functions are available.\n *\n * ```ts\n * const bytes = getBaseXEncoder('0123456789abcdef').encode('deadface');\n * const value = getBaseXDecoder('0123456789abcdef').decode(bytes);\n * ```\n *\n * @see {@link getBaseXEncoder}\n * @see {@link getBaseXDecoder}\n */\nexport const getBaseXCodec = (alphabet: string): VariableSizeCodec<string> =>\n combineCodec(getBaseXEncoder(alphabet), getBaseXDecoder(alphabet));\n\nfunction partitionLeadingZeroes(\n value: string,\n zeroCharacter: string,\n): [leadingZeros: string, tailChars: string | undefined] {\n const [leadingZeros, tailChars] = value.split(new RegExp(`((?!${zeroCharacter}).*)`));\n return [leadingZeros, tailChars];\n}\n\nfunction getBigIntFromBaseX(value: string, alphabet: string): bigint {\n const base = BigInt(alphabet.length);\n let sum = 0n;\n for (const char of value) {\n sum *= base;\n sum += BigInt(alphabet.indexOf(char));\n }\n return sum;\n}\n\nfunction getBaseXFromBigInt(value: bigint, alphabet: string): string {\n const base = BigInt(alphabet.length);\n const tailChars = [];\n while (value > 0n) {\n tailChars.unshift(alphabet[Number(value % base)]);\n value /= base;\n }\n return tailChars.join('');\n}\n","import { getBaseXCodec, getBaseXDecoder, getBaseXEncoder } from './baseX';\n\nconst alphabet = '0123456789';\n\n/**\n * Returns an encoder for base-10 strings.\n *\n * This encoder serializes strings using a base-10 encoding scheme.\n * The output consists of bytes representing the numerical values of the input string.\n *\n * For more details, see {@link getBase10Codec}.\n *\n * @returns A `VariableSizeEncoder<string>` for encoding base-10 strings.\n *\n * @example\n * Encoding a base-10 string.\n * ```ts\n * const encoder = getBase10Encoder();\n * const bytes = encoder.encode('1024'); // 0x0400\n * ```\n *\n * @see {@link getBase10Codec}\n */\nexport const getBase10Encoder = () => getBaseXEncoder(alphabet);\n\n/**\n * Returns a decoder for base-10 strings.\n *\n * This decoder deserializes base-10 encoded strings from a byte array.\n *\n * For more details, see {@link getBase10Codec}.\n *\n * @returns A `VariableSizeDecoder<string>` for decoding base-10 strings.\n *\n * @example\n * Decoding a base-10 string.\n * ```ts\n * const decoder = getBase10Decoder();\n * const value = decoder.decode(new Uint8Array([0x04, 0x00])); // \"1024\"\n * ```\n *\n * @see {@link getBase10Codec}\n */\nexport const getBase10Decoder = () => getBaseXDecoder(alphabet);\n\n/**\n * Returns a codec for encoding and decoding base-10 strings.\n *\n * This codec serializes strings using a base-10 encoding scheme.\n * The output consists of bytes representing the numerical values of the input string.\n *\n * @returns A `VariableSizeCodec<string>` for encoding and decoding base-10 strings.\n *\n * @example\n * Encoding and decoding a base-10 string.\n * ```ts\n * const codec = getBase10Codec();\n * const bytes = codec.encode('1024'); // 0x0400\n * const value = codec.decode(bytes); // \"1024\"\n * ```\n *\n * @remarks\n * This codec does not enforce a size boundary. It will encode and decode all bytes necessary to represent the string.\n *\n * If you need a fixed-size base-10 codec, consider using {@link fixCodecSize}.\n *\n * ```ts\n * const codec = fixCodecSize(getBase10Codec(), 5);\n * ```\n *\n * If you need a size-prefixed base-10 codec, consider using {@link addCodecSizePrefix}.\n *\n * ```ts\n * const codec = addCodecSizePrefix(getBase10Codec(), getU32Codec());\n * ```\n *\n * Separate {@link getBase10Encoder} and {@link getBase10Decoder} functions are available.\n *\n * ```ts\n * const bytes = getBase10Encoder().encode('1024');\n * const value = getBase10Decoder().decode(bytes);\n * ```\n *\n * @see {@link getBase10Encoder}\n * @see {@link getBase10Decoder}\n */\nexport const getBase10Codec = () => getBaseXCodec(alphabet);\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\nimport { SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, SolanaError } from '@solana/errors';\n\nconst enum HexC {\n ZERO = 48, // 0\n NINE = 57, // 9\n A_UP = 65, // A\n F_UP = 70, // F\n A_LO = 97, // a\n F_LO = 102, // f\n}\n\nconst INVALID_STRING_ERROR_BASE_CONFIG = {\n alphabet: '0123456789abcdef',\n base: 16,\n} as const;\n\nfunction charCodeToBase16(char: number) {\n if (char >= HexC.ZERO && char <= HexC.NINE) return char - HexC.ZERO;\n if (char >= HexC.A_UP && char <= HexC.F_UP) return char - (HexC.A_UP - 10);\n if (char >= HexC.A_LO && char <= HexC.F_LO) return char - (HexC.A_LO - 10);\n}\n\n/**\n * Returns an encoder for base-16 (hexadecimal) strings.\n *\n * This encoder serializes strings using a base-16 encoding scheme.\n * The output consists of bytes representing the hexadecimal values of the input string.\n *\n * For more details, see {@link getBase16Codec}.\n *\n * @returns A `VariableSizeEncoder<string>` for encoding base-16 strings.\n *\n * @example\n * Encoding a base-16 string.\n * ```ts\n * const encoder = getBase16Encoder();\n * const bytes = encoder.encode('deadface'); // 0xdeadface\n * ```\n *\n * @see {@link getBase16Codec}\n */\nexport const getBase16Encoder = (): VariableSizeEncoder<string> =>\n createEncoder({\n getSizeFromValue: (value: string) => Math.ceil(value.length / 2),\n write(value: string, bytes, offset) {\n const len = value.length;\n const al = len / 2;\n if (len === 1) {\n const c = value.charCodeAt(0);\n const n = charCodeToBase16(c);\n if (n === undefined) {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {\n ...INVALID_STRING_ERROR_BASE_CONFIG,\n value,\n });\n }\n bytes.set([n], offset);\n return 1 + offset;\n }\n const hexBytes = new Uint8Array(al);\n for (let i = 0, j = 0; i < al; i++) {\n const c1 = value.charCodeAt(j++);\n const c2 = value.charCodeAt(j++);\n\n const n1 = charCodeToBase16(c1);\n const n2 = charCodeToBase16(c2);\n if (n1 === undefined || (n2 === undefined && !Number.isNaN(c2))) {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {\n ...INVALID_STRING_ERROR_BASE_CONFIG,\n value,\n });\n }\n hexBytes[i] = !Number.isNaN(c2) ? (n1 << 4) | (n2 ?? 0) : n1;\n }\n\n bytes.set(hexBytes, offset);\n return hexBytes.length + offset;\n },\n });\n\n/**\n * Returns a decoder for base-16 (hexadecimal) strings.\n *\n * This decoder deserializes base-16 encoded strings from a byte array.\n *\n * For more details, see {@link getBase16Codec}.\n *\n * @returns A `VariableSizeDecoder<string>` for decoding base-16 strings.\n *\n * @example\n * Decoding a base-16 string.\n * ```ts\n * const decoder = getBase16Decoder();\n * const value = decoder.decode(new Uint8Array([0xde, 0xad, 0xfa, 0xce])); // \"deadface\"\n * ```\n *\n * @see {@link getBase16Codec}\n */\nexport const getBase16Decoder = (): VariableSizeDecoder<string> =>\n createDecoder({\n read(bytes, offset) {\n const value = bytes.slice(offset).reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');\n return [value, bytes.length];\n },\n });\n\n/**\n * Returns a codec for encoding and decoding base-16 (hexadecimal) strings.\n *\n * This codec serializes strings using a base-16 encoding scheme.\n * The output consists of bytes representing the hexadecimal values of the input string.\n *\n * @returns A `VariableSizeCodec<string>` for encoding and decoding base-16 strings.\n *\n * @example\n * Encoding and decoding a base-16 string.\n * ```ts\n * const codec = getBase16Codec();\n * const bytes = codec.encode('deadface'); // 0xdeadface\n * const value = codec.decode(bytes); // \"deadface\"\n * ```\n *\n * @remarks\n * This codec does not enforce a size boundary. It will encode and decode all bytes necessary to represent the string.\n *\n * If you need a fixed-size base-16 codec, consider using {@link fixCodecSize}.\n *\n * ```ts\n * const codec = fixCodecSize(getBase16Codec(), 8);\n * ```\n *\n * If you need a size-prefixed base-16 codec, consider using {@link addCodecSizePrefix}.\n *\n * ```ts\n * const codec = addCodecSizePrefix(getBase16Codec(), getU32Codec());\n * ```\n *\n * Separate {@link getBase16Encoder} and {@link getBase16Decoder} functions are available.\n *\n * ```ts\n * const bytes = getBase16Encoder().encode('deadface');\n * const value = getBase16Decoder().decode(bytes);\n * ```\n *\n * @see {@link getBase16Encoder}\n * @see {@link getBase16Decoder}\n */\nexport const getBase16Codec = (): VariableSizeCodec<string> => combineCodec(getBase16Encoder(), getBase16Decoder());\n","import { getBaseXCodec, getBaseXDecoder, getBaseXEncoder } from './baseX';\n\nconst alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';\n\n/**\n * Returns an encoder for base-58 strings.\n *\n * This encoder serializes strings using a base-58 encoding scheme,\n * commonly used in cryptocurrency addresses and other compact representations.\n *\n * For more details, see {@link getBase58Codec}.\n *\n * @returns A `VariableSizeEncoder<string>` for encoding base-58 strings.\n *\n * @example\n * Encoding a base-58 string.\n * ```ts\n * const encoder = getBase58Encoder();\n * const bytes = encoder.encode('heLLo'); // 0x1b6a3070\n * ```\n *\n * @see {@link getBase58Codec}\n */\nexport const getBase58Encoder = () => getBaseXEncoder(alphabet);\n\n/**\n * Returns a decoder for base-58 strings.\n *\n * This decoder deserializes base-58 encoded strings from a byte array.\n *\n * For more details, see {@link getBase58Codec}.\n *\n * @returns A `VariableSizeDecoder<string>` for decoding base-58 strings.\n *\n * @example\n * Decoding a base-58 string.\n * ```ts\n * const decoder = getBase58Decoder();\n * const value = decoder.decode(new Uint8Array([0x1b, 0x6a, 0x30, 0x70])); // \"heLLo\"\n * ```\n *\n * @see {@link getBase58Codec}\n */\nexport const getBase58Decoder = () => getBaseXDecoder(alphabet);\n\n/**\n * Returns a codec for encoding and decoding base-58 strings.\n *\n * This codec serializes strings using a base-58 encoding scheme,\n * commonly used in cryptocurrency addresses and other compact representations.\n *\n * @returns A `VariableSizeCodec<string>` for encoding and decoding base-58 strings.\n *\n * @example\n * Encoding and decoding a base-58 string.\n * ```ts\n * const codec = getBase58Codec();\n * const bytes = codec.encode('heLLo'); // 0x1b6a3070\n * const value = codec.decode(bytes); // \"heLLo\"\n * ```\n *\n * @remarks\n * This codec does not enforce a size boundary. It will encode and decode all bytes necessary to represent the string.\n *\n * If you need a fixed-size base-58 codec, consider using {@link fixCodecSize}.\n *\n * ```ts\n * const codec = fixCodecSize(getBase58Codec(), 8);\n * ```\n *\n * If you need a size-prefixed base-58 codec, consider using {@link addCodecSizePrefix}.\n *\n * ```ts\n * const codec = addCodecSizePrefix(getBase58Codec(), getU32Codec());\n * ```\n *\n * Separate {@link getBase58Encoder} and {@link getBase58Decoder} functions are available.\n *\n * ```ts\n * const bytes = getBase58Encoder().encode('heLLo');\n * const value = getBase58Decoder().decode(bytes);\n * ```\n *\n * @see {@link getBase58Encoder}\n * @see {@link getBase58Decoder}\n */\nexport const getBase58Codec = () => getBaseXCodec(alphabet);\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\n\nimport { assertValidBaseString } from './assertions';\n\n/**\n * Returns an encoder for base-X encoded strings using bit re-slicing.\n *\n * This encoder serializes strings by dividing the input into custom-sized bit chunks,\n * mapping them to an alphabet, and encoding the result into a byte array.\n * This approach is commonly used for encoding schemes where the alphabet's length is a power of 2,\n * such as base-16 or base-64.\n *\n * For more details, see {@link getBaseXResliceCodec}.\n *\n * @param alphabet - The set of characters defining the base-X encoding.\n * @param bits - The number of bits per encoded chunk, typically `log2(alphabet.length)`.\n * @returns A `VariableSizeEncoder<string>` for encoding base-X strings using bit re-slicing.\n *\n * @example\n * Encoding a base-X string using bit re-slicing.\n * ```ts\n * const encoder = getBaseXResliceEncoder('elho', 2);\n * const bytes = encoder.encode('hellolol'); // 0x4aee\n * ```\n *\n * @see {@link getBaseXResliceCodec}\n */\nexport const getBaseXResliceEncoder = (alphabet: string, bits: number): VariableSizeEncoder<string> =>\n createEncoder({\n getSizeFromValue: (value: string) => Math.floor((value.length * bits) / 8),\n write(value: string, bytes, offset) {\n assertValidBaseString(alphabet, value);\n if (value === '') return offset;\n const charIndices = [...value].map(c => alphabet.indexOf(c));\n const reslicedBytes = reslice(charIndices, bits, 8, false);\n bytes.set(reslicedBytes, offset);\n return reslicedBytes.length + offset;\n },\n });\n\n/**\n * Returns a decoder for base-X encoded strings using bit re-slicing.\n *\n * This decoder deserializes base-X encoded strings by re-slicing the bits of a byte array into\n * custom-sized chunks and mapping them to a specified alphabet.\n * This is typically used for encoding schemes where the alphabet's length is a power of 2,\n * such as base-16 or base-64.\n *\n * For more details, see {@link getBaseXResliceCodec}.\n *\n * @param alphabet - The set of characters defining the base-X encoding.\n * @param bits - The number of bits per encoded chunk, typically `log2(alphabet.length)`.\n * @returns A `VariableSizeDecoder<string>` for decoding base-X strings using bit re-slicing.\n *\n * @example\n * Decoding a base-X string using bit re-slicing.\n * ```ts\n * const decoder = getBaseXResliceDecoder('elho', 2);\n * const value = decoder.decode(new Uint8Array([0x4a, 0xee])); // \"hellolol\"\n * ```\n *\n * @see {@link getBaseXResliceCodec}\n */\nexport const getBaseXResliceDecoder = (alphabet: string, bits: number): VariableSizeDecoder<string> =>\n createDecoder({\n read(rawBytes, offset = 0): [string, number] {\n const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);\n if (bytes.length === 0) return ['', rawBytes.length];\n const charIndices = reslice([...bytes], 8, bits, true);\n return [charIndices.map(i => alphabet[i]).join(''), rawBytes.length];\n },\n });\n\n/**\n * Returns a codec for encoding and decoding base-X strings using bit re-slicing.\n *\n * This codec serializes strings by dividing the input into custom-sized bit chunks,\n * mapping them to a given alphabet, and encoding the result into bytes.\n * It is particularly suited for encoding schemes where the alphabet's length is a power of 2,\n * such as base-16 or base-64.\n *\n * @param alphabet - The set of characters defining the base-X encoding.\n * @param bits - The number of bits per encoded chunk, typically `log2(alphabet.length)`.\n * @returns A `VariableSizeCodec<string>` for encoding and decoding base-X strings using bit re-slicing.\n *\n * @example\n * Encoding and decoding a base-X string using bit re-slicing.\n * ```ts\n * const codec = getBaseXResliceCodec('elho', 2);\n * const bytes = codec.encode('hellolol'); // 0x4aee\n * const value = codec.decode(bytes); // \"hellolol\"\n * ```\n *\n * @remarks\n * This codec does not enforce a size boundary. It will encode and decode all bytes necessary to represent the string.\n *\n * If you need a fixed-size base-X codec, consider using {@link fixCodecSize}.\n *\n * ```ts\n * const codec = fixCodecSize(getBaseXResliceCodec('elho', 2), 8);\n * ```\n *\n * If you need a size-prefixed base-X codec, consider using {@link addCodecSizePrefix}.\n *\n * ```ts\n * const codec = addCodecSizePrefix(getBaseXResliceCodec('elho', 2), getU32Codec());\n * ```\n *\n * Separate {@link getBaseXResliceEncoder} and {@link getBaseXResliceDecoder} functions are available.\n *\n * ```ts\n * const bytes = getBaseXResliceEncoder('elho', 2).encode('hellolol');\n * const value = getBaseXResliceDecoder('elho', 2).decode(bytes);\n * ```\n *\n * @see {@link getBaseXResliceEncoder}\n * @see {@link getBaseXResliceDecoder}\n */\nexport const getBaseXResliceCodec = (alphabet: string, bits: number): VariableSizeCodec<string> =>\n combineCodec(getBaseXResliceEncoder(alphabet, bits), getBaseXResliceDecoder(alphabet, bits));\n\n/** Helper function to reslice the bits inside bytes. */\nfunction reslice(input: number[], inputBits: number, outputBits: number, useRemainder: boolean): number[] {\n const output = [];\n let accumulator = 0;\n let bitsInAccumulator = 0;\n const mask = (1 << outputBits) - 1;\n for (const value of input) {\n accumulator = (accumulator << inputBits) | value;\n bitsInAccumulator += inputBits;\n while (bitsInAccumulator >= outputBits) {\n bitsInAccumulator -= outputBits;\n output.push((accumulator >> bitsInAccumulator) & mask);\n }\n }\n if (useRemainder && bitsInAccumulator > 0) {\n output.push((accumulator << (outputBits - bitsInAccumulator)) & mask);\n }\n return output;\n}\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n toArrayBuffer,\n transformDecoder,\n transformEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\nimport { SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, SolanaError } from '@solana/errors';\n\nimport { assertValidBaseString } from './assertions';\nimport { getBaseXResliceDecoder, getBaseXResliceEncoder } from './baseX-reslice';\n\nconst alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n/**\n * Returns an encoder for base-64 strings.\n *\n * This encoder serializes strings using a base-64 encoding scheme,\n * commonly used for data encoding in URLs, cryptographic keys, and binary-to-text encoding.\n *\n * For more details, see {@link getBase64Codec}.\n *\n * @returns A `VariableSizeEncoder<string>` for encoding base-64 strings.\n *\n * @example\n * Encoding a base-64 string.\n * ```ts\n * const encoder = getBase64Encoder();\n * const bytes = encoder.encode('hello+world'); // 0x85e965a3ec28ae57\n * ```\n *\n * @see {@link getBase64Codec}\n */\nexport const getBase64Encoder = (): VariableSizeEncoder<string> => {\n if (__BROWSER__) {\n return createEncoder({\n getSizeFromValue: (value: string) => {\n try {\n return (atob as Window['atob'])(value).length;\n } catch {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {\n alphabet,\n base: 64,\n value,\n });\n }\n },\n write(value: string, bytes, offset) {\n try {\n const bytesToAdd = (atob as Window['atob'])(value)\n .split('')\n .map(c => c.charCodeAt(0));\n bytes.set(bytesToAdd, offset);\n return bytesToAdd.length + offset;\n } catch {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, {\n alphabet,\n base: 64,\n value,\n });\n }\n },\n });\n }\n\n if (__NODEJS__) {\n return createEncoder({\n getSizeFromValue: (value: string) => Buffer.from(value, 'base64').length,\n write(value: string, bytes, offset) {\n assertValidBaseString(alphabet, value.replace(/=/g, ''));\n const buffer = Buffer.from(value, 'base64');\n bytes.set(buffer, offset);\n return buffer.length + offset;\n },\n });\n }\n\n return transformEncoder(getBaseXResliceEncoder(alphabet, 6), (value: string): string => value.replace(/=/g, ''));\n};\n\n/**\n * Returns a decoder for base-64 strings.\n *\n * This decoder deserializes base-64 encoded strings from a byte array.\n *\n * For more details, see {@link getBase64Codec}.\n *\n * @returns A `VariableSizeDecoder<string>` for decoding base-64 strings.\n *\n * @example\n * Decoding a base-64 string.\n * ```ts\n * const decoder = getBase64Decoder();\n * const value = decoder.decode(new Uint8Array([0x85, 0xe9, 0x65, 0xa3, 0xec, 0x28, 0xae, 0x57])); // \"hello+world\"\n * ```\n *\n * @see {@link getBase64Codec}\n */\nexport const getBase64Decoder = (): VariableSizeDecoder<string> => {\n if (__BROWSER__) {\n return createDecoder({\n read(bytes, offset = 0) {\n const slice = bytes.slice(offset);\n const value = (btoa as Window['btoa'])(String.fromCharCode(...slice));\n return [value, bytes.length];\n },\n });\n }\n\n if (__NODEJS__) {\n return createDecoder({\n read: (bytes, offset = 0) => [Buffer.from(toArrayBuffer(bytes), offset).toString('base64'), bytes.length],\n });\n }\n\n return transformDecoder(getBaseXResliceDecoder(alphabet, 6), (value: string): string =>\n value.padEnd(Math.ceil(value.length / 4) * 4, '='),\n );\n};\n\n/**\n * Returns a codec for encoding and decoding base-64 strings.\n *\n * This codec serializes strings using a base-64 encoding scheme,\n * commonly used for data encoding in URLs, cryptographic keys, and binary-to-text encoding.\n *\n * @returns A `VariableSizeCodec<string>` for encoding and decoding base-64 strings.\n *\n * @example\n * Encoding and decoding a base-64 string.\n * ```ts\n * const codec = getBase64Codec();\n * const bytes = codec.encode('hello+world'); // 0x85e965a3ec28ae57\n * const value = codec.decode(bytes); // \"hello+world\"\n * ```\n *\n * @remarks\n * This codec does not enforce a size boundary. It will encode and decode all bytes necessary to represent the string.\n *\n * If you need a fixed-size base-64 codec, consider using {@link fixCodecSize}.\n *\n * ```ts\n * const codec = fixCodecSize(getBase64Codec(), 8);\n * ```\n *\n * If you need a size-prefixed base-64 codec, consider using {@link addCodecSizePrefix}.\n *\n * ```ts\n * const codec = addCodecSizePrefix(getBase64Codec(), getU32Codec());\n * ```\n *\n * Separate {@link getBase64Encoder} and {@link getBase64Decoder} functions are available.\n *\n * ```ts\n * const bytes = getBase64Encoder().encode('hello+world');\n * const value = getBase64Decoder().decode(bytes);\n * ```\n *\n * @see {@link getBase64Encoder}\n * @see {@link getBase64Decoder}\n */\nexport const getBase64Codec = (): VariableSizeCodec<string> => combineCodec(getBase64Encoder(), getBase64Decoder());\n","/**\n * Removes all null characters (`\\u0000`) from a string.\n *\n * This function cleans a string by stripping out any null characters,\n * which are often used as padding in fixed-size string encodings.\n *\n * @param value - The string to process.\n * @returns The input string with all null characters removed.\n *\n * @example\n * Removing null characters from a string.\n * ```ts\n * removeNullCharacters('hello\\u0000\\u0000'); // \"hello\"\n * ```\n */\nexport const removeNullCharacters = (value: string) =>\n // eslint-disable-next-line no-control-regex\n value.replace(/\\u0000/g, '');\n\n/**\n * Pads a string with null characters (`\\u0000`) at the end to reach a fixed length.\n *\n * If the input string is shorter than the specified length, it is padded with null characters\n * until it reaches the desired size. If it is already long enough, it remains unchanged.\n *\n * @param value - The string to pad.\n * @param chars - The total length of the resulting string, including padding.\n * @returns The input string padded with null characters up to the specified length.\n *\n * @example\n * Padding a string with null characters.\n * ```ts\n * padNullCharacters('hello', 8); // \"hello\\u0000\\u0000\\u0000\"\n * ```\n */\nexport const padNullCharacters = (value: string, chars: number) => value.padEnd(chars, '\\u0000');\n","export const TextDecoder = globalThis.TextDecoder;\nexport const TextEncoder = globalThis.TextEncoder;\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\nimport { TextDecoder, TextEncoder } from '@solana/text-encoding-impl';\n\nimport { removeNullCharacters } from './null-characters';\n\n/**\n * Returns an encoder for UTF-8 strings.\n *\n * This encoder serializes strings using UTF-8 encoding.\n * The encoded output contains as many bytes as needed to represent the string.\n *\n * For more details, see {@link getUtf8Codec}.\n *\n * @returns A `VariableSizeEncoder<string>` for encoding UTF-8 strings.\n *\n * @example\n * Encoding a UTF-8 string.\n * ```ts\n * const encoder = getUtf8Encoder();\n * const bytes = encoder.encode('hello'); // 0x68656c6c6f\n * ```\n *\n * @see {@link getUtf8Codec}\n */\nexport const getUtf8Encoder = (): VariableSizeEncoder<string> => {\n let textEncoder: TextEncoder;\n return createEncoder({\n getSizeFromValue: value => (textEncoder ||= new TextEncoder()).encode(value).length,\n write: (value: string, bytes, offset) => {\n const bytesToAdd = (textEncoder ||= new TextEncoder()).encode(value);\n bytes.set(bytesToAdd, offset);\n return offset + bytesToAdd.length;\n },\n });\n};\n\n/**\n * Returns a decoder for UTF-8 strings.\n *\n * This decoder deserializes UTF-8 encoded strings from a byte array.\n * It reads all available bytes starting from the given offset.\n *\n * For more details, see {@link getUtf8Codec}.\n *\n * @returns A `VariableSizeDecoder<string>` for decoding UTF-8 strings.\n *\n * @example\n * Decoding a UTF-8 string.\n * ```ts\n * const decoder = getUtf8Decoder();\n * const value = decoder.decode(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0x6f])); // \"hello\"\n * ```\n *\n * @see {@link getUtf8Codec}\n */\nexport const getUtf8Decoder = (): VariableSizeDecoder<string> => {\n let textDecoder: TextDecoder;\n return createDecoder({\n read(bytes, offset) {\n const value = (textDecoder ||= new TextDecoder()).decode(bytes.slice(offset));\n return [removeNullCharacters(value), bytes.length];\n },\n });\n};\n\n/**\n * Returns a codec for encoding and decoding UTF-8 strings.\n *\n * This codec serializes strings using UTF-8 encoding.\n * The encoded output contains as many bytes as needed to represent the string.\n *\n * @returns A `VariableSizeCodec<string>` for encoding and decoding UTF-8 strings.\n *\n * @example\n * Encoding and decoding a UTF-8 string.\n * ```ts\n * const codec = getUtf8Codec();\n * const bytes = codec.encode('hello'); // 0x68656c6c6f\n * const value = codec.decode(bytes); // \"hello\"\n * ```\n *\n * @remarks\n * This codec does not enforce a size boundary. It will encode and decode all bytes necessary to represent the string.\n *\n * If you need a fixed-size UTF-8 codec, consider using {@link fixCodecSize}.\n *\n * ```ts\n * const codec = fixCodecSize(getUtf8Codec(), 5);\n * ```\n *\n * If you need a size-prefixed UTF-8 codec, consider using {@link addCodecSizePrefix}.\n *\n * ```ts\n * const codec = addCodecSizePrefix(getUtf8Codec(), getU32Codec());\n * ```\n *\n * Separate {@link getUtf8Encoder} and {@link getUtf8Decoder} functions are available.\n *\n * ```ts\n * const bytes = getUtf8Encoder().encode('hello');\n * const value = getUtf8Decoder().decode(bytes);\n * ```\n *\n * @see {@link getUtf8Encoder}\n * @see {@link getUtf8Decoder}\n */\nexport const getUtf8Codec = (): VariableSizeCodec<string> => combineCodec(getUtf8Encoder(), getUtf8Decoder());\n","import {\n combineCodec,\n Decoder,\n Encoder,\n fixDecoderSize,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n fixEncoderSize,\n transformEncoder,\n} from '@solana/codecs-core';\nimport { getBase58Decoder, getBase58Encoder } from '@solana/codecs-strings';\nimport {\n SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH,\n SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE,\n SolanaError,\n} from '@solana/errors';\nimport { Brand, EncodedString } from '@solana/nominal-types';\n\n/**\n * Represents a string that validates as a Solana address. Functions that require well-formed\n * addresses should specify their inputs in terms of this type.\n *\n * Whenever you need to validate an arbitrary string as a base58-encoded address, use the\n * {@link address}, {@link assertIsAddress}, or {@link isAddress} functions in this package.\n */\nexport type Address<TAddress extends string = string> = Brand<EncodedString<TAddress, 'base58'>, 'Address'>;\n\nlet memoizedBase58Encoder: Encoder<string> | undefined;\nlet memoizedBase58Decoder: Decoder<string> | undefined;\n\nfunction getMemoizedBase58Encoder(): Encoder<string> {\n if (!memoizedBase58Encoder) memoizedBase58Encoder = getBase58Encoder();\n return memoizedBase58Encoder;\n}\n\nfunction getMemoizedBase58Decoder(): Decoder<string> {\n if (!memoizedBase58Decoder) memoizedBase58Decoder = getBase58Decoder();\n return memoizedBase58Decoder;\n}\n\n/**\n * A type guard that returns `true` if the input string conforms to the {@link Address} type, and\n * refines its type for use in your program.\n *\n * @example\n * ```ts\n * import { isAddress } from '@solana/addresses';\n *\n * if (isAddress(ownerAddress)) {\n * // At this point, `ownerAddress` has been refined to a\n * // `Address` that can be used with the RPC.\n * const { value: lamports } = await rpc.getBalance(ownerAddress).send();\n * setBalanceLamports(lamports);\n * } else {\n * setError(`${ownerAddress} is not an address`);\n * }\n * ```\n */\nexport function isAddress(putativeAddress: string): putativeAddress is Address<typeof putativeAddress> {\n // Fast-path; see if the input string is of an acceptable length.\n if (\n // Lowest address (32 bytes of zeroes)\n putativeAddress.length < 32 ||\n // Highest address (32 bytes of 255)\n putativeAddress.length > 44\n ) {\n return false;\n }\n // Slow-path; actually attempt to decode the input string.\n const base58Encoder = getMemoizedBase58Encoder();\n try {\n return base58Encoder.encode(putativeAddress).byteLength === 32;\n } catch {\n return false;\n }\n}\n\n/**\n * From time to time you might acquire a string, that you expect to validate as an address or public\n * key, from an untrusted network API or user input. Use this function to assert that such an\n * arbitrary string is a base58-encoded address.\n *\n * @example\n * ```ts\n * import { assertIsAddress } from '@solana/addresses';\n *\n * // Imagine a function that fetches an account's balance when a user submits a form.\n * function handleSubmit() {\n * // We know only that what the user typed conforms to the `string` type.\n * const address: string = accountAddressInput.value;\n * try {\n * // If this type assertion function doesn't throw, then\n * // Typescript will upcast `address` to `Address`.\n * assertIsAddress(address);\n * // At this point, `address` is an `Address` that can be used with the RPC.\n * const balanceInLamports = await rpc.getBalance(address).send();\n * } catch (e) {\n * // `address` turned out not to be a base58-encoded address\n * }\n * }\n * ```\n */\nexport function assertIsAddress(putativeAddress: string): asserts putativeAddress is Address<typeof putativeAddress> {\n // Fast-path; see if the input string is of an acceptable length.\n if (\n // Lowest address (32 bytes of zeroes)\n putativeAddress.length < 32 ||\n // Highest address (32 bytes of 255)\n putativeAddress.length > 44\n ) {\n throw new SolanaError(SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE, {\n actualLength: putativeAddress.length,\n });\n }\n // Slow-path; actually attempt to decode the input string.\n const base58Encoder = getMemoizedBase58Encoder();\n const bytes = base58Encoder.encode(putativeAddress);\n const numBytes = bytes.byteLength;\n if (numBytes !== 32) {\n throw new SolanaError(SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH, {\n actualLength: numBytes,\n });\n }\n}\n\n/**\n * Combines _asserting_ that a string is an address with _coercing_ it to the {@link Address} type.\n * It's most useful with untrusted input.\n *\n * @example\n * ```ts\n * import { address } from '@solana/addresses';\n *\n * await transfer(address(fromAddress), address(toAddress), lamports(100000n));\n * ```\n *\n * > [!TIP]\n * > When starting from a known-good address as a string, it's more efficient to typecast it rather\n * than to use the {@link address} helper, because the helper unconditionally performs validation on\n * its input.\n * >\n * > ```ts\n * > import { Address } from '@solana/addresses';\n * >\n * > const MEMO_PROGRAM_ADDRESS =\n * > 'MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr' as Address<'MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr'>;\n * > ```\n */\nexport function address<TAddress extends string = string>(putativeAddress: TAddress): Address<TAddress> {\n assertIsAddress(putativeAddress);\n return putativeAddress as Address<TAddress>;\n}\n\n/**\n * Returns an encoder that you can use to encode a base58-encoded address to a byte array.\n *\n * @example\n * ```ts\n * import { getAddressEncoder } from '@solana/addresses';\n *\n * const address = 'B9Lf9z5BfNPT4d5KMeaBFx8x1G4CULZYR1jA2kmxRDka' as Address;\n * const addressEncoder = getAddressEncoder();\n * const addressBytes = addressEncoder.encode(address);\n * // Uint8Array(32) [\n * // 150, 183, 190, 48, 171, 8, 39, 156,\n * // 122, 213, 172, 108, 193, 95, 26, 158,\n * // 149, 243, 115, 254, 20, 200, 36, 30,\n * // 248, 179, 178, 232, 220, 89, 53, 127\n * // ]\n * ```\n */\nexport function getAddressEncoder(): FixedSizeEncoder<Address, 32> {\n return transformEncoder(fixEncoderSize(getMemoizedBase58Encoder(), 32), putativeAddress =>\n address(putativeAddress),\n );\n}\n\n/**\n * Returns a decoder that you can use to convert an array of 32 bytes representing an address to the\n * base58-encoded representation of that address.\n *\n * @example\n * ```ts\n * import { getAddressDecoder } from '@solana/addresses';\n *\n * const addressBytes = new Uint8Array([\n * 150, 183, 190, 48, 171, 8, 39, 156,\n * 122, 213, 172, 108, 193, 95, 26, 158,\n * 149, 243, 115, 254, 20, 200, 36, 30,\n * 248, 179, 178, 232, 220, 89, 53, 127\n * ]);\n * const addressDecoder = getAddressDecoder();\n * const address = addressDecoder.decode(addressBytes); // B9Lf9z5BfNPT4d5KMeaBFx8x1G4CULZYR1jA2kmxRDka\n * ```\n */\nexport function getAddressDecoder(): FixedSizeDecoder<Address, 32> {\n return fixDecoderSize(getMemoizedBase58Decoder(), 32) as FixedSizeDecoder<Address, 32>;\n}\n\n/**\n * Returns a codec that you can use to encode from or decode to a base-58 encoded address.\n *\n * @see {@link getAddressDecoder}\n * @see {@link getAddressEncoder}\n */\nexport function getAddressCodec(): FixedSizeCodec<Address, Address, 32> {\n return combineCodec(getAddressEncoder(), getAddressDecoder());\n}\n\nexport function getAddressComparator(): (x: string, y: string) => number {\n return new Intl.Collator('en', {\n caseFirst: 'lower',\n ignorePunctuation: false,\n localeMatcher: 'best fit',\n numeric: false,\n sensitivity: 'variant',\n usage: 'sort',\n }).compare;\n}\n","/**!\n * noble-ed25519\n *\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Paul Miller (https://paulmillr.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the “Software”), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nconst D = 37095705934669439343138083508754565189542113879843219016388785533085940283555n;\nconst P = 57896044618658097711785492504343953926634992332820282019728792003956564819949n; // 2n ** 255n - 19n; ed25519 is twisted edwards curve\nconst RM1 = 19681161376707505956807079304988542015446066515923890162744021073123829784752n; // √-1\n\n// mod division\nfunction mod(a: bigint): bigint {\n const r = a % P;\n return r >= 0n ? r : P + r;\n}\nfunction pow2(x: bigint, power: bigint): bigint {\n // pow2(x, 4) == x^(2^4)\n let r = x;\n while (power-- > 0n) {\n r *= r;\n r %= P;\n }\n return r;\n}\nfunction pow_2_252_3(x: bigint): bigint {\n // x^(2^252-3) unrolled util for square root\n const x2 = (x * x) % P; // x^2, bits 1\n const b2 = (x2 * x) % P; // x^3, bits 11\n const b4 = (pow2(b2, 2n) * b2) % P; // x^(2^4-1), bits 1111\n const b5 = (pow2(b4, 1n) * x) % P; // x^(2^5-1), bits 11111\n const b10 = (pow2(b5, 5n) * b5) % P; // x^(2^10)\n const b20 = (pow2(b10, 10n) * b10) % P; // x^(2^20)\n const b40 = (pow2(b20, 20n) * b20) % P; // x^(2^40)\n const b80 = (pow2(b40, 40n) * b40) % P; // x^(2^80)\n const b160 = (pow2(b80, 80n) * b80) % P; // x^(2^160)\n const b240 = (pow2(b160, 80n) * b80) % P; // x^(2^240)\n const b250 = (pow2(b240, 10n) * b10) % P; // x^(2^250)\n const pow_p_5_8 = (pow2(b250, 2n) * x) % P; // < To pow to (p+3)/8, multiply it by x.\n return pow_p_5_8;\n}\nfunction uvRatio(u: bigint, v: bigint): bigint | null {\n // for sqrt comp\n const v3 = mod(v * v * v); // v³\n const v7 = mod(v3 * v3 * v); // v⁷\n const pow = pow_2_252_3(u * v7); // (uv⁷)^(p-5)/8\n let x = mod(u * v3 * pow); // (uv³)(uv⁷)^(p-5)/8\n const vx2 = mod(v * x * x); // vx²\n const root1 = x; // First root candidate\n const root2 = mod(x * RM1); // Second root candidate; RM1 is √-1\n const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root\n const useRoot2 = vx2 === mod(-u); // If vx² = -u, set x <-- x * 2^((p-1)/4)\n const noRoot = vx2 === mod(-u * RM1); // There is no valid root, vx² = -u√-1\n if (useRoot1) x = root1;\n if (useRoot2 || noRoot) x = root2; // We return root2 anyway, for const-time\n if ((mod(x) & 1n) === 1n) x = mod(-x); // edIsNegative\n if (!useRoot1 && !useRoot2) {\n return null;\n }\n return x;\n}\n// https://datatracker.ietf.org/doc/html/rfc8032#section-5.1.3\nexport function pointIsOnCurve(y: bigint, lastByte: number): boolean {\n const y2 = mod(y * y); // y²\n const u = mod(y2 - 1n); // u=y²-1\n const v = mod(D * y2 + 1n);\n const x = uvRatio(u, v); // (uv³)(uv⁷)^(p-5)/8; square root\n if (x === null) {\n return false;\n }\n const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit\n if (x === 0n && isLastByteOdd) {\n return false;\n }\n return true;\n}\n","import { ReadonlyUint8Array } from '@solana/codecs-core';\n\nimport { pointIsOnCurve } from './vendor/noble/ed25519';\n\nfunction byteToHex(byte: number): string {\n const hexString = byte.toString(16);\n if (hexString.length === 1) {\n return `0${hexString}`;\n } else {\n return hexString;\n }\n}\n\nfunction decompressPointBytes(bytes: ReadonlyUint8Array): bigint {\n const hexString = bytes.reduce((acc, byte, ii) => `${byteToHex(ii === 31 ? byte & ~0x80 : byte)}${acc}`, '');\n const integerLiteralString = `0x${hexString}`;\n return BigInt(integerLiteralString);\n}\n\nexport function compressedPointBytesAreOnCurve(bytes: ReadonlyUint8Array): boolean {\n if (bytes.byteLength !== 32) {\n return false;\n }\n const y = decompressPointBytes(bytes);\n return pointIsOnCurve(y, bytes[31]);\n}\n","import { SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS, SolanaError } from '@solana/errors';\nimport type { AffinePoint } from '@solana/nominal-types';\n\nimport { type Address, getAddressCodec } from './address';\nimport { compressedPointBytesAreOnCurve } from './curve-internal';\n\n/**\n * Represents an {@link Address} that validates as being off-curve. Functions that require off-curve\n * addresses should specify their inputs in terms of this type.\n *\n * Whenever you need to validate an address as being off-curve, use the {@link offCurveAddress},\n * {@link assertIsOffCurveAddress}, or {@link isOffCurveAddress} functions in this package.\n */\nexport type OffCurveAddress<TAddress extends string = string> = AffinePoint<Address<TAddress>, 'invalid'>;\n\n/**\n * A type guard that returns `true` if the input address conforms to the {@link OffCurveAddress}\n * type, and refines its type for use in your application.\n *\n * @example\n * ```ts\n * import { isOffCurveAddress } from '@solana/addresses';\n *\n * if (isOffCurveAddress(accountAddress)) {\n * // At this point, `accountAddress` has been refined to a\n * // `OffCurveAddress` that can be used within your business logic.\n * const { value: account } = await rpc.getAccountInfo(accountAddress).send();\n * } else {\n * setError(`${accountAddress} is not off-curve`);\n * }\n * ```\n */\nexport function isOffCurveAddress<TAddress extends Address>(\n putativeOffCurveAddress: TAddress,\n): putativeOffCurveAddress is OffCurveAddress<TAddress> {\n const addressBytes = getAddressCodec().encode(putativeOffCurveAddress);\n return compressedPointBytesAreOnCurve(addressBytes) === false;\n}\n\n/**\n * From time to time you might acquire an {@link Address}, that you expect to validate as an\n * off-curve address, from an untrusted source. Use this function to assert that such an address is\n * off-curve.\n *\n * @example\n * ```ts\n * import { assertIsOffCurveAddress } from '@solana/addresses';\n *\n * // Imagine a function that fetches an account's balance when a user submits a form.\n * function handleSubmit() {\n * // We know only that the input conforms to the `string` type.\n * const address: string = accountAddressInput.value;\n * try {\n * // If this type assertion function doesn't throw, then\n * // Typescript will upcast `address` to `Address`.\n * assertIsAddress(address);\n * // If this type assertion function doesn't throw, then\n * // Typescript will upcast `address` to `OffCurveAddress`.\n * assertIsOffCurveAddress(address);\n * // At this point, `address` is an `OffCurveAddress` that can be used with the RPC.\n * const balanceInLamports = await rpc.getBalance(address).send();\n * } catch (e) {\n * // `address` turned out to NOT be a base58-encoded off-curve address\n * }\n * }\n * ```\n */\nexport function assertIsOffCurveAddress<TAddress extends Address>(\n putativeOffCurveAddress: TAddress,\n): asserts putativeOffCurveAddress is OffCurveAddress<TAddress> {\n if (!isOffCurveAddress(putativeOffCurveAddress)) {\n throw new SolanaError(SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS);\n }\n}\n\n/**\n * Combines _asserting_ that an {@link Address} is off-curve with _coercing_ it to the\n * {@link OffCurveAddress} type. It's most useful with untrusted input.\n */\nexport function offCurveAddress<TAddress extends Address>(\n putativeOffCurveAddress: TAddress,\n): OffCurveAddress<TAddress> {\n assertIsOffCurveAddress(putativeOffCurveAddress);\n return putativeOffCurveAddress;\n}\n","import { assertDigestCapabilityIsAvailable } from '@solana/assertions';\nimport { bytesEqual, type ReadonlyUint8Array } from '@solana/codecs-core';\nimport {\n isSolanaError,\n SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED,\n SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE,\n SOLANA_ERROR__ADDRESSES__MALFORMED_PDA,\n SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED,\n SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED,\n SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE,\n SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER,\n SolanaError,\n} from '@solana/errors';\nimport { Brand } from '@solana/nominal-types';\n\nimport { Address, assertIsAddress, getAddressCodec, isAddress } from './address';\nimport { compressedPointBytesAreOnCurve } from './curve-internal';\n\n/**\n * A tuple representing a program derived address (derived from the address of some program and a\n * set of seeds) and the associated bump seed used to ensure that the address, as derived, does not\n * fall on the Ed25519 curve.\n *\n * Whenever you need to validate an arbitrary tuple as one that represents a program derived\n * address, use the {@link assertIsProgramDerivedAddress} or {@link isProgramDerivedAddress}\n * functions in this package.\n */\nexport type ProgramDerivedAddress<TAddress extends string = string> = Readonly<\n [Address<TAddress>, ProgramDerivedAddressBump]\n>;\n\n/**\n * Represents an integer in the range [0,255] used in the derivation of a program derived address to\n * ensure that it does not fall on the Ed25519 curve.\n */\nexport type ProgramDerivedAddressBump = Brand<number, 'ProgramDerivedAddressBump'>;\n\n/**\n * A type guard that returns `true` if the input tuple conforms to the {@link ProgramDerivedAddress}\n * type, and refines its type for use in your program.\n *\n * @see The {@link isAddress} function for an example of how to use a type guard.\n */\nexport function isProgramDerivedAddress<TAddress extends string = string>(\n value: unknown,\n): value is ProgramDerivedAddress<TAddress> {\n return (\n Array.isArray(value) &&\n value.length === 2 &&\n typeof value[0] === 'string' &&\n typeof value[1] === 'number' &&\n value[1] >= 0 &&\n value[1] <= 255 &&\n isAddress(value[0])\n );\n}\n\n/**\n * In the event that you receive an address/bump-seed tuple from some untrusted source, use this\n * function to assert that it conforms to the {@link ProgramDerivedAddress} interface.\n *\n * @see The {@link assertIsAddress} function for an example of how to use an assertion function.\n */\nexport function assertIsProgramDerivedAddress<TAddress extends string = string>(\n value: unknown,\n): asserts value is ProgramDerivedAddress<TAddress> {\n const validFormat =\n Array.isArray(value) && value.length === 2 && typeof value[0] === 'string' && typeof value[1] === 'number';\n if (!validFormat) {\n throw new SolanaError(SOLANA_ERROR__ADDRESSES__MALFORMED_PDA);\n }\n if (value[1] < 0 || value[1] > 255) {\n throw new SolanaError(SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE, {\n bump: value[1],\n });\n }\n assertIsAddress(value[0]);\n}\n\ntype ProgramDerivedAddressInput = Readonly<{\n programAddress: Address;\n seeds: Seed[];\n}>;\n\ntype SeedInput = Readonly<{\n baseAddress: Address;\n programAddress: Address;\n seed: Seed;\n}>;\n\ntype Seed = ReadonlyUint8Array | string;\n\nconst MAX_SEED_LENGTH = 32;\nconst MAX_SEEDS = 16;\nconst PDA_MARKER_BYTES = [\n // The string 'ProgramDerivedAddress'\n 80, 114, 111, 103, 114, 97, 109, 68, 101, 114, 105, 118, 101, 100, 65, 100, 100, 114, 101, 115, 115,\n] as const;\n\nasync function createProgramDerivedAddress({ programAddress, seeds }: ProgramDerivedAddressInput): Promise<Address> {\n assertDigestCapabilityIsAvailable();\n if (seeds.length > MAX_SEEDS) {\n throw new SolanaError(SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED, {\n actual: seeds.length,\n maxSeeds: MAX_SEEDS,\n });\n }\n let textEncoder: TextEncoder;\n const seedBytes = seeds.reduce((acc, seed, ii) => {\n const bytes = typeof seed === 'string' ? (textEncoder ||= new TextEncoder()).encode(seed) : seed;\n if (bytes.byteLength > MAX_SEED_LENGTH) {\n throw new SolanaError(SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED, {\n actual: bytes.byteLength,\n index: ii,\n maxSeedLength: MAX_SEED_LENGTH,\n });\n }\n acc.push(...bytes);\n return acc;\n }, [] as number[]);\n const base58EncodedAddressCodec = getAddressCodec();\n const programAddressBytes = base58EncodedAddressCodec.encode(programAddress);\n const addressBytesBuffer = await crypto.subtle.digest(\n 'SHA-256',\n new Uint8Array([...seedBytes, ...programAddressBytes, ...PDA_MARKER_BYTES]),\n );\n const addressBytes = new Uint8Array(addressBytesBuffer);\n if (compressedPointBytesAreOnCurve(addressBytes)) {\n throw new SolanaError(SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE);\n }\n return base58EncodedAddressCodec.decode(addressBytes);\n}\n\n/**\n * Given a program's {@link Address} and up to 16 {@link Seed | Seeds}, this method will return the\n * program derived address (PDA) associated with each.\n *\n * @example\n * ```ts\n * import { getAddressEncoder, getProgramDerivedAddress } from '@solana/addresses';\n *\n * const addressEncoder = getAddressEncoder();\n * const [pda, bumpSeed] = await getProgramDerivedAddress({\n * programAddress: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL' as Address,\n * seeds: [\n * // Owner\n * addressEncoder.encode('9fYLFVoVqwH37C3dyPi6cpeobfbQ2jtLpN5HgAYDDdkm' as Address),\n * // Token program\n * addressEncoder.encode('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA' as Address),\n * // Mint\n * addressEncoder.encode('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' as Address),\n * ],\n * });\n * ```\n */\nexport async function getProgramDerivedAddress({\n programAddress,\n seeds,\n}: ProgramDerivedAddressInput): Promise<ProgramDerivedAddress> {\n let bumpSeed = 255;\n while (bumpSeed > 0) {\n try {\n const address = await createProgramDerivedAddress({\n programAddress,\n seeds: [...seeds, new Uint8Array([bumpSeed])],\n });\n return [address, bumpSeed as ProgramDerivedAddressBump];\n } catch (e) {\n if (isSolanaError(e, SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE)) {\n bumpSeed--;\n } else {\n throw e;\n }\n }\n }\n throw new SolanaError(SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED);\n}\n\n/**\n * Returns a base58-encoded address derived from some base address, some program address, and a seed\n * string or byte array.\n *\n * @example\n * ```ts\n * import { createAddressWithSeed } from '@solana/addresses';\n *\n * const derivedAddress = await createAddressWithSeed({\n * // The private key associated with this address will be able to sign for `derivedAddress`.\n * baseAddress: 'B9Lf9z5BfNPT4d5KMeaBFx8x1G4CULZYR1jA2kmxRDka' as Address,\n * // Only this program will be able to write data to this account.\n * programAddress: '445erYq578p2aERrGW9mn9KiYe3fuG6uHdcJ2LPPShGw' as Address,\n * seed: 'data-account',\n * });\n * ```\n */\nexport async function createAddressWithSeed({ baseAddress, programAddress, seed }: SeedInput): Promise<Address> {\n const { encode, decode } = getAddressCodec();\n\n const seedBytes = typeof seed === 'string' ? new TextEncoder().encode(seed) : seed;\n if (seedBytes.byteLength > MAX_SEED_LENGTH) {\n throw new SolanaError(SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED, {\n actual: seedBytes.byteLength,\n index: 0,\n maxSeedLength: MAX_SEED_LENGTH,\n });\n }\n\n const programAddressBytes = encode(programAddress);\n if (\n programAddressBytes.length >= PDA_MARKER_BYTES.length &&\n bytesEqual(programAddressBytes.slice(-PDA_MARKER_BYTES.length), new Uint8Array(PDA_MARKER_BYTES))\n ) {\n throw new SolanaError(SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER);\n }\n\n const addressBytesBuffer = await crypto.subtle.digest(\n 'SHA-256',\n new Uint8Array([...encode(baseAddress), ...seedBytes, ...programAddressBytes]),\n );\n const addressBytes = new Uint8Array(addressBytesBuffer);\n\n return decode(addressBytes);\n}\n","import { assertKeyExporterIsAvailable } from '@solana/assertions';\nimport { SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY, SolanaError } from '@solana/errors';\n\nimport { Address, getAddressDecoder, getAddressEncoder } from './address';\n\n/**\n * Given a public {@link CryptoKey}, this method will return its associated {@link Address}.\n *\n * @example\n * ```ts\n * import { getAddressFromPublicKey } from '@solana/addresses';\n *\n * const address = await getAddressFromPublicKey(publicKey);\n * ```\n */\nexport async function getAddressFromPublicKey(publicKey: CryptoKey): Promise<Address> {\n assertKeyExporterIsAvailable();\n if (publicKey.type !== 'public' || publicKey.algorithm.name !== 'Ed25519') {\n throw new SolanaError(SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY);\n }\n const publicKeyBytes = await crypto.subtle.exportKey('raw', publicKey);\n return getAddressDecoder().decode(new Uint8Array(publicKeyBytes));\n}\n\n/**\n * Given an {@link Address}, return a {@link CryptoKey} that can be used to verify signatures.\n *\n * @example\n * ```ts\n * import { getAddressFromPublicKey } from '@solana/addresses';\n *\n * const publicKey = await getPublicKeyFromAddress(address);\n * ```\n */\nexport async function getPublicKeyFromAddress(address: Address) {\n const addressBytes = getAddressEncoder().encode(address);\n return await crypto.subtle.importKey('raw', addressBytes, { name: 'Ed25519' }, true /* extractable */, ['verify']);\n}\n","import type { ChainDef, ChainType } from \"../types\";\n\nexport const NATIVE_EVM = \"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\";\nexport const NATIVE_SOLANA = \"So11111111111111111111111111111111111111111\";\n\nconst CHAIN_TYPE_ALIASES: Record<string, ChainType> = {\n btc: \"bitcoin\",\n bitcoin: \"bitcoin\",\n sei: \"cosmos\",\n \"pacific-1\": \"cosmos\",\n};\n\nfunction inferChainTypeFromValue(normalized: string): ChainType | undefined {\n if (!normalized) return undefined;\n\n const aliased = CHAIN_TYPE_ALIASES[normalized];\n if (aliased) return aliased;\n\n if (\n normalized === \"evm\" ||\n normalized === \"solana\" ||\n normalized === \"cosmos\" ||\n normalized === \"bitcoin\"\n ) {\n return normalized;\n }\n\n if (/^eip155:\\d+$/.test(normalized) || /^\\d+$/.test(normalized)) {\n return \"evm\";\n }\n\n if (normalized.startsWith(\"solana:\") || normalized.includes(\"solana\")) {\n return \"solana\";\n }\n\n if (\n normalized.startsWith(\"cosmos:\") ||\n normalized.startsWith(\"sei:\") ||\n normalized === \"sei-evm\"\n ) {\n return \"cosmos\";\n }\n\n return undefined;\n}\n\nexport function normalizeChainKey(\n value: string | number | null | undefined\n): string {\n if (value === undefined || value === null) return \"\";\n return String(value).trim().toLowerCase();\n}\n\nexport function normalizeChainType(\n chain?: ChainDef | ChainType | string | null\n): ChainType | undefined {\n if (!chain) return undefined;\n const raw =\n typeof chain === \"string\"\n ? chain\n : (chain.type ??\n chain.chainType ??\n chain.networkIdentifier ??\n chain.chainId ??\n chain.id ??\n chain.networkName ??\n chain.axelarChainName);\n if (!raw) return undefined;\n const normalized = String(raw).trim().toLowerCase();\n return inferChainTypeFromValue(normalized) ?? normalized;\n}\n\nexport function getNativeTokenAddress(chainType?: ChainType | null) {\n return normalizeChainType(chainType) === \"solana\"\n ? NATIVE_SOLANA\n : NATIVE_EVM;\n}\n\nexport function isSolanaNativeTokenAlias(address?: string | null) {\n if (!address) return false;\n const trimmed = address.trim();\n if (!trimmed) return false;\n return trimmed === NATIVE_SOLANA || trimmed.toLowerCase() === NATIVE_EVM;\n}\n\nexport function normalizeAddress(\n address: string,\n chainType?: ChainType | null\n) {\n const trimmed = address.trim();\n if (normalizeChainType(chainType) === \"solana\") {\n if (isSolanaNativeTokenAlias(trimmed)) {\n return NATIVE_SOLANA;\n }\n return trimmed;\n }\n return trimmed.toLowerCase();\n}\n\nexport function isZeroAddressLike(\n address?: string | null,\n chainType?: ChainType | null\n) {\n if (!address) return true;\n const normalized = normalizeAddress(address, chainType);\n return (\n normalized ===\n normalizeAddress(getNativeTokenAddress(chainType), chainType) ||\n normalized === \"0x0000000000000000000000000000000000000000\"\n );\n}\n","import { isAddress as isEvmAddress } from \"viem\";\nimport { isAddress as isSolanaAddress } from \"@solana/addresses\";\n\nimport type { ChainDef, ChainType } from \"../types\";\nimport { normalizeChainType } from \"../utils/chains\";\n\ntype AddressValidationResult = { isValid: boolean; error?: string };\n\nconst BECH32_CHARSET = /^[023456789acdefghjklmnpqrstuvwxyz]+$/i;\n\nfunction hasMixedCase(value: string) {\n return value !== value.toLowerCase() && value !== value.toUpperCase();\n}\n\nfunction validateBech32LikeAddress(\n address: string,\n prefix: string\n): AddressValidationResult {\n const trimmed = address.trim();\n if (!trimmed) {\n return { isValid: false, error: \"Address is required.\" };\n }\n if (hasMixedCase(trimmed)) {\n return { isValid: false, error: \"Bech32 addresses cannot mix case.\" };\n }\n\n const lower = trimmed.toLowerCase();\n const expectedPrefix = `${prefix.toLowerCase()}1`;\n if (!lower.startsWith(expectedPrefix)) {\n return {\n isValid: false,\n error: `Address must start with ${expectedPrefix}.`,\n };\n }\n\n const dataPart = lower.slice(expectedPrefix.length);\n if (dataPart.length < 6 || !BECH32_CHARSET.test(dataPart)) {\n return {\n isValid: false,\n error: \"Bech32 address format is invalid.\",\n };\n }\n\n return { isValid: true };\n}\n\nexport function validateEvmAddress(address: string): AddressValidationResult {\n if (!isEvmAddress(address.trim())) {\n return {\n isValid: false,\n error: \"EVM addresses must be 0x-prefixed 20-byte hex strings.\",\n };\n }\n return { isValid: true };\n}\n\nexport function validateSeiAddress(address: string): AddressValidationResult {\n const trimmed = address.trim();\n if (isEvmAddress(trimmed)) {\n return { isValid: true };\n }\n const result = validateBech32LikeAddress(trimmed, \"sei\");\n if (result.isValid) return result;\n return {\n isValid: false,\n error: \"SEI addresses must be 0x-prefixed EVM or sei1 bech32 strings.\",\n };\n}\n\nexport function validateSolanaAddress(\n address: string\n): AddressValidationResult {\n const trimmed = address.trim();\n if (trimmed.startsWith(\"0x\") || isEvmAddress(trimmed)) {\n return {\n isValid: false,\n error: \"Solana addresses must be base58-encoded strings.\",\n };\n }\n if (\n trimmed.toLowerCase().startsWith(\"bc1\") ||\n trimmed.toLowerCase().startsWith(\"sei1\")\n ) {\n return {\n isValid: false,\n error: \"Solana addresses cannot be bech32 strings.\",\n };\n }\n if (!isSolanaAddress(trimmed)) {\n return {\n isValid: false,\n error: \"Solana addresses must be base58-encoded strings.\",\n };\n }\n return { isValid: true };\n}\n\nexport function validateBtcAddress(address: string): AddressValidationResult {\n const trimmed = address.trim();\n if (hasMixedCase(trimmed)) {\n return { isValid: false, error: \"Bitcoin addresses cannot mix case.\" };\n }\n const result = validateBech32LikeAddress(trimmed, \"bc\");\n if (result.isValid) return result;\n return {\n isValid: false,\n error: \"Bitcoin addresses must use native SegWit (bc1...) format.\",\n };\n}\n\nexport function validateAddressForChain(\n address: string,\n chain?: ChainDef | ChainType | string | null\n): AddressValidationResult {\n const trimmed = address.trim();\n if (!trimmed) return { isValid: true };\n const chainType = normalizeChainType(chain);\n const chainDef = typeof chain === \"object\" && chain ? chain : undefined;\n\n switch (chainType) {\n case \"evm\":\n return validateEvmAddress(trimmed);\n case \"solana\":\n return validateSolanaAddress(trimmed);\n case \"bitcoin\":\n return validateBtcAddress(trimmed);\n case \"cosmos\":\n if (chainDef?.networkIdentifier?.toLowerCase() === \"sei\") {\n return validateSeiAddress(trimmed);\n }\n return validateBech32LikeAddress(trimmed, \"sei\");\n default:\n return { isValid: false, error: \"Unsupported or unknown chain type.\" };\n }\n}\n\nfunction validateAddressForRouteChain(address: string, chainType: ChainType) {\n switch (normalizeChainType(chainType)) {\n case \"evm\":\n return validateEvmAddress(address);\n case \"solana\":\n return validateSolanaAddress(address);\n case \"bitcoin\":\n return validateBtcAddress(address);\n case \"cosmos\":\n return validateSeiAddress(address);\n default:\n return { isValid: false, error: \"Unsupported chain type.\" };\n }\n}\n\nexport function validateRouteAddresses(params: {\n fromChain?: ChainDef | ChainType | string | null;\n toChain?: ChainDef | ChainType | string | null;\n fromAddress: string;\n toAddress: string;\n refundAddress?: string;\n direction?: string;\n}): AddressValidationResult {\n const fromType = normalizeChainType(params.fromChain);\n const toType = normalizeChainType(params.toChain);\n\n if (!fromType || !toType) {\n return {\n isValid: false,\n error: \"Missing chain types for route validation.\",\n };\n }\n\n const fromAddress = params.fromAddress.trim();\n const toAddress = params.toAddress.trim();\n if (!fromAddress || !toAddress) {\n return { isValid: false, error: \"Route addresses are required.\" };\n }\n\n const normalizedDirection = params.direction?.trim().toLowerCase();\n const isDepositFlow =\n normalizedDirection === \"deposit\" ||\n ((toType === \"evm\" || toType === \"cosmos\") &&\n (fromType === \"bitcoin\" || fromType === \"solana\"));\n\n if (isDepositFlow) {\n const fromResult = validateAddressForRouteChain(fromAddress, fromType);\n if (!fromResult.isValid) {\n return {\n isValid: false,\n error: `From address: ${fromResult.error ?? \"Invalid address.\"}`,\n };\n }\n const toResult =\n toType === \"cosmos\"\n ? validateSeiAddress(toAddress)\n : validateEvmAddress(toAddress);\n if (!toResult.isValid) {\n return {\n isValid: false,\n error: `To address: ${toResult.error ?? \"Invalid address.\"}`,\n };\n }\n if (fromType === \"bitcoin\") {\n const refundAddress = params.refundAddress?.trim();\n if (!refundAddress) {\n return {\n isValid: false,\n error: \"Refund address is required for BTC deposit routes.\",\n };\n }\n const refundResult = validateBtcAddress(refundAddress);\n if (!refundResult.isValid) {\n return {\n isValid: false,\n error: `Refund address: ${refundResult.error ?? \"Invalid address.\"}`,\n };\n }\n }\n return { isValid: true };\n }\n\n const fromResult = validateAddressForRouteChain(fromAddress, fromType);\n if (!fromResult.isValid) {\n return {\n isValid: false,\n error: `From address: ${fromResult.error ?? \"Invalid address.\"}`,\n };\n }\n\n const toResult = validateAddressForRouteChain(toAddress, toType);\n if (!toResult.isValid) {\n return {\n isValid: false,\n error: `To address: ${toResult.error ?? \"Invalid address.\"}`,\n };\n }\n\n return { isValid: true };\n}\n","import type {\n WalletAddressResolution,\n WalletAddressSource,\n WalletIdentity,\n WalletIdentityAddress,\n WalletIdentityChainLike,\n} from \"../types\";\nimport { validateAddressForChain } from \"../validation/address\";\nimport { normalizeChainKey, normalizeChainType } from \"../utils/chains\";\n\nfunction normalizeIdentityChainId(\n chain?: WalletIdentityChainLike\n): string | undefined {\n if (!chain || typeof chain === \"string\") return undefined;\n const raw = chain.chainId ?? chain.id;\n if (raw === undefined || raw === null) return undefined;\n const normalized = String(raw).trim();\n return normalized || undefined;\n}\n\nfunction identityEntryMatchesChain(\n entry: WalletIdentityAddress,\n chainType?: string,\n chainKey?: string,\n chainId?: string\n) {\n if (chainKey && entry.chainKey && entry.chainKey === chainKey) return true;\n if (chainId && entry.chainId && entry.chainId === chainId) return true;\n if (chainType && entry.chainType === chainType) return true;\n return false;\n}\n\nexport function createWalletIdentity(\n addresses: WalletIdentityAddress[] = []\n): WalletIdentity {\n return { addresses };\n}\n\nexport function upsertWalletIdentityAddress(\n identity: WalletIdentity,\n next: WalletIdentityAddress\n): WalletIdentity {\n const normalizedAddress = next.address.trim();\n const normalizedChainKey = next.chainKey\n ? normalizeChainKey(next.chainKey)\n : undefined;\n const normalizedChainId = next.chainId?.trim() || undefined;\n\n const addresses = identity.addresses.filter((entry) => {\n if (entry.chainType !== next.chainType) return true;\n if (normalizedChainKey && entry.chainKey === normalizedChainKey)\n return false;\n if (normalizedChainId && entry.chainId === normalizedChainId) return false;\n if (!normalizedChainKey && !normalizedChainId) return false;\n return true;\n });\n\n if (!normalizedAddress) return createWalletIdentity(addresses);\n\n return createWalletIdentity([\n ...addresses,\n {\n ...next,\n address: normalizedAddress,\n chainKey: normalizedChainKey,\n chainId: normalizedChainId,\n },\n ]);\n}\n\nexport function resolveWalletAddressForChain(\n identity: WalletIdentity,\n chain?: WalletIdentityChainLike\n): WalletAddressResolution {\n const chainType = normalizeChainType(chain);\n const chainDef = typeof chain === \"object\" && chain ? chain : undefined;\n const chainKey = chainDef\n ? normalizeChainKey(\n chainDef.networkIdentifier ?? chainDef.chainId ?? chainDef.id\n )\n : typeof chain === \"string\"\n ? normalizeChainKey(chain)\n : undefined;\n const chainId = normalizeIdentityChainId(chain);\n\n if (!chainType) {\n return {\n status: \"missing\",\n reason: \"unknown_chain_type\",\n chainKey,\n chainId,\n };\n }\n\n const match = identity.addresses.find((entry) =>\n identityEntryMatchesChain(entry, chainType, chainKey, chainId)\n );\n\n if (!match) {\n return {\n status: \"missing\",\n reason: \"missing_chain_address\",\n chainType,\n chainKey,\n chainId,\n };\n }\n\n const validation = validateAddressForChain(\n match.address,\n chainDef ?? chainType\n );\n if (!validation.isValid) {\n return {\n status: \"invalid\",\n reason: validation.error ?? \"invalid_chain_address\",\n address: match.address,\n source: match.source,\n chainType,\n chainKey,\n chainId,\n };\n }\n\n return {\n status: \"resolved\",\n address: match.address.trim(),\n source: match.source,\n chainType,\n chainKey,\n chainId,\n };\n}\n\nexport function buildWalletIdentityAddress(params: {\n address: string;\n chain: WalletIdentityChainLike;\n source: WalletAddressSource;\n providerId?: string;\n}): WalletIdentityAddress | null {\n const chainType = normalizeChainType(params.chain);\n if (!chainType) return null;\n\n const address = params.address.trim();\n const chainId = normalizeIdentityChainId(params.chain);\n const chainDef =\n typeof params.chain === \"object\" && params.chain ? params.chain : undefined;\n const chainKey = chainDef\n ? normalizeChainKey(\n chainDef.networkIdentifier ?? chainDef.chainId ?? chainDef.id\n )\n : undefined;\n\n return {\n address,\n chainType,\n chainId,\n chainKey,\n providerId: params.providerId,\n source: params.source,\n };\n}\n\nexport class IdentityStore {\n private _identity = createWalletIdentity();\n\n get snapshot() {\n return this._identity;\n }\n\n reset() {\n this._identity = createWalletIdentity();\n }\n\n upsert(next: WalletIdentityAddress) {\n this._identity = upsertWalletIdentityAddress(this._identity, next);\n return this._identity;\n }\n\n resolve(chain?: WalletIdentityChainLike) {\n return resolveWalletAddressForChain(this._identity, chain);\n }\n}\n","import { apiBase, jsonHeaders, assertOK, rateLimitedFetch } from \"./http\";\nimport type {\n BuildRouteResult,\n RouteParams,\n RoutePlan,\n RouteSponsorship,\n Transaction,\n} from \"../types\";\nimport { TrustwareConfigStore } from \"src/config/store\";\nimport { validateRouteAddresses } from \"../validation/address\";\n\nexport type BuildRouteBody = {\n fromChain: string;\n toChain: string;\n fromToken: string;\n toToken: string;\n fromAmount: string;\n fromAddress: string;\n toAddress: string;\n fromAmountUsd?: string;\n fromAmountUSD?: string;\n refundAddress?: string;\n direction?: string;\n slippage?: number;\n slippageBps?: number;\n linkId?: string;\n memo?: string;\n};\n\nexport type TxRequest = {\n to?: string;\n target?: string;\n data: string;\n value?: string;\n gasLimit?: string;\n maxFeePerGas?: string;\n maxPriorityFeePerGas?: string;\n chainId?: number | string;\n gasPrice?: string;\n};\n\nexport type BuildRouteResponse = {\n intentId?: string;\n route?: RoutePlan;\n sponsorship?: RouteSponsorship;\n data?: {\n intentId?: string;\n route?: RoutePlan;\n sponsorship?: RouteSponsorship;\n };\n error?: string;\n message?: string;\n};\n\ntype DepositAddress = {\n address?: string;\n memo?: string;\n expiresAt?: string;\n};\n\ntype BuildDepositAddressResponse = {\n depositAddress?: DepositAddress;\n intentId?: string;\n route?: RoutePlan;\n data?: {\n depositAddress?: DepositAddress;\n intentId?: string;\n route?: RoutePlan;\n };\n error?: string;\n message?: string;\n};\n\nexport function isEvmTxRequest(txReq?: TxRequest | null) {\n return Boolean(txReq?.data && (txReq.to || txReq.target));\n}\n\nexport function isSerializedSolanaTxRequest(txReq?: TxRequest | null) {\n return Boolean(txReq?.data && !txReq?.to && !txReq?.target);\n}\n\nexport async function buildRoute1(p: RouteParams): Promise<BuildRouteResult> {\n const r = await rateLimitedFetch(`${apiBase()}/squid/route`, {\n method: \"POST\",\n headers: jsonHeaders(),\n credentials: \"omit\",\n body: JSON.stringify(p),\n });\n await assertOK(r);\n const j = await r.json();\n return j.data as BuildRouteResult;\n}\n\nexport async function buildRoute(\n body: BuildRouteBody,\n signal?: AbortSignal\n): Promise<BuildRouteResult> {\n const addressValidation = validateRouteAddresses({\n fromChain: body.fromChain,\n toChain: body.toChain,\n fromAddress: body.fromAddress,\n toAddress: body.toAddress,\n refundAddress: body.refundAddress,\n direction: body.direction,\n });\n if (!addressValidation.isValid) {\n throw new Error(addressValidation.error || \"Invalid route addresses.\");\n }\n\n const cfg = TrustwareConfigStore.get();\n const url = `${apiBase()}/v1/routes/route`;\n const payload = {\n ...body,\n slippageBps:\n body.slippageBps ??\n (body.slippage === undefined\n ? undefined\n : Math.round(body.slippage * 100)),\n fromAmountUSD: body.fromAmountUSD ?? body.fromAmountUsd,\n };\n const r = await rateLimitedFetch(url, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", \"X-API-Key\": cfg.apiKey },\n body: JSON.stringify(payload),\n signal,\n });\n\n let json: BuildRouteResponse = {};\n try {\n json = await r.json();\n } catch {\n // response body not JSON\n }\n\n if (!r.ok) {\n const msg = json?.error || json?.message || \"Failed to build route\";\n throw new Error(msg);\n }\n\n const intentId = json?.data?.intentId ?? json?.intentId ?? \"\";\n const route = json?.data?.route ?? json?.route;\n const txReq: TxRequest | undefined = route?.execution?.transaction;\n const actions = Array.isArray(route?.steps) ? route.steps : [];\n const estimate = route?.estimate ?? {};\n const sponsorship = json?.data?.sponsorship ?? json?.sponsorship ?? undefined;\n\n const finalExchangeRate = {\n fromAmountUSD: (estimate as { fromAmountUsd?: string }).fromAmountUsd,\n toAmountMinUSD: estimate?.toAmountMinUsd ?? estimate?.toAmountUsd,\n };\n\n if (!txReq?.data) {\n throw new Error(\"Invalid route: missing transaction data\");\n }\n\n return { intentId, txReq, actions, finalExchangeRate, route, sponsorship };\n}\n\nexport async function buildDepositAddress(\n body: BuildRouteBody,\n signal?: AbortSignal\n): Promise<{\n intentId: string;\n depositAddress: string;\n actions: unknown[];\n finalExchangeRate: {\n fromAmountUSD?: string;\n toAmountMinUSD?: string;\n };\n route: RoutePlan | undefined;\n}> {\n const cfg = TrustwareConfigStore.get();\n const url = `${apiBase()}/v1/routes/deposit-address`;\n const payload = {\n ...body,\n slippageBps:\n body.slippageBps ??\n (body.slippage === undefined\n ? undefined\n : Math.round(body.slippage * 100)),\n fromAmountUSD: body.fromAmountUSD ?? body.fromAmountUsd,\n };\n const r = await rateLimitedFetch(url, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", \"X-API-Key\": cfg.apiKey },\n body: JSON.stringify(payload),\n signal,\n });\n\n let json: BuildDepositAddressResponse = {};\n try {\n json = await r.json();\n } catch {\n // response body not JSON\n }\n\n if (!r.ok) {\n const msg =\n json?.error || json?.message || \"Failed to build deposit address\";\n throw new Error(msg);\n }\n\n const intentId = json?.data?.intentId ?? json?.intentId ?? \"\";\n const route = json?.data?.route ?? json?.route;\n const depositAddress =\n json?.data?.depositAddress?.address ?? json?.depositAddress?.address ?? \"\";\n const actions = Array.isArray(route?.steps) ? route.steps : [];\n const estimate = route?.estimate ?? {};\n if (!depositAddress) {\n throw new Error(\"Invalid route: missing deposit address\");\n }\n\n return {\n intentId,\n depositAddress,\n actions,\n finalExchangeRate: {\n fromAmountUSD: (estimate as { fromAmountUsd?: string }).fromAmountUsd,\n toAmountMinUSD: estimate?.toAmountMinUsd ?? estimate?.toAmountUsd,\n },\n route,\n };\n}\n\nexport async function submitReceipt(\n intentId: string,\n txHash: string,\n sponsorshipRequestId?: string\n) {\n const r = await rateLimitedFetch(\n `${apiBase()}/v1/route-intent/${intentId}/receipt`,\n {\n method: \"POST\",\n headers: jsonHeaders({ \"Idempotency-Key\": txHash }),\n body: JSON.stringify({\n txHash,\n ...(sponsorshipRequestId ? { sponsorshipRequestId } : {}),\n }),\n }\n );\n await assertOK(r);\n const j = await r.json();\n return j.data;\n}\n\nexport async function getStatus(intentId: string): Promise<Transaction> {\n const r = await rateLimitedFetch(\n `${apiBase()}/v1/route-intent/${intentId}/status`,\n {\n headers: jsonHeaders(),\n }\n );\n await assertOK(r);\n const j = await r.json();\n return j.data as Transaction;\n}\n\nexport async function pollStatus(\n intentId: string,\n { intervalMs = 2000, timeoutMs = 5 * 60_000 } = {}\n): Promise<Transaction> {\n const t0 = Date.now();\n while (true) {\n const tx = await getStatus(intentId);\n if (tx.status === \"success\" || tx.status === \"failed\") return tx;\n if (Date.now() - t0 > timeoutMs) return tx;\n await new Promise((r) => setTimeout(r, intervalMs));\n }\n}\n","import { TxRequest } from \"src/core/routes\";\n\nexport type RouteParams = {\n fromChain: string;\n toChain: string;\n fromToken: string;\n toToken: string;\n fromAmount: string | number;\n fromAddress: string;\n toAddress: string;\n slippage?: number;\n};\n\nexport type RouteIntent = {\n id: string;\n fromChainId: string | number;\n toChainId: string | number;\n fromToken: string;\n toToken: string;\n fromAddress: string;\n toAddress: string;\n fromAmountWei: string | number;\n quoteToAmountWei: string | number;\n minToAmountWei: string | number;\n requestId?: string;\n routeRaw?: unknown;\n status: \"created\" | \"submitted\" | \"bridging\" | \"success\" | \"failed\";\n createdDate: Date | string;\n updatedDate: Date | string;\n};\n\nexport type Transaction = {\n id: string;\n intentId: string;\n fromAddress: string;\n toAddress: string;\n fromChainId: string | number;\n toChainId: string | number;\n sourceTxHash: string;\n destTxHash: string;\n requestId: string;\n transactionRequest: unknown;\n status: \"submitted\" | \"bridging\" | \"success\" | \"failed\";\n statusRaw?: unknown;\n routePath?: unknown;\n routeStatus?: unknown;\n toAmountWei?: string | number;\n fromChainBlock: number;\n toChainBlock: number;\n fromChainTxUrl?: string;\n toChainTxUrl?: string;\n gasStatus?: string;\n isGMPTransaction?: boolean;\n axelarTransactionUrl?: string;\n\n createdDate: Date | string;\n updatedDate: Date | string;\n timeSpentMs?: number;\n};\n\n// export type BuildRouteResult = {\n// intentId: string;\n// route: {\n// estimate: {\n// fromAmount: string;\n// toAmount: string;\n// fromAmountUSD?: string;\n// toAmountUSD?: string;\n// toAmountMinUSD?: string;\n// minimumReceived?: string;\n// fees?: any;\n// route?: any;\n// };\n// transactionRequest: {\n// to: string;\n// data: string;\n// value?: string;\n// chainId?: string;\n// fromAmountUSD?: string;\n// toAmountMinUSD?: string;\n// };\n// };\n// };\n\nexport type SponsorshipApproval = {\n client_id: string;\n program_id: string;\n sdk_key_id: string;\n sender: string;\n call_data_hash: string;\n chain_id: string;\n max_cost: string;\n valid_after?: string | null;\n valid_until?: string | null;\n nonce: string;\n entry_point: string;\n paymaster: string;\n};\n\nexport type RouteSponsorship = {\n requestId: string;\n paymaster: string;\n entryPoint: string;\n chainId: string;\n callDataHash: string;\n maxCost: string;\n paymasterAndData: string;\n signature: string;\n signer: string;\n typedDataHash: string;\n approval: SponsorshipApproval;\n};\n\nexport type RouteEstimate = {\n fromAmount?: string;\n toAmount?: string;\n toAmountMin?: string;\n fromAmountUsd?: string;\n toAmountUsd?: string;\n totalFeesUsd?: string;\n toAmountMinUsd?: string;\n fees?: unknown[];\n};\n\nexport type RoutePlan = {\n estimate?: RouteEstimate;\n execution?: { transaction?: TxRequest };\n steps?: unknown[];\n provider?: string;\n requestId?: string;\n reliabilityScore?: number;\n diagnostics?: { rawPayload?: unknown };\n sponsorship?: RouteSponsorship;\n};\n\nexport type BuildRouteResult = {\n intentId: string;\n txReq: TxRequest;\n actions: unknown[];\n finalExchangeRate: {\n fromAmountUSD?: string;\n toAmountMinUSD?: string;\n };\n route: RoutePlan | undefined;\n sponsorship?: RouteSponsorship;\n};\n","// Wallet identifiers for popular wallets\nexport type WalletId =\n | \"metamask\"\n | \"coinbase\"\n | \"walletconnect\"\n | \"rainbow\"\n | \"phantom-evm\"\n | \"phantom-solana\"\n | \"solflare\"\n | \"backpack\"\n | \"rabby\"\n | \"brave\"\n | \"okx\"\n | \"zerion\"\n | \"taho\"\n | \"safe\"\n | \"imtoken\"\n | \"trust\"\n | \"bitget\"\n | \"kucoin\";\n\n// Wallet categories for grouping\nexport type WalletCategory = \"injected\" | \"walletconnect\" | \"app\";\nexport type WalletEcosystem = \"evm\" | \"solana\" | \"multi\";\n\n// Metadata about a wallet provider for display and detection purposes\nexport type WalletMeta = {\n id: WalletId;\n name: string;\n category: WalletCategory;\n ecosystem: WalletEcosystem;\n // Local path preferred; fallback to CDN or emoji via `emoji` field\n logo: string; // e.g. \"/assets/wallets/metamask.svg\"\n emoji?: string;\n homepage?: string;\n chromeWebStore?: string;\n android?: string; // Play Store\n ios?: string; // App Store\n // Mobile deep link (use `formatDeepLink` below to inject current URL)\n deepLink?: (currentUrl: string) => string;\n // Heuristics for detection (legacy EIP-1193) on window.ethereum\n detectFlags?: string[]; // checks like `isMetaMask`, `isCoinbaseWallet`, etc.\n};\n\nexport type EIP1193 = {\n request(args: {\n method: string;\n params?: unknown[] | object;\n }): Promise<unknown>;\n};\n\n// Details of a provider detected via EIP-6963 standard including metadata and supported methods/events\nexport type EIP6963ProviderDetail = {\n info: {\n uuid: string;\n name: string;\n icon: string; // data URL or URL\n rdns?: string; // reverse-DNS id (e.g., io.metamask)\n version?: string;\n wallets?: { name: string; version?: string }[]; // for aggregators\n features?: string[]; // e.g., ['signTypedData', 'eth_sendTransaction']\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n provider: any; // EIP-1193 Provider\n methods: string[];\n events: string[];\n};\n\n// Detected wallet with metadata and detection method\nexport type DetectedWallet = {\n meta: WalletMeta;\n via: \"eip6963\" | \"injected-flag\" | \"walletconnect\" | \"solana-window\";\n detail?: EIP6963ProviderDetail;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n provider?: any;\n};\n\nexport type SolanaProviderLike = {\n isPhantom?: boolean;\n isSolflare?: boolean;\n isBackpack?: boolean;\n isConnected?: boolean;\n publicKey?: { toString(): string };\n connect?: (options?: Record<string, unknown>) => Promise<unknown>;\n disconnect?: () => Promise<void>;\n signAndSendTransaction?: (\n transaction: unknown,\n options?: Record<string, unknown>\n ) => Promise<{ signature?: string } | string>;\n signTransaction?: (transaction: unknown) => Promise<{\n serialize: () => Uint8Array;\n }>;\n on?: (event: string, listener: (...args: unknown[]) => void) => void;\n off?: (event: string, listener: (...args: unknown[]) => void) => void;\n removeListener?: (\n event: string,\n listener: (...args: unknown[]) => void\n ) => void;\n};\n\ntype BaseWalletInterface = {\n ecosystem: \"evm\" | \"solana\";\n getAddress(): Promise<string>;\n disconnect?(): Promise<void>;\n};\n\nexport type EvmWalletInterface = BaseWalletInterface & {\n ecosystem: \"evm\";\n getChainId(): Promise<number>;\n switchChain(chainId: number): Promise<void>;\n} & (\n | {\n type: \"eip1193\";\n request(args: {\n method: string;\n params?: unknown[] | object;\n }): Promise<unknown>;\n }\n | {\n type: \"wagmi\";\n sendTransaction(tx: {\n to: `0x${string}`;\n data: `0x${string}`;\n value?: bigint;\n chainId?: number;\n paymasterAndData?: `0x${string}`;\n }): Promise<{ hash: `0x${string}` }>;\n }\n );\n\nexport type SolanaWalletInterface = BaseWalletInterface & {\n ecosystem: \"solana\";\n type: \"solana\";\n getChainKey(): Promise<string>;\n sendSerializedTransaction(\n serializedTransactionBase64: string,\n chainId?: string\n ): Promise<string>;\n};\n\n// Comprehensive wallet interface with transaction sending capabilities\n// and support for either EIP-1193, Wagmi, or Solana browser wallets\nexport type WalletInterFaceAPI = EvmWalletInterface | SolanaWalletInterface;\n\n// A simplified wallet interface without transaction sending capabilities\nexport type SimpleWalletInterface = {\n getAddress(): Promise<string>;\n disconnect?(): Promise<void>;\n};\n","export type TrustwareWidgetTheme = {\n primaryColor: string;\n secondaryColor: string;\n backgroundColor: string;\n textColor: string;\n borderColor: string;\n radius: number;\n};\n\nexport type TrustwareWidgetMessages = {\n title: string;\n description: string;\n};\n\nexport const DEFAULT_THEME: TrustwareWidgetTheme = {\n primaryColor: \"#4F46E5\", // Indigo-600\n secondaryColor: \"#6366F1\", // Indigo-500\n backgroundColor: \"#FFFFFF\", // White\n textColor: \"#111827\", // Gray-900\n borderColor: \"#E5E7EB\", // Gray-200\n radius: 8, // 8px border radius\n};\n\nexport const DEFAULT_MESSAGES: TrustwareWidgetMessages = {\n title: \"Trustware SDK\",\n description: \"Seamlessly bridge assets across chains with Trustware.\",\n};\n","export type ChainMeta = {\n id: string; // e.g. \"43114\"\n networkIdentifier: string; // e.g. \"avalanche\"\n nativeCurrency: { symbol: string; decimals: number; name: string };\n};\n\nexport type TokenMeta = {\n chainId: string; // \"43114\"\n address: `0x${string}`;\n symbol: string; // e.g. \"USDC.e\"\n decimals: number;\n visible?: boolean;\n active?: boolean;\n};\n\nexport type BalanceRow = {\n chain_key: string;\n category: \"native\" | \"erc20\" | \"spl\" | \"btc\";\n contract?: string;\n address?: string;\n symbol?: string;\n decimals: number;\n balance: string;\n name?: string;\n logoURI?: string;\n usdPrice?: number;\n};\n\nexport type WalletAddressBalanceWrapper = {\n chain_id: string;\n balances: BalanceRow[];\n count: number;\n error: string | null;\n source: string;\n};\n\nexport type TokenPageOptions = {\n cursor?: string;\n limit?: number;\n q?: string;\n};\n\nexport type TokenPageInfo = {\n hasNextPage: boolean;\n nextCursor?: string;\n};\n\nexport type TokenPageResult = {\n data: TokenDef[];\n pageInfo: TokenPageInfo;\n};\n\nexport type BalanceStreamOptions = {\n stream?: boolean;\n signal?: AbortSignal;\n strict?: boolean;\n};\n\nexport type ChainType = \"evm\" | \"cosmos\" | \"solana\" | \"btc\" | string;\n\nexport interface NativeCurrency {\n symbol: string;\n name?: string;\n decimals?: number;\n icon?: string;\n}\n\nexport interface ChainDef {\n /** API commonly sends both. We canonicalize on chainId as string. */\n chainId: string | number;\n id?: string | number;\n\n /** Keys we use to resolve chains from presets / user input */\n networkIdentifier?: string; // e.g. \"avalanche\", \"optimism\", \"linea\"\n axelarChainName?: string; // e.g. \"Avalanche\", \"optimism\", \"linea\"\n networkName?: string; // e.g. \"Avalanche\", \"Linea\"\n\n /** UI/availability flags */\n enabled?: boolean;\n visible?: boolean;\n isTestnet?: boolean;\n\n /** Display */\n chainIconURI?: string;\n nativeCurrency?: NativeCurrency;\n\n /** Kinds (some payloads use both) */\n type?: ChainType;\n chainType?: ChainType;\n\n /** Nice-to-have extras we won't rely on but keep for completeness */\n blockExplorerUrls?: string[];\n rpc?: string;\n rpcList?: string[];\n}\n\nexport type TokenType = \"evm\" | \"solana\" | \"btc\" | string;\n\nexport interface TokenDef {\n /** Core identity */\n address: string;\n chainId: string | number;\n\n /** Display */\n logoURI?: string; // NOTE: was 'logoUR' in your snippet — fixed the typo\n name: string;\n symbol: string;\n\n /** Behavior / filtering */\n decimals: number;\n active?: boolean;\n visible?: boolean;\n type: TokenType;\n\n /** Optional metadata */\n usdPrice?: number;\n coingeckoId?: string;\n createdBy?: string;\n subGraphIds?: string[];\n subGraphOnly?: boolean;\n}\n\nexport type TokenWithBalance = TokenDef & { balance?: bigint };\n","import type { ChainDef, ChainType } from \"./blockchain\";\n\nexport type WalletAddressSource = \"provider\" | \"manual\" | \"imported\";\n\nexport type WalletIdentityAddress = {\n address: string;\n chainType: ChainType;\n chainKey?: string;\n chainId?: string;\n providerId?: string;\n source: WalletAddressSource;\n};\n\nexport type WalletIdentity = {\n addresses: WalletIdentityAddress[];\n};\n\nexport type WalletAddressResolution =\n | {\n status: \"resolved\";\n address: string;\n source: WalletAddressSource;\n chainType: ChainType;\n chainKey?: string;\n chainId?: string;\n }\n | {\n status: \"missing\" | \"invalid\";\n reason: string;\n address?: string;\n source?: WalletAddressSource;\n chainType?: ChainType;\n chainKey?: string;\n chainId?: string;\n };\n\nexport type WalletIdentityChainLike = ChainDef | ChainType | string | null;\n","export * from \"./config\";\nexport * from \"./routes\";\nexport * from \"./wallets\";\nexport * from \"./theme\";\nexport * from \"./blockchain\";\nexport * from \"./identity\";\n","// src/index.ts\nexport { Trustware, TrustwareCore } from \"./core\";\nexport { RateLimitError } from \"./core/http\";\nexport { useWalletTokenState } from \"src/widget/state/deposit/useWalletTokenState\";\nexport type { YourTokenData } from \"src/widget/state/deposit/types\";\nexport {\n connectDetectedWallet,\n useWalletDetection,\n useWireDetectionIntoManager,\n WagmiBridge,\n WagmiConnector,\n useEIP1193,\n useWagmi,\n toWalletInterfaceFromDetected,\n useWalletInfo,\n useWalletExternalDisconnect,\n walletManager,\n} from \"./wallets/\";\nexport { TrustwareWidget } from \"./widget/\";\nexport { TrustwareProvider, useTrustware } from \"./provider\";\nexport { TrustwareError } from \"./errors/TrustwareError\";\nexport * from \"./identity\";\nexport * from \"./validation/address\";\nexport * from \"./types\";\nexport * from \"./constants\";\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n TrustwareConfigOptions,\n ResolvedTrustwareConfig,\n} from \"../types/\";\nimport {\n DEFAULT_AUTO_DETECT_PROVIDER,\n DEFAULT_SLIPPAGE,\n DEFAULT_THEME,\n DEFAULT_MESSAGES,\n} from \"./defaults\";\nimport { DEFAULT_FEATURE_FLAGS, DEFAULT_RETRY_CONFIG } from \"../types/config\";\nimport { validateAddressForChain } from \"src\";\n// import { getUniversalConnector } from \"./walletconnect\";\n\n/**\n * Resolve WalletConnect config with built-in defaults.\n * WalletConnect is ENABLED by default - no user configuration required.\n */\n// function resolveWalletConnectConfig(\n// input?: WalletConnectConfig\n// ): ResolvedWalletConnectConfig | undefined {\n// // Allow users to explicitly disable WalletConnect\n// if (input?.disabled) return undefined;\n\n// // Use built-in project ID by default, allow override\n// const projectId = input?.projectId ?? WALLETCONNECT_PROJECT_ID;\n\n// return {\n// projectId,\n// chains: input?.chains ?? [1], // Default to Ethereum mainnet\n// optionalChains: input?.optionalChains ?? [\n// 1, 10, 56, 137, 8453, 42161, 43114,\n// ], // ETH, OP, BSC, Polygon, Base, Arbitrum, Avalanche\n// metadata: {\n// name: input?.metadata?.name ?? \"Trustware\",\n// description:\n// input?.metadata?.description ?? \"Cross-chain bridge & top-up\",\n// url: input?.metadata?.url ?? \"https://trustware.io\",\n// icons: input?.metadata?.icons ?? [\"https://app.trustware.io/icon.png\"],\n// },\n// relayUrl: input?.relayUrl,\n// showQrModal: input?.showQrModal ?? true,\n// };\n// }\n\n// tiny deep merge for plain objects\nfunction deepMerge<T extends Record<string, any>>(\n base: T,\n patch?: Partial<T>\n): T {\n if (!patch) return { ...base };\n const out: any = Array.isArray(base) ? [...(base as any)] : { ...base };\n for (const [k, v] of Object.entries(patch)) {\n if (v && typeof v === \"object\" && !Array.isArray(v)) {\n (out as any)[k] = deepMerge((base as any)[k] ?? {}, v as any);\n } else {\n (out as any)[k] = v;\n }\n }\n return out;\n}\n\nfunction normalizeSlippage(v: unknown): number {\n const n = Number(v);\n if (!Number.isFinite(n)) return DEFAULT_SLIPPAGE;\n // clamp sane range 0.01%..5% (0.0001..0.05)\n if (n <= 0) return DEFAULT_SLIPPAGE;\n if (n > 5) return 5;\n return n;\n}\n\nexport function resolveConfig(\n input: TrustwareConfigOptions\n): ResolvedTrustwareConfig {\n if (!input?.apiKey) {\n throw new Error(\"TrustwareConfig: 'apiKey' is required.\");\n }\n if (!input.routes?.toChain || !input.routes?.toToken) {\n throw new Error(\n \"TrustwareConfig: 'routes.toChain' and 'routes.toToken' are required.\"\n );\n }\n\n // ── Address validation\n const toChain = input.routes.toChain;\n\n if (input.routes.toAddress) {\n const result = validateAddressForChain(input.routes.toAddress, toChain);\n if (!result.isValid) {\n console.error(`[Trustware SDK] Invalid toAddress: ${result.error}`);\n throw new Error(`Invalid toAddress: ${result.error}`);\n }\n }\n\n if (input.routes.fromAddress) {\n const result = validateAddressForChain(\n input.routes.fromAddress,\n input.routes.fromChain ?? toChain\n );\n if (!result.isValid) {\n console.error(`[Trustware SDK] Invalid fromAddress: ${result.error}`);\n throw new Error(`Invalid fromAddress: ${result.error}`);\n }\n }\n\n const autoDetectProvider =\n typeof input.autoDetectProvider === \"boolean\"\n ? input.autoDetectProvider\n : DEFAULT_AUTO_DETECT_PROVIDER;\n\n const routes = {\n toChain: input.routes.toChain,\n toToken: input.routes.toToken,\n fromToken: input.routes.fromToken,\n fromAddress: input.routes.fromAddress,\n fromChain: input.routes.fromChain,\n toAddress: input.routes.toAddress,\n defaultSlippage: normalizeSlippage(\n input.routes.defaultSlippage ?? DEFAULT_SLIPPAGE\n ),\n routeType: input.routes.routeType ?? \"swap\",\n options: {\n ...input.routes.options,\n },\n };\n\n const theme = deepMerge(DEFAULT_THEME, input.theme);\n const messages = deepMerge(DEFAULT_MESSAGES, input.messages);\n\n // Merge retry config with defaults\n const retry = {\n autoRetry: input.retry?.autoRetry ?? DEFAULT_RETRY_CONFIG.autoRetry,\n maxRetries: input.retry?.maxRetries ?? DEFAULT_RETRY_CONFIG.maxRetries,\n baseDelayMs: input.retry?.baseDelayMs ?? DEFAULT_RETRY_CONFIG.baseDelayMs,\n approachingThreshold:\n input.retry?.approachingThreshold ??\n DEFAULT_RETRY_CONFIG.approachingThreshold,\n onRateLimitInfo: input.retry?.onRateLimitInfo,\n onRateLimited: input.retry?.onRateLimited,\n onRateLimitApproaching: input.retry?.onRateLimitApproaching,\n };\n\n // Resolve WalletConnect config (optional)\n // const walletConnect = resolveWalletConnectConfig(input.walletConnect);\n const walletConnect = input.walletConnect;\n const features = {\n tokensPagination:\n input.features?.tokensPagination ??\n DEFAULT_FEATURE_FLAGS.tokensPagination,\n balanceStreaming:\n input.features?.balanceStreaming ??\n DEFAULT_FEATURE_FLAGS.balanceStreaming,\n shouldAllowGA4:\n input.features?.shouldAllowGA4 ?? DEFAULT_FEATURE_FLAGS.shouldAllowGA4,\n swapMode: input.features?.swapMode ?? DEFAULT_FEATURE_FLAGS.swapMode,\n swapDefaultDestToken:\n input.features?.swapDefaultDestToken ??\n DEFAULT_FEATURE_FLAGS.swapDefaultDestToken,\n swapLockDestToken:\n input.features?.swapLockDestToken ??\n DEFAULT_FEATURE_FLAGS.swapLockDestToken,\n swapAllowedDestTokens:\n input.features?.swapAllowedDestTokens ??\n DEFAULT_FEATURE_FLAGS.swapAllowedDestTokens,\n };\n\n return {\n apiKey: input.apiKey,\n routes,\n autoDetectProvider,\n theme,\n messages,\n retry,\n walletConnect,\n features,\n onError: input.onError,\n onSuccess: input.onSuccess,\n onEvent: input.onEvent,\n };\n}\n","export * from \"./defaults\";\nexport * from \"./merge\";\nexport * from \"./store\";\n// walletconnect.ts is excluded: depends on @reown/appkit-universal-connector (not installed)\n","/* core/http.ts */\nimport { SDK_NAME, SDK_VERSION, API_ROOT, API_PREFIX } from \"../constants\";\nimport { TrustwareConfigStore } from \"../config/\";\nimport type { RateLimitInfo } from \"../types/config\";\n\nexport function apiBase() {\n return `${API_ROOT}${API_PREFIX}`;\n}\n\nexport function jsonHeaders(extra?: Record<string, string>): HeadersInit {\n const cfg = TrustwareConfigStore.get();\n const h: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n \"X-API-Key\": cfg.apiKey,\n \"X-SDK-Name\": SDK_NAME,\n \"X-SDK-Version\": SDK_VERSION,\n \"X-API-Version\": \"2025-10-01\",\n };\n return { ...h, ...(extra || {}) };\n}\n\nexport async function assertOK(r: Response) {\n if (r.ok) return;\n let msg = r.statusText;\n try {\n const j = await r.json();\n if (j?.error) msg = j.error;\n } catch {\n // response body not JSON, use statusText\n }\n throw new Error(`HTTP ${r.status}: ${msg}`);\n}\n\n///sdk/validate\nexport async function validateSdkAccess() {\n const r = await fetch(`${apiBase()}/sdk/validate`, {\n method: \"GET\",\n headers: jsonHeaders(),\n });\n await assertOK(r);\n const j = await r.json();\n return j.data;\n}\n\n/** Parse rate limit headers from a response */\nexport function parseRateLimitHeaders(r: Response): RateLimitInfo | null {\n const limit = r.headers.get(\"X-RateLimit-Limit\");\n const remaining = r.headers.get(\"X-RateLimit-Remaining\");\n const reset = r.headers.get(\"X-RateLimit-Reset\");\n\n if (!limit || !remaining || !reset) {\n return null;\n }\n\n const info: RateLimitInfo = {\n limit: parseInt(limit, 10),\n remaining: parseInt(remaining, 10),\n reset: parseInt(reset, 10),\n };\n\n // Add retryAfter if present (only on 429 responses)\n const retryAfter = r.headers.get(\"Retry-After\");\n if (retryAfter) {\n info.retryAfter = parseInt(retryAfter, 10);\n }\n\n return info;\n}\n\n/** Notify rate limit callbacks based on response */\nfunction notifyRateLimitCallbacks(\n info: RateLimitInfo,\n isRateLimited: boolean,\n retryCount: number\n) {\n const cfg = TrustwareConfigStore.get();\n const { retry } = cfg;\n\n // Always notify onRateLimitInfo if configured\n if (retry.onRateLimitInfo) {\n retry.onRateLimitInfo(info);\n }\n\n // Notify when rate limited\n if (isRateLimited && retry.onRateLimited) {\n retry.onRateLimited(info, retryCount);\n }\n\n // Notify when approaching limit\n if (\n !isRateLimited &&\n retry.onRateLimitApproaching &&\n info.remaining <= retry.approachingThreshold\n ) {\n retry.onRateLimitApproaching(info, retry.approachingThreshold);\n }\n}\n\n/** Calculate delay for exponential backoff */\nfunction calculateBackoffDelay(\n baseDelayMs: number,\n retryCount: number,\n retryAfter?: number\n): number {\n // If server specified retry-after, use that (in seconds, convert to ms)\n if (retryAfter && retryAfter > 0) {\n return retryAfter * 1000;\n }\n // Otherwise use exponential backoff: base * 2^retryCount\n return baseDelayMs * Math.pow(2, retryCount);\n}\n\n/** Sleep for specified milliseconds */\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nexport class RateLimitError extends Error {\n public readonly rateLimitInfo: RateLimitInfo;\n public readonly retriesExhausted: boolean;\n\n constructor(info: RateLimitInfo, retriesExhausted: boolean) {\n const message = retriesExhausted\n ? `Rate limit exceeded after max retries. Try again in ${info.retryAfter ?? Math.ceil((info.reset * 1000 - Date.now()) / 1000)} seconds.`\n : `Rate limit exceeded. Try again in ${info.retryAfter} seconds.`;\n super(message);\n this.name = \"RateLimitError\";\n this.rateLimitInfo = info;\n this.retriesExhausted = retriesExhausted;\n }\n}\n\ntype FetchOptions = RequestInit & {\n /** Skip rate limit handling for this request */\n skipRateLimit?: boolean;\n};\n\n/**\n * Rate-limit-aware fetch wrapper.\n * Automatically handles 429 responses with exponential backoff retry.\n * Notifies callbacks on rate limit events.\n */\nexport async function rateLimitedFetch(\n url: string,\n options: FetchOptions = {}\n): Promise<Response> {\n const { skipRateLimit, ...fetchOptions } = options;\n\n // If auto-retry is disabled or skipped, just do a normal fetch\n const cfg = TrustwareConfigStore.get();\n if (!cfg.retry.autoRetry || skipRateLimit) {\n return fetch(url, fetchOptions);\n }\n\n const { maxRetries, baseDelayMs } = cfg.retry;\n let retryCount = 0;\n\n while (true) {\n const response = await fetch(url, fetchOptions);\n\n // Parse rate limit headers\n const rateLimitInfo = parseRateLimitHeaders(response);\n\n if (response.status === 429) {\n // Rate limited\n if (rateLimitInfo) {\n notifyRateLimitCallbacks(rateLimitInfo, true, retryCount);\n }\n\n // Check if we should retry\n if (retryCount >= maxRetries) {\n // Max retries exhausted\n throw new RateLimitError(\n rateLimitInfo || { limit: 0, remaining: 0, reset: 0 },\n true\n );\n }\n\n // Calculate delay and retry\n const delay = calculateBackoffDelay(\n baseDelayMs,\n retryCount,\n rateLimitInfo?.retryAfter\n );\n await sleep(delay);\n retryCount++;\n continue;\n }\n\n // Not rate limited - notify callbacks if we have info\n if (rateLimitInfo) {\n notifyRateLimitCallbacks(rateLimitInfo, false, 0);\n }\n\n return response;\n }\n}\n","import { createLightAccountClient } from \"@account-kit/smart-contracts\";\nimport {\n WalletClientSigner,\n deepHexlify,\n resolveProperties,\n type ClientMiddlewareFn,\n} from \"@aa-sdk/core\";\nimport {\n createWalletClient,\n custom,\n keccak256,\n stringToHex,\n type Chain,\n} from \"viem\";\nimport { apiBase, jsonHeaders } from \"../core/http\";\n\nconst FETCH_TIMEOUT_MS = 30_000;\n\nasync function fetchWithTimeout(\n url: string,\n init: RequestInit\n): Promise<Response> {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);\n try {\n return await fetch(url, { ...init, signal: controller.signal });\n } catch (err) {\n if (err instanceof Error && err.name === \"AbortError\") {\n throw Object.assign(\n new Error(\n `Request timed out after ${FETCH_TIMEOUT_MS / 1000}s: ${url}`\n ),\n {\n code: \"FETCH_TIMEOUT\",\n }\n );\n }\n throw err;\n } finally {\n clearTimeout(timer);\n }\n}\n\n// Map 4-byte selector → human-readable name for ClientPaymasterUpgradeable custom errors.\n// These are thrown inside FailedOpWithRevert.inner which Account Kit cannot decode on its own.\nconst _sel = (sig: string) =>\n keccak256(stringToHex(sig)).slice(0, 10).toLowerCase();\nconst PAYMASTER_ERROR_SELECTORS: Record<string, string> = {\n [_sel(\"InvalidCallDataHash()\")]: \"InvalidCallDataHash()\",\n [_sel(\"NonceAlreadyUsed()\")]: \"NonceAlreadyUsed()\",\n [_sel(\"InvalidSigner()\")]: \"InvalidSigner()\",\n [_sel(\"MaxCostExceeded()\")]: \"MaxCostExceeded()\",\n [_sel(\"InvalidPaymasterData()\")]: \"InvalidPaymasterData()\",\n [_sel(\"InvalidSender()\")]: \"InvalidSender()\",\n [_sel(\"InvalidChain()\")]: \"InvalidChain()\",\n [_sel(\"InvalidEntryPoint()\")]: \"InvalidEntryPoint()\",\n [_sel(\"InvalidPaymaster()\")]: \"InvalidPaymaster()\",\n [_sel(\"PaymasterPaused()\")]: \"PaymasterPaused()\",\n [_sel(\"NotEntryPoint()\")]: \"NotEntryPoint()\",\n};\n\n// Walks common locations Alchemy/bundlers put revert data and returns the first hex string found.\nfunction extractRevertHex(err: {\n code?: number;\n message?: string;\n data?: unknown;\n}): string | undefined {\n // Direct data field (string)\n if (typeof err.data === \"string\" && err.data.startsWith(\"0x\"))\n return err.data;\n // Nested data.revert (some Alchemy bundler versions)\n if (err.data && typeof err.data === \"object\") {\n const d = err.data as Record<string, unknown>;\n if (typeof d.revert === \"string\" && d.revert.startsWith(\"0x\"))\n return d.revert;\n if (typeof d.data === \"string\" && d.data.startsWith(\"0x\")) return d.data;\n }\n // Hex embedded in message: \"AA33 reverted: 0x...\"\n if (typeof err.message === \"string\") {\n const m = err.message.match(/0x[0-9a-fA-F]+/);\n if (m) return m[0];\n }\n return undefined;\n}\n\nfunction decodePaymasterRevert(revertHex: string): string | undefined {\n // 4-byte selector starts at index 2 (after \"0x\")\n if (revertHex.length < 10) return undefined;\n const selector = revertHex.slice(0, 10).toLowerCase();\n return PAYMASTER_ERROR_SELECTORS[selector];\n}\n\ntype Eip1193Request = (args: {\n method: string;\n params?: object | unknown[];\n}) => Promise<unknown>;\n\n// Minimal EVM bytecode: ignores calldata, returns ABI-encoded (bytes(\"\"), uint256(0)).\n// Used as a state override on the real paymaster address during eth_estimateUserOperationGas\n// so the bundler can simulate without needing a real EIP-712 signature at estimation time.\n// Opcodes: MSTORE(0,0x40) MSTORE(0x20,0) MSTORE(0x40,0) RETURN(0,0x60)\nconst ESTIMATION_OVERRIDE_BYTECODE =\n \"0x60406000526000602052600060405260606000f3\" as const;\n\nexport async function createTrustwareSmartAccountClient(\n eoaAddress: `0x${string}`,\n chainId: number,\n viemChain: Chain,\n eip1193Request: Eip1193Request,\n paymasterAddress: `0x${string}`\n) {\n let lastSponsorshipRequestId: string | undefined;\n\n const walletClient = createWalletClient({\n account: eoaAddress,\n transport: custom({ request: eip1193Request }),\n chain: viemChain,\n });\n\n const signer = new WalletClientSigner(walletClient, \"trustware-eip1193\");\n\n // Proxies all Account Kit JSON-RPC methods through the Trustware backend.\n // The Alchemy API key never leaves the server.\n // For eth_estimateUserOperationGas, injects a state override that makes the\n // real paymaster always validate — the dummy paymasterData (all zeros) would\n // otherwise fail ECDSA verification and cause AA30/AA34 from the bundler.\n const bundlerTransport = custom({\n async request({ method, params }: { method: string; params?: unknown }) {\n let forwardParams = params;\n\n if (method === \"eth_estimateUserOperationGas\" && Array.isArray(params)) {\n const userOp = params[0] as Record<string, unknown> | undefined;\n const paymasterInOp = (\n userOp?.paymaster as string | undefined\n )?.toLowerCase();\n if (\n paymasterInOp &&\n paymasterInOp !== \"0x0000000000000000000000000000000000000000\"\n ) {\n forwardParams = [\n params[0],\n params[1],\n { [paymasterAddress]: { code: ESTIMATION_OVERRIDE_BYTECODE } },\n ] as unknown as typeof params;\n }\n }\n\n const resp = await fetchWithTimeout(\n `${apiBase()}/v1/bundler/send-user-operation`,\n {\n method: \"POST\",\n headers: jsonHeaders(),\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n method,\n params: forwardParams,\n id: 1,\n chainId: String(chainId),\n }),\n }\n );\n const j = (await resp.json()) as {\n result?: unknown;\n error?: { code?: number; message?: string; data?: unknown };\n };\n if (j.error) {\n const rawErr = j.error as {\n code?: number;\n message?: string;\n data?: unknown;\n };\n const revertHex = extractRevertHex(rawErr);\n const decoded = revertHex\n ? decodePaymasterRevert(revertHex)\n : undefined;\n\n const msg = decoded\n ? `Paymaster validation failed: ${decoded}`\n : rawErr.code === -32602\n ? `UserOp rejected: ${rawErr.message ?? \"replacement underpriced\"}`\n : (rawErr.message ?? String(j.error));\n\n throw Object.assign(new Error(msg), {\n code: rawErr.code,\n data: rawErr.data,\n });\n }\n return j.result;\n },\n });\n\n // EP v0.7 dummy paymaster: uses the real paymaster address so the bundler\n // can verify it is deployed. The all-zero paymasterData is safe because the\n // state override above makes validatePaymasterUserOp always succeed during\n // gas estimation. The real signature is fetched by paymasterAndData below.\n //\n // paymasterPostOpGasLimit must match elros's defaultPostOpGasLimit (50,000 = 0xc350)\n // so that the gas limits in the submitted UserOp match what was estimated. If the\n // dummy and real values differ, some bundlers flag the change as a precheck failure.\n const dummyPaymasterAndData: ClientMiddlewareFn = async (struct) => {\n return {\n ...struct,\n paymaster: paymasterAddress,\n paymasterVerificationGasLimit: \"0x186a0\",\n paymasterPostOpGasLimit: \"0xc350\",\n paymasterData: `0x${\"00\".repeat(544)}`,\n } as typeof struct;\n };\n\n const paymasterAndData: ClientMiddlewareFn = async (struct) => {\n type ResolvedUO = {\n sender?: string;\n callData?: string;\n callGasLimit?: string;\n verificationGasLimit?: string;\n preVerificationGas?: string;\n paymasterVerificationGasLimit?: string;\n paymasterPostOpGasLimit?: string;\n maxFeePerGas?: string;\n };\n const uo = deepHexlify(await resolveProperties(struct)) as ResolvedUO;\n\n const totalGas =\n BigInt(uo.callGasLimit ?? \"0x0\") +\n BigInt(uo.verificationGasLimit ?? \"0x0\") +\n BigInt(uo.preVerificationGas ?? \"0x0\") +\n BigInt(uo.paymasterVerificationGasLimit ?? \"0x0\") +\n BigInt(uo.paymasterPostOpGasLimit ?? \"0x0\");\n\n // 2x buffer to accommodate maxFeePerGas variance between estimation and submission.\n // 1.3x proved too thin — a >30% gas spike between estimation and inclusion causes the\n // paymaster contract to revert with MaxCostExceeded, which bypasses the fee retry loop.\n const maxCostWei = totalGas * BigInt(uo.maxFeePerGas ?? \"0x0\") * 2n;\n\n const resp = await fetchWithTimeout(\n `${apiBase()}/v1/paymaster/sponsor-calldata`,\n {\n method: \"POST\",\n headers: jsonHeaders(),\n body: JSON.stringify({\n chainId: String(chainId),\n sender: uo.sender ?? \"\",\n userOpCallData: uo.callData ?? \"0x\",\n maxCostWei: maxCostWei.toString(),\n }),\n }\n );\n\n if (!resp.ok) {\n const j = (await resp.json().catch(() => ({}))) as { error?: string };\n // 404 = no deployment or rule for this chain/sender — non-retryable, SDK falls back to EOA.\n // 5xx = sign pipeline timeout or transient backend error — retryable by the send loop.\n const code =\n resp.status === 404 ? \"NO_PAYMASTER\" : \"PAYMASTER_UNAVAILABLE\";\n throw Object.assign(\n new Error(j?.error ?? `paymaster sponsor-calldata HTTP ${resp.status}`),\n { code }\n );\n }\n\n const j = (await resp.json()) as {\n data: { paymasterAndData: string; requestId?: string };\n };\n if (j.data.requestId) lastSponsorshipRequestId = j.data.requestId;\n const blob = (j.data.paymasterAndData ?? \"\").replace(/^0x/, \"\");\n\n // 596 bytes minimum: 20 (paymaster) + 16 (verifGasLimit) + 16 (postOpGasLimit) + 544 (paymasterData)\n if (blob.length < 1192 || !/^[0-9a-fA-F]+$/.test(blob)) {\n throw Object.assign(\n new Error(\n `Invalid paymasterAndData from backend: expected ≥ 1192 hex chars, got ${blob.length}`\n ),\n { code: \"PAYMASTER_RESPONSE_INVALID\" }\n );\n }\n\n // Split the 596-byte backend blob into EP v0.7 separate paymaster fields:\n // [0:40] paymaster address (20 bytes)\n // [40:72] paymasterVerificationGasLimit (16 bytes)\n // [72:104] paymasterPostOpGasLimit (16 bytes)\n // [104:] paymasterData (544 bytes — ECDSA sig + validity window)\n const splitFields = {\n paymaster: `0x${blob.slice(0, 40)}`,\n paymasterVerificationGasLimit: `0x${blob.slice(40, 72)}`,\n paymasterPostOpGasLimit: `0x${blob.slice(72, 104)}`,\n paymasterData: `0x${blob.slice(104)}`,\n };\n return {\n ...struct,\n ...splitFields,\n } as typeof struct;\n };\n\n const client = await createLightAccountClient({\n transport: bundlerTransport,\n chain: viemChain,\n signer,\n dummyPaymasterAndData,\n paymasterAndData,\n });\n\n return {\n client,\n getSponsorshipRequestId: () => lastSponsorshipRequestId,\n };\n}\n","export type FeeRequirement = {\n minFee: bigint;\n minPriorityFee: bigint;\n // true → -32602 replacement underpriced: bundler requires >110% of stuck op's fee\n // false → -32000 precheck floor: reported value IS the exact minimum\n isReplacement: boolean;\n};\n\nconst CAUSE_CHAIN_LIMIT = 50;\n\nfunction safeBigInt(value: string, fallback: bigint): bigint {\n try {\n return BigInt(value);\n } catch {\n return fallback;\n }\n}\n\n// Walks the cause chain looking for PAYMASTER_UNAVAILABLE, which means the backend's\n// sign pipeline had a transient failure — distinct from NO_PAYMASTER (non-retryable).\nexport function isPaymasterUnavailable(err: unknown): boolean {\n let current = err;\n for (let depth = 0; depth < CAUSE_CHAIN_LIMIT; depth++) {\n if (!current || typeof current !== \"object\") return false;\n const e = current as { code?: unknown; cause?: unknown };\n if (e.code === \"PAYMASTER_UNAVAILABLE\") return true;\n current = e.cause;\n }\n return false;\n}\n\n// Account Kit wraps bundler errors inside SmartAccountUserOperationExecutionError.\n// Walk the full cause chain to find a fee requirement from:\n// -32602 \"replacement underpriced\" — data.currentMaxFee / data.currentMaxPriorityFee\n// -32000 \"precheck failed: maxFeePerGas must be at least Y\" — parse Y from message\nexport function extractFeeRequirement(err: unknown): FeeRequirement | null {\n let current = err;\n for (let depth = 0; depth < CAUSE_CHAIN_LIMIT; depth++) {\n if (!current || typeof current !== \"object\") return null;\n const e = current as {\n code?: unknown;\n message?: unknown;\n data?: unknown;\n cause?: unknown;\n };\n\n if (e.code === -32602 && e.data && typeof e.data === \"object\") {\n const d = e.data as Record<string, unknown>;\n if (typeof d.currentMaxFee === \"string\") {\n try {\n const fee = BigInt(d.currentMaxFee);\n const priority =\n typeof d.currentMaxPriorityFee === \"string\"\n ? safeBigInt(d.currentMaxPriorityFee, fee)\n : fee;\n return { minFee: fee, minPriorityFee: priority, isReplacement: true };\n } catch {\n /* malformed fee string — fall through to cause chain */\n }\n }\n }\n\n if (e.code === -32000 && typeof e.message === \"string\") {\n const m = (e.message as string).match(/must be at least (\\d+)/);\n if (m) {\n try {\n const fee = BigInt(m[1]);\n return { minFee: fee, minPriorityFee: fee, isReplacement: false };\n } catch {\n /* malformed fee string — fall through to cause chain */\n }\n }\n }\n\n current = e.cause;\n }\n return null;\n}\n","import {\n encodeFunctionData,\n keccak256,\n encodeAbiParameters,\n concat,\n recoverAddress,\n stringToHex,\n} from \"viem\";\n\nexport const PERMIT2 = \"0x000000000022D473030F116dDEE9F6B43aC78BA3\" as const;\n\nconst PERMIT2_ABI = [\n {\n name: \"permitTransferFrom\",\n type: \"function\",\n inputs: [\n {\n name: \"permit\",\n type: \"tuple\",\n components: [\n {\n name: \"permitted\",\n type: \"tuple\",\n components: [\n { name: \"token\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n },\n {\n name: \"transferDetails\",\n type: \"tuple\",\n components: [\n { name: \"to\", type: \"address\" },\n { name: \"requestedAmount\", type: \"uint256\" },\n ],\n },\n { name: \"owner\", type: \"address\" },\n { name: \"signature\", type: \"bytes\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n] as const;\n\nconst ERC20_APPROVE_ABI = [\n {\n name: \"approve\",\n type: \"function\",\n inputs: [\n { name: \"spender\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n outputs: [{ name: \"\", type: \"bool\" }],\n stateMutability: \"nonpayable\",\n },\n] as const;\n\n// 128-bit random nonce — collision-free for SignatureTransfer (bitmap tracks used nonces).\n// Do NOT use permit2.allowance() nonce here — that is for AllowanceTransfer, not SignatureTransfer.\nexport function randomPermit2Nonce(): bigint {\n const buf = new Uint8Array(16);\n crypto.getRandomValues(buf);\n const hex = Array.from(buf)\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\");\n return BigInt(\"0x\" + hex);\n}\n\ntype Eip1193Request = (args: {\n method: string;\n params?: object | unknown[];\n}) => Promise<unknown>;\n\nexport async function signPermit2(\n eip1193Request: Eip1193Request,\n params: {\n chainId: number;\n token: `0x${string}`;\n amount: bigint;\n spender: `0x${string}`;\n nonce: bigint;\n deadline: bigint;\n owner: `0x${string}`;\n }\n): Promise<`0x${string}`> {\n // Permit2 domain has no \"version\" field — the contract is not ERC-712-versioned.\n // Use decimal strings for all uint256 fields. Wallets using @metamask/eth-sig-util\n // v4 pass values through new BN(value, 10), and hex strings fed to bn.js with explicit\n // base-10 produce wrong results (the 'x' prefix character is parsed as digit 33, etc.).\n // Decimal strings work correctly with both old (bn.js) and new (BigInt) wallet stacks.\n //\n // IMPORTANT: Callers may pass amount/nonce/deadline as hex strings (e.g. \"0x2713\") even\n // though the TypeScript type says bigint — JSON doesn't support BigInt so values coming\n // from API responses arrive as strings. Wrapping in BigInt() normalises any hex string,\n // decimal string, number, or bigint to a proper decimal representation before signing.\n const amountBig = BigInt(params.amount);\n const nonceBig = BigInt(params.nonce);\n const deadlineBig = BigInt(params.deadline);\n\n const typedData = {\n domain: {\n name: \"Permit2\",\n chainId: params.chainId,\n verifyingContract: PERMIT2,\n },\n types: {\n // Explicit EIP712Domain forces wallets to use this exact field order\n // (name, chainId, verifyingContract) — matching Permit2's on-chain\n // DOMAIN_SEPARATOR. Without it, some wallets (e.g. eth-sig-util v5+)\n // sort fields alphabetically (chainId, name, verifyingContract),\n // producing a different domain hash and an InvalidSigner revert.\n EIP712Domain: [\n { name: \"name\", type: \"string\" },\n { name: \"chainId\", type: \"uint256\" },\n { name: \"verifyingContract\", type: \"address\" },\n ],\n PermitTransferFrom: [\n { name: \"permitted\", type: \"TokenPermissions\" },\n { name: \"spender\", type: \"address\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"deadline\", type: \"uint256\" },\n ],\n TokenPermissions: [\n { name: \"token\", type: \"address\" },\n { name: \"amount\", type: \"uint256\" },\n ],\n },\n primaryType: \"PermitTransferFrom\",\n message: {\n permitted: {\n token: params.token,\n amount: amountBig.toString(),\n },\n spender: params.spender,\n nonce: nonceBig.toString(),\n deadline: deadlineBig.toString(),\n },\n };\n\n const sig = await eip1193Request({\n method: \"eth_signTypedData_v4\",\n params: [params.owner, JSON.stringify(typedData)],\n });\n\n // Sanity-check: manually compute the EIP-712 digest that Permit2 uses on-chain.\n // This is non-fatal — if recovery mismatches, we log all intermediates for debugging\n // and still proceed to the bundler so we can see if Permit2 accepts the sig on-chain.\n try {\n const TOKEN_PERMISSIONS_TYPEHASH = keccak256(\n stringToHex(\"TokenPermissions(address token,uint256 amount)\")\n );\n const PERMIT_TYPEHASH = keccak256(\n stringToHex(\n \"PermitTransferFrom(TokenPermissions permitted,address spender,uint256 nonce,uint256 deadline)TokenPermissions(address token,uint256 amount)\"\n )\n );\n const DOMAIN_TYPEHASH = keccak256(\n stringToHex(\n \"EIP712Domain(string name,uint256 chainId,address verifyingContract)\"\n )\n );\n const nameHash = keccak256(stringToHex(\"Permit2\"));\n\n const domainSeparator = keccak256(\n encodeAbiParameters(\n [\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"uint256\" },\n { type: \"address\" },\n ],\n [DOMAIN_TYPEHASH, nameHash, BigInt(params.chainId), PERMIT2]\n )\n );\n\n const tokenHash = keccak256(\n encodeAbiParameters(\n [{ type: \"bytes32\" }, { type: \"address\" }, { type: \"uint256\" }],\n [TOKEN_PERMISSIONS_TYPEHASH, params.token, amountBig]\n )\n );\n\n const structHash = keccak256(\n encodeAbiParameters(\n [\n { type: \"bytes32\" },\n { type: \"bytes32\" },\n { type: \"address\" },\n { type: \"uint256\" },\n { type: \"uint256\" },\n ],\n [PERMIT_TYPEHASH, tokenHash, params.spender, nonceBig, deadlineBig]\n )\n );\n\n const digest = keccak256(concat([\"0x1901\", domainSeparator, structHash]));\n\n const recovered = await recoverAddress({\n hash: digest,\n signature: sig as `0x${string}`,\n });\n const valid = recovered.toLowerCase() === params.owner.toLowerCase();\n\n if (!valid) {\n throw Object.assign(\n new Error(\n `Permit2: wallet signed with wrong account. ` +\n `Expected ${params.owner} but ${recovered} signed. ` +\n `Switch your wallet to account ${params.owner} and try again.`\n ),\n { code: \"PERMIT2_WRONG_SIGNER\", recovered, expected: params.owner }\n );\n }\n } catch (e) {\n if ((e as { code?: string }).code === \"PERMIT2_WRONG_SIGNER\") throw e;\n // Non-fatal: recovery check failure doesn't block the bundler submission.\n }\n\n return sig as `0x${string}`;\n}\n\nexport function encodePermitTransferFrom(\n token: `0x${string}`,\n amount: bigint,\n nonce: bigint,\n deadline: bigint,\n saAddress: `0x${string}`,\n eoaAddress: `0x${string}`,\n sig: `0x${string}`\n): `0x${string}` {\n return encodeFunctionData({\n abi: PERMIT2_ABI,\n functionName: \"permitTransferFrom\",\n args: [\n { permitted: { token, amount }, nonce, deadline },\n { to: saAddress, requestedAmount: amount },\n eoaAddress,\n sig,\n ],\n });\n}\n\nexport function encodeErc20Approve(\n spender: `0x${string}`,\n amount: bigint\n): `0x${string}` {\n return encodeFunctionData({\n abi: ERC20_APPROVE_ABI,\n functionName: \"approve\",\n args: [spender, amount],\n });\n}\n\nconst ERC20_ALLOWANCE_ABI = [\n {\n name: \"allowance\",\n type: \"function\",\n inputs: [\n { name: \"owner\", type: \"address\" },\n { name: \"spender\", type: \"address\" },\n ],\n outputs: [{ name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n },\n] as const;\n\nexport function encodeErc20Allowance(\n owner: `0x${string}`,\n spender: `0x${string}`\n): `0x${string}` {\n return encodeFunctionData({\n abi: ERC20_ALLOWANCE_ABI,\n functionName: \"allowance\",\n args: [owner, spender],\n });\n}\n\nconst ERC20_BALANCE_OF_ABI = [\n {\n name: \"balanceOf\",\n type: \"function\",\n inputs: [{ name: \"owner\", type: \"address\" }],\n outputs: [{ name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n },\n] as const;\n\nexport function encodeErc20BalanceOf(owner: `0x${string}`): `0x${string}` {\n return encodeFunctionData({\n abi: ERC20_BALANCE_OF_ABI,\n functionName: \"balanceOf\",\n args: [owner],\n });\n}\n\n// WETH9 deposit/withdraw — same ABI on every EVM chain.\nconst WETH_ABI = [\n {\n name: \"withdraw\",\n type: \"function\",\n inputs: [{ name: \"wad\", type: \"uint256\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n] as const;\n\nexport function encodeWethWithdraw(amount: bigint): `0x${string}` {\n return encodeFunctionData({\n abi: WETH_ABI,\n functionName: \"withdraw\",\n args: [amount],\n });\n}\n","import { encodeFunctionData } from \"viem\";\nimport { apiBase, jsonHeaders } from \"../core/http\";\n\n// Canonical WETH9 address per chain. OP Stack chains share the same address.\nexport const WETH_BY_CHAIN: Record<number, `0x${string}`> = {\n 1: \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\", // Ethereum\n 8453: \"0x4200000000000000000000000000000000000006\", // Base\n 10: \"0x4200000000000000000000000000000000000006\", // Optimism\n 42161: \"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1\", // Arbitrum One\n 137: \"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619\", // Polygon (WETH)\n 43114: \"0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB\", // Avalanche (WETH.e)\n};\n\n// Uniswap V3 SwapRouter02 addresses. Base has a distinct address from the other chains.\nexport const UNISWAP_V3_ROUTER: Record<number, `0x${string}`> = {\n 1: \"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45\", // Ethereum\n 8453: \"0x2626664c2603336E57B271c5C0b26F421741e481\", // Base\n 10: \"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45\", // Optimism\n 42161: \"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45\", // Arbitrum One\n 137: \"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45\", // Polygon\n 43114: \"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45\", // Avalanche\n};\n\n// Default pool fee tier (0.3%). Use 500 (0.05%) for stable/ETH pairs if known\n// to have deeper liquidity, but 3000 is the safest cross-chain default.\nexport const DEFAULT_POOL_FEE = 3000 as const;\n\nconst SWAP_ROUTER_ABI = [\n {\n name: \"exactOutputSingle\",\n type: \"function\",\n inputs: [\n {\n name: \"params\",\n type: \"tuple\",\n components: [\n { name: \"tokenIn\", type: \"address\" },\n { name: \"tokenOut\", type: \"address\" },\n { name: \"fee\", type: \"uint24\" },\n { name: \"recipient\", type: \"address\" },\n { name: \"amountOut\", type: \"uint256\" },\n { name: \"amountInMaximum\", type: \"uint256\" },\n { name: \"sqrtPriceLimitX96\", type: \"uint160\" },\n ],\n },\n ],\n outputs: [{ name: \"amountIn\", type: \"uint256\" }],\n stateMutability: \"payable\",\n },\n] as const;\n\n// Encodes a Uniswap V3 SwapRouter02 exactOutputSingle call.\n// The router pulls at most amountInMaximum of tokenIn from the caller and\n// delivers exactly amountOut of tokenOut to recipient. Unused allowance is\n// not consumed — no sweepToken needed for ERC-20 inputs.\nexport function encodeUniswapExactOutputSingle(\n tokenIn: `0x${string}`,\n tokenOut: `0x${string}`,\n fee: number,\n recipient: `0x${string}`,\n amountOut: bigint,\n amountInMaximum: bigint\n): `0x${string}` {\n return encodeFunctionData({\n abi: SWAP_ROUTER_ABI,\n functionName: \"exactOutputSingle\",\n args: [\n {\n tokenIn,\n tokenOut,\n fee,\n recipient,\n amountOut,\n amountInMaximum,\n sqrtPriceLimitX96: 0n,\n },\n ],\n });\n}\n\n// Fetches the current native token (ETH) price from the Trustware backend and returns\n// the maximum from-token amount needed to cover valueWei of relay fee (25% buffer).\n//\n// Primary path: uses fromAmountUSD from the route estimate (no extra request needed).\n// Fallback path: when fromAmountUSD is absent, fetches the from-token price from\n// the backend using the token contract address and decimals.\n//\n// Formula: amountInMaximum = (valueWei / 1e18 * ethPriceUSD) * (tokenUnitsPerDollar) * 1.25\n//\n// Returns 0n if price data is unavailable, which the caller should treat as an error.\nexport async function estimateRelayFeeInToken(\n valueWei: bigint,\n fromAmountWei: bigint,\n fromAmountUSD: string | undefined,\n chainId?: number,\n fromToken?: string,\n fromDecimals?: number\n): Promise<bigint> {\n if (fromAmountWei === 0n || valueWei === 0n) return 0n;\n\n const cid = chainId ?? 8453;\n\n // Determine token units per dollar — either from the route estimate or by\n // fetching the token price directly from the backend.\n let tokenUnitsPerDollar: number;\n\n const fromUSD = parseFloat(fromAmountUSD ?? \"\");\n if (isFinite(fromUSD) && fromUSD > 0) {\n tokenUnitsPerDollar = Number(fromAmountWei) / fromUSD;\n } else if (fromToken && fromDecimals !== undefined) {\n try {\n const resp = await fetch(\n `${apiBase()}/v1/price/token?chainId=${cid}&address=${fromToken}`,\n { headers: jsonHeaders() }\n );\n if (!resp.ok) throw new Error(`token price HTTP ${resp.status}`);\n const json = (await resp.json()) as { data?: { priceUSD?: string } };\n const tokenPriceUSD = parseFloat(json.data?.priceUSD ?? \"0\");\n if (tokenPriceUSD <= 0) throw new Error(\"zero token price\");\n // CoinGecko returns price per full token, so scale by decimals.\n tokenUnitsPerDollar = Math.pow(10, fromDecimals) / tokenPriceUSD;\n } catch {\n return 0n;\n }\n } else {\n return 0n;\n }\n\n try {\n const resp = await fetch(`${apiBase()}/v1/price/native?chainId=${cid}`, {\n headers: jsonHeaders(),\n });\n if (!resp.ok) throw new Error(`native price HTTP ${resp.status}`);\n const json = (await resp.json()) as { data?: { priceUSD?: string } };\n const ethPriceUSD = parseFloat(json.data?.priceUSD ?? \"0\");\n if (ethPriceUSD <= 0) throw new Error(\"zero ETH price\");\n\n const relayFeeUSD = (Number(valueWei) / 1e18) * ethPriceUSD;\n const amountIn = Math.ceil(relayFeeUSD * tokenUnitsPerDollar * 1.25);\n\n return BigInt(amountIn);\n } catch {\n return 0n;\n }\n}\n","import type { Chain } from \"viem\";\nimport { submitReceipt } from \"../core/routes\";\nimport type { BuildRouteResult } from \"../types\";\nimport { createTrustwareSmartAccountClient } from \"./client\";\nimport { isPaymasterUnavailable, extractFeeRequirement } from \"./fee-utils\";\nimport {\n PERMIT2,\n randomPermit2Nonce,\n signPermit2,\n encodePermitTransferFrom,\n encodeErc20Approve,\n encodeErc20Allowance,\n encodeErc20BalanceOf,\n encodeWethWithdraw,\n} from \"./permit2\";\nimport {\n WETH_BY_CHAIN,\n UNISWAP_V3_ROUTER,\n DEFAULT_POOL_FEE,\n encodeUniswapExactOutputSingle,\n estimateRelayFeeInToken,\n} from \"./uniswap\";\n\nconst NATIVE_ADDRS = new Set([\n \"0x0000000000000000000000000000000000000000\",\n \"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\",\n]);\n\nfunction isNativeToken(addr: string): boolean {\n return NATIVE_ADDRS.has(addr.toLowerCase());\n}\n\ntype Eip1193Request = (args: {\n method: string;\n params?: object | unknown[];\n}) => Promise<unknown>;\n\n// Permits Permit2 to pull `token` from `owner` up to max uint256 if the current\n// allowance is below `requiredAmount`. Sends a regular EOA transaction (not a\n// UserOp — the SA cannot sign on behalf of the EOA) and waits for confirmation.\nasync function ensurePermit2Allowance(\n eip1193Request: Eip1193Request,\n owner: `0x${string}`,\n token: `0x${string}`,\n requiredAmount: bigint | string\n): Promise<void> {\n const required = BigInt(requiredAmount as string | bigint);\n\n const allowanceCalldata = encodeErc20Allowance(owner, PERMIT2);\n const raw = (await eip1193Request({\n method: \"eth_call\",\n params: [{ to: token, data: allowanceCalldata }, \"latest\"],\n })) as string;\n\n const currentAllowance = raw && raw !== \"0x\" ? BigInt(raw) : 0n;\n console.debug(\"[send] PERMIT2 allowance\", {\n token,\n currentAllowance: currentAllowance.toString(),\n required: required.toString(),\n });\n if (currentAllowance >= required) return;\n\n console.debug(\"[send] requesting PERMIT2 max approval from EOA\", {\n owner,\n token,\n });\n const approveCalldata = encodeErc20Approve(\n PERMIT2,\n BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\")\n );\n const txHash = (await eip1193Request({\n method: \"eth_sendTransaction\",\n params: [{ from: owner, to: token, data: approveCalldata }],\n })) as string;\n\n console.debug(\"[send] waiting for PERMIT2 approval tx\", { txHash });\n await waitForTransaction(eip1193Request, txHash);\n console.debug(\"[send] PERMIT2 approval confirmed\", { txHash });\n}\n\nasync function waitForTransaction(\n eip1193Request: Eip1193Request,\n txHash: string,\n timeoutMs = 120_000\n): Promise<void> {\n const deadline = Date.now() + timeoutMs;\n while (Date.now() < deadline) {\n const receipt = (await eip1193Request({\n method: \"eth_getTransactionReceipt\",\n params: [txHash],\n })) as { status?: string } | null;\n if (receipt !== null) {\n if (receipt.status === \"0x0\")\n throw new Error(`Approval transaction reverted: ${txHash}`);\n return;\n }\n await new Promise((resolve) => setTimeout(resolve, 2000));\n }\n throw new Error(`Approval transaction confirmation timeout: ${txHash}`);\n}\n\nexport type SendRouteAsUserOperationParams = {\n route: BuildRouteResult;\n fromToken: string;\n fromAmountWei: bigint;\n /** Token decimals for the from-token (e.g. 6 for USDC). Used for relay fee estimation when\n * the route's step metadata doesn't include it. Omit only for native/WETH routes. */\n fromDecimals?: number;\n eoaAddress: `0x${string}`;\n chainId: number;\n viemChain: Chain;\n eip1193Request: Eip1193Request;\n};\n\nexport type SendRouteAsUserOperationResult = {\n userOpHash: string;\n /** On-chain transaction hash. Populated once the UserOp lands in a block; undefined if\n * the inclusion wait timed out (the UserOp may still land later). */\n txHash?: string;\n intentId: string;\n};\n\nexport async function sendRouteAsUserOperation(\n params: SendRouteAsUserOperationParams\n): Promise<SendRouteAsUserOperationResult> {\n const {\n route,\n fromToken,\n fromAmountWei,\n fromDecimals: callerFromDecimals,\n chainId,\n viemChain,\n eip1193Request,\n } = params;\n const { txReq, intentId } = route;\n\n const target = (txReq.to ?? txReq.target) as `0x${string}` | undefined;\n if (!txReq?.data || !target) {\n throw new Error(\"Route is missing transaction data or target address\");\n }\n\n const callData = txReq.data as `0x${string}`;\n const value = txReq.value ? BigInt(txReq.value) : 0n;\n\n const paymasterAddress = (route.sponsorship?.paymaster ??\n \"\") as `0x${string}`;\n if (!paymasterAddress)\n throw new Error(\"Route sponsorship is missing paymaster address\");\n\n // Derive the EOA from the wallet provider rather than trusting the caller's\n // walletAddress — it may be stale if the user switched accounts after connect.\n // All signing, SA derivation, and Permit2 owner must use the same key.\n const walletAccounts = (await eip1193Request({\n method: \"eth_accounts\",\n })) as string[];\n if (!walletAccounts?.[0])\n throw new Error(\"No connected wallet account available\");\n const eoaAddress = walletAccounts[0].toLowerCase() as `0x${string}`;\n\n const walletChainHex = (await eip1193Request({\n method: \"eth_chainId\",\n })) as string;\n const walletChainId = parseInt(walletChainHex, 16);\n if (walletChainId !== chainId) {\n throw Object.assign(\n new Error(\n `Wrong network: wallet is on chain ${walletChainId}, route requires chain ${chainId}. Switch your wallet to the correct network and try again.`\n ),\n { code: \"WRONG_CHAIN\", walletChainId, requiredChainId: chainId }\n );\n }\n\n const { client, getSponsorshipRequestId } =\n await createTrustwareSmartAccountClient(\n eoaAddress,\n chainId,\n viemChain,\n eip1193Request,\n paymasterAddress\n );\n const saAddress = client.account.address;\n console.debug(\"[send] saAddress:\", saAddress, \"eoaAddress:\", eoaAddress);\n\n // Detect first-time deployment — factory will be included in the UO, so\n // verificationGasLimit and callGasLimit need more headroom.\n const saCode = (await eip1193Request({\n method: \"eth_getCode\",\n params: [saAddress, \"latest\"],\n })) as string;\n const isNewAccount = !saCode || saCode === \"0x\";\n if (isNewAccount)\n console.debug(\n \"[send] new account — SA factory deployment will be included in UO\"\n );\n\n type BatchCall = {\n target: `0x${string}`;\n data: `0x${string}`;\n value?: bigint;\n };\n let batch: BatchCall[];\n\n if (isNativeToken(fromToken)) {\n // Native token route: no Permit2 needed. Pass value directly.\n batch = [{ target, data: callData, value }];\n } else {\n // ERC-20 route: pull tokens from EOA via Permit2 SignatureTransfer, then execute.\n const token = fromToken as `0x${string}`;\n const weth = WETH_BY_CHAIN[chainId];\n const swapRouter = UNISWAP_V3_ROUTER[chainId];\n\n // --- Relay fee strategy (Axelar requires native ETH as msg.value) ---\n // When the route has a non-zero relay fee and the SA doesn't already hold enough ETH,\n // we cover it atomically inside the UserOp batch by swapping a slice of the from-token\n // into ETH. No extra user signature is needed — only the single Permit2 sig below.\n //\n // Special case: if the from-token IS WETH we skip the swap and withdraw directly.\n //\n // The Permit2 amount is expanded to fromAmountWei + amountInMaximum so the SA\n // receives enough tokens to both fund the swap and pay the bridge.\n type RelayFeeStrategy = \"none\" | \"weth-withdraw\" | \"swap\";\n let relayFeeStrategy: RelayFeeStrategy = \"none\";\n let amountInMaximum = 0n;\n\n if (value > 0n) {\n const saBalHex = (await eip1193Request({\n method: \"eth_getBalance\",\n params: [saAddress, \"latest\"],\n })) as string;\n const saEthBal = BigInt(saBalHex as string);\n\n console.debug(\"[send] relay fee check\", {\n value: value.toString(),\n saEthBal: saEthBal.toString(),\n });\n\n if (saEthBal >= value) {\n // SA already holds enough ETH from a prior refund or top-up — nothing extra needed.\n console.debug(\"[send] SA has enough ETH for relay fee\");\n } else if (weth && token.toLowerCase() === weth.toLowerCase()) {\n // from-token IS WETH: pull value extra and withdraw directly — no DEX needed.\n amountInMaximum = value;\n relayFeeStrategy = \"weth-withdraw\";\n console.debug(\"[send] relay fee via WETH withdraw\", {\n amountInMaximum: value.toString(),\n });\n } else if (weth && swapRouter) {\n // Swap a slice of the from-token → WETH → ETH inside the UserOp.\n // Prefer caller-supplied decimals (most accurate), then fall back to route metadata.\n const fromDecimals: number =\n callerFromDecimals ??\n (\n route.route?.steps?.[0] as\n | { action?: { fromToken?: { decimals?: number } } }\n | undefined\n )?.action?.fromToken?.decimals ??\n (() => {\n throw Object.assign(\n new Error(\n `Cannot estimate relay fee: token decimals unavailable for ${token}. ` +\n \"Provide fromDecimals in the route params.\"\n ),\n { code: \"MISSING_TOKEN_DECIMALS\", tokenAddress: token }\n );\n })();\n amountInMaximum = await estimateRelayFeeInToken(\n value,\n fromAmountWei,\n route.finalExchangeRate.fromAmountUSD,\n chainId,\n token,\n fromDecimals\n );\n if (amountInMaximum === 0n) {\n throw Object.assign(\n new Error(\n \"Cannot estimate relay fee token amount — ETH price unavailable. Ensure the smart account has native ETH for the bridge relay fee.\"\n ),\n { code: \"RELAY_FEE_ESTIMATE_FAILED\" }\n );\n }\n relayFeeStrategy = \"swap\";\n console.debug(\"[send] relay fee via in-batch swap\", {\n swapRouter,\n weth,\n amountInMaximum: amountInMaximum.toString(),\n valueWei: value.toString(),\n });\n } else {\n throw Object.assign(\n new Error(\n `Chain ${chainId} has no configured swap router. Ensure the smart account has native ETH for the bridge relay fee.`\n ),\n { code: \"NO_SWAP_ROUTER\" }\n );\n }\n }\n\n // Total Permit2 amount includes the bridge amount plus any tokens needed for the relay fee swap.\n const totalPermit2Amount = fromAmountWei + amountInMaximum;\n\n // Check the SA's existing token balance. Refunds from failed swaps/bridges land in the SA,\n // so on a retry the SA may already hold some (or all) of what we need. Only pull the shortfall\n // from the EOA — avoids a redundant EOA approval tx and prevents draining more than necessary.\n const saTokenBalHex = (await eip1193Request({\n method: \"eth_call\",\n params: [{ to: token, data: encodeErc20BalanceOf(saAddress) }, \"latest\"],\n })) as string;\n const saTokenBalance =\n saTokenBalHex && saTokenBalHex !== \"0x\" ? BigInt(saTokenBalHex) : 0n;\n const permitNeeded =\n totalPermit2Amount > saTokenBalance\n ? totalPermit2Amount - saTokenBalance\n : 0n;\n console.debug(\"[send] SA token balance check\", {\n token,\n saTokenBalance: saTokenBalance.toString(),\n totalPermit2Amount: totalPermit2Amount.toString(),\n permitNeeded: permitNeeded.toString(),\n });\n\n // Build batch: [permit2 pull if needed, relay fee swap (if needed), bridge approve, bridge call]\n batch = [];\n\n if (permitNeeded > 0n) {\n await ensurePermit2Allowance(\n eip1193Request,\n eoaAddress,\n token,\n permitNeeded\n );\n\n const deadline = BigInt(Math.floor(Date.now() / 1000) + 1800); // 30-minute window\n const nonce = randomPermit2Nonce();\n\n console.debug(\"[send] permit2 params\", {\n token,\n amount: permitNeeded.toString(),\n nonce: \"0x\" + nonce.toString(16),\n deadline: \"0x\" + deadline.toString(16),\n spender: saAddress,\n owner: eoaAddress,\n });\n\n const sig = await signPermit2(eip1193Request, {\n chainId,\n token,\n amount: permitNeeded,\n spender: saAddress,\n nonce,\n deadline,\n owner: eoaAddress,\n });\n\n batch.push({\n target: PERMIT2,\n data: encodePermitTransferFrom(\n token,\n permitNeeded,\n nonce,\n deadline,\n saAddress,\n eoaAddress,\n sig\n ),\n });\n } else {\n console.debug(\n \"[send] SA already holds sufficient token balance — skipping Permit2 pull\"\n );\n }\n\n if (relayFeeStrategy === \"weth-withdraw\") {\n // from-token is WETH: withdraw exactly value wei to convert to ETH.\n batch.push({ target: weth!, data: encodeWethWithdraw(value) });\n } else if (relayFeeStrategy === \"swap\") {\n // Swap amountInMaximum of from-token → exactly value WETH, then unwrap to ETH.\n // exactOutputSingle only takes what it needs (≤ amountInMaximum), so the SA\n // retains any unused from-tokens for the bridge call.\n batch.push(\n {\n target: token,\n data: encodeErc20Approve(swapRouter!, amountInMaximum),\n },\n {\n target: swapRouter!,\n data: encodeUniswapExactOutputSingle(\n token,\n weth!,\n DEFAULT_POOL_FEE,\n saAddress,\n value,\n amountInMaximum\n ),\n },\n { target: weth!, data: encodeWethWithdraw(value) }\n );\n }\n\n batch.push(\n { target: token, data: encodeErc20Approve(target, fromAmountWei) },\n { target, data: callData, value }\n );\n }\n\n // Bundler enforces a verificationGasLimit efficiency floor: actual_preOpGas / limit ≥ 0.4.\n // That means the multiplier must be ≤ 1/0.4 = 2.5×. We use 2× (efficiency ≈ 50%) for all\n // accounts — this holds true regardless of whether the account is new (factory deploy adds\n // gas, but Account Kit's estimator captures that; ratio stays the same). Using 3× violates\n // the floor and is rejected with \"-32602 efficiency too low\" before simulation even runs.\n // callGasLimit uses 2× for new accounts because first-time storage slot writes cost more;\n // preVerificationGas gets a modest 20% pad for calldata variance.\n const baseOverrides = {\n verificationGasLimit: { multiplier: 2 },\n callGasLimit: { multiplier: isNewAccount ? 2 : 1.5 },\n preVerificationGas: { multiplier: 1.2 },\n };\n\n // Route bundler-specific RPC calls through the client's transport (not the wallet's\n // eip1193 — MetaMask doesn't support ERC-4337 bundler methods).\n type BundlerClient = {\n request: (args: { method: string; params: unknown[] }) => Promise<unknown>;\n };\n const bundlerReq = (method: string, params: unknown[] = []) =>\n (client as unknown as BundlerClient).request({ method, params });\n\n // Fetch the fast-tier fee from rundler right before each send attempt so we always\n // use fresh fees (base fee moves block-to-block on L2). Alchemy explicitly recommends\n // calling this before every eth_sendUserOperation — stale fees are the primary cause\n // of pool-accept / builder-reject ghost UOs. Fast tier: 2× base fee, 1.5× priority.\n // Returns undefined on failure so callers fall back to Account Kit's own estimation.\n type GasTier = { maxFeePerGas: string; maxPriorityFeePerGas: string };\n const fetchFreshFees = async (): Promise<\n { maxFeePerGas: bigint; maxPriorityFeePerGas: bigint } | undefined\n > => {\n try {\n const gasPrice = (await bundlerReq(\n \"rundler_getUserOperationGasPrice\"\n )) as { slow?: GasTier; standard?: GasTier; fast?: GasTier } | null;\n const tier = gasPrice?.fast ?? gasPrice?.standard ?? gasPrice?.slow;\n if (tier?.maxFeePerGas && tier?.maxPriorityFeePerGas) {\n return {\n maxFeePerGas: BigInt(tier.maxFeePerGas) * 2n,\n maxPriorityFeePerGas: BigInt(tier.maxPriorityFeePerGas) * 2n,\n };\n }\n } catch {\n /* non-fatal */\n }\n return undefined;\n };\n\n // Send loop (max 5 attempts). Handles:\n // 1. -32602 \"replacement underpriced\": a prior UO is stuck in the mempool with the same nonce.\n // Bundler requires >110% of the stuck op's fees. We use 112% to clear the floor.\n // 2. -32000 \"precheck failed: maxFeePerGas must be at least X\": exact bundler floor.\n // We use 101% (tiny rounding buffer only).\n // 3. PAYMASTER_UNAVAILABLE: transient sign pipeline timeout — retry after 2s, fresh fees.\n // Gas price is re-fetched fresh on every non-fee-error attempt (Alchemy's recommendation).\n let result: Awaited<ReturnType<typeof client.sendUserOperation>>;\n let nextFee: { maxFee: bigint; maxPriority: bigint } | null = null;\n let lastErr: unknown;\n for (let attempt = 0; attempt < 5; attempt++) {\n try {\n let feeOverrides:\n | { maxFeePerGas: bigint; maxPriorityFeePerGas: bigint }\n | undefined;\n if (nextFee !== null) {\n // Fee error on last attempt — use the calculated required fee directly.\n feeOverrides = {\n maxFeePerGas: nextFee.maxFee,\n maxPriorityFeePerGas: nextFee.maxPriority,\n };\n } else {\n // First attempt or paymaster retry — fetch fresh fees from the bundler.\n feeOverrides = await fetchFreshFees();\n console.debug(\n `[send] attempt ${attempt} fresh fees`,\n feeOverrides\n ? {\n maxFeePerGas: feeOverrides.maxFeePerGas.toString(),\n maxPriorityFeePerGas:\n feeOverrides.maxPriorityFeePerGas.toString(),\n }\n : \"unavailable — using AK estimation\"\n );\n }\n const overrides = feeOverrides\n ? { ...baseOverrides, ...feeOverrides }\n : baseOverrides;\n result = await client.sendUserOperation({ uo: batch, overrides });\n lastErr = null;\n break;\n } catch (err) {\n lastErr = err;\n\n if (isPaymasterUnavailable(err)) {\n console.debug(\n `[send] attempt ${attempt} paymaster unavailable (transient), retrying in 2s`\n );\n await new Promise((r) => setTimeout(r, 2000));\n nextFee = null; // trigger fresh fee fetch on next attempt\n continue;\n }\n\n const req = extractFeeRequirement(err);\n if (!req) throw err;\n\n // Anchor next fee on max(bundler-reported floor, what we just sent) then apply the\n // minimum bump the protocol requires for each error type.\n const bumpNumerator = req.isReplacement ? 112n : 101n;\n const prevFee: bigint = nextFee?.maxFee ?? 0n;\n const prevPri: bigint = nextFee?.maxPriority ?? 0n;\n nextFee = {\n maxFee:\n ((req.minFee > prevFee ? req.minFee : prevFee) * bumpNumerator) /\n 100n,\n maxPriority:\n ((req.minPriorityFee > prevPri ? req.minPriorityFee : prevPri) *\n bumpNumerator) /\n 100n,\n };\n console.debug(\n `[send] attempt ${attempt} fee rejection (isReplacement=${req.isReplacement}) — next fees`,\n {\n maxFee: nextFee.maxFee.toString(),\n maxPriority: nextFee.maxPriority.toString(),\n }\n );\n }\n }\n if (lastErr) throw lastErr;\n result = result!;\n\n // Poll for receipt via the bundler transport (NOT eip1193 — wallet providers don't support\n // eth_getUserOperationReceipt). Alchemy's builder drops ghost ops immediately; accepted ops\n // land within 2-5 seconds on Base. We poll every 3s for up to 45s, then give up and throw\n // USEROP_NOT_INCLUDED — this is far faster than Account Kit's 60-100s wait and avoids the\n // \"4 polls then connection timeout\" pattern that comes from its internal polling loop.\n const userOpHash = result.hash as string;\n let txHash: string | undefined;\n {\n const pollInterval = 3_000;\n const deadline = Date.now() + 45_000;\n while (Date.now() < deadline) {\n try {\n const r = (await bundlerReq(\"eth_getUserOperationReceipt\", [\n userOpHash,\n ])) as { receipt?: { transactionHash?: string } } | null;\n if (r?.receipt?.transactionHash) {\n txHash = r.receipt.transactionHash;\n break;\n }\n } catch {\n /* bundler hiccup — keep polling */\n }\n const remaining = deadline - Date.now();\n if (remaining <= 0) break;\n await new Promise((res) =>\n setTimeout(res, Math.min(pollInterval, remaining))\n );\n }\n }\n\n if (!txHash) {\n // Pool accepted the UO (we got a hash) but the builder dropped it — common when maxFeePerGas\n // is below the builder's inclusion floor even after pool acceptance. Do NOT submit using the\n // userOpHash as txHash: Squid/LiFi/Axelar return 404 for a userOpHash.\n throw Object.assign(\n new Error(\n \"Transaction was submitted but not included on-chain. The operation was likely dropped by the bundler — please try again.\"\n ),\n { code: \"USEROP_NOT_INCLUDED\", userOpHash }\n );\n }\n console.debug(\"[send] UserOp included\", { userOpHash, txHash });\n\n await submitReceipt(intentId, txHash!, getSponsorshipRequestId());\n\n return { userOpHash, txHash: txHash!, intentId };\n}\n","export { createTrustwareSmartAccountClient } from \"./client\";\nexport { sendRouteAsUserOperation } from \"./send\";\nexport type {\n SendRouteAsUserOperationParams,\n SendRouteAsUserOperationResult,\n} from \"./send\";\nexport { PERMIT2, randomPermit2Nonce } from \"./permit2\";\n","export * from \"./smart-account/index\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAa;AAAb;;;AAAO,IAAM,mBAAmB;MAC9B;QACE,QAAQ;UACN;YACE,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,QAAQ;UACN;YACE,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,QAAQ;UACN;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,QAAQ;UACN;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,QAAQ;UACN;YACE,YAAY;cACV;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,YAAY;cACV;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,YAAY;cACV;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,YAAY;cACV;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,QAAQ;UACN;YACE,YAAY;cACV;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,YAAY;cACV;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,YAAY;cACV;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,YAAY;cACV;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,YAAY;cACV;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,YAAY;kBACV;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;;gBAGV,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ,CAAA;QACR,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,QAAQ,CAAA;QACR,MAAM;QACN,SAAS;UACP;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,iBAAiB;QACjB,MAAM;;MAER;QACE,QAAQ;UACN;YACE,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,SAAS,CAAA;QACT,iBAAiB;QACjB,MAAM;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;QACE,QAAQ;UACN;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,SAAS,CAAA;QACT,iBAAiB;QACjB,MAAM;;MAER;QACE,QAAQ;UACN;YACE,YAAY;cACV;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,SAAS;UACP;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,iBAAiB;QACjB,MAAM;;MAER;QACE,QAAQ;UACN;YACE,YAAY;cACV;gBACE,YAAY;kBACV;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;;gBAGV,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,SAAS,CAAA;QACT,iBAAiB;QACjB,MAAM;;MAER;QACE,QAAQ;UACN;YACE,YAAY;cACV;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,SAAS,CAAA;QACT,iBAAiB;QACjB,MAAM;;MAER;QACE,QAAQ;UACN;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,SAAS,CAAA;QACT,iBAAiB;QACjB,MAAM;;MAER;QACE,QAAQ;UACN;YACE,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,YAAY;cACV;gBACE,YAAY;kBACV;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;kBAER;oBACE,cAAc;oBACd,MAAM;oBACN,MAAM;;;gBAGV,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;;YAGV,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,SAAS;UACP;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,iBAAiB;QACjB,MAAM;;MAER;QACE,QAAQ;UACN;YACE,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,SAAS;UACP;YACE,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,iBAAiB;QACjB,MAAM;;MAER;QACE,QAAQ;UACN;YACE,YAAY;cACV;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM;;cAER;gBACE,cAAc;gBACd,MAAM;gBACN,MAAM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M;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;;QAGV,MAAM;QACN,MAAM;;MAER;QACE,WAAW;QACX,QAAQ;UACN;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER;YACE,SAAS;YACT,cAAc;YACd,MAAM;YACN,MAAM;;UAER,EAAE,SAAS,OAAO,cAAc,QAAQ,MAAM,WAAW,MAAM,OAAM;U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A,uDACA,uDACA,8DACA,mDACA,oDAIA,2CACA,wDACA,kDACA,kDACA,6DAIA,6DACA,mDACA,8DACA,4DACA,8DACA,0DACA,4DACA,gEAIA,4DAIA,kDACA,qDACA,mDACA,0DACA,uDAIA,sDACA,kDACA,gDAKA,0CACA,gDACA,mDACA,2DACA,uDACA,yDACA,qDACA,uDACA,6DACA,8DACA,wDACA,yDACA,sDACA,iEACA,iEACA,0DACA,yDACA,0DACA,sDACA,sDACA,0DACA,4DACA,yDACA,wDACA,6DACA,gEACA,yCACA,gDACA,2DACA,4DACA,qEACA,yDACA,6CACA,kDACA,yDACA,2DACA,gDACA,kDACA,gEACA,uDACA,oEACA,6DACA,4DACA,4CACA,sDACA,iDACA,0DACA,wDACA,sDACA,qDACA,gDACA,yEACA,wDACA,wEACA,8EAIA,4DACA,gDACA,+CACA,yDACA,uDACA,mDACA,6DACA,2DACA,2DACA,wEACA,0DACA,sDAIA,yDACA,8EACA,+EACA,wEACA,yDACA,qEACA,8DACA,yDACA,yDACA,2DACA,wEACA,oDACA,2DACA,wEACA,oDACA,4DACA,4DACA,gEAIA,6DACA,kEACA,wDACA,oDACA,wDACA,sFACA,wFACA,sFACA,kEACA,+CACA,4CACA,8CACA,wDACA,2EACA,8FACA,8DACA,gEACA,wDACA,6DACA,6EACA,+CACA,yDACA,oEAKA,0CACA,iDACA,uDACA,oDACA,4DACA,6DACA,0DACA,oDACA,sDAEA,sDACA,4DACA,wDACA,oDACA,gEACA,mDACA,sDACA,6DACA,oEACA,sDACA,2DACA,sEACA,wEACA,yDACA,iEACA,qEACA,oEACA,qEACA,8DACA,mEACA,wEACA,wDACA,8DACA,yEACA,0EACA,wDACA,2EACA,yDAIA,kEACA,kEACA,yDACA,qEACA,gFACA,kFACA,8DACA,8DACA,qEACA,8EAIA,sDACA,2CACA,6CACA,gDACA,mEACA,2DACA,yDACA,+CACA,uDACA,2DACA,4CACA,2CACA,+CACA,qDACA,2CACA,qDACA,gEACA,kDACA,wCACA,oEACA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,SAAS;AACjD;AApkBA,IAuBM;AAvBN;AAAA;AAAA;AACA;AAEA,IAAAC;AACA;AACA;AAUA;AAQA,IAAM,eAAe,oBAAI,IAAI;AAAA,MAC3B;AAAA,MACA;AAAA,IACF,CAAC;AAAA;AAAA;;;AC1BD;AAAA;AAAA;AAAA,IAAAC;AACA;AAKA;AAAA;AAAA;;;ACNA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAC,sBAAA;AAAA;AAAA;AAAA;AAAA;","names":["ViemBaseError","import_viem","import_viem","import_viem","init_bundlerClient","LogLevel","import_viem","signMessage","signTypedData","import_viem","init_bundlerClient","DeploymentState","import_viem","util","e","objectUtil","errorUtil","errorMap","r","ctx","result","shape","issues","elements","e","processed","base","ZodFirstPartyTypeKind","import_viem","import_viem","RoundingMode","base","import_viem","import_viem","init_utils","import_viem","init_utils","import_viem","init_utils","uo","overrides","init_utils","init_utils","import_viem","err","import_viem","init_utils","init_utils","e","e","e","init_sendUserOperation","init_sendUserOperation","import_viem","init_sendUserOperation","nonce","import_viem","init_utils","import_viem","init_schema","init_utils","init_utils","init_utils","import_viem","init_utils","import_viem","params","data","address","import_viem","init_smartAccountClient","init_bundlerClient","init_schema","import_viem","packUserOperation","__default","init__","import_viem","init_entrypoint","init__","__default","paymasterAndData","import_viem","init_utils","import_viem","import_viem","init_sendUserOperation","init_bundlerClient","init_schema","init_smartAccountClient","init_entrypoint","init_utils","import_viem","init_utils","version","type","import_viem","init_base","init_utils","SignatureType","import_viem","init_utils","import_viem","init_account","init_utils","init_base","init_schema","VERSION","init_version","VERSION","import_viem","init_schema","init_version","import_viem","import_chains","arbitrum","arbitrumGoerli","arbitrumSepolia","vab","vabg","vabs","vgo","vmain","vop","vopg","vops","vsep","vbase","vbaseg","vbases","vbsc","vbsct","vpgm","vpga","vpg","vfrax","vzora","vzoras","vwcs","vwc","vhyperliquid","vhyperliquidEvmTestnet","vCronos","vCronosTesnet","init_esm","init_esm","init_version","VERSION","getDefaultUserOperationFeeOptions","init_defaults","arbitrum","arbitrumGoerli","arbitrumSepolia","init_feeEstimator","import_viem","arbitrumGoerli","arbitrum","arbitrumSepolia","BaseError","init_base","init_version","VERSION","init_base","BaseError","import_viem","init_feeEstimator","getDefaultUserOperationFeeOptions","import_viem","init_smartAccountClient","init_defaults","init_feeEstimator","init_smartAccountClient","import_viem","init_client","init_account","init_client","init_defaults","alphabet","base","TextDecoder","TextEncoder","isAddress","init_chains","isEvmAddress","isAddress","import_viem","init_index_node","init_chains","init_routes","init_identity","init_types","init_routes","init_identity","init_types","base","init_defaults","init_config","init_defaults","init_config","j","import_viem","init_client","e","e","import_viem","import_viem","params","init_client","init_client","init_smart_account"]}
|