@tonappchain/sdk 0.5.0 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +228 -149
- package/dist/adapters/contractOpener.js +1 -1
- package/dist/sdk/OperationTracker.d.ts +3 -4
- package/dist/sdk/OperationTracker.js +30 -18
- package/dist/sdk/StartTracking.d.ts +8 -2
- package/dist/sdk/StartTracking.js +77 -40
- package/dist/sdk/TacSdk.d.ts +3 -3
- package/dist/sdk/TacSdk.js +24 -21
- package/dist/sender/SenderFactory.d.ts +8 -8
- package/dist/sender/SenderFactory.js +15 -11
- package/dist/sender/TonConnectSender.d.ts +2 -1
- package/dist/sender/TonConnectSender.js +2 -2
- package/dist/structs/InternalStruct.d.ts +6 -4
- package/dist/structs/InternalStruct.js +2 -2
- package/dist/structs/Struct.d.ts +37 -20
- package/dist/structs/Struct.js +30 -7
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -47,17 +47,17 @@ To track an operation, you first need to obtain its `operationId`. The `operatio
|
|
|
47
47
|
|
|
48
48
|
After obtaining the `operationId`, you can check the operation’s status by using `OperationTracker.getOperationStatus(operationId: string)`. The following statuses may be returned:
|
|
49
49
|
|
|
50
|
-
1. **
|
|
51
|
-
2. **
|
|
52
|
-
3. **
|
|
53
|
-
4. **
|
|
54
|
-
5. **
|
|
55
|
-
6. **
|
|
50
|
+
1. **COLLECTED_IN_TAC:** The sequencer has collected all events for a single sharded message. For simple transfers (e.g., a token swap), this status indicates that the message is fully gathered.
|
|
51
|
+
2. **INCLUDED_IN_TAC_CONSENSUS:** The EVM message has been added to the Merkle tree, and subsequent roots will reflect this addition.
|
|
52
|
+
3. **EXECUTED_IN_TAC:** The collected message has been executed on the EVM side.
|
|
53
|
+
4. **COLLECTED_IN_TON:** After execution on EVM, a return message event is generated, which will then be executed on the TVM side.
|
|
54
|
+
5. **INCLUDED_IN_TON_CONSENSUS:** The TVM message has been added to the Merkle tree, updating future roots accordingly.
|
|
55
|
+
6. **EXECUTED_IN_TON:** The TVM Merkle message has been successfully executed on the TVM CrossChainLayer.
|
|
56
56
|
|
|
57
57
|
If an issue occurs, the error message will also be included in response.
|
|
58
58
|
|
|
59
59
|
### Terminal State
|
|
60
|
-
- **
|
|
60
|
+
- **EXECUTED_IN_TON**: Indicates that the operation has completed its full cycle from TVM to EVM and back.
|
|
61
61
|
|
|
62
62
|
---
|
|
63
63
|
|
|
@@ -81,7 +81,7 @@ import { TacSdk } from '@tonappchain/sdk';
|
|
|
81
81
|
import { Network } from '@tonappchain/sdk';
|
|
82
82
|
|
|
83
83
|
const sdkParams: SDKParams = {
|
|
84
|
-
network: Network.
|
|
84
|
+
network: Network.TESTNET
|
|
85
85
|
// you can also customize TAC and TON params here
|
|
86
86
|
};
|
|
87
87
|
const tacSdk = await TacSdk.create(sdkParams);
|
|
@@ -97,7 +97,7 @@ import { TacSdk, Network, liteClientOpener } from '@tonappchain/sdk';
|
|
|
97
97
|
const liteClientServers = [<liteClientServer1>, <liteClientServer1>, ...];
|
|
98
98
|
|
|
99
99
|
const sdkParams: SDKParams = {
|
|
100
|
-
network: Network.
|
|
100
|
+
network: Network.TESTNET,
|
|
101
101
|
TONParams: {
|
|
102
102
|
contractOpener: await liteClientOpener({ liteservers : liteClientServers }),
|
|
103
103
|
},
|
|
@@ -114,15 +114,15 @@ tacSdk.closeConnections();
|
|
|
114
114
|
|
|
115
115
|
Optionally, you can provide @ton/ton TonClient (public endpoints will be used by default):
|
|
116
116
|
|
|
117
|
-
- **
|
|
118
|
-
- **
|
|
117
|
+
- **MAINNET**: https://toncenter.com/api/v2/jsonRPC
|
|
118
|
+
- **TESTNET**: https://testnet.toncenter.com/api/v2/jsonRPC
|
|
119
119
|
|
|
120
120
|
```typescript
|
|
121
121
|
import { TacSdk, Network } from '@tonappchain/sdk';
|
|
122
122
|
import { TonClient } from '@ton/ton';
|
|
123
123
|
|
|
124
124
|
const sdk = await TacSdk.create({
|
|
125
|
-
network: Network.
|
|
125
|
+
network: Network.TESTNET,
|
|
126
126
|
delay: 1,
|
|
127
127
|
TONParams: {
|
|
128
128
|
contractOpener: new TonClient({
|
|
@@ -159,6 +159,7 @@ The `sendCrossChainTransaction` method is the core functionality of the `TacSdk`
|
|
|
159
159
|
- **`evmTargetAddress`**: Target address on the EVM network.
|
|
160
160
|
- **`methodName`** *(optional)*: Method name to execute on the target contract. Either method name `MethodName` or signature `MethodName(bytes,bytes)` must be specified (strictly (bytes,bytes)).
|
|
161
161
|
- **`encodedParameters`** *(optional)*: Encoded parameters for the EVM method. You need to specify all arguments except the first one (TACHeader bytes). The TACHeader logic will be specified below
|
|
162
|
+
- **`forceSend`** *(optional)*: Parameter indicates that the transaction should be sent even if simulation returned an error. Default `false`
|
|
162
163
|
|
|
163
164
|
- **`sender`**: A `SenderAbstraction` object, such as:
|
|
164
165
|
- **`TonConnectSender`**: For TonConnect integration.
|
|
@@ -384,7 +385,7 @@ This function provides a more detailed view of a user's Jetton balance, includin
|
|
|
384
385
|
- **`AddressError`**: invalid token address provided.
|
|
385
386
|
|
|
386
387
|
|
|
387
|
-
### Function: `
|
|
388
|
+
### Function: `simulateTACMessage`
|
|
388
389
|
|
|
389
390
|
This function will simulate the EVM message on the TAC side.
|
|
390
391
|
|
|
@@ -394,21 +395,21 @@ The ability to simulate the EVM message is crucial for testing and debugging cro
|
|
|
394
395
|
|
|
395
396
|
#### **Parameters**
|
|
396
397
|
|
|
397
|
-
- **`
|
|
398
|
+
- **`tacCallParams`**: An object defining the EVM-specific logic:
|
|
398
399
|
- **`target`**: Target address on the EVM network.
|
|
399
400
|
- **`methodName`**: Method name to execute on the target contract. Either method name `MethodName` or signature `MethodName(bytes,bytes)` must be specified (strictly (bytes,bytes)).
|
|
400
401
|
- **`arguments`**: Encoded parameters for the EVM method.
|
|
401
402
|
- **`extraData`**: Unstrusted Extra Data provided by executor.
|
|
402
403
|
- **`feeAssetAddress`**: TVM Fee Asset Address, empty string for native TON.
|
|
403
404
|
- **`shardedId`**: Sharded ID.
|
|
404
|
-
- **`
|
|
405
|
+
- **`tonAssets`**: An array of objects, each specifying the Assets details:
|
|
405
406
|
- **`tokenAddress`**: Address of the Asset.
|
|
406
407
|
- **`amount`**: Amount of Assets to be transferred.
|
|
407
|
-
- **`
|
|
408
|
+
- **`tonCaller`**: TVM Caller wallet address.
|
|
408
409
|
|
|
409
410
|
#### **Returns**
|
|
410
411
|
|
|
411
|
-
- **`Promise<
|
|
412
|
+
- **`Promise<TACSimulationResults>`**:
|
|
412
413
|
- A promise that resolves to detailed information about the execution of the given message, including:
|
|
413
414
|
- **`estimatedGas`**: The estimated gas required for the message.
|
|
414
415
|
- **`estimatedJettonFeeAmount`**: The estimated fee amount in Jettons.
|
|
@@ -464,7 +465,7 @@ The `RawSender` class allows direct interaction with the blockchain using a raw
|
|
|
464
465
|
```typescript
|
|
465
466
|
const walletVersion = 'v4';
|
|
466
467
|
const mnemonic = process.env.TVM_MNEMONICS || ''; // 24 words mnemonic
|
|
467
|
-
const network = Network.
|
|
468
|
+
const network = Network.TESTNET; // or Network.MAINNET
|
|
468
469
|
const sender = await SenderFactory.getSender({
|
|
469
470
|
version: walletVersion,
|
|
470
471
|
mnemonic,
|
|
@@ -475,13 +476,13 @@ const sender = await SenderFactory.getSender({
|
|
|
475
476
|
- **Supported wallet versions**:
|
|
476
477
|
```
|
|
477
478
|
export type WalletVersion =
|
|
478
|
-
| "
|
|
479
|
-
| "
|
|
480
|
-
| "
|
|
481
|
-
| "
|
|
482
|
-
| "
|
|
483
|
-
| "
|
|
484
|
-
| "
|
|
479
|
+
| "V2R1"
|
|
480
|
+
| "V2R2"
|
|
481
|
+
| "V3R1"
|
|
482
|
+
| "V3R2"
|
|
483
|
+
| "V4"
|
|
484
|
+
| "V5R1"
|
|
485
|
+
| "HIGHLOAD_V3";
|
|
485
486
|
```
|
|
486
487
|
|
|
487
488
|
- **Possible exceptions**:
|
|
@@ -509,7 +510,7 @@ To use the `OperationTracker` class, initialize it with the required parameters
|
|
|
509
510
|
import { OperationTracker, Network } from '@tonappchain/sdk';
|
|
510
511
|
|
|
511
512
|
const tracker = new OperationTracker(
|
|
512
|
-
network: Network.
|
|
513
|
+
network: Network.TESTNET,
|
|
513
514
|
// customLiteSequencerEndpoints: ["custom.com"]
|
|
514
515
|
);
|
|
515
516
|
```
|
|
@@ -533,7 +534,7 @@ Use the `getOperationId(transactionLinker)` method with the `transactionLinker`
|
|
|
533
534
|
#### **Usage**:
|
|
534
535
|
```typescript
|
|
535
536
|
const tracker = new OperationTracker(
|
|
536
|
-
network: Network.
|
|
537
|
+
network: Network.TESTNET
|
|
537
538
|
);
|
|
538
539
|
const operationId = await tracker.getOperationId(transactionLinker);
|
|
539
540
|
console.log('Operation ID:', operationId);
|
|
@@ -550,29 +551,35 @@ Retrieves the current status of an operation using its `operationId`.
|
|
|
550
551
|
#### **Parameters**:
|
|
551
552
|
- `operationId`: The identifier obtained from `getOperationId`.
|
|
552
553
|
|
|
553
|
-
#### **Returns**:
|
|
554
|
-
- **`Promise<StatusInfo>`**:
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
554
|
+
#### **Returns**:
|
|
555
|
+
- **`Promise<StatusInfo>`**:
|
|
556
|
+
A structure representing the operation's status, including:
|
|
557
|
+
- **`stage`** A value of type `StageName` (enum) which can be one of:
|
|
558
|
+
- `StageName.COLLECTED_IN_TAC` ('COLLECTED_IN_TAC')
|
|
559
|
+
- `StageName.INCLUDED_IN_TAC_CONSENSUS` ('INCLUDED_IN_TAC_CONSENSUS')
|
|
560
|
+
- `StageName.EXECUTED_IN_TAC` ('EXECUTED_IN_TAC')
|
|
561
|
+
- `StageName.COLLECTED_IN_TON` ('COLLECTED_IN_TON')
|
|
562
|
+
- `StageName.INCLUDED_IN_TON_CONSENSUS` ('INCLUDED_IN_TON_CONSENSUS')
|
|
563
|
+
- `StageName.EXECUTED_IN_TON` ('EXECUTED_IN_TON')
|
|
564
|
+
- **`success`** (`boolean`): Indicates if the stage completed successfully.
|
|
565
|
+
- **`timestamp`** (`number`): UNIX timestamp of the stage’s completion.
|
|
566
|
+
- **`transactions`**: An array of `TransactionData` objects or null. Each transaction contains:
|
|
567
|
+
- **`hash`**: A string with the transaction hash.
|
|
568
|
+
- **`blockchainType`**: A `BlockchainType` indicating the blockchain (`TAC`, `TON`).
|
|
569
|
+
- **`note`**: An object of type `NoteInfo` or null containing error/debug information:
|
|
570
|
+
- **`content`**: A string with additional details.
|
|
571
|
+
- **`errorName`**: A string representing the error name.
|
|
572
|
+
- **`internalMsg`**: A string with an internal message.
|
|
573
|
+
- **`internalBytesError`**: A string with internal error details in bytes.
|
|
574
|
+
|
|
575
|
+
|
|
566
576
|
#### **Usage**:
|
|
567
577
|
```typescript
|
|
568
578
|
const tracker = new OperationTracker(
|
|
569
|
-
network: Network.
|
|
579
|
+
network: Network.TESTNET
|
|
570
580
|
);
|
|
571
|
-
const
|
|
572
|
-
|
|
573
|
-
console.log('Error:', status);
|
|
574
|
-
}
|
|
575
|
-
console.log('Operation Status:', status);
|
|
581
|
+
const status = await tracker.getOperationStatus(operationId);
|
|
582
|
+
console.log('Stage:', status.stage)
|
|
576
583
|
```
|
|
577
584
|
|
|
578
585
|
---
|
|
@@ -581,21 +588,20 @@ Retrieves the current status of an operation using its `operationId`.
|
|
|
581
588
|
|
|
582
589
|
Use the `getSimplifiedOperationStatus(transactionLinker)` method for an easy-to-interpret status.
|
|
583
590
|
|
|
584
|
-
#### Method: `getSimplifiedOperationStatus(transactionLinker: TransactionLinker
|
|
591
|
+
#### Method: `getSimplifiedOperationStatus(transactionLinker: TransactionLinker): Promise<SimplifiedStatuses>`
|
|
585
592
|
|
|
586
593
|
Fetches a simplified operation status using the `transactionLinker`.
|
|
587
594
|
|
|
588
595
|
#### **Parameters**:
|
|
589
596
|
- `transactionLinker`: A `TransactionLinker` object returned from `sendCrossChainTransaction` function.
|
|
590
|
-
- `isBridgeOperation` *(optional)*: If your operation should only execute on EVM side without returning to TVM set `isBridgeOperation` to **true**. TAC protocol can just bridge the assets.
|
|
591
597
|
|
|
592
598
|
#### **Returns**:
|
|
593
599
|
- **`Promise<SimplifiedStatuses>`**:
|
|
594
600
|
- A simplified status from the `SimplifiedStatuses` enum:
|
|
595
|
-
- **`
|
|
596
|
-
- **`
|
|
597
|
-
- **`
|
|
598
|
-
- **`
|
|
601
|
+
- **`PENDING`**: The operation is still in progress.
|
|
602
|
+
- **`SUCCESSFUL`**: The operation has successfully completed.
|
|
603
|
+
- **`OPERATION_ID_NOT_FOUND`**: The operation ID could not be found.
|
|
604
|
+
- **`FAILED`**: The operation failed.
|
|
599
605
|
|
|
600
606
|
#### **Usage**
|
|
601
607
|
Here operationId will be always requested(not optimal).
|
|
@@ -605,8 +611,24 @@ const simplifiedStatus = await tracker.getSimpifiedOperationStatus(transactionLi
|
|
|
605
611
|
console.log('Simplified Status:', simplifiedStatus);
|
|
606
612
|
```
|
|
607
613
|
|
|
608
|
-
---
|
|
609
614
|
### Other functions
|
|
615
|
+
#### **Method: `getOperationType(operationId: string): Promise<OperationType>`**
|
|
616
|
+
|
|
617
|
+
Retrieves the current type of operation using its `operationId`.
|
|
618
|
+
|
|
619
|
+
#### **Parameters**:
|
|
620
|
+
- `operationId`: The identifier obtained from `getOperationType`.
|
|
621
|
+
|
|
622
|
+
#### **Returns**:
|
|
623
|
+
- **`Promise<OperationType>`**:
|
|
624
|
+
- A type from the `operationType` enum:
|
|
625
|
+
- **`PENDING`**: The operation is still in progress.
|
|
626
|
+
- **`TON_TAC_TON`**: The operation has successfully completed in TON-TAC-TON.
|
|
627
|
+
- **`ROLLBACK`**: The operation failed and there was an asset rollback.
|
|
628
|
+
- **`TON_TAC`**: The operation has successfully completed in TON-TAC.
|
|
629
|
+
- **`TAC_TON`**: The operation has successfully completed in TAC-TON.
|
|
630
|
+
- **`UNKNOWN`**: unknown operation type.
|
|
631
|
+
|
|
610
632
|
|
|
611
633
|
#### Method: `getOperationIdsByShardsKeys(shardsKeys: string[], caller: string): Promise<OperationIdsByShardsKey>`
|
|
612
634
|
|
|
@@ -666,17 +688,22 @@ Fetches the current status information for multiple operations based on their op
|
|
|
666
688
|
|
|
667
689
|
Track the execution of crosschain operation with `startTracking` method
|
|
668
690
|
|
|
669
|
-
#### Method: `async startTracking(transactionLinker: TransactionLinker, network:
|
|
691
|
+
#### Method: `async function startTracking(transactionLinker: TransactionLinker, network: Network, options?: { customLiteSequencerEndpoints?: string[]; delay?: number; maxIterationCount?: number; returnValue?: boolean; tableView?: boolean; }): Promise<void | ExecutionStages>`
|
|
670
692
|
|
|
671
693
|
#### **Parameters**:
|
|
672
694
|
- `transactionLinker`: A `TransactionLinker` object returned from `sendCrossChainTransaction` function.
|
|
673
695
|
- `network`: TON network (`Network` type).
|
|
674
|
-
- `
|
|
675
|
-
|
|
696
|
+
- `options` *(optional)*:
|
|
697
|
+
- `customLiteSequencerEndpoints` *(optional)*: specify custom lite sequencer API URL for sending requests there. Default is `undefined`
|
|
698
|
+
- `delay` *(optional)*: specify custom delay after requests there. Default is `10`
|
|
699
|
+
- `maxIterationCount` *(optional)*: specify custom max iteration count there. Default is `120`
|
|
700
|
+
- `returnValue` *(optional)*: specify whether to return the data to you after tracking. When `false` will write to the console. Default is `false`
|
|
701
|
+
- `tableView` *(optional)*: specify data display in the table. Default is `true`
|
|
676
702
|
|
|
677
703
|
#### **Returns**:
|
|
678
|
-
-
|
|
679
|
-
|
|
704
|
+
- Will stop requesting status once the final status of crosschain operation has been reached.
|
|
705
|
+
- if returnValue is `false` return `Promise<void>`
|
|
706
|
+
- if `true` return `Promise<ExecutionStages>` - execution stages profiling data.
|
|
680
707
|
|
|
681
708
|
#### **Possible exceptions**
|
|
682
709
|
|
|
@@ -685,7 +712,7 @@ Track the execution of crosschain operation with `startTracking` method
|
|
|
685
712
|
#### **Usage**
|
|
686
713
|
Here operationId will be always requested(not optimal).
|
|
687
714
|
```typescript
|
|
688
|
-
await startTracking(transactionLinker, network.
|
|
715
|
+
await startTracking(transactionLinker, network.TESTNET);
|
|
689
716
|
```
|
|
690
717
|
|
|
691
718
|
---
|
|
@@ -696,13 +723,13 @@ await startTracking(transactionLinker, network.Testnet);
|
|
|
696
723
|
Represents TON network type you want to use.
|
|
697
724
|
```typescript
|
|
698
725
|
export enum Network {
|
|
699
|
-
|
|
700
|
-
|
|
726
|
+
TESTNET = 'TESTNET',
|
|
727
|
+
MAINNET = 'MAINNET'
|
|
701
728
|
}
|
|
702
729
|
```
|
|
703
730
|
|
|
704
|
-
- **`
|
|
705
|
-
- **`
|
|
731
|
+
- **`TESTNET`**: Represents the testnet TON network.
|
|
732
|
+
- **`MAINNET`**: Represents the mainnet TON network.
|
|
706
733
|
|
|
707
734
|
|
|
708
735
|
### `SDKParams (Type)`
|
|
@@ -770,7 +797,7 @@ Represents a proxy message to a TAC.
|
|
|
770
797
|
- **`evmTargetAddress`**: Target address on the EVM network.
|
|
771
798
|
- **`methodName`** *(optional)*: Method name to be called on the target contract. Either method name `MethodName` or signature `MethodName(bytes,bytes)` must be specified (strictly (bytes,bytes)).
|
|
772
799
|
- **`encodedParameters`** *(optional)*: Parameters for the method, encoded as a string.
|
|
773
|
-
- **`gasLimit`** *(optional)*: `gasLimit` is a parameter that will be passed on the TAC side. The executor must allocate at least gasLimit gas for executing the transaction on the TAC side. If this parameter is not specified, it will be calculated using the `
|
|
800
|
+
- **`gasLimit`** *(optional)*: `gasLimit` is a parameter that will be passed on the TAC side. The executor must allocate at least gasLimit gas for executing the transaction on the TAC side. If this parameter is not specified, it will be calculated using the `simulateTACMessage` method(prefered).
|
|
774
801
|
|
|
775
802
|
This structure defines the logic you want to execute on the TAC side. This message is sent along with all the sharded messages related to the jetton bridging, enabling the TAC to process the intended logic on the TAC side during the crosschain transaction.
|
|
776
803
|
|
|
@@ -842,17 +869,17 @@ This structure is designed to help track the entire execution path of a operatio
|
|
|
842
869
|
### `SimplifiedStatuses (Enum)`
|
|
843
870
|
```typescript
|
|
844
871
|
export enum SimplifiedStatuses {
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
872
|
+
PENDING = 'PENDING',
|
|
873
|
+
FAILED = 'FAILED',
|
|
874
|
+
SUCCESSFUL = 'SUCCESSFUL',
|
|
875
|
+
OPERATION_ID_NOT_FOUND = 'OPERATION_ID_NOT_FOUND',
|
|
849
876
|
}
|
|
850
877
|
```
|
|
851
878
|
Represents the simplified operation statuses.
|
|
852
|
-
- **`
|
|
853
|
-
- **`
|
|
854
|
-
- **`
|
|
855
|
-
- **`
|
|
879
|
+
- **`PENDING`**: The operation in progress.
|
|
880
|
+
- **`FAILED`**: The operation has failed.
|
|
881
|
+
- **`SUCCESSFUL`**: The operation was executed successfully.
|
|
882
|
+
- **`OPERATION_ID_NOT_FOUND`**: The operation ID was not found.
|
|
856
883
|
|
|
857
884
|
|
|
858
885
|
### `ContractOpener (Interface)`
|
|
@@ -871,11 +898,11 @@ export interface ContractOpener {
|
|
|
871
898
|
```
|
|
872
899
|
|
|
873
900
|
|
|
874
|
-
### `
|
|
901
|
+
### `TACSimulationRequest`
|
|
875
902
|
|
|
876
903
|
```typescript
|
|
877
|
-
export type
|
|
878
|
-
|
|
904
|
+
export type TACSimulationRequest = {
|
|
905
|
+
tacCallParams: {
|
|
879
906
|
arguments: string;
|
|
880
907
|
methodName: string;
|
|
881
908
|
target: string;
|
|
@@ -883,27 +910,39 @@ export type EVMSimulationRequest = {
|
|
|
883
910
|
extraData: string;
|
|
884
911
|
feeAssetAddress: string;
|
|
885
912
|
shardsKey: number;
|
|
886
|
-
|
|
913
|
+
tonAssets: {
|
|
887
914
|
amount: string;
|
|
888
915
|
tokenAddress: string;
|
|
889
916
|
}[];
|
|
890
|
-
|
|
917
|
+
tonCaller: string;
|
|
891
918
|
};
|
|
892
919
|
```
|
|
893
920
|
|
|
894
|
-
Represents a request to simulate an
|
|
921
|
+
Represents a request to simulate an TAC message.
|
|
895
922
|
|
|
896
|
-
- **`
|
|
897
|
-
- **`arguments`**: Encoded arguments for the
|
|
898
|
-
- **`methodName`**: Name of the method to be called on the target
|
|
899
|
-
- **`target`**: The target address on the
|
|
900
|
-
- **`extraData`**: Additional non-root data to be included in
|
|
923
|
+
- **`tacCallParams`**: An object containing parameters for the TAC call.
|
|
924
|
+
- **`arguments`**: Encoded arguments for the TAC method.
|
|
925
|
+
- **`methodName`**: Name of the method to be called on the target TAC contract.
|
|
926
|
+
- **`target`**: The target address on the TAC network.
|
|
927
|
+
- **`extraData`**: Additional non-root data to be included in TAC call.
|
|
901
928
|
- **`feeAssetAddress`**: Address of the asset used to cover fees; empty string if using native TON.
|
|
902
929
|
- **`shardsKey`**: Key identifying shards for the operation.
|
|
903
|
-
- **`
|
|
930
|
+
- **`tonAssets`**: An array of assets involved in the transaction.
|
|
904
931
|
- **`amount`**: Amount of the asset to be transferred.
|
|
905
932
|
- **`tokenAddress`**: Address of the token.
|
|
906
|
-
- **`
|
|
933
|
+
- **`tonCaller`**: Address of the caller in the TON.
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
### `BlockchainType`
|
|
937
|
+
|
|
938
|
+
```typescript
|
|
939
|
+
export enum BlockchainType {
|
|
940
|
+
TAC = 'TAC',
|
|
941
|
+
TON = 'TON',
|
|
942
|
+
}
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
Represents blockchain type.
|
|
907
946
|
|
|
908
947
|
|
|
909
948
|
### `TransactionData`
|
|
@@ -911,21 +950,23 @@ Represents a request to simulate an EVM message.
|
|
|
911
950
|
```typescript
|
|
912
951
|
export type TransactionData = {
|
|
913
952
|
hash: string;
|
|
953
|
+
blockchainType: BlockchainType;
|
|
914
954
|
};
|
|
915
955
|
```
|
|
916
956
|
|
|
917
957
|
Represents transaction details.
|
|
918
958
|
- **`hash`**: The hash of the transaction.
|
|
959
|
+
- **`blockchainType`**: The type of the blockchain (`TON` or `TAC`).
|
|
919
960
|
|
|
920
961
|
|
|
921
962
|
### `NoteInfo`
|
|
922
963
|
|
|
923
964
|
```typescript
|
|
924
965
|
export type NoteInfo = {
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
966
|
+
content: string;
|
|
967
|
+
errorName: string;
|
|
968
|
+
internalMsg: string;
|
|
969
|
+
internalBytesError: string;
|
|
929
970
|
};
|
|
930
971
|
```
|
|
931
972
|
|
|
@@ -937,14 +978,30 @@ Provides detailed information about any notes or errors encountered during opera
|
|
|
937
978
|
- **`internalBytesError`**: Detailed bytes error information.
|
|
938
979
|
|
|
939
980
|
|
|
981
|
+
### `StageName`
|
|
982
|
+
|
|
983
|
+
```typescript
|
|
984
|
+
export enum StageName {
|
|
985
|
+
COLLECTED_IN_TAC = 'COLLECTED_IN_TAC',
|
|
986
|
+
INCLUDED_IN_TAC_CONSENSUS = 'INCLUDED_IN_TAC_CONSENSUS',
|
|
987
|
+
EXECUTED_IN_TAC = 'EXECUTED_IN_TAC',
|
|
988
|
+
COLLECTED_IN_TON = 'COLLECTED_IN_TON',
|
|
989
|
+
INCLUDED_IN_TON_CONSENSUS = 'INCLUDED_IN_TON_CONSENSUS',
|
|
990
|
+
EXECUTED_IN_TON = 'EXECUTED_IN_TON',
|
|
991
|
+
}
|
|
992
|
+
```
|
|
993
|
+
|
|
994
|
+
Represents stage in TAC protocol.
|
|
995
|
+
|
|
996
|
+
|
|
940
997
|
### `StageData`
|
|
941
998
|
|
|
942
999
|
```typescript
|
|
943
1000
|
export type StageData = {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1001
|
+
success: boolean;
|
|
1002
|
+
timestamp: number;
|
|
1003
|
+
transactions: TransactionData[] | null;
|
|
1004
|
+
note: NoteInfo | null;
|
|
948
1005
|
};
|
|
949
1006
|
```
|
|
950
1007
|
|
|
@@ -962,23 +1019,48 @@ Represents data for a specific stage of operation execution.
|
|
|
962
1019
|
|
|
963
1020
|
```typescript
|
|
964
1021
|
export type StatusInfo = StageData & {
|
|
965
|
-
|
|
1022
|
+
stage: StageName;
|
|
966
1023
|
};
|
|
967
1024
|
```
|
|
968
1025
|
|
|
969
1026
|
Combines `StageData` with an additional stage identifier.
|
|
970
1027
|
|
|
971
|
-
- **`stage`**:
|
|
972
|
-
|
|
1028
|
+
- **`stage`**: Current stage in `StageName` enum.
|
|
973
1029
|
- **Other Properties from `StageData`**
|
|
974
1030
|
|
|
975
1031
|
|
|
1032
|
+
### `OperationType`
|
|
1033
|
+
|
|
1034
|
+
```typescript
|
|
1035
|
+
export enum OperationType {
|
|
1036
|
+
PENDING = "PENDING",
|
|
1037
|
+
TON_TAC_TON = "TON-TAC-TON",
|
|
1038
|
+
ROLLBACK = "ROLLBACK",
|
|
1039
|
+
TON_TAC = "TON-TAC",
|
|
1040
|
+
TAC_TON = "TAC-TON",
|
|
1041
|
+
UNKNOWN = "UNKNOWN",
|
|
1042
|
+
}
|
|
1043
|
+
```
|
|
1044
|
+
|
|
1045
|
+
Provides information about transaction.
|
|
1046
|
+
|
|
1047
|
+
- **`PENDING`**: The transaction is still processing and has not yet reached a final state.
|
|
1048
|
+
- **`TON_TAC_TON`**:
|
|
1049
|
+
The transaction succeeded fully:
|
|
1050
|
+
- Executed on **TAC** (successfully interacted with dapp)
|
|
1051
|
+
- Processed a `roundTrip` message (e.g., a cross-chain callback - bridging back received assets).
|
|
1052
|
+
- **`ROLLBACK`**: The transaction failed on TAC, and funds were rolled back to their original on TON (e.g., tokens returned to the sender).
|
|
1053
|
+
- **`TON_TAC`**: The transaction was fully executed on TAC. (successfully interacted with dapp or assets were bridged)
|
|
1054
|
+
- **`TAC_TON`**: The cross-chain bridge operation from TAC to TON has completed successfully (e.g., tokens bridged to TON).
|
|
1055
|
+
- **`UNKNOWN`**: The status could not be determined (e.g., due to network errors, invalid operation ID, or outdated data).
|
|
1056
|
+
|
|
1057
|
+
|
|
976
1058
|
### `ProfilingStageData`
|
|
977
1059
|
|
|
978
1060
|
```typescript
|
|
979
1061
|
export type ProfilingStageData = {
|
|
980
|
-
|
|
981
|
-
|
|
1062
|
+
exists: boolean;
|
|
1063
|
+
stageData: StageData | null;
|
|
982
1064
|
};
|
|
983
1065
|
|
|
984
1066
|
```
|
|
@@ -986,7 +1068,6 @@ export type ProfilingStageData = {
|
|
|
986
1068
|
Provides profiling information for a specific stage.
|
|
987
1069
|
|
|
988
1070
|
- **`exists`**: Indicates whether profiling data exists for the stage.
|
|
989
|
-
|
|
990
1071
|
- **`stageData`** *(optional)*: Detailed data of the stage. `null` if none.
|
|
991
1072
|
|
|
992
1073
|
|
|
@@ -994,21 +1075,19 @@ Provides profiling information for a specific stage.
|
|
|
994
1075
|
|
|
995
1076
|
```typescript
|
|
996
1077
|
export type ExecutionStages = {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
tvmMerkleMsgCollected: ProfilingStageData;
|
|
1001
|
-
tvmMerkleMsgExecuted: ProfilingStageData;
|
|
1002
|
-
};
|
|
1078
|
+
operationType: OperationType;
|
|
1079
|
+
} & Record<StageName, ProfilingStageData>;
|
|
1080
|
+
|
|
1003
1081
|
```
|
|
1004
1082
|
|
|
1005
1083
|
Represents the profiling data for all execution stages within an operation.
|
|
1006
|
-
|
|
1007
|
-
- **`
|
|
1008
|
-
- **`
|
|
1009
|
-
- **`
|
|
1010
|
-
- **`
|
|
1011
|
-
- **`
|
|
1084
|
+
- **`operationType`**.
|
|
1085
|
+
- **`COLLECTED_IN_TAC`**.
|
|
1086
|
+
- **`INCLUDED_IN_TAC_CONSENSUS`**.
|
|
1087
|
+
- **`EXECUTED_IN_TAC`**.
|
|
1088
|
+
- **`COLLECTED_IN_TON`**.
|
|
1089
|
+
- **`INCLUDED_IN_TON_CONSENSUS`**.
|
|
1090
|
+
- **`EXECUTED_IN_TON`**.
|
|
1012
1091
|
|
|
1013
1092
|
|
|
1014
1093
|
### `ExecutionStagesByOperationId`
|
|
@@ -1064,47 +1143,47 @@ Provides extended information about a user's Jetton balance.
|
|
|
1064
1143
|
- **`decimals`** *(optional)*: The number of decimals for the Jetton token. Present only if `exists` is `true`.
|
|
1065
1144
|
|
|
1066
1145
|
|
|
1067
|
-
### `
|
|
1146
|
+
### `TACSimulationResults`
|
|
1068
1147
|
|
|
1069
1148
|
```typescript
|
|
1070
|
-
export type
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1149
|
+
export type TACSimulationResults = {
|
|
1150
|
+
estimatedGas: bigint;
|
|
1151
|
+
estimatedJettonFeeAmount: string;
|
|
1152
|
+
feeParams: {
|
|
1153
|
+
currentBaseFee: string;
|
|
1154
|
+
isEip1559: boolean;
|
|
1155
|
+
suggestedGasPrice: string;
|
|
1156
|
+
suggestedGasTip: string;
|
|
1157
|
+
};
|
|
1158
|
+
message: string;
|
|
1159
|
+
outMessages:
|
|
1160
|
+
| {
|
|
1161
|
+
callerAddress: string;
|
|
1162
|
+
operationId: string;
|
|
1163
|
+
payload: string;
|
|
1164
|
+
queryId: number;
|
|
1165
|
+
targetAddress: string;
|
|
1166
|
+
tokensBurned: {
|
|
1167
|
+
amount: string;
|
|
1168
|
+
tokenAddress: string;
|
|
1169
|
+
}[];
|
|
1170
|
+
tokensLocked: {
|
|
1171
|
+
amount: string;
|
|
1172
|
+
tokenAddress: string;
|
|
1173
|
+
}[];
|
|
1174
|
+
}[]
|
|
1175
|
+
| null;
|
|
1176
|
+
simulationError: string;
|
|
1177
|
+
simulationStatus: boolean;
|
|
1178
|
+
debugInfo: {
|
|
1179
|
+
from: string;
|
|
1180
|
+
to: string;
|
|
1181
|
+
callData: string;
|
|
1182
|
+
blockNumber: number;
|
|
1183
|
+
};
|
|
1105
1184
|
};
|
|
1106
1185
|
```
|
|
1107
|
-
Provides
|
|
1186
|
+
Provides TAC simulation results.
|
|
1108
1187
|
|
|
1109
1188
|
- **`estimatedGas`**: The estimated gas required for the message.
|
|
1110
1189
|
- **`estimatedJettonFeeAmount`**: The estimated fee amount in Jettons.
|
|
@@ -1172,7 +1251,7 @@ const assets: AssetBridgingData[] = [
|
|
|
1172
1251
|
];
|
|
1173
1252
|
|
|
1174
1253
|
const sdkParams: SDKParams = {
|
|
1175
|
-
network: Network.
|
|
1254
|
+
network: Network.TESTNET
|
|
1176
1255
|
};
|
|
1177
1256
|
const tacSdk = await TacSdk.create(sdkParams);
|
|
1178
1257
|
|
|
@@ -17,7 +17,7 @@ function intToIP(int) {
|
|
|
17
17
|
return part4 + '.' + part3 + '.' + part2 + '.' + part1;
|
|
18
18
|
}
|
|
19
19
|
async function getDefaultLiteServers(network) {
|
|
20
|
-
const url = network === Struct_1.Network.
|
|
20
|
+
const url = network === Struct_1.Network.TESTNET ? artifacts_1.testnet.DEFAULT_LITESERVERS : artifacts_1.mainnet.DEFAULT_LITESERVERS;
|
|
21
21
|
const resp = await fetch(url);
|
|
22
22
|
const liteClients = await resp.json();
|
|
23
23
|
return liteClients.liteservers;
|