@dynamic-labs/waas-sui 5.11.0 → 5.12.1
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 +14 -13
- package/src/connector/DynamicWaasSuiConnector.cjs +6 -4
- package/src/connector/DynamicWaasSuiConnector.d.ts +9 -4
- package/src/connector/DynamicWaasSuiConnector.js +6 -4
- package/src/wallet/WaasSuiWallet.cjs +61 -2
- package/src/wallet/WaasSuiWallet.d.ts +13 -1
- package/src/wallet/WaasSuiWallet.js +62 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
|
|
2
|
+
### [5.12.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.12.0...v5.12.1) (2026-10-20)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* 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))
|
|
8
|
+
* **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))
|
|
9
|
+
|
|
10
|
+
## [5.12.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.11.0...v5.12.0) (2026-10-16)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **embedded-wallet-solana:** add getSolanaSponsorAddress ([#12517](https://github.com/dynamic-labs/dynamic-auth/issues/12517)) ([b95c550](https://github.com/dynamic-labs/dynamic-auth/commit/b95c550e3dab783b7ff0b019051a17b22ea44f97))
|
|
16
|
+
* **embedded-wallet:** show chain and wallet in private key export modal ([#12507](https://github.com/dynamic-labs/dynamic-auth/issues/12507)) ([4bfb6d6](https://github.com/dynamic-labs/dynamic-auth/commit/4bfb6d6168aac3f800792fde933e0597f288058f))
|
|
17
|
+
* **sdk-react-core:** send OTP purpose from step-up flows ([#12511](https://github.com/dynamic-labs/dynamic-auth/issues/12511)) ([0d2d8a3](https://github.com/dynamic-labs/dynamic-auth/commit/0d2d8a31058b3e75c71af7a34f459e2a3ddf383b)), closes [#12898](https://github.com/dynamic-labs/dynamic-auth/issues/12898) [#816](https://github.com/dynamic-labs/dynamic-auth/issues/816) [#203](https://github.com/dynamic-labs/dynamic-auth/issues/203) [#12512](https://github.com/dynamic-labs/dynamic-auth/issues/12512)
|
|
18
|
+
* **wallet-connect:** back WalletConnect storage with native secure storage on mobile ([#12515](https://github.com/dynamic-labs/dynamic-auth/issues/12515)) ([7b57903](https://github.com/dynamic-labs/dynamic-auth/commit/7b5790325fce707d73d591483a0130b960ed055c))
|
|
19
|
+
|
|
2
20
|
## [5.11.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.10.0...v5.11.0) (2026-10-14)
|
|
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.
|
|
3
|
+
"version": "5.12.1",
|
|
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,21 +18,22 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs-sdk/client": "1.
|
|
22
|
-
"@dynamic-labs/sdk-api-core": "0.
|
|
23
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.1.
|
|
21
|
+
"@dynamic-labs-sdk/client": "1.41.0",
|
|
22
|
+
"@dynamic-labs/sdk-api-core": "0.104.0",
|
|
23
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.1.43",
|
|
24
|
+
"@dynamic-labs-wallet/core": "1.1.43",
|
|
24
25
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
25
26
|
"@mysten/sui": "1.45.2",
|
|
26
27
|
"@mysten/wallet-standard": "0.19.9",
|
|
27
|
-
"@dynamic-labs/assert-package-version": "5.
|
|
28
|
-
"@dynamic-labs/logger": "5.
|
|
29
|
-
"@dynamic-labs/rpc-providers": "5.
|
|
30
|
-
"@dynamic-labs/sui-core": "5.
|
|
31
|
-
"@dynamic-labs/types": "5.
|
|
32
|
-
"@dynamic-labs/utils": "5.
|
|
33
|
-
"@dynamic-labs/waas": "5.
|
|
34
|
-
"@dynamic-labs/wallet-book": "5.
|
|
35
|
-
"@dynamic-labs/wallet-connector-core": "5.
|
|
28
|
+
"@dynamic-labs/assert-package-version": "5.12.1",
|
|
29
|
+
"@dynamic-labs/logger": "5.12.1",
|
|
30
|
+
"@dynamic-labs/rpc-providers": "5.12.1",
|
|
31
|
+
"@dynamic-labs/sui-core": "5.12.1",
|
|
32
|
+
"@dynamic-labs/types": "5.12.1",
|
|
33
|
+
"@dynamic-labs/utils": "5.12.1",
|
|
34
|
+
"@dynamic-labs/waas": "5.12.1",
|
|
35
|
+
"@dynamic-labs/wallet-book": "5.12.1",
|
|
36
|
+
"@dynamic-labs/wallet-connector-core": "5.12.1"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {}
|
|
38
39
|
}
|
|
@@ -103,7 +103,7 @@ class DynamicWaasSuiConnector extends waas.withDynamicWaas(suiCore.SuiWalletConn
|
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
signMessage(message) {
|
|
106
|
+
signMessage(message, options) {
|
|
107
107
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
108
108
|
var _a, _b, _c, _d;
|
|
109
109
|
const waasSuiClient = yield this.getWaasWalletClient();
|
|
@@ -125,6 +125,7 @@ class DynamicWaasSuiConnector extends waas.withDynamicWaas(suiCore.SuiWalletConn
|
|
|
125
125
|
});
|
|
126
126
|
const signedMessage = yield waasSuiClient.signMessage({
|
|
127
127
|
accountAddress: this.activeAccountAddress,
|
|
128
|
+
approvalQuorum: options === null || options === void 0 ? void 0 : options.approvalQuorum,
|
|
128
129
|
authToken: (_d = this.getAuthToken) === null || _d === void 0 ? void 0 : _d.call(this),
|
|
129
130
|
elevatedAccessToken,
|
|
130
131
|
message,
|
|
@@ -135,7 +136,7 @@ class DynamicWaasSuiConnector extends waas.withDynamicWaas(suiCore.SuiWalletConn
|
|
|
135
136
|
return signedMessage;
|
|
136
137
|
});
|
|
137
138
|
}
|
|
138
|
-
createAndSignTransaction(transaction) {
|
|
139
|
+
createAndSignTransaction(transaction, approvalQuorum) {
|
|
139
140
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
140
141
|
var _a, _b, _c, _d;
|
|
141
142
|
const client = yield this.getSuiClient();
|
|
@@ -162,6 +163,7 @@ class DynamicWaasSuiConnector extends waas.withDynamicWaas(suiCore.SuiWalletConn
|
|
|
162
163
|
accountAddress: this.activeAccountAddress,
|
|
163
164
|
});
|
|
164
165
|
const signedTx = yield walletClient.signTransaction({
|
|
166
|
+
approvalQuorum,
|
|
165
167
|
authToken: (_d = this.getAuthToken) === null || _d === void 0 ? void 0 : _d.call(this),
|
|
166
168
|
elevatedAccessToken,
|
|
167
169
|
mfaToken,
|
|
@@ -179,10 +181,10 @@ class DynamicWaasSuiConnector extends waas.withDynamicWaas(suiCore.SuiWalletConn
|
|
|
179
181
|
};
|
|
180
182
|
});
|
|
181
183
|
}
|
|
182
|
-
signTransaction(transaction) {
|
|
184
|
+
signTransaction(transaction, approvalQuorum) {
|
|
183
185
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
184
186
|
try {
|
|
185
|
-
const { signedTx } = yield this.createAndSignTransaction(transaction);
|
|
187
|
+
const { signedTx } = yield this.createAndSignTransaction(transaction, approvalQuorum);
|
|
186
188
|
return signedTx;
|
|
187
189
|
}
|
|
188
190
|
catch (error) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DynamicWalletClient } from '@dynamic-labs-wallet/browser-wallet-client';
|
|
2
|
+
import type { ApprovalQuorumRequestContext } from '@dynamic-labs-wallet/core';
|
|
2
3
|
import type { LogoutReason } from '@dynamic-labs-sdk/client';
|
|
3
4
|
import { SuiClient, SuiTransactionBlockResponse } from '@mysten/sui/client';
|
|
4
5
|
import { Transaction } from '@mysten/sui/transactions';
|
|
@@ -152,9 +153,10 @@ declare const DynamicWaasSuiConnector_base: (abstract new (...args: any[]) => {
|
|
|
152
153
|
accountAddress: string;
|
|
153
154
|
newPassword: string;
|
|
154
155
|
}): Promise<void>;
|
|
155
|
-
signRawMessage({ accountAddress, context, message, password, }: {
|
|
156
|
+
signRawMessage({ accountAddress, approvalQuorum, context, message, password, }: {
|
|
156
157
|
accountAddress: string;
|
|
157
|
-
|
|
158
|
+
approvalQuorum?: ApprovalQuorumRequestContext | undefined;
|
|
159
|
+
context?: import("@dynamic-labs-wallet/core").SignMessageContext | undefined;
|
|
158
160
|
message: string;
|
|
159
161
|
password?: string | undefined;
|
|
160
162
|
}): Promise<string>;
|
|
@@ -225,9 +227,12 @@ export declare class DynamicWaasSuiConnector extends DynamicWaasSuiConnector_bas
|
|
|
225
227
|
private setActiveAccountAddress;
|
|
226
228
|
getActiveAccountAddress(): Promise<string | undefined>;
|
|
227
229
|
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
228
|
-
signMessage(message: string
|
|
230
|
+
signMessage(message: string, options?: {
|
|
231
|
+
address?: string;
|
|
232
|
+
approvalQuorum?: ApprovalQuorumRequestContext;
|
|
233
|
+
}): Promise<string>;
|
|
229
234
|
private createAndSignTransaction;
|
|
230
|
-
signTransaction(transaction: Transaction): Promise<SignedTransaction>;
|
|
235
|
+
signTransaction(transaction: Transaction, approvalQuorum?: ApprovalQuorumRequestContext): Promise<SignedTransaction>;
|
|
231
236
|
signAndExecuteTransaction(transaction: Transaction): Promise<SuiTransactionBlockResponse>;
|
|
232
237
|
getSuiClient(): Promise<SuiClient | undefined>;
|
|
233
238
|
getWalletClientByAddress({ accountAddress, }: {
|
|
@@ -99,7 +99,7 @@ class DynamicWaasSuiConnector extends withDynamicWaas(SuiWalletConnector) {
|
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
|
-
signMessage(message) {
|
|
102
|
+
signMessage(message, options) {
|
|
103
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
104
|
var _a, _b, _c, _d;
|
|
105
105
|
const waasSuiClient = yield this.getWaasWalletClient();
|
|
@@ -121,6 +121,7 @@ class DynamicWaasSuiConnector extends withDynamicWaas(SuiWalletConnector) {
|
|
|
121
121
|
});
|
|
122
122
|
const signedMessage = yield waasSuiClient.signMessage({
|
|
123
123
|
accountAddress: this.activeAccountAddress,
|
|
124
|
+
approvalQuorum: options === null || options === void 0 ? void 0 : options.approvalQuorum,
|
|
124
125
|
authToken: (_d = this.getAuthToken) === null || _d === void 0 ? void 0 : _d.call(this),
|
|
125
126
|
elevatedAccessToken,
|
|
126
127
|
message,
|
|
@@ -131,7 +132,7 @@ class DynamicWaasSuiConnector extends withDynamicWaas(SuiWalletConnector) {
|
|
|
131
132
|
return signedMessage;
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
|
-
createAndSignTransaction(transaction) {
|
|
135
|
+
createAndSignTransaction(transaction, approvalQuorum) {
|
|
135
136
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
137
|
var _a, _b, _c, _d;
|
|
137
138
|
const client = yield this.getSuiClient();
|
|
@@ -158,6 +159,7 @@ class DynamicWaasSuiConnector extends withDynamicWaas(SuiWalletConnector) {
|
|
|
158
159
|
accountAddress: this.activeAccountAddress,
|
|
159
160
|
});
|
|
160
161
|
const signedTx = yield walletClient.signTransaction({
|
|
162
|
+
approvalQuorum,
|
|
161
163
|
authToken: (_d = this.getAuthToken) === null || _d === void 0 ? void 0 : _d.call(this),
|
|
162
164
|
elevatedAccessToken,
|
|
163
165
|
mfaToken,
|
|
@@ -175,10 +177,10 @@ class DynamicWaasSuiConnector extends withDynamicWaas(SuiWalletConnector) {
|
|
|
175
177
|
};
|
|
176
178
|
});
|
|
177
179
|
}
|
|
178
|
-
signTransaction(transaction) {
|
|
180
|
+
signTransaction(transaction, approvalQuorum) {
|
|
179
181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
180
182
|
try {
|
|
181
|
-
const { signedTx } = yield this.createAndSignTransaction(transaction);
|
|
183
|
+
const { signedTx } = yield this.createAndSignTransaction(transaction, approvalQuorum);
|
|
182
184
|
return signedTx;
|
|
183
185
|
}
|
|
184
186
|
catch (error) {
|
|
@@ -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"]);
|
|
@@ -51,7 +54,7 @@ class WaasSuiWallet extends suiCore.SuiWallet {
|
|
|
51
54
|
* @param transaction - The [Transaction] to sign.
|
|
52
55
|
* @returns The signature of the signed transaction.
|
|
53
56
|
*/
|
|
54
|
-
signTransaction(transaction) {
|
|
57
|
+
signTransaction(transaction, options) {
|
|
55
58
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
56
59
|
const suiWalletConnector = this
|
|
57
60
|
._connector;
|
|
@@ -63,10 +66,66 @@ class WaasSuiWallet extends suiCore.SuiWallet {
|
|
|
63
66
|
suiWalletConnector.getWalletClientByAddress({
|
|
64
67
|
accountAddress: this.address,
|
|
65
68
|
});
|
|
66
|
-
const signedTransaction = yield suiWalletConnector.signTransaction(transaction);
|
|
69
|
+
const signedTransaction = yield suiWalletConnector.signTransaction(transaction, options === null || options === void 0 ? void 0 : options.approvalQuorum);
|
|
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
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ApprovalQuorumRequestContext } from '@dynamic-labs-wallet/core';
|
|
1
2
|
import { Transaction } from '@mysten/sui/transactions';
|
|
2
3
|
import { SignedTransaction } from '@mysten/wallet-standard';
|
|
3
4
|
import { WalletProps } from '@dynamic-labs/wallet-connector-core';
|
|
@@ -17,6 +18,17 @@ export declare class WaasSuiWallet extends SuiWallet {
|
|
|
17
18
|
* @param transaction - The [Transaction] to sign.
|
|
18
19
|
* @returns The signature of the signed transaction.
|
|
19
20
|
*/
|
|
20
|
-
signTransaction(transaction: Transaction
|
|
21
|
+
signTransaction(transaction: Transaction, options?: {
|
|
22
|
+
approvalQuorum?: ApprovalQuorumRequestContext;
|
|
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>;
|
|
21
33
|
getActiveNetwork(): Promise<string | undefined>;
|
|
22
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"]);
|
|
@@ -47,7 +50,7 @@ class WaasSuiWallet extends SuiWallet {
|
|
|
47
50
|
* @param transaction - The [Transaction] to sign.
|
|
48
51
|
* @returns The signature of the signed transaction.
|
|
49
52
|
*/
|
|
50
|
-
signTransaction(transaction) {
|
|
53
|
+
signTransaction(transaction, options) {
|
|
51
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
55
|
const suiWalletConnector = this
|
|
53
56
|
._connector;
|
|
@@ -59,10 +62,66 @@ class WaasSuiWallet extends SuiWallet {
|
|
|
59
62
|
suiWalletConnector.getWalletClientByAddress({
|
|
60
63
|
accountAddress: this.address,
|
|
61
64
|
});
|
|
62
|
-
const signedTransaction = yield suiWalletConnector.signTransaction(transaction);
|
|
65
|
+
const signedTransaction = yield suiWalletConnector.signTransaction(transaction, options === null || options === void 0 ? void 0 : options.approvalQuorum);
|
|
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
|