shogun-core 6.5.3 → 6.5.5
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/dist/browser/shogun-core.js +1 -3436
- package/dist/browser/shogun-core.js.map +1 -1
- package/dist/src/plugins/index.js +0 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/plugins/index.d.ts +0 -2
- package/package.json +1 -1
- package/dist/src/plugins/smartwallet/index.js +0 -2
- package/dist/src/plugins/smartwallet/smartWalletPlugin.js +0 -824
- package/dist/src/plugins/smartwallet/types.js +0 -1
- package/dist/types/src/plugins/smartwallet/index.d.ts +0 -2
- package/dist/types/src/plugins/smartwallet/smartWalletPlugin.d.ts +0 -67
- package/dist/types/src/plugins/smartwallet/types.d.ts +0 -80
|
@@ -58500,7 +58500,7 @@ var __webpack_exports__ = {};
|
|
|
58500
58500
|
(() => {
|
|
58501
58501
|
"use strict";
|
|
58502
58502
|
/*!************************************!*\
|
|
58503
|
-
!*** ./src/index.ts +
|
|
58503
|
+
!*** ./src/index.ts + 278 modules ***!
|
|
58504
58504
|
\************************************/
|
|
58505
58505
|
// ESM COMPAT FLAG
|
|
58506
58506
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -58524,7 +58524,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
58524
58524
|
SEA: () => (/* reexport */ (sea_default())),
|
|
58525
58525
|
ShogunCore: () => (/* reexport */ ShogunCore),
|
|
58526
58526
|
ShogunStorage: () => (/* reexport */ ShogunStorage),
|
|
58527
|
-
SmartWalletPlugin: () => (/* reexport */ SmartWalletPlugin),
|
|
58528
58527
|
Web3Connector: () => (/* reexport */ Web3Connector),
|
|
58529
58528
|
Web3ConnectorPlugin: () => (/* reexport */ Web3ConnectorPlugin),
|
|
58530
58529
|
Webauthn: () => (/* reexport */ Webauthn),
|
|
@@ -126905,3438 +126904,6 @@ var ZkCredentials = /** @class */ (function () {
|
|
|
126905
126904
|
}());
|
|
126906
126905
|
|
|
126907
126906
|
|
|
126908
|
-
;// ./node_modules/ethers/lib.esm/providers/community.js
|
|
126909
|
-
/**
|
|
126910
|
-
* There are many awesome community services that provide Ethereum
|
|
126911
|
-
* nodes both for developers just starting out and for large-scale
|
|
126912
|
-
* communities.
|
|
126913
|
-
*
|
|
126914
|
-
* @_section: api/providers/thirdparty: Community Providers [thirdparty]
|
|
126915
|
-
*/
|
|
126916
|
-
// Show the throttle message only once per service
|
|
126917
|
-
const shown = new Set();
|
|
126918
|
-
/**
|
|
126919
|
-
* Displays a warning in the console when the community resource is
|
|
126920
|
-
* being used too heavily by the app, recommending the developer
|
|
126921
|
-
* acquire their own credentials instead of using the community
|
|
126922
|
-
* credentials.
|
|
126923
|
-
*
|
|
126924
|
-
* The notification will only occur once per service.
|
|
126925
|
-
*/
|
|
126926
|
-
function showThrottleMessage(service) {
|
|
126927
|
-
if (shown.has(service)) {
|
|
126928
|
-
return;
|
|
126929
|
-
}
|
|
126930
|
-
shown.add(service);
|
|
126931
|
-
console.log("========= NOTICE =========");
|
|
126932
|
-
console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`);
|
|
126933
|
-
console.log("");
|
|
126934
|
-
console.log("The default API keys for each service are provided as a highly-throttled,");
|
|
126935
|
-
console.log("community resource for low-traffic projects and early prototyping.");
|
|
126936
|
-
console.log("");
|
|
126937
|
-
console.log("While your application will continue to function, we highly recommended");
|
|
126938
|
-
console.log("signing up for your own API keys to improve performance, increase your");
|
|
126939
|
-
console.log("request rate/limit and enable other perks, such as metrics and advanced APIs.");
|
|
126940
|
-
console.log("");
|
|
126941
|
-
console.log("For more details: https:/\/docs.ethers.org/api-keys/");
|
|
126942
|
-
console.log("==========================");
|
|
126943
|
-
}
|
|
126944
|
-
//# sourceMappingURL=community.js.map
|
|
126945
|
-
;// ./node_modules/ethers/lib.esm/providers/provider-ankr.js
|
|
126946
|
-
/**
|
|
126947
|
-
* [[link-ankr]] provides a third-party service for connecting to
|
|
126948
|
-
* various blockchains over JSON-RPC.
|
|
126949
|
-
*
|
|
126950
|
-
* **Supported Networks**
|
|
126951
|
-
*
|
|
126952
|
-
* - Ethereum Mainnet (``mainnet``)
|
|
126953
|
-
* - Goerli Testnet (``goerli``)
|
|
126954
|
-
* - Sepolia Testnet (``sepolia``)
|
|
126955
|
-
* - Arbitrum (``arbitrum``)
|
|
126956
|
-
* - Base (``base``)
|
|
126957
|
-
* - Base Goerlia Testnet (``base-goerli``)
|
|
126958
|
-
* - Base Sepolia Testnet (``base-sepolia``)
|
|
126959
|
-
* - BNB (``bnb``)
|
|
126960
|
-
* - BNB Testnet (``bnbt``)
|
|
126961
|
-
* - Optimism (``optimism``)
|
|
126962
|
-
* - Optimism Goerli Testnet (``optimism-goerli``)
|
|
126963
|
-
* - Optimism Sepolia Testnet (``optimism-sepolia``)
|
|
126964
|
-
* - Polygon (``matic``)
|
|
126965
|
-
* - Polygon Mumbai Testnet (``matic-mumbai``)
|
|
126966
|
-
*
|
|
126967
|
-
* @_subsection: api/providers/thirdparty:Ankr [providers-ankr]
|
|
126968
|
-
*/
|
|
126969
|
-
|
|
126970
|
-
|
|
126971
|
-
|
|
126972
|
-
|
|
126973
|
-
const defaultApiKey = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";
|
|
126974
|
-
function getHost(name) {
|
|
126975
|
-
switch (name) {
|
|
126976
|
-
case "mainnet":
|
|
126977
|
-
return "rpc.ankr.com/eth";
|
|
126978
|
-
case "goerli":
|
|
126979
|
-
return "rpc.ankr.com/eth_goerli";
|
|
126980
|
-
case "sepolia":
|
|
126981
|
-
return "rpc.ankr.com/eth_sepolia";
|
|
126982
|
-
case "arbitrum":
|
|
126983
|
-
return "rpc.ankr.com/arbitrum";
|
|
126984
|
-
case "base":
|
|
126985
|
-
return "rpc.ankr.com/base";
|
|
126986
|
-
case "base-goerli":
|
|
126987
|
-
return "rpc.ankr.com/base_goerli";
|
|
126988
|
-
case "base-sepolia":
|
|
126989
|
-
return "rpc.ankr.com/base_sepolia";
|
|
126990
|
-
case "bnb":
|
|
126991
|
-
return "rpc.ankr.com/bsc";
|
|
126992
|
-
case "bnbt":
|
|
126993
|
-
return "rpc.ankr.com/bsc_testnet_chapel";
|
|
126994
|
-
case "matic":
|
|
126995
|
-
return "rpc.ankr.com/polygon";
|
|
126996
|
-
case "matic-mumbai":
|
|
126997
|
-
return "rpc.ankr.com/polygon_mumbai";
|
|
126998
|
-
case "optimism":
|
|
126999
|
-
return "rpc.ankr.com/optimism";
|
|
127000
|
-
case "optimism-goerli":
|
|
127001
|
-
return "rpc.ankr.com/optimism_testnet";
|
|
127002
|
-
case "optimism-sepolia":
|
|
127003
|
-
return "rpc.ankr.com/optimism_sepolia";
|
|
127004
|
-
}
|
|
127005
|
-
assertArgument(false, "unsupported network", "network", name);
|
|
127006
|
-
}
|
|
127007
|
-
/**
|
|
127008
|
-
* The **AnkrProvider** connects to the [[link-ankr]]
|
|
127009
|
-
* JSON-RPC end-points.
|
|
127010
|
-
*
|
|
127011
|
-
* By default, a highly-throttled API key is used, which is
|
|
127012
|
-
* appropriate for quick prototypes and simple scripts. To
|
|
127013
|
-
* gain access to an increased rate-limit, it is highly
|
|
127014
|
-
* recommended to [sign up here](link-ankr-signup).
|
|
127015
|
-
*/
|
|
127016
|
-
class AnkrProvider extends JsonRpcProvider {
|
|
127017
|
-
/**
|
|
127018
|
-
* The API key for the Ankr connection.
|
|
127019
|
-
*/
|
|
127020
|
-
apiKey;
|
|
127021
|
-
/**
|
|
127022
|
-
* Create a new **AnkrProvider**.
|
|
127023
|
-
*
|
|
127024
|
-
* By default connecting to ``mainnet`` with a highly throttled
|
|
127025
|
-
* API key.
|
|
127026
|
-
*/
|
|
127027
|
-
constructor(_network, apiKey) {
|
|
127028
|
-
if (_network == null) {
|
|
127029
|
-
_network = "mainnet";
|
|
127030
|
-
}
|
|
127031
|
-
const network = Network.from(_network);
|
|
127032
|
-
if (apiKey == null) {
|
|
127033
|
-
apiKey = defaultApiKey;
|
|
127034
|
-
}
|
|
127035
|
-
// Ankr does not support filterId, so we force polling
|
|
127036
|
-
const options = { polling: true, staticNetwork: network };
|
|
127037
|
-
const request = AnkrProvider.getRequest(network, apiKey);
|
|
127038
|
-
super(request, network, options);
|
|
127039
|
-
defineProperties(this, { apiKey });
|
|
127040
|
-
}
|
|
127041
|
-
_getProvider(chainId) {
|
|
127042
|
-
try {
|
|
127043
|
-
return new AnkrProvider(chainId, this.apiKey);
|
|
127044
|
-
}
|
|
127045
|
-
catch (error) { }
|
|
127046
|
-
return super._getProvider(chainId);
|
|
127047
|
-
}
|
|
127048
|
-
/**
|
|
127049
|
-
* Returns a prepared request for connecting to %%network%% with
|
|
127050
|
-
* %%apiKey%%.
|
|
127051
|
-
*/
|
|
127052
|
-
static getRequest(network, apiKey) {
|
|
127053
|
-
if (apiKey == null) {
|
|
127054
|
-
apiKey = defaultApiKey;
|
|
127055
|
-
}
|
|
127056
|
-
const request = new FetchRequest(`https:/\/${getHost(network.name)}/${apiKey}`);
|
|
127057
|
-
request.allowGzip = true;
|
|
127058
|
-
if (apiKey === defaultApiKey) {
|
|
127059
|
-
request.retryFunc = async (request, response, attempt) => {
|
|
127060
|
-
showThrottleMessage("AnkrProvider");
|
|
127061
|
-
return true;
|
|
127062
|
-
};
|
|
127063
|
-
}
|
|
127064
|
-
return request;
|
|
127065
|
-
}
|
|
127066
|
-
getRpcError(payload, error) {
|
|
127067
|
-
if (payload.method === "eth_sendRawTransaction") {
|
|
127068
|
-
if (error && error.error && error.error.message === "INTERNAL_ERROR: could not replace existing tx") {
|
|
127069
|
-
error.error.message = "replacement transaction underpriced";
|
|
127070
|
-
}
|
|
127071
|
-
}
|
|
127072
|
-
return super.getRpcError(payload, error);
|
|
127073
|
-
}
|
|
127074
|
-
isCommunityResource() {
|
|
127075
|
-
return (this.apiKey === defaultApiKey);
|
|
127076
|
-
}
|
|
127077
|
-
}
|
|
127078
|
-
//# sourceMappingURL=provider-ankr.js.map
|
|
127079
|
-
;// ./node_modules/ethers/lib.esm/providers/provider-alchemy.js
|
|
127080
|
-
/**
|
|
127081
|
-
* [[link-alchemy]] provides a third-party service for connecting to
|
|
127082
|
-
* various blockchains over JSON-RPC.
|
|
127083
|
-
*
|
|
127084
|
-
* **Supported Networks**
|
|
127085
|
-
*
|
|
127086
|
-
* - Ethereum Mainnet (``mainnet``)
|
|
127087
|
-
* - Goerli Testnet (``goerli``)
|
|
127088
|
-
* - Sepolia Testnet (``sepolia``)
|
|
127089
|
-
* - Arbitrum (``arbitrum``)
|
|
127090
|
-
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
|
|
127091
|
-
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
|
|
127092
|
-
* - Base (``base``)
|
|
127093
|
-
* - Base Goerlia Testnet (``base-goerli``)
|
|
127094
|
-
* - Base Sepolia Testnet (``base-sepolia``)
|
|
127095
|
-
* - Optimism (``optimism``)
|
|
127096
|
-
* - Optimism Goerli Testnet (``optimism-goerli``)
|
|
127097
|
-
* - Optimism Sepolia Testnet (``optimism-sepolia``)
|
|
127098
|
-
* - Polygon (``matic``)
|
|
127099
|
-
* - Polygon Amoy Testnet (``matic-amoy``)
|
|
127100
|
-
* - Polygon Mumbai Testnet (``matic-mumbai``)
|
|
127101
|
-
*
|
|
127102
|
-
* @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy]
|
|
127103
|
-
*/
|
|
127104
|
-
|
|
127105
|
-
|
|
127106
|
-
|
|
127107
|
-
|
|
127108
|
-
const provider_alchemy_defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";
|
|
127109
|
-
function provider_alchemy_getHost(name) {
|
|
127110
|
-
switch (name) {
|
|
127111
|
-
case "mainnet":
|
|
127112
|
-
return "eth-mainnet.alchemyapi.io";
|
|
127113
|
-
case "goerli":
|
|
127114
|
-
return "eth-goerli.g.alchemy.com";
|
|
127115
|
-
case "sepolia":
|
|
127116
|
-
return "eth-sepolia.g.alchemy.com";
|
|
127117
|
-
case "arbitrum":
|
|
127118
|
-
return "arb-mainnet.g.alchemy.com";
|
|
127119
|
-
case "arbitrum-goerli":
|
|
127120
|
-
return "arb-goerli.g.alchemy.com";
|
|
127121
|
-
case "arbitrum-sepolia":
|
|
127122
|
-
return "arb-sepolia.g.alchemy.com";
|
|
127123
|
-
case "base":
|
|
127124
|
-
return "base-mainnet.g.alchemy.com";
|
|
127125
|
-
case "base-goerli":
|
|
127126
|
-
return "base-goerli.g.alchemy.com";
|
|
127127
|
-
case "base-sepolia":
|
|
127128
|
-
return "base-sepolia.g.alchemy.com";
|
|
127129
|
-
case "matic":
|
|
127130
|
-
return "polygon-mainnet.g.alchemy.com";
|
|
127131
|
-
case "matic-amoy":
|
|
127132
|
-
return "polygon-amoy.g.alchemy.com";
|
|
127133
|
-
case "matic-mumbai":
|
|
127134
|
-
return "polygon-mumbai.g.alchemy.com";
|
|
127135
|
-
case "optimism":
|
|
127136
|
-
return "opt-mainnet.g.alchemy.com";
|
|
127137
|
-
case "optimism-goerli":
|
|
127138
|
-
return "opt-goerli.g.alchemy.com";
|
|
127139
|
-
case "optimism-sepolia":
|
|
127140
|
-
return "opt-sepolia.g.alchemy.com";
|
|
127141
|
-
}
|
|
127142
|
-
assertArgument(false, "unsupported network", "network", name);
|
|
127143
|
-
}
|
|
127144
|
-
/**
|
|
127145
|
-
* The **AlchemyProvider** connects to the [[link-alchemy]]
|
|
127146
|
-
* JSON-RPC end-points.
|
|
127147
|
-
*
|
|
127148
|
-
* By default, a highly-throttled API key is used, which is
|
|
127149
|
-
* appropriate for quick prototypes and simple scripts. To
|
|
127150
|
-
* gain access to an increased rate-limit, it is highly
|
|
127151
|
-
* recommended to [sign up here](link-alchemy-signup).
|
|
127152
|
-
*
|
|
127153
|
-
* @_docloc: api/providers/thirdparty
|
|
127154
|
-
*/
|
|
127155
|
-
class AlchemyProvider extends JsonRpcProvider {
|
|
127156
|
-
apiKey;
|
|
127157
|
-
constructor(_network, apiKey) {
|
|
127158
|
-
if (_network == null) {
|
|
127159
|
-
_network = "mainnet";
|
|
127160
|
-
}
|
|
127161
|
-
const network = Network.from(_network);
|
|
127162
|
-
if (apiKey == null) {
|
|
127163
|
-
apiKey = provider_alchemy_defaultApiKey;
|
|
127164
|
-
}
|
|
127165
|
-
const request = AlchemyProvider.getRequest(network, apiKey);
|
|
127166
|
-
super(request, network, { staticNetwork: network });
|
|
127167
|
-
defineProperties(this, { apiKey });
|
|
127168
|
-
}
|
|
127169
|
-
_getProvider(chainId) {
|
|
127170
|
-
try {
|
|
127171
|
-
return new AlchemyProvider(chainId, this.apiKey);
|
|
127172
|
-
}
|
|
127173
|
-
catch (error) { }
|
|
127174
|
-
return super._getProvider(chainId);
|
|
127175
|
-
}
|
|
127176
|
-
async _perform(req) {
|
|
127177
|
-
// https://docs.alchemy.com/reference/trace-transaction
|
|
127178
|
-
if (req.method === "getTransactionResult") {
|
|
127179
|
-
const { trace, tx } = await resolveProperties({
|
|
127180
|
-
trace: this.send("trace_transaction", [req.hash]),
|
|
127181
|
-
tx: this.getTransaction(req.hash)
|
|
127182
|
-
});
|
|
127183
|
-
if (trace == null || tx == null) {
|
|
127184
|
-
return null;
|
|
127185
|
-
}
|
|
127186
|
-
let data;
|
|
127187
|
-
let error = false;
|
|
127188
|
-
try {
|
|
127189
|
-
data = trace[0].result.output;
|
|
127190
|
-
error = (trace[0].error === "Reverted");
|
|
127191
|
-
}
|
|
127192
|
-
catch (error) { }
|
|
127193
|
-
if (data) {
|
|
127194
|
-
assert(!error, "an error occurred during transaction executions", "CALL_EXCEPTION", {
|
|
127195
|
-
action: "getTransactionResult",
|
|
127196
|
-
data,
|
|
127197
|
-
reason: null,
|
|
127198
|
-
transaction: tx,
|
|
127199
|
-
invocation: null,
|
|
127200
|
-
revert: null // @TODO
|
|
127201
|
-
});
|
|
127202
|
-
return data;
|
|
127203
|
-
}
|
|
127204
|
-
assert(false, "could not parse trace result", "BAD_DATA", { value: trace });
|
|
127205
|
-
}
|
|
127206
|
-
return await super._perform(req);
|
|
127207
|
-
}
|
|
127208
|
-
isCommunityResource() {
|
|
127209
|
-
return (this.apiKey === provider_alchemy_defaultApiKey);
|
|
127210
|
-
}
|
|
127211
|
-
static getRequest(network, apiKey) {
|
|
127212
|
-
if (apiKey == null) {
|
|
127213
|
-
apiKey = provider_alchemy_defaultApiKey;
|
|
127214
|
-
}
|
|
127215
|
-
const request = new FetchRequest(`https:/\/${provider_alchemy_getHost(network.name)}/v2/${apiKey}`);
|
|
127216
|
-
request.allowGzip = true;
|
|
127217
|
-
if (apiKey === provider_alchemy_defaultApiKey) {
|
|
127218
|
-
request.retryFunc = async (request, response, attempt) => {
|
|
127219
|
-
showThrottleMessage("alchemy");
|
|
127220
|
-
return true;
|
|
127221
|
-
};
|
|
127222
|
-
}
|
|
127223
|
-
return request;
|
|
127224
|
-
}
|
|
127225
|
-
}
|
|
127226
|
-
//# sourceMappingURL=provider-alchemy.js.map
|
|
127227
|
-
;// ./node_modules/ethers/lib.esm/providers/provider-chainstack.js
|
|
127228
|
-
/**
|
|
127229
|
-
* [[link-chainstack]] provides a third-party service for connecting to
|
|
127230
|
-
* various blockchains over JSON-RPC.
|
|
127231
|
-
*
|
|
127232
|
-
* **Supported Networks**
|
|
127233
|
-
*
|
|
127234
|
-
* - Ethereum Mainnet (``mainnet``)
|
|
127235
|
-
* - Arbitrum (``arbitrum``)
|
|
127236
|
-
* - BNB Smart Chain Mainnet (``bnb``)
|
|
127237
|
-
* - Polygon (``matic``)
|
|
127238
|
-
*
|
|
127239
|
-
* @_subsection: api/providers/thirdparty:Chainstack [providers-chainstack]
|
|
127240
|
-
*/
|
|
127241
|
-
|
|
127242
|
-
|
|
127243
|
-
|
|
127244
|
-
|
|
127245
|
-
function getApiKey(name) {
|
|
127246
|
-
switch (name) {
|
|
127247
|
-
case "mainnet": return "39f1d67cedf8b7831010a665328c9197";
|
|
127248
|
-
case "arbitrum": return "0550c209db33c3abf4cc927e1e18cea1";
|
|
127249
|
-
case "bnb": return "98b5a77e531614387366f6fc5da097f8";
|
|
127250
|
-
case "matic": return "cd9d4d70377471aa7c142ec4a4205249";
|
|
127251
|
-
}
|
|
127252
|
-
assertArgument(false, "unsupported network", "network", name);
|
|
127253
|
-
}
|
|
127254
|
-
function provider_chainstack_getHost(name) {
|
|
127255
|
-
switch (name) {
|
|
127256
|
-
case "mainnet":
|
|
127257
|
-
return "ethereum-mainnet.core.chainstack.com";
|
|
127258
|
-
case "arbitrum":
|
|
127259
|
-
return "arbitrum-mainnet.core.chainstack.com";
|
|
127260
|
-
case "bnb":
|
|
127261
|
-
return "bsc-mainnet.core.chainstack.com";
|
|
127262
|
-
case "matic":
|
|
127263
|
-
return "polygon-mainnet.core.chainstack.com";
|
|
127264
|
-
}
|
|
127265
|
-
assertArgument(false, "unsupported network", "network", name);
|
|
127266
|
-
}
|
|
127267
|
-
/**
|
|
127268
|
-
* The **ChainstackProvider** connects to the [[link-chainstack]]
|
|
127269
|
-
* JSON-RPC end-points.
|
|
127270
|
-
*
|
|
127271
|
-
* By default, a highly-throttled API key is used, which is
|
|
127272
|
-
* appropriate for quick prototypes and simple scripts. To
|
|
127273
|
-
* gain access to an increased rate-limit, it is highly
|
|
127274
|
-
* recommended to [sign up here](link-chainstack).
|
|
127275
|
-
*/
|
|
127276
|
-
class ChainstackProvider extends JsonRpcProvider {
|
|
127277
|
-
/**
|
|
127278
|
-
* The API key for the Chainstack connection.
|
|
127279
|
-
*/
|
|
127280
|
-
apiKey;
|
|
127281
|
-
/**
|
|
127282
|
-
* Creates a new **ChainstackProvider**.
|
|
127283
|
-
*/
|
|
127284
|
-
constructor(_network, apiKey) {
|
|
127285
|
-
if (_network == null) {
|
|
127286
|
-
_network = "mainnet";
|
|
127287
|
-
}
|
|
127288
|
-
const network = Network.from(_network);
|
|
127289
|
-
if (apiKey == null) {
|
|
127290
|
-
apiKey = getApiKey(network.name);
|
|
127291
|
-
}
|
|
127292
|
-
const request = ChainstackProvider.getRequest(network, apiKey);
|
|
127293
|
-
super(request, network, { staticNetwork: network });
|
|
127294
|
-
defineProperties(this, { apiKey });
|
|
127295
|
-
}
|
|
127296
|
-
_getProvider(chainId) {
|
|
127297
|
-
try {
|
|
127298
|
-
return new ChainstackProvider(chainId, this.apiKey);
|
|
127299
|
-
}
|
|
127300
|
-
catch (error) { }
|
|
127301
|
-
return super._getProvider(chainId);
|
|
127302
|
-
}
|
|
127303
|
-
isCommunityResource() {
|
|
127304
|
-
return (this.apiKey === getApiKey(this._network.name));
|
|
127305
|
-
}
|
|
127306
|
-
/**
|
|
127307
|
-
* Returns a prepared request for connecting to %%network%%
|
|
127308
|
-
* with %%apiKey%% and %%projectSecret%%.
|
|
127309
|
-
*/
|
|
127310
|
-
static getRequest(network, apiKey) {
|
|
127311
|
-
if (apiKey == null) {
|
|
127312
|
-
apiKey = getApiKey(network.name);
|
|
127313
|
-
}
|
|
127314
|
-
const request = new FetchRequest(`https:/\/${provider_chainstack_getHost(network.name)}/${apiKey}`);
|
|
127315
|
-
request.allowGzip = true;
|
|
127316
|
-
if (apiKey === getApiKey(network.name)) {
|
|
127317
|
-
request.retryFunc = async (request, response, attempt) => {
|
|
127318
|
-
showThrottleMessage("ChainstackProvider");
|
|
127319
|
-
return true;
|
|
127320
|
-
};
|
|
127321
|
-
}
|
|
127322
|
-
return request;
|
|
127323
|
-
}
|
|
127324
|
-
}
|
|
127325
|
-
//# sourceMappingURL=provider-chainstack.js.map
|
|
127326
|
-
;// ./node_modules/ethers/lib.esm/providers/provider-cloudflare.js
|
|
127327
|
-
/**
|
|
127328
|
-
* About Cloudflare
|
|
127329
|
-
*
|
|
127330
|
-
* @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare]
|
|
127331
|
-
*/
|
|
127332
|
-
|
|
127333
|
-
|
|
127334
|
-
|
|
127335
|
-
/**
|
|
127336
|
-
* About Cloudflare...
|
|
127337
|
-
*/
|
|
127338
|
-
class CloudflareProvider extends JsonRpcProvider {
|
|
127339
|
-
constructor(_network) {
|
|
127340
|
-
if (_network == null) {
|
|
127341
|
-
_network = "mainnet";
|
|
127342
|
-
}
|
|
127343
|
-
const network = Network.from(_network);
|
|
127344
|
-
assertArgument(network.name === "mainnet", "unsupported network", "network", _network);
|
|
127345
|
-
super("https:/\/cloudflare-eth.com/", network, { staticNetwork: network });
|
|
127346
|
-
}
|
|
127347
|
-
}
|
|
127348
|
-
//# sourceMappingURL=provider-cloudflare.js.map
|
|
127349
|
-
;// ./node_modules/ethers/lib.esm/providers/provider-etherscan.js
|
|
127350
|
-
/**
|
|
127351
|
-
* [[link-etherscan]] provides a third-party service for connecting to
|
|
127352
|
-
* various blockchains over a combination of JSON-RPC and custom API
|
|
127353
|
-
* endpoints.
|
|
127354
|
-
*
|
|
127355
|
-
* **Supported Networks**
|
|
127356
|
-
*
|
|
127357
|
-
* - Ethereum Mainnet (``mainnet``)
|
|
127358
|
-
* - Goerli Testnet (``goerli``)
|
|
127359
|
-
* - Sepolia Testnet (``sepolia``)
|
|
127360
|
-
* - Holesky Testnet (``holesky``)
|
|
127361
|
-
* - Arbitrum (``arbitrum``)
|
|
127362
|
-
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
|
|
127363
|
-
* - Base (``base``)
|
|
127364
|
-
* - Base Sepolia Testnet (``base-sepolia``)
|
|
127365
|
-
* - BNB Smart Chain Mainnet (``bnb``)
|
|
127366
|
-
* - BNB Smart Chain Testnet (``bnbt``)
|
|
127367
|
-
* - Optimism (``optimism``)
|
|
127368
|
-
* - Optimism Goerli Testnet (``optimism-goerli``)
|
|
127369
|
-
* - Polygon (``matic``)
|
|
127370
|
-
* - Polygon Mumbai Testnet (``matic-mumbai``)
|
|
127371
|
-
* - Polygon Amoy Testnet (``matic-amoy``)
|
|
127372
|
-
*
|
|
127373
|
-
* @_subsection api/providers/thirdparty:Etherscan [providers-etherscan]
|
|
127374
|
-
*/
|
|
127375
|
-
|
|
127376
|
-
|
|
127377
|
-
|
|
127378
|
-
|
|
127379
|
-
|
|
127380
|
-
|
|
127381
|
-
|
|
127382
|
-
|
|
127383
|
-
const THROTTLE = 2000;
|
|
127384
|
-
function provider_etherscan_isPromise(value) {
|
|
127385
|
-
return (value && typeof (value.then) === "function");
|
|
127386
|
-
}
|
|
127387
|
-
const EtherscanPluginId = "org.ethers.plugins.provider.Etherscan";
|
|
127388
|
-
/**
|
|
127389
|
-
* A Network can include an **EtherscanPlugin** to provide
|
|
127390
|
-
* a custom base URL.
|
|
127391
|
-
*
|
|
127392
|
-
* @_docloc: api/providers/thirdparty:Etherscan
|
|
127393
|
-
*/
|
|
127394
|
-
class EtherscanPlugin extends NetworkPlugin {
|
|
127395
|
-
/**
|
|
127396
|
-
* The Etherscan API base URL.
|
|
127397
|
-
*/
|
|
127398
|
-
baseUrl;
|
|
127399
|
-
/**
|
|
127400
|
-
* Creates a new **EtherscanProvider** which will use
|
|
127401
|
-
* %%baseUrl%%.
|
|
127402
|
-
*/
|
|
127403
|
-
constructor(baseUrl) {
|
|
127404
|
-
super(EtherscanPluginId);
|
|
127405
|
-
defineProperties(this, { baseUrl });
|
|
127406
|
-
}
|
|
127407
|
-
clone() {
|
|
127408
|
-
return new EtherscanPlugin(this.baseUrl);
|
|
127409
|
-
}
|
|
127410
|
-
}
|
|
127411
|
-
const skipKeys = ["enableCcipRead"];
|
|
127412
|
-
let nextId = 1;
|
|
127413
|
-
/**
|
|
127414
|
-
* The **EtherscanBaseProvider** is the super-class of
|
|
127415
|
-
* [[EtherscanProvider]], which should generally be used instead.
|
|
127416
|
-
*
|
|
127417
|
-
* Since the **EtherscanProvider** includes additional code for
|
|
127418
|
-
* [[Contract]] access, in //rare cases// that contracts are not
|
|
127419
|
-
* used, this class can reduce code size.
|
|
127420
|
-
*
|
|
127421
|
-
* @_docloc: api/providers/thirdparty:Etherscan
|
|
127422
|
-
*/
|
|
127423
|
-
class EtherscanProvider extends AbstractProvider {
|
|
127424
|
-
/**
|
|
127425
|
-
* The connected network.
|
|
127426
|
-
*/
|
|
127427
|
-
network;
|
|
127428
|
-
/**
|
|
127429
|
-
* The API key or null if using the community provided bandwidth.
|
|
127430
|
-
*/
|
|
127431
|
-
apiKey;
|
|
127432
|
-
#plugin;
|
|
127433
|
-
/**
|
|
127434
|
-
* Creates a new **EtherscanBaseProvider**.
|
|
127435
|
-
*/
|
|
127436
|
-
constructor(_network, _apiKey) {
|
|
127437
|
-
const apiKey = (_apiKey != null) ? _apiKey : null;
|
|
127438
|
-
super();
|
|
127439
|
-
const network = Network.from(_network);
|
|
127440
|
-
this.#plugin = network.getPlugin(EtherscanPluginId);
|
|
127441
|
-
defineProperties(this, { apiKey, network });
|
|
127442
|
-
}
|
|
127443
|
-
/**
|
|
127444
|
-
* Returns the base URL.
|
|
127445
|
-
*
|
|
127446
|
-
* If an [[EtherscanPlugin]] is configured on the
|
|
127447
|
-
* [[EtherscanBaseProvider_network]], returns the plugin's
|
|
127448
|
-
* baseUrl.
|
|
127449
|
-
*
|
|
127450
|
-
* Deprecated; for Etherscan v2 the base is no longer a simply
|
|
127451
|
-
* host, but instead a URL including a chainId parameter. Changing
|
|
127452
|
-
* this to return a URL prefix could break some libraries, so it
|
|
127453
|
-
* is left intact but will be removed in the future as it is unused.
|
|
127454
|
-
*/
|
|
127455
|
-
getBaseUrl() {
|
|
127456
|
-
if (this.#plugin) {
|
|
127457
|
-
return this.#plugin.baseUrl;
|
|
127458
|
-
}
|
|
127459
|
-
switch (this.network.name) {
|
|
127460
|
-
case "mainnet":
|
|
127461
|
-
return "https:/\/api.etherscan.io";
|
|
127462
|
-
case "goerli":
|
|
127463
|
-
return "https:/\/api-goerli.etherscan.io";
|
|
127464
|
-
case "sepolia":
|
|
127465
|
-
return "https:/\/api-sepolia.etherscan.io";
|
|
127466
|
-
case "holesky":
|
|
127467
|
-
return "https:/\/api-holesky.etherscan.io";
|
|
127468
|
-
case "arbitrum":
|
|
127469
|
-
return "https:/\/api.arbiscan.io";
|
|
127470
|
-
case "arbitrum-goerli":
|
|
127471
|
-
return "https:/\/api-goerli.arbiscan.io";
|
|
127472
|
-
case "base":
|
|
127473
|
-
return "https:/\/api.basescan.org";
|
|
127474
|
-
case "base-sepolia":
|
|
127475
|
-
return "https:/\/api-sepolia.basescan.org";
|
|
127476
|
-
case "bnb":
|
|
127477
|
-
return "https:/\/api.bscscan.com";
|
|
127478
|
-
case "bnbt":
|
|
127479
|
-
return "https:/\/api-testnet.bscscan.com";
|
|
127480
|
-
case "matic":
|
|
127481
|
-
return "https:/\/api.polygonscan.com";
|
|
127482
|
-
case "matic-amoy":
|
|
127483
|
-
return "https:/\/api-amoy.polygonscan.com";
|
|
127484
|
-
case "matic-mumbai":
|
|
127485
|
-
return "https:/\/api-testnet.polygonscan.com";
|
|
127486
|
-
case "optimism":
|
|
127487
|
-
return "https:/\/api-optimistic.etherscan.io";
|
|
127488
|
-
case "optimism-goerli":
|
|
127489
|
-
return "https:/\/api-goerli-optimistic.etherscan.io";
|
|
127490
|
-
default:
|
|
127491
|
-
}
|
|
127492
|
-
assertArgument(false, "unsupported network", "network", this.network);
|
|
127493
|
-
}
|
|
127494
|
-
/**
|
|
127495
|
-
* Returns the URL for the %%module%% and %%params%%.
|
|
127496
|
-
*/
|
|
127497
|
-
getUrl(module, params) {
|
|
127498
|
-
let query = Object.keys(params).reduce((accum, key) => {
|
|
127499
|
-
const value = params[key];
|
|
127500
|
-
if (value != null) {
|
|
127501
|
-
accum += `&${key}=${value}`;
|
|
127502
|
-
}
|
|
127503
|
-
return accum;
|
|
127504
|
-
}, "");
|
|
127505
|
-
if (this.apiKey) {
|
|
127506
|
-
query += `&apikey=${this.apiKey}`;
|
|
127507
|
-
}
|
|
127508
|
-
return `https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}&module=${module}${query}`;
|
|
127509
|
-
}
|
|
127510
|
-
/**
|
|
127511
|
-
* Returns the URL for using POST requests.
|
|
127512
|
-
*/
|
|
127513
|
-
getPostUrl() {
|
|
127514
|
-
return `https:/\/api.etherscan.io/v2/api?chainid=${this.network.chainId}`;
|
|
127515
|
-
}
|
|
127516
|
-
/**
|
|
127517
|
-
* Returns the parameters for using POST requests.
|
|
127518
|
-
*/
|
|
127519
|
-
getPostData(module, params) {
|
|
127520
|
-
params.module = module;
|
|
127521
|
-
params.apikey = this.apiKey;
|
|
127522
|
-
params.chainid = this.network.chainId;
|
|
127523
|
-
return params;
|
|
127524
|
-
}
|
|
127525
|
-
async detectNetwork() {
|
|
127526
|
-
return this.network;
|
|
127527
|
-
}
|
|
127528
|
-
/**
|
|
127529
|
-
* Resolves to the result of calling %%module%% with %%params%%.
|
|
127530
|
-
*
|
|
127531
|
-
* If %%post%%, the request is made as a POST request.
|
|
127532
|
-
*/
|
|
127533
|
-
async fetch(module, params, post) {
|
|
127534
|
-
const id = nextId++;
|
|
127535
|
-
const url = (post ? this.getPostUrl() : this.getUrl(module, params));
|
|
127536
|
-
const payload = (post ? this.getPostData(module, params) : null);
|
|
127537
|
-
this.emit("debug", { action: "sendRequest", id, url, payload: payload });
|
|
127538
|
-
const request = new FetchRequest(url);
|
|
127539
|
-
request.setThrottleParams({ slotInterval: 1000 });
|
|
127540
|
-
request.retryFunc = (req, resp, attempt) => {
|
|
127541
|
-
if (this.isCommunityResource()) {
|
|
127542
|
-
showThrottleMessage("Etherscan");
|
|
127543
|
-
}
|
|
127544
|
-
return Promise.resolve(true);
|
|
127545
|
-
};
|
|
127546
|
-
request.processFunc = async (request, response) => {
|
|
127547
|
-
const result = response.hasBody() ? JSON.parse(toUtf8String(response.body)) : {};
|
|
127548
|
-
const throttle = ((typeof (result.result) === "string") ? result.result : "").toLowerCase().indexOf("rate limit") >= 0;
|
|
127549
|
-
if (module === "proxy") {
|
|
127550
|
-
// This JSON response indicates we are being throttled
|
|
127551
|
-
if (result && result.status == 0 && result.message == "NOTOK" && throttle) {
|
|
127552
|
-
this.emit("debug", { action: "receiveError", id, reason: "proxy-NOTOK", error: result });
|
|
127553
|
-
response.throwThrottleError(result.result, THROTTLE);
|
|
127554
|
-
}
|
|
127555
|
-
}
|
|
127556
|
-
else {
|
|
127557
|
-
if (throttle) {
|
|
127558
|
-
this.emit("debug", { action: "receiveError", id, reason: "null result", error: result.result });
|
|
127559
|
-
response.throwThrottleError(result.result, THROTTLE);
|
|
127560
|
-
}
|
|
127561
|
-
}
|
|
127562
|
-
return response;
|
|
127563
|
-
};
|
|
127564
|
-
if (payload) {
|
|
127565
|
-
request.setHeader("content-type", "application/x-www-form-urlencoded; charset=UTF-8");
|
|
127566
|
-
request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join("&");
|
|
127567
|
-
}
|
|
127568
|
-
const response = await request.send();
|
|
127569
|
-
try {
|
|
127570
|
-
response.assertOk();
|
|
127571
|
-
}
|
|
127572
|
-
catch (error) {
|
|
127573
|
-
this.emit("debug", { action: "receiveError", id, error, reason: "assertOk" });
|
|
127574
|
-
assert(false, "response error", "SERVER_ERROR", { request, response });
|
|
127575
|
-
}
|
|
127576
|
-
if (!response.hasBody()) {
|
|
127577
|
-
this.emit("debug", { action: "receiveError", id, error: "missing body", reason: "null body" });
|
|
127578
|
-
assert(false, "missing response", "SERVER_ERROR", { request, response });
|
|
127579
|
-
}
|
|
127580
|
-
const result = JSON.parse(toUtf8String(response.body));
|
|
127581
|
-
if (module === "proxy") {
|
|
127582
|
-
if (result.jsonrpc != "2.0") {
|
|
127583
|
-
this.emit("debug", { action: "receiveError", id, result, reason: "invalid JSON-RPC" });
|
|
127584
|
-
assert(false, "invalid JSON-RPC response (missing jsonrpc='2.0')", "SERVER_ERROR", { request, response, info: { result } });
|
|
127585
|
-
}
|
|
127586
|
-
if (result.error) {
|
|
127587
|
-
this.emit("debug", { action: "receiveError", id, result, reason: "JSON-RPC error" });
|
|
127588
|
-
assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } });
|
|
127589
|
-
}
|
|
127590
|
-
this.emit("debug", { action: "receiveRequest", id, result });
|
|
127591
|
-
return result.result;
|
|
127592
|
-
}
|
|
127593
|
-
else {
|
|
127594
|
-
// getLogs, getHistory have weird success responses
|
|
127595
|
-
if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) {
|
|
127596
|
-
this.emit("debug", { action: "receiveRequest", id, result });
|
|
127597
|
-
return result.result;
|
|
127598
|
-
}
|
|
127599
|
-
if (result.status != 1 || (typeof (result.message) === "string" && !result.message.match(/^OK/))) {
|
|
127600
|
-
this.emit("debug", { action: "receiveError", id, result });
|
|
127601
|
-
assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } });
|
|
127602
|
-
}
|
|
127603
|
-
this.emit("debug", { action: "receiveRequest", id, result });
|
|
127604
|
-
return result.result;
|
|
127605
|
-
}
|
|
127606
|
-
}
|
|
127607
|
-
/**
|
|
127608
|
-
* Returns %%transaction%% normalized for the Etherscan API.
|
|
127609
|
-
*/
|
|
127610
|
-
_getTransactionPostData(transaction) {
|
|
127611
|
-
const result = {};
|
|
127612
|
-
for (let key in transaction) {
|
|
127613
|
-
if (skipKeys.indexOf(key) >= 0) {
|
|
127614
|
-
continue;
|
|
127615
|
-
}
|
|
127616
|
-
if (transaction[key] == null) {
|
|
127617
|
-
continue;
|
|
127618
|
-
}
|
|
127619
|
-
let value = transaction[key];
|
|
127620
|
-
if (key === "type" && value === 0) {
|
|
127621
|
-
continue;
|
|
127622
|
-
}
|
|
127623
|
-
if (key === "blockTag" && value === "latest") {
|
|
127624
|
-
continue;
|
|
127625
|
-
}
|
|
127626
|
-
// Quantity-types require no leading zero, unless 0
|
|
127627
|
-
if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) {
|
|
127628
|
-
value = toQuantity(value);
|
|
127629
|
-
}
|
|
127630
|
-
else if (key === "accessList") {
|
|
127631
|
-
value = "[" + accessListify(value).map((set) => {
|
|
127632
|
-
return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`;
|
|
127633
|
-
}).join(",") + "]";
|
|
127634
|
-
}
|
|
127635
|
-
else if (key === "blobVersionedHashes") {
|
|
127636
|
-
if (value.length === 0) {
|
|
127637
|
-
continue;
|
|
127638
|
-
}
|
|
127639
|
-
// @TODO: update this once the API supports blobs
|
|
127640
|
-
assert(false, "Etherscan API does not support blobVersionedHashes", "UNSUPPORTED_OPERATION", {
|
|
127641
|
-
operation: "_getTransactionPostData",
|
|
127642
|
-
info: { transaction }
|
|
127643
|
-
});
|
|
127644
|
-
}
|
|
127645
|
-
else {
|
|
127646
|
-
value = hexlify(value);
|
|
127647
|
-
}
|
|
127648
|
-
result[key] = value;
|
|
127649
|
-
}
|
|
127650
|
-
return result;
|
|
127651
|
-
}
|
|
127652
|
-
/**
|
|
127653
|
-
* Throws the normalized Etherscan error.
|
|
127654
|
-
*/
|
|
127655
|
-
_checkError(req, error, transaction) {
|
|
127656
|
-
// Pull any message out if, possible
|
|
127657
|
-
let message = "";
|
|
127658
|
-
if (isError(error, "SERVER_ERROR")) {
|
|
127659
|
-
// Check for an error emitted by a proxy call
|
|
127660
|
-
try {
|
|
127661
|
-
message = error.info.result.error.message;
|
|
127662
|
-
}
|
|
127663
|
-
catch (e) { }
|
|
127664
|
-
if (!message) {
|
|
127665
|
-
try {
|
|
127666
|
-
message = error.info.message;
|
|
127667
|
-
}
|
|
127668
|
-
catch (e) { }
|
|
127669
|
-
}
|
|
127670
|
-
}
|
|
127671
|
-
if (req.method === "estimateGas") {
|
|
127672
|
-
if (!message.match(/revert/i) && message.match(/insufficient funds/i)) {
|
|
127673
|
-
assert(false, "insufficient funds", "INSUFFICIENT_FUNDS", {
|
|
127674
|
-
transaction: req.transaction
|
|
127675
|
-
});
|
|
127676
|
-
}
|
|
127677
|
-
}
|
|
127678
|
-
if (req.method === "call" || req.method === "estimateGas") {
|
|
127679
|
-
if (message.match(/execution reverted/i)) {
|
|
127680
|
-
let data = "";
|
|
127681
|
-
try {
|
|
127682
|
-
data = error.info.result.error.data;
|
|
127683
|
-
}
|
|
127684
|
-
catch (error) { }
|
|
127685
|
-
const e = AbiCoder.getBuiltinCallException(req.method, req.transaction, data);
|
|
127686
|
-
e.info = { request: req, error };
|
|
127687
|
-
throw e;
|
|
127688
|
-
}
|
|
127689
|
-
}
|
|
127690
|
-
if (message) {
|
|
127691
|
-
if (req.method === "broadcastTransaction") {
|
|
127692
|
-
const transaction = Transaction.from(req.signedTransaction);
|
|
127693
|
-
if (message.match(/replacement/i) && message.match(/underpriced/i)) {
|
|
127694
|
-
assert(false, "replacement fee too low", "REPLACEMENT_UNDERPRICED", {
|
|
127695
|
-
transaction
|
|
127696
|
-
});
|
|
127697
|
-
}
|
|
127698
|
-
if (message.match(/insufficient funds/)) {
|
|
127699
|
-
assert(false, "insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", {
|
|
127700
|
-
transaction
|
|
127701
|
-
});
|
|
127702
|
-
}
|
|
127703
|
-
if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) {
|
|
127704
|
-
assert(false, "nonce has already been used", "NONCE_EXPIRED", {
|
|
127705
|
-
transaction
|
|
127706
|
-
});
|
|
127707
|
-
}
|
|
127708
|
-
}
|
|
127709
|
-
}
|
|
127710
|
-
// Something we could not process
|
|
127711
|
-
throw error;
|
|
127712
|
-
}
|
|
127713
|
-
async _detectNetwork() {
|
|
127714
|
-
return this.network;
|
|
127715
|
-
}
|
|
127716
|
-
async _perform(req) {
|
|
127717
|
-
switch (req.method) {
|
|
127718
|
-
case "chainId":
|
|
127719
|
-
return this.network.chainId;
|
|
127720
|
-
case "getBlockNumber":
|
|
127721
|
-
return this.fetch("proxy", { action: "eth_blockNumber" });
|
|
127722
|
-
case "getGasPrice":
|
|
127723
|
-
return this.fetch("proxy", { action: "eth_gasPrice" });
|
|
127724
|
-
case "getPriorityFee":
|
|
127725
|
-
// This is temporary until Etherscan completes support
|
|
127726
|
-
if (this.network.name === "mainnet") {
|
|
127727
|
-
return "1000000000";
|
|
127728
|
-
}
|
|
127729
|
-
else if (this.network.name === "optimism") {
|
|
127730
|
-
return "1000000";
|
|
127731
|
-
}
|
|
127732
|
-
else {
|
|
127733
|
-
throw new Error("fallback onto the AbstractProvider default");
|
|
127734
|
-
}
|
|
127735
|
-
/* Working with Etherscan to get this added:
|
|
127736
|
-
try {
|
|
127737
|
-
const test = await this.fetch("proxy", {
|
|
127738
|
-
action: "eth_maxPriorityFeePerGas"
|
|
127739
|
-
});
|
|
127740
|
-
console.log(test);
|
|
127741
|
-
return test;
|
|
127742
|
-
} catch (e) {
|
|
127743
|
-
console.log("DEBUG", e);
|
|
127744
|
-
throw e;
|
|
127745
|
-
}
|
|
127746
|
-
*/
|
|
127747
|
-
/* This might be safe; but due to rounding neither myself
|
|
127748
|
-
or Etherscan are necessarily comfortable with this. :)
|
|
127749
|
-
try {
|
|
127750
|
-
const result = await this.fetch("gastracker", { action: "gasoracle" });
|
|
127751
|
-
console.log(result);
|
|
127752
|
-
const gasPrice = parseUnits(result.SafeGasPrice, "gwei");
|
|
127753
|
-
const baseFee = parseUnits(result.suggestBaseFee, "gwei");
|
|
127754
|
-
const priorityFee = gasPrice - baseFee;
|
|
127755
|
-
if (priorityFee < 0) { throw new Error("negative priority fee; defer to abstract provider default"); }
|
|
127756
|
-
return priorityFee;
|
|
127757
|
-
} catch (error) {
|
|
127758
|
-
console.log("DEBUG", error);
|
|
127759
|
-
throw error;
|
|
127760
|
-
}
|
|
127761
|
-
*/
|
|
127762
|
-
case "getBalance":
|
|
127763
|
-
// Returns base-10 result
|
|
127764
|
-
return this.fetch("account", {
|
|
127765
|
-
action: "balance",
|
|
127766
|
-
address: req.address,
|
|
127767
|
-
tag: req.blockTag
|
|
127768
|
-
});
|
|
127769
|
-
case "getTransactionCount":
|
|
127770
|
-
return this.fetch("proxy", {
|
|
127771
|
-
action: "eth_getTransactionCount",
|
|
127772
|
-
address: req.address,
|
|
127773
|
-
tag: req.blockTag
|
|
127774
|
-
});
|
|
127775
|
-
case "getCode":
|
|
127776
|
-
return this.fetch("proxy", {
|
|
127777
|
-
action: "eth_getCode",
|
|
127778
|
-
address: req.address,
|
|
127779
|
-
tag: req.blockTag
|
|
127780
|
-
});
|
|
127781
|
-
case "getStorage":
|
|
127782
|
-
return this.fetch("proxy", {
|
|
127783
|
-
action: "eth_getStorageAt",
|
|
127784
|
-
address: req.address,
|
|
127785
|
-
position: req.position,
|
|
127786
|
-
tag: req.blockTag
|
|
127787
|
-
});
|
|
127788
|
-
case "broadcastTransaction":
|
|
127789
|
-
return this.fetch("proxy", {
|
|
127790
|
-
action: "eth_sendRawTransaction",
|
|
127791
|
-
hex: req.signedTransaction
|
|
127792
|
-
}, true).catch((error) => {
|
|
127793
|
-
return this._checkError(req, error, req.signedTransaction);
|
|
127794
|
-
});
|
|
127795
|
-
case "getBlock":
|
|
127796
|
-
if ("blockTag" in req) {
|
|
127797
|
-
return this.fetch("proxy", {
|
|
127798
|
-
action: "eth_getBlockByNumber",
|
|
127799
|
-
tag: req.blockTag,
|
|
127800
|
-
boolean: (req.includeTransactions ? "true" : "false")
|
|
127801
|
-
});
|
|
127802
|
-
}
|
|
127803
|
-
assert(false, "getBlock by blockHash not supported by Etherscan", "UNSUPPORTED_OPERATION", {
|
|
127804
|
-
operation: "getBlock(blockHash)"
|
|
127805
|
-
});
|
|
127806
|
-
case "getTransaction":
|
|
127807
|
-
return this.fetch("proxy", {
|
|
127808
|
-
action: "eth_getTransactionByHash",
|
|
127809
|
-
txhash: req.hash
|
|
127810
|
-
});
|
|
127811
|
-
case "getTransactionReceipt":
|
|
127812
|
-
return this.fetch("proxy", {
|
|
127813
|
-
action: "eth_getTransactionReceipt",
|
|
127814
|
-
txhash: req.hash
|
|
127815
|
-
});
|
|
127816
|
-
case "call": {
|
|
127817
|
-
if (req.blockTag !== "latest") {
|
|
127818
|
-
throw new Error("EtherscanProvider does not support blockTag for call");
|
|
127819
|
-
}
|
|
127820
|
-
const postData = this._getTransactionPostData(req.transaction);
|
|
127821
|
-
postData.module = "proxy";
|
|
127822
|
-
postData.action = "eth_call";
|
|
127823
|
-
try {
|
|
127824
|
-
return await this.fetch("proxy", postData, true);
|
|
127825
|
-
}
|
|
127826
|
-
catch (error) {
|
|
127827
|
-
return this._checkError(req, error, req.transaction);
|
|
127828
|
-
}
|
|
127829
|
-
}
|
|
127830
|
-
case "estimateGas": {
|
|
127831
|
-
const postData = this._getTransactionPostData(req.transaction);
|
|
127832
|
-
postData.module = "proxy";
|
|
127833
|
-
postData.action = "eth_estimateGas";
|
|
127834
|
-
try {
|
|
127835
|
-
return await this.fetch("proxy", postData, true);
|
|
127836
|
-
}
|
|
127837
|
-
catch (error) {
|
|
127838
|
-
return this._checkError(req, error, req.transaction);
|
|
127839
|
-
}
|
|
127840
|
-
}
|
|
127841
|
-
/*
|
|
127842
|
-
case "getLogs": {
|
|
127843
|
-
// Needs to complain if more than one address is passed in
|
|
127844
|
-
const args: Record<string, any> = { action: "getLogs" }
|
|
127845
|
-
|
|
127846
|
-
if (params.filter.fromBlock) {
|
|
127847
|
-
args.fromBlock = checkLogTag(params.filter.fromBlock);
|
|
127848
|
-
}
|
|
127849
|
-
|
|
127850
|
-
if (params.filter.toBlock) {
|
|
127851
|
-
args.toBlock = checkLogTag(params.filter.toBlock);
|
|
127852
|
-
}
|
|
127853
|
-
|
|
127854
|
-
if (params.filter.address) {
|
|
127855
|
-
args.address = params.filter.address;
|
|
127856
|
-
}
|
|
127857
|
-
|
|
127858
|
-
// @TODO: We can handle slightly more complicated logs using the logs API
|
|
127859
|
-
if (params.filter.topics && params.filter.topics.length > 0) {
|
|
127860
|
-
if (params.filter.topics.length > 1) {
|
|
127861
|
-
logger.throwError("unsupported topic count", Logger.Errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics });
|
|
127862
|
-
}
|
|
127863
|
-
if (params.filter.topics.length === 1) {
|
|
127864
|
-
const topic0 = params.filter.topics[0];
|
|
127865
|
-
if (typeof(topic0) !== "string" || topic0.length !== 66) {
|
|
127866
|
-
logger.throwError("unsupported topic format", Logger.Errors.UNSUPPORTED_OPERATION, { topic0: topic0 });
|
|
127867
|
-
}
|
|
127868
|
-
args.topic0 = topic0;
|
|
127869
|
-
}
|
|
127870
|
-
}
|
|
127871
|
-
|
|
127872
|
-
const logs: Array<any> = await this.fetch("logs", args);
|
|
127873
|
-
|
|
127874
|
-
// Cache txHash => blockHash
|
|
127875
|
-
let blocks: { [tag: string]: string } = {};
|
|
127876
|
-
|
|
127877
|
-
// Add any missing blockHash to the logs
|
|
127878
|
-
for (let i = 0; i < logs.length; i++) {
|
|
127879
|
-
const log = logs[i];
|
|
127880
|
-
if (log.blockHash != null) { continue; }
|
|
127881
|
-
if (blocks[log.blockNumber] == null) {
|
|
127882
|
-
const block = await this.getBlock(log.blockNumber);
|
|
127883
|
-
if (block) {
|
|
127884
|
-
blocks[log.blockNumber] = block.hash;
|
|
127885
|
-
}
|
|
127886
|
-
}
|
|
127887
|
-
|
|
127888
|
-
log.blockHash = blocks[log.blockNumber];
|
|
127889
|
-
}
|
|
127890
|
-
|
|
127891
|
-
return logs;
|
|
127892
|
-
}
|
|
127893
|
-
*/
|
|
127894
|
-
default:
|
|
127895
|
-
break;
|
|
127896
|
-
}
|
|
127897
|
-
return super._perform(req);
|
|
127898
|
-
}
|
|
127899
|
-
async getNetwork() {
|
|
127900
|
-
return this.network;
|
|
127901
|
-
}
|
|
127902
|
-
/**
|
|
127903
|
-
* Resolves to the current price of ether.
|
|
127904
|
-
*
|
|
127905
|
-
* This returns ``0`` on any network other than ``mainnet``.
|
|
127906
|
-
*/
|
|
127907
|
-
async getEtherPrice() {
|
|
127908
|
-
if (this.network.name !== "mainnet") {
|
|
127909
|
-
return 0.0;
|
|
127910
|
-
}
|
|
127911
|
-
return parseFloat((await this.fetch("stats", { action: "ethprice" })).ethusd);
|
|
127912
|
-
}
|
|
127913
|
-
/**
|
|
127914
|
-
* Resolves to a [Contract]] for %%address%%, using the
|
|
127915
|
-
* Etherscan API to retreive the Contract ABI.
|
|
127916
|
-
*/
|
|
127917
|
-
async getContract(_address) {
|
|
127918
|
-
let address = this._getAddress(_address);
|
|
127919
|
-
if (provider_etherscan_isPromise(address)) {
|
|
127920
|
-
address = await address;
|
|
127921
|
-
}
|
|
127922
|
-
try {
|
|
127923
|
-
const resp = await this.fetch("contract", {
|
|
127924
|
-
action: "getabi", address
|
|
127925
|
-
});
|
|
127926
|
-
const abi = JSON.parse(resp);
|
|
127927
|
-
return new Contract(address, abi, this);
|
|
127928
|
-
}
|
|
127929
|
-
catch (error) {
|
|
127930
|
-
return null;
|
|
127931
|
-
}
|
|
127932
|
-
}
|
|
127933
|
-
isCommunityResource() {
|
|
127934
|
-
return (this.apiKey == null);
|
|
127935
|
-
}
|
|
127936
|
-
}
|
|
127937
|
-
//# sourceMappingURL=provider-etherscan.js.map
|
|
127938
|
-
;// ./node_modules/ethers/lib.esm/providers/ws-browser.js
|
|
127939
|
-
function ws_browser_getGlobal() {
|
|
127940
|
-
if (typeof self !== 'undefined') {
|
|
127941
|
-
return self;
|
|
127942
|
-
}
|
|
127943
|
-
if (true) {
|
|
127944
|
-
return window;
|
|
127945
|
-
}
|
|
127946
|
-
// removed by dead control flow
|
|
127947
|
-
|
|
127948
|
-
// removed by dead control flow
|
|
127949
|
-
|
|
127950
|
-
}
|
|
127951
|
-
;
|
|
127952
|
-
const ws_browser_WebSocket = ws_browser_getGlobal().WebSocket;
|
|
127953
|
-
|
|
127954
|
-
//# sourceMappingURL=ws-browser.js.map
|
|
127955
|
-
;// ./node_modules/ethers/lib.esm/providers/provider-socket.js
|
|
127956
|
-
/**
|
|
127957
|
-
* Generic long-lived socket provider.
|
|
127958
|
-
*
|
|
127959
|
-
* Sub-classing notes
|
|
127960
|
-
* - a sub-class MUST call the `_start()` method once connected
|
|
127961
|
-
* - a sub-class MUST override the `_write(string)` method
|
|
127962
|
-
* - a sub-class MUST call `_processMessage(string)` for each message
|
|
127963
|
-
*
|
|
127964
|
-
* @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider]
|
|
127965
|
-
*/
|
|
127966
|
-
|
|
127967
|
-
|
|
127968
|
-
|
|
127969
|
-
/**
|
|
127970
|
-
* A **SocketSubscriber** uses a socket transport to handle events and
|
|
127971
|
-
* should use [[_emit]] to manage the events.
|
|
127972
|
-
*/
|
|
127973
|
-
class SocketSubscriber {
|
|
127974
|
-
#provider;
|
|
127975
|
-
#filter;
|
|
127976
|
-
/**
|
|
127977
|
-
* The filter.
|
|
127978
|
-
*/
|
|
127979
|
-
get filter() { return JSON.parse(this.#filter); }
|
|
127980
|
-
#filterId;
|
|
127981
|
-
#paused;
|
|
127982
|
-
#emitPromise;
|
|
127983
|
-
/**
|
|
127984
|
-
* Creates a new **SocketSubscriber** attached to %%provider%% listening
|
|
127985
|
-
* to %%filter%%.
|
|
127986
|
-
*/
|
|
127987
|
-
constructor(provider, filter) {
|
|
127988
|
-
this.#provider = provider;
|
|
127989
|
-
this.#filter = JSON.stringify(filter);
|
|
127990
|
-
this.#filterId = null;
|
|
127991
|
-
this.#paused = null;
|
|
127992
|
-
this.#emitPromise = null;
|
|
127993
|
-
}
|
|
127994
|
-
start() {
|
|
127995
|
-
this.#filterId = this.#provider.send("eth_subscribe", this.filter).then((filterId) => {
|
|
127996
|
-
;
|
|
127997
|
-
this.#provider._register(filterId, this);
|
|
127998
|
-
return filterId;
|
|
127999
|
-
});
|
|
128000
|
-
}
|
|
128001
|
-
stop() {
|
|
128002
|
-
(this.#filterId).then((filterId) => {
|
|
128003
|
-
if (this.#provider.destroyed) {
|
|
128004
|
-
return;
|
|
128005
|
-
}
|
|
128006
|
-
this.#provider.send("eth_unsubscribe", [filterId]);
|
|
128007
|
-
});
|
|
128008
|
-
this.#filterId = null;
|
|
128009
|
-
}
|
|
128010
|
-
// @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs
|
|
128011
|
-
// and resume
|
|
128012
|
-
pause(dropWhilePaused) {
|
|
128013
|
-
assert(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", "UNSUPPORTED_OPERATION", { operation: "pause(false)" });
|
|
128014
|
-
this.#paused = !!dropWhilePaused;
|
|
128015
|
-
}
|
|
128016
|
-
resume() {
|
|
128017
|
-
this.#paused = null;
|
|
128018
|
-
}
|
|
128019
|
-
/**
|
|
128020
|
-
* @_ignore:
|
|
128021
|
-
*/
|
|
128022
|
-
_handleMessage(message) {
|
|
128023
|
-
if (this.#filterId == null) {
|
|
128024
|
-
return;
|
|
128025
|
-
}
|
|
128026
|
-
if (this.#paused === null) {
|
|
128027
|
-
let emitPromise = this.#emitPromise;
|
|
128028
|
-
if (emitPromise == null) {
|
|
128029
|
-
emitPromise = this._emit(this.#provider, message);
|
|
128030
|
-
}
|
|
128031
|
-
else {
|
|
128032
|
-
emitPromise = emitPromise.then(async () => {
|
|
128033
|
-
await this._emit(this.#provider, message);
|
|
128034
|
-
});
|
|
128035
|
-
}
|
|
128036
|
-
this.#emitPromise = emitPromise.then(() => {
|
|
128037
|
-
if (this.#emitPromise === emitPromise) {
|
|
128038
|
-
this.#emitPromise = null;
|
|
128039
|
-
}
|
|
128040
|
-
});
|
|
128041
|
-
}
|
|
128042
|
-
}
|
|
128043
|
-
/**
|
|
128044
|
-
* Sub-classes **must** override this to emit the events on the
|
|
128045
|
-
* provider.
|
|
128046
|
-
*/
|
|
128047
|
-
async _emit(provider, message) {
|
|
128048
|
-
throw new Error("sub-classes must implemente this; _emit");
|
|
128049
|
-
}
|
|
128050
|
-
}
|
|
128051
|
-
/**
|
|
128052
|
-
* A **SocketBlockSubscriber** listens for ``newHeads`` events and emits
|
|
128053
|
-
* ``"block"`` events.
|
|
128054
|
-
*/
|
|
128055
|
-
class SocketBlockSubscriber extends SocketSubscriber {
|
|
128056
|
-
/**
|
|
128057
|
-
* @_ignore:
|
|
128058
|
-
*/
|
|
128059
|
-
constructor(provider) {
|
|
128060
|
-
super(provider, ["newHeads"]);
|
|
128061
|
-
}
|
|
128062
|
-
async _emit(provider, message) {
|
|
128063
|
-
provider.emit("block", parseInt(message.number));
|
|
128064
|
-
}
|
|
128065
|
-
}
|
|
128066
|
-
/**
|
|
128067
|
-
* A **SocketPendingSubscriber** listens for pending transacitons and emits
|
|
128068
|
-
* ``"pending"`` events.
|
|
128069
|
-
*/
|
|
128070
|
-
class SocketPendingSubscriber extends SocketSubscriber {
|
|
128071
|
-
/**
|
|
128072
|
-
* @_ignore:
|
|
128073
|
-
*/
|
|
128074
|
-
constructor(provider) {
|
|
128075
|
-
super(provider, ["newPendingTransactions"]);
|
|
128076
|
-
}
|
|
128077
|
-
async _emit(provider, message) {
|
|
128078
|
-
provider.emit("pending", message);
|
|
128079
|
-
}
|
|
128080
|
-
}
|
|
128081
|
-
/**
|
|
128082
|
-
* A **SocketEventSubscriber** listens for event logs.
|
|
128083
|
-
*/
|
|
128084
|
-
class SocketEventSubscriber extends SocketSubscriber {
|
|
128085
|
-
#logFilter;
|
|
128086
|
-
/**
|
|
128087
|
-
* The filter.
|
|
128088
|
-
*/
|
|
128089
|
-
get logFilter() { return JSON.parse(this.#logFilter); }
|
|
128090
|
-
/**
|
|
128091
|
-
* @_ignore:
|
|
128092
|
-
*/
|
|
128093
|
-
constructor(provider, filter) {
|
|
128094
|
-
super(provider, ["logs", filter]);
|
|
128095
|
-
this.#logFilter = JSON.stringify(filter);
|
|
128096
|
-
}
|
|
128097
|
-
async _emit(provider, message) {
|
|
128098
|
-
provider.emit(this.logFilter, provider._wrapLog(message, provider._network));
|
|
128099
|
-
}
|
|
128100
|
-
}
|
|
128101
|
-
/**
|
|
128102
|
-
* A **SocketProvider** is backed by a long-lived connection over a
|
|
128103
|
-
* socket, which can subscribe and receive real-time messages over
|
|
128104
|
-
* its communication channel.
|
|
128105
|
-
*/
|
|
128106
|
-
class SocketProvider extends JsonRpcApiProvider {
|
|
128107
|
-
#callbacks;
|
|
128108
|
-
// Maps each filterId to its subscriber
|
|
128109
|
-
#subs;
|
|
128110
|
-
// If any events come in before a subscriber has finished
|
|
128111
|
-
// registering, queue them
|
|
128112
|
-
#pending;
|
|
128113
|
-
/**
|
|
128114
|
-
* Creates a new **SocketProvider** connected to %%network%%.
|
|
128115
|
-
*
|
|
128116
|
-
* If unspecified, the network will be discovered.
|
|
128117
|
-
*/
|
|
128118
|
-
constructor(network, _options) {
|
|
128119
|
-
// Copy the options
|
|
128120
|
-
const options = Object.assign({}, (_options != null) ? _options : {});
|
|
128121
|
-
// Support for batches is generally not supported for
|
|
128122
|
-
// connection-base providers; if this changes in the future
|
|
128123
|
-
// the _send should be updated to reflect this
|
|
128124
|
-
assertArgument(options.batchMaxCount == null || options.batchMaxCount === 1, "sockets-based providers do not support batches", "options.batchMaxCount", _options);
|
|
128125
|
-
options.batchMaxCount = 1;
|
|
128126
|
-
// Socket-based Providers (generally) cannot change their network,
|
|
128127
|
-
// since they have a long-lived connection; but let people override
|
|
128128
|
-
// this if they have just cause.
|
|
128129
|
-
if (options.staticNetwork == null) {
|
|
128130
|
-
options.staticNetwork = true;
|
|
128131
|
-
}
|
|
128132
|
-
super(network, options);
|
|
128133
|
-
this.#callbacks = new Map();
|
|
128134
|
-
this.#subs = new Map();
|
|
128135
|
-
this.#pending = new Map();
|
|
128136
|
-
}
|
|
128137
|
-
// This value is only valid after _start has been called
|
|
128138
|
-
/*
|
|
128139
|
-
get _network(): Network {
|
|
128140
|
-
if (this.#network == null) {
|
|
128141
|
-
throw new Error("this shouldn't happen");
|
|
128142
|
-
}
|
|
128143
|
-
return this.#network.clone();
|
|
128144
|
-
}
|
|
128145
|
-
*/
|
|
128146
|
-
_getSubscriber(sub) {
|
|
128147
|
-
switch (sub.type) {
|
|
128148
|
-
case "close":
|
|
128149
|
-
return new UnmanagedSubscriber("close");
|
|
128150
|
-
case "block":
|
|
128151
|
-
return new SocketBlockSubscriber(this);
|
|
128152
|
-
case "pending":
|
|
128153
|
-
return new SocketPendingSubscriber(this);
|
|
128154
|
-
case "event":
|
|
128155
|
-
return new SocketEventSubscriber(this, sub.filter);
|
|
128156
|
-
case "orphan":
|
|
128157
|
-
// Handled auto-matically within AbstractProvider
|
|
128158
|
-
// when the log.removed = true
|
|
128159
|
-
if (sub.filter.orphan === "drop-log") {
|
|
128160
|
-
return new UnmanagedSubscriber("drop-log");
|
|
128161
|
-
}
|
|
128162
|
-
}
|
|
128163
|
-
return super._getSubscriber(sub);
|
|
128164
|
-
}
|
|
128165
|
-
/**
|
|
128166
|
-
* Register a new subscriber. This is used internalled by Subscribers
|
|
128167
|
-
* and generally is unecessary unless extending capabilities.
|
|
128168
|
-
*/
|
|
128169
|
-
_register(filterId, subscriber) {
|
|
128170
|
-
this.#subs.set(filterId, subscriber);
|
|
128171
|
-
const pending = this.#pending.get(filterId);
|
|
128172
|
-
if (pending) {
|
|
128173
|
-
for (const message of pending) {
|
|
128174
|
-
subscriber._handleMessage(message);
|
|
128175
|
-
}
|
|
128176
|
-
this.#pending.delete(filterId);
|
|
128177
|
-
}
|
|
128178
|
-
}
|
|
128179
|
-
async _send(payload) {
|
|
128180
|
-
// WebSocket provider doesn't accept batches
|
|
128181
|
-
assertArgument(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload);
|
|
128182
|
-
// @TODO: stringify payloads here and store to prevent mutations
|
|
128183
|
-
// Prepare a promise to respond to
|
|
128184
|
-
const promise = new Promise((resolve, reject) => {
|
|
128185
|
-
this.#callbacks.set(payload.id, { payload, resolve, reject });
|
|
128186
|
-
});
|
|
128187
|
-
// Wait until the socket is connected before writing to it
|
|
128188
|
-
await this._waitUntilReady();
|
|
128189
|
-
// Write the request to the socket
|
|
128190
|
-
await this._write(JSON.stringify(payload));
|
|
128191
|
-
return [await promise];
|
|
128192
|
-
}
|
|
128193
|
-
// Sub-classes must call this once they are connected
|
|
128194
|
-
/*
|
|
128195
|
-
async _start(): Promise<void> {
|
|
128196
|
-
if (this.#ready) { return; }
|
|
128197
|
-
|
|
128198
|
-
for (const { payload } of this.#callbacks.values()) {
|
|
128199
|
-
await this._write(JSON.stringify(payload));
|
|
128200
|
-
}
|
|
128201
|
-
|
|
128202
|
-
this.#ready = (async function() {
|
|
128203
|
-
await super._start();
|
|
128204
|
-
})();
|
|
128205
|
-
}
|
|
128206
|
-
*/
|
|
128207
|
-
/**
|
|
128208
|
-
* Sub-classes **must** call this with messages received over their
|
|
128209
|
-
* transport to be processed and dispatched.
|
|
128210
|
-
*/
|
|
128211
|
-
async _processMessage(message) {
|
|
128212
|
-
const result = (JSON.parse(message));
|
|
128213
|
-
if (result && typeof (result) === "object" && "id" in result) {
|
|
128214
|
-
const callback = this.#callbacks.get(result.id);
|
|
128215
|
-
if (callback == null) {
|
|
128216
|
-
this.emit("error", makeError("received result for unknown id", "UNKNOWN_ERROR", {
|
|
128217
|
-
reasonCode: "UNKNOWN_ID",
|
|
128218
|
-
result
|
|
128219
|
-
}));
|
|
128220
|
-
return;
|
|
128221
|
-
}
|
|
128222
|
-
this.#callbacks.delete(result.id);
|
|
128223
|
-
callback.resolve(result);
|
|
128224
|
-
}
|
|
128225
|
-
else if (result && result.method === "eth_subscription") {
|
|
128226
|
-
const filterId = result.params.subscription;
|
|
128227
|
-
const subscriber = this.#subs.get(filterId);
|
|
128228
|
-
if (subscriber) {
|
|
128229
|
-
subscriber._handleMessage(result.params.result);
|
|
128230
|
-
}
|
|
128231
|
-
else {
|
|
128232
|
-
let pending = this.#pending.get(filterId);
|
|
128233
|
-
if (pending == null) {
|
|
128234
|
-
pending = [];
|
|
128235
|
-
this.#pending.set(filterId, pending);
|
|
128236
|
-
}
|
|
128237
|
-
pending.push(result.params.result);
|
|
128238
|
-
}
|
|
128239
|
-
}
|
|
128240
|
-
else {
|
|
128241
|
-
this.emit("error", makeError("received unexpected message", "UNKNOWN_ERROR", {
|
|
128242
|
-
reasonCode: "UNEXPECTED_MESSAGE",
|
|
128243
|
-
result
|
|
128244
|
-
}));
|
|
128245
|
-
return;
|
|
128246
|
-
}
|
|
128247
|
-
}
|
|
128248
|
-
/**
|
|
128249
|
-
* Sub-classes **must** override this to send %%message%% over their
|
|
128250
|
-
* transport.
|
|
128251
|
-
*/
|
|
128252
|
-
async _write(message) {
|
|
128253
|
-
throw new Error("sub-classes must override this");
|
|
128254
|
-
}
|
|
128255
|
-
}
|
|
128256
|
-
//# sourceMappingURL=provider-socket.js.map
|
|
128257
|
-
;// ./node_modules/ethers/lib.esm/providers/provider-websocket.js
|
|
128258
|
-
/*-browser*/
|
|
128259
|
-
|
|
128260
|
-
/**
|
|
128261
|
-
* A JSON-RPC provider which is backed by a WebSocket.
|
|
128262
|
-
*
|
|
128263
|
-
* WebSockets are often preferred because they retain a live connection
|
|
128264
|
-
* to a server, which permits more instant access to events.
|
|
128265
|
-
*
|
|
128266
|
-
* However, this incurs higher server infrasturture costs, so additional
|
|
128267
|
-
* resources may be required to host your own WebSocket nodes and many
|
|
128268
|
-
* third-party services charge additional fees for WebSocket endpoints.
|
|
128269
|
-
*/
|
|
128270
|
-
class WebSocketProvider extends SocketProvider {
|
|
128271
|
-
#connect;
|
|
128272
|
-
#websocket;
|
|
128273
|
-
get websocket() {
|
|
128274
|
-
if (this.#websocket == null) {
|
|
128275
|
-
throw new Error("websocket closed");
|
|
128276
|
-
}
|
|
128277
|
-
return this.#websocket;
|
|
128278
|
-
}
|
|
128279
|
-
constructor(url, network, options) {
|
|
128280
|
-
super(network, options);
|
|
128281
|
-
if (typeof (url) === "string") {
|
|
128282
|
-
this.#connect = () => { return new ws_browser_WebSocket(url); };
|
|
128283
|
-
this.#websocket = this.#connect();
|
|
128284
|
-
}
|
|
128285
|
-
else if (typeof (url) === "function") {
|
|
128286
|
-
this.#connect = url;
|
|
128287
|
-
this.#websocket = url();
|
|
128288
|
-
}
|
|
128289
|
-
else {
|
|
128290
|
-
this.#connect = null;
|
|
128291
|
-
this.#websocket = url;
|
|
128292
|
-
}
|
|
128293
|
-
this.websocket.onopen = async () => {
|
|
128294
|
-
try {
|
|
128295
|
-
await this._start();
|
|
128296
|
-
this.resume();
|
|
128297
|
-
}
|
|
128298
|
-
catch (error) {
|
|
128299
|
-
console.log("failed to start WebsocketProvider", error);
|
|
128300
|
-
// @TODO: now what? Attempt reconnect?
|
|
128301
|
-
}
|
|
128302
|
-
};
|
|
128303
|
-
this.websocket.onmessage = (message) => {
|
|
128304
|
-
this._processMessage(message.data);
|
|
128305
|
-
};
|
|
128306
|
-
/*
|
|
128307
|
-
this.websocket.onclose = (event) => {
|
|
128308
|
-
// @TODO: What event.code should we reconnect on?
|
|
128309
|
-
const reconnect = false;
|
|
128310
|
-
if (reconnect) {
|
|
128311
|
-
this.pause(true);
|
|
128312
|
-
if (this.#connect) {
|
|
128313
|
-
this.#websocket = this.#connect();
|
|
128314
|
-
this.#websocket.onopen = ...
|
|
128315
|
-
// @TODO: this requires the super class to rebroadcast; move it there
|
|
128316
|
-
}
|
|
128317
|
-
this._reconnect();
|
|
128318
|
-
}
|
|
128319
|
-
};
|
|
128320
|
-
*/
|
|
128321
|
-
}
|
|
128322
|
-
async _write(message) {
|
|
128323
|
-
this.websocket.send(message);
|
|
128324
|
-
}
|
|
128325
|
-
async destroy() {
|
|
128326
|
-
if (this.#websocket != null) {
|
|
128327
|
-
this.#websocket.close();
|
|
128328
|
-
this.#websocket = null;
|
|
128329
|
-
}
|
|
128330
|
-
super.destroy();
|
|
128331
|
-
}
|
|
128332
|
-
}
|
|
128333
|
-
//# sourceMappingURL=provider-websocket.js.map
|
|
128334
|
-
;// ./node_modules/ethers/lib.esm/providers/provider-infura.js
|
|
128335
|
-
/**
|
|
128336
|
-
* [[link-infura]] provides a third-party service for connecting to
|
|
128337
|
-
* various blockchains over JSON-RPC.
|
|
128338
|
-
*
|
|
128339
|
-
* **Supported Networks**
|
|
128340
|
-
*
|
|
128341
|
-
* - Ethereum Mainnet (``mainnet``)
|
|
128342
|
-
* - Goerli Testnet (``goerli``)
|
|
128343
|
-
* - Sepolia Testnet (``sepolia``)
|
|
128344
|
-
* - Arbitrum (``arbitrum``)
|
|
128345
|
-
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
|
|
128346
|
-
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
|
|
128347
|
-
* - Base (``base``)
|
|
128348
|
-
* - Base Goerlia Testnet (``base-goerli``)
|
|
128349
|
-
* - Base Sepolia Testnet (``base-sepolia``)
|
|
128350
|
-
* - BNB Smart Chain Mainnet (``bnb``)
|
|
128351
|
-
* - BNB Smart Chain Testnet (``bnbt``)
|
|
128352
|
-
* - Linea (``linea``)
|
|
128353
|
-
* - Linea Goerli Testnet (``linea-goerli``)
|
|
128354
|
-
* - Linea Sepolia Testnet (``linea-sepolia``)
|
|
128355
|
-
* - Optimism (``optimism``)
|
|
128356
|
-
* - Optimism Goerli Testnet (``optimism-goerli``)
|
|
128357
|
-
* - Optimism Sepolia Testnet (``optimism-sepolia``)
|
|
128358
|
-
* - Polygon (``matic``)
|
|
128359
|
-
* - Polygon Amoy Testnet (``matic-amoy``)
|
|
128360
|
-
* - Polygon Mumbai Testnet (``matic-mumbai``)
|
|
128361
|
-
*
|
|
128362
|
-
* @_subsection: api/providers/thirdparty:INFURA [providers-infura]
|
|
128363
|
-
*/
|
|
128364
|
-
|
|
128365
|
-
|
|
128366
|
-
|
|
128367
|
-
|
|
128368
|
-
|
|
128369
|
-
const defaultProjectId = "84842078b09946638c03157f83405213";
|
|
128370
|
-
function provider_infura_getHost(name) {
|
|
128371
|
-
switch (name) {
|
|
128372
|
-
case "mainnet":
|
|
128373
|
-
return "mainnet.infura.io";
|
|
128374
|
-
case "goerli":
|
|
128375
|
-
return "goerli.infura.io";
|
|
128376
|
-
case "sepolia":
|
|
128377
|
-
return "sepolia.infura.io";
|
|
128378
|
-
case "arbitrum":
|
|
128379
|
-
return "arbitrum-mainnet.infura.io";
|
|
128380
|
-
case "arbitrum-goerli":
|
|
128381
|
-
return "arbitrum-goerli.infura.io";
|
|
128382
|
-
case "arbitrum-sepolia":
|
|
128383
|
-
return "arbitrum-sepolia.infura.io";
|
|
128384
|
-
case "base":
|
|
128385
|
-
return "base-mainnet.infura.io";
|
|
128386
|
-
case "base-goerlia": // @TODO: Remove this typo in the future!
|
|
128387
|
-
case "base-goerli":
|
|
128388
|
-
return "base-goerli.infura.io";
|
|
128389
|
-
case "base-sepolia":
|
|
128390
|
-
return "base-sepolia.infura.io";
|
|
128391
|
-
case "bnb":
|
|
128392
|
-
return "bsc-mainnet.infura.io";
|
|
128393
|
-
case "bnbt":
|
|
128394
|
-
return "bsc-testnet.infura.io";
|
|
128395
|
-
case "linea":
|
|
128396
|
-
return "linea-mainnet.infura.io";
|
|
128397
|
-
case "linea-goerli":
|
|
128398
|
-
return "linea-goerli.infura.io";
|
|
128399
|
-
case "linea-sepolia":
|
|
128400
|
-
return "linea-sepolia.infura.io";
|
|
128401
|
-
case "matic":
|
|
128402
|
-
return "polygon-mainnet.infura.io";
|
|
128403
|
-
case "matic-amoy":
|
|
128404
|
-
return "polygon-amoy.infura.io";
|
|
128405
|
-
case "matic-mumbai":
|
|
128406
|
-
return "polygon-mumbai.infura.io";
|
|
128407
|
-
case "optimism":
|
|
128408
|
-
return "optimism-mainnet.infura.io";
|
|
128409
|
-
case "optimism-goerli":
|
|
128410
|
-
return "optimism-goerli.infura.io";
|
|
128411
|
-
case "optimism-sepolia":
|
|
128412
|
-
return "optimism-sepolia.infura.io";
|
|
128413
|
-
}
|
|
128414
|
-
assertArgument(false, "unsupported network", "network", name);
|
|
128415
|
-
}
|
|
128416
|
-
/**
|
|
128417
|
-
* The **InfuraWebSocketProvider** connects to the [[link-infura]]
|
|
128418
|
-
* WebSocket end-points.
|
|
128419
|
-
*
|
|
128420
|
-
* By default, a highly-throttled API key is used, which is
|
|
128421
|
-
* appropriate for quick prototypes and simple scripts. To
|
|
128422
|
-
* gain access to an increased rate-limit, it is highly
|
|
128423
|
-
* recommended to [sign up here](link-infura-signup).
|
|
128424
|
-
*/
|
|
128425
|
-
class InfuraWebSocketProvider extends WebSocketProvider {
|
|
128426
|
-
/**
|
|
128427
|
-
* The Project ID for the INFURA connection.
|
|
128428
|
-
*/
|
|
128429
|
-
projectId;
|
|
128430
|
-
/**
|
|
128431
|
-
* The Project Secret.
|
|
128432
|
-
*
|
|
128433
|
-
* If null, no authenticated requests are made. This should not
|
|
128434
|
-
* be used outside of private contexts.
|
|
128435
|
-
*/
|
|
128436
|
-
projectSecret;
|
|
128437
|
-
/**
|
|
128438
|
-
* Creates a new **InfuraWebSocketProvider**.
|
|
128439
|
-
*/
|
|
128440
|
-
constructor(network, projectId) {
|
|
128441
|
-
const provider = new InfuraProvider(network, projectId);
|
|
128442
|
-
const req = provider._getConnection();
|
|
128443
|
-
assert(!req.credentials, "INFURA WebSocket project secrets unsupported", "UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" });
|
|
128444
|
-
const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/");
|
|
128445
|
-
super(url, provider._network);
|
|
128446
|
-
defineProperties(this, {
|
|
128447
|
-
projectId: provider.projectId,
|
|
128448
|
-
projectSecret: provider.projectSecret
|
|
128449
|
-
});
|
|
128450
|
-
}
|
|
128451
|
-
isCommunityResource() {
|
|
128452
|
-
return (this.projectId === defaultProjectId);
|
|
128453
|
-
}
|
|
128454
|
-
}
|
|
128455
|
-
/**
|
|
128456
|
-
* The **InfuraProvider** connects to the [[link-infura]]
|
|
128457
|
-
* JSON-RPC end-points.
|
|
128458
|
-
*
|
|
128459
|
-
* By default, a highly-throttled API key is used, which is
|
|
128460
|
-
* appropriate for quick prototypes and simple scripts. To
|
|
128461
|
-
* gain access to an increased rate-limit, it is highly
|
|
128462
|
-
* recommended to [sign up here](link-infura-signup).
|
|
128463
|
-
*/
|
|
128464
|
-
class InfuraProvider extends JsonRpcProvider {
|
|
128465
|
-
/**
|
|
128466
|
-
* The Project ID for the INFURA connection.
|
|
128467
|
-
*/
|
|
128468
|
-
projectId;
|
|
128469
|
-
/**
|
|
128470
|
-
* The Project Secret.
|
|
128471
|
-
*
|
|
128472
|
-
* If null, no authenticated requests are made. This should not
|
|
128473
|
-
* be used outside of private contexts.
|
|
128474
|
-
*/
|
|
128475
|
-
projectSecret;
|
|
128476
|
-
/**
|
|
128477
|
-
* Creates a new **InfuraProvider**.
|
|
128478
|
-
*/
|
|
128479
|
-
constructor(_network, projectId, projectSecret) {
|
|
128480
|
-
if (_network == null) {
|
|
128481
|
-
_network = "mainnet";
|
|
128482
|
-
}
|
|
128483
|
-
const network = Network.from(_network);
|
|
128484
|
-
if (projectId == null) {
|
|
128485
|
-
projectId = defaultProjectId;
|
|
128486
|
-
}
|
|
128487
|
-
if (projectSecret == null) {
|
|
128488
|
-
projectSecret = null;
|
|
128489
|
-
}
|
|
128490
|
-
const request = InfuraProvider.getRequest(network, projectId, projectSecret);
|
|
128491
|
-
super(request, network, { staticNetwork: network });
|
|
128492
|
-
defineProperties(this, { projectId, projectSecret });
|
|
128493
|
-
}
|
|
128494
|
-
_getProvider(chainId) {
|
|
128495
|
-
try {
|
|
128496
|
-
return new InfuraProvider(chainId, this.projectId, this.projectSecret);
|
|
128497
|
-
}
|
|
128498
|
-
catch (error) { }
|
|
128499
|
-
return super._getProvider(chainId);
|
|
128500
|
-
}
|
|
128501
|
-
isCommunityResource() {
|
|
128502
|
-
return (this.projectId === defaultProjectId);
|
|
128503
|
-
}
|
|
128504
|
-
/**
|
|
128505
|
-
* Creates a new **InfuraWebSocketProvider**.
|
|
128506
|
-
*/
|
|
128507
|
-
static getWebSocketProvider(network, projectId) {
|
|
128508
|
-
return new InfuraWebSocketProvider(network, projectId);
|
|
128509
|
-
}
|
|
128510
|
-
/**
|
|
128511
|
-
* Returns a prepared request for connecting to %%network%%
|
|
128512
|
-
* with %%projectId%% and %%projectSecret%%.
|
|
128513
|
-
*/
|
|
128514
|
-
static getRequest(network, projectId, projectSecret) {
|
|
128515
|
-
if (projectId == null) {
|
|
128516
|
-
projectId = defaultProjectId;
|
|
128517
|
-
}
|
|
128518
|
-
if (projectSecret == null) {
|
|
128519
|
-
projectSecret = null;
|
|
128520
|
-
}
|
|
128521
|
-
const request = new FetchRequest(`https:/\/${provider_infura_getHost(network.name)}/v3/${projectId}`);
|
|
128522
|
-
request.allowGzip = true;
|
|
128523
|
-
if (projectSecret) {
|
|
128524
|
-
request.setCredentials("", projectSecret);
|
|
128525
|
-
}
|
|
128526
|
-
if (projectId === defaultProjectId) {
|
|
128527
|
-
request.retryFunc = async (request, response, attempt) => {
|
|
128528
|
-
showThrottleMessage("InfuraProvider");
|
|
128529
|
-
return true;
|
|
128530
|
-
};
|
|
128531
|
-
}
|
|
128532
|
-
return request;
|
|
128533
|
-
}
|
|
128534
|
-
}
|
|
128535
|
-
//# sourceMappingURL=provider-infura.js.map
|
|
128536
|
-
;// ./node_modules/ethers/lib.esm/providers/provider-quicknode.js
|
|
128537
|
-
/**
|
|
128538
|
-
* [[link-quicknode]] provides a third-party service for connecting to
|
|
128539
|
-
* various blockchains over JSON-RPC.
|
|
128540
|
-
*
|
|
128541
|
-
* **Supported Networks**
|
|
128542
|
-
*
|
|
128543
|
-
* - Ethereum Mainnet (``mainnet``)
|
|
128544
|
-
* - Goerli Testnet (``goerli``)
|
|
128545
|
-
* - Sepolia Testnet (``sepolia``)
|
|
128546
|
-
* - Holesky Testnet (``holesky``)
|
|
128547
|
-
* - Arbitrum (``arbitrum``)
|
|
128548
|
-
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
|
|
128549
|
-
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
|
|
128550
|
-
* - Base Mainnet (``base``);
|
|
128551
|
-
* - Base Goerli Testnet (``base-goerli``);
|
|
128552
|
-
* - Base Sepolia Testnet (``base-sepolia``);
|
|
128553
|
-
* - BNB Smart Chain Mainnet (``bnb``)
|
|
128554
|
-
* - BNB Smart Chain Testnet (``bnbt``)
|
|
128555
|
-
* - Optimism (``optimism``)
|
|
128556
|
-
* - Optimism Goerli Testnet (``optimism-goerli``)
|
|
128557
|
-
* - Optimism Sepolia Testnet (``optimism-sepolia``)
|
|
128558
|
-
* - Polygon (``matic``)
|
|
128559
|
-
* - Polygon Mumbai Testnet (``matic-mumbai``)
|
|
128560
|
-
*
|
|
128561
|
-
* @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode]
|
|
128562
|
-
*/
|
|
128563
|
-
|
|
128564
|
-
|
|
128565
|
-
|
|
128566
|
-
|
|
128567
|
-
const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb";
|
|
128568
|
-
function provider_quicknode_getHost(name) {
|
|
128569
|
-
switch (name) {
|
|
128570
|
-
case "mainnet":
|
|
128571
|
-
return "ethers.quiknode.pro";
|
|
128572
|
-
case "goerli":
|
|
128573
|
-
return "ethers.ethereum-goerli.quiknode.pro";
|
|
128574
|
-
case "sepolia":
|
|
128575
|
-
return "ethers.ethereum-sepolia.quiknode.pro";
|
|
128576
|
-
case "holesky":
|
|
128577
|
-
return "ethers.ethereum-holesky.quiknode.pro";
|
|
128578
|
-
case "arbitrum":
|
|
128579
|
-
return "ethers.arbitrum-mainnet.quiknode.pro";
|
|
128580
|
-
case "arbitrum-goerli":
|
|
128581
|
-
return "ethers.arbitrum-goerli.quiknode.pro";
|
|
128582
|
-
case "arbitrum-sepolia":
|
|
128583
|
-
return "ethers.arbitrum-sepolia.quiknode.pro";
|
|
128584
|
-
case "base":
|
|
128585
|
-
return "ethers.base-mainnet.quiknode.pro";
|
|
128586
|
-
case "base-goerli":
|
|
128587
|
-
return "ethers.base-goerli.quiknode.pro";
|
|
128588
|
-
case "base-spolia":
|
|
128589
|
-
return "ethers.base-sepolia.quiknode.pro";
|
|
128590
|
-
case "bnb":
|
|
128591
|
-
return "ethers.bsc.quiknode.pro";
|
|
128592
|
-
case "bnbt":
|
|
128593
|
-
return "ethers.bsc-testnet.quiknode.pro";
|
|
128594
|
-
case "matic":
|
|
128595
|
-
return "ethers.matic.quiknode.pro";
|
|
128596
|
-
case "matic-mumbai":
|
|
128597
|
-
return "ethers.matic-testnet.quiknode.pro";
|
|
128598
|
-
case "optimism":
|
|
128599
|
-
return "ethers.optimism.quiknode.pro";
|
|
128600
|
-
case "optimism-goerli":
|
|
128601
|
-
return "ethers.optimism-goerli.quiknode.pro";
|
|
128602
|
-
case "optimism-sepolia":
|
|
128603
|
-
return "ethers.optimism-sepolia.quiknode.pro";
|
|
128604
|
-
case "xdai":
|
|
128605
|
-
return "ethers.xdai.quiknode.pro";
|
|
128606
|
-
}
|
|
128607
|
-
assertArgument(false, "unsupported network", "network", name);
|
|
128608
|
-
}
|
|
128609
|
-
/*
|
|
128610
|
-
@TODO:
|
|
128611
|
-
These networks are not currently present in the Network
|
|
128612
|
-
default included networks. Research them and ensure they
|
|
128613
|
-
are EVM compatible and work with ethers
|
|
128614
|
-
|
|
128615
|
-
http://ethers.matic-amoy.quiknode.pro
|
|
128616
|
-
|
|
128617
|
-
http://ethers.avalanche-mainnet.quiknode.pro
|
|
128618
|
-
http://ethers.avalanche-testnet.quiknode.pro
|
|
128619
|
-
http://ethers.blast-sepolia.quiknode.pro
|
|
128620
|
-
http://ethers.celo-mainnet.quiknode.pro
|
|
128621
|
-
http://ethers.fantom.quiknode.pro
|
|
128622
|
-
http://ethers.imx-demo.quiknode.pro
|
|
128623
|
-
http://ethers.imx-mainnet.quiknode.pro
|
|
128624
|
-
http://ethers.imx-testnet.quiknode.pro
|
|
128625
|
-
http://ethers.near-mainnet.quiknode.pro
|
|
128626
|
-
http://ethers.near-testnet.quiknode.pro
|
|
128627
|
-
http://ethers.nova-mainnet.quiknode.pro
|
|
128628
|
-
http://ethers.scroll-mainnet.quiknode.pro
|
|
128629
|
-
http://ethers.scroll-testnet.quiknode.pro
|
|
128630
|
-
http://ethers.tron-mainnet.quiknode.pro
|
|
128631
|
-
http://ethers.zkevm-mainnet.quiknode.pro
|
|
128632
|
-
http://ethers.zkevm-testnet.quiknode.pro
|
|
128633
|
-
http://ethers.zksync-mainnet.quiknode.pro
|
|
128634
|
-
http://ethers.zksync-testnet.quiknode.pro
|
|
128635
|
-
*/
|
|
128636
|
-
/**
|
|
128637
|
-
* The **QuickNodeProvider** connects to the [[link-quicknode]]
|
|
128638
|
-
* JSON-RPC end-points.
|
|
128639
|
-
*
|
|
128640
|
-
* By default, a highly-throttled API token is used, which is
|
|
128641
|
-
* appropriate for quick prototypes and simple scripts. To
|
|
128642
|
-
* gain access to an increased rate-limit, it is highly
|
|
128643
|
-
* recommended to [sign up here](link-quicknode).
|
|
128644
|
-
*/
|
|
128645
|
-
class QuickNodeProvider extends JsonRpcProvider {
|
|
128646
|
-
/**
|
|
128647
|
-
* The API token.
|
|
128648
|
-
*/
|
|
128649
|
-
token;
|
|
128650
|
-
/**
|
|
128651
|
-
* Creates a new **QuickNodeProvider**.
|
|
128652
|
-
*/
|
|
128653
|
-
constructor(_network, token) {
|
|
128654
|
-
if (_network == null) {
|
|
128655
|
-
_network = "mainnet";
|
|
128656
|
-
}
|
|
128657
|
-
const network = Network.from(_network);
|
|
128658
|
-
if (token == null) {
|
|
128659
|
-
token = defaultToken;
|
|
128660
|
-
}
|
|
128661
|
-
const request = QuickNodeProvider.getRequest(network, token);
|
|
128662
|
-
super(request, network, { staticNetwork: network });
|
|
128663
|
-
defineProperties(this, { token });
|
|
128664
|
-
}
|
|
128665
|
-
_getProvider(chainId) {
|
|
128666
|
-
try {
|
|
128667
|
-
return new QuickNodeProvider(chainId, this.token);
|
|
128668
|
-
}
|
|
128669
|
-
catch (error) { }
|
|
128670
|
-
return super._getProvider(chainId);
|
|
128671
|
-
}
|
|
128672
|
-
isCommunityResource() {
|
|
128673
|
-
return (this.token === defaultToken);
|
|
128674
|
-
}
|
|
128675
|
-
/**
|
|
128676
|
-
* Returns a new request prepared for %%network%% and the
|
|
128677
|
-
* %%token%%.
|
|
128678
|
-
*/
|
|
128679
|
-
static getRequest(network, token) {
|
|
128680
|
-
if (token == null) {
|
|
128681
|
-
token = defaultToken;
|
|
128682
|
-
}
|
|
128683
|
-
const request = new FetchRequest(`https:/\/${provider_quicknode_getHost(network.name)}/${token}`);
|
|
128684
|
-
request.allowGzip = true;
|
|
128685
|
-
//if (projectSecret) { request.setCredentials("", projectSecret); }
|
|
128686
|
-
if (token === defaultToken) {
|
|
128687
|
-
request.retryFunc = async (request, response, attempt) => {
|
|
128688
|
-
showThrottleMessage("QuickNodeProvider");
|
|
128689
|
-
return true;
|
|
128690
|
-
};
|
|
128691
|
-
}
|
|
128692
|
-
return request;
|
|
128693
|
-
}
|
|
128694
|
-
}
|
|
128695
|
-
//# sourceMappingURL=provider-quicknode.js.map
|
|
128696
|
-
;// ./node_modules/ethers/lib.esm/providers/provider-fallback.js
|
|
128697
|
-
/**
|
|
128698
|
-
* A **FallbackProvider** provides resilience, security and performance
|
|
128699
|
-
* in a way that is customizable and configurable.
|
|
128700
|
-
*
|
|
128701
|
-
* @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider]
|
|
128702
|
-
*/
|
|
128703
|
-
|
|
128704
|
-
|
|
128705
|
-
|
|
128706
|
-
const provider_fallback_BN_1 = BigInt("1");
|
|
128707
|
-
const provider_fallback_BN_2 = BigInt("2");
|
|
128708
|
-
function shuffle(array) {
|
|
128709
|
-
for (let i = array.length - 1; i > 0; i--) {
|
|
128710
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
128711
|
-
const tmp = array[i];
|
|
128712
|
-
array[i] = array[j];
|
|
128713
|
-
array[j] = tmp;
|
|
128714
|
-
}
|
|
128715
|
-
}
|
|
128716
|
-
function provider_fallback_stall(duration) {
|
|
128717
|
-
return new Promise((resolve) => { setTimeout(resolve, duration); });
|
|
128718
|
-
}
|
|
128719
|
-
function provider_fallback_getTime() { return (new Date()).getTime(); }
|
|
128720
|
-
function provider_fallback_stringify(value) {
|
|
128721
|
-
return JSON.stringify(value, (key, value) => {
|
|
128722
|
-
if (typeof (value) === "bigint") {
|
|
128723
|
-
return { type: "bigint", value: value.toString() };
|
|
128724
|
-
}
|
|
128725
|
-
return value;
|
|
128726
|
-
});
|
|
128727
|
-
}
|
|
128728
|
-
;
|
|
128729
|
-
const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 };
|
|
128730
|
-
const defaultState = {
|
|
128731
|
-
blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0,
|
|
128732
|
-
outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0,
|
|
128733
|
-
_network: null, _updateNumber: null, _totalTime: 0,
|
|
128734
|
-
_lastFatalError: null, _lastFatalErrorTimestamp: 0
|
|
128735
|
-
};
|
|
128736
|
-
async function waitForSync(config, blockNumber) {
|
|
128737
|
-
while (config.blockNumber < 0 || config.blockNumber < blockNumber) {
|
|
128738
|
-
if (!config._updateNumber) {
|
|
128739
|
-
config._updateNumber = (async () => {
|
|
128740
|
-
try {
|
|
128741
|
-
const blockNumber = await config.provider.getBlockNumber();
|
|
128742
|
-
if (blockNumber > config.blockNumber) {
|
|
128743
|
-
config.blockNumber = blockNumber;
|
|
128744
|
-
}
|
|
128745
|
-
}
|
|
128746
|
-
catch (error) {
|
|
128747
|
-
config.blockNumber = -2;
|
|
128748
|
-
config._lastFatalError = error;
|
|
128749
|
-
config._lastFatalErrorTimestamp = provider_fallback_getTime();
|
|
128750
|
-
}
|
|
128751
|
-
config._updateNumber = null;
|
|
128752
|
-
})();
|
|
128753
|
-
}
|
|
128754
|
-
await config._updateNumber;
|
|
128755
|
-
config.outOfSync++;
|
|
128756
|
-
if (config._lastFatalError) {
|
|
128757
|
-
break;
|
|
128758
|
-
}
|
|
128759
|
-
}
|
|
128760
|
-
}
|
|
128761
|
-
function _normalize(value) {
|
|
128762
|
-
if (value == null) {
|
|
128763
|
-
return "null";
|
|
128764
|
-
}
|
|
128765
|
-
if (Array.isArray(value)) {
|
|
128766
|
-
return "[" + (value.map(_normalize)).join(",") + "]";
|
|
128767
|
-
}
|
|
128768
|
-
if (typeof (value) === "object" && typeof (value.toJSON) === "function") {
|
|
128769
|
-
return _normalize(value.toJSON());
|
|
128770
|
-
}
|
|
128771
|
-
switch (typeof (value)) {
|
|
128772
|
-
case "boolean":
|
|
128773
|
-
case "symbol":
|
|
128774
|
-
return value.toString();
|
|
128775
|
-
case "bigint":
|
|
128776
|
-
case "number":
|
|
128777
|
-
return BigInt(value).toString();
|
|
128778
|
-
case "string":
|
|
128779
|
-
return JSON.stringify(value);
|
|
128780
|
-
case "object": {
|
|
128781
|
-
const keys = Object.keys(value);
|
|
128782
|
-
keys.sort();
|
|
128783
|
-
return "{" + keys.map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`).join(",") + "}";
|
|
128784
|
-
}
|
|
128785
|
-
}
|
|
128786
|
-
console.log("Could not serialize", value);
|
|
128787
|
-
throw new Error("Hmm...");
|
|
128788
|
-
}
|
|
128789
|
-
function normalizeResult(method, value) {
|
|
128790
|
-
if ("error" in value) {
|
|
128791
|
-
const error = value.error;
|
|
128792
|
-
let tag;
|
|
128793
|
-
if (isError(error, "CALL_EXCEPTION")) {
|
|
128794
|
-
tag = _normalize(Object.assign({}, error, {
|
|
128795
|
-
shortMessage: undefined, reason: undefined, info: undefined
|
|
128796
|
-
}));
|
|
128797
|
-
}
|
|
128798
|
-
else {
|
|
128799
|
-
tag = _normalize(error);
|
|
128800
|
-
}
|
|
128801
|
-
return { tag, value: error };
|
|
128802
|
-
}
|
|
128803
|
-
const result = value.result;
|
|
128804
|
-
return { tag: _normalize(result), value: result };
|
|
128805
|
-
}
|
|
128806
|
-
// This strategy picks the highest weight result, as long as the weight is
|
|
128807
|
-
// equal to or greater than quorum
|
|
128808
|
-
function checkQuorum(quorum, results) {
|
|
128809
|
-
const tally = new Map();
|
|
128810
|
-
for (const { value, tag, weight } of results) {
|
|
128811
|
-
const t = tally.get(tag) || { value, weight: 0 };
|
|
128812
|
-
t.weight += weight;
|
|
128813
|
-
tally.set(tag, t);
|
|
128814
|
-
}
|
|
128815
|
-
let best = null;
|
|
128816
|
-
for (const r of tally.values()) {
|
|
128817
|
-
if (r.weight >= quorum && (!best || r.weight > best.weight)) {
|
|
128818
|
-
best = r;
|
|
128819
|
-
}
|
|
128820
|
-
}
|
|
128821
|
-
if (best) {
|
|
128822
|
-
return best.value;
|
|
128823
|
-
}
|
|
128824
|
-
return undefined;
|
|
128825
|
-
}
|
|
128826
|
-
function getMedian(quorum, results) {
|
|
128827
|
-
let resultWeight = 0;
|
|
128828
|
-
const errorMap = new Map();
|
|
128829
|
-
let bestError = null;
|
|
128830
|
-
const values = [];
|
|
128831
|
-
for (const { value, tag, weight } of results) {
|
|
128832
|
-
if (value instanceof Error) {
|
|
128833
|
-
const e = errorMap.get(tag) || { value, weight: 0 };
|
|
128834
|
-
e.weight += weight;
|
|
128835
|
-
errorMap.set(tag, e);
|
|
128836
|
-
if (bestError == null || e.weight > bestError.weight) {
|
|
128837
|
-
bestError = e;
|
|
128838
|
-
}
|
|
128839
|
-
}
|
|
128840
|
-
else {
|
|
128841
|
-
values.push(BigInt(value));
|
|
128842
|
-
resultWeight += weight;
|
|
128843
|
-
}
|
|
128844
|
-
}
|
|
128845
|
-
if (resultWeight < quorum) {
|
|
128846
|
-
// We have quorum for an error
|
|
128847
|
-
if (bestError && bestError.weight >= quorum) {
|
|
128848
|
-
return bestError.value;
|
|
128849
|
-
}
|
|
128850
|
-
// We do not have quorum for a result
|
|
128851
|
-
return undefined;
|
|
128852
|
-
}
|
|
128853
|
-
// Get the sorted values
|
|
128854
|
-
values.sort((a, b) => ((a < b) ? -1 : (b > a) ? 1 : 0));
|
|
128855
|
-
const mid = Math.floor(values.length / 2);
|
|
128856
|
-
// Odd-length; take the middle value
|
|
128857
|
-
if (values.length % 2) {
|
|
128858
|
-
return values[mid];
|
|
128859
|
-
}
|
|
128860
|
-
// Even length; take the ceiling of the mean of the center two values
|
|
128861
|
-
return (values[mid - 1] + values[mid] + provider_fallback_BN_1) / provider_fallback_BN_2;
|
|
128862
|
-
}
|
|
128863
|
-
function getAnyResult(quorum, results) {
|
|
128864
|
-
// If any value or error meets quorum, that is our preferred result
|
|
128865
|
-
const result = checkQuorum(quorum, results);
|
|
128866
|
-
if (result !== undefined) {
|
|
128867
|
-
return result;
|
|
128868
|
-
}
|
|
128869
|
-
// Otherwise, do we have any result?
|
|
128870
|
-
for (const r of results) {
|
|
128871
|
-
if (r.value) {
|
|
128872
|
-
return r.value;
|
|
128873
|
-
}
|
|
128874
|
-
}
|
|
128875
|
-
// Nope!
|
|
128876
|
-
return undefined;
|
|
128877
|
-
}
|
|
128878
|
-
function getFuzzyMode(quorum, results) {
|
|
128879
|
-
if (quorum === 1) {
|
|
128880
|
-
return getNumber(getMedian(quorum, results), "%internal");
|
|
128881
|
-
}
|
|
128882
|
-
const tally = new Map();
|
|
128883
|
-
const add = (result, weight) => {
|
|
128884
|
-
const t = tally.get(result) || { result, weight: 0 };
|
|
128885
|
-
t.weight += weight;
|
|
128886
|
-
tally.set(result, t);
|
|
128887
|
-
};
|
|
128888
|
-
for (const { weight, value } of results) {
|
|
128889
|
-
const r = getNumber(value);
|
|
128890
|
-
add(r - 1, weight);
|
|
128891
|
-
add(r, weight);
|
|
128892
|
-
add(r + 1, weight);
|
|
128893
|
-
}
|
|
128894
|
-
let bestWeight = 0;
|
|
128895
|
-
let bestResult = undefined;
|
|
128896
|
-
for (const { weight, result } of tally.values()) {
|
|
128897
|
-
// Use this result, if this result meets quorum and has either:
|
|
128898
|
-
// - a better weight
|
|
128899
|
-
// - or equal weight, but the result is larger
|
|
128900
|
-
if (weight >= quorum && (weight > bestWeight || (bestResult != null && weight === bestWeight && result > bestResult))) {
|
|
128901
|
-
bestWeight = weight;
|
|
128902
|
-
bestResult = result;
|
|
128903
|
-
}
|
|
128904
|
-
}
|
|
128905
|
-
return bestResult;
|
|
128906
|
-
}
|
|
128907
|
-
/**
|
|
128908
|
-
* A **FallbackProvider** manages several [[Providers]] providing
|
|
128909
|
-
* resilience by switching between slow or misbehaving nodes, security
|
|
128910
|
-
* by requiring multiple backends to aggree and performance by allowing
|
|
128911
|
-
* faster backends to respond earlier.
|
|
128912
|
-
*
|
|
128913
|
-
*/
|
|
128914
|
-
class FallbackProvider extends AbstractProvider {
|
|
128915
|
-
/**
|
|
128916
|
-
* The number of backends that must agree on a value before it is
|
|
128917
|
-
* accpeted.
|
|
128918
|
-
*/
|
|
128919
|
-
quorum;
|
|
128920
|
-
/**
|
|
128921
|
-
* @_ignore:
|
|
128922
|
-
*/
|
|
128923
|
-
eventQuorum;
|
|
128924
|
-
/**
|
|
128925
|
-
* @_ignore:
|
|
128926
|
-
*/
|
|
128927
|
-
eventWorkers;
|
|
128928
|
-
#configs;
|
|
128929
|
-
#height;
|
|
128930
|
-
#initialSyncPromise;
|
|
128931
|
-
/**
|
|
128932
|
-
* Creates a new **FallbackProvider** with %%providers%% connected to
|
|
128933
|
-
* %%network%%.
|
|
128934
|
-
*
|
|
128935
|
-
* If a [[Provider]] is included in %%providers%%, defaults are used
|
|
128936
|
-
* for the configuration.
|
|
128937
|
-
*/
|
|
128938
|
-
constructor(providers, network, options) {
|
|
128939
|
-
super(network, options);
|
|
128940
|
-
this.#configs = providers.map((p) => {
|
|
128941
|
-
if (p instanceof AbstractProvider) {
|
|
128942
|
-
return Object.assign({ provider: p }, defaultConfig, defaultState);
|
|
128943
|
-
}
|
|
128944
|
-
else {
|
|
128945
|
-
return Object.assign({}, defaultConfig, p, defaultState);
|
|
128946
|
-
}
|
|
128947
|
-
});
|
|
128948
|
-
this.#height = -2;
|
|
128949
|
-
this.#initialSyncPromise = null;
|
|
128950
|
-
if (options && options.quorum != null) {
|
|
128951
|
-
this.quorum = options.quorum;
|
|
128952
|
-
}
|
|
128953
|
-
else {
|
|
128954
|
-
this.quorum = Math.ceil(this.#configs.reduce((accum, config) => {
|
|
128955
|
-
accum += config.weight;
|
|
128956
|
-
return accum;
|
|
128957
|
-
}, 0) / 2);
|
|
128958
|
-
}
|
|
128959
|
-
this.eventQuorum = 1;
|
|
128960
|
-
this.eventWorkers = 1;
|
|
128961
|
-
assertArgument(this.quorum <= this.#configs.reduce((a, c) => (a + c.weight), 0), "quorum exceed provider weight", "quorum", this.quorum);
|
|
128962
|
-
}
|
|
128963
|
-
get providerConfigs() {
|
|
128964
|
-
return this.#configs.map((c) => {
|
|
128965
|
-
const result = Object.assign({}, c);
|
|
128966
|
-
for (const key in result) {
|
|
128967
|
-
if (key[0] === "_") {
|
|
128968
|
-
delete result[key];
|
|
128969
|
-
}
|
|
128970
|
-
}
|
|
128971
|
-
return result;
|
|
128972
|
-
});
|
|
128973
|
-
}
|
|
128974
|
-
async _detectNetwork() {
|
|
128975
|
-
return Network.from(getBigInt(await this._perform({ method: "chainId" })));
|
|
128976
|
-
}
|
|
128977
|
-
// @TODO: Add support to select providers to be the event subscriber
|
|
128978
|
-
//_getSubscriber(sub: Subscription): Subscriber {
|
|
128979
|
-
// throw new Error("@TODO");
|
|
128980
|
-
//}
|
|
128981
|
-
/**
|
|
128982
|
-
* Transforms a %%req%% into the correct method call on %%provider%%.
|
|
128983
|
-
*/
|
|
128984
|
-
async _translatePerform(provider, req) {
|
|
128985
|
-
switch (req.method) {
|
|
128986
|
-
case "broadcastTransaction":
|
|
128987
|
-
return await provider.broadcastTransaction(req.signedTransaction);
|
|
128988
|
-
case "call":
|
|
128989
|
-
return await provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag }));
|
|
128990
|
-
case "chainId":
|
|
128991
|
-
return (await provider.getNetwork()).chainId;
|
|
128992
|
-
case "estimateGas":
|
|
128993
|
-
return await provider.estimateGas(req.transaction);
|
|
128994
|
-
case "getBalance":
|
|
128995
|
-
return await provider.getBalance(req.address, req.blockTag);
|
|
128996
|
-
case "getBlock": {
|
|
128997
|
-
const block = ("blockHash" in req) ? req.blockHash : req.blockTag;
|
|
128998
|
-
return await provider.getBlock(block, req.includeTransactions);
|
|
128999
|
-
}
|
|
129000
|
-
case "getBlockNumber":
|
|
129001
|
-
return await provider.getBlockNumber();
|
|
129002
|
-
case "getCode":
|
|
129003
|
-
return await provider.getCode(req.address, req.blockTag);
|
|
129004
|
-
case "getGasPrice":
|
|
129005
|
-
return (await provider.getFeeData()).gasPrice;
|
|
129006
|
-
case "getPriorityFee":
|
|
129007
|
-
return (await provider.getFeeData()).maxPriorityFeePerGas;
|
|
129008
|
-
case "getLogs":
|
|
129009
|
-
return await provider.getLogs(req.filter);
|
|
129010
|
-
case "getStorage":
|
|
129011
|
-
return await provider.getStorage(req.address, req.position, req.blockTag);
|
|
129012
|
-
case "getTransaction":
|
|
129013
|
-
return await provider.getTransaction(req.hash);
|
|
129014
|
-
case "getTransactionCount":
|
|
129015
|
-
return await provider.getTransactionCount(req.address, req.blockTag);
|
|
129016
|
-
case "getTransactionReceipt":
|
|
129017
|
-
return await provider.getTransactionReceipt(req.hash);
|
|
129018
|
-
case "getTransactionResult":
|
|
129019
|
-
return await provider.getTransactionResult(req.hash);
|
|
129020
|
-
}
|
|
129021
|
-
}
|
|
129022
|
-
// Grab the next (random) config that is not already part of
|
|
129023
|
-
// the running set
|
|
129024
|
-
#getNextConfig(running) {
|
|
129025
|
-
// @TODO: Maybe do a check here to favour (heavily) providers that
|
|
129026
|
-
// do not require waitForSync and disfavour providers that
|
|
129027
|
-
// seem down-ish or are behaving slowly
|
|
129028
|
-
const configs = Array.from(running).map((r) => r.config);
|
|
129029
|
-
// Shuffle the states, sorted by priority
|
|
129030
|
-
const allConfigs = this.#configs.slice();
|
|
129031
|
-
shuffle(allConfigs);
|
|
129032
|
-
allConfigs.sort((a, b) => (a.priority - b.priority));
|
|
129033
|
-
for (const config of allConfigs) {
|
|
129034
|
-
if (config._lastFatalError) {
|
|
129035
|
-
continue;
|
|
129036
|
-
}
|
|
129037
|
-
if (configs.indexOf(config) === -1) {
|
|
129038
|
-
return config;
|
|
129039
|
-
}
|
|
129040
|
-
}
|
|
129041
|
-
return null;
|
|
129042
|
-
}
|
|
129043
|
-
// Adds a new runner (if available) to running.
|
|
129044
|
-
#addRunner(running, req) {
|
|
129045
|
-
const config = this.#getNextConfig(running);
|
|
129046
|
-
// No runners available
|
|
129047
|
-
if (config == null) {
|
|
129048
|
-
return null;
|
|
129049
|
-
}
|
|
129050
|
-
// Create a new runner
|
|
129051
|
-
const runner = {
|
|
129052
|
-
config, result: null, didBump: false,
|
|
129053
|
-
perform: null, staller: null
|
|
129054
|
-
};
|
|
129055
|
-
const now = provider_fallback_getTime();
|
|
129056
|
-
// Start performing this operation
|
|
129057
|
-
runner.perform = (async () => {
|
|
129058
|
-
try {
|
|
129059
|
-
config.requests++;
|
|
129060
|
-
const result = await this._translatePerform(config.provider, req);
|
|
129061
|
-
runner.result = { result };
|
|
129062
|
-
}
|
|
129063
|
-
catch (error) {
|
|
129064
|
-
config.errorResponses++;
|
|
129065
|
-
runner.result = { error };
|
|
129066
|
-
}
|
|
129067
|
-
const dt = (provider_fallback_getTime() - now);
|
|
129068
|
-
config._totalTime += dt;
|
|
129069
|
-
config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt;
|
|
129070
|
-
runner.perform = null;
|
|
129071
|
-
})();
|
|
129072
|
-
// Start a staller; when this times out, it's time to force
|
|
129073
|
-
// kicking off another runner because we are taking too long
|
|
129074
|
-
runner.staller = (async () => {
|
|
129075
|
-
await provider_fallback_stall(config.stallTimeout);
|
|
129076
|
-
runner.staller = null;
|
|
129077
|
-
})();
|
|
129078
|
-
running.add(runner);
|
|
129079
|
-
return runner;
|
|
129080
|
-
}
|
|
129081
|
-
// Initializes the blockNumber and network for each runner and
|
|
129082
|
-
// blocks until initialized
|
|
129083
|
-
async #initialSync() {
|
|
129084
|
-
let initialSync = this.#initialSyncPromise;
|
|
129085
|
-
if (!initialSync) {
|
|
129086
|
-
const promises = [];
|
|
129087
|
-
this.#configs.forEach((config) => {
|
|
129088
|
-
promises.push((async () => {
|
|
129089
|
-
await waitForSync(config, 0);
|
|
129090
|
-
if (!config._lastFatalError) {
|
|
129091
|
-
config._network = await config.provider.getNetwork();
|
|
129092
|
-
}
|
|
129093
|
-
})());
|
|
129094
|
-
});
|
|
129095
|
-
this.#initialSyncPromise = initialSync = (async () => {
|
|
129096
|
-
// Wait for all providers to have a block number and network
|
|
129097
|
-
await Promise.all(promises);
|
|
129098
|
-
// Check all the networks match
|
|
129099
|
-
let chainId = null;
|
|
129100
|
-
for (const config of this.#configs) {
|
|
129101
|
-
if (config._lastFatalError) {
|
|
129102
|
-
continue;
|
|
129103
|
-
}
|
|
129104
|
-
const network = (config._network);
|
|
129105
|
-
if (chainId == null) {
|
|
129106
|
-
chainId = network.chainId;
|
|
129107
|
-
}
|
|
129108
|
-
else if (network.chainId !== chainId) {
|
|
129109
|
-
assert(false, "cannot mix providers on different networks", "UNSUPPORTED_OPERATION", {
|
|
129110
|
-
operation: "new FallbackProvider"
|
|
129111
|
-
});
|
|
129112
|
-
}
|
|
129113
|
-
}
|
|
129114
|
-
})();
|
|
129115
|
-
}
|
|
129116
|
-
await initialSync;
|
|
129117
|
-
}
|
|
129118
|
-
async #checkQuorum(running, req) {
|
|
129119
|
-
// Get all the result objects
|
|
129120
|
-
const results = [];
|
|
129121
|
-
for (const runner of running) {
|
|
129122
|
-
if (runner.result != null) {
|
|
129123
|
-
const { tag, value } = normalizeResult(req.method, runner.result);
|
|
129124
|
-
results.push({ tag, value, weight: runner.config.weight });
|
|
129125
|
-
}
|
|
129126
|
-
}
|
|
129127
|
-
// Are there enough results to event meet quorum?
|
|
129128
|
-
if (results.reduce((a, r) => (a + r.weight), 0) < this.quorum) {
|
|
129129
|
-
return undefined;
|
|
129130
|
-
}
|
|
129131
|
-
switch (req.method) {
|
|
129132
|
-
case "getBlockNumber": {
|
|
129133
|
-
// We need to get the bootstrap block height
|
|
129134
|
-
if (this.#height === -2) {
|
|
129135
|
-
this.#height = Math.ceil(getNumber(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({
|
|
129136
|
-
value: c.blockNumber,
|
|
129137
|
-
tag: getNumber(c.blockNumber).toString(),
|
|
129138
|
-
weight: c.weight
|
|
129139
|
-
})))));
|
|
129140
|
-
}
|
|
129141
|
-
// Find the mode across all the providers, allowing for
|
|
129142
|
-
// a little drift between block heights
|
|
129143
|
-
const mode = getFuzzyMode(this.quorum, results);
|
|
129144
|
-
if (mode === undefined) {
|
|
129145
|
-
return undefined;
|
|
129146
|
-
}
|
|
129147
|
-
if (mode > this.#height) {
|
|
129148
|
-
this.#height = mode;
|
|
129149
|
-
}
|
|
129150
|
-
return this.#height;
|
|
129151
|
-
}
|
|
129152
|
-
case "getGasPrice":
|
|
129153
|
-
case "getPriorityFee":
|
|
129154
|
-
case "estimateGas":
|
|
129155
|
-
return getMedian(this.quorum, results);
|
|
129156
|
-
case "getBlock":
|
|
129157
|
-
// Pending blocks are in the mempool and already
|
|
129158
|
-
// quite untrustworthy; just grab anything
|
|
129159
|
-
if ("blockTag" in req && req.blockTag === "pending") {
|
|
129160
|
-
return getAnyResult(this.quorum, results);
|
|
129161
|
-
}
|
|
129162
|
-
return checkQuorum(this.quorum, results);
|
|
129163
|
-
case "call":
|
|
129164
|
-
case "chainId":
|
|
129165
|
-
case "getBalance":
|
|
129166
|
-
case "getTransactionCount":
|
|
129167
|
-
case "getCode":
|
|
129168
|
-
case "getStorage":
|
|
129169
|
-
case "getTransaction":
|
|
129170
|
-
case "getTransactionReceipt":
|
|
129171
|
-
case "getLogs":
|
|
129172
|
-
return checkQuorum(this.quorum, results);
|
|
129173
|
-
case "broadcastTransaction":
|
|
129174
|
-
return getAnyResult(this.quorum, results);
|
|
129175
|
-
}
|
|
129176
|
-
assert(false, "unsupported method", "UNSUPPORTED_OPERATION", {
|
|
129177
|
-
operation: `_perform(${provider_fallback_stringify(req.method)})`
|
|
129178
|
-
});
|
|
129179
|
-
}
|
|
129180
|
-
async #waitForQuorum(running, req) {
|
|
129181
|
-
if (running.size === 0) {
|
|
129182
|
-
throw new Error("no runners?!");
|
|
129183
|
-
}
|
|
129184
|
-
// Any promises that are interesting to watch for; an expired stall
|
|
129185
|
-
// or a successful perform
|
|
129186
|
-
const interesting = [];
|
|
129187
|
-
let newRunners = 0;
|
|
129188
|
-
for (const runner of running) {
|
|
129189
|
-
// No responses, yet; keep an eye on it
|
|
129190
|
-
if (runner.perform) {
|
|
129191
|
-
interesting.push(runner.perform);
|
|
129192
|
-
}
|
|
129193
|
-
// Still stalling...
|
|
129194
|
-
if (runner.staller) {
|
|
129195
|
-
interesting.push(runner.staller);
|
|
129196
|
-
continue;
|
|
129197
|
-
}
|
|
129198
|
-
// This runner has already triggered another runner
|
|
129199
|
-
if (runner.didBump) {
|
|
129200
|
-
continue;
|
|
129201
|
-
}
|
|
129202
|
-
// Got a response (result or error) or stalled; kick off another runner
|
|
129203
|
-
runner.didBump = true;
|
|
129204
|
-
newRunners++;
|
|
129205
|
-
}
|
|
129206
|
-
// Check if we have reached quorum on a result (or error)
|
|
129207
|
-
const value = await this.#checkQuorum(running, req);
|
|
129208
|
-
if (value !== undefined) {
|
|
129209
|
-
if (value instanceof Error) {
|
|
129210
|
-
throw value;
|
|
129211
|
-
}
|
|
129212
|
-
return value;
|
|
129213
|
-
}
|
|
129214
|
-
// Add any new runners, because a staller timed out or a result
|
|
129215
|
-
// or error response came in.
|
|
129216
|
-
for (let i = 0; i < newRunners; i++) {
|
|
129217
|
-
this.#addRunner(running, req);
|
|
129218
|
-
}
|
|
129219
|
-
// All providers have returned, and we have no result
|
|
129220
|
-
assert(interesting.length > 0, "quorum not met", "SERVER_ERROR", {
|
|
129221
|
-
request: "%sub-requests",
|
|
129222
|
-
info: { request: req, results: Array.from(running).map((r) => provider_fallback_stringify(r.result)) }
|
|
129223
|
-
});
|
|
129224
|
-
// Wait for someone to either complete its perform or stall out
|
|
129225
|
-
await Promise.race(interesting);
|
|
129226
|
-
// This is recursive, but at worst case the depth is 2x the
|
|
129227
|
-
// number of providers (each has a perform and a staller)
|
|
129228
|
-
return await this.#waitForQuorum(running, req);
|
|
129229
|
-
}
|
|
129230
|
-
async _perform(req) {
|
|
129231
|
-
// Broadcasting a transaction is rare (ish) and already incurs
|
|
129232
|
-
// a cost on the user, so spamming is safe-ish. Just send it to
|
|
129233
|
-
// every backend.
|
|
129234
|
-
if (req.method === "broadcastTransaction") {
|
|
129235
|
-
// Once any broadcast provides a positive result, use it. No
|
|
129236
|
-
// need to wait for anyone else
|
|
129237
|
-
const results = this.#configs.map((c) => null);
|
|
129238
|
-
const broadcasts = this.#configs.map(async ({ provider, weight }, index) => {
|
|
129239
|
-
try {
|
|
129240
|
-
const result = await provider._perform(req);
|
|
129241
|
-
results[index] = Object.assign(normalizeResult(req.method, { result }), { weight });
|
|
129242
|
-
}
|
|
129243
|
-
catch (error) {
|
|
129244
|
-
results[index] = Object.assign(normalizeResult(req.method, { error }), { weight });
|
|
129245
|
-
}
|
|
129246
|
-
});
|
|
129247
|
-
// As each promise finishes...
|
|
129248
|
-
while (true) {
|
|
129249
|
-
// Check for a valid broadcast result
|
|
129250
|
-
const done = results.filter((r) => (r != null));
|
|
129251
|
-
for (const { value } of done) {
|
|
129252
|
-
if (!(value instanceof Error)) {
|
|
129253
|
-
return value;
|
|
129254
|
-
}
|
|
129255
|
-
}
|
|
129256
|
-
// Check for a legit broadcast error (one which we cannot
|
|
129257
|
-
// recover from; some nodes may return the following red
|
|
129258
|
-
// herring events:
|
|
129259
|
-
// - alredy seend (UNKNOWN_ERROR)
|
|
129260
|
-
// - NONCE_EXPIRED
|
|
129261
|
-
// - REPLACEMENT_UNDERPRICED
|
|
129262
|
-
const result = checkQuorum(this.quorum, results.filter((r) => (r != null)));
|
|
129263
|
-
if (isError(result, "INSUFFICIENT_FUNDS")) {
|
|
129264
|
-
throw result;
|
|
129265
|
-
}
|
|
129266
|
-
// Kick off the next provider (if any)
|
|
129267
|
-
const waiting = broadcasts.filter((b, i) => (results[i] == null));
|
|
129268
|
-
if (waiting.length === 0) {
|
|
129269
|
-
break;
|
|
129270
|
-
}
|
|
129271
|
-
await Promise.race(waiting);
|
|
129272
|
-
}
|
|
129273
|
-
// Use standard quorum results; any result was returned above,
|
|
129274
|
-
// so this will find any error that met quorum if any
|
|
129275
|
-
const result = getAnyResult(this.quorum, results);
|
|
129276
|
-
assert(result !== undefined, "problem multi-broadcasting", "SERVER_ERROR", {
|
|
129277
|
-
request: "%sub-requests",
|
|
129278
|
-
info: { request: req, results: results.map(provider_fallback_stringify) }
|
|
129279
|
-
});
|
|
129280
|
-
if (result instanceof Error) {
|
|
129281
|
-
throw result;
|
|
129282
|
-
}
|
|
129283
|
-
return result;
|
|
129284
|
-
}
|
|
129285
|
-
await this.#initialSync();
|
|
129286
|
-
// Bootstrap enough runners to meet quorum
|
|
129287
|
-
const running = new Set();
|
|
129288
|
-
let inflightQuorum = 0;
|
|
129289
|
-
while (true) {
|
|
129290
|
-
const runner = this.#addRunner(running, req);
|
|
129291
|
-
if (runner == null) {
|
|
129292
|
-
break;
|
|
129293
|
-
}
|
|
129294
|
-
inflightQuorum += runner.config.weight;
|
|
129295
|
-
if (inflightQuorum >= this.quorum) {
|
|
129296
|
-
break;
|
|
129297
|
-
}
|
|
129298
|
-
}
|
|
129299
|
-
const result = await this.#waitForQuorum(running, req);
|
|
129300
|
-
// Track requests sent to a provider that are still
|
|
129301
|
-
// outstanding after quorum has been otherwise found
|
|
129302
|
-
for (const runner of running) {
|
|
129303
|
-
if (runner.perform && runner.result == null) {
|
|
129304
|
-
runner.config.lateResponses++;
|
|
129305
|
-
}
|
|
129306
|
-
}
|
|
129307
|
-
return result;
|
|
129308
|
-
}
|
|
129309
|
-
async destroy() {
|
|
129310
|
-
for (const { provider } of this.#configs) {
|
|
129311
|
-
provider.destroy();
|
|
129312
|
-
}
|
|
129313
|
-
super.destroy();
|
|
129314
|
-
}
|
|
129315
|
-
}
|
|
129316
|
-
//# sourceMappingURL=provider-fallback.js.map
|
|
129317
|
-
;// ./node_modules/ethers/lib.esm/providers/default-provider.js
|
|
129318
|
-
|
|
129319
|
-
|
|
129320
|
-
|
|
129321
|
-
//import { BlockscoutProvider } from "./provider-blockscout.js";
|
|
129322
|
-
|
|
129323
|
-
|
|
129324
|
-
|
|
129325
|
-
|
|
129326
|
-
//import { PocketProvider } from "./provider-pocket.js";
|
|
129327
|
-
|
|
129328
|
-
|
|
129329
|
-
|
|
129330
|
-
|
|
129331
|
-
|
|
129332
|
-
function isWebSocketLike(value) {
|
|
129333
|
-
return (value && typeof (value.send) === "function" &&
|
|
129334
|
-
typeof (value.close) === "function");
|
|
129335
|
-
}
|
|
129336
|
-
const Testnets = "goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");
|
|
129337
|
-
/**
|
|
129338
|
-
* Returns a default provider for %%network%%.
|
|
129339
|
-
*
|
|
129340
|
-
* If %%network%% is a [[WebSocketLike]] or string that begins with
|
|
129341
|
-
* ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed
|
|
129342
|
-
* by that WebSocket or URL.
|
|
129343
|
-
*
|
|
129344
|
-
* If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``,
|
|
129345
|
-
* a [[JsonRpcProvider]] is returned connected to that URL.
|
|
129346
|
-
*
|
|
129347
|
-
* Otherwise, a default provider is created backed by well-known public
|
|
129348
|
-
* Web3 backends (such as [[link-infura]]) using community-provided API
|
|
129349
|
-
* keys.
|
|
129350
|
-
*
|
|
129351
|
-
* The %%options%% allows specifying custom API keys per backend (setting
|
|
129352
|
-
* an API key to ``"-"`` will omit that provider) and ``options.exclusive``
|
|
129353
|
-
* can be set to either a backend name or and array of backend names, which
|
|
129354
|
-
* will whitelist **only** those backends.
|
|
129355
|
-
*
|
|
129356
|
-
* Current backend strings supported are:
|
|
129357
|
-
* - ``"alchemy"``
|
|
129358
|
-
* - ``"ankr"``
|
|
129359
|
-
* - ``"cloudflare"``
|
|
129360
|
-
* - ``"chainstack"``
|
|
129361
|
-
* - ``"etherscan"``
|
|
129362
|
-
* - ``"infura"``
|
|
129363
|
-
* - ``"publicPolygon"``
|
|
129364
|
-
* - ``"quicknode"``
|
|
129365
|
-
*
|
|
129366
|
-
* @example:
|
|
129367
|
-
* // Connect to a local Geth node
|
|
129368
|
-
* provider = getDefaultProvider("http://localhost:8545/");
|
|
129369
|
-
*
|
|
129370
|
-
* // Connect to Ethereum mainnet with any current and future
|
|
129371
|
-
* // third-party services available
|
|
129372
|
-
* provider = getDefaultProvider("mainnet");
|
|
129373
|
-
*
|
|
129374
|
-
* // Connect to Polygon, but only allow Etherscan and
|
|
129375
|
-
* // INFURA and use "MY_API_KEY" in calls to Etherscan.
|
|
129376
|
-
* provider = getDefaultProvider("matic", {
|
|
129377
|
-
* etherscan: "MY_API_KEY",
|
|
129378
|
-
* exclusive: [ "etherscan", "infura" ]
|
|
129379
|
-
* });
|
|
129380
|
-
*/
|
|
129381
|
-
function getDefaultProvider(network, options) {
|
|
129382
|
-
if (options == null) {
|
|
129383
|
-
options = {};
|
|
129384
|
-
}
|
|
129385
|
-
const allowService = (name) => {
|
|
129386
|
-
if (options[name] === "-") {
|
|
129387
|
-
return false;
|
|
129388
|
-
}
|
|
129389
|
-
if (typeof (options.exclusive) === "string") {
|
|
129390
|
-
return (name === options.exclusive);
|
|
129391
|
-
}
|
|
129392
|
-
if (Array.isArray(options.exclusive)) {
|
|
129393
|
-
return (options.exclusive.indexOf(name) !== -1);
|
|
129394
|
-
}
|
|
129395
|
-
return true;
|
|
129396
|
-
};
|
|
129397
|
-
if (typeof (network) === "string" && network.match(/^https?:/)) {
|
|
129398
|
-
return new JsonRpcProvider(network);
|
|
129399
|
-
}
|
|
129400
|
-
if (typeof (network) === "string" && network.match(/^wss?:/) || isWebSocketLike(network)) {
|
|
129401
|
-
return new WebSocketProvider(network);
|
|
129402
|
-
}
|
|
129403
|
-
// Get the network and name, if possible
|
|
129404
|
-
let staticNetwork = null;
|
|
129405
|
-
try {
|
|
129406
|
-
staticNetwork = Network.from(network);
|
|
129407
|
-
}
|
|
129408
|
-
catch (error) { }
|
|
129409
|
-
const providers = [];
|
|
129410
|
-
if (allowService("publicPolygon") && staticNetwork) {
|
|
129411
|
-
if (staticNetwork.name === "matic") {
|
|
129412
|
-
providers.push(new JsonRpcProvider("https:/\/polygon-rpc.com/", staticNetwork, { staticNetwork }));
|
|
129413
|
-
}
|
|
129414
|
-
else if (staticNetwork.name === "matic-amoy") {
|
|
129415
|
-
providers.push(new JsonRpcProvider("https:/\/rpc-amoy.polygon.technology/", staticNetwork, { staticNetwork }));
|
|
129416
|
-
}
|
|
129417
|
-
}
|
|
129418
|
-
if (allowService("alchemy")) {
|
|
129419
|
-
try {
|
|
129420
|
-
providers.push(new AlchemyProvider(network, options.alchemy));
|
|
129421
|
-
}
|
|
129422
|
-
catch (error) { }
|
|
129423
|
-
}
|
|
129424
|
-
if (allowService("ankr") && options.ankr != null) {
|
|
129425
|
-
try {
|
|
129426
|
-
providers.push(new AnkrProvider(network, options.ankr));
|
|
129427
|
-
}
|
|
129428
|
-
catch (error) { }
|
|
129429
|
-
}
|
|
129430
|
-
/* Temporarily remove until custom error issue is fixed
|
|
129431
|
-
if (allowService("blockscout")) {
|
|
129432
|
-
try {
|
|
129433
|
-
providers.push(new BlockscoutProvider(network, options.blockscout));
|
|
129434
|
-
} catch (error) { }
|
|
129435
|
-
}
|
|
129436
|
-
*/
|
|
129437
|
-
if (allowService("chainstack")) {
|
|
129438
|
-
try {
|
|
129439
|
-
providers.push(new ChainstackProvider(network, options.chainstack));
|
|
129440
|
-
}
|
|
129441
|
-
catch (error) { }
|
|
129442
|
-
}
|
|
129443
|
-
if (allowService("cloudflare")) {
|
|
129444
|
-
try {
|
|
129445
|
-
providers.push(new CloudflareProvider(network));
|
|
129446
|
-
}
|
|
129447
|
-
catch (error) { }
|
|
129448
|
-
}
|
|
129449
|
-
if (allowService("etherscan")) {
|
|
129450
|
-
try {
|
|
129451
|
-
providers.push(new EtherscanProvider(network, options.etherscan));
|
|
129452
|
-
}
|
|
129453
|
-
catch (error) { }
|
|
129454
|
-
}
|
|
129455
|
-
if (allowService("infura")) {
|
|
129456
|
-
try {
|
|
129457
|
-
let projectId = options.infura;
|
|
129458
|
-
let projectSecret = undefined;
|
|
129459
|
-
if (typeof (projectId) === "object") {
|
|
129460
|
-
projectSecret = projectId.projectSecret;
|
|
129461
|
-
projectId = projectId.projectId;
|
|
129462
|
-
}
|
|
129463
|
-
providers.push(new InfuraProvider(network, projectId, projectSecret));
|
|
129464
|
-
}
|
|
129465
|
-
catch (error) { }
|
|
129466
|
-
}
|
|
129467
|
-
/*
|
|
129468
|
-
if (options.pocket !== "-") {
|
|
129469
|
-
try {
|
|
129470
|
-
let appId = options.pocket;
|
|
129471
|
-
let secretKey: undefined | string = undefined;
|
|
129472
|
-
let loadBalancer: undefined | boolean = undefined;
|
|
129473
|
-
if (typeof(appId) === "object") {
|
|
129474
|
-
loadBalancer = !!appId.loadBalancer;
|
|
129475
|
-
secretKey = appId.secretKey;
|
|
129476
|
-
appId = appId.appId;
|
|
129477
|
-
}
|
|
129478
|
-
providers.push(new PocketProvider(network, appId, secretKey, loadBalancer));
|
|
129479
|
-
} catch (error) { console.log(error); }
|
|
129480
|
-
}
|
|
129481
|
-
*/
|
|
129482
|
-
if (allowService("quicknode")) {
|
|
129483
|
-
try {
|
|
129484
|
-
let token = options.quicknode;
|
|
129485
|
-
providers.push(new QuickNodeProvider(network, token));
|
|
129486
|
-
}
|
|
129487
|
-
catch (error) { }
|
|
129488
|
-
}
|
|
129489
|
-
assert(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", {
|
|
129490
|
-
operation: "getDefaultProvider"
|
|
129491
|
-
});
|
|
129492
|
-
// No need for a FallbackProvider
|
|
129493
|
-
if (providers.length === 1) {
|
|
129494
|
-
return providers[0];
|
|
129495
|
-
}
|
|
129496
|
-
// We use the floor because public third-party providers can be unreliable,
|
|
129497
|
-
// so a low number of providers with a large quorum will fail too often
|
|
129498
|
-
let quorum = Math.floor(providers.length / 2);
|
|
129499
|
-
if (quorum > 2) {
|
|
129500
|
-
quorum = 2;
|
|
129501
|
-
}
|
|
129502
|
-
// Testnets don't need as strong a security gaurantee and speed is
|
|
129503
|
-
// more useful during testing
|
|
129504
|
-
if (staticNetwork && Testnets.indexOf(staticNetwork.name) !== -1) {
|
|
129505
|
-
quorum = 1;
|
|
129506
|
-
}
|
|
129507
|
-
// Provided override qorum takes priority
|
|
129508
|
-
if (options && options.quorum) {
|
|
129509
|
-
quorum = options.quorum;
|
|
129510
|
-
}
|
|
129511
|
-
return new FallbackProvider(providers, undefined, { quorum });
|
|
129512
|
-
}
|
|
129513
|
-
//# sourceMappingURL=default-provider.js.map
|
|
129514
|
-
;// ./src/plugins/smartwallet/smartWalletPlugin.ts
|
|
129515
|
-
var smartWalletPlugin_extends = (undefined && undefined.__extends) || (function () {
|
|
129516
|
-
var extendStatics = function (d, b) {
|
|
129517
|
-
extendStatics = Object.setPrototypeOf ||
|
|
129518
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
129519
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
129520
|
-
return extendStatics(d, b);
|
|
129521
|
-
};
|
|
129522
|
-
return function (d, b) {
|
|
129523
|
-
if (typeof b !== "function" && b !== null)
|
|
129524
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
129525
|
-
extendStatics(d, b);
|
|
129526
|
-
function __() { this.constructor = d; }
|
|
129527
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
129528
|
-
};
|
|
129529
|
-
})();
|
|
129530
|
-
var smartWalletPlugin_assign = (undefined && undefined.__assign) || function () {
|
|
129531
|
-
smartWalletPlugin_assign = Object.assign || function(t) {
|
|
129532
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
129533
|
-
s = arguments[i];
|
|
129534
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
129535
|
-
t[p] = s[p];
|
|
129536
|
-
}
|
|
129537
|
-
return t;
|
|
129538
|
-
};
|
|
129539
|
-
return smartWalletPlugin_assign.apply(this, arguments);
|
|
129540
|
-
};
|
|
129541
|
-
var smartWalletPlugin_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
129542
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
129543
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
129544
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
129545
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
129546
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
129547
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
129548
|
-
});
|
|
129549
|
-
};
|
|
129550
|
-
var smartWalletPlugin_generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
129551
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
129552
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
129553
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
129554
|
-
function step(op) {
|
|
129555
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
129556
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
129557
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
129558
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
129559
|
-
switch (op[0]) {
|
|
129560
|
-
case 0: case 1: t = op; break;
|
|
129561
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
129562
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
129563
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
129564
|
-
default:
|
|
129565
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
129566
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
129567
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
129568
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
129569
|
-
if (t[2]) _.ops.pop();
|
|
129570
|
-
_.trys.pop(); continue;
|
|
129571
|
-
}
|
|
129572
|
-
op = body.call(thisArg, _);
|
|
129573
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
129574
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
129575
|
-
}
|
|
129576
|
-
};
|
|
129577
|
-
var smartWalletPlugin_read = (undefined && undefined.__read) || function (o, n) {
|
|
129578
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
129579
|
-
if (!m) return o;
|
|
129580
|
-
var i = m.call(o), r, ar = [], e;
|
|
129581
|
-
try {
|
|
129582
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
129583
|
-
}
|
|
129584
|
-
catch (error) { e = { error: error }; }
|
|
129585
|
-
finally {
|
|
129586
|
-
try {
|
|
129587
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
129588
|
-
}
|
|
129589
|
-
finally { if (e) throw e.error; }
|
|
129590
|
-
}
|
|
129591
|
-
return ar;
|
|
129592
|
-
};
|
|
129593
|
-
|
|
129594
|
-
|
|
129595
|
-
// Smart Wallet ABIs
|
|
129596
|
-
var SMART_WALLET_FACTORY_ABI = [
|
|
129597
|
-
"function createWallet(address owner, uint256 requiredSignatures, uint256 requiredGuardians) external returns (address wallet)",
|
|
129598
|
-
"function createWalletWithGuardians(address owner, address[] memory guardians, uint256 requiredSignatures, uint256 requiredGuardians) external returns (address wallet)",
|
|
129599
|
-
"function getOwnerWallets(address owner) external view returns (address[] memory)",
|
|
129600
|
-
"event WalletCreated(address indexed wallet, address indexed owner, uint256 indexed walletIndex)",
|
|
129601
|
-
];
|
|
129602
|
-
var SMART_WALLET_ABI = [
|
|
129603
|
-
// Signer management
|
|
129604
|
-
"function addSigner(address signer) external",
|
|
129605
|
-
"function removeSigner(address signer) external",
|
|
129606
|
-
"function setRequiredSignatures(uint256 requiredSignatures) external",
|
|
129607
|
-
"function signers(address) external view returns (bool)",
|
|
129608
|
-
"function requiredSignatures() external view returns (uint256)",
|
|
129609
|
-
"function owner() external view returns (address)",
|
|
129610
|
-
// Guardian management
|
|
129611
|
-
"function addGuardian(address guardian) external",
|
|
129612
|
-
"function removeGuardian(address guardian) external",
|
|
129613
|
-
"function setRequiredGuardians(uint256 requiredGuardians) external",
|
|
129614
|
-
"function guardians(address) external view returns (bool)",
|
|
129615
|
-
"function requiredGuardians() external view returns (uint256)",
|
|
129616
|
-
// Execution
|
|
129617
|
-
"function execute(address target, bytes calldata data, uint256 value) external returns (bool success, bytes memory returnData)",
|
|
129618
|
-
"function executeBatch(address[] memory targets, bytes[] memory data, uint256[] memory values) external returns (bool[] memory results)",
|
|
129619
|
-
// Multi-sig
|
|
129620
|
-
"function proposeExecution(address target, bytes calldata data) external returns (uint256 proposalId)",
|
|
129621
|
-
"function approveProposal(uint256 proposalId) external",
|
|
129622
|
-
"function getProposal(uint256 proposalId) external view returns (address target, bytes memory data, address proposer, uint256 approvals, bool executed)",
|
|
129623
|
-
"function hasApprovedProposal(uint256 proposalId, address signer) external view returns (bool)",
|
|
129624
|
-
// Recovery
|
|
129625
|
-
"function initiateRecovery(address newOwner) external",
|
|
129626
|
-
"function approveRecovery() external",
|
|
129627
|
-
"function executeRecovery() external",
|
|
129628
|
-
"function getRecoveryRequest() external view returns (address newOwner, uint256 unlockTime, uint256 approvals)",
|
|
129629
|
-
"function hasApprovedRecovery(address guardian) external view returns (bool)",
|
|
129630
|
-
"event SignerAdded(address indexed signer)",
|
|
129631
|
-
"event GuardianAdded(address indexed guardian)",
|
|
129632
|
-
"event ExecutionExecuted(uint256 indexed proposalId, bool success)",
|
|
129633
|
-
"event RecoveryExecuted(address indexed newOwner)",
|
|
129634
|
-
];
|
|
129635
|
-
/**
|
|
129636
|
-
* Smart Wallet Plugin for Shogun Core
|
|
129637
|
-
* Provides integration with Smart Wallet contracts for account abstraction
|
|
129638
|
-
*/
|
|
129639
|
-
var SmartWalletPlugin = /** @class */ (function (_super) {
|
|
129640
|
-
smartWalletPlugin_extends(SmartWalletPlugin, _super);
|
|
129641
|
-
function SmartWalletPlugin(config) {
|
|
129642
|
-
if (config === void 0) { config = {}; }
|
|
129643
|
-
var _this = _super.call(this) || this;
|
|
129644
|
-
_this.name = "smartwallet";
|
|
129645
|
-
_this.version = "1.0.0";
|
|
129646
|
-
_this.description = "Smart Wallet integration for Shogun Core with multi-sig and social recovery";
|
|
129647
|
-
_this.factoryContract = null;
|
|
129648
|
-
_this.signer = null;
|
|
129649
|
-
_this.config = smartWalletPlugin_assign({ enabled: true, defaultRequiredSignatures: 1, defaultRequiredGuardians: 2 }, config);
|
|
129650
|
-
return _this;
|
|
129651
|
-
}
|
|
129652
|
-
/**
|
|
129653
|
-
* Initialize the plugin
|
|
129654
|
-
*/
|
|
129655
|
-
SmartWalletPlugin.prototype.initialize = function (core) {
|
|
129656
|
-
_super.prototype.initialize.call(this, core);
|
|
129657
|
-
if (!this.config.enabled) {
|
|
129658
|
-
console.log("[SmartWallet] Plugin disabled");
|
|
129659
|
-
return;
|
|
129660
|
-
}
|
|
129661
|
-
try {
|
|
129662
|
-
// Initialize provider and signer
|
|
129663
|
-
this.initProvider();
|
|
129664
|
-
// Initialize factory contract if address is provided
|
|
129665
|
-
if (this.config.factoryAddress) {
|
|
129666
|
-
this.initFactoryContract();
|
|
129667
|
-
}
|
|
129668
|
-
console.log("[SmartWallet] Plugin initialized successfully");
|
|
129669
|
-
}
|
|
129670
|
-
catch (error) {
|
|
129671
|
-
console.error("[SmartWallet] Initialization failed:", error.message);
|
|
129672
|
-
}
|
|
129673
|
-
};
|
|
129674
|
-
/**
|
|
129675
|
-
* Destroy the plugin and cleanup resources
|
|
129676
|
-
*/
|
|
129677
|
-
SmartWalletPlugin.prototype.destroy = function () {
|
|
129678
|
-
this.factoryContract = null;
|
|
129679
|
-
this.signer = null;
|
|
129680
|
-
_super.prototype.destroy.call(this);
|
|
129681
|
-
console.log("[SmartWallet] Plugin destroyed");
|
|
129682
|
-
};
|
|
129683
|
-
/**
|
|
129684
|
-
* Initialize provider and signer
|
|
129685
|
-
*/
|
|
129686
|
-
SmartWalletPlugin.prototype.initProvider = function () {
|
|
129687
|
-
if ( true && window.ethereum) {
|
|
129688
|
-
var provider = new BrowserProvider(window.ethereum);
|
|
129689
|
-
// Try to get signer from config, otherwise request from browser
|
|
129690
|
-
if (this.config.privateKey) {
|
|
129691
|
-
this.signer = new Wallet(this.config.privateKey, provider);
|
|
129692
|
-
}
|
|
129693
|
-
else {
|
|
129694
|
-
// Will be set when user connects wallet or provides private key
|
|
129695
|
-
this.signer = null;
|
|
129696
|
-
console.log("[SmartWallet] No private key provided. Use connectWallet() or setSigner() first.");
|
|
129697
|
-
}
|
|
129698
|
-
}
|
|
129699
|
-
};
|
|
129700
|
-
/**
|
|
129701
|
-
* Set signer with private key or wallet instance
|
|
129702
|
-
* This should be called after deriving the EOA from seed phrase
|
|
129703
|
-
*/
|
|
129704
|
-
SmartWalletPlugin.prototype.setSigner = function (privateKeyOrAddress) {
|
|
129705
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
129706
|
-
var provider;
|
|
129707
|
-
var _a;
|
|
129708
|
-
return smartWalletPlugin_generator(this, function (_b) {
|
|
129709
|
-
try {
|
|
129710
|
-
if (!((_a = this.signer) === null || _a === void 0 ? void 0 : _a.provider)) {
|
|
129711
|
-
provider = new BrowserProvider(window.ethereum);
|
|
129712
|
-
this.signer = new Wallet(privateKeyOrAddress, provider);
|
|
129713
|
-
}
|
|
129714
|
-
else {
|
|
129715
|
-
this.signer = new Wallet(privateKeyOrAddress, this.signer.provider);
|
|
129716
|
-
}
|
|
129717
|
-
console.log("[SmartWallet] Signer updated");
|
|
129718
|
-
}
|
|
129719
|
-
catch (error) {
|
|
129720
|
-
console.error("[SmartWallet] Failed to set signer:", error.message);
|
|
129721
|
-
throw error;
|
|
129722
|
-
}
|
|
129723
|
-
return [2 /*return*/];
|
|
129724
|
-
});
|
|
129725
|
-
});
|
|
129726
|
-
};
|
|
129727
|
-
/**
|
|
129728
|
-
* Connect to MetaMask or other injected provider
|
|
129729
|
-
*/
|
|
129730
|
-
SmartWalletPlugin.prototype.connectWallet = function () {
|
|
129731
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
129732
|
-
var provider, _a, _b, _c, _d, error_1;
|
|
129733
|
-
return smartWalletPlugin_generator(this, function (_e) {
|
|
129734
|
-
switch (_e.label) {
|
|
129735
|
-
case 0:
|
|
129736
|
-
_e.trys.push([0, 6, , 7]);
|
|
129737
|
-
if (!( true && window.ethereum)) return [3 /*break*/, 4];
|
|
129738
|
-
provider = new BrowserProvider(window.ethereum);
|
|
129739
|
-
return [4 /*yield*/, provider.send("eth_requestAccounts", [])];
|
|
129740
|
-
case 1:
|
|
129741
|
-
_e.sent();
|
|
129742
|
-
_a = this;
|
|
129743
|
-
return [4 /*yield*/, provider.getSigner()];
|
|
129744
|
-
case 2:
|
|
129745
|
-
_a.signer = _e.sent();
|
|
129746
|
-
_c = (_b = console).log;
|
|
129747
|
-
_d = ["[SmartWallet] Connected to wallet:"];
|
|
129748
|
-
return [4 /*yield*/, this.signer.getAddress()];
|
|
129749
|
-
case 3:
|
|
129750
|
-
_c.apply(_b, _d.concat([_e.sent()]));
|
|
129751
|
-
return [3 /*break*/, 5];
|
|
129752
|
-
case 4: throw new Error("No Ethereum provider found");
|
|
129753
|
-
case 5: return [3 /*break*/, 7];
|
|
129754
|
-
case 6:
|
|
129755
|
-
error_1 = _e.sent();
|
|
129756
|
-
console.error("[SmartWallet] Failed to connect wallet:", error_1.message);
|
|
129757
|
-
throw error_1;
|
|
129758
|
-
case 7: return [2 /*return*/];
|
|
129759
|
-
}
|
|
129760
|
-
});
|
|
129761
|
-
});
|
|
129762
|
-
};
|
|
129763
|
-
/**
|
|
129764
|
-
* Initialize factory contract
|
|
129765
|
-
*/
|
|
129766
|
-
SmartWalletPlugin.prototype.initFactoryContract = function () {
|
|
129767
|
-
if (!this.config.factoryAddress || !this.signer) {
|
|
129768
|
-
console.warn("[SmartWallet] Factory address or signer not available");
|
|
129769
|
-
return;
|
|
129770
|
-
}
|
|
129771
|
-
this.factoryContract = new Contract(this.config.factoryAddress, SMART_WALLET_FACTORY_ABI, this.signer);
|
|
129772
|
-
};
|
|
129773
|
-
/**
|
|
129774
|
-
* Ensure signer is available
|
|
129775
|
-
*/
|
|
129776
|
-
SmartWalletPlugin.prototype.assertSigner = function () {
|
|
129777
|
-
if (!this.signer) {
|
|
129778
|
-
throw new Error("Signer not available. Please connect a wallet.");
|
|
129779
|
-
}
|
|
129780
|
-
return this.signer;
|
|
129781
|
-
};
|
|
129782
|
-
/**
|
|
129783
|
-
* Ensure factory is initialized
|
|
129784
|
-
*/
|
|
129785
|
-
SmartWalletPlugin.prototype.assertFactory = function () {
|
|
129786
|
-
if (!this.factoryContract) {
|
|
129787
|
-
throw new Error("SmartWallet factory not initialized. Please deploy factory first.");
|
|
129788
|
-
}
|
|
129789
|
-
return this.factoryContract;
|
|
129790
|
-
};
|
|
129791
|
-
// ============================================ Wallet Creation ============================================
|
|
129792
|
-
SmartWalletPlugin.prototype.createWallet = function (owner, requiredSignatures, requiredGuardians) {
|
|
129793
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
129794
|
-
var factory, sig, reqSig, reqGuard, tx, receipt, event_1, walletAddress, error_2;
|
|
129795
|
-
var _a, _b;
|
|
129796
|
-
return smartWalletPlugin_generator(this, function (_c) {
|
|
129797
|
-
switch (_c.label) {
|
|
129798
|
-
case 0:
|
|
129799
|
-
_c.trys.push([0, 3, , 4]);
|
|
129800
|
-
factory = this.assertFactory();
|
|
129801
|
-
sig = this.assertSigner();
|
|
129802
|
-
reqSig = (_a = requiredSignatures !== null && requiredSignatures !== void 0 ? requiredSignatures : this.config.defaultRequiredSignatures) !== null && _a !== void 0 ? _a : 1;
|
|
129803
|
-
reqGuard = (_b = requiredGuardians !== null && requiredGuardians !== void 0 ? requiredGuardians : this.config.defaultRequiredGuardians) !== null && _b !== void 0 ? _b : 2;
|
|
129804
|
-
return [4 /*yield*/, factory.createWallet(owner, reqSig, reqGuard)];
|
|
129805
|
-
case 1:
|
|
129806
|
-
tx = _c.sent();
|
|
129807
|
-
return [4 /*yield*/, tx.wait()];
|
|
129808
|
-
case 2:
|
|
129809
|
-
receipt = _c.sent();
|
|
129810
|
-
event_1 = receipt.logs.find(function (log) {
|
|
129811
|
-
return log.topics[0] === id("WalletCreated(address,address,uint256)");
|
|
129812
|
-
});
|
|
129813
|
-
walletAddress = event_1
|
|
129814
|
-
? getAddress("0x" + event_1.topics[1].slice(-40))
|
|
129815
|
-
: null;
|
|
129816
|
-
return [2 /*return*/, {
|
|
129817
|
-
success: true,
|
|
129818
|
-
walletAddress: walletAddress || undefined,
|
|
129819
|
-
transactionHash: receipt.hash,
|
|
129820
|
-
}];
|
|
129821
|
-
case 3:
|
|
129822
|
-
error_2 = _c.sent();
|
|
129823
|
-
return [2 /*return*/, {
|
|
129824
|
-
success: false,
|
|
129825
|
-
error: error_2.message,
|
|
129826
|
-
}];
|
|
129827
|
-
case 4: return [2 /*return*/];
|
|
129828
|
-
}
|
|
129829
|
-
});
|
|
129830
|
-
});
|
|
129831
|
-
};
|
|
129832
|
-
SmartWalletPlugin.prototype.createWalletWithGuardians = function (owner, guardians, requiredSignatures, requiredGuardians) {
|
|
129833
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
129834
|
-
var factory, reqSig, reqGuard, tx, receipt, event_2, walletAddress, error_3;
|
|
129835
|
-
var _a, _b;
|
|
129836
|
-
return smartWalletPlugin_generator(this, function (_c) {
|
|
129837
|
-
switch (_c.label) {
|
|
129838
|
-
case 0:
|
|
129839
|
-
_c.trys.push([0, 3, , 4]);
|
|
129840
|
-
factory = this.assertFactory();
|
|
129841
|
-
reqSig = (_a = requiredSignatures !== null && requiredSignatures !== void 0 ? requiredSignatures : this.config.defaultRequiredSignatures) !== null && _a !== void 0 ? _a : 1;
|
|
129842
|
-
reqGuard = (_b = requiredGuardians !== null && requiredGuardians !== void 0 ? requiredGuardians : this.config.defaultRequiredGuardians) !== null && _b !== void 0 ? _b : 2;
|
|
129843
|
-
return [4 /*yield*/, factory.createWalletWithGuardians(owner, guardians, reqSig, reqGuard)];
|
|
129844
|
-
case 1:
|
|
129845
|
-
tx = _c.sent();
|
|
129846
|
-
return [4 /*yield*/, tx.wait()];
|
|
129847
|
-
case 2:
|
|
129848
|
-
receipt = _c.sent();
|
|
129849
|
-
event_2 = receipt.logs.find(function (log) {
|
|
129850
|
-
return log.topics[0] === id("WalletCreated(address,address,uint256)");
|
|
129851
|
-
});
|
|
129852
|
-
walletAddress = event_2
|
|
129853
|
-
? getAddress("0x" + event_2.topics[1].slice(-40))
|
|
129854
|
-
: null;
|
|
129855
|
-
return [2 /*return*/, {
|
|
129856
|
-
success: true,
|
|
129857
|
-
walletAddress: walletAddress || undefined,
|
|
129858
|
-
transactionHash: receipt.hash,
|
|
129859
|
-
}];
|
|
129860
|
-
case 3:
|
|
129861
|
-
error_3 = _c.sent();
|
|
129862
|
-
return [2 /*return*/, {
|
|
129863
|
-
success: false,
|
|
129864
|
-
error: error_3.message,
|
|
129865
|
-
}];
|
|
129866
|
-
case 4: return [2 /*return*/];
|
|
129867
|
-
}
|
|
129868
|
-
});
|
|
129869
|
-
});
|
|
129870
|
-
};
|
|
129871
|
-
// ============================================ Wallet Management ============================================
|
|
129872
|
-
SmartWalletPlugin.prototype.getWalletInfo = function (walletAddress) {
|
|
129873
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
129874
|
-
var walletContract, _a, owner, requiredSig, requiredGuard, currentSigner, isSigner, error_4;
|
|
129875
|
-
return smartWalletPlugin_generator(this, function (_b) {
|
|
129876
|
-
switch (_b.label) {
|
|
129877
|
-
case 0:
|
|
129878
|
-
_b.trys.push([0, 3, , 4]);
|
|
129879
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
129880
|
-
return [4 /*yield*/, Promise.all([
|
|
129881
|
-
walletContract.owner(),
|
|
129882
|
-
walletContract.requiredSignatures(),
|
|
129883
|
-
walletContract.requiredGuardians(),
|
|
129884
|
-
this.assertSigner().getAddress(),
|
|
129885
|
-
])];
|
|
129886
|
-
case 1:
|
|
129887
|
-
_a = smartWalletPlugin_read.apply(void 0, [_b.sent(), 4]), owner = _a[0], requiredSig = _a[1], requiredGuard = _a[2], currentSigner = _a[3];
|
|
129888
|
-
return [4 /*yield*/, walletContract.signers(currentSigner)];
|
|
129889
|
-
case 2:
|
|
129890
|
-
isSigner = _b.sent();
|
|
129891
|
-
return [2 /*return*/, {
|
|
129892
|
-
address: walletAddress,
|
|
129893
|
-
owner: owner,
|
|
129894
|
-
isSigner: isSigner,
|
|
129895
|
-
requiredSignatures: Number(requiredSig),
|
|
129896
|
-
requiredGuardians: Number(requiredGuard),
|
|
129897
|
-
}];
|
|
129898
|
-
case 3:
|
|
129899
|
-
error_4 = _b.sent();
|
|
129900
|
-
console.error("[SmartWallet] Error getting wallet info:", error_4);
|
|
129901
|
-
return [2 /*return*/, null];
|
|
129902
|
-
case 4: return [2 /*return*/];
|
|
129903
|
-
}
|
|
129904
|
-
});
|
|
129905
|
-
});
|
|
129906
|
-
};
|
|
129907
|
-
SmartWalletPlugin.prototype.getOwnerWallets = function (ownerAddress) {
|
|
129908
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
129909
|
-
var factory, wallets, error_5;
|
|
129910
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
129911
|
-
switch (_a.label) {
|
|
129912
|
-
case 0:
|
|
129913
|
-
_a.trys.push([0, 2, , 3]);
|
|
129914
|
-
factory = this.assertFactory();
|
|
129915
|
-
return [4 /*yield*/, factory.getOwnerWallets(ownerAddress)];
|
|
129916
|
-
case 1:
|
|
129917
|
-
wallets = _a.sent();
|
|
129918
|
-
return [2 /*return*/, wallets];
|
|
129919
|
-
case 2:
|
|
129920
|
-
error_5 = _a.sent();
|
|
129921
|
-
console.error("[SmartWallet] Error getting owner wallets:", error_5);
|
|
129922
|
-
return [2 /*return*/, []];
|
|
129923
|
-
case 3: return [2 /*return*/];
|
|
129924
|
-
}
|
|
129925
|
-
});
|
|
129926
|
-
});
|
|
129927
|
-
};
|
|
129928
|
-
// ============================================ Signer Management ============================================
|
|
129929
|
-
SmartWalletPlugin.prototype.addSigner = function (walletAddress, signer) {
|
|
129930
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
129931
|
-
var walletContract, tx, receipt, error_6;
|
|
129932
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
129933
|
-
switch (_a.label) {
|
|
129934
|
-
case 0:
|
|
129935
|
-
_a.trys.push([0, 3, , 4]);
|
|
129936
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
129937
|
-
return [4 /*yield*/, walletContract.addSigner(signer)];
|
|
129938
|
-
case 1:
|
|
129939
|
-
tx = _a.sent();
|
|
129940
|
-
return [4 /*yield*/, tx.wait()];
|
|
129941
|
-
case 2:
|
|
129942
|
-
receipt = _a.sent();
|
|
129943
|
-
return [2 /*return*/, {
|
|
129944
|
-
success: true,
|
|
129945
|
-
transactionHash: receipt.hash,
|
|
129946
|
-
}];
|
|
129947
|
-
case 3:
|
|
129948
|
-
error_6 = _a.sent();
|
|
129949
|
-
return [2 /*return*/, {
|
|
129950
|
-
success: false,
|
|
129951
|
-
error: error_6.message,
|
|
129952
|
-
}];
|
|
129953
|
-
case 4: return [2 /*return*/];
|
|
129954
|
-
}
|
|
129955
|
-
});
|
|
129956
|
-
});
|
|
129957
|
-
};
|
|
129958
|
-
SmartWalletPlugin.prototype.removeSigner = function (walletAddress, signer) {
|
|
129959
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
129960
|
-
var walletContract, tx, receipt, error_7;
|
|
129961
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
129962
|
-
switch (_a.label) {
|
|
129963
|
-
case 0:
|
|
129964
|
-
_a.trys.push([0, 3, , 4]);
|
|
129965
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
129966
|
-
return [4 /*yield*/, walletContract.removeSigner(signer)];
|
|
129967
|
-
case 1:
|
|
129968
|
-
tx = _a.sent();
|
|
129969
|
-
return [4 /*yield*/, tx.wait()];
|
|
129970
|
-
case 2:
|
|
129971
|
-
receipt = _a.sent();
|
|
129972
|
-
return [2 /*return*/, {
|
|
129973
|
-
success: true,
|
|
129974
|
-
transactionHash: receipt.hash,
|
|
129975
|
-
}];
|
|
129976
|
-
case 3:
|
|
129977
|
-
error_7 = _a.sent();
|
|
129978
|
-
return [2 /*return*/, {
|
|
129979
|
-
success: false,
|
|
129980
|
-
error: error_7.message,
|
|
129981
|
-
}];
|
|
129982
|
-
case 4: return [2 /*return*/];
|
|
129983
|
-
}
|
|
129984
|
-
});
|
|
129985
|
-
});
|
|
129986
|
-
};
|
|
129987
|
-
SmartWalletPlugin.prototype.setRequiredSignatures = function (walletAddress, required) {
|
|
129988
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
129989
|
-
var walletContract, tx, receipt, error_8;
|
|
129990
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
129991
|
-
switch (_a.label) {
|
|
129992
|
-
case 0:
|
|
129993
|
-
_a.trys.push([0, 3, , 4]);
|
|
129994
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
129995
|
-
return [4 /*yield*/, walletContract.setRequiredSignatures(required)];
|
|
129996
|
-
case 1:
|
|
129997
|
-
tx = _a.sent();
|
|
129998
|
-
return [4 /*yield*/, tx.wait()];
|
|
129999
|
-
case 2:
|
|
130000
|
-
receipt = _a.sent();
|
|
130001
|
-
return [2 /*return*/, {
|
|
130002
|
-
success: true,
|
|
130003
|
-
transactionHash: receipt.hash,
|
|
130004
|
-
}];
|
|
130005
|
-
case 3:
|
|
130006
|
-
error_8 = _a.sent();
|
|
130007
|
-
return [2 /*return*/, {
|
|
130008
|
-
success: false,
|
|
130009
|
-
error: error_8.message,
|
|
130010
|
-
}];
|
|
130011
|
-
case 4: return [2 /*return*/];
|
|
130012
|
-
}
|
|
130013
|
-
});
|
|
130014
|
-
});
|
|
130015
|
-
};
|
|
130016
|
-
// ============================================ Guardian Management ============================================
|
|
130017
|
-
SmartWalletPlugin.prototype.addGuardian = function (walletAddress, guardian) {
|
|
130018
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
130019
|
-
var walletContract, tx, receipt, error_9;
|
|
130020
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
130021
|
-
switch (_a.label) {
|
|
130022
|
-
case 0:
|
|
130023
|
-
_a.trys.push([0, 3, , 4]);
|
|
130024
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
130025
|
-
return [4 /*yield*/, walletContract.addGuardian(guardian)];
|
|
130026
|
-
case 1:
|
|
130027
|
-
tx = _a.sent();
|
|
130028
|
-
return [4 /*yield*/, tx.wait()];
|
|
130029
|
-
case 2:
|
|
130030
|
-
receipt = _a.sent();
|
|
130031
|
-
return [2 /*return*/, {
|
|
130032
|
-
success: true,
|
|
130033
|
-
transactionHash: receipt.hash,
|
|
130034
|
-
}];
|
|
130035
|
-
case 3:
|
|
130036
|
-
error_9 = _a.sent();
|
|
130037
|
-
return [2 /*return*/, {
|
|
130038
|
-
success: false,
|
|
130039
|
-
error: error_9.message,
|
|
130040
|
-
}];
|
|
130041
|
-
case 4: return [2 /*return*/];
|
|
130042
|
-
}
|
|
130043
|
-
});
|
|
130044
|
-
});
|
|
130045
|
-
};
|
|
130046
|
-
SmartWalletPlugin.prototype.removeGuardian = function (walletAddress, guardian) {
|
|
130047
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
130048
|
-
var walletContract, tx, receipt, error_10;
|
|
130049
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
130050
|
-
switch (_a.label) {
|
|
130051
|
-
case 0:
|
|
130052
|
-
_a.trys.push([0, 3, , 4]);
|
|
130053
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
130054
|
-
return [4 /*yield*/, walletContract.removeGuardian(guardian)];
|
|
130055
|
-
case 1:
|
|
130056
|
-
tx = _a.sent();
|
|
130057
|
-
return [4 /*yield*/, tx.wait()];
|
|
130058
|
-
case 2:
|
|
130059
|
-
receipt = _a.sent();
|
|
130060
|
-
return [2 /*return*/, {
|
|
130061
|
-
success: true,
|
|
130062
|
-
transactionHash: receipt.hash,
|
|
130063
|
-
}];
|
|
130064
|
-
case 3:
|
|
130065
|
-
error_10 = _a.sent();
|
|
130066
|
-
return [2 /*return*/, {
|
|
130067
|
-
success: false,
|
|
130068
|
-
error: error_10.message,
|
|
130069
|
-
}];
|
|
130070
|
-
case 4: return [2 /*return*/];
|
|
130071
|
-
}
|
|
130072
|
-
});
|
|
130073
|
-
});
|
|
130074
|
-
};
|
|
130075
|
-
// ============================================ Execution ============================================
|
|
130076
|
-
SmartWalletPlugin.prototype.executeTransaction = function (walletAddress_1, target_1, data_1) {
|
|
130077
|
-
return smartWalletPlugin_awaiter(this, arguments, void 0, function (walletAddress, target, data, value) {
|
|
130078
|
-
var walletContract, tx, receipt, error_11;
|
|
130079
|
-
if (value === void 0) { value = "0"; }
|
|
130080
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
130081
|
-
switch (_a.label) {
|
|
130082
|
-
case 0:
|
|
130083
|
-
_a.trys.push([0, 3, , 4]);
|
|
130084
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
130085
|
-
return [4 /*yield*/, walletContract.execute(target, data, value)];
|
|
130086
|
-
case 1:
|
|
130087
|
-
tx = _a.sent();
|
|
130088
|
-
return [4 /*yield*/, tx.wait()];
|
|
130089
|
-
case 2:
|
|
130090
|
-
receipt = _a.sent();
|
|
130091
|
-
return [2 /*return*/, {
|
|
130092
|
-
success: true,
|
|
130093
|
-
transactionHash: receipt.hash,
|
|
130094
|
-
}];
|
|
130095
|
-
case 3:
|
|
130096
|
-
error_11 = _a.sent();
|
|
130097
|
-
return [2 /*return*/, {
|
|
130098
|
-
success: false,
|
|
130099
|
-
error: error_11.message,
|
|
130100
|
-
}];
|
|
130101
|
-
case 4: return [2 /*return*/];
|
|
130102
|
-
}
|
|
130103
|
-
});
|
|
130104
|
-
});
|
|
130105
|
-
};
|
|
130106
|
-
SmartWalletPlugin.prototype.executeBatch = function (walletAddress, targets, dataArray, values) {
|
|
130107
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
130108
|
-
var walletContract, tx, receipt, error_12;
|
|
130109
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
130110
|
-
switch (_a.label) {
|
|
130111
|
-
case 0:
|
|
130112
|
-
_a.trys.push([0, 3, , 4]);
|
|
130113
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
130114
|
-
return [4 /*yield*/, walletContract.executeBatch(targets, dataArray, values)];
|
|
130115
|
-
case 1:
|
|
130116
|
-
tx = _a.sent();
|
|
130117
|
-
return [4 /*yield*/, tx.wait()];
|
|
130118
|
-
case 2:
|
|
130119
|
-
receipt = _a.sent();
|
|
130120
|
-
return [2 /*return*/, {
|
|
130121
|
-
success: true,
|
|
130122
|
-
transactionHash: receipt.hash,
|
|
130123
|
-
}];
|
|
130124
|
-
case 3:
|
|
130125
|
-
error_12 = _a.sent();
|
|
130126
|
-
return [2 /*return*/, {
|
|
130127
|
-
success: false,
|
|
130128
|
-
error: error_12.message,
|
|
130129
|
-
}];
|
|
130130
|
-
case 4: return [2 /*return*/];
|
|
130131
|
-
}
|
|
130132
|
-
});
|
|
130133
|
-
});
|
|
130134
|
-
};
|
|
130135
|
-
// ============================================ Multi-Sig ============================================
|
|
130136
|
-
SmartWalletPlugin.prototype.proposeExecution = function (walletAddress, target, data) {
|
|
130137
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
130138
|
-
var walletContract, tx, receipt, error_13;
|
|
130139
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
130140
|
-
switch (_a.label) {
|
|
130141
|
-
case 0:
|
|
130142
|
-
_a.trys.push([0, 3, , 4]);
|
|
130143
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
130144
|
-
return [4 /*yield*/, walletContract.proposeExecution(target, data)];
|
|
130145
|
-
case 1:
|
|
130146
|
-
tx = _a.sent();
|
|
130147
|
-
return [4 /*yield*/, tx.wait()];
|
|
130148
|
-
case 2:
|
|
130149
|
-
receipt = _a.sent();
|
|
130150
|
-
return [2 /*return*/, {
|
|
130151
|
-
success: true,
|
|
130152
|
-
transactionHash: receipt.hash,
|
|
130153
|
-
}];
|
|
130154
|
-
case 3:
|
|
130155
|
-
error_13 = _a.sent();
|
|
130156
|
-
return [2 /*return*/, {
|
|
130157
|
-
success: false,
|
|
130158
|
-
error: error_13.message,
|
|
130159
|
-
}];
|
|
130160
|
-
case 4: return [2 /*return*/];
|
|
130161
|
-
}
|
|
130162
|
-
});
|
|
130163
|
-
});
|
|
130164
|
-
};
|
|
130165
|
-
SmartWalletPlugin.prototype.approveProposal = function (walletAddress, proposalId) {
|
|
130166
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
130167
|
-
var walletContract, tx, receipt, error_14;
|
|
130168
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
130169
|
-
switch (_a.label) {
|
|
130170
|
-
case 0:
|
|
130171
|
-
_a.trys.push([0, 3, , 4]);
|
|
130172
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
130173
|
-
return [4 /*yield*/, walletContract.approveProposal(proposalId)];
|
|
130174
|
-
case 1:
|
|
130175
|
-
tx = _a.sent();
|
|
130176
|
-
return [4 /*yield*/, tx.wait()];
|
|
130177
|
-
case 2:
|
|
130178
|
-
receipt = _a.sent();
|
|
130179
|
-
return [2 /*return*/, {
|
|
130180
|
-
success: true,
|
|
130181
|
-
transactionHash: receipt.hash,
|
|
130182
|
-
}];
|
|
130183
|
-
case 3:
|
|
130184
|
-
error_14 = _a.sent();
|
|
130185
|
-
return [2 /*return*/, {
|
|
130186
|
-
success: false,
|
|
130187
|
-
error: error_14.message,
|
|
130188
|
-
}];
|
|
130189
|
-
case 4: return [2 /*return*/];
|
|
130190
|
-
}
|
|
130191
|
-
});
|
|
130192
|
-
});
|
|
130193
|
-
};
|
|
130194
|
-
SmartWalletPlugin.prototype.getProposalInfo = function (walletAddress, proposalId) {
|
|
130195
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
130196
|
-
var provider, walletContract, _a, target, data, proposer, approvals, executed, error_15;
|
|
130197
|
-
return smartWalletPlugin_generator(this, function (_b) {
|
|
130198
|
-
switch (_b.label) {
|
|
130199
|
-
case 0:
|
|
130200
|
-
_b.trys.push([0, 2, , 3]);
|
|
130201
|
-
provider = this.assertSigner().provider || getDefaultProvider();
|
|
130202
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, provider);
|
|
130203
|
-
return [4 /*yield*/, walletContract.getProposal(proposalId)];
|
|
130204
|
-
case 1:
|
|
130205
|
-
_a = smartWalletPlugin_read.apply(void 0, [_b.sent(), 5]), target = _a[0], data = _a[1], proposer = _a[2], approvals = _a[3], executed = _a[4];
|
|
130206
|
-
return [2 /*return*/, {
|
|
130207
|
-
proposalId: proposalId,
|
|
130208
|
-
target: target,
|
|
130209
|
-
proposer: proposer,
|
|
130210
|
-
approvals: Number(approvals),
|
|
130211
|
-
executed: executed,
|
|
130212
|
-
}];
|
|
130213
|
-
case 2:
|
|
130214
|
-
error_15 = _b.sent();
|
|
130215
|
-
console.error("[SmartWallet] Error getting proposal info:", error_15);
|
|
130216
|
-
return [2 /*return*/, null];
|
|
130217
|
-
case 3: return [2 /*return*/];
|
|
130218
|
-
}
|
|
130219
|
-
});
|
|
130220
|
-
});
|
|
130221
|
-
};
|
|
130222
|
-
// ============================================ Recovery ============================================
|
|
130223
|
-
SmartWalletPlugin.prototype.initiateRecovery = function (walletAddress, newOwner) {
|
|
130224
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
130225
|
-
var walletContract, tx, receipt, error_16;
|
|
130226
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
130227
|
-
switch (_a.label) {
|
|
130228
|
-
case 0:
|
|
130229
|
-
_a.trys.push([0, 3, , 4]);
|
|
130230
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
130231
|
-
return [4 /*yield*/, walletContract.initiateRecovery(newOwner)];
|
|
130232
|
-
case 1:
|
|
130233
|
-
tx = _a.sent();
|
|
130234
|
-
return [4 /*yield*/, tx.wait()];
|
|
130235
|
-
case 2:
|
|
130236
|
-
receipt = _a.sent();
|
|
130237
|
-
return [2 /*return*/, {
|
|
130238
|
-
success: true,
|
|
130239
|
-
transactionHash: receipt.hash,
|
|
130240
|
-
}];
|
|
130241
|
-
case 3:
|
|
130242
|
-
error_16 = _a.sent();
|
|
130243
|
-
return [2 /*return*/, {
|
|
130244
|
-
success: false,
|
|
130245
|
-
error: error_16.message,
|
|
130246
|
-
}];
|
|
130247
|
-
case 4: return [2 /*return*/];
|
|
130248
|
-
}
|
|
130249
|
-
});
|
|
130250
|
-
});
|
|
130251
|
-
};
|
|
130252
|
-
SmartWalletPlugin.prototype.approveRecovery = function (walletAddress) {
|
|
130253
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
130254
|
-
var walletContract, tx, receipt, error_17;
|
|
130255
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
130256
|
-
switch (_a.label) {
|
|
130257
|
-
case 0:
|
|
130258
|
-
_a.trys.push([0, 3, , 4]);
|
|
130259
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
130260
|
-
return [4 /*yield*/, walletContract.approveRecovery()];
|
|
130261
|
-
case 1:
|
|
130262
|
-
tx = _a.sent();
|
|
130263
|
-
return [4 /*yield*/, tx.wait()];
|
|
130264
|
-
case 2:
|
|
130265
|
-
receipt = _a.sent();
|
|
130266
|
-
return [2 /*return*/, {
|
|
130267
|
-
success: true,
|
|
130268
|
-
transactionHash: receipt.hash,
|
|
130269
|
-
}];
|
|
130270
|
-
case 3:
|
|
130271
|
-
error_17 = _a.sent();
|
|
130272
|
-
return [2 /*return*/, {
|
|
130273
|
-
success: false,
|
|
130274
|
-
error: error_17.message,
|
|
130275
|
-
}];
|
|
130276
|
-
case 4: return [2 /*return*/];
|
|
130277
|
-
}
|
|
130278
|
-
});
|
|
130279
|
-
});
|
|
130280
|
-
};
|
|
130281
|
-
SmartWalletPlugin.prototype.executeRecovery = function (walletAddress) {
|
|
130282
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
130283
|
-
var walletContract, tx, receipt, error_18;
|
|
130284
|
-
return smartWalletPlugin_generator(this, function (_a) {
|
|
130285
|
-
switch (_a.label) {
|
|
130286
|
-
case 0:
|
|
130287
|
-
_a.trys.push([0, 3, , 4]);
|
|
130288
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, this.assertSigner());
|
|
130289
|
-
return [4 /*yield*/, walletContract.executeRecovery()];
|
|
130290
|
-
case 1:
|
|
130291
|
-
tx = _a.sent();
|
|
130292
|
-
return [4 /*yield*/, tx.wait()];
|
|
130293
|
-
case 2:
|
|
130294
|
-
receipt = _a.sent();
|
|
130295
|
-
return [2 /*return*/, {
|
|
130296
|
-
success: true,
|
|
130297
|
-
transactionHash: receipt.hash,
|
|
130298
|
-
}];
|
|
130299
|
-
case 3:
|
|
130300
|
-
error_18 = _a.sent();
|
|
130301
|
-
return [2 /*return*/, {
|
|
130302
|
-
success: false,
|
|
130303
|
-
error: error_18.message,
|
|
130304
|
-
}];
|
|
130305
|
-
case 4: return [2 /*return*/];
|
|
130306
|
-
}
|
|
130307
|
-
});
|
|
130308
|
-
});
|
|
130309
|
-
};
|
|
130310
|
-
SmartWalletPlugin.prototype.getRecoveryRequest = function (walletAddress) {
|
|
130311
|
-
return smartWalletPlugin_awaiter(this, void 0, void 0, function () {
|
|
130312
|
-
var provider, walletContract, _a, newOwner, unlockTime, approvals, error_19;
|
|
130313
|
-
return smartWalletPlugin_generator(this, function (_b) {
|
|
130314
|
-
switch (_b.label) {
|
|
130315
|
-
case 0:
|
|
130316
|
-
_b.trys.push([0, 2, , 3]);
|
|
130317
|
-
provider = this.assertSigner().provider || getDefaultProvider();
|
|
130318
|
-
walletContract = new Contract(walletAddress, SMART_WALLET_ABI, provider);
|
|
130319
|
-
return [4 /*yield*/, walletContract.getRecoveryRequest()];
|
|
130320
|
-
case 1:
|
|
130321
|
-
_a = smartWalletPlugin_read.apply(void 0, [_b.sent(), 3]), newOwner = _a[0], unlockTime = _a[1], approvals = _a[2];
|
|
130322
|
-
return [2 /*return*/, {
|
|
130323
|
-
newOwner: newOwner,
|
|
130324
|
-
unlockTime: Number(unlockTime),
|
|
130325
|
-
approvals: Number(approvals),
|
|
130326
|
-
}];
|
|
130327
|
-
case 2:
|
|
130328
|
-
error_19 = _b.sent();
|
|
130329
|
-
console.error("[SmartWallet] Error getting recovery request:", error_19);
|
|
130330
|
-
return [2 /*return*/, null];
|
|
130331
|
-
case 3: return [2 /*return*/];
|
|
130332
|
-
}
|
|
130333
|
-
});
|
|
130334
|
-
});
|
|
130335
|
-
};
|
|
130336
|
-
return SmartWalletPlugin;
|
|
130337
|
-
}(BasePlugin));
|
|
130338
|
-
|
|
130339
|
-
|
|
130340
126907
|
;// ./src/plugins/index.ts
|
|
130341
126908
|
// Base plugin interface and types
|
|
130342
126909
|
|
|
@@ -130353,8 +126920,6 @@ var SmartWalletPlugin = /** @class */ (function (_super) {
|
|
|
130353
126920
|
|
|
130354
126921
|
|
|
130355
126922
|
|
|
130356
|
-
// Smart Wallet plugin exports
|
|
130357
|
-
|
|
130358
126923
|
|
|
130359
126924
|
// EXTERNAL MODULE: external "Gun"
|
|
130360
126925
|
var external_Gun_ = __webpack_require__("gun");
|