@dynamic-labs/waas-sui 5.12.0 → 5.12.2
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 +18 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/wallet/WaasSuiWallet.cjs +59 -0
- package/src/wallet/WaasSuiWallet.d.ts +9 -0
- package/src/wallet/WaasSuiWallet.js +60 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
|
|
2
|
+
### [5.12.2](https://github.com/dynamic-labs/dynamic-auth/compare/v5.12.1...v5.12.2) (2026-10-21)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **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))
|
|
8
|
+
* **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))
|
|
9
|
+
* **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))
|
|
10
|
+
* **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))
|
|
11
|
+
|
|
12
|
+
### [5.12.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.12.0...v5.12.1) (2026-10-20)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* rabby not using native rabby:// scheme when redirecting on android devices [main] ([#12541](https://github.com/dynamic-labs/dynamic-auth/issues/12541)) ([923a372](https://github.com/dynamic-labs/dynamic-auth/commit/923a3724eae5e82ef896de78641320b7320933df))
|
|
18
|
+
* **sui,ton:** sign serialized Sui txs without parsing; native TON balance for jetton sends ([#12503](https://github.com/dynamic-labs/dynamic-auth/issues/12503)) ([6a5bfd6](https://github.com/dynamic-labs/dynamic-auth/commit/6a5bfd6bd0118b8ed7ce079159c10ac47cade337))
|
|
19
|
+
|
|
2
20
|
## [5.12.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.11.0...v5.12.0) (2026-10-16)
|
|
3
21
|
|
|
4
22
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/waas-sui",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.2",
|
|
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",
|
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@dynamic-labs-sdk/client": "1.41.0",
|
|
22
22
|
"@dynamic-labs/sdk-api-core": "0.104.0",
|
|
23
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.1.
|
|
24
|
-
"@dynamic-labs-wallet/core": "1.1.
|
|
23
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.1.47",
|
|
24
|
+
"@dynamic-labs-wallet/core": "1.1.47",
|
|
25
25
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
26
26
|
"@mysten/sui": "1.45.2",
|
|
27
27
|
"@mysten/wallet-standard": "0.19.9",
|
|
28
|
-
"@dynamic-labs/assert-package-version": "5.12.
|
|
29
|
-
"@dynamic-labs/logger": "5.12.
|
|
30
|
-
"@dynamic-labs/rpc-providers": "5.12.
|
|
31
|
-
"@dynamic-labs/sui-core": "5.12.
|
|
32
|
-
"@dynamic-labs/types": "5.12.
|
|
33
|
-
"@dynamic-labs/utils": "5.12.
|
|
34
|
-
"@dynamic-labs/waas": "5.12.
|
|
35
|
-
"@dynamic-labs/wallet-book": "5.12.
|
|
36
|
-
"@dynamic-labs/wallet-connector-core": "5.12.
|
|
28
|
+
"@dynamic-labs/assert-package-version": "5.12.2",
|
|
29
|
+
"@dynamic-labs/logger": "5.12.2",
|
|
30
|
+
"@dynamic-labs/rpc-providers": "5.12.2",
|
|
31
|
+
"@dynamic-labs/sui-core": "5.12.2",
|
|
32
|
+
"@dynamic-labs/types": "5.12.2",
|
|
33
|
+
"@dynamic-labs/utils": "5.12.2",
|
|
34
|
+
"@dynamic-labs/waas": "5.12.2",
|
|
35
|
+
"@dynamic-labs/wallet-book": "5.12.2",
|
|
36
|
+
"@dynamic-labs/wallet-connector-core": "5.12.2"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {}
|
|
39
39
|
}
|
|
@@ -5,9 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
7
|
var transactions = require('@mysten/sui/transactions');
|
|
8
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
8
9
|
var suiCore = require('@dynamic-labs/sui-core');
|
|
9
10
|
var utils = require('@dynamic-labs/utils');
|
|
10
11
|
|
|
12
|
+
// Sui's max transaction size is 128 KiB; base64 expands 3 bytes to 4 chars.
|
|
13
|
+
const MAX_SERIALIZED_TRANSACTION_LENGTH = Math.ceil((128 * 1024) / 3) * 4;
|
|
11
14
|
class WaasSuiWallet extends suiCore.SuiWallet {
|
|
12
15
|
constructor(_a) {
|
|
13
16
|
var { connector } = _a, props = _tslib.__rest(_a, ["connector"]);
|
|
@@ -67,6 +70,62 @@ class WaasSuiWallet extends suiCore.SuiWallet {
|
|
|
67
70
|
return signedTransaction;
|
|
68
71
|
});
|
|
69
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Signs an already-serialized (base64 BCS) Sui transaction without
|
|
75
|
+
* deserializing it into a [Transaction]. Use this for transactions built
|
|
76
|
+
* outside the SDK that may contain input types unknown to the bundled
|
|
77
|
+
* @mysten/sui schema.
|
|
78
|
+
* @param serializedTransaction - The base64-encoded BCS transaction bytes.
|
|
79
|
+
* @returns The signature and transaction bytes.
|
|
80
|
+
*/
|
|
81
|
+
signSerializedTransaction(serializedTransaction) {
|
|
82
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
var _a, _b, _c, _d;
|
|
84
|
+
const suiWalletConnector = this
|
|
85
|
+
._connector;
|
|
86
|
+
if (!suiWalletConnector) {
|
|
87
|
+
throw new Error('SUI wallet connector not found');
|
|
88
|
+
}
|
|
89
|
+
yield suiWalletConnector.connect();
|
|
90
|
+
const trimmed = serializedTransaction.trim();
|
|
91
|
+
const isValidSerializedTransaction = trimmed.length > 0 &&
|
|
92
|
+
trimmed.length <= MAX_SERIALIZED_TRANSACTION_LENGTH &&
|
|
93
|
+
utils.isBase64(trimmed);
|
|
94
|
+
if (!isValidSerializedTransaction) {
|
|
95
|
+
throw new Error('Invalid serialized transaction: expected a base64 BCS string');
|
|
96
|
+
}
|
|
97
|
+
const walletClient = yield suiWalletConnector.getWalletClientByAddress({
|
|
98
|
+
accountAddress: this.address,
|
|
99
|
+
});
|
|
100
|
+
const signedSessionId = yield ((_a = suiWalletConnector.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(suiWalletConnector));
|
|
101
|
+
if (!signedSessionId) {
|
|
102
|
+
throw new utils.DynamicError('Signed session ID is required', 'signed_session_id_is_required');
|
|
103
|
+
}
|
|
104
|
+
const mfaToken = yield ((_b = suiWalletConnector.getMfaToken) === null || _b === void 0 ? void 0 : _b.call(suiWalletConnector, {
|
|
105
|
+
mfaAction: sdkApiCore.MFAAction.WalletWaasSign,
|
|
106
|
+
}));
|
|
107
|
+
const elevatedAccessToken = yield ((_c = suiWalletConnector.getElevatedAccessToken) === null || _c === void 0 ? void 0 : _c.call(suiWalletConnector, {
|
|
108
|
+
scope: sdkApiCore.TokenScope.Walletsign,
|
|
109
|
+
}));
|
|
110
|
+
const password = yield suiWalletConnector.getPasswordIfNeeded({
|
|
111
|
+
accountAddress: this.address,
|
|
112
|
+
});
|
|
113
|
+
const txBytes = Buffer.from(trimmed, 'base64');
|
|
114
|
+
const signedTx = yield walletClient.signTransaction({
|
|
115
|
+
authToken: (_d = suiWalletConnector.getAuthToken) === null || _d === void 0 ? void 0 : _d.call(suiWalletConnector),
|
|
116
|
+
elevatedAccessToken,
|
|
117
|
+
mfaToken,
|
|
118
|
+
password,
|
|
119
|
+
senderAddress: this.address,
|
|
120
|
+
signedSessionId,
|
|
121
|
+
transaction: txBytes.toString('hex'),
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
bytes: txBytes,
|
|
125
|
+
signature: signedTx,
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
}
|
|
70
129
|
getActiveNetwork() {
|
|
71
130
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
72
131
|
const suiWalletConnector = this
|
|
@@ -21,5 +21,14 @@ export declare class WaasSuiWallet extends SuiWallet {
|
|
|
21
21
|
signTransaction(transaction: Transaction, options?: {
|
|
22
22
|
approvalQuorum?: ApprovalQuorumRequestContext;
|
|
23
23
|
}): Promise<SignedTransaction>;
|
|
24
|
+
/**
|
|
25
|
+
* Signs an already-serialized (base64 BCS) Sui transaction without
|
|
26
|
+
* deserializing it into a [Transaction]. Use this for transactions built
|
|
27
|
+
* outside the SDK that may contain input types unknown to the bundled
|
|
28
|
+
* @mysten/sui schema.
|
|
29
|
+
* @param serializedTransaction - The base64-encoded BCS transaction bytes.
|
|
30
|
+
* @returns The signature and transaction bytes.
|
|
31
|
+
*/
|
|
32
|
+
signSerializedTransaction(serializedTransaction: string): Promise<SignedTransaction>;
|
|
24
33
|
getActiveNetwork(): Promise<string | undefined>;
|
|
25
34
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __rest, __awaiter } from '../../_virtual/_tslib.js';
|
|
3
3
|
import { Transaction } from '@mysten/sui/transactions';
|
|
4
|
+
import { MFAAction, TokenScope } from '@dynamic-labs/sdk-api-core';
|
|
4
5
|
import { SuiWallet, MIST_PER_SUI } from '@dynamic-labs/sui-core';
|
|
5
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
|
+
import { isBase64, DynamicError } from '@dynamic-labs/utils';
|
|
6
7
|
|
|
8
|
+
// Sui's max transaction size is 128 KiB; base64 expands 3 bytes to 4 chars.
|
|
9
|
+
const MAX_SERIALIZED_TRANSACTION_LENGTH = Math.ceil((128 * 1024) / 3) * 4;
|
|
7
10
|
class WaasSuiWallet extends SuiWallet {
|
|
8
11
|
constructor(_a) {
|
|
9
12
|
var { connector } = _a, props = __rest(_a, ["connector"]);
|
|
@@ -63,6 +66,62 @@ class WaasSuiWallet extends SuiWallet {
|
|
|
63
66
|
return signedTransaction;
|
|
64
67
|
});
|
|
65
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Signs an already-serialized (base64 BCS) Sui transaction without
|
|
71
|
+
* deserializing it into a [Transaction]. Use this for transactions built
|
|
72
|
+
* outside the SDK that may contain input types unknown to the bundled
|
|
73
|
+
* @mysten/sui schema.
|
|
74
|
+
* @param serializedTransaction - The base64-encoded BCS transaction bytes.
|
|
75
|
+
* @returns The signature and transaction bytes.
|
|
76
|
+
*/
|
|
77
|
+
signSerializedTransaction(serializedTransaction) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
var _a, _b, _c, _d;
|
|
80
|
+
const suiWalletConnector = this
|
|
81
|
+
._connector;
|
|
82
|
+
if (!suiWalletConnector) {
|
|
83
|
+
throw new Error('SUI wallet connector not found');
|
|
84
|
+
}
|
|
85
|
+
yield suiWalletConnector.connect();
|
|
86
|
+
const trimmed = serializedTransaction.trim();
|
|
87
|
+
const isValidSerializedTransaction = trimmed.length > 0 &&
|
|
88
|
+
trimmed.length <= MAX_SERIALIZED_TRANSACTION_LENGTH &&
|
|
89
|
+
isBase64(trimmed);
|
|
90
|
+
if (!isValidSerializedTransaction) {
|
|
91
|
+
throw new Error('Invalid serialized transaction: expected a base64 BCS string');
|
|
92
|
+
}
|
|
93
|
+
const walletClient = yield suiWalletConnector.getWalletClientByAddress({
|
|
94
|
+
accountAddress: this.address,
|
|
95
|
+
});
|
|
96
|
+
const signedSessionId = yield ((_a = suiWalletConnector.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(suiWalletConnector));
|
|
97
|
+
if (!signedSessionId) {
|
|
98
|
+
throw new DynamicError('Signed session ID is required', 'signed_session_id_is_required');
|
|
99
|
+
}
|
|
100
|
+
const mfaToken = yield ((_b = suiWalletConnector.getMfaToken) === null || _b === void 0 ? void 0 : _b.call(suiWalletConnector, {
|
|
101
|
+
mfaAction: MFAAction.WalletWaasSign,
|
|
102
|
+
}));
|
|
103
|
+
const elevatedAccessToken = yield ((_c = suiWalletConnector.getElevatedAccessToken) === null || _c === void 0 ? void 0 : _c.call(suiWalletConnector, {
|
|
104
|
+
scope: TokenScope.Walletsign,
|
|
105
|
+
}));
|
|
106
|
+
const password = yield suiWalletConnector.getPasswordIfNeeded({
|
|
107
|
+
accountAddress: this.address,
|
|
108
|
+
});
|
|
109
|
+
const txBytes = Buffer.from(trimmed, 'base64');
|
|
110
|
+
const signedTx = yield walletClient.signTransaction({
|
|
111
|
+
authToken: (_d = suiWalletConnector.getAuthToken) === null || _d === void 0 ? void 0 : _d.call(suiWalletConnector),
|
|
112
|
+
elevatedAccessToken,
|
|
113
|
+
mfaToken,
|
|
114
|
+
password,
|
|
115
|
+
senderAddress: this.address,
|
|
116
|
+
signedSessionId,
|
|
117
|
+
transaction: txBytes.toString('hex'),
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
bytes: txBytes,
|
|
121
|
+
signature: signedTx,
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
}
|
|
66
125
|
getActiveNetwork() {
|
|
67
126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
127
|
const suiWalletConnector = this
|