@dynamic-labs/ton 4.77.2 → 4.77.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/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ ### [4.77.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.77.2...v4.77.3) (2026-04-18)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * **ton:** convert sendBalance amount to smallest units ([#10941](https://github.com/dynamic-labs/dynamic-auth/issues/10941)) ([5eac6be](https://github.com/dynamic-labs/dynamic-auth/commit/5eac6be1c3444525893e6e5e95ce65f6c9f9dea3))
8
+
2
9
  ### [4.77.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.77.1...v4.77.2) (2026-04-16)
3
10
 
4
11
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.77.2";
6
+ var version = "4.77.3";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.77.2";
2
+ var version = "4.77.3";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ton",
3
- "version": "4.77.2",
3
+ "version": "4.77.3",
4
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -19,14 +19,14 @@
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
21
  "@dynamic-labs-sdk/client": "0.24.0",
22
- "@dynamic-labs/assert-package-version": "4.77.2",
23
- "@dynamic-labs/logger": "4.77.2",
22
+ "@dynamic-labs/assert-package-version": "4.77.3",
23
+ "@dynamic-labs/logger": "4.77.3",
24
24
  "@dynamic-labs/sdk-api-core": "0.0.927",
25
- "@dynamic-labs/types": "4.77.2",
26
- "@dynamic-labs/utils": "4.77.2",
27
- "@dynamic-labs/waas": "4.77.2",
28
- "@dynamic-labs/wallet-book": "4.77.2",
29
- "@dynamic-labs/wallet-connector-core": "4.77.2",
25
+ "@dynamic-labs/types": "4.77.3",
26
+ "@dynamic-labs/utils": "4.77.3",
27
+ "@dynamic-labs/waas": "4.77.3",
28
+ "@dynamic-labs/wallet-book": "4.77.3",
29
+ "@dynamic-labs/wallet-connector-core": "4.77.3",
30
30
  "@ton/core": "0.62.0",
31
31
  "@ton/crypto": "3.3.0",
32
32
  "@ton/ton": "16.0.0",
@@ -22,6 +22,7 @@ const DEFAULT_FORWARD_TON_AMOUNT = BigInt(1);
22
22
  class TonWallet extends walletConnectorCore.Wallet {
23
23
  constructor(props) {
24
24
  super(props);
25
+ this.toSmallestUnit = (amount, decimals) => BigInt(Math.floor(parseFloat(amount) * Math.pow(10, decimals)));
25
26
  }
26
27
  /**
27
28
  * Send TON (native currency) to an address
@@ -34,9 +35,8 @@ class TonWallet extends walletConnectorCore.Wallet {
34
35
  sendTon(to, amount, comment) {
35
36
  return _tslib.__awaiter(this, void 0, void 0, function* () {
36
37
  const amountStr = typeof amount === 'number' ? amount.toString() : amount;
37
- const amountNano = BigInt(Math.floor(parseFloat(amountStr) * 1000000000));
38
38
  const hash = yield this.sendBalance({
39
- amount: amountNano.toString(),
39
+ amount: amountStr,
40
40
  comment,
41
41
  toAddress: to,
42
42
  });
@@ -55,18 +55,20 @@ class TonWallet extends walletConnectorCore.Wallet {
55
55
  */
56
56
  sendBalance(_a) {
57
57
  return _tslib.__awaiter(this, arguments, void 0, function* ({ amount, comment, toAddress, token, }) {
58
+ var _b;
59
+ yield this._connector.validateActiveWallet(this.address);
58
60
  if (token === null || token === void 0 ? void 0 : token.address) {
59
61
  return this.sendJettonViaConnector({
60
62
  forwardPayload: comment,
61
63
  forwardTonAmount: DEFAULT_FORWARD_TON_AMOUNT,
62
- jettonAmount: BigInt(amount),
64
+ jettonAmount: this.toSmallestUnit(amount, (_b = token.decimals) !== null && _b !== void 0 ? _b : 0),
63
65
  jettonMasterAddress: token.address,
64
66
  recipientAddress: toAddress,
65
67
  });
66
68
  }
67
69
  const result = yield this._connector.sendTransaction({
68
70
  messages: [
69
- Object.assign({ address: toAddress, amount: amount }, (comment
71
+ Object.assign({ address: toAddress, amount: this.toSmallestUnit(amount, 9).toString() }, (comment
70
72
  ? { payload: this._connector.encodeComment(comment) }
71
73
  : {})),
72
74
  ],
@@ -68,4 +68,5 @@ export declare class TonWallet extends Wallet<TonConnectConnector> {
68
68
  name: string;
69
69
  }>;
70
70
  private sendJettonViaConnector;
71
+ private toSmallestUnit;
71
72
  }
@@ -18,6 +18,7 @@ const DEFAULT_FORWARD_TON_AMOUNT = BigInt(1);
18
18
  class TonWallet extends Wallet {
19
19
  constructor(props) {
20
20
  super(props);
21
+ this.toSmallestUnit = (amount, decimals) => BigInt(Math.floor(parseFloat(amount) * Math.pow(10, decimals)));
21
22
  }
22
23
  /**
23
24
  * Send TON (native currency) to an address
@@ -30,9 +31,8 @@ class TonWallet extends Wallet {
30
31
  sendTon(to, amount, comment) {
31
32
  return __awaiter(this, void 0, void 0, function* () {
32
33
  const amountStr = typeof amount === 'number' ? amount.toString() : amount;
33
- const amountNano = BigInt(Math.floor(parseFloat(amountStr) * 1000000000));
34
34
  const hash = yield this.sendBalance({
35
- amount: amountNano.toString(),
35
+ amount: amountStr,
36
36
  comment,
37
37
  toAddress: to,
38
38
  });
@@ -51,18 +51,20 @@ class TonWallet extends Wallet {
51
51
  */
52
52
  sendBalance(_a) {
53
53
  return __awaiter(this, arguments, void 0, function* ({ amount, comment, toAddress, token, }) {
54
+ var _b;
55
+ yield this._connector.validateActiveWallet(this.address);
54
56
  if (token === null || token === void 0 ? void 0 : token.address) {
55
57
  return this.sendJettonViaConnector({
56
58
  forwardPayload: comment,
57
59
  forwardTonAmount: DEFAULT_FORWARD_TON_AMOUNT,
58
- jettonAmount: BigInt(amount),
60
+ jettonAmount: this.toSmallestUnit(amount, (_b = token.decimals) !== null && _b !== void 0 ? _b : 0),
59
61
  jettonMasterAddress: token.address,
60
62
  recipientAddress: toAddress,
61
63
  });
62
64
  }
63
65
  const result = yield this._connector.sendTransaction({
64
66
  messages: [
65
- Object.assign({ address: toAddress, amount: amount }, (comment
67
+ Object.assign({ address: toAddress, amount: this.toSmallestUnit(amount, 9).toString() }, (comment
66
68
  ? { payload: this._connector.encodeComment(comment) }
67
69
  : {})),
68
70
  ],