@dappworks/kit 0.5.20 → 0.5.22
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/{PromiseState-GU5X863c.d.ts → PromiseState-DVdsif1j.d.ts} +1 -1
- package/dist/{chunk-I3PECBV3.mjs → chunk-43PPHYFY.mjs} +505 -31
- package/dist/chunk-43PPHYFY.mjs.map +1 -0
- package/dist/{chunk-4MCAH3FV.mjs → chunk-B7RV4C5E.mjs} +8 -8
- package/dist/chunk-B7RV4C5E.mjs.map +1 -0
- package/dist/experimental.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/plugins.d.mts +1 -1
- package/dist/wallet.mjs +3 -3
- package/package.json +1 -1
- package/dist/chunk-4MCAH3FV.mjs.map +0 -1
- package/dist/chunk-I3PECBV3.mjs.map +0 -1
|
@@ -17,7 +17,6 @@ declare class PromiseState<T extends (...args: any[]) => Promise<any>, U = Retur
|
|
|
17
17
|
defaultValue: any;
|
|
18
18
|
function: T;
|
|
19
19
|
transform?: (value: any) => Promise<Awaited<U>> | Awaited<U>;
|
|
20
|
-
signOut?: () => void | null;
|
|
21
20
|
onError?: (error: any) => void | null;
|
|
22
21
|
autoAlert: boolean;
|
|
23
22
|
autoUpdate: boolean;
|
|
@@ -26,6 +25,7 @@ declare class PromiseState<T extends (...args: any[]) => Promise<any>, U = Retur
|
|
|
26
25
|
context: any;
|
|
27
26
|
successMsg: string;
|
|
28
27
|
errMsg: string;
|
|
28
|
+
showUnauthorizedAlert: boolean;
|
|
29
29
|
loadingLock: boolean;
|
|
30
30
|
event: EventEmitter<[never]>;
|
|
31
31
|
on<E extends keyof Events>(event: E, listener: Events[E]): this;
|
|
@@ -6934,10 +6934,10 @@ __export(ethers_exports, {
|
|
|
6934
6934
|
constants: () => lib_exports2,
|
|
6935
6935
|
errors: () => ErrorCode,
|
|
6936
6936
|
getDefaultProvider: () => getDefaultProvider,
|
|
6937
|
-
logger: () =>
|
|
6937
|
+
logger: () => logger47,
|
|
6938
6938
|
providers: () => lib_exports4,
|
|
6939
6939
|
utils: () => utils_exports,
|
|
6940
|
-
version: () =>
|
|
6940
|
+
version: () => version27,
|
|
6941
6941
|
wordlists: () => wordlists
|
|
6942
6942
|
});
|
|
6943
6943
|
|
|
@@ -7010,10 +7010,10 @@ var ErrorCode;
|
|
|
7010
7010
|
})(ErrorCode || (ErrorCode = {}));
|
|
7011
7011
|
var HEX = "0123456789abcdef";
|
|
7012
7012
|
var Logger = class _Logger {
|
|
7013
|
-
constructor(
|
|
7013
|
+
constructor(version28) {
|
|
7014
7014
|
Object.defineProperty(this, "version", {
|
|
7015
7015
|
enumerable: true,
|
|
7016
|
-
value:
|
|
7016
|
+
value: version28,
|
|
7017
7017
|
writable: false
|
|
7018
7018
|
});
|
|
7019
7019
|
}
|
|
@@ -7225,8 +7225,8 @@ var Logger = class _Logger {
|
|
|
7225
7225
|
}
|
|
7226
7226
|
_logLevel = level;
|
|
7227
7227
|
}
|
|
7228
|
-
static from(
|
|
7229
|
-
return new _Logger(
|
|
7228
|
+
static from(version28) {
|
|
7229
|
+
return new _Logger(version28);
|
|
7230
7230
|
}
|
|
7231
7231
|
};
|
|
7232
7232
|
Logger.errors = ErrorCode;
|
|
@@ -16701,7 +16701,7 @@ __export(lib_exports4, {
|
|
|
16701
16701
|
});
|
|
16702
16702
|
|
|
16703
16703
|
// ../../node_modules/@ethersproject/networks/lib.esm/_version.js
|
|
16704
|
-
var version21 = "networks/5.7.
|
|
16704
|
+
var version21 = "networks/5.7.1";
|
|
16705
16705
|
|
|
16706
16706
|
// ../../node_modules/@ethersproject/networks/lib.esm/index.js
|
|
16707
16707
|
var logger27 = new Logger(version21);
|
|
@@ -16733,7 +16733,7 @@ function ethDefaultProvider(network) {
|
|
|
16733
16733
|
}
|
|
16734
16734
|
}
|
|
16735
16735
|
if (providers.PocketProvider && options.pocket !== "-") {
|
|
16736
|
-
const skip = ["goerli", "ropsten", "rinkeby"];
|
|
16736
|
+
const skip = ["goerli", "ropsten", "rinkeby", "sepolia"];
|
|
16737
16737
|
try {
|
|
16738
16738
|
const provider = new providers.PocketProvider(network, options.pocket);
|
|
16739
16739
|
if (provider.network && skip.indexOf(provider.network.name) === -1) {
|
|
@@ -16831,6 +16831,11 @@ var networks = {
|
|
|
16831
16831
|
_defaultProvider: ethDefaultProvider("goerli")
|
|
16832
16832
|
},
|
|
16833
16833
|
kintsugi: { chainId: 1337702, name: "kintsugi" },
|
|
16834
|
+
sepolia: {
|
|
16835
|
+
chainId: 11155111,
|
|
16836
|
+
name: "sepolia",
|
|
16837
|
+
_defaultProvider: ethDefaultProvider("sepolia")
|
|
16838
|
+
},
|
|
16834
16839
|
// ETC (See: #351)
|
|
16835
16840
|
classic: {
|
|
16836
16841
|
chainId: 61,
|
|
@@ -16925,7 +16930,7 @@ function getNetwork(network) {
|
|
|
16925
16930
|
}
|
|
16926
16931
|
|
|
16927
16932
|
// ../../node_modules/@ethersproject/web/lib.esm/_version.js
|
|
16928
|
-
var version22 = "web/5.7.
|
|
16933
|
+
var version22 = "web/5.7.1";
|
|
16929
16934
|
|
|
16930
16935
|
// ../../node_modules/@ethersproject/web/lib.esm/geturl.js
|
|
16931
16936
|
var __awaiter8 = function(thisArg, _arguments, P, generator) {
|
|
@@ -17063,6 +17068,11 @@ function bodyify(value, type) {
|
|
|
17063
17068
|
}
|
|
17064
17069
|
return value;
|
|
17065
17070
|
}
|
|
17071
|
+
function unpercent(value) {
|
|
17072
|
+
return toUtf8Bytes(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => {
|
|
17073
|
+
return String.fromCharCode(parseInt(code, 16));
|
|
17074
|
+
}));
|
|
17075
|
+
}
|
|
17066
17076
|
function _fetchData(connection, body, processFunc) {
|
|
17067
17077
|
const attemptLimit = typeof connection === "object" && connection.throttleLimit != null ? connection.throttleLimit : 12;
|
|
17068
17078
|
logger28.assertArgument(attemptLimit > 0 && attemptLimit % 1 === 0, "invalid connection throttle limit", "connection.throttleLimit", attemptLimit);
|
|
@@ -17113,15 +17123,15 @@ function _fetchData(connection, body, processFunc) {
|
|
|
17113
17123
|
options.fetchOptions = shallowCopy(connection.fetchOptions);
|
|
17114
17124
|
}
|
|
17115
17125
|
}
|
|
17116
|
-
const reData = new RegExp("^data:([
|
|
17126
|
+
const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i");
|
|
17117
17127
|
const dataMatch = url ? url.match(reData) : null;
|
|
17118
17128
|
if (dataMatch) {
|
|
17119
17129
|
try {
|
|
17120
17130
|
const response = {
|
|
17121
17131
|
statusCode: 200,
|
|
17122
17132
|
statusMessage: "OK",
|
|
17123
|
-
headers: { "content-type": dataMatch[1] },
|
|
17124
|
-
body: decode2(dataMatch[
|
|
17133
|
+
headers: { "content-type": dataMatch[1] || "text/plain" },
|
|
17134
|
+
body: dataMatch[2] ? decode2(dataMatch[3]) : unpercent(dataMatch[3])
|
|
17125
17135
|
};
|
|
17126
17136
|
let result = response.body;
|
|
17127
17137
|
if (processFunc) {
|
|
@@ -18139,17 +18149,17 @@ var Resolver = class {
|
|
|
18139
18149
|
}
|
|
18140
18150
|
if (coinInfo.prefix != null) {
|
|
18141
18151
|
const length = bytes[1];
|
|
18142
|
-
let
|
|
18143
|
-
if (
|
|
18152
|
+
let version28 = bytes[0];
|
|
18153
|
+
if (version28 === 0) {
|
|
18144
18154
|
if (length !== 20 && length !== 32) {
|
|
18145
|
-
|
|
18155
|
+
version28 = -1;
|
|
18146
18156
|
}
|
|
18147
18157
|
} else {
|
|
18148
|
-
|
|
18158
|
+
version28 = -1;
|
|
18149
18159
|
}
|
|
18150
|
-
if (
|
|
18160
|
+
if (version28 >= 0 && bytes.length === 2 + length && length >= 1 && length <= 75) {
|
|
18151
18161
|
const words2 = import_bech32.default.toWords(bytes.slice(2));
|
|
18152
|
-
words2.unshift(
|
|
18162
|
+
words2.unshift(version28);
|
|
18153
18163
|
return import_bech32.default.encode(coinInfo.prefix, words2);
|
|
18154
18164
|
}
|
|
18155
18165
|
}
|
|
@@ -20204,7 +20214,7 @@ var JsonRpcProvider = class extends BaseProvider {
|
|
|
20204
20214
|
const pendingFilter = this.send("eth_newPendingTransactionFilter", []);
|
|
20205
20215
|
this._pendingFilter = pendingFilter;
|
|
20206
20216
|
pendingFilter.then(function(filterId) {
|
|
20207
|
-
function
|
|
20217
|
+
function poll3() {
|
|
20208
20218
|
self2.send("eth_getFilterChanges", [filterId]).then(function(hashes) {
|
|
20209
20219
|
if (self2._pendingFilter != pendingFilter) {
|
|
20210
20220
|
return null;
|
|
@@ -20228,13 +20238,13 @@ var JsonRpcProvider = class extends BaseProvider {
|
|
|
20228
20238
|
return;
|
|
20229
20239
|
}
|
|
20230
20240
|
setTimeout(function() {
|
|
20231
|
-
|
|
20241
|
+
poll3();
|
|
20232
20242
|
}, 0);
|
|
20233
20243
|
return null;
|
|
20234
20244
|
}).catch((error) => {
|
|
20235
20245
|
});
|
|
20236
20246
|
}
|
|
20237
|
-
|
|
20247
|
+
poll3();
|
|
20238
20248
|
return filterId;
|
|
20239
20249
|
}).catch((error) => {
|
|
20240
20250
|
});
|
|
@@ -20296,9 +20306,9 @@ try {
|
|
|
20296
20306
|
throw new Error("inject please");
|
|
20297
20307
|
}
|
|
20298
20308
|
} catch (error) {
|
|
20299
|
-
const
|
|
20309
|
+
const logger48 = new Logger(version23);
|
|
20300
20310
|
WS = function() {
|
|
20301
|
-
|
|
20311
|
+
logger48.throwError("WebSockets not supported in this environment", Logger.errors.UNSUPPORTED_OPERATION, {
|
|
20302
20312
|
operation: "new WebSocket()"
|
|
20303
20313
|
});
|
|
20304
20314
|
};
|
|
@@ -22281,7 +22291,7 @@ __export(utils_exports, {
|
|
|
22281
22291
|
Utf8ErrorFuncs: () => Utf8ErrorFuncs,
|
|
22282
22292
|
Utf8ErrorReason: () => Utf8ErrorReason,
|
|
22283
22293
|
_TypedDataEncoder: () => TypedDataEncoder,
|
|
22284
|
-
_fetchData: () =>
|
|
22294
|
+
_fetchData: () => _fetchData2,
|
|
22285
22295
|
_toEscapedUtf8String: () => _toEscapedUtf8String,
|
|
22286
22296
|
accessListify: () => accessListify,
|
|
22287
22297
|
arrayify: () => arrayify,
|
|
@@ -22300,7 +22310,7 @@ __export(utils_exports, {
|
|
|
22300
22310
|
defineReadOnly: () => defineReadOnly,
|
|
22301
22311
|
dnsEncode: () => dnsEncode,
|
|
22302
22312
|
entropyToMnemonic: () => entropyToMnemonic,
|
|
22303
|
-
fetchJson: () =>
|
|
22313
|
+
fetchJson: () => fetchJson2,
|
|
22304
22314
|
formatBytes32String: () => formatBytes32String,
|
|
22305
22315
|
formatEther: () => formatEther,
|
|
22306
22316
|
formatUnits: () => formatUnits,
|
|
@@ -22336,7 +22346,7 @@ __export(utils_exports, {
|
|
|
22336
22346
|
parseEther: () => parseEther,
|
|
22337
22347
|
parseTransaction: () => parse,
|
|
22338
22348
|
parseUnits: () => parseUnits,
|
|
22339
|
-
poll: () =>
|
|
22349
|
+
poll: () => poll2,
|
|
22340
22350
|
randomBytes: () => randomBytes,
|
|
22341
22351
|
recoverAddress: () => recoverAddress,
|
|
22342
22352
|
recoverPublicKey: () => recoverPublicKey,
|
|
@@ -22524,11 +22534,473 @@ function parseEther(ether) {
|
|
|
22524
22534
|
return parseUnits(ether, 18);
|
|
22525
22535
|
}
|
|
22526
22536
|
|
|
22537
|
+
// ../../node_modules/ethers/node_modules/@ethersproject/web/lib.esm/_version.js
|
|
22538
|
+
var version26 = "web/5.7.0";
|
|
22539
|
+
|
|
22540
|
+
// ../../node_modules/ethers/node_modules/@ethersproject/web/lib.esm/geturl.js
|
|
22541
|
+
var __awaiter17 = function(thisArg, _arguments, P, generator) {
|
|
22542
|
+
function adopt(value) {
|
|
22543
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
22544
|
+
resolve(value);
|
|
22545
|
+
});
|
|
22546
|
+
}
|
|
22547
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
22548
|
+
function fulfilled(value) {
|
|
22549
|
+
try {
|
|
22550
|
+
step(generator.next(value));
|
|
22551
|
+
} catch (e) {
|
|
22552
|
+
reject(e);
|
|
22553
|
+
}
|
|
22554
|
+
}
|
|
22555
|
+
function rejected(value) {
|
|
22556
|
+
try {
|
|
22557
|
+
step(generator["throw"](value));
|
|
22558
|
+
} catch (e) {
|
|
22559
|
+
reject(e);
|
|
22560
|
+
}
|
|
22561
|
+
}
|
|
22562
|
+
function step(result) {
|
|
22563
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
22564
|
+
}
|
|
22565
|
+
step((generator = generator.apply(thisArg, [])).next());
|
|
22566
|
+
});
|
|
22567
|
+
};
|
|
22568
|
+
function getUrl2(href, options) {
|
|
22569
|
+
return __awaiter17(this, void 0, void 0, function* () {
|
|
22570
|
+
if (options == null) {
|
|
22571
|
+
options = {};
|
|
22572
|
+
}
|
|
22573
|
+
const request = {
|
|
22574
|
+
method: options.method || "GET",
|
|
22575
|
+
headers: options.headers || {},
|
|
22576
|
+
body: options.body || void 0
|
|
22577
|
+
};
|
|
22578
|
+
if (options.skipFetchSetup !== true) {
|
|
22579
|
+
request.mode = "cors";
|
|
22580
|
+
request.cache = "no-cache";
|
|
22581
|
+
request.credentials = "same-origin";
|
|
22582
|
+
request.redirect = "follow";
|
|
22583
|
+
request.referrer = "client";
|
|
22584
|
+
}
|
|
22585
|
+
if (options.fetchOptions != null) {
|
|
22586
|
+
const opts = options.fetchOptions;
|
|
22587
|
+
if (opts.mode) {
|
|
22588
|
+
request.mode = opts.mode;
|
|
22589
|
+
}
|
|
22590
|
+
if (opts.cache) {
|
|
22591
|
+
request.cache = opts.cache;
|
|
22592
|
+
}
|
|
22593
|
+
if (opts.credentials) {
|
|
22594
|
+
request.credentials = opts.credentials;
|
|
22595
|
+
}
|
|
22596
|
+
if (opts.redirect) {
|
|
22597
|
+
request.redirect = opts.redirect;
|
|
22598
|
+
}
|
|
22599
|
+
if (opts.referrer) {
|
|
22600
|
+
request.referrer = opts.referrer;
|
|
22601
|
+
}
|
|
22602
|
+
}
|
|
22603
|
+
const response = yield fetch(href, request);
|
|
22604
|
+
const body = yield response.arrayBuffer();
|
|
22605
|
+
const headers = {};
|
|
22606
|
+
if (response.headers.forEach) {
|
|
22607
|
+
response.headers.forEach((value, key2) => {
|
|
22608
|
+
headers[key2.toLowerCase()] = value;
|
|
22609
|
+
});
|
|
22610
|
+
} else {
|
|
22611
|
+
response.headers.keys().forEach((key2) => {
|
|
22612
|
+
headers[key2.toLowerCase()] = response.headers.get(key2);
|
|
22613
|
+
});
|
|
22614
|
+
}
|
|
22615
|
+
return {
|
|
22616
|
+
headers,
|
|
22617
|
+
statusCode: response.status,
|
|
22618
|
+
statusMessage: response.statusText,
|
|
22619
|
+
body: arrayify(new Uint8Array(body))
|
|
22620
|
+
};
|
|
22621
|
+
});
|
|
22622
|
+
}
|
|
22623
|
+
|
|
22624
|
+
// ../../node_modules/ethers/node_modules/@ethersproject/web/lib.esm/index.js
|
|
22625
|
+
var __awaiter18 = function(thisArg, _arguments, P, generator) {
|
|
22626
|
+
function adopt(value) {
|
|
22627
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
22628
|
+
resolve(value);
|
|
22629
|
+
});
|
|
22630
|
+
}
|
|
22631
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
22632
|
+
function fulfilled(value) {
|
|
22633
|
+
try {
|
|
22634
|
+
step(generator.next(value));
|
|
22635
|
+
} catch (e) {
|
|
22636
|
+
reject(e);
|
|
22637
|
+
}
|
|
22638
|
+
}
|
|
22639
|
+
function rejected(value) {
|
|
22640
|
+
try {
|
|
22641
|
+
step(generator["throw"](value));
|
|
22642
|
+
} catch (e) {
|
|
22643
|
+
reject(e);
|
|
22644
|
+
}
|
|
22645
|
+
}
|
|
22646
|
+
function step(result) {
|
|
22647
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
22648
|
+
}
|
|
22649
|
+
step((generator = generator.apply(thisArg, [])).next());
|
|
22650
|
+
});
|
|
22651
|
+
};
|
|
22652
|
+
var logger46 = new Logger(version26);
|
|
22653
|
+
function staller2(duration) {
|
|
22654
|
+
return new Promise((resolve) => {
|
|
22655
|
+
setTimeout(resolve, duration);
|
|
22656
|
+
});
|
|
22657
|
+
}
|
|
22658
|
+
function bodyify2(value, type) {
|
|
22659
|
+
if (value == null) {
|
|
22660
|
+
return null;
|
|
22661
|
+
}
|
|
22662
|
+
if (typeof value === "string") {
|
|
22663
|
+
return value;
|
|
22664
|
+
}
|
|
22665
|
+
if (isBytesLike(value)) {
|
|
22666
|
+
if (type && (type.split("/")[0] === "text" || type.split(";")[0].trim() === "application/json")) {
|
|
22667
|
+
try {
|
|
22668
|
+
return toUtf8String(value);
|
|
22669
|
+
} catch (error) {
|
|
22670
|
+
}
|
|
22671
|
+
}
|
|
22672
|
+
return hexlify(value);
|
|
22673
|
+
}
|
|
22674
|
+
return value;
|
|
22675
|
+
}
|
|
22676
|
+
function _fetchData2(connection, body, processFunc) {
|
|
22677
|
+
const attemptLimit = typeof connection === "object" && connection.throttleLimit != null ? connection.throttleLimit : 12;
|
|
22678
|
+
logger46.assertArgument(attemptLimit > 0 && attemptLimit % 1 === 0, "invalid connection throttle limit", "connection.throttleLimit", attemptLimit);
|
|
22679
|
+
const throttleCallback = typeof connection === "object" ? connection.throttleCallback : null;
|
|
22680
|
+
const throttleSlotInterval = typeof connection === "object" && typeof connection.throttleSlotInterval === "number" ? connection.throttleSlotInterval : 100;
|
|
22681
|
+
logger46.assertArgument(throttleSlotInterval > 0 && throttleSlotInterval % 1 === 0, "invalid connection throttle slot interval", "connection.throttleSlotInterval", throttleSlotInterval);
|
|
22682
|
+
const errorPassThrough = typeof connection === "object" ? !!connection.errorPassThrough : false;
|
|
22683
|
+
const headers = {};
|
|
22684
|
+
let url = null;
|
|
22685
|
+
const options = {
|
|
22686
|
+
method: "GET"
|
|
22687
|
+
};
|
|
22688
|
+
let allow304 = false;
|
|
22689
|
+
let timeout = 2 * 60 * 1e3;
|
|
22690
|
+
if (typeof connection === "string") {
|
|
22691
|
+
url = connection;
|
|
22692
|
+
} else if (typeof connection === "object") {
|
|
22693
|
+
if (connection == null || connection.url == null) {
|
|
22694
|
+
logger46.throwArgumentError("missing URL", "connection.url", connection);
|
|
22695
|
+
}
|
|
22696
|
+
url = connection.url;
|
|
22697
|
+
if (typeof connection.timeout === "number" && connection.timeout > 0) {
|
|
22698
|
+
timeout = connection.timeout;
|
|
22699
|
+
}
|
|
22700
|
+
if (connection.headers) {
|
|
22701
|
+
for (const key2 in connection.headers) {
|
|
22702
|
+
headers[key2.toLowerCase()] = { key: key2, value: String(connection.headers[key2]) };
|
|
22703
|
+
if (["if-none-match", "if-modified-since"].indexOf(key2.toLowerCase()) >= 0) {
|
|
22704
|
+
allow304 = true;
|
|
22705
|
+
}
|
|
22706
|
+
}
|
|
22707
|
+
}
|
|
22708
|
+
options.allowGzip = !!connection.allowGzip;
|
|
22709
|
+
if (connection.user != null && connection.password != null) {
|
|
22710
|
+
if (url.substring(0, 6) !== "https:" && connection.allowInsecureAuthentication !== true) {
|
|
22711
|
+
logger46.throwError("basic authentication requires a secure https url", Logger.errors.INVALID_ARGUMENT, { argument: "url", url, user: connection.user, password: "[REDACTED]" });
|
|
22712
|
+
}
|
|
22713
|
+
const authorization = connection.user + ":" + connection.password;
|
|
22714
|
+
headers["authorization"] = {
|
|
22715
|
+
key: "Authorization",
|
|
22716
|
+
value: "Basic " + encode2(toUtf8Bytes(authorization))
|
|
22717
|
+
};
|
|
22718
|
+
}
|
|
22719
|
+
if (connection.skipFetchSetup != null) {
|
|
22720
|
+
options.skipFetchSetup = !!connection.skipFetchSetup;
|
|
22721
|
+
}
|
|
22722
|
+
if (connection.fetchOptions != null) {
|
|
22723
|
+
options.fetchOptions = shallowCopy(connection.fetchOptions);
|
|
22724
|
+
}
|
|
22725
|
+
}
|
|
22726
|
+
const reData = new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$", "i");
|
|
22727
|
+
const dataMatch = url ? url.match(reData) : null;
|
|
22728
|
+
if (dataMatch) {
|
|
22729
|
+
try {
|
|
22730
|
+
const response = {
|
|
22731
|
+
statusCode: 200,
|
|
22732
|
+
statusMessage: "OK",
|
|
22733
|
+
headers: { "content-type": dataMatch[1] },
|
|
22734
|
+
body: decode2(dataMatch[2])
|
|
22735
|
+
};
|
|
22736
|
+
let result = response.body;
|
|
22737
|
+
if (processFunc) {
|
|
22738
|
+
result = processFunc(response.body, response);
|
|
22739
|
+
}
|
|
22740
|
+
return Promise.resolve(result);
|
|
22741
|
+
} catch (error) {
|
|
22742
|
+
logger46.throwError("processing response error", Logger.errors.SERVER_ERROR, {
|
|
22743
|
+
body: bodyify2(dataMatch[1], dataMatch[2]),
|
|
22744
|
+
error,
|
|
22745
|
+
requestBody: null,
|
|
22746
|
+
requestMethod: "GET",
|
|
22747
|
+
url
|
|
22748
|
+
});
|
|
22749
|
+
}
|
|
22750
|
+
}
|
|
22751
|
+
if (body) {
|
|
22752
|
+
options.method = "POST";
|
|
22753
|
+
options.body = body;
|
|
22754
|
+
if (headers["content-type"] == null) {
|
|
22755
|
+
headers["content-type"] = { key: "Content-Type", value: "application/octet-stream" };
|
|
22756
|
+
}
|
|
22757
|
+
if (headers["content-length"] == null) {
|
|
22758
|
+
headers["content-length"] = { key: "Content-Length", value: String(body.length) };
|
|
22759
|
+
}
|
|
22760
|
+
}
|
|
22761
|
+
const flatHeaders = {};
|
|
22762
|
+
Object.keys(headers).forEach((key2) => {
|
|
22763
|
+
const header = headers[key2];
|
|
22764
|
+
flatHeaders[header.key] = header.value;
|
|
22765
|
+
});
|
|
22766
|
+
options.headers = flatHeaders;
|
|
22767
|
+
const runningTimeout = function() {
|
|
22768
|
+
let timer2 = null;
|
|
22769
|
+
const promise = new Promise(function(resolve, reject) {
|
|
22770
|
+
if (timeout) {
|
|
22771
|
+
timer2 = setTimeout(() => {
|
|
22772
|
+
if (timer2 == null) {
|
|
22773
|
+
return;
|
|
22774
|
+
}
|
|
22775
|
+
timer2 = null;
|
|
22776
|
+
reject(logger46.makeError("timeout", Logger.errors.TIMEOUT, {
|
|
22777
|
+
requestBody: bodyify2(options.body, flatHeaders["content-type"]),
|
|
22778
|
+
requestMethod: options.method,
|
|
22779
|
+
timeout,
|
|
22780
|
+
url
|
|
22781
|
+
}));
|
|
22782
|
+
}, timeout);
|
|
22783
|
+
}
|
|
22784
|
+
});
|
|
22785
|
+
const cancel = function() {
|
|
22786
|
+
if (timer2 == null) {
|
|
22787
|
+
return;
|
|
22788
|
+
}
|
|
22789
|
+
clearTimeout(timer2);
|
|
22790
|
+
timer2 = null;
|
|
22791
|
+
};
|
|
22792
|
+
return { promise, cancel };
|
|
22793
|
+
}();
|
|
22794
|
+
const runningFetch = function() {
|
|
22795
|
+
return __awaiter18(this, void 0, void 0, function* () {
|
|
22796
|
+
for (let attempt = 0; attempt < attemptLimit; attempt++) {
|
|
22797
|
+
let response = null;
|
|
22798
|
+
try {
|
|
22799
|
+
response = yield getUrl2(url, options);
|
|
22800
|
+
if (attempt < attemptLimit) {
|
|
22801
|
+
if (response.statusCode === 301 || response.statusCode === 302) {
|
|
22802
|
+
const location = response.headers.location || "";
|
|
22803
|
+
if (options.method === "GET" && location.match(/^https:/)) {
|
|
22804
|
+
url = response.headers.location;
|
|
22805
|
+
continue;
|
|
22806
|
+
}
|
|
22807
|
+
} else if (response.statusCode === 429) {
|
|
22808
|
+
let tryAgain = true;
|
|
22809
|
+
if (throttleCallback) {
|
|
22810
|
+
tryAgain = yield throttleCallback(attempt, url);
|
|
22811
|
+
}
|
|
22812
|
+
if (tryAgain) {
|
|
22813
|
+
let stall3 = 0;
|
|
22814
|
+
const retryAfter = response.headers["retry-after"];
|
|
22815
|
+
if (typeof retryAfter === "string" && retryAfter.match(/^[1-9][0-9]*$/)) {
|
|
22816
|
+
stall3 = parseInt(retryAfter) * 1e3;
|
|
22817
|
+
} else {
|
|
22818
|
+
stall3 = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt)));
|
|
22819
|
+
}
|
|
22820
|
+
yield staller2(stall3);
|
|
22821
|
+
continue;
|
|
22822
|
+
}
|
|
22823
|
+
}
|
|
22824
|
+
}
|
|
22825
|
+
} catch (error) {
|
|
22826
|
+
response = error.response;
|
|
22827
|
+
if (response == null) {
|
|
22828
|
+
runningTimeout.cancel();
|
|
22829
|
+
logger46.throwError("missing response", Logger.errors.SERVER_ERROR, {
|
|
22830
|
+
requestBody: bodyify2(options.body, flatHeaders["content-type"]),
|
|
22831
|
+
requestMethod: options.method,
|
|
22832
|
+
serverError: error,
|
|
22833
|
+
url
|
|
22834
|
+
});
|
|
22835
|
+
}
|
|
22836
|
+
}
|
|
22837
|
+
let body2 = response.body;
|
|
22838
|
+
if (allow304 && response.statusCode === 304) {
|
|
22839
|
+
body2 = null;
|
|
22840
|
+
} else if (!errorPassThrough && (response.statusCode < 200 || response.statusCode >= 300)) {
|
|
22841
|
+
runningTimeout.cancel();
|
|
22842
|
+
logger46.throwError("bad response", Logger.errors.SERVER_ERROR, {
|
|
22843
|
+
status: response.statusCode,
|
|
22844
|
+
headers: response.headers,
|
|
22845
|
+
body: bodyify2(body2, response.headers ? response.headers["content-type"] : null),
|
|
22846
|
+
requestBody: bodyify2(options.body, flatHeaders["content-type"]),
|
|
22847
|
+
requestMethod: options.method,
|
|
22848
|
+
url
|
|
22849
|
+
});
|
|
22850
|
+
}
|
|
22851
|
+
if (processFunc) {
|
|
22852
|
+
try {
|
|
22853
|
+
const result = yield processFunc(body2, response);
|
|
22854
|
+
runningTimeout.cancel();
|
|
22855
|
+
return result;
|
|
22856
|
+
} catch (error) {
|
|
22857
|
+
if (error.throttleRetry && attempt < attemptLimit) {
|
|
22858
|
+
let tryAgain = true;
|
|
22859
|
+
if (throttleCallback) {
|
|
22860
|
+
tryAgain = yield throttleCallback(attempt, url);
|
|
22861
|
+
}
|
|
22862
|
+
if (tryAgain) {
|
|
22863
|
+
const timeout2 = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt)));
|
|
22864
|
+
yield staller2(timeout2);
|
|
22865
|
+
continue;
|
|
22866
|
+
}
|
|
22867
|
+
}
|
|
22868
|
+
runningTimeout.cancel();
|
|
22869
|
+
logger46.throwError("processing response error", Logger.errors.SERVER_ERROR, {
|
|
22870
|
+
body: bodyify2(body2, response.headers ? response.headers["content-type"] : null),
|
|
22871
|
+
error,
|
|
22872
|
+
requestBody: bodyify2(options.body, flatHeaders["content-type"]),
|
|
22873
|
+
requestMethod: options.method,
|
|
22874
|
+
url
|
|
22875
|
+
});
|
|
22876
|
+
}
|
|
22877
|
+
}
|
|
22878
|
+
runningTimeout.cancel();
|
|
22879
|
+
return body2;
|
|
22880
|
+
}
|
|
22881
|
+
return logger46.throwError("failed response", Logger.errors.SERVER_ERROR, {
|
|
22882
|
+
requestBody: bodyify2(options.body, flatHeaders["content-type"]),
|
|
22883
|
+
requestMethod: options.method,
|
|
22884
|
+
url
|
|
22885
|
+
});
|
|
22886
|
+
});
|
|
22887
|
+
}();
|
|
22888
|
+
return Promise.race([runningTimeout.promise, runningFetch]);
|
|
22889
|
+
}
|
|
22890
|
+
function fetchJson2(connection, json, processFunc) {
|
|
22891
|
+
let processJsonFunc = (value, response) => {
|
|
22892
|
+
let result = null;
|
|
22893
|
+
if (value != null) {
|
|
22894
|
+
try {
|
|
22895
|
+
result = JSON.parse(toUtf8String(value));
|
|
22896
|
+
} catch (error) {
|
|
22897
|
+
logger46.throwError("invalid JSON", Logger.errors.SERVER_ERROR, {
|
|
22898
|
+
body: value,
|
|
22899
|
+
error
|
|
22900
|
+
});
|
|
22901
|
+
}
|
|
22902
|
+
}
|
|
22903
|
+
if (processFunc) {
|
|
22904
|
+
result = processFunc(result, response);
|
|
22905
|
+
}
|
|
22906
|
+
return result;
|
|
22907
|
+
};
|
|
22908
|
+
let body = null;
|
|
22909
|
+
if (json != null) {
|
|
22910
|
+
body = toUtf8Bytes(json);
|
|
22911
|
+
const updated = typeof connection === "string" ? { url: connection } : shallowCopy(connection);
|
|
22912
|
+
if (updated.headers) {
|
|
22913
|
+
const hasContentType = Object.keys(updated.headers).filter((k) => k.toLowerCase() === "content-type").length !== 0;
|
|
22914
|
+
if (!hasContentType) {
|
|
22915
|
+
updated.headers = shallowCopy(updated.headers);
|
|
22916
|
+
updated.headers["content-type"] = "application/json";
|
|
22917
|
+
}
|
|
22918
|
+
} else {
|
|
22919
|
+
updated.headers = { "content-type": "application/json" };
|
|
22920
|
+
}
|
|
22921
|
+
connection = updated;
|
|
22922
|
+
}
|
|
22923
|
+
return _fetchData2(connection, body, processJsonFunc);
|
|
22924
|
+
}
|
|
22925
|
+
function poll2(func, options) {
|
|
22926
|
+
if (!options) {
|
|
22927
|
+
options = {};
|
|
22928
|
+
}
|
|
22929
|
+
options = shallowCopy(options);
|
|
22930
|
+
if (options.floor == null) {
|
|
22931
|
+
options.floor = 0;
|
|
22932
|
+
}
|
|
22933
|
+
if (options.ceiling == null) {
|
|
22934
|
+
options.ceiling = 1e4;
|
|
22935
|
+
}
|
|
22936
|
+
if (options.interval == null) {
|
|
22937
|
+
options.interval = 250;
|
|
22938
|
+
}
|
|
22939
|
+
return new Promise(function(resolve, reject) {
|
|
22940
|
+
let timer2 = null;
|
|
22941
|
+
let done = false;
|
|
22942
|
+
const cancel = () => {
|
|
22943
|
+
if (done) {
|
|
22944
|
+
return false;
|
|
22945
|
+
}
|
|
22946
|
+
done = true;
|
|
22947
|
+
if (timer2) {
|
|
22948
|
+
clearTimeout(timer2);
|
|
22949
|
+
}
|
|
22950
|
+
return true;
|
|
22951
|
+
};
|
|
22952
|
+
if (options.timeout) {
|
|
22953
|
+
timer2 = setTimeout(() => {
|
|
22954
|
+
if (cancel()) {
|
|
22955
|
+
reject(new Error("timeout"));
|
|
22956
|
+
}
|
|
22957
|
+
}, options.timeout);
|
|
22958
|
+
}
|
|
22959
|
+
const retryLimit = options.retryLimit;
|
|
22960
|
+
let attempt = 0;
|
|
22961
|
+
function check() {
|
|
22962
|
+
return func().then(function(result) {
|
|
22963
|
+
if (result !== void 0) {
|
|
22964
|
+
if (cancel()) {
|
|
22965
|
+
resolve(result);
|
|
22966
|
+
}
|
|
22967
|
+
} else if (options.oncePoll) {
|
|
22968
|
+
options.oncePoll.once("poll", check);
|
|
22969
|
+
} else if (options.onceBlock) {
|
|
22970
|
+
options.onceBlock.once("block", check);
|
|
22971
|
+
} else if (!done) {
|
|
22972
|
+
attempt++;
|
|
22973
|
+
if (attempt > retryLimit) {
|
|
22974
|
+
if (cancel()) {
|
|
22975
|
+
reject(new Error("retry limit reached"));
|
|
22976
|
+
}
|
|
22977
|
+
return;
|
|
22978
|
+
}
|
|
22979
|
+
let timeout = options.interval * parseInt(String(Math.random() * Math.pow(2, attempt)));
|
|
22980
|
+
if (timeout < options.floor) {
|
|
22981
|
+
timeout = options.floor;
|
|
22982
|
+
}
|
|
22983
|
+
if (timeout > options.ceiling) {
|
|
22984
|
+
timeout = options.ceiling;
|
|
22985
|
+
}
|
|
22986
|
+
setTimeout(check, timeout);
|
|
22987
|
+
}
|
|
22988
|
+
return null;
|
|
22989
|
+
}, function(error) {
|
|
22990
|
+
if (cancel()) {
|
|
22991
|
+
reject(error);
|
|
22992
|
+
}
|
|
22993
|
+
});
|
|
22994
|
+
}
|
|
22995
|
+
check();
|
|
22996
|
+
});
|
|
22997
|
+
}
|
|
22998
|
+
|
|
22527
22999
|
// ../../node_modules/ethers/lib.esm/_version.js
|
|
22528
|
-
var
|
|
23000
|
+
var version27 = "ethers/5.7.0";
|
|
22529
23001
|
|
|
22530
23002
|
// ../../node_modules/ethers/lib.esm/ethers.js
|
|
22531
|
-
var
|
|
23003
|
+
var logger47 = new Logger(version27);
|
|
22532
23004
|
|
|
22533
23005
|
// ../../node_modules/ethers/lib.esm/index.js
|
|
22534
23006
|
try {
|
|
@@ -23037,12 +23509,14 @@ var WalletStore = class _WalletStore {
|
|
|
23037
23509
|
if (this.isLedger) {
|
|
23038
23510
|
const ledger = await GlobalLedgerSigner();
|
|
23039
23511
|
console.log(ledger, "ledger signer");
|
|
23040
|
-
|
|
23512
|
+
const tx = await ledger.sendTransaction({
|
|
23041
23513
|
to: address,
|
|
23042
23514
|
data,
|
|
23043
23515
|
value: value ? BigInt(value) : void 0,
|
|
23044
|
-
from: this.account
|
|
23516
|
+
from: this.account,
|
|
23517
|
+
type: 0
|
|
23045
23518
|
});
|
|
23519
|
+
hash3 = tx == null ? void 0 : tx.hash;
|
|
23046
23520
|
} else {
|
|
23047
23521
|
hash3 = await this.walletClient.sendTransaction({
|
|
23048
23522
|
account: this.account,
|
|
@@ -23203,4 +23677,4 @@ js-sha3/src/sha3.js:
|
|
|
23203
23677
|
|
|
23204
23678
|
export { AppProvider, AutoMan, BigNumberInputState, BigNumberState, ConnectLedger, DisconnectLedger, ObjectPool, PromiseHook, StorageListState, StorageState, WalletConfigStore, WalletHistoryStore, WalletRpcStore, WalletStore };
|
|
23205
23679
|
//# sourceMappingURL=out.js.map
|
|
23206
|
-
//# sourceMappingURL=chunk-
|
|
23680
|
+
//# sourceMappingURL=chunk-43PPHYFY.mjs.map
|