@tonappchain/sdk 0.7.2-alpha-11 → 0.7.2-alpha-14
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/dist/artifacts/dev/ton/internal/build/CrossChainLayer.compiled.json +1 -1
- package/dist/src/adapters/BaseContractOpener.d.ts +76 -0
- package/dist/src/adapters/BaseContractOpener.js +445 -0
- package/dist/src/adapters/LiteClientOpener.d.ts +38 -0
- package/dist/src/adapters/LiteClientOpener.js +141 -0
- package/dist/src/adapters/OpenerUtils.d.ts +3 -0
- package/dist/src/adapters/OpenerUtils.js +39 -0
- package/dist/src/adapters/RetryableContractOpener.d.ts +40 -0
- package/dist/src/adapters/RetryableContractOpener.js +287 -0
- package/dist/src/adapters/SandboxOpener.d.ts +15 -0
- package/dist/src/adapters/SandboxOpener.js +35 -0
- package/dist/src/adapters/TonClient4Opener.d.ts +23 -0
- package/dist/src/adapters/TonClient4Opener.js +87 -0
- package/dist/src/adapters/TonClientOpener.d.ts +17 -0
- package/dist/src/adapters/TonClientOpener.js +72 -0
- package/dist/src/adapters/index.d.ts +7 -2
- package/dist/src/adapters/index.js +7 -2
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +3 -2
- package/dist/src/interfaces/ContractOpener.d.ts +71 -2
- package/dist/src/interfaces/ITacSDK.d.ts +11 -1
- package/dist/src/sdk/Configuration.js +2 -1
- package/dist/src/sdk/Consts.d.ts +10 -3
- package/dist/src/sdk/Consts.js +13 -5
- package/dist/src/sdk/StartTracking.d.ts +4 -1
- package/dist/src/sdk/StartTracking.js +11 -6
- package/dist/src/sdk/TONTransactionManager.d.ts +1 -3
- package/dist/src/sdk/TONTransactionManager.js +3 -4
- package/dist/src/sdk/TacSdk.d.ts +3 -1
- package/dist/src/sdk/TacSdk.js +5 -3
- package/dist/src/sdk/TxFinalizer.d.ts +1 -8
- package/dist/src/sdk/TxFinalizer.js +14 -125
- package/dist/src/sdk/Utils.d.ts +10 -0
- package/dist/src/sdk/Utils.js +53 -0
- package/dist/src/structs/InternalStruct.d.ts +2 -17
- package/dist/src/structs/Struct.d.ts +117 -5
- package/package.json +1 -1
- package/dist/src/adapters/contractOpener.d.ts +0 -24
- package/dist/src/adapters/contractOpener.js +0 -310
- package/dist/src/adapters/retryableContractOpener.d.ts +0 -29
- package/dist/src/adapters/retryableContractOpener.js +0 -138
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TonClient4Opener = void 0;
|
|
4
|
+
exports.tonHubApi4Opener = tonHubApi4Opener;
|
|
5
|
+
exports.tonClient4Opener = tonClient4Opener;
|
|
6
|
+
exports.orbsOpener4 = orbsOpener4;
|
|
7
|
+
const ton_1 = require("@ton/ton");
|
|
8
|
+
const Consts_1 = require("../sdk/Consts");
|
|
9
|
+
const Struct_1 = require("../structs/Struct");
|
|
10
|
+
const BaseContractOpener_1 = require("./BaseContractOpener");
|
|
11
|
+
const OpenerUtils_1 = require("./OpenerUtils");
|
|
12
|
+
class TonClient4Opener extends BaseContractOpener_1.BaseContractOpener {
|
|
13
|
+
constructor(client4, logger) {
|
|
14
|
+
super(logger);
|
|
15
|
+
this.client4 = client4;
|
|
16
|
+
}
|
|
17
|
+
static create(endpoint, timeout = 10000, logger) {
|
|
18
|
+
const client4 = new ton_1.TonClient4({ endpoint, timeout });
|
|
19
|
+
return new TonClient4Opener(client4, logger);
|
|
20
|
+
}
|
|
21
|
+
open(contract) {
|
|
22
|
+
return this.client4.open(contract);
|
|
23
|
+
}
|
|
24
|
+
async getContractState(address) {
|
|
25
|
+
const latestBlock = await this.client4.getLastBlock();
|
|
26
|
+
const latestBlockNumber = latestBlock.last.seqno;
|
|
27
|
+
const state = await this.client4.getAccount(latestBlockNumber, address);
|
|
28
|
+
return {
|
|
29
|
+
balance: BigInt(state.account.balance.coins),
|
|
30
|
+
code: 'code' in state.account.state && state.account.state.code !== null
|
|
31
|
+
? Buffer.from(state.account.state.code, 'base64')
|
|
32
|
+
: null,
|
|
33
|
+
state: state.account.state.type === 'uninit' ? 'uninitialized' : state.account.state.type,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async getTransactions(address, opts) {
|
|
37
|
+
const allTxs = await this.client4
|
|
38
|
+
.getAccountTransactions(address, opts.lt ? BigInt(opts.lt) : 0n, opts.hash ? Buffer.from(opts.hash, 'base64') : Buffer.alloc(0))
|
|
39
|
+
.then((res) => res.map((t) => t.tx));
|
|
40
|
+
// Apply limit if specified
|
|
41
|
+
let txs = opts.limit ? allTxs.slice(0, opts.limit) : allTxs;
|
|
42
|
+
// Apply to_lt filter if specified
|
|
43
|
+
if (opts.to_lt) {
|
|
44
|
+
const toLt = BigInt(opts.to_lt);
|
|
45
|
+
txs = txs.filter((tx) => {
|
|
46
|
+
const comparison = tx.lt > toLt;
|
|
47
|
+
return opts.inclusive ? tx.lt >= toLt : comparison;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return txs;
|
|
51
|
+
}
|
|
52
|
+
async getAddressInformation(addr) {
|
|
53
|
+
const latestBlock = await this.client4.getLastBlock();
|
|
54
|
+
const latestBlockNumber = latestBlock.last.seqno;
|
|
55
|
+
const state = await this.client4.getAccount(latestBlockNumber, addr);
|
|
56
|
+
return {
|
|
57
|
+
lastTransaction: {
|
|
58
|
+
lt: state.account.last?.lt ?? '',
|
|
59
|
+
hash: state.account.last?.hash ?? '',
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async getConfig() {
|
|
64
|
+
const block = await this.client4.getLastBlock();
|
|
65
|
+
const { config } = await this.client4.getConfig(block.last.seqno);
|
|
66
|
+
return config.cell;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.TonClient4Opener = TonClient4Opener;
|
|
70
|
+
/**
|
|
71
|
+
* Creates a TonClient4Opener instance using TonHub public API
|
|
72
|
+
* @param network Network to connect to (mainnet or testnet)
|
|
73
|
+
* @param timeout Request timeout in milliseconds
|
|
74
|
+
* @param logger
|
|
75
|
+
*/
|
|
76
|
+
function tonHubApi4Opener(network, timeout = Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS, logger) {
|
|
77
|
+
const endpoint = network === Struct_1.Network.MAINNET ? 'https://mainnet-v4.tonhubapi.com' : 'https://testnet-v4.tonhubapi.com';
|
|
78
|
+
return TonClient4Opener.create(endpoint, timeout, logger);
|
|
79
|
+
}
|
|
80
|
+
function tonClient4Opener(client, logger) {
|
|
81
|
+
return new TonClient4Opener(client, logger);
|
|
82
|
+
}
|
|
83
|
+
async function orbsOpener4(network, timeout = Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS, logger) {
|
|
84
|
+
const endpoint = await (0, OpenerUtils_1.getHttpV4EndpointWithRetry)(network);
|
|
85
|
+
const client = new ton_1.TonClient4({ endpoint, timeout });
|
|
86
|
+
return new TonClient4Opener(client, logger);
|
|
87
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Address, Contract, OpenedContract, TonClient, Transaction } from '@ton/ton';
|
|
2
|
+
import { ILogger } from '../interfaces';
|
|
3
|
+
import { AddressInformation, ContractState, GetTransactionsOptions, Network } from '../structs/Struct';
|
|
4
|
+
import { BaseContractOpener } from './BaseContractOpener';
|
|
5
|
+
export declare class TonClientOpener extends BaseContractOpener {
|
|
6
|
+
private readonly client;
|
|
7
|
+
private readonly httpClient;
|
|
8
|
+
constructor(client: TonClient, logger?: ILogger);
|
|
9
|
+
static create(endpoint: string, timeout?: number, logger?: ILogger): TonClientOpener;
|
|
10
|
+
open<T extends Contract>(contract: T): OpenedContract<T>;
|
|
11
|
+
getContractState(address: Address): Promise<ContractState>;
|
|
12
|
+
getTransactions(address: Address, opts: GetTransactionsOptions): Promise<Transaction[]>;
|
|
13
|
+
getAddressInformation(addr: Address): Promise<AddressInformation>;
|
|
14
|
+
getConfig(): Promise<string>;
|
|
15
|
+
}
|
|
16
|
+
export declare function tonClientOpener(client: TonClient, logger?: ILogger): TonClientOpener;
|
|
17
|
+
export declare function orbsOpener(network: Network, logger?: ILogger): Promise<TonClientOpener>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TonClientOpener = void 0;
|
|
4
|
+
exports.tonClientOpener = tonClientOpener;
|
|
5
|
+
exports.orbsOpener = orbsOpener;
|
|
6
|
+
const ton_1 = require("@ton/ton");
|
|
7
|
+
const AxiosHttpClient_1 = require("../sdk/AxiosHttpClient");
|
|
8
|
+
const Consts_1 = require("../sdk/Consts");
|
|
9
|
+
const Utils_1 = require("../sdk/Utils");
|
|
10
|
+
const BaseContractOpener_1 = require("./BaseContractOpener");
|
|
11
|
+
const OpenerUtils_1 = require("./OpenerUtils");
|
|
12
|
+
class TonClientOpener extends BaseContractOpener_1.BaseContractOpener {
|
|
13
|
+
constructor(client, logger) {
|
|
14
|
+
super(logger);
|
|
15
|
+
this.client = client;
|
|
16
|
+
this.httpClient = new AxiosHttpClient_1.AxiosHttpClient({ timeout: Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS });
|
|
17
|
+
}
|
|
18
|
+
static create(endpoint, timeout = Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS, logger) {
|
|
19
|
+
const client = new ton_1.TonClient({ endpoint, timeout });
|
|
20
|
+
return new TonClientOpener(client, logger);
|
|
21
|
+
}
|
|
22
|
+
open(contract) {
|
|
23
|
+
return this.client.open(contract);
|
|
24
|
+
}
|
|
25
|
+
async getContractState(address) {
|
|
26
|
+
return this.client.getContractState(address);
|
|
27
|
+
}
|
|
28
|
+
async getTransactions(address, opts) {
|
|
29
|
+
// TonClient doesn't accept timeoutMs and retryDelayMs, filter them out
|
|
30
|
+
const clientOpts = {
|
|
31
|
+
limit: opts.limit ?? Consts_1.DEFAULT_FIND_TX_LIMIT,
|
|
32
|
+
lt: opts.lt,
|
|
33
|
+
// TonClient API expects base64 transaction hash and converts it to hex internally.
|
|
34
|
+
hash: opts.hash ? (0, Utils_1.normalizeHashToBase64)(opts.hash) : undefined,
|
|
35
|
+
to_lt: opts.to_lt,
|
|
36
|
+
inclusive: opts.inclusive,
|
|
37
|
+
archival: opts.archival,
|
|
38
|
+
};
|
|
39
|
+
return this.client.getTransactions(address, clientOpts);
|
|
40
|
+
}
|
|
41
|
+
async getAddressInformation(addr) {
|
|
42
|
+
const state = await this.client.getContractState(addr);
|
|
43
|
+
return {
|
|
44
|
+
lastTransaction: {
|
|
45
|
+
lt: state.lastTransaction?.lt ?? '',
|
|
46
|
+
hash: state.lastTransaction?.hash ?? '',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async getConfig() {
|
|
51
|
+
const info = await this.client.getMasterchainInfo();
|
|
52
|
+
const url = new URL('getConfigAll', this.client.parameters.endpoint);
|
|
53
|
+
url.searchParams.append('seqno', info.latestSeqno.toString());
|
|
54
|
+
// Use longer timeout for getConfig as the response is very large (~100KB+)
|
|
55
|
+
// and Brotli decompression can take significant time
|
|
56
|
+
const response = await this.httpClient.get(url.toString(), { timeout: 60000 });
|
|
57
|
+
const body = response.data;
|
|
58
|
+
if (!body?.ok || !body.result?.config?.bytes) {
|
|
59
|
+
throw new Error(`Failed to fetch config: ${JSON.stringify(body)}`);
|
|
60
|
+
}
|
|
61
|
+
return body.result.config.bytes;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.TonClientOpener = TonClientOpener;
|
|
65
|
+
function tonClientOpener(client, logger) {
|
|
66
|
+
return new TonClientOpener(client, logger);
|
|
67
|
+
}
|
|
68
|
+
async function orbsOpener(network, logger) {
|
|
69
|
+
const endpoint = await (0, OpenerUtils_1.getHttpEndpointWithRetry)(network);
|
|
70
|
+
const client = new ton_1.TonClient({ endpoint, timeout: Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS });
|
|
71
|
+
return new TonClientOpener(client, logger);
|
|
72
|
+
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './BaseContractOpener';
|
|
2
|
+
export * from './LiteClientOpener';
|
|
3
|
+
export * from './OpenerUtils';
|
|
4
|
+
export * from './RetryableContractOpener';
|
|
5
|
+
export * from './SandboxOpener';
|
|
6
|
+
export * from './TonClient4Opener';
|
|
7
|
+
export * from './TonClientOpener';
|
|
@@ -14,5 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./BaseContractOpener"), exports);
|
|
18
|
+
__exportStar(require("./LiteClientOpener"), exports);
|
|
19
|
+
__exportStar(require("./OpenerUtils"), exports);
|
|
20
|
+
__exportStar(require("./RetryableContractOpener"), exports);
|
|
21
|
+
__exportStar(require("./SandboxOpener"), exports);
|
|
22
|
+
__exportStar(require("./TonClient4Opener"), exports);
|
|
23
|
+
__exportStar(require("./TonClientOpener"), exports);
|
package/dist/src/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export { TacExplorerClient } from './sdk/TacExplorerClient';
|
|
|
15
15
|
export { TacSdk } from './sdk/TacSdk';
|
|
16
16
|
export { TACTransactionManager } from './sdk/TACTransactionManager';
|
|
17
17
|
export { TONTransactionManager } from './sdk/TONTransactionManager';
|
|
18
|
-
export
|
|
18
|
+
export { TonTxFinalizer } from './sdk/TxFinalizer';
|
|
19
19
|
export * from './sender';
|
|
20
20
|
export * from './structs/Struct';
|
|
21
21
|
export * from './wrappers/ContentUtils';
|
package/dist/src/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.TONTransactionManager = exports.TACTransactionManager = exports.TacSdk = exports.TacExplorerClient = exports.Simulator = exports.OperationTracker = exports.NoopLogger = exports.ConsoleLogger = exports.LiteSequencerClient = exports.Configuration = exports.AxiosHttpClient = exports.AgnosticStructs = exports.AgnosticProxySDK = void 0;
|
|
39
|
+
exports.TonTxFinalizer = exports.TONTransactionManager = exports.TACTransactionManager = exports.TacSdk = exports.TacExplorerClient = exports.Simulator = exports.OperationTracker = exports.NoopLogger = exports.ConsoleLogger = exports.LiteSequencerClient = exports.Configuration = exports.AxiosHttpClient = exports.AgnosticStructs = exports.AgnosticProxySDK = void 0;
|
|
40
40
|
__exportStar(require("./adapters"), exports);
|
|
41
41
|
var AgnosticSdk_1 = require("./agnosticSdk/AgnosticSdk");
|
|
42
42
|
Object.defineProperty(exports, "AgnosticProxySDK", { enumerable: true, get: function () { return AgnosticSdk_1.AgnosticProxySDK; } });
|
|
@@ -66,7 +66,8 @@ var TACTransactionManager_1 = require("./sdk/TACTransactionManager");
|
|
|
66
66
|
Object.defineProperty(exports, "TACTransactionManager", { enumerable: true, get: function () { return TACTransactionManager_1.TACTransactionManager; } });
|
|
67
67
|
var TONTransactionManager_1 = require("./sdk/TONTransactionManager");
|
|
68
68
|
Object.defineProperty(exports, "TONTransactionManager", { enumerable: true, get: function () { return TONTransactionManager_1.TONTransactionManager; } });
|
|
69
|
-
|
|
69
|
+
var TxFinalizer_1 = require("./sdk/TxFinalizer");
|
|
70
|
+
Object.defineProperty(exports, "TonTxFinalizer", { enumerable: true, get: function () { return TxFinalizer_1.TonTxFinalizer; } });
|
|
70
71
|
__exportStar(require("./sender"), exports);
|
|
71
72
|
__exportStar(require("./structs/Struct"), exports);
|
|
72
73
|
__exportStar(require("./wrappers/ContentUtils"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SandboxContract } from '@ton/sandbox';
|
|
2
2
|
import type { Address, Contract, OpenedContract, Transaction } from '@ton/ton';
|
|
3
|
-
import { AddressInformation, GetTransactionsOptions } from '../structs/
|
|
4
|
-
import {
|
|
3
|
+
import { AddressInformation, ContractState, GetTransactionsOptions, TrackTransactionTreeParams, TrackTransactionTreeResult } from '../structs/Struct';
|
|
4
|
+
import { ILogger } from './ILogger';
|
|
5
5
|
export interface ContractOpener {
|
|
6
6
|
/**
|
|
7
7
|
* Opens a contract for interaction using the underlying client (lite client, sandbox, etc.).
|
|
@@ -19,8 +19,77 @@ export interface ContractOpener {
|
|
|
19
19
|
* Closes any underlying connections if supported by the implementation.
|
|
20
20
|
*/
|
|
21
21
|
closeConnections?: () => unknown;
|
|
22
|
+
/**
|
|
23
|
+
* Fetches transactions for a given address.
|
|
24
|
+
* @param address Address to fetch transactions for.
|
|
25
|
+
* @param opts Options for fetching transactions (limit, archival, etc.).
|
|
26
|
+
* @returns Promise with array of transactions.
|
|
27
|
+
*/
|
|
28
|
+
getTransactions(address: Address, opts: GetTransactionsOptions): Promise<Transaction[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Find transaction by its hash.
|
|
31
|
+
* Searches by transaction hash, and also by incoming message hash (both external-in and internal).
|
|
32
|
+
* This is a universal method that checks all possible hash types.
|
|
33
|
+
* @param address Account address where to search
|
|
34
|
+
* @param hash Transaction or message hash in any format (base64, hex)
|
|
35
|
+
* @param opts Search options (limit, pagination, etc.)
|
|
36
|
+
* @returns Transaction if found, null otherwise
|
|
37
|
+
*/
|
|
22
38
|
getTransactionByHash(address: Address, hash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Find transaction by its transaction hash only.
|
|
41
|
+
* More efficient than getTransactionByHash if you know it's a transaction hash.
|
|
42
|
+
* @param address Account address where to search
|
|
43
|
+
* @param txHash Transaction hash in any format (base64, hex)
|
|
44
|
+
* @param opts Search options
|
|
45
|
+
* @returns Transaction if found, null otherwise
|
|
46
|
+
*/
|
|
47
|
+
getTransactionByTxHash(address: Address, txHash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Find transaction by its incoming message hash.
|
|
50
|
+
* Useful for finding the transaction that processed a specific message.
|
|
51
|
+
* @param address Account address where to search
|
|
52
|
+
* @param msgHash Message hash in any format (base64, hex)
|
|
53
|
+
* @param opts Search options
|
|
54
|
+
* @returns Transaction if found, null otherwise
|
|
55
|
+
*/
|
|
56
|
+
getTransactionByInMsgHash(address: Address, msgHash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
|
|
57
|
+
/**
|
|
58
|
+
* Find transaction by its outgoing message hash.
|
|
59
|
+
* Useful for finding the parent transaction that sent a specific message.
|
|
60
|
+
* @param address Account address where to search
|
|
61
|
+
* @param msgHash Outgoing message hash in any format (base64, hex)
|
|
62
|
+
* @param opts Search options
|
|
63
|
+
* @returns Transaction if found, null otherwise
|
|
64
|
+
*/
|
|
65
|
+
getTransactionByOutMsgHash(address: Address, msgHash: string, opts?: GetTransactionsOptions): Promise<Transaction | null>;
|
|
66
|
+
/**
|
|
67
|
+
* Get adjacent transactions (children via outgoing messages and parent via incoming message).
|
|
68
|
+
* @param address Account address
|
|
69
|
+
* @param hash Transaction or message hash in any format (base64, hex)
|
|
70
|
+
* @param opts Search options
|
|
71
|
+
* @returns Array of adjacent transactions
|
|
72
|
+
*/
|
|
23
73
|
getAdjacentTransactions(address: Address, hash: string, opts?: GetTransactionsOptions): Promise<Transaction[]>;
|
|
24
74
|
getAddressInformation(address: Address): Promise<AddressInformation>;
|
|
25
75
|
getConfig(): Promise<string>;
|
|
76
|
+
/**
|
|
77
|
+
* Track and validate entire transaction tree starting from a root transaction.
|
|
78
|
+
* Recursively follows outgoing messages and validates all child transactions.
|
|
79
|
+
* @param address Root account address
|
|
80
|
+
* @param hash Root transaction or message hash
|
|
81
|
+
* @param params Tracking parameters (maxDepth, ignoreOpcodeList, etc.)
|
|
82
|
+
* @throws Error if any transaction in the tree failed or if a hash is not found
|
|
83
|
+
*/
|
|
84
|
+
trackTransactionTree(address: string, hash: string, params?: TrackTransactionTreeParams): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Track and validate entire transaction tree starting from a root transaction (returns result instead of throwing).
|
|
87
|
+
* Recursively follows outgoing messages and validates all child transactions.
|
|
88
|
+
* @param address Root account address
|
|
89
|
+
* @param hash Root transaction or message hash
|
|
90
|
+
* @param params Tracking parameters (maxDepth, ignoreOpcodeList, etc.)
|
|
91
|
+
* @returns Result object with success flag and error details if validation failed or a hash was not found
|
|
92
|
+
*/
|
|
93
|
+
trackTransactionTreeWithResult(address: string, hash: string, params?: TrackTransactionTreeParams): Promise<TrackTransactionTreeResult>;
|
|
94
|
+
setLogger(logger: ILogger): void;
|
|
26
95
|
}
|
|
@@ -2,8 +2,9 @@ import { Wallet } from 'ethers';
|
|
|
2
2
|
import { JettonMinterData, NFTItemData } from '../../artifacts/tonTypes';
|
|
3
3
|
import { FT, NFT } from '../assets';
|
|
4
4
|
import type { SenderAbstraction } from '../sender';
|
|
5
|
-
import { AssetFromFTArg, AssetFromNFTCollectionArg, AssetFromNFTItemArg, AssetLike, BatchCrossChainTxWithAssetLike, CrossChainPayloadResult, CrossChainTransactionOptions, CrossChainTransactionsOptions, CrosschainTx, EVMAddress, EvmProxyMsg, ExecutionFeeEstimationResult, NFTAddressType, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinkerWithOperationId, TVMAddress, UserWalletBalanceExtended, WaitOptions } from '../structs/Struct';
|
|
5
|
+
import { AssetFromFTArg, AssetFromNFTCollectionArg, AssetFromNFTItemArg, AssetLike, BatchCrossChainTxWithAssetLike, CrossChainPayloadResult, CrossChainTransactionOptions, CrossChainTransactionsOptions, CrosschainTx, EVMAddress, EvmProxyMsg, ExecutionFeeEstimationResult, NFTAddressType, SuggestedTVMExecutorFee, TacGasPrice, TACSimulationParams, TACSimulationResult, TransactionLinkerWithOperationId, TVMAddress, UserWalletBalanceExtended, WaitOptions } from '../structs/Struct';
|
|
6
6
|
import { Asset } from './Asset';
|
|
7
|
+
import { ContractOpener } from './ContractOpener';
|
|
7
8
|
import { IConfiguration } from './IConfiguration';
|
|
8
9
|
import { IOperationTracker } from './IOperationTracker';
|
|
9
10
|
import { ITacExplorerClient } from './ITacExplorerClient';
|
|
@@ -187,6 +188,10 @@ export interface ITacSDK {
|
|
|
187
188
|
* Returns the TAC explorer client instance used for querying blockchain explorer data.
|
|
188
189
|
*/
|
|
189
190
|
getTacExplorerClient(): ITacExplorerClient;
|
|
191
|
+
/**
|
|
192
|
+
* Returns the TON contract opener client instance used for querying TON blockchain data.
|
|
193
|
+
*/
|
|
194
|
+
getTonContractOpener(): ContractOpener;
|
|
190
195
|
/**
|
|
191
196
|
* Prepares the transaction payloads required for a cross-chain operation without sending them.
|
|
192
197
|
* @param evmProxyMsg Encoded EVM proxy message.
|
|
@@ -196,4 +201,9 @@ export interface ITacSDK {
|
|
|
196
201
|
* @returns Promise with the prepared transaction payloads.
|
|
197
202
|
*/
|
|
198
203
|
prepareCrossChainTransactionPayload(evmProxyMsg: EvmProxyMsg, senderAddress: string, assets?: AssetLike[], options?: CrossChainTransactionOptions): Promise<CrossChainPayloadResult[]>;
|
|
204
|
+
/**
|
|
205
|
+
* Returns TAC gas price for the current network.
|
|
206
|
+
* @returns Promise resolving to the gas price in wei (bigint).
|
|
207
|
+
*/
|
|
208
|
+
getTACGasPrice(): Promise<TacGasPrice>;
|
|
199
209
|
}
|
|
@@ -52,9 +52,10 @@ class Configuration {
|
|
|
52
52
|
else {
|
|
53
53
|
contractOpener =
|
|
54
54
|
TONParams?.contractOpener ??
|
|
55
|
-
(await (0, adapters_1.createDefaultRetryableOpener)(artifacts.TON_RPC_ENDPOINT_BY_TAC, network, 5, delay));
|
|
55
|
+
(await (0, adapters_1.createDefaultRetryableOpener)(artifacts.TON_RPC_ENDPOINT_BY_TAC, network, 5, delay, logger));
|
|
56
56
|
settingsAddress = TONParams?.settingsAddress ?? artifacts.TON_SETTINGS_ADDRESS;
|
|
57
57
|
}
|
|
58
|
+
contractOpener.setLogger(logger);
|
|
58
59
|
const settings = contractOpener.open(artifacts.ton.wrappers.Settings.createFromAddress(ton_1.Address.parse(settingsAddress)));
|
|
59
60
|
const allSettingsSlice = (await settings.getAll()).beginParse();
|
|
60
61
|
const allSettings = allSettingsSlice.loadDictDirect(ton_1.Dictionary.Keys.BigUint(256), ton_1.Dictionary.Values.Cell());
|
package/dist/src/sdk/Consts.d.ts
CHANGED
|
@@ -14,10 +14,17 @@ export declare const ONE_YEAR_SECONDS: number;
|
|
|
14
14
|
export declare const TON_DECIMALS = 9;
|
|
15
15
|
export declare const TAC_DECIMALS = 18;
|
|
16
16
|
export declare const FIVE_MINUTES: number;
|
|
17
|
+
export declare const MINUTE: number;
|
|
17
18
|
export declare const TON_BURN_ADDRESS = "EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c";
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
19
|
+
export declare const DEFAULT_HTTP_CLIENT_TIMEOUT_MS = 30000;
|
|
20
|
+
export declare const DEFAULT_RETRY_MAX_COUNT = 5;
|
|
21
|
+
export declare const DEFAULT_RETRY_DELAY_MS = 1000;
|
|
22
|
+
export declare const DEFAULT_FIND_TX_LIMIT = 100;
|
|
23
|
+
export declare const DEFAULT_MAX_SCANNED_TRANSACTIONS = 100;
|
|
21
24
|
export declare const DEFAULT_FIND_TX_ARCHIVAL = true;
|
|
22
25
|
export declare const DEFAULT_FIND_TX_MAX_DEPTH = 10;
|
|
26
|
+
export declare const DEFAULT_WAIT_FOR_ROOT_TRANSACTION = true;
|
|
27
|
+
export declare const DEFAULT_WAIT_FOR_ROOT_TRANSACTION_TIMEOUT_MS: number;
|
|
28
|
+
export declare const DEFAULT_WAIT_FOR_ROOT_TRANSACTION_RETRY_DELAY_MS = 1000;
|
|
23
29
|
export declare const IGNORE_MSG_VALUE_1_NANO = 1n;
|
|
30
|
+
export declare const IGNORE_OPCODE: number[];
|
package/dist/src/sdk/Consts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IGNORE_MSG_VALUE_1_NANO = exports.DEFAULT_FIND_TX_MAX_DEPTH = exports.DEFAULT_FIND_TX_ARCHIVAL = exports.DEFAULT_FIND_TX_LIMIT = exports.
|
|
3
|
+
exports.IGNORE_OPCODE = exports.IGNORE_MSG_VALUE_1_NANO = exports.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_RETRY_DELAY_MS = exports.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_TIMEOUT_MS = exports.DEFAULT_WAIT_FOR_ROOT_TRANSACTION = exports.DEFAULT_FIND_TX_MAX_DEPTH = exports.DEFAULT_FIND_TX_ARCHIVAL = exports.DEFAULT_MAX_SCANNED_TRANSACTIONS = exports.DEFAULT_FIND_TX_LIMIT = exports.DEFAULT_RETRY_DELAY_MS = exports.DEFAULT_RETRY_MAX_COUNT = exports.DEFAULT_HTTP_CLIENT_TIMEOUT_MS = exports.TON_BURN_ADDRESS = exports.MINUTE = exports.FIVE_MINUTES = exports.TAC_DECIMALS = exports.TON_DECIMALS = exports.ONE_YEAR_SECONDS = exports.FIFTEEN_MINUTES = exports.TAC_SYMBOL = exports.TON_SYMBOL = exports.MAX_MSG_DEPTH = exports.MAX_HIGHLOAD_GROUP_MSG_NUM = exports.MAX_EXT_MSG_SIZE = exports.SOLIDITY_METHOD_NAME_REGEX = exports.SOLIDITY_SIGNATURE_REGEX = exports.DEFAULT_DELAY = exports.MAX_ITERATION_COUNT = exports.NFT_TRANSFER_FORWARD_TON_AMOUNT = exports.JETTON_TRANSFER_FORWARD_TON_AMOUNT = void 0;
|
|
4
4
|
const ton_1 = require("@ton/ton");
|
|
5
5
|
exports.JETTON_TRANSFER_FORWARD_TON_AMOUNT = (0, ton_1.toNano)(0.2);
|
|
6
6
|
exports.NFT_TRANSFER_FORWARD_TON_AMOUNT = (0, ton_1.toNano)(0.3);
|
|
@@ -18,11 +18,19 @@ exports.ONE_YEAR_SECONDS = 365 * 24 * 3600;
|
|
|
18
18
|
exports.TON_DECIMALS = 9;
|
|
19
19
|
exports.TAC_DECIMALS = 18;
|
|
20
20
|
exports.FIVE_MINUTES = 5 * 60 * 1000;
|
|
21
|
+
exports.MINUTE = 60 * 1000;
|
|
21
22
|
exports.TON_BURN_ADDRESS = 'EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c';
|
|
22
|
-
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.DEFAULT_FIND_TX_LIMIT =
|
|
23
|
+
exports.DEFAULT_HTTP_CLIENT_TIMEOUT_MS = 30000;
|
|
24
|
+
exports.DEFAULT_RETRY_MAX_COUNT = 5;
|
|
25
|
+
exports.DEFAULT_RETRY_DELAY_MS = 1000;
|
|
26
|
+
exports.DEFAULT_FIND_TX_LIMIT = 100;
|
|
27
|
+
exports.DEFAULT_MAX_SCANNED_TRANSACTIONS = 100;
|
|
26
28
|
exports.DEFAULT_FIND_TX_ARCHIVAL = true;
|
|
27
29
|
exports.DEFAULT_FIND_TX_MAX_DEPTH = 10;
|
|
30
|
+
exports.DEFAULT_WAIT_FOR_ROOT_TRANSACTION = true;
|
|
31
|
+
exports.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_TIMEOUT_MS = exports.MINUTE;
|
|
32
|
+
exports.DEFAULT_WAIT_FOR_ROOT_TRANSACTION_RETRY_DELAY_MS = 1000;
|
|
28
33
|
exports.IGNORE_MSG_VALUE_1_NANO = 1n;
|
|
34
|
+
exports.IGNORE_OPCODE = [
|
|
35
|
+
0xd53276db, // Excess
|
|
36
|
+
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILogger } from '../interfaces';
|
|
1
|
+
import { ContractOpener, ILogger } from '../interfaces';
|
|
2
2
|
import { ITxFinalizer } from '../interfaces/ITxFinalizer';
|
|
3
3
|
import { ExecutionStages, Network, TransactionLinker } from '../structs/Struct';
|
|
4
4
|
export declare function startTracking(transactionLinker: TransactionLinker, network: Network, options?: {
|
|
@@ -9,6 +9,7 @@ export declare function startTracking(transactionLinker: TransactionLinker, netw
|
|
|
9
9
|
tableView?: boolean;
|
|
10
10
|
logger?: ILogger;
|
|
11
11
|
txFinalizer?: ITxFinalizer;
|
|
12
|
+
contractOpener?: ContractOpener;
|
|
12
13
|
cclAddress?: string;
|
|
13
14
|
}): Promise<void | ExecutionStages>;
|
|
14
15
|
export declare function startTrackingMultiple(transactionLinkers: TransactionLinker[], network: Network, options?: {
|
|
@@ -19,5 +20,7 @@ export declare function startTrackingMultiple(transactionLinkers: TransactionLin
|
|
|
19
20
|
tableView?: boolean;
|
|
20
21
|
logger?: ILogger;
|
|
21
22
|
txFinalizer?: ITxFinalizer;
|
|
23
|
+
contractOpener?: ContractOpener;
|
|
24
|
+
cclAddress?: string;
|
|
22
25
|
}): Promise<void | ExecutionStages[]>;
|
|
23
26
|
export declare function printExecutionStagesTable(stages: ExecutionStages, logger: ILogger): void;
|
|
@@ -9,7 +9,7 @@ const Logger_1 = require("./Logger");
|
|
|
9
9
|
const OperationTracker_1 = require("./OperationTracker");
|
|
10
10
|
const Utils_1 = require("./Utils");
|
|
11
11
|
async function startTracking(transactionLinker, network, options) {
|
|
12
|
-
const { customLiteSequencerEndpoints, delay = 10, maxIterationCount = Consts_1.MAX_ITERATION_COUNT, returnValue = false, tableView = true, logger = new Logger_1.NoopLogger(), txFinalizer, cclAddress, } = options || {};
|
|
12
|
+
const { customLiteSequencerEndpoints, delay = 10, maxIterationCount = Consts_1.MAX_ITERATION_COUNT, returnValue = false, tableView = true, logger = new Logger_1.NoopLogger(), txFinalizer, contractOpener, cclAddress, } = options || {};
|
|
13
13
|
const tracker = new OperationTracker_1.OperationTracker(network, customLiteSequencerEndpoints, logger);
|
|
14
14
|
logger.debug(`Start tracking operation\n` +
|
|
15
15
|
`caller: ${transactionLinker.caller}\n` +
|
|
@@ -63,15 +63,18 @@ async function startTracking(transactionLinker, network, options) {
|
|
|
63
63
|
logger.debug(errorMessage);
|
|
64
64
|
}
|
|
65
65
|
const profilingData = await tracker.getStageProfiling(operationId);
|
|
66
|
-
// Check if EXECUTED_IN_TON stage exists and use
|
|
66
|
+
// Check if EXECUTED_IN_TON stage exists and use ContractOpener to verify transaction success
|
|
67
67
|
if (profilingData.executedInTON.exists && profilingData.executedInTON.stageData?.transactions) {
|
|
68
68
|
logger.debug('EXECUTED_IN_TON stage found, verifying transaction success in TON...');
|
|
69
|
-
|
|
69
|
+
const finalizer = txFinalizer || contractOpener;
|
|
70
|
+
if (finalizer && cclAddress) {
|
|
70
71
|
const transactions = profilingData.executedInTON.stageData.transactions;
|
|
71
72
|
for (const tx of transactions) {
|
|
72
73
|
try {
|
|
73
74
|
logger.debug(`Verifying transaction: ${tx.hash}`);
|
|
74
|
-
await
|
|
75
|
+
await finalizer.trackTransactionTree(cclAddress, tx.hash, {
|
|
76
|
+
maxDepth: Consts_1.DEFAULT_FIND_TX_MAX_DEPTH,
|
|
77
|
+
});
|
|
75
78
|
logger.debug(`Transaction ${tx.hash} verified successfully in TON`);
|
|
76
79
|
}
|
|
77
80
|
catch (error) {
|
|
@@ -83,7 +86,7 @@ async function startTracking(transactionLinker, network, options) {
|
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
else {
|
|
86
|
-
logger.debug('
|
|
89
|
+
logger.debug('Finalizer, ContractOpener or CCL address is not provided, skipping TON transaction verification');
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
if (returnValue) {
|
|
@@ -99,7 +102,7 @@ async function startTracking(transactionLinker, network, options) {
|
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
async function startTrackingMultiple(transactionLinkers, network, options) {
|
|
102
|
-
const { customLiteSequencerEndpoints, delay = 10, maxIterationCount = Consts_1.MAX_ITERATION_COUNT, returnValue = false, tableView = true, txFinalizer, logger = new Logger_1.NoopLogger(), } = options || {};
|
|
105
|
+
const { customLiteSequencerEndpoints, delay = 10, maxIterationCount = Consts_1.MAX_ITERATION_COUNT, returnValue = false, tableView = true, txFinalizer, contractOpener, cclAddress, logger = new Logger_1.NoopLogger(), } = options || {};
|
|
103
106
|
logger.debug(`Start tracking ${transactionLinkers.length} operations`);
|
|
104
107
|
const results = await Promise.all(transactionLinkers.map((linker, index) => {
|
|
105
108
|
logger.debug(`\nProcessing operation ${index + 1}/${transactionLinkers.length}`);
|
|
@@ -110,6 +113,8 @@ async function startTrackingMultiple(transactionLinkers, network, options) {
|
|
|
110
113
|
returnValue: true,
|
|
111
114
|
tableView: false,
|
|
112
115
|
txFinalizer,
|
|
116
|
+
contractOpener,
|
|
117
|
+
cclAddress,
|
|
113
118
|
logger,
|
|
114
119
|
});
|
|
115
120
|
}));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Asset, IConfiguration, ILogger, IOperationTracker, ISimulator, ITONTransactionManager } from '../interfaces';
|
|
2
|
-
import { ITxFinalizer } from '../interfaces/ITxFinalizer';
|
|
3
2
|
import { type SenderAbstraction } from '../sender';
|
|
4
3
|
import { BatchCrossChainTx, CrossChainPayloadResult, CrossChainTransactionOptions, CrossChainTransactionsOptions, CrosschainTx, EvmProxyMsg, FeeParams, TransactionLinkerWithOperationId } from '../structs/Struct';
|
|
5
4
|
export declare class TONTransactionManager implements ITONTransactionManager {
|
|
@@ -7,8 +6,7 @@ export declare class TONTransactionManager implements ITONTransactionManager {
|
|
|
7
6
|
private readonly simulator;
|
|
8
7
|
private readonly operationTracker;
|
|
9
8
|
private readonly logger;
|
|
10
|
-
|
|
11
|
-
constructor(config: IConfiguration, simulator: ISimulator, operationTracker: IOperationTracker, logger: ILogger | undefined, txFinalizer: ITxFinalizer);
|
|
9
|
+
constructor(config: IConfiguration, simulator: ISimulator, operationTracker: IOperationTracker, logger?: ILogger);
|
|
12
10
|
buildFeeParams(options: CrossChainTransactionOptions, evmProxyMsg: EvmProxyMsg, sender: SenderAbstraction, tx: CrosschainTx): Promise<FeeParams>;
|
|
13
11
|
private prepareCrossChainTransaction;
|
|
14
12
|
private generateCrossChainMessages;
|
|
@@ -11,12 +11,11 @@ const Logger_1 = require("./Logger");
|
|
|
11
11
|
const Utils_1 = require("./Utils");
|
|
12
12
|
const Validator_1 = require("./Validator");
|
|
13
13
|
class TONTransactionManager {
|
|
14
|
-
constructor(config, simulator, operationTracker, logger = new Logger_1.NoopLogger()
|
|
14
|
+
constructor(config, simulator, operationTracker, logger = new Logger_1.NoopLogger()) {
|
|
15
15
|
this.config = config;
|
|
16
16
|
this.simulator = simulator;
|
|
17
17
|
this.operationTracker = operationTracker;
|
|
18
18
|
this.logger = logger;
|
|
19
|
-
this.txFinalizer = txFinalizer;
|
|
20
19
|
}
|
|
21
20
|
async buildFeeParams(options, evmProxyMsg, sender, tx) {
|
|
22
21
|
const { withoutSimulation, protocolFee, evmExecutorFee, tvmExecutorFee, isRoundTrip } = options;
|
|
@@ -160,12 +159,12 @@ class TONTransactionManager {
|
|
|
160
159
|
async sendCrossChainTransaction(evmProxyMsg, sender, tx) {
|
|
161
160
|
const { transaction, transactionLinker } = await this.prepareCrossChainTransaction(evmProxyMsg, sender, tx.assets, tx.options);
|
|
162
161
|
await assets_1.TON.checkBalance(sender, this.config, [transaction]);
|
|
162
|
+
const shouldWaitForOperationId = tx.options?.waitOperationId ?? true;
|
|
163
163
|
this.logger.debug(`Sending transaction: ${(0, Utils_1.formatObjectForLogging)(transactionLinker)}`);
|
|
164
164
|
const sendTransactionResult = await sender.sendShardTransaction(transaction, this.config.network, this.config.TONParams.contractOpener);
|
|
165
165
|
if (!sendTransactionResult.success || sendTransactionResult.error) {
|
|
166
166
|
throw (0, instances_1.sendCrossChainTransactionFailedError)(sendTransactionResult.error?.message ?? 'Transaction failed to send');
|
|
167
167
|
}
|
|
168
|
-
const shouldWaitForOperationId = tx.options?.waitOperationId ?? true;
|
|
169
168
|
if (!shouldWaitForOperationId) {
|
|
170
169
|
return { sendTransactionResult, ...transactionLinker };
|
|
171
170
|
}
|
|
@@ -175,7 +174,7 @@ class TONTransactionManager {
|
|
|
175
174
|
if (waitOptions.ensureTxExecuted && sendTransactionResult.boc) {
|
|
176
175
|
const hash = (0, Utils_1.getNormalizedExtMessageHash)((0, ton_1.loadMessage)(ton_1.Cell.fromBase64(sendTransactionResult.boc).beginParse()));
|
|
177
176
|
this.logger.info(`Tracking transaction tree for hash: ${hash}`);
|
|
178
|
-
await this.
|
|
177
|
+
await this.config.TONParams.contractOpener.trackTransactionTree(sender.getSenderAddress(), hash, {
|
|
179
178
|
maxDepth: Consts_1.DEFAULT_FIND_TX_MAX_DEPTH,
|
|
180
179
|
});
|
|
181
180
|
this.logger.info(`Transaction tree successful`);
|
package/dist/src/sdk/TacSdk.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Wallet } from 'ethers';
|
|
2
2
|
import { JettonMinterData, NFTItemData } from '../../artifacts/tonTypes';
|
|
3
3
|
import { FT, NFT } from '../assets';
|
|
4
|
-
import { IConfiguration, ILogger, IOperationTracker, ITacExplorerClient, ITacSDK } from '../interfaces';
|
|
4
|
+
import { ContractOpener, IConfiguration, ILogger, IOperationTracker, ITacExplorerClient, ITacSDK } from '../interfaces';
|
|
5
5
|
import type { SenderAbstraction } from '../sender';
|
|
6
6
|
import { AssetFromFTArg, AssetFromNFTCollectionArg, AssetFromNFTItemArg, AssetLike, BatchCrossChainTxWithAssetLike, CrossChainPayloadResult, CrossChainTransactionOptions, CrossChainTransactionsOptions, CrosschainTx, EVMAddress, EvmProxyMsg, ExecutionFeeEstimationResult, NFTAddressType, SDKParams, SuggestedTVMExecutorFee, TacGasPrice, TACSimulationParams, TACSimulationResult, TransactionLinkerWithOperationId, TVMAddress, UserWalletBalanceExtended } from '../structs/Struct';
|
|
7
7
|
export declare class TacSdk implements ITacSDK {
|
|
8
8
|
readonly config: IConfiguration;
|
|
9
|
+
readonly contactOpener: ContractOpener;
|
|
9
10
|
readonly operationTracker: IOperationTracker;
|
|
10
11
|
readonly explorerClient: ITacExplorerClient;
|
|
11
12
|
private readonly simulator;
|
|
@@ -45,4 +46,5 @@ export declare class TacSdk implements ITacSDK {
|
|
|
45
46
|
getTacExplorerClient(): ITacExplorerClient;
|
|
46
47
|
prepareCrossChainTransactionPayload(evmProxyMsg: EvmProxyMsg, senderAddress: string, assets?: AssetLike[], options?: CrossChainTransactionOptions): Promise<CrossChainPayloadResult[]>;
|
|
47
48
|
getTACGasPrice(): Promise<TacGasPrice>;
|
|
49
|
+
getTonContractOpener(): ContractOpener;
|
|
48
50
|
}
|
package/dist/src/sdk/TacSdk.js
CHANGED
|
@@ -12,11 +12,11 @@ const Simulator_1 = require("./Simulator");
|
|
|
12
12
|
const TacExplorerClient_1 = require("./TacExplorerClient");
|
|
13
13
|
const TACTransactionManager_1 = require("./TACTransactionManager");
|
|
14
14
|
const TONTransactionManager_1 = require("./TONTransactionManager");
|
|
15
|
-
const TxFinalizer_1 = require("./TxFinalizer");
|
|
16
15
|
const Utils_1 = require("./Utils");
|
|
17
16
|
class TacSdk {
|
|
18
17
|
constructor(config, simulator, tonTransactionManager, tacTransactionManager, operationTracker, explorerClient) {
|
|
19
18
|
this.config = config;
|
|
19
|
+
this.contactOpener = config.TONParams.contractOpener;
|
|
20
20
|
this.simulator = simulator;
|
|
21
21
|
this.tonTransactionManager = tonTransactionManager;
|
|
22
22
|
this.tacTransactionManager = tacTransactionManager;
|
|
@@ -44,8 +44,7 @@ class TacSdk {
|
|
|
44
44
|
const operationTracker = new OperationTracker_1.OperationTracker(network, config.liteSequencerEndpoints);
|
|
45
45
|
const explorerClient = new TacExplorerClient_1.TacExplorerClient(artifacts.TAC_EXPLORER_API_ENDPOINT);
|
|
46
46
|
const simulator = new Simulator_1.Simulator(config, operationTracker, logger);
|
|
47
|
-
const
|
|
48
|
-
const tonTransactionManager = new TONTransactionManager_1.TONTransactionManager(config, simulator, operationTracker, logger, txFinalizer);
|
|
47
|
+
const tonTransactionManager = new TONTransactionManager_1.TONTransactionManager(config, simulator, operationTracker, logger);
|
|
49
48
|
const tacTransactionManager = new TACTransactionManager_1.TACTransactionManager(config, operationTracker, logger);
|
|
50
49
|
return new TacSdk(config, simulator, tonTransactionManager, tacTransactionManager, operationTracker, explorerClient);
|
|
51
50
|
}
|
|
@@ -197,5 +196,8 @@ class TacSdk {
|
|
|
197
196
|
slow: response.gasPrices.slow,
|
|
198
197
|
};
|
|
199
198
|
}
|
|
199
|
+
getTonContractOpener() {
|
|
200
|
+
return this.contactOpener;
|
|
201
|
+
}
|
|
200
202
|
}
|
|
201
203
|
exports.TacSdk = TacSdk;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IHttpClient, ILogger } from '../interfaces';
|
|
2
2
|
import { ITxFinalizer } from '../interfaces/ITxFinalizer';
|
|
3
3
|
import { TxFinalizerConfig } from '../structs/InternalStruct';
|
|
4
4
|
import { TrackTransactionTreeParams } from '../structs/Struct';
|
|
5
5
|
export declare class TonTxFinalizer implements ITxFinalizer {
|
|
6
|
-
private logger;
|
|
7
|
-
private contractOpener;
|
|
8
|
-
constructor(contractOpener: ContractOpener, logger?: ILogger);
|
|
9
|
-
private fetchAdjacentTransactions;
|
|
10
|
-
trackTransactionTree(address: string, hash: string, params?: TrackTransactionTreeParams): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
export declare class TonIndexerTxFinalizer implements ITxFinalizer {
|
|
13
6
|
private logger;
|
|
14
7
|
private apiConfig;
|
|
15
8
|
private readonly httpClient;
|