@tonappchain/sdk 0.7.3-rc8 → 0.8.0-aa-alpha-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/ICrossChainLayer.sol/ICrossChainLayer.json +0 -7
  2. package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/ISettings.sol/ISettings.json +0 -7
  3. package/dist/artifacts/dev/tac/internal/artifacts/contracts/interfaces/ITokenUtils.sol/ITokenUtils.json +0 -7
  4. package/dist/artifacts/dev/tac/internal/artifacts/contracts/smart-account/interfaces/ISAFactory.sol/ISAFactory.json +0 -7
  5. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.d.ts +1 -5
  6. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ISettings.d.ts +1 -5
  7. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.d.ts +1 -5
  8. package/dist/artifacts/dev/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.d.ts +1 -5
  9. package/dist/artifacts/dev/ton/internal/build/Settings.compiled.json +1 -1
  10. package/dist/artifacts/dev/ton/internal/wrappers/Settings.d.ts +1 -0
  11. package/dist/artifacts/dev/ton/internal/wrappers/Settings.js +11 -7
  12. package/dist/artifacts/index.d.ts +5 -3
  13. package/dist/artifacts/index.js +6 -3
  14. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/ICrossChainLayer.sol/ICrossChainLayer.json +0 -7
  15. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/ISettings.sol/ISettings.json +0 -7
  16. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/interfaces/ITokenUtils.sol/ITokenUtils.json +0 -7
  17. package/dist/artifacts/mainnet/tac/internal/artifacts/contracts/smart-account/interfaces/ISAFactory.sol/ISAFactory.json +0 -7
  18. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.d.ts +1 -5
  19. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ISettings.d.ts +1 -5
  20. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.d.ts +1 -5
  21. package/dist/artifacts/mainnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.d.ts +1 -5
  22. package/dist/artifacts/mainnet/ton/internal/build/CrossChainLayer.compiled.json +1 -1
  23. package/dist/artifacts/mainnet/ton/internal/build/Executor.compiled.json +1 -1
  24. package/dist/artifacts/mainnet/ton/internal/build/JettonMinter.compiled.json +1 -1
  25. package/dist/artifacts/mainnet/ton/internal/build/JettonProxy.compiled.json +1 -1
  26. package/dist/artifacts/mainnet/ton/internal/build/JettonWallet.compiled.json +1 -1
  27. package/dist/artifacts/mainnet/ton/internal/build/NFTCollection.compiled.json +1 -1
  28. package/dist/artifacts/mainnet/ton/internal/build/NFTItem.compiled.json +1 -1
  29. package/dist/artifacts/mainnet/ton/internal/build/NFTProxy.compiled.json +1 -1
  30. package/dist/artifacts/mainnet/ton/internal/build/Settings.compiled.json +1 -1
  31. package/dist/artifacts/mainnet/ton/internal/wrappers/CrossChainLayer.d.ts +65 -6
  32. package/dist/artifacts/mainnet/ton/internal/wrappers/CrossChainLayer.js +169 -18
  33. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonMinter.d.ts +4 -2
  34. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonMinter.js +5 -3
  35. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonProxy.d.ts +9 -0
  36. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonProxy.js +11 -2
  37. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonWallet.d.ts +7 -0
  38. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonWallet.js +9 -2
  39. package/dist/artifacts/mainnet/ton/internal/wrappers/NFTCollection.d.ts +11 -1
  40. package/dist/artifacts/mainnet/ton/internal/wrappers/NFTCollection.js +17 -5
  41. package/dist/artifacts/mainnet/ton/internal/wrappers/NFTItem.d.ts +9 -1
  42. package/dist/artifacts/mainnet/ton/internal/wrappers/NFTItem.js +15 -5
  43. package/dist/artifacts/mainnet/ton/internal/wrappers/NFTProxy.d.ts +9 -1
  44. package/dist/artifacts/mainnet/ton/internal/wrappers/NFTProxy.js +16 -6
  45. package/dist/artifacts/mainnet/ton/internal/wrappers/Settings.d.ts +2 -0
  46. package/dist/artifacts/mainnet/ton/internal/wrappers/Settings.js +11 -6
  47. package/dist/artifacts/mainnet/ton/internal/wrappers/utils/CrossChainLayerPayload.d.ts +10 -0
  48. package/dist/artifacts/mainnet/ton/internal/wrappers/utils/CrossChainLayerPayload.js +24 -0
  49. package/dist/artifacts/mainnet/ton/internal/wrappers/utils/MerkleRoots.d.ts +2 -1
  50. package/dist/artifacts/mainnet/ton/internal/wrappers/utils/MerkleRoots.js +9 -1
  51. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/ICrossChainLayer.sol/ICrossChainLayer.json +0 -7
  52. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/ISettings.sol/ISettings.json +0 -7
  53. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/interfaces/ITokenUtils.sol/ITokenUtils.json +0 -7
  54. package/dist/artifacts/testnet/tac/internal/artifacts/contracts/smart-account/interfaces/ISAFactory.sol/ISAFactory.json +0 -7
  55. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ICrossChainLayer.d.ts +1 -5
  56. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ISettings.d.ts +1 -5
  57. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/interfaces/ITokenUtils.d.ts +1 -5
  58. package/dist/artifacts/testnet/tac/internal/typechain-types/contracts/smart-account/interfaces/ISAFactory.d.ts +1 -5
  59. package/dist/artifacts/testnet/ton/internal/build/Settings.compiled.json +1 -1
  60. package/dist/artifacts/testnet/ton/internal/wrappers/Settings.d.ts +1 -0
  61. package/dist/artifacts/testnet/ton/internal/wrappers/Settings.js +11 -7
  62. package/dist/src/accountAbstraction/BaseAccountAPI.d.ts +62 -0
  63. package/dist/src/accountAbstraction/BaseAccountAPI.js +163 -0
  64. package/dist/src/accountAbstraction/Ed25519.d.ts +47 -0
  65. package/dist/src/accountAbstraction/Ed25519.js +100 -0
  66. package/dist/src/accountAbstraction/HttpRpcClient.d.ts +26 -0
  67. package/dist/src/accountAbstraction/HttpRpcClient.js +45 -0
  68. package/dist/src/accountAbstraction/PaymasterAPI.d.ts +21 -0
  69. package/dist/src/accountAbstraction/PaymasterAPI.js +18 -0
  70. package/dist/src/accountAbstraction/Permit2.d.ts +37 -0
  71. package/dist/src/accountAbstraction/Permit2.js +41 -0
  72. package/dist/src/accountAbstraction/PermitFlow.d.ts +43 -0
  73. package/dist/src/accountAbstraction/PermitFlow.js +80 -0
  74. package/dist/src/accountAbstraction/TacAccountAPI.d.ts +53 -0
  75. package/dist/src/accountAbstraction/TacAccountAPI.js +84 -0
  76. package/dist/src/accountAbstraction/TacAccountSdk.d.ts +101 -0
  77. package/dist/src/accountAbstraction/TacAccountSdk.js +163 -0
  78. package/dist/src/accountAbstraction/TacERC20PaymasterAPI.d.ts +59 -0
  79. package/dist/src/accountAbstraction/TacERC20PaymasterAPI.js +88 -0
  80. package/dist/src/accountAbstraction/TransactionDetailsForUserOp.d.ts +10 -0
  81. package/dist/src/accountAbstraction/TransactionDetailsForUserOp.js +2 -0
  82. package/dist/src/accountAbstraction/abi.d.ts +3 -0
  83. package/dist/src/accountAbstraction/abi.js +32 -0
  84. package/dist/src/accountAbstraction/index.d.ts +24 -0
  85. package/dist/src/accountAbstraction/index.js +44 -0
  86. package/dist/src/accountAbstraction/internal/entryPointAbi.d.ts +1 -0
  87. package/dist/src/accountAbstraction/internal/entryPointAbi.js +16 -0
  88. package/dist/src/accountAbstraction/internal/userOp.d.ts +54 -0
  89. package/dist/src/accountAbstraction/internal/userOp.js +72 -0
  90. package/dist/src/accountAbstraction/networks.d.ts +22 -0
  91. package/dist/src/accountAbstraction/networks.js +19 -0
  92. package/dist/src/accountAbstraction/signer.d.ts +12 -0
  93. package/dist/src/accountAbstraction/signer.js +14 -0
  94. package/dist/src/adapters/RetryableContractOpener.js +5 -2
  95. package/dist/src/adapters/ToncenterV3Indexer.js +1 -1
  96. package/dist/src/assets/AssetCache.d.ts +4 -4
  97. package/dist/src/assets/AssetCache.js +11 -6
  98. package/dist/src/assets/AssetFactory.js +2 -2
  99. package/dist/src/errors/index.d.ts +1 -1
  100. package/dist/src/errors/index.js +2 -1
  101. package/dist/src/errors/instances.d.ts +1 -0
  102. package/dist/src/errors/instances.js +3 -1
  103. package/dist/src/index.d.ts +2 -0
  104. package/dist/src/index.js +4 -1
  105. package/dist/src/interfaces/IConfiguration.d.ts +2 -2
  106. package/dist/src/sdk/Artifacts.d.ts +3 -0
  107. package/dist/src/sdk/Artifacts.js +17 -0
  108. package/dist/src/sdk/Configuration.d.ts +4 -4
  109. package/dist/src/sdk/Configuration.js +3 -3
  110. package/dist/src/sdk/Consts.d.ts +0 -1
  111. package/dist/src/sdk/Consts.js +1 -2
  112. package/dist/src/sdk/LiteSequencerClient.js +2 -1
  113. package/dist/src/sdk/StartTracking.js +2 -2
  114. package/dist/src/sdk/TACTransactionManager.js +5 -5
  115. package/dist/src/sdk/TONTransactionManager.js +23 -21
  116. package/dist/src/sdk/TacExplorerClient.js +4 -3
  117. package/dist/src/sdk/TacSdk.js +2 -15
  118. package/dist/src/sdk/TxFinalizer.js +1 -1
  119. package/dist/src/sdk/Utils.js +37 -4
  120. package/dist/src/structs/Struct.d.ts +4 -4
  121. package/package.json +1 -1
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ // Minimal human-readable ABIs for TAC account-abstraction contracts. Kept in sync
3
+ // with aa-contracts#tac:
4
+ // contracts/accounts/TacAccount.sol
5
+ // contracts/accounts/TacAccountFactory.sol
6
+ // contracts/accounts/TacBaseAccount.sol (execute / executeBatch surface)
7
+ // contracts/paymaster/TacERC20Paymaster.sol (read surface for SDK clients)
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.TacERC20PaymasterABI = exports.TacAccountABI = exports.TacAccountFactoryABI = void 0;
10
+ exports.TacAccountFactoryABI = [
11
+ 'function getOrCreateAccount(bytes32 publicKey) external returns (address)',
12
+ 'function getAccountAddress(bytes32 publicKey) public view returns (address)',
13
+ ];
14
+ exports.TacAccountABI = [
15
+ // From TacBaseAccount (execute surface)
16
+ 'function execute(address target, uint256 value, bytes calldata data) external',
17
+ 'function executeBatch(tuple(address target, uint256 value, bytes data)[] calls) external',
18
+ // From IAccount + TacBaseAccount
19
+ 'function getNonce() public view returns (uint256)',
20
+ 'function getNonce(uint192 key) public view returns (uint256)',
21
+ // From TacAccount
22
+ 'function publicKey() public view returns (bytes32)',
23
+ 'function entryPoint() public view returns (address)',
24
+ ];
25
+ exports.TacERC20PaymasterABI = [
26
+ 'function token() public view returns (address)',
27
+ 'function tacPermit2() public view returns (address)',
28
+ 'function priceMarkup() public view returns (uint32)',
29
+ 'function refundPostOpCost() public view returns (uint256)',
30
+ 'function internalBalance(address account) public view returns (uint256)',
31
+ 'function getPrice() public view returns (uint192)',
32
+ ];
@@ -0,0 +1,24 @@
1
+ export { TacAccountABI, TacAccountFactoryABI, TacERC20PaymasterABI } from './abi';
2
+ export type { BaseApiParams, UserOpResult } from './BaseAccountAPI';
3
+ export { BaseAccountAPI } from './BaseAccountAPI';
4
+ export type { Ed25519Signature, Ed25519Signer, TonConnectSignedParts, TonConnectSigner } from './Ed25519';
5
+ export { buildPermitBinding, ed25519SignerFromSecretKey, packPermit2InnerSignature, packPermitBoundUserOpSignature, packRawEd25519Signature, packTonConnectPermit2InnerSignature, packTonConnectUserOpSignature, } from './Ed25519';
6
+ export { HttpRpcClient } from './HttpRpcClient';
7
+ export type { UserOperation } from './internal/userOp';
8
+ export type { AaAddresses, AaNetworkConfig } from './networks';
9
+ export { AA_NETWORKS } from './networks';
10
+ export type { PaymasterParams } from './PaymasterAPI';
11
+ export { PaymasterAPI } from './PaymasterAPI';
12
+ export type { Permit2TokenPermission, PermitBatchTransferFromInput, PermitBatchTransferFromTuple } from './Permit2';
13
+ export { buildPermitMessage, packPermitData, packPermitPaymasterData } from './Permit2';
14
+ export type { BuildPermitUserOpInput, BuildPermitUserOpInputTonConnect } from './PermitFlow';
15
+ export { buildSignedUserOpWithPermit, buildSignedUserOpWithPermitTonConnect } from './PermitFlow';
16
+ export type { AaSignerResult } from './signer';
17
+ export { aaSignerFromMnemonic } from './signer';
18
+ export type { TacAccountApiParams } from './TacAccountAPI';
19
+ export { TacAccountAPI } from './TacAccountAPI';
20
+ export type { PermitOptions, SendTx, TacAccountSdkParams, UserOpReceipt, UserOpSendResult, } from './TacAccountSdk';
21
+ export { TacAccountSdk } from './TacAccountSdk';
22
+ export type { TacERC20PaymasterApiParams } from './TacERC20PaymasterAPI';
23
+ export { packModeByte, packPaymasterAndData, TacERC20PaymasterAPI, TacPaymasterMode } from './TacERC20PaymasterAPI';
24
+ export type { TransactionDetailsForUserOp } from './TransactionDetailsForUserOp';
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ // TAC account-abstraction (ERC-4337) client — native ethers v6.
3
+ // Drive a TAC smart account from a TON Ed25519 key: build + sign UserOperations,
4
+ // send them to the bundler, and pay gas natively or in an ERC-20 via the paymaster.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TacPaymasterMode = exports.TacERC20PaymasterAPI = exports.packPaymasterAndData = exports.packModeByte = exports.TacAccountSdk = exports.TacAccountAPI = exports.aaSignerFromMnemonic = exports.buildSignedUserOpWithPermitTonConnect = exports.buildSignedUserOpWithPermit = exports.packPermitPaymasterData = exports.packPermitData = exports.buildPermitMessage = exports.PaymasterAPI = exports.AA_NETWORKS = exports.HttpRpcClient = exports.packTonConnectUserOpSignature = exports.packTonConnectPermit2InnerSignature = exports.packRawEd25519Signature = exports.packPermitBoundUserOpSignature = exports.packPermit2InnerSignature = exports.ed25519SignerFromSecretKey = exports.buildPermitBinding = exports.BaseAccountAPI = exports.TacERC20PaymasterABI = exports.TacAccountFactoryABI = exports.TacAccountABI = void 0;
7
+ var abi_1 = require("./abi");
8
+ Object.defineProperty(exports, "TacAccountABI", { enumerable: true, get: function () { return abi_1.TacAccountABI; } });
9
+ Object.defineProperty(exports, "TacAccountFactoryABI", { enumerable: true, get: function () { return abi_1.TacAccountFactoryABI; } });
10
+ Object.defineProperty(exports, "TacERC20PaymasterABI", { enumerable: true, get: function () { return abi_1.TacERC20PaymasterABI; } });
11
+ var BaseAccountAPI_1 = require("./BaseAccountAPI");
12
+ Object.defineProperty(exports, "BaseAccountAPI", { enumerable: true, get: function () { return BaseAccountAPI_1.BaseAccountAPI; } });
13
+ var Ed25519_1 = require("./Ed25519");
14
+ Object.defineProperty(exports, "buildPermitBinding", { enumerable: true, get: function () { return Ed25519_1.buildPermitBinding; } });
15
+ Object.defineProperty(exports, "ed25519SignerFromSecretKey", { enumerable: true, get: function () { return Ed25519_1.ed25519SignerFromSecretKey; } });
16
+ Object.defineProperty(exports, "packPermit2InnerSignature", { enumerable: true, get: function () { return Ed25519_1.packPermit2InnerSignature; } });
17
+ Object.defineProperty(exports, "packPermitBoundUserOpSignature", { enumerable: true, get: function () { return Ed25519_1.packPermitBoundUserOpSignature; } });
18
+ Object.defineProperty(exports, "packRawEd25519Signature", { enumerable: true, get: function () { return Ed25519_1.packRawEd25519Signature; } });
19
+ Object.defineProperty(exports, "packTonConnectPermit2InnerSignature", { enumerable: true, get: function () { return Ed25519_1.packTonConnectPermit2InnerSignature; } });
20
+ Object.defineProperty(exports, "packTonConnectUserOpSignature", { enumerable: true, get: function () { return Ed25519_1.packTonConnectUserOpSignature; } });
21
+ var HttpRpcClient_1 = require("./HttpRpcClient");
22
+ Object.defineProperty(exports, "HttpRpcClient", { enumerable: true, get: function () { return HttpRpcClient_1.HttpRpcClient; } });
23
+ var networks_1 = require("./networks");
24
+ Object.defineProperty(exports, "AA_NETWORKS", { enumerable: true, get: function () { return networks_1.AA_NETWORKS; } });
25
+ var PaymasterAPI_1 = require("./PaymasterAPI");
26
+ Object.defineProperty(exports, "PaymasterAPI", { enumerable: true, get: function () { return PaymasterAPI_1.PaymasterAPI; } });
27
+ var Permit2_1 = require("./Permit2");
28
+ Object.defineProperty(exports, "buildPermitMessage", { enumerable: true, get: function () { return Permit2_1.buildPermitMessage; } });
29
+ Object.defineProperty(exports, "packPermitData", { enumerable: true, get: function () { return Permit2_1.packPermitData; } });
30
+ Object.defineProperty(exports, "packPermitPaymasterData", { enumerable: true, get: function () { return Permit2_1.packPermitPaymasterData; } });
31
+ var PermitFlow_1 = require("./PermitFlow");
32
+ Object.defineProperty(exports, "buildSignedUserOpWithPermit", { enumerable: true, get: function () { return PermitFlow_1.buildSignedUserOpWithPermit; } });
33
+ Object.defineProperty(exports, "buildSignedUserOpWithPermitTonConnect", { enumerable: true, get: function () { return PermitFlow_1.buildSignedUserOpWithPermitTonConnect; } });
34
+ var signer_1 = require("./signer");
35
+ Object.defineProperty(exports, "aaSignerFromMnemonic", { enumerable: true, get: function () { return signer_1.aaSignerFromMnemonic; } });
36
+ var TacAccountAPI_1 = require("./TacAccountAPI");
37
+ Object.defineProperty(exports, "TacAccountAPI", { enumerable: true, get: function () { return TacAccountAPI_1.TacAccountAPI; } });
38
+ var TacAccountSdk_1 = require("./TacAccountSdk");
39
+ Object.defineProperty(exports, "TacAccountSdk", { enumerable: true, get: function () { return TacAccountSdk_1.TacAccountSdk; } });
40
+ var TacERC20PaymasterAPI_1 = require("./TacERC20PaymasterAPI");
41
+ Object.defineProperty(exports, "packModeByte", { enumerable: true, get: function () { return TacERC20PaymasterAPI_1.packModeByte; } });
42
+ Object.defineProperty(exports, "packPaymasterAndData", { enumerable: true, get: function () { return TacERC20PaymasterAPI_1.packPaymasterAndData; } });
43
+ Object.defineProperty(exports, "TacERC20PaymasterAPI", { enumerable: true, get: function () { return TacERC20PaymasterAPI_1.TacERC20PaymasterAPI; } });
44
+ Object.defineProperty(exports, "TacPaymasterMode", { enumerable: true, get: function () { return TacERC20PaymasterAPI_1.TacPaymasterMode; } });
@@ -0,0 +1 @@
1
+ export declare const IEntryPointABI: readonly ["function getUserOpHash((address sender,uint256 nonce,bytes initCode,bytes callData,bytes32 accountGasLimits,uint256 preVerificationGas,bytes32 gasFees,bytes paymasterAndData,bytes signature) userOp) view returns (bytes32)", "function getSenderAddress(bytes initCode)", "error SenderAddressResult(address sender)", "function senderCreator() view returns (address)", "function getNonce(address sender, uint192 key) view returns (uint256)", "event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed)"];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // Minimal human-readable ABI for the ERC-4337 v0.8 EntryPoint — only the surface
3
+ // the account APIs use: on-chain userOpHash, counterfactual-address probing, and
4
+ // the UserOperationEvent. Vendored so this module needs no @account-abstraction dep.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.IEntryPointABI = void 0;
7
+ exports.IEntryPointABI = [
8
+ // off-chain-matching userOpHash (avoids re-implementing EIP-712 packing in the SDK)
9
+ 'function getUserOpHash((address sender,uint256 nonce,bytes initCode,bytes callData,bytes32 accountGasLimits,uint256 preVerificationGas,bytes32 gasFees,bytes paymasterAndData,bytes signature) userOp) view returns (bytes32)',
10
+ // reverts with SenderAddressResult(sender) — used to derive an undeployed account address
11
+ 'function getSenderAddress(bytes initCode)',
12
+ 'error SenderAddressResult(address sender)',
13
+ 'function senderCreator() view returns (address)',
14
+ 'function getNonce(address sender, uint192 key) view returns (uint256)',
15
+ 'event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed)',
16
+ ];
@@ -0,0 +1,54 @@
1
+ import { BigNumberish, BytesLike } from 'ethers';
2
+ /** Unpacked UserOperation as the SDK/bundler exchange it (paymaster fields split out). */
3
+ export interface UserOperation {
4
+ sender: string;
5
+ nonce: BigNumberish;
6
+ factory?: string;
7
+ factoryData?: BytesLike;
8
+ callData: BytesLike;
9
+ callGasLimit: BigNumberish;
10
+ verificationGasLimit: BigNumberish;
11
+ preVerificationGas: BigNumberish;
12
+ maxFeePerGas: BigNumberish;
13
+ maxPriorityFeePerGas: BigNumberish;
14
+ paymaster?: string;
15
+ paymasterData?: BytesLike;
16
+ paymasterVerificationGasLimit?: BigNumberish;
17
+ paymasterPostOpGasLimit?: BigNumberish;
18
+ signature: BytesLike;
19
+ authorizationList?: unknown[];
20
+ }
21
+ /** The on-chain PackedUserOperation tuple shape (what EntryPoint.getUserOpHash consumes). */
22
+ export interface PackedUserOperation {
23
+ sender: string;
24
+ nonce: string;
25
+ initCode: string;
26
+ callData: string;
27
+ accountGasLimits: string;
28
+ preVerificationGas: string;
29
+ gasFees: string;
30
+ paymasterAndData: string;
31
+ signature: string;
32
+ }
33
+ /** initCode split, as returned by an account API for an undeployed account. */
34
+ export interface FactoryParams {
35
+ factory: string;
36
+ factoryData?: BytesLike;
37
+ }
38
+ /**
39
+ * Coerce a bytes-like field to a hex string, treating '' / null / undefined as '0x'.
40
+ * `createUnsignedUserOp` returns an unsigned op with `signature: ''`, and ethers'
41
+ * `hexlify('')` throws — so a plain `?? '0x'` (only catches null/undefined) is not enough.
42
+ */
43
+ export declare function toHexBytes(v: BytesLike | null | undefined): string;
44
+ /** Pack two 128-bit values into a single bytes32 (high128 << 128 | low128). */
45
+ export declare function packUint(high128: BigNumberish, low128: BigNumberish): string;
46
+ /** Pack the paymaster fields into the on-chain `paymasterAndData` bytes. */
47
+ export declare function packPaymasterData(paymaster: string, paymasterVerificationGasLimit: BigNumberish, postOpGasLimit: BigNumberish, paymasterData?: BytesLike): string;
48
+ /** Pack an unpacked UserOperation into the on-chain PackedUserOperation tuple. */
49
+ export declare function packUserOp(op: UserOperation): PackedUserOperation;
50
+ /**
51
+ * Recursively hex-encode a value for JSON-RPC: numeric values become minimal hex
52
+ * quantities, byte arrays become hex strings, everything else is passed through.
53
+ */
54
+ export declare function deepHexlify(obj: unknown): unknown;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ // Self-contained ERC-4337 v0.8 UserOperation types + packing helpers, ported to
3
+ // ethers v6. Vendored from @account-abstraction/utils (which is ethers v5 and
4
+ // unpublished) so the accountAbstraction module has no external AA dependency.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.toHexBytes = toHexBytes;
7
+ exports.packUint = packUint;
8
+ exports.packPaymasterData = packPaymasterData;
9
+ exports.packUserOp = packUserOp;
10
+ exports.deepHexlify = deepHexlify;
11
+ const ethers_1 = require("ethers");
12
+ /**
13
+ * Coerce a bytes-like field to a hex string, treating '' / null / undefined as '0x'.
14
+ * `createUnsignedUserOp` returns an unsigned op with `signature: ''`, and ethers'
15
+ * `hexlify('')` throws — so a plain `?? '0x'` (only catches null/undefined) is not enough.
16
+ */
17
+ function toHexBytes(v) {
18
+ return v == null || v === '' ? '0x' : (0, ethers_1.hexlify)(v);
19
+ }
20
+ /** Pack two 128-bit values into a single bytes32 (high128 << 128 | low128). */
21
+ function packUint(high128, low128) {
22
+ return (0, ethers_1.zeroPadValue)((0, ethers_1.toBeHex)(((0, ethers_1.toBigInt)(high128) << 128n) + (0, ethers_1.toBigInt)(low128)), 32);
23
+ }
24
+ /** Pack the paymaster fields into the on-chain `paymasterAndData` bytes. */
25
+ function packPaymasterData(paymaster, paymasterVerificationGasLimit, postOpGasLimit, paymasterData) {
26
+ return (0, ethers_1.concat)([paymaster, packUint(paymasterVerificationGasLimit, postOpGasLimit), toHexBytes(paymasterData)]);
27
+ }
28
+ /** Pack an unpacked UserOperation into the on-chain PackedUserOperation tuple. */
29
+ function packUserOp(op) {
30
+ let paymasterAndData = '0x';
31
+ if (op.paymaster != null) {
32
+ if (op.paymasterVerificationGasLimit == null || op.paymasterPostOpGasLimit == null) {
33
+ throw new Error('paymaster with no gas limits');
34
+ }
35
+ paymasterAndData = packPaymasterData(op.paymaster, op.paymasterVerificationGasLimit, op.paymasterPostOpGasLimit, op.paymasterData);
36
+ }
37
+ const initCode = op.factory == null ? '0x' : (0, ethers_1.concat)([op.factory, toHexBytes(op.factoryData)]);
38
+ return {
39
+ sender: op.sender,
40
+ nonce: (0, ethers_1.toBeHex)((0, ethers_1.toBigInt)(op.nonce)),
41
+ initCode,
42
+ callData: toHexBytes(op.callData),
43
+ accountGasLimits: packUint(op.verificationGasLimit, op.callGasLimit),
44
+ preVerificationGas: (0, ethers_1.toBeHex)((0, ethers_1.toBigInt)(op.preVerificationGas)),
45
+ gasFees: packUint(op.maxPriorityFeePerGas, op.maxFeePerGas),
46
+ paymasterAndData,
47
+ signature: toHexBytes(op.signature),
48
+ };
49
+ }
50
+ /**
51
+ * Recursively hex-encode a value for JSON-RPC: numeric values become minimal hex
52
+ * quantities, byte arrays become hex strings, everything else is passed through.
53
+ */
54
+ function deepHexlify(obj) {
55
+ if (typeof obj === 'function') {
56
+ return undefined;
57
+ }
58
+ if (obj == null || typeof obj === 'string' || typeof obj === 'boolean') {
59
+ return obj;
60
+ }
61
+ if (typeof obj === 'bigint' || typeof obj === 'number') {
62
+ return (0, ethers_1.toQuantity)(obj);
63
+ }
64
+ if (obj instanceof Uint8Array) {
65
+ return (0, ethers_1.hexlify)(obj);
66
+ }
67
+ if (Array.isArray(obj)) {
68
+ return obj.map((member) => deepHexlify(member));
69
+ }
70
+ const record = obj;
71
+ return Object.keys(record).reduce((set, key) => ({ ...set, [key]: deepHexlify(record[key]) }), {});
72
+ }
@@ -0,0 +1,22 @@
1
+ import { Network } from '../structs/Struct';
2
+ /** AA contract addresses for a network. */
3
+ export interface AaAddresses {
4
+ entryPoint: string;
5
+ accountFactory: string;
6
+ paymaster: string;
7
+ permit2: string;
8
+ }
9
+ /** Built-in AA configuration for a network. */
10
+ export interface AaNetworkConfig extends AaAddresses {
11
+ chainId: number;
12
+ /**
13
+ * Bundler RPC URL. Intentionally left undefined in the built-in defaults — there is no
14
+ * public bundler endpoint to ship, so pass `bundlerUrl` to {@link TacAccountSdk.create}.
15
+ */
16
+ bundlerUrl?: string;
17
+ }
18
+ /**
19
+ * Built-in per-network AA defaults. TESTNET is SPB (chainId 2391) — the same chain
20
+ * tac-sdk's TESTNET resolves to. MAINNET is not deployed yet.
21
+ */
22
+ export declare const AA_NETWORKS: Partial<Record<Network, AaNetworkConfig>>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AA_NETWORKS = void 0;
4
+ const Struct_1 = require("../structs/Struct");
5
+ /**
6
+ * Built-in per-network AA defaults. TESTNET is SPB (chainId 2391) — the same chain
7
+ * tac-sdk's TESTNET resolves to. MAINNET is not deployed yet.
8
+ */
9
+ exports.AA_NETWORKS = {
10
+ [Struct_1.Network.TESTNET]: {
11
+ chainId: 2391,
12
+ entryPoint: '0x239DBD98defbad1c369034a2897bD5b8b57b468A',
13
+ accountFactory: '0x7879c3237811A86092E89AD94837163Ae71d6669',
14
+ paymaster: '0x5b3242786e8E2F0A3068AFcE6ca90288acBf5e33',
15
+ permit2: '0x36d6565DcdE4674115bBd1d86E511bebB1C425b9',
16
+ // bundlerUrl: undefined — provide it via TacAccountSdk.create({ bundlerUrl })
17
+ },
18
+ // MAINNET: account abstraction not deployed yet
19
+ };
@@ -0,0 +1,12 @@
1
+ import { Ed25519Signer } from './Ed25519';
2
+ export interface AaSignerResult {
3
+ /** Ed25519 public key as 32-byte 0x-hex — the AA account is derived from this. */
4
+ publicKey: string;
5
+ /** Signer that produces `(r, s)` over a 32-byte message. */
6
+ signer: Ed25519Signer;
7
+ }
8
+ /**
9
+ * Build an AA signer + public key from a TON mnemonic, using the same key derivation as
10
+ * `SenderFactory` (`mnemonicToWalletKey`, which equals `mnemonicToPrivateKey`).
11
+ */
12
+ export declare function aaSignerFromMnemonic(mnemonic: string): Promise<AaSignerResult>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aaSignerFromMnemonic = aaSignerFromMnemonic;
4
+ const ton_crypto_1 = require("ton-crypto");
5
+ const Ed25519_1 = require("./Ed25519");
6
+ /**
7
+ * Build an AA signer + public key from a TON mnemonic, using the same key derivation as
8
+ * `SenderFactory` (`mnemonicToWalletKey`, which equals `mnemonicToPrivateKey`).
9
+ */
10
+ async function aaSignerFromMnemonic(mnemonic) {
11
+ const keypair = await (0, ton_crypto_1.mnemonicToWalletKey)(mnemonic.trim().split(/\s+/));
12
+ const signer = (0, Ed25519_1.ed25519SignerFromSecretKey)(keypair.secretKey, (message, secretKey) => (0, ton_crypto_1.sign)(Buffer.from(message), Buffer.from(secretKey)));
13
+ return { publicKey: '0x' + keypair.publicKey.toString('hex'), signer };
14
+ }
@@ -146,7 +146,7 @@ class RetryableContractOpener {
146
146
  const openerLabel = `opener ${index + 1}/${this.openerConfigs.length}`;
147
147
  this.logger?.debug(`[RetryableContractOpener] ${operationName}: trying ${openerLabel}`);
148
148
  const result = useRetries
149
- ? await this.tryWithRetries(() => operation(config), config, `${operationName} ${openerLabel}`)
149
+ ? await this.tryWithRetries(() => operation(config), config, `${operationName} ${openerLabel}`, shouldFallbackOnError)
150
150
  : await this.trySingleAttempt(() => operation(config));
151
151
  if (result.success) {
152
152
  return { success: true, data: result.data };
@@ -186,7 +186,7 @@ class RetryableContractOpener {
186
186
  return { success: false, lastError: error };
187
187
  }
188
188
  }
189
- async tryWithRetries(operation, config, operationContext = 'operation') {
189
+ async tryWithRetries(operation, config, operationContext = 'operation', shouldRetryError) {
190
190
  let lastError;
191
191
  for (let attempt = 0; attempt <= config.retries; attempt++) {
192
192
  try {
@@ -198,6 +198,9 @@ class RetryableContractOpener {
198
198
  if (lastError instanceof errors_1.TransactionError || this.isContractExecutionError(lastError)) {
199
199
  return { success: false, lastError };
200
200
  }
201
+ if (shouldRetryError && !shouldRetryError(lastError)) {
202
+ return { success: false, lastError };
203
+ }
201
204
  if (attempt < config.retries) {
202
205
  const retryDelay = this.getRetryDelay(config, attempt);
203
206
  this.logger?.debug(`[RetryableContractOpener] ${operationContext}: attempt ${attempt + 1}/${config.retries + 1} failed (${lastError.message}), retrying in ${retryDelay}ms`);
@@ -11,7 +11,7 @@ const Utils_1 = require("../sdk/Utils");
11
11
  * traversing a linked chain of TON transactions until it finds the sequencer-collected event transaction on CCL.
12
12
  */
13
13
  class ToncenterV3Indexer {
14
- constructor(endpoint, httpClient = new AxiosHttpClient_1.AxiosHttpClient()) {
14
+ constructor(endpoint, httpClient = new AxiosHttpClient_1.AxiosHttpClient({ timeout: Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS })) {
15
15
  this.endpoint = endpoint;
16
16
  this.httpClient = httpClient;
17
17
  }
@@ -1,19 +1,19 @@
1
- import { Asset } from '../interfaces';
1
+ import type { Asset, IConfiguration } from '../interfaces';
2
2
  type AssetCacheToken = {
3
3
  address: string;
4
4
  index?: bigint;
5
5
  tokenType?: string;
6
6
  };
7
7
  export declare class AssetCache {
8
- private static readonly cache;
8
+ private static cache;
9
9
  /**
10
10
  * Get asset from cache
11
11
  */
12
- static get(token: AssetCacheToken): Asset | undefined;
12
+ static get(configuration: IConfiguration, token: AssetCacheToken): Asset | undefined;
13
13
  /**
14
14
  * Set asset in cache
15
15
  */
16
- static set(token: AssetCacheToken, asset: Asset): void;
16
+ static set(configuration: IConfiguration, token: AssetCacheToken, asset: Asset): void;
17
17
  /**
18
18
  * Clear the cache
19
19
  */
@@ -5,22 +5,27 @@ class AssetCache {
5
5
  /**
6
6
  * Get asset from cache
7
7
  */
8
- static get(token) {
8
+ static get(configuration, token) {
9
9
  const key = this.generateKey(token);
10
- return this.cache.get(key);
10
+ return this.cache.get(configuration)?.get(key);
11
11
  }
12
12
  /**
13
13
  * Set asset in cache
14
14
  */
15
- static set(token, asset) {
15
+ static set(configuration, token, asset) {
16
16
  const key = this.generateKey(token);
17
- this.cache.set(key, asset);
17
+ let scopedCache = this.cache.get(configuration);
18
+ if (!scopedCache) {
19
+ scopedCache = new Map();
20
+ this.cache.set(configuration, scopedCache);
21
+ }
22
+ scopedCache.set(key, asset);
18
23
  }
19
24
  /**
20
25
  * Clear the cache
21
26
  */
22
27
  static clear() {
23
- this.cache.clear();
28
+ this.cache = new WeakMap();
24
29
  }
25
30
  static generateKey(token) {
26
31
  // Normalize address to lowercase for consistency
@@ -36,4 +41,4 @@ class AssetCache {
36
41
  }
37
42
  }
38
43
  exports.AssetCache = AssetCache;
39
- AssetCache.cache = new Map();
44
+ AssetCache.cache = new WeakMap();
@@ -18,14 +18,14 @@ class AssetFactory {
18
18
  throw (0, errors_1.unknownTokenTypeError)(token.address, 'detected TON, but token type is not FT');
19
19
  return TON_1.TON.create(configuration);
20
20
  }
21
- const cachedAsset = AssetCache_1.AssetCache.get(token);
21
+ const cachedAsset = AssetCache_1.AssetCache.get(configuration, token);
22
22
  if (cachedAsset) {
23
23
  return cachedAsset.clone.withRawAmount(0n);
24
24
  }
25
25
  const asset = token.tokenType === Struct_1.AssetType.FT
26
26
  ? await this.createFTAsset(configuration, token.address)
27
27
  : await this.createNFTAsset(configuration, token.address, token.addressType, token.addressType === Struct_1.NFTAddressType.COLLECTION ? token.index : undefined);
28
- AssetCache_1.AssetCache.set(token, asset);
28
+ AssetCache_1.AssetCache.set(configuration, token, asset);
29
29
  return asset;
30
30
  }
31
31
  static async createFTAsset(configuration, address) {
@@ -1,2 +1,2 @@
1
1
  export { AddressError, BitError, ContractError, EVMCallError, FetchError, FormatError, KeyError, MetadataError, SettingError, TokenError, TransactionError, WalletError, } from './errors';
2
- export { allEndpointsFailedError, blockGasLimitFetchError, emptyArrayError, emptyContractError, emptySettingError, estimatedGasExceedsBlockGasLimitError, evmAddressError, executedInTONStageFailedError, externalInMessageRequiredError, gasPriceFetchError, indexRequiredError, insufficientBalanceError, insufficientFeeParamsError, invalidMethodNameError, invalidTonExternalMessageBocError, missingDecimals, missingFeeParamsError, missingGasLimitError, missingJettonDataError, missingTvmExecutorFeeError, notMultiplyOf8Error, operationFetchError, operationIdRequiredForFinalizationError, prefixError, profilingFetchError, simulationFetchError, statusFetchError, tonIndexerRequiredForTonTransactionBocError, tvmAddressError, txFinalizationError, unknownTokenTypeError, unknownWalletError, unsupportedFormatError, unsupportedKeyError, zeroRawAmountError, } from './instances';
2
+ export { allEndpointsFailedError, blockGasLimitFetchError, emptyArrayError, emptyContractError, emptySettingError, estimatedGasExceedsBlockGasLimitError, evmAddressError, executedInTONStageFailedError, externalInMessageRequiredError, gasPriceFetchError, indexRequiredError, insufficientBalanceError, insufficientFeeParamsError, invalidAmountError, invalidMethodNameError, invalidTonExternalMessageBocError, missingDecimals, missingFeeParamsError, missingGasLimitError, missingJettonDataError, missingTvmExecutorFeeError, notMultiplyOf8Error, operationFetchError, operationIdRequiredForFinalizationError, prefixError, profilingFetchError, simulationFetchError, statusFetchError, tonIndexerRequiredForTonTransactionBocError, tvmAddressError, txFinalizationError, unknownTokenTypeError, unknownWalletError, unsupportedFormatError, unsupportedKeyError, zeroRawAmountError, } from './instances';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zeroRawAmountError = exports.unsupportedKeyError = exports.unsupportedFormatError = exports.unknownWalletError = exports.unknownTokenTypeError = exports.txFinalizationError = exports.tvmAddressError = exports.tonIndexerRequiredForTonTransactionBocError = exports.statusFetchError = exports.simulationFetchError = exports.profilingFetchError = exports.prefixError = exports.operationIdRequiredForFinalizationError = exports.operationFetchError = exports.notMultiplyOf8Error = exports.missingTvmExecutorFeeError = exports.missingJettonDataError = exports.missingGasLimitError = exports.missingFeeParamsError = exports.missingDecimals = exports.invalidTonExternalMessageBocError = exports.invalidMethodNameError = exports.insufficientFeeParamsError = exports.insufficientBalanceError = exports.indexRequiredError = exports.gasPriceFetchError = exports.externalInMessageRequiredError = exports.executedInTONStageFailedError = exports.evmAddressError = exports.estimatedGasExceedsBlockGasLimitError = exports.emptySettingError = exports.emptyContractError = exports.emptyArrayError = exports.blockGasLimitFetchError = exports.allEndpointsFailedError = exports.WalletError = exports.TransactionError = exports.TokenError = exports.SettingError = exports.MetadataError = exports.KeyError = exports.FormatError = exports.FetchError = exports.EVMCallError = exports.ContractError = exports.BitError = exports.AddressError = void 0;
3
+ exports.zeroRawAmountError = exports.unsupportedKeyError = exports.unsupportedFormatError = exports.unknownWalletError = exports.unknownTokenTypeError = exports.txFinalizationError = exports.tvmAddressError = exports.tonIndexerRequiredForTonTransactionBocError = exports.statusFetchError = exports.simulationFetchError = exports.profilingFetchError = exports.prefixError = exports.operationIdRequiredForFinalizationError = exports.operationFetchError = exports.notMultiplyOf8Error = exports.missingTvmExecutorFeeError = exports.missingJettonDataError = exports.missingGasLimitError = exports.missingFeeParamsError = exports.missingDecimals = exports.invalidTonExternalMessageBocError = exports.invalidMethodNameError = exports.invalidAmountError = exports.insufficientFeeParamsError = exports.insufficientBalanceError = exports.indexRequiredError = exports.gasPriceFetchError = exports.externalInMessageRequiredError = exports.executedInTONStageFailedError = exports.evmAddressError = exports.estimatedGasExceedsBlockGasLimitError = exports.emptySettingError = exports.emptyContractError = exports.emptyArrayError = exports.blockGasLimitFetchError = exports.allEndpointsFailedError = exports.WalletError = exports.TransactionError = exports.TokenError = exports.SettingError = exports.MetadataError = exports.KeyError = exports.FormatError = exports.FetchError = exports.EVMCallError = exports.ContractError = exports.BitError = exports.AddressError = void 0;
4
4
  var errors_1 = require("./errors");
5
5
  Object.defineProperty(exports, "AddressError", { enumerable: true, get: function () { return errors_1.AddressError; } });
6
6
  Object.defineProperty(exports, "BitError", { enumerable: true, get: function () { return errors_1.BitError; } });
@@ -28,6 +28,7 @@ Object.defineProperty(exports, "gasPriceFetchError", { enumerable: true, get: fu
28
28
  Object.defineProperty(exports, "indexRequiredError", { enumerable: true, get: function () { return instances_1.indexRequiredError; } });
29
29
  Object.defineProperty(exports, "insufficientBalanceError", { enumerable: true, get: function () { return instances_1.insufficientBalanceError; } });
30
30
  Object.defineProperty(exports, "insufficientFeeParamsError", { enumerable: true, get: function () { return instances_1.insufficientFeeParamsError; } });
31
+ Object.defineProperty(exports, "invalidAmountError", { enumerable: true, get: function () { return instances_1.invalidAmountError; } });
31
32
  Object.defineProperty(exports, "invalidMethodNameError", { enumerable: true, get: function () { return instances_1.invalidMethodNameError; } });
32
33
  Object.defineProperty(exports, "invalidTonExternalMessageBocError", { enumerable: true, get: function () { return instances_1.invalidTonExternalMessageBocError; } });
33
34
  Object.defineProperty(exports, "missingDecimals", { enumerable: true, get: function () { return instances_1.missingDecimals; } });
@@ -44,3 +44,4 @@ export declare const estimatedGasExceedsBlockGasLimitError: (txName: string, est
44
44
  export declare const invalidTonExternalMessageBocError: (reason?: string) => FormatError;
45
45
  export declare const externalInMessageRequiredError: (actualType: string) => FormatError;
46
46
  export declare const tonIndexerRequiredForTonTransactionBocError: SettingError;
47
+ export declare const invalidAmountError: (reason: string) => FormatError;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tonIndexerRequiredForTonTransactionBocError = exports.externalInMessageRequiredError = exports.invalidTonExternalMessageBocError = exports.estimatedGasExceedsBlockGasLimitError = exports.blockGasLimitFetchError = exports.executedInTONStageFailedError = exports.operationIdRequiredForFinalizationError = exports.insufficientFeeParamsError = exports.txFinalizationError = exports.gasPriceFetchError = exports.unknownAssetOriginError = exports.convertCurrencyNegativeOrZeroValueError = exports.sendCrossChainTransactionFailedError = exports.zeroRawAmountError = exports.missingJettonDataError = exports.missingDecimals = exports.missingGasLimitError = exports.missingTvmExecutorFeeError = exports.missingFeeParamsError = exports.getTONFeeInfoFetchError = exports.simulationFetchError = exports.convertCurrencyFetchError = exports.indexRequiredError = exports.unknownTokenTypeError = exports.insufficientBalanceError = exports.allContractOpenerFailedError = exports.allEndpointsFailedError = exports.noValidGroupFoundError = exports.prepareMessageGroupError = exports.invalidAssetType = exports.emptyArrayError = exports.profilingFetchError = exports.invalidMethodNameError = exports.emptySettingError = exports.prefixError = exports.notMultiplyOf8Error = exports.unsupportedFormatError = exports.unsupportedKeyError = exports.unknownWalletError = exports.evmAddressError = exports.tvmAddressError = exports.statusFetchError = exports.operationFetchError = exports.emptyContractError = void 0;
3
+ exports.invalidAmountError = exports.tonIndexerRequiredForTonTransactionBocError = exports.externalInMessageRequiredError = exports.invalidTonExternalMessageBocError = exports.estimatedGasExceedsBlockGasLimitError = exports.blockGasLimitFetchError = exports.executedInTONStageFailedError = exports.operationIdRequiredForFinalizationError = exports.insufficientFeeParamsError = exports.txFinalizationError = exports.gasPriceFetchError = exports.unknownAssetOriginError = exports.convertCurrencyNegativeOrZeroValueError = exports.sendCrossChainTransactionFailedError = exports.zeroRawAmountError = exports.missingJettonDataError = exports.missingDecimals = exports.missingGasLimitError = exports.missingTvmExecutorFeeError = exports.missingFeeParamsError = exports.getTONFeeInfoFetchError = exports.simulationFetchError = exports.convertCurrencyFetchError = exports.indexRequiredError = exports.unknownTokenTypeError = exports.insufficientBalanceError = exports.allContractOpenerFailedError = exports.allEndpointsFailedError = exports.noValidGroupFoundError = exports.prepareMessageGroupError = exports.invalidAssetType = exports.emptyArrayError = exports.profilingFetchError = exports.invalidMethodNameError = exports.emptySettingError = exports.prefixError = exports.notMultiplyOf8Error = exports.unsupportedFormatError = exports.unsupportedKeyError = exports.unknownWalletError = exports.evmAddressError = exports.tvmAddressError = exports.statusFetchError = exports.operationFetchError = exports.emptyContractError = void 0;
4
4
  const errors_1 = require("./errors");
5
5
  exports.emptyContractError = new errors_1.ContractError('unexpected empty contract code of given jetton.', 100);
6
6
  const operationFetchError = (msg, inner) => new errors_1.FetchError(`failed to fetch OperationId: ${msg}`, 101, inner);
@@ -132,3 +132,5 @@ exports.invalidTonExternalMessageBocError = invalidTonExternalMessageBocError;
132
132
  const externalInMessageRequiredError = (actualType) => new errors_1.FormatError(`Expected external-in TON message, got ${actualType}`, 142);
133
133
  exports.externalInMessageRequiredError = externalInMessageRequiredError;
134
134
  exports.tonIndexerRequiredForTonTransactionBocError = new errors_1.SettingError('TON indexer is required to resolve operation ID by TON transaction BOC', 143);
135
+ const invalidAmountError = (reason) => new errors_1.FormatError(`Invalid amount: ${reason}`, 144);
136
+ exports.invalidAmountError = invalidAmountError;
@@ -1,9 +1,11 @@
1
+ export * from './accountAbstraction';
1
2
  export * from './adapters';
2
3
  export { AgnosticProxySDK } from './agnosticSdk/AgnosticSdk';
3
4
  export * as AgnosticStructs from './agnosticSdk/AgnosticStructs';
4
5
  export * from './assets';
5
6
  export * from './errors';
6
7
  export * from './interfaces';
8
+ export { getArtifacts } from './sdk/Artifacts';
7
9
  export { AxiosHttpClient } from './sdk/AxiosHttpClient';
8
10
  export { Configuration } from './sdk/Configuration';
9
11
  export { LiteSequencerClient } from './sdk/LiteSequencerClient';
package/dist/src/index.js CHANGED
@@ -36,7 +36,8 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.TonTxFinalizer = exports.TONTransactionManager = exports.TACTransactionManager = exports.TacSdk = exports.TacExplorerClient = exports.Simulator = exports.OperationTracker = exports.NoopLogger = exports.ConsoleLogger = exports.LiteSequencerClient = exports.Configuration = exports.AxiosHttpClient = exports.AgnosticStructs = exports.AgnosticProxySDK = void 0;
39
+ exports.TonTxFinalizer = exports.TONTransactionManager = exports.TACTransactionManager = exports.TacSdk = exports.TacExplorerClient = exports.Simulator = exports.OperationTracker = exports.NoopLogger = exports.ConsoleLogger = exports.LiteSequencerClient = exports.Configuration = exports.AxiosHttpClient = exports.getArtifacts = exports.AgnosticStructs = exports.AgnosticProxySDK = void 0;
40
+ __exportStar(require("./accountAbstraction"), exports);
40
41
  __exportStar(require("./adapters"), exports);
41
42
  var AgnosticSdk_1 = require("./agnosticSdk/AgnosticSdk");
42
43
  Object.defineProperty(exports, "AgnosticProxySDK", { enumerable: true, get: function () { return AgnosticSdk_1.AgnosticProxySDK; } });
@@ -44,6 +45,8 @@ exports.AgnosticStructs = __importStar(require("./agnosticSdk/AgnosticStructs"))
44
45
  __exportStar(require("./assets"), exports);
45
46
  __exportStar(require("./errors"), exports);
46
47
  __exportStar(require("./interfaces"), exports);
48
+ var Artifacts_1 = require("./sdk/Artifacts");
49
+ Object.defineProperty(exports, "getArtifacts", { enumerable: true, get: function () { return Artifacts_1.getArtifacts; } });
47
50
  var AxiosHttpClient_1 = require("./sdk/AxiosHttpClient");
48
51
  Object.defineProperty(exports, "AxiosHttpClient", { enumerable: true, get: function () { return AxiosHttpClient_1.AxiosHttpClient; } });
49
52
  var Configuration_1 = require("./sdk/Configuration");
@@ -1,11 +1,11 @@
1
- import { dev, mainnet, testnet } from '../../artifacts';
1
+ import type { NetworkArtifacts } from '../../artifacts';
2
2
  import { InternalTACParams, InternalTONParams } from '../structs/InternalStruct';
3
3
  import { Network } from '../structs/Struct';
4
4
  export interface IConfiguration {
5
5
  /** Current network the SDK is configured for (e.g., MAINNET/TESTNET). */
6
6
  readonly network: Network;
7
7
  /** Resolved artifacts bundle for the selected network (contract ABIs/addresses). */
8
- readonly artifacts: typeof testnet | typeof mainnet | typeof dev;
8
+ readonly artifacts: NetworkArtifacts;
9
9
  /** Low-level TON client parameters and dependencies. */
10
10
  readonly TONParams: InternalTONParams;
11
11
  /** Low-level TAC (EVM-side) client parameters and dependencies. */
@@ -0,0 +1,3 @@
1
+ import type { NetworkArtifacts } from '../../artifacts';
2
+ import { Network } from '../structs/Struct';
3
+ export declare function getArtifacts(network: Network): NetworkArtifacts;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getArtifacts = getArtifacts;
4
+ const artifacts_1 = require("../../artifacts");
5
+ const Struct_1 = require("../structs/Struct");
6
+ function getArtifacts(network) {
7
+ switch (network) {
8
+ case Struct_1.Network.MAINNET:
9
+ return artifacts_1.mainnet;
10
+ case Struct_1.Network.TESTNET:
11
+ return artifacts_1.testnet;
12
+ case Struct_1.Network.DEV:
13
+ return artifacts_1.dev;
14
+ default:
15
+ throw new Error(`Unsupported network: ${network}`);
16
+ }
17
+ }
@@ -1,16 +1,16 @@
1
- import { dev, mainnet, testnet } from '../../artifacts';
1
+ import type { NetworkArtifacts } from '../../artifacts';
2
2
  import { IConfiguration, ILogger } from '../interfaces';
3
3
  import { InternalTACParams, InternalTONParams } from '../structs/InternalStruct';
4
4
  import { Network, TACParams, TONParams } from '../structs/Struct';
5
5
  export declare class Configuration implements IConfiguration {
6
6
  readonly network: Network;
7
- readonly artifacts: typeof testnet | typeof mainnet | typeof dev;
7
+ readonly artifacts: NetworkArtifacts;
8
8
  readonly TONParams: InternalTONParams;
9
9
  readonly TACParams: InternalTACParams;
10
10
  readonly liteSequencerEndpoints: string[];
11
11
  readonly logger: ILogger;
12
- constructor(network: Network, artifacts: typeof testnet | typeof mainnet | typeof dev, TONParams: InternalTONParams, TACParams: InternalTACParams, liteSequencerEndpoints: string[], logger: ILogger);
13
- static create(network: Network, artifacts: typeof testnet | typeof mainnet | typeof dev, TONParams?: TONParams, TACParams?: TACParams, customLiteSequencerEndpoints?: string[], delay?: number, logger?: ILogger, passLoggerToOpeners?: boolean): Promise<Configuration>;
12
+ constructor(network: Network, artifacts: NetworkArtifacts, TONParams: InternalTONParams, TACParams: InternalTACParams, liteSequencerEndpoints: string[], logger: ILogger);
13
+ static create(network: Network, artifacts: NetworkArtifacts, TONParams?: TONParams, TACParams?: TACParams, customLiteSequencerEndpoints?: string[], delay?: number, logger?: ILogger, passLoggerToOpeners?: boolean): Promise<Configuration>;
14
14
  private static prepareTONParams;
15
15
  private static prepareTACParams;
16
16
  private static loadTACSettingsViaMulticall;