@dynamic-labs/ton 4.60.0 → 4.61.0

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 (40) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +9 -9
  5. package/src/TonWalletConnector.cjs +1 -1
  6. package/src/TonWalletConnector.js +1 -1
  7. package/src/connectors/TonConnectConnector/TonConnectConnector.cjs +709 -0
  8. package/src/connectors/TonConnectConnector/TonConnectConnector.d.ts +169 -0
  9. package/src/connectors/TonConnectConnector/TonConnectConnector.js +705 -0
  10. package/src/connectors/TonConnectConnector/index.d.ts +1 -0
  11. package/src/consts.d.ts +4 -0
  12. package/src/index.cjs +11 -5
  13. package/src/index.d.ts +6 -1
  14. package/src/index.js +8 -3
  15. package/src/types.d.ts +61 -1
  16. package/src/utils/debugLog/debugLog.cjs +55 -0
  17. package/src/utils/debugLog/debugLog.d.ts +34 -0
  18. package/src/utils/debugLog/debugLog.js +49 -0
  19. package/src/utils/debugLog/index.d.ts +1 -0
  20. package/src/utils/fetchTonWalletConnectors/fetchTonWalletConnectors.cjs +113 -0
  21. package/src/utils/fetchTonWalletConnectors/fetchTonWalletConnectors.d.ts +41 -0
  22. package/src/utils/fetchTonWalletConnectors/fetchTonWalletConnectors.js +108 -0
  23. package/src/utils/fetchTonWalletConnectors/index.d.ts +1 -0
  24. package/src/utils/index.d.ts +1 -0
  25. package/src/waas/connector/DynamicWaasTonConnector.d.ts +6 -9
  26. package/src/wallet/TonWallet/TonWallet.cjs +140 -0
  27. package/src/wallet/TonWallet/TonWallet.d.ts +65 -0
  28. package/src/wallet/TonWallet/TonWallet.js +136 -0
  29. package/src/wallet/TonWallet/index.d.ts +1 -0
  30. package/src/wallet/WaasTonWallet.cjs +1 -1
  31. package/src/wallet/WaasTonWallet.js +1 -1
  32. package/src/wallet/isTonWallet/isTonWallet.cjs +7 -1
  33. package/src/wallet/isTonWallet/isTonWallet.d.ts +7 -1
  34. package/src/wallet/isTonWallet/isTonWallet.js +7 -1
  35. package/src/TonWalletConnectors.cjs +0 -13
  36. package/src/TonWalletConnectors.d.ts +0 -2
  37. package/src/TonWalletConnectors.js +0 -9
  38. package/src/wallet/TonWallet.cjs +0 -109
  39. package/src/wallet/TonWallet.d.ts +0 -60
  40. package/src/wallet/TonWallet.js +0 -105
@@ -1,105 +0,0 @@
1
- 'use client'
2
- import { __awaiter } from '../../_virtual/_tslib.js';
3
- import { Wallet } from '@dynamic-labs/wallet-connector-core';
4
- import { prepareTonTransfer } from '../utils/prepareTonTransfer/prepareTonTransfer.js';
5
- import { prepareJettonTransfer } from '../utils/prepareJettonTransfer/prepareJettonTransfer.js';
6
-
7
- /**
8
- * Base TonWallet class for TON blockchain wallets.
9
- * Provides core functionality for interacting with TON wallets.
10
- */
11
- class TonWallet extends Wallet {
12
- /**
13
- * Get the TonClient for interacting with the TON blockchain.
14
- * @param chainId - Optional chain ID to get client for specific network
15
- * @returns TonClient instance
16
- */
17
- getTonClient(chainId) {
18
- return this._connector.getTonClient(chainId);
19
- }
20
- /**
21
- * Generates a TON Connect proof for authentication.
22
- * @param payload - The payload string to include in the proof
23
- * @returns Complete TON Connect proof object
24
- */
25
- generateTonConnectProof(payload) {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- yield this.sync();
28
- return this._connector.generateTonConnectProof(payload);
29
- });
30
- }
31
- /**
32
- * Signs a message with the wallet.
33
- * @param message - The message to sign
34
- * @returns The signature as a string
35
- */
36
- signMessage(message) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- yield this.sync();
39
- return this._connector.signMessage(message);
40
- });
41
- }
42
- /**
43
- * Sends a TON Connect transaction.
44
- * @param request - The SendTransactionRequest containing messages to send
45
- * @returns The transaction hash
46
- */
47
- sendTransaction(request) {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- yield this.sync();
50
- return this._connector.sendTransaction(request);
51
- });
52
- }
53
- /**
54
- * Sends native TON to a given address.
55
- * @param amount - The amount in TON (will be converted to nanotons)
56
- * @param toAddress - The recipient address
57
- * @returns The transaction hash
58
- */
59
- sendBalance(_a) {
60
- return __awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
61
- yield this.sync();
62
- const client = this.getTonClient();
63
- const network = (yield this._connector.getNetwork());
64
- const request = yield prepareTonTransfer({
65
- amount,
66
- client,
67
- network,
68
- recipient: toAddress,
69
- timeout: 60,
70
- walletAddress: this.address,
71
- });
72
- return this.sendTransaction(request);
73
- });
74
- }
75
- /**
76
- * Sends jettons (non-native tokens) to a given address.
77
- * @param jettonMasterAddress - The jetton master contract address
78
- * @param recipientAddress - The recipient's main wallet address
79
- * @param jettonAmount - Amount of jettons in base units (bigint)
80
- * @param forwardTonAmount - TON amount to forward with notification (bigint)
81
- * @param forwardPayload - Optional comment/memo
82
- * @returns The transaction hash
83
- */
84
- sendJetton(_a) {
85
- return __awaiter(this, arguments, void 0, function* ({ jettonMasterAddress, recipientAddress, jettonAmount, forwardTonAmount, forwardPayload, }) {
86
- yield this.sync();
87
- const client = this.getTonClient();
88
- const network = (yield this._connector.getNetwork());
89
- const request = yield prepareJettonTransfer({
90
- client,
91
- forwardPayload,
92
- forwardTonAmount,
93
- jettonAmount,
94
- jettonMasterAddress,
95
- network,
96
- recipientAddress,
97
- timeout: 60,
98
- walletAddress: this.address,
99
- });
100
- return this.sendTransaction(request);
101
- });
102
- }
103
- }
104
-
105
- export { TonWallet };