@dynamic-labs/embedded-wallet-evm 4.4.2-preview.0 → 4.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -5
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -9
- package/src/lib/TurnkeyEVMWalletConnector/TurnkeyEVMWalletConnector.cjs +0 -66
- package/src/lib/TurnkeyEVMWalletConnector/TurnkeyEVMWalletConnector.d.ts +1 -3
- package/src/lib/TurnkeyEVMWalletConnector/TurnkeyEVMWalletConnector.js +0 -66
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
|
|
2
|
-
### [4.4.2
|
|
2
|
+
### [4.4.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.4.1...v4.4.2) (2025-01-30)
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
6
|
|
|
7
|
-
* add support for
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
* add support for Bitget BTC ([#7915](https://github.com/dynamic-labs/dynamic-auth/issues/7915)) ([3fe23f7](https://github.com/dynamic-labs/dynamic-auth/commit/3fe23f739818ef0f5d504c34f237d1d115e4f50c))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* add backpackeclipse to walletbook fallbacks ([#7932](https://github.com/dynamic-labs/dynamic-auth/issues/7932)) ([eeaa7da](https://github.com/dynamic-labs/dynamic-auth/commit/eeaa7da629cb06ffc856f2e7f99beefcb8553bbd))
|
|
13
|
+
* otp verified should always be true ([#7921](https://github.com/dynamic-labs/dynamic-auth/issues/7921)) ([ac884d6](https://github.com/dynamic-labs/dynamic-auth/commit/ac884d6475152778aabd72d2c923b3c0b7745b00))
|
|
14
|
+
* **qntm-2814:** return checksum address from coinbase and metamask ([#7927](https://github.com/dynamic-labs/dynamic-auth/issues/7927)) ([3169d4d](https://github.com/dynamic-labs/dynamic-auth/commit/3169d4dd717b840c3654d15bacb20780d515269b))
|
|
15
|
+
* fix: creation of embedded wallet sessions with external auth
|
|
16
|
+
|
|
11
17
|
|
|
12
18
|
### [4.4.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.4.0...v4.4.1) (2025-01-27)
|
|
13
19
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/embedded-wallet-evm",
|
|
3
|
-
"version": "4.4.2
|
|
3
|
+
"version": "4.4.2",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"@turnkey/iframe-stamper": "2.0.0",
|
|
24
24
|
"@turnkey/viem": "0.6.2",
|
|
25
25
|
"@turnkey/webauthn-stamper": "0.5.0",
|
|
26
|
-
"@dynamic-labs/assert-package-version": "4.4.2
|
|
27
|
-
"@dynamic-labs/embedded-wallet": "4.4.2
|
|
28
|
-
"@dynamic-labs/ethereum-core": "4.4.2
|
|
29
|
-
"@dynamic-labs/types": "4.4.2
|
|
30
|
-
"@dynamic-labs/utils": "4.4.2
|
|
31
|
-
"@dynamic-labs/wallet-book": "4.4.2
|
|
32
|
-
"@dynamic-labs/wallet-connector-core": "4.4.2
|
|
33
|
-
"@dynamic-labs/webauthn": "4.4.2
|
|
26
|
+
"@dynamic-labs/assert-package-version": "4.4.2",
|
|
27
|
+
"@dynamic-labs/embedded-wallet": "4.4.2",
|
|
28
|
+
"@dynamic-labs/ethereum-core": "4.4.2",
|
|
29
|
+
"@dynamic-labs/types": "4.4.2",
|
|
30
|
+
"@dynamic-labs/utils": "4.4.2",
|
|
31
|
+
"@dynamic-labs/wallet-book": "4.4.2",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "4.4.2",
|
|
33
|
+
"@dynamic-labs/webauthn": "4.4.2"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"viem": "^2.21.55"
|
|
@@ -10,7 +10,6 @@ var viem$1 = require('@turnkey/viem');
|
|
|
10
10
|
var webauthnStamper = require('@turnkey/webauthn-stamper');
|
|
11
11
|
var viem = require('viem');
|
|
12
12
|
var accounts = require('viem/accounts');
|
|
13
|
-
var experimental = require('viem/experimental');
|
|
14
13
|
var utils = require('@dynamic-labs/utils');
|
|
15
14
|
var ethereumCore = require('@dynamic-labs/ethereum-core');
|
|
16
15
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
@@ -103,44 +102,6 @@ class TurnkeyEVMWalletConnector extends embeddedWallet.TurnkeyWalletConnectorBas
|
|
|
103
102
|
}
|
|
104
103
|
});
|
|
105
104
|
}
|
|
106
|
-
experimental_signAuthorization(parameters) {
|
|
107
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
var _a;
|
|
109
|
-
const { contractAddress } = parameters;
|
|
110
|
-
const chainId = this.currentChainId;
|
|
111
|
-
yield this.createOrRestoreSession();
|
|
112
|
-
if (!chainId) {
|
|
113
|
-
throw new Error('Chain id not found');
|
|
114
|
-
}
|
|
115
|
-
const [signer, publicClient] = yield Promise.all([
|
|
116
|
-
this.getSigner(),
|
|
117
|
-
this.getPublicClient(),
|
|
118
|
-
]);
|
|
119
|
-
if (!signer || !publicClient) {
|
|
120
|
-
throw new Error('Required clients not found');
|
|
121
|
-
}
|
|
122
|
-
const { turnkeySubOrganizationId } = (_a = this.walletProperties) !== null && _a !== void 0 ? _a : {};
|
|
123
|
-
if (!turnkeySubOrganizationId) {
|
|
124
|
-
throw new Error('Turnkey sub organization id not found');
|
|
125
|
-
}
|
|
126
|
-
const { address } = signer.account;
|
|
127
|
-
const nonce = yield publicClient.getTransactionCount({ address });
|
|
128
|
-
const signature = yield this.internalSign({
|
|
129
|
-
address,
|
|
130
|
-
hash: experimental.hashAuthorization({ chainId, contractAddress, nonce }),
|
|
131
|
-
turnkeySubOrganizationId,
|
|
132
|
-
});
|
|
133
|
-
return {
|
|
134
|
-
chainId,
|
|
135
|
-
contractAddress,
|
|
136
|
-
nonce,
|
|
137
|
-
r: signature.r,
|
|
138
|
-
s: signature.s,
|
|
139
|
-
v: BigInt(signature.v),
|
|
140
|
-
yParity: signature.yParity,
|
|
141
|
-
};
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
105
|
getBalance(address) {
|
|
145
106
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
146
107
|
const client = yield this.getPublicClient();
|
|
@@ -275,33 +236,6 @@ class TurnkeyEVMWalletConnector extends embeddedWallet.TurnkeyWalletConnectorBas
|
|
|
275
236
|
const chainId = this.currentChainId;
|
|
276
237
|
return this.evmNetworks.find((network) => network.chainId === chainId);
|
|
277
238
|
}
|
|
278
|
-
internalSign(_a) {
|
|
279
|
-
return _tslib.__awaiter(this, arguments, void 0, function* ({ hash, address, turnkeySubOrganizationId, }) {
|
|
280
|
-
var _b;
|
|
281
|
-
const client = this.getTurnkeyClient();
|
|
282
|
-
const { activity } = yield client.signRawPayload({
|
|
283
|
-
organizationId: turnkeySubOrganizationId,
|
|
284
|
-
parameters: {
|
|
285
|
-
encoding: 'PAYLOAD_ENCODING_HEXADECIMAL',
|
|
286
|
-
hashFunction: 'HASH_FUNCTION_NO_OP',
|
|
287
|
-
payload: hash,
|
|
288
|
-
signWith: address,
|
|
289
|
-
},
|
|
290
|
-
timestampMs: Date.now().toString(),
|
|
291
|
-
type: 'ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2',
|
|
292
|
-
});
|
|
293
|
-
const result = (_b = activity === null || activity === void 0 ? void 0 : activity.result) === null || _b === void 0 ? void 0 : _b.signRawPayloadResult;
|
|
294
|
-
if (!result) {
|
|
295
|
-
throw new Error('Sign raw payload result not found');
|
|
296
|
-
}
|
|
297
|
-
return {
|
|
298
|
-
r: `0x${result.r}`,
|
|
299
|
-
s: `0x${result.s}`,
|
|
300
|
-
v: result.v,
|
|
301
|
-
yParity: Number(result.v) % 2,
|
|
302
|
-
};
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
239
|
internalSignTransaction(_a) {
|
|
306
240
|
return _tslib.__awaiter(this, arguments, void 0, function* ({ transaction, args, address, turnkeySubOrganizationId, }) {
|
|
307
241
|
return this.doRetryableTurnkeyAction({
|
|
@@ -3,7 +3,7 @@ import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
|
|
|
3
3
|
import { EvmNetwork, GenericNetwork, IUITransaction, WalletUiUtils } from '@dynamic-labs/types';
|
|
4
4
|
import { IChainRpcProviders, EthereumWallet, RegisterEvmProvidersConfig } from '@dynamic-labs/ethereum-core';
|
|
5
5
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
6
|
-
import type { Chain,
|
|
6
|
+
import type { Chain, ISendBalanceWalletConnector, InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
7
7
|
import { TurnkeyWalletConnectorNameAndKey, TurnkeyWalletConnectorBase } from '@dynamic-labs/embedded-wallet';
|
|
8
8
|
export type TurnkeyEVMConnectorProps = {
|
|
9
9
|
walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
@@ -39,7 +39,6 @@ export declare class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBas
|
|
|
39
39
|
}): Promise<void>;
|
|
40
40
|
setVerifiedCredentials(verifiedCredentials: JwtVerifiedCredential[]): void;
|
|
41
41
|
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
42
|
-
experimental_signAuthorization(parameters: EVMAuthorizationParameters): Promise<EVMAuthorizationResult>;
|
|
43
42
|
getBalance(address: string): Promise<string | undefined>;
|
|
44
43
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
45
44
|
getPublicClient(): Promise<void | PublicClient<Transport, ViemChain> | undefined>;
|
|
@@ -51,7 +50,6 @@ export declare class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBas
|
|
|
51
50
|
set lastUsedChainId(chainId: number | undefined);
|
|
52
51
|
private get networkRpcUrl();
|
|
53
52
|
private get currentEvmNetwork();
|
|
54
|
-
private internalSign;
|
|
55
53
|
private internalSignTransaction;
|
|
56
54
|
private internalSignTypedData;
|
|
57
55
|
private internalSignMessage;
|
|
@@ -6,7 +6,6 @@ import { createAccount } from '@turnkey/viem';
|
|
|
6
6
|
import { WebauthnStamper } from '@turnkey/webauthn-stamper';
|
|
7
7
|
import { http, formatEther } from 'viem';
|
|
8
8
|
import { toAccount } from 'viem/accounts';
|
|
9
|
-
import { hashAuthorization } from 'viem/experimental';
|
|
10
9
|
import { parseEvmNetworks, DynamicError } from '@dynamic-labs/utils';
|
|
11
10
|
import { EthereumWallet, createWalletClientWithUiConfirmation, getOrMapViemChain, createViemUiTransaction } from '@dynamic-labs/ethereum-core';
|
|
12
11
|
import { getRpcUrlForChain, isSameAddress } from '@dynamic-labs/wallet-connector-core';
|
|
@@ -99,44 +98,6 @@ class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase {
|
|
|
99
98
|
}
|
|
100
99
|
});
|
|
101
100
|
}
|
|
102
|
-
experimental_signAuthorization(parameters) {
|
|
103
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
var _a;
|
|
105
|
-
const { contractAddress } = parameters;
|
|
106
|
-
const chainId = this.currentChainId;
|
|
107
|
-
yield this.createOrRestoreSession();
|
|
108
|
-
if (!chainId) {
|
|
109
|
-
throw new Error('Chain id not found');
|
|
110
|
-
}
|
|
111
|
-
const [signer, publicClient] = yield Promise.all([
|
|
112
|
-
this.getSigner(),
|
|
113
|
-
this.getPublicClient(),
|
|
114
|
-
]);
|
|
115
|
-
if (!signer || !publicClient) {
|
|
116
|
-
throw new Error('Required clients not found');
|
|
117
|
-
}
|
|
118
|
-
const { turnkeySubOrganizationId } = (_a = this.walletProperties) !== null && _a !== void 0 ? _a : {};
|
|
119
|
-
if (!turnkeySubOrganizationId) {
|
|
120
|
-
throw new Error('Turnkey sub organization id not found');
|
|
121
|
-
}
|
|
122
|
-
const { address } = signer.account;
|
|
123
|
-
const nonce = yield publicClient.getTransactionCount({ address });
|
|
124
|
-
const signature = yield this.internalSign({
|
|
125
|
-
address,
|
|
126
|
-
hash: hashAuthorization({ chainId, contractAddress, nonce }),
|
|
127
|
-
turnkeySubOrganizationId,
|
|
128
|
-
});
|
|
129
|
-
return {
|
|
130
|
-
chainId,
|
|
131
|
-
contractAddress,
|
|
132
|
-
nonce,
|
|
133
|
-
r: signature.r,
|
|
134
|
-
s: signature.s,
|
|
135
|
-
v: BigInt(signature.v),
|
|
136
|
-
yParity: signature.yParity,
|
|
137
|
-
};
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
101
|
getBalance(address) {
|
|
141
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
142
103
|
const client = yield this.getPublicClient();
|
|
@@ -271,33 +232,6 @@ class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase {
|
|
|
271
232
|
const chainId = this.currentChainId;
|
|
272
233
|
return this.evmNetworks.find((network) => network.chainId === chainId);
|
|
273
234
|
}
|
|
274
|
-
internalSign(_a) {
|
|
275
|
-
return __awaiter(this, arguments, void 0, function* ({ hash, address, turnkeySubOrganizationId, }) {
|
|
276
|
-
var _b;
|
|
277
|
-
const client = this.getTurnkeyClient();
|
|
278
|
-
const { activity } = yield client.signRawPayload({
|
|
279
|
-
organizationId: turnkeySubOrganizationId,
|
|
280
|
-
parameters: {
|
|
281
|
-
encoding: 'PAYLOAD_ENCODING_HEXADECIMAL',
|
|
282
|
-
hashFunction: 'HASH_FUNCTION_NO_OP',
|
|
283
|
-
payload: hash,
|
|
284
|
-
signWith: address,
|
|
285
|
-
},
|
|
286
|
-
timestampMs: Date.now().toString(),
|
|
287
|
-
type: 'ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2',
|
|
288
|
-
});
|
|
289
|
-
const result = (_b = activity === null || activity === void 0 ? void 0 : activity.result) === null || _b === void 0 ? void 0 : _b.signRawPayloadResult;
|
|
290
|
-
if (!result) {
|
|
291
|
-
throw new Error('Sign raw payload result not found');
|
|
292
|
-
}
|
|
293
|
-
return {
|
|
294
|
-
r: `0x${result.r}`,
|
|
295
|
-
s: `0x${result.s}`,
|
|
296
|
-
v: result.v,
|
|
297
|
-
yParity: Number(result.v) % 2,
|
|
298
|
-
};
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
235
|
internalSignTransaction(_a) {
|
|
302
236
|
return __awaiter(this, arguments, void 0, function* ({ transaction, args, address, turnkeySubOrganizationId, }) {
|
|
303
237
|
return this.doRetryableTurnkeyAction({
|