@dynamic-labs/waas-sui 4.20.2 → 4.20.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.20.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.2...v4.20.3) (2025-06-13)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * use minified jwt for waas wallet client auth ([#8938](https://github.com/dynamic-labs/dynamic-auth/issues/8938)) ([f7b9e14](https://github.com/dynamic-labs/dynamic-auth/commit/f7b9e1435e397a64fdf4f42f9b3ad354314e0191))
8
+
2
9
  ### [4.20.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.1...v4.20.2) (2025-06-11)
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.20.2";
6
+ var version = "4.20.3";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.20.2";
2
+ var version = "4.20.3";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/waas-sui",
3
- "version": "4.20.2",
3
+ "version": "4.20.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",
@@ -21,14 +21,15 @@
21
21
  "@dynamic-labs-wallet/browser-wallet-client": "0.0.85",
22
22
  "@mysten/sui": "1.24.0",
23
23
  "@mysten/wallet-standard": "0.13.29",
24
- "@dynamic-labs/assert-package-version": "4.20.2",
25
- "@dynamic-labs/logger": "4.20.2",
26
- "@dynamic-labs/rpc-providers": "4.20.2",
27
- "@dynamic-labs/sui-core": "4.20.2",
28
- "@dynamic-labs/types": "4.20.2",
29
- "@dynamic-labs/utils": "4.20.2",
30
- "@dynamic-labs/wallet-book": "4.20.2",
31
- "@dynamic-labs/wallet-connector-core": "4.20.2"
24
+ "@dynamic-labs/assert-package-version": "4.20.3",
25
+ "@dynamic-labs/logger": "4.20.3",
26
+ "@dynamic-labs/rpc-providers": "4.20.3",
27
+ "@dynamic-labs/sui-core": "4.20.3",
28
+ "@dynamic-labs/types": "4.20.3",
29
+ "@dynamic-labs/utils": "4.20.3",
30
+ "@dynamic-labs/waas": "4.20.3",
31
+ "@dynamic-labs/wallet-book": "4.20.3",
32
+ "@dynamic-labs/wallet-connector-core": "4.20.3"
32
33
  },
33
34
  "peerDependencies": {}
34
35
  }
@@ -4,11 +4,11 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../_virtual/_tslib.cjs');
7
- var browserWalletClient = require('@dynamic-labs-wallet/browser-wallet-client');
8
7
  var client = require('@mysten/sui/client');
9
8
  var suiCore = require('@dynamic-labs/sui-core');
10
9
  var utils = require('@dynamic-labs/utils');
11
10
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
11
+ var waas = require('@dynamic-labs/waas');
12
12
  var WaasSuiWallet = require('../wallet/WaasSuiWallet.cjs');
13
13
 
14
14
  // This will need to be moved to a base class once we have base classes for waas connectors
@@ -26,7 +26,7 @@ class WaasExportHandler {
26
26
  }
27
27
  }
28
28
  }
29
- class DynamicWaasSuiConnector extends suiCore.SuiWalletConnector {
29
+ class DynamicWaasSuiConnector extends waas.withDynamicWaas(suiCore.SuiWalletConnector) {
30
30
  constructor(props) {
31
31
  super('Dynamic Waas', props);
32
32
  this.ChainWallet = WaasSuiWallet.WaasSuiWallet;
@@ -90,18 +90,6 @@ class DynamicWaasSuiConnector extends suiCore.SuiWalletConnector {
90
90
  supportsNetworkSwitching() {
91
91
  return true;
92
92
  }
93
- setGetAuthTokenFunction(getAuthToken) {
94
- this.getAuthToken = getAuthToken;
95
- }
96
- setEnvironmentId(environmentId) {
97
- this.environmentId = environmentId;
98
- }
99
- setBaseApiUrl(baseApiUrl) {
100
- this.baseApiUrl = baseApiUrl;
101
- }
102
- setRelayUrl(relayUrl) {
103
- this.relayUrl = relayUrl;
104
- }
105
93
  setActiveAccountAddress(accountAddress) {
106
94
  this.activeAccountAddress = accountAddress;
107
95
  }
@@ -110,37 +98,14 @@ class DynamicWaasSuiConnector extends suiCore.SuiWalletConnector {
110
98
  return this.activeAccountAddress;
111
99
  });
112
100
  }
113
- createDynamicWaasClient() {
114
- var _a;
115
- const authToken = (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this);
116
- if (!authToken) {
117
- throw new Error('Auth token is required');
118
- }
119
- if (!this.environmentId) {
120
- throw new Error('Environment ID is required');
121
- }
122
- if (!this.baseApiUrl) {
123
- throw new Error('Base API URL is required');
124
- }
125
- return new browserWalletClient.DynamicWalletClient({
126
- authToken,
127
- baseApiUrl: this.baseApiUrl,
128
- baseMPCRelayApiUrl: this.relayUrl || 'relay.dynamic-preprod.xyz',
129
- chainName: 'SUI',
130
- environmentId: this.environmentId,
131
- });
132
- }
133
- getWaasWalletClient() {
134
- if (!this.dynamicWaasClient) {
135
- this.dynamicWaasClient = this.createDynamicWaasClient();
136
- }
137
- return this.dynamicWaasClient;
138
- }
139
101
  validateActiveWallet(expectedAddress) {
140
102
  return _tslib.__awaiter(this, void 0, void 0, function* () {
141
- const waasSuiClient = this.getWaasWalletClient();
142
- const targetWallet = yield waasSuiClient.getWallet({
103
+ var _a;
104
+ const walletClient = this.getWaasWalletClient();
105
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
106
+ const targetWallet = yield walletClient.getWallet({
143
107
  accountAddress: expectedAddress,
108
+ signedSessionId,
144
109
  });
145
110
  if (!targetWallet) {
146
111
  throw new utils.DynamicError('Account not found');
@@ -153,8 +118,11 @@ class DynamicWaasSuiConnector extends suiCore.SuiWalletConnector {
153
118
  }
154
119
  createWalletAccount() {
155
120
  return _tslib.__awaiter(this, arguments, void 0, function* ({ thresholdSignatureScheme = 'TWO_OF_TWO', } = {}) {
121
+ var _a;
156
122
  const walletClient = this.getWaasWalletClient();
123
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
157
124
  const createdWallet = yield walletClient.createWalletAccount({
125
+ signedSessionId,
158
126
  thresholdSignatureScheme: thresholdSignatureScheme,
159
127
  });
160
128
  return createdWallet;
@@ -171,19 +139,23 @@ class DynamicWaasSuiConnector extends suiCore.SuiWalletConnector {
171
139
  }
172
140
  signMessage(message) {
173
141
  return _tslib.__awaiter(this, void 0, void 0, function* () {
142
+ var _a;
174
143
  const waasSuiClient = this.getWaasWalletClient();
175
144
  if (!this.activeAccountAddress) {
176
145
  throw new Error('Active account address is required');
177
146
  }
147
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
178
148
  const signedMessage = yield waasSuiClient.signMessage({
179
149
  accountAddress: this.activeAccountAddress,
180
150
  message,
151
+ signedSessionId,
181
152
  });
182
153
  return signedMessage;
183
154
  });
184
155
  }
185
156
  createAndSignTransaction(transaction) {
186
157
  return _tslib.__awaiter(this, void 0, void 0, function* () {
158
+ var _a;
187
159
  const networkName = yield this.getNetworkName();
188
160
  const client$1 = new client.SuiClient({ url: client.getFullnodeUrl(networkName) });
189
161
  const txBytes = yield transaction.build({ client: client$1 });
@@ -192,8 +164,10 @@ class DynamicWaasSuiConnector extends suiCore.SuiWalletConnector {
192
164
  if (!this.activeAccountAddress) {
193
165
  throw new Error('Active account address is required');
194
166
  }
167
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
195
168
  const signedTx = yield walletClient.signTransaction({
196
169
  senderAddress: this.activeAccountAddress,
170
+ signedSessionId,
197
171
  transaction: txString,
198
172
  });
199
173
  return {
@@ -249,6 +223,7 @@ class DynamicWaasSuiConnector extends suiCore.SuiWalletConnector {
249
223
  }
250
224
  exportPrivateKey() {
251
225
  return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, displayContainer, password, } = {}) {
226
+ var _a;
252
227
  const walletClient = this.getWaasWalletClient();
253
228
  const targetAccountAddress = accountAddress || this.activeAccountAddress;
254
229
  if (!targetAccountAddress) {
@@ -258,10 +233,12 @@ class DynamicWaasSuiConnector extends suiCore.SuiWalletConnector {
258
233
  throw new Error('Missing display container for export private key');
259
234
  }
260
235
  this.__exportHandler.setIframeStamper(displayContainer);
236
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
261
237
  yield walletClient.exportPrivateKey({
262
238
  accountAddress: targetAccountAddress,
263
239
  displayContainer,
264
240
  password,
241
+ signedSessionId,
265
242
  });
266
243
  });
267
244
  }
@@ -270,14 +247,17 @@ class DynamicWaasSuiConnector extends suiCore.SuiWalletConnector {
270
247
  }
271
248
  exportClientKeyshares(_a) {
272
249
  return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, password, }) {
250
+ var _b;
273
251
  const waasSuiClient = this.getWaasWalletClient();
274
252
  const targetAccountAddress = accountAddress || this.activeAccountAddress;
275
253
  if (!targetAccountAddress) {
276
254
  throw new Error('Account address is required');
277
255
  }
256
+ const signedSessionId = yield ((_b = this.getSignedSessionId) === null || _b === void 0 ? void 0 : _b.call(this));
278
257
  yield waasSuiClient.exportClientKeyshares({
279
258
  accountAddress: targetAccountAddress,
280
259
  password,
260
+ signedSessionId,
281
261
  });
282
262
  });
283
263
  }
@@ -6,7 +6,27 @@ import { SuiWalletConnector, SuiWalletConnectorProps } from '@dynamic-labs/sui-c
6
6
  import { IUITransaction } from '@dynamic-labs/types';
7
7
  import { IDynamicWaasConnector } from '@dynamic-labs/wallet-connector-core';
8
8
  import { WaasSuiWallet } from '../wallet/WaasSuiWallet';
9
- export declare class DynamicWaasSuiConnector extends SuiWalletConnector implements IDynamicWaasConnector {
9
+ declare const DynamicWaasSuiConnector_base: (abstract new (...args: any[]) => {
10
+ [x: string]: any;
11
+ name: string;
12
+ overrideKey: string;
13
+ isEmbeddedWallet: boolean;
14
+ getSignedSessionId?: (() => Promise<string>) | undefined;
15
+ getAuthToken?: (() => string) | undefined;
16
+ environmentId?: string | undefined;
17
+ baseApiUrl?: string | undefined;
18
+ relayUrl?: string | undefined;
19
+ dynamicWaasClient: DynamicWalletClient | undefined;
20
+ chainName: string;
21
+ setGetAuthTokenFunction(getAuthToken: () => string): void;
22
+ setEnvironmentId(environmentId: string): void;
23
+ setBaseApiUrl(baseApiUrl: string): void;
24
+ setRelayUrl(relayUrl: string): void;
25
+ setGetSignedSessionIdFunction(getSignedSessionId: () => Promise<string>): void;
26
+ createDynamicWaasClient(): DynamicWalletClient;
27
+ getWaasWalletClient(): DynamicWalletClient;
28
+ }) & typeof SuiWalletConnector;
29
+ export declare class DynamicWaasSuiConnector extends DynamicWaasSuiConnector_base implements IDynamicWaasConnector {
10
30
  ChainWallet: typeof WaasSuiWallet;
11
31
  switchNetworkOnlyFromWallet: boolean;
12
32
  constructor(props: SuiWalletConnectorProps);
@@ -20,21 +40,10 @@ export declare class DynamicWaasSuiConnector extends SuiWalletConnector implemen
20
40
  name: string;
21
41
  overrideKey: string;
22
42
  isEmbeddedWallet: boolean;
23
- private environmentId?;
24
- private getAuthToken?;
25
- private dynamicWaasClient;
26
43
  private __exportHandler;
27
44
  activeAccountAddress: string | undefined;
28
- private baseApiUrl?;
29
- private relayUrl?;
30
- setGetAuthTokenFunction(getAuthToken: () => string): void;
31
- setEnvironmentId(environmentId: string): void;
32
- setBaseApiUrl(baseApiUrl: string): void;
33
- setRelayUrl(relayUrl: string): void;
34
45
  private setActiveAccountAddress;
35
46
  getActiveAccountAddress(): Promise<string | undefined>;
36
- createDynamicWaasClient(): DynamicWalletClient;
37
- private getWaasWalletClient;
38
47
  validateActiveWallet(expectedAddress: string): Promise<void>;
39
48
  createWalletAccount({ thresholdSignatureScheme, }?: {
40
49
  thresholdSignatureScheme?: string;
@@ -91,3 +100,4 @@ export declare class DynamicWaasSuiConnector extends SuiWalletConnector implemen
91
100
  createUiTransaction(from: string): Promise<IUITransaction>;
92
101
  endSession(): Promise<void>;
93
102
  }
103
+ export {};
@@ -1,10 +1,10 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../_virtual/_tslib.js';
3
- import { DynamicWalletClient } from '@dynamic-labs-wallet/browser-wallet-client';
4
3
  import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
5
4
  import { SuiWalletConnector, SuiUiTransaction } from '@dynamic-labs/sui-core';
6
5
  import { DynamicError } from '@dynamic-labs/utils';
7
6
  import { isSameAddress } from '@dynamic-labs/wallet-connector-core';
7
+ import { withDynamicWaas } from '@dynamic-labs/waas';
8
8
  import { WaasSuiWallet } from '../wallet/WaasSuiWallet.js';
9
9
 
10
10
  // This will need to be moved to a base class once we have base classes for waas connectors
@@ -22,7 +22,7 @@ class WaasExportHandler {
22
22
  }
23
23
  }
24
24
  }
25
- class DynamicWaasSuiConnector extends SuiWalletConnector {
25
+ class DynamicWaasSuiConnector extends withDynamicWaas(SuiWalletConnector) {
26
26
  constructor(props) {
27
27
  super('Dynamic Waas', props);
28
28
  this.ChainWallet = WaasSuiWallet;
@@ -86,18 +86,6 @@ class DynamicWaasSuiConnector extends SuiWalletConnector {
86
86
  supportsNetworkSwitching() {
87
87
  return true;
88
88
  }
89
- setGetAuthTokenFunction(getAuthToken) {
90
- this.getAuthToken = getAuthToken;
91
- }
92
- setEnvironmentId(environmentId) {
93
- this.environmentId = environmentId;
94
- }
95
- setBaseApiUrl(baseApiUrl) {
96
- this.baseApiUrl = baseApiUrl;
97
- }
98
- setRelayUrl(relayUrl) {
99
- this.relayUrl = relayUrl;
100
- }
101
89
  setActiveAccountAddress(accountAddress) {
102
90
  this.activeAccountAddress = accountAddress;
103
91
  }
@@ -106,37 +94,14 @@ class DynamicWaasSuiConnector extends SuiWalletConnector {
106
94
  return this.activeAccountAddress;
107
95
  });
108
96
  }
109
- createDynamicWaasClient() {
110
- var _a;
111
- const authToken = (_a = this.getAuthToken) === null || _a === void 0 ? void 0 : _a.call(this);
112
- if (!authToken) {
113
- throw new Error('Auth token is required');
114
- }
115
- if (!this.environmentId) {
116
- throw new Error('Environment ID is required');
117
- }
118
- if (!this.baseApiUrl) {
119
- throw new Error('Base API URL is required');
120
- }
121
- return new DynamicWalletClient({
122
- authToken,
123
- baseApiUrl: this.baseApiUrl,
124
- baseMPCRelayApiUrl: this.relayUrl || 'relay.dynamic-preprod.xyz',
125
- chainName: 'SUI',
126
- environmentId: this.environmentId,
127
- });
128
- }
129
- getWaasWalletClient() {
130
- if (!this.dynamicWaasClient) {
131
- this.dynamicWaasClient = this.createDynamicWaasClient();
132
- }
133
- return this.dynamicWaasClient;
134
- }
135
97
  validateActiveWallet(expectedAddress) {
136
98
  return __awaiter(this, void 0, void 0, function* () {
137
- const waasSuiClient = this.getWaasWalletClient();
138
- const targetWallet = yield waasSuiClient.getWallet({
99
+ var _a;
100
+ const walletClient = this.getWaasWalletClient();
101
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
102
+ const targetWallet = yield walletClient.getWallet({
139
103
  accountAddress: expectedAddress,
104
+ signedSessionId,
140
105
  });
141
106
  if (!targetWallet) {
142
107
  throw new DynamicError('Account not found');
@@ -149,8 +114,11 @@ class DynamicWaasSuiConnector extends SuiWalletConnector {
149
114
  }
150
115
  createWalletAccount() {
151
116
  return __awaiter(this, arguments, void 0, function* ({ thresholdSignatureScheme = 'TWO_OF_TWO', } = {}) {
117
+ var _a;
152
118
  const walletClient = this.getWaasWalletClient();
119
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
153
120
  const createdWallet = yield walletClient.createWalletAccount({
121
+ signedSessionId,
154
122
  thresholdSignatureScheme: thresholdSignatureScheme,
155
123
  });
156
124
  return createdWallet;
@@ -167,19 +135,23 @@ class DynamicWaasSuiConnector extends SuiWalletConnector {
167
135
  }
168
136
  signMessage(message) {
169
137
  return __awaiter(this, void 0, void 0, function* () {
138
+ var _a;
170
139
  const waasSuiClient = this.getWaasWalletClient();
171
140
  if (!this.activeAccountAddress) {
172
141
  throw new Error('Active account address is required');
173
142
  }
143
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
174
144
  const signedMessage = yield waasSuiClient.signMessage({
175
145
  accountAddress: this.activeAccountAddress,
176
146
  message,
147
+ signedSessionId,
177
148
  });
178
149
  return signedMessage;
179
150
  });
180
151
  }
181
152
  createAndSignTransaction(transaction) {
182
153
  return __awaiter(this, void 0, void 0, function* () {
154
+ var _a;
183
155
  const networkName = yield this.getNetworkName();
184
156
  const client = new SuiClient({ url: getFullnodeUrl(networkName) });
185
157
  const txBytes = yield transaction.build({ client });
@@ -188,8 +160,10 @@ class DynamicWaasSuiConnector extends SuiWalletConnector {
188
160
  if (!this.activeAccountAddress) {
189
161
  throw new Error('Active account address is required');
190
162
  }
163
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
191
164
  const signedTx = yield walletClient.signTransaction({
192
165
  senderAddress: this.activeAccountAddress,
166
+ signedSessionId,
193
167
  transaction: txString,
194
168
  });
195
169
  return {
@@ -245,6 +219,7 @@ class DynamicWaasSuiConnector extends SuiWalletConnector {
245
219
  }
246
220
  exportPrivateKey() {
247
221
  return __awaiter(this, arguments, void 0, function* ({ accountAddress, displayContainer, password, } = {}) {
222
+ var _a;
248
223
  const walletClient = this.getWaasWalletClient();
249
224
  const targetAccountAddress = accountAddress || this.activeAccountAddress;
250
225
  if (!targetAccountAddress) {
@@ -254,10 +229,12 @@ class DynamicWaasSuiConnector extends SuiWalletConnector {
254
229
  throw new Error('Missing display container for export private key');
255
230
  }
256
231
  this.__exportHandler.setIframeStamper(displayContainer);
232
+ const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
257
233
  yield walletClient.exportPrivateKey({
258
234
  accountAddress: targetAccountAddress,
259
235
  displayContainer,
260
236
  password,
237
+ signedSessionId,
261
238
  });
262
239
  });
263
240
  }
@@ -266,14 +243,17 @@ class DynamicWaasSuiConnector extends SuiWalletConnector {
266
243
  }
267
244
  exportClientKeyshares(_a) {
268
245
  return __awaiter(this, arguments, void 0, function* ({ accountAddress, password, }) {
246
+ var _b;
269
247
  const waasSuiClient = this.getWaasWalletClient();
270
248
  const targetAccountAddress = accountAddress || this.activeAccountAddress;
271
249
  if (!targetAccountAddress) {
272
250
  throw new Error('Account address is required');
273
251
  }
252
+ const signedSessionId = yield ((_b = this.getSignedSessionId) === null || _b === void 0 ? void 0 : _b.call(this));
274
253
  yield waasSuiClient.exportClientKeyshares({
275
254
  accountAddress: targetAccountAddress,
276
255
  password,
256
+ signedSessionId,
277
257
  });
278
258
  });
279
259
  }