@tonappchain/sdk 0.7.2-scaled-ui-support-2 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +130 -17
- package/dist/artifacts/dev/ton/internal/wrappers/JettonMinter.d.ts +2 -0
- package/dist/artifacts/dev/ton/internal/wrappers/JettonMinter.js +3 -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/endpoints.d.ts +1 -1
- package/dist/artifacts/mainnet/ton/endpoints.js +1 -1
- package/dist/artifacts/mainnet/ton/internal/build/CrossChainLayer.compiled.json +1 -1
- package/dist/artifacts/mainnet/ton/internal/build/Executor.compiled.json +1 -1
- package/dist/artifacts/mainnet/ton/internal/build/JettonMinter.compiled.json +1 -1
- package/dist/artifacts/mainnet/ton/internal/build/JettonProxy.compiled.json +1 -1
- package/dist/artifacts/mainnet/ton/internal/build/JettonWallet.compiled.json +1 -1
- package/dist/artifacts/mainnet/ton/internal/build/NFTItem.compiled.json +1 -1
- package/dist/artifacts/mainnet/ton/internal/build/NFTProxy.compiled.json +1 -1
- package/dist/artifacts/mainnet/ton/internal/wrappers/CrossChainLayer.d.ts +1 -13
- package/dist/artifacts/mainnet/ton/internal/wrappers/CrossChainLayer.js +7 -45
- package/dist/artifacts/mainnet/ton/internal/wrappers/JettonMinter.d.ts +2 -2
- package/dist/artifacts/mainnet/ton/internal/wrappers/JettonMinter.js +2 -2
- 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/endpoints.d.ts +1 -1
- package/dist/artifacts/testnet/ton/endpoints.js +1 -1
- package/dist/artifacts/testnet/ton/internal/build/CrossChainLayer.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/Executor.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/JettonProxy.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/JettonWallet.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/NFTItem.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/NFTProxy.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/build/Settings.compiled.json +1 -1
- package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.d.ts +53 -6
- package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.js +130 -17
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.d.ts +2 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.js +3 -1
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonProxy.d.ts +9 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonProxy.js +10 -1
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonWallet.d.ts +7 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonWallet.js +9 -2
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTCollection.d.ts +9 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTCollection.js +9 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTItem.d.ts +7 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTItem.js +7 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTProxy.d.ts +7 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/NFTProxy.js +8 -1
- package/dist/artifacts/testnet/ton/internal/wrappers/Settings.d.ts +1 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/Settings.js +1 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/utils/CrossChainLayerPayload.d.ts +10 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/utils/CrossChainLayerPayload.js +24 -0
- package/dist/artifacts/testnet/ton/internal/wrappers/utils/MerkleRoots.d.ts +2 -1
- package/dist/artifacts/testnet/ton/internal/wrappers/utils/MerkleRoots.js +9 -1
- package/dist/src/adapters/BaseContractOpener.d.ts +76 -0
- package/dist/src/adapters/BaseContractOpener.js +440 -0
- package/dist/src/adapters/LiteClientOpener.d.ts +38 -0
- package/dist/src/adapters/LiteClientOpener.js +141 -0
- package/dist/src/adapters/OpenerUtils.d.ts +3 -0
- package/dist/src/adapters/OpenerUtils.js +40 -0
- package/dist/src/adapters/RetryableContractOpener.d.ts +40 -0
- package/dist/src/adapters/RetryableContractOpener.js +290 -0
- package/dist/src/adapters/SandboxOpener.d.ts +15 -0
- package/dist/src/adapters/SandboxOpener.js +35 -0
- package/dist/src/adapters/TonClient4Opener.d.ts +24 -0
- package/dist/src/adapters/TonClient4Opener.js +95 -0
- package/dist/src/adapters/TonClientOpener.d.ts +19 -0
- package/dist/src/adapters/TonClientOpener.js +82 -0
- package/dist/src/adapters/index.d.ts +7 -2
- package/dist/src/adapters/index.js +7 -2
- package/dist/src/assets/AssetCache.d.ts +8 -8
- package/dist/src/assets/AssetCache.js +3 -0
- package/dist/src/assets/AssetFactory.js +8 -2
- package/dist/src/assets/FT.d.ts +2 -3
- package/dist/src/assets/FT.js +4 -7
- package/dist/src/assets/NFT.d.ts +1 -1
- package/dist/src/assets/NFT.js +1 -1
- package/dist/src/assets/TON.d.ts +3 -2
- package/dist/src/assets/TON.js +2 -1
- package/dist/src/errors/errors.d.ts +12 -1
- package/dist/src/errors/errors.js +66 -2
- package/dist/src/errors/index.d.ts +2 -2
- package/dist/src/errors/index.js +4 -1
- package/dist/src/errors/instances.d.ts +7 -2
- package/dist/src/errors/instances.js +67 -2
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.js +6 -4
- package/dist/src/interfaces/Asset.d.ts +4 -9
- package/dist/src/interfaces/ContractOpener.d.ts +76 -2
- package/dist/src/interfaces/IOperationTracker.d.ts +22 -22
- package/dist/src/interfaces/ISimulator.d.ts +9 -1
- package/dist/src/interfaces/ITONTransactionManager.d.ts +20 -1
- package/dist/src/interfaces/ITacExplorerClient.d.ts +8 -0
- package/dist/src/interfaces/ITacExplorerClient.js +2 -0
- package/dist/src/interfaces/ITacSDK.d.ts +25 -1
- package/dist/src/interfaces/ITxFinalizer.d.ts +4 -0
- package/dist/src/interfaces/ITxFinalizer.js +2 -0
- package/dist/src/interfaces/WalletInstanse.d.ts +4 -8
- package/dist/src/interfaces/index.d.ts +1 -0
- package/dist/src/interfaces/index.js +1 -0
- package/dist/src/sdk/Configuration.d.ts +5 -3
- package/dist/src/sdk/Configuration.js +54 -7
- package/dist/src/sdk/Consts.d.ts +18 -1
- package/dist/src/sdk/Consts.js +21 -2
- package/dist/src/sdk/Fees.d.ts +21 -0
- package/dist/src/sdk/Fees.js +201 -0
- package/dist/src/sdk/LiteSequencerClient.d.ts +1 -0
- package/dist/src/sdk/LiteSequencerClient.js +39 -17
- package/dist/src/sdk/OperationTracker.d.ts +11 -11
- package/dist/src/sdk/OperationTracker.js +46 -94
- package/dist/src/sdk/Simulator.d.ts +10 -2
- package/dist/src/sdk/Simulator.js +102 -0
- package/dist/src/sdk/StartTracking.d.ts +12 -7
- package/dist/src/sdk/StartTracking.js +75 -49
- package/dist/src/sdk/TONTransactionManager.d.ts +5 -4
- package/dist/src/sdk/TONTransactionManager.js +63 -8
- package/dist/src/sdk/TacExplorerClient.d.ts +8 -0
- package/dist/src/sdk/TacExplorerClient.js +22 -0
- package/dist/src/sdk/TacSdk.d.ts +8 -2
- package/dist/src/sdk/TacSdk.js +27 -4
- package/dist/src/sdk/TxFinalizer.d.ts +4 -3
- package/dist/src/sdk/TxFinalizer.js +41 -41
- package/dist/src/sdk/Utils.d.ts +20 -1
- package/dist/src/sdk/Utils.js +158 -10
- package/dist/src/sender/BatchSender.js +19 -0
- package/dist/src/sender/MockSender.d.ts +2 -0
- package/dist/src/sender/MockSender.js +13 -0
- package/dist/src/sender/RawSender.js +34 -1
- package/dist/src/sender/SenderFactory.js +1 -1
- package/dist/src/sender/TonConnectSender.js +2 -0
- package/dist/src/sender/index.d.ts +1 -0
- package/dist/src/sender/index.js +1 -0
- package/dist/src/structs/InternalStruct.d.ts +98 -4
- package/dist/src/structs/Struct.d.ts +183 -7
- package/dist/src/structs/Struct.js +4 -3
- package/dist/src/wrappers/HighloadWalletV3.d.ts +5 -3
- package/dist/src/wrappers/HighloadWalletV3.js +14 -3
- package/package.json +121 -117
- package/dist/src/adapters/contractOpener.d.ts +0 -20
- package/dist/src/adapters/contractOpener.js +0 -126
- package/dist/src/adapters/retryableContractOpener.d.ts +0 -24
- package/dist/src/adapters/retryableContractOpener.js +0 -111
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TonClient4Opener = void 0;
|
|
4
|
+
exports.tonHubApi4Opener = tonHubApi4Opener;
|
|
5
|
+
exports.tonClient4Opener = tonClient4Opener;
|
|
6
|
+
exports.orbsOpener4 = orbsOpener4;
|
|
7
|
+
exports.getOrbsOpener4WithRetry = getOrbsOpener4WithRetry;
|
|
8
|
+
const ton_access_1 = require("@orbs-network/ton-access");
|
|
9
|
+
const ton_1 = require("@ton/ton");
|
|
10
|
+
const Consts_1 = require("../sdk/Consts");
|
|
11
|
+
const Struct_1 = require("../structs/Struct");
|
|
12
|
+
const BaseContractOpener_1 = require("./BaseContractOpener");
|
|
13
|
+
const OpenerUtils_1 = require("./OpenerUtils");
|
|
14
|
+
class TonClient4Opener extends BaseContractOpener_1.BaseContractOpener {
|
|
15
|
+
constructor(client4, logger) {
|
|
16
|
+
super(logger);
|
|
17
|
+
this.client4 = client4;
|
|
18
|
+
}
|
|
19
|
+
static create(endpoint, timeout = 10000, logger) {
|
|
20
|
+
const client4 = new ton_1.TonClient4({ endpoint, timeout });
|
|
21
|
+
return new TonClient4Opener(client4, logger);
|
|
22
|
+
}
|
|
23
|
+
open(contract) {
|
|
24
|
+
return this.client4.open(contract);
|
|
25
|
+
}
|
|
26
|
+
async getContractState(address) {
|
|
27
|
+
const latestBlock = await this.client4.getLastBlock();
|
|
28
|
+
const latestBlockNumber = latestBlock.last.seqno;
|
|
29
|
+
const state = await this.client4.getAccount(latestBlockNumber, address);
|
|
30
|
+
return {
|
|
31
|
+
balance: BigInt(state.account.balance.coins),
|
|
32
|
+
code: 'code' in state.account.state && state.account.state.code !== null
|
|
33
|
+
? Buffer.from(state.account.state.code, 'base64')
|
|
34
|
+
: null,
|
|
35
|
+
state: state.account.state.type === 'uninit' ? 'uninitialized' : state.account.state.type,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async getTransactions(address, opts) {
|
|
39
|
+
const allTxs = await this.client4
|
|
40
|
+
.getAccountTransactions(address, opts.lt ? BigInt(opts.lt) : 0n, opts.hash ? Buffer.from(opts.hash, 'base64') : Buffer.alloc(0))
|
|
41
|
+
.then((res) => res.map((t) => t.tx));
|
|
42
|
+
// Apply limit if specified
|
|
43
|
+
let txs = opts.limit ? allTxs.slice(0, opts.limit) : allTxs;
|
|
44
|
+
// Apply to_lt filter if specified
|
|
45
|
+
if (opts.to_lt) {
|
|
46
|
+
const toLt = BigInt(opts.to_lt);
|
|
47
|
+
txs = txs.filter((tx) => {
|
|
48
|
+
const comparison = tx.lt > toLt;
|
|
49
|
+
return opts.inclusive ? tx.lt >= toLt : comparison;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return txs;
|
|
53
|
+
}
|
|
54
|
+
async getAddressInformation(addr) {
|
|
55
|
+
const latestBlock = await this.client4.getLastBlock();
|
|
56
|
+
const latestBlockNumber = latestBlock.last.seqno;
|
|
57
|
+
const state = await this.client4.getAccount(latestBlockNumber, addr);
|
|
58
|
+
return {
|
|
59
|
+
lastTransaction: {
|
|
60
|
+
lt: state.account.last?.lt ?? '',
|
|
61
|
+
hash: state.account.last?.hash ?? '',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
async getConfig() {
|
|
66
|
+
const block = await this.client4.getLastBlock();
|
|
67
|
+
const { config } = await this.client4.getConfig(block.last.seqno);
|
|
68
|
+
return config.cell;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.TonClient4Opener = TonClient4Opener;
|
|
72
|
+
/**
|
|
73
|
+
* Creates a TonClient4Opener instance using TonHub public API
|
|
74
|
+
* @param network Network to connect to (mainnet or testnet)
|
|
75
|
+
* @param timeout Request timeout in milliseconds
|
|
76
|
+
* @param logger
|
|
77
|
+
*/
|
|
78
|
+
function tonHubApi4Opener(network, timeout = Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS, logger) {
|
|
79
|
+
const endpoint = network === Struct_1.Network.MAINNET ? 'https://mainnet-v4.tonhubapi.com' : 'https://testnet-v4.tonhubapi.com';
|
|
80
|
+
return TonClient4Opener.create(endpoint, timeout, logger);
|
|
81
|
+
}
|
|
82
|
+
function tonClient4Opener(client, logger) {
|
|
83
|
+
return new TonClient4Opener(client, logger);
|
|
84
|
+
}
|
|
85
|
+
async function orbsOpener4(network, timeout = Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS, logger) {
|
|
86
|
+
const tonNetwork = network === Struct_1.Network.MAINNET ? 'mainnet' : 'testnet';
|
|
87
|
+
const endpoint = await (0, ton_access_1.getHttpV4Endpoint)({ network: tonNetwork });
|
|
88
|
+
const client = new ton_1.TonClient4({ endpoint, timeout });
|
|
89
|
+
return new TonClient4Opener(client, logger);
|
|
90
|
+
}
|
|
91
|
+
async function getOrbsOpener4WithRetry(network, timeout = Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS, logger, maxRetries = Consts_1.DEFAULT_RETRY_MAX_COUNT, delay = Consts_1.DEFAULT_RETRY_DELAY_MS) {
|
|
92
|
+
const endpoint = await (0, OpenerUtils_1.getHttpV4EndpointWithRetry)(network, maxRetries, delay);
|
|
93
|
+
const client = new ton_1.TonClient4({ endpoint, timeout });
|
|
94
|
+
return new TonClient4Opener(client, logger);
|
|
95
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Address, Contract, OpenedContract, TonClient, Transaction } from '@ton/ton';
|
|
2
|
+
import { ILogger } from '../interfaces';
|
|
3
|
+
import { AddressInformation, ContractState, GetTransactionsOptions, Network } from '../structs/Struct';
|
|
4
|
+
import { BaseContractOpener } from './BaseContractOpener';
|
|
5
|
+
import { TonClient4Opener } from './TonClient4Opener';
|
|
6
|
+
export declare class TonClientOpener extends BaseContractOpener {
|
|
7
|
+
private readonly client;
|
|
8
|
+
private readonly httpClient;
|
|
9
|
+
constructor(client: TonClient, logger?: ILogger);
|
|
10
|
+
static create(endpoint: string, timeout?: number, logger?: ILogger): TonClientOpener;
|
|
11
|
+
open<T extends Contract>(contract: T): OpenedContract<T>;
|
|
12
|
+
getContractState(address: Address): Promise<ContractState>;
|
|
13
|
+
getTransactions(address: Address, opts: GetTransactionsOptions): Promise<Transaction[]>;
|
|
14
|
+
getAddressInformation(addr: Address): Promise<AddressInformation>;
|
|
15
|
+
getConfig(): Promise<string>;
|
|
16
|
+
}
|
|
17
|
+
export declare function tonClientOpener(client: TonClient, logger?: ILogger): TonClientOpener;
|
|
18
|
+
export declare function orbsOpener(network: Network, logger?: ILogger): Promise<TonClientOpener>;
|
|
19
|
+
export declare function getOrbsOpenerWithRetry(network: Network, timeout?: number, logger?: ILogger, maxRetries?: number, delay?: number): Promise<TonClient4Opener>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TonClientOpener = void 0;
|
|
4
|
+
exports.tonClientOpener = tonClientOpener;
|
|
5
|
+
exports.orbsOpener = orbsOpener;
|
|
6
|
+
exports.getOrbsOpenerWithRetry = getOrbsOpenerWithRetry;
|
|
7
|
+
const ton_access_1 = require("@orbs-network/ton-access");
|
|
8
|
+
const ton_1 = require("@ton/ton");
|
|
9
|
+
const AxiosHttpClient_1 = require("../sdk/AxiosHttpClient");
|
|
10
|
+
const Consts_1 = require("../sdk/Consts");
|
|
11
|
+
const Utils_1 = require("../sdk/Utils");
|
|
12
|
+
const Struct_1 = require("../structs/Struct");
|
|
13
|
+
const BaseContractOpener_1 = require("./BaseContractOpener");
|
|
14
|
+
const OpenerUtils_1 = require("./OpenerUtils");
|
|
15
|
+
const TonClient4Opener_1 = require("./TonClient4Opener");
|
|
16
|
+
class TonClientOpener extends BaseContractOpener_1.BaseContractOpener {
|
|
17
|
+
constructor(client, logger) {
|
|
18
|
+
super(logger);
|
|
19
|
+
this.client = client;
|
|
20
|
+
this.httpClient = new AxiosHttpClient_1.AxiosHttpClient({ timeout: Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS });
|
|
21
|
+
}
|
|
22
|
+
static create(endpoint, timeout = Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS, logger) {
|
|
23
|
+
const client = new ton_1.TonClient({ endpoint, timeout });
|
|
24
|
+
return new TonClientOpener(client, logger);
|
|
25
|
+
}
|
|
26
|
+
open(contract) {
|
|
27
|
+
return this.client.open(contract);
|
|
28
|
+
}
|
|
29
|
+
async getContractState(address) {
|
|
30
|
+
return this.client.getContractState(address);
|
|
31
|
+
}
|
|
32
|
+
async getTransactions(address, opts) {
|
|
33
|
+
// TonClient doesn't accept timeoutMs and retryDelayMs, filter them out
|
|
34
|
+
const clientOpts = {
|
|
35
|
+
limit: opts.limit ?? Consts_1.DEFAULT_FIND_TX_LIMIT,
|
|
36
|
+
lt: opts.lt,
|
|
37
|
+
// TonClient API expects base64 transaction hash and converts it to hex internally.
|
|
38
|
+
hash: opts.hash ? (0, Utils_1.normalizeHashToBase64)(opts.hash) : undefined,
|
|
39
|
+
to_lt: opts.to_lt,
|
|
40
|
+
inclusive: opts.inclusive,
|
|
41
|
+
archival: opts.archival,
|
|
42
|
+
};
|
|
43
|
+
return this.client.getTransactions(address, clientOpts);
|
|
44
|
+
}
|
|
45
|
+
async getAddressInformation(addr) {
|
|
46
|
+
const state = await this.client.getContractState(addr);
|
|
47
|
+
return {
|
|
48
|
+
lastTransaction: {
|
|
49
|
+
lt: state.lastTransaction?.lt ?? '',
|
|
50
|
+
hash: state.lastTransaction?.hash ?? '',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
async getConfig() {
|
|
55
|
+
const info = await this.client.getMasterchainInfo();
|
|
56
|
+
const url = new URL('getConfigAll', this.client.parameters.endpoint);
|
|
57
|
+
url.searchParams.append('seqno', info.latestSeqno.toString());
|
|
58
|
+
// Use longer timeout for getConfig as the response is very large (~100KB+)
|
|
59
|
+
// and Brotli decompression can take significant time
|
|
60
|
+
const response = await this.httpClient.get(url.toString(), { timeout: 60000 });
|
|
61
|
+
const body = response.data;
|
|
62
|
+
if (!body?.ok || !body.result?.config?.bytes) {
|
|
63
|
+
throw new Error(`Failed to fetch config: ${JSON.stringify(body)}`);
|
|
64
|
+
}
|
|
65
|
+
return body.result.config.bytes;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.TonClientOpener = TonClientOpener;
|
|
69
|
+
function tonClientOpener(client, logger) {
|
|
70
|
+
return new TonClientOpener(client, logger);
|
|
71
|
+
}
|
|
72
|
+
async function orbsOpener(network, logger) {
|
|
73
|
+
const tonNetwork = network === Struct_1.Network.MAINNET ? 'mainnet' : 'testnet';
|
|
74
|
+
const endpoint = await (0, ton_access_1.getHttpEndpoint)({ network: tonNetwork });
|
|
75
|
+
const client = new ton_1.TonClient({ endpoint, timeout: Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS });
|
|
76
|
+
return new TonClientOpener(client, logger);
|
|
77
|
+
}
|
|
78
|
+
async function getOrbsOpenerWithRetry(network, timeout = Consts_1.DEFAULT_HTTP_CLIENT_TIMEOUT_MS, logger, maxRetries = Consts_1.DEFAULT_RETRY_MAX_COUNT, delay = Consts_1.DEFAULT_RETRY_DELAY_MS) {
|
|
79
|
+
const endpoint = await (0, OpenerUtils_1.getHttpEndpointWithRetry)(network, maxRetries, delay);
|
|
80
|
+
const client = new ton_1.TonClient4({ endpoint, timeout });
|
|
81
|
+
return new TonClient4Opener_1.TonClient4Opener(client, logger);
|
|
82
|
+
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './BaseContractOpener';
|
|
2
|
+
export * from './LiteClientOpener';
|
|
3
|
+
export * from './OpenerUtils';
|
|
4
|
+
export * from './RetryableContractOpener';
|
|
5
|
+
export * from './SandboxOpener';
|
|
6
|
+
export * from './TonClient4Opener';
|
|
7
|
+
export * from './TonClientOpener';
|
|
@@ -14,5 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./BaseContractOpener"), exports);
|
|
18
|
+
__exportStar(require("./LiteClientOpener"), exports);
|
|
19
|
+
__exportStar(require("./OpenerUtils"), exports);
|
|
20
|
+
__exportStar(require("./RetryableContractOpener"), exports);
|
|
21
|
+
__exportStar(require("./SandboxOpener"), exports);
|
|
22
|
+
__exportStar(require("./TonClient4Opener"), exports);
|
|
23
|
+
__exportStar(require("./TonClientOpener"), exports);
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { Asset } from '../interfaces';
|
|
2
|
+
type AssetCacheToken = {
|
|
3
|
+
address: string;
|
|
4
|
+
index?: bigint;
|
|
5
|
+
tokenType?: string;
|
|
6
|
+
};
|
|
2
7
|
export declare class AssetCache {
|
|
3
8
|
private static readonly cache;
|
|
4
9
|
/**
|
|
5
10
|
* Get asset from cache
|
|
6
11
|
*/
|
|
7
|
-
static get(token:
|
|
8
|
-
address: string;
|
|
9
|
-
index?: bigint;
|
|
10
|
-
}): Asset | undefined;
|
|
12
|
+
static get(token: AssetCacheToken): Asset | undefined;
|
|
11
13
|
/**
|
|
12
14
|
* Set asset in cache
|
|
13
15
|
*/
|
|
14
|
-
static set(token:
|
|
15
|
-
address: string;
|
|
16
|
-
index?: bigint;
|
|
17
|
-
}, asset: Asset): void;
|
|
16
|
+
static set(token: AssetCacheToken, asset: Asset): void;
|
|
18
17
|
/**
|
|
19
18
|
* Clear the cache
|
|
20
19
|
*/
|
|
21
20
|
static clear(): void;
|
|
22
21
|
private static generateKey;
|
|
23
22
|
}
|
|
23
|
+
export {};
|
|
@@ -26,6 +26,9 @@ class AssetCache {
|
|
|
26
26
|
// Normalize address to lowercase for consistency
|
|
27
27
|
const normalizedAddress = token.address.toLowerCase();
|
|
28
28
|
const parts = [normalizedAddress];
|
|
29
|
+
if (token.tokenType !== undefined) {
|
|
30
|
+
parts.push(token.tokenType);
|
|
31
|
+
}
|
|
29
32
|
if (token.index !== undefined) {
|
|
30
33
|
parts.push(token.index.toString());
|
|
31
34
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AssetFactory = void 0;
|
|
4
4
|
const errors_1 = require("../errors");
|
|
5
|
+
const Consts_1 = require("../sdk/Consts");
|
|
5
6
|
const Struct_1 = require("../structs/Struct");
|
|
6
7
|
const AssetCache_1 = require("./AssetCache");
|
|
7
8
|
const FT_1 = require("./FT");
|
|
@@ -9,7 +10,9 @@ const NFT_1 = require("./NFT");
|
|
|
9
10
|
const TON_1 = require("./TON");
|
|
10
11
|
class AssetFactory {
|
|
11
12
|
static async from(configuration, token) {
|
|
12
|
-
if (token.address === '' ||
|
|
13
|
+
if (token.address === '' ||
|
|
14
|
+
token.address === configuration.nativeTONAddress ||
|
|
15
|
+
token.address === Consts_1.TON_BURN_ADDRESS) {
|
|
13
16
|
if (token.tokenType !== Struct_1.AssetType.FT)
|
|
14
17
|
throw (0, errors_1.unknownTokenTypeError)(token.address, 'detected TON, but token type is not FT');
|
|
15
18
|
return TON_1.TON.create(configuration);
|
|
@@ -26,7 +29,10 @@ class AssetFactory {
|
|
|
26
29
|
}
|
|
27
30
|
static async createFTAsset(configuration, address) {
|
|
28
31
|
const ton = TON_1.TON.create(configuration);
|
|
29
|
-
if (address === configuration.nativeTONAddress ||
|
|
32
|
+
if (address === configuration.nativeTONAddress ||
|
|
33
|
+
address === '' ||
|
|
34
|
+
address === (await ton.getEVMAddress()) ||
|
|
35
|
+
address === Consts_1.TON_BURN_ADDRESS) {
|
|
30
36
|
return ton;
|
|
31
37
|
}
|
|
32
38
|
return FT_1.FT.fromAddress(configuration, address);
|
package/dist/src/assets/FT.d.ts
CHANGED
|
@@ -35,9 +35,8 @@ export declare class FT implements Asset {
|
|
|
35
35
|
addAmount(amount: number): FT;
|
|
36
36
|
addRawAmount(rawAmount: bigint): FT;
|
|
37
37
|
getDecimals(): Promise<number>;
|
|
38
|
-
private refreshDisplayMultiplierInternal;
|
|
39
|
-
private ensureFreshDisplayMultiplier;
|
|
40
38
|
refreshDisplayMultiplier(): Promise<void>;
|
|
39
|
+
private ensureFreshDisplayMultiplier;
|
|
41
40
|
setDisplayMultiplierCacheDuration(durationMs: number): void;
|
|
42
41
|
toDisplayAmount(onchainAmount: bigint): bigint;
|
|
43
42
|
fromDisplayAmount(displayAmount: bigint): bigint;
|
|
@@ -49,7 +48,7 @@ export declare class FT implements Asset {
|
|
|
49
48
|
crossChainTonAmount?: bigint;
|
|
50
49
|
forwardFeeTonAmount?: bigint;
|
|
51
50
|
feeParams?: FeeParams;
|
|
52
|
-
}):
|
|
51
|
+
}): Cell;
|
|
53
52
|
get opType(): AssetOpType.JETTON_BURN | AssetOpType.JETTON_TRANSFER;
|
|
54
53
|
getWallet(userAddress: string): Promise<OpenedContract<JettonWallet> | SandboxContract<JettonWallet>>;
|
|
55
54
|
getUserWalletAddress(userAddress: string): Promise<string>;
|
package/dist/src/assets/FT.js
CHANGED
|
@@ -142,7 +142,7 @@ class FT {
|
|
|
142
142
|
token._evmAddress = finalEvmAddress || address;
|
|
143
143
|
}
|
|
144
144
|
// Fetch and cache display multiplier for TEP-526 support
|
|
145
|
-
await token.
|
|
145
|
+
await token.refreshDisplayMultiplier();
|
|
146
146
|
return token;
|
|
147
147
|
}
|
|
148
148
|
get rawAmount() {
|
|
@@ -191,7 +191,7 @@ class FT {
|
|
|
191
191
|
async getDecimals() {
|
|
192
192
|
return this._decimals;
|
|
193
193
|
}
|
|
194
|
-
async
|
|
194
|
+
async refreshDisplayMultiplier() {
|
|
195
195
|
try {
|
|
196
196
|
const multiplier = await this._jettonMinter.getDisplayMultiplier();
|
|
197
197
|
this._displayMultiplierNumerator = multiplier.numerator;
|
|
@@ -207,12 +207,9 @@ class FT {
|
|
|
207
207
|
async ensureFreshDisplayMultiplier() {
|
|
208
208
|
const age = Date.now() - this._displayMultiplierFetchedAt;
|
|
209
209
|
if (age > this._displayMultiplierCacheDuration) {
|
|
210
|
-
await this.
|
|
210
|
+
await this.refreshDisplayMultiplier();
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
async refreshDisplayMultiplier() {
|
|
214
|
-
await this.refreshDisplayMultiplierInternal();
|
|
215
|
-
}
|
|
216
213
|
setDisplayMultiplierCacheDuration(durationMs) {
|
|
217
214
|
this._displayMultiplierCacheDuration = durationMs;
|
|
218
215
|
}
|
|
@@ -242,7 +239,7 @@ class FT {
|
|
|
242
239
|
async getTVMAddress() {
|
|
243
240
|
return this._tvmAddress.toString({ bounceable: true });
|
|
244
241
|
}
|
|
245
|
-
|
|
242
|
+
generatePayload(params) {
|
|
246
243
|
const { excessReceiver, evmData, crossChainTonAmount = 0n, forwardFeeTonAmount = 0n, feeParams } = params;
|
|
247
244
|
const feeData = (0, Utils_1.generateFeeData)(feeParams);
|
|
248
245
|
let payload;
|
package/dist/src/assets/NFT.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare class NFT implements Asset {
|
|
|
59
59
|
crossChainTonAmount?: bigint;
|
|
60
60
|
forwardFeeTonAmount?: bigint;
|
|
61
61
|
feeParams?: FeeParams;
|
|
62
|
-
}):
|
|
62
|
+
}): Cell;
|
|
63
63
|
isOwnedBy(userAddress: string): Promise<boolean>;
|
|
64
64
|
checkCanBeTransferredBy(userAddress: string): Promise<void>;
|
|
65
65
|
getBalanceOf(userAddress: string): Promise<bigint>;
|
package/dist/src/assets/NFT.js
CHANGED
|
@@ -188,7 +188,7 @@ class NFT {
|
|
|
188
188
|
async getTVMAddress() {
|
|
189
189
|
return this.address.toString();
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
generatePayload(params) {
|
|
192
192
|
const { excessReceiver, evmData, crossChainTonAmount = 0n, forwardFeeTonAmount = 0n, feeParams } = params;
|
|
193
193
|
const opType = this.origin === Struct_1.Origin.TAC ? InternalStruct_1.AssetOpType.NFT_BURN : InternalStruct_1.AssetOpType.NFT_TRANSFER;
|
|
194
194
|
const feeData = (0, Utils_1.generateFeeData)(feeParams);
|
package/dist/src/assets/TON.d.ts
CHANGED
|
@@ -2,13 +2,14 @@ import { Cell } from '@ton/ton';
|
|
|
2
2
|
import { Asset, IConfiguration } from '../interfaces';
|
|
3
3
|
import type { SenderAbstraction } from '../sender';
|
|
4
4
|
import type { ShardTransaction } from '../structs/InternalStruct';
|
|
5
|
-
import { AssetType, FeeParams } from '../structs/Struct';
|
|
5
|
+
import { AssetType, FeeParams, Origin } from '../structs/Struct';
|
|
6
6
|
export declare class TON implements Asset {
|
|
7
7
|
readonly address: string;
|
|
8
8
|
readonly type: AssetType;
|
|
9
9
|
private evmAddress;
|
|
10
10
|
private _rawAmount;
|
|
11
11
|
private _config;
|
|
12
|
+
readonly origin: Origin;
|
|
12
13
|
constructor(config: IConfiguration);
|
|
13
14
|
static create(config: IConfiguration): TON;
|
|
14
15
|
get rawAmount(): bigint;
|
|
@@ -25,7 +26,7 @@ export declare class TON implements Asset {
|
|
|
25
26
|
crossChainTonAmount?: bigint;
|
|
26
27
|
forwardFeeTonAmount?: bigint;
|
|
27
28
|
feeParams?: FeeParams;
|
|
28
|
-
}):
|
|
29
|
+
}): Cell;
|
|
29
30
|
getUserBalance(userAddress: string): Promise<bigint>;
|
|
30
31
|
static checkBalance(sender: SenderAbstraction, config: IConfiguration, transactions: ShardTransaction[]): Promise<void>;
|
|
31
32
|
checkCanBeTransferredBy(userAddress: string): Promise<void>;
|
package/dist/src/assets/TON.js
CHANGED
|
@@ -9,6 +9,7 @@ const Struct_1 = require("../structs/Struct");
|
|
|
9
9
|
class TON {
|
|
10
10
|
constructor(config) {
|
|
11
11
|
this.type = Struct_1.AssetType.FT;
|
|
12
|
+
this.origin = Struct_1.Origin.TON;
|
|
12
13
|
this.address = '';
|
|
13
14
|
this._config = config;
|
|
14
15
|
this._rawAmount = 0n;
|
|
@@ -60,7 +61,7 @@ class TON {
|
|
|
60
61
|
async getTVMAddress() {
|
|
61
62
|
return '';
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
+
generatePayload(params) {
|
|
64
65
|
const { excessReceiver, evmData, feeParams } = params;
|
|
65
66
|
const queryId = (0, Utils_1.generateRandomNumberByTimestamp)().randomNumber;
|
|
66
67
|
const feeData = (0, Utils_1.generateFeeData)(feeParams);
|
|
@@ -7,7 +7,15 @@ export declare class ContractError extends ErrorWithStatusCode {
|
|
|
7
7
|
}
|
|
8
8
|
export declare class FetchError extends ErrorWithStatusCode {
|
|
9
9
|
readonly inner?: unknown;
|
|
10
|
-
|
|
10
|
+
readonly httpStatus?: number;
|
|
11
|
+
readonly innerErrorCode?: number;
|
|
12
|
+
readonly innerErrorName?: string;
|
|
13
|
+
readonly innerMessage?: string;
|
|
14
|
+
readonly innerStack?: string;
|
|
15
|
+
constructor(message: string, errorCode: number, inner?: unknown, options?: {
|
|
16
|
+
includeInnerStack?: boolean;
|
|
17
|
+
});
|
|
18
|
+
toDebugString(includeTrace?: boolean): string;
|
|
11
19
|
}
|
|
12
20
|
export declare class AddressError extends ErrorWithStatusCode {
|
|
13
21
|
constructor(message: string, errorCode: number);
|
|
@@ -45,3 +53,6 @@ export declare class InsufficientBalanceError extends ErrorWithStatusCode {
|
|
|
45
53
|
export declare class TokenError extends ErrorWithStatusCode {
|
|
46
54
|
constructor(message: string, errorCode: number);
|
|
47
55
|
}
|
|
56
|
+
export declare class TransactionError extends ErrorWithStatusCode {
|
|
57
|
+
constructor(message: string, errorCode: number);
|
|
58
|
+
}
|
|
@@ -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);
|
|
@@ -8,6 +8,32 @@ class ErrorWithStatusCode extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.ErrorWithStatusCode = ErrorWithStatusCode;
|
|
11
|
+
function asString(value) {
|
|
12
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
13
|
+
}
|
|
14
|
+
function asNumber(value) {
|
|
15
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
if (typeof value === 'string' && value.trim().length > 0) {
|
|
19
|
+
const parsed = Number(value);
|
|
20
|
+
if (Number.isFinite(parsed)) {
|
|
21
|
+
return parsed;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
function extractResponseMessage(responseData) {
|
|
27
|
+
if (typeof responseData === 'string' && responseData.length > 0) {
|
|
28
|
+
return responseData;
|
|
29
|
+
}
|
|
30
|
+
const data = responseData;
|
|
31
|
+
const nestedError = data?.error && typeof data.error === 'object' ? data.error : undefined;
|
|
32
|
+
return (asString(data?.message) ??
|
|
33
|
+
asString(data?.error) ??
|
|
34
|
+
asString(nestedError?.message) ??
|
|
35
|
+
asString(nestedError?.error));
|
|
36
|
+
}
|
|
11
37
|
class ContractError extends ErrorWithStatusCode {
|
|
12
38
|
constructor(message, errorCode) {
|
|
13
39
|
super(message, errorCode);
|
|
@@ -16,10 +42,41 @@ class ContractError extends ErrorWithStatusCode {
|
|
|
16
42
|
}
|
|
17
43
|
exports.ContractError = ContractError;
|
|
18
44
|
class FetchError extends ErrorWithStatusCode {
|
|
19
|
-
constructor(message, errorCode, inner) {
|
|
45
|
+
constructor(message, errorCode, inner, options) {
|
|
20
46
|
super(message, errorCode);
|
|
21
47
|
this.name = 'FetchError';
|
|
22
48
|
this.inner = inner;
|
|
49
|
+
if (inner && typeof inner === 'object') {
|
|
50
|
+
const err = inner;
|
|
51
|
+
this.httpStatus = asNumber(err.status) ?? asNumber(err.response?.status);
|
|
52
|
+
this.innerErrorCode = asNumber(err.errorCode);
|
|
53
|
+
if (typeof err.name === 'string') {
|
|
54
|
+
this.innerErrorName = err.name;
|
|
55
|
+
}
|
|
56
|
+
this.innerMessage = extractResponseMessage(err.response?.data) ?? asString(err.message);
|
|
57
|
+
if (options?.includeInnerStack && typeof err.stack === 'string') {
|
|
58
|
+
this.innerStack = err.stack;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
toDebugString(includeTrace = false) {
|
|
63
|
+
const parts = [`${this.name} (${this.errorCode}): ${this.message}`];
|
|
64
|
+
if (this.httpStatus !== undefined) {
|
|
65
|
+
parts.push(`httpStatus: ${this.httpStatus}`);
|
|
66
|
+
}
|
|
67
|
+
if (this.innerErrorCode !== undefined) {
|
|
68
|
+
parts.push(`innerErrorCode: ${this.innerErrorCode}`);
|
|
69
|
+
}
|
|
70
|
+
if (this.innerErrorName) {
|
|
71
|
+
parts.push(`innerErrorName: ${this.innerErrorName}`);
|
|
72
|
+
}
|
|
73
|
+
if (this.innerMessage) {
|
|
74
|
+
parts.push(`innerMessage: ${this.innerMessage}`);
|
|
75
|
+
}
|
|
76
|
+
if (includeTrace && this.innerStack) {
|
|
77
|
+
parts.push(`innerStack:\n${this.innerStack}`);
|
|
78
|
+
}
|
|
79
|
+
return parts.join('\n');
|
|
23
80
|
}
|
|
24
81
|
}
|
|
25
82
|
exports.FetchError = FetchError;
|
|
@@ -107,3 +164,10 @@ class TokenError extends ErrorWithStatusCode {
|
|
|
107
164
|
}
|
|
108
165
|
}
|
|
109
166
|
exports.TokenError = TokenError;
|
|
167
|
+
class TransactionError extends ErrorWithStatusCode {
|
|
168
|
+
constructor(message, errorCode) {
|
|
169
|
+
super(message, errorCode);
|
|
170
|
+
this.name = 'TransactionError';
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
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, insufficientFeeParamsError, 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.insufficientFeeParamsError = 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; } });
|
|
@@ -21,6 +22,7 @@ Object.defineProperty(exports, "emptySettingError", { enumerable: true, get: fun
|
|
|
21
22
|
Object.defineProperty(exports, "evmAddressError", { enumerable: true, get: function () { return instances_1.evmAddressError; } });
|
|
22
23
|
Object.defineProperty(exports, "indexRequiredError", { enumerable: true, get: function () { return instances_1.indexRequiredError; } });
|
|
23
24
|
Object.defineProperty(exports, "insufficientBalanceError", { enumerable: true, get: function () { return instances_1.insufficientBalanceError; } });
|
|
25
|
+
Object.defineProperty(exports, "insufficientFeeParamsError", { enumerable: true, get: function () { return instances_1.insufficientFeeParamsError; } });
|
|
24
26
|
Object.defineProperty(exports, "invalidMethodNameError", { enumerable: true, get: function () { return instances_1.invalidMethodNameError; } });
|
|
25
27
|
Object.defineProperty(exports, "missingDecimals", { enumerable: true, get: function () { return instances_1.missingDecimals; } });
|
|
26
28
|
Object.defineProperty(exports, "missingFeeParamsError", { enumerable: true, get: function () { return instances_1.missingFeeParamsError; } });
|
|
@@ -34,6 +36,7 @@ Object.defineProperty(exports, "profilingFetchError", { enumerable: true, get: f
|
|
|
34
36
|
Object.defineProperty(exports, "simulationFetchError", { enumerable: true, get: function () { return instances_1.simulationFetchError; } });
|
|
35
37
|
Object.defineProperty(exports, "statusFetchError", { enumerable: true, get: function () { return instances_1.statusFetchError; } });
|
|
36
38
|
Object.defineProperty(exports, "tvmAddressError", { enumerable: true, get: function () { return instances_1.tvmAddressError; } });
|
|
39
|
+
Object.defineProperty(exports, "txFinalizationError", { enumerable: true, get: function () { return instances_1.txFinalizationError; } });
|
|
37
40
|
Object.defineProperty(exports, "unknownTokenTypeError", { enumerable: true, get: function () { return instances_1.unknownTokenTypeError; } });
|
|
38
41
|
Object.defineProperty(exports, "unknownWalletError", { enumerable: true, get: function () { return instances_1.unknownWalletError; } });
|
|
39
42
|
Object.defineProperty(exports, "unsupportedFormatError", { enumerable: true, get: function () { return instances_1.unsupportedFormatError; } });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Origin } from '../structs/Struct';
|
|
2
|
+
import { AddressError, BitError, ContractError, EVMCallError, FetchError, FormatError, InsufficientBalanceError, KeyError, MetadataError, NoValidGroupFoundError, PrepareMessageGroupError, SettingError, TokenError, TransactionError, WalletError } from './errors';
|
|
2
3
|
export declare const emptyContractError: ContractError;
|
|
3
4
|
export declare const operationFetchError: (msg: string, inner?: unknown) => FetchError;
|
|
4
5
|
export declare const statusFetchError: (msg: string, inner?: unknown) => FetchError;
|
|
@@ -16,7 +17,7 @@ export declare const emptyArrayError: (msg: string) => FetchError;
|
|
|
16
17
|
export declare const invalidAssetType: FormatError;
|
|
17
18
|
export declare const prepareMessageGroupError: (isBocSizeValid: boolean, isDepthValid: boolean) => PrepareMessageGroupError;
|
|
18
19
|
export declare const noValidGroupFoundError: NoValidGroupFoundError;
|
|
19
|
-
export declare const allEndpointsFailedError: (inner: unknown) => FetchError;
|
|
20
|
+
export declare const allEndpointsFailedError: (inner: unknown, includeInnerStack?: boolean) => FetchError;
|
|
20
21
|
export declare const allContractOpenerFailedError: (inner: unknown) => FetchError;
|
|
21
22
|
export declare const insufficientBalanceError: (token: string) => InsufficientBalanceError;
|
|
22
23
|
export declare const unknownTokenTypeError: (token: string, reason?: string) => TokenError;
|
|
@@ -32,3 +33,7 @@ export declare const missingJettonDataError: MetadataError;
|
|
|
32
33
|
export declare const zeroRawAmountError: (assetAddress: string) => TokenError;
|
|
33
34
|
export declare const sendCrossChainTransactionFailedError: (msg: string) => WalletError;
|
|
34
35
|
export declare const convertCurrencyNegativeOrZeroValueError: FormatError;
|
|
36
|
+
export declare const unknownAssetOriginError: (origin: Origin) => TokenError;
|
|
37
|
+
export declare const gasPriceFetchError: (msg: string, inner?: unknown) => FetchError;
|
|
38
|
+
export declare const txFinalizationError: (msg: string) => TransactionError;
|
|
39
|
+
export declare const insufficientFeeParamsError: (feeName: string, provided: bigint, required: bigint) => FormatError;
|