@tonappchain/sdk 0.6.6-mainnet-alpha → 0.7.0-rc11
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 +191 -191
- package/dist/adapters/contractOpener.d.ts +2 -1
- package/dist/adapters/contractOpener.js +6 -6
- package/dist/adapters/retryableContractOpener.d.ts +6 -2
- package/dist/adapters/retryableContractOpener.js +2 -2
- package/dist/assets/AssetCache.d.ts +23 -0
- package/dist/assets/AssetCache.js +36 -0
- package/dist/assets/AssetFactory.d.ts +7 -0
- package/dist/assets/AssetFactory.js +46 -0
- package/dist/assets/FT.d.ts +58 -0
- package/dist/assets/FT.js +231 -0
- package/dist/assets/NFT.d.ts +65 -0
- package/dist/assets/NFT.js +210 -0
- package/dist/assets/TON.d.ts +38 -0
- package/dist/assets/TON.js +91 -0
- package/dist/assets/index.d.ts +4 -0
- package/dist/assets/index.js +11 -0
- package/dist/errors/errors.d.ts +6 -0
- package/dist/errors/errors.js +15 -1
- package/dist/errors/index.d.ts +2 -2
- package/dist/errors/index.js +26 -22
- package/dist/errors/instances.d.ts +4 -1
- package/dist/errors/instances.js +11 -2
- package/dist/index.d.ts +7 -0
- package/dist/index.js +14 -1
- package/dist/interfaces/Asset.d.ts +73 -0
- package/dist/interfaces/Asset.js +2 -0
- package/dist/interfaces/ContractOpener.d.ts +21 -0
- package/dist/interfaces/ContractOpener.js +2 -0
- package/dist/interfaces/IConfiguration.d.ts +35 -0
- package/dist/interfaces/IConfiguration.js +2 -0
- package/dist/interfaces/IHttpClient.d.ts +16 -0
- package/dist/interfaces/IHttpClient.js +2 -0
- package/dist/interfaces/ILiteSequencerClient.d.ts +30 -0
- package/dist/interfaces/ILiteSequencerClient.js +2 -0
- package/dist/interfaces/ILiteSequencerClientFactory.d.ts +9 -0
- package/dist/interfaces/ILiteSequencerClientFactory.js +2 -0
- package/dist/interfaces/ILogger.d.ts +10 -0
- package/dist/interfaces/ILogger.js +2 -0
- package/dist/interfaces/IOperationTracker.d.ts +66 -0
- package/dist/interfaces/IOperationTracker.js +2 -0
- package/dist/interfaces/ISimulator.d.ts +47 -0
- package/dist/interfaces/ISimulator.js +2 -0
- package/dist/interfaces/ITacSDK.d.ts +147 -0
- package/dist/interfaces/ITacSDK.js +2 -0
- package/dist/interfaces/ITransactionManager.d.ts +35 -0
- package/dist/interfaces/ITransactionManager.js +2 -0
- package/dist/interfaces/SenderAbstraction.d.ts +35 -0
- package/dist/interfaces/SenderAbstraction.js +2 -0
- package/dist/interfaces/WalletInstanse.d.ts +20 -0
- package/dist/interfaces/WalletInstanse.js +2 -0
- package/dist/interfaces/index.d.ts +13 -0
- package/dist/interfaces/index.js +29 -0
- package/dist/sdk/AxiosHttpClient.d.ts +12 -0
- package/dist/sdk/AxiosHttpClient.js +23 -0
- package/dist/sdk/Configuration.d.ts +21 -0
- package/dist/sdk/Configuration.js +90 -0
- package/dist/sdk/LiteSequencerClient.d.ts +6 -2
- package/dist/sdk/LiteSequencerClient.js +58 -14
- package/dist/sdk/Logger.d.ts +13 -0
- package/dist/sdk/Logger.js +25 -0
- package/dist/sdk/OperationTracker.d.ts +10 -5
- package/dist/sdk/OperationTracker.js +87 -45
- package/dist/sdk/Simulator.d.ts +17 -0
- package/dist/sdk/Simulator.js +163 -0
- package/dist/sdk/StartTracking.d.ts +6 -0
- package/dist/sdk/StartTracking.js +69 -32
- package/dist/sdk/TacSdk.d.ts +26 -43
- package/dist/sdk/TacSdk.js +121 -816
- package/dist/sdk/TransactionManager.d.ts +22 -0
- package/dist/sdk/TransactionManager.js +272 -0
- package/dist/sdk/TxFinalizer.d.ts +10 -0
- package/dist/sdk/TxFinalizer.js +104 -0
- package/dist/sdk/Utils.d.ts +7 -2
- package/dist/sdk/Utils.js +43 -24
- package/dist/sdk/Validator.d.ts +9 -0
- package/dist/sdk/Validator.js +43 -0
- package/dist/sender/BatchSender.d.ts +6 -4
- package/dist/sender/BatchSender.js +18 -6
- package/dist/sender/RawSender.d.ts +10 -5
- package/dist/sender/RawSender.js +46 -18
- package/dist/sender/SenderFactory.d.ts +1 -1
- package/dist/sender/SenderFactory.js +5 -4
- package/dist/sender/TonConnectSender.d.ts +6 -4
- package/dist/sender/TonConnectSender.js +14 -10
- package/dist/sender/index.d.ts +2 -2
- package/dist/sender/index.js +2 -2
- package/dist/structs/InternalStruct.d.ts +51 -32
- package/dist/structs/Struct.d.ts +88 -90
- package/dist/structs/Struct.js +11 -1
- package/dist/wrappers/HighloadQueryId.js +0 -1
- package/dist/wrappers/HighloadWalletV3.d.ts +4 -3
- package/dist/wrappers/HighloadWalletV3.js +5 -2
- package/package.json +67 -67
- package/dist/sender/SenderAbstraction.d.ts +0 -20
- package/dist/sender/SenderAbstraction.js +0 -5
package/dist/structs/Struct.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import type { Address, Cell } from '@ton/ton';
|
|
2
|
+
import { AbstractProvider, Addressable } from 'ethers';
|
|
3
|
+
import type { ILogger, ContractOpener, Asset } from '../interfaces';
|
|
4
|
+
export type { ContractOpener, Asset } from '../interfaces';
|
|
4
5
|
export type ContractState = {
|
|
5
6
|
balance: bigint;
|
|
6
7
|
state: 'active' | 'uninitialized' | 'frozen';
|
|
7
8
|
code: Buffer | null;
|
|
8
9
|
};
|
|
9
|
-
export interface ContractOpener {
|
|
10
|
-
open<T extends Contract>(src: T): OpenedContract<T> | SandboxContract<T>;
|
|
11
|
-
getContractState(address: Address): Promise<ContractState>;
|
|
12
|
-
closeConnections?: () => unknown;
|
|
13
|
-
}
|
|
14
10
|
export declare enum SimplifiedStatuses {
|
|
15
11
|
PENDING = "PENDING",
|
|
16
12
|
FAILED = "FAILED",
|
|
@@ -25,6 +21,10 @@ export declare enum BlockchainType {
|
|
|
25
21
|
TAC = "TAC",
|
|
26
22
|
TON = "TON"
|
|
27
23
|
}
|
|
24
|
+
export declare enum CurrencyType {
|
|
25
|
+
TAC = "TAC",
|
|
26
|
+
TON = "TON"
|
|
27
|
+
}
|
|
28
28
|
export declare enum OperationType {
|
|
29
29
|
PENDING = "PENDING",
|
|
30
30
|
TON_TAC_TON = "TON-TAC-TON",
|
|
@@ -42,30 +42,6 @@ export type TACParams = {
|
|
|
42
42
|
* Address of TAC settings contract. Use only for tests.
|
|
43
43
|
*/
|
|
44
44
|
settingsAddress?: string | Addressable;
|
|
45
|
-
/**
|
|
46
|
-
* ABI of TAC settings contract. Use only for tests.
|
|
47
|
-
*/
|
|
48
|
-
settingsABI?: Interface | InterfaceAbi;
|
|
49
|
-
/**
|
|
50
|
-
* ABI of TAC CCL contract. Use only for tests.
|
|
51
|
-
*/
|
|
52
|
-
crossChainLayerABI?: Interface | InterfaceAbi;
|
|
53
|
-
/**
|
|
54
|
-
* ABI of TAC CrossChainLayerToken contract. Use only for tests.
|
|
55
|
-
*/
|
|
56
|
-
crossChainLayerTokenABI?: Interface | InterfaceAbi;
|
|
57
|
-
/**
|
|
58
|
-
* bytecode of TAC CrossChainLayerToken contract. Use only for tests.
|
|
59
|
-
*/
|
|
60
|
-
crossChainLayerTokenBytecode?: string;
|
|
61
|
-
/**
|
|
62
|
-
* ABI of TAC CrossChainLayerNFT contract. Use only for tests.
|
|
63
|
-
*/
|
|
64
|
-
crossChainLayerNFTABI?: Interface | InterfaceAbi;
|
|
65
|
-
/**
|
|
66
|
-
* bytecode of TAC CrossChainLayerNFT contract. Use only for tests.
|
|
67
|
-
*/
|
|
68
|
-
crossChainLayerNFTBytecode?: string;
|
|
69
45
|
};
|
|
70
46
|
export type TONParams = {
|
|
71
47
|
/**
|
|
@@ -98,10 +74,6 @@ export type SDKParams = {
|
|
|
98
74
|
* URLs of lite sequencers
|
|
99
75
|
*/
|
|
100
76
|
customLiteSequencerEndpoints?: string[];
|
|
101
|
-
/**
|
|
102
|
-
* Debug flag
|
|
103
|
-
*/
|
|
104
|
-
debug?: boolean;
|
|
105
77
|
};
|
|
106
78
|
export declare enum AssetType {
|
|
107
79
|
NFT = "NFT",
|
|
@@ -111,52 +83,6 @@ export declare enum NFTAddressType {
|
|
|
111
83
|
ITEM = "ITEM",
|
|
112
84
|
COLLECTION = "COLLECTION"
|
|
113
85
|
}
|
|
114
|
-
export type WithAddressFT = {
|
|
115
|
-
type: AssetType.FT;
|
|
116
|
-
/**
|
|
117
|
-
* Address of TAC or TON token.
|
|
118
|
-
* Empty if sending native TON coin.
|
|
119
|
-
*/
|
|
120
|
-
address?: string;
|
|
121
|
-
};
|
|
122
|
-
export type WithAddressNFTItem = {
|
|
123
|
-
type: AssetType.NFT;
|
|
124
|
-
/**
|
|
125
|
-
* Address NFT item token.
|
|
126
|
-
*/
|
|
127
|
-
address: string;
|
|
128
|
-
};
|
|
129
|
-
export type WithAddressNFTCollectionItem = {
|
|
130
|
-
type: AssetType.NFT;
|
|
131
|
-
/**
|
|
132
|
-
* Address NFT collection.
|
|
133
|
-
*/
|
|
134
|
-
collectionAddress: string;
|
|
135
|
-
/**
|
|
136
|
-
* Index of NFT item in collection.
|
|
137
|
-
*/
|
|
138
|
-
itemIndex: bigint;
|
|
139
|
-
};
|
|
140
|
-
export type WithAddressNFT = WithAddressNFTItem | WithAddressNFTCollectionItem;
|
|
141
|
-
export type WithAddress = WithAddressFT | WithAddressNFT;
|
|
142
|
-
export type RawAssetBridgingData<NFTFormatRequired extends WithAddressNFT = WithAddressNFTItem> = {
|
|
143
|
-
/** Raw format, e.g. 12340000000 (=12.34 tokens if decimals is 9) */
|
|
144
|
-
rawAmount: bigint;
|
|
145
|
-
} & (WithAddressFT | NFTFormatRequired);
|
|
146
|
-
export type UserFriendlyAssetBridgingData = {
|
|
147
|
-
/**
|
|
148
|
-
* User friendly format, e.g. 12.34 tokens
|
|
149
|
-
* Specified value will be converted automatically to raw format: 12.34 * (10^decimals).
|
|
150
|
-
* No decimals should be specified.
|
|
151
|
-
*/
|
|
152
|
-
amount: number;
|
|
153
|
-
/**
|
|
154
|
-
* Decimals may be specified manually.
|
|
155
|
-
* Otherwise, SDK tries to extract them from chain.
|
|
156
|
-
*/
|
|
157
|
-
decimals?: number;
|
|
158
|
-
} & WithAddress;
|
|
159
|
-
export type AssetBridgingData = RawAssetBridgingData | UserFriendlyAssetBridgingData;
|
|
160
86
|
export type UserWalletBalanceExtended = {
|
|
161
87
|
exists: true;
|
|
162
88
|
amount: number;
|
|
@@ -170,6 +96,7 @@ export type EvmProxyMsg = {
|
|
|
170
96
|
methodName?: string;
|
|
171
97
|
encodedParameters?: string;
|
|
172
98
|
gasLimit?: bigint;
|
|
99
|
+
[key: string]: unknown;
|
|
173
100
|
};
|
|
174
101
|
export type TransactionLinker = {
|
|
175
102
|
caller: string;
|
|
@@ -187,9 +114,9 @@ export type TACSimulationRequest = {
|
|
|
187
114
|
methodName: string;
|
|
188
115
|
target: string;
|
|
189
116
|
};
|
|
190
|
-
evmValidExecutors
|
|
191
|
-
tvmValidExecutors
|
|
192
|
-
extraData
|
|
117
|
+
evmValidExecutors?: string[];
|
|
118
|
+
tvmValidExecutors?: string[];
|
|
119
|
+
extraData?: string;
|
|
193
120
|
shardsKey: string;
|
|
194
121
|
tonAssets: {
|
|
195
122
|
amount: string;
|
|
@@ -197,6 +124,7 @@ export type TACSimulationRequest = {
|
|
|
197
124
|
assetType: string;
|
|
198
125
|
}[];
|
|
199
126
|
tonCaller: string;
|
|
127
|
+
calculateRollbackFee?: boolean;
|
|
200
128
|
};
|
|
201
129
|
export declare enum StageName {
|
|
202
130
|
COLLECTED_IN_TAC = "collectedInTAC",
|
|
@@ -246,14 +174,38 @@ export type GeneralFeeInfo = {
|
|
|
246
174
|
executorFee: string;
|
|
247
175
|
tokenFeeSymbol: TokenSymbol;
|
|
248
176
|
};
|
|
177
|
+
export type AdditionalFeeInfo = {
|
|
178
|
+
attachedProtocolFee: string;
|
|
179
|
+
tokenFeeSymbol: TokenSymbol;
|
|
180
|
+
};
|
|
249
181
|
export type FeeInfo = {
|
|
182
|
+
additionalFeeInfo: AdditionalFeeInfo;
|
|
250
183
|
tac: GeneralFeeInfo;
|
|
251
184
|
ton: GeneralFeeInfo;
|
|
252
185
|
};
|
|
186
|
+
export type AssetMovement = {
|
|
187
|
+
assetType: AssetType;
|
|
188
|
+
tvmAddress: string;
|
|
189
|
+
evmAddress: string;
|
|
190
|
+
amount: string;
|
|
191
|
+
tokenId: string | null;
|
|
192
|
+
};
|
|
193
|
+
export type TransactionHash = {
|
|
194
|
+
hash: string;
|
|
195
|
+
blockchainType: BlockchainType;
|
|
196
|
+
};
|
|
197
|
+
export type AssetMovementInfo = {
|
|
198
|
+
caller: InitialCallerInfo;
|
|
199
|
+
target: InitialCallerInfo;
|
|
200
|
+
transactionHash: TransactionHash;
|
|
201
|
+
assetMovements: AssetMovement[];
|
|
202
|
+
};
|
|
253
203
|
export type MetaInfo = {
|
|
254
204
|
initialCaller: InitialCallerInfo;
|
|
255
205
|
validExecutors: ValidExecutors;
|
|
256
206
|
feeInfo: FeeInfo;
|
|
207
|
+
sentAssets: AssetMovementInfo | null;
|
|
208
|
+
receivedAssets: AssetMovementInfo | null;
|
|
257
209
|
};
|
|
258
210
|
export type ExecutionStages = {
|
|
259
211
|
operationType: OperationType;
|
|
@@ -320,21 +272,22 @@ export type FeeParams = {
|
|
|
320
272
|
tvmExecutorFee: bigint;
|
|
321
273
|
};
|
|
322
274
|
export type CrossChainTransactionOptions = {
|
|
323
|
-
|
|
275
|
+
allowSimulationError?: boolean;
|
|
324
276
|
isRoundTrip?: boolean;
|
|
325
277
|
protocolFee?: bigint;
|
|
326
278
|
evmValidExecutors?: string[];
|
|
327
279
|
evmExecutorFee?: bigint;
|
|
328
280
|
tvmValidExecutors?: string[];
|
|
329
281
|
tvmExecutorFee?: bigint;
|
|
282
|
+
calculateRollbackFee?: boolean;
|
|
330
283
|
};
|
|
331
284
|
export type ExecutionFeeEstimationResult = {
|
|
332
285
|
feeParams: FeeParams;
|
|
333
|
-
simulation
|
|
286
|
+
simulation?: TACSimulationResult;
|
|
334
287
|
};
|
|
335
288
|
export type CrosschainTx = {
|
|
336
289
|
evmProxyMsg: EvmProxyMsg;
|
|
337
|
-
assets?:
|
|
290
|
+
assets?: Asset[];
|
|
338
291
|
options?: CrossChainTransactionOptions;
|
|
339
292
|
};
|
|
340
293
|
export type NFTItemData = {
|
|
@@ -344,6 +297,11 @@ export type NFTItemData = {
|
|
|
344
297
|
ownerAddress: Address | null;
|
|
345
298
|
content: Cell | null;
|
|
346
299
|
};
|
|
300
|
+
export type NFTCollectionData = {
|
|
301
|
+
nextIndex: number;
|
|
302
|
+
content: Cell;
|
|
303
|
+
adminAddress: Address;
|
|
304
|
+
};
|
|
347
305
|
export interface WaitOptions<T = unknown> {
|
|
348
306
|
/**
|
|
349
307
|
* Timeout in milliseconds
|
|
@@ -361,9 +319,9 @@ export interface WaitOptions<T = unknown> {
|
|
|
361
319
|
*/
|
|
362
320
|
delay?: number;
|
|
363
321
|
/**
|
|
364
|
-
*
|
|
322
|
+
* Logger
|
|
365
323
|
*/
|
|
366
|
-
|
|
324
|
+
logger?: ILogger;
|
|
367
325
|
/**
|
|
368
326
|
* Function to check if the result is successful
|
|
369
327
|
* If not provided, any non-error result is considered successful
|
|
@@ -371,3 +329,43 @@ export interface WaitOptions<T = unknown> {
|
|
|
371
329
|
successCheck?: (result: T) => boolean;
|
|
372
330
|
}
|
|
373
331
|
export declare const defaultWaitOptions: WaitOptions;
|
|
332
|
+
export declare enum Origin {
|
|
333
|
+
TON = "TON",
|
|
334
|
+
TAC = "TAC"
|
|
335
|
+
}
|
|
336
|
+
export type TVMAddress = string;
|
|
337
|
+
export type EVMAddress = string;
|
|
338
|
+
export type AssetFromFTArg = {
|
|
339
|
+
address: TVMAddress | EVMAddress;
|
|
340
|
+
tokenType: AssetType.FT;
|
|
341
|
+
};
|
|
342
|
+
export type AssetFromNFTCollectionArg = {
|
|
343
|
+
address: TVMAddress | EVMAddress;
|
|
344
|
+
tokenType: AssetType.NFT;
|
|
345
|
+
addressType: NFTAddressType.COLLECTION;
|
|
346
|
+
index: bigint;
|
|
347
|
+
};
|
|
348
|
+
export type AssetFromNFTItemArg = {
|
|
349
|
+
address: TVMAddress;
|
|
350
|
+
tokenType: AssetType.NFT;
|
|
351
|
+
addressType: NFTAddressType.ITEM;
|
|
352
|
+
};
|
|
353
|
+
export type ConvertCurrencyParams = {
|
|
354
|
+
rawValue: bigint;
|
|
355
|
+
currencyType: CurrencyType;
|
|
356
|
+
};
|
|
357
|
+
export type TokenPriceInfo = {
|
|
358
|
+
spot: bigint;
|
|
359
|
+
ema: bigint;
|
|
360
|
+
};
|
|
361
|
+
export type ConvertedCurrencyResult = {
|
|
362
|
+
spotRawValue: bigint;
|
|
363
|
+
spotFriendlyValue: string;
|
|
364
|
+
emaValue: bigint;
|
|
365
|
+
emaFriendlyValue: string;
|
|
366
|
+
spotValueInUSD: number;
|
|
367
|
+
emaValueInUSD: number;
|
|
368
|
+
currencyType: CurrencyType;
|
|
369
|
+
tacPrice: TokenPriceInfo;
|
|
370
|
+
tonPrice: TokenPriceInfo;
|
|
371
|
+
};
|
package/dist/structs/Struct.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultWaitOptions = exports.TokenSymbol = exports.StageName = exports.NFTAddressType = exports.AssetType = exports.OperationType = exports.BlockchainType = exports.Network = exports.SimplifiedStatuses = void 0;
|
|
3
|
+
exports.Origin = exports.defaultWaitOptions = exports.TokenSymbol = exports.StageName = exports.NFTAddressType = exports.AssetType = exports.OperationType = exports.CurrencyType = exports.BlockchainType = exports.Network = exports.SimplifiedStatuses = void 0;
|
|
4
4
|
var SimplifiedStatuses;
|
|
5
5
|
(function (SimplifiedStatuses) {
|
|
6
6
|
SimplifiedStatuses["PENDING"] = "PENDING";
|
|
@@ -18,6 +18,11 @@ var BlockchainType;
|
|
|
18
18
|
BlockchainType["TAC"] = "TAC";
|
|
19
19
|
BlockchainType["TON"] = "TON";
|
|
20
20
|
})(BlockchainType || (exports.BlockchainType = BlockchainType = {}));
|
|
21
|
+
var CurrencyType;
|
|
22
|
+
(function (CurrencyType) {
|
|
23
|
+
CurrencyType["TAC"] = "TAC";
|
|
24
|
+
CurrencyType["TON"] = "TON";
|
|
25
|
+
})(CurrencyType || (exports.CurrencyType = CurrencyType = {}));
|
|
21
26
|
var OperationType;
|
|
22
27
|
(function (OperationType) {
|
|
23
28
|
OperationType["PENDING"] = "PENDING";
|
|
@@ -56,3 +61,8 @@ exports.defaultWaitOptions = {
|
|
|
56
61
|
maxAttempts: 30,
|
|
57
62
|
delay: 10000,
|
|
58
63
|
};
|
|
64
|
+
var Origin;
|
|
65
|
+
(function (Origin) {
|
|
66
|
+
Origin["TON"] = "TON";
|
|
67
|
+
Origin["TAC"] = "TAC";
|
|
68
|
+
})(Origin || (exports.Origin = Origin = {}));
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HighloadQueryId = void 0;
|
|
4
4
|
const BIT_NUMBER_SIZE = 10n; // 10 bit
|
|
5
|
-
const SHIFT_SIZE = 13n; // 13 bit
|
|
6
5
|
const MAX_BIT_NUMBER = 1022n;
|
|
7
6
|
const MAX_SHIFT = 8191n; // 2^13 = 8192
|
|
8
7
|
class HighloadQueryId {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address, Cell, ContractProvider, MessageRelaxed, OutAction, OutActionSendMsg, SendMode } from '@ton/ton';
|
|
2
2
|
import { HighloadQueryId } from './HighloadQueryId';
|
|
3
|
-
import {
|
|
3
|
+
import { WalletInstanse } from '../interfaces';
|
|
4
4
|
export declare enum OP {
|
|
5
5
|
InternalTransfer = 2923619748
|
|
6
6
|
}
|
|
@@ -14,7 +14,7 @@ export declare const DEFAULT_TIMEOUT: number;
|
|
|
14
14
|
export declare const TIMESTAMP_SIZE = 64;
|
|
15
15
|
export declare const TIMEOUT_SIZE = 22;
|
|
16
16
|
export declare function highloadWalletV3ConfigToCell(config: HighloadWalletV3Config): Cell;
|
|
17
|
-
export declare class HighloadWalletV3 implements
|
|
17
|
+
export declare class HighloadWalletV3 implements WalletInstanse {
|
|
18
18
|
readonly address: Address;
|
|
19
19
|
readonly init?: {
|
|
20
20
|
code: Cell;
|
|
@@ -24,7 +24,7 @@ export declare class HighloadWalletV3 implements WalletInstance {
|
|
|
24
24
|
code: Cell;
|
|
25
25
|
data: Cell;
|
|
26
26
|
} | undefined);
|
|
27
|
-
getSeqno(
|
|
27
|
+
getSeqno(): Promise<number>;
|
|
28
28
|
sendTransfer(provider: ContractProvider, args: {
|
|
29
29
|
seqno?: number;
|
|
30
30
|
secretKey: Buffer;
|
|
@@ -35,6 +35,7 @@ export declare class HighloadWalletV3 implements WalletInstance {
|
|
|
35
35
|
createdAt?: number;
|
|
36
36
|
}): Promise<void>;
|
|
37
37
|
static create(config: HighloadWalletV3Config, code?: Cell, workchain?: number): HighloadWalletV3;
|
|
38
|
+
static generateCreatedAt(): number;
|
|
38
39
|
sendExternalMessage(provider: ContractProvider, secretKey: Buffer, opts: {
|
|
39
40
|
message: MessageRelaxed | Cell;
|
|
40
41
|
mode: number;
|
|
@@ -27,7 +27,7 @@ class HighloadWalletV3 {
|
|
|
27
27
|
this.address = address;
|
|
28
28
|
this.init = init;
|
|
29
29
|
}
|
|
30
|
-
async getSeqno(
|
|
30
|
+
async getSeqno() {
|
|
31
31
|
return 0; // will not be used
|
|
32
32
|
}
|
|
33
33
|
async sendTransfer(provider, args) {
|
|
@@ -50,6 +50,9 @@ class HighloadWalletV3 {
|
|
|
50
50
|
const init = { code, data };
|
|
51
51
|
return new HighloadWalletV3((0, ton_1.contractAddress)(workchain, init), init);
|
|
52
52
|
}
|
|
53
|
+
static generateCreatedAt() {
|
|
54
|
+
return Math.floor(Date.now() / 1000) - 40; // -40 is used to pass check created_at <= now() in smart contract for sure
|
|
55
|
+
}
|
|
53
56
|
async sendExternalMessage(provider, secretKey, opts) {
|
|
54
57
|
let messageCell;
|
|
55
58
|
if (opts.message instanceof ton_1.Cell) {
|
|
@@ -73,7 +76,7 @@ class HighloadWalletV3 {
|
|
|
73
76
|
}
|
|
74
77
|
async sendBatch(provider, secretKey, messages, subwallet, timeout, createdAt, value = 0n) {
|
|
75
78
|
if (createdAt == undefined) {
|
|
76
|
-
createdAt =
|
|
79
|
+
createdAt = HighloadWalletV3.generateCreatedAt();
|
|
77
80
|
}
|
|
78
81
|
const queryId = this.getQueryIdFromCreatedAt(createdAt);
|
|
79
82
|
return await this.sendExternalMessage(provider, secretKey, {
|
package/package.json
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tonappchain/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"repository": "https://github.com/TacBuild/tac-sdk.git",
|
|
5
|
-
"author": "TAC. <developers@tac>",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"main": "dist/index.js",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "rm -rf dist && tsc --declaration",
|
|
13
|
-
"test": "jest --verbose --runInBand",
|
|
14
|
-
"release": "yarn build && yarn release-it --npm.yarn1",
|
|
15
|
-
"lint": "eslint .",
|
|
16
|
-
"lint:fix": "eslint . --fix",
|
|
17
|
-
"prettier": "prettier --ignore-path .gitignore --write \"./src/**/*.+(js|ts|json)\""
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@aws-crypto/sha256-js": "^5.2.0",
|
|
21
|
-
"@orbs-network/ton-access": "^2.3.3",
|
|
22
|
-
"@ton/ton": "15.1.0",
|
|
23
|
-
"@tonappchain/artifacts": "0.0.19-smart-accounts-4",
|
|
24
|
-
"@tonappchain/ton-lite-client": "3.0.6",
|
|
25
|
-
"@tonconnect/ui": "^2.0.11",
|
|
26
|
-
"bn.js": "^5.2.1",
|
|
27
|
-
"cli-table3": "^0.6.5",
|
|
28
|
-
"dotenv": "^16.4.7",
|
|
29
|
-
"ethers": "^6.13.5",
|
|
30
|
-
"ton-crypto": "^3.2.0"
|
|
31
|
-
},
|
|
32
|
-
"keywords": [],
|
|
33
|
-
"description": "",
|
|
34
|
-
"devDependencies": {
|
|
35
|
-
"@eslint/js": "^9.21.0",
|
|
36
|
-
"@jest/globals": "^29.7.0",
|
|
37
|
-
"@release-it/keep-a-changelog": "^6.0.0",
|
|
38
|
-
"@ton/sandbox": "^0.27.1",
|
|
39
|
-
"@ton/test-utils": "^0.5.0",
|
|
40
|
-
"@types/bn.js": "^5.1.6",
|
|
41
|
-
"@types/jest": "^29.5.14",
|
|
42
|
-
"eslint": "^9.21.0",
|
|
43
|
-
"eslint-config-prettier": "^10.0.2",
|
|
44
|
-
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
45
|
-
"jest": "^29.7.0",
|
|
46
|
-
"prettier": "^3.5.3",
|
|
47
|
-
"ts-jest": "^29.2.6",
|
|
48
|
-
"ts-node": "^10.9.2",
|
|
49
|
-
"typescript": "^5.7.3",
|
|
50
|
-
"typescript-eslint": "^8.17.0"
|
|
51
|
-
},
|
|
52
|
-
"publishConfig": {
|
|
53
|
-
"access": "public",
|
|
54
|
-
"registry": "https://registry.npmjs.org/"
|
|
55
|
-
},
|
|
56
|
-
"release-it": {
|
|
57
|
-
"plugins": {
|
|
58
|
-
"@release-it/keep-a-changelog": {
|
|
59
|
-
"filename": "CHANGELOG.md"
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"npm": {
|
|
63
|
-
"publish": false
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
67
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tonappchain/sdk",
|
|
3
|
+
"version": "0.7.0-rc11",
|
|
4
|
+
"repository": "https://github.com/TacBuild/tac-sdk.git",
|
|
5
|
+
"author": "TAC. <developers@tac>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "rm -rf dist && tsc --declaration",
|
|
13
|
+
"test": "jest --verbose --runInBand",
|
|
14
|
+
"release": "yarn build && yarn release-it --npm.yarn1",
|
|
15
|
+
"lint": "eslint .",
|
|
16
|
+
"lint:fix": "eslint . --fix",
|
|
17
|
+
"prettier": "prettier --ignore-path .gitignore --write \"./src/**/*.+(js|ts|json)\""
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@aws-crypto/sha256-js": "^5.2.0",
|
|
21
|
+
"@orbs-network/ton-access": "^2.3.3",
|
|
22
|
+
"@ton/ton": "15.1.0",
|
|
23
|
+
"@tonappchain/artifacts": "0.0.19-smart-accounts-4",
|
|
24
|
+
"@tonappchain/ton-lite-client": "3.0.6",
|
|
25
|
+
"@tonconnect/ui": "^2.0.11",
|
|
26
|
+
"bn.js": "^5.2.1",
|
|
27
|
+
"cli-table3": "^0.6.5",
|
|
28
|
+
"dotenv": "^16.4.7",
|
|
29
|
+
"ethers": "^6.13.5",
|
|
30
|
+
"ton-crypto": "^3.2.0"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [],
|
|
33
|
+
"description": "",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@eslint/js": "^9.21.0",
|
|
36
|
+
"@jest/globals": "^29.7.0",
|
|
37
|
+
"@release-it/keep-a-changelog": "^6.0.0",
|
|
38
|
+
"@ton/sandbox": "^0.27.1",
|
|
39
|
+
"@ton/test-utils": "^0.5.0",
|
|
40
|
+
"@types/bn.js": "^5.1.6",
|
|
41
|
+
"@types/jest": "^29.5.14",
|
|
42
|
+
"eslint": "^9.21.0",
|
|
43
|
+
"eslint-config-prettier": "^10.0.2",
|
|
44
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
45
|
+
"jest": "^29.7.0",
|
|
46
|
+
"prettier": "^3.5.3",
|
|
47
|
+
"ts-jest": "^29.2.6",
|
|
48
|
+
"ts-node": "^10.9.2",
|
|
49
|
+
"typescript": "^5.7.3",
|
|
50
|
+
"typescript-eslint": "^8.17.0"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public",
|
|
54
|
+
"registry": "https://registry.npmjs.org/"
|
|
55
|
+
},
|
|
56
|
+
"release-it": {
|
|
57
|
+
"plugins": {
|
|
58
|
+
"@release-it/keep-a-changelog": {
|
|
59
|
+
"filename": "CHANGELOG.md"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"npm": {
|
|
63
|
+
"publish": false
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
67
|
+
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Contract, ContractProvider, MessageRelaxed, SendMode } from '@ton/ton';
|
|
2
|
-
import type { ContractOpener } from '../structs/Struct';
|
|
3
|
-
import type { SendResult, ShardTransaction } from '../structs/InternalStruct';
|
|
4
|
-
import { Network } from '../structs/Struct';
|
|
5
|
-
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
6
|
-
export interface WalletInstance extends Contract {
|
|
7
|
-
getSeqno(provider: ContractProvider): Promise<number>;
|
|
8
|
-
sendTransfer(provider: ContractProvider, args: {
|
|
9
|
-
seqno: number;
|
|
10
|
-
secretKey: Buffer;
|
|
11
|
-
messages: MessageRelaxed[];
|
|
12
|
-
sendMode: SendMode;
|
|
13
|
-
timeout?: number;
|
|
14
|
-
}): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
export interface SenderAbstraction {
|
|
17
|
-
sendShardTransaction(shardTransaction: ShardTransaction, delay: number, chain?: Network, contractOpener?: ContractOpener): Promise<SendResult>;
|
|
18
|
-
sendShardTransactions(shardTransactions: ShardTransaction[], delay: number, chain?: Network, contractOpener?: ContractOpener): Promise<SendResult[]>;
|
|
19
|
-
getSenderAddress(): string;
|
|
20
|
-
}
|