@tonappchain/sdk 0.7.3-rc1 → 0.7.3-rc3
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/index.d.ts +2 -2
- package/dist/artifacts/dev/index.js +2 -1
- package/dist/artifacts/dev/ton/endpoints.d.ts +1 -0
- package/dist/artifacts/dev/ton/endpoints.js +2 -1
- package/dist/artifacts/mainnet/index.d.ts +2 -2
- package/dist/artifacts/mainnet/index.js +2 -1
- package/dist/artifacts/mainnet/ton/endpoints.d.ts +1 -0
- package/dist/artifacts/mainnet/ton/endpoints.js +2 -1
- package/dist/artifacts/testnet/index.d.ts +2 -2
- package/dist/artifacts/testnet/index.js +2 -1
- package/dist/artifacts/testnet/ton/endpoints.d.ts +1 -0
- package/dist/artifacts/testnet/ton/endpoints.js +2 -1
- package/dist/src/adapters/RetryableContractOpener.d.ts +6 -1
- package/dist/src/adapters/RetryableContractOpener.js +35 -8
- package/dist/src/adapters/ToncenterV3Indexer.d.ts +34 -0
- package/dist/src/adapters/ToncenterV3Indexer.js +123 -0
- package/dist/src/adapters/index.d.ts +1 -0
- package/dist/src/adapters/index.js +1 -0
- package/dist/src/assets/FT.d.ts +3 -2
- package/dist/src/assets/FT.js +30 -14
- package/dist/src/assets/NFT.d.ts +4 -2
- package/dist/src/assets/NFT.js +6 -2
- package/dist/src/assets/TAC.d.ts +2 -1
- package/dist/src/assets/TAC.js +1 -0
- package/dist/src/assets/TON.d.ts +2 -1
- package/dist/src/assets/TON.js +1 -0
- package/dist/src/errors/index.d.ts +1 -1
- package/dist/src/errors/index.js +3 -1
- package/dist/src/errors/instances.d.ts +2 -0
- package/dist/src/errors/instances.js +5 -1
- package/dist/src/interfaces/Asset.d.ts +2 -1
- package/dist/src/interfaces/ContractOpener.d.ts +1 -1
- package/dist/src/interfaces/ILiteSequencerClient.d.ts +8 -2
- package/dist/src/interfaces/IOperationTracker.d.ts +13 -1
- package/dist/src/interfaces/ITACTransactionManager.d.ts +4 -3
- package/dist/src/interfaces/ITacSDK.d.ts +26 -5
- package/dist/src/interfaces/IToncenterV3Indexer.d.ts +35 -0
- package/dist/src/interfaces/IToncenterV3Indexer.js +2 -0
- package/dist/src/interfaces/index.d.ts +1 -0
- package/dist/src/interfaces/index.js +1 -0
- package/dist/src/sdk/Consts.d.ts +13 -0
- package/dist/src/sdk/Consts.js +15 -1
- package/dist/src/sdk/LiteSequencerClient.d.ts +4 -2
- package/dist/src/sdk/LiteSequencerClient.js +29 -13
- package/dist/src/sdk/OperationTracker.d.ts +3 -1
- package/dist/src/sdk/OperationTracker.js +36 -0
- package/dist/src/sdk/Simulator.d.ts +3 -0
- package/dist/src/sdk/Simulator.js +27 -0
- package/dist/src/sdk/TACTransactionManager.d.ts +3 -2
- package/dist/src/sdk/TACTransactionManager.js +45 -35
- package/dist/src/sdk/TacSdk.d.ts +6 -2
- package/dist/src/sdk/TacSdk.js +36 -2
- package/dist/src/sdk/Utils.js +2 -2
- package/dist/src/structs/InternalStruct.d.ts +8 -7
- package/dist/src/structs/Struct.d.ts +64 -2
- package/dist/src/structs/Struct.js +7 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DEV_AGNOSTIC_PROXY_ADDRESS as AGNOSTIC_PROXY_ADDRESS, DEV_MULTICALL_3_ADDRESS as MULTICALL_3_ADDRESS, DEV_TAC_SETTINGS_ADDRESS as TAC_SETTINGS_ADDRESS, DEV_TAC_SMART_ACCOUNT_FACTORY_ADDRESS as TAC_SMART_ACCOUNT_FACTORY_ADDRESS } from './tac/addresses';
|
|
2
2
|
import { DEV_PUBLIC_LITE_SEQUENCER_ENDPOINTS as PUBLIC_LITE_SEQUENCER_ENDPOINTS, DEV_TAC_RPC_ENDPOINT as TAC_RPC_ENDPOINT, DEV_TAC_EXPLORER_API_ENDPOINT as TAC_EXPLORER_API_ENDPOINT } from "./tac/endpoints";
|
|
3
3
|
import { DEV_TON_SETTINGS_ADDRESS as TON_SETTINGS_ADDRESS } from './ton/addresses';
|
|
4
|
-
import { DEV_DEFAULT_LITESERVERS as DEFAULT_LITESERVERS, DEV_TON_PUBLIC_RPC_ENDPOINT as TON_PUBLIC_RPC_ENDPOINT, DEV_TON_RPC_ENDPOINT_BY_TAC as TON_RPC_ENDPOINT_BY_TAC } from "./ton/endpoints";
|
|
4
|
+
import { DEV_DEFAULT_LITESERVERS as DEFAULT_LITESERVERS, DEV_TON_PUBLIC_RPC_ENDPOINT as TON_PUBLIC_RPC_ENDPOINT, DEV_TON_RPC_ENDPOINT_BY_TAC as TON_RPC_ENDPOINT_BY_TAC, DEV_TONCENTER_V3_INDEXER_ENDPOINT as TONCENTER_V3_INDEXER_ENDPOINT } from "./ton/endpoints";
|
|
5
5
|
export * as tac from "./tac";
|
|
6
6
|
export { PUBLIC_LITE_SEQUENCER_ENDPOINTS, TAC_RPC_ENDPOINT, TAC_EXPLORER_API_ENDPOINT };
|
|
7
7
|
export * as ton from "./ton";
|
|
8
|
-
export { DEFAULT_LITESERVERS, TON_PUBLIC_RPC_ENDPOINT, TON_RPC_ENDPOINT_BY_TAC };
|
|
8
|
+
export { DEFAULT_LITESERVERS, TON_PUBLIC_RPC_ENDPOINT, TON_RPC_ENDPOINT_BY_TAC, TONCENTER_V3_INDEXER_ENDPOINT };
|
|
9
9
|
export { AGNOSTIC_PROXY_ADDRESS, MULTICALL_3_ADDRESS, TAC_SETTINGS_ADDRESS, TAC_SMART_ACCOUNT_FACTORY_ADDRESS, TON_SETTINGS_ADDRESS };
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.TON_SETTINGS_ADDRESS = exports.TAC_SMART_ACCOUNT_FACTORY_ADDRESS = exports.TAC_SETTINGS_ADDRESS = exports.MULTICALL_3_ADDRESS = exports.AGNOSTIC_PROXY_ADDRESS = exports.TON_RPC_ENDPOINT_BY_TAC = exports.TON_PUBLIC_RPC_ENDPOINT = exports.DEFAULT_LITESERVERS = exports.ton = exports.TAC_EXPLORER_API_ENDPOINT = exports.TAC_RPC_ENDPOINT = exports.PUBLIC_LITE_SEQUENCER_ENDPOINTS = exports.tac = void 0;
|
|
36
|
+
exports.TON_SETTINGS_ADDRESS = exports.TAC_SMART_ACCOUNT_FACTORY_ADDRESS = exports.TAC_SETTINGS_ADDRESS = exports.MULTICALL_3_ADDRESS = exports.AGNOSTIC_PROXY_ADDRESS = exports.TONCENTER_V3_INDEXER_ENDPOINT = exports.TON_RPC_ENDPOINT_BY_TAC = exports.TON_PUBLIC_RPC_ENDPOINT = exports.DEFAULT_LITESERVERS = exports.ton = exports.TAC_EXPLORER_API_ENDPOINT = exports.TAC_RPC_ENDPOINT = exports.PUBLIC_LITE_SEQUENCER_ENDPOINTS = exports.tac = void 0;
|
|
37
37
|
const addresses_1 = require("./tac/addresses");
|
|
38
38
|
Object.defineProperty(exports, "AGNOSTIC_PROXY_ADDRESS", { enumerable: true, get: function () { return addresses_1.DEV_AGNOSTIC_PROXY_ADDRESS; } });
|
|
39
39
|
Object.defineProperty(exports, "MULTICALL_3_ADDRESS", { enumerable: true, get: function () { return addresses_1.DEV_MULTICALL_3_ADDRESS; } });
|
|
@@ -49,5 +49,6 @@ const endpoints_2 = require("./ton/endpoints");
|
|
|
49
49
|
Object.defineProperty(exports, "DEFAULT_LITESERVERS", { enumerable: true, get: function () { return endpoints_2.DEV_DEFAULT_LITESERVERS; } });
|
|
50
50
|
Object.defineProperty(exports, "TON_PUBLIC_RPC_ENDPOINT", { enumerable: true, get: function () { return endpoints_2.DEV_TON_PUBLIC_RPC_ENDPOINT; } });
|
|
51
51
|
Object.defineProperty(exports, "TON_RPC_ENDPOINT_BY_TAC", { enumerable: true, get: function () { return endpoints_2.DEV_TON_RPC_ENDPOINT_BY_TAC; } });
|
|
52
|
+
Object.defineProperty(exports, "TONCENTER_V3_INDEXER_ENDPOINT", { enumerable: true, get: function () { return endpoints_2.DEV_TONCENTER_V3_INDEXER_ENDPOINT; } });
|
|
52
53
|
exports.tac = __importStar(require("./tac"));
|
|
53
54
|
exports.ton = __importStar(require("./ton"));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEV_TON_RPC_ENDPOINT_BY_TAC = exports.DEV_TON_PUBLIC_RPC_ENDPOINT = exports.DEV_DEFAULT_LITESERVERS = void 0;
|
|
3
|
+
exports.DEV_TONCENTER_V3_INDEXER_ENDPOINT = exports.DEV_TON_RPC_ENDPOINT_BY_TAC = exports.DEV_TON_PUBLIC_RPC_ENDPOINT = exports.DEV_DEFAULT_LITESERVERS = void 0;
|
|
4
4
|
exports.DEV_DEFAULT_LITESERVERS = "";
|
|
5
5
|
exports.DEV_TON_PUBLIC_RPC_ENDPOINT = "";
|
|
6
6
|
exports.DEV_TON_RPC_ENDPOINT_BY_TAC = "";
|
|
7
|
+
exports.DEV_TONCENTER_V3_INDEXER_ENDPOINT = "";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { MAINNET_AGNOSTIC_PROXY_ADDRESS as AGNOSTIC_PROXY_ADDRESS, MAINNET_MULTICALL_3_ADDRESS as MULTICALL_3_ADDRESS, MAINNET_TAC_SETTINGS_ADDRESS as TAC_SETTINGS_ADDRESS, MAINNET_TAC_SMART_ACCOUNT_FACTORY_ADDRESS as TAC_SMART_ACCOUNT_FACTORY_ADDRESS } from './tac/addresses';
|
|
2
2
|
import { MAINNET_PUBLIC_LITE_SEQUENCER_ENDPOINTS as PUBLIC_LITE_SEQUENCER_ENDPOINTS, MAINNET_TAC_RPC_ENDPOINT as TAC_RPC_ENDPOINT, MAINNET_TAC_EXPLORER_API_ENDPOINT as TAC_EXPLORER_API_ENDPOINT } from "./tac/endpoints";
|
|
3
3
|
import { MAINNET_TON_SETTINGS_ADDRESS as TON_SETTINGS_ADDRESS } from './ton/addresses';
|
|
4
|
-
import { MAINNET_DEFAULT_LITESERVERS as DEFAULT_LITESERVERS, MAINNET_TON_PUBLIC_RPC_ENDPOINT as TON_PUBLIC_RPC_ENDPOINT, MAINNET_TON_RPC_ENDPOINT_BY_TAC as TON_RPC_ENDPOINT_BY_TAC } from "./ton/endpoints";
|
|
4
|
+
import { MAINNET_DEFAULT_LITESERVERS as DEFAULT_LITESERVERS, MAINNET_TON_PUBLIC_RPC_ENDPOINT as TON_PUBLIC_RPC_ENDPOINT, MAINNET_TON_RPC_ENDPOINT_BY_TAC as TON_RPC_ENDPOINT_BY_TAC, MAINNET_TONCENTER_V3_INDEXER_ENDPOINT as TONCENTER_V3_INDEXER_ENDPOINT } from "./ton/endpoints";
|
|
5
5
|
export * as tac from "./tac";
|
|
6
6
|
export { PUBLIC_LITE_SEQUENCER_ENDPOINTS, TAC_RPC_ENDPOINT, TAC_EXPLORER_API_ENDPOINT };
|
|
7
7
|
export * as ton from "./ton";
|
|
8
|
-
export { DEFAULT_LITESERVERS, TON_PUBLIC_RPC_ENDPOINT, TON_RPC_ENDPOINT_BY_TAC };
|
|
8
|
+
export { DEFAULT_LITESERVERS, TON_PUBLIC_RPC_ENDPOINT, TON_RPC_ENDPOINT_BY_TAC, TONCENTER_V3_INDEXER_ENDPOINT };
|
|
9
9
|
export { AGNOSTIC_PROXY_ADDRESS, MULTICALL_3_ADDRESS, TAC_SETTINGS_ADDRESS, TAC_SMART_ACCOUNT_FACTORY_ADDRESS, TON_SETTINGS_ADDRESS };
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.TON_SETTINGS_ADDRESS = exports.TAC_SMART_ACCOUNT_FACTORY_ADDRESS = exports.TAC_SETTINGS_ADDRESS = exports.MULTICALL_3_ADDRESS = exports.AGNOSTIC_PROXY_ADDRESS = exports.TON_RPC_ENDPOINT_BY_TAC = exports.TON_PUBLIC_RPC_ENDPOINT = exports.DEFAULT_LITESERVERS = exports.ton = exports.TAC_EXPLORER_API_ENDPOINT = exports.TAC_RPC_ENDPOINT = exports.PUBLIC_LITE_SEQUENCER_ENDPOINTS = exports.tac = void 0;
|
|
36
|
+
exports.TON_SETTINGS_ADDRESS = exports.TAC_SMART_ACCOUNT_FACTORY_ADDRESS = exports.TAC_SETTINGS_ADDRESS = exports.MULTICALL_3_ADDRESS = exports.AGNOSTIC_PROXY_ADDRESS = exports.TONCENTER_V3_INDEXER_ENDPOINT = exports.TON_RPC_ENDPOINT_BY_TAC = exports.TON_PUBLIC_RPC_ENDPOINT = exports.DEFAULT_LITESERVERS = exports.ton = exports.TAC_EXPLORER_API_ENDPOINT = exports.TAC_RPC_ENDPOINT = exports.PUBLIC_LITE_SEQUENCER_ENDPOINTS = exports.tac = void 0;
|
|
37
37
|
const addresses_1 = require("./tac/addresses");
|
|
38
38
|
Object.defineProperty(exports, "AGNOSTIC_PROXY_ADDRESS", { enumerable: true, get: function () { return addresses_1.MAINNET_AGNOSTIC_PROXY_ADDRESS; } });
|
|
39
39
|
Object.defineProperty(exports, "MULTICALL_3_ADDRESS", { enumerable: true, get: function () { return addresses_1.MAINNET_MULTICALL_3_ADDRESS; } });
|
|
@@ -49,5 +49,6 @@ const endpoints_2 = require("./ton/endpoints");
|
|
|
49
49
|
Object.defineProperty(exports, "DEFAULT_LITESERVERS", { enumerable: true, get: function () { return endpoints_2.MAINNET_DEFAULT_LITESERVERS; } });
|
|
50
50
|
Object.defineProperty(exports, "TON_PUBLIC_RPC_ENDPOINT", { enumerable: true, get: function () { return endpoints_2.MAINNET_TON_PUBLIC_RPC_ENDPOINT; } });
|
|
51
51
|
Object.defineProperty(exports, "TON_RPC_ENDPOINT_BY_TAC", { enumerable: true, get: function () { return endpoints_2.MAINNET_TON_RPC_ENDPOINT_BY_TAC; } });
|
|
52
|
+
Object.defineProperty(exports, "TONCENTER_V3_INDEXER_ENDPOINT", { enumerable: true, get: function () { return endpoints_2.MAINNET_TONCENTER_V3_INDEXER_ENDPOINT; } });
|
|
52
53
|
exports.tac = __importStar(require("./tac"));
|
|
53
54
|
exports.ton = __importStar(require("./ton"));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const MAINNET_DEFAULT_LITESERVERS = "https://ton.org/global.config.json";
|
|
2
2
|
export declare const MAINNET_TON_PUBLIC_RPC_ENDPOINT = "https://toncenter.com/api/v2/jsonRPC";
|
|
3
3
|
export declare const MAINNET_TON_RPC_ENDPOINT_BY_TAC = "https://toncenter-mainnet.tac.build";
|
|
4
|
+
export declare const MAINNET_TONCENTER_V3_INDEXER_ENDPOINT = "https://toncenter-mainnet.tac.build/api/v3/";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAINNET_TON_RPC_ENDPOINT_BY_TAC = exports.MAINNET_TON_PUBLIC_RPC_ENDPOINT = exports.MAINNET_DEFAULT_LITESERVERS = void 0;
|
|
3
|
+
exports.MAINNET_TONCENTER_V3_INDEXER_ENDPOINT = exports.MAINNET_TON_RPC_ENDPOINT_BY_TAC = exports.MAINNET_TON_PUBLIC_RPC_ENDPOINT = exports.MAINNET_DEFAULT_LITESERVERS = void 0;
|
|
4
4
|
exports.MAINNET_DEFAULT_LITESERVERS = 'https://ton.org/global.config.json';
|
|
5
5
|
exports.MAINNET_TON_PUBLIC_RPC_ENDPOINT = 'https://toncenter.com/api/v2/jsonRPC';
|
|
6
6
|
exports.MAINNET_TON_RPC_ENDPOINT_BY_TAC = 'https://toncenter-mainnet.tac.build';
|
|
7
|
+
exports.MAINNET_TONCENTER_V3_INDEXER_ENDPOINT = 'https://toncenter-mainnet.tac.build/api/v3/';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TESTNET_AGNOSTIC_PROXY_ADDRESS as AGNOSTIC_PROXY_ADDRESS, TESTNET_MULTICALL_3_ADDRESS as MULTICALL_3_ADDRESS, TESTNET_TAC_SETTINGS_ADDRESS as TAC_SETTINGS_ADDRESS, TESTNET_TAC_SMART_ACCOUNT_FACTORY_ADDRESS as TAC_SMART_ACCOUNT_FACTORY_ADDRESS } from './tac/addresses';
|
|
2
2
|
import { TESTNET_PUBLIC_LITE_SEQUENCER_ENDPOINTS as PUBLIC_LITE_SEQUENCER_ENDPOINTS, TESTNET_TAC_RPC_ENDPOINT as TAC_RPC_ENDPOINT, TESTNET_TAC_EXPLORER_API_ENDPOINT as TAC_EXPLORER_API_ENDPOINT } from "./tac/endpoints";
|
|
3
3
|
import { TESTNET_TON_SETTINGS_ADDRESS as TON_SETTINGS_ADDRESS } from './ton/addresses';
|
|
4
|
-
import { TESTNET_DEFAULT_LITESERVERS as DEFAULT_LITESERVERS, TESTNET_TON_PUBLIC_RPC_ENDPOINT as TON_PUBLIC_RPC_ENDPOINT, TESTNET_TON_RPC_ENDPOINT_BY_TAC as TON_RPC_ENDPOINT_BY_TAC } from "./ton/endpoints";
|
|
4
|
+
import { TESTNET_DEFAULT_LITESERVERS as DEFAULT_LITESERVERS, TESTNET_TON_PUBLIC_RPC_ENDPOINT as TON_PUBLIC_RPC_ENDPOINT, TESTNET_TON_RPC_ENDPOINT_BY_TAC as TON_RPC_ENDPOINT_BY_TAC, TESTNET_TONCENTER_V3_INDEXER_ENDPOINT as TONCENTER_V3_INDEXER_ENDPOINT } from "./ton/endpoints";
|
|
5
5
|
export * as tac from "./tac";
|
|
6
6
|
export { PUBLIC_LITE_SEQUENCER_ENDPOINTS, TAC_RPC_ENDPOINT, TAC_EXPLORER_API_ENDPOINT };
|
|
7
7
|
export * as ton from "./ton";
|
|
8
|
-
export { DEFAULT_LITESERVERS, TON_PUBLIC_RPC_ENDPOINT, TON_RPC_ENDPOINT_BY_TAC };
|
|
8
|
+
export { DEFAULT_LITESERVERS, TON_PUBLIC_RPC_ENDPOINT, TON_RPC_ENDPOINT_BY_TAC, TONCENTER_V3_INDEXER_ENDPOINT };
|
|
9
9
|
export { AGNOSTIC_PROXY_ADDRESS, MULTICALL_3_ADDRESS, TAC_SETTINGS_ADDRESS, TAC_SMART_ACCOUNT_FACTORY_ADDRESS, TON_SETTINGS_ADDRESS };
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.TON_SETTINGS_ADDRESS = exports.TAC_SMART_ACCOUNT_FACTORY_ADDRESS = exports.TAC_SETTINGS_ADDRESS = exports.MULTICALL_3_ADDRESS = exports.AGNOSTIC_PROXY_ADDRESS = exports.TON_RPC_ENDPOINT_BY_TAC = exports.TON_PUBLIC_RPC_ENDPOINT = exports.DEFAULT_LITESERVERS = exports.ton = exports.TAC_EXPLORER_API_ENDPOINT = exports.TAC_RPC_ENDPOINT = exports.PUBLIC_LITE_SEQUENCER_ENDPOINTS = exports.tac = void 0;
|
|
36
|
+
exports.TON_SETTINGS_ADDRESS = exports.TAC_SMART_ACCOUNT_FACTORY_ADDRESS = exports.TAC_SETTINGS_ADDRESS = exports.MULTICALL_3_ADDRESS = exports.AGNOSTIC_PROXY_ADDRESS = exports.TONCENTER_V3_INDEXER_ENDPOINT = exports.TON_RPC_ENDPOINT_BY_TAC = exports.TON_PUBLIC_RPC_ENDPOINT = exports.DEFAULT_LITESERVERS = exports.ton = exports.TAC_EXPLORER_API_ENDPOINT = exports.TAC_RPC_ENDPOINT = exports.PUBLIC_LITE_SEQUENCER_ENDPOINTS = exports.tac = void 0;
|
|
37
37
|
const addresses_1 = require("./tac/addresses");
|
|
38
38
|
Object.defineProperty(exports, "AGNOSTIC_PROXY_ADDRESS", { enumerable: true, get: function () { return addresses_1.TESTNET_AGNOSTIC_PROXY_ADDRESS; } });
|
|
39
39
|
Object.defineProperty(exports, "MULTICALL_3_ADDRESS", { enumerable: true, get: function () { return addresses_1.TESTNET_MULTICALL_3_ADDRESS; } });
|
|
@@ -49,5 +49,6 @@ const endpoints_2 = require("./ton/endpoints");
|
|
|
49
49
|
Object.defineProperty(exports, "DEFAULT_LITESERVERS", { enumerable: true, get: function () { return endpoints_2.TESTNET_DEFAULT_LITESERVERS; } });
|
|
50
50
|
Object.defineProperty(exports, "TON_PUBLIC_RPC_ENDPOINT", { enumerable: true, get: function () { return endpoints_2.TESTNET_TON_PUBLIC_RPC_ENDPOINT; } });
|
|
51
51
|
Object.defineProperty(exports, "TON_RPC_ENDPOINT_BY_TAC", { enumerable: true, get: function () { return endpoints_2.TESTNET_TON_RPC_ENDPOINT_BY_TAC; } });
|
|
52
|
+
Object.defineProperty(exports, "TONCENTER_V3_INDEXER_ENDPOINT", { enumerable: true, get: function () { return endpoints_2.TESTNET_TONCENTER_V3_INDEXER_ENDPOINT; } });
|
|
52
53
|
exports.tac = __importStar(require("./tac"));
|
|
53
54
|
exports.ton = __importStar(require("./ton"));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const TESTNET_DEFAULT_LITESERVERS = "https://ton.org/testnet-global.config.json";
|
|
2
2
|
export declare const TESTNET_TON_PUBLIC_RPC_ENDPOINT = "https://testnet.toncenter.com/api/v2/jsonRPC";
|
|
3
3
|
export declare const TESTNET_TON_RPC_ENDPOINT_BY_TAC = "https://toncenter-spb.tac.build";
|
|
4
|
+
export declare const TESTNET_TONCENTER_V3_INDEXER_ENDPOINT = "https://toncenter-spb.tac.build/api/v3/";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TESTNET_TON_RPC_ENDPOINT_BY_TAC = exports.TESTNET_TON_PUBLIC_RPC_ENDPOINT = exports.TESTNET_DEFAULT_LITESERVERS = void 0;
|
|
3
|
+
exports.TESTNET_TONCENTER_V3_INDEXER_ENDPOINT = exports.TESTNET_TON_RPC_ENDPOINT_BY_TAC = exports.TESTNET_TON_PUBLIC_RPC_ENDPOINT = exports.TESTNET_DEFAULT_LITESERVERS = void 0;
|
|
4
4
|
exports.TESTNET_DEFAULT_LITESERVERS = 'https://ton.org/testnet-global.config.json';
|
|
5
5
|
exports.TESTNET_TON_PUBLIC_RPC_ENDPOINT = 'https://testnet.toncenter.com/api/v2/jsonRPC';
|
|
6
6
|
exports.TESTNET_TON_RPC_ENDPOINT_BY_TAC = 'https://toncenter-spb.tac.build';
|
|
7
|
+
exports.TESTNET_TONCENTER_V3_INDEXER_ENDPOINT = 'https://toncenter-spb.tac.build/api/v3/';
|
|
@@ -7,8 +7,12 @@ export interface OpenerConfig {
|
|
|
7
7
|
opener: ContractOpener;
|
|
8
8
|
/** Number of retry attempts before falling back to the next opener. */
|
|
9
9
|
retries: number;
|
|
10
|
-
/**
|
|
10
|
+
/** Base delay in milliseconds between retries for this opener. */
|
|
11
11
|
retryDelay: number;
|
|
12
|
+
/** Upper bound for exponential backoff delay in milliseconds. */
|
|
13
|
+
maxRetryDelay?: number;
|
|
14
|
+
/** Exponential backoff multiplier applied after each failed retry. */
|
|
15
|
+
retryBackoffMultiplier?: number;
|
|
12
16
|
}
|
|
13
17
|
export declare class RetryableContractOpener implements ContractOpener {
|
|
14
18
|
private readonly openerConfigs;
|
|
@@ -32,6 +36,7 @@ export declare class RetryableContractOpener implements ContractOpener {
|
|
|
32
36
|
private executeWithFallback;
|
|
33
37
|
private trySingleAttempt;
|
|
34
38
|
private tryWithRetries;
|
|
39
|
+
private getRetryDelay;
|
|
35
40
|
private isContractExecutionError;
|
|
36
41
|
private isTransportError;
|
|
37
42
|
private createRetryableContract;
|
|
@@ -22,9 +22,7 @@ class RetryableContractOpener {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
setLogger(logger) {
|
|
25
|
-
|
|
26
|
-
this.logger = logger;
|
|
27
|
-
}
|
|
25
|
+
this.logger = logger;
|
|
28
26
|
this.applyLoggerToOpeners(logger);
|
|
29
27
|
}
|
|
30
28
|
applyLoggerToOpeners(logger) {
|
|
@@ -199,13 +197,24 @@ class RetryableContractOpener {
|
|
|
199
197
|
return { success: false, lastError };
|
|
200
198
|
}
|
|
201
199
|
if (attempt < config.retries) {
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
const retryDelay = this.getRetryDelay(config, attempt);
|
|
201
|
+
this.logger?.debug(`[RetryableContractOpener] ${operationContext}: attempt ${attempt + 1}/${config.retries + 1} failed (${lastError.message}), retrying in ${retryDelay}ms`);
|
|
202
|
+
await sleep(retryDelay);
|
|
204
203
|
}
|
|
205
204
|
}
|
|
206
205
|
}
|
|
207
206
|
return { success: false, lastError };
|
|
208
207
|
}
|
|
208
|
+
getRetryDelay(config, attempt) {
|
|
209
|
+
const baseDelay = config.retryDelay ?? Consts_1.DEFAULT_RETRY_DELAY_MS;
|
|
210
|
+
const maxRetryDelay = config.maxRetryDelay ?? Consts_1.DEFAULT_RETRY_MAX_DELAY_MS;
|
|
211
|
+
const backoffMultiplier = config.retryBackoffMultiplier ?? Consts_1.DEFAULT_RETRY_BACKOFF_MULTIPLIER;
|
|
212
|
+
if (baseDelay === 0 || maxRetryDelay === 0) {
|
|
213
|
+
return 0;
|
|
214
|
+
}
|
|
215
|
+
const calculatedDelay = baseDelay * backoffMultiplier ** attempt;
|
|
216
|
+
return Math.min(Math.round(calculatedDelay), maxRetryDelay);
|
|
217
|
+
}
|
|
209
218
|
isContractExecutionError(error) {
|
|
210
219
|
const errorWithExit = error;
|
|
211
220
|
if (typeof errorWithExit.exitCode === 'number' ||
|
|
@@ -269,18 +278,36 @@ async function createDefaultRetryableOpener(tonRpcEndpoint, networkType, maxRetr
|
|
|
269
278
|
timeout: Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS,
|
|
270
279
|
});
|
|
271
280
|
const opener = (0, TonClientOpener_1.tonClientOpener)(tonClient, logger);
|
|
272
|
-
openers.push({
|
|
281
|
+
openers.push({
|
|
282
|
+
opener,
|
|
283
|
+
retries: maxRetries,
|
|
284
|
+
retryDelay,
|
|
285
|
+
maxRetryDelay: Consts_1.DEFAULT_RETRY_MAX_DELAY_MS,
|
|
286
|
+
retryBackoffMultiplier: Consts_1.DEFAULT_RETRY_BACKOFF_MULTIPLIER,
|
|
287
|
+
});
|
|
273
288
|
if (networkType !== Struct_1.Network.DEV) {
|
|
274
289
|
try {
|
|
275
290
|
const opener = await (0, TonClientOpener_1.orbsOpener)(networkType, logger);
|
|
276
|
-
openers.push({
|
|
291
|
+
openers.push({
|
|
292
|
+
opener: opener,
|
|
293
|
+
retries: maxRetries,
|
|
294
|
+
retryDelay,
|
|
295
|
+
maxRetryDelay: Consts_1.DEFAULT_RETRY_MAX_DELAY_MS,
|
|
296
|
+
retryBackoffMultiplier: Consts_1.DEFAULT_RETRY_BACKOFF_MULTIPLIER,
|
|
297
|
+
});
|
|
277
298
|
}
|
|
278
299
|
catch {
|
|
279
300
|
// skip opener in case of failure
|
|
280
301
|
}
|
|
281
302
|
try {
|
|
282
303
|
const opener4 = await (0, TonClient4Opener_1.orbsOpener4)(networkType, Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS, logger);
|
|
283
|
-
openers.push({
|
|
304
|
+
openers.push({
|
|
305
|
+
opener: opener4,
|
|
306
|
+
retries: maxRetries,
|
|
307
|
+
retryDelay,
|
|
308
|
+
maxRetryDelay: Consts_1.DEFAULT_RETRY_MAX_DELAY_MS,
|
|
309
|
+
retryBackoffMultiplier: Consts_1.DEFAULT_RETRY_BACKOFF_MULTIPLIER,
|
|
310
|
+
});
|
|
284
311
|
}
|
|
285
312
|
catch {
|
|
286
313
|
// skip opener in case of failure
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IHttpClient, IToncenterV3Indexer } from '../interfaces';
|
|
2
|
+
import { ToncenterV3IndexedTransaction, ToncenterV3TraversalParams } from '../structs/Struct';
|
|
3
|
+
/**
|
|
4
|
+
* Thin Toncenter v3 indexer client for resolving indexed TON transaction context by hash and
|
|
5
|
+
* traversing a linked chain of TON transactions until it finds the sequencer-collected event transaction on CCL.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ToncenterV3Indexer implements IToncenterV3Indexer {
|
|
8
|
+
readonly endpoint: string;
|
|
9
|
+
private readonly httpClient;
|
|
10
|
+
constructor(endpoint: string, httpClient?: IHttpClient);
|
|
11
|
+
/**
|
|
12
|
+
* Queries Toncenter v3 indexed `/transactions` endpoint by hash and returns the first match.
|
|
13
|
+
* @param transactionHash TON transaction hash accepted by the indexer.
|
|
14
|
+
* @returns Indexed transaction with owning account context, or null on 404 / empty result.
|
|
15
|
+
*/
|
|
16
|
+
getTransactionByHash(transactionHash: string): Promise<ToncenterV3IndexedTransaction | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Queries Toncenter v3 indexed `/adjacentTransactions` endpoint by hash.
|
|
19
|
+
* @param transactionHash TON transaction hash accepted by the indexer.
|
|
20
|
+
* @returns Adjacent indexed transactions, or an empty array on 404 / empty result.
|
|
21
|
+
*/
|
|
22
|
+
getAdjacentTransactions(transactionHash: string): Promise<ToncenterV3IndexedTransaction[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Traverses the linked chain of TON transactions in both directions starting from any TON transaction hash
|
|
25
|
+
* from that linked transaction chain, and returns the transaction on crossChainLayer that the sequencer would collect
|
|
26
|
+
* as a TVM event.
|
|
27
|
+
* @param transactionHash Any TON transaction hash from the target linked chain of TON transactions.
|
|
28
|
+
* @param crossChainLayerAddress crossChainLayer address whose sequencer-collected event transaction should be found in that linked chain of TON transactions.
|
|
29
|
+
* @param params Optional traversal settings. Defaults match the SDK traversal defaults.
|
|
30
|
+
* @returns Indexed crossChainLayer transaction that matches the sequencer collector rules, or null if not found.
|
|
31
|
+
*/
|
|
32
|
+
findCollectibleCrossChainLayerTransaction(transactionHash: string, crossChainLayerAddress: string, params?: ToncenterV3TraversalParams): Promise<ToncenterV3IndexedTransaction | null>;
|
|
33
|
+
private isCollectibleEventTransactionOnAccount;
|
|
34
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ToncenterV3Indexer = void 0;
|
|
4
|
+
const ton_1 = require("@ton/ton");
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
const AxiosHttpClient_1 = require("../sdk/AxiosHttpClient");
|
|
7
|
+
const Consts_1 = require("../sdk/Consts");
|
|
8
|
+
const Utils_1 = require("../sdk/Utils");
|
|
9
|
+
/**
|
|
10
|
+
* Thin Toncenter v3 indexer client for resolving indexed TON transaction context by hash and
|
|
11
|
+
* traversing a linked chain of TON transactions until it finds the sequencer-collected event transaction on CCL.
|
|
12
|
+
*/
|
|
13
|
+
class ToncenterV3Indexer {
|
|
14
|
+
constructor(endpoint, httpClient = new AxiosHttpClient_1.AxiosHttpClient()) {
|
|
15
|
+
this.endpoint = endpoint;
|
|
16
|
+
this.httpClient = httpClient;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Queries Toncenter v3 indexed `/transactions` endpoint by hash and returns the first match.
|
|
20
|
+
* @param transactionHash TON transaction hash accepted by the indexer.
|
|
21
|
+
* @returns Indexed transaction with owning account context, or null on 404 / empty result.
|
|
22
|
+
*/
|
|
23
|
+
async getTransactionByHash(transactionHash) {
|
|
24
|
+
const endpoint = this.endpoint.endsWith('/') ? `${this.endpoint}transactions` : `${this.endpoint}/transactions`;
|
|
25
|
+
const requestLabel = `GET ${endpoint}`;
|
|
26
|
+
try {
|
|
27
|
+
const response = await this.httpClient.get(endpoint, {
|
|
28
|
+
params: {
|
|
29
|
+
hash: transactionHash,
|
|
30
|
+
limit: 1,
|
|
31
|
+
},
|
|
32
|
+
transformResponse: [Utils_1.toCamelCaseTransformer],
|
|
33
|
+
});
|
|
34
|
+
return response.data.transactions?.[0] ?? null;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
if (error?.response?.status === 404) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
throw (0, errors_1.operationFetchError)(`request ${requestLabel} failed to resolve TON indexed transaction`, error);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Queries Toncenter v3 indexed `/adjacentTransactions` endpoint by hash.
|
|
46
|
+
* @param transactionHash TON transaction hash accepted by the indexer.
|
|
47
|
+
* @returns Adjacent indexed transactions, or an empty array on 404 / empty result.
|
|
48
|
+
*/
|
|
49
|
+
async getAdjacentTransactions(transactionHash) {
|
|
50
|
+
const endpoint = this.endpoint.endsWith('/') ? `${this.endpoint}adjacentTransactions` : `${this.endpoint}/adjacentTransactions`;
|
|
51
|
+
const requestLabel = `GET ${endpoint}`;
|
|
52
|
+
try {
|
|
53
|
+
const response = await this.httpClient.get(endpoint, {
|
|
54
|
+
params: {
|
|
55
|
+
hash: transactionHash,
|
|
56
|
+
},
|
|
57
|
+
transformResponse: [Utils_1.toCamelCaseTransformer],
|
|
58
|
+
});
|
|
59
|
+
return response.data.transactions ?? [];
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
|
+
if (error?.response?.status === 404) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
throw (0, errors_1.operationFetchError)(`request ${requestLabel} failed to resolve adjacent TON indexed transactions`, error);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Traverses the linked chain of TON transactions in both directions starting from any TON transaction hash
|
|
71
|
+
* from that linked transaction chain, and returns the transaction on crossChainLayer that the sequencer would collect
|
|
72
|
+
* as a TVM event.
|
|
73
|
+
* @param transactionHash Any TON transaction hash from the target linked chain of TON transactions.
|
|
74
|
+
* @param crossChainLayerAddress crossChainLayer address whose sequencer-collected event transaction should be found in that linked chain of TON transactions.
|
|
75
|
+
* @param params Optional traversal settings. Defaults match the SDK traversal defaults.
|
|
76
|
+
* @returns Indexed crossChainLayer transaction that matches the sequencer collector rules, or null if not found.
|
|
77
|
+
*/
|
|
78
|
+
async findCollectibleCrossChainLayerTransaction(transactionHash, crossChainLayerAddress, params) {
|
|
79
|
+
const { maxDepth = Consts_1.DEFAULT_FIND_TX_MAX_DEPTH, maxScannedTransactions = Consts_1.DEFAULT_MAX_SCANNED_TRANSACTIONS, } = params ?? {};
|
|
80
|
+
const crossChainLayer = ton_1.Address.parse(crossChainLayerAddress);
|
|
81
|
+
const rootTransaction = await this.getTransactionByHash(transactionHash);
|
|
82
|
+
if (!rootTransaction) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
if (this.isCollectibleEventTransactionOnAccount(rootTransaction, crossChainLayer)) {
|
|
86
|
+
return rootTransaction;
|
|
87
|
+
}
|
|
88
|
+
const queue = [{ hash: rootTransaction.hash, depth: 0 }];
|
|
89
|
+
const visitedHashes = new Set([(0, Utils_1.normalizeHashToHex)(rootTransaction.hash)]);
|
|
90
|
+
let scannedTransactions = 0;
|
|
91
|
+
while (queue.length > 0) {
|
|
92
|
+
const { hash: currentHash, depth } = queue.shift();
|
|
93
|
+
if (depth >= maxDepth || scannedTransactions >= maxScannedTransactions) {
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const adjacentTransactions = await this.getAdjacentTransactions(currentHash);
|
|
97
|
+
for (const transaction of adjacentTransactions) {
|
|
98
|
+
const normalizedHash = (0, Utils_1.normalizeHashToHex)(transaction.hash);
|
|
99
|
+
if (visitedHashes.has(normalizedHash)) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
visitedHashes.add(normalizedHash);
|
|
103
|
+
scannedTransactions += 1;
|
|
104
|
+
if (this.isCollectibleEventTransactionOnAccount(transaction, crossChainLayer)) {
|
|
105
|
+
return transaction;
|
|
106
|
+
}
|
|
107
|
+
if (scannedTransactions < maxScannedTransactions) {
|
|
108
|
+
queue.push({ hash: transaction.hash, depth: depth + 1 });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
isCollectibleEventTransactionOnAccount(transaction, account) {
|
|
115
|
+
if (!ton_1.Address.parse(transaction.account).equals(account)) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return transaction.outMsgs.some((message) => {
|
|
119
|
+
return message.destination == null;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.ToncenterV3Indexer = ToncenterV3Indexer;
|
|
@@ -19,5 +19,6 @@ __exportStar(require("./LiteClientOpener"), exports);
|
|
|
19
19
|
__exportStar(require("./OpenerUtils"), exports);
|
|
20
20
|
__exportStar(require("./RetryableContractOpener"), exports);
|
|
21
21
|
__exportStar(require("./SandboxOpener"), exports);
|
|
22
|
+
__exportStar(require("./ToncenterV3Indexer"), exports);
|
|
22
23
|
__exportStar(require("./TonClient4Opener"), exports);
|
|
23
24
|
__exportStar(require("./TonClientOpener"), exports);
|
package/dist/src/assets/FT.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import { Cell, OpenedContract } from '@ton/ton';
|
|
|
3
3
|
import { JettonMinterData, JettonWallet } from '../../artifacts/tonTypes';
|
|
4
4
|
import { Asset, IConfiguration } from '../interfaces';
|
|
5
5
|
import { AssetOpType } from '../structs/InternalStruct';
|
|
6
|
-
import { AssetType, BlockchainType, EVMAddress, FeeParams, FTOriginAndData, TVMAddress, UserWalletBalanceExtended } from '../structs/Struct';
|
|
7
|
-
import { Origin } from '../structs/Struct';
|
|
6
|
+
import { AssetFeeMode, AssetType, BlockchainType, EVMAddress, FeeParams, FTOriginAndData, Origin, TVMAddress, UserWalletBalanceExtended } from '../structs/Struct';
|
|
8
7
|
export declare class FT implements Asset {
|
|
9
8
|
private _tvmAddress;
|
|
10
9
|
readonly type: AssetType;
|
|
11
10
|
readonly origin: Origin;
|
|
11
|
+
readonly feeMode: AssetFeeMode;
|
|
12
12
|
private _configuration;
|
|
13
13
|
private _jettonMinter;
|
|
14
14
|
private _decimals;
|
|
@@ -26,6 +26,7 @@ export declare class FT implements Asset {
|
|
|
26
26
|
static getTVMAddress(configuration: IConfiguration, address: EVMAddress): Promise<string>;
|
|
27
27
|
static getEVMAddress(configuration: IConfiguration, address: TVMAddress): Promise<string>;
|
|
28
28
|
private constructor();
|
|
29
|
+
private static resolveFeeMode;
|
|
29
30
|
private static getTACDecimals;
|
|
30
31
|
static fromAddress(configuration: IConfiguration, address: TVMAddress | EVMAddress): Promise<FT>;
|
|
31
32
|
get rawAmount(): bigint;
|
package/dist/src/assets/FT.js
CHANGED
|
@@ -9,7 +9,6 @@ const Utils_1 = require("../sdk/Utils");
|
|
|
9
9
|
const Validator_1 = require("../sdk/Validator");
|
|
10
10
|
const InternalStruct_1 = require("../structs/InternalStruct");
|
|
11
11
|
const Struct_1 = require("../structs/Struct");
|
|
12
|
-
const Struct_2 = require("../structs/Struct");
|
|
13
12
|
const ContentUtils_1 = require("../wrappers/ContentUtils");
|
|
14
13
|
class FT {
|
|
15
14
|
get address() {
|
|
@@ -37,7 +36,7 @@ class FT {
|
|
|
37
36
|
const jettonMinter = configuration.TONParams.contractOpener.open(configuration.artifacts.ton.wrappers.JettonMinter.createFromAddress(ton_1.Address.parse(address)));
|
|
38
37
|
if (!jettonMinterCode.equals(thisCode)) {
|
|
39
38
|
const jettonData = await jettonMinter.getJettonData();
|
|
40
|
-
return { origin:
|
|
39
|
+
return { origin: Struct_1.Origin.TON, jettonMinter, jettonData };
|
|
41
40
|
}
|
|
42
41
|
const evmAddress = await jettonMinter.getEVMTokenAddress();
|
|
43
42
|
const expectedMinterAddress = await (0, Utils_1.calculateContractAddress)(jettonMinterCode, (0, ton_1.beginCell)()
|
|
@@ -50,9 +49,9 @@ class FT {
|
|
|
50
49
|
.endCell());
|
|
51
50
|
if (!expectedMinterAddress.equals(ton_1.Address.parse(address))) {
|
|
52
51
|
const jettonData = await jettonMinter.getJettonData();
|
|
53
|
-
return { origin:
|
|
52
|
+
return { origin: Struct_1.Origin.TON, jettonMinter, jettonData };
|
|
54
53
|
}
|
|
55
|
-
return { origin:
|
|
54
|
+
return { origin: Struct_1.Origin.TAC, jettonMinter, evmAddress };
|
|
56
55
|
}
|
|
57
56
|
static async getTVMAddress(configuration, address) {
|
|
58
57
|
Validator_1.Validator.validateEVMAddress(address);
|
|
@@ -75,7 +74,7 @@ class FT {
|
|
|
75
74
|
static async getEVMAddress(configuration, address) {
|
|
76
75
|
const tokenAddressString = ton_1.Address.parse(address).toString({ bounceable: true });
|
|
77
76
|
const origin = await FT.getOrigin(configuration, address);
|
|
78
|
-
if (origin ===
|
|
77
|
+
if (origin === Struct_1.Origin.TON) {
|
|
79
78
|
return configuration.TACParams.tokenUtils.computeAddress(tokenAddressString);
|
|
80
79
|
}
|
|
81
80
|
else {
|
|
@@ -83,7 +82,7 @@ class FT {
|
|
|
83
82
|
return givenMinter.getEVMTokenAddress();
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
|
-
constructor(address, origin, configuration, decimals) {
|
|
85
|
+
constructor(address, origin, configuration, decimals, feeMode) {
|
|
87
86
|
this.type = Struct_1.AssetType.FT;
|
|
88
87
|
this._displayMultiplierNumerator = 1n;
|
|
89
88
|
this._displayMultiplierDenominator = 1n;
|
|
@@ -93,9 +92,25 @@ class FT {
|
|
|
93
92
|
this._configuration = configuration;
|
|
94
93
|
this._jettonMinter = this._configuration.TONParams.contractOpener.open(configuration.artifacts.ton.wrappers.JettonMinter.createFromAddress(this._tvmAddress));
|
|
95
94
|
this.origin = origin;
|
|
95
|
+
this.feeMode = feeMode;
|
|
96
96
|
this._transferAmount = 0n;
|
|
97
97
|
this._decimals = decimals;
|
|
98
98
|
}
|
|
99
|
+
static resolveFeeMode(origin, jettonData) {
|
|
100
|
+
if (origin === Struct_1.Origin.TAC) {
|
|
101
|
+
return Struct_1.AssetFeeMode.TAC_ORIGINAL;
|
|
102
|
+
}
|
|
103
|
+
if (!jettonData) {
|
|
104
|
+
return Struct_1.AssetFeeMode.LEGACY;
|
|
105
|
+
}
|
|
106
|
+
const walletCodeHash = jettonData.walletCode.hash().toString('hex').toLowerCase();
|
|
107
|
+
for (const hash of Consts_1.DYNAMIC_JETTON_WALLET_CODE_HASHES) {
|
|
108
|
+
if (hash.toLowerCase() === walletCodeHash) {
|
|
109
|
+
return Struct_1.AssetFeeMode.DYNAMIC;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return Struct_1.AssetFeeMode.LEGACY;
|
|
113
|
+
}
|
|
99
114
|
static async getTACDecimals(configuration, evmAddress) {
|
|
100
115
|
const nativeTACAddress = await configuration.nativeTACAddress();
|
|
101
116
|
if (evmAddress === nativeTACAddress) {
|
|
@@ -111,13 +126,13 @@ class FT {
|
|
|
111
126
|
const { origin, jettonMinter, evmAddress: cachedEvmAddress, jettonData, } = await this.getOriginAndData(configuration, tvmAddress).catch((e) => {
|
|
112
127
|
if (e instanceof errors_1.ContractError) {
|
|
113
128
|
const jettonMinter = configuration.TONParams.contractOpener.open(configuration.artifacts.ton.wrappers.JettonMinter.createFromAddress(ton_1.Address.parse(tvmAddress)));
|
|
114
|
-
return { origin:
|
|
129
|
+
return { origin: Struct_1.Origin.TAC, jettonMinter, evmAddress: undefined, jettonData: undefined };
|
|
115
130
|
}
|
|
116
131
|
throw e;
|
|
117
132
|
});
|
|
118
133
|
let decimals;
|
|
119
134
|
let finalEvmAddress;
|
|
120
|
-
if (origin ===
|
|
135
|
+
if (origin === Struct_1.Origin.TON) {
|
|
121
136
|
if (!jettonData) {
|
|
122
137
|
throw errors_1.missingJettonDataError;
|
|
123
138
|
}
|
|
@@ -131,11 +146,12 @@ class FT {
|
|
|
131
146
|
else {
|
|
132
147
|
const resolvedEvmAddress = (0, ethers_1.isAddress)(address)
|
|
133
148
|
? address
|
|
134
|
-
: cachedEvmAddress ?? (await jettonMinter.getEVMTokenAddress());
|
|
149
|
+
: (cachedEvmAddress ?? (await jettonMinter.getEVMTokenAddress()));
|
|
135
150
|
finalEvmAddress = resolvedEvmAddress;
|
|
136
151
|
decimals = await this.getTACDecimals(configuration, resolvedEvmAddress);
|
|
137
152
|
}
|
|
138
|
-
const
|
|
153
|
+
const feeMode = FT.resolveFeeMode(origin, jettonData);
|
|
154
|
+
const token = new FT(tvmAddress, origin, configuration, decimals, feeMode);
|
|
139
155
|
if (finalEvmAddress || (0, ethers_1.isAddress)(address)) {
|
|
140
156
|
token._evmAddress = finalEvmAddress || address;
|
|
141
157
|
}
|
|
@@ -147,7 +163,7 @@ class FT {
|
|
|
147
163
|
return this._transferAmount;
|
|
148
164
|
}
|
|
149
165
|
get clone() {
|
|
150
|
-
const ft = new FT(this._tvmAddress.toString(), this.origin, this._configuration, this._decimals);
|
|
166
|
+
const ft = new FT(this._tvmAddress.toString(), this.origin, this._configuration, this._decimals, this.feeMode);
|
|
151
167
|
ft._transferAmount = this._transferAmount;
|
|
152
168
|
ft._evmAddress = this._evmAddress;
|
|
153
169
|
ft._displayMultiplierNumerator = this._displayMultiplierNumerator;
|
|
@@ -223,10 +239,10 @@ class FT {
|
|
|
223
239
|
}
|
|
224
240
|
const tokenAddressString = this._tvmAddress.toString({ bounceable: true });
|
|
225
241
|
let evmAddress;
|
|
226
|
-
if (this.origin ===
|
|
242
|
+
if (this.origin === Struct_1.Origin.TON) {
|
|
227
243
|
evmAddress = await this._configuration.TACParams.tokenUtils.computeAddress(tokenAddressString);
|
|
228
244
|
}
|
|
229
|
-
else if (this.origin ===
|
|
245
|
+
else if (this.origin === Struct_1.Origin.TAC) {
|
|
230
246
|
const givenMinter = this._configuration.TONParams.contractOpener.open(this._configuration.artifacts.ton.wrappers.JettonMinter.createFromAddress(ton_1.Address.parse(tokenAddressString)));
|
|
231
247
|
evmAddress = await givenMinter.getEVMTokenAddress();
|
|
232
248
|
}
|
|
@@ -254,7 +270,7 @@ class FT {
|
|
|
254
270
|
return payload;
|
|
255
271
|
}
|
|
256
272
|
get opType() {
|
|
257
|
-
return this.origin ===
|
|
273
|
+
return this.origin === Struct_1.Origin.TAC ? InternalStruct_1.AssetOpType.JETTON_BURN : InternalStruct_1.AssetOpType.JETTON_TRANSFER;
|
|
258
274
|
}
|
|
259
275
|
async getWallet(userAddress) {
|
|
260
276
|
const walletAddress = await this.getUserWalletAddress(userAddress);
|
package/dist/src/assets/NFT.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Cell } from '@ton/ton';
|
|
2
2
|
import { NFTCollectionData, NFTItemData } from '../../artifacts/tonTypes';
|
|
3
3
|
import { Asset, IConfiguration } from '../interfaces';
|
|
4
|
-
import { AssetType, BlockchainType, EVMAddress, FeeParams, Origin, TVMAddress } from '../structs/Struct';
|
|
4
|
+
import { AssetFeeMode, AssetType, BlockchainType, EVMAddress, FeeParams, Origin, TVMAddress } from '../structs/Struct';
|
|
5
5
|
export declare class NFT implements Asset {
|
|
6
6
|
private readonly _addresses;
|
|
7
7
|
readonly origin: Origin;
|
|
8
|
+
readonly feeMode: AssetFeeMode;
|
|
8
9
|
readonly type: AssetType;
|
|
9
10
|
private _nftCollection;
|
|
10
11
|
private _configuration;
|
|
@@ -37,7 +38,7 @@ export declare class NFT implements Asset {
|
|
|
37
38
|
collection: TVMAddress;
|
|
38
39
|
index: bigint;
|
|
39
40
|
evmAddress?: EVMAddress;
|
|
40
|
-
}, origin: Origin, configuration: IConfiguration);
|
|
41
|
+
}, origin: Origin, configuration: IConfiguration, feeMode?: AssetFeeMode);
|
|
41
42
|
get addresses(): {
|
|
42
43
|
item: string;
|
|
43
44
|
collection: string;
|
|
@@ -47,6 +48,7 @@ export declare class NFT implements Asset {
|
|
|
47
48
|
get address(): string;
|
|
48
49
|
get rawAmount(): bigint;
|
|
49
50
|
get clone(): NFT;
|
|
51
|
+
private static resolveFeeMode;
|
|
50
52
|
withAmount(_amount?: number): NFT;
|
|
51
53
|
withRawAmount(_rawAmount?: bigint): NFT;
|
|
52
54
|
addAmount(_amount?: number): NFT;
|
package/dist/src/assets/NFT.js
CHANGED
|
@@ -128,11 +128,12 @@ class NFT {
|
|
|
128
128
|
}, configuration.TONParams.nftItemCode).address.toString();
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
constructor(nftAddress, origin, configuration) {
|
|
131
|
+
constructor(nftAddress, origin, configuration, feeMode = NFT.resolveFeeMode(origin)) {
|
|
132
132
|
this.type = Struct_1.AssetType.NFT;
|
|
133
133
|
this._addresses = nftAddress;
|
|
134
134
|
this._configuration = configuration;
|
|
135
135
|
this.origin = origin;
|
|
136
|
+
this.feeMode = feeMode;
|
|
136
137
|
const NFTCollectionC = configuration.artifacts.ton.wrappers.NFTCollection;
|
|
137
138
|
this._nftCollection = configuration.TONParams.contractOpener.open(NFTCollectionC.createFromAddress(ton_1.Address.parse(this._addresses.collection)));
|
|
138
139
|
}
|
|
@@ -146,7 +147,10 @@ class NFT {
|
|
|
146
147
|
return 1n;
|
|
147
148
|
}
|
|
148
149
|
get clone() {
|
|
149
|
-
return new NFT(this._addresses, this.origin, this._configuration);
|
|
150
|
+
return new NFT(this._addresses, this.origin, this._configuration, this.feeMode);
|
|
151
|
+
}
|
|
152
|
+
static resolveFeeMode(origin) {
|
|
153
|
+
return origin === Struct_1.Origin.TAC ? Struct_1.AssetFeeMode.TAC_ORIGINAL : Struct_1.AssetFeeMode.DYNAMIC;
|
|
150
154
|
}
|
|
151
155
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
152
156
|
withAmount(_amount) {
|