@tonappchain/sdk 0.7.2-payload-builder-0.2 → 0.7.2-payload-builder-0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/artifacts/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/JettonMinter.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/wrappers/CrossChainLayer.d.ts +13 -1
- package/dist/artifacts/testnet/ton/internal/wrappers/CrossChainLayer.js +45 -7
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.d.ts +2 -2
- package/dist/artifacts/testnet/ton/internal/wrappers/JettonMinter.js +2 -2
- package/dist/src/adapters/contractOpener.d.ts +4 -0
- package/dist/src/adapters/contractOpener.js +165 -1
- package/dist/src/adapters/retryableContractOpener.d.ts +5 -1
- package/dist/src/adapters/retryableContractOpener.js +22 -4
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js +1 -4
- package/dist/src/interfaces/ContractOpener.d.ts +5 -1
- package/dist/src/interfaces/ITxFinalizer.d.ts +5 -0
- package/dist/src/interfaces/ITxFinalizer.js +2 -0
- package/dist/src/interfaces/WalletInstanse.d.ts +4 -8
- package/dist/src/sdk/StartTracking.d.ts +4 -3
- package/dist/src/sdk/StartTracking.js +5 -7
- package/dist/src/sdk/TONTransactionManager.d.ts +3 -1
- package/dist/src/sdk/TONTransactionManager.js +16 -3
- package/dist/src/sdk/TacSdk.js +3 -1
- package/dist/src/sdk/TxFinalizer.d.ts +15 -4
- package/dist/src/sdk/TxFinalizer.js +102 -23
- package/dist/src/sdk/Utils.d.ts +6 -1
- package/dist/src/sdk/Utils.js +37 -0
- package/dist/src/sender/BatchSender.js +19 -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/structs/InternalStruct.d.ts +19 -1
- package/dist/src/structs/Struct.d.ts +13 -1
- package/dist/src/wrappers/HighloadWalletV3.d.ts +5 -3
- package/dist/src/wrappers/HighloadWalletV3.js +14 -3
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cell } from '@ton/ton';
|
|
1
|
+
import { Address, Cell } from '@ton/ton';
|
|
2
2
|
import { AbstractProvider, ethers } from 'ethers';
|
|
3
3
|
import { ICrossChainLayer, ISAFactory, ISettings, ITokenUtils } from '../../artifacts/tacTypes';
|
|
4
4
|
import { ContractOpener } from '../interfaces';
|
|
@@ -64,6 +64,7 @@ export type OperationIdWithLogIndex = {
|
|
|
64
64
|
export type OperationIdWithLogIndexResponse = ResponseBase<OperationIdWithLogIndex>;
|
|
65
65
|
export interface SendResult {
|
|
66
66
|
success: boolean;
|
|
67
|
+
boc: string;
|
|
67
68
|
result?: unknown;
|
|
68
69
|
error?: Error;
|
|
69
70
|
lastMessageIndex?: number;
|
|
@@ -91,6 +92,7 @@ export type ToncenterTransaction = {
|
|
|
91
92
|
}[];
|
|
92
93
|
};
|
|
93
94
|
export type TransactionDepth = {
|
|
95
|
+
address?: Address;
|
|
94
96
|
hash: string;
|
|
95
97
|
depth: number;
|
|
96
98
|
};
|
|
@@ -117,3 +119,19 @@ export type ConvertedCurrencyRawResult = {
|
|
|
117
119
|
tacPrice: USDPriceInfoRaw;
|
|
118
120
|
tonPrice: USDPriceInfoRaw;
|
|
119
121
|
};
|
|
122
|
+
export type GetTransactionsOptions = {
|
|
123
|
+
limit: number;
|
|
124
|
+
lt?: string;
|
|
125
|
+
hash?: string;
|
|
126
|
+
to_lt?: string;
|
|
127
|
+
inclusive?: boolean;
|
|
128
|
+
archival?: boolean;
|
|
129
|
+
timeoutMs?: number;
|
|
130
|
+
retryDelayMs?: number;
|
|
131
|
+
};
|
|
132
|
+
export type AddressInformation = {
|
|
133
|
+
lastTransaction: {
|
|
134
|
+
lt: string;
|
|
135
|
+
hash: string;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
@@ -4,6 +4,8 @@ import { AbstractProvider } from 'ethers';
|
|
|
4
4
|
import { JettonMinter, JettonMinterData } from '../../artifacts/tonTypes';
|
|
5
5
|
import type { FT, NFT } from '../assets';
|
|
6
6
|
import type { Asset, ContractOpener, ILogger } from '../interfaces';
|
|
7
|
+
import { ITxFinalizer } from '../interfaces/ITxFinalizer';
|
|
8
|
+
import { SendResult } from './InternalStruct';
|
|
7
9
|
export type ContractState = {
|
|
8
10
|
balance: bigint;
|
|
9
11
|
state: 'active' | 'uninitialized' | 'frozen';
|
|
@@ -59,6 +61,10 @@ export type TONParams = {
|
|
|
59
61
|
* Address of TON settings contract. Use only for tests.
|
|
60
62
|
*/
|
|
61
63
|
settingsAddress?: string;
|
|
64
|
+
/**
|
|
65
|
+
* TxFinalizer for tracking transaction tree
|
|
66
|
+
*/
|
|
67
|
+
txFinalizer?: ITxFinalizer;
|
|
62
68
|
};
|
|
63
69
|
export type SDKParams = {
|
|
64
70
|
/**
|
|
@@ -110,7 +116,7 @@ export type TransactionLinker = {
|
|
|
110
116
|
shardCount: number;
|
|
111
117
|
shardsKey: string;
|
|
112
118
|
timestamp: number;
|
|
113
|
-
sendTransactionResult?:
|
|
119
|
+
sendTransactionResult?: SendResult;
|
|
114
120
|
};
|
|
115
121
|
export type TransactionLinkerWithOperationId = TransactionLinker & {
|
|
116
122
|
operationId?: string;
|
|
@@ -367,6 +373,11 @@ export interface WaitOptions<T = unknown, TContext = unknown> {
|
|
|
367
373
|
* Receives both the result and optional context with additional parameters
|
|
368
374
|
*/
|
|
369
375
|
onSuccess?: (result: T, context?: TContext) => Promise<void> | void;
|
|
376
|
+
/**
|
|
377
|
+
* Ensure that TON transaction is succesful
|
|
378
|
+
* @default true
|
|
379
|
+
*/
|
|
380
|
+
ensureTxExecuted?: boolean;
|
|
370
381
|
}
|
|
371
382
|
export declare const defaultWaitOptions: WaitOptions;
|
|
372
383
|
export declare enum Origin {
|
|
@@ -423,4 +434,5 @@ export type CrossChainPayloadResult = {
|
|
|
423
434
|
destinationAddress: string;
|
|
424
435
|
tonAmount: bigint;
|
|
425
436
|
networkFee: bigint;
|
|
437
|
+
transactionLinker: TransactionLinker;
|
|
426
438
|
};
|
|
@@ -25,6 +25,8 @@ export declare class HighloadWalletV3 implements WalletInstanse {
|
|
|
25
25
|
data: Cell;
|
|
26
26
|
} | undefined);
|
|
27
27
|
getSeqno(): Promise<number>;
|
|
28
|
+
send(provider: ContractProvider, msg: Cell): Promise<void>;
|
|
29
|
+
createTransfer(): Cell;
|
|
28
30
|
sendTransfer(provider: ContractProvider, args: {
|
|
29
31
|
seqno?: number;
|
|
30
32
|
secretKey: Buffer;
|
|
@@ -33,7 +35,7 @@ export declare class HighloadWalletV3 implements WalletInstanse {
|
|
|
33
35
|
timeout?: number;
|
|
34
36
|
subwalletId?: number;
|
|
35
37
|
createdAt?: number;
|
|
36
|
-
}): Promise<
|
|
38
|
+
}): Promise<string>;
|
|
37
39
|
static create(config: HighloadWalletV3Config, code?: Cell, workchain?: number): HighloadWalletV3;
|
|
38
40
|
static generateCreatedAt(): number;
|
|
39
41
|
sendExternalMessage(provider: ContractProvider, secretKey: Buffer, opts: {
|
|
@@ -43,8 +45,8 @@ export declare class HighloadWalletV3 implements WalletInstanse {
|
|
|
43
45
|
createdAt: number;
|
|
44
46
|
subwalletId: number;
|
|
45
47
|
timeout: number;
|
|
46
|
-
}): Promise<
|
|
47
|
-
sendBatch(provider: ContractProvider, secretKey: Buffer, messages: OutActionSendMsg[], subwallet: number, timeout: number, createdAt?: number, value?: bigint): Promise<
|
|
48
|
+
}): Promise<string>;
|
|
49
|
+
sendBatch(provider: ContractProvider, secretKey: Buffer, messages: OutActionSendMsg[], subwallet: number, timeout: number, createdAt?: number, value?: bigint): Promise<string>;
|
|
48
50
|
getQueryIdFromCreatedAt(createdAt: number): HighloadQueryId;
|
|
49
51
|
getExternalMessage(messages: MessageRelaxed[], sendMode: SendMode, value: bigint, queryId: HighloadQueryId): MessageRelaxed;
|
|
50
52
|
static createInternalTransferBody(opts: {
|
|
@@ -30,9 +30,15 @@ class HighloadWalletV3 {
|
|
|
30
30
|
async getSeqno() {
|
|
31
31
|
return 0; // will not be used
|
|
32
32
|
}
|
|
33
|
+
async send(provider, msg) {
|
|
34
|
+
await provider.external(msg);
|
|
35
|
+
}
|
|
36
|
+
createTransfer() {
|
|
37
|
+
throw new Error('Not implemented. Use sendTransfer instead - it returns the BOC as a string');
|
|
38
|
+
}
|
|
33
39
|
async sendTransfer(provider, args) {
|
|
34
40
|
if (!args.messages.length) {
|
|
35
|
-
return;
|
|
41
|
+
return '';
|
|
36
42
|
}
|
|
37
43
|
const state = await provider.getState();
|
|
38
44
|
const isActive = state.state.type === 'active';
|
|
@@ -43,7 +49,7 @@ class HighloadWalletV3 {
|
|
|
43
49
|
mode: args.sendMode,
|
|
44
50
|
outMsg: msg,
|
|
45
51
|
}));
|
|
46
|
-
await this.sendBatch(provider, args.secretKey, actions, subwalletId, timeout, args.createdAt);
|
|
52
|
+
return await this.sendBatch(provider, args.secretKey, actions, subwalletId, timeout, args.createdAt);
|
|
47
53
|
}
|
|
48
54
|
static create(config, code = HIGHLOAD_V3_CODE, workchain = 0) {
|
|
49
55
|
const data = highloadWalletV3ConfigToCell(config);
|
|
@@ -72,7 +78,12 @@ class HighloadWalletV3 {
|
|
|
72
78
|
.storeUint(opts.createdAt, exports.TIMESTAMP_SIZE)
|
|
73
79
|
.storeUint(opts.timeout, exports.TIMEOUT_SIZE)
|
|
74
80
|
.endCell();
|
|
75
|
-
|
|
81
|
+
const externalMessage = (0, ton_1.beginCell)()
|
|
82
|
+
.storeBuffer((0, ton_crypto_1.sign)(messageInner.hash(), secretKey))
|
|
83
|
+
.storeRef(messageInner)
|
|
84
|
+
.endCell();
|
|
85
|
+
await provider.external(externalMessage);
|
|
86
|
+
return externalMessage.toBoc().toString('base64');
|
|
76
87
|
}
|
|
77
88
|
async sendBatch(provider, secretKey, messages, subwallet, timeout, createdAt, value = 0n) {
|
|
78
89
|
if (createdAt == undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonappchain/sdk",
|
|
3
|
-
"version": "0.7.2-payload-builder-0.
|
|
3
|
+
"version": "0.7.2-payload-builder-0.3",
|
|
4
4
|
"repository": "https://github.com/TacBuild/tac-sdk.git",
|
|
5
5
|
"author": "TAC. <developers@tac>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@aws-crypto/sha256-js": "^5.2.0",
|
|
71
71
|
"@orbs-network/ton-access": "^2.3.3",
|
|
72
|
-
"@ton/ton": "
|
|
72
|
+
"@ton/ton": "^16.1.0",
|
|
73
73
|
"@tonappchain/ton-lite-client": "3.0.6",
|
|
74
74
|
"@tonconnect/ui": "^2.0.11",
|
|
75
75
|
"bn.js": "^5.2.1",
|