quantumcoin 6.14.1 → 6.14.2
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/README.md +2 -0
- package/dist/quantumcoin.js +2697 -7812
- package/dist/quantumcoin.js.map +1 -1
- package/dist/quantumcoin.min.js +1 -1
- package/dist/quantumcoin.min.js'.gz' +0 -0
- package/dist/quantumcoin.umd.js +2698 -7835
- package/dist/quantumcoin.umd.js.map +1 -1
- package/dist/quantumcoin.umd.min.js +1 -1
- package/dist/quantumcoin.umd.min.js'.gz' +0 -0
- package/dist/wordlists-extra.min.js'.gz' +0 -0
- package/lib.commonjs/address/address.d.ts +1 -21
- package/lib.commonjs/address/address.d.ts.map +1 -1
- package/lib.commonjs/address/address.js +2 -30
- package/lib.commonjs/address/address.js.map +1 -1
- package/lib.commonjs/address/index.d.ts +1 -1
- package/lib.commonjs/address/index.d.ts.map +1 -1
- package/lib.commonjs/address/index.js +1 -2
- package/lib.commonjs/address/index.js.map +1 -1
- package/lib.commonjs/crypto/signature.d.ts +4 -17
- package/lib.commonjs/crypto/signature.d.ts.map +1 -1
- package/lib.commonjs/crypto/signature.js +57 -60
- package/lib.commonjs/crypto/signature.js.map +1 -1
- package/lib.commonjs/crypto/signing-key.d.ts +5 -64
- package/lib.commonjs/crypto/signing-key.d.ts.map +1 -1
- package/lib.commonjs/crypto/signing-key.js +27 -101
- package/lib.commonjs/crypto/signing-key.js.map +1 -1
- package/lib.commonjs/providers/default-provider.d.ts +0 -8
- package/lib.commonjs/providers/default-provider.d.ts.map +1 -1
- package/lib.commonjs/providers/default-provider.js +0 -108
- package/lib.commonjs/providers/default-provider.js.map +1 -1
- package/lib.commonjs/providers/index.d.ts +0 -9
- package/lib.commonjs/providers/index.d.ts.map +1 -1
- package/lib.commonjs/providers/index.js +1 -21
- package/lib.commonjs/providers/index.js.map +1 -1
- package/lib.commonjs/providers/network.js +1 -99
- package/lib.commonjs/providers/network.js.map +1 -1
- package/lib.commonjs/quantumcoin.d.ts +4 -4
- package/lib.commonjs/quantumcoin.d.ts.map +1 -1
- package/lib.commonjs/quantumcoin.js +4 -26
- package/lib.commonjs/quantumcoin.js.map +1 -1
- package/lib.commonjs/transaction/address.d.ts +1 -1
- package/lib.commonjs/transaction/address.d.ts.map +1 -1
- package/lib.commonjs/transaction/address.js +9 -5
- package/lib.commonjs/transaction/address.js.map +1 -1
- package/lib.commonjs/wallet/hdwallet.d.ts.map +1 -1
- package/lib.commonjs/wallet/hdwallet.js +4 -5
- package/lib.commonjs/wallet/hdwallet.js.map +1 -1
- package/lib.commonjs/wallet/index.d.ts +2 -6
- package/lib.commonjs/wallet/index.d.ts.map +1 -1
- package/lib.commonjs/wallet/index.js +1 -14
- package/lib.commonjs/wallet/index.js.map +1 -1
- package/lib.commonjs/wallet/json-keystore.d.ts +3 -52
- package/lib.commonjs/wallet/json-keystore.d.ts.map +1 -1
- package/lib.commonjs/wallet/json-keystore.js +41 -246
- package/lib.commonjs/wallet/json-keystore.js.map +1 -1
- package/lib.commonjs/wallet/seedwallet.d.ts +4 -0
- package/lib.commonjs/wallet/seedwallet.d.ts.map +1 -0
- package/lib.commonjs/wallet/seedwallet.js +8 -0
- package/lib.commonjs/wallet/seedwallet.js.map +1 -0
- package/lib.commonjs/wallet/wallet.d.ts +5 -14
- package/lib.commonjs/wallet/wallet.d.ts.map +1 -1
- package/lib.commonjs/wallet/wallet.js +12 -51
- package/lib.commonjs/wallet/wallet.js.map +1 -1
- package/lib.esm/address/address.d.ts +1 -21
- package/lib.esm/address/address.d.ts.map +1 -1
- package/lib.esm/address/address.js +1 -28
- package/lib.esm/address/address.js.map +1 -1
- package/lib.esm/address/index.d.ts +1 -1
- package/lib.esm/address/index.d.ts.map +1 -1
- package/lib.esm/address/index.js +1 -1
- package/lib.esm/address/index.js.map +1 -1
- package/lib.esm/crypto/signature.d.ts +4 -17
- package/lib.esm/crypto/signature.d.ts.map +1 -1
- package/lib.esm/crypto/signature.js +45 -46
- package/lib.esm/crypto/signature.js.map +1 -1
- package/lib.esm/crypto/signing-key.d.ts +5 -64
- package/lib.esm/crypto/signing-key.d.ts.map +1 -1
- package/lib.esm/crypto/signing-key.js +26 -102
- package/lib.esm/crypto/signing-key.js.map +1 -1
- package/lib.esm/providers/default-provider.d.ts +0 -8
- package/lib.esm/providers/default-provider.d.ts.map +1 -1
- package/lib.esm/providers/default-provider.js +0 -108
- package/lib.esm/providers/default-provider.js.map +1 -1
- package/lib.esm/providers/index.d.ts +0 -9
- package/lib.esm/providers/index.d.ts.map +1 -1
- package/lib.esm/providers/index.js +0 -9
- package/lib.esm/providers/index.js.map +1 -1
- package/lib.esm/providers/network.js +3 -101
- package/lib.esm/providers/network.js.map +1 -1
- package/lib.esm/quantumcoin.d.ts +4 -4
- package/lib.esm/quantumcoin.d.ts.map +1 -1
- package/lib.esm/quantumcoin.js +3 -3
- package/lib.esm/quantumcoin.js.map +1 -1
- package/lib.esm/transaction/address.d.ts +1 -1
- package/lib.esm/transaction/address.d.ts.map +1 -1
- package/lib.esm/transaction/address.js +7 -4
- package/lib.esm/transaction/address.js.map +1 -1
- package/lib.esm/wallet/hdwallet.d.ts.map +1 -1
- package/lib.esm/wallet/hdwallet.js +4 -5
- package/lib.esm/wallet/hdwallet.js.map +1 -1
- package/lib.esm/wallet/index.d.ts +2 -6
- package/lib.esm/wallet/index.d.ts.map +1 -1
- package/lib.esm/wallet/index.js +1 -4
- package/lib.esm/wallet/index.js.map +1 -1
- package/lib.esm/wallet/json-keystore.d.ts +3 -52
- package/lib.esm/wallet/json-keystore.d.ts.map +1 -1
- package/lib.esm/wallet/json-keystore.js +32 -241
- package/lib.esm/wallet/json-keystore.js.map +1 -1
- package/lib.esm/wallet/seedwallet.d.ts +4 -0
- package/lib.esm/wallet/seedwallet.d.ts.map +1 -0
- package/lib.esm/wallet/seedwallet.js +4 -0
- package/lib.esm/wallet/seedwallet.js.map +1 -0
- package/lib.esm/wallet/wallet.d.ts +5 -14
- package/lib.esm/wallet/wallet.d.ts.map +1 -1
- package/lib.esm/wallet/wallet.js +12 -53
- package/lib.esm/wallet/wallet.js.map +1 -1
- package/package.json +5 -2
- package/src.ts/address/address.ts +2 -27
- package/src.ts/address/index.ts +1 -1
- package/src.ts/crypto/signature.ts +31 -45
- package/src.ts/crypto/signing-key.ts +31 -109
- package/src.ts/providers/default-provider.ts +0 -106
- package/src.ts/providers/index.ts +0 -10
- package/src.ts/providers/network.ts +3 -111
- package/src.ts/quantumcoin.ts +7 -17
- package/src.ts/transaction/address.ts +8 -5
- package/src.ts/wallet/index.ts +2 -17
- package/src.ts/wallet/json-keystore.ts +42 -325
- package/src.ts/wallet/wallet.ts +23 -47
- package/src.ts/providers/provider-alchemy.ts +0 -166
- package/src.ts/providers/provider-ankr.ts +0 -153
- package/src.ts/providers/provider-blockscout.ts +0 -167
- package/src.ts/providers/provider-chainstack.ts +0 -113
- package/src.ts/providers/provider-cloudflare.ts +0 -24
- package/src.ts/providers/provider-etherscan.ts +0 -671
- package/src.ts/providers/provider-infura.ts +0 -220
- package/src.ts/providers/provider-pocket.ts +0 -121
- package/src.ts/providers/provider-quicknode.ts +0 -177
- package/src.ts/wallet/hdwallet.ts +0 -586
- package/src.ts/wallet/json-crowdsale.ts +0 -74
- package/src.ts/wallet/mnemonic.ts +0 -203
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* [[link-infura]] provides a third-party service for connecting to
|
|
3
|
-
* various blockchains over JSON-RPC.
|
|
4
|
-
*
|
|
5
|
-
* **Supported Networks**
|
|
6
|
-
*
|
|
7
|
-
* - Ethereum Mainnet (``mainnet``)
|
|
8
|
-
* - Goerli Testnet (``goerli``)
|
|
9
|
-
* - Sepolia Testnet (``sepolia``)
|
|
10
|
-
* - Arbitrum (``arbitrum``)
|
|
11
|
-
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
|
|
12
|
-
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
|
|
13
|
-
* - Base (``base``)
|
|
14
|
-
* - Base Goerlia Testnet (``base-goerli``)
|
|
15
|
-
* - Base Sepolia Testnet (``base-sepolia``)
|
|
16
|
-
* - BNB Smart Chain Mainnet (``bnb``)
|
|
17
|
-
* - BNB Smart Chain Testnet (``bnbt``)
|
|
18
|
-
* - Linea (``linea``)
|
|
19
|
-
* - Linea Goerli Testnet (``linea-goerli``)
|
|
20
|
-
* - Linea Sepolia Testnet (``linea-sepolia``)
|
|
21
|
-
* - Optimism (``optimism``)
|
|
22
|
-
* - Optimism Goerli Testnet (``optimism-goerli``)
|
|
23
|
-
* - Optimism Sepolia Testnet (``optimism-sepolia``)
|
|
24
|
-
* - Polygon (``matic``)
|
|
25
|
-
* - Polygon Amoy Testnet (``matic-amoy``)
|
|
26
|
-
* - Polygon Mumbai Testnet (``matic-mumbai``)
|
|
27
|
-
*
|
|
28
|
-
* @_subsection: api/providers/thirdparty:INFURA [providers-infura]
|
|
29
|
-
*/
|
|
30
|
-
import {
|
|
31
|
-
defineProperties, FetchRequest, assert, assertArgument
|
|
32
|
-
} from "../utils/index.js";
|
|
33
|
-
|
|
34
|
-
import { showThrottleMessage } from "./community.js";
|
|
35
|
-
import { Network } from "./network.js";
|
|
36
|
-
import { JsonRpcProvider } from "./provider-jsonrpc.js";
|
|
37
|
-
import { WebSocketProvider } from "./provider-websocket.js";
|
|
38
|
-
|
|
39
|
-
import type { AbstractProvider } from "./abstract-provider.js";
|
|
40
|
-
import type { CommunityResourcable } from "./community.js";
|
|
41
|
-
import type { Networkish } from "./network.js";
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const defaultProjectId = "84842078b09946638c03157f83405213";
|
|
45
|
-
|
|
46
|
-
function getHost(name: string): string {
|
|
47
|
-
switch(name) {
|
|
48
|
-
case "mainnet":
|
|
49
|
-
return "mainnet.infura.io";
|
|
50
|
-
case "goerli":
|
|
51
|
-
return "goerli.infura.io";
|
|
52
|
-
case "sepolia":
|
|
53
|
-
return "sepolia.infura.io";
|
|
54
|
-
|
|
55
|
-
case "arbitrum":
|
|
56
|
-
return "arbitrum-mainnet.infura.io";
|
|
57
|
-
case "arbitrum-goerli":
|
|
58
|
-
return "arbitrum-goerli.infura.io";
|
|
59
|
-
case "arbitrum-sepolia":
|
|
60
|
-
return "arbitrum-sepolia.infura.io";
|
|
61
|
-
case "base":
|
|
62
|
-
return "base-mainnet.infura.io";
|
|
63
|
-
case "base-goerlia": // @TODO: Remove this typo in the future!
|
|
64
|
-
case "base-goerli":
|
|
65
|
-
return "base-goerli.infura.io";
|
|
66
|
-
case "base-sepolia":
|
|
67
|
-
return "base-sepolia.infura.io";
|
|
68
|
-
case "bnb":
|
|
69
|
-
return "bsc-mainnet.infura.io";
|
|
70
|
-
case "bnbt":
|
|
71
|
-
return "bsc-testnet.infura.io";
|
|
72
|
-
case "linea":
|
|
73
|
-
return "linea-mainnet.infura.io";
|
|
74
|
-
case "linea-goerli":
|
|
75
|
-
return "linea-goerli.infura.io";
|
|
76
|
-
case "linea-sepolia":
|
|
77
|
-
return "linea-sepolia.infura.io";
|
|
78
|
-
case "matic":
|
|
79
|
-
return "polygon-mainnet.infura.io";
|
|
80
|
-
case "matic-amoy":
|
|
81
|
-
return "polygon-amoy.infura.io";
|
|
82
|
-
case "matic-mumbai":
|
|
83
|
-
return "polygon-mumbai.infura.io";
|
|
84
|
-
case "optimism":
|
|
85
|
-
return "optimism-mainnet.infura.io";
|
|
86
|
-
case "optimism-goerli":
|
|
87
|
-
return "optimism-goerli.infura.io";
|
|
88
|
-
case "optimism-sepolia":
|
|
89
|
-
return "optimism-sepolia.infura.io";
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
assertArgument(false, "unsupported network", "network", name);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* The **InfuraWebSocketProvider** connects to the [[link-infura]]
|
|
97
|
-
* WebSocket end-points.
|
|
98
|
-
*
|
|
99
|
-
* By default, a highly-throttled API key is used, which is
|
|
100
|
-
* appropriate for quick prototypes and simple scripts. To
|
|
101
|
-
* gain access to an increased rate-limit, it is highly
|
|
102
|
-
* recommended to [sign up here](link-infura-signup).
|
|
103
|
-
*/
|
|
104
|
-
export class InfuraWebSocketProvider extends WebSocketProvider implements CommunityResourcable {
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* The Project ID for the INFURA connection.
|
|
108
|
-
*/
|
|
109
|
-
readonly projectId!: string;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* The Project Secret.
|
|
113
|
-
*
|
|
114
|
-
* If null, no authenticated requests are made. This should not
|
|
115
|
-
* be used outside of private contexts.
|
|
116
|
-
*/
|
|
117
|
-
readonly projectSecret!: null | string;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Creates a new **InfuraWebSocketProvider**.
|
|
121
|
-
*/
|
|
122
|
-
constructor(network?: Networkish, projectId?: string) {
|
|
123
|
-
const provider = new InfuraProvider(network, projectId);
|
|
124
|
-
|
|
125
|
-
const req = provider._getConnection();
|
|
126
|
-
assert(!req.credentials, "INFURA WebSocket project secrets unsupported",
|
|
127
|
-
"UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" });
|
|
128
|
-
|
|
129
|
-
const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/");
|
|
130
|
-
super(url, provider._network);
|
|
131
|
-
|
|
132
|
-
defineProperties<InfuraWebSocketProvider>(this, {
|
|
133
|
-
projectId: provider.projectId,
|
|
134
|
-
projectSecret: provider.projectSecret
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
isCommunityResource(): boolean {
|
|
139
|
-
return (this.projectId === defaultProjectId);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* The **InfuraProvider** connects to the [[link-infura]]
|
|
145
|
-
* JSON-RPC end-points.
|
|
146
|
-
*
|
|
147
|
-
* By default, a highly-throttled API key is used, which is
|
|
148
|
-
* appropriate for quick prototypes and simple scripts. To
|
|
149
|
-
* gain access to an increased rate-limit, it is highly
|
|
150
|
-
* recommended to [sign up here](link-infura-signup).
|
|
151
|
-
*/
|
|
152
|
-
export class InfuraProvider extends JsonRpcProvider implements CommunityResourcable {
|
|
153
|
-
/**
|
|
154
|
-
* The Project ID for the INFURA connection.
|
|
155
|
-
*/
|
|
156
|
-
readonly projectId!: string;
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* The Project Secret.
|
|
160
|
-
*
|
|
161
|
-
* If null, no authenticated requests are made. This should not
|
|
162
|
-
* be used outside of private contexts.
|
|
163
|
-
*/
|
|
164
|
-
readonly projectSecret!: null | string;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Creates a new **InfuraProvider**.
|
|
168
|
-
*/
|
|
169
|
-
constructor(_network?: Networkish, projectId?: null | string, projectSecret?: null | string) {
|
|
170
|
-
if (_network == null) { _network = "mainnet"; }
|
|
171
|
-
const network = Network.from(_network);
|
|
172
|
-
if (projectId == null) { projectId = defaultProjectId; }
|
|
173
|
-
if (projectSecret == null) { projectSecret = null; }
|
|
174
|
-
|
|
175
|
-
const request = InfuraProvider.getRequest(network, projectId, projectSecret);
|
|
176
|
-
super(request, network, { staticNetwork: network });
|
|
177
|
-
|
|
178
|
-
defineProperties<InfuraProvider>(this, { projectId, projectSecret });
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
_getProvider(chainId: number): AbstractProvider {
|
|
182
|
-
try {
|
|
183
|
-
return new InfuraProvider(chainId, this.projectId, this.projectSecret);
|
|
184
|
-
} catch (error) { }
|
|
185
|
-
return super._getProvider(chainId);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
isCommunityResource(): boolean {
|
|
189
|
-
return (this.projectId === defaultProjectId);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Creates a new **InfuraWebSocketProvider**.
|
|
194
|
-
*/
|
|
195
|
-
static getWebSocketProvider(network?: Networkish, projectId?: string): InfuraWebSocketProvider {
|
|
196
|
-
return new InfuraWebSocketProvider(network, projectId);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Returns a prepared request for connecting to %%network%%
|
|
201
|
-
* with %%projectId%% and %%projectSecret%%.
|
|
202
|
-
*/
|
|
203
|
-
static getRequest(network: Network, projectId?: null | string, projectSecret?: null | string): FetchRequest {
|
|
204
|
-
if (projectId == null) { projectId = defaultProjectId; }
|
|
205
|
-
if (projectSecret == null) { projectSecret = null; }
|
|
206
|
-
|
|
207
|
-
const request = new FetchRequest(`https:/\/${ getHost(network.name) }/v3/${ projectId }`);
|
|
208
|
-
request.allowGzip = true;
|
|
209
|
-
if (projectSecret) { request.setCredentials("", projectSecret); }
|
|
210
|
-
|
|
211
|
-
if (projectId === defaultProjectId) {
|
|
212
|
-
request.retryFunc = async (request, response, attempt) => {
|
|
213
|
-
showThrottleMessage("InfuraProvider");
|
|
214
|
-
return true;
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return request;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* [[link-pocket]] provides a third-party service for connecting to
|
|
3
|
-
* various blockchains over JSON-RPC.
|
|
4
|
-
*
|
|
5
|
-
* **Supported Networks**
|
|
6
|
-
*
|
|
7
|
-
* - Ethereum Mainnet (``mainnet``)
|
|
8
|
-
* - Goerli Testnet (``goerli``)
|
|
9
|
-
* - Polygon (``matic``)
|
|
10
|
-
* - Arbitrum (``arbitrum``)
|
|
11
|
-
*
|
|
12
|
-
* @_subsection: api/providers/thirdparty:Pocket [providers-pocket]
|
|
13
|
-
*/
|
|
14
|
-
import {
|
|
15
|
-
defineProperties, FetchRequest, assertArgument
|
|
16
|
-
} from "../utils/index.js";
|
|
17
|
-
|
|
18
|
-
import { AbstractProvider } from "./abstract-provider.js";
|
|
19
|
-
import { showThrottleMessage } from "./community.js";
|
|
20
|
-
import { Network } from "./network.js";
|
|
21
|
-
import { JsonRpcProvider } from "./provider-jsonrpc.js";
|
|
22
|
-
|
|
23
|
-
import type { CommunityResourcable } from "./community.js";
|
|
24
|
-
import type { Networkish } from "./network.js";
|
|
25
|
-
|
|
26
|
-
const defaultApplicationId = "62e1ad51b37b8e00394bda3b";
|
|
27
|
-
|
|
28
|
-
function getHost(name: string): string {
|
|
29
|
-
switch (name) {
|
|
30
|
-
case "mainnet":
|
|
31
|
-
return "eth-mainnet.gateway.pokt.network";
|
|
32
|
-
case "goerli":
|
|
33
|
-
return "eth-goerli.gateway.pokt.network";
|
|
34
|
-
|
|
35
|
-
case "matic":
|
|
36
|
-
return "poly-mainnet.gateway.pokt.network";
|
|
37
|
-
case "matic-mumbai":
|
|
38
|
-
return "polygon-mumbai-rpc.gateway.pokt.network";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
assertArgument(false, "unsupported network", "network", name);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The **PocketProvider** connects to the [[link-pocket]]
|
|
47
|
-
* JSON-RPC end-points.
|
|
48
|
-
*
|
|
49
|
-
* By default, a highly-throttled API key is used, which is
|
|
50
|
-
* appropriate for quick prototypes and simple scripts. To
|
|
51
|
-
* gain access to an increased rate-limit, it is highly
|
|
52
|
-
* recommended to [sign up here](link-pocket-signup).
|
|
53
|
-
*/
|
|
54
|
-
export class PocketProvider extends JsonRpcProvider implements CommunityResourcable {
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The Application ID for the Pocket connection.
|
|
58
|
-
*/
|
|
59
|
-
readonly applicationId!: string;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* The Application Secret for making authenticated requests
|
|
63
|
-
* to the Pocket connection.
|
|
64
|
-
*/
|
|
65
|
-
readonly applicationSecret!: null | string;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Create a new **PocketProvider**.
|
|
69
|
-
*
|
|
70
|
-
* By default connecting to ``mainnet`` with a highly throttled
|
|
71
|
-
* API key.
|
|
72
|
-
*/
|
|
73
|
-
constructor(_network?: Networkish, applicationId?: null | string, applicationSecret?: null | string) {
|
|
74
|
-
if (_network == null) { _network = "mainnet"; }
|
|
75
|
-
const network = Network.from(_network);
|
|
76
|
-
if (applicationId == null) { applicationId = defaultApplicationId; }
|
|
77
|
-
if (applicationSecret == null) { applicationSecret = null; }
|
|
78
|
-
|
|
79
|
-
const options = { staticNetwork: network };
|
|
80
|
-
|
|
81
|
-
const request = PocketProvider.getRequest(network, applicationId, applicationSecret);
|
|
82
|
-
super(request, network, options);
|
|
83
|
-
|
|
84
|
-
defineProperties<PocketProvider>(this, { applicationId, applicationSecret });
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
_getProvider(chainId: number): AbstractProvider {
|
|
88
|
-
try {
|
|
89
|
-
return new PocketProvider(chainId, this.applicationId, this.applicationSecret);
|
|
90
|
-
} catch (error) { }
|
|
91
|
-
return super._getProvider(chainId);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Returns a prepared request for connecting to %%network%% with
|
|
96
|
-
* %%applicationId%%.
|
|
97
|
-
*/
|
|
98
|
-
static getRequest(network: Network, applicationId?: null | string, applicationSecret?: null | string): FetchRequest {
|
|
99
|
-
if (applicationId == null) { applicationId = defaultApplicationId; }
|
|
100
|
-
|
|
101
|
-
const request = new FetchRequest(`https:/\/${ getHost(network.name) }/v1/lb/${ applicationId }`);
|
|
102
|
-
request.allowGzip = true;
|
|
103
|
-
|
|
104
|
-
if (applicationSecret) {
|
|
105
|
-
request.setCredentials("", applicationSecret);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (applicationId === defaultApplicationId) {
|
|
109
|
-
request.retryFunc = async (request, response, attempt) => {
|
|
110
|
-
showThrottleMessage("PocketProvider");
|
|
111
|
-
return true;
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return request;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
isCommunityResource(): boolean {
|
|
119
|
-
return (this.applicationId === defaultApplicationId);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* [[link-quicknode]] provides a third-party service for connecting to
|
|
3
|
-
* various blockchains over JSON-RPC.
|
|
4
|
-
*
|
|
5
|
-
* **Supported Networks**
|
|
6
|
-
*
|
|
7
|
-
* - Ethereum Mainnet (``mainnet``)
|
|
8
|
-
* - Goerli Testnet (``goerli``)
|
|
9
|
-
* - Sepolia Testnet (``sepolia``)
|
|
10
|
-
* - Holesky Testnet (``holesky``)
|
|
11
|
-
* - Arbitrum (``arbitrum``)
|
|
12
|
-
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
|
|
13
|
-
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
|
|
14
|
-
* - Base Mainnet (``base``);
|
|
15
|
-
* - Base Goerli Testnet (``base-goerli``);
|
|
16
|
-
* - Base Sepolia Testnet (``base-sepolia``);
|
|
17
|
-
* - BNB Smart Chain Mainnet (``bnb``)
|
|
18
|
-
* - BNB Smart Chain Testnet (``bnbt``)
|
|
19
|
-
* - Optimism (``optimism``)
|
|
20
|
-
* - Optimism Goerli Testnet (``optimism-goerli``)
|
|
21
|
-
* - Optimism Sepolia Testnet (``optimism-sepolia``)
|
|
22
|
-
* - Polygon (``matic``)
|
|
23
|
-
* - Polygon Mumbai Testnet (``matic-mumbai``)
|
|
24
|
-
*
|
|
25
|
-
* @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode]
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
import {
|
|
29
|
-
defineProperties, FetchRequest, assertArgument
|
|
30
|
-
} from "../utils/index.js";
|
|
31
|
-
|
|
32
|
-
import { showThrottleMessage } from "./community.js";
|
|
33
|
-
import { Network } from "./network.js";
|
|
34
|
-
import { JsonRpcProvider } from "./provider-jsonrpc.js";
|
|
35
|
-
|
|
36
|
-
import type { AbstractProvider } from "./abstract-provider.js";
|
|
37
|
-
import type { CommunityResourcable } from "./community.js";
|
|
38
|
-
import type { Networkish } from "./network.js";
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb";
|
|
42
|
-
|
|
43
|
-
function getHost(name: string): string {
|
|
44
|
-
switch(name) {
|
|
45
|
-
case "mainnet":
|
|
46
|
-
return "ethers.quiknode.pro";
|
|
47
|
-
case "goerli":
|
|
48
|
-
return "ethers.ethereum-goerli.quiknode.pro";
|
|
49
|
-
case "sepolia":
|
|
50
|
-
return "ethers.ethereum-sepolia.quiknode.pro";
|
|
51
|
-
case "holesky":
|
|
52
|
-
return "ethers.ethereum-holesky.quiknode.pro";
|
|
53
|
-
|
|
54
|
-
case "arbitrum":
|
|
55
|
-
return "ethers.arbitrum-mainnet.quiknode.pro";
|
|
56
|
-
case "arbitrum-goerli":
|
|
57
|
-
return "ethers.arbitrum-goerli.quiknode.pro";
|
|
58
|
-
case "arbitrum-sepolia":
|
|
59
|
-
return "ethers.arbitrum-sepolia.quiknode.pro";
|
|
60
|
-
case "base":
|
|
61
|
-
return "ethers.base-mainnet.quiknode.pro";
|
|
62
|
-
case "base-goerli":
|
|
63
|
-
return "ethers.base-goerli.quiknode.pro";
|
|
64
|
-
case "base-spolia":
|
|
65
|
-
return "ethers.base-sepolia.quiknode.pro";
|
|
66
|
-
case "bnb":
|
|
67
|
-
return "ethers.bsc.quiknode.pro";
|
|
68
|
-
case "bnbt":
|
|
69
|
-
return "ethers.bsc-testnet.quiknode.pro";
|
|
70
|
-
case "matic":
|
|
71
|
-
return "ethers.matic.quiknode.pro";
|
|
72
|
-
case "matic-mumbai":
|
|
73
|
-
return "ethers.matic-testnet.quiknode.pro";
|
|
74
|
-
case "optimism":
|
|
75
|
-
return "ethers.optimism.quiknode.pro";
|
|
76
|
-
case "optimism-goerli":
|
|
77
|
-
return "ethers.optimism-goerli.quiknode.pro";
|
|
78
|
-
case "optimism-sepolia":
|
|
79
|
-
return "ethers.optimism-sepolia.quiknode.pro";
|
|
80
|
-
case "xdai":
|
|
81
|
-
return "ethers.xdai.quiknode.pro";
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
assertArgument(false, "unsupported network", "network", name);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/*
|
|
88
|
-
@TODO:
|
|
89
|
-
These networks are not currently present in the Network
|
|
90
|
-
default included networks. Research them and ensure they
|
|
91
|
-
are EVM compatible and work with ethers
|
|
92
|
-
|
|
93
|
-
http://ethers.matic-amoy.quiknode.pro
|
|
94
|
-
|
|
95
|
-
http://ethers.avalanche-mainnet.quiknode.pro
|
|
96
|
-
http://ethers.avalanche-testnet.quiknode.pro
|
|
97
|
-
http://ethers.blast-sepolia.quiknode.pro
|
|
98
|
-
http://ethers.celo-mainnet.quiknode.pro
|
|
99
|
-
http://ethers.fantom.quiknode.pro
|
|
100
|
-
http://ethers.imx-demo.quiknode.pro
|
|
101
|
-
http://ethers.imx-mainnet.quiknode.pro
|
|
102
|
-
http://ethers.imx-testnet.quiknode.pro
|
|
103
|
-
http://ethers.near-mainnet.quiknode.pro
|
|
104
|
-
http://ethers.near-testnet.quiknode.pro
|
|
105
|
-
http://ethers.nova-mainnet.quiknode.pro
|
|
106
|
-
http://ethers.scroll-mainnet.quiknode.pro
|
|
107
|
-
http://ethers.scroll-testnet.quiknode.pro
|
|
108
|
-
http://ethers.tron-mainnet.quiknode.pro
|
|
109
|
-
http://ethers.zkevm-mainnet.quiknode.pro
|
|
110
|
-
http://ethers.zkevm-testnet.quiknode.pro
|
|
111
|
-
http://ethers.zksync-mainnet.quiknode.pro
|
|
112
|
-
http://ethers.zksync-testnet.quiknode.pro
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* The **QuickNodeProvider** connects to the [[link-quicknode]]
|
|
119
|
-
* JSON-RPC end-points.
|
|
120
|
-
*
|
|
121
|
-
* By default, a highly-throttled API token is used, which is
|
|
122
|
-
* appropriate for quick prototypes and simple scripts. To
|
|
123
|
-
* gain access to an increased rate-limit, it is highly
|
|
124
|
-
* recommended to [sign up here](link-quicknode).
|
|
125
|
-
*/
|
|
126
|
-
export class QuickNodeProvider extends JsonRpcProvider implements CommunityResourcable {
|
|
127
|
-
/**
|
|
128
|
-
* The API token.
|
|
129
|
-
*/
|
|
130
|
-
readonly token!: string;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Creates a new **QuickNodeProvider**.
|
|
134
|
-
*/
|
|
135
|
-
constructor(_network?: Networkish, token?: null | string) {
|
|
136
|
-
if (_network == null) { _network = "mainnet"; }
|
|
137
|
-
const network = Network.from(_network);
|
|
138
|
-
if (token == null) { token = defaultToken; }
|
|
139
|
-
|
|
140
|
-
const request = QuickNodeProvider.getRequest(network, token);
|
|
141
|
-
super(request, network, { staticNetwork: network });
|
|
142
|
-
|
|
143
|
-
defineProperties<QuickNodeProvider>(this, { token });
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
_getProvider(chainId: number): AbstractProvider {
|
|
147
|
-
try {
|
|
148
|
-
return new QuickNodeProvider(chainId, this.token);
|
|
149
|
-
} catch (error) { }
|
|
150
|
-
return super._getProvider(chainId);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
isCommunityResource(): boolean {
|
|
154
|
-
return (this.token === defaultToken);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Returns a new request prepared for %%network%% and the
|
|
159
|
-
* %%token%%.
|
|
160
|
-
*/
|
|
161
|
-
static getRequest(network: Network, token?: null | string): FetchRequest {
|
|
162
|
-
if (token == null) { token = defaultToken; }
|
|
163
|
-
|
|
164
|
-
const request = new FetchRequest(`https:/\/${ getHost(network.name) }/${ token }`);
|
|
165
|
-
request.allowGzip = true;
|
|
166
|
-
//if (projectSecret) { request.setCredentials("", projectSecret); }
|
|
167
|
-
|
|
168
|
-
if (token === defaultToken) {
|
|
169
|
-
request.retryFunc = async (request, response, attempt) => {
|
|
170
|
-
showThrottleMessage("QuickNodeProvider");
|
|
171
|
-
return true;
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return request;
|
|
176
|
-
}
|
|
177
|
-
}
|