@dynamic-labs/sui-core 5.12.1 → 5.12.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,34 @@
1
1
 
2
+ ### [5.12.3](https://github.com/dynamic-labs/dynamic-auth/compare/v5.12.2...v5.12.3) (2026-10-23)
3
+
4
+
5
+ ### Features
6
+
7
+ * accept recoveryEncryptionPublicKey in createOfflineRecoveryShares ([#12417](https://github.com/dynamic-labs/dynamic-auth/issues/12417)) ([7bb6dac](https://github.com/dynamic-labs/dynamic-auth/commit/7bb6dac56f4509fba46bc2afc9a37bcfb52aecc5))
8
+ * **client:** add loadId and sdk_bootstrap sub-stage to webview load failure meta ([#12576](https://github.com/dynamic-labs/dynamic-auth/issues/12576)) ([4f5254e](https://github.com/dynamic-labs/dynamic-auth/commit/4f5254e011afbaa20deb10300ea5fa92ae85e56d))
9
+ * **sui:** migrate SDK clients to gRPC ([#12446](https://github.com/dynamic-labs/dynamic-auth/issues/12446)) ([b6c04f3](https://github.com/dynamic-labs/dynamic-auth/commit/b6c04f32bead909439f1e24fb684eeaadd1692d2))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **client:** derive webview bootstrapStage from raw manifest timestamp ([#12578](https://github.com/dynamic-labs/dynamic-auth/issues/12578)) ([965263f](https://github.com/dynamic-labs/dynamic-auth/commit/965263f553d9b83d0fab7f42ed1e76053b514e45))
15
+ * **deps:** bump next 16.4.1 + toml/image-size floors (crit/high vulns) ([#12582](https://github.com/dynamic-labs/dynamic-auth/issues/12582)) ([ac732e4](https://github.com/dynamic-labs/dynamic-auth/commit/ac732e443d450be15f3362c9b59fc29dbe1f1727)), closes [#1163](https://github.com/dynamic-labs/dynamic-auth/issues/1163) [-#1166](https://github.com/dynamic-labs/-/issues/1166) [#1171](https://github.com/dynamic-labs/dynamic-auth/issues/1171) [#1172](https://github.com/dynamic-labs/dynamic-auth/issues/1172) [#1168](https://github.com/dynamic-labs/dynamic-auth/issues/1168) [-#1170](https://github.com/dynamic-labs/-/issues/1170) [#1014](https://github.com/dynamic-labs/dynamic-auth/issues/1014) [-#1019](https://github.com/dynamic-labs/-/issues/1019)
16
+ * **emudhra-fix:** move Maestro Cloud action off Node 20 (v1.9.9 to v3.0.1) ([#12568](https://github.com/dynamic-labs/dynamic-auth/issues/12568)) ([8282d84](https://github.com/dynamic-labs/dynamic-auth/commit/8282d8436edd2c5d7e339884e04a41922fc2581e))
17
+ * **sdk-react-core:** show signing wallet's network in SendBalanceTransactionCard [DYNT-2337] ([#12573](https://github.com/dynamic-labs/dynamic-auth/issues/12573)) ([4f78456](https://github.com/dynamic-labs/dynamic-auth/commit/4f78456b6100075156465b3f5efd0c760b2465ef)), closes [#12063](https://github.com/dynamic-labs/dynamic-auth/issues/12063)
18
+ * **wallet-book:** add a separate OKX Exchange entry ([#12564](https://github.com/dynamic-labs/dynamic-auth/issues/12564)) ([b4dc2ad](https://github.com/dynamic-labs/dynamic-auth/commit/b4dc2adab5a6bc75a1ba96c4f5d6b713dc0fc217))
19
+ * **wallet-book:** open OKX Wallet app for OKX Wallet connections ([#12563](https://github.com/dynamic-labs/dynamic-auth/issues/12563)) ([182bfa7](https://github.com/dynamic-labs/dynamic-auth/commit/182bfa714c883d010333a9d2e4cd748888a2a0d9))
20
+ * **wallet-connect:** send http(s) redirect URLs as universal redirects ([#12565](https://github.com/dynamic-labs/dynamic-auth/issues/12565)) ([ae11460](https://github.com/dynamic-labs/dynamic-auth/commit/ae11460a6d07c843e150932a895ca1462192ef28))
21
+
22
+ ### [5.12.2](https://github.com/dynamic-labs/dynamic-auth/compare/v5.12.1...v5.12.2) (2026-10-21)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **deps:** patch follow-redirects GHSA-8r9p-f939-6h3c and bump test-app next to 16.3.8 ([#12554](https://github.com/dynamic-labs/dynamic-auth/issues/12554)) ([a4df20f](https://github.com/dynamic-labs/dynamic-auth/commit/a4df20f5c5742b2d042c6bd6304843352dbc83bd))
28
+ * **eMudhra-fix:** bump @dynamic-labs-wallet/* to 1.1.47 (eMudhra CA distrust) ([#12561](https://github.com/dynamic-labs/dynamic-auth/issues/12561)) ([6f6a9ce](https://github.com/dynamic-labs/dynamic-auth/commit/6f6a9ce310db000af38b3411d60776b2fa5f9e89))
29
+ * **emudhra-fix:** bump Node to 22.23.4 in CI and actions to Node 24 runtimes ([#12559](https://github.com/dynamic-labs/dynamic-auth/issues/12559)) ([af1a97f](https://github.com/dynamic-labs/dynamic-auth/commit/af1a97fc12629a31a1297aa910fab155f9317163))
30
+ * **wallet-book:** detect TokenPocket EVM via window.tokenpocket and isTokenPocket ([#12546](https://github.com/dynamic-labs/dynamic-auth/issues/12546)) ([bd4f01a](https://github.com/dynamic-labs/dynamic-auth/commit/bd4f01a0b8c4180c1b4a5a5d891c84f8af7f0269))
31
+
2
32
  ### [5.12.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.12.0...v5.12.1) (2026-10-20)
3
33
 
4
34
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "5.12.1";
6
+ var version = "5.12.3";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "5.12.1";
2
+ var version = "5.12.3";
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": "5.12.1",
3
+ "version": "5.12.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",
@@ -18,18 +18,18 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs-wallet/core": "1.1.43",
21
+ "@dynamic-labs-wallet/core": "1.1.49",
22
22
  "@dynamic-labs/sdk-api-core": "0.104.0",
23
- "@dynamic-labs/utils": "5.12.1",
24
- "@mysten/wallet-standard": "0.19.9",
25
- "@mysten/sui": "1.45.2",
23
+ "@dynamic-labs/utils": "5.12.3",
24
+ "@mysten/wallet-standard": "0.20.3",
25
+ "@mysten/sui": "2.8.0",
26
26
  "text-encoding": "0.7.0",
27
- "@dynamic-labs/assert-package-version": "5.12.1",
28
- "@dynamic-labs/logger": "5.12.1",
29
- "@dynamic-labs/rpc-providers": "5.12.1",
30
- "@dynamic-labs/types": "5.12.1",
31
- "@dynamic-labs/wallet-book": "5.12.1",
32
- "@dynamic-labs/wallet-connector-core": "5.12.1"
27
+ "@dynamic-labs/assert-package-version": "5.12.3",
28
+ "@dynamic-labs/logger": "5.12.3",
29
+ "@dynamic-labs/rpc-providers": "5.12.3",
30
+ "@dynamic-labs/types": "5.12.3",
31
+ "@dynamic-labs/wallet-book": "5.12.3",
32
+ "@dynamic-labs/wallet-connector-core": "5.12.3"
33
33
  },
34
34
  "peerDependencies": {}
35
35
  }
@@ -4,7 +4,6 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../_virtual/_tslib.cjs');
7
- var client = require('@mysten/sui/client');
8
7
  var logger = require('@dynamic-labs/logger');
9
8
  var utils = require('@dynamic-labs/utils');
10
9
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
@@ -222,14 +221,16 @@ class SuiWalletConnector extends walletConnectorCore.WalletConnectorBase {
222
221
  this.logger.error(`[${this.name}] [getSuiClient] Failed to get network url`);
223
222
  return undefined;
224
223
  }
225
- this.suiClients[clientNetworkId] = new client.SuiClient({
226
- url: url,
224
+ this.suiClients[clientNetworkId] = networkHelpers.createSuiGrpcClient({
225
+ networkId: clientNetworkId,
226
+ url,
227
227
  });
228
228
  return this.suiClients[clientNetworkId];
229
229
  });
230
230
  }
231
231
  getBalance(address) {
232
232
  return _tslib.__awaiter(this, void 0, void 0, function* () {
233
+ var _a;
233
234
  const client = yield this.getSuiClient();
234
235
  if (!client) {
235
236
  this.logger.error(`[${this.name}] [getBalance] Failed to get Sui client`);
@@ -239,7 +240,7 @@ class SuiWalletConnector extends walletConnectorCore.WalletConnectorBase {
239
240
  owner: address,
240
241
  });
241
242
  // Balance comes back as MIST, 1 SUI = 1e9 MIST
242
- const balance = Number(balanceResult === null || balanceResult === void 0 ? void 0 : balanceResult.totalBalance) / 1e9;
243
+ const balance = Number((_a = balanceResult === null || balanceResult === void 0 ? void 0 : balanceResult.balance) === null || _a === void 0 ? void 0 : _a.balance) / 1e9;
243
244
  if (Number.isNaN(balance)) {
244
245
  this.logger.error(`[${this.name}] [getBalance] Failed to get balance for address: ${address}`);
245
246
  return undefined;
@@ -1,10 +1,10 @@
1
- import { ExecuteTransactionRequestType, SuiClient, SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
1
+ import type { SuiGrpcClient } from '@mysten/sui/grpc';
2
2
  import { SignedTransaction, SuiSignAndExecuteTransactionBlockOutput, SuiSignAndExecuteTransactionOutput, SuiSignTransactionBlockOutput, SuiWalletFeatures, WalletAccount, WalletWithFeatures } from '@mysten/wallet-standard';
3
3
  import { Transaction } from '@mysten/sui/transactions';
4
4
  import { Logger } from '@dynamic-labs/logger';
5
5
  import { GenericNetwork, IUITransaction } from '@dynamic-labs/types';
6
6
  import { Chain, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
7
- import { SuiChangeEvent, SuiWalletConnectorProps, SuiWalletStandardEventHandler } from './types';
7
+ import { SuiChangeEvent, SuiExecuteTransactionRequestType, SuiTransactionBlockResponseOptions, SuiWalletConnectorProps, SuiWalletStandardEventHandler } from './types';
8
8
  import { SuiWallet } from './wallet/SuiWallet';
9
9
  export declare abstract class SuiWalletConnector extends WalletConnectorBase<typeof SuiWallet> {
10
10
  name: string;
@@ -31,7 +31,7 @@ export declare abstract class SuiWalletConnector extends WalletConnectorBase<typ
31
31
  */
32
32
  protected activeNetworkId: string | undefined;
33
33
  /** Sui clients */
34
- suiClients: Record<string, SuiClient>;
34
+ suiClients: Record<string, SuiGrpcClient>;
35
35
  /** Enabled SUI networks */
36
36
  suiNetworks: GenericNetwork[];
37
37
  /** Dynamic logger */
@@ -72,7 +72,7 @@ export declare abstract class SuiWalletConnector extends WalletConnectorBase<typ
72
72
  *
73
73
  * The client will prefer the private customer rpc url if available.
74
74
  */
75
- getSuiClient(networkId?: string): Promise<SuiClient | undefined>;
75
+ getSuiClient(networkId?: string): Promise<SuiGrpcClient | undefined>;
76
76
  getBalance(address: string): Promise<string | undefined>;
77
77
  signMessage(messageToSign: string): Promise<string | undefined>;
78
78
  getWalletAccount(): Promise<WalletAccount | undefined>;
@@ -85,7 +85,7 @@ export declare abstract class SuiWalletConnector extends WalletConnectorBase<typ
85
85
  transaction: Transaction;
86
86
  legacyOptions?: {
87
87
  options?: SuiTransactionBlockResponseOptions;
88
- requestType?: ExecuteTransactionRequestType;
88
+ requestType?: SuiExecuteTransactionRequestType;
89
89
  };
90
90
  }): Promise<SuiSignAndExecuteTransactionOutput | SuiSignAndExecuteTransactionBlockOutput>;
91
91
  signTransactionFeature({ transaction, }: {
@@ -1,10 +1,9 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../_virtual/_tslib.js';
3
- import { SuiClient } from '@mysten/sui/client';
4
3
  import { Logger } from '@dynamic-labs/logger';
5
4
  import { isMobile, template, PlatformService, DynamicError } from '@dynamic-labs/utils';
6
5
  import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
7
- import { getSuiNetworkIdFromName, getPreferredRpcUrl } from './utils/network/networkHelpers.js';
6
+ import { getSuiNetworkIdFromName, getPreferredRpcUrl, createSuiGrpcClient } from './utils/network/networkHelpers.js';
8
7
  import { SuiUiTransaction } from './utils/SuiUiTransaction/SuiUiTransaction.js';
9
8
  import { SuiWallet } from './wallet/SuiWallet.js';
10
9
 
@@ -218,14 +217,16 @@ class SuiWalletConnector extends WalletConnectorBase {
218
217
  this.logger.error(`[${this.name}] [getSuiClient] Failed to get network url`);
219
218
  return undefined;
220
219
  }
221
- this.suiClients[clientNetworkId] = new SuiClient({
222
- url: url,
220
+ this.suiClients[clientNetworkId] = createSuiGrpcClient({
221
+ networkId: clientNetworkId,
222
+ url,
223
223
  });
224
224
  return this.suiClients[clientNetworkId];
225
225
  });
226
226
  }
227
227
  getBalance(address) {
228
228
  return __awaiter(this, void 0, void 0, function* () {
229
+ var _a;
229
230
  const client = yield this.getSuiClient();
230
231
  if (!client) {
231
232
  this.logger.error(`[${this.name}] [getBalance] Failed to get Sui client`);
@@ -235,7 +236,7 @@ class SuiWalletConnector extends WalletConnectorBase {
235
236
  owner: address,
236
237
  });
237
238
  // Balance comes back as MIST, 1 SUI = 1e9 MIST
238
- const balance = Number(balanceResult === null || balanceResult === void 0 ? void 0 : balanceResult.totalBalance) / 1e9;
239
+ const balance = Number((_a = balanceResult === null || balanceResult === void 0 ? void 0 : balanceResult.balance) === null || _a === void 0 ? void 0 : _a.balance) / 1e9;
239
240
  if (Number.isNaN(balance)) {
240
241
  this.logger.error(`[${this.name}] [getBalance] Failed to get balance for address: ${address}`);
241
242
  return undefined;
package/src/types.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { WalletWithFeatures, SuiWalletFeatures, IdentifierRecord, IdentifierArray, WalletAccount } from '@mysten/wallet-standard';
2
- import { ExecuteTransactionRequestType, SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
3
2
  import { IChainRpcProviders } from '@dynamic-labs/rpc-providers';
4
3
  import { NetworkConfiguration } from '@dynamic-labs/sdk-api-core';
5
4
  import { WalletBookSchema } from '@dynamic-labs/wallet-book';
@@ -26,7 +25,17 @@ export type SuiSendBalanceProps = {
26
25
  decimals?: number;
27
26
  };
28
27
  };
28
+ export type SuiExecuteTransactionRequestType = 'WaitForEffectsCert' | 'WaitForLocalExecution';
29
+ export type SuiTransactionBlockResponseOptions = {
30
+ showBalanceChanges?: boolean;
31
+ showEffects?: boolean;
32
+ showEvents?: boolean;
33
+ showInput?: boolean;
34
+ showObjectChanges?: boolean;
35
+ showRawEffects?: boolean;
36
+ showRawInput?: boolean;
37
+ };
29
38
  export type SuiSignAndExecuteTransactionBlockOptions = {
30
39
  options?: SuiTransactionBlockResponseOptions;
31
- requestType?: ExecuteTransactionRequestType;
40
+ requestType?: SuiExecuteTransactionRequestType;
32
41
  };
@@ -27,21 +27,27 @@ class SuiUiTransaction {
27
27
  */
28
28
  fetchFee() {
29
29
  return _tslib.__awaiter(this, void 0, void 0, function* () {
30
+ var _a, _b, _c;
30
31
  if (this.fee.gas)
31
32
  return;
32
33
  const transaction = yield this.createTransactionSafe();
33
34
  if (!transaction) {
34
35
  throw new Error('Could not create a valid SUI transaction, check your address and value');
35
36
  }
36
- const transactionBlock = yield transaction.build({ client: this.client });
37
- const dryRunResult = yield this.client.dryRunTransactionBlock({
38
- transactionBlock,
37
+ const simulation = yield this.client.simulateTransaction({
38
+ include: { effects: true },
39
+ transaction,
39
40
  });
40
- if (!dryRunResult) {
41
+ const simulatedTransaction = simulation.Transaction;
42
+ if (simulation.FailedTransaction) {
43
+ this.fee.gas = undefined;
44
+ throw new Error((_c = (_b = (_a = simulation.FailedTransaction.status) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : 'Error accessing SUI network to calculate gas, please try again later');
45
+ }
46
+ if (!(simulatedTransaction === null || simulatedTransaction === void 0 ? void 0 : simulatedTransaction.effects)) {
41
47
  this.fee.gas = undefined;
42
48
  throw new Error('Error accessing SUI network to calculate gas, please try again later');
43
49
  }
44
- const gasObject = dryRunResult.effects.gasUsed;
50
+ const gasObject = simulatedTransaction.effects.gasUsed;
45
51
  // net_gas_fees = computation_gas_fee + storage_gas_fee - storage_rebate
46
52
  // https://docs.sui.io/concepts/tokenomics/gas-in-sui
47
53
  const calculatedGas = BigInt(gasObject.computationCost) +
@@ -85,7 +91,7 @@ class SuiUiTransaction {
85
91
  coinType: '0x2::sui::SUI',
86
92
  owner: this.from,
87
93
  });
88
- return BigInt(balance.totalBalance);
94
+ return BigInt(balance.balance.balance);
89
95
  });
90
96
  }
91
97
  validateAddressFormat(address) {
@@ -107,16 +113,14 @@ class SuiUiTransaction {
107
113
  sendTransaction.setSender(this.from);
108
114
  let coin = undefined;
109
115
  if (nonNativeAddress && nonNativeValue) {
110
- const { data: coins } = yield this.client.getCoins({
116
+ const { objects: coins } = yield this.client.listCoins({
111
117
  coinType: nonNativeAddress,
112
118
  owner: this.from,
113
119
  });
114
120
  if (coins.length === 0) {
115
121
  throw new Error('Token not found');
116
122
  }
117
- [coin] = sendTransaction.splitCoins(coins[0].coinObjectId, [
118
- nonNativeValue,
119
- ]);
123
+ [coin] = sendTransaction.splitCoins(coins[0].objectId, [nonNativeValue]);
120
124
  sendTransaction.transferObjects([coin], to);
121
125
  }
122
126
  if (value) {
@@ -1,11 +1,11 @@
1
1
  import { Transaction } from '@mysten/sui/transactions';
2
- import { SuiClient } from '@mysten/sui/client';
2
+ import type { SuiGrpcClient } from '@mysten/sui/grpc';
3
3
  import { IUITransaction, IUITransactionFormatOptions } from '@dynamic-labs/types';
4
4
  type SuiUiTransactionProps = {
5
5
  /** SUI Address of the sender */
6
6
  from: string;
7
7
  /** The [SuiClient] instance, needed to estimate gas fees */
8
- client: SuiClient;
8
+ client: SuiGrpcClient;
9
9
  /** The function to call when the transaction is submitted */
10
10
  onSubmit: (transaction?: Transaction) => Promise<any>;
11
11
  };
@@ -23,21 +23,27 @@ class SuiUiTransaction {
23
23
  */
24
24
  fetchFee() {
25
25
  return __awaiter(this, void 0, void 0, function* () {
26
+ var _a, _b, _c;
26
27
  if (this.fee.gas)
27
28
  return;
28
29
  const transaction = yield this.createTransactionSafe();
29
30
  if (!transaction) {
30
31
  throw new Error('Could not create a valid SUI transaction, check your address and value');
31
32
  }
32
- const transactionBlock = yield transaction.build({ client: this.client });
33
- const dryRunResult = yield this.client.dryRunTransactionBlock({
34
- transactionBlock,
33
+ const simulation = yield this.client.simulateTransaction({
34
+ include: { effects: true },
35
+ transaction,
35
36
  });
36
- if (!dryRunResult) {
37
+ const simulatedTransaction = simulation.Transaction;
38
+ if (simulation.FailedTransaction) {
39
+ this.fee.gas = undefined;
40
+ throw new Error((_c = (_b = (_a = simulation.FailedTransaction.status) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : 'Error accessing SUI network to calculate gas, please try again later');
41
+ }
42
+ if (!(simulatedTransaction === null || simulatedTransaction === void 0 ? void 0 : simulatedTransaction.effects)) {
37
43
  this.fee.gas = undefined;
38
44
  throw new Error('Error accessing SUI network to calculate gas, please try again later');
39
45
  }
40
- const gasObject = dryRunResult.effects.gasUsed;
46
+ const gasObject = simulatedTransaction.effects.gasUsed;
41
47
  // net_gas_fees = computation_gas_fee + storage_gas_fee - storage_rebate
42
48
  // https://docs.sui.io/concepts/tokenomics/gas-in-sui
43
49
  const calculatedGas = BigInt(gasObject.computationCost) +
@@ -81,7 +87,7 @@ class SuiUiTransaction {
81
87
  coinType: '0x2::sui::SUI',
82
88
  owner: this.from,
83
89
  });
84
- return BigInt(balance.totalBalance);
90
+ return BigInt(balance.balance.balance);
85
91
  });
86
92
  }
87
93
  validateAddressFormat(address) {
@@ -103,16 +109,14 @@ class SuiUiTransaction {
103
109
  sendTransaction.setSender(this.from);
104
110
  let coin = undefined;
105
111
  if (nonNativeAddress && nonNativeValue) {
106
- const { data: coins } = yield this.client.getCoins({
112
+ const { objects: coins } = yield this.client.listCoins({
107
113
  coinType: nonNativeAddress,
108
114
  owner: this.from,
109
115
  });
110
116
  if (coins.length === 0) {
111
117
  throw new Error('Token not found');
112
118
  }
113
- [coin] = sendTransaction.splitCoins(coins[0].coinObjectId, [
114
- nonNativeValue,
115
- ]);
119
+ [coin] = sendTransaction.splitCoins(coins[0].objectId, [nonNativeValue]);
116
120
  sendTransaction.transferObjects([coin], to);
117
121
  }
118
122
  if (value) {
@@ -3,6 +3,27 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
+ var grpc = require('@mysten/sui/grpc');
7
+
8
+ const SUI_NETWORK_NAMES = {
9
+ 501: 'mainnet',
10
+ 502: 'testnet',
11
+ 503: 'devnet',
12
+ };
13
+ /**
14
+ * Creates a Sui gRPC client for a Dynamic network.
15
+ *
16
+ * `url` must serve the Sui gRPC API; JSON-RPC endpoints are not supported.
17
+ * Unmapped network ids are passed through to the client as the network name
18
+ * so custom/private networks keep working.
19
+ */
20
+ const createSuiGrpcClient = ({ networkId, url, }) => {
21
+ var _a;
22
+ return new grpc.SuiGrpcClient({
23
+ baseUrl: url,
24
+ network: (_a = SUI_NETWORK_NAMES[networkId]) !== null && _a !== void 0 ? _a : networkId,
25
+ });
26
+ };
6
27
  /**
7
28
  * Get the Sui network id from the network name
8
29
  *
@@ -25,10 +46,15 @@ const getSuiNetworkIdFromName = (name, networks) => {
25
46
  /**
26
47
  * Get the preferred RPC URL for a given network
27
48
  *
49
+ * Private customer overrides keep priority so customers can point at their
50
+ * own infrastructure; with the gRPC client these URLs must serve the Sui
51
+ * gRPC API rather than JSON-RPC.
52
+ *
28
53
  * @param network - The network
29
54
  * @returns The preferred RPC URL
30
55
  */
31
56
  const getPreferredRpcUrl = (network) => { var _a, _b, _c; return (_b = (_a = network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : (_c = network.rpcUrls) === null || _c === void 0 ? void 0 : _c[0]; };
32
57
 
58
+ exports.createSuiGrpcClient = createSuiGrpcClient;
33
59
  exports.getPreferredRpcUrl = getPreferredRpcUrl;
34
60
  exports.getSuiNetworkIdFromName = getSuiNetworkIdFromName;
@@ -1,4 +1,16 @@
1
+ import { SuiGrpcClient } from '@mysten/sui/grpc';
1
2
  import { GenericNetwork } from '@dynamic-labs/types';
3
+ /**
4
+ * Creates a Sui gRPC client for a Dynamic network.
5
+ *
6
+ * `url` must serve the Sui gRPC API; JSON-RPC endpoints are not supported.
7
+ * Unmapped network ids are passed through to the client as the network name
8
+ * so custom/private networks keep working.
9
+ */
10
+ export declare const createSuiGrpcClient: ({ networkId, url, }: {
11
+ networkId: string;
12
+ url: string;
13
+ }) => SuiGrpcClient;
2
14
  /**
3
15
  * Get the Sui network id from the network name
4
16
  *
@@ -13,6 +25,10 @@ export declare const getSuiNetworkIdFromName: (name: string, networks: GenericNe
13
25
  /**
14
26
  * Get the preferred RPC URL for a given network
15
27
  *
28
+ * Private customer overrides keep priority so customers can point at their
29
+ * own infrastructure; with the gRPC client these URLs must serve the Sui
30
+ * gRPC API rather than JSON-RPC.
31
+ *
16
32
  * @param network - The network
17
33
  * @returns The preferred RPC URL
18
34
  */
@@ -1,4 +1,25 @@
1
1
  'use client'
2
+ import { SuiGrpcClient } from '@mysten/sui/grpc';
3
+
4
+ const SUI_NETWORK_NAMES = {
5
+ 501: 'mainnet',
6
+ 502: 'testnet',
7
+ 503: 'devnet',
8
+ };
9
+ /**
10
+ * Creates a Sui gRPC client for a Dynamic network.
11
+ *
12
+ * `url` must serve the Sui gRPC API; JSON-RPC endpoints are not supported.
13
+ * Unmapped network ids are passed through to the client as the network name
14
+ * so custom/private networks keep working.
15
+ */
16
+ const createSuiGrpcClient = ({ networkId, url, }) => {
17
+ var _a;
18
+ return new SuiGrpcClient({
19
+ baseUrl: url,
20
+ network: (_a = SUI_NETWORK_NAMES[networkId]) !== null && _a !== void 0 ? _a : networkId,
21
+ });
22
+ };
2
23
  /**
3
24
  * Get the Sui network id from the network name
4
25
  *
@@ -21,9 +42,13 @@ const getSuiNetworkIdFromName = (name, networks) => {
21
42
  /**
22
43
  * Get the preferred RPC URL for a given network
23
44
  *
45
+ * Private customer overrides keep priority so customers can point at their
46
+ * own infrastructure; with the gRPC client these URLs must serve the Sui
47
+ * gRPC API rather than JSON-RPC.
48
+ *
24
49
  * @param network - The network
25
50
  * @returns The preferred RPC URL
26
51
  */
27
52
  const getPreferredRpcUrl = (network) => { var _a, _b, _c; return (_b = (_a = network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : (_c = network.rpcUrls) === null || _c === void 0 ? void 0 : _c[0]; };
28
53
 
29
- export { getPreferredRpcUrl, getSuiNetworkIdFromName };
54
+ export { createSuiGrpcClient, getPreferredRpcUrl, getSuiNetworkIdFromName };
@@ -26,17 +26,18 @@ class SuiWallet extends walletConnectorCore.Wallet {
26
26
  if (!suiClient) {
27
27
  throw new Error('SUI client not found');
28
28
  }
29
- const { data: coins } = yield suiClient.getCoins({
29
+ const { objects: coins } = yield suiClient.listCoins({
30
30
  coinType: token.address,
31
31
  owner: this.address,
32
32
  });
33
33
  if (coins.length === 0) {
34
34
  throw new Error('Token not found');
35
35
  }
36
- const decimals = (_b = token.decimals) !== null && _b !== void 0 ? _b : (_c = (yield suiClient.getCoinMetadata({
37
- coinType: token.address,
38
- }))) === null || _c === void 0 ? void 0 : _c.decimals;
39
- const [coin] = transaction.splitCoins(coins[0].coinObjectId, [
36
+ const metadata = token.decimals === undefined
37
+ ? yield suiClient.getCoinMetadata({ coinType: token.address })
38
+ : undefined;
39
+ const decimals = (_b = token.decimals) !== null && _b !== void 0 ? _b : (_c = metadata === null || metadata === void 0 ? void 0 : metadata.coinMetadata) === null || _c === void 0 ? void 0 : _c.decimals;
40
+ const [coin] = transaction.splitCoins(coins[0].objectId, [
40
41
  utils.parseAmountToSmallestUnit({ amount, decimals: decimals !== null && decimals !== void 0 ? decimals : 0 }),
41
42
  ]);
42
43
  transaction.transferObjects([coin], toAddress);
@@ -1,6 +1,6 @@
1
1
  import type { ApprovalQuorumRequestContext } from '@dynamic-labs-wallet/core';
2
2
  import { Transaction } from '@mysten/sui/transactions';
3
- import { SuiClient } from '@mysten/sui/client';
3
+ import type { SuiGrpcClient } from '@mysten/sui/grpc';
4
4
  import { SuiSignAndExecuteTransactionBlockOutput, SuiSignAndExecuteTransactionOutput, WalletAccount } from '@mysten/wallet-standard';
5
5
  import { Wallet } from '@dynamic-labs/wallet-connector-core';
6
6
  import { SuiWalletConnector } from '../SuiWalletConnector';
@@ -17,11 +17,11 @@ export declare class SuiWallet extends Wallet<SuiWalletConnector> {
17
17
  * Returns the Sui Client object initialized for the wallet's current network.
18
18
  * @returns The [SuiClient] object.
19
19
  */
20
- getSuiClient(): Promise<SuiClient | undefined>;
20
+ getSuiClient(): Promise<SuiGrpcClient | undefined>;
21
21
  /**
22
22
  * @deprecated Use `getSuiClient` instead
23
23
  */
24
- getWalletClient(): Promise<SuiClient | undefined>;
24
+ getWalletClient(): Promise<SuiGrpcClient | undefined>;
25
25
  /**
26
26
  * Returns the wallet's current active account.
27
27
  * @returns a readonly [WalletAccount] object.
@@ -22,17 +22,18 @@ class SuiWallet extends Wallet {
22
22
  if (!suiClient) {
23
23
  throw new Error('SUI client not found');
24
24
  }
25
- const { data: coins } = yield suiClient.getCoins({
25
+ const { objects: coins } = yield suiClient.listCoins({
26
26
  coinType: token.address,
27
27
  owner: this.address,
28
28
  });
29
29
  if (coins.length === 0) {
30
30
  throw new Error('Token not found');
31
31
  }
32
- const decimals = (_b = token.decimals) !== null && _b !== void 0 ? _b : (_c = (yield suiClient.getCoinMetadata({
33
- coinType: token.address,
34
- }))) === null || _c === void 0 ? void 0 : _c.decimals;
35
- const [coin] = transaction.splitCoins(coins[0].coinObjectId, [
32
+ const metadata = token.decimals === undefined
33
+ ? yield suiClient.getCoinMetadata({ coinType: token.address })
34
+ : undefined;
35
+ const decimals = (_b = token.decimals) !== null && _b !== void 0 ? _b : (_c = metadata === null || metadata === void 0 ? void 0 : metadata.coinMetadata) === null || _c === void 0 ? void 0 : _c.decimals;
36
+ const [coin] = transaction.splitCoins(coins[0].objectId, [
36
37
  parseAmountToSmallestUnit({ amount, decimals: decimals !== null && decimals !== void 0 ? decimals : 0 }),
37
38
  ]);
38
39
  transaction.transferObjects([coin], toAddress);
@@ -1,6 +1,6 @@
1
- import { SuiSignAndExecuteTransactionBlockOutput, SuiSignAndExecuteTransactionOutput, WalletAccount, SignedTransaction, SuiSignTransactionBlockOutput } from '@mysten/wallet-standard';
2
1
  import { Transaction } from '@mysten/sui/transactions';
3
- import { ExecuteTransactionRequestType, SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
2
+ import { SuiSignAndExecuteTransactionBlockOutput, SuiSignAndExecuteTransactionOutput, WalletAccount, SignedTransaction, SuiSignTransactionBlockOutput } from '@mysten/wallet-standard';
3
+ import { SuiExecuteTransactionRequestType, SuiTransactionBlockResponseOptions } from '../../types';
4
4
  import { Injected } from '../injected/injected';
5
5
  /**
6
6
  * Slush Wallet Connector with Multi-Account Support
@@ -73,7 +73,7 @@ export declare class Slush extends Injected {
73
73
  transaction: Transaction;
74
74
  legacyOptions?: {
75
75
  options?: SuiTransactionBlockResponseOptions;
76
- requestType?: ExecuteTransactionRequestType;
76
+ requestType?: SuiExecuteTransactionRequestType;
77
77
  };
78
78
  }): Promise<SuiSignAndExecuteTransactionOutput | SuiSignAndExecuteTransactionBlockOutput>;
79
79
  signTransactionFeature({ transaction, }: {