@tonappchain/sdk 0.6.4 → 0.7.0-rc6

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.
Files changed (67) hide show
  1. package/dist/adapters/contractOpener.d.ts +1 -1
  2. package/dist/adapters/contractOpener.js +7 -8
  3. package/dist/adapters/retryableContractOpener.d.ts +21 -0
  4. package/dist/adapters/retryableContractOpener.js +101 -0
  5. package/dist/assets/AssetFactory.d.ts +13 -0
  6. package/dist/assets/AssetFactory.js +73 -0
  7. package/dist/assets/FT.d.ts +58 -0
  8. package/dist/assets/FT.js +199 -0
  9. package/dist/assets/NFT.d.ts +60 -0
  10. package/dist/assets/NFT.js +170 -0
  11. package/dist/assets/TON.d.ts +38 -0
  12. package/dist/assets/TON.js +91 -0
  13. package/dist/assets/index.d.ts +4 -0
  14. package/dist/assets/index.js +11 -0
  15. package/dist/errors/errors.d.ts +6 -0
  16. package/dist/errors/errors.js +15 -1
  17. package/dist/errors/index.d.ts +2 -2
  18. package/dist/errors/index.js +26 -21
  19. package/dist/errors/instances.d.ts +9 -4
  20. package/dist/errors/instances.js +19 -5
  21. package/dist/index.d.ts +12 -6
  22. package/dist/index.js +24 -13
  23. package/dist/sdk/Configuration.d.ts +21 -0
  24. package/dist/sdk/Configuration.js +90 -0
  25. package/dist/sdk/Consts.js +2 -2
  26. package/dist/sdk/LiteSequencerClient.d.ts +1 -1
  27. package/dist/sdk/LiteSequencerClient.js +5 -11
  28. package/dist/sdk/Logger.d.ts +13 -0
  29. package/dist/sdk/Logger.js +25 -0
  30. package/dist/sdk/OperationTracker.d.ts +21 -6
  31. package/dist/sdk/OperationTracker.js +155 -75
  32. package/dist/sdk/Simulator.d.ts +23 -0
  33. package/dist/sdk/Simulator.js +169 -0
  34. package/dist/sdk/StartTracking.d.ts +6 -0
  35. package/dist/sdk/StartTracking.js +66 -29
  36. package/dist/sdk/TacSdk.d.ts +12 -41
  37. package/dist/sdk/TacSdk.js +69 -717
  38. package/dist/sdk/TransactionManager.d.ts +22 -0
  39. package/dist/sdk/TransactionManager.js +257 -0
  40. package/dist/sdk/TxFinalizer.d.ts +10 -0
  41. package/dist/sdk/TxFinalizer.js +104 -0
  42. package/dist/sdk/Utils.d.ts +12 -4
  43. package/dist/sdk/Utils.js +80 -16
  44. package/dist/sdk/Validator.d.ts +9 -0
  45. package/dist/sdk/Validator.js +43 -0
  46. package/dist/sender/BatchSender.d.ts +7 -4
  47. package/dist/sender/BatchSender.js +18 -6
  48. package/dist/sender/RawSender.d.ts +9 -4
  49. package/dist/sender/RawSender.js +46 -18
  50. package/dist/sender/SenderAbstraction.d.ts +5 -3
  51. package/dist/sender/SenderFactory.d.ts +1 -1
  52. package/dist/sender/SenderFactory.js +5 -4
  53. package/dist/sender/TonConnectSender.d.ts +5 -3
  54. package/dist/sender/TonConnectSender.js +12 -8
  55. package/dist/sender/index.d.ts +1 -1
  56. package/dist/sender/index.js +1 -1
  57. package/dist/structs/InternalStruct.d.ts +36 -33
  58. package/dist/structs/Services.d.ts +40 -0
  59. package/dist/structs/Services.js +2 -0
  60. package/dist/structs/Struct.d.ts +98 -79
  61. package/dist/structs/Struct.js +11 -1
  62. package/dist/wrappers/HighloadQueryId.js +0 -1
  63. package/dist/wrappers/HighloadWalletV3.d.ts +3 -2
  64. package/dist/wrappers/HighloadWalletV3.js +5 -2
  65. package/dist/wrappers/JettonWallet.d.ts +11 -2
  66. package/dist/wrappers/JettonWallet.js +34 -17
  67. package/package.json +3 -3
@@ -1,13 +1,15 @@
1
1
  import { SandboxContract } from '@ton/sandbox';
2
2
  import type { Address, Cell, Contract, OpenedContract } from '@ton/ton';
3
- import { AbstractProvider, Addressable, Interface, InterfaceAbi } from 'ethers';
3
+ import { AbstractProvider, Addressable } from 'ethers';
4
+ import { ILogger } from './Services';
5
+ export type ContractState = {
6
+ balance: bigint;
7
+ state: 'active' | 'uninitialized' | 'frozen';
8
+ code: Buffer | null;
9
+ };
4
10
  export interface ContractOpener {
5
11
  open<T extends Contract>(src: T): OpenedContract<T> | SandboxContract<T>;
6
- getContractState(address: Address): Promise<{
7
- balance: bigint;
8
- state: 'active' | 'uninitialized' | 'frozen';
9
- code: Buffer | null;
10
- }>;
12
+ getContractState(address: Address): Promise<ContractState>;
11
13
  closeConnections?: () => unknown;
12
14
  }
13
15
  export declare enum SimplifiedStatuses {
@@ -41,30 +43,6 @@ export type TACParams = {
41
43
  * Address of TAC settings contract. Use only for tests.
42
44
  */
43
45
  settingsAddress?: string | Addressable;
44
- /**
45
- * ABI of TAC settings contract. Use only for tests.
46
- */
47
- settingsABI?: Interface | InterfaceAbi;
48
- /**
49
- * ABI of TAC CCL contract. Use only for tests.
50
- */
51
- crossChainLayerABI?: Interface | InterfaceAbi;
52
- /**
53
- * ABI of TAC CrossChainLayerToken contract. Use only for tests.
54
- */
55
- crossChainLayerTokenABI?: Interface | InterfaceAbi;
56
- /**
57
- * bytecode of TAC CrossChainLayerToken contract. Use only for tests.
58
- */
59
- crossChainLayerTokenBytecode?: string;
60
- /**
61
- * ABI of TAC CrossChainLayerNFT contract. Use only for tests.
62
- */
63
- crossChainLayerNFTABI?: Interface | InterfaceAbi;
64
- /**
65
- * bytecode of TAC CrossChainLayerNFT contract. Use only for tests.
66
- */
67
- crossChainLayerNFTBytecode?: string;
68
46
  };
69
47
  export type TONParams = {
70
48
  /**
@@ -106,52 +84,6 @@ export declare enum NFTAddressType {
106
84
  ITEM = "ITEM",
107
85
  COLLECTION = "COLLECTION"
108
86
  }
109
- export type WithAddressFT = {
110
- type: AssetType.FT;
111
- /**
112
- * Address of TAC or TON token.
113
- * Empty if sending native TON coin.
114
- */
115
- address?: string;
116
- };
117
- export type WithAddressNFTItem = {
118
- type: AssetType.NFT;
119
- /**
120
- * Address NFT item token.
121
- */
122
- address: string;
123
- };
124
- export type WithAddressNFTCollectionItem = {
125
- type: AssetType.NFT;
126
- /**
127
- * Address NFT collection.
128
- */
129
- collectionAddress: string;
130
- /**
131
- * Index of NFT item in collection.
132
- */
133
- itemIndex: bigint;
134
- };
135
- export type WithAddressNFT = WithAddressNFTItem | WithAddressNFTCollectionItem;
136
- export type WithAddress = WithAddressFT | WithAddressNFT;
137
- export type RawAssetBridgingData<NFTFormatRequired extends WithAddressNFT = WithAddressNFTItem> = {
138
- /** Raw format, e.g. 12340000000 (=12.34 tokens if decimals is 9) */
139
- rawAmount: bigint;
140
- } & (WithAddressFT | NFTFormatRequired);
141
- export type UserFriendlyAssetBridgingData = {
142
- /**
143
- * User friendly format, e.g. 12.34 tokens
144
- * Specified value will be converted automatically to raw format: 12.34 * (10^decimals).
145
- * No decimals should be specified.
146
- */
147
- amount: number;
148
- /**
149
- * Decimals may be specified manually.
150
- * Otherwise, SDK tries to extract them from chain.
151
- */
152
- decimals?: number;
153
- } & WithAddress;
154
- export type AssetBridgingData = RawAssetBridgingData | UserFriendlyAssetBridgingData;
155
87
  export type UserWalletBalanceExtended = {
156
88
  exists: true;
157
89
  amount: number;
@@ -165,6 +97,7 @@ export type EvmProxyMsg = {
165
97
  methodName?: string;
166
98
  encodedParameters?: string;
167
99
  gasLimit?: bigint;
100
+ [key: string]: unknown;
168
101
  };
169
102
  export type TransactionLinker = {
170
103
  caller: string;
@@ -173,6 +106,9 @@ export type TransactionLinker = {
173
106
  timestamp: number;
174
107
  sendTransactionResult?: unknown;
175
108
  };
109
+ export type TransactionLinkerWithOperationId = TransactionLinker & {
110
+ operationId?: string;
111
+ };
176
112
  export type TACSimulationRequest = {
177
113
  tacCallParams: {
178
114
  arguments: string;
@@ -180,6 +116,7 @@ export type TACSimulationRequest = {
180
116
  target: string;
181
117
  };
182
118
  evmValidExecutors: string[];
119
+ tvmValidExecutors: string[];
183
120
  extraData: string;
184
121
  shardsKey: string;
185
122
  tonAssets: {
@@ -237,14 +174,38 @@ export type GeneralFeeInfo = {
237
174
  executorFee: string;
238
175
  tokenFeeSymbol: TokenSymbol;
239
176
  };
177
+ export type AdditionalFeeInfo = {
178
+ attachedProtocolFee: string;
179
+ tokenFeeSymbol: TokenSymbol;
180
+ };
240
181
  export type FeeInfo = {
182
+ additionalFeeInfo: AdditionalFeeInfo;
241
183
  tac: GeneralFeeInfo;
242
184
  ton: GeneralFeeInfo;
243
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
+ };
244
203
  export type MetaInfo = {
245
204
  initialCaller: InitialCallerInfo;
246
205
  validExecutors: ValidExecutors;
247
206
  feeInfo: FeeInfo;
207
+ sentAssets: AssetMovementInfo;
208
+ receivedAssets: AssetMovementInfo;
248
209
  };
249
210
  export type ExecutionStages = {
250
211
  operationType: OperationType;
@@ -311,7 +272,7 @@ export type FeeParams = {
311
272
  tvmExecutorFee: bigint;
312
273
  };
313
274
  export type CrossChainTransactionOptions = {
314
- forceSend?: boolean;
275
+ allowSimulationError?: boolean;
315
276
  isRoundTrip?: boolean;
316
277
  protocolFee?: bigint;
317
278
  evmValidExecutors?: string[];
@@ -321,11 +282,11 @@ export type CrossChainTransactionOptions = {
321
282
  };
322
283
  export type ExecutionFeeEstimationResult = {
323
284
  feeParams: FeeParams;
324
- simulation: TACSimulationResult;
285
+ simulation?: TACSimulationResult;
325
286
  };
326
287
  export type CrosschainTx = {
327
288
  evmProxyMsg: EvmProxyMsg;
328
- assets?: AssetBridgingData[];
289
+ assets?: Asset[];
329
290
  options?: CrossChainTransactionOptions;
330
291
  };
331
292
  export type NFTItemData = {
@@ -335,3 +296,61 @@ export type NFTItemData = {
335
296
  ownerAddress: Address | null;
336
297
  content: Cell | null;
337
298
  };
299
+ export interface WaitOptions<T = unknown> {
300
+ /**
301
+ * Timeout in milliseconds
302
+ * @default 300000 (5 minutes)
303
+ */
304
+ timeout?: number;
305
+ /**
306
+ * Maximum number of attempts
307
+ * @default 30
308
+ */
309
+ maxAttempts?: number;
310
+ /**
311
+ * Delay between attempts in milliseconds
312
+ * @default 10000 (10 seconds)
313
+ */
314
+ delay?: number;
315
+ /**
316
+ * Logger
317
+ */
318
+ logger?: ILogger;
319
+ /**
320
+ * Function to check if the result is successful
321
+ * If not provided, any non-error result is considered successful
322
+ */
323
+ successCheck?: (result: T) => boolean;
324
+ }
325
+ export declare const defaultWaitOptions: WaitOptions;
326
+ export interface Asset {
327
+ address: string;
328
+ type: AssetType;
329
+ rawAmount: bigint;
330
+ clone: Asset;
331
+ withAmount(amount: {
332
+ rawAmount: bigint;
333
+ } | {
334
+ amount: number;
335
+ }): Promise<Asset>;
336
+ addAmount(amount: {
337
+ rawAmount: bigint;
338
+ } | {
339
+ amount: number;
340
+ }): Promise<Asset>;
341
+ getEVMAddress(): Promise<string>;
342
+ getTVMAddress(): Promise<string>;
343
+ generatePayload(params: {
344
+ excessReceiver: string;
345
+ evmData: Cell;
346
+ crossChainTonAmount?: bigint;
347
+ forwardFeeTonAmount?: bigint;
348
+ feeParams?: FeeParams;
349
+ }): Promise<Cell>;
350
+ checkCanBeTransferedBy(userAddress: string): Promise<void>;
351
+ getBalanceOf(userAddress: string): Promise<bigint>;
352
+ }
353
+ export declare enum Origin {
354
+ TON = "TON",
355
+ TAC = "TAC"
356
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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.BlockchainType = exports.Network = exports.SimplifiedStatuses = void 0;
4
4
  var SimplifiedStatuses;
5
5
  (function (SimplifiedStatuses) {
6
6
  SimplifiedStatuses["PENDING"] = "PENDING";
@@ -51,3 +51,13 @@ var TokenSymbol;
51
51
  TokenSymbol["TAC_SYMBOL"] = "TAC";
52
52
  TokenSymbol["TON_SYMBOL"] = "TON";
53
53
  })(TokenSymbol || (exports.TokenSymbol = TokenSymbol = {}));
54
+ exports.defaultWaitOptions = {
55
+ timeout: 300000,
56
+ maxAttempts: 30,
57
+ delay: 10000,
58
+ };
59
+ var Origin;
60
+ (function (Origin) {
61
+ Origin["TON"] = "TON";
62
+ Origin["TAC"] = "TAC";
63
+ })(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
- import { HighloadQueryId } from './HighloadQueryId';
3
2
  import { WalletInstance } from '../sender';
3
+ import { HighloadQueryId } from './HighloadQueryId';
4
4
  export declare enum OP {
5
5
  InternalTransfer = 2923619748
6
6
  }
@@ -24,7 +24,7 @@ export declare class HighloadWalletV3 implements WalletInstance {
24
24
  code: Cell;
25
25
  data: Cell;
26
26
  } | undefined);
27
- getSeqno(_: ContractProvider): Promise<number>;
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 = Math.floor(Date.now() / 1000) - 40; // -40 is used to pass check created_at <= now() in smart contract for sure
79
+ createdAt = HighloadWalletV3.generateCreatedAt();
77
80
  }
78
81
  const queryId = this.getQueryIdFromCreatedAt(createdAt);
79
82
  return await this.sendExternalMessage(provider, secretKey, {
@@ -1,4 +1,4 @@
1
- import type { Contract, ContractProvider, Sender } from '@ton/ton';
1
+ import { Contract, ContractProvider, Sender } from '@ton/ton';
2
2
  import { Address, Cell } from '@ton/ton';
3
3
  export type JettonWalletData = {
4
4
  balance: bigint;
@@ -8,7 +8,8 @@ export type JettonWalletData = {
8
8
  };
9
9
  export declare enum JettonWalletOpCodes {
10
10
  burn = 1499400124,
11
- transfer = 260734629
11
+ transfer = 260734629,
12
+ internalTransfer = 395134233
12
13
  }
13
14
  export declare function jettonWalletConfigToCell(config: JettonWalletData): Cell;
14
15
  export declare class JettonWallet implements Contract {
@@ -42,6 +43,14 @@ export declare class JettonWallet implements Contract {
42
43
  forwardTonAmount?: bigint;
43
44
  forwardPayload?: Cell | null;
44
45
  }): Promise<void>;
46
+ sendReceive(provider: ContractProvider, via: Sender, value: bigint, opts: {
47
+ queryId?: number;
48
+ jettonAmount: number;
49
+ fromOwnerAddress?: string;
50
+ responseAddress?: string;
51
+ forwardTonAmount?: number;
52
+ forwardPayload?: Cell;
53
+ }): Promise<void>;
45
54
  getWalletData(provider: ContractProvider): Promise<JettonWalletData>;
46
55
  getJettonBalance(provider: ContractProvider): Promise<bigint>;
47
56
  }
@@ -3,16 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JettonWallet = exports.JettonWalletOpCodes = void 0;
4
4
  exports.jettonWalletConfigToCell = jettonWalletConfigToCell;
5
5
  const ton_1 = require("@ton/ton");
6
+ const ton_2 = require("@ton/ton");
6
7
  var JettonWalletOpCodes;
7
8
  (function (JettonWalletOpCodes) {
8
9
  JettonWalletOpCodes[JettonWalletOpCodes["burn"] = 1499400124] = "burn";
9
10
  JettonWalletOpCodes[JettonWalletOpCodes["transfer"] = 260734629] = "transfer";
11
+ JettonWalletOpCodes[JettonWalletOpCodes["internalTransfer"] = 395134233] = "internalTransfer";
10
12
  })(JettonWalletOpCodes || (exports.JettonWalletOpCodes = JettonWalletOpCodes = {}));
11
13
  function jettonWalletConfigToCell(config) {
12
- return (0, ton_1.beginCell)()
14
+ return (0, ton_2.beginCell)()
13
15
  .storeCoins(config.balance)
14
- .storeAddress(ton_1.Address.parse(config.ownerAddress))
15
- .storeAddress(ton_1.Address.parse(config.jettonMasterAddress))
16
+ .storeAddress(ton_2.Address.parse(config.ownerAddress))
17
+ .storeAddress(ton_2.Address.parse(config.jettonMasterAddress))
16
18
  .endCell();
17
19
  }
18
20
  class JettonWallet {
@@ -26,16 +28,16 @@ class JettonWallet {
26
28
  static createFromConfig(config, code, workchain = 0) {
27
29
  const data = jettonWalletConfigToCell(config);
28
30
  const init = { code, data };
29
- return new JettonWallet((0, ton_1.contractAddress)(workchain, init), init);
31
+ return new JettonWallet((0, ton_2.contractAddress)(workchain, init), init);
30
32
  }
31
33
  static burnMessage(jettonAmount, receiverAddress, crossChainTonAmount, feeData, crossChainPayload, queryId) {
32
- const body = (0, ton_1.beginCell)()
34
+ const body = (0, ton_2.beginCell)()
33
35
  .storeUint(JettonWalletOpCodes.burn, 32)
34
36
  .storeUint(queryId || 0, 64)
35
37
  .storeCoins(jettonAmount)
36
- .storeAddress(receiverAddress ? ton_1.Address.parse(receiverAddress) : null);
38
+ .storeAddress(receiverAddress ? ton_2.Address.parse(receiverAddress) : null);
37
39
  if (crossChainTonAmount || crossChainPayload) {
38
- body.storeMaybeRef((0, ton_1.beginCell)()
40
+ body.storeMaybeRef((0, ton_2.beginCell)()
39
41
  .storeCoins(crossChainTonAmount ?? 0n)
40
42
  .storeMaybeRef(feeData)
41
43
  .storeMaybeRef(crossChainPayload)
@@ -50,20 +52,20 @@ class JettonWallet {
50
52
  const body = JettonWallet.burnMessage(opts.jettonAmount, opts.receiverAddress, opts.crossChainTonAmount, opts.feeData, opts.crossChainPayload, opts.queryId);
51
53
  await provider.internal(via, {
52
54
  value,
53
- sendMode: ton_1.SendMode.PAY_GAS_SEPARATELY,
55
+ sendMode: ton_2.SendMode.PAY_GAS_SEPARATELY,
54
56
  body: body,
55
57
  });
56
58
  }
57
59
  static transferMessage(jettonAmount, to, responseAddress, forwardTonAmount, crossChainTonAmount, feeData, crossChainPayload, queryId) {
58
- return (0, ton_1.beginCell)()
60
+ return (0, ton_2.beginCell)()
59
61
  .storeUint(JettonWalletOpCodes.transfer, 32)
60
62
  .storeUint(queryId ?? 0, 64)
61
63
  .storeCoins(jettonAmount)
62
- .storeAddress(ton_1.Address.parse(to))
63
- .storeAddress(responseAddress ? ton_1.Address.parse(responseAddress) : null)
64
+ .storeAddress(ton_2.Address.parse(to))
65
+ .storeAddress(responseAddress ? ton_2.Address.parse(responseAddress) : null)
64
66
  .storeMaybeRef(null)
65
- .storeCoins((forwardTonAmount || 0n))
66
- .storeMaybeRef((0, ton_1.beginCell)()
67
+ .storeCoins(forwardTonAmount || 0n)
68
+ .storeMaybeRef((0, ton_2.beginCell)()
67
69
  .storeCoins(crossChainTonAmount ?? 0n)
68
70
  .storeMaybeRef(feeData)
69
71
  .storeMaybeRef(crossChainPayload)
@@ -73,19 +75,34 @@ class JettonWallet {
73
75
  async sendTransfer(provider, via, value, opts) {
74
76
  await provider.internal(via, {
75
77
  value,
76
- sendMode: ton_1.SendMode.PAY_GAS_SEPARATELY,
77
- body: (0, ton_1.beginCell)()
78
+ sendMode: ton_2.SendMode.PAY_GAS_SEPARATELY,
79
+ body: (0, ton_2.beginCell)()
78
80
  .storeUint(JettonWalletOpCodes.transfer, 32)
79
81
  .storeUint(opts.queryId || 0, 64)
80
82
  .storeCoins(opts.jettonAmount)
81
- .storeAddress(ton_1.Address.parse(opts.toOwnerAddress))
82
- .storeAddress(opts.responseAddress ? ton_1.Address.parse(opts.responseAddress) : null)
83
+ .storeAddress(ton_2.Address.parse(opts.toOwnerAddress))
84
+ .storeAddress(opts.responseAddress ? ton_2.Address.parse(opts.responseAddress) : null)
83
85
  .storeMaybeRef(opts.customPayload)
84
86
  .storeCoins(opts.forwardTonAmount ?? 0n)
85
87
  .storeMaybeRef(opts.forwardPayload)
86
88
  .endCell(),
87
89
  });
88
90
  }
91
+ async sendReceive(provider, via, value, opts) {
92
+ await provider.internal(via, {
93
+ value,
94
+ sendMode: ton_2.SendMode.PAY_GAS_SEPARATELY,
95
+ body: (0, ton_2.beginCell)()
96
+ .storeUint(JettonWalletOpCodes.internalTransfer, 32)
97
+ .storeUint(opts.queryId || 0, 64)
98
+ .storeCoins((0, ton_1.toNano)(opts.jettonAmount.toFixed(9)))
99
+ .storeAddress(opts.fromOwnerAddress ? ton_2.Address.parse(opts.fromOwnerAddress) : null)
100
+ .storeAddress(opts.responseAddress ? ton_2.Address.parse(opts.responseAddress) : null)
101
+ .storeCoins(opts.forwardTonAmount || 0)
102
+ .storeMaybeRef(opts.forwardPayload)
103
+ .endCell(),
104
+ });
105
+ }
89
106
  async getWalletData(provider) {
90
107
  const result = await provider.get('get_wallet_data', []);
91
108
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tonappchain/sdk",
3
- "version": "0.6.4",
3
+ "version": "0.7.0-rc6",
4
4
  "repository": "https://github.com/TacBuild/tac-sdk.git",
5
5
  "author": "TAC. <developers@tac>",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "@aws-crypto/sha256-js": "^5.2.0",
21
21
  "@orbs-network/ton-access": "^2.3.3",
22
22
  "@ton/ton": "15.1.0",
23
- "@tonappchain/artifacts": "0.0.18",
23
+ "@tonappchain/artifacts": "0.0.19-mainnet-rc2",
24
24
  "@tonappchain/ton-lite-client": "3.0.6",
25
25
  "@tonconnect/ui": "^2.0.11",
26
26
  "bn.js": "^5.2.1",
@@ -64,4 +64,4 @@
64
64
  }
65
65
  },
66
66
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
67
- }
67
+ }