@dynamic-labs/embedded-wallet 3.0.0-alpha.55 → 3.0.0-alpha.57
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 +25 -0
- package/package.json +7 -7
- package/src/index.cjs +3 -2
- package/src/index.d.ts +2 -1
- package/src/index.js +1 -1
- package/src/lib/TurnkeyWalletConnectorBase/TurnkeyWalletConnectorBase.cjs +16 -9
- package/src/lib/TurnkeyWalletConnectorBase/TurnkeyWalletConnectorBase.d.ts +8 -3
- package/src/lib/TurnkeyWalletConnectorBase/TurnkeyWalletConnectorBase.js +16 -9
- package/src/lib/utils/findTurnkeyVerifiedCredentials/findTurnkeyVerifiedCredentials.cjs +19 -0
- package/src/lib/utils/findTurnkeyVerifiedCredentials/findTurnkeyVerifiedCredentials.d.ts +7 -0
- package/src/lib/utils/findTurnkeyVerifiedCredentials/findTurnkeyVerifiedCredentials.js +14 -0
- package/src/lib/utils/findTurnkeyVerifiedCredentials/index.d.ts +2 -0
- package/src/lib/utils/index.d.ts +1 -1
- package/src/lib/utils/findTurnkeyVerifiedCredential/findTurnkeyVerifiedCredential.cjs +0 -8
- package/src/lib/utils/findTurnkeyVerifiedCredential/findTurnkeyVerifiedCredential.d.ts +0 -2
- package/src/lib/utils/findTurnkeyVerifiedCredential/findTurnkeyVerifiedCredential.js +0 -4
- package/src/lib/utils/findTurnkeyVerifiedCredential/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.57](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.56...v3.0.0-alpha.57) (2024-09-05)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add support for headless mfa ([#6802](https://github.com/dynamic-labs/DynamicAuth/issues/6802)) ([1eea60e](https://github.com/dynamic-labs/DynamicAuth/commit/1eea60e4f6acf60a9efa8ae64626d0c72e18a12d))
|
|
8
|
+
* telegram auto login ([#6803](https://github.com/dynamic-labs/DynamicAuth/issues/6803)) ([1123ae4](https://github.com/dynamic-labs/DynamicAuth/commit/1123ae4acfdfc54be8dbfa03cc41cbbd00b4bea4))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* circular dependency in solana-core and wallet-book ([#6794](https://github.com/dynamic-labs/DynamicAuth/issues/6794)) ([c0d9254](https://github.com/dynamic-labs/DynamicAuth/commit/c0d9254f21c4a847bcf271886997ba61fe077696))
|
|
14
|
+
* fix overriding cosmos wallet methods ([#6799](https://github.com/dynamic-labs/DynamicAuth/issues/6799)) ([ebce93b](https://github.com/dynamic-labs/DynamicAuth/commit/ebce93bab49bb54d320c77a558d0df48eb1ce19a))
|
|
15
|
+
* fix overriding solana wallet methods ([#6798](https://github.com/dynamic-labs/DynamicAuth/issues/6798)) ([6ab57b5](https://github.com/dynamic-labs/DynamicAuth/commit/6ab57b534b04a3824898bbb9df3fc23397e661f3))
|
|
16
|
+
* memoize return of useSwitchWallet ([#6804](https://github.com/dynamic-labs/DynamicAuth/issues/6804)) ([7e96eb2](https://github.com/dynamic-labs/DynamicAuth/commit/7e96eb28ca3809edd89855c4ecb1344f3e9d53bd))
|
|
17
|
+
* phantom wallets error when trying to sync wallet ([#6782](https://github.com/dynamic-labs/DynamicAuth/issues/6782)) ([481e474](https://github.com/dynamic-labs/DynamicAuth/commit/481e4746adf1ebac5584e3c83d1603e5b2e48f8a))
|
|
18
|
+
* remove miss use of hook inside function ([#6795](https://github.com/dynamic-labs/DynamicAuth/issues/6795)) ([35902cf](https://github.com/dynamic-labs/DynamicAuth/commit/35902cfc876e93928cf5baff0313d8b0352c1129))
|
|
19
|
+
|
|
20
|
+
## [3.0.0-alpha.56](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.55...v3.0.0-alpha.56) (2024-09-03)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* pass `authCode` for telegram from sdk to `signin` and `verify` calls ([#6777](https://github.com/dynamic-labs/DynamicAuth/issues/6777)) ([43d09dd](https://github.com/dynamic-labs/DynamicAuth/commit/43d09dd3ea82fd13f1c798c0745aa0fef2051f90))
|
|
26
|
+
|
|
2
27
|
## [3.0.0-alpha.55](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.54...v3.0.0-alpha.55) (2024-09-02)
|
|
3
28
|
|
|
4
29
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/embedded-wallet",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.57",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -26,16 +26,16 @@
|
|
|
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.526",
|
|
30
30
|
"@turnkey/api-key-stamper": "0.4.1",
|
|
31
31
|
"@turnkey/http": "2.12.2",
|
|
32
32
|
"@turnkey/iframe-stamper": "2.0.0",
|
|
33
33
|
"@turnkey/webauthn-stamper": "0.5.0",
|
|
34
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
35
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
36
|
-
"@dynamic-labs/wallet-book": "3.0.0-alpha.
|
|
37
|
-
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.
|
|
38
|
-
"@dynamic-labs/webauthn": "3.0.0-alpha.
|
|
34
|
+
"@dynamic-labs/logger": "3.0.0-alpha.57",
|
|
35
|
+
"@dynamic-labs/utils": "3.0.0-alpha.57",
|
|
36
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.57",
|
|
37
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.57",
|
|
38
|
+
"@dynamic-labs/webauthn": "3.0.0-alpha.57"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {}
|
|
41
41
|
}
|
package/src/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var TurnkeyWalletConnectorBase = require('./lib/TurnkeyWalletConnectorBase/TurnkeyWalletConnectorBase.cjs');
|
|
7
7
|
var types = require('./types.cjs');
|
|
8
8
|
var PasskeyService = require('./lib/utils/PasskeyService/PasskeyService.cjs');
|
|
9
|
-
var
|
|
9
|
+
var findTurnkeyVerifiedCredentials = require('./lib/utils/findTurnkeyVerifiedCredentials/findTurnkeyVerifiedCredentials.cjs');
|
|
10
10
|
require('./lib/utils/convertAttestationTransports/convertAttestationTransports.cjs');
|
|
11
11
|
var logger = require('./lib/utils/logger/logger.cjs');
|
|
12
12
|
var TurnkeyAuthenticatorRecoveryHandler = require('./lib/AuthenticatorHandler/TurnkeyAuthenticatorRecoveryHandler.cjs');
|
|
@@ -18,7 +18,8 @@ var constants = require('./lib/constants.cjs');
|
|
|
18
18
|
exports.TurnkeyWalletConnectorBase = TurnkeyWalletConnectorBase.TurnkeyWalletConnectorBase;
|
|
19
19
|
exports.TurnkeyWalletConnectorInfo = types.TurnkeyWalletConnectorInfo;
|
|
20
20
|
exports.PasskeyService = PasskeyService.PasskeyService;
|
|
21
|
-
exports.
|
|
21
|
+
exports.findTurnkeyVerifiedCredentials = findTurnkeyVerifiedCredentials.findTurnkeyVerifiedCredentials;
|
|
22
|
+
exports.findTurnkeyVerifiedCredentialsWithSmartWalletRef = findTurnkeyVerifiedCredentials.findTurnkeyVerifiedCredentialsWithSmartWalletRef;
|
|
22
23
|
exports.logger = logger.logger;
|
|
23
24
|
exports.turnkeyAuthenticatorRecoveryHandler = TurnkeyAuthenticatorRecoveryHandler.turnkeyAuthenticatorRecoveryHandler;
|
|
24
25
|
exports.ExportHandler = ExportHandler.ExportHandler;
|
package/src/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { TurnkeyWalletConnectorBase, type SessionKeys, } from './lib/TurnkeyWalletConnectorBase';
|
|
2
2
|
export * from './types';
|
|
3
3
|
export * from './lib/utils/PasskeyService';
|
|
4
|
-
export {
|
|
4
|
+
export { findTurnkeyVerifiedCredentials, findTurnkeyVerifiedCredentialsWithSmartWalletRef, logger, } from './lib/utils';
|
|
5
|
+
export type { JwtVerifiedCredentialWithSmartWalletRef } from './lib/utils';
|
|
5
6
|
export * from './lib/AuthenticatorHandler';
|
|
6
7
|
export { ExportHandler } from './lib/ExportHandler';
|
|
7
8
|
export * from './lib/constants';
|
package/src/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export { TurnkeyWalletConnectorBase } from './lib/TurnkeyWalletConnectorBase/TurnkeyWalletConnectorBase.js';
|
|
3
3
|
export { TurnkeyWalletConnectorInfo } from './types.js';
|
|
4
4
|
export { PasskeyService } from './lib/utils/PasskeyService/PasskeyService.js';
|
|
5
|
-
export {
|
|
5
|
+
export { findTurnkeyVerifiedCredentials, findTurnkeyVerifiedCredentialsWithSmartWalletRef } from './lib/utils/findTurnkeyVerifiedCredentials/findTurnkeyVerifiedCredentials.js';
|
|
6
6
|
import './lib/utils/convertAttestationTransports/convertAttestationTransports.js';
|
|
7
7
|
export { logger } from './lib/utils/logger/logger.js';
|
|
8
8
|
export { turnkeyAuthenticatorRecoveryHandler } from './lib/AuthenticatorHandler/TurnkeyAuthenticatorRecoveryHandler.js';
|
|
@@ -131,12 +131,11 @@ class TurnkeyWalletConnectorBase extends walletConnectorCore.WalletConnectorBase
|
|
|
131
131
|
}
|
|
132
132
|
getConnectedAccounts() {
|
|
133
133
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return [address];
|
|
134
|
+
const verifiedCredentials = this.verifiedCredentials || [];
|
|
135
|
+
const addresses = verifiedCredentials
|
|
136
|
+
.map((vc) => vc === null || vc === void 0 ? void 0 : vc.address)
|
|
137
|
+
.filter((a) => typeof a === 'string');
|
|
138
|
+
return addresses;
|
|
140
139
|
});
|
|
141
140
|
}
|
|
142
141
|
get turnkeyAddress() {
|
|
@@ -149,6 +148,12 @@ class TurnkeyWalletConnectorBase extends walletConnectorCore.WalletConnectorBase
|
|
|
149
148
|
return walletProperties;
|
|
150
149
|
}
|
|
151
150
|
// Private methods
|
|
151
|
+
set verifiedCredentials(verifiedCredentials) {
|
|
152
|
+
this._verifiedCredentials = verifiedCredentials;
|
|
153
|
+
}
|
|
154
|
+
get verifiedCredentials() {
|
|
155
|
+
return this._verifiedCredentials;
|
|
156
|
+
}
|
|
152
157
|
set verifiedCredential(verifiedCredential) {
|
|
153
158
|
this._verifiedCredential = verifiedCredential;
|
|
154
159
|
}
|
|
@@ -163,7 +168,6 @@ class TurnkeyWalletConnectorBase extends walletConnectorCore.WalletConnectorBase
|
|
|
163
168
|
}
|
|
164
169
|
createOrRestoreSession() {
|
|
165
170
|
return _tslib.__awaiter(this, arguments, void 0, function* ({ ignoreRestore, } = {}) {
|
|
166
|
-
var _a;
|
|
167
171
|
if (!this.isSessionKeyCompatible() ||
|
|
168
172
|
TurnkeyWalletConnectorBase.isLoadingSession) {
|
|
169
173
|
return;
|
|
@@ -171,8 +175,11 @@ class TurnkeyWalletConnectorBase extends walletConnectorCore.WalletConnectorBase
|
|
|
171
175
|
if (!this.createOrRestoreSessionFetcherFunction) {
|
|
172
176
|
throw new utils.DynamicError('Cannot register session key to init provider');
|
|
173
177
|
}
|
|
174
|
-
|
|
175
|
-
|
|
178
|
+
const { sessionKeys } = TurnkeyWalletConnectorBase;
|
|
179
|
+
if (sessionKeys === null || sessionKeys === void 0 ? void 0 : sessionKeys.publicKey) {
|
|
180
|
+
const isExpired = new Date() >= new Date(sessionKeys.expirationDate);
|
|
181
|
+
if (!isExpired)
|
|
182
|
+
return sessionKeys.publicKey;
|
|
176
183
|
}
|
|
177
184
|
try {
|
|
178
185
|
TurnkeyWalletConnectorBase.isLoadingSession = true;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ApiKeyStamper } from '@turnkey/api-key-stamper';
|
|
2
|
-
import {
|
|
2
|
+
import { TurnkeyWalletProperties } from '@dynamic-labs/sdk-api-core';
|
|
3
3
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
4
4
|
import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import type { AuthenticatorRecoveryHandler, IEmailWalletConnector, IPasskeyWalletConnector, ISMSWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
+
import { JwtVerifiedCredentialWithSmartWalletRef } from '../utils';
|
|
6
7
|
import { TurnkeyWalletConnectorNameAndKey } from '../../types';
|
|
7
8
|
import { ExportHandler } from '../ExportHandler';
|
|
8
9
|
export type TurnkeyConnectorBaseProps = {
|
|
@@ -12,6 +13,7 @@ export type TurnkeyConnectorBaseProps = {
|
|
|
12
13
|
export type SessionKeys = {
|
|
13
14
|
publicKey: string;
|
|
14
15
|
privateKey: string;
|
|
16
|
+
expirationDate: string;
|
|
15
17
|
};
|
|
16
18
|
type ITurnkeyWalletConnector = IEmailWalletConnector & IPasskeyWalletConnector & ISMSWalletConnector;
|
|
17
19
|
export declare abstract class TurnkeyWalletConnectorBase extends WalletConnectorBase implements ITurnkeyWalletConnector {
|
|
@@ -24,6 +26,7 @@ export declare abstract class TurnkeyWalletConnectorBase extends WalletConnector
|
|
|
24
26
|
private _phone;
|
|
25
27
|
private _passkeyIdentifier;
|
|
26
28
|
private _verifiedCredential;
|
|
29
|
+
private _verifiedCredentials;
|
|
27
30
|
private __authenticatorMethodHandler;
|
|
28
31
|
private __exportHandler;
|
|
29
32
|
static sessionKeys: SessionKeys | undefined;
|
|
@@ -56,8 +59,10 @@ export declare abstract class TurnkeyWalletConnectorBase extends WalletConnector
|
|
|
56
59
|
getConnectedAccounts(): Promise<string[]>;
|
|
57
60
|
get turnkeyAddress(): string | undefined;
|
|
58
61
|
get walletProperties(): TurnkeyWalletProperties | undefined;
|
|
59
|
-
set
|
|
60
|
-
get
|
|
62
|
+
set verifiedCredentials(verifiedCredentials: JwtVerifiedCredentialWithSmartWalletRef[] | undefined);
|
|
63
|
+
get verifiedCredentials(): JwtVerifiedCredentialWithSmartWalletRef[] | undefined;
|
|
64
|
+
set verifiedCredential(verifiedCredential: JwtVerifiedCredentialWithSmartWalletRef | undefined);
|
|
65
|
+
get verifiedCredential(): JwtVerifiedCredentialWithSmartWalletRef | undefined;
|
|
61
66
|
setSessionKeyFetcher(func: () => Promise<SessionKeys>): void;
|
|
62
67
|
setSessionKeyRemoveFunction(func: () => Promise<void>): void;
|
|
63
68
|
removeSessionKeys: () => Promise<void>;
|
|
@@ -127,12 +127,11 @@ class TurnkeyWalletConnectorBase extends WalletConnectorBase {
|
|
|
127
127
|
}
|
|
128
128
|
getConnectedAccounts() {
|
|
129
129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return [address];
|
|
130
|
+
const verifiedCredentials = this.verifiedCredentials || [];
|
|
131
|
+
const addresses = verifiedCredentials
|
|
132
|
+
.map((vc) => vc === null || vc === void 0 ? void 0 : vc.address)
|
|
133
|
+
.filter((a) => typeof a === 'string');
|
|
134
|
+
return addresses;
|
|
136
135
|
});
|
|
137
136
|
}
|
|
138
137
|
get turnkeyAddress() {
|
|
@@ -145,6 +144,12 @@ class TurnkeyWalletConnectorBase extends WalletConnectorBase {
|
|
|
145
144
|
return walletProperties;
|
|
146
145
|
}
|
|
147
146
|
// Private methods
|
|
147
|
+
set verifiedCredentials(verifiedCredentials) {
|
|
148
|
+
this._verifiedCredentials = verifiedCredentials;
|
|
149
|
+
}
|
|
150
|
+
get verifiedCredentials() {
|
|
151
|
+
return this._verifiedCredentials;
|
|
152
|
+
}
|
|
148
153
|
set verifiedCredential(verifiedCredential) {
|
|
149
154
|
this._verifiedCredential = verifiedCredential;
|
|
150
155
|
}
|
|
@@ -159,7 +164,6 @@ class TurnkeyWalletConnectorBase extends WalletConnectorBase {
|
|
|
159
164
|
}
|
|
160
165
|
createOrRestoreSession() {
|
|
161
166
|
return __awaiter(this, arguments, void 0, function* ({ ignoreRestore, } = {}) {
|
|
162
|
-
var _a;
|
|
163
167
|
if (!this.isSessionKeyCompatible() ||
|
|
164
168
|
TurnkeyWalletConnectorBase.isLoadingSession) {
|
|
165
169
|
return;
|
|
@@ -167,8 +171,11 @@ class TurnkeyWalletConnectorBase extends WalletConnectorBase {
|
|
|
167
171
|
if (!this.createOrRestoreSessionFetcherFunction) {
|
|
168
172
|
throw new DynamicError('Cannot register session key to init provider');
|
|
169
173
|
}
|
|
170
|
-
|
|
171
|
-
|
|
174
|
+
const { sessionKeys } = TurnkeyWalletConnectorBase;
|
|
175
|
+
if (sessionKeys === null || sessionKeys === void 0 ? void 0 : sessionKeys.publicKey) {
|
|
176
|
+
const isExpired = new Date() >= new Date(sessionKeys.expirationDate);
|
|
177
|
+
if (!isExpired)
|
|
178
|
+
return sessionKeys.publicKey;
|
|
172
179
|
}
|
|
173
180
|
try {
|
|
174
181
|
TurnkeyWalletConnectorBase.isLoadingSession = true;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const findTurnkeyVerifiedCredentials = (verifiedCredentials, chain) => verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.filter(({ walletName, chain: vcChain }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && chain === vcChain);
|
|
7
|
+
const findTurnkeyVerifiedCredentialsWithSmartWalletRef = (verifiedCredentials, chain) => verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.reduce((acc, vc) => {
|
|
8
|
+
var _a;
|
|
9
|
+
if (((_a = vc.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('turnkey')) && chain === vc.chain) {
|
|
10
|
+
const smartWallet = verifiedCredentials.find((v) => v.signerRefId === vc.id);
|
|
11
|
+
const smartWalletRefId = smartWallet === null || smartWallet === void 0 ? void 0 : smartWallet.id;
|
|
12
|
+
const smartWalletRefAddress = smartWallet === null || smartWallet === void 0 ? void 0 : smartWallet.address;
|
|
13
|
+
acc.push(Object.assign(Object.assign({}, vc), { smartWalletRefAddress, smartWalletRefId }));
|
|
14
|
+
}
|
|
15
|
+
return acc;
|
|
16
|
+
}, []);
|
|
17
|
+
|
|
18
|
+
exports.findTurnkeyVerifiedCredentials = findTurnkeyVerifiedCredentials;
|
|
19
|
+
exports.findTurnkeyVerifiedCredentialsWithSmartWalletRef = findTurnkeyVerifiedCredentialsWithSmartWalletRef;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
export declare const findTurnkeyVerifiedCredentials: (verifiedCredentials: JwtVerifiedCredential[], chain: string) => JwtVerifiedCredential[];
|
|
3
|
+
export interface JwtVerifiedCredentialWithSmartWalletRef extends JwtVerifiedCredential {
|
|
4
|
+
smartWalletRefId?: string;
|
|
5
|
+
smartWalletRefAddress?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const findTurnkeyVerifiedCredentialsWithSmartWalletRef: (verifiedCredentials: JwtVerifiedCredential[], chain: string) => JwtVerifiedCredentialWithSmartWalletRef[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const findTurnkeyVerifiedCredentials = (verifiedCredentials, chain) => verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.filter(({ walletName, chain: vcChain }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && chain === vcChain);
|
|
3
|
+
const findTurnkeyVerifiedCredentialsWithSmartWalletRef = (verifiedCredentials, chain) => verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.reduce((acc, vc) => {
|
|
4
|
+
var _a;
|
|
5
|
+
if (((_a = vc.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('turnkey')) && chain === vc.chain) {
|
|
6
|
+
const smartWallet = verifiedCredentials.find((v) => v.signerRefId === vc.id);
|
|
7
|
+
const smartWalletRefId = smartWallet === null || smartWallet === void 0 ? void 0 : smartWallet.id;
|
|
8
|
+
const smartWalletRefAddress = smartWallet === null || smartWallet === void 0 ? void 0 : smartWallet.address;
|
|
9
|
+
acc.push(Object.assign(Object.assign({}, vc), { smartWalletRefAddress, smartWalletRefId }));
|
|
10
|
+
}
|
|
11
|
+
return acc;
|
|
12
|
+
}, []);
|
|
13
|
+
|
|
14
|
+
export { findTurnkeyVerifiedCredentials, findTurnkeyVerifiedCredentialsWithSmartWalletRef };
|
package/src/lib/utils/index.d.ts
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
const findTurnkeyVerifiedCredential = (verifiedCredentials, chain) => verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.find(({ walletName, chain: vcChain }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && chain === vcChain);
|
|
7
|
-
|
|
8
|
-
exports.findTurnkeyVerifiedCredential = findTurnkeyVerifiedCredential;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
const findTurnkeyVerifiedCredential = (verifiedCredentials, chain) => verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.find(({ walletName, chain: vcChain }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && chain === vcChain);
|
|
3
|
-
|
|
4
|
-
export { findTurnkeyVerifiedCredential };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { findTurnkeyVerifiedCredential } from './findTurnkeyVerifiedCredential';
|