@dynamic-labs/embedded-wallet-evm 3.0.0-alpha.21 → 3.0.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.23](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.22...v3.0.0-alpha.23) (2024-07-19)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* show custom labels in the sdk ([#6352](https://github.com/dynamic-labs/DynamicAuth/issues/6352)) ([6eec9b2](https://github.com/dynamic-labs/DynamicAuth/commit/6eec9b26dbfd25c5138378aa92de8379a5cd0ddc))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* add missing await to viem controller ([#6354](https://github.com/dynamic-labs/DynamicAuth/issues/6354)) ([32c7362](https://github.com/dynamic-labs/DynamicAuth/commit/32c73625c5575f9134edd541c7221aba08a741b5))
|
|
13
|
+
* allow for react-native 0.74.x ([#6371](https://github.com/dynamic-labs/DynamicAuth/issues/6371)) ([37e08b6](https://github.com/dynamic-labs/DynamicAuth/commit/37e08b6b32bcaef7b7f6a4dedc45b2321f3f64a6))
|
|
14
|
+
* not able to switch to secondary wallet ([#6373](https://github.com/dynamic-labs/DynamicAuth/issues/6373)) ([f85ed10](https://github.com/dynamic-labs/DynamicAuth/commit/f85ed10aca8bf41658eb1418cd87e1c5061d4b1b))
|
|
15
|
+
|
|
16
|
+
## [3.0.0-alpha.22](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.21...v3.0.0-alpha.22) (2024-07-18)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* add support for aa kernel 3.1 ([#6333](https://github.com/dynamic-labs/DynamicAuth/issues/6333)) ([93c743a](https://github.com/dynamic-labs/DynamicAuth/commit/93c743a74d1af79f15baec343d15212a2feeac39))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* ensure retryableFn props are passed through ([#6357](https://github.com/dynamic-labs/DynamicAuth/issues/6357)) ([246da78](https://github.com/dynamic-labs/DynamicAuth/commit/246da78ebaa0e623843d93fc990d8a0f3298af54))
|
|
27
|
+
* removes wallet connect qr code from magic eden ([#6360](https://github.com/dynamic-labs/DynamicAuth/issues/6360)) ([5968c2e](https://github.com/dynamic-labs/DynamicAuth/commit/5968c2e220f98b0995a2067e6f5397f27da4dfb0))
|
|
28
|
+
|
|
2
29
|
## [3.0.0-alpha.21](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.20...v3.0.0-alpha.21) (2024-07-17)
|
|
3
30
|
|
|
4
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/embedded-wallet-evm",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.23",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
29
|
+
"@dynamic-labs/sdk-api-core": "0.0.489",
|
|
30
30
|
"@turnkey/api-key-stamper": "0.4.0",
|
|
31
31
|
"@turnkey/http": "2.7.1",
|
|
32
32
|
"@turnkey/iframe-stamper": "2.0.0",
|
|
33
33
|
"@turnkey/viem": "0.4.10",
|
|
34
34
|
"@turnkey/webauthn-stamper": "0.5.0",
|
|
35
|
-
"@dynamic-labs/embedded-wallet": "3.0.0-alpha.
|
|
36
|
-
"@dynamic-labs/rpc-provider-ethereum": "3.0.0-alpha.
|
|
37
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
38
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
39
|
-
"@dynamic-labs/viem-utils": "3.0.0-alpha.
|
|
40
|
-
"@dynamic-labs/wallet-book": "3.0.0-alpha.
|
|
41
|
-
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.
|
|
35
|
+
"@dynamic-labs/embedded-wallet": "3.0.0-alpha.23",
|
|
36
|
+
"@dynamic-labs/rpc-provider-ethereum": "3.0.0-alpha.23",
|
|
37
|
+
"@dynamic-labs/types": "3.0.0-alpha.23",
|
|
38
|
+
"@dynamic-labs/utils": "3.0.0-alpha.23",
|
|
39
|
+
"@dynamic-labs/viem-utils": "3.0.0-alpha.23",
|
|
40
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.23",
|
|
41
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.23"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"viem": "^2.7.6"
|
|
@@ -241,70 +241,56 @@ class TurnkeyEVMWalletConnector extends embeddedWallet.TurnkeyWalletConnectorBas
|
|
|
241
241
|
}
|
|
242
242
|
internalSignTransaction(_a) {
|
|
243
243
|
return _tslib.__awaiter(this, arguments, void 0, function* ({ transaction, args, address, turnkeySubOrganizationId, }) {
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
return this.doRetryableTurnkeyAction({
|
|
245
|
+
action: (turnkeyAccount) => turnkeyAccount.signTransaction(transaction, args),
|
|
246
246
|
address,
|
|
247
247
|
turnkeySubOrganizationId,
|
|
248
248
|
});
|
|
249
|
-
try {
|
|
250
|
-
return yield newTurnkeyAccount.signTransaction(transaction, args);
|
|
251
|
-
}
|
|
252
|
-
catch (err) {
|
|
253
|
-
yield this.removeSessionKeys();
|
|
254
|
-
yield this.createOrRestoreSession({
|
|
255
|
-
ignoreRestore: true,
|
|
256
|
-
});
|
|
257
|
-
const newTurnkeyAccount = yield this.createTurnkeyAccount({
|
|
258
|
-
address,
|
|
259
|
-
turnkeySubOrganizationId,
|
|
260
|
-
});
|
|
261
|
-
return newTurnkeyAccount.signTransaction(transaction, args);
|
|
262
|
-
}
|
|
263
249
|
});
|
|
264
250
|
}
|
|
265
251
|
internalSignTypedData(_a) {
|
|
266
252
|
return _tslib.__awaiter(this, arguments, void 0, function* ({ typedData, address, turnkeySubOrganizationId, }) {
|
|
267
|
-
|
|
268
|
-
|
|
253
|
+
return this.doRetryableTurnkeyAction({
|
|
254
|
+
action: (turnkeyAccount) => turnkeyAccount.signTypedData(typedData),
|
|
269
255
|
address,
|
|
270
256
|
turnkeySubOrganizationId,
|
|
271
257
|
});
|
|
272
|
-
try {
|
|
273
|
-
return yield newTurnkeyAccountRaw.signTypedData(typedData);
|
|
274
|
-
}
|
|
275
|
-
catch (err) {
|
|
276
|
-
yield this.removeSessionKeys();
|
|
277
|
-
yield this.createOrRestoreSession({
|
|
278
|
-
ignoreRestore: true,
|
|
279
|
-
});
|
|
280
|
-
const newTurnkeyAccountRaw = yield this.createTurnkeyAccount({
|
|
281
|
-
address,
|
|
282
|
-
turnkeySubOrganizationId,
|
|
283
|
-
});
|
|
284
|
-
return newTurnkeyAccountRaw.signTypedData(typedData);
|
|
285
|
-
}
|
|
286
258
|
});
|
|
287
259
|
}
|
|
288
260
|
internalSignMessage(_a) {
|
|
289
261
|
return _tslib.__awaiter(this, arguments, void 0, function* ({ message, address, turnkeySubOrganizationId, }) {
|
|
262
|
+
return this.doRetryableTurnkeyAction({
|
|
263
|
+
action: (turnkeyAccount) => turnkeyAccount.signMessage({ message }),
|
|
264
|
+
address,
|
|
265
|
+
turnkeySubOrganizationId,
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
doRetryableTurnkeyAction(_a) {
|
|
270
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ action, address, turnkeySubOrganizationId, }) {
|
|
290
271
|
yield this.createOrRestoreSession();
|
|
291
|
-
|
|
272
|
+
let newTurnkeyAccountRaw = yield this.createTurnkeyAccount({
|
|
292
273
|
address,
|
|
293
274
|
turnkeySubOrganizationId,
|
|
294
275
|
});
|
|
295
276
|
try {
|
|
296
|
-
return yield newTurnkeyAccountRaw
|
|
277
|
+
return yield action(newTurnkeyAccountRaw);
|
|
297
278
|
}
|
|
298
279
|
catch (err) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
280
|
+
if (err.message.includes(embeddedWallet.TURNKEY_API_KEY_EXPIRY_MESSAGE) ||
|
|
281
|
+
err.message.includes(embeddedWallet.TURNKEY_API_KEY_NOT_FOUND_MESSAGE)) {
|
|
282
|
+
yield this.removeSessionKeys();
|
|
283
|
+
yield this.createOrRestoreSession({
|
|
284
|
+
ignoreRestore: true,
|
|
285
|
+
});
|
|
286
|
+
newTurnkeyAccountRaw = yield this.createTurnkeyAccount({
|
|
287
|
+
address,
|
|
288
|
+
turnkeySubOrganizationId,
|
|
289
|
+
});
|
|
290
|
+
return action(newTurnkeyAccountRaw);
|
|
291
|
+
}
|
|
292
|
+
walletConnectorCore.logger.error(`[TK] SubOrg: ${turnkeySubOrganizationId} failed to perform activity`, err);
|
|
293
|
+
throw err;
|
|
308
294
|
}
|
|
309
295
|
});
|
|
310
296
|
}
|
|
@@ -54,6 +54,7 @@ export declare class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBas
|
|
|
54
54
|
private internalSignTransaction;
|
|
55
55
|
private internalSignTypedData;
|
|
56
56
|
private internalSignMessage;
|
|
57
|
+
private doRetryableTurnkeyAction;
|
|
57
58
|
private createTurnkeyAccount;
|
|
58
59
|
private refreshTurnkeyAccount;
|
|
59
60
|
private getTurnkeyAccount;
|
|
@@ -10,7 +10,7 @@ import { toAccount } from 'viem/accounts';
|
|
|
10
10
|
import { parseEvmNetworks, getTLD, PlatformService, DynamicError } from '@dynamic-labs/utils';
|
|
11
11
|
import { createWalletClientWithUiConfirmation, getOrMapViemChain, createViemUiTransaction } from '@dynamic-labs/viem-utils';
|
|
12
12
|
import { getRpcUrlForChain, logger } from '@dynamic-labs/wallet-connector-core';
|
|
13
|
-
import { TurnkeyWalletConnectorBase, findTurnkeyVerifiedCredential, PasskeyService, TURNKEY_API_BASE_URL } from '@dynamic-labs/embedded-wallet';
|
|
13
|
+
import { TurnkeyWalletConnectorBase, findTurnkeyVerifiedCredential, PasskeyService, TURNKEY_API_BASE_URL, TURNKEY_API_KEY_EXPIRY_MESSAGE, TURNKEY_API_KEY_NOT_FOUND_MESSAGE } from '@dynamic-labs/embedded-wallet';
|
|
14
14
|
|
|
15
15
|
class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase {
|
|
16
16
|
constructor(nameAndKey, props) {
|
|
@@ -237,70 +237,56 @@ class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase {
|
|
|
237
237
|
}
|
|
238
238
|
internalSignTransaction(_a) {
|
|
239
239
|
return __awaiter(this, arguments, void 0, function* ({ transaction, args, address, turnkeySubOrganizationId, }) {
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
return this.doRetryableTurnkeyAction({
|
|
241
|
+
action: (turnkeyAccount) => turnkeyAccount.signTransaction(transaction, args),
|
|
242
242
|
address,
|
|
243
243
|
turnkeySubOrganizationId,
|
|
244
244
|
});
|
|
245
|
-
try {
|
|
246
|
-
return yield newTurnkeyAccount.signTransaction(transaction, args);
|
|
247
|
-
}
|
|
248
|
-
catch (err) {
|
|
249
|
-
yield this.removeSessionKeys();
|
|
250
|
-
yield this.createOrRestoreSession({
|
|
251
|
-
ignoreRestore: true,
|
|
252
|
-
});
|
|
253
|
-
const newTurnkeyAccount = yield this.createTurnkeyAccount({
|
|
254
|
-
address,
|
|
255
|
-
turnkeySubOrganizationId,
|
|
256
|
-
});
|
|
257
|
-
return newTurnkeyAccount.signTransaction(transaction, args);
|
|
258
|
-
}
|
|
259
245
|
});
|
|
260
246
|
}
|
|
261
247
|
internalSignTypedData(_a) {
|
|
262
248
|
return __awaiter(this, arguments, void 0, function* ({ typedData, address, turnkeySubOrganizationId, }) {
|
|
263
|
-
|
|
264
|
-
|
|
249
|
+
return this.doRetryableTurnkeyAction({
|
|
250
|
+
action: (turnkeyAccount) => turnkeyAccount.signTypedData(typedData),
|
|
265
251
|
address,
|
|
266
252
|
turnkeySubOrganizationId,
|
|
267
253
|
});
|
|
268
|
-
try {
|
|
269
|
-
return yield newTurnkeyAccountRaw.signTypedData(typedData);
|
|
270
|
-
}
|
|
271
|
-
catch (err) {
|
|
272
|
-
yield this.removeSessionKeys();
|
|
273
|
-
yield this.createOrRestoreSession({
|
|
274
|
-
ignoreRestore: true,
|
|
275
|
-
});
|
|
276
|
-
const newTurnkeyAccountRaw = yield this.createTurnkeyAccount({
|
|
277
|
-
address,
|
|
278
|
-
turnkeySubOrganizationId,
|
|
279
|
-
});
|
|
280
|
-
return newTurnkeyAccountRaw.signTypedData(typedData);
|
|
281
|
-
}
|
|
282
254
|
});
|
|
283
255
|
}
|
|
284
256
|
internalSignMessage(_a) {
|
|
285
257
|
return __awaiter(this, arguments, void 0, function* ({ message, address, turnkeySubOrganizationId, }) {
|
|
258
|
+
return this.doRetryableTurnkeyAction({
|
|
259
|
+
action: (turnkeyAccount) => turnkeyAccount.signMessage({ message }),
|
|
260
|
+
address,
|
|
261
|
+
turnkeySubOrganizationId,
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
doRetryableTurnkeyAction(_a) {
|
|
266
|
+
return __awaiter(this, arguments, void 0, function* ({ action, address, turnkeySubOrganizationId, }) {
|
|
286
267
|
yield this.createOrRestoreSession();
|
|
287
|
-
|
|
268
|
+
let newTurnkeyAccountRaw = yield this.createTurnkeyAccount({
|
|
288
269
|
address,
|
|
289
270
|
turnkeySubOrganizationId,
|
|
290
271
|
});
|
|
291
272
|
try {
|
|
292
|
-
return yield newTurnkeyAccountRaw
|
|
273
|
+
return yield action(newTurnkeyAccountRaw);
|
|
293
274
|
}
|
|
294
275
|
catch (err) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
276
|
+
if (err.message.includes(TURNKEY_API_KEY_EXPIRY_MESSAGE) ||
|
|
277
|
+
err.message.includes(TURNKEY_API_KEY_NOT_FOUND_MESSAGE)) {
|
|
278
|
+
yield this.removeSessionKeys();
|
|
279
|
+
yield this.createOrRestoreSession({
|
|
280
|
+
ignoreRestore: true,
|
|
281
|
+
});
|
|
282
|
+
newTurnkeyAccountRaw = yield this.createTurnkeyAccount({
|
|
283
|
+
address,
|
|
284
|
+
turnkeySubOrganizationId,
|
|
285
|
+
});
|
|
286
|
+
return action(newTurnkeyAccountRaw);
|
|
287
|
+
}
|
|
288
|
+
logger.error(`[TK] SubOrg: ${turnkeySubOrganizationId} failed to perform activity`, err);
|
|
289
|
+
throw err;
|
|
304
290
|
}
|
|
305
291
|
});
|
|
306
292
|
}
|