@dynamic-labs/solana 4.0.0-alpha.44 → 4.0.0-alpha.46
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 +20 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/CoinbaseSolana/CoinbaseSolana.cjs +1 -1
- package/src/CoinbaseSolana/CoinbaseSolana.js +1 -1
- package/src/Phantom/Phantom.cjs +1 -1
- package/src/Phantom/Phantom.js +1 -1
- package/src/SolProviderHelper/SolProviderHelper.cjs +17 -7
- package/src/SolProviderHelper/SolProviderHelper.js +17 -7
- package/src/SolanaWalletConnectors.cjs +1 -1
- package/src/SolanaWalletConnectors.js +1 -1
- package/src/Solflare/Solflare.cjs +1 -1
- package/src/Solflare/Solflare.js +1 -1
- package/src/index.cjs +2 -2
- package/src/index.js +2 -2
- package/src/injected/{BackpackSol.cjs → BackpackSol/BackpackSol.cjs} +2 -2
- package/src/injected/{BackpackSol.d.ts → BackpackSol/BackpackSol.d.ts} +1 -1
- package/src/injected/{BackpackSol.js → BackpackSol/BackpackSol.js} +2 -2
- package/src/injected/BackpackSol/index.d.ts +1 -0
- package/src/injected/{FallbackSolanaConnector.cjs → FallbackSolanaConnector/FallbackSolanaConnector.cjs} +1 -1
- package/src/injected/{FallbackSolanaConnector.d.ts → FallbackSolanaConnector/FallbackSolanaConnector.d.ts} +1 -1
- package/src/injected/{FallbackSolanaConnector.js → FallbackSolanaConnector/FallbackSolanaConnector.js} +1 -1
- package/src/injected/FallbackSolanaConnector/index.d.ts +1 -0
- package/src/injected/{InjectedWalletBase.cjs → InjectedWalletBase/InjectedWalletBase.cjs} +3 -3
- package/src/injected/{InjectedWalletBase.d.ts → InjectedWalletBase/InjectedWalletBase.d.ts} +1 -1
- package/src/injected/{InjectedWalletBase.js → InjectedWalletBase/InjectedWalletBase.js} +3 -3
- package/src/injected/InjectedWalletBase/index.d.ts +1 -0
- package/src/injected/{PhantomInjected.cjs → PhantomInjected/PhantomInjected.cjs} +2 -2
- package/src/injected/{PhantomInjected.d.ts → PhantomInjected/PhantomInjected.d.ts} +1 -1
- package/src/injected/{PhantomInjected.js → PhantomInjected/PhantomInjected.js} +2 -2
- package/src/injected/PhantomInjected/index.d.ts +1 -0
- package/src/injected/fetchInjectedWalletConnectors.cjs +39 -20
- package/src/injected/fetchInjectedWalletConnectors.js +39 -20
- package/src/{SolanaWalletStandardConnector/utils → injected/walletStandard}/createSolanaSignerFromWalletStandard/createSolanaSignerFromWalletStandard.cjs +70 -19
- package/src/injected/walletStandard/createSolanaSignerFromWalletStandard/createSolanaSignerFromWalletStandard.d.ts +4 -0
- package/src/{SolanaWalletStandardConnector/utils → injected/walletStandard}/createSolanaSignerFromWalletStandard/createSolanaSignerFromWalletStandard.js +70 -19
- package/src/injected/walletStandard/getConnectorConstructorForWalletStandardWallet/getConnectorConstructorForWalletStandardWallet.cjs +29 -0
- package/src/injected/walletStandard/getConnectorConstructorForWalletStandardWallet/getConnectorConstructorForWalletStandardWallet.d.ts +3 -0
- package/src/injected/walletStandard/getConnectorConstructorForWalletStandardWallet/getConnectorConstructorForWalletStandardWallet.js +25 -0
- package/src/injected/walletStandard/getConnectorConstructorForWalletStandardWallet/index.d.ts +1 -0
- package/src/injected/walletStandard/getWalletStandardWallets/getWalletStandardWallets.cjs +10 -0
- package/src/injected/walletStandard/getWalletStandardWallets/getWalletStandardWallets.d.ts +1 -0
- package/src/injected/walletStandard/getWalletStandardWallets/getWalletStandardWallets.js +6 -0
- package/src/injected/walletStandard/getWalletStandardWallets/index.d.ts +1 -0
- package/src/SolanaWalletStandardConnector/SolanaWalletStandardConnector.cjs +0 -100
- package/src/SolanaWalletStandardConnector/SolanaWalletStandardConnector.d.ts +0 -20
- package/src/SolanaWalletStandardConnector/SolanaWalletStandardConnector.js +0 -96
- package/src/SolanaWalletStandardConnector/index.d.ts +0 -1
- package/src/SolanaWalletStandardConnector/utils/createSolanaSignerFromWalletStandard/createSolanaSignerFromWalletStandard.d.ts +0 -3
- /package/src/{SolanaWalletStandardConnector/utils → injected/walletStandard}/createSolanaSignerFromWalletStandard/index.d.ts +0 -0
- /package/src/{utils → injected/walletStandard}/findWalletProviderFromWalletStandard/findWalletProviderFromWalletStandard.cjs +0 -0
- /package/src/{utils → injected/walletStandard}/findWalletProviderFromWalletStandard/findWalletProviderFromWalletStandard.d.ts +0 -0
- /package/src/{utils → injected/walletStandard}/findWalletProviderFromWalletStandard/findWalletProviderFromWalletStandard.js +0 -0
- /package/src/{utils → injected/walletStandard}/findWalletProviderFromWalletStandard/index.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.46](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.45...v4.0.0-alpha.46) (2024-12-17)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **GVTY-2484:** add subdomain handle field ([#7613](https://github.com/dynamic-labs/dynamic-auth/issues/7613)) ([ee8df3b](https://github.com/dynamic-labs/dynamic-auth/commit/ee8df3b34fa9fed96d92d0b414334c370c9791bc))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* increase wait for transactions ([#7624](https://github.com/dynamic-labs/dynamic-auth/issues/7624)) ([2f7f01b](https://github.com/dynamic-labs/dynamic-auth/commit/2f7f01b024c2733f71ea0fd09dff24f815120acb))
|
|
13
|
+
* solana wallet standard signer connect ([#7614](https://github.com/dynamic-labs/dynamic-auth/issues/7614)) ([1836cf3](https://github.com/dynamic-labs/dynamic-auth/commit/1836cf343b45bae01cfdcf0c0d010bf38bf54d83))
|
|
14
|
+
|
|
15
|
+
## [4.0.0-alpha.45](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.44...v4.0.0-alpha.45) (2024-12-11)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* don't throw error if wallet no found in walletbook when fetching metadata ([#7579](https://github.com/dynamic-labs/dynamic-auth/issues/7579)) ([93074a1](https://github.com/dynamic-labs/dynamic-auth/commit/93074a11da1b843cd44ad986c7cfd1f243f2a65d))
|
|
21
|
+
|
|
2
22
|
## [4.0.0-alpha.44](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.43...v4.0.0-alpha.44) (2024-12-09)
|
|
3
23
|
|
|
4
24
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.46",
|
|
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",
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"@wallet-standard/experimental-features": "0.1.1",
|
|
26
26
|
"bs58": "5.0.0",
|
|
27
27
|
"tweetnacl": "1.0.3",
|
|
28
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
29
|
-
"@dynamic-labs/embedded-wallet-solana": "4.0.0-alpha.
|
|
30
|
-
"@dynamic-labs/logger": "4.0.0-alpha.
|
|
31
|
-
"@dynamic-labs/rpc-providers": "4.0.0-alpha.
|
|
32
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
33
|
-
"@dynamic-labs/solana-core": "4.0.0-alpha.
|
|
34
|
-
"@dynamic-labs/types": "4.0.0-alpha.
|
|
35
|
-
"@dynamic-labs/utils": "4.0.0-alpha.
|
|
36
|
-
"@dynamic-labs/wallet-book": "4.0.0-alpha.
|
|
37
|
-
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.
|
|
28
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.46",
|
|
29
|
+
"@dynamic-labs/embedded-wallet-solana": "4.0.0-alpha.46",
|
|
30
|
+
"@dynamic-labs/logger": "4.0.0-alpha.46",
|
|
31
|
+
"@dynamic-labs/rpc-providers": "4.0.0-alpha.46",
|
|
32
|
+
"@dynamic-labs/sdk-api-core": "0.0.576",
|
|
33
|
+
"@dynamic-labs/solana-core": "4.0.0-alpha.46",
|
|
34
|
+
"@dynamic-labs/types": "4.0.0-alpha.46",
|
|
35
|
+
"@dynamic-labs/utils": "4.0.0-alpha.46",
|
|
36
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.46",
|
|
37
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.46"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {}
|
|
40
40
|
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
|
-
var InjectedWalletBase = require('../injected/InjectedWalletBase.cjs');
|
|
8
|
+
var InjectedWalletBase = require('../injected/InjectedWalletBase/InjectedWalletBase.cjs');
|
|
9
9
|
var isSignedMessage = require('../utils/isSignedMessage.cjs');
|
|
10
10
|
|
|
11
11
|
class CoinbaseSolana extends InjectedWalletBase.InjectedWalletBase {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
3
|
import { bufferToBase64 } from '@dynamic-labs/utils';
|
|
4
|
-
import { InjectedWalletBase } from '../injected/InjectedWalletBase.js';
|
|
4
|
+
import { InjectedWalletBase } from '../injected/InjectedWalletBase/InjectedWalletBase.js';
|
|
5
5
|
import { isSignedMessage } from '../utils/isSignedMessage.js';
|
|
6
6
|
|
|
7
7
|
class CoinbaseSolana extends InjectedWalletBase {
|
package/src/Phantom/Phantom.cjs
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
7
|
var solanaCore = require('@dynamic-labs/solana-core');
|
|
8
8
|
var utils = require('@dynamic-labs/utils');
|
|
9
|
-
var PhantomInjected = require('../injected/PhantomInjected.cjs');
|
|
9
|
+
var PhantomInjected = require('../injected/PhantomInjected/PhantomInjected.cjs');
|
|
10
10
|
var PhantomRedirect = require('../phantomRedirect/PhantomRedirect/PhantomRedirect.cjs');
|
|
11
11
|
|
|
12
12
|
class Phantom extends solanaCore.SolanaWalletConnector {
|
package/src/Phantom/Phantom.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
3
|
import { SolanaWalletConnector } from '@dynamic-labs/solana-core';
|
|
4
4
|
import { isMobile } from '@dynamic-labs/utils';
|
|
5
|
-
import { PhantomInjected } from '../injected/PhantomInjected.js';
|
|
5
|
+
import { PhantomInjected } from '../injected/PhantomInjected/PhantomInjected.js';
|
|
6
6
|
import { PhantomRedirect } from '../phantomRedirect/PhantomRedirect/PhantomRedirect.js';
|
|
7
7
|
|
|
8
8
|
class Phantom extends SolanaWalletConnector {
|
|
@@ -7,7 +7,7 @@ var _tslib = require('../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
8
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
9
9
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
10
|
-
var findWalletProviderFromWalletStandard = require('../
|
|
10
|
+
var findWalletProviderFromWalletStandard = require('../injected/walletStandard/findWalletProviderFromWalletStandard/findWalletProviderFromWalletStandard.cjs');
|
|
11
11
|
var isSignedMessage = require('../utils/isSignedMessage.cjs');
|
|
12
12
|
|
|
13
13
|
class SolProviderHelper {
|
|
@@ -173,13 +173,23 @@ class SolProviderHelper {
|
|
|
173
173
|
return [];
|
|
174
174
|
}
|
|
175
175
|
const address = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.address;
|
|
176
|
-
|
|
177
|
-
if (address)
|
|
176
|
+
if (address) {
|
|
178
177
|
return [address];
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
178
|
+
}
|
|
179
|
+
// adding a try/catch to prevent errors from being thrown
|
|
180
|
+
// when the public key getter throws for wallet standard wallets
|
|
181
|
+
try {
|
|
182
|
+
const publicKey = (_a = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.publicKey) !== null && _a !== void 0 ? _a : (_b = provider.publicKey) === null || _b === void 0 ? void 0 : _b.toString();
|
|
183
|
+
if (publicKey)
|
|
184
|
+
return [publicKey === null || publicKey === void 0 ? void 0 : publicKey.toString()];
|
|
185
|
+
}
|
|
186
|
+
catch (e) {
|
|
187
|
+
walletConnectorCore.logger.debug('Error getting public key', {
|
|
188
|
+
connector: this.connector,
|
|
189
|
+
error: e,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return [];
|
|
183
193
|
});
|
|
184
194
|
}
|
|
185
195
|
}
|
|
@@ -3,7 +3,7 @@ import { __awaiter } from '../../_virtual/_tslib.js';
|
|
|
3
3
|
import { getProvidersFromWindow, bufferToBase64 } from '@dynamic-labs/utils';
|
|
4
4
|
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
5
5
|
import { ProviderLookup, logger } from '@dynamic-labs/wallet-connector-core';
|
|
6
|
-
import { findWalletProviderFromWalletStandard } from '../
|
|
6
|
+
import { findWalletProviderFromWalletStandard } from '../injected/walletStandard/findWalletProviderFromWalletStandard/findWalletProviderFromWalletStandard.js';
|
|
7
7
|
import { isSignedMessage } from '../utils/isSignedMessage.js';
|
|
8
8
|
|
|
9
9
|
class SolProviderHelper {
|
|
@@ -169,13 +169,23 @@ class SolProviderHelper {
|
|
|
169
169
|
return [];
|
|
170
170
|
}
|
|
171
171
|
const address = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.address;
|
|
172
|
-
|
|
173
|
-
if (address)
|
|
172
|
+
if (address) {
|
|
174
173
|
return [address];
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
}
|
|
175
|
+
// adding a try/catch to prevent errors from being thrown
|
|
176
|
+
// when the public key getter throws for wallet standard wallets
|
|
177
|
+
try {
|
|
178
|
+
const publicKey = (_a = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.publicKey) !== null && _a !== void 0 ? _a : (_b = provider.publicKey) === null || _b === void 0 ? void 0 : _b.toString();
|
|
179
|
+
if (publicKey)
|
|
180
|
+
return [publicKey === null || publicKey === void 0 ? void 0 : publicKey.toString()];
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
logger.debug('Error getting public key', {
|
|
184
|
+
connector: this.connector,
|
|
185
|
+
error: e,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return [];
|
|
179
189
|
});
|
|
180
190
|
}
|
|
181
191
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var embeddedWalletSolana = require('@dynamic-labs/embedded-wallet-solana');
|
|
7
7
|
var Phantom = require('./Phantom/Phantom.cjs');
|
|
8
8
|
var fetchInjectedWalletConnectors = require('./injected/fetchInjectedWalletConnectors.cjs');
|
|
9
|
-
var FallbackSolanaConnector = require('./injected/FallbackSolanaConnector.cjs');
|
|
9
|
+
var FallbackSolanaConnector = require('./injected/FallbackSolanaConnector/FallbackSolanaConnector.cjs');
|
|
10
10
|
|
|
11
11
|
const SolanaWalletConnectors = (
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { TurnkeySolanaWalletConnectors } from '@dynamic-labs/embedded-wallet-solana';
|
|
3
3
|
import { Phantom } from './Phantom/Phantom.js';
|
|
4
4
|
import { injectedWalletOverrides, fetchInjectedWalletConnectors } from './injected/fetchInjectedWalletConnectors.js';
|
|
5
|
-
import { FallbackSolanaConnector } from './injected/FallbackSolanaConnector.js';
|
|
5
|
+
import { FallbackSolanaConnector } from './injected/FallbackSolanaConnector/FallbackSolanaConnector.js';
|
|
6
6
|
|
|
7
7
|
const SolanaWalletConnectors = (
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
|
-
var InjectedWalletBase = require('../injected/InjectedWalletBase.cjs');
|
|
8
|
+
var InjectedWalletBase = require('../injected/InjectedWalletBase/InjectedWalletBase.cjs');
|
|
9
9
|
|
|
10
10
|
class Solflare extends InjectedWalletBase.InjectedWalletBase {
|
|
11
11
|
constructor() {
|
package/src/Solflare/Solflare.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
3
|
import { isMobile, handleMobileWalletRedirect, bufferToBase64 } from '@dynamic-labs/utils';
|
|
4
|
-
import { InjectedWalletBase } from '../injected/InjectedWalletBase.js';
|
|
4
|
+
import { InjectedWalletBase } from '../injected/InjectedWalletBase/InjectedWalletBase.js';
|
|
5
5
|
|
|
6
6
|
class Solflare extends InjectedWalletBase {
|
|
7
7
|
constructor() {
|
package/src/index.cjs
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var assertPackageVersion = require('@dynamic-labs/assert-package-version');
|
|
7
7
|
var _package = require('../package.cjs');
|
|
8
8
|
var solanaCore = require('@dynamic-labs/solana-core');
|
|
9
|
-
var BackpackSol = require('./injected/BackpackSol.cjs');
|
|
10
|
-
var InjectedWalletBase = require('./injected/InjectedWalletBase.cjs');
|
|
9
|
+
var BackpackSol = require('./injected/BackpackSol/BackpackSol.cjs');
|
|
10
|
+
var InjectedWalletBase = require('./injected/InjectedWalletBase/InjectedWalletBase.cjs');
|
|
11
11
|
var SolanaWalletConnectors = require('./SolanaWalletConnectors.cjs');
|
|
12
12
|
var SolanaWalletConnectorsWithConfig = require('./SolanaWalletConnectorsWithConfig/SolanaWalletConnectorsWithConfig.cjs');
|
|
13
13
|
var isBackpackSolanaSigner = require('./utils/isBackpackSolanaSigner.cjs');
|
package/src/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
|
|
3
3
|
import { version } from '../package.js';
|
|
4
4
|
export { SolanaWalletConnector, isSolanaWallet } from '@dynamic-labs/solana-core';
|
|
5
|
-
export { BackpackSol as BackpackConnector } from './injected/BackpackSol.js';
|
|
6
|
-
export { InjectedWalletBase as SolanaInjectedConnector } from './injected/InjectedWalletBase.js';
|
|
5
|
+
export { BackpackSol as BackpackConnector } from './injected/BackpackSol/BackpackSol.js';
|
|
6
|
+
export { InjectedWalletBase as SolanaInjectedConnector } from './injected/InjectedWalletBase/InjectedWalletBase.js';
|
|
7
7
|
export { SolanaWalletConnectors } from './SolanaWalletConnectors.js';
|
|
8
8
|
export { SolanaWalletConnectorsWithConfig } from './SolanaWalletConnectorsWithConfig/SolanaWalletConnectorsWithConfig.js';
|
|
9
9
|
export { isBackpackSolanaSigner } from './utils/isBackpackSolanaSigner.js';
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var _tslib = require('
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
|
-
var InjectedWalletBase = require('
|
|
8
|
+
var InjectedWalletBase = require('../InjectedWalletBase/InjectedWalletBase.cjs');
|
|
9
9
|
|
|
10
10
|
class BackpackSol extends InjectedWalletBase.InjectedWalletBase {
|
|
11
11
|
constructor() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { __awaiter } from '
|
|
2
|
+
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
3
|
import { bufferToBase64 } from '@dynamic-labs/utils';
|
|
4
|
-
import { InjectedWalletBase } from '
|
|
4
|
+
import { InjectedWalletBase } from '../InjectedWalletBase/InjectedWalletBase.js';
|
|
5
5
|
|
|
6
6
|
class BackpackSol extends InjectedWalletBase {
|
|
7
7
|
constructor() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BackpackSol';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var InjectedWalletBase = require('
|
|
6
|
+
var InjectedWalletBase = require('../InjectedWalletBase/InjectedWalletBase.cjs');
|
|
7
7
|
|
|
8
8
|
class FallbackSolanaConnector extends InjectedWalletBase.InjectedWalletBase {
|
|
9
9
|
constructor() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FallbackSolanaConnector';
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var _tslib = require('
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
7
|
var web3_js = require('@solana/web3.js');
|
|
8
8
|
var utils = require('@dynamic-labs/utils');
|
|
9
9
|
var solanaCore = require('@dynamic-labs/solana-core');
|
|
10
|
-
var SolProviderHelper = require('
|
|
11
|
-
var SignMessageNotSupportedError = require('
|
|
10
|
+
var SolProviderHelper = require('../../SolProviderHelper/SolProviderHelper.cjs');
|
|
11
|
+
var SignMessageNotSupportedError = require('../../errors/SignMessageNotSupportedError.cjs');
|
|
12
12
|
|
|
13
13
|
class InjectedWalletBase extends solanaCore.SolanaWalletConnector {
|
|
14
14
|
get solProviderHelper() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SolanaWalletConnector, type ISolana } from '@dynamic-labs/solana-core';
|
|
2
2
|
import { IUITransaction } from '@dynamic-labs/types';
|
|
3
3
|
import { ISendBalanceWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
-
import { SolProviderHelper } from '
|
|
4
|
+
import { SolProviderHelper } from '../../SolProviderHelper';
|
|
5
5
|
export declare abstract class InjectedWalletBase extends SolanaWalletConnector implements ISendBalanceWalletConnector {
|
|
6
6
|
_solProviderHelper: SolProviderHelper | undefined;
|
|
7
7
|
get solProviderHelper(): SolProviderHelper | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { __awaiter } from '
|
|
2
|
+
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
3
|
import { PublicKey } from '@solana/web3.js';
|
|
4
4
|
import { isMobile, template } from '@dynamic-labs/utils';
|
|
5
5
|
import { SolanaWalletConnector, SolanaUiTransaction } from '@dynamic-labs/solana-core';
|
|
6
|
-
import { SolProviderHelper } from '
|
|
7
|
-
import { SignMessageNotSupportedError } from '
|
|
6
|
+
import { SolProviderHelper } from '../../SolProviderHelper/SolProviderHelper.js';
|
|
7
|
+
import { SignMessageNotSupportedError } from '../../errors/SignMessageNotSupportedError.js';
|
|
8
8
|
|
|
9
9
|
class InjectedWalletBase extends SolanaWalletConnector {
|
|
10
10
|
get solProviderHelper() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './InjectedWalletBase';
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var _tslib = require('
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
|
-
var InjectedWalletBase = require('
|
|
8
|
+
var InjectedWalletBase = require('../InjectedWalletBase/InjectedWalletBase.cjs');
|
|
9
9
|
|
|
10
10
|
class PhantomInjected extends InjectedWalletBase.InjectedWalletBase {
|
|
11
11
|
constructor() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { __awaiter } from '
|
|
2
|
+
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
3
|
import { isMobile, handleMobileWalletRedirect } from '@dynamic-labs/utils';
|
|
4
|
-
import { InjectedWalletBase } from '
|
|
4
|
+
import { InjectedWalletBase } from '../InjectedWalletBase/InjectedWalletBase.js';
|
|
5
5
|
|
|
6
6
|
class PhantomInjected extends InjectedWalletBase {
|
|
7
7
|
constructor() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './PhantomInjected';
|
|
@@ -3,50 +3,63 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var utils = require('@dynamic-labs/utils');
|
|
6
7
|
var CoinbaseSolana = require('../CoinbaseSolana/CoinbaseSolana.cjs');
|
|
7
8
|
var Solflare = require('../Solflare/Solflare.cjs');
|
|
8
|
-
var
|
|
9
|
-
var InjectedWalletBase = require('./InjectedWalletBase.cjs');
|
|
10
|
-
var BackpackSol = require('./BackpackSol.cjs');
|
|
9
|
+
var logger = require('../utils/logger.cjs');
|
|
10
|
+
var InjectedWalletBase = require('./InjectedWalletBase/InjectedWalletBase.cjs');
|
|
11
|
+
var BackpackSol = require('./BackpackSol/BackpackSol.cjs');
|
|
12
|
+
var getConnectorConstructorForWalletStandardWallet = require('./walletStandard/getConnectorConstructorForWalletStandardWallet/getConnectorConstructorForWalletStandardWallet.cjs');
|
|
13
|
+
var getWalletStandardWallets = require('./walletStandard/getWalletStandardWallets/getWalletStandardWallets.cjs');
|
|
11
14
|
|
|
12
15
|
const injectedWalletOverrides = [
|
|
13
16
|
CoinbaseSolana.CoinbaseSolana,
|
|
14
17
|
BackpackSol.BackpackSol,
|
|
15
18
|
Solflare.Solflare,
|
|
16
19
|
];
|
|
17
|
-
const
|
|
20
|
+
const walletsWithCustomConnectors = [
|
|
18
21
|
'coinbasesolana',
|
|
19
22
|
'phantom',
|
|
20
23
|
'phantomledger',
|
|
21
24
|
'backpacksol',
|
|
22
25
|
'solflare',
|
|
23
26
|
];
|
|
27
|
+
const shouldAddWalletStandardConnector = (wallet, walletBook) => {
|
|
28
|
+
var _a, _b, _c, _d, _e, _f;
|
|
29
|
+
const { name } = wallet;
|
|
30
|
+
const chain = 'sol';
|
|
31
|
+
const connectorKey = `${utils.sanitizeName(name)}${chain}`;
|
|
32
|
+
logger.logger.logVerboseTroubleshootingMessage('[SOL shouldAddWalletStandardConnector]', name, chain, connectorKey, wallet.features);
|
|
33
|
+
const existingWallet = Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {}).find(([key, wallet]) => {
|
|
34
|
+
var _a;
|
|
35
|
+
return key === connectorKey ||
|
|
36
|
+
walletsWithCustomConnectors.includes(connectorKey) ||
|
|
37
|
+
(wallet.name === name && ((_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a[0].chain) === chain);
|
|
38
|
+
});
|
|
39
|
+
const hasAllFeatures = Boolean(((_b = wallet.features) === null || _b === void 0 ? void 0 : _b['standard:events']) &&
|
|
40
|
+
((_c = wallet.features) === null || _c === void 0 ? void 0 : _c['standard:connect']) &&
|
|
41
|
+
((_d = wallet.features) === null || _d === void 0 ? void 0 : _d['solana:signMessage']) &&
|
|
42
|
+
((_e = wallet.features) === null || _e === void 0 ? void 0 : _e['solana:signTransaction']) &&
|
|
43
|
+
((_f = wallet.features) === null || _f === void 0 ? void 0 : _f['solana:signAndSendTransaction']));
|
|
44
|
+
logger.logger.logVerboseTroubleshootingMessage('[SOL shouldAddWalletStandardConnector]', {
|
|
45
|
+
existingWallet,
|
|
46
|
+
hasAllFeatures,
|
|
47
|
+
shouldAdd: !existingWallet && hasAllFeatures,
|
|
48
|
+
});
|
|
49
|
+
return !existingWallet && hasAllFeatures;
|
|
50
|
+
};
|
|
24
51
|
const fetchInjectedWalletConnectors = ({ walletBook, }) => {
|
|
25
52
|
var _a;
|
|
26
|
-
|
|
53
|
+
const walletBookConnectors = Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
|
|
27
54
|
.filter(([key, wallet]) => {
|
|
28
55
|
var _a;
|
|
29
56
|
const isSolanaWallet = Boolean((_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a.find((config) => config.chain === 'sol'));
|
|
30
|
-
const shouldBeFiltered =
|
|
57
|
+
const shouldBeFiltered = walletsWithCustomConnectors.includes(key);
|
|
31
58
|
return isSolanaWallet && !shouldBeFiltered;
|
|
32
59
|
})
|
|
33
60
|
.map(([key, wallet]) => {
|
|
34
|
-
var _a;
|
|
35
61
|
const { shortName } = wallet;
|
|
36
62
|
const name = shortName || wallet.name;
|
|
37
|
-
const hasWalletStandard = Boolean((_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a.find((config) => config.walletStandard));
|
|
38
|
-
if (hasWalletStandard) {
|
|
39
|
-
const isWalletStandardPresent = Boolean(SolanaWalletStandardConnector.SolanaWalletStandardConnector.getWallet(walletBook, key));
|
|
40
|
-
if (isWalletStandardPresent) {
|
|
41
|
-
return class extends SolanaWalletStandardConnector.SolanaWalletStandardConnector {
|
|
42
|
-
constructor(props) {
|
|
43
|
-
super(Object.assign({}, props));
|
|
44
|
-
this.name = name;
|
|
45
|
-
this.overrideKey = key;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
63
|
return class extends InjectedWalletBase.InjectedWalletBase {
|
|
51
64
|
constructor() {
|
|
52
65
|
super(...arguments);
|
|
@@ -56,6 +69,12 @@ const fetchInjectedWalletConnectors = ({ walletBook, }) => {
|
|
|
56
69
|
}
|
|
57
70
|
};
|
|
58
71
|
});
|
|
72
|
+
const walletStandardWallets = getWalletStandardWallets.getWalletStandardWallets();
|
|
73
|
+
const walletStandardConnectors = walletStandardWallets
|
|
74
|
+
.filter((wallet) => shouldAddWalletStandardConnector(wallet, walletBook))
|
|
75
|
+
.map((wallet) => getConnectorConstructorForWalletStandardWallet.getConnectorConstructorForWalletStandardWallet(wallet));
|
|
76
|
+
logger.logger.logVerboseTroubleshootingMessage('[SOL fetchInjectedWalletConnectors] walletStandardConnectors', walletStandardConnectors.map((w) => w.name));
|
|
77
|
+
return [...walletBookConnectors, ...walletStandardConnectors];
|
|
59
78
|
};
|
|
60
79
|
|
|
61
80
|
exports.fetchInjectedWalletConnectors = fetchInjectedWalletConnectors;
|
|
@@ -1,48 +1,61 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { sanitizeName } from '@dynamic-labs/utils';
|
|
2
3
|
import { CoinbaseSolana } from '../CoinbaseSolana/CoinbaseSolana.js';
|
|
3
4
|
import { Solflare } from '../Solflare/Solflare.js';
|
|
4
|
-
import {
|
|
5
|
-
import { InjectedWalletBase } from './InjectedWalletBase.js';
|
|
6
|
-
import { BackpackSol } from './BackpackSol.js';
|
|
5
|
+
import { logger } from '../utils/logger.js';
|
|
6
|
+
import { InjectedWalletBase } from './InjectedWalletBase/InjectedWalletBase.js';
|
|
7
|
+
import { BackpackSol } from './BackpackSol/BackpackSol.js';
|
|
8
|
+
import { getConnectorConstructorForWalletStandardWallet } from './walletStandard/getConnectorConstructorForWalletStandardWallet/getConnectorConstructorForWalletStandardWallet.js';
|
|
9
|
+
import { getWalletStandardWallets } from './walletStandard/getWalletStandardWallets/getWalletStandardWallets.js';
|
|
7
10
|
|
|
8
11
|
const injectedWalletOverrides = [
|
|
9
12
|
CoinbaseSolana,
|
|
10
13
|
BackpackSol,
|
|
11
14
|
Solflare,
|
|
12
15
|
];
|
|
13
|
-
const
|
|
16
|
+
const walletsWithCustomConnectors = [
|
|
14
17
|
'coinbasesolana',
|
|
15
18
|
'phantom',
|
|
16
19
|
'phantomledger',
|
|
17
20
|
'backpacksol',
|
|
18
21
|
'solflare',
|
|
19
22
|
];
|
|
23
|
+
const shouldAddWalletStandardConnector = (wallet, walletBook) => {
|
|
24
|
+
var _a, _b, _c, _d, _e, _f;
|
|
25
|
+
const { name } = wallet;
|
|
26
|
+
const chain = 'sol';
|
|
27
|
+
const connectorKey = `${sanitizeName(name)}${chain}`;
|
|
28
|
+
logger.logVerboseTroubleshootingMessage('[SOL shouldAddWalletStandardConnector]', name, chain, connectorKey, wallet.features);
|
|
29
|
+
const existingWallet = Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {}).find(([key, wallet]) => {
|
|
30
|
+
var _a;
|
|
31
|
+
return key === connectorKey ||
|
|
32
|
+
walletsWithCustomConnectors.includes(connectorKey) ||
|
|
33
|
+
(wallet.name === name && ((_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a[0].chain) === chain);
|
|
34
|
+
});
|
|
35
|
+
const hasAllFeatures = Boolean(((_b = wallet.features) === null || _b === void 0 ? void 0 : _b['standard:events']) &&
|
|
36
|
+
((_c = wallet.features) === null || _c === void 0 ? void 0 : _c['standard:connect']) &&
|
|
37
|
+
((_d = wallet.features) === null || _d === void 0 ? void 0 : _d['solana:signMessage']) &&
|
|
38
|
+
((_e = wallet.features) === null || _e === void 0 ? void 0 : _e['solana:signTransaction']) &&
|
|
39
|
+
((_f = wallet.features) === null || _f === void 0 ? void 0 : _f['solana:signAndSendTransaction']));
|
|
40
|
+
logger.logVerboseTroubleshootingMessage('[SOL shouldAddWalletStandardConnector]', {
|
|
41
|
+
existingWallet,
|
|
42
|
+
hasAllFeatures,
|
|
43
|
+
shouldAdd: !existingWallet && hasAllFeatures,
|
|
44
|
+
});
|
|
45
|
+
return !existingWallet && hasAllFeatures;
|
|
46
|
+
};
|
|
20
47
|
const fetchInjectedWalletConnectors = ({ walletBook, }) => {
|
|
21
48
|
var _a;
|
|
22
|
-
|
|
49
|
+
const walletBookConnectors = Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
|
|
23
50
|
.filter(([key, wallet]) => {
|
|
24
51
|
var _a;
|
|
25
52
|
const isSolanaWallet = Boolean((_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a.find((config) => config.chain === 'sol'));
|
|
26
|
-
const shouldBeFiltered =
|
|
53
|
+
const shouldBeFiltered = walletsWithCustomConnectors.includes(key);
|
|
27
54
|
return isSolanaWallet && !shouldBeFiltered;
|
|
28
55
|
})
|
|
29
56
|
.map(([key, wallet]) => {
|
|
30
|
-
var _a;
|
|
31
57
|
const { shortName } = wallet;
|
|
32
58
|
const name = shortName || wallet.name;
|
|
33
|
-
const hasWalletStandard = Boolean((_a = wallet.injectedConfig) === null || _a === void 0 ? void 0 : _a.find((config) => config.walletStandard));
|
|
34
|
-
if (hasWalletStandard) {
|
|
35
|
-
const isWalletStandardPresent = Boolean(SolanaWalletStandardConnector.getWallet(walletBook, key));
|
|
36
|
-
if (isWalletStandardPresent) {
|
|
37
|
-
return class extends SolanaWalletStandardConnector {
|
|
38
|
-
constructor(props) {
|
|
39
|
-
super(Object.assign({}, props));
|
|
40
|
-
this.name = name;
|
|
41
|
-
this.overrideKey = key;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
59
|
return class extends InjectedWalletBase {
|
|
47
60
|
constructor() {
|
|
48
61
|
super(...arguments);
|
|
@@ -52,6 +65,12 @@ const fetchInjectedWalletConnectors = ({ walletBook, }) => {
|
|
|
52
65
|
}
|
|
53
66
|
};
|
|
54
67
|
});
|
|
68
|
+
const walletStandardWallets = getWalletStandardWallets();
|
|
69
|
+
const walletStandardConnectors = walletStandardWallets
|
|
70
|
+
.filter((wallet) => shouldAddWalletStandardConnector(wallet, walletBook))
|
|
71
|
+
.map((wallet) => getConnectorConstructorForWalletStandardWallet(wallet));
|
|
72
|
+
logger.logVerboseTroubleshootingMessage('[SOL fetchInjectedWalletConnectors] walletStandardConnectors', walletStandardConnectors.map((w) => w.name));
|
|
73
|
+
return [...walletBookConnectors, ...walletStandardConnectors];
|
|
55
74
|
};
|
|
56
75
|
|
|
57
76
|
export { fetchInjectedWalletConnectors, injectedWalletOverrides };
|