@dynamic-labs/waas-svm 4.46.1 → 4.46.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 +14 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -9
- package/src/connector/DynamicWaasSVMConnector.cjs +220 -37
- package/src/connector/DynamicWaasSVMConnector.d.ts +27 -3
- package/src/connector/DynamicWaasSVMConnector.js +220 -37
- package/utils/logger.cjs +4 -0
- package/utils/logger.d.ts +2 -1
- package/utils/logger.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.46.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.46.2...v4.46.3) (2025-11-20)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* ensure that phantomredirect does not render if the previous request is the same ([#9920](https://github.com/dynamic-labs/dynamic-auth/issues/9920)) ([2bb9665](https://github.com/dynamic-labs/dynamic-auth/commit/2bb96654821518bee6378c65d1353a33aea1363b))
|
|
8
|
+
|
|
9
|
+
### [4.46.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.46.1...v4.46.2) (2025-11-20)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* patch vulnerability with package @hpke/core ([#9923](https://github.com/dynamic-labs/dynamic-auth/issues/9923)) ([24133c6](https://github.com/dynamic-labs/dynamic-auth/commit/24133c6155fa36cd65cd2befabbdd9cbaa239b61))
|
|
15
|
+
|
|
2
16
|
### [4.46.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.46.0...v4.46.1) (2025-11-20)
|
|
3
17
|
|
|
4
18
|
## [4.46.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.45.3...v4.46.0) (2025-11-19)
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/waas-svm",
|
|
3
|
-
"version": "4.46.
|
|
3
|
+
"version": "4.46.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",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"@solana/web3.js": "1.98.1",
|
|
23
23
|
"eventemitter3": "5.0.1",
|
|
24
24
|
"bs58": "5.0.0",
|
|
25
|
-
"@dynamic-labs/assert-package-version": "4.46.
|
|
26
|
-
"@dynamic-labs/logger": "4.46.
|
|
27
|
-
"@dynamic-labs/rpc-providers": "4.46.
|
|
28
|
-
"@dynamic-labs/solana-core": "4.46.
|
|
29
|
-
"@dynamic-labs/types": "4.46.
|
|
30
|
-
"@dynamic-labs/utils": "4.46.
|
|
31
|
-
"@dynamic-labs/waas": "4.46.
|
|
32
|
-
"@dynamic-labs/wallet-connector-core": "4.46.
|
|
25
|
+
"@dynamic-labs/assert-package-version": "4.46.3",
|
|
26
|
+
"@dynamic-labs/logger": "4.46.3",
|
|
27
|
+
"@dynamic-labs/rpc-providers": "4.46.3",
|
|
28
|
+
"@dynamic-labs/solana-core": "4.46.3",
|
|
29
|
+
"@dynamic-labs/types": "4.46.3",
|
|
30
|
+
"@dynamic-labs/utils": "4.46.3",
|
|
31
|
+
"@dynamic-labs/waas": "4.46.3",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "4.46.3"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {}
|
|
35
35
|
}
|
|
@@ -12,6 +12,7 @@ var waas = require('@dynamic-labs/waas');
|
|
|
12
12
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
13
13
|
var logger = require('../../utils/logger.cjs');
|
|
14
14
|
var DynamicWaasSVMSigner = require('../signer/DynamicWaasSVMSigner.cjs');
|
|
15
|
+
var logger$1 = require('@dynamic-labs/logger');
|
|
15
16
|
|
|
16
17
|
class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWalletConnector) {
|
|
17
18
|
connect() {
|
|
@@ -22,8 +23,16 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
22
23
|
this.name = 'Dynamic Waas';
|
|
23
24
|
this.overrideKey = 'dynamicwaas';
|
|
24
25
|
this.isEmbeddedWallet = true;
|
|
26
|
+
this.logger = logger.logger;
|
|
25
27
|
this.walletUiUtils = props.walletUiUtils;
|
|
26
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Override setEnvironmentId to ensure it's set on the global logger
|
|
31
|
+
*/
|
|
32
|
+
setEnvironmentId(environmentId) {
|
|
33
|
+
super.setEnvironmentId(environmentId);
|
|
34
|
+
logger$1.Logger.setEnvironmentId(environmentId);
|
|
35
|
+
}
|
|
27
36
|
setActiveAccountAddress(accountAddress) {
|
|
28
37
|
this.activeAccountAddress = accountAddress;
|
|
29
38
|
}
|
|
@@ -54,10 +63,17 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
54
63
|
}
|
|
55
64
|
});
|
|
56
65
|
}
|
|
57
|
-
internalSignMessage(
|
|
58
|
-
return _tslib.__awaiter(this,
|
|
66
|
+
internalSignMessage(message_1) {
|
|
67
|
+
return _tslib.__awaiter(this, arguments, void 0, function* (message, { parentTraceId, startTime, } = {}) {
|
|
59
68
|
var _a, _b, _c;
|
|
60
|
-
const
|
|
69
|
+
const traceId = parentTraceId || this.generateTraceId();
|
|
70
|
+
const effectiveStartTime = startTime || Date.now();
|
|
71
|
+
const walletClient = yield this.instrumentAsync({
|
|
72
|
+
context: { startTime: effectiveStartTime, traceId },
|
|
73
|
+
fn: () => _tslib.__awaiter(this, void 0, void 0, function* () { return this.getWaasWalletClient(); }),
|
|
74
|
+
operation: 'internalSignMessage',
|
|
75
|
+
resource: 'getWaasWalletClient',
|
|
76
|
+
});
|
|
61
77
|
if (!this.activeAccountAddress) {
|
|
62
78
|
throw new Error('Active account address is required');
|
|
63
79
|
}
|
|
@@ -68,12 +84,21 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
68
84
|
const mfaToken = yield ((_b = this.getMfaToken) === null || _b === void 0 ? void 0 : _b.call(this, {
|
|
69
85
|
mfaAction: sdkApiCore.MFAAction.WalletWaasSign,
|
|
70
86
|
}));
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
const accountAddress = this.activeAccountAddress;
|
|
88
|
+
const authToken = (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this);
|
|
89
|
+
const signedMessage = yield this.instrumentAsync({
|
|
90
|
+
context: { startTime: effectiveStartTime, traceId },
|
|
91
|
+
fn: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
return walletClient.signMessage({
|
|
93
|
+
accountAddress,
|
|
94
|
+
authToken,
|
|
95
|
+
message,
|
|
96
|
+
mfaToken,
|
|
97
|
+
signedSessionId,
|
|
98
|
+
});
|
|
99
|
+
}),
|
|
100
|
+
operation: 'internalSignMessage',
|
|
101
|
+
resource: 'walletClient.signMessage',
|
|
77
102
|
});
|
|
78
103
|
return signedMessage;
|
|
79
104
|
});
|
|
@@ -83,17 +108,44 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
83
108
|
if (!this.activeAccountAddress) {
|
|
84
109
|
throw new Error('Active account address is required');
|
|
85
110
|
}
|
|
86
|
-
|
|
87
|
-
|
|
111
|
+
const traceId = this.generateTraceId();
|
|
112
|
+
const startTime = Date.now();
|
|
113
|
+
this.instrument('[signMessage] start', {
|
|
114
|
+
key: 'signMessage-start',
|
|
115
|
+
startTime,
|
|
116
|
+
time: 0,
|
|
117
|
+
traceId,
|
|
118
|
+
});
|
|
119
|
+
const signedMessage = yield this.walletUiUtils.signMessage({
|
|
120
|
+
handler: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
return this.internalSignMessage(message, {
|
|
122
|
+
parentTraceId: traceId,
|
|
123
|
+
startTime,
|
|
124
|
+
});
|
|
125
|
+
}),
|
|
88
126
|
message,
|
|
89
127
|
walletConnector: this,
|
|
90
128
|
});
|
|
129
|
+
this.instrument('[signMessage] completed', {
|
|
130
|
+
key: 'signMessage-completed',
|
|
131
|
+
startTime,
|
|
132
|
+
time: Date.now() - startTime,
|
|
133
|
+
traceId,
|
|
134
|
+
});
|
|
135
|
+
return signedMessage;
|
|
91
136
|
});
|
|
92
137
|
}
|
|
93
|
-
internalSignTransaction(
|
|
94
|
-
return _tslib.__awaiter(this,
|
|
95
|
-
var _a, _b
|
|
96
|
-
const
|
|
138
|
+
internalSignTransaction(transaction_1) {
|
|
139
|
+
return _tslib.__awaiter(this, arguments, void 0, function* (transaction, { parentTraceId, startTime, } = {}) {
|
|
140
|
+
var _a, _b;
|
|
141
|
+
const traceId = parentTraceId || this.generateTraceId();
|
|
142
|
+
const effectiveStartTime = startTime || Date.now();
|
|
143
|
+
const walletClient = yield this.instrumentAsync({
|
|
144
|
+
context: { startTime: effectiveStartTime, traceId },
|
|
145
|
+
fn: () => _tslib.__awaiter(this, void 0, void 0, function* () { return this.getWaasWalletClient(); }),
|
|
146
|
+
operation: 'internalSignTransaction',
|
|
147
|
+
resource: 'getWaasWalletClient',
|
|
148
|
+
});
|
|
97
149
|
const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
98
150
|
if (!signedSessionId) {
|
|
99
151
|
throw new utils.DynamicError('Signed session ID is required');
|
|
@@ -109,13 +161,22 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
109
161
|
: transaction.message.serialize();
|
|
110
162
|
const messageToSign = Buffer.from(messageBytes).toString('hex');
|
|
111
163
|
const chainId = yield this.getNetwork(true);
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
164
|
+
const senderAddress = this.activeAccountAddress;
|
|
165
|
+
const signature = yield this.instrumentAsync({
|
|
166
|
+
context: { startTime: effectiveStartTime, traceId },
|
|
167
|
+
fn: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
var _c;
|
|
169
|
+
return walletClient.signTransaction({
|
|
170
|
+
authToken: (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this),
|
|
171
|
+
chainId,
|
|
172
|
+
mfaToken,
|
|
173
|
+
senderAddress,
|
|
174
|
+
signedSessionId,
|
|
175
|
+
transaction: messageToSign,
|
|
176
|
+
});
|
|
177
|
+
}),
|
|
178
|
+
operation: 'internalSignTransaction',
|
|
179
|
+
resource: 'signTransaction',
|
|
119
180
|
});
|
|
120
181
|
transaction.addSignature(new web3_js.PublicKey(this.activeAccountAddress), Buffer.from(signature, 'hex'));
|
|
121
182
|
try {
|
|
@@ -125,7 +186,7 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
125
186
|
});
|
|
126
187
|
}
|
|
127
188
|
catch (err) {
|
|
128
|
-
logger.logger.warn('[
|
|
189
|
+
logger.logger.warn('[internalSignTransaction] Error signing transaction', err);
|
|
129
190
|
}
|
|
130
191
|
return transaction;
|
|
131
192
|
});
|
|
@@ -135,13 +196,33 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
135
196
|
if (!this.activeAccountAddress) {
|
|
136
197
|
throw new Error('Active account address is required');
|
|
137
198
|
}
|
|
199
|
+
const traceId = this.generateTraceId();
|
|
200
|
+
const startTime = Date.now();
|
|
201
|
+
this.instrument('[signTransaction] start', {
|
|
202
|
+
key: 'signTransaction-start',
|
|
203
|
+
startTime,
|
|
204
|
+
time: 0,
|
|
205
|
+
traceId,
|
|
206
|
+
});
|
|
138
207
|
const uiTransaction = new solanaCore.SolanaUiTransaction({
|
|
139
208
|
connection: this.getWalletClient(),
|
|
140
209
|
from: this.activeAccountAddress,
|
|
141
210
|
multipleTransactions: [transaction],
|
|
142
|
-
onSubmit: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
211
|
+
onSubmit: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
212
|
+
return this.internalSignTransaction(transaction, {
|
|
213
|
+
parentTraceId: traceId,
|
|
214
|
+
startTime,
|
|
215
|
+
});
|
|
216
|
+
}),
|
|
143
217
|
});
|
|
144
|
-
|
|
218
|
+
const signedTransaction = yield this.walletUiUtils.signTransaction(this, uiTransaction);
|
|
219
|
+
this.instrument('[signTransaction] completed', {
|
|
220
|
+
key: 'signTransaction-completed',
|
|
221
|
+
startTime,
|
|
222
|
+
time: Date.now() - startTime,
|
|
223
|
+
traceId,
|
|
224
|
+
});
|
|
225
|
+
return signedTransaction;
|
|
145
226
|
});
|
|
146
227
|
}
|
|
147
228
|
internalSignAllTransactions(transactions) {
|
|
@@ -162,40 +243,106 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
162
243
|
if (!this.activeAccountAddress) {
|
|
163
244
|
throw new Error('Active account address is required');
|
|
164
245
|
}
|
|
246
|
+
const traceId = this.generateTraceId();
|
|
247
|
+
const startTime = Date.now();
|
|
248
|
+
this.instrument('[signAllTransactions] start', {
|
|
249
|
+
key: 'signAllTransactions-start',
|
|
250
|
+
startTime,
|
|
251
|
+
time: 0,
|
|
252
|
+
traceId,
|
|
253
|
+
});
|
|
165
254
|
const uiTransaction = new solanaCore.SolanaUiTransaction({
|
|
166
255
|
connection: this.getWalletClient(),
|
|
167
256
|
from: this.activeAccountAddress,
|
|
168
257
|
multipleTransactions: transactions,
|
|
169
258
|
onSubmit: () => _tslib.__awaiter(this, void 0, void 0, function* () { return this.internalSignAllTransactions(transactions); }),
|
|
170
259
|
});
|
|
171
|
-
|
|
260
|
+
const signedTransactions = yield this.walletUiUtils.signTransaction(this, uiTransaction);
|
|
261
|
+
this.instrument('[signAllTransactions] completed', {
|
|
262
|
+
key: 'signAllTransactions-completed',
|
|
263
|
+
startTime,
|
|
264
|
+
time: Date.now() - startTime,
|
|
265
|
+
traceId,
|
|
266
|
+
});
|
|
267
|
+
return signedTransactions;
|
|
172
268
|
});
|
|
173
269
|
}
|
|
174
|
-
internalSignAndSendTransaction(
|
|
175
|
-
return _tslib.__awaiter(this,
|
|
270
|
+
internalSignAndSendTransaction(transaction_1, options_1) {
|
|
271
|
+
return _tslib.__awaiter(this, arguments, void 0, function* (transaction, options, { parentTraceId, startTime, } = {}) {
|
|
272
|
+
const traceId = parentTraceId || this.generateTraceId();
|
|
273
|
+
const effectiveStartTime = startTime || Date.now();
|
|
176
274
|
if (!this.activeAccountAddress) {
|
|
177
275
|
throw new Error('Active account address is required');
|
|
178
276
|
}
|
|
179
277
|
const connection = this.getWalletClient();
|
|
180
|
-
const signedTransaction = yield this.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
278
|
+
const signedTransaction = yield this.instrumentAsync({
|
|
279
|
+
context: { startTime: effectiveStartTime, traceId },
|
|
280
|
+
fn: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
281
|
+
return this.internalSignTransaction(transaction, {
|
|
282
|
+
parentTraceId: traceId,
|
|
283
|
+
startTime: effectiveStartTime,
|
|
284
|
+
});
|
|
285
|
+
}),
|
|
286
|
+
operation: 'internalSignAndSendTransaction',
|
|
287
|
+
resource: 'internalSignTransaction',
|
|
288
|
+
});
|
|
289
|
+
const signature = yield this.instrumentAsync({
|
|
290
|
+
context: {
|
|
291
|
+
rpcUrl: connection.rpcEndpoint,
|
|
292
|
+
startTime: effectiveStartTime,
|
|
293
|
+
traceId,
|
|
294
|
+
},
|
|
295
|
+
fn: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
296
|
+
return connection.sendRawTransaction(signedTransaction.serialize({
|
|
297
|
+
requireAllSignatures: false,
|
|
298
|
+
verifySignatures: true,
|
|
299
|
+
}), options);
|
|
300
|
+
}),
|
|
301
|
+
operation: 'internalSignAndSendTransaction',
|
|
302
|
+
resource: 'sendRawTransaction',
|
|
303
|
+
});
|
|
185
304
|
// Listen for transaction confirmation with timeout
|
|
305
|
+
const confirmationStartTime = Date.now();
|
|
186
306
|
return new Promise((resolve, reject) => {
|
|
307
|
+
var _a;
|
|
187
308
|
const timeout = setTimeout(() => {
|
|
309
|
+
const timeoutTotalElapsed = Date.now() - confirmationStartTime;
|
|
310
|
+
this.instrument(`[internalSignAndSendTransaction] Transaction timed out - total: ${timeoutTotalElapsed}ms`, {
|
|
311
|
+
key: 'internalSignAndSendTransaction-transactionTimedOut',
|
|
312
|
+
rpcUrl: connection.rpcEndpoint,
|
|
313
|
+
time: timeoutTotalElapsed,
|
|
314
|
+
traceId,
|
|
315
|
+
});
|
|
188
316
|
reject(new Error('Transaction timed out'));
|
|
189
317
|
}, 60000);
|
|
190
318
|
connection.onSignature(signature, (result) => {
|
|
191
319
|
clearTimeout(timeout);
|
|
320
|
+
const confirmationEndTime = Date.now();
|
|
321
|
+
const confirmationStepElapsed = confirmationEndTime - confirmationStartTime;
|
|
322
|
+
const confirmationTotalElapsed = confirmationEndTime - effectiveStartTime;
|
|
192
323
|
if (result.err) {
|
|
324
|
+
logger.logger.error(`[internalSignAndSendTransaction] Transaction failed - total: ${confirmationTotalElapsed}ms, step: ${confirmationStepElapsed}ms`, {
|
|
325
|
+
accountAddress: this.activeAccountAddress,
|
|
326
|
+
error: result.err,
|
|
327
|
+
key: 'internalSignAndSendTransaction-transactionFailed',
|
|
328
|
+
rpcUrl: connection.rpcEndpoint,
|
|
329
|
+
stepTime: confirmationStepElapsed,
|
|
330
|
+
time: confirmationTotalElapsed,
|
|
331
|
+
traceId,
|
|
332
|
+
});
|
|
193
333
|
reject(new Error(`Transaction failed: ${result.err}`));
|
|
194
334
|
}
|
|
195
335
|
else {
|
|
336
|
+
this.instrument(`[internalSignAndSendTransaction] Transaction confirmed - total: ${confirmationTotalElapsed}ms, step: ${confirmationStepElapsed}ms`, {
|
|
337
|
+
key: 'internalSignAndSendTransaction-transactionSuccess',
|
|
338
|
+
rpcUrl: connection.rpcEndpoint,
|
|
339
|
+
stepTime: confirmationStepElapsed,
|
|
340
|
+
time: confirmationTotalElapsed,
|
|
341
|
+
traceId,
|
|
342
|
+
});
|
|
196
343
|
resolve(signature);
|
|
197
344
|
}
|
|
198
|
-
}, 'confirmed');
|
|
345
|
+
}, (_a = options === null || options === void 0 ? void 0 : options.preflightCommitment) !== null && _a !== void 0 ? _a : 'confirmed');
|
|
199
346
|
});
|
|
200
347
|
});
|
|
201
348
|
}
|
|
@@ -204,13 +351,34 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
204
351
|
if (!this.activeAccountAddress) {
|
|
205
352
|
throw new Error('Active account address is required');
|
|
206
353
|
}
|
|
354
|
+
const traceId = this.generateTraceId();
|
|
355
|
+
const startTime = Date.now();
|
|
356
|
+
this.instrument('[signAndSendTransaction] start', {
|
|
357
|
+
key: 'signAndSendTransaction-start',
|
|
358
|
+
options,
|
|
359
|
+
startTime,
|
|
360
|
+
time: 0,
|
|
361
|
+
traceId,
|
|
362
|
+
});
|
|
207
363
|
const uiTransaction = new solanaCore.SolanaUiTransaction({
|
|
208
364
|
connection: this.getWalletClient(),
|
|
209
365
|
from: this.activeAccountAddress,
|
|
210
366
|
multipleTransactions: [transaction],
|
|
211
|
-
onSubmit: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
367
|
+
onSubmit: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
368
|
+
return this.internalSignAndSendTransaction(transaction, options, {
|
|
369
|
+
parentTraceId: traceId,
|
|
370
|
+
startTime,
|
|
371
|
+
});
|
|
372
|
+
}),
|
|
373
|
+
});
|
|
374
|
+
const result = yield this.walletUiUtils.sendTransaction(this, uiTransaction);
|
|
375
|
+
this.instrument('[signAndSendTransaction] completed', {
|
|
376
|
+
key: 'signAndSendTransaction-completed',
|
|
377
|
+
startTime,
|
|
378
|
+
time: Date.now() - startTime,
|
|
379
|
+
traceId,
|
|
212
380
|
});
|
|
213
|
-
return
|
|
381
|
+
return result;
|
|
214
382
|
});
|
|
215
383
|
}
|
|
216
384
|
getSigner() {
|
|
@@ -234,10 +402,25 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
234
402
|
if (!targetAccountAddress) {
|
|
235
403
|
throw new Error('Account address is required');
|
|
236
404
|
}
|
|
237
|
-
|
|
405
|
+
const traceId = this.generateTraceId();
|
|
406
|
+
const startTime = Date.now();
|
|
407
|
+
this.instrument('[exportClientKeyshares] start', {
|
|
408
|
+
key: 'exportClientKeyshares-start',
|
|
409
|
+
startTime,
|
|
410
|
+
time: 0,
|
|
411
|
+
traceId,
|
|
412
|
+
});
|
|
413
|
+
const result = yield _super.exportClientKeyshares.call(this, {
|
|
238
414
|
accountAddress: targetAccountAddress,
|
|
239
415
|
password,
|
|
240
416
|
});
|
|
417
|
+
this.instrument('[exportClientKeyshares] completed', {
|
|
418
|
+
key: 'exportClientKeyshares-completed',
|
|
419
|
+
startTime,
|
|
420
|
+
time: Date.now() - startTime,
|
|
421
|
+
traceId,
|
|
422
|
+
});
|
|
423
|
+
return result;
|
|
241
424
|
});
|
|
242
425
|
}
|
|
243
426
|
createUiTransaction(from) {
|
|
@@ -3,6 +3,7 @@ import { MFAAction } from '@dynamic-labs/sdk-api-core';
|
|
|
3
3
|
import { ISolanaSigner, SolanaWalletConnector, SolanaWalletConnectorOpts } from '@dynamic-labs/solana-core';
|
|
4
4
|
import { IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
|
|
5
5
|
import { IDynamicWaasConnector, InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
+
import { Logger } from '../../utils/logger';
|
|
6
7
|
export type DynamicWaasSVMConnectorProps = SolanaWalletConnectorOpts & {
|
|
7
8
|
walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
8
9
|
};
|
|
@@ -22,6 +23,7 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
|
|
|
22
23
|
dynamicWaasClient: import("@dynamic-labs-wallet/browser-wallet-client").DynamicWalletClient | undefined;
|
|
23
24
|
chainName: string;
|
|
24
25
|
authMode: "cookie" | "header";
|
|
26
|
+
logger: Logger;
|
|
25
27
|
__exportHandler: import("@dynamic-labs/waas").WaasExportHandler;
|
|
26
28
|
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
27
29
|
setGetAuthTokenFunction(getAuthToken: () => string): void;
|
|
@@ -94,6 +96,14 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
|
|
|
94
96
|
}): Promise<string>;
|
|
95
97
|
endSession(): Promise<void>;
|
|
96
98
|
getActiveAccountAddress(): Promise<string | undefined>;
|
|
99
|
+
generateTraceId(): string;
|
|
100
|
+
instrument(message: string, context: import("dist/packages/logger/src").InstrumentOptions & import("dist/packages/waas/utils/instrumentation").InstrumentContext & Record<string, any>): void;
|
|
101
|
+
instrumentAsync<T_1>({ operation, resource, fn, context, }: {
|
|
102
|
+
operation: string;
|
|
103
|
+
resource: string;
|
|
104
|
+
fn: (timing: import("dist/packages/waas/utils/instrumentation").InstrumentationTimer) => Promise<T_1>;
|
|
105
|
+
context?: Record<string, any> | undefined;
|
|
106
|
+
}): Promise<T_1>;
|
|
97
107
|
}) & typeof SolanaWalletConnector;
|
|
98
108
|
export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_base implements IDynamicWaasConnector {
|
|
99
109
|
connect(): Promise<void>;
|
|
@@ -103,16 +113,30 @@ export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_bas
|
|
|
103
113
|
activeAccountAddress: string | undefined;
|
|
104
114
|
protected walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
105
115
|
constructor(props: DynamicWaasSVMConnectorProps);
|
|
116
|
+
/**
|
|
117
|
+
* Override setEnvironmentId to ensure it's set on the global logger
|
|
118
|
+
*/
|
|
119
|
+
setEnvironmentId(environmentId: string): void;
|
|
120
|
+
logger: Logger;
|
|
106
121
|
private setActiveAccountAddress;
|
|
107
122
|
getActiveAccountAddress(): Promise<string | undefined>;
|
|
108
123
|
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
109
|
-
internalSignMessage(message: string
|
|
124
|
+
internalSignMessage(message: string, { parentTraceId, startTime, }?: {
|
|
125
|
+
parentTraceId?: string;
|
|
126
|
+
startTime?: number;
|
|
127
|
+
}): Promise<string>;
|
|
110
128
|
signMessage(message: string): Promise<string>;
|
|
111
|
-
internalSignTransaction<T extends Transaction | VersionedTransaction>(transaction: T
|
|
129
|
+
internalSignTransaction<T extends Transaction | VersionedTransaction>(transaction: T, { parentTraceId, startTime, }?: {
|
|
130
|
+
parentTraceId?: string;
|
|
131
|
+
startTime?: number;
|
|
132
|
+
}): Promise<Transaction | VersionedTransaction>;
|
|
112
133
|
signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<Transaction | VersionedTransaction>;
|
|
113
134
|
internalSignAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<(Transaction | VersionedTransaction)[]>;
|
|
114
135
|
signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<(Transaction | VersionedTransaction)[]>;
|
|
115
|
-
internalSignAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SendOptions
|
|
136
|
+
internalSignAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SendOptions, { parentTraceId, startTime, }?: {
|
|
137
|
+
parentTraceId?: string;
|
|
138
|
+
startTime?: number;
|
|
139
|
+
}): Promise<string>;
|
|
116
140
|
signAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SendOptions): Promise<string>;
|
|
117
141
|
getSigner(): Promise<ISolanaSigner>;
|
|
118
142
|
getWalletClientByAddress({ accountAddress, }: {
|
|
@@ -8,6 +8,7 @@ import { withDynamicWaas } from '@dynamic-labs/waas';
|
|
|
8
8
|
import { isSameAddress } from '@dynamic-labs/wallet-connector-core';
|
|
9
9
|
import { logger } from '../../utils/logger.js';
|
|
10
10
|
import { DynamicWaasSVMSigner } from '../signer/DynamicWaasSVMSigner.js';
|
|
11
|
+
import { Logger } from '@dynamic-labs/logger';
|
|
11
12
|
|
|
12
13
|
class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
13
14
|
connect() {
|
|
@@ -18,8 +19,16 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
18
19
|
this.name = 'Dynamic Waas';
|
|
19
20
|
this.overrideKey = 'dynamicwaas';
|
|
20
21
|
this.isEmbeddedWallet = true;
|
|
22
|
+
this.logger = logger;
|
|
21
23
|
this.walletUiUtils = props.walletUiUtils;
|
|
22
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Override setEnvironmentId to ensure it's set on the global logger
|
|
27
|
+
*/
|
|
28
|
+
setEnvironmentId(environmentId) {
|
|
29
|
+
super.setEnvironmentId(environmentId);
|
|
30
|
+
Logger.setEnvironmentId(environmentId);
|
|
31
|
+
}
|
|
23
32
|
setActiveAccountAddress(accountAddress) {
|
|
24
33
|
this.activeAccountAddress = accountAddress;
|
|
25
34
|
}
|
|
@@ -50,10 +59,17 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
50
59
|
}
|
|
51
60
|
});
|
|
52
61
|
}
|
|
53
|
-
internalSignMessage(
|
|
54
|
-
return __awaiter(this,
|
|
62
|
+
internalSignMessage(message_1) {
|
|
63
|
+
return __awaiter(this, arguments, void 0, function* (message, { parentTraceId, startTime, } = {}) {
|
|
55
64
|
var _a, _b, _c;
|
|
56
|
-
const
|
|
65
|
+
const traceId = parentTraceId || this.generateTraceId();
|
|
66
|
+
const effectiveStartTime = startTime || Date.now();
|
|
67
|
+
const walletClient = yield this.instrumentAsync({
|
|
68
|
+
context: { startTime: effectiveStartTime, traceId },
|
|
69
|
+
fn: () => __awaiter(this, void 0, void 0, function* () { return this.getWaasWalletClient(); }),
|
|
70
|
+
operation: 'internalSignMessage',
|
|
71
|
+
resource: 'getWaasWalletClient',
|
|
72
|
+
});
|
|
57
73
|
if (!this.activeAccountAddress) {
|
|
58
74
|
throw new Error('Active account address is required');
|
|
59
75
|
}
|
|
@@ -64,12 +80,21 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
64
80
|
const mfaToken = yield ((_b = this.getMfaToken) === null || _b === void 0 ? void 0 : _b.call(this, {
|
|
65
81
|
mfaAction: MFAAction.WalletWaasSign,
|
|
66
82
|
}));
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
83
|
+
const accountAddress = this.activeAccountAddress;
|
|
84
|
+
const authToken = (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this);
|
|
85
|
+
const signedMessage = yield this.instrumentAsync({
|
|
86
|
+
context: { startTime: effectiveStartTime, traceId },
|
|
87
|
+
fn: () => __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
return walletClient.signMessage({
|
|
89
|
+
accountAddress,
|
|
90
|
+
authToken,
|
|
91
|
+
message,
|
|
92
|
+
mfaToken,
|
|
93
|
+
signedSessionId,
|
|
94
|
+
});
|
|
95
|
+
}),
|
|
96
|
+
operation: 'internalSignMessage',
|
|
97
|
+
resource: 'walletClient.signMessage',
|
|
73
98
|
});
|
|
74
99
|
return signedMessage;
|
|
75
100
|
});
|
|
@@ -79,17 +104,44 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
79
104
|
if (!this.activeAccountAddress) {
|
|
80
105
|
throw new Error('Active account address is required');
|
|
81
106
|
}
|
|
82
|
-
|
|
83
|
-
|
|
107
|
+
const traceId = this.generateTraceId();
|
|
108
|
+
const startTime = Date.now();
|
|
109
|
+
this.instrument('[signMessage] start', {
|
|
110
|
+
key: 'signMessage-start',
|
|
111
|
+
startTime,
|
|
112
|
+
time: 0,
|
|
113
|
+
traceId,
|
|
114
|
+
});
|
|
115
|
+
const signedMessage = yield this.walletUiUtils.signMessage({
|
|
116
|
+
handler: () => __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
return this.internalSignMessage(message, {
|
|
118
|
+
parentTraceId: traceId,
|
|
119
|
+
startTime,
|
|
120
|
+
});
|
|
121
|
+
}),
|
|
84
122
|
message,
|
|
85
123
|
walletConnector: this,
|
|
86
124
|
});
|
|
125
|
+
this.instrument('[signMessage] completed', {
|
|
126
|
+
key: 'signMessage-completed',
|
|
127
|
+
startTime,
|
|
128
|
+
time: Date.now() - startTime,
|
|
129
|
+
traceId,
|
|
130
|
+
});
|
|
131
|
+
return signedMessage;
|
|
87
132
|
});
|
|
88
133
|
}
|
|
89
|
-
internalSignTransaction(
|
|
90
|
-
return __awaiter(this,
|
|
91
|
-
var _a, _b
|
|
92
|
-
const
|
|
134
|
+
internalSignTransaction(transaction_1) {
|
|
135
|
+
return __awaiter(this, arguments, void 0, function* (transaction, { parentTraceId, startTime, } = {}) {
|
|
136
|
+
var _a, _b;
|
|
137
|
+
const traceId = parentTraceId || this.generateTraceId();
|
|
138
|
+
const effectiveStartTime = startTime || Date.now();
|
|
139
|
+
const walletClient = yield this.instrumentAsync({
|
|
140
|
+
context: { startTime: effectiveStartTime, traceId },
|
|
141
|
+
fn: () => __awaiter(this, void 0, void 0, function* () { return this.getWaasWalletClient(); }),
|
|
142
|
+
operation: 'internalSignTransaction',
|
|
143
|
+
resource: 'getWaasWalletClient',
|
|
144
|
+
});
|
|
93
145
|
const signedSessionId = yield ((_a = this.getSignedSessionId) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
94
146
|
if (!signedSessionId) {
|
|
95
147
|
throw new DynamicError('Signed session ID is required');
|
|
@@ -105,13 +157,22 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
105
157
|
: transaction.message.serialize();
|
|
106
158
|
const messageToSign = Buffer.from(messageBytes).toString('hex');
|
|
107
159
|
const chainId = yield this.getNetwork(true);
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
160
|
+
const senderAddress = this.activeAccountAddress;
|
|
161
|
+
const signature = yield this.instrumentAsync({
|
|
162
|
+
context: { startTime: effectiveStartTime, traceId },
|
|
163
|
+
fn: () => __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
var _c;
|
|
165
|
+
return walletClient.signTransaction({
|
|
166
|
+
authToken: (_c = this.getAuthToken) === null || _c === void 0 ? void 0 : _c.call(this),
|
|
167
|
+
chainId,
|
|
168
|
+
mfaToken,
|
|
169
|
+
senderAddress,
|
|
170
|
+
signedSessionId,
|
|
171
|
+
transaction: messageToSign,
|
|
172
|
+
});
|
|
173
|
+
}),
|
|
174
|
+
operation: 'internalSignTransaction',
|
|
175
|
+
resource: 'signTransaction',
|
|
115
176
|
});
|
|
116
177
|
transaction.addSignature(new PublicKey(this.activeAccountAddress), Buffer.from(signature, 'hex'));
|
|
117
178
|
try {
|
|
@@ -121,7 +182,7 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
121
182
|
});
|
|
122
183
|
}
|
|
123
184
|
catch (err) {
|
|
124
|
-
logger.warn('[
|
|
185
|
+
logger.warn('[internalSignTransaction] Error signing transaction', err);
|
|
125
186
|
}
|
|
126
187
|
return transaction;
|
|
127
188
|
});
|
|
@@ -131,13 +192,33 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
131
192
|
if (!this.activeAccountAddress) {
|
|
132
193
|
throw new Error('Active account address is required');
|
|
133
194
|
}
|
|
195
|
+
const traceId = this.generateTraceId();
|
|
196
|
+
const startTime = Date.now();
|
|
197
|
+
this.instrument('[signTransaction] start', {
|
|
198
|
+
key: 'signTransaction-start',
|
|
199
|
+
startTime,
|
|
200
|
+
time: 0,
|
|
201
|
+
traceId,
|
|
202
|
+
});
|
|
134
203
|
const uiTransaction = new SolanaUiTransaction({
|
|
135
204
|
connection: this.getWalletClient(),
|
|
136
205
|
from: this.activeAccountAddress,
|
|
137
206
|
multipleTransactions: [transaction],
|
|
138
|
-
onSubmit: () => __awaiter(this, void 0, void 0, function* () {
|
|
207
|
+
onSubmit: () => __awaiter(this, void 0, void 0, function* () {
|
|
208
|
+
return this.internalSignTransaction(transaction, {
|
|
209
|
+
parentTraceId: traceId,
|
|
210
|
+
startTime,
|
|
211
|
+
});
|
|
212
|
+
}),
|
|
139
213
|
});
|
|
140
|
-
|
|
214
|
+
const signedTransaction = yield this.walletUiUtils.signTransaction(this, uiTransaction);
|
|
215
|
+
this.instrument('[signTransaction] completed', {
|
|
216
|
+
key: 'signTransaction-completed',
|
|
217
|
+
startTime,
|
|
218
|
+
time: Date.now() - startTime,
|
|
219
|
+
traceId,
|
|
220
|
+
});
|
|
221
|
+
return signedTransaction;
|
|
141
222
|
});
|
|
142
223
|
}
|
|
143
224
|
internalSignAllTransactions(transactions) {
|
|
@@ -158,40 +239,106 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
158
239
|
if (!this.activeAccountAddress) {
|
|
159
240
|
throw new Error('Active account address is required');
|
|
160
241
|
}
|
|
242
|
+
const traceId = this.generateTraceId();
|
|
243
|
+
const startTime = Date.now();
|
|
244
|
+
this.instrument('[signAllTransactions] start', {
|
|
245
|
+
key: 'signAllTransactions-start',
|
|
246
|
+
startTime,
|
|
247
|
+
time: 0,
|
|
248
|
+
traceId,
|
|
249
|
+
});
|
|
161
250
|
const uiTransaction = new SolanaUiTransaction({
|
|
162
251
|
connection: this.getWalletClient(),
|
|
163
252
|
from: this.activeAccountAddress,
|
|
164
253
|
multipleTransactions: transactions,
|
|
165
254
|
onSubmit: () => __awaiter(this, void 0, void 0, function* () { return this.internalSignAllTransactions(transactions); }),
|
|
166
255
|
});
|
|
167
|
-
|
|
256
|
+
const signedTransactions = yield this.walletUiUtils.signTransaction(this, uiTransaction);
|
|
257
|
+
this.instrument('[signAllTransactions] completed', {
|
|
258
|
+
key: 'signAllTransactions-completed',
|
|
259
|
+
startTime,
|
|
260
|
+
time: Date.now() - startTime,
|
|
261
|
+
traceId,
|
|
262
|
+
});
|
|
263
|
+
return signedTransactions;
|
|
168
264
|
});
|
|
169
265
|
}
|
|
170
|
-
internalSignAndSendTransaction(
|
|
171
|
-
return __awaiter(this,
|
|
266
|
+
internalSignAndSendTransaction(transaction_1, options_1) {
|
|
267
|
+
return __awaiter(this, arguments, void 0, function* (transaction, options, { parentTraceId, startTime, } = {}) {
|
|
268
|
+
const traceId = parentTraceId || this.generateTraceId();
|
|
269
|
+
const effectiveStartTime = startTime || Date.now();
|
|
172
270
|
if (!this.activeAccountAddress) {
|
|
173
271
|
throw new Error('Active account address is required');
|
|
174
272
|
}
|
|
175
273
|
const connection = this.getWalletClient();
|
|
176
|
-
const signedTransaction = yield this.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
274
|
+
const signedTransaction = yield this.instrumentAsync({
|
|
275
|
+
context: { startTime: effectiveStartTime, traceId },
|
|
276
|
+
fn: () => __awaiter(this, void 0, void 0, function* () {
|
|
277
|
+
return this.internalSignTransaction(transaction, {
|
|
278
|
+
parentTraceId: traceId,
|
|
279
|
+
startTime: effectiveStartTime,
|
|
280
|
+
});
|
|
281
|
+
}),
|
|
282
|
+
operation: 'internalSignAndSendTransaction',
|
|
283
|
+
resource: 'internalSignTransaction',
|
|
284
|
+
});
|
|
285
|
+
const signature = yield this.instrumentAsync({
|
|
286
|
+
context: {
|
|
287
|
+
rpcUrl: connection.rpcEndpoint,
|
|
288
|
+
startTime: effectiveStartTime,
|
|
289
|
+
traceId,
|
|
290
|
+
},
|
|
291
|
+
fn: () => __awaiter(this, void 0, void 0, function* () {
|
|
292
|
+
return connection.sendRawTransaction(signedTransaction.serialize({
|
|
293
|
+
requireAllSignatures: false,
|
|
294
|
+
verifySignatures: true,
|
|
295
|
+
}), options);
|
|
296
|
+
}),
|
|
297
|
+
operation: 'internalSignAndSendTransaction',
|
|
298
|
+
resource: 'sendRawTransaction',
|
|
299
|
+
});
|
|
181
300
|
// Listen for transaction confirmation with timeout
|
|
301
|
+
const confirmationStartTime = Date.now();
|
|
182
302
|
return new Promise((resolve, reject) => {
|
|
303
|
+
var _a;
|
|
183
304
|
const timeout = setTimeout(() => {
|
|
305
|
+
const timeoutTotalElapsed = Date.now() - confirmationStartTime;
|
|
306
|
+
this.instrument(`[internalSignAndSendTransaction] Transaction timed out - total: ${timeoutTotalElapsed}ms`, {
|
|
307
|
+
key: 'internalSignAndSendTransaction-transactionTimedOut',
|
|
308
|
+
rpcUrl: connection.rpcEndpoint,
|
|
309
|
+
time: timeoutTotalElapsed,
|
|
310
|
+
traceId,
|
|
311
|
+
});
|
|
184
312
|
reject(new Error('Transaction timed out'));
|
|
185
313
|
}, 60000);
|
|
186
314
|
connection.onSignature(signature, (result) => {
|
|
187
315
|
clearTimeout(timeout);
|
|
316
|
+
const confirmationEndTime = Date.now();
|
|
317
|
+
const confirmationStepElapsed = confirmationEndTime - confirmationStartTime;
|
|
318
|
+
const confirmationTotalElapsed = confirmationEndTime - effectiveStartTime;
|
|
188
319
|
if (result.err) {
|
|
320
|
+
logger.error(`[internalSignAndSendTransaction] Transaction failed - total: ${confirmationTotalElapsed}ms, step: ${confirmationStepElapsed}ms`, {
|
|
321
|
+
accountAddress: this.activeAccountAddress,
|
|
322
|
+
error: result.err,
|
|
323
|
+
key: 'internalSignAndSendTransaction-transactionFailed',
|
|
324
|
+
rpcUrl: connection.rpcEndpoint,
|
|
325
|
+
stepTime: confirmationStepElapsed,
|
|
326
|
+
time: confirmationTotalElapsed,
|
|
327
|
+
traceId,
|
|
328
|
+
});
|
|
189
329
|
reject(new Error(`Transaction failed: ${result.err}`));
|
|
190
330
|
}
|
|
191
331
|
else {
|
|
332
|
+
this.instrument(`[internalSignAndSendTransaction] Transaction confirmed - total: ${confirmationTotalElapsed}ms, step: ${confirmationStepElapsed}ms`, {
|
|
333
|
+
key: 'internalSignAndSendTransaction-transactionSuccess',
|
|
334
|
+
rpcUrl: connection.rpcEndpoint,
|
|
335
|
+
stepTime: confirmationStepElapsed,
|
|
336
|
+
time: confirmationTotalElapsed,
|
|
337
|
+
traceId,
|
|
338
|
+
});
|
|
192
339
|
resolve(signature);
|
|
193
340
|
}
|
|
194
|
-
}, 'confirmed');
|
|
341
|
+
}, (_a = options === null || options === void 0 ? void 0 : options.preflightCommitment) !== null && _a !== void 0 ? _a : 'confirmed');
|
|
195
342
|
});
|
|
196
343
|
});
|
|
197
344
|
}
|
|
@@ -200,13 +347,34 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
200
347
|
if (!this.activeAccountAddress) {
|
|
201
348
|
throw new Error('Active account address is required');
|
|
202
349
|
}
|
|
350
|
+
const traceId = this.generateTraceId();
|
|
351
|
+
const startTime = Date.now();
|
|
352
|
+
this.instrument('[signAndSendTransaction] start', {
|
|
353
|
+
key: 'signAndSendTransaction-start',
|
|
354
|
+
options,
|
|
355
|
+
startTime,
|
|
356
|
+
time: 0,
|
|
357
|
+
traceId,
|
|
358
|
+
});
|
|
203
359
|
const uiTransaction = new SolanaUiTransaction({
|
|
204
360
|
connection: this.getWalletClient(),
|
|
205
361
|
from: this.activeAccountAddress,
|
|
206
362
|
multipleTransactions: [transaction],
|
|
207
|
-
onSubmit: () => __awaiter(this, void 0, void 0, function* () {
|
|
363
|
+
onSubmit: () => __awaiter(this, void 0, void 0, function* () {
|
|
364
|
+
return this.internalSignAndSendTransaction(transaction, options, {
|
|
365
|
+
parentTraceId: traceId,
|
|
366
|
+
startTime,
|
|
367
|
+
});
|
|
368
|
+
}),
|
|
369
|
+
});
|
|
370
|
+
const result = yield this.walletUiUtils.sendTransaction(this, uiTransaction);
|
|
371
|
+
this.instrument('[signAndSendTransaction] completed', {
|
|
372
|
+
key: 'signAndSendTransaction-completed',
|
|
373
|
+
startTime,
|
|
374
|
+
time: Date.now() - startTime,
|
|
375
|
+
traceId,
|
|
208
376
|
});
|
|
209
|
-
return
|
|
377
|
+
return result;
|
|
210
378
|
});
|
|
211
379
|
}
|
|
212
380
|
getSigner() {
|
|
@@ -230,10 +398,25 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
230
398
|
if (!targetAccountAddress) {
|
|
231
399
|
throw new Error('Account address is required');
|
|
232
400
|
}
|
|
233
|
-
|
|
401
|
+
const traceId = this.generateTraceId();
|
|
402
|
+
const startTime = Date.now();
|
|
403
|
+
this.instrument('[exportClientKeyshares] start', {
|
|
404
|
+
key: 'exportClientKeyshares-start',
|
|
405
|
+
startTime,
|
|
406
|
+
time: 0,
|
|
407
|
+
traceId,
|
|
408
|
+
});
|
|
409
|
+
const result = yield _super.exportClientKeyshares.call(this, {
|
|
234
410
|
accountAddress: targetAccountAddress,
|
|
235
411
|
password,
|
|
236
412
|
});
|
|
413
|
+
this.instrument('[exportClientKeyshares] completed', {
|
|
414
|
+
key: 'exportClientKeyshares-completed',
|
|
415
|
+
startTime,
|
|
416
|
+
time: Date.now() - startTime,
|
|
417
|
+
traceId,
|
|
418
|
+
});
|
|
419
|
+
return result;
|
|
237
420
|
});
|
|
238
421
|
}
|
|
239
422
|
createUiTransaction(from) {
|
package/utils/logger.cjs
CHANGED
package/utils/logger.d.ts
CHANGED