@tonappchain/sdk 0.7.2-alpha-7 → 0.7.2-alpha-10
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/LICENSE +20 -20
- package/README.md +198 -198
- package/dist/artifacts/dev/index.d.ts +2 -2
- package/dist/artifacts/dev/index.js +2 -1
- package/dist/artifacts/dev/tac/endpoints.d.ts +1 -0
- package/dist/artifacts/dev/tac/endpoints.js +2 -1
- package/dist/artifacts/dev/ton/internal/build/CrossChainLayer.compiled.json +1 -1
- package/dist/artifacts/dev/ton/internal/build/Executor.compiled.json +1 -1
- package/dist/artifacts/dev/ton/internal/build/JettonProxy.compiled.json +1 -1
- package/dist/artifacts/dev/ton/internal/build/JettonWallet.compiled.json +1 -1
- package/dist/artifacts/dev/ton/internal/build/NFTItem.compiled.json +1 -1
- package/dist/artifacts/dev/ton/internal/build/NFTProxy.compiled.json +1 -1
- package/dist/artifacts/dev/ton/internal/build/Settings.compiled.json +1 -1
- package/dist/artifacts/dev/ton/internal/wrappers/CrossChainLayer.d.ts +53 -6
- package/dist/artifacts/dev/ton/internal/wrappers/CrossChainLayer.js +126 -17
- package/dist/artifacts/dev/ton/internal/wrappers/JettonMinter.d.ts +6 -0
- package/dist/artifacts/dev/ton/internal/wrappers/JettonMinter.js +10 -1
- package/dist/artifacts/dev/ton/internal/wrappers/JettonProxy.d.ts +9 -0
- package/dist/artifacts/dev/ton/internal/wrappers/JettonProxy.js +10 -1
- package/dist/artifacts/dev/ton/internal/wrappers/JettonWallet.d.ts +7 -0
- package/dist/artifacts/dev/ton/internal/wrappers/JettonWallet.js +9 -2
- package/dist/artifacts/dev/ton/internal/wrappers/NFTCollection.d.ts +9 -0
- package/dist/artifacts/dev/ton/internal/wrappers/NFTCollection.js +9 -0
- package/dist/artifacts/dev/ton/internal/wrappers/NFTItem.d.ts +7 -0
- package/dist/artifacts/dev/ton/internal/wrappers/NFTItem.js +7 -0
- package/dist/artifacts/dev/ton/internal/wrappers/NFTProxy.d.ts +7 -0
- package/dist/artifacts/dev/ton/internal/wrappers/NFTProxy.js +8 -1
- package/dist/artifacts/dev/ton/internal/wrappers/Settings.d.ts +1 -0
- package/dist/artifacts/dev/ton/internal/wrappers/Settings.js +1 -0
- package/dist/artifacts/dev/ton/internal/wrappers/utils/CrossChainLayerPayload.d.ts +10 -0
- package/dist/artifacts/dev/ton/internal/wrappers/utils/CrossChainLayerPayload.js +24 -0
- package/dist/artifacts/dev/ton/internal/wrappers/utils/MerkleRoots.d.ts +2 -1
- package/dist/artifacts/dev/ton/internal/wrappers/utils/MerkleRoots.js +9 -1
- package/dist/artifacts/mainnet/index.d.ts +2 -2
- package/dist/artifacts/mainnet/index.js +2 -1
- package/dist/artifacts/mainnet/tac/endpoints.d.ts +1 -0
- package/dist/artifacts/mainnet/tac/endpoints.js +2 -1
- package/dist/artifacts/mainnet/ton/internal/wrappers/JettonMinter.d.ts +4 -0
- package/dist/artifacts/mainnet/ton/internal/wrappers/JettonMinter.js +7 -0
- package/dist/artifacts/testnet/index.d.ts +2 -2
- package/dist/artifacts/testnet/index.js +2 -1
- package/dist/artifacts/testnet/tac/endpoints.d.ts +1 -0
- package/dist/artifacts/testnet/tac/endpoints.js +2 -1
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.d.ts +4 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.js +7 -0
- package/dist/src/adapters/contractOpener.js +10 -19
- package/dist/src/assets/FT.d.ts +9 -0
- package/dist/src/assets/FT.js +48 -4
- package/dist/src/errors/errors.d.ts +3 -0
- package/dist/src/errors/errors.js +8 -1
- package/dist/src/errors/index.d.ts +2 -2
- package/dist/src/errors/index.js +3 -1
- package/dist/src/errors/instances.d.ts +2 -1
- package/dist/src/errors/instances.js +4 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +3 -1
- package/dist/src/interfaces/Asset.d.ts +4 -0
- package/dist/src/interfaces/ILiteSequencerClient.d.ts +1 -6
- package/dist/src/interfaces/IOperationTracker.d.ts +1 -6
- package/dist/src/interfaces/ITacExplorerClient.d.ts +8 -0
- package/dist/src/interfaces/ITacExplorerClient.js +2 -0
- package/dist/src/interfaces/ITacSDK.d.ts +5 -0
- package/dist/src/interfaces/ITxFinalizer.d.ts +2 -3
- package/dist/src/interfaces/index.d.ts +1 -0
- package/dist/src/interfaces/index.js +1 -0
- package/dist/src/sdk/Configuration.d.ts +4 -3
- package/dist/src/sdk/Configuration.js +18 -6
- package/dist/src/sdk/Consts.d.ts +1 -0
- package/dist/src/sdk/Consts.js +2 -1
- package/dist/src/sdk/Fees.d.ts +20 -74
- package/dist/src/sdk/Fees.js +56 -53
- package/dist/src/sdk/LiteSequencerClient.d.ts +1 -2
- package/dist/src/sdk/LiteSequencerClient.js +0 -9
- package/dist/src/sdk/OperationTracker.d.ts +1 -2
- package/dist/src/sdk/OperationTracker.js +0 -20
- package/dist/src/sdk/Simulator.js +23 -21
- package/dist/src/sdk/StartTracking.js +4 -4
- package/dist/src/sdk/TacExplorerClient.d.ts +8 -0
- package/dist/src/sdk/TacExplorerClient.js +22 -0
- package/dist/src/sdk/TacSdk.d.ts +5 -7
- package/dist/src/sdk/TacSdk.js +10 -4
- package/dist/src/sdk/TxFinalizer.d.ts +3 -6
- package/dist/src/sdk/TxFinalizer.js +52 -42
- package/dist/src/sdk/Utils.d.ts +5 -0
- package/dist/src/sdk/Utils.js +11 -0
- package/dist/src/structs/InternalStruct.d.ts +66 -0
- package/dist/src/structs/Struct.d.ts +8 -6
- package/package.json +115 -116
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Address, Cell } from '@ton/core';
|
|
2
|
+
export type CrossChainLayerPayload = {
|
|
3
|
+
operationId: bigint;
|
|
4
|
+
destinationAddress: Address;
|
|
5
|
+
destinationMsgValue: bigint;
|
|
6
|
+
payload: Cell;
|
|
7
|
+
maybeStateInit?: Cell;
|
|
8
|
+
};
|
|
9
|
+
export declare function CrossChainLayerPayloadToCell(payload: CrossChainLayerPayload): Cell;
|
|
10
|
+
export declare function CrossChainLayerPayloadFromCell(cell: Cell): CrossChainLayerPayload;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CrossChainLayerPayloadToCell = CrossChainLayerPayloadToCell;
|
|
4
|
+
exports.CrossChainLayerPayloadFromCell = CrossChainLayerPayloadFromCell;
|
|
5
|
+
const core_1 = require("@ton/core");
|
|
6
|
+
function CrossChainLayerPayloadToCell(payload) {
|
|
7
|
+
return (0, core_1.beginCell)()
|
|
8
|
+
.storeUint(payload.operationId, 256)
|
|
9
|
+
.storeAddress(payload.destinationAddress)
|
|
10
|
+
.storeCoins(payload.destinationMsgValue)
|
|
11
|
+
.storeRef(payload.payload)
|
|
12
|
+
.storeMaybeRef(payload.maybeStateInit)
|
|
13
|
+
.endCell();
|
|
14
|
+
}
|
|
15
|
+
function CrossChainLayerPayloadFromCell(cell) {
|
|
16
|
+
const slice = cell.beginParse();
|
|
17
|
+
return {
|
|
18
|
+
operationId: slice.loadUintBig(256),
|
|
19
|
+
destinationAddress: slice.loadAddress(),
|
|
20
|
+
destinationMsgValue: slice.loadCoins(),
|
|
21
|
+
payload: slice.loadRef(),
|
|
22
|
+
maybeStateInit: slice.loadMaybeRef() ?? undefined,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -4,4 +4,5 @@ export type MerkleRoot = {
|
|
|
4
4
|
validTimestamp: number;
|
|
5
5
|
};
|
|
6
6
|
export declare function cellToArray(addrDict: Cell | null): Array<MerkleRoot>;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function arrayToDict(arr: Array<MerkleRoot>): Dictionary<bigint, number>;
|
|
8
|
+
export declare function arrayToCell(arr: Array<MerkleRoot>): Cell;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cellToArray = cellToArray;
|
|
4
|
+
exports.arrayToDict = arrayToDict;
|
|
4
5
|
exports.arrayToCell = arrayToCell;
|
|
5
6
|
const core_1 = require("@ton/core");
|
|
6
7
|
const Constants_1 = require("../Constants");
|
|
@@ -18,10 +19,17 @@ function cellToArray(addrDict) {
|
|
|
18
19
|
}
|
|
19
20
|
return resArr;
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function arrayToDict(arr) {
|
|
22
23
|
let dict = core_1.Dictionary.empty(core_1.Dictionary.Keys.BigUint(Constants_1.Params.bitsize.hash), core_1.Dictionary.Values.Uint(Constants_1.Params.bitsize.time));
|
|
23
24
|
for (let i = 0; i < arr.length; i++) {
|
|
24
25
|
dict.set(arr[i].root, arr[i].validTimestamp);
|
|
25
26
|
}
|
|
26
27
|
return dict;
|
|
27
28
|
}
|
|
29
|
+
function arrayToCell(arr) {
|
|
30
|
+
let dict = core_1.Dictionary.empty(core_1.Dictionary.Keys.BigUint(Constants_1.Params.bitsize.hash), core_1.Dictionary.Values.Uint(Constants_1.Params.bitsize.time));
|
|
31
|
+
for (let i = 0; i < arr.length; i++) {
|
|
32
|
+
dict.set(arr[i].root, arr[i].validTimestamp);
|
|
33
|
+
}
|
|
34
|
+
return (0, core_1.beginCell)().storeDictDirect(dict).endCell();
|
|
35
|
+
}
|
|
@@ -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
|
-
import { MAINNET_PUBLIC_LITE_SEQUENCER_ENDPOINTS as PUBLIC_LITE_SEQUENCER_ENDPOINTS, MAINNET_TAC_RPC_ENDPOINT as TAC_RPC_ENDPOINT } from "./tac/endpoints";
|
|
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
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";
|
|
5
5
|
export * as tac from "./tac";
|
|
6
|
-
export { PUBLIC_LITE_SEQUENCER_ENDPOINTS, TAC_RPC_ENDPOINT };
|
|
6
|
+
export { PUBLIC_LITE_SEQUENCER_ENDPOINTS, TAC_RPC_ENDPOINT, TAC_EXPLORER_API_ENDPOINT };
|
|
7
7
|
export * as ton from "./ton";
|
|
8
8
|
export { DEFAULT_LITESERVERS, TON_PUBLIC_RPC_ENDPOINT, TON_RPC_ENDPOINT_BY_TAC };
|
|
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_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.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; } });
|
|
@@ -42,6 +42,7 @@ Object.defineProperty(exports, "TAC_SMART_ACCOUNT_FACTORY_ADDRESS", { enumerable
|
|
|
42
42
|
const endpoints_1 = require("./tac/endpoints");
|
|
43
43
|
Object.defineProperty(exports, "PUBLIC_LITE_SEQUENCER_ENDPOINTS", { enumerable: true, get: function () { return endpoints_1.MAINNET_PUBLIC_LITE_SEQUENCER_ENDPOINTS; } });
|
|
44
44
|
Object.defineProperty(exports, "TAC_RPC_ENDPOINT", { enumerable: true, get: function () { return endpoints_1.MAINNET_TAC_RPC_ENDPOINT; } });
|
|
45
|
+
Object.defineProperty(exports, "TAC_EXPLORER_API_ENDPOINT", { enumerable: true, get: function () { return endpoints_1.MAINNET_TAC_EXPLORER_API_ENDPOINT; } });
|
|
45
46
|
const addresses_2 = require("./ton/addresses");
|
|
46
47
|
Object.defineProperty(exports, "TON_SETTINGS_ADDRESS", { enumerable: true, get: function () { return addresses_2.MAINNET_TON_SETTINGS_ADDRESS; } });
|
|
47
48
|
const endpoints_2 = require("./ton/endpoints");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAINNET_PUBLIC_LITE_SEQUENCER_ENDPOINTS = exports.MAINNET_TAC_RPC_ENDPOINT = void 0;
|
|
3
|
+
exports.MAINNET_TAC_EXPLORER_API_ENDPOINT = exports.MAINNET_PUBLIC_LITE_SEQUENCER_ENDPOINTS = exports.MAINNET_TAC_RPC_ENDPOINT = void 0;
|
|
4
4
|
exports.MAINNET_TAC_RPC_ENDPOINT = 'https://rpc.ankr.com/tac';
|
|
5
5
|
exports.MAINNET_PUBLIC_LITE_SEQUENCER_ENDPOINTS = ['https://data.tac.build'];
|
|
6
|
+
exports.MAINNET_TAC_EXPLORER_API_ENDPOINT = 'https://explorer.tac.build/api/v2/';
|
|
@@ -91,4 +91,8 @@ export declare class JettonMinter implements Contract {
|
|
|
91
91
|
getJettonData(provider: ContractProvider): Promise<JettonMinterData>;
|
|
92
92
|
getEVMTokenAddress(provider: ContractProvider): Promise<string>;
|
|
93
93
|
getFullData(provider: ContractProvider): Promise<JettonMinterConfig>;
|
|
94
|
+
getDisplayMultiplier(provider: ContractProvider): Promise<{
|
|
95
|
+
numerator: bigint;
|
|
96
|
+
denominator: bigint;
|
|
97
|
+
}>;
|
|
94
98
|
}
|
|
@@ -198,5 +198,12 @@ class JettonMinter {
|
|
|
198
198
|
evmTokenAddress,
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
+
async getDisplayMultiplier(provider) {
|
|
202
|
+
const res = await provider.get('get_display_multiplier', []);
|
|
203
|
+
return {
|
|
204
|
+
numerator: res.stack.readBigNumber(),
|
|
205
|
+
denominator: res.stack.readBigNumber(),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
201
208
|
}
|
|
202
209
|
exports.JettonMinter = JettonMinter;
|
|
@@ -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
|
-
import { TESTNET_PUBLIC_LITE_SEQUENCER_ENDPOINTS as PUBLIC_LITE_SEQUENCER_ENDPOINTS, TESTNET_TAC_RPC_ENDPOINT as TAC_RPC_ENDPOINT } from "./tac/endpoints";
|
|
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
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";
|
|
5
5
|
export * as tac from "./tac";
|
|
6
|
-
export { PUBLIC_LITE_SEQUENCER_ENDPOINTS, TAC_RPC_ENDPOINT };
|
|
6
|
+
export { PUBLIC_LITE_SEQUENCER_ENDPOINTS, TAC_RPC_ENDPOINT, TAC_EXPLORER_API_ENDPOINT };
|
|
7
7
|
export * as ton from "./ton";
|
|
8
8
|
export { DEFAULT_LITESERVERS, TON_PUBLIC_RPC_ENDPOINT, TON_RPC_ENDPOINT_BY_TAC };
|
|
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_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.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; } });
|
|
@@ -42,6 +42,7 @@ Object.defineProperty(exports, "TAC_SMART_ACCOUNT_FACTORY_ADDRESS", { enumerable
|
|
|
42
42
|
const endpoints_1 = require("./tac/endpoints");
|
|
43
43
|
Object.defineProperty(exports, "PUBLIC_LITE_SEQUENCER_ENDPOINTS", { enumerable: true, get: function () { return endpoints_1.TESTNET_PUBLIC_LITE_SEQUENCER_ENDPOINTS; } });
|
|
44
44
|
Object.defineProperty(exports, "TAC_RPC_ENDPOINT", { enumerable: true, get: function () { return endpoints_1.TESTNET_TAC_RPC_ENDPOINT; } });
|
|
45
|
+
Object.defineProperty(exports, "TAC_EXPLORER_API_ENDPOINT", { enumerable: true, get: function () { return endpoints_1.TESTNET_TAC_EXPLORER_API_ENDPOINT; } });
|
|
45
46
|
const addresses_2 = require("./ton/addresses");
|
|
46
47
|
Object.defineProperty(exports, "TON_SETTINGS_ADDRESS", { enumerable: true, get: function () { return addresses_2.TESTNET_TON_SETTINGS_ADDRESS; } });
|
|
47
48
|
const endpoints_2 = require("./ton/endpoints");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TESTNET_PUBLIC_LITE_SEQUENCER_ENDPOINTS = exports.TESTNET_TAC_RPC_ENDPOINT = void 0;
|
|
3
|
+
exports.TESTNET_TAC_EXPLORER_API_ENDPOINT = exports.TESTNET_PUBLIC_LITE_SEQUENCER_ENDPOINTS = exports.TESTNET_TAC_RPC_ENDPOINT = void 0;
|
|
4
4
|
exports.TESTNET_TAC_RPC_ENDPOINT = 'https://rpc.ankr.com/tac_spb';
|
|
5
5
|
exports.TESTNET_PUBLIC_LITE_SEQUENCER_ENDPOINTS = ['https://data.spb.tac.build'];
|
|
6
|
+
exports.TESTNET_TAC_EXPLORER_API_ENDPOINT = 'https://spb.explorer.tac.build/api/v2/';
|
|
@@ -91,4 +91,8 @@ export declare class JettonMinter implements Contract {
|
|
|
91
91
|
getJettonData(provider: ContractProvider): Promise<JettonMinterData>;
|
|
92
92
|
getEVMTokenAddress(provider: ContractProvider): Promise<string>;
|
|
93
93
|
getFullData(provider: ContractProvider): Promise<JettonMinterConfig>;
|
|
94
|
+
getDisplayMultiplier(provider: ContractProvider): Promise<{
|
|
95
|
+
numerator: bigint;
|
|
96
|
+
denominator: bigint;
|
|
97
|
+
}>;
|
|
94
98
|
}
|
|
@@ -198,5 +198,12 @@ class JettonMinter {
|
|
|
198
198
|
evmTokenAddress,
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
+
async getDisplayMultiplier(provider) {
|
|
202
|
+
const res = await provider.get('get_display_multiplier', []);
|
|
203
|
+
return {
|
|
204
|
+
numerator: res.stack.readBigNumber(),
|
|
205
|
+
denominator: res.stack.readBigNumber(),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
201
208
|
}
|
|
202
209
|
exports.JettonMinter = JettonMinter;
|
|
@@ -101,15 +101,11 @@ async function getAdjacentTransactionsHelper(addr, hashB64, getTransactions, opt
|
|
|
101
101
|
}
|
|
102
102
|
// 3. Optional: follow the incoming message (if it exists and is internal)
|
|
103
103
|
if (rootTx.inMessage?.info.type === 'internal') {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const tx = await findTransactionByHash(src, msgHashB64, getTransactions, opts);
|
|
110
|
-
if (tx)
|
|
111
|
-
adjacent.push(tx);
|
|
112
|
-
}
|
|
104
|
+
// The incoming message belongs to the sender's out-message list,
|
|
105
|
+
const msgHashB64 = (0, ton_1.beginCell)().store((0, ton_1.storeMessage)(rootTx.inMessage)).endCell().hash().toString('base64');
|
|
106
|
+
const tx = await findTransactionByHash(rootTx.inMessage.info.src, msgHashB64, getTransactions, opts);
|
|
107
|
+
if (tx)
|
|
108
|
+
adjacent.push(tx);
|
|
113
109
|
}
|
|
114
110
|
return adjacent;
|
|
115
111
|
}
|
|
@@ -148,8 +144,7 @@ async function liteClientOpener(options) {
|
|
|
148
144
|
.getAccountTransactions(address, opts.lt ?? '', opts.hash ? Buffer.from(opts.hash, 'base64') : Buffer.alloc(0), opts.limit)
|
|
149
145
|
.then((r) => r.transactions);
|
|
150
146
|
const cell = ton_1.Cell.fromBoc(txsBuffered);
|
|
151
|
-
|
|
152
|
-
return transactions;
|
|
147
|
+
return cell.map((c) => (0, ton_1.loadTransaction)(c.beginParse()));
|
|
153
148
|
};
|
|
154
149
|
return {
|
|
155
150
|
getContractState: async (addr) => {
|
|
@@ -166,8 +161,7 @@ async function liteClientOpener(options) {
|
|
|
166
161
|
open: (contract) => client.open(contract),
|
|
167
162
|
closeConnections,
|
|
168
163
|
getTransactionByHash: async (addr, hash, opts) => {
|
|
169
|
-
|
|
170
|
-
return tx;
|
|
164
|
+
return await findTransactionByHash(addr, hash, getTransactions, opts);
|
|
171
165
|
},
|
|
172
166
|
getAdjacentTransactions: async (addr, hash, opts) => getAdjacentTransactionsHelper(addr, hash, getTransactions, opts),
|
|
173
167
|
getAddressInformation: async (addr) => {
|
|
@@ -219,8 +213,7 @@ async function orbsOpener(network) {
|
|
|
219
213
|
open: client.open,
|
|
220
214
|
getContractState: client.getContractState,
|
|
221
215
|
getTransactionByHash: async (addr, hash, opts) => {
|
|
222
|
-
|
|
223
|
-
return tx;
|
|
216
|
+
return await findTransactionByHash(addr, hash, client.getTransactions, opts);
|
|
224
217
|
},
|
|
225
218
|
getAdjacentTransactions: async (addr, hash, opts) => getAdjacentTransactionsHelper(addr, hash, client.getTransactions, opts),
|
|
226
219
|
getAddressInformation: async (addr) => {
|
|
@@ -266,8 +259,7 @@ async function orbsOpener4(network, timeout = 10000) {
|
|
|
266
259
|
};
|
|
267
260
|
},
|
|
268
261
|
getTransactionByHash: async (addr, hash, opts) => {
|
|
269
|
-
|
|
270
|
-
return tx;
|
|
262
|
+
return await findTransactionByHash(addr, hash, getTransactions, opts);
|
|
271
263
|
},
|
|
272
264
|
getAdjacentTransactions: async (addr, hash, opts) => getAdjacentTransactionsHelper(addr, hash, getTransactions, opts),
|
|
273
265
|
getAddressInformation: async (addr) => {
|
|
@@ -293,8 +285,7 @@ function tonClientOpener(client) {
|
|
|
293
285
|
open: client.open.bind(client),
|
|
294
286
|
getContractState: client.getContractState.bind(client),
|
|
295
287
|
getTransactionByHash: async (addr, hash, opts) => {
|
|
296
|
-
|
|
297
|
-
return tx;
|
|
288
|
+
return await findTransactionByHash(addr, hash, client.getTransactions.bind(client), opts);
|
|
298
289
|
},
|
|
299
290
|
getAdjacentTransactions: async (addr, hash, opts) => getAdjacentTransactionsHelper(addr, hash, client.getTransactions.bind(client), opts),
|
|
300
291
|
getAddressInformation: async (addr) => {
|
package/dist/src/assets/FT.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export declare class FT implements Asset {
|
|
|
14
14
|
private _decimals;
|
|
15
15
|
private _transferAmount;
|
|
16
16
|
private _evmAddress?;
|
|
17
|
+
private _displayMultiplierNumerator;
|
|
18
|
+
private _displayMultiplierDenominator;
|
|
19
|
+
private _displayMultiplierFetchedAt;
|
|
20
|
+
private _displayMultiplierCacheDuration;
|
|
17
21
|
get address(): string;
|
|
18
22
|
static getJettonData(configuration: IConfiguration, address: TVMAddress): Promise<JettonMinterData>;
|
|
19
23
|
getJettonData(): Promise<JettonMinterData>;
|
|
@@ -31,6 +35,11 @@ export declare class FT implements Asset {
|
|
|
31
35
|
addAmount(amount: number): FT;
|
|
32
36
|
addRawAmount(rawAmount: bigint): FT;
|
|
33
37
|
getDecimals(): Promise<number>;
|
|
38
|
+
refreshDisplayMultiplier(): Promise<void>;
|
|
39
|
+
private ensureFreshDisplayMultiplier;
|
|
40
|
+
setDisplayMultiplierCacheDuration(durationMs: number): void;
|
|
41
|
+
toDisplayAmount(onchainAmount: bigint): bigint;
|
|
42
|
+
fromDisplayAmount(displayAmount: bigint): bigint;
|
|
34
43
|
getEVMAddress(): Promise<string>;
|
|
35
44
|
getTVMAddress(): Promise<string>;
|
|
36
45
|
generatePayload(params: {
|
package/dist/src/assets/FT.js
CHANGED
|
@@ -85,6 +85,10 @@ class FT {
|
|
|
85
85
|
}
|
|
86
86
|
constructor(address, origin, configuration, decimals) {
|
|
87
87
|
this.type = Struct_1.AssetType.FT;
|
|
88
|
+
this._displayMultiplierNumerator = 1n;
|
|
89
|
+
this._displayMultiplierDenominator = 1n;
|
|
90
|
+
this._displayMultiplierFetchedAt = 0;
|
|
91
|
+
this._displayMultiplierCacheDuration = Consts_1.FIVE_MINUTES;
|
|
88
92
|
this._tvmAddress = ton_1.Address.parse(address);
|
|
89
93
|
this._configuration = configuration;
|
|
90
94
|
this._jettonMinter = this._configuration.TONParams.contractOpener.open(configuration.artifacts.ton.wrappers.JettonMinter.createFromAddress(this._tvmAddress));
|
|
@@ -137,6 +141,8 @@ class FT {
|
|
|
137
141
|
if (finalEvmAddress || (0, ethers_1.isAddress)(address)) {
|
|
138
142
|
token._evmAddress = finalEvmAddress || address;
|
|
139
143
|
}
|
|
144
|
+
// Fetch and cache display multiplier for TEP-526 support
|
|
145
|
+
await token.refreshDisplayMultiplier();
|
|
140
146
|
return token;
|
|
141
147
|
}
|
|
142
148
|
get rawAmount() {
|
|
@@ -146,15 +152,21 @@ class FT {
|
|
|
146
152
|
const ft = new FT(this._tvmAddress.toString(), this.origin, this._configuration, this._decimals);
|
|
147
153
|
ft._transferAmount = this._transferAmount;
|
|
148
154
|
ft._evmAddress = this._evmAddress;
|
|
155
|
+
ft._displayMultiplierNumerator = this._displayMultiplierNumerator;
|
|
156
|
+
ft._displayMultiplierDenominator = this._displayMultiplierDenominator;
|
|
157
|
+
ft._displayMultiplierFetchedAt = this._displayMultiplierFetchedAt;
|
|
158
|
+
ft._displayMultiplierCacheDuration = this._displayMultiplierCacheDuration;
|
|
149
159
|
return ft;
|
|
150
160
|
}
|
|
151
161
|
withAmount(amount) {
|
|
162
|
+
const rawAmount = (0, Utils_1.calculateRawAmount)(amount, this._decimals);
|
|
163
|
+
const onchainAmount = this.fromDisplayAmount(rawAmount);
|
|
152
164
|
if (this._transferAmount > 0n) {
|
|
153
165
|
const newToken = this.clone;
|
|
154
|
-
newToken._transferAmount =
|
|
166
|
+
newToken._transferAmount = onchainAmount;
|
|
155
167
|
return newToken;
|
|
156
168
|
}
|
|
157
|
-
this._transferAmount =
|
|
169
|
+
this._transferAmount = onchainAmount;
|
|
158
170
|
return this;
|
|
159
171
|
}
|
|
160
172
|
withRawAmount(rawAmount) {
|
|
@@ -167,7 +179,9 @@ class FT {
|
|
|
167
179
|
return this;
|
|
168
180
|
}
|
|
169
181
|
addAmount(amount) {
|
|
170
|
-
|
|
182
|
+
const rawAmount = (0, Utils_1.calculateRawAmount)(amount, this._decimals);
|
|
183
|
+
const onchainAmount = this.fromDisplayAmount(rawAmount);
|
|
184
|
+
this._transferAmount = this._transferAmount + onchainAmount;
|
|
171
185
|
return this;
|
|
172
186
|
}
|
|
173
187
|
addRawAmount(rawAmount) {
|
|
@@ -177,6 +191,34 @@ class FT {
|
|
|
177
191
|
async getDecimals() {
|
|
178
192
|
return this._decimals;
|
|
179
193
|
}
|
|
194
|
+
async refreshDisplayMultiplier() {
|
|
195
|
+
try {
|
|
196
|
+
const multiplier = await this._jettonMinter.getDisplayMultiplier();
|
|
197
|
+
this._displayMultiplierNumerator = multiplier.numerator;
|
|
198
|
+
this._displayMultiplierDenominator = multiplier.denominator;
|
|
199
|
+
this._displayMultiplierFetchedAt = Date.now();
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
this._displayMultiplierNumerator = 1n;
|
|
203
|
+
this._displayMultiplierDenominator = 1n;
|
|
204
|
+
this._displayMultiplierFetchedAt = Date.now();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
async ensureFreshDisplayMultiplier() {
|
|
208
|
+
const age = Date.now() - this._displayMultiplierFetchedAt;
|
|
209
|
+
if (age > this._displayMultiplierCacheDuration) {
|
|
210
|
+
await this.refreshDisplayMultiplier();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
setDisplayMultiplierCacheDuration(durationMs) {
|
|
214
|
+
this._displayMultiplierCacheDuration = durationMs;
|
|
215
|
+
}
|
|
216
|
+
toDisplayAmount(onchainAmount) {
|
|
217
|
+
return (0, Utils_1.muldivr)(onchainAmount, this._displayMultiplierNumerator, this._displayMultiplierDenominator);
|
|
218
|
+
}
|
|
219
|
+
fromDisplayAmount(displayAmount) {
|
|
220
|
+
return (0, Utils_1.muldivr)(displayAmount, this._displayMultiplierDenominator, this._displayMultiplierNumerator);
|
|
221
|
+
}
|
|
180
222
|
async getEVMAddress() {
|
|
181
223
|
if (this._evmAddress) {
|
|
182
224
|
return this._evmAddress;
|
|
@@ -222,10 +264,12 @@ class FT {
|
|
|
222
264
|
return (await this._jettonMinter.getWalletAddress(ton_1.Address.parse(userAddress))).toString({ bounceable: true });
|
|
223
265
|
}
|
|
224
266
|
async getUserBalance(userAddress) {
|
|
267
|
+
await this.ensureFreshDisplayMultiplier();
|
|
225
268
|
const wallet = await this.getWallet(userAddress);
|
|
226
269
|
return BigInt(await wallet.getJettonBalance());
|
|
227
270
|
}
|
|
228
271
|
async getUserBalanceExtended(userAddress) {
|
|
272
|
+
await this.ensureFreshDisplayMultiplier();
|
|
229
273
|
const masterState = await this._configuration.TONParams.contractOpener.getContractState(this._tvmAddress);
|
|
230
274
|
if (masterState.state !== 'active') {
|
|
231
275
|
return { exists: false };
|
|
@@ -236,7 +280,7 @@ class FT {
|
|
|
236
280
|
return {
|
|
237
281
|
rawAmount,
|
|
238
282
|
decimals,
|
|
239
|
-
amount: (0, Utils_1.calculateAmount)(rawAmount, decimals),
|
|
283
|
+
amount: (0, Utils_1.calculateAmount)(this.toDisplayAmount(rawAmount), decimals),
|
|
240
284
|
exists: true,
|
|
241
285
|
};
|
|
242
286
|
}
|
|
@@ -45,3 +45,6 @@ export declare class InsufficientBalanceError extends ErrorWithStatusCode {
|
|
|
45
45
|
export declare class TokenError extends ErrorWithStatusCode {
|
|
46
46
|
constructor(message: string, errorCode: number);
|
|
47
47
|
}
|
|
48
|
+
export declare class TransactionError extends ErrorWithStatusCode {
|
|
49
|
+
constructor(message: string, errorCode: number);
|
|
50
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TokenError = exports.InsufficientBalanceError = exports.NoValidGroupFoundError = exports.PrepareMessageGroupError = exports.EVMCallError = exports.SettingError = exports.MetadataError = exports.BitError = exports.FormatError = exports.KeyError = exports.WalletError = exports.AddressError = exports.FetchError = exports.ContractError = exports.ErrorWithStatusCode = void 0;
|
|
3
|
+
exports.TransactionError = exports.TokenError = exports.InsufficientBalanceError = exports.NoValidGroupFoundError = exports.PrepareMessageGroupError = exports.EVMCallError = exports.SettingError = exports.MetadataError = exports.BitError = exports.FormatError = exports.KeyError = exports.WalletError = exports.AddressError = exports.FetchError = exports.ContractError = exports.ErrorWithStatusCode = void 0;
|
|
4
4
|
class ErrorWithStatusCode extends Error {
|
|
5
5
|
constructor(message, errorCode) {
|
|
6
6
|
super(message);
|
|
@@ -107,3 +107,10 @@ class TokenError extends ErrorWithStatusCode {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
exports.TokenError = TokenError;
|
|
110
|
+
class TransactionError extends ErrorWithStatusCode {
|
|
111
|
+
constructor(message, errorCode) {
|
|
112
|
+
super(message, errorCode);
|
|
113
|
+
this.name = 'TransactionError';
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.TransactionError = TransactionError;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AddressError, BitError, ContractError, EVMCallError, FetchError, FormatError, KeyError, MetadataError, SettingError, TokenError, WalletError, } from './errors';
|
|
2
|
-
export { allEndpointsFailedError, emptyArrayError, emptyContractError, emptySettingError, evmAddressError, indexRequiredError, insufficientBalanceError, invalidMethodNameError, missingDecimals, missingFeeParamsError, missingGasLimitError, missingJettonDataError, missingTvmExecutorFeeError, notMultiplyOf8Error, operationFetchError, prefixError, profilingFetchError, simulationFetchError, statusFetchError, tvmAddressError, unknownTokenTypeError, unknownWalletError, unsupportedFormatError, unsupportedKeyError, zeroRawAmountError, } from './instances';
|
|
1
|
+
export { AddressError, BitError, ContractError, EVMCallError, FetchError, FormatError, KeyError, MetadataError, SettingError, TokenError, TransactionError, WalletError, } from './errors';
|
|
2
|
+
export { allEndpointsFailedError, emptyArrayError, emptyContractError, emptySettingError, evmAddressError, indexRequiredError, insufficientBalanceError, invalidMethodNameError, missingDecimals, missingFeeParamsError, missingGasLimitError, missingJettonDataError, missingTvmExecutorFeeError, notMultiplyOf8Error, operationFetchError, prefixError, profilingFetchError, simulationFetchError, statusFetchError, tvmAddressError, txFinalizationError, unknownTokenTypeError, unknownWalletError, unsupportedFormatError, unsupportedKeyError, zeroRawAmountError, } from './instances';
|
package/dist/src/errors/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zeroRawAmountError = exports.unsupportedKeyError = exports.unsupportedFormatError = exports.unknownWalletError = exports.unknownTokenTypeError = exports.tvmAddressError = exports.statusFetchError = exports.simulationFetchError = exports.profilingFetchError = exports.prefixError = exports.operationFetchError = exports.notMultiplyOf8Error = exports.missingTvmExecutorFeeError = exports.missingJettonDataError = exports.missingGasLimitError = exports.missingFeeParamsError = exports.missingDecimals = exports.invalidMethodNameError = exports.insufficientBalanceError = exports.indexRequiredError = exports.evmAddressError = exports.emptySettingError = exports.emptyContractError = exports.emptyArrayError = exports.allEndpointsFailedError = exports.WalletError = exports.TokenError = exports.SettingError = exports.MetadataError = exports.KeyError = exports.FormatError = exports.FetchError = exports.EVMCallError = exports.ContractError = exports.BitError = exports.AddressError = void 0;
|
|
3
|
+
exports.zeroRawAmountError = exports.unsupportedKeyError = exports.unsupportedFormatError = exports.unknownWalletError = exports.unknownTokenTypeError = exports.txFinalizationError = exports.tvmAddressError = exports.statusFetchError = exports.simulationFetchError = exports.profilingFetchError = exports.prefixError = exports.operationFetchError = exports.notMultiplyOf8Error = exports.missingTvmExecutorFeeError = exports.missingJettonDataError = exports.missingGasLimitError = exports.missingFeeParamsError = exports.missingDecimals = exports.invalidMethodNameError = exports.insufficientBalanceError = exports.indexRequiredError = exports.evmAddressError = exports.emptySettingError = exports.emptyContractError = exports.emptyArrayError = exports.allEndpointsFailedError = exports.WalletError = exports.TransactionError = exports.TokenError = exports.SettingError = exports.MetadataError = exports.KeyError = exports.FormatError = exports.FetchError = exports.EVMCallError = exports.ContractError = exports.BitError = exports.AddressError = void 0;
|
|
4
4
|
var errors_1 = require("./errors");
|
|
5
5
|
Object.defineProperty(exports, "AddressError", { enumerable: true, get: function () { return errors_1.AddressError; } });
|
|
6
6
|
Object.defineProperty(exports, "BitError", { enumerable: true, get: function () { return errors_1.BitError; } });
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "KeyError", { enumerable: true, get: function ()
|
|
|
12
12
|
Object.defineProperty(exports, "MetadataError", { enumerable: true, get: function () { return errors_1.MetadataError; } });
|
|
13
13
|
Object.defineProperty(exports, "SettingError", { enumerable: true, get: function () { return errors_1.SettingError; } });
|
|
14
14
|
Object.defineProperty(exports, "TokenError", { enumerable: true, get: function () { return errors_1.TokenError; } });
|
|
15
|
+
Object.defineProperty(exports, "TransactionError", { enumerable: true, get: function () { return errors_1.TransactionError; } });
|
|
15
16
|
Object.defineProperty(exports, "WalletError", { enumerable: true, get: function () { return errors_1.WalletError; } });
|
|
16
17
|
var instances_1 = require("./instances");
|
|
17
18
|
Object.defineProperty(exports, "allEndpointsFailedError", { enumerable: true, get: function () { return instances_1.allEndpointsFailedError; } });
|
|
@@ -34,6 +35,7 @@ Object.defineProperty(exports, "profilingFetchError", { enumerable: true, get: f
|
|
|
34
35
|
Object.defineProperty(exports, "simulationFetchError", { enumerable: true, get: function () { return instances_1.simulationFetchError; } });
|
|
35
36
|
Object.defineProperty(exports, "statusFetchError", { enumerable: true, get: function () { return instances_1.statusFetchError; } });
|
|
36
37
|
Object.defineProperty(exports, "tvmAddressError", { enumerable: true, get: function () { return instances_1.tvmAddressError; } });
|
|
38
|
+
Object.defineProperty(exports, "txFinalizationError", { enumerable: true, get: function () { return instances_1.txFinalizationError; } });
|
|
37
39
|
Object.defineProperty(exports, "unknownTokenTypeError", { enumerable: true, get: function () { return instances_1.unknownTokenTypeError; } });
|
|
38
40
|
Object.defineProperty(exports, "unknownWalletError", { enumerable: true, get: function () { return instances_1.unknownWalletError; } });
|
|
39
41
|
Object.defineProperty(exports, "unsupportedFormatError", { enumerable: true, get: function () { return instances_1.unsupportedFormatError; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Origin } from '../structs/Struct';
|
|
2
|
-
import { AddressError, BitError, ContractError, EVMCallError, FetchError, FormatError, InsufficientBalanceError, KeyError, MetadataError, NoValidGroupFoundError, PrepareMessageGroupError, SettingError, TokenError, WalletError } from './errors';
|
|
2
|
+
import { AddressError, BitError, ContractError, EVMCallError, FetchError, FormatError, InsufficientBalanceError, KeyError, MetadataError, NoValidGroupFoundError, PrepareMessageGroupError, SettingError, TokenError, TransactionError, WalletError } from './errors';
|
|
3
3
|
export declare const emptyContractError: ContractError;
|
|
4
4
|
export declare const operationFetchError: (msg: string, inner?: unknown) => FetchError;
|
|
5
5
|
export declare const statusFetchError: (msg: string, inner?: unknown) => FetchError;
|
|
@@ -35,3 +35,4 @@ export declare const sendCrossChainTransactionFailedError: (msg: string) => Wall
|
|
|
35
35
|
export declare const convertCurrencyNegativeOrZeroValueError: FormatError;
|
|
36
36
|
export declare const unknownAssetOriginError: (origin: Origin) => TokenError;
|
|
37
37
|
export declare const gasPriceFetchError: (msg: string, inner?: unknown) => FetchError;
|
|
38
|
+
export declare const txFinalizationError: (msg: string) => TransactionError;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gasPriceFetchError = exports.unknownAssetOriginError = exports.convertCurrencyNegativeOrZeroValueError = exports.sendCrossChainTransactionFailedError = exports.zeroRawAmountError = exports.missingJettonDataError = exports.missingDecimals = exports.missingGasLimitError = exports.missingTvmExecutorFeeError = exports.missingFeeParamsError = exports.getTONFeeInfoFetchError = exports.simulationFetchError = exports.convertCurrencyFetchError = exports.indexRequiredError = exports.unknownTokenTypeError = exports.insufficientBalanceError = exports.allContractOpenerFailedError = exports.allEndpointsFailedError = exports.noValidGroupFoundError = exports.prepareMessageGroupError = exports.invalidAssetType = exports.emptyArrayError = exports.profilingFetchError = exports.invalidMethodNameError = exports.emptySettingError = exports.prefixError = exports.notMultiplyOf8Error = exports.unsupportedFormatError = exports.unsupportedKeyError = exports.unknownWalletError = exports.evmAddressError = exports.tvmAddressError = exports.statusFetchError = exports.operationFetchError = exports.emptyContractError = void 0;
|
|
3
|
+
exports.txFinalizationError = exports.gasPriceFetchError = exports.unknownAssetOriginError = exports.convertCurrencyNegativeOrZeroValueError = exports.sendCrossChainTransactionFailedError = exports.zeroRawAmountError = exports.missingJettonDataError = exports.missingDecimals = exports.missingGasLimitError = exports.missingTvmExecutorFeeError = exports.missingFeeParamsError = exports.getTONFeeInfoFetchError = exports.simulationFetchError = exports.convertCurrencyFetchError = exports.indexRequiredError = exports.unknownTokenTypeError = exports.insufficientBalanceError = exports.allContractOpenerFailedError = exports.allEndpointsFailedError = exports.noValidGroupFoundError = exports.prepareMessageGroupError = exports.invalidAssetType = exports.emptyArrayError = exports.profilingFetchError = exports.invalidMethodNameError = exports.emptySettingError = exports.prefixError = exports.notMultiplyOf8Error = exports.unsupportedFormatError = exports.unsupportedKeyError = exports.unknownWalletError = exports.evmAddressError = exports.tvmAddressError = exports.statusFetchError = exports.operationFetchError = exports.emptyContractError = void 0;
|
|
4
4
|
const errors_1 = require("./errors");
|
|
5
5
|
exports.emptyContractError = new errors_1.ContractError('unexpected empty contract code of given jetton.', 100);
|
|
6
6
|
const operationFetchError = (msg, inner) => new errors_1.FetchError(`failed to fetch OperationId: ${msg}`, 101, inner);
|
|
@@ -58,5 +58,7 @@ exports.sendCrossChainTransactionFailedError = sendCrossChainTransactionFailedEr
|
|
|
58
58
|
exports.convertCurrencyNegativeOrZeroValueError = new errors_1.FormatError('Value cannot be negative or zero for currency conversion', 132);
|
|
59
59
|
const unknownAssetOriginError = (origin) => new errors_1.TokenError(`Unknown asset origin: ${origin}`, 133);
|
|
60
60
|
exports.unknownAssetOriginError = unknownAssetOriginError;
|
|
61
|
-
const gasPriceFetchError = (msg, inner) => new errors_1.FetchError(`
|
|
61
|
+
const gasPriceFetchError = (msg, inner) => new errors_1.FetchError(`Failed to fetch gas price: ${msg}`, 134, inner);
|
|
62
62
|
exports.gasPriceFetchError = gasPriceFetchError;
|
|
63
|
+
const txFinalizationError = (msg) => new errors_1.TransactionError(`Transaction failed: ${msg}`, 135);
|
|
64
|
+
exports.txFinalizationError = txFinalizationError;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { ConsoleLogger, NoopLogger } from './sdk/Logger';
|
|
|
11
11
|
export { OperationTracker } from './sdk/OperationTracker';
|
|
12
12
|
export { Simulator } from './sdk/Simulator';
|
|
13
13
|
export * from './sdk/StartTracking';
|
|
14
|
+
export { TacExplorerClient } from './sdk/TacExplorerClient';
|
|
14
15
|
export { TacSdk } from './sdk/TacSdk';
|
|
15
16
|
export { TACTransactionManager } from './sdk/TACTransactionManager';
|
|
16
17
|
export { TONTransactionManager } from './sdk/TONTransactionManager';
|
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.Simulator = exports.OperationTracker = exports.NoopLogger = exports.ConsoleLogger = exports.LiteSequencerClient = exports.Configuration = exports.AxiosHttpClient = exports.AgnosticStructs = exports.AgnosticProxySDK = void 0;
|
|
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;
|
|
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; } });
|
|
@@ -58,6 +58,8 @@ Object.defineProperty(exports, "OperationTracker", { enumerable: true, get: func
|
|
|
58
58
|
var Simulator_1 = require("./sdk/Simulator");
|
|
59
59
|
Object.defineProperty(exports, "Simulator", { enumerable: true, get: function () { return Simulator_1.Simulator; } });
|
|
60
60
|
__exportStar(require("./sdk/StartTracking"), exports);
|
|
61
|
+
var TacExplorerClient_1 = require("./sdk/TacExplorerClient");
|
|
62
|
+
Object.defineProperty(exports, "TacExplorerClient", { enumerable: true, get: function () { return TacExplorerClient_1.TacExplorerClient; } });
|
|
61
63
|
var TacSdk_1 = require("./sdk/TacSdk");
|
|
62
64
|
Object.defineProperty(exports, "TacSdk", { enumerable: true, get: function () { return TacSdk_1.TacSdk; } });
|
|
63
65
|
var TACTransactionManager_1 = require("./sdk/TACTransactionManager");
|
|
@@ -9,6 +9,7 @@ export interface Asset {
|
|
|
9
9
|
/**
|
|
10
10
|
* Returns a new asset instance with the specified transfer amount in human-readable units.
|
|
11
11
|
* Does not mutate the current asset instance.
|
|
12
|
+
* For FT assets, this applies TEP-526 scaling automatically if supported by the token.
|
|
12
13
|
* @param amount Amount in human units (e.g., 1.5 TON). Decimals are resolved during asset creation.
|
|
13
14
|
* @returns A new Asset reflecting the requested amount.
|
|
14
15
|
*/
|
|
@@ -16,6 +17,7 @@ export interface Asset {
|
|
|
16
17
|
/**
|
|
17
18
|
* Returns a new asset instance with the specified transfer amount in raw base units.
|
|
18
19
|
* Does not mutate the current asset instance.
|
|
20
|
+
* No TEP-526 scaling is applied - sets the raw onchain amount directly.
|
|
19
21
|
* @param rawAmount Amount in raw base units (bigint).
|
|
20
22
|
* @returns A new Asset reflecting the requested raw amount.
|
|
21
23
|
*/
|
|
@@ -23,6 +25,7 @@ export interface Asset {
|
|
|
23
25
|
/**
|
|
24
26
|
* Increases the transfer amount by the specified value (human-readable units) and returns a new asset instance.
|
|
25
27
|
* Does not mutate the current asset instance.
|
|
28
|
+
* For FT assets, this applies TEP-526 scaling automatically if supported by the token.
|
|
26
29
|
* @param amount Amount in human units (e.g., 1.5 TON). Decimals are resolved during asset creation.
|
|
27
30
|
* @returns A new Asset with the increased amount.
|
|
28
31
|
*/
|
|
@@ -30,6 +33,7 @@ export interface Asset {
|
|
|
30
33
|
/**
|
|
31
34
|
* Increases the transfer amount by the specified raw base units and returns a new asset instance.
|
|
32
35
|
* Does not mutate the current asset instance.
|
|
36
|
+
* No TEP-526 scaling is applied - adds to the raw onchain amount directly.
|
|
33
37
|
* @param rawAmount Amount in raw base units (bigint).
|
|
34
38
|
* @returns A new Asset with the increased amount in raw units.
|
|
35
39
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStagesByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationType, StatusInfosByOperationId, SuggestedTVMExecutorFee,
|
|
1
|
+
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStagesByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationType, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker } from '../structs/Struct';
|
|
2
2
|
export interface ILiteSequencerClient {
|
|
3
3
|
/** Retrieves the operation type by id. */
|
|
4
4
|
getOperationType(operationId: string): Promise<OperationType>;
|
|
@@ -40,9 +40,4 @@ export interface ILiteSequencerClient {
|
|
|
40
40
|
* @returns Promise resolving to detailed simulation result.
|
|
41
41
|
*/
|
|
42
42
|
simulateTACMessage(params: TACSimulationParams): Promise<TACSimulationResult>;
|
|
43
|
-
/**
|
|
44
|
-
* Gets TAC gas price.
|
|
45
|
-
* @returns Promise resolving to TAC gas price.
|
|
46
|
-
*/
|
|
47
|
-
getTACGasPrice(): Promise<TacGasPriceResponse>;
|
|
48
43
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStages, ExecutionStagesByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationType, SimplifiedStatuses, StatusInfo, StatusInfosByOperationId, SuggestedTVMExecutorFee,
|
|
1
|
+
import { ConvertCurrencyParams, ConvertedCurrencyResult, ExecutionStages, ExecutionStagesByOperationId, GetTVMExecutorFeeParams, OperationIdsByShardsKey, OperationType, SimplifiedStatuses, StatusInfo, StatusInfosByOperationId, SuggestedTVMExecutorFee, TACSimulationParams, TACSimulationResult, TransactionLinker, WaitOptions } from '../structs/Struct';
|
|
2
2
|
export interface IOperationTracker {
|
|
3
3
|
/**
|
|
4
4
|
* Returns the operation type for the given id, optionally waiting according to the provided policy.
|
|
@@ -78,9 +78,4 @@ export interface IOperationTracker {
|
|
|
78
78
|
* @returns Promise with suggested fee information.
|
|
79
79
|
*/
|
|
80
80
|
getTVMExecutorFee(params: GetTVMExecutorFeeParams, waitOptions?: WaitOptions<SuggestedTVMExecutorFee>): Promise<SuggestedTVMExecutorFee>;
|
|
81
|
-
/**
|
|
82
|
-
* Gets TAC gas price.
|
|
83
|
-
* @returns Promise resolving to TAC gas price.
|
|
84
|
-
*/
|
|
85
|
-
getTACGasPrice(): Promise<TacGasPriceResponse>;
|
|
86
81
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TacGasPriceResponse } from '../structs/InternalStruct';
|
|
2
|
+
export interface ITacExplorerClient {
|
|
3
|
+
/**
|
|
4
|
+
* Gets TAC gas price from the blockchain explorer.
|
|
5
|
+
* @returns Promise resolving to TAC gas price response with average, fast, and slow prices.
|
|
6
|
+
*/
|
|
7
|
+
getTACGasPrice(): Promise<TacGasPriceResponse>;
|
|
8
|
+
}
|