@tonappchain/sdk 0.7.2-scaled-ui-support-2 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +198 -198
  3. package/dist/artifacts/dev/index.d.ts +2 -2
  4. package/dist/artifacts/dev/index.js +2 -1
  5. package/dist/artifacts/dev/tac/endpoints.d.ts +1 -0
  6. package/dist/artifacts/dev/tac/endpoints.js +2 -1
  7. package/dist/artifacts/dev/ton/internal/build/CrossChainLayer.compiled.json +1 -1
  8. package/dist/artifacts/dev/ton/internal/build/Executor.compiled.json +1 -1
  9. package/dist/artifacts/dev/ton/internal/build/JettonProxy.compiled.json +1 -1
  10. package/dist/artifacts/dev/ton/internal/build/JettonWallet.compiled.json +1 -1
  11. package/dist/artifacts/dev/ton/internal/build/NFTItem.compiled.json +1 -1
  12. package/dist/artifacts/dev/ton/internal/build/NFTProxy.compiled.json +1 -1
  13. package/dist/artifacts/dev/ton/internal/build/Settings.compiled.json +1 -1
  14. package/dist/artifacts/dev/ton/internal/wrappers/CrossChainLayer.d.ts +53 -6
  15. package/dist/artifacts/dev/ton/internal/wrappers/CrossChainLayer.js +130 -17
  16. package/dist/artifacts/dev/ton/internal/wrappers/JettonMinter.d.ts +2 -0
  17. package/dist/artifacts/dev/ton/internal/wrappers/JettonMinter.js +3 -1
  18. package/dist/artifacts/dev/ton/internal/wrappers/JettonProxy.d.ts +9 -0
  19. package/dist/artifacts/dev/ton/internal/wrappers/JettonProxy.js +10 -1
  20. package/dist/artifacts/dev/ton/internal/wrappers/JettonWallet.d.ts +7 -0
  21. package/dist/artifacts/dev/ton/internal/wrappers/JettonWallet.js +9 -2
  22. package/dist/artifacts/dev/ton/internal/wrappers/NFTCollection.d.ts +9 -0
  23. package/dist/artifacts/dev/ton/internal/wrappers/NFTCollection.js +9 -0
  24. package/dist/artifacts/dev/ton/internal/wrappers/NFTItem.d.ts +7 -0
  25. package/dist/artifacts/dev/ton/internal/wrappers/NFTItem.js +7 -0
  26. package/dist/artifacts/dev/ton/internal/wrappers/NFTProxy.d.ts +7 -0
  27. package/dist/artifacts/dev/ton/internal/wrappers/NFTProxy.js +8 -1
  28. package/dist/artifacts/dev/ton/internal/wrappers/Settings.d.ts +1 -0
  29. package/dist/artifacts/dev/ton/internal/wrappers/Settings.js +1 -0
  30. package/dist/artifacts/dev/ton/internal/wrappers/utils/CrossChainLayerPayload.d.ts +10 -0
  31. package/dist/artifacts/dev/ton/internal/wrappers/utils/CrossChainLayerPayload.js +24 -0
  32. package/dist/artifacts/dev/ton/internal/wrappers/utils/MerkleRoots.d.ts +2 -1
  33. package/dist/artifacts/dev/ton/internal/wrappers/utils/MerkleRoots.js +9 -1
  34. package/dist/artifacts/mainnet/index.d.ts +2 -2
  35. package/dist/artifacts/mainnet/index.js +2 -1
  36. package/dist/artifacts/mainnet/tac/endpoints.d.ts +1 -0
  37. package/dist/artifacts/mainnet/tac/endpoints.js +2 -1
  38. package/dist/artifacts/mainnet/ton/endpoints.d.ts +1 -1
  39. package/dist/artifacts/mainnet/ton/endpoints.js +1 -1
  40. package/dist/artifacts/mainnet/ton/internal/build/CrossChainLayer.compiled.json +1 -1
  41. package/dist/artifacts/mainnet/ton/internal/build/Executor.compiled.json +1 -1
  42. package/dist/artifacts/mainnet/ton/internal/build/JettonMinter.compiled.json +1 -1
  43. package/dist/artifacts/mainnet/ton/internal/build/JettonProxy.compiled.json +1 -1
  44. package/dist/artifacts/mainnet/ton/internal/build/JettonWallet.compiled.json +1 -1
  45. package/dist/artifacts/mainnet/ton/internal/build/NFTItem.compiled.json +1 -1
  46. package/dist/artifacts/mainnet/ton/internal/build/NFTProxy.compiled.json +1 -1
  47. package/dist/artifacts/mainnet/ton/internal/wrappers/CrossChainLayer.d.ts +1 -13
  48. package/dist/artifacts/mainnet/ton/internal/wrappers/CrossChainLayer.js +7 -45
  49. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonMinter.d.ts +2 -2
  50. package/dist/artifacts/mainnet/ton/internal/wrappers/JettonMinter.js +2 -2
  51. package/dist/artifacts/testnet/index.d.ts +2 -2
  52. package/dist/artifacts/testnet/index.js +2 -1
  53. package/dist/artifacts/testnet/tac/endpoints.d.ts +1 -0
  54. package/dist/artifacts/testnet/tac/endpoints.js +2 -1
  55. package/dist/artifacts/testnet/ton/endpoints.d.ts +1 -1
  56. package/dist/artifacts/testnet/ton/endpoints.js +1 -1
  57. package/dist/artifacts/testnet/ton/internal/build/CrossChainLayer.compiled.json +1 -1
  58. package/dist/artifacts/testnet/ton/internal/build/Executor.compiled.json +1 -1
  59. package/dist/artifacts/testnet/ton/internal/build/JettonProxy.compiled.json +1 -1
  60. package/dist/artifacts/testnet/ton/internal/build/JettonWallet.compiled.json +1 -1
  61. package/dist/artifacts/testnet/ton/internal/build/NFTItem.compiled.json +1 -1
  62. package/dist/artifacts/testnet/ton/internal/build/NFTProxy.compiled.json +1 -1
  63. package/dist/artifacts/testnet/ton/internal/build/Settings.compiled.json +1 -1
  64. package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.d.ts +53 -6
  65. package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.js +130 -17
  66. package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.d.ts +2 -0
  67. package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.js +3 -1
  68. package/dist/artifacts/testnet/ton/internal/wrappers/JettonProxy.d.ts +9 -0
  69. package/dist/artifacts/testnet/ton/internal/wrappers/JettonProxy.js +10 -1
  70. package/dist/artifacts/testnet/ton/internal/wrappers/JettonWallet.d.ts +7 -0
  71. package/dist/artifacts/testnet/ton/internal/wrappers/JettonWallet.js +9 -2
  72. package/dist/artifacts/testnet/ton/internal/wrappers/NFTCollection.d.ts +9 -0
  73. package/dist/artifacts/testnet/ton/internal/wrappers/NFTCollection.js +9 -0
  74. package/dist/artifacts/testnet/ton/internal/wrappers/NFTItem.d.ts +7 -0
  75. package/dist/artifacts/testnet/ton/internal/wrappers/NFTItem.js +7 -0
  76. package/dist/artifacts/testnet/ton/internal/wrappers/NFTProxy.d.ts +7 -0
  77. package/dist/artifacts/testnet/ton/internal/wrappers/NFTProxy.js +8 -1
  78. package/dist/artifacts/testnet/ton/internal/wrappers/Settings.d.ts +1 -0
  79. package/dist/artifacts/testnet/ton/internal/wrappers/Settings.js +1 -0
  80. package/dist/artifacts/testnet/ton/internal/wrappers/utils/CrossChainLayerPayload.d.ts +10 -0
  81. package/dist/artifacts/testnet/ton/internal/wrappers/utils/CrossChainLayerPayload.js +24 -0
  82. package/dist/artifacts/testnet/ton/internal/wrappers/utils/MerkleRoots.d.ts +2 -1
  83. package/dist/artifacts/testnet/ton/internal/wrappers/utils/MerkleRoots.js +9 -1
  84. package/dist/src/adapters/BaseContractOpener.d.ts +76 -0
  85. package/dist/src/adapters/BaseContractOpener.js +440 -0
  86. package/dist/src/adapters/LiteClientOpener.d.ts +38 -0
  87. package/dist/src/adapters/LiteClientOpener.js +141 -0
  88. package/dist/src/adapters/OpenerUtils.d.ts +3 -0
  89. package/dist/src/adapters/OpenerUtils.js +40 -0
  90. package/dist/src/adapters/RetryableContractOpener.d.ts +40 -0
  91. package/dist/src/adapters/RetryableContractOpener.js +290 -0
  92. package/dist/src/adapters/SandboxOpener.d.ts +15 -0
  93. package/dist/src/adapters/SandboxOpener.js +35 -0
  94. package/dist/src/adapters/TonClient4Opener.d.ts +24 -0
  95. package/dist/src/adapters/TonClient4Opener.js +95 -0
  96. package/dist/src/adapters/TonClientOpener.d.ts +19 -0
  97. package/dist/src/adapters/TonClientOpener.js +82 -0
  98. package/dist/src/adapters/index.d.ts +7 -2
  99. package/dist/src/adapters/index.js +7 -2
  100. package/dist/src/assets/AssetCache.d.ts +8 -8
  101. package/dist/src/assets/AssetCache.js +3 -0
  102. package/dist/src/assets/AssetFactory.js +8 -2
  103. package/dist/src/assets/FT.d.ts +2 -3
  104. package/dist/src/assets/FT.js +4 -7
  105. package/dist/src/assets/NFT.d.ts +1 -1
  106. package/dist/src/assets/NFT.js +1 -1
  107. package/dist/src/assets/TON.d.ts +3 -2
  108. package/dist/src/assets/TON.js +2 -1
  109. package/dist/src/errors/errors.d.ts +12 -1
  110. package/dist/src/errors/errors.js +66 -2
  111. package/dist/src/errors/index.d.ts +2 -2
  112. package/dist/src/errors/index.js +4 -1
  113. package/dist/src/errors/instances.d.ts +7 -2
  114. package/dist/src/errors/instances.js +67 -2
  115. package/dist/src/index.d.ts +3 -1
  116. package/dist/src/index.js +6 -4
  117. package/dist/src/interfaces/Asset.d.ts +4 -9
  118. package/dist/src/interfaces/ContractOpener.d.ts +76 -2
  119. package/dist/src/interfaces/IOperationTracker.d.ts +22 -22
  120. package/dist/src/interfaces/ISimulator.d.ts +9 -1
  121. package/dist/src/interfaces/ITONTransactionManager.d.ts +20 -1
  122. package/dist/src/interfaces/ITacExplorerClient.d.ts +8 -0
  123. package/dist/src/interfaces/ITacExplorerClient.js +2 -0
  124. package/dist/src/interfaces/ITacSDK.d.ts +25 -1
  125. package/dist/src/interfaces/ITxFinalizer.d.ts +4 -0
  126. package/dist/src/interfaces/ITxFinalizer.js +2 -0
  127. package/dist/src/interfaces/WalletInstanse.d.ts +4 -8
  128. package/dist/src/interfaces/index.d.ts +1 -0
  129. package/dist/src/interfaces/index.js +1 -0
  130. package/dist/src/sdk/Configuration.d.ts +5 -3
  131. package/dist/src/sdk/Configuration.js +54 -7
  132. package/dist/src/sdk/Consts.d.ts +18 -1
  133. package/dist/src/sdk/Consts.js +21 -2
  134. package/dist/src/sdk/Fees.d.ts +21 -0
  135. package/dist/src/sdk/Fees.js +201 -0
  136. package/dist/src/sdk/LiteSequencerClient.d.ts +1 -0
  137. package/dist/src/sdk/LiteSequencerClient.js +39 -17
  138. package/dist/src/sdk/OperationTracker.d.ts +11 -11
  139. package/dist/src/sdk/OperationTracker.js +46 -94
  140. package/dist/src/sdk/Simulator.d.ts +10 -2
  141. package/dist/src/sdk/Simulator.js +102 -0
  142. package/dist/src/sdk/StartTracking.d.ts +12 -7
  143. package/dist/src/sdk/StartTracking.js +75 -49
  144. package/dist/src/sdk/TONTransactionManager.d.ts +5 -4
  145. package/dist/src/sdk/TONTransactionManager.js +63 -8
  146. package/dist/src/sdk/TacExplorerClient.d.ts +8 -0
  147. package/dist/src/sdk/TacExplorerClient.js +22 -0
  148. package/dist/src/sdk/TacSdk.d.ts +8 -2
  149. package/dist/src/sdk/TacSdk.js +27 -4
  150. package/dist/src/sdk/TxFinalizer.d.ts +4 -3
  151. package/dist/src/sdk/TxFinalizer.js +41 -41
  152. package/dist/src/sdk/Utils.d.ts +20 -1
  153. package/dist/src/sdk/Utils.js +158 -10
  154. package/dist/src/sender/BatchSender.js +19 -0
  155. package/dist/src/sender/MockSender.d.ts +2 -0
  156. package/dist/src/sender/MockSender.js +13 -0
  157. package/dist/src/sender/RawSender.js +34 -1
  158. package/dist/src/sender/SenderFactory.js +1 -1
  159. package/dist/src/sender/TonConnectSender.js +2 -0
  160. package/dist/src/sender/index.d.ts +1 -0
  161. package/dist/src/sender/index.js +1 -0
  162. package/dist/src/structs/InternalStruct.d.ts +98 -4
  163. package/dist/src/structs/Struct.d.ts +183 -7
  164. package/dist/src/structs/Struct.js +4 -3
  165. package/dist/src/wrappers/HighloadWalletV3.d.ts +5 -3
  166. package/dist/src/wrappers/HighloadWalletV3.js +14 -3
  167. package/package.json +121 -117
  168. package/dist/src/adapters/contractOpener.d.ts +0 -20
  169. package/dist/src/adapters/contractOpener.js +0 -126
  170. package/dist/src/adapters/retryableContractOpener.d.ts +0 -24
  171. package/dist/src/adapters/retryableContractOpener.js +0 -111
@@ -1,9 +1,10 @@
1
1
  import { SandboxContract } from '@ton/sandbox';
2
- import { OpenedContract } from '@ton/ton';
2
+ import { Cell, OpenedContract } from '@ton/ton';
3
3
  import { AbstractProvider } from 'ethers';
4
4
  import { JettonMinter, JettonMinterData } from '../../artifacts/tonTypes';
5
5
  import type { FT, NFT } from '../assets';
6
6
  import type { Asset, ContractOpener, ILogger } from '../interfaces';
7
+ import { SendResult } from './InternalStruct';
7
8
  export type ContractState = {
8
9
  balance: bigint;
9
10
  state: 'active' | 'uninitialized' | 'frozen';
@@ -81,6 +82,11 @@ export type SDKParams = {
81
82
  * URLs of lite sequencers
82
83
  */
83
84
  customLiteSequencerEndpoints?: string[];
85
+ /**
86
+ * Whether SDK logger should be passed to TON contract opener(s).
87
+ * Default: true
88
+ */
89
+ passLoggerToOpeners?: boolean;
84
90
  };
85
91
  export declare enum AssetType {
86
92
  NFT = "NFT",
@@ -103,14 +109,13 @@ export type EvmProxyMsg = {
103
109
  methodName?: string;
104
110
  encodedParameters?: string;
105
111
  gasLimit?: bigint;
106
- [key: string]: unknown;
107
112
  };
108
113
  export type TransactionLinker = {
109
114
  caller: string;
110
115
  shardCount: number;
111
116
  shardsKey: string;
112
117
  timestamp: number;
113
- sendTransactionResult?: unknown;
118
+ sendTransactionResult?: SendResult;
114
119
  };
115
120
  export type TransactionLinkerWithOperationId = TransactionLinker & {
116
121
  operationId?: string;
@@ -279,9 +284,21 @@ export type FeeParams = {
279
284
  protocolFee: bigint;
280
285
  evmExecutorFee: bigint;
281
286
  tvmExecutorFee: bigint;
287
+ evmEstimatedGas?: bigint;
282
288
  };
289
+ export type evmDataBuilder = (transactionLinker: TransactionLinker, evmProxyMsg: EvmProxyMsg, validExecutors: ValidExecutors) => Cell;
283
290
  export type CrossChainTransactionOptions = {
284
291
  allowSimulationError?: boolean;
292
+ /**
293
+ * If true, ensures TON transaction execution is validated before waiting for operation id.
294
+ * @default true
295
+ */
296
+ ensureTxExecuted?: boolean;
297
+ /**
298
+ * If true, validates explicitly provided fee params against suggested values.
299
+ * @default true
300
+ */
301
+ shouldValidateFees?: boolean;
285
302
  isRoundTrip?: boolean;
286
303
  protocolFee?: bigint;
287
304
  evmValidExecutors?: string[];
@@ -293,8 +310,9 @@ export type CrossChainTransactionOptions = {
293
310
  validateAssetsBalance?: boolean;
294
311
  waitOperationId?: boolean;
295
312
  waitOptions?: WaitOptions<string>;
313
+ evmDataBuilder?: evmDataBuilder;
296
314
  };
297
- export type BatchCrossChainTransactionOptions = Omit<CrossChainTransactionOptions, 'waitOperationId' | 'waitOptions'>;
315
+ export type BatchCrossChainTransactionOptions = Omit<CrossChainTransactionOptions, 'waitOperationId' | 'waitOptions' | 'ensureTxExecuted'>;
298
316
  export type CrossChainTransactionsOptions = {
299
317
  waitOperationIds?: boolean;
300
318
  waitOptions?: WaitOptions<OperationIdsByShardsKey>;
@@ -335,17 +353,17 @@ export type BatchCrossChainTxWithAssetLike = Omit<BatchCrossChainTx, 'assets'> &
335
353
  export interface WaitOptions<T = unknown, TContext = unknown> {
336
354
  /**
337
355
  * Timeout in milliseconds
338
- * @default 300000 (5 minutes)
356
+ * @default 30000 (5 minutes)
339
357
  */
340
358
  timeout?: number;
341
359
  /**
342
360
  * Maximum number of attempts
343
- * @default 30
361
+ * @default 10
344
362
  */
345
363
  maxAttempts?: number;
346
364
  /**
347
365
  * Delay between attempts in milliseconds
348
- * @default 10000 (10 seconds)
366
+ * @default 1000 (1 seconds)
349
367
  */
350
368
  delay?: number;
351
369
  /**
@@ -367,6 +385,11 @@ export interface WaitOptions<T = unknown, TContext = unknown> {
367
385
  * Receives both the result and optional context with additional parameters
368
386
  */
369
387
  onSuccess?: (result: T, context?: TContext) => Promise<void> | void;
388
+ /**
389
+ * Include underlying error stack trace in FetchError (innerStack)
390
+ * @default false
391
+ */
392
+ includeErrorTrace?: boolean;
370
393
  }
371
394
  export declare const defaultWaitOptions: WaitOptions;
372
395
  export declare enum Origin {
@@ -418,3 +441,156 @@ export type FTOriginAndData = {
418
441
  evmAddress?: string;
419
442
  jettonData?: JettonMinterData;
420
443
  };
444
+ export type CrossChainPayloadResult = {
445
+ body: Cell;
446
+ destinationAddress: string;
447
+ tonAmount: bigint;
448
+ tonNetworkFee: bigint;
449
+ tacEstimatedGas?: bigint;
450
+ transactionLinker: TransactionLinker;
451
+ };
452
+ export type GeneratePayloadParams = {
453
+ excessReceiver: string;
454
+ evmData: Cell;
455
+ crossChainTonAmount?: bigint;
456
+ forwardFeeTonAmount?: bigint;
457
+ feeParams?: FeeParams;
458
+ };
459
+ export type TacGasPrice = {
460
+ average: number;
461
+ fast: number;
462
+ slow: number;
463
+ };
464
+ /**
465
+ * Parameters for tracking and validating transaction trees
466
+ */
467
+ export type TrackTransactionTreeParams = {
468
+ /**
469
+ * Maximum number of transactions to fetch per pagination request
470
+ * @default 100
471
+ */
472
+ limit?: number;
473
+ /**
474
+ * Maximum depth to traverse in the transaction tree, inclusive (prevents infinite loops)
475
+ * @default 10
476
+ */
477
+ maxDepth?: number;
478
+ /**
479
+ * Maximum number of transactions to scan while searching by hash in account history.
480
+ * Prevents excessive full-history scans on high-activity accounts.
481
+ * @default 100
482
+ */
483
+ maxScannedTransactions?: number;
484
+ /**
485
+ * List of operation codes (opcodes) to skip for extra checks.
486
+ * Core phase validation is still applied.
487
+ * @default [ 0xd53276db ] // Excess
488
+ */
489
+ ignoreOpcodeList?: number[];
490
+ /**
491
+ * Direction to search the transaction tree:
492
+ * - 'forward': only search children (outgoing messages)
493
+ * - 'backward': only search parents (incoming messages)
494
+ * - 'both': search in both directions (default)
495
+ * @default 'both'
496
+ */
497
+ direction?: 'forward' | 'backward' | 'both';
498
+ /**
499
+ * Retry transaction lookup when `not_found` error occurs.
500
+ * Useful when transaction indexing has delays or when transactions appear gradually.
501
+ * @default true
502
+ */
503
+ retryOnNotFound?: boolean;
504
+ /**
505
+ * Delay in milliseconds between retry attempts for transaction lookup
506
+ * @default 5000
507
+ */
508
+ retryDelayMs?: number;
509
+ /**
510
+ * Number of retry attempts for transaction lookup
511
+ * @default 10
512
+ */
513
+ retries?: number;
514
+ };
515
+ /**
516
+ * Details about a transaction validation error
517
+ */
518
+ export type TransactionValidationError = {
519
+ /**
520
+ * Base64-encoded hash of the failed transaction (or the searched hash if not found)
521
+ */
522
+ txHash: string;
523
+ /**
524
+ * Exit code from the compute phase, or 'N/A' if compute phase is missing
525
+ */
526
+ exitCode: number | 'N/A';
527
+ /**
528
+ * Result code from the action phase, or 'N/A' if action phase is missing
529
+ */
530
+ resultCode: number | 'N/A';
531
+ /**
532
+ * Reason for validation failure:
533
+ * - 'aborted': default: transaction was aborted
534
+ * - 'compute_phase_missing': compute phase is missing
535
+ * - 'compute_phase_failed': compute phase failed (exitCode !== 0)
536
+ * - 'action_phase_failed': action phase failed (resultCode !== 0)
537
+ * - 'not_found': transaction or message hash not found during traversal
538
+ */
539
+ reason: 'aborted' | 'compute_phase_missing' | 'compute_phase_failed' | 'action_phase_failed' | 'not_found';
540
+ /**
541
+ * Address where the lookup was performed (for reason: 'not_found')
542
+ */
543
+ address?: string;
544
+ /**
545
+ * Hash type used in lookup (for reason: 'not_found')
546
+ */
547
+ hashType?: 'unknown' | 'in' | 'out';
548
+ };
549
+ /**
550
+ * Result of transaction tree tracking and validation
551
+ */
552
+ export type TrackTransactionTreeResult = {
553
+ /**
554
+ * Whether all transactions in the tree passed validation
555
+ */
556
+ success: boolean;
557
+ /**
558
+ * Count of unique transactions checked during traversal
559
+ */
560
+ checkedCount?: number;
561
+ /**
562
+ * Details about the first validation error encountered (if any)
563
+ */
564
+ error?: TransactionValidationError;
565
+ };
566
+ export type GetTransactionsOptions = {
567
+ /** Maximum number of transactions to retrieve */
568
+ limit?: number;
569
+ /** Logical time of the transaction to start from */
570
+ lt?: string;
571
+ /** Hash of the transaction to start from */
572
+ hash?: string;
573
+ /** Logical time of the transaction to end at */
574
+ to_lt?: string;
575
+ /** Whether to include the starting transaction in the results */
576
+ inclusive?: boolean;
577
+ /** Whether to search in archival nodes for historical data */
578
+ archival?: boolean;
579
+ /** Request timeout in milliseconds */
580
+ timeoutMs?: number;
581
+ /** Delay between retry attempts in milliseconds */
582
+ retryDelayMs?: number;
583
+ /** Number of retry attempts */
584
+ retries?: number;
585
+ /** Internal scan guard: maximum transactions to inspect while traversing history */
586
+ maxScannedTransactions?: number;
587
+ };
588
+ export type AddressInformation = {
589
+ /** Information about the last transaction of the address */
590
+ lastTransaction: {
591
+ /** Logical time of the last transaction */
592
+ lt: string;
593
+ /** Hash of the last transaction */
594
+ hash: string;
595
+ };
596
+ };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Origin = exports.defaultWaitOptions = exports.TokenSymbol = exports.StageName = exports.NFTAddressType = exports.AssetType = exports.OperationType = exports.CurrencyType = exports.BlockchainType = exports.Network = exports.SimplifiedStatuses = void 0;
4
+ const Consts_1 = require("../sdk/Consts");
4
5
  var SimplifiedStatuses;
5
6
  (function (SimplifiedStatuses) {
6
7
  SimplifiedStatuses["PENDING"] = "PENDING";
@@ -58,9 +59,9 @@ var TokenSymbol;
58
59
  TokenSymbol["TON_SYMBOL"] = "TON";
59
60
  })(TokenSymbol || (exports.TokenSymbol = TokenSymbol = {}));
60
61
  exports.defaultWaitOptions = {
61
- timeout: 300000,
62
- maxAttempts: 30,
63
- delay: 10000,
62
+ timeout: Consts_1.DEFAULT_WAIT_TIMEOUT_MS,
63
+ maxAttempts: Consts_1.DEFAULT_WAIT_MAX_ATTEMPTS,
64
+ delay: Consts_1.DEFAULT_WAIT_DELAY_MS,
64
65
  };
65
66
  var Origin;
66
67
  (function (Origin) {
@@ -25,6 +25,8 @@ export declare class HighloadWalletV3 implements WalletInstanse {
25
25
  data: Cell;
26
26
  } | undefined);
27
27
  getSeqno(): Promise<number>;
28
+ send(provider: ContractProvider, msg: Cell): Promise<void>;
29
+ createTransfer(): Cell;
28
30
  sendTransfer(provider: ContractProvider, args: {
29
31
  seqno?: number;
30
32
  secretKey: Buffer;
@@ -33,7 +35,7 @@ export declare class HighloadWalletV3 implements WalletInstanse {
33
35
  timeout?: number;
34
36
  subwalletId?: number;
35
37
  createdAt?: number;
36
- }): Promise<void>;
38
+ }): Promise<string>;
37
39
  static create(config: HighloadWalletV3Config, code?: Cell, workchain?: number): HighloadWalletV3;
38
40
  static generateCreatedAt(): number;
39
41
  sendExternalMessage(provider: ContractProvider, secretKey: Buffer, opts: {
@@ -43,8 +45,8 @@ export declare class HighloadWalletV3 implements WalletInstanse {
43
45
  createdAt: number;
44
46
  subwalletId: number;
45
47
  timeout: number;
46
- }): Promise<void>;
47
- sendBatch(provider: ContractProvider, secretKey: Buffer, messages: OutActionSendMsg[], subwallet: number, timeout: number, createdAt?: number, value?: bigint): Promise<void>;
48
+ }): Promise<string>;
49
+ sendBatch(provider: ContractProvider, secretKey: Buffer, messages: OutActionSendMsg[], subwallet: number, timeout: number, createdAt?: number, value?: bigint): Promise<string>;
48
50
  getQueryIdFromCreatedAt(createdAt: number): HighloadQueryId;
49
51
  getExternalMessage(messages: MessageRelaxed[], sendMode: SendMode, value: bigint, queryId: HighloadQueryId): MessageRelaxed;
50
52
  static createInternalTransferBody(opts: {
@@ -30,9 +30,15 @@ class HighloadWalletV3 {
30
30
  async getSeqno() {
31
31
  return 0; // will not be used
32
32
  }
33
+ async send(provider, msg) {
34
+ await provider.external(msg);
35
+ }
36
+ createTransfer() {
37
+ throw new Error('Not implemented. Use sendTransfer instead - it returns the BOC as a string');
38
+ }
33
39
  async sendTransfer(provider, args) {
34
40
  if (!args.messages.length) {
35
- return;
41
+ return '';
36
42
  }
37
43
  const state = await provider.getState();
38
44
  const isActive = state.state.type === 'active';
@@ -43,7 +49,7 @@ class HighloadWalletV3 {
43
49
  mode: args.sendMode,
44
50
  outMsg: msg,
45
51
  }));
46
- await this.sendBatch(provider, args.secretKey, actions, subwalletId, timeout, args.createdAt);
52
+ return await this.sendBatch(provider, args.secretKey, actions, subwalletId, timeout, args.createdAt);
47
53
  }
48
54
  static create(config, code = HIGHLOAD_V3_CODE, workchain = 0) {
49
55
  const data = highloadWalletV3ConfigToCell(config);
@@ -72,7 +78,12 @@ class HighloadWalletV3 {
72
78
  .storeUint(opts.createdAt, exports.TIMESTAMP_SIZE)
73
79
  .storeUint(opts.timeout, exports.TIMEOUT_SIZE)
74
80
  .endCell();
75
- await provider.external((0, ton_1.beginCell)().storeBuffer((0, ton_crypto_1.sign)(messageInner.hash(), secretKey)).storeRef(messageInner).endCell());
81
+ const externalMessage = (0, ton_1.beginCell)()
82
+ .storeBuffer((0, ton_crypto_1.sign)(messageInner.hash(), secretKey))
83
+ .storeRef(messageInner)
84
+ .endCell();
85
+ await provider.external(externalMessage);
86
+ return externalMessage.toBoc().toString('base64');
76
87
  }
77
88
  async sendBatch(provider, secretKey, messages, subwallet, timeout, createdAt, value = 0n) {
78
89
  if (createdAt == undefined) {
package/package.json CHANGED
@@ -1,117 +1,121 @@
1
- {
2
- "name": "@tonappchain/sdk",
3
- "version": "0.7.2-scaled-ui-support-2",
4
- "repository": "https://github.com/TacBuild/tac-sdk.git",
5
- "author": "TAC. <developers@tac>",
6
- "license": "MIT",
7
- "main": "dist/src/index.js",
8
- "types": "dist/src/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "node": {
12
- "types": "./dist/src/index.d.ts",
13
- "require": "./dist/src/index.js",
14
- "import": "./dist/src/index.js"
15
- },
16
- "browser": {
17
- "types": "./dist/src/index.d.ts",
18
- "import": "./dist/src/index.js"
19
- },
20
- "types": "./dist/src/index.d.ts",
21
- "require": "./dist/src/index.js",
22
- "import": "./dist/src/index.js",
23
- "default": "./dist/src/index.js"
24
- },
25
- "./package.json": "./package.json",
26
- "./dist": null,
27
- "./dist/*": null,
28
- "./src": null,
29
- "./src/*": null,
30
- "./artifacts": {
31
- "types": "./dist/artifacts/index.d.ts",
32
- "import": "./dist/artifacts/index.js",
33
- "require": "./dist/artifacts/index.js"
34
- },
35
- "./artifacts/types/ton": {
36
- "types": "./dist/artifacts/tonTypes.d.ts",
37
- "import": "./dist/artifacts/tonTypes.js",
38
- "require": "./dist/artifacts/tonTypes.js"
39
- },
40
- "./artifacts/types/tac": {
41
- "types": "./dist/artifacts/tacTypes.d.ts",
42
- "import": "./dist/artifacts/tacTypes.js",
43
- "require": "./dist/artifacts/tacTypes.js"
44
- },
45
- "./artifacts/*": null,
46
- "./*": null
47
- },
48
- "files": [
49
- "dist"
50
- ],
51
- "scripts": {
52
- "litebuild": "rm -rf dist && tsc --declaration",
53
- "build": "rm -rf dist && npm run build:artifacts && tsc --declaration",
54
- "build:artifacts:tac:dev": "cd artifacts/dev/l2-evm && npm i && npx hardhat compile && rsync -avh --delete ./artifacts ./scripts ./typechain-types ../tac/internal/",
55
- "build:artifacts:ton:dev": "cd artifacts/dev/l1_tvm_ton && npm i && npm run compile:ts && npm run build:all && rsync -avh --delete ./build ./wrappers ../ton/internal/",
56
- "build:artifacts:tac:testnet": "cd artifacts/testnet/l2-evm && npm i && npx hardhat compile && rsync -avh --delete ./artifacts ./scripts ./typechain-types ../tac/internal/",
57
- "build:artifacts:ton:testnet": "cd artifacts/testnet/l1_tvm_ton && npm i && npm run compile:ts && npm run build:all && rsync -avh --delete ./build ./wrappers ../ton/internal/",
58
- "build:artifacts:tac:mainnet": "cd artifacts/mainnet/l2-evm && npm i && npx hardhat compile && rsync -avh --delete ./artifacts ./scripts ./typechain-types ../tac/internal/",
59
- "build:artifacts:ton:mainnet": "cd artifacts/mainnet/l1_tvm_ton && npm i && npm run compile:ts && npm run build:all && rsync -avh --delete ./build ./wrappers ../ton/internal/",
60
- "build:artifacts:ton:all": "npm run build:artifacts:ton:dev && npm run build:artifacts:ton:testnet && npm run build:artifacts:ton:mainnet",
61
- "build:artifacts:tac:all": "npm run build:artifacts:tac:dev && npm run build:artifacts:tac:testnet && npm run build:artifacts:tac:mainnet",
62
- "build:artifacts": "npm run build:artifacts:ton:all && npm run build:artifacts:tac:all",
63
- "test": "jest --verbose --runInBand",
64
- "release": "yarn build && yarn release-it --npm.yarn1",
65
- "lint": "eslint .",
66
- "lint:fix": "eslint . --fix",
67
- "prettier": "prettier --ignore-path .gitignore --write \"./src/**/*.+(js|ts|json)\""
68
- },
69
- "dependencies": {
70
- "@aws-crypto/sha256-js": "^5.2.0",
71
- "@orbs-network/ton-access": "^2.3.3",
72
- "@ton/ton": "15.1.0",
73
- "@tonappchain/ton-lite-client": "3.0.6",
74
- "@tonconnect/ui": "^2.0.11",
75
- "bn.js": "^5.2.1",
76
- "cli-table3": "^0.6.5",
77
- "dotenv": "^16.4.7",
78
- "ethers": "^6.13.5",
79
- "ton-crypto": "^3.2.0"
80
- },
81
- "keywords": [],
82
- "description": "",
83
- "devDependencies": {
84
- "@eslint/js": "^9.21.0",
85
- "@jest/globals": "^29.7.0",
86
- "@release-it/keep-a-changelog": "^6.0.0",
87
- "@ton/sandbox": "^0.27.1",
88
- "@ton/test-utils": "^0.5.0",
89
- "@types/bn.js": "^5.1.6",
90
- "@types/jest": "^29.5.14",
91
- "eslint": "^9.21.0",
92
- "eslint-config-prettier": "^10.0.2",
93
- "eslint-plugin-simple-import-sort": "^12.1.1",
94
- "jest": "^29.7.0",
95
- "prettier": "^3.5.3",
96
- "ts-jest": "^29.2.6",
97
- "ts-node": "^10.9.2",
98
- "typescript": "^5.7.3",
99
- "typescript-eslint": "^8.17.0",
100
- "yarn": "^1.22.22"
101
- },
102
- "publishConfig": {
103
- "access": "public",
104
- "registry": "https://registry.npmjs.org/"
105
- },
106
- "release-it": {
107
- "plugins": {
108
- "@release-it/keep-a-changelog": {
109
- "filename": "CHANGELOG.md"
110
- }
111
- },
112
- "npm": {
113
- "publish": false
114
- }
115
- },
116
- "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
117
- }
1
+ {
2
+ "name": "@tonappchain/sdk",
3
+ "version": "0.7.2",
4
+ "repository": "https://github.com/TacBuild/tac-sdk.git",
5
+ "author": "TAC. <developers@tac>",
6
+ "license": "MIT",
7
+ "main": "dist/src/index.js",
8
+ "types": "dist/src/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "node": {
12
+ "types": "./dist/src/index.d.ts",
13
+ "require": "./dist/src/index.js",
14
+ "import": "./dist/src/index.js"
15
+ },
16
+ "browser": {
17
+ "types": "./dist/src/index.d.ts",
18
+ "import": "./dist/src/index.js"
19
+ },
20
+ "types": "./dist/src/index.d.ts",
21
+ "require": "./dist/src/index.js",
22
+ "import": "./dist/src/index.js",
23
+ "default": "./dist/src/index.js"
24
+ },
25
+ "./package.json": "./package.json",
26
+ "./dist": null,
27
+ "./dist/*": null,
28
+ "./src": null,
29
+ "./src/*": null,
30
+ "./artifacts": {
31
+ "types": "./dist/artifacts/index.d.ts",
32
+ "import": "./dist/artifacts/index.js",
33
+ "require": "./dist/artifacts/index.js"
34
+ },
35
+ "./artifacts/types/ton": {
36
+ "types": "./dist/artifacts/tonTypes.d.ts",
37
+ "import": "./dist/artifacts/tonTypes.js",
38
+ "require": "./dist/artifacts/tonTypes.js"
39
+ },
40
+ "./artifacts/types/tac": {
41
+ "types": "./dist/artifacts/tacTypes.d.ts",
42
+ "import": "./dist/artifacts/tacTypes.js",
43
+ "require": "./dist/artifacts/tacTypes.js"
44
+ },
45
+ "./artifacts/*": null,
46
+ "./*": null
47
+ },
48
+ "files": [
49
+ "dist"
50
+ ],
51
+ "scripts": {
52
+ "litebuild": "rm -rf dist && tsc --declaration",
53
+ "build": "bash build.sh",
54
+ "build:artifacts:tac:dev": "cd artifacts/dev/l2-evm && npm i && npx hardhat compile && rsync -avh --delete ./artifacts ./scripts ./typechain-types ../tac/internal/",
55
+ "build:artifacts:ton:dev": "cd artifacts/dev/l1_tvm_ton && npm i && npm run compile:ts && npm run build:all && rsync -avh --delete ./build ./wrappers ../ton/internal/",
56
+ "build:artifacts:tac:testnet": "cd artifacts/testnet/l2-evm && npm i && npx hardhat compile && rsync -avh --delete ./artifacts ./scripts ./typechain-types ../tac/internal/",
57
+ "build:artifacts:ton:testnet": "cd artifacts/testnet/l1_tvm_ton && npm i && npm run compile:ts && npm run build:all && rsync -avh --delete ./build ./wrappers ../ton/internal/",
58
+ "build:artifacts:tac:mainnet": "cd artifacts/mainnet/l2-evm && npm i && npx hardhat compile && rsync -avh --delete ./artifacts ./scripts ./typechain-types ../tac/internal/",
59
+ "build:artifacts:ton:mainnet": "cd artifacts/mainnet/l1_tvm_ton && npm i && npm run compile:ts && npm run build:all && rsync -avh --delete ./build ./wrappers ../ton/internal/",
60
+ "build:artifacts:ton:all": "npm run build:artifacts:ton:dev && npm run build:artifacts:ton:testnet && npm run build:artifacts:ton:mainnet",
61
+ "build:artifacts:tac:all": "npm run build:artifacts:tac:dev && npm run build:artifacts:tac:testnet && npm run build:artifacts:tac:mainnet",
62
+ "build:artifacts": "npm run build:artifacts:ton:all && npm run build:artifacts:tac:all",
63
+ "test": "jest --verbose --runInBand",
64
+ "release": "npm run build && npx release-it",
65
+ "lint": "eslint .",
66
+ "lint:fix": "eslint . --fix",
67
+ "prettier": "prettier --ignore-path .gitignore --write \"./src/**/*.+(js|ts|json)\""
68
+ },
69
+ "dependencies": {
70
+ "@aws-crypto/sha256-js": "^5.2.0",
71
+ "@orbs-network/ton-access": "^2.3.3",
72
+ "@tonappchain/ton-lite-client": "3.0.6",
73
+ "bn.js": "^5.2.3",
74
+ "cli-table3": "^0.6.5",
75
+ "dotenv": "^16.4.7"
76
+ },
77
+ "peerDependencies": {
78
+ "@ton/ton": ">=15",
79
+ "@tonconnect/ui": ">=2",
80
+ "ethers": ">=6",
81
+ "ton-crypto": ">=3"
82
+ },
83
+ "keywords": [],
84
+ "description": "",
85
+ "devDependencies": {
86
+ "@eslint/js": "^9.21.0",
87
+ "@jest/globals": "^29.7.0",
88
+ "@release-it/keep-a-changelog": "^7.0.0",
89
+ "@ton/sandbox": "^0.27.1",
90
+ "@ton/test-utils": "^0.5.0",
91
+ "@ton/ton": "16.2.2",
92
+ "@tonconnect/ui": "^2.0.11",
93
+ "@types/bn.js": "^5.1.6",
94
+ "@types/jest": "^29.5.14",
95
+ "eslint": "^9.26.0",
96
+ "eslint-config-prettier": "^10.0.2",
97
+ "eslint-plugin-simple-import-sort": "^12.1.1",
98
+ "ethers": "^6.13.5",
99
+ "jest": "^29.7.0",
100
+ "prettier": "^3.5.3",
101
+ "ton-crypto": "3.2.0",
102
+ "ts-jest": "^29.2.6",
103
+ "ts-node": "^10.9.2",
104
+ "typescript": "^5.7.3",
105
+ "typescript-eslint": "^8.17.0"
106
+ },
107
+ "publishConfig": {
108
+ "access": "public",
109
+ "registry": "https://registry.npmjs.org/"
110
+ },
111
+ "release-it": {
112
+ "plugins": {
113
+ "@release-it/keep-a-changelog": {
114
+ "filename": "CHANGELOG.md"
115
+ }
116
+ },
117
+ "npm": {
118
+ "publish": false
119
+ }
120
+ }
121
+ }
@@ -1,20 +0,0 @@
1
- import { Blockchain } from '@ton/sandbox';
2
- import { ContractOpener } from '../interfaces';
3
- import { Network } from '../structs/Struct';
4
- type LiteServer = {
5
- ip: number;
6
- port: number;
7
- id: {
8
- '@type': string;
9
- key: string;
10
- };
11
- };
12
- export declare function liteClientOpener(options: {
13
- liteservers: LiteServer[];
14
- } | {
15
- network: Network;
16
- }): Promise<ContractOpener>;
17
- export declare function sandboxOpener(blockchain: Blockchain): ContractOpener;
18
- export declare function orbsOpener(network: Network): Promise<ContractOpener>;
19
- export declare function orbsOpener4(network: Network, timeout?: number): Promise<ContractOpener>;
20
- export {};