@dynamic-labs/waas-svm 4.100.3 → 4.100.4
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 +10 -0
- package/_virtual/_tslib.cjs +13 -0
- package/_virtual/_tslib.js +13 -1
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -10
- package/src/connector/DynamicWaasSVMConnector.cjs +67 -31
- package/src/connector/DynamicWaasSVMConnector.d.ts +15 -14
- package/src/connector/DynamicWaasSVMConnector.js +68 -32
- package/src/signer/DynamicWaasSVMSigner.cjs +8 -2
- package/src/signer/DynamicWaasSVMSigner.d.ts +5 -5
- package/src/signer/DynamicWaasSVMSigner.js +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.100.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.100.3...v4.100.4) (2026-10-08)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **embedded-webview:** connect Coinbase Wallet via a real popup window [V4 backport] ([#12429](https://github.com/dynamic-labs/dynamic-auth/issues/12429)) ([82368fd](https://github.com/dynamic-labs/dynamic-auth/commit/82368fd41791e3a6e2ffec4dc6a0b401a7bec82f))
|
|
8
|
+
* **rpc-providers:** skip networks without an RPC URL instead of throwing [v4 backport] ([#12431](https://github.com/dynamic-labs/dynamic-auth/issues/12431)) ([95f05c5](https://github.com/dynamic-labs/dynamic-auth/commit/95f05c5c0c5195cc02f4dbc9969e90fc2e41eae0))
|
|
9
|
+
* unblock v4 CI (Playwright password/sign-message tests, shell-quote critical advisory) [V4 backport] ([#12475](https://github.com/dynamic-labs/dynamic-auth/issues/12475)) ([c4ad2ba](https://github.com/dynamic-labs/dynamic-auth/commit/c4ad2ba52a5d329a6b324b27c4ccfb3b48970223)), closes [#12468](https://github.com/dynamic-labs/dynamic-auth/issues/12468) [#1936](https://github.com/dynamic-labs/dynamic-auth/issues/1936) [#12476](https://github.com/dynamic-labs/dynamic-auth/issues/12476)
|
|
10
|
+
* **waas:** fall back when crypto.randomUUID is unavailable (v4 backport) ([#12436](https://github.com/dynamic-labs/dynamic-auth/issues/12436)) ([c72781e](https://github.com/dynamic-labs/dynamic-auth/commit/c72781ebf4269b356a98f3fc167bbd643a601bfd))
|
|
11
|
+
|
|
2
12
|
### [4.100.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.100.2...v4.100.3) (2026-09-18)
|
|
3
13
|
|
|
4
14
|
|
package/_virtual/_tslib.cjs
CHANGED
|
@@ -18,6 +18,18 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
18
18
|
PERFORMANCE OF THIS SOFTWARE.
|
|
19
19
|
***************************************************************************** */
|
|
20
20
|
|
|
21
|
+
function __rest(s, e) {
|
|
22
|
+
var t = {};
|
|
23
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
+
t[p] = s[p];
|
|
25
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
+
t[p[i]] = s[p[i]];
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
}
|
|
32
|
+
|
|
21
33
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
22
34
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
35
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -34,3 +46,4 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
34
46
|
};
|
|
35
47
|
|
|
36
48
|
exports.__awaiter = __awaiter;
|
|
49
|
+
exports.__rest = __rest;
|
package/_virtual/_tslib.js
CHANGED
|
@@ -14,6 +14,18 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
16
|
|
|
17
|
+
function __rest(s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
22
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
24
|
+
t[p[i]] = s[p[i]];
|
|
25
|
+
}
|
|
26
|
+
return t;
|
|
27
|
+
}
|
|
28
|
+
|
|
17
29
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
18
30
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
31
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -29,4 +41,4 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
29
41
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
30
42
|
};
|
|
31
43
|
|
|
32
|
-
export { __awaiter };
|
|
44
|
+
export { __awaiter, __rest };
|
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.100.
|
|
3
|
+
"version": "4.100.4",
|
|
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",
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@dynamic-labs/sdk-api-core": "0.40.0",
|
|
22
|
-
"@dynamic-labs/embedded-wallet-solana": "4.100.
|
|
22
|
+
"@dynamic-labs/embedded-wallet-solana": "4.100.4",
|
|
23
23
|
"@solana/web3.js": "1.98.1",
|
|
24
24
|
"eventemitter3": "5.0.1",
|
|
25
25
|
"bs58": "5.0.0",
|
|
26
|
-
"@dynamic-labs/assert-package-version": "4.100.
|
|
27
|
-
"@dynamic-labs/logger": "4.100.
|
|
28
|
-
"@dynamic-labs/rpc-providers": "4.100.
|
|
29
|
-
"@dynamic-labs/solana-core": "4.100.
|
|
30
|
-
"@dynamic-labs/types": "4.100.
|
|
31
|
-
"@dynamic-labs/utils": "4.100.
|
|
32
|
-
"@dynamic-labs/waas": "4.100.
|
|
33
|
-
"@dynamic-labs/wallet-connector-core": "4.100.
|
|
26
|
+
"@dynamic-labs/assert-package-version": "4.100.4",
|
|
27
|
+
"@dynamic-labs/logger": "4.100.4",
|
|
28
|
+
"@dynamic-labs/rpc-providers": "4.100.4",
|
|
29
|
+
"@dynamic-labs/solana-core": "4.100.4",
|
|
30
|
+
"@dynamic-labs/types": "4.100.4",
|
|
31
|
+
"@dynamic-labs/utils": "4.100.4",
|
|
32
|
+
"@dynamic-labs/waas": "4.100.4",
|
|
33
|
+
"@dynamic-labs/wallet-connector-core": "4.100.4"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {}
|
|
36
36
|
}
|
|
@@ -30,6 +30,7 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
30
30
|
this.overrideKey = 'dynamicwaas';
|
|
31
31
|
this.isEmbeddedWallet = true;
|
|
32
32
|
this.getSvmGasSponsorshipEnabled = () => false;
|
|
33
|
+
this.supportsSvmGasSponsorship = true;
|
|
33
34
|
this.logger = logger.logger;
|
|
34
35
|
this.walletUiUtils = props.walletUiUtils;
|
|
35
36
|
}
|
|
@@ -71,18 +72,52 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
71
72
|
}
|
|
72
73
|
return transaction.signatures.some((sig) => sig.signature && !sig.signature.every((byte) => byte === 0));
|
|
73
74
|
}
|
|
75
|
+
getFeePayerAddress(transaction) {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
if ('version' in transaction) {
|
|
78
|
+
return (_a = transaction.message.staticAccountKeys[0]) === null || _a === void 0 ? void 0 : _a.toBase58();
|
|
79
|
+
}
|
|
80
|
+
return (_b = transaction.feePayer) === null || _b === void 0 ? void 0 : _b.toBase58();
|
|
81
|
+
}
|
|
82
|
+
attemptSponsorship(environmentId, transaction, sponsorshipMode, attempt) {
|
|
83
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const sponsoredTransaction = yield this.instrumentAsync({
|
|
85
|
+
context: { attempt, maxAttempts: SPONSORSHIP_MAX_ATTEMPTS },
|
|
86
|
+
fn: () => _tslib.__awaiter(this, void 0, void 0, function* () { return embeddedWalletSolana.sponsorSolanaTransaction(environmentId, transaction); }),
|
|
87
|
+
operation: 'maybeSponsorTransaction',
|
|
88
|
+
resource: `sponsorSolanaTransaction-attempt-${attempt}`,
|
|
89
|
+
});
|
|
90
|
+
const feePayer = this.getFeePayerAddress(sponsoredTransaction);
|
|
91
|
+
if (sponsorshipMode === 'required' &&
|
|
92
|
+
(!feePayer || feePayer === this.activeAccountAddress)) {
|
|
93
|
+
throw new utils.DynamicError('Sponsored transaction is not sponsored', 'sponsorship_not_applied');
|
|
94
|
+
}
|
|
95
|
+
logger.logger.info('[maybeSponsorTransaction] Transaction sponsored successfully');
|
|
96
|
+
return sponsoredTransaction;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
asSponsorshipError(error) {
|
|
100
|
+
if (error instanceof utils.DynamicError) {
|
|
101
|
+
return error;
|
|
102
|
+
}
|
|
103
|
+
return new utils.DynamicError(SPONSORSHIP_FAILURE_MESSAGE, SPONSORSHIP_FAILURE_CODE);
|
|
104
|
+
}
|
|
74
105
|
/**
|
|
75
106
|
* Sponsor a transaction if gas sponsorship is enabled and the tx is unsigned.
|
|
76
107
|
* Retries transient failures; throws if sponsorship never succeeds so callers
|
|
77
108
|
* never sign and return a transaction that silently skipped sponsorship
|
|
78
109
|
* (e.g. a 0-SOL wallet still set as fee payer).
|
|
79
110
|
*/
|
|
80
|
-
maybeSponsorTransaction(
|
|
81
|
-
return _tslib.__awaiter(this,
|
|
82
|
-
if (
|
|
111
|
+
maybeSponsorTransaction(transaction_1) {
|
|
112
|
+
return _tslib.__awaiter(this, arguments, void 0, function* (transaction, sponsorshipMode = 'auto') {
|
|
113
|
+
if (sponsorshipMode === 'off' ||
|
|
114
|
+
(sponsorshipMode === 'auto' && !this.getSvmGasSponsorshipEnabled())) {
|
|
83
115
|
return transaction;
|
|
84
116
|
}
|
|
85
117
|
if (this.isTxAlreadySigned(transaction)) {
|
|
118
|
+
if (sponsorshipMode === 'required') {
|
|
119
|
+
throw new utils.DynamicError('Signed transactions cannot be sponsored', 'sponsorship_transaction_already_signed');
|
|
120
|
+
}
|
|
86
121
|
logger.logger.debug('[maybeSponsorTransaction] Skipping sponsorship - transaction already signed');
|
|
87
122
|
return transaction;
|
|
88
123
|
}
|
|
@@ -95,23 +130,13 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
95
130
|
const { environmentId } = this;
|
|
96
131
|
for (let attempt = 1; attempt <= SPONSORSHIP_MAX_ATTEMPTS; attempt++) {
|
|
97
132
|
try {
|
|
98
|
-
|
|
99
|
-
context: { attempt, maxAttempts: SPONSORSHIP_MAX_ATTEMPTS },
|
|
100
|
-
fn: () => _tslib.__awaiter(this, void 0, void 0, function* () { return embeddedWalletSolana.sponsorSolanaTransaction(environmentId, transaction); }),
|
|
101
|
-
operation: 'maybeSponsorTransaction',
|
|
102
|
-
resource: `sponsorSolanaTransaction-attempt-${attempt}`,
|
|
103
|
-
});
|
|
104
|
-
logger.logger.info('[maybeSponsorTransaction] Transaction sponsored successfully');
|
|
105
|
-
return sponsoredTransaction;
|
|
133
|
+
return yield this.attemptSponsorship(environmentId, transaction, sponsorshipMode, attempt);
|
|
106
134
|
}
|
|
107
135
|
catch (error) {
|
|
108
136
|
logger.logger.warn(`[maybeSponsorTransaction] Sponsorship attempt ${attempt}/${SPONSORSHIP_MAX_ATTEMPTS} failed`, { error });
|
|
109
137
|
if (attempt === SPONSORSHIP_MAX_ATTEMPTS ||
|
|
110
138
|
!this.isRetryableSponsorshipError(error)) {
|
|
111
|
-
|
|
112
|
-
throw error;
|
|
113
|
-
}
|
|
114
|
-
throw new utils.DynamicError(SPONSORSHIP_FAILURE_MESSAGE, SPONSORSHIP_FAILURE_CODE);
|
|
139
|
+
throw this.asSponsorshipError(error);
|
|
115
140
|
}
|
|
116
141
|
yield utils.sleep(SPONSORSHIP_RETRY_INTERVAL_MS);
|
|
117
142
|
}
|
|
@@ -239,7 +264,7 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
239
264
|
});
|
|
240
265
|
}
|
|
241
266
|
internalSignTransaction(transaction_1) {
|
|
242
|
-
return _tslib.__awaiter(this, arguments, void 0, function* (transaction, { parentTraceId, startTime, overrideBlockhash, } = {}) {
|
|
267
|
+
return _tslib.__awaiter(this, arguments, void 0, function* (transaction, { parentTraceId, startTime, overrideBlockhash, sponsorshipMode, } = {}) {
|
|
243
268
|
var _a, _b, _c;
|
|
244
269
|
const traceId = parentTraceId || this.generateTraceId();
|
|
245
270
|
const effectiveStartTime = startTime || Date.now();
|
|
@@ -257,7 +282,9 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
257
282
|
overrideBlockhash.lastValidBlockHeight;
|
|
258
283
|
}
|
|
259
284
|
}
|
|
260
|
-
const txToSign =
|
|
285
|
+
const txToSign = sponsorshipMode
|
|
286
|
+
? yield this.maybeSponsorTransaction(txToSponsor, sponsorshipMode)
|
|
287
|
+
: yield this.maybeSponsorTransaction(txToSponsor);
|
|
261
288
|
const walletClient = yield this.instrumentAsync({
|
|
262
289
|
context: { chainName: 'SVM', startTime: effectiveStartTime, traceId },
|
|
263
290
|
fn: () => _tslib.__awaiter(this, void 0, void 0, function* () { return this.getWaasWalletClient(); }),
|
|
@@ -326,7 +353,7 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
326
353
|
return txToSign;
|
|
327
354
|
});
|
|
328
355
|
}
|
|
329
|
-
signTransaction(transaction) {
|
|
356
|
+
signTransaction(transaction, options) {
|
|
330
357
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
331
358
|
if (!this.activeAccountAddress) {
|
|
332
359
|
throw new Error('Active account address is required');
|
|
@@ -344,11 +371,11 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
344
371
|
from: this.activeAccountAddress,
|
|
345
372
|
multipleTransactions: [transaction],
|
|
346
373
|
onSubmit: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
347
|
-
return this.internalSignTransaction(transaction, {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
});
|
|
374
|
+
return this.internalSignTransaction(transaction, Object.assign(Object.assign({ parentTraceId: traceId }, ((options === null || options === void 0 ? void 0 : options.sponsorshipMode) && {
|
|
375
|
+
sponsorshipMode: options.sponsorshipMode,
|
|
376
|
+
})), { startTime }));
|
|
351
377
|
}),
|
|
378
|
+
sponsorshipMode: options === null || options === void 0 ? void 0 : options.sponsorshipMode,
|
|
352
379
|
});
|
|
353
380
|
const signedTransaction = yield this.walletUiUtils.signTransaction(this, uiTransaction);
|
|
354
381
|
this.instrument('[signTransaction] completed', {
|
|
@@ -360,20 +387,24 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
360
387
|
return signedTransaction;
|
|
361
388
|
});
|
|
362
389
|
}
|
|
363
|
-
internalSignAllTransactions(transactions) {
|
|
390
|
+
internalSignAllTransactions(transactions, options) {
|
|
364
391
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
365
392
|
if (!this.activeAccountAddress) {
|
|
366
393
|
throw new Error('Active account address is required');
|
|
367
394
|
}
|
|
368
395
|
const signedTransactions = [];
|
|
369
396
|
for (const transaction of transactions) {
|
|
370
|
-
const signedTx =
|
|
397
|
+
const signedTx = (options === null || options === void 0 ? void 0 : options.sponsorshipMode)
|
|
398
|
+
? yield this.internalSignTransaction(transaction, {
|
|
399
|
+
sponsorshipMode: options.sponsorshipMode,
|
|
400
|
+
})
|
|
401
|
+
: yield this.internalSignTransaction(transaction);
|
|
371
402
|
signedTransactions.push(signedTx);
|
|
372
403
|
}
|
|
373
404
|
return signedTransactions;
|
|
374
405
|
});
|
|
375
406
|
}
|
|
376
|
-
signAllTransactions(transactions) {
|
|
407
|
+
signAllTransactions(transactions, options) {
|
|
377
408
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
378
409
|
if (!this.activeAccountAddress) {
|
|
379
410
|
throw new Error('Active account address is required');
|
|
@@ -390,7 +421,12 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
390
421
|
connection: this.getWalletClient(),
|
|
391
422
|
from: this.activeAccountAddress,
|
|
392
423
|
multipleTransactions: transactions,
|
|
393
|
-
onSubmit: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
424
|
+
onSubmit: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
425
|
+
return options
|
|
426
|
+
? this.internalSignAllTransactions(transactions, options)
|
|
427
|
+
: this.internalSignAllTransactions(transactions);
|
|
428
|
+
}),
|
|
429
|
+
sponsorshipMode: options === null || options === void 0 ? void 0 : options.sponsorshipMode,
|
|
394
430
|
});
|
|
395
431
|
const signedTransactions = yield this.walletUiUtils.signTransaction(this, uiTransaction);
|
|
396
432
|
this.instrument('[signAllTransactions] completed', {
|
|
@@ -403,7 +439,7 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
403
439
|
});
|
|
404
440
|
}
|
|
405
441
|
internalSignAndSendTransaction(transaction_1, options_1) {
|
|
406
|
-
return _tslib.__awaiter(this, arguments, void 0, function* (transaction, options, { parentTraceId, startTime, } = {}) {
|
|
442
|
+
return _tslib.__awaiter(this, arguments, void 0, function* (transaction, options, { parentTraceId, sponsorshipMode, startTime, } = {}) {
|
|
407
443
|
var _a, _b;
|
|
408
444
|
const traceId = parentTraceId || this.generateTraceId();
|
|
409
445
|
const effectiveStartTime = startTime || Date.now();
|
|
@@ -424,6 +460,7 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
424
460
|
return this.internalSignTransaction(transaction, {
|
|
425
461
|
overrideBlockhash: { blockhash, lastValidBlockHeight },
|
|
426
462
|
parentTraceId: traceId,
|
|
463
|
+
sponsorshipMode,
|
|
427
464
|
startTime: effectiveStartTime,
|
|
428
465
|
});
|
|
429
466
|
}),
|
|
@@ -512,6 +549,7 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
512
549
|
}
|
|
513
550
|
const traceId = this.generateTraceId();
|
|
514
551
|
const startTime = Date.now();
|
|
552
|
+
const _a = options !== null && options !== void 0 ? options : {}, { sponsorshipMode } = _a, sendOptions = _tslib.__rest(_a, ["sponsorshipMode"]);
|
|
515
553
|
this.instrument('[signAndSendTransaction] start', {
|
|
516
554
|
key: 'signAndSendTransaction-start',
|
|
517
555
|
options,
|
|
@@ -524,11 +562,9 @@ class DynamicWaasSVMConnector extends waas.withDynamicWaas(solanaCore.SolanaWall
|
|
|
524
562
|
from: this.activeAccountAddress,
|
|
525
563
|
multipleTransactions: [transaction],
|
|
526
564
|
onSubmit: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
527
|
-
return this.internalSignAndSendTransaction(transaction, options, {
|
|
528
|
-
parentTraceId: traceId,
|
|
529
|
-
startTime,
|
|
530
|
-
});
|
|
565
|
+
return this.internalSignAndSendTransaction(transaction, options ? sendOptions : undefined, Object.assign(Object.assign({ parentTraceId: traceId }, (sponsorshipMode && { sponsorshipMode })), { startTime }));
|
|
531
566
|
}),
|
|
567
|
+
sponsorshipMode,
|
|
532
568
|
});
|
|
533
569
|
const result = yield this.walletUiUtils.sendTransaction(this, uiTransaction);
|
|
534
570
|
this.instrument('[signAndSendTransaction] completed', {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connection, SendOptions, Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
2
|
import { MFAAction, TokenScope } from '@dynamic-labs/sdk-api-core';
|
|
3
|
-
import { ISolanaSigner, SolanaWalletConnector, SolanaWalletConnectorOpts } from '@dynamic-labs/solana-core';
|
|
3
|
+
import { GasSponsorshipMode, ISolanaSigner, SolanaSendOptions, SolanaTransactionOptions, 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
6
|
import { Logger } from '../../utils/logger';
|
|
@@ -34,10 +34,7 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
|
|
|
34
34
|
logger: Logger;
|
|
35
35
|
__exportHandler: import("@dynamic-labs/waas").WaasExportHandler;
|
|
36
36
|
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
37
|
-
setGetAuthTokenFunction(getAuthToken: () => string): void;
|
|
38
|
-
* Set a getter that resolves the current SVM gas sponsorship state.
|
|
39
|
-
* Using a getter avoids stale values from initialization race conditions.
|
|
40
|
-
*/
|
|
37
|
+
setGetAuthTokenFunction(getAuthToken: () => string): void;
|
|
41
38
|
setOnUnauthorizedFunction(onUnauthorized: () => void | Promise<void>): void;
|
|
42
39
|
setWaasAuthMode(authMode: "cookie" | "header"): void;
|
|
43
40
|
setGetMfaTokenFunction(getMfaToken: (props?: {
|
|
@@ -102,9 +99,7 @@ declare const DynamicWaasSVMConnector_base: (abstract new (...args: any[]) => {
|
|
|
102
99
|
publicAddressCheck?: string | undefined;
|
|
103
100
|
addressType?: string | undefined;
|
|
104
101
|
legacyWalletId?: string | undefined;
|
|
105
|
-
password?: string | undefined;
|
|
106
|
-
* Override setEnvironmentId to ensure it's set on the global logger
|
|
107
|
-
*/
|
|
102
|
+
password?: string | undefined;
|
|
108
103
|
}): Promise<void>;
|
|
109
104
|
migrateFromFireblocks({ deviceId, jwt, walletPassword, ncwStorage, expectedAddresses, coinTypes, password, }: {
|
|
110
105
|
deviceId: string;
|
|
@@ -219,6 +214,7 @@ export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_bas
|
|
|
219
214
|
activeAccountAddress: string | undefined;
|
|
220
215
|
protected walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
221
216
|
private getSvmGasSponsorshipEnabled;
|
|
217
|
+
readonly supportsSvmGasSponsorship = true;
|
|
222
218
|
constructor(props: DynamicWaasSVMConnectorProps);
|
|
223
219
|
/**
|
|
224
220
|
* Set a getter that resolves the current SVM gas sponsorship state.
|
|
@@ -237,6 +233,9 @@ export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_bas
|
|
|
237
233
|
* Check if a transaction is already signed (has non-zero signatures).
|
|
238
234
|
*/
|
|
239
235
|
private isTxAlreadySigned;
|
|
236
|
+
private getFeePayerAddress;
|
|
237
|
+
private attemptSponsorship;
|
|
238
|
+
private asSponsorshipError;
|
|
240
239
|
/**
|
|
241
240
|
* Sponsor a transaction if gas sponsorship is enabled and the tx is unsigned.
|
|
242
241
|
* Retries transient failures; throws if sponsorship never succeeds so callers
|
|
@@ -257,22 +256,24 @@ export declare class DynamicWaasSVMConnector extends DynamicWaasSVMConnector_bas
|
|
|
257
256
|
startTime?: number;
|
|
258
257
|
}): Promise<string>;
|
|
259
258
|
signMessage(message: string): Promise<string>;
|
|
260
|
-
internalSignTransaction<T extends Transaction | VersionedTransaction>(transaction: T, { parentTraceId, startTime, overrideBlockhash, }?: {
|
|
259
|
+
internalSignTransaction<T extends Transaction | VersionedTransaction>(transaction: T, { parentTraceId, startTime, overrideBlockhash, sponsorshipMode, }?: {
|
|
261
260
|
parentTraceId?: string;
|
|
262
261
|
startTime?: number;
|
|
263
262
|
overrideBlockhash?: {
|
|
264
263
|
blockhash: string;
|
|
265
264
|
lastValidBlockHeight: number;
|
|
266
265
|
};
|
|
266
|
+
sponsorshipMode?: GasSponsorshipMode;
|
|
267
267
|
}): Promise<Transaction | VersionedTransaction>;
|
|
268
|
-
signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<Transaction | VersionedTransaction>;
|
|
269
|
-
internalSignAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<(Transaction | VersionedTransaction)[]>;
|
|
270
|
-
signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<(Transaction | VersionedTransaction)[]>;
|
|
271
|
-
internalSignAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SendOptions, { parentTraceId, startTime, }?: {
|
|
268
|
+
signTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SolanaTransactionOptions): Promise<Transaction | VersionedTransaction>;
|
|
269
|
+
internalSignAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[], options?: SolanaTransactionOptions): Promise<(Transaction | VersionedTransaction)[]>;
|
|
270
|
+
signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[], options?: SolanaTransactionOptions): Promise<(Transaction | VersionedTransaction)[]>;
|
|
271
|
+
internalSignAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SendOptions, { parentTraceId, sponsorshipMode, startTime, }?: {
|
|
272
272
|
parentTraceId?: string;
|
|
273
|
+
sponsorshipMode?: GasSponsorshipMode;
|
|
273
274
|
startTime?: number;
|
|
274
275
|
}): Promise<string>;
|
|
275
|
-
signAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?:
|
|
276
|
+
signAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SolanaSendOptions): Promise<string>;
|
|
276
277
|
getSigner(): Promise<ISolanaSigner>;
|
|
277
278
|
getWalletClientByAddress({ accountAddress, }: {
|
|
278
279
|
accountAddress: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
2
|
+
import { __awaiter, __rest } from '../../_virtual/_tslib.js';
|
|
3
3
|
import { PublicKey } from '@solana/web3.js';
|
|
4
4
|
import { sponsorSolanaTransaction } from '@dynamic-labs/embedded-wallet-solana';
|
|
5
5
|
import { MFAAction, TokenScope } from '@dynamic-labs/sdk-api-core';
|
|
@@ -26,6 +26,7 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
26
26
|
this.overrideKey = 'dynamicwaas';
|
|
27
27
|
this.isEmbeddedWallet = true;
|
|
28
28
|
this.getSvmGasSponsorshipEnabled = () => false;
|
|
29
|
+
this.supportsSvmGasSponsorship = true;
|
|
29
30
|
this.logger = logger;
|
|
30
31
|
this.walletUiUtils = props.walletUiUtils;
|
|
31
32
|
}
|
|
@@ -67,18 +68,52 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
67
68
|
}
|
|
68
69
|
return transaction.signatures.some((sig) => sig.signature && !sig.signature.every((byte) => byte === 0));
|
|
69
70
|
}
|
|
71
|
+
getFeePayerAddress(transaction) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
if ('version' in transaction) {
|
|
74
|
+
return (_a = transaction.message.staticAccountKeys[0]) === null || _a === void 0 ? void 0 : _a.toBase58();
|
|
75
|
+
}
|
|
76
|
+
return (_b = transaction.feePayer) === null || _b === void 0 ? void 0 : _b.toBase58();
|
|
77
|
+
}
|
|
78
|
+
attemptSponsorship(environmentId, transaction, sponsorshipMode, attempt) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
const sponsoredTransaction = yield this.instrumentAsync({
|
|
81
|
+
context: { attempt, maxAttempts: SPONSORSHIP_MAX_ATTEMPTS },
|
|
82
|
+
fn: () => __awaiter(this, void 0, void 0, function* () { return sponsorSolanaTransaction(environmentId, transaction); }),
|
|
83
|
+
operation: 'maybeSponsorTransaction',
|
|
84
|
+
resource: `sponsorSolanaTransaction-attempt-${attempt}`,
|
|
85
|
+
});
|
|
86
|
+
const feePayer = this.getFeePayerAddress(sponsoredTransaction);
|
|
87
|
+
if (sponsorshipMode === 'required' &&
|
|
88
|
+
(!feePayer || feePayer === this.activeAccountAddress)) {
|
|
89
|
+
throw new DynamicError('Sponsored transaction is not sponsored', 'sponsorship_not_applied');
|
|
90
|
+
}
|
|
91
|
+
logger.info('[maybeSponsorTransaction] Transaction sponsored successfully');
|
|
92
|
+
return sponsoredTransaction;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
asSponsorshipError(error) {
|
|
96
|
+
if (error instanceof DynamicError) {
|
|
97
|
+
return error;
|
|
98
|
+
}
|
|
99
|
+
return new DynamicError(SPONSORSHIP_FAILURE_MESSAGE, SPONSORSHIP_FAILURE_CODE);
|
|
100
|
+
}
|
|
70
101
|
/**
|
|
71
102
|
* Sponsor a transaction if gas sponsorship is enabled and the tx is unsigned.
|
|
72
103
|
* Retries transient failures; throws if sponsorship never succeeds so callers
|
|
73
104
|
* never sign and return a transaction that silently skipped sponsorship
|
|
74
105
|
* (e.g. a 0-SOL wallet still set as fee payer).
|
|
75
106
|
*/
|
|
76
|
-
maybeSponsorTransaction(
|
|
77
|
-
return __awaiter(this,
|
|
78
|
-
if (
|
|
107
|
+
maybeSponsorTransaction(transaction_1) {
|
|
108
|
+
return __awaiter(this, arguments, void 0, function* (transaction, sponsorshipMode = 'auto') {
|
|
109
|
+
if (sponsorshipMode === 'off' ||
|
|
110
|
+
(sponsorshipMode === 'auto' && !this.getSvmGasSponsorshipEnabled())) {
|
|
79
111
|
return transaction;
|
|
80
112
|
}
|
|
81
113
|
if (this.isTxAlreadySigned(transaction)) {
|
|
114
|
+
if (sponsorshipMode === 'required') {
|
|
115
|
+
throw new DynamicError('Signed transactions cannot be sponsored', 'sponsorship_transaction_already_signed');
|
|
116
|
+
}
|
|
82
117
|
logger.debug('[maybeSponsorTransaction] Skipping sponsorship - transaction already signed');
|
|
83
118
|
return transaction;
|
|
84
119
|
}
|
|
@@ -91,23 +126,13 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
91
126
|
const { environmentId } = this;
|
|
92
127
|
for (let attempt = 1; attempt <= SPONSORSHIP_MAX_ATTEMPTS; attempt++) {
|
|
93
128
|
try {
|
|
94
|
-
|
|
95
|
-
context: { attempt, maxAttempts: SPONSORSHIP_MAX_ATTEMPTS },
|
|
96
|
-
fn: () => __awaiter(this, void 0, void 0, function* () { return sponsorSolanaTransaction(environmentId, transaction); }),
|
|
97
|
-
operation: 'maybeSponsorTransaction',
|
|
98
|
-
resource: `sponsorSolanaTransaction-attempt-${attempt}`,
|
|
99
|
-
});
|
|
100
|
-
logger.info('[maybeSponsorTransaction] Transaction sponsored successfully');
|
|
101
|
-
return sponsoredTransaction;
|
|
129
|
+
return yield this.attemptSponsorship(environmentId, transaction, sponsorshipMode, attempt);
|
|
102
130
|
}
|
|
103
131
|
catch (error) {
|
|
104
132
|
logger.warn(`[maybeSponsorTransaction] Sponsorship attempt ${attempt}/${SPONSORSHIP_MAX_ATTEMPTS} failed`, { error });
|
|
105
133
|
if (attempt === SPONSORSHIP_MAX_ATTEMPTS ||
|
|
106
134
|
!this.isRetryableSponsorshipError(error)) {
|
|
107
|
-
|
|
108
|
-
throw error;
|
|
109
|
-
}
|
|
110
|
-
throw new DynamicError(SPONSORSHIP_FAILURE_MESSAGE, SPONSORSHIP_FAILURE_CODE);
|
|
135
|
+
throw this.asSponsorshipError(error);
|
|
111
136
|
}
|
|
112
137
|
yield sleep(SPONSORSHIP_RETRY_INTERVAL_MS);
|
|
113
138
|
}
|
|
@@ -235,7 +260,7 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
235
260
|
});
|
|
236
261
|
}
|
|
237
262
|
internalSignTransaction(transaction_1) {
|
|
238
|
-
return __awaiter(this, arguments, void 0, function* (transaction, { parentTraceId, startTime, overrideBlockhash, } = {}) {
|
|
263
|
+
return __awaiter(this, arguments, void 0, function* (transaction, { parentTraceId, startTime, overrideBlockhash, sponsorshipMode, } = {}) {
|
|
239
264
|
var _a, _b, _c;
|
|
240
265
|
const traceId = parentTraceId || this.generateTraceId();
|
|
241
266
|
const effectiveStartTime = startTime || Date.now();
|
|
@@ -253,7 +278,9 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
253
278
|
overrideBlockhash.lastValidBlockHeight;
|
|
254
279
|
}
|
|
255
280
|
}
|
|
256
|
-
const txToSign =
|
|
281
|
+
const txToSign = sponsorshipMode
|
|
282
|
+
? yield this.maybeSponsorTransaction(txToSponsor, sponsorshipMode)
|
|
283
|
+
: yield this.maybeSponsorTransaction(txToSponsor);
|
|
257
284
|
const walletClient = yield this.instrumentAsync({
|
|
258
285
|
context: { chainName: 'SVM', startTime: effectiveStartTime, traceId },
|
|
259
286
|
fn: () => __awaiter(this, void 0, void 0, function* () { return this.getWaasWalletClient(); }),
|
|
@@ -322,7 +349,7 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
322
349
|
return txToSign;
|
|
323
350
|
});
|
|
324
351
|
}
|
|
325
|
-
signTransaction(transaction) {
|
|
352
|
+
signTransaction(transaction, options) {
|
|
326
353
|
return __awaiter(this, void 0, void 0, function* () {
|
|
327
354
|
if (!this.activeAccountAddress) {
|
|
328
355
|
throw new Error('Active account address is required');
|
|
@@ -340,11 +367,11 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
340
367
|
from: this.activeAccountAddress,
|
|
341
368
|
multipleTransactions: [transaction],
|
|
342
369
|
onSubmit: () => __awaiter(this, void 0, void 0, function* () {
|
|
343
|
-
return this.internalSignTransaction(transaction, {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
});
|
|
370
|
+
return this.internalSignTransaction(transaction, Object.assign(Object.assign({ parentTraceId: traceId }, ((options === null || options === void 0 ? void 0 : options.sponsorshipMode) && {
|
|
371
|
+
sponsorshipMode: options.sponsorshipMode,
|
|
372
|
+
})), { startTime }));
|
|
347
373
|
}),
|
|
374
|
+
sponsorshipMode: options === null || options === void 0 ? void 0 : options.sponsorshipMode,
|
|
348
375
|
});
|
|
349
376
|
const signedTransaction = yield this.walletUiUtils.signTransaction(this, uiTransaction);
|
|
350
377
|
this.instrument('[signTransaction] completed', {
|
|
@@ -356,20 +383,24 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
356
383
|
return signedTransaction;
|
|
357
384
|
});
|
|
358
385
|
}
|
|
359
|
-
internalSignAllTransactions(transactions) {
|
|
386
|
+
internalSignAllTransactions(transactions, options) {
|
|
360
387
|
return __awaiter(this, void 0, void 0, function* () {
|
|
361
388
|
if (!this.activeAccountAddress) {
|
|
362
389
|
throw new Error('Active account address is required');
|
|
363
390
|
}
|
|
364
391
|
const signedTransactions = [];
|
|
365
392
|
for (const transaction of transactions) {
|
|
366
|
-
const signedTx =
|
|
393
|
+
const signedTx = (options === null || options === void 0 ? void 0 : options.sponsorshipMode)
|
|
394
|
+
? yield this.internalSignTransaction(transaction, {
|
|
395
|
+
sponsorshipMode: options.sponsorshipMode,
|
|
396
|
+
})
|
|
397
|
+
: yield this.internalSignTransaction(transaction);
|
|
367
398
|
signedTransactions.push(signedTx);
|
|
368
399
|
}
|
|
369
400
|
return signedTransactions;
|
|
370
401
|
});
|
|
371
402
|
}
|
|
372
|
-
signAllTransactions(transactions) {
|
|
403
|
+
signAllTransactions(transactions, options) {
|
|
373
404
|
return __awaiter(this, void 0, void 0, function* () {
|
|
374
405
|
if (!this.activeAccountAddress) {
|
|
375
406
|
throw new Error('Active account address is required');
|
|
@@ -386,7 +417,12 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
386
417
|
connection: this.getWalletClient(),
|
|
387
418
|
from: this.activeAccountAddress,
|
|
388
419
|
multipleTransactions: transactions,
|
|
389
|
-
onSubmit: () => __awaiter(this, void 0, void 0, function* () {
|
|
420
|
+
onSubmit: () => __awaiter(this, void 0, void 0, function* () {
|
|
421
|
+
return options
|
|
422
|
+
? this.internalSignAllTransactions(transactions, options)
|
|
423
|
+
: this.internalSignAllTransactions(transactions);
|
|
424
|
+
}),
|
|
425
|
+
sponsorshipMode: options === null || options === void 0 ? void 0 : options.sponsorshipMode,
|
|
390
426
|
});
|
|
391
427
|
const signedTransactions = yield this.walletUiUtils.signTransaction(this, uiTransaction);
|
|
392
428
|
this.instrument('[signAllTransactions] completed', {
|
|
@@ -399,7 +435,7 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
399
435
|
});
|
|
400
436
|
}
|
|
401
437
|
internalSignAndSendTransaction(transaction_1, options_1) {
|
|
402
|
-
return __awaiter(this, arguments, void 0, function* (transaction, options, { parentTraceId, startTime, } = {}) {
|
|
438
|
+
return __awaiter(this, arguments, void 0, function* (transaction, options, { parentTraceId, sponsorshipMode, startTime, } = {}) {
|
|
403
439
|
var _a, _b;
|
|
404
440
|
const traceId = parentTraceId || this.generateTraceId();
|
|
405
441
|
const effectiveStartTime = startTime || Date.now();
|
|
@@ -420,6 +456,7 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
420
456
|
return this.internalSignTransaction(transaction, {
|
|
421
457
|
overrideBlockhash: { blockhash, lastValidBlockHeight },
|
|
422
458
|
parentTraceId: traceId,
|
|
459
|
+
sponsorshipMode,
|
|
423
460
|
startTime: effectiveStartTime,
|
|
424
461
|
});
|
|
425
462
|
}),
|
|
@@ -508,6 +545,7 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
508
545
|
}
|
|
509
546
|
const traceId = this.generateTraceId();
|
|
510
547
|
const startTime = Date.now();
|
|
548
|
+
const _a = options !== null && options !== void 0 ? options : {}, { sponsorshipMode } = _a, sendOptions = __rest(_a, ["sponsorshipMode"]);
|
|
511
549
|
this.instrument('[signAndSendTransaction] start', {
|
|
512
550
|
key: 'signAndSendTransaction-start',
|
|
513
551
|
options,
|
|
@@ -520,11 +558,9 @@ class DynamicWaasSVMConnector extends withDynamicWaas(SolanaWalletConnector) {
|
|
|
520
558
|
from: this.activeAccountAddress,
|
|
521
559
|
multipleTransactions: [transaction],
|
|
522
560
|
onSubmit: () => __awaiter(this, void 0, void 0, function* () {
|
|
523
|
-
return this.internalSignAndSendTransaction(transaction, options, {
|
|
524
|
-
parentTraceId: traceId,
|
|
525
|
-
startTime,
|
|
526
|
-
});
|
|
561
|
+
return this.internalSignAndSendTransaction(transaction, options ? sendOptions : undefined, Object.assign(Object.assign({ parentTraceId: traceId }, (sponsorshipMode && { sponsorshipMode })), { startTime }));
|
|
527
562
|
}),
|
|
563
|
+
sponsorshipMode,
|
|
528
564
|
});
|
|
529
565
|
const result = yield this.walletUiUtils.sendTransaction(this, uiTransaction);
|
|
530
566
|
this.instrument('[signAndSendTransaction] completed', {
|
|
@@ -46,13 +46,19 @@ class DynamicWaasSVMSigner extends EventEmitter__default["default"] {
|
|
|
46
46
|
return { signature: signatureBytes };
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
signTransaction(transaction) {
|
|
49
|
+
signTransaction(transaction, options) {
|
|
50
50
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
if (options) {
|
|
52
|
+
return this.walletConnector.signTransaction(transaction, options);
|
|
53
|
+
}
|
|
51
54
|
return this.walletConnector.signTransaction(transaction);
|
|
52
55
|
});
|
|
53
56
|
}
|
|
54
|
-
signAllTransactions(transactions) {
|
|
57
|
+
signAllTransactions(transactions, options) {
|
|
55
58
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
if (options) {
|
|
60
|
+
return this.walletConnector.signAllTransactions(transactions, options);
|
|
61
|
+
}
|
|
56
62
|
return this.walletConnector.signAllTransactions(transactions);
|
|
57
63
|
});
|
|
58
64
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PublicKey,
|
|
1
|
+
import { PublicKey, Transaction, TransactionSignature, VersionedTransaction } from '@solana/web3.js';
|
|
2
2
|
import EventEmitter from 'eventemitter3';
|
|
3
|
-
import { SignedMessage, ISolanaSigner, ConnectionResult, ISolanaEvents } from '@dynamic-labs/solana-core';
|
|
3
|
+
import { SignedMessage, ISolanaSigner, ConnectionResult, ISolanaEvents, SolanaSendOptions, SolanaTransactionOptions } from '@dynamic-labs/solana-core';
|
|
4
4
|
import { DynamicWaasSVMConnector } from '../connector/DynamicWaasSVMConnector';
|
|
5
5
|
/**
|
|
6
6
|
* Signer implementation for DynamicWaasSVMConnector
|
|
@@ -23,9 +23,9 @@ export declare class DynamicWaasSVMSigner extends EventEmitter<ISolanaEvents> im
|
|
|
23
23
|
walletConnector: DynamicWaasSVMConnector;
|
|
24
24
|
});
|
|
25
25
|
signMessage(encodedMessage: Uint8Array): Promise<SignedMessage>;
|
|
26
|
-
signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<T>;
|
|
27
|
-
signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
|
|
28
|
-
signAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?:
|
|
26
|
+
signTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SolanaTransactionOptions): Promise<T>;
|
|
27
|
+
signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[], options?: SolanaTransactionOptions): Promise<T[]>;
|
|
28
|
+
signAndSendTransaction<T extends Transaction | VersionedTransaction>(transaction: T, options?: SolanaSendOptions): Promise<{
|
|
29
29
|
signature: TransactionSignature;
|
|
30
30
|
}>;
|
|
31
31
|
connect(_args?: {
|
|
@@ -37,13 +37,19 @@ class DynamicWaasSVMSigner extends EventEmitter {
|
|
|
37
37
|
return { signature: signatureBytes };
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
signTransaction(transaction) {
|
|
40
|
+
signTransaction(transaction, options) {
|
|
41
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
if (options) {
|
|
43
|
+
return this.walletConnector.signTransaction(transaction, options);
|
|
44
|
+
}
|
|
42
45
|
return this.walletConnector.signTransaction(transaction);
|
|
43
46
|
});
|
|
44
47
|
}
|
|
45
|
-
signAllTransactions(transactions) {
|
|
48
|
+
signAllTransactions(transactions, options) {
|
|
46
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
if (options) {
|
|
51
|
+
return this.walletConnector.signAllTransactions(transactions, options);
|
|
52
|
+
}
|
|
47
53
|
return this.walletConnector.signAllTransactions(transactions);
|
|
48
54
|
});
|
|
49
55
|
}
|