@dynamic-labs/rpc-providers 2.0.0-alpha.0 → 2.0.0-alpha.10
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 +140 -0
- package/package.json +3 -7
- package/src/ChainRpcProviders.cjs +19 -34
- package/src/ChainRpcProviders.d.ts +5 -6
- package/src/ChainRpcProviders.js +18 -34
- package/src/IChainRpcProviders.d.ts +5 -0
- package/src/{types.cjs → RpcProviders.cjs} +3 -0
- package/src/RpcProviders.d.ts +16 -0
- package/src/{types.js → RpcProviders.js} +3 -0
- package/src/index.cjs +3 -2
- package/src/index.d.ts +2 -1
- package/src/index.js +2 -2
- package/src/types.d.ts +0 -36
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,144 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.0.0-alpha.10](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.9...v2.0.0-alpha.10) (2024-03-08)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* rename hideEmbeddedWalletUIs prop to hideEmbeddedWalletTra… (#4892)
|
|
8
|
+
* refactor send transaction for multi chain (#4831)
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add sandbox indicator to sdk ([62fd821](https://github.com/dynamic-labs/DynamicAuth/commit/62fd821a895bb54cec4cae3d153aa0056a7e6638))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* coinbase connector and auth fetcher no being set properly ([#4891](https://github.com/dynamic-labs/DynamicAuth/issues/4891)) ([328566f](https://github.com/dynamic-labs/DynamicAuth/commit/328566ff39c38d5b5761ddc655de3a5d08bb567a))
|
|
18
|
+
* fix server side rendering ([#4811](https://github.com/dynamic-labs/DynamicAuth/issues/4811)) ([063dfae](https://github.com/dynamic-labs/DynamicAuth/commit/063dfae8b6750875d2f35dd9709a1f675495f4fb))
|
|
19
|
+
* hide network ([#4885](https://github.com/dynamic-labs/DynamicAuth/issues/4885)) ([ec10c58](https://github.com/dynamic-labs/DynamicAuth/commit/ec10c588218f067e991d5830fc06ec081e4e1d18))
|
|
20
|
+
* network picker on mobile ([#4887](https://github.com/dynamic-labs/DynamicAuth/issues/4887)) ([6e0ab1b](https://github.com/dynamic-labs/DynamicAuth/commit/6e0ab1bc7d138b73373741960a501ff7cf20e3f9))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
* refactor send transaction for multi chain ([#4831](https://github.com/dynamic-labs/DynamicAuth/issues/4831)) ([c98444b](https://github.com/dynamic-labs/DynamicAuth/commit/c98444be7935420dda3d8216d03946f5893eb82f))
|
|
24
|
+
* rename hideEmbeddedWalletUIs prop to hideEmbeddedWalletTra… ([#4892](https://github.com/dynamic-labs/DynamicAuth/issues/4892)) ([7cdf519](https://github.com/dynamic-labs/DynamicAuth/commit/7cdf5196b1cd8516de2d456163fe9071956d40d3))
|
|
25
|
+
|
|
26
|
+
## [2.0.0-alpha.9](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.8...v2.0.0-alpha.9) (2024-03-06)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* solana connector new sendTransaction method ([#4842](https://github.com/dynamic-labs/DynamicAuth/issues/4842)) ([0b198e3](https://github.com/dynamic-labs/DynamicAuth/commit/0b198e30d83fbbc8d506654d87cbfad403fda289))
|
|
32
|
+
* specify solana network when using phantom redirect deeplinking ([#4863](https://github.com/dynamic-labs/DynamicAuth/issues/4863)) ([fb4ee7c](https://github.com/dynamic-labs/DynamicAuth/commit/fb4ee7cfc0493c9c85b6ccb31954842556c58aa4))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* isLoggedIn should return true even when there is no primary wallet ([#4875](https://github.com/dynamic-labs/DynamicAuth/issues/4875)) ([f396e22](https://github.com/dynamic-labs/DynamicAuth/commit/f396e22b9d809b05ac52194ffa4346f3591d17fe))
|
|
38
|
+
* update btckit network conversion for signPsbt ([a6009e1](https://github.com/dynamic-labs/DynamicAuth/commit/a6009e18c453b4e65545455fea0e52ed7a983b4d))
|
|
39
|
+
* user getting logged out when signing in with email linked to a unavailable wallet ([#4858](https://github.com/dynamic-labs/DynamicAuth/issues/4858)) ([8653e13](https://github.com/dynamic-labs/DynamicAuth/commit/8653e13d2067dd0161e660b4374c08a9fe0bc203))
|
|
40
|
+
|
|
41
|
+
## [2.0.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.7...v2.0.0-alpha.8) (2024-03-04)
|
|
42
|
+
|
|
43
|
+
## [2.0.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.6...v2.0.0-alpha.7) (2024-02-28)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### ⚠ BREAKING CHANGES
|
|
47
|
+
|
|
48
|
+
* add networkValidationMode and remove enableForcedNetworkValidation (#4778)
|
|
49
|
+
|
|
50
|
+
### Features
|
|
51
|
+
|
|
52
|
+
* add bitget and okx wallets ([51fab41](https://github.com/dynamic-labs/DynamicAuth/commit/51fab413096fd89ce99c6c617cf4f3f5db9bf44d))
|
|
53
|
+
* add networkValidationMode and remove enableForcedNetworkValidation ([#4778](https://github.com/dynamic-labs/DynamicAuth/issues/4778)) ([ccb9576](https://github.com/dynamic-labs/DynamicAuth/commit/ccb9576c81b2c570185f5126d6d1fcfcbb5ac9e3))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
* **GVTY-1243:** non evm onramp urls ([#4791](https://github.com/dynamic-labs/DynamicAuth/issues/4791)) ([fea602e](https://github.com/dynamic-labs/DynamicAuth/commit/fea602e2835b4bb9bc096b96375fa97297bf35f1))
|
|
59
|
+
* revert use enableForcedNetworkValidation on connect-only ([#4750](https://github.com/dynamic-labs/DynamicAuth/issues/4750)) ([#4772](https://github.com/dynamic-labs/DynamicAuth/issues/4772)) ([b871c22](https://github.com/dynamic-labs/DynamicAuth/commit/b871c2295f39230bc34ae1fca5f8817cd9251a17))
|
|
60
|
+
* use correct chromeId for okx and bitget wallets and remove group from coin98 ([#4795](https://github.com/dynamic-labs/DynamicAuth/issues/4795)) ([e63bad7](https://github.com/dynamic-labs/DynamicAuth/commit/e63bad76ed06636151212c915a102359a03b4218))
|
|
61
|
+
|
|
62
|
+
## [2.0.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.5...v2.0.0-alpha.6) (2024-02-26)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### ⚠ BREAKING CHANGES
|
|
66
|
+
|
|
67
|
+
* setShowAuthFlow opens dynamic profile in non-multi-wallet states
|
|
68
|
+
|
|
69
|
+
### Features
|
|
70
|
+
|
|
71
|
+
* allow passing prop to hide embedded wallet action confirmation UIs ([#4775](https://github.com/dynamic-labs/DynamicAuth/issues/4775)) ([d7c6a46](https://github.com/dynamic-labs/DynamicAuth/commit/d7c6a4699e41f6a62d31880c3bd0346ebfa0e3ba))
|
|
72
|
+
* make sms mobile keyboard numeric ([#4755](https://github.com/dynamic-labs/DynamicAuth/issues/4755)) ([f36844a](https://github.com/dynamic-labs/DynamicAuth/commit/f36844aeaae240c520181b3242492db8ffc64a50))
|
|
73
|
+
* setShowAuthFlow opens dynamic profile in non-multi-wallet states ([42dbbc0](https://github.com/dynamic-labs/DynamicAuth/commit/42dbbc00a5cebe937dca5a80397cdd3c577f6a45))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Bug Fixes
|
|
77
|
+
|
|
78
|
+
* demo one-time codes for solana wallets fix ([#4760](https://github.com/dynamic-labs/DynamicAuth/issues/4760)) ([a5ab2a8](https://github.com/dynamic-labs/DynamicAuth/commit/a5ab2a8bc348a35a898e03db0900bfab88184c17))
|
|
79
|
+
* only store passcode in backend when auto-generated by dynamic ([#4764](https://github.com/dynamic-labs/DynamicAuth/issues/4764)) ([528bedc](https://github.com/dynamic-labs/DynamicAuth/commit/528bedce5cbd3022ddafe4242954a04f5b70ae74))
|
|
80
|
+
* use enableForcedNetworkValidation on connect-only ([#4750](https://github.com/dynamic-labs/DynamicAuth/issues/4750)) ([6299f7c](https://github.com/dynamic-labs/DynamicAuth/commit/6299f7c3ce705ddb19714f6b7a3a488851ed8dde))
|
|
81
|
+
|
|
82
|
+
## [2.0.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.4...v2.0.0-alpha.5) (2024-02-22)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### ⚠ BREAKING CHANGES
|
|
86
|
+
|
|
87
|
+
* wagmi v2 (#4660)
|
|
88
|
+
|
|
89
|
+
### Features
|
|
90
|
+
|
|
91
|
+
* wagmi v2 ([#4660](https://github.com/dynamic-labs/DynamicAuth/issues/4660)) ([d8894e6](https://github.com/dynamic-labs/DynamicAuth/commit/d8894e61393b90ccf44904c33394b54286f0f9e9))
|
|
92
|
+
|
|
93
|
+
## [2.0.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.3...v2.0.0-alpha.4) (2024-02-22)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### ⚠ BREAKING CHANGES
|
|
97
|
+
|
|
98
|
+
* remove wallet connector from callback types (#4730)
|
|
99
|
+
* drop support for walletconnect v1 (#4666)
|
|
100
|
+
|
|
101
|
+
### Features
|
|
102
|
+
|
|
103
|
+
* add coin98 evm ([1d64f5f](https://github.com/dynamic-labs/DynamicAuth/commit/1d64f5f00885ff671358651fd0251b77a2e05739))
|
|
104
|
+
* add support for solana versioned transactions ([#4721](https://github.com/dynamic-labs/DynamicAuth/issues/4721)) ([25b1643](https://github.com/dynamic-labs/DynamicAuth/commit/25b1643f8addbada09fff5d22e988bdf22038170))
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
### Bug Fixes
|
|
108
|
+
|
|
109
|
+
* allow rpc-providers package to use exports based on usage ([#4539](https://github.com/dynamic-labs/DynamicAuth/issues/4539)) ([abdc196](https://github.com/dynamic-labs/DynamicAuth/commit/abdc19641580cbcfe8f9e357c645f8291bc9ed66))
|
|
110
|
+
* coinbasesocial should display coinbase in profile linking section ([#4680](https://github.com/dynamic-labs/DynamicAuth/issues/4680)) ([21cbe2e](https://github.com/dynamic-labs/DynamicAuth/commit/21cbe2e24345a33bc927428c01cc7b5c724e40e5))
|
|
111
|
+
* improve on transaction confirmation step ([#4704](https://github.com/dynamic-labs/DynamicAuth/issues/4704)) ([f2b27cf](https://github.com/dynamic-labs/DynamicAuth/commit/f2b27cfd94452be2eb7e88a298f61ef56985931f))
|
|
112
|
+
* prevent the DynamicMultiWalletPromptsWidget from opening if useris not logged in ([#4701](https://github.com/dynamic-labs/DynamicAuth/issues/4701)) ([2bb35fd](https://github.com/dynamic-labs/DynamicAuth/commit/2bb35fd29b60677e893390f7d47857cd76c73adc))
|
|
113
|
+
* reduce isPreauthorized calls when starknet wallet is connected ([#4710](https://github.com/dynamic-labs/DynamicAuth/issues/4710)) ([ca6a630](https://github.com/dynamic-labs/DynamicAuth/commit/ca6a630dd47a1c116afcd63fe7256ffc745532ab))
|
|
114
|
+
* update sepolia currency symbol ([#4728](https://github.com/dynamic-labs/DynamicAuth/issues/4728)) ([3c228a0](https://github.com/dynamic-labs/DynamicAuth/commit/3c228a03ccc962374ad1dac3ab45af92732ba61a))
|
|
115
|
+
* use overflow clip when available, use hidden by default ([#4696](https://github.com/dynamic-labs/DynamicAuth/issues/4696)) ([29fb2a1](https://github.com/dynamic-labs/DynamicAuth/commit/29fb2a1e48b010c6c1d525403fbdcf7ded068466))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
* drop support for walletconnect v1 ([#4666](https://github.com/dynamic-labs/DynamicAuth/issues/4666)) ([4af93e4](https://github.com/dynamic-labs/DynamicAuth/commit/4af93e4f9b95fa4c49bbfda0c1144da1a4a43991))
|
|
119
|
+
* remove wallet connector from callback types ([#4730](https://github.com/dynamic-labs/DynamicAuth/issues/4730)) ([08cb200](https://github.com/dynamic-labs/DynamicAuth/commit/08cb200a09c0fd78d2093d1a60b17089b3b2c2b1))
|
|
120
|
+
|
|
121
|
+
## [2.0.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2024-02-13)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### Bug Fixes
|
|
125
|
+
|
|
126
|
+
* allow any icon to be used in wallet list tabs ([#4678](https://github.com/dynamic-labs/DynamicAuth/issues/4678)) ([eb03603](https://github.com/dynamic-labs/DynamicAuth/commit/eb036031725a91cb28c144b3bdcb5b20b3314038))
|
|
127
|
+
|
|
128
|
+
## [2.0.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2024-02-13)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
### Bug Fixes
|
|
132
|
+
|
|
133
|
+
* old iconic dependency version ([#4673](https://github.com/dynamic-labs/DynamicAuth/issues/4673)) ([4a5c448](https://github.com/dynamic-labs/DynamicAuth/commit/4a5c448c251540139f84514328d5f1d31808d75c))
|
|
134
|
+
|
|
135
|
+
## [2.0.0-alpha.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.0...v2.0.0-alpha.1) (2024-02-12)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
### Bug Fixes
|
|
139
|
+
|
|
140
|
+
* fix make tabs style attribute optional ([#4667](https://github.com/dynamic-labs/DynamicAuth/issues/4667))
|
|
141
|
+
|
|
2
142
|
## [2.0.0-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v1.2.0-alpha.1...v2.0.0-alpha.0) (2024-02-12)
|
|
3
143
|
|
|
4
144
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/rpc-providers",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.10",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -26,11 +26,7 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"starknet": "5.25.0",
|
|
31
|
-
"@dynamic-labs/types": "2.0.0-alpha.0"
|
|
29
|
+
"@dynamic-labs/types": "2.0.0-alpha.10"
|
|
32
30
|
},
|
|
33
|
-
"peerDependencies": {
|
|
34
|
-
"viem": "^1.19.13 || ^2.2.0"
|
|
35
|
-
}
|
|
31
|
+
"peerDependencies": {}
|
|
36
32
|
}
|
|
@@ -3,64 +3,49 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _tslib = require('../_virtual/_tslib.cjs');
|
|
6
|
-
var
|
|
6
|
+
var RpcProviders = require('./RpcProviders.cjs');
|
|
7
7
|
|
|
8
|
-
class
|
|
8
|
+
class ChainRpcProvidersClass {
|
|
9
9
|
static get client() {
|
|
10
|
-
if (!
|
|
11
|
-
|
|
10
|
+
if (!ChainRpcProvidersClass.instance) {
|
|
11
|
+
ChainRpcProvidersClass.instance = new ChainRpcProvidersClass();
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return ChainRpcProvidersClass.instance;
|
|
14
14
|
}
|
|
15
15
|
constructor() {
|
|
16
16
|
this.getProvidersMethods = {};
|
|
17
17
|
}
|
|
18
18
|
static getProviders(configurations) {
|
|
19
|
-
Object.values(
|
|
19
|
+
Object.values(RpcProviders.ProviderChain).forEach((chain) => {
|
|
20
20
|
var _a, _b;
|
|
21
|
-
if (!
|
|
22
|
-
const providers = (_b = (_a =
|
|
21
|
+
if (!ChainRpcProvidersClass.providers[chain]) {
|
|
22
|
+
const providers = (_b = (_a = ChainRpcProvidersClass.client.getProvidersMethods)[chain]) === null || _b === void 0 ? void 0 : _b.call(_a, configurations);
|
|
23
23
|
if (providers) {
|
|
24
|
-
Object.assign(
|
|
24
|
+
Object.assign(ChainRpcProvidersClass.providers, {
|
|
25
25
|
[chain]: providers,
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
return
|
|
30
|
+
return ChainRpcProvidersClass.providers;
|
|
31
31
|
}
|
|
32
32
|
static registerChainProviders(providerChain, fn) {
|
|
33
33
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
if (!
|
|
35
|
-
Object.assign(
|
|
34
|
+
if (!ChainRpcProvidersClass.client.getProvidersMethods[providerChain]) {
|
|
35
|
+
Object.assign(ChainRpcProvidersClass.client.getProvidersMethods, {
|
|
36
36
|
[providerChain]: fn,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
static getEvmProviderByChainId(config, chainId) {
|
|
42
|
-
var _a;
|
|
43
|
-
const rpcProviders = ChainRpcProviders.getProviders(config);
|
|
44
|
-
const provider = (_a = rpcProviders['evm']) === null || _a === void 0 ? void 0 : _a.find((provider) => provider.chainId === chainId);
|
|
45
|
-
return provider;
|
|
46
|
-
}
|
|
47
41
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
ChainRpcProviders.getSolanaRpcProviderByChainId = (config, chainId) => {
|
|
54
|
-
var _a;
|
|
55
|
-
const rpcProviders = ChainRpcProviders.getProviders(config);
|
|
56
|
-
const provider = (_a = rpcProviders['solana']) === null || _a === void 0 ? void 0 : _a.find((rpcProvider) => rpcProvider.chainId === chainId);
|
|
57
|
-
return provider;
|
|
58
|
-
};
|
|
59
|
-
ChainRpcProviders.getStarknetRpcProviderByChainId = (config, chainId) => {
|
|
60
|
-
var _a;
|
|
61
|
-
const rpcProviders = ChainRpcProviders.getProviders(config);
|
|
62
|
-
const provider = (_a = rpcProviders['starknet']) === null || _a === void 0 ? void 0 : _a.find((rpcProvider) => rpcProvider.chainId === chainId);
|
|
63
|
-
return provider;
|
|
42
|
+
ChainRpcProvidersClass.providers = {};
|
|
43
|
+
ChainRpcProvidersClass.wipeInstance = () => {
|
|
44
|
+
ChainRpcProvidersClass.instance = undefined;
|
|
45
|
+
ChainRpcProvidersClass.providers = {};
|
|
64
46
|
};
|
|
47
|
+
//@ts-ignore
|
|
48
|
+
const ChainRpcProviders = ChainRpcProvidersClass;
|
|
65
49
|
|
|
66
50
|
exports.ChainRpcProviders = ChainRpcProviders;
|
|
51
|
+
exports.ChainRpcProvidersClass = ChainRpcProvidersClass;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { NetworkConfigurationMap } from '@dynamic-labs/types';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { ProviderChain, RegisteredProviderMethod, RpcProviders } from './RpcProviders';
|
|
3
|
+
import { IChainRpcProviders } from '.';
|
|
4
|
+
export declare class ChainRpcProvidersClass {
|
|
4
5
|
private static instance;
|
|
5
6
|
private static providers;
|
|
6
7
|
private getProvidersMethods;
|
|
7
|
-
static get client():
|
|
8
|
+
static get client(): ChainRpcProvidersClass;
|
|
8
9
|
private constructor();
|
|
9
10
|
static wipeInstance: () => void;
|
|
10
11
|
static getProviders(configurations: NetworkConfigurationMap): RpcProviders;
|
|
11
12
|
static registerChainProviders(providerChain: ProviderChain, fn: RegisteredProviderMethod): Promise<void>;
|
|
12
|
-
static getEvmProviderByChainId(config: NetworkConfigurationMap, chainId: number): EvmRpcProvider | undefined;
|
|
13
|
-
static getSolanaRpcProviderByChainId: (config: NetworkConfigurationMap, chainId: string) => SolanaRpcProvider | undefined;
|
|
14
|
-
static getStarknetRpcProviderByChainId: (config: NetworkConfigurationMap, chainId: string) => StarknetRpcProvider | undefined;
|
|
15
13
|
}
|
|
14
|
+
export declare const ChainRpcProviders: IChainRpcProviders;
|
package/src/ChainRpcProviders.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { __awaiter } from '../_virtual/_tslib.js';
|
|
2
|
-
import { ProviderChain } from './
|
|
2
|
+
import { ProviderChain } from './RpcProviders.js';
|
|
3
3
|
|
|
4
|
-
class
|
|
4
|
+
class ChainRpcProvidersClass {
|
|
5
5
|
static get client() {
|
|
6
|
-
if (!
|
|
7
|
-
|
|
6
|
+
if (!ChainRpcProvidersClass.instance) {
|
|
7
|
+
ChainRpcProvidersClass.instance = new ChainRpcProvidersClass();
|
|
8
8
|
}
|
|
9
|
-
return
|
|
9
|
+
return ChainRpcProvidersClass.instance;
|
|
10
10
|
}
|
|
11
11
|
constructor() {
|
|
12
12
|
this.getProvidersMethods = {};
|
|
@@ -14,49 +14,33 @@ class ChainRpcProviders {
|
|
|
14
14
|
static getProviders(configurations) {
|
|
15
15
|
Object.values(ProviderChain).forEach((chain) => {
|
|
16
16
|
var _a, _b;
|
|
17
|
-
if (!
|
|
18
|
-
const providers = (_b = (_a =
|
|
17
|
+
if (!ChainRpcProvidersClass.providers[chain]) {
|
|
18
|
+
const providers = (_b = (_a = ChainRpcProvidersClass.client.getProvidersMethods)[chain]) === null || _b === void 0 ? void 0 : _b.call(_a, configurations);
|
|
19
19
|
if (providers) {
|
|
20
|
-
Object.assign(
|
|
20
|
+
Object.assign(ChainRpcProvidersClass.providers, {
|
|
21
21
|
[chain]: providers,
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
return
|
|
26
|
+
return ChainRpcProvidersClass.providers;
|
|
27
27
|
}
|
|
28
28
|
static registerChainProviders(providerChain, fn) {
|
|
29
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
if (!
|
|
31
|
-
Object.assign(
|
|
30
|
+
if (!ChainRpcProvidersClass.client.getProvidersMethods[providerChain]) {
|
|
31
|
+
Object.assign(ChainRpcProvidersClass.client.getProvidersMethods, {
|
|
32
32
|
[providerChain]: fn,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
static getEvmProviderByChainId(config, chainId) {
|
|
38
|
-
var _a;
|
|
39
|
-
const rpcProviders = ChainRpcProviders.getProviders(config);
|
|
40
|
-
const provider = (_a = rpcProviders['evm']) === null || _a === void 0 ? void 0 : _a.find((provider) => provider.chainId === chainId);
|
|
41
|
-
return provider;
|
|
42
|
-
}
|
|
43
37
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
ChainRpcProviders.getSolanaRpcProviderByChainId = (config, chainId) => {
|
|
50
|
-
var _a;
|
|
51
|
-
const rpcProviders = ChainRpcProviders.getProviders(config);
|
|
52
|
-
const provider = (_a = rpcProviders['solana']) === null || _a === void 0 ? void 0 : _a.find((rpcProvider) => rpcProvider.chainId === chainId);
|
|
53
|
-
return provider;
|
|
54
|
-
};
|
|
55
|
-
ChainRpcProviders.getStarknetRpcProviderByChainId = (config, chainId) => {
|
|
56
|
-
var _a;
|
|
57
|
-
const rpcProviders = ChainRpcProviders.getProviders(config);
|
|
58
|
-
const provider = (_a = rpcProviders['starknet']) === null || _a === void 0 ? void 0 : _a.find((rpcProvider) => rpcProvider.chainId === chainId);
|
|
59
|
-
return provider;
|
|
38
|
+
ChainRpcProvidersClass.providers = {};
|
|
39
|
+
ChainRpcProvidersClass.wipeInstance = () => {
|
|
40
|
+
ChainRpcProvidersClass.instance = undefined;
|
|
41
|
+
ChainRpcProvidersClass.providers = {};
|
|
60
42
|
};
|
|
43
|
+
//@ts-ignore
|
|
44
|
+
const ChainRpcProviders = ChainRpcProvidersClass;
|
|
61
45
|
|
|
62
|
-
export { ChainRpcProviders };
|
|
46
|
+
export { ChainRpcProviders, ChainRpcProvidersClass };
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-empty-interface */
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
5
8
|
exports.ProviderChain = void 0;
|
|
6
9
|
(function (ProviderChain) {
|
|
7
10
|
ProviderChain["EVM"] = "evm";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type NetworkConfigurationMap } from '@dynamic-labs/types';
|
|
2
|
+
export declare enum ProviderChain {
|
|
3
|
+
EVM = "evm",
|
|
4
|
+
SOLANA = "solana",
|
|
5
|
+
STARKNET = "starknet"
|
|
6
|
+
}
|
|
7
|
+
export interface RpcProviderLookup {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
export type RpcProviders = {
|
|
11
|
+
[key in ProviderChain]?: RpcProviderLookup[key];
|
|
12
|
+
};
|
|
13
|
+
export type RegisteredProviderMethod = (configuration: NetworkConfigurationMap) => RpcProviders[keyof RpcProviders] | undefined;
|
|
14
|
+
export type RegisteredProviderMethods = {
|
|
15
|
+
[key in ProviderChain]?: RegisteredProviderMethod;
|
|
16
|
+
};
|
package/src/index.cjs
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var RpcProviders = require('./RpcProviders.cjs');
|
|
6
6
|
var ChainRpcProviders = require('./ChainRpcProviders.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, 'ProviderChain', {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return RpcProviders.ProviderChain; }
|
|
13
13
|
});
|
|
14
14
|
exports.ChainRpcProviders = ChainRpcProviders.ChainRpcProviders;
|
|
15
|
+
exports.ChainRpcProvidersClass = ChainRpcProviders.ChainRpcProvidersClass;
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ProviderChain } from './
|
|
2
|
-
export { ChainRpcProviders } from './ChainRpcProviders.js';
|
|
1
|
+
export { ProviderChain } from './RpcProviders.js';
|
|
2
|
+
export { ChainRpcProviders, ChainRpcProvidersClass } from './ChainRpcProviders.js';
|
package/src/types.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type Connection } from '@solana/web3.js';
|
|
2
|
-
import { PublicClient } from 'viem';
|
|
3
|
-
import { type RpcProvider } from 'starknet';
|
|
4
|
-
import { type NetworkConfigurationMap } from '@dynamic-labs/types';
|
|
5
|
-
export declare enum ProviderChain {
|
|
6
|
-
EVM = "evm",
|
|
7
|
-
SOLANA = "solana",
|
|
8
|
-
STARKNET = "starknet"
|
|
9
|
-
}
|
|
10
|
-
export type EvmRpcProvider = {
|
|
11
|
-
chainId: number;
|
|
12
|
-
chainName: string;
|
|
13
|
-
provider: PublicClient;
|
|
14
|
-
};
|
|
15
|
-
export type SolanaRpcProvider = {
|
|
16
|
-
chainId: string;
|
|
17
|
-
chainName: string;
|
|
18
|
-
provider: Connection;
|
|
19
|
-
};
|
|
20
|
-
export type StarknetRpcProvider = {
|
|
21
|
-
chainId: string;
|
|
22
|
-
chainName: string;
|
|
23
|
-
provider: RpcProvider;
|
|
24
|
-
};
|
|
25
|
-
export type RpcProviderLookup = {
|
|
26
|
-
evm: EvmRpcProvider[];
|
|
27
|
-
solana: SolanaRpcProvider[];
|
|
28
|
-
starknet: StarknetRpcProvider[];
|
|
29
|
-
};
|
|
30
|
-
export type RpcProviders = {
|
|
31
|
-
[key in ProviderChain]?: RpcProviderLookup[key];
|
|
32
|
-
};
|
|
33
|
-
export type RegisteredProviderMethod = (configuration: NetworkConfigurationMap) => RpcProviders[keyof RpcProviders] | undefined;
|
|
34
|
-
export type RegisteredProviderMethods = {
|
|
35
|
-
[key in ProviderChain]?: RegisteredProviderMethod;
|
|
36
|
-
};
|