@dynamic-labs/sui-core 4.35.0 → 4.36.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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
1
 
2
+ ## [4.36.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.35.0...v4.36.0) (2025-10-03)
3
+
4
+
5
+ ### Features
6
+
7
+ * add refresh/reshare settings on next login ([#9611](https://github.com/dynamic-labs/dynamic-auth/issues/9611)) ([49ce9a9](https://github.com/dynamic-labs/dynamic-auth/commit/49ce9a920bd3b4f7e7a4c3227bd8ecf2e6d0e37d))
8
+ * add waas mpc reshare on connectors ([#9610](https://github.com/dynamic-labs/dynamic-auth/issues/9610)) ([15394df](https://github.com/dynamic-labs/dynamic-auth/commit/15394dfb35c279b86c440066295eb8f3b8b1e342))
9
+ * send non-native tokens with sui sendbalance ([#9620](https://github.com/dynamic-labs/dynamic-auth/issues/9620)) ([c2c2b2b](https://github.com/dynamic-labs/dynamic-auth/commit/c2c2b2b5108933acf0858c61f96c902868531737))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * send balance input alignment ([#9617](https://github.com/dynamic-labs/dynamic-auth/issues/9617)) ([00d9f7c](https://github.com/dynamic-labs/dynamic-auth/commit/00d9f7cfd9e77660be8855367dbb14b139b6f146))
15
+
2
16
  ## [4.35.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.34.0...v4.35.0) (2025-10-02)
3
17
 
4
18
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.35.0";
6
+ var version = "4.36.0";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.35.0";
2
+ var version = "4.36.0";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sui-core",
3
- "version": "4.35.0",
3
+ "version": "4.36.0",
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",
@@ -22,13 +22,13 @@
22
22
  "@mysten/wallet-standard": "0.13.29",
23
23
  "@mysten/sui": "1.24.0",
24
24
  "text-encoding": "0.7.0",
25
- "@dynamic-labs/assert-package-version": "4.35.0",
26
- "@dynamic-labs/logger": "4.35.0",
27
- "@dynamic-labs/rpc-providers": "4.35.0",
28
- "@dynamic-labs/types": "4.35.0",
29
- "@dynamic-labs/utils": "4.35.0",
30
- "@dynamic-labs/wallet-book": "4.35.0",
31
- "@dynamic-labs/wallet-connector-core": "4.35.0"
25
+ "@dynamic-labs/assert-package-version": "4.36.0",
26
+ "@dynamic-labs/logger": "4.36.0",
27
+ "@dynamic-labs/rpc-providers": "4.36.0",
28
+ "@dynamic-labs/types": "4.36.0",
29
+ "@dynamic-labs/utils": "4.36.0",
30
+ "@dynamic-labs/wallet-book": "4.36.0",
31
+ "@dynamic-labs/wallet-connector-core": "4.36.0"
32
32
  },
33
33
  "peerDependencies": {}
34
34
  }
@@ -16,9 +16,34 @@ class SuiWallet extends walletConnectorCore.Wallet {
16
16
  * @returns The transaction as base64 encoded bcs.
17
17
  */
18
18
  sendBalance(_a) {
19
- return _tslib.__awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
19
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ amount, toAddress, token, }) {
20
+ var _b, _c;
20
21
  yield this._connector.connect();
21
22
  const transaction = new transactions.Transaction();
23
+ if (token === null || token === void 0 ? void 0 : token.address) {
24
+ const suiClient = yield this.getSuiClient();
25
+ if (!suiClient) {
26
+ throw new Error('SUI client not found');
27
+ }
28
+ const { data: coins } = yield suiClient.getCoins({
29
+ coinType: token.address,
30
+ owner: this.address,
31
+ });
32
+ if (coins.length === 0) {
33
+ throw new Error('Token not found');
34
+ }
35
+ const decimals = (_b = token.decimals) !== null && _b !== void 0 ? _b : (_c = (yield suiClient.getCoinMetadata({
36
+ coinType: token.address,
37
+ }))) === null || _c === void 0 ? void 0 : _c.decimals;
38
+ const [coin] = transaction.splitCoins(coins[0].coinObjectId, [
39
+ BigInt(parseFloat(amount) * Math.pow(10, (decimals !== null && decimals !== void 0 ? decimals : 0))),
40
+ ]);
41
+ transaction.transferObjects([coin], toAddress);
42
+ const result = yield this.signAndExecuteTransaction({
43
+ transaction,
44
+ });
45
+ return result.digest;
46
+ }
22
47
  const mistAmount = Number(amount) * constants.MIST_PER_SUI;
23
48
  // Let the transaction calculate gas automatically
24
49
  // https://sdk.mystenlabs.com/typescript/transaction-building/gas#gas-price
@@ -11,7 +11,7 @@ export declare class SuiWallet extends Wallet<SuiWalletConnector> {
11
11
  * @param toAddress - The address to send the balance to.
12
12
  * @returns The transaction as base64 encoded bcs.
13
13
  */
14
- sendBalance({ amount, toAddress, }: SuiSendBalanceProps): Promise<string>;
14
+ sendBalance({ amount, toAddress, token, }: SuiSendBalanceProps): Promise<string>;
15
15
  /**
16
16
  * Returns the Sui Client object initialized for the wallet's current network.
17
17
  * @returns The [SuiClient] object.
@@ -12,9 +12,34 @@ class SuiWallet extends Wallet {
12
12
  * @returns The transaction as base64 encoded bcs.
13
13
  */
14
14
  sendBalance(_a) {
15
- return __awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
15
+ return __awaiter(this, arguments, void 0, function* ({ amount, toAddress, token, }) {
16
+ var _b, _c;
16
17
  yield this._connector.connect();
17
18
  const transaction = new Transaction();
19
+ if (token === null || token === void 0 ? void 0 : token.address) {
20
+ const suiClient = yield this.getSuiClient();
21
+ if (!suiClient) {
22
+ throw new Error('SUI client not found');
23
+ }
24
+ const { data: coins } = yield suiClient.getCoins({
25
+ coinType: token.address,
26
+ owner: this.address,
27
+ });
28
+ if (coins.length === 0) {
29
+ throw new Error('Token not found');
30
+ }
31
+ const decimals = (_b = token.decimals) !== null && _b !== void 0 ? _b : (_c = (yield suiClient.getCoinMetadata({
32
+ coinType: token.address,
33
+ }))) === null || _c === void 0 ? void 0 : _c.decimals;
34
+ const [coin] = transaction.splitCoins(coins[0].coinObjectId, [
35
+ BigInt(parseFloat(amount) * Math.pow(10, (decimals !== null && decimals !== void 0 ? decimals : 0))),
36
+ ]);
37
+ transaction.transferObjects([coin], toAddress);
38
+ const result = yield this.signAndExecuteTransaction({
39
+ transaction,
40
+ });
41
+ return result.digest;
42
+ }
18
43
  const mistAmount = Number(amount) * MIST_PER_SUI;
19
44
  // Let the transaction calculate gas automatically
20
45
  // https://sdk.mystenlabs.com/typescript/transaction-building/gas#gas-price