@dynamic-labs/eclipse 4.0.0-alpha.17

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +4316 -0
  2. package/LICENSE +21 -0
  3. package/README.md +0 -0
  4. package/_virtual/_tslib.cjs +36 -0
  5. package/_virtual/_tslib.js +32 -0
  6. package/package.cjs +8 -0
  7. package/package.js +4 -0
  8. package/package.json +33 -0
  9. package/src/connectors/Backpack.cjs +73 -0
  10. package/src/connectors/Backpack.d.ts +20 -0
  11. package/src/connectors/Backpack.js +69 -0
  12. package/src/connectors/EclipseWalletConnector.d.ts +12 -0
  13. package/src/connectors/constants.cjs +12 -0
  14. package/src/connectors/constants.d.ts +2 -0
  15. package/src/connectors/constants.js +7 -0
  16. package/src/connectors/index.d.ts +2 -0
  17. package/src/index.cjs +28 -0
  18. package/src/index.d.ts +4 -0
  19. package/src/index.js +15 -0
  20. package/src/rpc/RpcProviderEclipse/RpcProviderEclipse.cjs +29 -0
  21. package/src/rpc/RpcProviderEclipse/RpcProviderEclipse.d.ts +18 -0
  22. package/src/rpc/RpcProviderEclipse/RpcProviderEclipse.js +27 -0
  23. package/src/rpc/RpcProviderEclipse/index.d.ts +1 -0
  24. package/src/rpc/eclipseProvidersSelector/eclipseProvidersSelector.cjs +23 -0
  25. package/src/rpc/eclipseProvidersSelector/eclipseProvidersSelector.d.ts +7 -0
  26. package/src/rpc/eclipseProvidersSelector/eclipseProvidersSelector.js +19 -0
  27. package/src/rpc/eclipseProvidersSelector/index.d.ts +1 -0
  28. package/src/rpc/index.d.ts +3 -0
  29. package/src/wallet/EclipseWallet.cjs +11 -0
  30. package/src/wallet/EclipseWallet.d.ts +4 -0
  31. package/src/wallet/EclipseWallet.js +7 -0
  32. package/src/wallet/index.d.ts +2 -0
  33. package/src/wallet/isEclipseWallet/index.d.ts +1 -0
  34. package/src/wallet/isEclipseWallet/isEclipseWallet.cjs +8 -0
  35. package/src/wallet/isEclipseWallet/isEclipseWallet.d.ts +3 -0
  36. package/src/wallet/isEclipseWallet/isEclipseWallet.js +4 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Dynamic Labs, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
File without changes
@@ -0,0 +1,36 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /******************************************************************************
7
+ Copyright (c) Microsoft Corporation.
8
+
9
+ Permission to use, copy, modify, and/or distribute this software for any
10
+ purpose with or without fee is hereby granted.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
13
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
15
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
17
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18
+ PERFORMANCE OF THIS SOFTWARE.
19
+ ***************************************************************************** */
20
+
21
+ function __awaiter(thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ }
30
+
31
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
32
+ var e = new Error(message);
33
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
34
+ };
35
+
36
+ exports.__awaiter = __awaiter;
@@ -0,0 +1,32 @@
1
+ 'use client'
2
+ /******************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */
16
+
17
+ function __awaiter(thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ }
26
+
27
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
28
+ var e = new Error(message);
29
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
30
+ };
31
+
32
+ export { __awaiter };
package/package.cjs ADDED
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var version = "4.0.0-alpha.17";
7
+
8
+ exports.version = version;
package/package.js ADDED
@@ -0,0 +1,4 @@
1
+ 'use client'
2
+ var version = "4.0.0-alpha.17";
3
+
4
+ export { version };
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@dynamic-labs/eclipse",
3
+ "version": "4.0.0-alpha.17",
4
+ "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
+ "author": "Dynamic Labs, Inc.",
6
+ "license": "MIT",
7
+ "main": "./src/index.cjs",
8
+ "module": "./src/index.js",
9
+ "types": "./src/index.d.ts",
10
+ "type": "module",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./src/index.d.ts",
14
+ "import": "./src/index.js",
15
+ "require": "./src/index.cjs"
16
+ },
17
+ "./package.json": "./package.json"
18
+ },
19
+ "homepage": "https://www.dynamic.xyz/",
20
+ "dependencies": {
21
+ "@solana/web3.js": "1.92.1",
22
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.17",
23
+ "@dynamic-labs/rpc-providers": "4.0.0-alpha.17",
24
+ "@dynamic-labs/sdk-api-core": "0.0.556",
25
+ "@dynamic-labs/solana": "4.0.0-alpha.17",
26
+ "@dynamic-labs/solana-core": "4.0.0-alpha.17",
27
+ "@dynamic-labs/types": "4.0.0-alpha.17",
28
+ "@dynamic-labs/utils": "4.0.0-alpha.17",
29
+ "@dynamic-labs/wallet-book": "4.0.0-alpha.17",
30
+ "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.17"
31
+ },
32
+ "peerDependencies": {}
33
+ }
@@ -0,0 +1,73 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../_virtual/_tslib.cjs');
7
+ var web3_js = require('@solana/web3.js');
8
+ var solana = require('@dynamic-labs/solana');
9
+ var solanaCore = require('@dynamic-labs/solana-core');
10
+ var utils = require('@dynamic-labs/utils');
11
+ var constants = require('./constants.cjs');
12
+
13
+ class Backpack extends solana.BackpackConnector {
14
+ constructor(opts) {
15
+ var _a;
16
+ super(opts);
17
+ this.connectedChain = 'ECLIPSE';
18
+ this.supportedChains = ['ECLIPSE'];
19
+ this.name = 'Backpack';
20
+ this.overrideKey = 'backpackeclipse';
21
+ this.eclipseNetworks = opts.eclipseNetworks;
22
+ this.chainRpcProviders = opts.chainRpcProviders;
23
+ (_a = this.chainRpcProviders) === null || _a === void 0 ? void 0 : _a.registerEclipseProviders();
24
+ }
25
+ getPublicClient() {
26
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
27
+ var _a;
28
+ if (this.eclipseNetworks.length === 0)
29
+ return;
30
+ const configurations = {
31
+ eclipse: this.eclipseNetworks,
32
+ };
33
+ if (!this.chainRpcProviders)
34
+ return;
35
+ const providers = this.chainRpcProviders.getProviders(configurations);
36
+ return (_a = this.chainRpcProviders.getEclipseProviderByChainId(providers, yield this.getNetwork())) === null || _a === void 0 ? void 0 : _a.provider;
37
+ });
38
+ }
39
+ getWalletClient() {
40
+ var _a;
41
+ const [network] = this.eclipseNetworks;
42
+ if (!network) {
43
+ throw new utils.DynamicError('No enabled networks');
44
+ }
45
+ const rpcUrl = ((_a = network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || network.rpcUrls[0];
46
+ return new web3_js.Connection(rpcUrl, 'confirmed');
47
+ }
48
+ // the genesis hashes on Eclipse are different than Solana
49
+ getNetwork() {
50
+ return _tslib.__awaiter(this, void 0, void 0, function* () {
51
+ const provider = this.getWalletClient();
52
+ let genesisHash = localStorage.getItem(solanaCore.getGenesisHashLSKey(provider.rpcEndpoint));
53
+ if (!genesisHash) {
54
+ genesisHash = yield provider.getGenesisHash();
55
+ localStorage.setItem(solanaCore.getGenesisHashLSKey(provider.rpcEndpoint), genesisHash);
56
+ }
57
+ genesisHash = genesisHash.substring(0, 32);
58
+ let network;
59
+ if (genesisHash === constants.eclipseMainnetHash) {
60
+ network = 'mainnet';
61
+ }
62
+ else if (genesisHash === constants.eclipseTestnetHash) {
63
+ network = 'testnet';
64
+ }
65
+ else {
66
+ network = 'devnet2';
67
+ }
68
+ return network;
69
+ });
70
+ }
71
+ }
72
+
73
+ exports.Backpack = Backpack;
@@ -0,0 +1,20 @@
1
+ import { Connection } from '@solana/web3.js';
2
+ import { BackpackConnector } from '@dynamic-labs/solana';
3
+ import { SolWalletConnectorOpts } from '@dynamic-labs/solana-core';
4
+ import { GenericNetwork } from '@dynamic-labs/types';
5
+ import { Chain } from '@dynamic-labs/wallet-connector-core';
6
+ type BackpackOpts = {
7
+ eclipseNetworks: GenericNetwork[];
8
+ } & SolWalletConnectorOpts;
9
+ export declare class Backpack extends BackpackConnector {
10
+ connectedChain: Chain;
11
+ supportedChains: Chain[];
12
+ name: string;
13
+ overrideKey: string;
14
+ eclipseNetworks: GenericNetwork[];
15
+ constructor(opts: BackpackOpts);
16
+ getPublicClient(): Promise<Connection | undefined>;
17
+ getWalletClient(): Connection;
18
+ getNetwork(): Promise<string>;
19
+ }
20
+ export {};
@@ -0,0 +1,69 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../_virtual/_tslib.js';
3
+ import { Connection } from '@solana/web3.js';
4
+ import { BackpackConnector } from '@dynamic-labs/solana';
5
+ import { getGenesisHashLSKey } from '@dynamic-labs/solana-core';
6
+ import { DynamicError } from '@dynamic-labs/utils';
7
+ import { eclipseMainnetHash, eclipseTestnetHash } from './constants.js';
8
+
9
+ class Backpack extends BackpackConnector {
10
+ constructor(opts) {
11
+ var _a;
12
+ super(opts);
13
+ this.connectedChain = 'ECLIPSE';
14
+ this.supportedChains = ['ECLIPSE'];
15
+ this.name = 'Backpack';
16
+ this.overrideKey = 'backpackeclipse';
17
+ this.eclipseNetworks = opts.eclipseNetworks;
18
+ this.chainRpcProviders = opts.chainRpcProviders;
19
+ (_a = this.chainRpcProviders) === null || _a === void 0 ? void 0 : _a.registerEclipseProviders();
20
+ }
21
+ getPublicClient() {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ var _a;
24
+ if (this.eclipseNetworks.length === 0)
25
+ return;
26
+ const configurations = {
27
+ eclipse: this.eclipseNetworks,
28
+ };
29
+ if (!this.chainRpcProviders)
30
+ return;
31
+ const providers = this.chainRpcProviders.getProviders(configurations);
32
+ return (_a = this.chainRpcProviders.getEclipseProviderByChainId(providers, yield this.getNetwork())) === null || _a === void 0 ? void 0 : _a.provider;
33
+ });
34
+ }
35
+ getWalletClient() {
36
+ var _a;
37
+ const [network] = this.eclipseNetworks;
38
+ if (!network) {
39
+ throw new DynamicError('No enabled networks');
40
+ }
41
+ const rpcUrl = ((_a = network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || network.rpcUrls[0];
42
+ return new Connection(rpcUrl, 'confirmed');
43
+ }
44
+ // the genesis hashes on Eclipse are different than Solana
45
+ getNetwork() {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const provider = this.getWalletClient();
48
+ let genesisHash = localStorage.getItem(getGenesisHashLSKey(provider.rpcEndpoint));
49
+ if (!genesisHash) {
50
+ genesisHash = yield provider.getGenesisHash();
51
+ localStorage.setItem(getGenesisHashLSKey(provider.rpcEndpoint), genesisHash);
52
+ }
53
+ genesisHash = genesisHash.substring(0, 32);
54
+ let network;
55
+ if (genesisHash === eclipseMainnetHash) {
56
+ network = 'mainnet';
57
+ }
58
+ else if (genesisHash === eclipseTestnetHash) {
59
+ network = 'testnet';
60
+ }
61
+ else {
62
+ network = 'devnet2';
63
+ }
64
+ return network;
65
+ });
66
+ }
67
+ }
68
+
69
+ export { Backpack };
@@ -0,0 +1,12 @@
1
+ import { WalletBookSchema } from '@dynamic-labs/wallet-book';
2
+ import { Chain, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
3
+ import { EclipseWallet } from '../wallet';
4
+ export type EclipseWalletConnectorOpts = {
5
+ walletBook: WalletBookSchema;
6
+ };
7
+ export declare abstract class EclipseWalletConnector extends WalletConnectorBase {
8
+ ChainWallet: typeof EclipseWallet;
9
+ connectedChain: Chain;
10
+ supportedChains: Chain[];
11
+ constructor(opts: EclipseWalletConnectorOpts);
12
+ }
@@ -0,0 +1,12 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ // This value was obtained by querying the genesis hash with a Connection on mainnet
7
+ const eclipseMainnetHash = 'EAQLJCV2mh23BsK2P9oYpV5CHVLDNHTx';
8
+ // This value was obtained by querying the genesis hash with a Connection on testnet
9
+ const eclipseTestnetHash = 'CX4huckiV9QNAkKNVKi5Tj8nxzBive5k';
10
+
11
+ exports.eclipseMainnetHash = eclipseMainnetHash;
12
+ exports.eclipseTestnetHash = eclipseTestnetHash;
@@ -0,0 +1,2 @@
1
+ export declare const eclipseMainnetHash = "EAQLJCV2mh23BsK2P9oYpV5CHVLDNHTx";
2
+ export declare const eclipseTestnetHash = "CX4huckiV9QNAkKNVKi5Tj8nxzBive5k";
@@ -0,0 +1,7 @@
1
+ 'use client'
2
+ // This value was obtained by querying the genesis hash with a Connection on mainnet
3
+ const eclipseMainnetHash = 'EAQLJCV2mh23BsK2P9oYpV5CHVLDNHTx';
4
+ // This value was obtained by querying the genesis hash with a Connection on testnet
5
+ const eclipseTestnetHash = 'CX4huckiV9QNAkKNVKi5Tj8nxzBive5k';
6
+
7
+ export { eclipseMainnetHash, eclipseTestnetHash };
@@ -0,0 +1,2 @@
1
+ export * from './EclipseWalletConnector';
2
+ export * from './Backpack';
package/src/index.cjs ADDED
@@ -0,0 +1,28 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var assertPackageVersion = require('@dynamic-labs/assert-package-version');
7
+ var _package = require('../package.cjs');
8
+ require('@dynamic-labs/wallet-connector-core');
9
+ var EclipseWallet = require('./wallet/EclipseWallet.cjs');
10
+ var isEclipseWallet = require('./wallet/isEclipseWallet/isEclipseWallet.cjs');
11
+ var Backpack = require('./connectors/Backpack.cjs');
12
+ require('./rpc/RpcProviderEclipse/RpcProviderEclipse.cjs');
13
+ var rpcProviders = require('@dynamic-labs/rpc-providers');
14
+ var eclipseProvidersSelector = require('./rpc/eclipseProvidersSelector/eclipseProvidersSelector.cjs');
15
+
16
+ assertPackageVersion.assertPackageVersion('@dynamic-labs/eclipse', _package.version);
17
+ const EclipseWalletConnectors = () => [Backpack.Backpack];
18
+
19
+ exports.EclipseWallet = EclipseWallet.EclipseWallet;
20
+ exports.isEclipseWallet = isEclipseWallet.isEclipseWallet;
21
+ exports.eclipseProvidersSelector = eclipseProvidersSelector.eclipseProvidersSelector;
22
+ exports.EclipseWalletConnectors = EclipseWalletConnectors;
23
+ Object.keys(rpcProviders).forEach(function (k) {
24
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
25
+ enumerable: true,
26
+ get: function () { return rpcProviders[k]; }
27
+ });
28
+ });
package/src/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { Backpack } from './connectors';
2
+ export * from './rpc';
3
+ export * from './wallet';
4
+ export declare const EclipseWalletConnectors: () => (typeof Backpack)[];
package/src/index.js ADDED
@@ -0,0 +1,15 @@
1
+ 'use client'
2
+ import { assertPackageVersion } from '@dynamic-labs/assert-package-version';
3
+ import { version } from '../package.js';
4
+ import '@dynamic-labs/wallet-connector-core';
5
+ export { EclipseWallet } from './wallet/EclipseWallet.js';
6
+ export { isEclipseWallet } from './wallet/isEclipseWallet/isEclipseWallet.js';
7
+ import { Backpack } from './connectors/Backpack.js';
8
+ import './rpc/RpcProviderEclipse/RpcProviderEclipse.js';
9
+ export * from '@dynamic-labs/rpc-providers';
10
+ export { eclipseProvidersSelector } from './rpc/eclipseProvidersSelector/eclipseProvidersSelector.js';
11
+
12
+ assertPackageVersion('@dynamic-labs/eclipse', version);
13
+ const EclipseWalletConnectors = () => [Backpack];
14
+
15
+ export { EclipseWalletConnectors };
@@ -0,0 +1,29 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ var web3_js = require('@solana/web3.js');
5
+ var rpcProviders = require('@dynamic-labs/rpc-providers');
6
+
7
+ rpcProviders.ChainRpcProviders.getEclipseProviderByChainId = (rpcProviders, chainId) => {
8
+ var _a;
9
+ const provider = (_a = rpcProviders['eclipse']) === null || _a === void 0 ? void 0 : _a.find((rpcProvider) => rpcProvider.chainId === chainId);
10
+ return provider;
11
+ };
12
+ rpcProviders.ChainRpcProviders.registerEclipseProviders = () => {
13
+ rpcProviders.ChainRpcProviders.registerChainProviders(rpcProviders.ProviderChain.ECLIPSE, (config) => {
14
+ const rpcProviders = {};
15
+ if (config === null || config === void 0 ? void 0 : config.eclipse) {
16
+ rpcProviders.eclipse = config.eclipse.map((network) => {
17
+ var _a;
18
+ const rpcUrl = ((_a = network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || network.rpcUrls[0];
19
+ const provider = new web3_js.Connection(rpcUrl);
20
+ return {
21
+ chainId: network.chainId.toString(),
22
+ chainName: network.name,
23
+ provider,
24
+ };
25
+ });
26
+ }
27
+ return rpcProviders.eclipse;
28
+ });
29
+ };
@@ -0,0 +1,18 @@
1
+ import { Connection } from '@solana/web3.js';
2
+ import { RpcProviders } from '@dynamic-labs/rpc-providers';
3
+ type IEclipseRpcProvider = {
4
+ chainId: string;
5
+ chainName: string;
6
+ provider: Connection;
7
+ };
8
+ declare module '@dynamic-labs/rpc-providers' {
9
+ type EclipseRpcProvider = IEclipseRpcProvider;
10
+ interface RpcProviderLookup {
11
+ eclipse: EclipseRpcProvider[];
12
+ }
13
+ interface IChainRpcProviders {
14
+ getEclipseProviderByChainId(rpcProviders: RpcProviders, chainId: string): EclipseRpcProvider | undefined;
15
+ registerEclipseProviders(): void;
16
+ }
17
+ }
18
+ export {};
@@ -0,0 +1,27 @@
1
+ 'use client'
2
+ import { Connection } from '@solana/web3.js';
3
+ import { ChainRpcProviders, ProviderChain } from '@dynamic-labs/rpc-providers';
4
+
5
+ ChainRpcProviders.getEclipseProviderByChainId = (rpcProviders, chainId) => {
6
+ var _a;
7
+ const provider = (_a = rpcProviders['eclipse']) === null || _a === void 0 ? void 0 : _a.find((rpcProvider) => rpcProvider.chainId === chainId);
8
+ return provider;
9
+ };
10
+ ChainRpcProviders.registerEclipseProviders = () => {
11
+ ChainRpcProviders.registerChainProviders(ProviderChain.ECLIPSE, (config) => {
12
+ const rpcProviders = {};
13
+ if (config === null || config === void 0 ? void 0 : config.eclipse) {
14
+ rpcProviders.eclipse = config.eclipse.map((network) => {
15
+ var _a;
16
+ const rpcUrl = ((_a = network.privateCustomerRpcUrls) === null || _a === void 0 ? void 0 : _a[0]) || network.rpcUrls[0];
17
+ const provider = new Connection(rpcUrl);
18
+ return {
19
+ chainId: network.chainId.toString(),
20
+ chainName: network.name,
21
+ provider,
22
+ };
23
+ });
24
+ }
25
+ return rpcProviders.eclipse;
26
+ });
27
+ };
@@ -0,0 +1 @@
1
+ import './RpcProviderEclipse';
@@ -0,0 +1,23 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var rpcProviders = require('@dynamic-labs/rpc-providers');
7
+
8
+ const eclipseProvidersSelector = (providers) => {
9
+ if (!providers)
10
+ return {
11
+ defaultProvider: undefined,
12
+ getProviderByChainId: () => undefined,
13
+ providers: [],
14
+ };
15
+ const getProviderByChainId = (chainId) => { var _a; return (_a = rpcProviders.ChainRpcProviders.getEclipseProviderByChainId) === null || _a === void 0 ? void 0 : _a.call(rpcProviders.ChainRpcProviders, providers, chainId); };
16
+ return {
17
+ defaultProvider: getProviderByChainId('mainnet'),
18
+ getProviderByChainId,
19
+ providers: providers === null || providers === void 0 ? void 0 : providers.eclipse,
20
+ };
21
+ };
22
+
23
+ exports.eclipseProvidersSelector = eclipseProvidersSelector;
@@ -0,0 +1,7 @@
1
+ import { RpcProvidersSelector, EclipseRpcProvider } from '@dynamic-labs/rpc-providers';
2
+ export type EclipseRpcProviderMethods = {
3
+ defaultProvider: EclipseRpcProvider | undefined;
4
+ providers: EclipseRpcProvider[] | undefined;
5
+ getProviderByChainId: (chainId: string) => EclipseRpcProvider | undefined;
6
+ };
7
+ export declare const eclipseProvidersSelector: RpcProvidersSelector<EclipseRpcProviderMethods>;
@@ -0,0 +1,19 @@
1
+ 'use client'
2
+ import { ChainRpcProviders } from '@dynamic-labs/rpc-providers';
3
+
4
+ const eclipseProvidersSelector = (providers) => {
5
+ if (!providers)
6
+ return {
7
+ defaultProvider: undefined,
8
+ getProviderByChainId: () => undefined,
9
+ providers: [],
10
+ };
11
+ const getProviderByChainId = (chainId) => { var _a; return (_a = ChainRpcProviders.getEclipseProviderByChainId) === null || _a === void 0 ? void 0 : _a.call(ChainRpcProviders, providers, chainId); };
12
+ return {
13
+ defaultProvider: getProviderByChainId('mainnet'),
14
+ getProviderByChainId,
15
+ providers: providers === null || providers === void 0 ? void 0 : providers.eclipse,
16
+ };
17
+ };
18
+
19
+ export { eclipseProvidersSelector };
@@ -0,0 +1 @@
1
+ export * from './eclipseProvidersSelector';
@@ -0,0 +1,3 @@
1
+ import './RpcProviderEclipse';
2
+ export * from '@dynamic-labs/rpc-providers';
3
+ export { type EclipseRpcProviderMethods, eclipseProvidersSelector, } from './eclipseProvidersSelector';
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
7
+
8
+ class EclipseWallet extends walletConnectorCore.Wallet {
9
+ }
10
+
11
+ exports.EclipseWallet = EclipseWallet;
@@ -0,0 +1,4 @@
1
+ import { Wallet } from '@dynamic-labs/wallet-connector-core';
2
+ import { EclipseWalletConnector } from '../connectors';
3
+ export declare class EclipseWallet extends Wallet<EclipseWalletConnector> {
4
+ }
@@ -0,0 +1,7 @@
1
+ 'use client'
2
+ import { Wallet } from '@dynamic-labs/wallet-connector-core';
3
+
4
+ class EclipseWallet extends Wallet {
5
+ }
6
+
7
+ export { EclipseWallet };
@@ -0,0 +1,2 @@
1
+ export * from './EclipseWallet';
2
+ export * from './isEclipseWallet';
@@ -0,0 +1 @@
1
+ export * from './isEclipseWallet';
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const isEclipseWallet = (wallet) => wallet.chain === 'ECLIPSE';
7
+
8
+ exports.isEclipseWallet = isEclipseWallet;
@@ -0,0 +1,3 @@
1
+ import { Wallet } from '@dynamic-labs/wallet-connector-core';
2
+ import { EclipseWallet } from '../EclipseWallet';
3
+ export declare const isEclipseWallet: (wallet: Wallet) => wallet is EclipseWallet;
@@ -0,0 +1,4 @@
1
+ 'use client'
2
+ const isEclipseWallet = (wallet) => wallet.chain === 'ECLIPSE';
3
+
4
+ export { isEclipseWallet };