@dynamic-labs/wallet-connector-core 3.0.0-alpha.24 → 3.0.0-alpha.26
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 -0
- package/package.json +7 -7
- package/src/index.cjs +2 -0
- package/src/index.js +1 -0
- package/src/lib/WalletConnector.cjs +13 -0
- package/src/lib/WalletConnector.d.ts +2 -0
- package/src/lib/WalletConnector.js +13 -0
- package/src/lib/wallets/Wallet/Wallet.cjs +1 -0
- package/src/lib/wallets/Wallet/Wallet.js +1 -0
- package/src/utils/getMobileExperience/getMobileExperience.cjs +24 -0
- package/src/utils/getMobileExperience/getMobileExperience.d.ts +7 -0
- package/src/utils/getMobileExperience/getMobileExperience.js +20 -0
- package/src/utils/getMobileExperience/index.d.ts +1 -0
- package/src/utils/index.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.26](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.25...v3.0.0-alpha.26) (2024-07-24)
|
|
3
|
+
|
|
4
|
+
## [3.0.0-alpha.25](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.24...v3.0.0-alpha.25) (2024-07-24)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* add ability to specify mobileExperience on a wallet by wallet ([#6195](https://github.com/dynamic-labs/DynamicAuth/issues/6195)) ([947fd0a](https://github.com/dynamic-labs/DynamicAuth/commit/947fd0ab864d1995a1ef35a51c77a585649fd43f))
|
|
10
|
+
* global wallet new package ([#6385](https://github.com/dynamic-labs/DynamicAuth/issues/6385)) ([230a0f3](https://github.com/dynamic-labs/DynamicAuth/commit/230a0f380c2bc8c69619daed0c7f3280da8b8bb9))
|
|
11
|
+
* solana send balance modal for injected ([#6405](https://github.com/dynamic-labs/DynamicAuth/issues/6405)) ([b8aa84b](https://github.com/dynamic-labs/DynamicAuth/commit/b8aa84b58eb71791405bf68b6c46c40bebb170f8))
|
|
12
|
+
|
|
2
13
|
## [3.0.0-alpha.24](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.23...v3.0.0-alpha.24) (2024-07-20)
|
|
3
14
|
|
|
4
15
|
## [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)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/wallet-connector-core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.26",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -26,14 +26,14 @@
|
|
|
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.497"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
33
|
-
"@dynamic-labs/rpc-providers": "3.0.0-alpha.
|
|
34
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
35
|
-
"@dynamic-labs/utils": "3.0.0-alpha.
|
|
36
|
-
"@dynamic-labs/wallet-book": "3.0.0-alpha.
|
|
32
|
+
"@dynamic-labs/logger": "3.0.0-alpha.26",
|
|
33
|
+
"@dynamic-labs/rpc-providers": "3.0.0-alpha.26",
|
|
34
|
+
"@dynamic-labs/types": "3.0.0-alpha.26",
|
|
35
|
+
"@dynamic-labs/utils": "3.0.0-alpha.26",
|
|
36
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.26",
|
|
37
37
|
"eventemitter3": "5.0.1"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/src/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ var isCoinbaseMpcWalletConnector = require('./utils/isCoinbaseMpcWalletConnector
|
|
|
33
33
|
var isWalletConnectConnector = require('./utils/isWalletConnectConnector/isWalletConnectConnector.cjs');
|
|
34
34
|
var isSendBalanceWalletConnector = require('./utils/isSendBalanceWalletConnector/isSendBalanceWalletConnector.cjs');
|
|
35
35
|
var isSessionKeyCompatibleWalletConnector = require('./utils/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.cjs');
|
|
36
|
+
var getMobileExperience = require('./utils/getMobileExperience/getMobileExperience.cjs');
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
|
|
@@ -70,3 +71,4 @@ exports.isCoinbaseMpcWalletConnector = isCoinbaseMpcWalletConnector.isCoinbaseMp
|
|
|
70
71
|
exports.isWalletConnectConnector = isWalletConnectConnector.isWalletConnectConnector;
|
|
71
72
|
exports.isSendBalanceWalletConnector = isSendBalanceWalletConnector.isSendBalanceWalletConnector;
|
|
72
73
|
exports.isSessionKeyCompatibleWalletConnector = isSessionKeyCompatibleWalletConnector.isSessionKeyCompatibleWalletConnector;
|
|
74
|
+
exports.getMobileExperience = getMobileExperience.getMobileExperience;
|
package/src/index.js
CHANGED
|
@@ -29,3 +29,4 @@ export { isCoinbaseMpcWalletConnector } from './utils/isCoinbaseMpcWalletConnect
|
|
|
29
29
|
export { isWalletConnectConnector } from './utils/isWalletConnectConnector/isWalletConnectConnector.js';
|
|
30
30
|
export { isSendBalanceWalletConnector } from './utils/isSendBalanceWalletConnector/isSendBalanceWalletConnector.js';
|
|
31
31
|
export { isSessionKeyCompatibleWalletConnector } from './utils/isSessionKeyCompatibleWalletConnector/isSessionKeyCompatibleWalletConnector.js';
|
|
32
|
+
export { getMobileExperience } from './utils/getMobileExperience/getMobileExperience.js';
|
|
@@ -8,6 +8,7 @@ var EventEmitter = require('eventemitter3');
|
|
|
8
8
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
9
9
|
var utils = require('@dynamic-labs/utils');
|
|
10
10
|
var logger = require('../utils/logger.cjs');
|
|
11
|
+
var getMobileExperience = require('../utils/getMobileExperience/getMobileExperience.cjs');
|
|
11
12
|
var WalletBookSingleton = require('./WalletBookSingleton.cjs');
|
|
12
13
|
|
|
13
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -126,6 +127,11 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
|
|
|
126
127
|
if (_tslib.__classPrivateFieldGet(this, _WalletConnectorBase_registeredExtensions, "f").includes(extension.name)) {
|
|
127
128
|
throw new Error(`You can only register a single extension of: ${extension.name}`);
|
|
128
129
|
}
|
|
130
|
+
if (extension.name === 'global-wallet-extension') {
|
|
131
|
+
// only allow global wallet extension for evm embedded wallets
|
|
132
|
+
if (!this.isEmbeddedWallet || !this.supportedChains.includes('EVM'))
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
129
135
|
_tslib.__classPrivateFieldGet(this, _WalletConnectorBase_registeredExtensions, "f").push(extension.name);
|
|
130
136
|
extension.extend(this);
|
|
131
137
|
}
|
|
@@ -151,6 +157,13 @@ class WalletConnectorBase extends EventEmitter__default["default"] {
|
|
|
151
157
|
return false;
|
|
152
158
|
}
|
|
153
159
|
}
|
|
160
|
+
get mobileExperience() {
|
|
161
|
+
return getMobileExperience.getMobileExperience({
|
|
162
|
+
mobileExperienceProp: this.constructorProps.mobileExperience,
|
|
163
|
+
walletBook: this.walletBook,
|
|
164
|
+
walletKey: this.key,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
154
167
|
connect() {
|
|
155
168
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
156
169
|
yield this.getAddress();
|
|
@@ -2,6 +2,7 @@ import EventEmitter from 'eventemitter3';
|
|
|
2
2
|
import { WalletBookSchema, WalletSchema } from '@dynamic-labs/wallet-book';
|
|
3
3
|
import type { JwtVerifiedCredential, WalletAdditionalAddress } from '@dynamic-labs/sdk-api-core';
|
|
4
4
|
import { IChainRpcProviders } from '@dynamic-labs/rpc-providers';
|
|
5
|
+
import { MobileExperience } from '@dynamic-labs/types';
|
|
5
6
|
import { WalletBookSingleton } from './WalletBookSingleton';
|
|
6
7
|
import { WalletConnectorExtension } from './WalletConnectorExtension';
|
|
7
8
|
import { WalletConnectorCore } from './types';
|
|
@@ -70,6 +71,7 @@ export declare abstract class WalletConnectorBase extends EventEmitter<WalletCon
|
|
|
70
71
|
initEventListener(): void;
|
|
71
72
|
get walletBook(): WalletBookSchema;
|
|
72
73
|
filter(): boolean;
|
|
74
|
+
get mobileExperience(): MobileExperience | undefined;
|
|
73
75
|
/**
|
|
74
76
|
* This flag corresponds to whether this wallet connector also requires its own email otp outside dynamic
|
|
75
77
|
* @default false
|
|
@@ -4,6 +4,7 @@ import EventEmitter from 'eventemitter3';
|
|
|
4
4
|
import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
5
5
|
import { WalletAddressMismatchError } from '@dynamic-labs/utils';
|
|
6
6
|
import { logger } from '../utils/logger.js';
|
|
7
|
+
import { getMobileExperience } from '../utils/getMobileExperience/getMobileExperience.js';
|
|
7
8
|
import { WalletBookSingleton } from './WalletBookSingleton.js';
|
|
8
9
|
|
|
9
10
|
/* eslint-disable @typescript-eslint/triple-slash-reference */
|
|
@@ -118,6 +119,11 @@ class WalletConnectorBase extends EventEmitter {
|
|
|
118
119
|
if (__classPrivateFieldGet(this, _WalletConnectorBase_registeredExtensions, "f").includes(extension.name)) {
|
|
119
120
|
throw new Error(`You can only register a single extension of: ${extension.name}`);
|
|
120
121
|
}
|
|
122
|
+
if (extension.name === 'global-wallet-extension') {
|
|
123
|
+
// only allow global wallet extension for evm embedded wallets
|
|
124
|
+
if (!this.isEmbeddedWallet || !this.supportedChains.includes('EVM'))
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
121
127
|
__classPrivateFieldGet(this, _WalletConnectorBase_registeredExtensions, "f").push(extension.name);
|
|
122
128
|
extension.extend(this);
|
|
123
129
|
}
|
|
@@ -143,6 +149,13 @@ class WalletConnectorBase extends EventEmitter {
|
|
|
143
149
|
return false;
|
|
144
150
|
}
|
|
145
151
|
}
|
|
152
|
+
get mobileExperience() {
|
|
153
|
+
return getMobileExperience({
|
|
154
|
+
mobileExperienceProp: this.constructorProps.mobileExperience,
|
|
155
|
+
walletBook: this.walletBook,
|
|
156
|
+
walletKey: this.key,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
146
159
|
connect() {
|
|
147
160
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
161
|
yield this.getAddress();
|
|
@@ -7,6 +7,7 @@ var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var types = require('@dynamic-labs/types');
|
|
8
8
|
var logger = require('../../../utils/logger.cjs');
|
|
9
9
|
require('@dynamic-labs/utils');
|
|
10
|
+
require('@dynamic-labs/wallet-book');
|
|
10
11
|
|
|
11
12
|
var _Wallet_connector;
|
|
12
13
|
class Wallet extends types.BaseWallet {
|
|
@@ -3,6 +3,7 @@ import { __rest, __classPrivateFieldSet, __classPrivateFieldGet, __awaiter } fro
|
|
|
3
3
|
import { BaseWallet } from '@dynamic-labs/types';
|
|
4
4
|
import { logger } from '../../../utils/logger.js';
|
|
5
5
|
import '@dynamic-labs/utils';
|
|
6
|
+
import '@dynamic-labs/wallet-book';
|
|
6
7
|
|
|
7
8
|
var _Wallet_connector;
|
|
8
9
|
class Wallet extends BaseWallet {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
|
+
|
|
8
|
+
const getMobileExperience = ({ mobileExperienceProp, walletBook: walletBook$1, walletKey, }) => {
|
|
9
|
+
// if the legacy prop is set, use that
|
|
10
|
+
if (mobileExperienceProp && typeof mobileExperienceProp === 'string')
|
|
11
|
+
return mobileExperienceProp;
|
|
12
|
+
// if the wallet has a deeplink preference set from the DynamicContext, use that
|
|
13
|
+
if (mobileExperienceProp === null || mobileExperienceProp === void 0 ? void 0 : mobileExperienceProp[walletKey])
|
|
14
|
+
return mobileExperienceProp[walletKey];
|
|
15
|
+
// if the wallet has a deeplink preference set in the wallet book, use that
|
|
16
|
+
const walletRecord = walletBook.findWalletBookWallet(walletBook$1, walletKey);
|
|
17
|
+
if (walletRecord === null || walletRecord === void 0 ? void 0 : walletRecord.mobileExperience)
|
|
18
|
+
return walletRecord.mobileExperience;
|
|
19
|
+
if (mobileExperienceProp === null || mobileExperienceProp === void 0 ? void 0 : mobileExperienceProp.default)
|
|
20
|
+
return mobileExperienceProp.default;
|
|
21
|
+
return 'in-app-browser';
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.getMobileExperience = getMobileExperience;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MobileExperience } from '@dynamic-labs/types';
|
|
2
|
+
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
3
|
+
export declare const getMobileExperience: ({ mobileExperienceProp, walletBook, walletKey, }: {
|
|
4
|
+
mobileExperienceProp?: MobileExperience;
|
|
5
|
+
walletBook: WalletBookSchema;
|
|
6
|
+
walletKey: string;
|
|
7
|
+
}) => MobileExperience;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
3
|
+
|
|
4
|
+
const getMobileExperience = ({ mobileExperienceProp, walletBook, walletKey, }) => {
|
|
5
|
+
// if the legacy prop is set, use that
|
|
6
|
+
if (mobileExperienceProp && typeof mobileExperienceProp === 'string')
|
|
7
|
+
return mobileExperienceProp;
|
|
8
|
+
// if the wallet has a deeplink preference set from the DynamicContext, use that
|
|
9
|
+
if (mobileExperienceProp === null || mobileExperienceProp === void 0 ? void 0 : mobileExperienceProp[walletKey])
|
|
10
|
+
return mobileExperienceProp[walletKey];
|
|
11
|
+
// if the wallet has a deeplink preference set in the wallet book, use that
|
|
12
|
+
const walletRecord = findWalletBookWallet(walletBook, walletKey);
|
|
13
|
+
if (walletRecord === null || walletRecord === void 0 ? void 0 : walletRecord.mobileExperience)
|
|
14
|
+
return walletRecord.mobileExperience;
|
|
15
|
+
if (mobileExperienceProp === null || mobileExperienceProp === void 0 ? void 0 : mobileExperienceProp.default)
|
|
16
|
+
return mobileExperienceProp.default;
|
|
17
|
+
return 'in-app-browser';
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { getMobileExperience };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getMobileExperience';
|
package/src/utils/index.d.ts
CHANGED