@tonappchain/sdk 0.6.6-mainnet-alpha → 0.7.0-rc11

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 (97) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +191 -191
  3. package/dist/adapters/contractOpener.d.ts +2 -1
  4. package/dist/adapters/contractOpener.js +6 -6
  5. package/dist/adapters/retryableContractOpener.d.ts +6 -2
  6. package/dist/adapters/retryableContractOpener.js +2 -2
  7. package/dist/assets/AssetCache.d.ts +23 -0
  8. package/dist/assets/AssetCache.js +36 -0
  9. package/dist/assets/AssetFactory.d.ts +7 -0
  10. package/dist/assets/AssetFactory.js +46 -0
  11. package/dist/assets/FT.d.ts +58 -0
  12. package/dist/assets/FT.js +231 -0
  13. package/dist/assets/NFT.d.ts +65 -0
  14. package/dist/assets/NFT.js +210 -0
  15. package/dist/assets/TON.d.ts +38 -0
  16. package/dist/assets/TON.js +91 -0
  17. package/dist/assets/index.d.ts +4 -0
  18. package/dist/assets/index.js +11 -0
  19. package/dist/errors/errors.d.ts +6 -0
  20. package/dist/errors/errors.js +15 -1
  21. package/dist/errors/index.d.ts +2 -2
  22. package/dist/errors/index.js +26 -22
  23. package/dist/errors/instances.d.ts +4 -1
  24. package/dist/errors/instances.js +11 -2
  25. package/dist/index.d.ts +7 -0
  26. package/dist/index.js +14 -1
  27. package/dist/interfaces/Asset.d.ts +73 -0
  28. package/dist/interfaces/Asset.js +2 -0
  29. package/dist/interfaces/ContractOpener.d.ts +21 -0
  30. package/dist/interfaces/ContractOpener.js +2 -0
  31. package/dist/interfaces/IConfiguration.d.ts +35 -0
  32. package/dist/interfaces/IConfiguration.js +2 -0
  33. package/dist/interfaces/IHttpClient.d.ts +16 -0
  34. package/dist/interfaces/IHttpClient.js +2 -0
  35. package/dist/interfaces/ILiteSequencerClient.d.ts +30 -0
  36. package/dist/interfaces/ILiteSequencerClient.js +2 -0
  37. package/dist/interfaces/ILiteSequencerClientFactory.d.ts +9 -0
  38. package/dist/interfaces/ILiteSequencerClientFactory.js +2 -0
  39. package/dist/interfaces/ILogger.d.ts +10 -0
  40. package/dist/interfaces/ILogger.js +2 -0
  41. package/dist/interfaces/IOperationTracker.d.ts +66 -0
  42. package/dist/interfaces/IOperationTracker.js +2 -0
  43. package/dist/interfaces/ISimulator.d.ts +47 -0
  44. package/dist/interfaces/ISimulator.js +2 -0
  45. package/dist/interfaces/ITacSDK.d.ts +147 -0
  46. package/dist/interfaces/ITacSDK.js +2 -0
  47. package/dist/interfaces/ITransactionManager.d.ts +35 -0
  48. package/dist/interfaces/ITransactionManager.js +2 -0
  49. package/dist/interfaces/SenderAbstraction.d.ts +35 -0
  50. package/dist/interfaces/SenderAbstraction.js +2 -0
  51. package/dist/interfaces/WalletInstanse.d.ts +20 -0
  52. package/dist/interfaces/WalletInstanse.js +2 -0
  53. package/dist/interfaces/index.d.ts +13 -0
  54. package/dist/interfaces/index.js +29 -0
  55. package/dist/sdk/AxiosHttpClient.d.ts +12 -0
  56. package/dist/sdk/AxiosHttpClient.js +23 -0
  57. package/dist/sdk/Configuration.d.ts +21 -0
  58. package/dist/sdk/Configuration.js +90 -0
  59. package/dist/sdk/LiteSequencerClient.d.ts +6 -2
  60. package/dist/sdk/LiteSequencerClient.js +58 -14
  61. package/dist/sdk/Logger.d.ts +13 -0
  62. package/dist/sdk/Logger.js +25 -0
  63. package/dist/sdk/OperationTracker.d.ts +10 -5
  64. package/dist/sdk/OperationTracker.js +87 -45
  65. package/dist/sdk/Simulator.d.ts +17 -0
  66. package/dist/sdk/Simulator.js +163 -0
  67. package/dist/sdk/StartTracking.d.ts +6 -0
  68. package/dist/sdk/StartTracking.js +69 -32
  69. package/dist/sdk/TacSdk.d.ts +26 -43
  70. package/dist/sdk/TacSdk.js +121 -816
  71. package/dist/sdk/TransactionManager.d.ts +22 -0
  72. package/dist/sdk/TransactionManager.js +272 -0
  73. package/dist/sdk/TxFinalizer.d.ts +10 -0
  74. package/dist/sdk/TxFinalizer.js +104 -0
  75. package/dist/sdk/Utils.d.ts +7 -2
  76. package/dist/sdk/Utils.js +43 -24
  77. package/dist/sdk/Validator.d.ts +9 -0
  78. package/dist/sdk/Validator.js +43 -0
  79. package/dist/sender/BatchSender.d.ts +6 -4
  80. package/dist/sender/BatchSender.js +18 -6
  81. package/dist/sender/RawSender.d.ts +10 -5
  82. package/dist/sender/RawSender.js +46 -18
  83. package/dist/sender/SenderFactory.d.ts +1 -1
  84. package/dist/sender/SenderFactory.js +5 -4
  85. package/dist/sender/TonConnectSender.d.ts +6 -4
  86. package/dist/sender/TonConnectSender.js +14 -10
  87. package/dist/sender/index.d.ts +2 -2
  88. package/dist/sender/index.js +2 -2
  89. package/dist/structs/InternalStruct.d.ts +51 -32
  90. package/dist/structs/Struct.d.ts +88 -90
  91. package/dist/structs/Struct.js +11 -1
  92. package/dist/wrappers/HighloadQueryId.js +0 -1
  93. package/dist/wrappers/HighloadWalletV3.d.ts +4 -3
  94. package/dist/wrappers/HighloadWalletV3.js +5 -2
  95. package/package.json +67 -67
  96. package/dist/sender/SenderAbstraction.d.ts +0 -20
  97. package/dist/sender/SenderAbstraction.js +0 -5
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,47 @@
1
+ import type { SenderAbstraction } from '../sender';
2
+ import { CrosschainTx, EvmProxyMsg, ExecutionFeeEstimationResult, SuggestedTONExecutorFee, TACSimulationRequest, TACSimulationResult, TransactionLinker } from '../structs/Struct';
3
+ import { Asset } from './Asset';
4
+ export interface ISimulator {
5
+ /**
6
+ * Simulates a TAC message execution without sending it to the chain.
7
+ * @param req Simulation request that encapsulates the message and context.
8
+ * @returns Promise with detailed simulation output.
9
+ */
10
+ simulateTACMessage(req: TACSimulationRequest): Promise<TACSimulationResult>;
11
+ /**
12
+ * Simulates a list of cross-chain transactions for a given sender.
13
+ * @param sender Sender abstraction used to provide context (e.g., wallet state).
14
+ * @param txs Cross-chain transactions to simulate.
15
+ * @returns Promise with results, one for each input transaction.
16
+ */
17
+ simulateTransactions(sender: SenderAbstraction, txs: CrosschainTx[]): Promise<TACSimulationResult[]>;
18
+ /**
19
+ * Suggests the TON executor fee for a given set of assets and target fee symbol.
20
+ * @param assets Assets involved in execution.
21
+ * @param feeSymbol Symbol that represents the fee denomination (e.g., TON).
22
+ * @param tvmValidExecutors Whitelist of permitted TVM executors (optional).
23
+ * @returns Promise with suggested fee information.
24
+ */
25
+ getTVMExecutorFeeInfo(assets: Asset[], feeSymbol: string, tvmValidExecutors?: string[]): Promise<SuggestedTONExecutorFee>;
26
+ /**
27
+ * Computes simulation info and fees for a single transaction, using the provided sender context.
28
+ * @param evmProxyMsg Encoded EVM proxy message.
29
+ * @param sender Sender abstraction.
30
+ * @param assets Optional list of assets to attach to the transaction.
31
+ * @returns Promise with execution fee estimation details.
32
+ */
33
+ getTransactionSimulationInfo(evmProxyMsg: EvmProxyMsg, sender: SenderAbstraction, assets?: Asset[]): Promise<ExecutionFeeEstimationResult>;
34
+ /**
35
+ * Computes simulation info for a transaction tied to an existing TransactionLinker.
36
+ * @param evmProxyMsg Encoded EVM proxy message.
37
+ * @param transactionLinker Linker referencing the originating transaction.
38
+ * @param assets Assets to be included in the transaction.
39
+ * @param allowSimulationError If true, returns partial info even if simulation fails.
40
+ * @param isRoundTrip If true, includes round-trip (rollback) considerations.
41
+ * @param evmValidExecutors Optional whitelist of EVM-side executors.
42
+ * @param tvmValidExecutors Optional whitelist of TVM-side executors.
43
+ * @param calculateRollbackFee If true, includes rollback fee in estimation.
44
+ * @returns Promise with fee estimation and execution info.
45
+ */
46
+ getSimulationInfoForTransaction(evmProxyMsg: EvmProxyMsg, transactionLinker: TransactionLinker, assets: Asset[], allowSimulationError?: boolean, isRoundTrip?: boolean, evmValidExecutors?: string[], tvmValidExecutors?: string[], calculateRollbackFee?: boolean): Promise<ExecutionFeeEstimationResult>;
47
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,147 @@
1
+ import { Wallet } from 'ethers';
2
+ import type { SenderAbstraction } from '../sender';
3
+ import { AssetFromFTArg, AssetFromNFTCollectionArg, AssetFromNFTItemArg, CrossChainTransactionOptions, CrosschainTx, EVMAddress, EvmProxyMsg, ExecutionFeeEstimationResult, NFTAddressType, NFTItemData, OperationIdsByShardsKey, SuggestedTONExecutorFee, TACSimulationRequest, TACSimulationResult, TransactionLinkerWithOperationId, TVMAddress, UserWalletBalanceExtended, WaitOptions } from '../structs/Struct';
4
+ import { IConfiguration } from './IConfiguration';
5
+ import { Asset } from './Asset';
6
+ import { FT, NFT } from '../assets';
7
+ import { JettonMasterData } from '../wrappers/JettonMaster';
8
+ export interface ITacSDK {
9
+ readonly config: IConfiguration;
10
+ /**
11
+ * TON native token (TON coin) address configured for the current network.
12
+ * @returns TON address string.
13
+ */
14
+ get nativeTONAddress(): string;
15
+ /**
16
+ * Returns the TAC (TON App Chain) native token address for the current network.
17
+ * @returns Promise that resolves to the TAC token master address.
18
+ */
19
+ nativeTACAddress(): Promise<string>;
20
+ /**
21
+ * List of TAC (EVM-side) executor addresses considered trusted for fee payments/validations.
22
+ */
23
+ get getTrustedTACExecutors(): string[];
24
+ /**
25
+ * List of TON (TVM-side) executor addresses considered trusted for fee payments/validations.
26
+ */
27
+ get getTrustedTONExecutors(): string[];
28
+ /**
29
+ * Closes any underlying network connections, clients, or subscriptions established by the SDK.
30
+ * Implementations should be idempotent and safe to call multiple times.
31
+ */
32
+ closeConnections(): unknown;
33
+ /**
34
+ * Creates a typed asset wrapper instance based on provided arguments.
35
+ * Pass FT, NFT collection or NFT item parameters; the returned type will match the input.
36
+ * @param args Parameters that describe the asset to wrap (FT/NFT collection/NFT item).
37
+ * @returns Promise resolving to a generic IAsset. Use overloads for stronger typing.
38
+ */
39
+ getAsset(args: AssetFromFTArg | AssetFromNFTCollectionArg | AssetFromNFTItemArg): Promise<Asset>;
40
+ getAsset(args: AssetFromFTArg): Promise<FT>;
41
+ getAsset(args: AssetFromNFTCollectionArg): Promise<NFT>;
42
+ getAsset(args: AssetFromNFTItemArg): Promise<NFT>;
43
+ /**
44
+ * Returns a fungible token (Jetton) asset wrapper by its TVM or EVM address.
45
+ * @param address TVM or EVM token address.
46
+ * @returns Promise resolving to an FT wrapper.
47
+ */
48
+ getFT(address: TVMAddress | EVMAddress): Promise<FT>;
49
+ /**
50
+ * Returns an NFT asset wrapper for either a collection or a specific item.
51
+ * @param args NFT collection parameters or NFT item parameters.
52
+ * @returns Promise resolving to an NFT wrapper.
53
+ */
54
+ getNFT(args: AssetFromNFTCollectionArg | AssetFromNFTItemArg): Promise<NFT>;
55
+ /**
56
+ * Simulates a TAC message execution without broadcasting it on-chain.
57
+ * Useful for estimating fees and validating transaction inputs.
58
+ * @param req Simulation request with encoded message and context.
59
+ * @returns Promise with the detailed simulation result.
60
+ */
61
+ simulateTACMessage(req: TACSimulationRequest): Promise<TACSimulationResult>;
62
+ /**
63
+ * Simulates a batch of cross-chain transactions from a given sender.
64
+ * @param sender Abstracted sender used for simulation context (not broadcasting).
65
+ * @param txs Array of cross-chain transactions to simulate.
66
+ * @returns Promise with an array of results matching the input order.
67
+ */
68
+ simulateTransactions(sender: SenderAbstraction, txs: CrosschainTx[]): Promise<TACSimulationResult[]>;
69
+ /**
70
+ * Computes fee and execution information for a prospective transaction.
71
+ * @param evmProxyMsg Encoded EVM proxy message.
72
+ * @param sender Sender abstraction providing context (e.g., seqno, wallet info).
73
+ * @param assets Optional list of assets attached to the transaction.
74
+ * @returns Promise with the fee estimation and execution breakdown.
75
+ */
76
+ getTransactionSimulationInfo(evmProxyMsg: EvmProxyMsg, sender: SenderAbstraction, assets?: Asset[]): Promise<ExecutionFeeEstimationResult>;
77
+ /**
78
+ * Suggests optimal TON-side executor fee for a given asset set and fee symbol.
79
+ * @param assets Assets to be processed on TON side.
80
+ * @param feeSymbol Symbol (ticker) to express the fee in.
81
+ * @param tvmValidExecutors Optional whitelist of allowed TVM executors.
82
+ * @returns Promise with suggested fee details.
83
+ */
84
+ getTVMExecutorFeeInfo(assets: Asset[], feeSymbol: string, tvmValidExecutors?: string[]): Promise<SuggestedTONExecutorFee>;
85
+ /**
86
+ * Sends a single cross-chain transaction and optionally waits for tracking information.
87
+ * @param evmProxyMsg Encoded EVM proxy message to be bridged.
88
+ * @param sender Sender abstraction responsible for signing/sending TVM messages.
89
+ * @param assets Optional list of assets to attach to the cross-chain message.
90
+ * @param options Optional cross-chain options (fees, executors, extra data, etc.).
91
+ * @param waitOptions Optional waiting policy for operation id resolution.
92
+ * @returns Promise with a TransactionLinkerWithOperationId to track the operation across chains.
93
+ */
94
+ sendCrossChainTransaction(evmProxyMsg: EvmProxyMsg, sender: SenderAbstraction, assets?: Asset[], options?: CrossChainTransactionOptions, waitOptions?: WaitOptions<string>): Promise<TransactionLinkerWithOperationId>;
95
+ /**
96
+ * Sends multiple cross-chain transactions in one batch and optionally waits for tracking info.
97
+ * @param sender Sender abstraction for signing/sending TVM messages.
98
+ * @param txs Array of cross-chain transactions to broadcast.
99
+ * @param waitOptions Optional waiting policy for operation ids by shard keys.
100
+ * @returns Promise with an array of TransactionLinkerWithOperationId for each submitted transaction.
101
+ */
102
+ sendCrossChainTransactions(sender: SenderAbstraction, txs: CrosschainTx[], waitOptions?: WaitOptions<OperationIdsByShardsKey>): Promise<TransactionLinkerWithOperationId[]>;
103
+ /**
104
+ * Bridges tokens/value from EVM to TON chain via the executor.
105
+ * @param signer Ethers Wallet used to sign the EVM-side transaction.
106
+ * @param value Amount of native EVM currency to bridge (in wei as bigint).
107
+ * @param tonTarget Recipient TVM address on TON.
108
+ * @param assets Optional list of TAC assets to include for the bridge.
109
+ * @param tvmExecutorFee Optional explicit TON-side executor fee.
110
+ * @param tvmValidExecutors Optional whitelist of allowed TVM executors.
111
+ * @returns Promise resolving to the EVM transaction hash or bridge identifier.
112
+ */
113
+ bridgeTokensToTON(signer: Wallet, value: bigint, tonTarget: string, assets?: Asset[], tvmExecutorFee?: bigint, tvmValidExecutors?: string[]): Promise<string>;
114
+ /**
115
+ * Returns the user's Jetton wallet address for a given Jetton master (token) address.
116
+ * @param userAddress TVM user address.
117
+ * @param tokenAddress Jetton master address.
118
+ * @returns Promise resolving to the Jetton wallet address.
119
+ */
120
+ getUserJettonWalletAddress(userAddress: string, tokenAddress: string): Promise<string>;
121
+ /**
122
+ * Returns Jetton balance for a user and a given Jetton master address.
123
+ * @param userAddress TVM user address.
124
+ * @param tokenAddress Jetton master address.
125
+ * @returns Promise resolving to the balance in raw base units (bigint).
126
+ */
127
+ getUserJettonBalance(userAddress: string, tokenAddress: string): Promise<bigint>;
128
+ /**
129
+ * Returns extended Jetton wallet information including balance and metadata.
130
+ * @param userAddress TVM user address.
131
+ * @param tokenAddress Jetton master address.
132
+ * @returns Promise resolving to extended wallet data.
133
+ */
134
+ getUserJettonBalanceExtended(userAddress: string, tokenAddress: string): Promise<UserWalletBalanceExtended>;
135
+ /**
136
+ * Returns Jetton master data (metadata and configuration) for a given Jetton master address.
137
+ * @param itemAddress Jetton master TVM address.
138
+ * @returns Promise resolving to JettonMasterData.
139
+ */
140
+ getJettonData(itemAddress: TVMAddress): Promise<JettonMasterData>;
141
+ getNFTItemData(itemAddress: TVMAddress): Promise<NFTItemData>;
142
+ getEVMTokenAddress(tvmTokenAddress: string): Promise<string>;
143
+ getTVMTokenAddress(evmTokenAddress: string): Promise<string>;
144
+ getTVMNFTAddress(evmNFTAddress: string, tokenId?: number | bigint): Promise<string>;
145
+ getEVMNFTAddress(tvmNFTAddress: string, addressType: NFTAddressType): Promise<string>;
146
+ isContractDeployedOnTVM(address: string): Promise<boolean>;
147
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,35 @@
1
+ import { Wallet } from 'ethers';
2
+ import type { SenderAbstraction } from '../sender';
3
+ import { CrossChainTransactionOptions, CrosschainTx, EvmProxyMsg, OperationIdsByShardsKey, TransactionLinkerWithOperationId, WaitOptions } from '../structs/Struct';
4
+ import { Asset } from './Asset';
5
+ export interface ITransactionManager {
6
+ /**
7
+ * Sends a single cross-chain transaction.
8
+ * @param evmProxyMsg Encoded EVM proxy message to bridge.
9
+ * @param sender Sender abstraction for TVM message sending.
10
+ * @param assets Optional assets to attach to the cross-chain message.
11
+ * @param options Optional cross-chain execution options (fees, executors, extra data).
12
+ * @param waitOptions Optional policy to wait for operation id resolution.
13
+ * @returns Transaction linker with operation id for tracking.
14
+ */
15
+ sendCrossChainTransaction(evmProxyMsg: EvmProxyMsg, sender: SenderAbstraction, assets?: Asset[], options?: CrossChainTransactionOptions, waitOptions?: WaitOptions<string>): Promise<TransactionLinkerWithOperationId>;
16
+ /**
17
+ * Sends multiple cross-chain transactions in a batch.
18
+ * @param sender Sender abstraction for TVM message sending.
19
+ * @param txs List of cross-chain transactions to broadcast.
20
+ * @param waitOptions Optional policy for waiting on operation ids by shard keys.
21
+ * @returns Array of transaction linkers, one per submitted transaction.
22
+ */
23
+ sendCrossChainTransactions(sender: SenderAbstraction, txs: CrosschainTx[], waitOptions?: WaitOptions<OperationIdsByShardsKey>): Promise<TransactionLinkerWithOperationId[]>;
24
+ /**
25
+ * Bridges native EVM value and optional assets to TON chain via executor.
26
+ * @param signer Ethers Wallet used to sign EVM transaction.
27
+ * @param value Amount of native EVM currency (wei as bigint).
28
+ * @param tonTarget Recipient TVM address on TON.
29
+ * @param assets Optional list of TAC assets to include.
30
+ * @param tvmExecutorFee Optional explicit TON-side executor fee.
31
+ * @param tvmValidExecutors Optional whitelist of allowed TVM executors.
32
+ * @returns EVM transaction hash or bridge identifier.
33
+ */
34
+ bridgeTokensToTON(signer: Wallet, value: bigint, tonTarget: string, assets?: Asset[], tvmExecutorFee?: bigint, tvmValidExecutors?: string[]): Promise<string>;
35
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,35 @@
1
+ import type { SendResult, ShardTransaction } from '../structs/InternalStruct';
2
+ import type { Asset, ContractOpener } from './index';
3
+ import { Network } from '../structs/Struct';
4
+ export interface SenderAbstraction {
5
+ /**
6
+ * Sends a single shard transaction on the specified chain.
7
+ * @param shardTransaction Prepared transaction payload to send.
8
+ * @param chain Optional network selector; defaults to current SDK network.
9
+ * @param contractOpener Optional contract opener to use for sending.
10
+ * @returns Promise with low-level send result.
11
+ */
12
+ sendShardTransaction(shardTransaction: ShardTransaction, chain?: Network, contractOpener?: ContractOpener): Promise<SendResult>;
13
+ /**
14
+ * Sends multiple shard transactions as a batch.
15
+ * @param shardTransactions Array of prepared shard transactions to send.
16
+ * @param chain Optional network selector; defaults to current SDK network.
17
+ * @param contractOpener Optional contract opener to use for sending.
18
+ * @returns Promise with an array of low-level send results in the same order.
19
+ */
20
+ sendShardTransactions(shardTransactions: ShardTransaction[], chain?: Network, contractOpener?: ContractOpener): Promise<SendResult[]>;
21
+ /**
22
+ * Returns the TVM address of the underlying sender wallet.
23
+ */
24
+ getSenderAddress(): string;
25
+ /**
26
+ * Returns the TON balance of the sender wallet using the provided opener.
27
+ * @param contractOpener Contract opener used for on-chain queries.
28
+ */
29
+ getBalance(contractOpener: ContractOpener): Promise<bigint>;
30
+ /**
31
+ * Returns the balance of a given asset for the sender wallet.
32
+ * @param asset Asset wrapper instance to query balance for.
33
+ */
34
+ getBalanceOf(asset: Asset): Promise<bigint>;
35
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ import type { Contract, ContractProvider, MessageRelaxed, SendMode } from '@ton/ton';
2
+ export interface WalletInstanse extends Contract {
3
+ /**
4
+ * Returns current wallet seqno, used for nonce/ordering.
5
+ * @param provider Contract provider to query the wallet.
6
+ */
7
+ getSeqno(provider: ContractProvider): Promise<number>;
8
+ /**
9
+ * Sends a transfer with specified messages and send mode.
10
+ * @param provider Contract provider used to send the transfer.
11
+ * @param args Transfer arguments including seqno, secretKey, messages and sendMode.
12
+ */
13
+ sendTransfer(provider: ContractProvider, args: {
14
+ seqno: number;
15
+ secretKey: Buffer;
16
+ messages: MessageRelaxed[];
17
+ sendMode: SendMode;
18
+ timeout?: number;
19
+ }): Promise<void>;
20
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ export * from './Asset';
2
+ export * from './IConfiguration';
3
+ export * from './ContractOpener';
4
+ export * from './IHttpClient';
5
+ export * from './ILiteSequencerClient';
6
+ export * from './ILiteSequencerClientFactory';
7
+ export * from './ILogger';
8
+ export * from './IOperationTracker';
9
+ export * from './SenderAbstraction';
10
+ export * from './ISimulator';
11
+ export * from './ITacSDK';
12
+ export * from './ITransactionManager';
13
+ export * from './WalletInstanse';
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Asset"), exports);
18
+ __exportStar(require("./IConfiguration"), exports);
19
+ __exportStar(require("./ContractOpener"), exports);
20
+ __exportStar(require("./IHttpClient"), exports);
21
+ __exportStar(require("./ILiteSequencerClient"), exports);
22
+ __exportStar(require("./ILiteSequencerClientFactory"), exports);
23
+ __exportStar(require("./ILogger"), exports);
24
+ __exportStar(require("./IOperationTracker"), exports);
25
+ __exportStar(require("./SenderAbstraction"), exports);
26
+ __exportStar(require("./ISimulator"), exports);
27
+ __exportStar(require("./ITacSDK"), exports);
28
+ __exportStar(require("./ITransactionManager"), exports);
29
+ __exportStar(require("./WalletInstanse"), exports);
@@ -0,0 +1,12 @@
1
+ import { IHttpClient } from '../interfaces';
2
+ import { AxiosRequestConfig, AxiosResponse } from 'axios';
3
+ /**
4
+ * Axios-based HTTP client that isolates SDK traffic from any global axios configuration.
5
+ * It uses its own axios instance, so external/global interceptors and defaults won't affect SDK requests.
6
+ */
7
+ export declare class AxiosHttpClient implements IHttpClient {
8
+ private readonly instance;
9
+ constructor(config?: AxiosRequestConfig);
10
+ get<T>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
11
+ post<T>(url: string, data: unknown, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
12
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AxiosHttpClient = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ /**
9
+ * Axios-based HTTP client that isolates SDK traffic from any global axios configuration.
10
+ * It uses its own axios instance, so external/global interceptors and defaults won't affect SDK requests.
11
+ */
12
+ class AxiosHttpClient {
13
+ constructor(config) {
14
+ this.instance = axios_1.default.create(config);
15
+ }
16
+ async get(url, config) {
17
+ return this.instance.get(url, config);
18
+ }
19
+ async post(url, data, config) {
20
+ return this.instance.post(url, data, config);
21
+ }
22
+ }
23
+ exports.AxiosHttpClient = AxiosHttpClient;
@@ -0,0 +1,21 @@
1
+ import { mainnet, testnet } from '@tonappchain/artifacts';
2
+ import { InternalTACParams, InternalTONParams } from '../structs/InternalStruct';
3
+ import { IConfiguration } from '../interfaces';
4
+ import { Network, TACParams, TONParams } from '../structs/Struct';
5
+ export declare class Configuration implements IConfiguration {
6
+ readonly network: Network;
7
+ readonly artifacts: typeof testnet | typeof mainnet;
8
+ readonly TONParams: InternalTONParams;
9
+ readonly TACParams: InternalTACParams;
10
+ readonly liteSequencerEndpoints: string[];
11
+ constructor(network: Network, artifacts: typeof testnet | typeof mainnet, TONParams: InternalTONParams, TACParams: InternalTACParams, liteSequencerEndpoints: string[]);
12
+ static create(network: Network, artifacts: typeof testnet | typeof mainnet, TONParams?: TONParams, TACParams?: TACParams, customLiteSequencerEndpoints?: string[], delay?: number): Promise<Configuration>;
13
+ private static prepareTONParams;
14
+ private static prepareTACParams;
15
+ get nativeTONAddress(): string;
16
+ nativeTACAddress(): Promise<string>;
17
+ get getTrustedTACExecutors(): string[];
18
+ get getTrustedTONExecutors(): string[];
19
+ closeConnections(): unknown;
20
+ isContractDeployedOnTVM(address: string): Promise<boolean>;
21
+ }
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Configuration = void 0;
4
+ const ton_1 = require("@ton/ton");
5
+ const artifacts_1 = require("@tonappchain/artifacts");
6
+ const ethers_1 = require("ethers");
7
+ const retryableContractOpener_1 = require("../adapters/retryableContractOpener");
8
+ const Struct_1 = require("../structs/Struct");
9
+ const Settings_1 = require("../wrappers/Settings");
10
+ const Validator_1 = require("./Validator");
11
+ class Configuration {
12
+ constructor(network, artifacts, TONParams, TACParams, liteSequencerEndpoints) {
13
+ this.network = network;
14
+ this.artifacts = artifacts;
15
+ this.TONParams = TONParams;
16
+ this.TACParams = TACParams;
17
+ this.liteSequencerEndpoints = liteSequencerEndpoints;
18
+ }
19
+ static async create(network, artifacts, TONParams, TACParams, customLiteSequencerEndpoints, delay) {
20
+ const internalTONParams = await this.prepareTONParams(artifacts, TONParams, delay);
21
+ const internalTACParams = await this.prepareTACParams(artifacts, TACParams);
22
+ const liteSequencerEndpoints = customLiteSequencerEndpoints ??
23
+ (network === Struct_1.Network.TESTNET
24
+ ? artifacts_1.testnet.PUBLIC_LITE_SEQUENCER_ENDPOINTS
25
+ : artifacts_1.mainnet.PUBLIC_LITE_SEQUENCER_ENDPOINTS);
26
+ return new Configuration(network, artifacts, internalTONParams, internalTACParams, liteSequencerEndpoints);
27
+ }
28
+ static async prepareTONParams(artifacts, TONParams, delay) {
29
+ const contractOpener = TONParams?.contractOpener ?? (await (0, retryableContractOpener_1.createDefaultRetryableOpener)(artifacts, 3, delay));
30
+ const settingsAddress = TONParams?.settingsAddress ?? artifacts.TON_SETTINGS_ADDRESS;
31
+ const settings = contractOpener.open(new Settings_1.Settings(ton_1.Address.parse(settingsAddress)));
32
+ const jettonProxyAddress = await settings.getAddressSetting('JettonProxyAddress');
33
+ const crossChainLayerAddress = await settings.getAddressSetting('CrossChainLayerAddress');
34
+ const jettonMinterCode = await settings.getCellSetting('JettonMinterCode');
35
+ const jettonWalletCode = await settings.getCellSetting('JettonWalletCode');
36
+ const nftProxyAddress = await settings.getAddressSetting('NFTProxyAddress');
37
+ const nftItemCode = await settings.getCellSetting('NFTItemCode');
38
+ const nftCollectionCode = await settings.getCellSetting('NFTCollectionCode');
39
+ return {
40
+ contractOpener,
41
+ jettonProxyAddress,
42
+ crossChainLayerAddress,
43
+ jettonMinterCode,
44
+ jettonWalletCode,
45
+ nftProxyAddress,
46
+ nftItemCode,
47
+ nftCollectionCode,
48
+ };
49
+ }
50
+ static async prepareTACParams(artifacts, TACParams) {
51
+ const provider = TACParams?.provider ?? ethers_1.ethers.getDefaultProvider(artifacts.TAC_RPC_ENDPOINT);
52
+ const settingsAddress = TACParams?.settingsAddress?.toString() ?? artifacts.TAC_SETTINGS_ADDRESS;
53
+ Validator_1.Validator.validateEVMAddress(settingsAddress);
54
+ const settings = artifacts.tac.wrappers.SettingsFactoryTAC.connect(settingsAddress, provider);
55
+ const crossChainLayerAddress = await settings.getAddressSetting((0, ethers_1.keccak256)((0, ethers_1.toUtf8Bytes)('CrossChainLayerAddress')));
56
+ const crossChainLayer = artifacts.tac.wrappers.CrossChainLayerFactoryTAC.connect(crossChainLayerAddress, provider);
57
+ const tokenUtilsAddress = await settings.getAddressSetting((0, ethers_1.keccak256)((0, ethers_1.toUtf8Bytes)('TokenUtilsAddress')));
58
+ const tokenUtils = artifacts.tac.wrappers.TokenUtilsFactoryTAC.connect(tokenUtilsAddress, provider);
59
+ const trustedTACExecutors = await settings.getTrustedEVMExecutors();
60
+ const trustedTONExecutors = await settings.getTrustedTVMExecutors();
61
+ return {
62
+ provider,
63
+ settings,
64
+ tokenUtils,
65
+ crossChainLayer,
66
+ trustedTACExecutors,
67
+ trustedTONExecutors,
68
+ abiCoder: new ethers_1.ethers.AbiCoder(),
69
+ };
70
+ }
71
+ get nativeTONAddress() {
72
+ return 'NONE';
73
+ }
74
+ async nativeTACAddress() {
75
+ return this.TACParams.crossChainLayer.NATIVE_TOKEN_ADDRESS.staticCall();
76
+ }
77
+ get getTrustedTACExecutors() {
78
+ return this.TACParams.trustedTACExecutors;
79
+ }
80
+ get getTrustedTONExecutors() {
81
+ return this.TACParams.trustedTONExecutors;
82
+ }
83
+ closeConnections() {
84
+ return this.TONParams.contractOpener.closeConnections?.();
85
+ }
86
+ async isContractDeployedOnTVM(address) {
87
+ return (await this.TONParams.contractOpener.getContractState(ton_1.Address.parse(address))).state === 'active';
88
+ }
89
+ }
90
+ exports.Configuration = Configuration;
@@ -1,12 +1,16 @@
1
- import { ExecutionStagesByOperationId, OperationIdsByShardsKey, OperationType, StatusInfosByOperationId, TransactionLinker } from '../structs/Struct';
1
+ import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStagesByOperationId, OperationIdsByShardsKey, OperationType, StatusInfosByOperationId, TransactionLinker } from '../structs/Struct';
2
+ import { IHttpClient } from '../interfaces';
2
3
  export declare class LiteSequencerClient {
3
4
  private readonly endpoint;
4
5
  private readonly maxChunkSize;
5
- constructor(endpoint: string, maxChunkSize?: number);
6
+ private readonly httpClient;
7
+ constructor(endpoint: string, maxChunkSize?: number, httpClient?: IHttpClient);
8
+ getOperationIdByTransactionHash(transactionHash: string): Promise<string>;
6
9
  getOperationType(operationId: string): Promise<OperationType>;
7
10
  getOperationId(transactionLinker: TransactionLinker): Promise<string>;
8
11
  getOperationIdsByShardsKeys(shardsKeys: string[], caller: string, chunkSize?: number): Promise<OperationIdsByShardsKey>;
9
12
  getStageProfilings(operationIds: string[], chunkSize?: number): Promise<ExecutionStagesByOperationId>;
10
13
  getOperationStatuses(operationIds: string[], chunkSize?: number): Promise<StatusInfosByOperationId>;
14
+ convertCurrency(params: ConvertCurrencyParams): Promise<ConvertedCurrencyResult>;
11
15
  private processChunkedRequest;
12
16
  }