opencrowd 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -9
- package/bundle/opencrowd.js +1896 -682
- package/package.json +2 -2
package/bundle/opencrowd.js
CHANGED
|
@@ -31,11 +31,11 @@ var __export = (target, all) => {
|
|
|
31
31
|
for (var name in all)
|
|
32
32
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
33
33
|
};
|
|
34
|
-
var __copyProps = (to,
|
|
35
|
-
if (
|
|
36
|
-
for (let key of __getOwnPropNames(
|
|
34
|
+
var __copyProps = (to, from16, except, desc) => {
|
|
35
|
+
if (from16 && typeof from16 === "object" || typeof from16 === "function") {
|
|
36
|
+
for (let key of __getOwnPropNames(from16))
|
|
37
37
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
38
|
-
__defProp(to, key, { get: () =>
|
|
38
|
+
__defProp(to, key, { get: () => from16[key], enumerable: !(desc = __getOwnPropDesc(from16, key)) || desc.enumerable });
|
|
39
39
|
}
|
|
40
40
|
return to;
|
|
41
41
|
};
|
|
@@ -1683,10 +1683,10 @@ var init_gateway = __esm({
|
|
|
1683
1683
|
if (this.options.approvalMode === "off") {
|
|
1684
1684
|
return { ok: false, error: "financial actions are disabled (approval mode `off`)" };
|
|
1685
1685
|
}
|
|
1686
|
-
const
|
|
1686
|
+
const from16 = stringArg(args.from);
|
|
1687
1687
|
const to = stringArg(args.to);
|
|
1688
1688
|
const amountUsd = numberArg(args.amount_usd);
|
|
1689
|
-
if (!
|
|
1689
|
+
if (!from16 || !to || amountUsd === void 0 || amountUsd <= 0) {
|
|
1690
1690
|
return { ok: false, error: "bridge_usdc requires from, to, and a positive amount_usd" };
|
|
1691
1691
|
}
|
|
1692
1692
|
if (this.options.approvalMode === "ask") {
|
|
@@ -1694,7 +1694,7 @@ var init_gateway = __esm({
|
|
|
1694
1694
|
return { ok: false, error: "bridging requires interactive approval and no prompt is available in this run mode" };
|
|
1695
1695
|
}
|
|
1696
1696
|
const answer = await this.options.approvalHandler({
|
|
1697
|
-
endpoint: `bridge ${
|
|
1697
|
+
endpoint: `bridge ${from16} -> ${to}`,
|
|
1698
1698
|
origin: "agentcash-bridge",
|
|
1699
1699
|
method: "BRIDGE",
|
|
1700
1700
|
quotedCostCents: Math.round(amountUsd * 100)
|
|
@@ -1703,11 +1703,11 @@ var init_gateway = __esm({
|
|
|
1703
1703
|
return { ok: false, error: "the user declined the bridge" };
|
|
1704
1704
|
}
|
|
1705
1705
|
}
|
|
1706
|
-
const result = await this.options.agentcash.bridge({ from:
|
|
1706
|
+
const result = await this.options.agentcash.bridge({ from: from16, to, amountUsd });
|
|
1707
1707
|
await appendLedgerEntry(this.options.session.ledgerPath, {
|
|
1708
1708
|
session_id: this.options.session.sessionId,
|
|
1709
1709
|
type: "service_call",
|
|
1710
|
-
resource_url: `agentcash:bridge:${
|
|
1710
|
+
resource_url: `agentcash:bridge:${from16}->${to}`,
|
|
1711
1711
|
method: "BRIDGE",
|
|
1712
1712
|
quoted_cost_cents: Math.round(amountUsd * 100),
|
|
1713
1713
|
charged_cost_cents: 0,
|
|
@@ -3417,10 +3417,10 @@ var init_chunk_K4TZLEOT = __esm({
|
|
|
3417
3417
|
}
|
|
3418
3418
|
});
|
|
3419
3419
|
|
|
3420
|
-
// ../../node_modules/zod/v3/helpers/util.js
|
|
3420
|
+
// ../../node_modules/x402/node_modules/zod/v3/helpers/util.js
|
|
3421
3421
|
var util, objectUtil, ZodParsedType, getParsedType;
|
|
3422
3422
|
var init_util = __esm({
|
|
3423
|
-
"../../node_modules/zod/v3/helpers/util.js"() {
|
|
3423
|
+
"../../node_modules/x402/node_modules/zod/v3/helpers/util.js"() {
|
|
3424
3424
|
(function(util2) {
|
|
3425
3425
|
util2.assertEqual = (_) => {
|
|
3426
3426
|
};
|
|
@@ -3554,10 +3554,10 @@ var init_util = __esm({
|
|
|
3554
3554
|
}
|
|
3555
3555
|
});
|
|
3556
3556
|
|
|
3557
|
-
// ../../node_modules/zod/v3/ZodError.js
|
|
3557
|
+
// ../../node_modules/x402/node_modules/zod/v3/ZodError.js
|
|
3558
3558
|
var ZodIssueCode, quotelessJson, ZodError;
|
|
3559
3559
|
var init_ZodError = __esm({
|
|
3560
|
-
"../../node_modules/zod/v3/ZodError.js"() {
|
|
3560
|
+
"../../node_modules/x402/node_modules/zod/v3/ZodError.js"() {
|
|
3561
3561
|
init_util();
|
|
3562
3562
|
ZodIssueCode = util.arrayToEnum([
|
|
3563
3563
|
"invalid_type",
|
|
@@ -3678,10 +3678,10 @@ var init_ZodError = __esm({
|
|
|
3678
3678
|
}
|
|
3679
3679
|
});
|
|
3680
3680
|
|
|
3681
|
-
// ../../node_modules/zod/v3/locales/en.js
|
|
3681
|
+
// ../../node_modules/x402/node_modules/zod/v3/locales/en.js
|
|
3682
3682
|
var errorMap, en_default;
|
|
3683
3683
|
var init_en = __esm({
|
|
3684
|
-
"../../node_modules/zod/v3/locales/en.js"() {
|
|
3684
|
+
"../../node_modules/x402/node_modules/zod/v3/locales/en.js"() {
|
|
3685
3685
|
init_ZodError();
|
|
3686
3686
|
init_util();
|
|
3687
3687
|
errorMap = (issue, _ctx) => {
|
|
@@ -3788,7 +3788,7 @@ var init_en = __esm({
|
|
|
3788
3788
|
}
|
|
3789
3789
|
});
|
|
3790
3790
|
|
|
3791
|
-
// ../../node_modules/zod/v3/errors.js
|
|
3791
|
+
// ../../node_modules/x402/node_modules/zod/v3/errors.js
|
|
3792
3792
|
function setErrorMap(map) {
|
|
3793
3793
|
overrideErrorMap = map;
|
|
3794
3794
|
}
|
|
@@ -3797,13 +3797,13 @@ function getErrorMap() {
|
|
|
3797
3797
|
}
|
|
3798
3798
|
var overrideErrorMap;
|
|
3799
3799
|
var init_errors = __esm({
|
|
3800
|
-
"../../node_modules/zod/v3/errors.js"() {
|
|
3800
|
+
"../../node_modules/x402/node_modules/zod/v3/errors.js"() {
|
|
3801
3801
|
init_en();
|
|
3802
3802
|
overrideErrorMap = en_default;
|
|
3803
3803
|
}
|
|
3804
3804
|
});
|
|
3805
3805
|
|
|
3806
|
-
// ../../node_modules/zod/v3/helpers/parseUtil.js
|
|
3806
|
+
// ../../node_modules/x402/node_modules/zod/v3/helpers/parseUtil.js
|
|
3807
3807
|
function addIssueToContext(ctx, issueData) {
|
|
3808
3808
|
const overrideMap = getErrorMap();
|
|
3809
3809
|
const issue = makeIssue({
|
|
@@ -3825,7 +3825,7 @@ function addIssueToContext(ctx, issueData) {
|
|
|
3825
3825
|
}
|
|
3826
3826
|
var makeIssue, EMPTY_PATH, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync;
|
|
3827
3827
|
var init_parseUtil = __esm({
|
|
3828
|
-
"../../node_modules/zod/v3/helpers/parseUtil.js"() {
|
|
3828
|
+
"../../node_modules/x402/node_modules/zod/v3/helpers/parseUtil.js"() {
|
|
3829
3829
|
init_errors();
|
|
3830
3830
|
init_en();
|
|
3831
3831
|
makeIssue = (params) => {
|
|
@@ -3920,16 +3920,16 @@ var init_parseUtil = __esm({
|
|
|
3920
3920
|
}
|
|
3921
3921
|
});
|
|
3922
3922
|
|
|
3923
|
-
// ../../node_modules/zod/v3/helpers/typeAliases.js
|
|
3923
|
+
// ../../node_modules/x402/node_modules/zod/v3/helpers/typeAliases.js
|
|
3924
3924
|
var init_typeAliases = __esm({
|
|
3925
|
-
"../../node_modules/zod/v3/helpers/typeAliases.js"() {
|
|
3925
|
+
"../../node_modules/x402/node_modules/zod/v3/helpers/typeAliases.js"() {
|
|
3926
3926
|
}
|
|
3927
3927
|
});
|
|
3928
3928
|
|
|
3929
|
-
// ../../node_modules/zod/v3/helpers/errorUtil.js
|
|
3929
|
+
// ../../node_modules/x402/node_modules/zod/v3/helpers/errorUtil.js
|
|
3930
3930
|
var errorUtil;
|
|
3931
3931
|
var init_errorUtil = __esm({
|
|
3932
|
-
"../../node_modules/zod/v3/helpers/errorUtil.js"() {
|
|
3932
|
+
"../../node_modules/x402/node_modules/zod/v3/helpers/errorUtil.js"() {
|
|
3933
3933
|
(function(errorUtil2) {
|
|
3934
3934
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
3935
3935
|
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
@@ -3937,7 +3937,7 @@ var init_errorUtil = __esm({
|
|
|
3937
3937
|
}
|
|
3938
3938
|
});
|
|
3939
3939
|
|
|
3940
|
-
// ../../node_modules/zod/v3/types.js
|
|
3940
|
+
// ../../node_modules/x402/node_modules/zod/v3/types.js
|
|
3941
3941
|
function processCreateParams(params) {
|
|
3942
3942
|
if (!params)
|
|
3943
3943
|
return {};
|
|
@@ -4131,7 +4131,7 @@ function custom(check, _params = {}, fatal) {
|
|
|
4131
4131
|
}
|
|
4132
4132
|
var ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, instanceOfType, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, ostring, onumber, oboolean, coerce, NEVER;
|
|
4133
4133
|
var init_types2 = __esm({
|
|
4134
|
-
"../../node_modules/zod/v3/types.js"() {
|
|
4134
|
+
"../../node_modules/x402/node_modules/zod/v3/types.js"() {
|
|
4135
4135
|
init_ZodError();
|
|
4136
4136
|
init_errors();
|
|
4137
4137
|
init_errorUtil();
|
|
@@ -7393,7 +7393,7 @@ var init_types2 = __esm({
|
|
|
7393
7393
|
}
|
|
7394
7394
|
});
|
|
7395
7395
|
|
|
7396
|
-
// ../../node_modules/zod/v3/external.js
|
|
7396
|
+
// ../../node_modules/x402/node_modules/zod/v3/external.js
|
|
7397
7397
|
var external_exports = {};
|
|
7398
7398
|
__export(external_exports, {
|
|
7399
7399
|
BRAND: () => BRAND,
|
|
@@ -7505,7 +7505,7 @@ __export(external_exports, {
|
|
|
7505
7505
|
void: () => voidType
|
|
7506
7506
|
});
|
|
7507
7507
|
var init_external = __esm({
|
|
7508
|
-
"../../node_modules/zod/v3/external.js"() {
|
|
7508
|
+
"../../node_modules/x402/node_modules/zod/v3/external.js"() {
|
|
7509
7509
|
init_errors();
|
|
7510
7510
|
init_parseUtil();
|
|
7511
7511
|
init_typeAliases();
|
|
@@ -7515,9 +7515,9 @@ var init_external = __esm({
|
|
|
7515
7515
|
}
|
|
7516
7516
|
});
|
|
7517
7517
|
|
|
7518
|
-
// ../../node_modules/zod/index.js
|
|
7518
|
+
// ../../node_modules/x402/node_modules/zod/index.js
|
|
7519
7519
|
var init_zod = __esm({
|
|
7520
|
-
"../../node_modules/zod/index.js"() {
|
|
7520
|
+
"../../node_modules/x402/node_modules/zod/index.js"() {
|
|
7521
7521
|
init_external();
|
|
7522
7522
|
init_external();
|
|
7523
7523
|
}
|
|
@@ -8517,7 +8517,7 @@ var init_size = __esm({
|
|
|
8517
8517
|
var version2;
|
|
8518
8518
|
var init_version2 = __esm({
|
|
8519
8519
|
"../../node_modules/viem/_esm/errors/version.js"() {
|
|
8520
|
-
version2 = "2.
|
|
8520
|
+
version2 = "2.55.19";
|
|
8521
8521
|
}
|
|
8522
8522
|
});
|
|
8523
8523
|
|
|
@@ -9930,10 +9930,7 @@ function encodeAbiParameters(params, values) {
|
|
|
9930
9930
|
params,
|
|
9931
9931
|
values
|
|
9932
9932
|
});
|
|
9933
|
-
|
|
9934
|
-
if (data.length === 0)
|
|
9935
|
-
return "0x";
|
|
9936
|
-
return data;
|
|
9933
|
+
return encodeParams(preparedParams);
|
|
9937
9934
|
}
|
|
9938
9935
|
function prepareParams({ params, values }) {
|
|
9939
9936
|
const preparedParams = [];
|
|
@@ -9999,7 +9996,7 @@ function encodeParams(preparedParams) {
|
|
|
9999
9996
|
staticParams.push(encoded);
|
|
10000
9997
|
}
|
|
10001
9998
|
}
|
|
10002
|
-
return
|
|
9999
|
+
return concatHex([...staticParams, ...dynamicParams]);
|
|
10003
10000
|
}
|
|
10004
10001
|
function encodeAddress(value) {
|
|
10005
10002
|
if (!isAddress(value))
|
|
@@ -10016,7 +10013,7 @@ function encodeArray(value, { length, param }) {
|
|
|
10016
10013
|
givenLength: value.length,
|
|
10017
10014
|
type: `${param.type}[${length}]`
|
|
10018
10015
|
});
|
|
10019
|
-
let dynamicChild =
|
|
10016
|
+
let dynamicChild = value.length === 0 && isDynamicType(param);
|
|
10020
10017
|
const preparedParams = [];
|
|
10021
10018
|
for (let i = 0; i < value.length; i++) {
|
|
10022
10019
|
const preparedParam = prepareParam({ param, value: value[i] });
|
|
@@ -10030,7 +10027,7 @@ function encodeArray(value, { length, param }) {
|
|
|
10030
10027
|
const length2 = numberToHex(preparedParams.length, { size: 32 });
|
|
10031
10028
|
return {
|
|
10032
10029
|
dynamic: true,
|
|
10033
|
-
encoded:
|
|
10030
|
+
encoded: concatHex([length2, data])
|
|
10034
10031
|
};
|
|
10035
10032
|
}
|
|
10036
10033
|
if (dynamicChild)
|
|
@@ -10038,7 +10035,7 @@ function encodeArray(value, { length, param }) {
|
|
|
10038
10035
|
}
|
|
10039
10036
|
return {
|
|
10040
10037
|
dynamic: false,
|
|
10041
|
-
encoded:
|
|
10038
|
+
encoded: concatHex(preparedParams.map(({ encoded }) => encoded))
|
|
10042
10039
|
};
|
|
10043
10040
|
}
|
|
10044
10041
|
function encodeBytes(value, { param }) {
|
|
@@ -10053,7 +10050,10 @@ function encodeBytes(value, { param }) {
|
|
|
10053
10050
|
});
|
|
10054
10051
|
return {
|
|
10055
10052
|
dynamic: true,
|
|
10056
|
-
encoded:
|
|
10053
|
+
encoded: concatHex([
|
|
10054
|
+
padHex(numberToHex(bytesSize, { size: 32 })),
|
|
10055
|
+
value_
|
|
10056
|
+
])
|
|
10057
10057
|
};
|
|
10058
10058
|
}
|
|
10059
10059
|
if (bytesSize !== Number.parseInt(paramSize, 10))
|
|
@@ -10100,7 +10100,7 @@ function encodeString(value) {
|
|
|
10100
10100
|
}
|
|
10101
10101
|
return {
|
|
10102
10102
|
dynamic: true,
|
|
10103
|
-
encoded:
|
|
10103
|
+
encoded: concatHex([
|
|
10104
10104
|
padHex(numberToHex(size(hexValue), { size: 32 })),
|
|
10105
10105
|
...parts
|
|
10106
10106
|
])
|
|
@@ -10122,7 +10122,7 @@ function encodeTuple(value, { param }) {
|
|
|
10122
10122
|
}
|
|
10123
10123
|
return {
|
|
10124
10124
|
dynamic,
|
|
10125
|
-
encoded: dynamic ? encodeParams(preparedParams) :
|
|
10125
|
+
encoded: dynamic ? encodeParams(preparedParams) : concatHex(preparedParams.map(({ encoded }) => encoded))
|
|
10126
10126
|
};
|
|
10127
10127
|
}
|
|
10128
10128
|
function getArrayComponents(type) {
|
|
@@ -10132,6 +10132,21 @@ function getArrayComponents(type) {
|
|
|
10132
10132
|
[matches[2] ? Number(matches[2]) : null, matches[1]]
|
|
10133
10133
|
) : void 0;
|
|
10134
10134
|
}
|
|
10135
|
+
function isDynamicType(param) {
|
|
10136
|
+
const { type } = param;
|
|
10137
|
+
if (type === "string")
|
|
10138
|
+
return true;
|
|
10139
|
+
if (type === "bytes")
|
|
10140
|
+
return true;
|
|
10141
|
+
if (type.endsWith("[]"))
|
|
10142
|
+
return true;
|
|
10143
|
+
if (type === "tuple")
|
|
10144
|
+
return param.components.some(isDynamicType);
|
|
10145
|
+
const arrayComponents = getArrayComponents(type);
|
|
10146
|
+
if (arrayComponents)
|
|
10147
|
+
return isDynamicType({ ...param, type: arrayComponents[1] });
|
|
10148
|
+
return false;
|
|
10149
|
+
}
|
|
10135
10150
|
var init_encodeAbiParameters = __esm({
|
|
10136
10151
|
"../../node_modules/viem/_esm/utils/abi/encodeAbiParameters.js"() {
|
|
10137
10152
|
init_abi();
|
|
@@ -10692,7 +10707,7 @@ var init_cursor2 = __esm({
|
|
|
10692
10707
|
function bytesToBigInt(bytes, opts = {}) {
|
|
10693
10708
|
if (typeof opts.size !== "undefined")
|
|
10694
10709
|
assertSize(bytes, { size: opts.size });
|
|
10695
|
-
const hex = bytesToHex(bytes
|
|
10710
|
+
const hex = bytesToHex(bytes);
|
|
10696
10711
|
return hexToBigInt(hex, opts);
|
|
10697
10712
|
}
|
|
10698
10713
|
function bytesToBool(bytes_, opts = {}) {
|
|
@@ -10708,7 +10723,7 @@ function bytesToBool(bytes_, opts = {}) {
|
|
|
10708
10723
|
function bytesToNumber(bytes, opts = {}) {
|
|
10709
10724
|
if (typeof opts.size !== "undefined")
|
|
10710
10725
|
assertSize(bytes, { size: opts.size });
|
|
10711
|
-
const hex = bytesToHex(bytes
|
|
10726
|
+
const hex = bytesToHex(bytes);
|
|
10712
10727
|
return hexToNumber(hex, opts);
|
|
10713
10728
|
}
|
|
10714
10729
|
function bytesToString(bytes_, opts = {}) {
|
|
@@ -10744,7 +10759,8 @@ function decodeAbiParameters(params, data) {
|
|
|
10744
10759
|
const values = [];
|
|
10745
10760
|
for (let i = 0; i < params.length; ++i) {
|
|
10746
10761
|
const param = params[i];
|
|
10747
|
-
|
|
10762
|
+
if (consumed < bytes.length)
|
|
10763
|
+
cursor.setPosition(consumed);
|
|
10748
10764
|
const [data2, consumed_] = decodeParameter(cursor, param, {
|
|
10749
10765
|
staticPosition: 0
|
|
10750
10766
|
});
|
|
@@ -10780,7 +10796,7 @@ function decodeAddress(cursor) {
|
|
|
10780
10796
|
return [checksumAddress(bytesToHex(sliceBytes(value, -20))), 32];
|
|
10781
10797
|
}
|
|
10782
10798
|
function decodeArray(cursor, param, { length, staticPosition }) {
|
|
10783
|
-
if (
|
|
10799
|
+
if (length === null) {
|
|
10784
10800
|
const offset = bytesToNumber(cursor.readBytes(sizeOfOffset));
|
|
10785
10801
|
const start = staticPosition + offset;
|
|
10786
10802
|
const startOfData = start + sizeOfLength;
|
|
@@ -10796,6 +10812,10 @@ function decodeArray(cursor, param, { length, staticPosition }) {
|
|
|
10796
10812
|
});
|
|
10797
10813
|
consumed2 += consumed_;
|
|
10798
10814
|
value2.push(data);
|
|
10815
|
+
if (consumed_ === 0) {
|
|
10816
|
+
cursor.assertReadLimit();
|
|
10817
|
+
cursor._touch();
|
|
10818
|
+
}
|
|
10799
10819
|
}
|
|
10800
10820
|
cursor.setPosition(staticPosition + 32);
|
|
10801
10821
|
return [value2, 32];
|
|
@@ -10822,6 +10842,10 @@ function decodeArray(cursor, param, { length, staticPosition }) {
|
|
|
10822
10842
|
});
|
|
10823
10843
|
consumed += consumed_;
|
|
10824
10844
|
value.push(data);
|
|
10845
|
+
if (consumed_ === 0) {
|
|
10846
|
+
cursor.assertReadLimit();
|
|
10847
|
+
cursor._touch();
|
|
10848
|
+
}
|
|
10825
10849
|
}
|
|
10826
10850
|
return [value, consumed];
|
|
10827
10851
|
}
|
|
@@ -10893,7 +10917,7 @@ function decodeString(cursor, { staticPosition }) {
|
|
|
10893
10917
|
return ["", 32];
|
|
10894
10918
|
}
|
|
10895
10919
|
const data = cursor.readBytes(length, 32);
|
|
10896
|
-
const value = bytesToString(
|
|
10920
|
+
const value = bytesToString(data);
|
|
10897
10921
|
cursor.setPosition(staticPosition + 32);
|
|
10898
10922
|
return [value, 32];
|
|
10899
10923
|
}
|
|
@@ -10920,7 +10944,6 @@ var init_decodeAbiParameters = __esm({
|
|
|
10920
10944
|
init_cursor2();
|
|
10921
10945
|
init_size();
|
|
10922
10946
|
init_slice();
|
|
10923
|
-
init_trim();
|
|
10924
10947
|
init_fromBytes();
|
|
10925
10948
|
init_toBytes();
|
|
10926
10949
|
init_toHex();
|
|
@@ -10987,23 +11010,10 @@ var init_formatAbiItemWithArgs = __esm({
|
|
|
10987
11010
|
}
|
|
10988
11011
|
});
|
|
10989
11012
|
|
|
10990
|
-
// ../../node_modules/viem/_esm/
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
|
|
10994
|
-
etherUnits = {
|
|
10995
|
-
gwei: 9,
|
|
10996
|
-
wei: 18
|
|
10997
|
-
};
|
|
10998
|
-
gweiUnits = {
|
|
10999
|
-
ether: -9,
|
|
11000
|
-
wei: 9
|
|
11001
|
-
};
|
|
11002
|
-
}
|
|
11003
|
-
});
|
|
11004
|
-
|
|
11005
|
-
// ../../node_modules/viem/_esm/utils/unit/formatUnits.js
|
|
11006
|
-
function formatUnits(value, decimals) {
|
|
11013
|
+
// ../../node_modules/viem/_esm/utils/unit/Value.js
|
|
11014
|
+
function format(value, decimals = 0) {
|
|
11015
|
+
if (!Number.isInteger(decimals) || decimals < 0)
|
|
11016
|
+
throw new InvalidDecimalsError({ decimals });
|
|
11007
11017
|
let display = value.toString();
|
|
11008
11018
|
const negative = display.startsWith("-");
|
|
11009
11019
|
if (negative)
|
|
@@ -11016,30 +11026,113 @@ function formatUnits(value, decimals) {
|
|
|
11016
11026
|
fraction = fraction.replace(/(0+)$/, "");
|
|
11017
11027
|
return `${negative ? "-" : ""}${integer || "0"}${fraction ? `.${fraction}` : ""}`;
|
|
11018
11028
|
}
|
|
11019
|
-
|
|
11020
|
-
|
|
11029
|
+
function formatEther(wei, unit = "wei") {
|
|
11030
|
+
return format(wei, exponents.ether - exponents[unit]);
|
|
11031
|
+
}
|
|
11032
|
+
function formatGwei(wei, unit = "wei") {
|
|
11033
|
+
return format(wei, exponents.gwei - exponents[unit]);
|
|
11034
|
+
}
|
|
11035
|
+
function from(value, decimals = 0) {
|
|
11036
|
+
if (!Number.isInteger(decimals) || decimals < 0)
|
|
11037
|
+
throw new InvalidDecimalsError({ decimals });
|
|
11038
|
+
if (!/^-?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)$/.test(value))
|
|
11039
|
+
throw new InvalidDecimalNumberError({ value });
|
|
11040
|
+
let [integer = "", fraction = "0"] = value.split(".");
|
|
11041
|
+
const negative = integer.startsWith("-");
|
|
11042
|
+
if (negative)
|
|
11043
|
+
integer = integer.slice(1);
|
|
11044
|
+
if (integer === "")
|
|
11045
|
+
integer = "0";
|
|
11046
|
+
fraction = fraction.replace(/(0+)$/, "");
|
|
11047
|
+
if (decimals === 0) {
|
|
11048
|
+
if (fraction.length > 0 && Number.parseInt(fraction[0], 10) >= 5)
|
|
11049
|
+
integer = `${BigInt(integer) + 1n}`;
|
|
11050
|
+
fraction = "";
|
|
11051
|
+
} else if (fraction.length > decimals) {
|
|
11052
|
+
const left = fraction.slice(0, decimals);
|
|
11053
|
+
const roundDigit = Number.parseInt(fraction.slice(decimals, decimals + 1), 10);
|
|
11054
|
+
if (roundDigit >= 5) {
|
|
11055
|
+
const carried = carry(left);
|
|
11056
|
+
if (carried.length > decimals) {
|
|
11057
|
+
fraction = carried.slice(1);
|
|
11058
|
+
integer = `${BigInt(integer) + 1n}`;
|
|
11059
|
+
} else {
|
|
11060
|
+
fraction = carried;
|
|
11061
|
+
}
|
|
11062
|
+
} else {
|
|
11063
|
+
fraction = left;
|
|
11064
|
+
}
|
|
11065
|
+
} else {
|
|
11066
|
+
fraction = fraction.padEnd(decimals, "0");
|
|
11067
|
+
}
|
|
11068
|
+
return BigInt(`${negative ? "-" : ""}${integer}${fraction}`);
|
|
11069
|
+
}
|
|
11070
|
+
function carry(digits) {
|
|
11071
|
+
const out = digits.split("");
|
|
11072
|
+
let i = out.length - 1;
|
|
11073
|
+
while (i >= 0) {
|
|
11074
|
+
const d = Number.parseInt(out[i], 10) + 1;
|
|
11075
|
+
if (d < 10) {
|
|
11076
|
+
out[i] = String(d);
|
|
11077
|
+
return out.join("");
|
|
11078
|
+
}
|
|
11079
|
+
out[i] = "0";
|
|
11080
|
+
i--;
|
|
11081
|
+
}
|
|
11082
|
+
return `1${out.join("")}`;
|
|
11083
|
+
}
|
|
11084
|
+
var exponents, InvalidDecimalNumberError, InvalidDecimalsError;
|
|
11085
|
+
var init_Value = __esm({
|
|
11086
|
+
"../../node_modules/viem/_esm/utils/unit/Value.js"() {
|
|
11087
|
+
exponents = {
|
|
11088
|
+
wei: 0,
|
|
11089
|
+
gwei: 9,
|
|
11090
|
+
szabo: 12,
|
|
11091
|
+
finney: 15,
|
|
11092
|
+
ether: 18
|
|
11093
|
+
};
|
|
11094
|
+
InvalidDecimalNumberError = class extends Error {
|
|
11095
|
+
constructor({ value }) {
|
|
11096
|
+
super(`Value \`${value}\` is not a valid decimal number.`);
|
|
11097
|
+
Object.defineProperty(this, "name", {
|
|
11098
|
+
enumerable: true,
|
|
11099
|
+
configurable: true,
|
|
11100
|
+
writable: true,
|
|
11101
|
+
value: "Value.InvalidDecimalNumberError"
|
|
11102
|
+
});
|
|
11103
|
+
}
|
|
11104
|
+
};
|
|
11105
|
+
InvalidDecimalsError = class extends Error {
|
|
11106
|
+
constructor({ decimals }) {
|
|
11107
|
+
super(`\`decimals\` must be a non-negative integer. Got \`${decimals}\`.`);
|
|
11108
|
+
Object.defineProperty(this, "name", {
|
|
11109
|
+
enumerable: true,
|
|
11110
|
+
configurable: true,
|
|
11111
|
+
writable: true,
|
|
11112
|
+
value: "Value.InvalidDecimalsError"
|
|
11113
|
+
});
|
|
11114
|
+
}
|
|
11115
|
+
};
|
|
11021
11116
|
}
|
|
11022
11117
|
});
|
|
11023
11118
|
|
|
11024
11119
|
// ../../node_modules/viem/_esm/utils/unit/formatEther.js
|
|
11025
|
-
function
|
|
11026
|
-
return
|
|
11120
|
+
function formatEther2(wei, unit = "wei") {
|
|
11121
|
+
return formatEther(wei, unit);
|
|
11027
11122
|
}
|
|
11028
11123
|
var init_formatEther = __esm({
|
|
11029
11124
|
"../../node_modules/viem/_esm/utils/unit/formatEther.js"() {
|
|
11030
|
-
|
|
11031
|
-
init_formatUnits();
|
|
11125
|
+
init_Value();
|
|
11032
11126
|
}
|
|
11033
11127
|
});
|
|
11034
11128
|
|
|
11035
11129
|
// ../../node_modules/viem/_esm/utils/unit/formatGwei.js
|
|
11036
|
-
function
|
|
11037
|
-
return
|
|
11130
|
+
function formatGwei2(wei, unit = "wei") {
|
|
11131
|
+
return formatGwei(wei, unit);
|
|
11038
11132
|
}
|
|
11039
11133
|
var init_formatGwei = __esm({
|
|
11040
11134
|
"../../node_modules/viem/_esm/utils/unit/formatGwei.js"() {
|
|
11041
|
-
|
|
11042
|
-
init_formatUnits();
|
|
11135
|
+
init_Value();
|
|
11043
11136
|
}
|
|
11044
11137
|
});
|
|
11045
11138
|
|
|
@@ -11105,12 +11198,23 @@ function prettyPrint(args) {
|
|
|
11105
11198
|
const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);
|
|
11106
11199
|
return entries.map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`).join("\n");
|
|
11107
11200
|
}
|
|
11108
|
-
var InvalidLegacyVError, InvalidSerializableTransactionError, InvalidStorageKeySizeError, TransactionExecutionError, TransactionNotFoundError, TransactionReceiptNotFoundError, TransactionReceiptRevertedError, WaitForTransactionReceiptTimeoutError;
|
|
11201
|
+
var FeePayerNonceMismatchError, InvalidLegacyVError, InvalidSerializableTransactionError, InvalidStorageKeySizeError, TransactionExecutionError, TransactionNotFoundError, TransactionReceiptNotFoundError, TransactionReceiptRevertedError, WaitForTransactionReceiptTimeoutError;
|
|
11109
11202
|
var init_transaction = __esm({
|
|
11110
11203
|
"../../node_modules/viem/_esm/errors/transaction.js"() {
|
|
11111
11204
|
init_formatEther();
|
|
11112
11205
|
init_formatGwei();
|
|
11113
11206
|
init_base();
|
|
11207
|
+
FeePayerNonceMismatchError = class extends BaseError2 {
|
|
11208
|
+
constructor({ filledNonce, requestedNonce }) {
|
|
11209
|
+
super("The filled transaction nonce does not match the requested nonce.", {
|
|
11210
|
+
metaMessages: [
|
|
11211
|
+
`Requested Nonce: ${requestedNonce}`,
|
|
11212
|
+
`Filled Nonce: ${filledNonce}`
|
|
11213
|
+
],
|
|
11214
|
+
name: "FeePayerNonceMismatchError"
|
|
11215
|
+
});
|
|
11216
|
+
}
|
|
11217
|
+
};
|
|
11114
11218
|
InvalidLegacyVError = class extends BaseError2 {
|
|
11115
11219
|
constructor({ v }) {
|
|
11116
11220
|
super(`Invalid \`v\` value "${v}". Expected 27 or 28.`, {
|
|
@@ -11150,12 +11254,12 @@ var init_transaction = __esm({
|
|
|
11150
11254
|
chain: chain2 && `${chain2?.name} (id: ${chain2?.id})`,
|
|
11151
11255
|
from: account?.address,
|
|
11152
11256
|
to,
|
|
11153
|
-
value: typeof value !== "undefined" && `${
|
|
11257
|
+
value: typeof value !== "undefined" && `${formatEther2(value)} ${chain2?.nativeCurrency?.symbol || "ETH"}`,
|
|
11154
11258
|
data,
|
|
11155
11259
|
gas,
|
|
11156
|
-
gasPrice: typeof gasPrice !== "undefined" && `${
|
|
11157
|
-
maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${
|
|
11158
|
-
maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${
|
|
11260
|
+
gasPrice: typeof gasPrice !== "undefined" && `${formatGwei2(gasPrice)} gwei`,
|
|
11261
|
+
maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei2(maxFeePerGas)} gwei`,
|
|
11262
|
+
maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei2(maxPriorityFeePerGas)} gwei`,
|
|
11159
11263
|
nonce
|
|
11160
11264
|
});
|
|
11161
11265
|
super(cause.shortMessage, {
|
|
@@ -11284,12 +11388,12 @@ var init_contract = __esm({
|
|
|
11284
11388
|
let prettyArgs = prettyPrint({
|
|
11285
11389
|
from: account?.address,
|
|
11286
11390
|
to,
|
|
11287
|
-
value: typeof value !== "undefined" && `${
|
|
11391
|
+
value: typeof value !== "undefined" && `${formatEther2(value)} ${chain2?.nativeCurrency?.symbol || "ETH"}`,
|
|
11288
11392
|
data,
|
|
11289
11393
|
gas,
|
|
11290
|
-
gasPrice: typeof gasPrice !== "undefined" && `${
|
|
11291
|
-
maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${
|
|
11292
|
-
maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${
|
|
11394
|
+
gasPrice: typeof gasPrice !== "undefined" && `${formatGwei2(gasPrice)} gwei`,
|
|
11395
|
+
maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei2(maxFeePerGas)} gwei`,
|
|
11396
|
+
maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei2(maxPriorityFeePerGas)} gwei`,
|
|
11293
11397
|
nonce
|
|
11294
11398
|
});
|
|
11295
11399
|
if (stateOverride) {
|
|
@@ -11519,7 +11623,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
11519
11623
|
});
|
|
11520
11624
|
|
|
11521
11625
|
// ../../node_modules/viem/_esm/errors/request.js
|
|
11522
|
-
var HttpRequestError, RpcRequestError, TimeoutError;
|
|
11626
|
+
var HttpRequestError, ResponseBodyTooLargeError, RpcRequestError, TimeoutError;
|
|
11523
11627
|
var init_request = __esm({
|
|
11524
11628
|
"../../node_modules/viem/_esm/errors/request.js"() {
|
|
11525
11629
|
init_stringify();
|
|
@@ -11567,6 +11671,28 @@ var init_request = __esm({
|
|
|
11567
11671
|
this.url = url;
|
|
11568
11672
|
}
|
|
11569
11673
|
};
|
|
11674
|
+
ResponseBodyTooLargeError = class extends BaseError2 {
|
|
11675
|
+
constructor({ maxSize, size: size5 }) {
|
|
11676
|
+
super("HTTP response body exceeded the size limit.", {
|
|
11677
|
+
metaMessages: [`Max: ${maxSize} bytes`, `Received: ${size5} bytes`],
|
|
11678
|
+
name: "ResponseBodyTooLargeError"
|
|
11679
|
+
});
|
|
11680
|
+
Object.defineProperty(this, "maxSize", {
|
|
11681
|
+
enumerable: true,
|
|
11682
|
+
configurable: true,
|
|
11683
|
+
writable: true,
|
|
11684
|
+
value: void 0
|
|
11685
|
+
});
|
|
11686
|
+
Object.defineProperty(this, "size", {
|
|
11687
|
+
enumerable: true,
|
|
11688
|
+
configurable: true,
|
|
11689
|
+
writable: true,
|
|
11690
|
+
value: void 0
|
|
11691
|
+
});
|
|
11692
|
+
this.maxSize = maxSize;
|
|
11693
|
+
this.size = size5;
|
|
11694
|
+
}
|
|
11695
|
+
};
|
|
11570
11696
|
RpcRequestError = class extends BaseError2 {
|
|
11571
11697
|
constructor({ body, error, url }) {
|
|
11572
11698
|
super("RPC Request failed.", {
|
|
@@ -13730,7 +13856,7 @@ function weierstrass(curveDef) {
|
|
|
13730
13856
|
function normalizeS(s3) {
|
|
13731
13857
|
return isBiggerThanHalfOrder(s3) ? modN2(-s3) : s3;
|
|
13732
13858
|
}
|
|
13733
|
-
const slcNum = (b,
|
|
13859
|
+
const slcNum = (b, from16, to) => bytesToNumberBE(b.slice(from16, to));
|
|
13734
13860
|
class Signature {
|
|
13735
13861
|
constructor(r, s3, recovery) {
|
|
13736
13862
|
aInRange("r", r, _1n5, CURVE_ORDER);
|
|
@@ -13933,14 +14059,14 @@ function weierstrass(curveDef) {
|
|
|
13933
14059
|
const sg = signature;
|
|
13934
14060
|
msgHash = ensureBytes("msgHash", msgHash);
|
|
13935
14061
|
publicKey = ensureBytes("publicKey", publicKey);
|
|
13936
|
-
const { lowS, prehash, format } = opts;
|
|
14062
|
+
const { lowS, prehash, format: format2 } = opts;
|
|
13937
14063
|
validateSigVerOpts(opts);
|
|
13938
14064
|
if ("strict" in opts)
|
|
13939
14065
|
throw new Error("options.strict was renamed to lowS");
|
|
13940
|
-
if (
|
|
14066
|
+
if (format2 !== void 0 && format2 !== "compact" && format2 !== "der")
|
|
13941
14067
|
throw new Error("format must be compact or der");
|
|
13942
14068
|
const isHex2 = typeof sg === "string" || isBytes2(sg);
|
|
13943
|
-
const isObj = !isHex2 && !
|
|
14069
|
+
const isObj = !isHex2 && !format2 && typeof sg === "object" && sg !== null && typeof sg.r === "bigint" && typeof sg.s === "bigint";
|
|
13944
14070
|
if (!isHex2 && !isObj)
|
|
13945
14071
|
throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
|
|
13946
14072
|
let _sig = void 0;
|
|
@@ -13950,13 +14076,13 @@ function weierstrass(curveDef) {
|
|
|
13950
14076
|
_sig = new Signature(sg.r, sg.s);
|
|
13951
14077
|
if (isHex2) {
|
|
13952
14078
|
try {
|
|
13953
|
-
if (
|
|
14079
|
+
if (format2 !== "compact")
|
|
13954
14080
|
_sig = Signature.fromDER(sg);
|
|
13955
14081
|
} catch (derError) {
|
|
13956
14082
|
if (!(derError instanceof DER.Err))
|
|
13957
14083
|
throw derError;
|
|
13958
14084
|
}
|
|
13959
|
-
if (!_sig &&
|
|
14085
|
+
if (!_sig && format2 !== "der")
|
|
13960
14086
|
_sig = Signature.fromCompact(sg);
|
|
13961
14087
|
}
|
|
13962
14088
|
P2 = Point2.fromHex(publicKey);
|
|
@@ -14817,12 +14943,12 @@ var init_estimateGas = __esm({
|
|
|
14817
14943
|
const prettyArgs = prettyPrint({
|
|
14818
14944
|
from: account?.address,
|
|
14819
14945
|
to,
|
|
14820
|
-
value: typeof value !== "undefined" && `${
|
|
14946
|
+
value: typeof value !== "undefined" && `${formatEther2(value)} ${chain2?.nativeCurrency?.symbol || "ETH"}`,
|
|
14821
14947
|
data,
|
|
14822
14948
|
gas,
|
|
14823
|
-
gasPrice: typeof gasPrice !== "undefined" && `${
|
|
14824
|
-
maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${
|
|
14825
|
-
maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${
|
|
14949
|
+
gasPrice: typeof gasPrice !== "undefined" && `${formatGwei2(gasPrice)} gwei`,
|
|
14950
|
+
maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei2(maxFeePerGas)} gwei`,
|
|
14951
|
+
maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei2(maxPriorityFeePerGas)} gwei`,
|
|
14826
14952
|
nonce
|
|
14827
14953
|
});
|
|
14828
14954
|
super(cause.shortMessage, {
|
|
@@ -14876,7 +15002,7 @@ var init_node = __esm({
|
|
|
14876
15002
|
});
|
|
14877
15003
|
FeeCapTooHighError = class extends BaseError2 {
|
|
14878
15004
|
constructor({ cause, maxFeePerGas } = {}) {
|
|
14879
|
-
super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${
|
|
15005
|
+
super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei2(maxFeePerGas)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
|
|
14880
15006
|
cause,
|
|
14881
15007
|
name: "FeeCapTooHighError"
|
|
14882
15008
|
});
|
|
@@ -14890,7 +15016,7 @@ var init_node = __esm({
|
|
|
14890
15016
|
});
|
|
14891
15017
|
FeeCapTooLowError = class extends BaseError2 {
|
|
14892
15018
|
constructor({ cause, maxFeePerGas } = {}) {
|
|
14893
|
-
super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${
|
|
15019
|
+
super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei2(maxFeePerGas)}` : ""} gwei) cannot be lower than the block base fee.`, {
|
|
14894
15020
|
cause,
|
|
14895
15021
|
name: "FeeCapTooLowError"
|
|
14896
15022
|
});
|
|
@@ -15009,7 +15135,7 @@ var init_node = __esm({
|
|
|
15009
15135
|
TipAboveFeeCapError = class extends BaseError2 {
|
|
15010
15136
|
constructor({ cause, maxPriorityFeePerGas, maxFeePerGas } = {}) {
|
|
15011
15137
|
super([
|
|
15012
|
-
`The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${
|
|
15138
|
+
`The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei2(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei2(maxFeePerGas)} gwei` : ""}).`
|
|
15013
15139
|
].join("\n"), {
|
|
15014
15140
|
cause,
|
|
15015
15141
|
name: "TipAboveFeeCapError"
|
|
@@ -15110,8 +15236,8 @@ var init_getEstimateGasError = __esm({
|
|
|
15110
15236
|
});
|
|
15111
15237
|
|
|
15112
15238
|
// ../../node_modules/viem/_esm/utils/formatters/extract.js
|
|
15113
|
-
function extract(value_, { format }) {
|
|
15114
|
-
if (!
|
|
15239
|
+
function extract(value_, { format: format2 }) {
|
|
15240
|
+
if (!format2)
|
|
15115
15241
|
return {};
|
|
15116
15242
|
const value = {};
|
|
15117
15243
|
function extract_(formatted2) {
|
|
@@ -15123,7 +15249,7 @@ function extract(value_, { format }) {
|
|
|
15123
15249
|
extract_(formatted2[key]);
|
|
15124
15250
|
}
|
|
15125
15251
|
}
|
|
15126
|
-
const formatted =
|
|
15252
|
+
const formatted = format2(value_ || {});
|
|
15127
15253
|
extract_(formatted);
|
|
15128
15254
|
return value;
|
|
15129
15255
|
}
|
|
@@ -15133,12 +15259,12 @@ var init_extract = __esm({
|
|
|
15133
15259
|
});
|
|
15134
15260
|
|
|
15135
15261
|
// ../../node_modules/viem/_esm/utils/formatters/formatter.js
|
|
15136
|
-
function defineFormatter(type,
|
|
15262
|
+
function defineFormatter(type, format2) {
|
|
15137
15263
|
return ({ exclude, format: overrides }) => {
|
|
15138
15264
|
return {
|
|
15139
15265
|
exclude,
|
|
15140
15266
|
format: (args, action) => {
|
|
15141
|
-
const formatted =
|
|
15267
|
+
const formatted = format2(args, action);
|
|
15142
15268
|
if (exclude) {
|
|
15143
15269
|
for (const key of exclude) {
|
|
15144
15270
|
delete formatted[key];
|
|
@@ -15436,7 +15562,7 @@ var init_fee = __esm({
|
|
|
15436
15562
|
};
|
|
15437
15563
|
MaxFeePerGasTooLowError = class extends BaseError2 {
|
|
15438
15564
|
constructor({ maxPriorityFeePerGas }) {
|
|
15439
|
-
super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${
|
|
15565
|
+
super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${formatGwei2(maxPriorityFeePerGas)} gwei).`, { name: "MaxFeePerGasTooLowError" });
|
|
15440
15566
|
}
|
|
15441
15567
|
};
|
|
15442
15568
|
}
|
|
@@ -15592,8 +15718,8 @@ async function getBlock(client, { blockHash, blockNumber, blockTag = client.expe
|
|
|
15592
15718
|
}
|
|
15593
15719
|
if (!block)
|
|
15594
15720
|
throw new BlockNotFoundError({ blockHash, blockNumber });
|
|
15595
|
-
const
|
|
15596
|
-
return
|
|
15721
|
+
const format2 = client.chain?.formatters?.block?.format || formatBlock;
|
|
15722
|
+
return format2(block, "getBlock");
|
|
15597
15723
|
}
|
|
15598
15724
|
var init_getBlock = __esm({
|
|
15599
15725
|
"../../node_modules/viem/_esm/actions/public/getBlock.js"() {
|
|
@@ -15682,7 +15808,7 @@ async function internal_estimateFeesPerGas(client, args) {
|
|
|
15682
15808
|
throw new BaseFeeScalarError();
|
|
15683
15809
|
const decimals = baseFeeMultiplier.toString().split(".")[1]?.length ?? 0;
|
|
15684
15810
|
const denominator = 10 ** decimals;
|
|
15685
|
-
const multiply = (base2) => base2 * BigInt(Math.
|
|
15811
|
+
const multiply = (base2) => base2 * BigInt(Math.round(baseFeeMultiplier * denominator)) / BigInt(denominator);
|
|
15686
15812
|
const block = block_ ? block_ : await getAction(client, getBlock, "getBlock")({});
|
|
15687
15813
|
if (typeof chain2?.fees?.estimateFeesPerGas === "function") {
|
|
15688
15814
|
const fees = await chain2.fees.estimateFeesPerGas({
|
|
@@ -16074,8 +16200,8 @@ async function fillTransaction(client, parameters) {
|
|
|
16074
16200
|
})();
|
|
16075
16201
|
assertRequest(parameters);
|
|
16076
16202
|
const chainFormat = chain2?.formatters?.transactionRequest?.format;
|
|
16077
|
-
const
|
|
16078
|
-
const request =
|
|
16203
|
+
const format2 = chainFormat || formatTransactionRequest;
|
|
16204
|
+
const request = format2({
|
|
16079
16205
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
16080
16206
|
...extract(rest, { format: chainFormat }),
|
|
16081
16207
|
account: account ? parseAccount(account) : void 0,
|
|
@@ -16099,8 +16225,8 @@ async function fillTransaction(client, parameters) {
|
|
|
16099
16225
|
method: "eth_fillTransaction",
|
|
16100
16226
|
params: [request]
|
|
16101
16227
|
});
|
|
16102
|
-
const
|
|
16103
|
-
const transaction =
|
|
16228
|
+
const format3 = chain2?.formatters?.transaction?.format || formatTransaction;
|
|
16229
|
+
const transaction = format3(response.tx);
|
|
16104
16230
|
delete transaction.blockHash;
|
|
16105
16231
|
delete transaction.blockNumber;
|
|
16106
16232
|
delete transaction.r;
|
|
@@ -16109,35 +16235,41 @@ async function fillTransaction(client, parameters) {
|
|
|
16109
16235
|
delete transaction.v;
|
|
16110
16236
|
delete transaction.yParity;
|
|
16111
16237
|
transaction.data = transaction.input;
|
|
16112
|
-
|
|
16113
|
-
|
|
16114
|
-
|
|
16115
|
-
|
|
16116
|
-
|
|
16117
|
-
|
|
16118
|
-
if (
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
|
|
16122
|
-
|
|
16123
|
-
|
|
16124
|
-
|
|
16125
|
-
if (
|
|
16126
|
-
|
|
16127
|
-
|
|
16128
|
-
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
|
|
16140
|
-
|
|
16238
|
+
const hasFeePayerSignature = typeof transaction.feePayerSignature !== "undefined" && transaction.feePayerSignature !== null;
|
|
16239
|
+
if (hasFeePayerSignature && typeof nonce !== "undefined" && transaction.nonce !== nonce)
|
|
16240
|
+
throw new FeePayerNonceMismatchError({
|
|
16241
|
+
filledNonce: transaction.nonce,
|
|
16242
|
+
requestedNonce: nonce
|
|
16243
|
+
});
|
|
16244
|
+
if (!hasFeePayerSignature) {
|
|
16245
|
+
if (transaction.gas)
|
|
16246
|
+
transaction.gas = parameters.gas ?? transaction.gas;
|
|
16247
|
+
if (transaction.gasPrice)
|
|
16248
|
+
transaction.gasPrice = parameters.gasPrice ?? transaction.gasPrice;
|
|
16249
|
+
if (transaction.maxFeePerBlobGas)
|
|
16250
|
+
transaction.maxFeePerBlobGas = parameters.maxFeePerBlobGas ?? transaction.maxFeePerBlobGas;
|
|
16251
|
+
if (transaction.maxFeePerGas)
|
|
16252
|
+
transaction.maxFeePerGas = parameters.maxFeePerGas ?? transaction.maxFeePerGas;
|
|
16253
|
+
if (transaction.maxPriorityFeePerGas)
|
|
16254
|
+
transaction.maxPriorityFeePerGas = parameters.maxPriorityFeePerGas ?? transaction.maxPriorityFeePerGas;
|
|
16255
|
+
if (typeof transaction.nonce !== "undefined")
|
|
16256
|
+
transaction.nonce = parameters.nonce ?? transaction.nonce;
|
|
16257
|
+
const feeMultiplier = await (async () => {
|
|
16258
|
+
if (typeof chain2?.fees?.baseFeeMultiplier === "function") {
|
|
16259
|
+
const block = await getAction(client, getBlock, "getBlock")({});
|
|
16260
|
+
return chain2.fees.baseFeeMultiplier({
|
|
16261
|
+
block,
|
|
16262
|
+
client,
|
|
16263
|
+
request: parameters
|
|
16264
|
+
});
|
|
16265
|
+
}
|
|
16266
|
+
return chain2?.fees?.baseFeeMultiplier ?? 1.2;
|
|
16267
|
+
})();
|
|
16268
|
+
if (feeMultiplier < 1)
|
|
16269
|
+
throw new BaseFeeScalarError();
|
|
16270
|
+
const decimals = feeMultiplier.toString().split(".")[1]?.length ?? 0;
|
|
16271
|
+
const denominator = 10 ** decimals;
|
|
16272
|
+
const multiplyFee = (base2) => base2 * BigInt(Math.round(feeMultiplier * denominator)) / BigInt(denominator);
|
|
16141
16273
|
if (transaction.maxFeePerGas && !parameters.maxFeePerGas)
|
|
16142
16274
|
transaction.maxFeePerGas = multiplyFee(transaction.maxFeePerGas);
|
|
16143
16275
|
if (transaction.gasPrice && !parameters.gasPrice)
|
|
@@ -16162,6 +16294,7 @@ var init_fillTransaction = __esm({
|
|
|
16162
16294
|
"../../node_modules/viem/_esm/actions/public/fillTransaction.js"() {
|
|
16163
16295
|
init_parseAccount();
|
|
16164
16296
|
init_fee();
|
|
16297
|
+
init_transaction();
|
|
16165
16298
|
init_getTransactionError();
|
|
16166
16299
|
init_extract();
|
|
16167
16300
|
init_transaction2();
|
|
@@ -16204,8 +16337,17 @@ async function prepareTransactionRequest(client, args) {
|
|
|
16204
16337
|
chainId = chainId_;
|
|
16205
16338
|
return chainId;
|
|
16206
16339
|
}
|
|
16207
|
-
|
|
16340
|
+
let account = account_ ? parseAccount(account_) : account_;
|
|
16208
16341
|
let nonce = request.nonce;
|
|
16342
|
+
if (prepareTransactionRequest2?.fn && prepareTransactionRequest2.runAt?.includes("beforeFillTransaction")) {
|
|
16343
|
+
request = await prepareTransactionRequest2.fn({ ...request, chain: chain2 }, {
|
|
16344
|
+
client,
|
|
16345
|
+
phase: "beforeFillTransaction"
|
|
16346
|
+
});
|
|
16347
|
+
nonce ??= request.nonce;
|
|
16348
|
+
const sender = request.account ?? request.from;
|
|
16349
|
+
account = sender ? parseAccount(sender) : void 0;
|
|
16350
|
+
}
|
|
16209
16351
|
if (parameters.includes("nonce") && typeof nonce === "undefined" && account && nonceManager) {
|
|
16210
16352
|
const chainId2 = await getChainId2();
|
|
16211
16353
|
nonce = await nonceManager.consume({
|
|
@@ -16214,16 +16356,11 @@ async function prepareTransactionRequest(client, args) {
|
|
|
16214
16356
|
client
|
|
16215
16357
|
});
|
|
16216
16358
|
}
|
|
16217
|
-
if (prepareTransactionRequest2?.fn && prepareTransactionRequest2.runAt?.includes("beforeFillTransaction")) {
|
|
16218
|
-
request = await prepareTransactionRequest2.fn({ ...request, chain: chain2 }, {
|
|
16219
|
-
client,
|
|
16220
|
-
phase: "beforeFillTransaction"
|
|
16221
|
-
});
|
|
16222
|
-
nonce ??= request.nonce;
|
|
16223
|
-
}
|
|
16224
16359
|
const attemptFill = (() => {
|
|
16225
16360
|
if ((parameters.includes("blobVersionedHashes") || parameters.includes("sidecars")) && request.kzg && request.blobs)
|
|
16226
16361
|
return false;
|
|
16362
|
+
if (parameters.length > 0 && "feePayer" in request && request.feePayer && !("feePayerSignature" in request && request.feePayerSignature))
|
|
16363
|
+
return true;
|
|
16227
16364
|
if (supportsFillTransaction.get(client.uid) === false)
|
|
16228
16365
|
return false;
|
|
16229
16366
|
const shouldAttempt = ["fees", "gas"].some((parameter) => parameters.includes(parameter));
|
|
@@ -16240,11 +16377,14 @@ async function prepareTransactionRequest(client, args) {
|
|
|
16240
16377
|
return false;
|
|
16241
16378
|
})();
|
|
16242
16379
|
const fillResult = attemptFill ? await getAction(client, fillTransaction, "fillTransaction")({ ...request, nonce }).then((result) => {
|
|
16243
|
-
const { chainId: chainId2, from:
|
|
16380
|
+
const { chainId: chainId2, from: from16, gas: gas2, gasPrice, nonce: nonce2, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, type: type2, ...rest } = result.transaction;
|
|
16381
|
+
const feeToken = "feeToken" in rest ? rest.feeToken : void 0;
|
|
16382
|
+
const hasFilledFeePayerSignature = "feePayerSignature" in rest && rest.feePayerSignature !== null && typeof rest.feePayerSignature !== "undefined";
|
|
16383
|
+
const shouldUseFilledFeeToken = typeof feeToken !== "undefined" && feeToken !== null && (!("feeToken" in request) || hasFilledFeePayerSignature);
|
|
16244
16384
|
supportsFillTransaction.set(client.uid, true);
|
|
16245
16385
|
return {
|
|
16246
16386
|
...request,
|
|
16247
|
-
...
|
|
16387
|
+
...from16 ? { from: from16 } : {},
|
|
16248
16388
|
...type2 && !request.type ? { type: type2 } : {},
|
|
16249
16389
|
...typeof chainId2 !== "undefined" ? { chainId: chainId2 } : {},
|
|
16250
16390
|
...typeof gas2 !== "undefined" ? { gas: gas2 } : {},
|
|
@@ -16256,13 +16396,16 @@ async function prepareTransactionRequest(client, args) {
|
|
|
16256
16396
|
..."nonceKey" in rest && typeof rest.nonceKey !== "undefined" ? { nonceKey: rest.nonceKey } : {},
|
|
16257
16397
|
..."keyAuthorization" in rest && typeof rest.keyAuthorization !== "undefined" && rest.keyAuthorization !== null && !("keyAuthorization" in request) ? { keyAuthorization: rest.keyAuthorization } : {},
|
|
16258
16398
|
..."feePayerSignature" in rest && typeof rest.feePayerSignature !== "undefined" && rest.feePayerSignature !== null ? { feePayerSignature: rest.feePayerSignature } : {},
|
|
16259
|
-
...
|
|
16399
|
+
...shouldUseFilledFeeToken ? { feeToken } : {},
|
|
16260
16400
|
...result.capabilities ? { _capabilities: result.capabilities } : {}
|
|
16261
16401
|
};
|
|
16262
16402
|
}).catch((e6) => {
|
|
16263
16403
|
const error = e6;
|
|
16264
16404
|
if (error.name !== "TransactionExecutionError")
|
|
16265
16405
|
return request;
|
|
16406
|
+
const nonceMismatch = error.walk?.((error2) => error2 instanceof FeePayerNonceMismatchError);
|
|
16407
|
+
if (nonceMismatch)
|
|
16408
|
+
throw e6;
|
|
16266
16409
|
const executionReverted = error.walk?.((e7) => {
|
|
16267
16410
|
const error2 = e7;
|
|
16268
16411
|
return error2.name === "ExecutionRevertedError";
|
|
@@ -16392,6 +16535,7 @@ var init_prepareTransactionRequest = __esm({
|
|
|
16392
16535
|
init_getBlock();
|
|
16393
16536
|
init_getTransactionCount();
|
|
16394
16537
|
init_fee();
|
|
16538
|
+
init_transaction();
|
|
16395
16539
|
init_blobsToCommitments();
|
|
16396
16540
|
init_blobsToProofs();
|
|
16397
16541
|
init_commitmentsToVersionedHashes();
|
|
@@ -16450,8 +16594,8 @@ async function estimateGas(client, args) {
|
|
|
16450
16594
|
const rpcStateOverride = serializeStateOverride(stateOverride);
|
|
16451
16595
|
assertRequest(args);
|
|
16452
16596
|
const chainFormat = client.chain?.formatters?.transactionRequest?.format;
|
|
16453
|
-
const
|
|
16454
|
-
const request =
|
|
16597
|
+
const format2 = chainFormat || formatTransactionRequest;
|
|
16598
|
+
const request = format2({
|
|
16455
16599
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
16456
16600
|
...extract(rest, { format: chainFormat }),
|
|
16457
16601
|
account,
|
|
@@ -17437,7 +17581,7 @@ function assert(value) {
|
|
|
17437
17581
|
if (value.BYTES_PER_ELEMENT !== 1 || value.constructor.name !== "Uint8Array")
|
|
17438
17582
|
throw new InvalidBytesTypeError(value);
|
|
17439
17583
|
}
|
|
17440
|
-
function
|
|
17584
|
+
function from2(value) {
|
|
17441
17585
|
if (value instanceof Uint8Array)
|
|
17442
17586
|
return value;
|
|
17443
17587
|
if (typeof value === "string")
|
|
@@ -17631,7 +17775,7 @@ function assert2(value, options = {}) {
|
|
|
17631
17775
|
function concat2(...values) {
|
|
17632
17776
|
return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
|
|
17633
17777
|
}
|
|
17634
|
-
function
|
|
17778
|
+
function from3(value) {
|
|
17635
17779
|
if (value instanceof Uint8Array)
|
|
17636
17780
|
return fromBytes(value);
|
|
17637
17781
|
if (Array.isArray(value))
|
|
@@ -17873,7 +18017,7 @@ var init_BlockOverrides = __esm({
|
|
|
17873
18017
|
});
|
|
17874
18018
|
|
|
17875
18019
|
// ../../node_modules/viem/_esm/constants/abis.js
|
|
17876
|
-
var multicall3Abi, batchGatewayAbi, universalResolverErrors, universalResolverResolveAbi, universalResolverReverseAbi, textResolverAbi, addressResolverAbi, erc1271Abi, erc6492SignatureValidatorAbi;
|
|
18020
|
+
var multicall3Abi, batchGatewayAbi, universalResolverErrors, universalResolverResolveAbi, universalResolverReverseAbi, textResolverAbi, addressResolverAbi, erc1271Abi, erc6492SignatureValidatorAbi, erc20Abi;
|
|
17877
18021
|
var init_abis = __esm({
|
|
17878
18022
|
"../../node_modules/viem/_esm/constants/abis.js"() {
|
|
17879
18023
|
multicall3Abi = [
|
|
@@ -18227,6 +18371,194 @@ var init_abis = __esm({
|
|
|
18227
18371
|
name: "isValidSig"
|
|
18228
18372
|
}
|
|
18229
18373
|
];
|
|
18374
|
+
erc20Abi = [
|
|
18375
|
+
{
|
|
18376
|
+
type: "event",
|
|
18377
|
+
name: "Approval",
|
|
18378
|
+
inputs: [
|
|
18379
|
+
{
|
|
18380
|
+
indexed: true,
|
|
18381
|
+
name: "owner",
|
|
18382
|
+
type: "address"
|
|
18383
|
+
},
|
|
18384
|
+
{
|
|
18385
|
+
indexed: true,
|
|
18386
|
+
name: "spender",
|
|
18387
|
+
type: "address"
|
|
18388
|
+
},
|
|
18389
|
+
{
|
|
18390
|
+
indexed: false,
|
|
18391
|
+
name: "value",
|
|
18392
|
+
type: "uint256"
|
|
18393
|
+
}
|
|
18394
|
+
]
|
|
18395
|
+
},
|
|
18396
|
+
{
|
|
18397
|
+
type: "event",
|
|
18398
|
+
name: "Transfer",
|
|
18399
|
+
inputs: [
|
|
18400
|
+
{
|
|
18401
|
+
indexed: true,
|
|
18402
|
+
name: "from",
|
|
18403
|
+
type: "address"
|
|
18404
|
+
},
|
|
18405
|
+
{
|
|
18406
|
+
indexed: true,
|
|
18407
|
+
name: "to",
|
|
18408
|
+
type: "address"
|
|
18409
|
+
},
|
|
18410
|
+
{
|
|
18411
|
+
indexed: false,
|
|
18412
|
+
name: "value",
|
|
18413
|
+
type: "uint256"
|
|
18414
|
+
}
|
|
18415
|
+
]
|
|
18416
|
+
},
|
|
18417
|
+
{
|
|
18418
|
+
type: "function",
|
|
18419
|
+
name: "allowance",
|
|
18420
|
+
stateMutability: "view",
|
|
18421
|
+
inputs: [
|
|
18422
|
+
{
|
|
18423
|
+
name: "owner",
|
|
18424
|
+
type: "address"
|
|
18425
|
+
},
|
|
18426
|
+
{
|
|
18427
|
+
name: "spender",
|
|
18428
|
+
type: "address"
|
|
18429
|
+
}
|
|
18430
|
+
],
|
|
18431
|
+
outputs: [
|
|
18432
|
+
{
|
|
18433
|
+
type: "uint256"
|
|
18434
|
+
}
|
|
18435
|
+
]
|
|
18436
|
+
},
|
|
18437
|
+
{
|
|
18438
|
+
type: "function",
|
|
18439
|
+
name: "approve",
|
|
18440
|
+
stateMutability: "nonpayable",
|
|
18441
|
+
inputs: [
|
|
18442
|
+
{
|
|
18443
|
+
name: "spender",
|
|
18444
|
+
type: "address"
|
|
18445
|
+
},
|
|
18446
|
+
{
|
|
18447
|
+
name: "amount",
|
|
18448
|
+
type: "uint256"
|
|
18449
|
+
}
|
|
18450
|
+
],
|
|
18451
|
+
outputs: [
|
|
18452
|
+
{
|
|
18453
|
+
type: "bool"
|
|
18454
|
+
}
|
|
18455
|
+
]
|
|
18456
|
+
},
|
|
18457
|
+
{
|
|
18458
|
+
type: "function",
|
|
18459
|
+
name: "balanceOf",
|
|
18460
|
+
stateMutability: "view",
|
|
18461
|
+
inputs: [
|
|
18462
|
+
{
|
|
18463
|
+
name: "account",
|
|
18464
|
+
type: "address"
|
|
18465
|
+
}
|
|
18466
|
+
],
|
|
18467
|
+
outputs: [
|
|
18468
|
+
{
|
|
18469
|
+
type: "uint256"
|
|
18470
|
+
}
|
|
18471
|
+
]
|
|
18472
|
+
},
|
|
18473
|
+
{
|
|
18474
|
+
type: "function",
|
|
18475
|
+
name: "decimals",
|
|
18476
|
+
stateMutability: "view",
|
|
18477
|
+
inputs: [],
|
|
18478
|
+
outputs: [
|
|
18479
|
+
{
|
|
18480
|
+
type: "uint8"
|
|
18481
|
+
}
|
|
18482
|
+
]
|
|
18483
|
+
},
|
|
18484
|
+
{
|
|
18485
|
+
type: "function",
|
|
18486
|
+
name: "name",
|
|
18487
|
+
stateMutability: "view",
|
|
18488
|
+
inputs: [],
|
|
18489
|
+
outputs: [
|
|
18490
|
+
{
|
|
18491
|
+
type: "string"
|
|
18492
|
+
}
|
|
18493
|
+
]
|
|
18494
|
+
},
|
|
18495
|
+
{
|
|
18496
|
+
type: "function",
|
|
18497
|
+
name: "symbol",
|
|
18498
|
+
stateMutability: "view",
|
|
18499
|
+
inputs: [],
|
|
18500
|
+
outputs: [
|
|
18501
|
+
{
|
|
18502
|
+
type: "string"
|
|
18503
|
+
}
|
|
18504
|
+
]
|
|
18505
|
+
},
|
|
18506
|
+
{
|
|
18507
|
+
type: "function",
|
|
18508
|
+
name: "totalSupply",
|
|
18509
|
+
stateMutability: "view",
|
|
18510
|
+
inputs: [],
|
|
18511
|
+
outputs: [
|
|
18512
|
+
{
|
|
18513
|
+
type: "uint256"
|
|
18514
|
+
}
|
|
18515
|
+
]
|
|
18516
|
+
},
|
|
18517
|
+
{
|
|
18518
|
+
type: "function",
|
|
18519
|
+
name: "transfer",
|
|
18520
|
+
stateMutability: "nonpayable",
|
|
18521
|
+
inputs: [
|
|
18522
|
+
{
|
|
18523
|
+
name: "recipient",
|
|
18524
|
+
type: "address"
|
|
18525
|
+
},
|
|
18526
|
+
{
|
|
18527
|
+
name: "amount",
|
|
18528
|
+
type: "uint256"
|
|
18529
|
+
}
|
|
18530
|
+
],
|
|
18531
|
+
outputs: [
|
|
18532
|
+
{
|
|
18533
|
+
type: "bool"
|
|
18534
|
+
}
|
|
18535
|
+
]
|
|
18536
|
+
},
|
|
18537
|
+
{
|
|
18538
|
+
type: "function",
|
|
18539
|
+
name: "transferFrom",
|
|
18540
|
+
stateMutability: "nonpayable",
|
|
18541
|
+
inputs: [
|
|
18542
|
+
{
|
|
18543
|
+
name: "sender",
|
|
18544
|
+
type: "address"
|
|
18545
|
+
},
|
|
18546
|
+
{
|
|
18547
|
+
name: "recipient",
|
|
18548
|
+
type: "address"
|
|
18549
|
+
},
|
|
18550
|
+
{
|
|
18551
|
+
name: "amount",
|
|
18552
|
+
type: "uint256"
|
|
18553
|
+
}
|
|
18554
|
+
],
|
|
18555
|
+
outputs: [
|
|
18556
|
+
{
|
|
18557
|
+
type: "bool"
|
|
18558
|
+
}
|
|
18559
|
+
]
|
|
18560
|
+
}
|
|
18561
|
+
];
|
|
18230
18562
|
}
|
|
18231
18563
|
});
|
|
18232
18564
|
|
|
@@ -18820,8 +19152,8 @@ async function call(client, args) {
|
|
|
18820
19152
|
const rpcBlockOverrides = blockOverrides ? toRpc2(blockOverrides) : void 0;
|
|
18821
19153
|
const rpcStateOverride = serializeStateOverride(stateOverride);
|
|
18822
19154
|
const chainFormat = client.chain?.formatters?.transactionRequest?.format;
|
|
18823
|
-
const
|
|
18824
|
-
const request =
|
|
19155
|
+
const format2 = chainFormat || formatTransactionRequest;
|
|
19156
|
+
const request = format2({
|
|
18825
19157
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
18826
19158
|
...extract(rest, { format: chainFormat }),
|
|
18827
19159
|
accessList,
|
|
@@ -19640,8 +19972,8 @@ async function sendTransaction(client, parameters) {
|
|
|
19640
19972
|
});
|
|
19641
19973
|
}
|
|
19642
19974
|
const chainFormat = client.chain?.formatters?.transactionRequest?.format;
|
|
19643
|
-
const
|
|
19644
|
-
const request =
|
|
19975
|
+
const format2 = chainFormat || formatTransactionRequest;
|
|
19976
|
+
const request = format2({
|
|
19645
19977
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
19646
19978
|
...extract(rest, { format: chainFormat }),
|
|
19647
19979
|
accessList,
|
|
@@ -19691,17 +20023,29 @@ async function sendTransaction(client, parameters) {
|
|
|
19691
20023
|
}
|
|
19692
20024
|
}
|
|
19693
20025
|
if (account?.type === "local") {
|
|
19694
|
-
|
|
19695
|
-
|
|
19696
|
-
|
|
19697
|
-
|
|
19698
|
-
|
|
19699
|
-
|
|
19700
|
-
|
|
19701
|
-
|
|
19702
|
-
|
|
19703
|
-
|
|
19704
|
-
|
|
20026
|
+
const nonceManager = (() => {
|
|
20027
|
+
if (!account.nonceManager || typeof nonce !== "undefined")
|
|
20028
|
+
return account.nonceManager;
|
|
20029
|
+
const nonceManager2 = account.nonceManager;
|
|
20030
|
+
return {
|
|
20031
|
+
consume(parameters2) {
|
|
20032
|
+
nonceManagerParameters = {
|
|
20033
|
+
address: parameters2.address,
|
|
20034
|
+
chainId: parameters2.chainId
|
|
20035
|
+
};
|
|
20036
|
+
return nonceManager2.consume(parameters2);
|
|
20037
|
+
},
|
|
20038
|
+
get(parameters2) {
|
|
20039
|
+
return nonceManager2.get(parameters2);
|
|
20040
|
+
},
|
|
20041
|
+
increment(parameters2) {
|
|
20042
|
+
return nonceManager2.increment(parameters2);
|
|
20043
|
+
},
|
|
20044
|
+
reset(parameters2) {
|
|
20045
|
+
return nonceManager2.reset(parameters2);
|
|
20046
|
+
}
|
|
20047
|
+
};
|
|
20048
|
+
})();
|
|
19705
20049
|
const request = await getAction(client, prepareTransactionRequest, "prepareTransactionRequest")({
|
|
19706
20050
|
account,
|
|
19707
20051
|
accessList,
|
|
@@ -19715,7 +20059,7 @@ async function sendTransaction(client, parameters) {
|
|
|
19715
20059
|
maxFeePerGas,
|
|
19716
20060
|
maxPriorityFeePerGas,
|
|
19717
20061
|
nonce,
|
|
19718
|
-
nonceManager
|
|
20062
|
+
nonceManager,
|
|
19719
20063
|
parameters: [...defaultParameters, "sidecars"],
|
|
19720
20064
|
type,
|
|
19721
20065
|
value,
|
|
@@ -19864,7 +20208,7 @@ function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry: shoul
|
|
|
19864
20208
|
return;
|
|
19865
20209
|
}
|
|
19866
20210
|
}
|
|
19867
|
-
attemptRetry({ count: count + 1 });
|
|
20211
|
+
return attemptRetry({ count: count + 1 });
|
|
19868
20212
|
};
|
|
19869
20213
|
try {
|
|
19870
20214
|
const data = await fn();
|
|
@@ -19883,7 +20227,7 @@ function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry: shoul
|
|
|
19883
20227
|
reject(err);
|
|
19884
20228
|
}
|
|
19885
20229
|
};
|
|
19886
|
-
attemptRetry();
|
|
20230
|
+
void attemptRetry().catch(reject);
|
|
19887
20231
|
});
|
|
19888
20232
|
}
|
|
19889
20233
|
var init_withRetry = __esm({
|
|
@@ -20225,7 +20569,7 @@ var init_uid = __esm({
|
|
|
20225
20569
|
|
|
20226
20570
|
// ../../node_modules/viem/_esm/clients/createClient.js
|
|
20227
20571
|
function createClient(parameters) {
|
|
20228
|
-
const { batch, chain: chain2, ccipRead, dataSuffix, key = "base", name = "Base Client", type = "base" } = parameters;
|
|
20572
|
+
const { batch, chain: chain2, ccipRead, dataSuffix, key = "base", name = "Base Client", tokens, type = "base" } = parameters;
|
|
20229
20573
|
const experimental_blockTag = parameters.experimental_blockTag ?? (typeof chain2?.experimental_preconfirmationTime === "number" ? "pending" : void 0);
|
|
20230
20574
|
const blockTime = chain2?.blockTime ?? 12e3;
|
|
20231
20575
|
const defaultPollingInterval = Math.min(Math.max(Math.floor(blockTime / 2), 500), 4e3);
|
|
@@ -20249,6 +20593,7 @@ function createClient(parameters) {
|
|
|
20249
20593
|
name,
|
|
20250
20594
|
pollingInterval,
|
|
20251
20595
|
request,
|
|
20596
|
+
tokens,
|
|
20252
20597
|
transport,
|
|
20253
20598
|
type,
|
|
20254
20599
|
uid: uid(),
|
|
@@ -20260,11 +20605,48 @@ function createClient(parameters) {
|
|
|
20260
20605
|
for (const key2 in client)
|
|
20261
20606
|
delete extended[key2];
|
|
20262
20607
|
const combined = { ...base2, ...extended };
|
|
20608
|
+
for (const key2 in extended) {
|
|
20609
|
+
const a = base2[key2];
|
|
20610
|
+
const b = extended[key2];
|
|
20611
|
+
if (isPlainObject(a) && isPlainObject(b))
|
|
20612
|
+
combined[key2] = { ...a, ...b };
|
|
20613
|
+
}
|
|
20263
20614
|
return Object.assign(combined, { extend: extend(combined) });
|
|
20264
20615
|
};
|
|
20265
20616
|
}
|
|
20266
20617
|
return Object.assign(client, { extend: extend(client) });
|
|
20267
20618
|
}
|
|
20619
|
+
function isPlainObject(value) {
|
|
20620
|
+
if (typeof value !== "object" || value === null)
|
|
20621
|
+
return false;
|
|
20622
|
+
const prototype = Object.getPrototypeOf(value);
|
|
20623
|
+
return prototype === Object.prototype || prototype === null;
|
|
20624
|
+
}
|
|
20625
|
+
function bindActionDecorators(client, action) {
|
|
20626
|
+
const wrapped = (parameters = {}) => action(client, parameters);
|
|
20627
|
+
for (const key of [
|
|
20628
|
+
"call",
|
|
20629
|
+
"calls",
|
|
20630
|
+
"callWithPeriod",
|
|
20631
|
+
"estimateGas",
|
|
20632
|
+
"prepare",
|
|
20633
|
+
"prepareRecipient",
|
|
20634
|
+
"predict",
|
|
20635
|
+
"simulate"
|
|
20636
|
+
])
|
|
20637
|
+
if (Object.hasOwn(action, key)) {
|
|
20638
|
+
const helper = action[key];
|
|
20639
|
+
wrapped[key] = (args = {}) => {
|
|
20640
|
+
if (helper.length === 1)
|
|
20641
|
+
return helper(args);
|
|
20642
|
+
return helper(client, args);
|
|
20643
|
+
};
|
|
20644
|
+
}
|
|
20645
|
+
for (const key of ["extractEvent", "extractEvents"])
|
|
20646
|
+
if (Object.hasOwn(action, key))
|
|
20647
|
+
wrapped[key] = action[key];
|
|
20648
|
+
return wrapped;
|
|
20649
|
+
}
|
|
20268
20650
|
var init_createClient = __esm({
|
|
20269
20651
|
"../../node_modules/viem/_esm/clients/createClient.js"() {
|
|
20270
20652
|
init_parseAccount();
|
|
@@ -20944,8 +21326,8 @@ async function createAccessList(client, args) {
|
|
|
20944
21326
|
const blockNumberHex = typeof blockNumber === "bigint" ? numberToHex(blockNumber) : void 0;
|
|
20945
21327
|
const block = blockNumberHex || blockTag;
|
|
20946
21328
|
const chainFormat = client.chain?.formatters?.transactionRequest?.format;
|
|
20947
|
-
const
|
|
20948
|
-
const request =
|
|
21329
|
+
const format2 = chainFormat || formatTransactionRequest;
|
|
21330
|
+
const request = format2({
|
|
20949
21331
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
20950
21332
|
...extract(rest, { format: chainFormat }),
|
|
20951
21333
|
account,
|
|
@@ -21137,8 +21519,8 @@ async function getBlockReceipts(client, { blockHash, blockNumber, blockTag = cli
|
|
|
21137
21519
|
}, { dedupe: Boolean(blockHash || blockNumberHex) });
|
|
21138
21520
|
if (!receipts)
|
|
21139
21521
|
throw new BlockNotFoundError({ blockHash, blockNumber });
|
|
21140
|
-
const
|
|
21141
|
-
return receipts.map((receipt) =>
|
|
21522
|
+
const format2 = client.chain?.formatters?.transactionReceipt?.format || formatTransactionReceipt;
|
|
21523
|
+
return receipts.map((receipt) => format2(receipt, "getBlockReceipts"));
|
|
21142
21524
|
}
|
|
21143
21525
|
var init_getBlockReceipts = __esm({
|
|
21144
21526
|
"../../node_modules/viem/_esm/actions/public/getBlockReceipts.js"() {
|
|
@@ -22017,7 +22399,7 @@ function getHttpRpcClient(url_, options = {}) {
|
|
|
22017
22399
|
const { url, headers: headers_url } = parseUrl(url_);
|
|
22018
22400
|
return {
|
|
22019
22401
|
async request(params) {
|
|
22020
|
-
const { body, fetchFn = options.fetchFn ?? fetch, onRequest = options.onRequest, onResponse = options.onResponse, timeout = options.timeout ?? 1e4 } = params;
|
|
22402
|
+
const { body, fetchFn = options.fetchFn ?? fetch, maxResponseBodySize = options.maxResponseBodySize ?? defaultMaxResponseBodySize, onRequest = options.onRequest, onResponse = options.onResponse, timeout = options.timeout ?? 1e4 } = params;
|
|
22021
22403
|
const fetchOptions = {
|
|
22022
22404
|
...options.fetchOptions ?? {},
|
|
22023
22405
|
...params.fetchOptions ?? {}
|
|
@@ -22056,10 +22438,13 @@ function getHttpRpcClient(url_, options = {}) {
|
|
|
22056
22438
|
if (onResponse)
|
|
22057
22439
|
await onResponse(response);
|
|
22058
22440
|
let data;
|
|
22441
|
+
const responseBody = await readResponseBody(response, {
|
|
22442
|
+
maxResponseBodySize
|
|
22443
|
+
});
|
|
22059
22444
|
if (response.headers.get("Content-Type")?.startsWith("application/json"))
|
|
22060
|
-
data =
|
|
22445
|
+
data = JSON.parse(responseBody);
|
|
22061
22446
|
else {
|
|
22062
|
-
data =
|
|
22447
|
+
data = responseBody;
|
|
22063
22448
|
try {
|
|
22064
22449
|
data = JSON.parse(data || "{}");
|
|
22065
22450
|
} catch (err) {
|
|
@@ -22087,6 +22472,8 @@ function getHttpRpcClient(url_, options = {}) {
|
|
|
22087
22472
|
throw err;
|
|
22088
22473
|
if (err instanceof HttpRequestError)
|
|
22089
22474
|
throw err;
|
|
22475
|
+
if (err instanceof ResponseBodyTooLargeError)
|
|
22476
|
+
throw err;
|
|
22090
22477
|
if (err instanceof TimeoutError)
|
|
22091
22478
|
throw err;
|
|
22092
22479
|
throw new HttpRequestError({
|
|
@@ -22098,6 +22485,53 @@ function getHttpRpcClient(url_, options = {}) {
|
|
|
22098
22485
|
}
|
|
22099
22486
|
};
|
|
22100
22487
|
}
|
|
22488
|
+
async function readResponseBody(response, { maxResponseBodySize }) {
|
|
22489
|
+
if (maxResponseBodySize === false)
|
|
22490
|
+
return response.text();
|
|
22491
|
+
const contentLength = response.headers.get("Content-Length");
|
|
22492
|
+
if (contentLength) {
|
|
22493
|
+
const size6 = Number(contentLength);
|
|
22494
|
+
if (size6 > maxResponseBodySize)
|
|
22495
|
+
throw new ResponseBodyTooLargeError({
|
|
22496
|
+
maxSize: maxResponseBodySize,
|
|
22497
|
+
size: size6
|
|
22498
|
+
});
|
|
22499
|
+
}
|
|
22500
|
+
if (!response.body) {
|
|
22501
|
+
const body2 = await response.text();
|
|
22502
|
+
const size6 = new TextEncoder().encode(body2).length;
|
|
22503
|
+
if (size6 > maxResponseBodySize)
|
|
22504
|
+
throw new ResponseBodyTooLargeError({
|
|
22505
|
+
maxSize: maxResponseBodySize,
|
|
22506
|
+
size: size6
|
|
22507
|
+
});
|
|
22508
|
+
return body2;
|
|
22509
|
+
}
|
|
22510
|
+
const reader = response.body.getReader();
|
|
22511
|
+
const decoder2 = new TextDecoder();
|
|
22512
|
+
let body = "";
|
|
22513
|
+
let size5 = 0;
|
|
22514
|
+
try {
|
|
22515
|
+
while (true) {
|
|
22516
|
+
const { done, value } = await reader.read();
|
|
22517
|
+
if (done)
|
|
22518
|
+
break;
|
|
22519
|
+
size5 += value.byteLength;
|
|
22520
|
+
if (size5 > maxResponseBodySize) {
|
|
22521
|
+
await reader.cancel();
|
|
22522
|
+
throw new ResponseBodyTooLargeError({
|
|
22523
|
+
maxSize: maxResponseBodySize,
|
|
22524
|
+
size: size5
|
|
22525
|
+
});
|
|
22526
|
+
}
|
|
22527
|
+
body += decoder2.decode(value, { stream: true });
|
|
22528
|
+
}
|
|
22529
|
+
body += decoder2.decode();
|
|
22530
|
+
return body;
|
|
22531
|
+
} finally {
|
|
22532
|
+
reader.releaseLock();
|
|
22533
|
+
}
|
|
22534
|
+
}
|
|
22101
22535
|
function parseUrl(url_) {
|
|
22102
22536
|
try {
|
|
22103
22537
|
const url = new URL(url_);
|
|
@@ -22118,6 +22552,7 @@ function parseUrl(url_) {
|
|
|
22118
22552
|
return { url: url_ };
|
|
22119
22553
|
}
|
|
22120
22554
|
}
|
|
22555
|
+
var defaultMaxResponseBodySize;
|
|
22121
22556
|
var init_http = __esm({
|
|
22122
22557
|
"../../node_modules/viem/_esm/utils/rpc/http.js"() {
|
|
22123
22558
|
init_request();
|
|
@@ -22125,6 +22560,7 @@ var init_http = __esm({
|
|
|
22125
22560
|
init_withTimeout();
|
|
22126
22561
|
init_stringify();
|
|
22127
22562
|
init_id();
|
|
22563
|
+
defaultMaxResponseBodySize = 10485760;
|
|
22128
22564
|
}
|
|
22129
22565
|
});
|
|
22130
22566
|
|
|
@@ -22169,7 +22605,7 @@ var init_hashMessage = __esm({
|
|
|
22169
22605
|
});
|
|
22170
22606
|
|
|
22171
22607
|
// ../../node_modules/viem/_esm/errors/typedData.js
|
|
22172
|
-
var InvalidDomainError, InvalidPrimaryTypeError, InvalidStructTypeError;
|
|
22608
|
+
var InvalidDomainError, InvalidPrimaryTypeError, InvalidStructTypeError, InvalidTypedDataTypeError;
|
|
22173
22609
|
var init_typedData = __esm({
|
|
22174
22610
|
"../../node_modules/viem/_esm/errors/typedData.js"() {
|
|
22175
22611
|
init_stringify();
|
|
@@ -22197,6 +22633,15 @@ var init_typedData = __esm({
|
|
|
22197
22633
|
});
|
|
22198
22634
|
}
|
|
22199
22635
|
};
|
|
22636
|
+
InvalidTypedDataTypeError = class extends BaseError2 {
|
|
22637
|
+
constructor({ type }) {
|
|
22638
|
+
const canonicalType = type.replace(/^(u?int)/, "$&256");
|
|
22639
|
+
super(`Type "${type}" is not a valid EIP-712 type.`, {
|
|
22640
|
+
metaMessages: [`Use "${canonicalType}" instead.`],
|
|
22641
|
+
name: "InvalidTypedDataTypeError"
|
|
22642
|
+
});
|
|
22643
|
+
}
|
|
22644
|
+
};
|
|
22200
22645
|
}
|
|
22201
22646
|
});
|
|
22202
22647
|
|
|
@@ -22232,6 +22677,9 @@ function validateTypedData(parameters) {
|
|
|
22232
22677
|
for (const param of struct) {
|
|
22233
22678
|
const { name, type } = param;
|
|
22234
22679
|
const value = data[name];
|
|
22680
|
+
const baseType = type.replace(/(\[[0-9]*\])+$/, "");
|
|
22681
|
+
if (baseType === "int" || baseType === "uint")
|
|
22682
|
+
throw new InvalidTypedDataTypeError({ type });
|
|
22235
22683
|
const integerMatch = type.match(integerRegex2);
|
|
22236
22684
|
if (integerMatch && (typeof value === "number" || typeof value === "bigint")) {
|
|
22237
22685
|
const [_type, base2, size_] = integerMatch;
|
|
@@ -23162,7 +23610,7 @@ var init_sha22 = __esm({
|
|
|
23162
23610
|
// ../../node_modules/ox/_esm/core/Hash.js
|
|
23163
23611
|
function keccak2562(value, options = {}) {
|
|
23164
23612
|
const { as = typeof value === "string" ? "Hex" : "Bytes" } = options;
|
|
23165
|
-
const bytes = keccak_2562(
|
|
23613
|
+
const bytes = keccak_2562(from2(value));
|
|
23166
23614
|
if (as === "Bytes")
|
|
23167
23615
|
return bytes;
|
|
23168
23616
|
return fromBytes(bytes);
|
|
@@ -23197,7 +23645,7 @@ function assert3(publicKey, options = {}) {
|
|
|
23197
23645
|
}
|
|
23198
23646
|
throw new InvalidError({ publicKey });
|
|
23199
23647
|
}
|
|
23200
|
-
function
|
|
23648
|
+
function from4(value) {
|
|
23201
23649
|
const publicKey = (() => {
|
|
23202
23650
|
if (validate2(value))
|
|
23203
23651
|
return fromHex2(value);
|
|
@@ -23319,7 +23767,7 @@ var init_PublicKey = __esm({
|
|
|
23319
23767
|
super(`Value \`${publicKey}\` is an invalid public key size.`, {
|
|
23320
23768
|
metaMessages: [
|
|
23321
23769
|
"Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",
|
|
23322
|
-
`Received ${size3(
|
|
23770
|
+
`Received ${size3(from3(publicKey))} bytes.`
|
|
23323
23771
|
]
|
|
23324
23772
|
});
|
|
23325
23773
|
Object.defineProperty(this, "name", {
|
|
@@ -23370,7 +23818,7 @@ function checksum2(address2) {
|
|
|
23370
23818
|
checksum.set(address2, result);
|
|
23371
23819
|
return result;
|
|
23372
23820
|
}
|
|
23373
|
-
function
|
|
23821
|
+
function from5(address2, options = {}) {
|
|
23374
23822
|
const { checksum: checksumVal = false } = options;
|
|
23375
23823
|
assert4(address2);
|
|
23376
23824
|
if (checksumVal)
|
|
@@ -23379,7 +23827,7 @@ function from4(address2, options = {}) {
|
|
|
23379
23827
|
}
|
|
23380
23828
|
function fromPublicKey(publicKey, options = {}) {
|
|
23381
23829
|
const address2 = keccak2562(`0x${toHex2(publicKey).slice(4)}`).substring(26);
|
|
23382
|
-
return
|
|
23830
|
+
return from5(`0x${address2}`, options);
|
|
23383
23831
|
}
|
|
23384
23832
|
function validate3(address2, options = {}) {
|
|
23385
23833
|
const { strict = true } = options ?? {};
|
|
@@ -23576,7 +24024,7 @@ function decodeAddress3(cursor, options = {}) {
|
|
|
23576
24024
|
}
|
|
23577
24025
|
function decodeArray2(cursor, param, options) {
|
|
23578
24026
|
const { checksumAddress: checksumAddress2, length, staticPosition } = options;
|
|
23579
|
-
if (
|
|
24027
|
+
if (length === null) {
|
|
23580
24028
|
const offset = toNumber2(cursor.readBytes(sizeOfOffset2));
|
|
23581
24029
|
const start = staticPosition + offset;
|
|
23582
24030
|
const startOfData = start + sizeOfLength2;
|
|
@@ -23593,6 +24041,10 @@ function decodeArray2(cursor, param, options) {
|
|
|
23593
24041
|
});
|
|
23594
24042
|
consumed2 += consumed_;
|
|
23595
24043
|
value2.push(data);
|
|
24044
|
+
if (consumed_ === 0) {
|
|
24045
|
+
cursor.assertReadLimit();
|
|
24046
|
+
cursor._touch();
|
|
24047
|
+
}
|
|
23596
24048
|
}
|
|
23597
24049
|
cursor.setPosition(staticPosition + 32);
|
|
23598
24050
|
return [value2, 32];
|
|
@@ -23621,6 +24073,10 @@ function decodeArray2(cursor, param, options) {
|
|
|
23621
24073
|
});
|
|
23622
24074
|
consumed += consumed_;
|
|
23623
24075
|
value.push(data);
|
|
24076
|
+
if (consumed_ === 0) {
|
|
24077
|
+
cursor.assertReadLimit();
|
|
24078
|
+
cursor._touch();
|
|
24079
|
+
}
|
|
23624
24080
|
}
|
|
23625
24081
|
return [value, consumed];
|
|
23626
24082
|
}
|
|
@@ -23797,7 +24253,7 @@ function encodeArray2(value, options) {
|
|
|
23797
24253
|
givenLength: value.length,
|
|
23798
24254
|
type: `${parameter.type}[${length}]`
|
|
23799
24255
|
});
|
|
23800
|
-
let dynamicChild =
|
|
24256
|
+
let dynamicChild = value.length === 0 && hasDynamicChild2(parameter);
|
|
23801
24257
|
const preparedParameters = [];
|
|
23802
24258
|
for (let i = 0; i < value.length; i++) {
|
|
23803
24259
|
const preparedParam = prepareParameter({
|
|
@@ -24168,7 +24624,8 @@ function decode(parameters, data, options = {}) {
|
|
|
24168
24624
|
const values = as === "Array" ? [] : {};
|
|
24169
24625
|
for (let i = 0; i < parameters.length; ++i) {
|
|
24170
24626
|
const param = parameters[i];
|
|
24171
|
-
|
|
24627
|
+
if (consumed < bytes.length)
|
|
24628
|
+
cursor.setPosition(consumed);
|
|
24172
24629
|
const [data2, consumed_] = decodeParameter2(cursor, param, {
|
|
24173
24630
|
checksumAddress: checksumAddress2,
|
|
24174
24631
|
staticPosition: 0
|
|
@@ -24212,7 +24669,7 @@ function encodePacked(types, values) {
|
|
|
24212
24669
|
}
|
|
24213
24670
|
return concat2(...data);
|
|
24214
24671
|
}
|
|
24215
|
-
function
|
|
24672
|
+
function from6(parameters) {
|
|
24216
24673
|
if (Array.isArray(parameters) && typeof parameters[0] === "string")
|
|
24217
24674
|
return parseAbiParameters(parameters);
|
|
24218
24675
|
if (typeof parameters === "string")
|
|
@@ -24367,7 +24824,7 @@ var init_AbiParameters = __esm({
|
|
|
24367
24824
|
});
|
|
24368
24825
|
|
|
24369
24826
|
// ../../node_modules/ox/_esm/core/Rlp.js
|
|
24370
|
-
function
|
|
24827
|
+
function from7(value, options) {
|
|
24371
24828
|
const { as } = options;
|
|
24372
24829
|
const encodable = getEncodable2(value);
|
|
24373
24830
|
const cursor = create(new Uint8Array(encodable.length));
|
|
@@ -24378,7 +24835,7 @@ function from6(value, options) {
|
|
|
24378
24835
|
}
|
|
24379
24836
|
function fromHex3(hex, options = {}) {
|
|
24380
24837
|
const { as = "Hex" } = options;
|
|
24381
|
-
return
|
|
24838
|
+
return from7(hex, { as });
|
|
24382
24839
|
}
|
|
24383
24840
|
function getEncodable2(bytes) {
|
|
24384
24841
|
if (Array.isArray(bytes))
|
|
@@ -25504,7 +25961,7 @@ function weierstrass2(curveDef) {
|
|
|
25504
25961
|
function normalizeS(s3) {
|
|
25505
25962
|
return isBiggerThanHalfOrder(s3) ? modN2(-s3) : s3;
|
|
25506
25963
|
}
|
|
25507
|
-
const slcNum = (b,
|
|
25964
|
+
const slcNum = (b, from16, to) => bytesToNumberBE2(b.slice(from16, to));
|
|
25508
25965
|
class Signature {
|
|
25509
25966
|
constructor(r, s3, recovery) {
|
|
25510
25967
|
aInRange2("r", r, _1n11, CURVE_ORDER);
|
|
@@ -25707,14 +26164,14 @@ function weierstrass2(curveDef) {
|
|
|
25707
26164
|
const sg = signature;
|
|
25708
26165
|
msgHash = ensureBytes2("msgHash", msgHash);
|
|
25709
26166
|
publicKey = ensureBytes2("publicKey", publicKey);
|
|
25710
|
-
const { lowS, prehash, format } = opts;
|
|
26167
|
+
const { lowS, prehash, format: format2 } = opts;
|
|
25711
26168
|
validateSigVerOpts2(opts);
|
|
25712
26169
|
if ("strict" in opts)
|
|
25713
26170
|
throw new Error("options.strict was renamed to lowS");
|
|
25714
|
-
if (
|
|
26171
|
+
if (format2 !== void 0 && format2 !== "compact" && format2 !== "der")
|
|
25715
26172
|
throw new Error("format must be compact or der");
|
|
25716
26173
|
const isHex2 = typeof sg === "string" || isBytes3(sg);
|
|
25717
|
-
const isObj = !isHex2 && !
|
|
26174
|
+
const isObj = !isHex2 && !format2 && typeof sg === "object" && sg !== null && typeof sg.r === "bigint" && typeof sg.s === "bigint";
|
|
25718
26175
|
if (!isHex2 && !isObj)
|
|
25719
26176
|
throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
|
|
25720
26177
|
let _sig = void 0;
|
|
@@ -25724,13 +26181,13 @@ function weierstrass2(curveDef) {
|
|
|
25724
26181
|
_sig = new Signature(sg.r, sg.s);
|
|
25725
26182
|
if (isHex2) {
|
|
25726
26183
|
try {
|
|
25727
|
-
if (
|
|
26184
|
+
if (format2 !== "compact")
|
|
25728
26185
|
_sig = Signature.fromDER(sg);
|
|
25729
26186
|
} catch (derError) {
|
|
25730
26187
|
if (!(derError instanceof DER2.Err))
|
|
25731
26188
|
throw derError;
|
|
25732
26189
|
}
|
|
25733
|
-
if (!_sig &&
|
|
26190
|
+
if (!_sig && format2 !== "der")
|
|
25734
26191
|
_sig = Signature.fromCompact(sg);
|
|
25735
26192
|
}
|
|
25736
26193
|
P2 = Point2.fromHex(publicKey);
|
|
@@ -26030,9 +26487,9 @@ function extract2(value) {
|
|
|
26030
26487
|
return void 0;
|
|
26031
26488
|
if (typeof value.s === "undefined")
|
|
26032
26489
|
return void 0;
|
|
26033
|
-
return
|
|
26490
|
+
return from8(value);
|
|
26034
26491
|
}
|
|
26035
|
-
function
|
|
26492
|
+
function from8(signature) {
|
|
26036
26493
|
const signature_ = (() => {
|
|
26037
26494
|
if (typeof signature === "string")
|
|
26038
26495
|
return fromHex4(signature);
|
|
@@ -26103,7 +26560,7 @@ var init_Signature = __esm({
|
|
|
26103
26560
|
super(`Value \`${signature}\` is an invalid signature size.`, {
|
|
26104
26561
|
metaMessages: [
|
|
26105
26562
|
"Expected: 64 bytes or 65 bytes.",
|
|
26106
|
-
`Received ${size3(
|
|
26563
|
+
`Received ${size3(from3(signature))} bytes.`
|
|
26107
26564
|
]
|
|
26108
26565
|
});
|
|
26109
26566
|
Object.defineProperty(this, "name", {
|
|
@@ -26173,7 +26630,7 @@ var init_Signature = __esm({
|
|
|
26173
26630
|
});
|
|
26174
26631
|
|
|
26175
26632
|
// ../../node_modules/ox/_esm/core/Authorization.js
|
|
26176
|
-
function
|
|
26633
|
+
function from9(authorization, options = {}) {
|
|
26177
26634
|
if (typeof authorization.chainId === "string")
|
|
26178
26635
|
return fromRpc3(authorization);
|
|
26179
26636
|
return { ...authorization, ...options.signature };
|
|
@@ -26226,8 +26683,8 @@ function recoverPublicKey2(options) {
|
|
|
26226
26683
|
const { payload, signature } = options;
|
|
26227
26684
|
const { r, s: s3, yParity } = signature;
|
|
26228
26685
|
const signature_ = new secp256k12.Signature(BigInt(r), BigInt(s3)).addRecoveryBit(yParity);
|
|
26229
|
-
const point = signature_.recoverPublicKey(
|
|
26230
|
-
return
|
|
26686
|
+
const point = signature_.recoverPublicKey(from3(payload).substring(2));
|
|
26687
|
+
return from4(point);
|
|
26231
26688
|
}
|
|
26232
26689
|
var init_Secp256k1 = __esm({
|
|
26233
26690
|
"../../node_modules/ox/_esm/core/Secp256k1.js"() {
|
|
@@ -26243,7 +26700,7 @@ var SignatureErc8010_exports = {};
|
|
|
26243
26700
|
__export(SignatureErc8010_exports, {
|
|
26244
26701
|
InvalidWrappedSignatureError: () => InvalidWrappedSignatureError,
|
|
26245
26702
|
assert: () => assert6,
|
|
26246
|
-
from: () =>
|
|
26703
|
+
from: () => from10,
|
|
26247
26704
|
magicBytes: () => magicBytes,
|
|
26248
26705
|
suffixParameters: () => suffixParameters,
|
|
26249
26706
|
unwrap: () => unwrap,
|
|
@@ -26257,7 +26714,7 @@ function assert6(value) {
|
|
|
26257
26714
|
} else
|
|
26258
26715
|
assert5(value.authorization);
|
|
26259
26716
|
}
|
|
26260
|
-
function
|
|
26717
|
+
function from10(value) {
|
|
26261
26718
|
if (typeof value === "string")
|
|
26262
26719
|
return unwrap(value);
|
|
26263
26720
|
return value;
|
|
@@ -26268,7 +26725,7 @@ function unwrap(wrapped) {
|
|
|
26268
26725
|
const suffix = slice3(wrapped, -suffixLength - 64, -64);
|
|
26269
26726
|
const signature = slice3(wrapped, 0, -suffixLength - 64);
|
|
26270
26727
|
const [auth, to, data] = decode(suffixParameters, suffix);
|
|
26271
|
-
const authorization =
|
|
26728
|
+
const authorization = from9({
|
|
26272
26729
|
address: auth.delegation,
|
|
26273
26730
|
chainId: Number(auth.chainId),
|
|
26274
26731
|
nonce: auth.nonce,
|
|
@@ -26287,7 +26744,7 @@ function wrap(value) {
|
|
|
26287
26744
|
assert6(value);
|
|
26288
26745
|
const self = recoverAddress2({
|
|
26289
26746
|
payload: getSignPayload(value.authorization),
|
|
26290
|
-
signature:
|
|
26747
|
+
signature: from8(value.authorization)
|
|
26291
26748
|
});
|
|
26292
26749
|
const suffix = encode2(suffixParameters, [
|
|
26293
26750
|
{
|
|
@@ -26319,7 +26776,7 @@ var init_SignatureErc8010 = __esm({
|
|
|
26319
26776
|
init_Secp256k1();
|
|
26320
26777
|
init_Signature();
|
|
26321
26778
|
magicBytes = "0x8010801080108010801080108010801080108010801080108010801080108010";
|
|
26322
|
-
suffixParameters =
|
|
26779
|
+
suffixParameters = from6("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");
|
|
26323
26780
|
InvalidWrappedSignatureError = class extends BaseError3 {
|
|
26324
26781
|
constructor(wrapped) {
|
|
26325
26782
|
super(`Value \`${wrapped}\` is an invalid ERC-8010 wrapped signature.`);
|
|
@@ -26341,9 +26798,30 @@ var init_erc8010 = __esm({
|
|
|
26341
26798
|
}
|
|
26342
26799
|
});
|
|
26343
26800
|
|
|
26801
|
+
// ../../node_modules/viem/_esm/utils/unit/formatUnits.js
|
|
26802
|
+
function formatUnits(value, decimals) {
|
|
26803
|
+
return format(value, decimals);
|
|
26804
|
+
}
|
|
26805
|
+
var init_formatUnits = __esm({
|
|
26806
|
+
"../../node_modules/viem/_esm/utils/unit/formatUnits.js"() {
|
|
26807
|
+
init_Value();
|
|
26808
|
+
}
|
|
26809
|
+
});
|
|
26810
|
+
|
|
26811
|
+
// ../../node_modules/viem/_esm/utils/unit/parseUnits.js
|
|
26812
|
+
function parseUnits(value, decimals) {
|
|
26813
|
+
return from(value, decimals);
|
|
26814
|
+
}
|
|
26815
|
+
var init_parseUnits = __esm({
|
|
26816
|
+
"../../node_modules/viem/_esm/utils/unit/parseUnits.js"() {
|
|
26817
|
+
init_Value();
|
|
26818
|
+
}
|
|
26819
|
+
});
|
|
26820
|
+
|
|
26344
26821
|
// ../../node_modules/viem/_esm/utils/index.js
|
|
26345
26822
|
var init_utils8 = __esm({
|
|
26346
26823
|
"../../node_modules/viem/_esm/utils/index.js"() {
|
|
26824
|
+
init_encodeFunctionData();
|
|
26347
26825
|
init_fromHex();
|
|
26348
26826
|
}
|
|
26349
26827
|
});
|
|
@@ -26390,6 +26868,22 @@ var init_getProof = __esm({
|
|
|
26390
26868
|
}
|
|
26391
26869
|
});
|
|
26392
26870
|
|
|
26871
|
+
// ../../node_modules/viem/_esm/actions/public/getRawTransaction.js
|
|
26872
|
+
async function getRawTransaction(client, { hash: hash3 }) {
|
|
26873
|
+
const rawTransaction = await client.request({
|
|
26874
|
+
method: "eth_getRawTransactionByHash",
|
|
26875
|
+
params: [hash3]
|
|
26876
|
+
}, { dedupe: true });
|
|
26877
|
+
if (!rawTransaction)
|
|
26878
|
+
throw new TransactionNotFoundError({ hash: hash3 });
|
|
26879
|
+
return rawTransaction;
|
|
26880
|
+
}
|
|
26881
|
+
var init_getRawTransaction = __esm({
|
|
26882
|
+
"../../node_modules/viem/_esm/actions/public/getRawTransaction.js"() {
|
|
26883
|
+
init_transaction();
|
|
26884
|
+
}
|
|
26885
|
+
});
|
|
26886
|
+
|
|
26393
26887
|
// ../../node_modules/viem/_esm/actions/public/getStorageAt.js
|
|
26394
26888
|
async function getStorageAt(client, { address: address2, blockHash, blockNumber, blockTag = "latest", requireCanonical, slot }) {
|
|
26395
26889
|
const block = formatBlockParameter({
|
|
@@ -26444,8 +26938,8 @@ async function getTransaction(client, { blockHash, blockNumber, blockTag: blockT
|
|
|
26444
26938
|
hash: hash3,
|
|
26445
26939
|
index: index2
|
|
26446
26940
|
});
|
|
26447
|
-
const
|
|
26448
|
-
return
|
|
26941
|
+
const format2 = client.chain?.formatters?.transaction?.format || formatTransaction;
|
|
26942
|
+
return format2(transaction, "getTransaction");
|
|
26449
26943
|
}
|
|
26450
26944
|
var init_getTransaction = __esm({
|
|
26451
26945
|
"../../node_modules/viem/_esm/actions/public/getTransaction.js"() {
|
|
@@ -26482,8 +26976,8 @@ async function getTransactionReceipt(client, { hash: hash3 }) {
|
|
|
26482
26976
|
}, { dedupe: true });
|
|
26483
26977
|
if (!receipt)
|
|
26484
26978
|
throw new TransactionReceiptNotFoundError({ hash: hash3 });
|
|
26485
|
-
const
|
|
26486
|
-
return
|
|
26979
|
+
const format2 = client.chain?.formatters?.transactionReceipt?.format || formatTransactionReceipt;
|
|
26980
|
+
return format2(receipt, "getTransactionReceipt");
|
|
26487
26981
|
}
|
|
26488
26982
|
var init_getTransactionReceipt = __esm({
|
|
26489
26983
|
"../../node_modules/viem/_esm/actions/public/getTransactionReceipt.js"() {
|
|
@@ -26496,7 +26990,9 @@ var init_getTransactionReceipt = __esm({
|
|
|
26496
26990
|
async function multicall(client, parameters) {
|
|
26497
26991
|
const { account, authorizationList, allowFailure = true, blockHash, blockNumber, blockOverrides, blockTag, requireCanonical, stateOverride } = parameters;
|
|
26498
26992
|
const contracts2 = parameters.contracts;
|
|
26499
|
-
const
|
|
26993
|
+
const batch = typeof client.batch?.multicall === "object" ? client.batch.multicall : {};
|
|
26994
|
+
const batchSize = parameters.batchSize ?? batch.batchSize ?? 1024;
|
|
26995
|
+
const deployless = parameters.deployless ?? batch.deployless ?? false;
|
|
26500
26996
|
const multicallAddress = (() => {
|
|
26501
26997
|
if (parameters.multicallAddress)
|
|
26502
26998
|
return parameters.multicallAddress;
|
|
@@ -26558,27 +27054,45 @@ async function multicall(client, parameters) {
|
|
|
26558
27054
|
];
|
|
26559
27055
|
}
|
|
26560
27056
|
}
|
|
26561
|
-
const
|
|
26562
|
-
|
|
26563
|
-
|
|
26564
|
-
|
|
26565
|
-
|
|
26566
|
-
|
|
26567
|
-
|
|
26568
|
-
|
|
26569
|
-
|
|
26570
|
-
|
|
26571
|
-
|
|
26572
|
-
|
|
26573
|
-
|
|
26574
|
-
|
|
27057
|
+
const batching = Boolean(client.batch?.multicall);
|
|
27058
|
+
const batches = batching ? chunkedCalls.flatMap((calls) => calls.map((call2) => [call2])) : chunkedCalls;
|
|
27059
|
+
const aggregate3Results = await Promise.allSettled(batches.map((calls) => {
|
|
27060
|
+
if (batching)
|
|
27061
|
+
return scheduleMulticall2(client, {
|
|
27062
|
+
account,
|
|
27063
|
+
authorizationList,
|
|
27064
|
+
batchSize,
|
|
27065
|
+
blockHash,
|
|
27066
|
+
blockNumber,
|
|
27067
|
+
blockOverrides,
|
|
27068
|
+
blockTag,
|
|
27069
|
+
call: calls[0],
|
|
27070
|
+
multicallAddress,
|
|
27071
|
+
requireCanonical,
|
|
27072
|
+
stateOverride
|
|
27073
|
+
}).then((result) => [result]);
|
|
27074
|
+
return getAction(client, readContract, "readContract")({
|
|
27075
|
+
...multicallAddress === null ? { code: multicall3Bytecode } : { address: multicallAddress },
|
|
27076
|
+
abi: multicall3Abi,
|
|
27077
|
+
account,
|
|
27078
|
+
args: [calls],
|
|
27079
|
+
authorizationList,
|
|
27080
|
+
blockHash,
|
|
27081
|
+
blockNumber,
|
|
27082
|
+
blockOverrides,
|
|
27083
|
+
blockTag,
|
|
27084
|
+
functionName: "aggregate3",
|
|
27085
|
+
requireCanonical,
|
|
27086
|
+
stateOverride
|
|
27087
|
+
});
|
|
27088
|
+
}));
|
|
26575
27089
|
const results = [];
|
|
26576
27090
|
for (let i = 0; i < aggregate3Results.length; i++) {
|
|
26577
27091
|
const result = aggregate3Results[i];
|
|
26578
27092
|
if (result.status === "rejected") {
|
|
26579
27093
|
if (!allowFailure)
|
|
26580
27094
|
throw result.reason;
|
|
26581
|
-
for (let j = 0; j <
|
|
27095
|
+
for (let j = 0; j < batches[i].length; j++) {
|
|
26582
27096
|
results.push({
|
|
26583
27097
|
status: "failure",
|
|
26584
27098
|
error: result.reason,
|
|
@@ -26590,7 +27104,7 @@ async function multicall(client, parameters) {
|
|
|
26590
27104
|
const aggregate3Result = result.value;
|
|
26591
27105
|
for (let j = 0; j < aggregate3Result.length; j++) {
|
|
26592
27106
|
const { returnData, success } = aggregate3Result[j];
|
|
26593
|
-
const { callData } =
|
|
27107
|
+
const { callData } = batches[i][j];
|
|
26594
27108
|
const { abi: abi2, address: address2, functionName, args } = contracts2[results.length];
|
|
26595
27109
|
try {
|
|
26596
27110
|
if (callData === "0x")
|
|
@@ -26622,6 +27136,29 @@ async function multicall(client, parameters) {
|
|
|
26622
27136
|
throw new BaseError2("multicall results mismatch");
|
|
26623
27137
|
return results;
|
|
26624
27138
|
}
|
|
27139
|
+
async function scheduleMulticall2(client, parameters) {
|
|
27140
|
+
const { batchSize, call: call2, multicallAddress, ...rest } = parameters;
|
|
27141
|
+
const { wait: wait2 = 0 } = typeof client.batch?.multicall === "object" ? client.batch.multicall : {};
|
|
27142
|
+
const { schedule } = createBatchScheduler({
|
|
27143
|
+
id: stringify(["multicall", client.uid, batchSize, multicallAddress, rest]),
|
|
27144
|
+
wait: wait2,
|
|
27145
|
+
shouldSplitBatch(calls) {
|
|
27146
|
+
if (batchSize === 0)
|
|
27147
|
+
return false;
|
|
27148
|
+
const size5 = calls.reduce((size6, { callData }) => size6 + (callData.length - 2) / 2, 0);
|
|
27149
|
+
return size5 > batchSize;
|
|
27150
|
+
},
|
|
27151
|
+
fn: (calls) => getAction(client, readContract, "readContract")({
|
|
27152
|
+
...multicallAddress === null ? { code: multicall3Bytecode } : { address: multicallAddress },
|
|
27153
|
+
...rest,
|
|
27154
|
+
abi: multicall3Abi,
|
|
27155
|
+
args: [calls],
|
|
27156
|
+
functionName: "aggregate3"
|
|
27157
|
+
})
|
|
27158
|
+
});
|
|
27159
|
+
const [result] = await schedule(call2);
|
|
27160
|
+
return result;
|
|
27161
|
+
}
|
|
26625
27162
|
var init_multicall = __esm({
|
|
26626
27163
|
"../../node_modules/viem/_esm/actions/public/multicall.js"() {
|
|
26627
27164
|
init_abis();
|
|
@@ -26634,6 +27171,8 @@ var init_multicall = __esm({
|
|
|
26634
27171
|
init_getChainContractAddress();
|
|
26635
27172
|
init_getContractError();
|
|
26636
27173
|
init_getAction();
|
|
27174
|
+
init_createBatchScheduler();
|
|
27175
|
+
init_stringify();
|
|
26637
27176
|
init_readContract();
|
|
26638
27177
|
}
|
|
26639
27178
|
});
|
|
@@ -26854,7 +27393,7 @@ var init_abiItem2 = __esm({
|
|
|
26854
27393
|
});
|
|
26855
27394
|
|
|
26856
27395
|
// ../../node_modules/ox/_esm/core/AbiItem.js
|
|
26857
|
-
function
|
|
27396
|
+
function from11(abiItem, options = {}) {
|
|
26858
27397
|
const { prepare = true } = options;
|
|
26859
27398
|
const item = (() => {
|
|
26860
27399
|
if (Array.isArray(abiItem))
|
|
@@ -27038,8 +27577,8 @@ function encode3(...parameters) {
|
|
|
27038
27577
|
const { bytecode, args } = options;
|
|
27039
27578
|
return concat2(bytecode, abiConstructor.inputs?.length && args?.length ? encode2(abiConstructor.inputs, args) : "0x");
|
|
27040
27579
|
}
|
|
27041
|
-
function
|
|
27042
|
-
return
|
|
27580
|
+
function from12(abiConstructor) {
|
|
27581
|
+
return from11(abiConstructor);
|
|
27043
27582
|
}
|
|
27044
27583
|
function fromAbi2(abi2) {
|
|
27045
27584
|
const item = abi2.find((item2) => item2.type === "constructor");
|
|
@@ -27055,7 +27594,38 @@ var init_AbiConstructor = __esm({
|
|
|
27055
27594
|
}
|
|
27056
27595
|
});
|
|
27057
27596
|
|
|
27597
|
+
// ../../node_modules/ox/_esm/core/AbiEvent.js
|
|
27598
|
+
function from13(abiEvent, options = {}) {
|
|
27599
|
+
return from11(abiEvent, options);
|
|
27600
|
+
}
|
|
27601
|
+
function getSelector2(abiItem) {
|
|
27602
|
+
return getSignatureHash(abiItem);
|
|
27603
|
+
}
|
|
27604
|
+
var init_AbiEvent = __esm({
|
|
27605
|
+
"../../node_modules/ox/_esm/core/AbiEvent.js"() {
|
|
27606
|
+
init_AbiItem();
|
|
27607
|
+
}
|
|
27608
|
+
});
|
|
27609
|
+
|
|
27058
27610
|
// ../../node_modules/ox/_esm/core/AbiFunction.js
|
|
27611
|
+
function decodeResult(...parameters) {
|
|
27612
|
+
const [abiFunction, data, options = {}] = (() => {
|
|
27613
|
+
if (Array.isArray(parameters[0])) {
|
|
27614
|
+
const [abi2, name, data2, options2] = parameters;
|
|
27615
|
+
return [fromAbi3(abi2, name), data2, options2];
|
|
27616
|
+
}
|
|
27617
|
+
return parameters;
|
|
27618
|
+
})();
|
|
27619
|
+
const values = decode(abiFunction.outputs, data, options);
|
|
27620
|
+
if (values && Object.keys(values).length === 0)
|
|
27621
|
+
return void 0;
|
|
27622
|
+
if (values && Object.keys(values).length === 1) {
|
|
27623
|
+
if (Array.isArray(values))
|
|
27624
|
+
return values[0];
|
|
27625
|
+
return Object.values(values)[0];
|
|
27626
|
+
}
|
|
27627
|
+
return values;
|
|
27628
|
+
}
|
|
27059
27629
|
function encodeData2(...parameters) {
|
|
27060
27630
|
const [abiFunction, args = []] = (() => {
|
|
27061
27631
|
if (Array.isArray(parameters[0])) {
|
|
@@ -27069,12 +27639,12 @@ function encodeData2(...parameters) {
|
|
|
27069
27639
|
const item = overloads ? fromAbi3([abiFunction, ...overloads], abiFunction.name, {
|
|
27070
27640
|
args
|
|
27071
27641
|
}) : abiFunction;
|
|
27072
|
-
const selector =
|
|
27642
|
+
const selector = getSelector3(item);
|
|
27073
27643
|
const data = args.length > 0 ? encode2(item.inputs, args) : void 0;
|
|
27074
27644
|
return data ? concat2(selector, data) : selector;
|
|
27075
27645
|
}
|
|
27076
|
-
function
|
|
27077
|
-
return
|
|
27646
|
+
function from14(abiFunction, options = {}) {
|
|
27647
|
+
return from11(abiFunction, options);
|
|
27078
27648
|
}
|
|
27079
27649
|
function fromAbi3(abi2, name, options) {
|
|
27080
27650
|
const item = fromAbi(abi2, name, options);
|
|
@@ -27082,7 +27652,7 @@ function fromAbi3(abi2, name, options) {
|
|
|
27082
27652
|
throw new NotFoundError({ name, type: "function" });
|
|
27083
27653
|
return item;
|
|
27084
27654
|
}
|
|
27085
|
-
function
|
|
27655
|
+
function getSelector3(abiItem) {
|
|
27086
27656
|
return getSelector(abiItem);
|
|
27087
27657
|
}
|
|
27088
27658
|
var init_AbiFunction = __esm({
|
|
@@ -27108,158 +27678,148 @@ async function simulateCalls(client, parameters) {
|
|
|
27108
27678
|
const account = parameters.account ? parseAccount(parameters.account) : void 0;
|
|
27109
27679
|
if (traceAssetChanges && !account)
|
|
27110
27680
|
throw new BaseError2("`account` is required when `traceAssetChanges` is true");
|
|
27111
|
-
const getBalanceData = account ? encode3(
|
|
27681
|
+
const getBalanceData = account ? encode3(from12("constructor(bytes, bytes)"), {
|
|
27112
27682
|
bytecode: deploylessCallViaBytecodeBytecode,
|
|
27113
27683
|
args: [
|
|
27114
27684
|
getBalanceCode,
|
|
27115
|
-
encodeData2(
|
|
27685
|
+
encodeData2(from14("function getBalance(address)"), [account.address])
|
|
27116
27686
|
]
|
|
27117
27687
|
}) : void 0;
|
|
27118
|
-
const
|
|
27119
|
-
|
|
27120
|
-
|
|
27121
|
-
|
|
27122
|
-
|
|
27123
|
-
|
|
27124
|
-
|
|
27125
|
-
|
|
27126
|
-
|
|
27127
|
-
|
|
27128
|
-
|
|
27129
|
-
|
|
27130
|
-
|
|
27688
|
+
const blockTag_ = blockTag ?? client.experimental_blockTag ?? "latest";
|
|
27689
|
+
let baseBlockNumber = blockNumber;
|
|
27690
|
+
if (traceAssetChanges && typeof baseBlockNumber !== "bigint" && blockTag_ !== "earliest" && blockTag_ !== "pending") {
|
|
27691
|
+
if (blockTag_ === "latest")
|
|
27692
|
+
baseBlockNumber = await getBlockNumber(client, { cacheTime: 0 });
|
|
27693
|
+
else {
|
|
27694
|
+
const block2 = await getBlock(client, { blockTag: blockTag_ });
|
|
27695
|
+
if (typeof block2.number !== "bigint")
|
|
27696
|
+
throw new BaseError2(`Block tag \`${blockTag_}\` did not resolve to a number.`);
|
|
27697
|
+
baseBlockNumber = block2.number;
|
|
27698
|
+
}
|
|
27699
|
+
}
|
|
27700
|
+
const block_ = typeof baseBlockNumber === "bigint" ? { blockNumber: baseBlockNumber } : { blockTag: blockTag_ };
|
|
27701
|
+
const discovery = traceAssetChanges ? await simulateBlocks(client, {
|
|
27702
|
+
...block_,
|
|
27131
27703
|
blocks: [
|
|
27132
|
-
...traceAssetChanges ? [
|
|
27133
|
-
// ETH pre balances
|
|
27134
|
-
{
|
|
27135
|
-
calls: [{ data: getBalanceData }],
|
|
27136
|
-
stateOverrides
|
|
27137
|
-
},
|
|
27138
|
-
// Asset pre balances
|
|
27139
|
-
{
|
|
27140
|
-
calls: assetAddresses.map((address2, i) => ({
|
|
27141
|
-
abi: [
|
|
27142
|
-
from12("function balanceOf(address) returns (uint256)")
|
|
27143
|
-
],
|
|
27144
|
-
functionName: "balanceOf",
|
|
27145
|
-
args: [account.address],
|
|
27146
|
-
to: address2,
|
|
27147
|
-
from: zeroAddress,
|
|
27148
|
-
nonce: i
|
|
27149
|
-
})),
|
|
27150
|
-
stateOverrides: [
|
|
27151
|
-
{
|
|
27152
|
-
address: zeroAddress,
|
|
27153
|
-
nonce: 0
|
|
27154
|
-
}
|
|
27155
|
-
]
|
|
27156
|
-
}
|
|
27157
|
-
] : [],
|
|
27158
27704
|
{
|
|
27159
|
-
calls:
|
|
27705
|
+
calls: calls.map((call2) => ({
|
|
27160
27706
|
...call2,
|
|
27161
|
-
from: account
|
|
27707
|
+
from: account.address
|
|
27162
27708
|
})),
|
|
27163
27709
|
stateOverrides
|
|
27164
|
-
}
|
|
27165
|
-
...traceAssetChanges ? [
|
|
27166
|
-
// ETH post balances
|
|
27167
|
-
{
|
|
27168
|
-
calls: [{ data: getBalanceData }]
|
|
27169
|
-
},
|
|
27170
|
-
// Asset post balances
|
|
27171
|
-
{
|
|
27172
|
-
calls: assetAddresses.map((address2, i) => ({
|
|
27173
|
-
abi: [
|
|
27174
|
-
from12("function balanceOf(address) returns (uint256)")
|
|
27175
|
-
],
|
|
27176
|
-
functionName: "balanceOf",
|
|
27177
|
-
args: [account.address],
|
|
27178
|
-
to: address2,
|
|
27179
|
-
from: zeroAddress,
|
|
27180
|
-
nonce: i
|
|
27181
|
-
})),
|
|
27182
|
-
stateOverrides: [
|
|
27183
|
-
{
|
|
27184
|
-
address: zeroAddress,
|
|
27185
|
-
nonce: 0
|
|
27186
|
-
}
|
|
27187
|
-
]
|
|
27188
|
-
},
|
|
27189
|
-
// Decimals
|
|
27190
|
-
{
|
|
27191
|
-
calls: assetAddresses.map((address2, i) => ({
|
|
27192
|
-
to: address2,
|
|
27193
|
-
abi: [
|
|
27194
|
-
from12("function decimals() returns (uint256)")
|
|
27195
|
-
],
|
|
27196
|
-
functionName: "decimals",
|
|
27197
|
-
from: zeroAddress,
|
|
27198
|
-
nonce: i
|
|
27199
|
-
})),
|
|
27200
|
-
stateOverrides: [
|
|
27201
|
-
{
|
|
27202
|
-
address: zeroAddress,
|
|
27203
|
-
nonce: 0
|
|
27204
|
-
}
|
|
27205
|
-
]
|
|
27206
|
-
},
|
|
27207
|
-
// Token URI
|
|
27208
|
-
{
|
|
27209
|
-
calls: assetAddresses.map((address2, i) => ({
|
|
27210
|
-
to: address2,
|
|
27211
|
-
abi: [
|
|
27212
|
-
from12("function tokenURI(uint256) returns (string)")
|
|
27213
|
-
],
|
|
27214
|
-
functionName: "tokenURI",
|
|
27215
|
-
args: [0n],
|
|
27216
|
-
from: zeroAddress,
|
|
27217
|
-
nonce: i
|
|
27218
|
-
})),
|
|
27219
|
-
stateOverrides: [
|
|
27220
|
-
{
|
|
27221
|
-
address: zeroAddress,
|
|
27222
|
-
nonce: 0
|
|
27223
|
-
}
|
|
27224
|
-
]
|
|
27225
|
-
},
|
|
27226
|
-
// Symbols
|
|
27227
|
-
{
|
|
27228
|
-
calls: assetAddresses.map((address2, i) => ({
|
|
27229
|
-
to: address2,
|
|
27230
|
-
abi: [from12("function symbol() returns (string)")],
|
|
27231
|
-
functionName: "symbol",
|
|
27232
|
-
from: zeroAddress,
|
|
27233
|
-
nonce: i
|
|
27234
|
-
})),
|
|
27235
|
-
stateOverrides: [
|
|
27236
|
-
{
|
|
27237
|
-
address: zeroAddress,
|
|
27238
|
-
nonce: 0
|
|
27239
|
-
}
|
|
27240
|
-
]
|
|
27241
|
-
}
|
|
27242
|
-
] : []
|
|
27710
|
+
}
|
|
27243
27711
|
],
|
|
27244
27712
|
traceTransfers,
|
|
27245
27713
|
validation
|
|
27246
|
-
});
|
|
27247
|
-
const
|
|
27248
|
-
|
|
27714
|
+
}) : void 0;
|
|
27715
|
+
const assetAddresses = discovery ? [
|
|
27716
|
+
.../* @__PURE__ */ new Set([
|
|
27717
|
+
...tokensFromLogs(discovery[0].calls.flatMap((call2) => call2.logs ?? []), account.address),
|
|
27718
|
+
// Included even for calls without data: contracts that mint on receiving
|
|
27719
|
+
// native value (WETH) emit `Deposit`, not a `Transfer` the logs would catch.
|
|
27720
|
+
// Candidates without code fall out at `isBalance`.
|
|
27721
|
+
...parameters.calls.map((call2) => call2.to?.toLowerCase())
|
|
27722
|
+
])
|
|
27723
|
+
].filter((address2) => Boolean(address2) && address2 !== ethAddress && address2 !== zeroAddress) : [];
|
|
27724
|
+
const staticCallAddress = getStaticCallAddress([
|
|
27725
|
+
...account ? [account.address] : [],
|
|
27726
|
+
...assetAddresses,
|
|
27727
|
+
...stateOverrides?.map(({ address: address2 }) => address2) ?? []
|
|
27728
|
+
]);
|
|
27729
|
+
const staticCallStateOverrides = [
|
|
27730
|
+
{ address: staticCallAddress, code: staticCallCode }
|
|
27731
|
+
];
|
|
27732
|
+
const [balanceCallsPre, blocks] = await Promise.all([
|
|
27733
|
+
traceAssetChanges ? Promise.all([
|
|
27734
|
+
readBalance(client, {
|
|
27735
|
+
account: account.address,
|
|
27736
|
+
...block_,
|
|
27737
|
+
data: getBalanceData,
|
|
27738
|
+
stateOverride: stateOverrides
|
|
27739
|
+
}),
|
|
27740
|
+
...assetAddresses.map((address2) => readBalance(client, {
|
|
27741
|
+
account: account.address,
|
|
27742
|
+
address: address2,
|
|
27743
|
+
...block_,
|
|
27744
|
+
data: encodeData2(balanceOfFunction, [
|
|
27745
|
+
account.address
|
|
27746
|
+
]),
|
|
27747
|
+
staticCallAddress,
|
|
27748
|
+
stateOverride: stateOverrides
|
|
27749
|
+
}))
|
|
27750
|
+
]) : [],
|
|
27751
|
+
simulateBlocks(client, {
|
|
27752
|
+
...block_,
|
|
27753
|
+
blocks: [
|
|
27754
|
+
{
|
|
27755
|
+
calls: [...calls, { to: zeroAddress }].map((call2) => ({
|
|
27756
|
+
...call2,
|
|
27757
|
+
from: account?.address
|
|
27758
|
+
})),
|
|
27759
|
+
stateOverrides
|
|
27760
|
+
},
|
|
27761
|
+
...traceAssetChanges ? [
|
|
27762
|
+
// ETH post balances
|
|
27763
|
+
{
|
|
27764
|
+
calls: [{ data: getBalanceData }]
|
|
27765
|
+
},
|
|
27766
|
+
// Asset post balances
|
|
27767
|
+
{
|
|
27768
|
+
calls: assetAddresses.map((address2) => ({
|
|
27769
|
+
to: staticCallAddress,
|
|
27770
|
+
data: encodeStaticCall(address2, encodeData2(balanceOfFunction, [
|
|
27771
|
+
account.address
|
|
27772
|
+
]))
|
|
27773
|
+
})),
|
|
27774
|
+
stateOverrides: staticCallStateOverrides
|
|
27775
|
+
},
|
|
27776
|
+
// Decimals
|
|
27777
|
+
{
|
|
27778
|
+
calls: assetAddresses.map((address2) => ({
|
|
27779
|
+
to: staticCallAddress,
|
|
27780
|
+
data: encodeStaticCall(address2, encodeData2(decimalsFunction))
|
|
27781
|
+
})),
|
|
27782
|
+
stateOverrides: staticCallStateOverrides
|
|
27783
|
+
},
|
|
27784
|
+
// Token URI
|
|
27785
|
+
{
|
|
27786
|
+
calls: assetAddresses.map((address2) => ({
|
|
27787
|
+
to: staticCallAddress,
|
|
27788
|
+
data: encodeStaticCall(address2, encodeData2(tokenUriFunction, [0n]))
|
|
27789
|
+
})),
|
|
27790
|
+
stateOverrides: staticCallStateOverrides
|
|
27791
|
+
},
|
|
27792
|
+
// Symbols
|
|
27793
|
+
{
|
|
27794
|
+
calls: assetAddresses.map((address2) => ({
|
|
27795
|
+
to: staticCallAddress,
|
|
27796
|
+
data: encodeStaticCall(address2, encodeData2(symbolFunction))
|
|
27797
|
+
})),
|
|
27798
|
+
stateOverrides: staticCallStateOverrides
|
|
27799
|
+
}
|
|
27800
|
+
] : []
|
|
27801
|
+
],
|
|
27802
|
+
traceTransfers,
|
|
27803
|
+
validation
|
|
27804
|
+
})
|
|
27805
|
+
]);
|
|
27806
|
+
const block_results = blocks[0];
|
|
27807
|
+
const [block_ethPost, block_assetsPost, block_decimals, block_tokenURI, block_symbols] = traceAssetChanges ? blocks.slice(1) : [];
|
|
27249
27808
|
const { calls: block_calls, ...block } = block_results;
|
|
27250
|
-
const results = block_calls.slice(0, -1)
|
|
27251
|
-
const
|
|
27252
|
-
const assetsPre = block_assetsPre?.calls ?? [];
|
|
27253
|
-
const balancesPre = [...ethPre, ...assetsPre].map((call2) => call2.status === "success" ? hexToBigInt(call2.data) : null);
|
|
27809
|
+
const results = block_calls.slice(0, -1);
|
|
27810
|
+
const balancesPre = balanceCallsPre.map((call2) => isBalance(call2) ? hexToBigInt(call2.data) : null);
|
|
27254
27811
|
const ethPost = block_ethPost?.calls ?? [];
|
|
27255
27812
|
const assetsPost = block_assetsPost?.calls ?? [];
|
|
27256
|
-
const
|
|
27257
|
-
const
|
|
27258
|
-
const
|
|
27259
|
-
const
|
|
27813
|
+
const balanceCallsPost = [...ethPost, ...assetsPost];
|
|
27814
|
+
const balancesPost = balanceCallsPost.map((call2) => isBalance(call2) ? hexToBigInt(call2.data) : null);
|
|
27815
|
+
const decimals = (block_decimals?.calls ?? []).map((call2) => decodeAssetResult(call2, decimalsFunction));
|
|
27816
|
+
const symbols = (block_symbols?.calls ?? []).map((call2) => decodeAssetResult(call2, symbolFunction));
|
|
27817
|
+
const tokenURI = (block_tokenURI?.calls ?? []).map((call2) => decodeAssetResult(call2, tokenUriFunction));
|
|
27260
27818
|
const changes = [];
|
|
27261
27819
|
for (const [i, balancePost] of balancesPost.entries()) {
|
|
27262
|
-
const
|
|
27820
|
+
const balancePre_ = balancesPre[i];
|
|
27821
|
+
const preCall = balanceCallsPre[i];
|
|
27822
|
+
const balancePre = typeof balancePre_ === "bigint" ? balancePre_ : i > 0 && preCall?.status === "success" && preCall.data === "0x" ? 0n : null;
|
|
27263
27823
|
if (typeof balancePost !== "bigint")
|
|
27264
27824
|
continue;
|
|
27265
27825
|
if (typeof balancePre !== "bigint")
|
|
@@ -27280,8 +27840,6 @@ async function simulateCalls(client, parameters) {
|
|
|
27280
27840
|
symbol: symbol_ ?? void 0
|
|
27281
27841
|
};
|
|
27282
27842
|
})();
|
|
27283
|
-
if (changes.some((change) => change.token.address === token.address))
|
|
27284
|
-
continue;
|
|
27285
27843
|
changes.push({
|
|
27286
27844
|
token,
|
|
27287
27845
|
value: {
|
|
@@ -27297,20 +27855,85 @@ async function simulateCalls(client, parameters) {
|
|
|
27297
27855
|
results
|
|
27298
27856
|
};
|
|
27299
27857
|
}
|
|
27300
|
-
|
|
27858
|
+
function encodeStaticCall(address2, data) {
|
|
27859
|
+
return encodeData2(staticCallFunction, [address2, data]);
|
|
27860
|
+
}
|
|
27861
|
+
function tokensFromLogs(logs, account) {
|
|
27862
|
+
const account_ = pad(account.toLowerCase(), { size: 32 });
|
|
27863
|
+
return logs.filter((log) => {
|
|
27864
|
+
if (log.topics[0]?.toLowerCase() !== transferEventSelector)
|
|
27865
|
+
return false;
|
|
27866
|
+
if (log.address.toLowerCase() === ethAddress)
|
|
27867
|
+
return false;
|
|
27868
|
+
return log.topics[1]?.toLowerCase() === account_ || log.topics[2]?.toLowerCase() === account_;
|
|
27869
|
+
}).map((log) => log.address.toLowerCase());
|
|
27870
|
+
}
|
|
27871
|
+
function isBalance(call2) {
|
|
27872
|
+
return call2.status === "success" && /^0x[\da-f]{64}$/i.test(call2.data);
|
|
27873
|
+
}
|
|
27874
|
+
function decodeAssetResult(call2, abiFunction) {
|
|
27875
|
+
if (call2.status === "failure" || call2.data === "0x")
|
|
27876
|
+
return null;
|
|
27877
|
+
try {
|
|
27878
|
+
return decodeResult(abiFunction, call2.data);
|
|
27879
|
+
} catch {
|
|
27880
|
+
return null;
|
|
27881
|
+
}
|
|
27882
|
+
}
|
|
27883
|
+
async function readBalance(client, parameters) {
|
|
27884
|
+
const { account, address: address2, blockNumber, blockTag, data, staticCallAddress, stateOverride } = parameters;
|
|
27885
|
+
try {
|
|
27886
|
+
const result = await call({ ...client, ccipRead: false }, {
|
|
27887
|
+
account: address2 ? zeroAddress : account,
|
|
27888
|
+
data: address2 ? encodeStaticCall(address2, data) : data,
|
|
27889
|
+
stateOverride: address2 && staticCallAddress ? [
|
|
27890
|
+
...stateOverride ?? [],
|
|
27891
|
+
{ address: staticCallAddress, code: staticCallCode }
|
|
27892
|
+
] : stateOverride,
|
|
27893
|
+
...address2 ? { to: staticCallAddress } : {},
|
|
27894
|
+
...typeof blockNumber === "bigint" ? { blockNumber } : { blockTag }
|
|
27895
|
+
});
|
|
27896
|
+
return { data: result.data ?? "0x", status: "success" };
|
|
27897
|
+
} catch (error) {
|
|
27898
|
+
if (!(error instanceof CallExecutionError) || !(error.cause instanceof ExecutionRevertedError))
|
|
27899
|
+
throw error;
|
|
27900
|
+
return { data: "0x", status: "failure" };
|
|
27901
|
+
}
|
|
27902
|
+
}
|
|
27903
|
+
function getStaticCallAddress(addresses) {
|
|
27904
|
+
const occupied = new Set(addresses.map((address2) => address2.toLowerCase()));
|
|
27905
|
+
let value = staticCallAddressBase;
|
|
27906
|
+
while (occupied.has(`0x${value.toString(16).padStart(40, "0")}`))
|
|
27907
|
+
value++;
|
|
27908
|
+
return `0x${value.toString(16).padStart(40, "0")}`;
|
|
27909
|
+
}
|
|
27910
|
+
var getBalanceCode, staticCallCode, staticCallAddressBase, transferEventSelector, balanceOfFunction, decimalsFunction, tokenUriFunction, symbolFunction, staticCallFunction;
|
|
27301
27911
|
var init_simulateCalls = __esm({
|
|
27302
27912
|
"../../node_modules/viem/_esm/actions/public/simulateCalls.js"() {
|
|
27303
27913
|
init_AbiConstructor();
|
|
27914
|
+
init_AbiEvent();
|
|
27304
27915
|
init_AbiFunction();
|
|
27305
27916
|
init_parseAccount();
|
|
27306
27917
|
init_address2();
|
|
27307
27918
|
init_contracts();
|
|
27308
27919
|
init_base();
|
|
27309
|
-
|
|
27310
|
-
|
|
27311
|
-
|
|
27920
|
+
init_contract();
|
|
27921
|
+
init_node();
|
|
27922
|
+
init_pad();
|
|
27923
|
+
init_fromHex();
|
|
27924
|
+
init_call();
|
|
27925
|
+
init_getBlock();
|
|
27926
|
+
init_getBlockNumber();
|
|
27312
27927
|
init_simulateBlocks();
|
|
27313
27928
|
getBalanceCode = "0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033";
|
|
27929
|
+
staticCallCode = "0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c8063fd00430c1461002d575b5f5ffd5b6100476004803603810190610042919061012b565b610049565b005b80825f375f5f825f865afa610060573d5f5f3e3d5ffd5b3d5f5f3e3d5ff35b5f5ffd5b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61009982610070565b9050919050565b6100a98161008f565b81146100b3575f5ffd5b50565b5f813590506100c4816100a0565b92915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f8401126100eb576100ea6100ca565b5b8235905067ffffffffffffffff811115610108576101076100ce565b5b602083019150836001820283011115610124576101236100d2565b5b9250929050565b5f5f5f6040848603121561014257610141610068565b5b5f61014f868287016100b6565b935050602084013567ffffffffffffffff8111156101705761016f61006c565b5b61017c868287016100d6565b9250925050925092509256fea2646970667358221220635ed99185cacf3f2acba6921f23687c969cec2bbaf5f9ad599f507e6e105e6964736f6c63430008230033";
|
|
27930
|
+
staticCallAddressBase = 0x00000000000000000000000000000000deadbeefn;
|
|
27931
|
+
transferEventSelector = getSelector2(from13("event Transfer(address indexed from, address indexed to, uint256 value)"));
|
|
27932
|
+
balanceOfFunction = from14("function balanceOf(address) returns (uint256)");
|
|
27933
|
+
decimalsFunction = from14("function decimals() returns (uint256)");
|
|
27934
|
+
tokenUriFunction = from14("function tokenURI(uint256) returns (string)");
|
|
27935
|
+
symbolFunction = from14("function symbol() returns (string)");
|
|
27936
|
+
staticCallFunction = from14("function query(address target, bytes data)");
|
|
27314
27937
|
}
|
|
27315
27938
|
});
|
|
27316
27939
|
|
|
@@ -27319,7 +27942,7 @@ var SignatureErc6492_exports = {};
|
|
|
27319
27942
|
__export(SignatureErc6492_exports, {
|
|
27320
27943
|
InvalidWrappedSignatureError: () => InvalidWrappedSignatureError2,
|
|
27321
27944
|
assert: () => assert7,
|
|
27322
|
-
from: () =>
|
|
27945
|
+
from: () => from15,
|
|
27323
27946
|
magicBytes: () => magicBytes2,
|
|
27324
27947
|
universalSignatureValidatorAbi: () => universalSignatureValidatorAbi,
|
|
27325
27948
|
universalSignatureValidatorBytecode: () => universalSignatureValidatorBytecode,
|
|
@@ -27331,19 +27954,19 @@ function assert7(wrapped) {
|
|
|
27331
27954
|
if (slice3(wrapped, -32) !== magicBytes2)
|
|
27332
27955
|
throw new InvalidWrappedSignatureError2(wrapped);
|
|
27333
27956
|
}
|
|
27334
|
-
function
|
|
27957
|
+
function from15(wrapped) {
|
|
27335
27958
|
if (typeof wrapped === "string")
|
|
27336
27959
|
return unwrap2(wrapped);
|
|
27337
27960
|
return wrapped;
|
|
27338
27961
|
}
|
|
27339
27962
|
function unwrap2(wrapped) {
|
|
27340
27963
|
assert7(wrapped);
|
|
27341
|
-
const [to, data, signature] = decode(
|
|
27964
|
+
const [to, data, signature] = decode(from6("address, bytes, bytes"), wrapped);
|
|
27342
27965
|
return { data, signature, to };
|
|
27343
27966
|
}
|
|
27344
27967
|
function wrap2(value) {
|
|
27345
27968
|
const { data, signature, to } = value;
|
|
27346
|
-
return concat2(encode2(
|
|
27969
|
+
return concat2(encode2(from6("address, bytes, bytes"), [
|
|
27347
27970
|
to,
|
|
27348
27971
|
data,
|
|
27349
27972
|
signature
|
|
@@ -27501,19 +28124,18 @@ async function verifyHash(client, parameters) {
|
|
|
27501
28124
|
}
|
|
27502
28125
|
}
|
|
27503
28126
|
async function verifyErc8010(client, parameters) {
|
|
27504
|
-
const { address: address2, blockNumber, blockTag, hash: hash3, multicallAddress } = parameters;
|
|
28127
|
+
const { address: address2, blockHash, blockNumber, blockTag, hash: hash3, multicallAddress, requireCanonical } = parameters;
|
|
27505
28128
|
const { authorization: authorization_ox, data: initData, signature, to } = SignatureErc8010_exports.unwrap(parameters.signature);
|
|
27506
28129
|
const code = await getCode(client, {
|
|
27507
28130
|
address: address2,
|
|
28131
|
+
blockHash,
|
|
27508
28132
|
blockNumber,
|
|
27509
|
-
blockTag
|
|
28133
|
+
blockTag,
|
|
28134
|
+
requireCanonical
|
|
27510
28135
|
});
|
|
27511
28136
|
if (code === concatHex(["0xef0100", authorization_ox.address]))
|
|
27512
28137
|
return await verifyErc1271(client, {
|
|
27513
|
-
|
|
27514
|
-
blockNumber,
|
|
27515
|
-
blockTag,
|
|
27516
|
-
hash: hash3,
|
|
28138
|
+
...parameters,
|
|
27517
28139
|
signature
|
|
27518
28140
|
});
|
|
27519
28141
|
const authorization = {
|
|
@@ -27534,9 +28156,11 @@ async function verifyErc8010(client, parameters) {
|
|
|
27534
28156
|
...multicallAddress ? { address: multicallAddress } : { code: multicall3Bytecode },
|
|
27535
28157
|
authorizationList: [authorization],
|
|
27536
28158
|
abi: multicall3Abi,
|
|
28159
|
+
blockHash,
|
|
27537
28160
|
blockNumber,
|
|
27538
28161
|
blockTag: "pending",
|
|
27539
28162
|
functionName: "aggregate3",
|
|
28163
|
+
requireCanonical,
|
|
27540
28164
|
args: [
|
|
27541
28165
|
[
|
|
27542
28166
|
...initData ? [
|
|
@@ -27602,14 +28226,16 @@ async function verifyErc6492(client, parameters) {
|
|
|
27602
28226
|
throw new VerificationError();
|
|
27603
28227
|
}
|
|
27604
28228
|
async function verifyErc1271(client, parameters) {
|
|
27605
|
-
const { address: address2, blockNumber, blockTag, hash: hash3, signature } = parameters;
|
|
28229
|
+
const { address: address2, blockHash, blockNumber, blockTag, hash: hash3, requireCanonical, signature } = parameters;
|
|
27606
28230
|
const result = await getAction(client, readContract, "readContract")({
|
|
27607
28231
|
address: address2,
|
|
27608
28232
|
abi: erc1271Abi,
|
|
27609
28233
|
args: [hash3, signature],
|
|
28234
|
+
blockHash,
|
|
27610
28235
|
blockNumber,
|
|
27611
28236
|
blockTag,
|
|
27612
|
-
functionName: "isValidSignature"
|
|
28237
|
+
functionName: "isValidSignature",
|
|
28238
|
+
requireCanonical
|
|
27613
28239
|
}).catch((error) => {
|
|
27614
28240
|
if (error instanceof ContractFunctionExecutionError)
|
|
27615
28241
|
throw new VerificationError();
|
|
@@ -27793,7 +28419,7 @@ var init_watchBlockNumber = __esm({
|
|
|
27793
28419
|
// ../../node_modules/viem/_esm/actions/public/waitForTransactionReceipt.js
|
|
27794
28420
|
async function waitForTransactionReceipt(client, parameters) {
|
|
27795
28421
|
const {
|
|
27796
|
-
checkReplacement = true,
|
|
28422
|
+
checkReplacement = client.chain?.supportsTransactionReplacementDetection ?? true,
|
|
27797
28423
|
confirmations = 1,
|
|
27798
28424
|
hash: hash3,
|
|
27799
28425
|
onReplaced,
|
|
@@ -27886,7 +28512,7 @@ async function waitForTransactionReceipt(client, parameters) {
|
|
|
27886
28512
|
shouldRetry: ({ error }) => error instanceof BlockNotFoundError
|
|
27887
28513
|
});
|
|
27888
28514
|
retrying = false;
|
|
27889
|
-
const replacementTransaction = block.transactions.find(({ from:
|
|
28515
|
+
const replacementTransaction = block.transactions.find(({ from: from16, nonce }) => from16 === replacedTransaction.from && nonce === replacedTransaction.nonce);
|
|
27890
28516
|
if (!replacementTransaction)
|
|
27891
28517
|
return;
|
|
27892
28518
|
receipt = await getAction(client, getTransactionReceipt, "getTransactionReceipt")({
|
|
@@ -27937,6 +28563,68 @@ var init_waitForTransactionReceipt = __esm({
|
|
|
27937
28563
|
}
|
|
27938
28564
|
});
|
|
27939
28565
|
|
|
28566
|
+
// ../../node_modules/viem/_esm/actions/public/watchBlockHeaders.js
|
|
28567
|
+
function watchBlockHeaders(client, { onBlockHeader, onError }) {
|
|
28568
|
+
let prevBlockHeader;
|
|
28569
|
+
const observerId = stringify(["watchBlockHeaders", client.uid]);
|
|
28570
|
+
return observe(observerId, { onBlockHeader, onError }, (emit) => {
|
|
28571
|
+
let active = true;
|
|
28572
|
+
let subscribed = false;
|
|
28573
|
+
let unsubscribe = () => active = false;
|
|
28574
|
+
(async () => {
|
|
28575
|
+
try {
|
|
28576
|
+
const transport = (() => {
|
|
28577
|
+
if (client.transport.type === "fallback") {
|
|
28578
|
+
const transport2 = client.transport.transports.find((transport3) => transport3.config.type === "webSocket" || transport3.config.type === "ipc");
|
|
28579
|
+
if (!transport2)
|
|
28580
|
+
return client.transport;
|
|
28581
|
+
return transport2.value;
|
|
28582
|
+
}
|
|
28583
|
+
return client.transport;
|
|
28584
|
+
})();
|
|
28585
|
+
const { unsubscribe: unsubscribe_ } = await transport.subscribe({
|
|
28586
|
+
params: ["newHeads"],
|
|
28587
|
+
onData(data) {
|
|
28588
|
+
if (!active)
|
|
28589
|
+
return;
|
|
28590
|
+
const blockHeader = (client.chain?.formatters?.block?.format || formatBlock)(data.result, "watchBlockHeaders");
|
|
28591
|
+
for (const field of blockFields)
|
|
28592
|
+
delete blockHeader[field];
|
|
28593
|
+
emit.onBlockHeader(blockHeader, prevBlockHeader);
|
|
28594
|
+
prevBlockHeader = blockHeader;
|
|
28595
|
+
},
|
|
28596
|
+
onError(error) {
|
|
28597
|
+
if (subscribed)
|
|
28598
|
+
emit.onError?.(error);
|
|
28599
|
+
}
|
|
28600
|
+
});
|
|
28601
|
+
subscribed = true;
|
|
28602
|
+
unsubscribe = unsubscribe_;
|
|
28603
|
+
if (!active)
|
|
28604
|
+
unsubscribe();
|
|
28605
|
+
} catch (err) {
|
|
28606
|
+
emit.onError?.(err);
|
|
28607
|
+
}
|
|
28608
|
+
})();
|
|
28609
|
+
return () => unsubscribe();
|
|
28610
|
+
});
|
|
28611
|
+
}
|
|
28612
|
+
var blockFields;
|
|
28613
|
+
var init_watchBlockHeaders = __esm({
|
|
28614
|
+
"../../node_modules/viem/_esm/actions/public/watchBlockHeaders.js"() {
|
|
28615
|
+
init_block2();
|
|
28616
|
+
init_observe();
|
|
28617
|
+
init_stringify();
|
|
28618
|
+
blockFields = [
|
|
28619
|
+
"size",
|
|
28620
|
+
"totalDifficulty",
|
|
28621
|
+
"transactions",
|
|
28622
|
+
"uncles",
|
|
28623
|
+
"withdrawals"
|
|
28624
|
+
];
|
|
28625
|
+
}
|
|
28626
|
+
});
|
|
28627
|
+
|
|
27940
28628
|
// ../../node_modules/viem/_esm/actions/public/watchBlocks.js
|
|
27941
28629
|
function watchBlocks(client, { blockTag = client.experimental_blockTag ?? "latest", emitMissed = false, emitOnBegin = false, onBlock, onError, includeTransactions: includeTransactions_, poll: poll_, pollingInterval = client.pollingInterval }) {
|
|
27942
28630
|
const enablePolling = (() => {
|
|
@@ -28334,6 +29022,16 @@ var init_watchPendingTransactions = __esm({
|
|
|
28334
29022
|
});
|
|
28335
29023
|
|
|
28336
29024
|
// ../../node_modules/viem/_esm/utils/siwe/parseSiweMessage.js
|
|
29025
|
+
function isValidSiweDateTime(value) {
|
|
29026
|
+
if (!siweDateTimeRegex.test(value))
|
|
29027
|
+
return false;
|
|
29028
|
+
return !Number.isNaN(new Date(value).getTime());
|
|
29029
|
+
}
|
|
29030
|
+
function parseSiweDateTime(value) {
|
|
29031
|
+
if (!isValidSiweDateTime(value))
|
|
29032
|
+
return new Date(Number.NaN);
|
|
29033
|
+
return new Date(value);
|
|
29034
|
+
}
|
|
28337
29035
|
function parseSiweMessage(message) {
|
|
28338
29036
|
const { scheme, statement, ...prefix } = message.match(prefixRegex)?.groups ?? {};
|
|
28339
29037
|
const { chainId, expirationTime, issuedAt, notBefore, requestId, ...suffix } = message.match(suffixRegex)?.groups ?? {};
|
|
@@ -28342,18 +29040,19 @@ function parseSiweMessage(message) {
|
|
|
28342
29040
|
...prefix,
|
|
28343
29041
|
...suffix,
|
|
28344
29042
|
...chainId ? { chainId: Number(chainId) } : {},
|
|
28345
|
-
...expirationTime ? { expirationTime:
|
|
28346
|
-
...issuedAt ? { issuedAt:
|
|
28347
|
-
...notBefore ? { notBefore:
|
|
29043
|
+
...expirationTime ? { expirationTime: parseSiweDateTime(expirationTime) } : {},
|
|
29044
|
+
...issuedAt ? { issuedAt: parseSiweDateTime(issuedAt) } : {},
|
|
29045
|
+
...notBefore ? { notBefore: parseSiweDateTime(notBefore) } : {},
|
|
28348
29046
|
...requestId ? { requestId } : {},
|
|
28349
29047
|
...resources ? { resources } : {},
|
|
28350
29048
|
...scheme ? { scheme } : {},
|
|
28351
29049
|
...statement ? { statement } : {}
|
|
28352
29050
|
};
|
|
28353
29051
|
}
|
|
28354
|
-
var prefixRegex, suffixRegex;
|
|
29052
|
+
var siweDateTimeRegex, prefixRegex, suffixRegex;
|
|
28355
29053
|
var init_parseSiweMessage = __esm({
|
|
28356
29054
|
"../../node_modules/viem/_esm/utils/siwe/parseSiweMessage.js"() {
|
|
29055
|
+
siweDateTimeRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;
|
|
28357
29056
|
prefixRegex = /^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/;
|
|
28358
29057
|
suffixRegex = /(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;
|
|
28359
29058
|
}
|
|
@@ -28368,10 +29067,20 @@ function validateSiweMessage(parameters) {
|
|
|
28368
29067
|
return false;
|
|
28369
29068
|
if (scheme && message.scheme !== scheme)
|
|
28370
29069
|
return false;
|
|
28371
|
-
if (
|
|
28372
|
-
return false;
|
|
28373
|
-
if (message.notBefore && time < message.notBefore)
|
|
29070
|
+
if (Number.isNaN(time.getTime()))
|
|
28374
29071
|
return false;
|
|
29072
|
+
if (message.expirationTime) {
|
|
29073
|
+
if (Number.isNaN(message.expirationTime.getTime()))
|
|
29074
|
+
return false;
|
|
29075
|
+
if (time >= message.expirationTime)
|
|
29076
|
+
return false;
|
|
29077
|
+
}
|
|
29078
|
+
if (message.notBefore) {
|
|
29079
|
+
if (Number.isNaN(message.notBefore.getTime()))
|
|
29080
|
+
return false;
|
|
29081
|
+
if (time < message.notBefore)
|
|
29082
|
+
return false;
|
|
29083
|
+
}
|
|
28375
29084
|
try {
|
|
28376
29085
|
if (!message.address)
|
|
28377
29086
|
return false;
|
|
@@ -28424,14 +29133,197 @@ var init_verifySiweMessage = __esm({
|
|
|
28424
29133
|
}
|
|
28425
29134
|
});
|
|
28426
29135
|
|
|
29136
|
+
// ../../node_modules/viem/_esm/actions/token/internal.js
|
|
29137
|
+
function toAmount(amount, decimals) {
|
|
29138
|
+
return { amount, decimals, formatted: formatUnits(amount, decimals) };
|
|
29139
|
+
}
|
|
29140
|
+
function toBaseUnits(amount, decimals) {
|
|
29141
|
+
if (typeof amount === "bigint")
|
|
29142
|
+
return amount;
|
|
29143
|
+
const resolved = amount.decimals ?? decimals;
|
|
29144
|
+
return parseUnits(amount.formatted, requireTokenDecimals(resolved));
|
|
29145
|
+
}
|
|
29146
|
+
function requireTokenDecimals(decimals) {
|
|
29147
|
+
if (decimals === void 0)
|
|
29148
|
+
throw new Error("Token decimals are required. Pass `amount.decimals` or select a declared token.");
|
|
29149
|
+
return decimals;
|
|
29150
|
+
}
|
|
29151
|
+
function resolveAmountDecimals(amount, decimals) {
|
|
29152
|
+
if (typeof amount === "bigint")
|
|
29153
|
+
return decimals;
|
|
29154
|
+
return amount.decimals ?? decimals;
|
|
29155
|
+
}
|
|
29156
|
+
function resolveToken(client, parameters) {
|
|
29157
|
+
const { decimals, token } = parameters;
|
|
29158
|
+
const declared = findDeclaredToken(client, token);
|
|
29159
|
+
if (declared)
|
|
29160
|
+
return {
|
|
29161
|
+
address: declared.address,
|
|
29162
|
+
decimals: decimals ?? declared.decimals
|
|
29163
|
+
};
|
|
29164
|
+
if (isAddress(token, { strict: false }))
|
|
29165
|
+
return {
|
|
29166
|
+
address: token,
|
|
29167
|
+
decimals: decimals ?? inferDecimals(client, token)
|
|
29168
|
+
};
|
|
29169
|
+
throw new Error(`Token "${token}" is not a declared ERC-20 token on the client's \`tokens\` array (with an address for the client's chain), and is not a valid address.`);
|
|
29170
|
+
}
|
|
29171
|
+
function findDeclaredToken(client, token) {
|
|
29172
|
+
const tokens = client.tokens;
|
|
29173
|
+
const chainId = client.chain?.id;
|
|
29174
|
+
if (!tokens || chainId === void 0)
|
|
29175
|
+
return void 0;
|
|
29176
|
+
const bySymbol = findTokenBySymbol(tokens, token);
|
|
29177
|
+
if (bySymbol)
|
|
29178
|
+
return resolveTokenForChain(bySymbol, chainId);
|
|
29179
|
+
if (isAddress(token, { strict: false }))
|
|
29180
|
+
for (const token_ of tokens) {
|
|
29181
|
+
const resolved = resolveTokenForChain(token_, chainId);
|
|
29182
|
+
if (resolved && isAddressEqual(resolved.address, token))
|
|
29183
|
+
return resolved;
|
|
29184
|
+
}
|
|
29185
|
+
return void 0;
|
|
29186
|
+
}
|
|
29187
|
+
function resolveTokenForChain(token, chainId) {
|
|
29188
|
+
const address2 = token.addresses[chainId];
|
|
29189
|
+
if (!address2)
|
|
29190
|
+
return void 0;
|
|
29191
|
+
return {
|
|
29192
|
+
address: address2,
|
|
29193
|
+
currency: token.currency,
|
|
29194
|
+
decimals: token.decimals,
|
|
29195
|
+
name: token.name,
|
|
29196
|
+
popular: token.popular,
|
|
29197
|
+
symbol: token.symbol
|
|
29198
|
+
};
|
|
29199
|
+
}
|
|
29200
|
+
function findTokenBySymbol(tokens, symbol) {
|
|
29201
|
+
const lowerSymbol = symbol.toLowerCase();
|
|
29202
|
+
for (const token of tokens) {
|
|
29203
|
+
if (token.symbol?.toLowerCase() === lowerSymbol)
|
|
29204
|
+
return token;
|
|
29205
|
+
}
|
|
29206
|
+
return void 0;
|
|
29207
|
+
}
|
|
29208
|
+
function inferDecimals(client, address2) {
|
|
29209
|
+
const tokens = client.tokens;
|
|
29210
|
+
const chainId = client.chain?.id;
|
|
29211
|
+
if (tokens && chainId !== void 0)
|
|
29212
|
+
for (const token of tokens) {
|
|
29213
|
+
const resolved = resolveTokenForChain(token, chainId);
|
|
29214
|
+
if (resolved && isAddressEqual(resolved.address, address2))
|
|
29215
|
+
return resolved.decimals;
|
|
29216
|
+
}
|
|
29217
|
+
return void 0;
|
|
29218
|
+
}
|
|
29219
|
+
async function resolveTokenWithDecimals(client, parameters) {
|
|
29220
|
+
const { address: address2, decimals } = resolveToken(client, parameters);
|
|
29221
|
+
if (decimals !== void 0)
|
|
29222
|
+
return { address: address2, decimals };
|
|
29223
|
+
return {
|
|
29224
|
+
address: address2,
|
|
29225
|
+
decimals: await readContract(client, {
|
|
29226
|
+
abi: erc20Abi,
|
|
29227
|
+
address: address2,
|
|
29228
|
+
functionName: "decimals"
|
|
29229
|
+
})
|
|
29230
|
+
};
|
|
29231
|
+
}
|
|
29232
|
+
function pickWriteParameters(parameters) {
|
|
29233
|
+
const { account, chain: chain2, gas, maxFeePerGas, maxPriorityFeePerGas, nonce } = parameters;
|
|
29234
|
+
return { account, chain: chain2, gas, maxFeePerGas, maxPriorityFeePerGas, nonce };
|
|
29235
|
+
}
|
|
29236
|
+
function defineCall(call2) {
|
|
29237
|
+
return {
|
|
29238
|
+
...call2,
|
|
29239
|
+
data: encodeFunctionData(call2),
|
|
29240
|
+
to: call2.address
|
|
29241
|
+
};
|
|
29242
|
+
}
|
|
29243
|
+
var init_internal = __esm({
|
|
29244
|
+
"../../node_modules/viem/_esm/actions/token/internal.js"() {
|
|
29245
|
+
init_abis();
|
|
29246
|
+
init_isAddress();
|
|
29247
|
+
init_isAddressEqual();
|
|
29248
|
+
init_utils8();
|
|
29249
|
+
init_formatUnits();
|
|
29250
|
+
init_parseUnits();
|
|
29251
|
+
init_readContract();
|
|
29252
|
+
}
|
|
29253
|
+
});
|
|
29254
|
+
|
|
29255
|
+
// ../../node_modules/viem/_esm/actions/token/approve.js
|
|
29256
|
+
async function approve(client, parameters) {
|
|
29257
|
+
return approve.inner(writeContract, client, parameters);
|
|
29258
|
+
}
|
|
29259
|
+
function getCall(client, parameters) {
|
|
29260
|
+
const { amount, spender, token } = parameters;
|
|
29261
|
+
const { address: address2, decimals } = resolveToken(client, { token });
|
|
29262
|
+
return {
|
|
29263
|
+
abi: erc20Abi,
|
|
29264
|
+
address: address2,
|
|
29265
|
+
args: [spender, toBaseUnits(amount, decimals)],
|
|
29266
|
+
functionName: "approve"
|
|
29267
|
+
};
|
|
29268
|
+
}
|
|
29269
|
+
var init_approve = __esm({
|
|
29270
|
+
"../../node_modules/viem/_esm/actions/token/approve.js"() {
|
|
29271
|
+
init_abis();
|
|
29272
|
+
init_parseEventLogs();
|
|
29273
|
+
init_estimateContractGas();
|
|
29274
|
+
init_simulateContract();
|
|
29275
|
+
init_writeContract();
|
|
29276
|
+
init_internal();
|
|
29277
|
+
(function(approve2) {
|
|
29278
|
+
async function inner(action, client, parameters) {
|
|
29279
|
+
return await action(client, {
|
|
29280
|
+
...parameters,
|
|
29281
|
+
...approve2.call(client, parameters)
|
|
29282
|
+
});
|
|
29283
|
+
}
|
|
29284
|
+
approve2.inner = inner;
|
|
29285
|
+
function call2(client, parameters) {
|
|
29286
|
+
return defineCall(getCall(client, parameters));
|
|
29287
|
+
}
|
|
29288
|
+
approve2.call = call2;
|
|
29289
|
+
async function estimateGas2(client, parameters) {
|
|
29290
|
+
return estimateContractGas(client, {
|
|
29291
|
+
...pickWriteParameters(parameters),
|
|
29292
|
+
...approve2.call(client, parameters)
|
|
29293
|
+
});
|
|
29294
|
+
}
|
|
29295
|
+
approve2.estimateGas = estimateGas2;
|
|
29296
|
+
async function simulate(client, parameters) {
|
|
29297
|
+
return simulateContract(client, {
|
|
29298
|
+
...pickWriteParameters(parameters),
|
|
29299
|
+
...approve2.call(client, parameters)
|
|
29300
|
+
});
|
|
29301
|
+
}
|
|
29302
|
+
approve2.simulate = simulate;
|
|
29303
|
+
function extractEvent(logs) {
|
|
29304
|
+
const [log] = parseEventLogs({
|
|
29305
|
+
abi: erc20Abi,
|
|
29306
|
+
logs,
|
|
29307
|
+
eventName: "Approval",
|
|
29308
|
+
strict: true
|
|
29309
|
+
});
|
|
29310
|
+
if (!log)
|
|
29311
|
+
throw new Error("`Approval` event not found.");
|
|
29312
|
+
return log;
|
|
29313
|
+
}
|
|
29314
|
+
approve2.extractEvent = extractEvent;
|
|
29315
|
+
})(approve || (approve = {}));
|
|
29316
|
+
}
|
|
29317
|
+
});
|
|
29318
|
+
|
|
28427
29319
|
// ../../node_modules/viem/_esm/actions/wallet/sendRawTransactionSync.js
|
|
28428
29320
|
async function sendRawTransactionSync(client, { serializedTransaction, throwOnReceiptRevert, timeout }) {
|
|
28429
29321
|
const receipt = await client.request({
|
|
28430
29322
|
method: "eth_sendRawTransactionSync",
|
|
28431
29323
|
params: timeout ? [serializedTransaction, timeout] : [serializedTransaction]
|
|
28432
29324
|
}, { retryCount: 0 });
|
|
28433
|
-
const
|
|
28434
|
-
const formatted =
|
|
29325
|
+
const format2 = client.chain?.formatters?.transactionReceipt?.format || formatTransactionReceipt;
|
|
29326
|
+
const formatted = format2(receipt);
|
|
28435
29327
|
if (formatted.status === "reverted" && throwOnReceiptRevert)
|
|
28436
29328
|
throw new TransactionReceiptRevertedError({ receipt: formatted });
|
|
28437
29329
|
return formatted;
|
|
@@ -28443,6 +29335,502 @@ var init_sendRawTransactionSync = __esm({
|
|
|
28443
29335
|
}
|
|
28444
29336
|
});
|
|
28445
29337
|
|
|
29338
|
+
// ../../node_modules/viem/_esm/actions/wallet/sendTransactionSync.js
|
|
29339
|
+
async function sendTransactionSync(client, parameters) {
|
|
29340
|
+
const { account: account_ = client.account, assertChainId = true, chain: chain2 = client.chain, accessList, authorizationList, blobs, data, dataSuffix = typeof client.dataSuffix === "string" ? client.dataSuffix : client.dataSuffix?.value, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, pollingInterval, throwOnReceiptRevert, type, value, ...rest } = parameters;
|
|
29341
|
+
const timeout = parameters.timeout ?? Math.max((chain2?.blockTime ?? 0) * 3, 5e3);
|
|
29342
|
+
if (typeof account_ === "undefined")
|
|
29343
|
+
throw new AccountNotFoundError({
|
|
29344
|
+
docsPath: "/docs/actions/wallet/sendTransactionSync"
|
|
29345
|
+
});
|
|
29346
|
+
const account = account_ ? parseAccount(account_) : null;
|
|
29347
|
+
let nonceManagerParameters;
|
|
29348
|
+
try {
|
|
29349
|
+
assertRequest(parameters);
|
|
29350
|
+
const to = await (async () => {
|
|
29351
|
+
if (parameters.to)
|
|
29352
|
+
return parameters.to;
|
|
29353
|
+
if (parameters.to === null)
|
|
29354
|
+
return void 0;
|
|
29355
|
+
if (authorizationList && authorizationList.length > 0)
|
|
29356
|
+
return await recoverAuthorizationAddress({
|
|
29357
|
+
authorization: authorizationList[0]
|
|
29358
|
+
}).catch(() => {
|
|
29359
|
+
throw new BaseError2("`to` is required. Could not infer from `authorizationList`.");
|
|
29360
|
+
});
|
|
29361
|
+
return void 0;
|
|
29362
|
+
})();
|
|
29363
|
+
if (account?.type === "json-rpc" || account === null) {
|
|
29364
|
+
let chainId;
|
|
29365
|
+
if (chain2 !== null) {
|
|
29366
|
+
chainId = await getAction(client, getChainId, "getChainId")({});
|
|
29367
|
+
if (assertChainId)
|
|
29368
|
+
assertCurrentChain({
|
|
29369
|
+
currentChainId: chainId,
|
|
29370
|
+
chain: chain2
|
|
29371
|
+
});
|
|
29372
|
+
}
|
|
29373
|
+
const chainFormat = client.chain?.formatters?.transactionRequest?.format;
|
|
29374
|
+
const format2 = chainFormat || formatTransactionRequest;
|
|
29375
|
+
const request = format2({
|
|
29376
|
+
// Pick out extra data that might exist on the chain's transaction request type.
|
|
29377
|
+
...extract(rest, { format: chainFormat }),
|
|
29378
|
+
accessList,
|
|
29379
|
+
account,
|
|
29380
|
+
authorizationList,
|
|
29381
|
+
blobs,
|
|
29382
|
+
chainId,
|
|
29383
|
+
data: dataSuffix ? concat([data ?? "0x", dataSuffix]) : data,
|
|
29384
|
+
gas,
|
|
29385
|
+
gasPrice,
|
|
29386
|
+
maxFeePerBlobGas,
|
|
29387
|
+
maxFeePerGas,
|
|
29388
|
+
maxPriorityFeePerGas,
|
|
29389
|
+
nonce,
|
|
29390
|
+
to,
|
|
29391
|
+
type,
|
|
29392
|
+
value
|
|
29393
|
+
}, "sendTransaction");
|
|
29394
|
+
const isWalletNamespaceSupported = supportsWalletNamespace2.get(client.uid);
|
|
29395
|
+
const method = isWalletNamespaceSupported ? "wallet_sendTransaction" : "eth_sendTransaction";
|
|
29396
|
+
const hash3 = await (async () => {
|
|
29397
|
+
try {
|
|
29398
|
+
return await client.request({
|
|
29399
|
+
method,
|
|
29400
|
+
params: [request]
|
|
29401
|
+
}, { retryCount: 0 });
|
|
29402
|
+
} catch (e6) {
|
|
29403
|
+
if (isWalletNamespaceSupported === false)
|
|
29404
|
+
throw e6;
|
|
29405
|
+
const error = e6;
|
|
29406
|
+
if (error.name === "InvalidInputRpcError" || error.name === "InvalidParamsRpcError" || error.name === "MethodNotFoundRpcError" || error.name === "MethodNotSupportedRpcError") {
|
|
29407
|
+
return await client.request({
|
|
29408
|
+
method: "wallet_sendTransaction",
|
|
29409
|
+
params: [request]
|
|
29410
|
+
}, { retryCount: 0 }).then((hash4) => {
|
|
29411
|
+
supportsWalletNamespace2.set(client.uid, true);
|
|
29412
|
+
return hash4;
|
|
29413
|
+
}).catch((e7) => {
|
|
29414
|
+
const walletNamespaceError = e7;
|
|
29415
|
+
if (walletNamespaceError.name === "MethodNotFoundRpcError" || walletNamespaceError.name === "MethodNotSupportedRpcError") {
|
|
29416
|
+
supportsWalletNamespace2.set(client.uid, false);
|
|
29417
|
+
throw error;
|
|
29418
|
+
}
|
|
29419
|
+
throw walletNamespaceError;
|
|
29420
|
+
});
|
|
29421
|
+
}
|
|
29422
|
+
throw error;
|
|
29423
|
+
}
|
|
29424
|
+
})();
|
|
29425
|
+
const receipt = await getAction(client, waitForTransactionReceipt, "waitForTransactionReceipt")({
|
|
29426
|
+
checkReplacement: false,
|
|
29427
|
+
hash: hash3,
|
|
29428
|
+
pollingInterval,
|
|
29429
|
+
timeout
|
|
29430
|
+
});
|
|
29431
|
+
if (throwOnReceiptRevert && receipt.status === "reverted")
|
|
29432
|
+
throw new TransactionReceiptRevertedError({ receipt });
|
|
29433
|
+
return receipt;
|
|
29434
|
+
}
|
|
29435
|
+
if (account?.type === "local") {
|
|
29436
|
+
const nonceManager = (() => {
|
|
29437
|
+
if (!account.nonceManager || typeof nonce !== "undefined")
|
|
29438
|
+
return account.nonceManager;
|
|
29439
|
+
const nonceManager2 = account.nonceManager;
|
|
29440
|
+
return {
|
|
29441
|
+
consume(parameters2) {
|
|
29442
|
+
nonceManagerParameters = {
|
|
29443
|
+
address: parameters2.address,
|
|
29444
|
+
chainId: parameters2.chainId
|
|
29445
|
+
};
|
|
29446
|
+
return nonceManager2.consume(parameters2);
|
|
29447
|
+
},
|
|
29448
|
+
get(parameters2) {
|
|
29449
|
+
return nonceManager2.get(parameters2);
|
|
29450
|
+
},
|
|
29451
|
+
increment(parameters2) {
|
|
29452
|
+
return nonceManager2.increment(parameters2);
|
|
29453
|
+
},
|
|
29454
|
+
reset(parameters2) {
|
|
29455
|
+
return nonceManager2.reset(parameters2);
|
|
29456
|
+
}
|
|
29457
|
+
};
|
|
29458
|
+
})();
|
|
29459
|
+
const request = await getAction(client, prepareTransactionRequest, "prepareTransactionRequest")({
|
|
29460
|
+
account,
|
|
29461
|
+
accessList,
|
|
29462
|
+
authorizationList,
|
|
29463
|
+
blobs,
|
|
29464
|
+
chain: chain2,
|
|
29465
|
+
data: dataSuffix ? concat([data ?? "0x", dataSuffix]) : data,
|
|
29466
|
+
gas,
|
|
29467
|
+
gasPrice,
|
|
29468
|
+
maxFeePerBlobGas,
|
|
29469
|
+
maxFeePerGas,
|
|
29470
|
+
maxPriorityFeePerGas,
|
|
29471
|
+
nonce,
|
|
29472
|
+
nonceManager,
|
|
29473
|
+
parameters: [...defaultParameters, "sidecars"],
|
|
29474
|
+
type,
|
|
29475
|
+
value,
|
|
29476
|
+
...rest,
|
|
29477
|
+
to
|
|
29478
|
+
});
|
|
29479
|
+
const serializer = chain2?.serializers?.transaction;
|
|
29480
|
+
const serializedTransaction = await account.signTransaction(request, {
|
|
29481
|
+
serializer
|
|
29482
|
+
});
|
|
29483
|
+
return await getAction(client, sendRawTransactionSync, "sendRawTransactionSync")({
|
|
29484
|
+
serializedTransaction,
|
|
29485
|
+
throwOnReceiptRevert,
|
|
29486
|
+
timeout: parameters.timeout
|
|
29487
|
+
});
|
|
29488
|
+
}
|
|
29489
|
+
if (account?.type === "smart")
|
|
29490
|
+
throw new AccountTypeNotSupportedError({
|
|
29491
|
+
metaMessages: [
|
|
29492
|
+
"Consider using the `sendUserOperation` Action instead."
|
|
29493
|
+
],
|
|
29494
|
+
docsPath: "/docs/actions/bundler/sendUserOperation",
|
|
29495
|
+
type: "smart"
|
|
29496
|
+
});
|
|
29497
|
+
throw new AccountTypeNotSupportedError({
|
|
29498
|
+
docsPath: "/docs/actions/wallet/sendTransactionSync",
|
|
29499
|
+
type: account?.type
|
|
29500
|
+
});
|
|
29501
|
+
} catch (err) {
|
|
29502
|
+
if (err instanceof AccountTypeNotSupportedError)
|
|
29503
|
+
throw err;
|
|
29504
|
+
if (nonceManagerParameters && !(err instanceof TransactionReceiptRevertedError))
|
|
29505
|
+
account?.nonceManager?.reset(nonceManagerParameters);
|
|
29506
|
+
throw getTransactionError(err, {
|
|
29507
|
+
...parameters,
|
|
29508
|
+
account,
|
|
29509
|
+
chain: parameters.chain || void 0
|
|
29510
|
+
});
|
|
29511
|
+
}
|
|
29512
|
+
}
|
|
29513
|
+
var supportsWalletNamespace2;
|
|
29514
|
+
var init_sendTransactionSync = __esm({
|
|
29515
|
+
"../../node_modules/viem/_esm/actions/wallet/sendTransactionSync.js"() {
|
|
29516
|
+
init_parseAccount();
|
|
29517
|
+
init_account();
|
|
29518
|
+
init_base();
|
|
29519
|
+
init_transaction();
|
|
29520
|
+
init_recoverAuthorizationAddress();
|
|
29521
|
+
init_assertCurrentChain();
|
|
29522
|
+
init_concat();
|
|
29523
|
+
init_getTransactionError();
|
|
29524
|
+
init_extract();
|
|
29525
|
+
init_transactionRequest();
|
|
29526
|
+
init_getAction();
|
|
29527
|
+
init_lru();
|
|
29528
|
+
init_assertRequest();
|
|
29529
|
+
init_getChainId();
|
|
29530
|
+
init_waitForTransactionReceipt();
|
|
29531
|
+
init_prepareTransactionRequest();
|
|
29532
|
+
init_sendRawTransactionSync();
|
|
29533
|
+
supportsWalletNamespace2 = new LruMap(128);
|
|
29534
|
+
}
|
|
29535
|
+
});
|
|
29536
|
+
|
|
29537
|
+
// ../../node_modules/viem/_esm/actions/wallet/writeContractSync.js
|
|
29538
|
+
async function writeContractSync(client, parameters) {
|
|
29539
|
+
return writeContract.internal(client, sendTransactionSync, "sendTransactionSync", parameters);
|
|
29540
|
+
}
|
|
29541
|
+
var init_writeContractSync = __esm({
|
|
29542
|
+
"../../node_modules/viem/_esm/actions/wallet/writeContractSync.js"() {
|
|
29543
|
+
init_sendTransactionSync();
|
|
29544
|
+
init_writeContract();
|
|
29545
|
+
}
|
|
29546
|
+
});
|
|
29547
|
+
|
|
29548
|
+
// ../../node_modules/viem/_esm/actions/token/approveSync.js
|
|
29549
|
+
async function approveSync(client, parameters) {
|
|
29550
|
+
const { amount, token, throwOnReceiptRevert = true } = parameters;
|
|
29551
|
+
const { decimals } = resolveToken(client, { token });
|
|
29552
|
+
const resolved = resolveAmountDecimals(amount, decimals);
|
|
29553
|
+
const receipt = await approve.inner(writeContractSync, client, {
|
|
29554
|
+
...parameters,
|
|
29555
|
+
throwOnReceiptRevert
|
|
29556
|
+
});
|
|
29557
|
+
const { args } = approve.extractEvent(receipt.logs);
|
|
29558
|
+
return {
|
|
29559
|
+
...args,
|
|
29560
|
+
...resolved === void 0 ? {} : { decimals: resolved, formatted: formatUnits(args.value, resolved) },
|
|
29561
|
+
receipt
|
|
29562
|
+
};
|
|
29563
|
+
}
|
|
29564
|
+
var init_approveSync = __esm({
|
|
29565
|
+
"../../node_modules/viem/_esm/actions/token/approveSync.js"() {
|
|
29566
|
+
init_formatUnits();
|
|
29567
|
+
init_writeContractSync();
|
|
29568
|
+
init_approve();
|
|
29569
|
+
init_internal();
|
|
29570
|
+
}
|
|
29571
|
+
});
|
|
29572
|
+
|
|
29573
|
+
// ../../node_modules/viem/_esm/actions/token/getAllowance.js
|
|
29574
|
+
async function getAllowance(client, parameters) {
|
|
29575
|
+
const { account, decimals, spender, token, ...rest } = parameters;
|
|
29576
|
+
const [amount, { decimals: resolved }] = await Promise.all([
|
|
29577
|
+
readContract(client, {
|
|
29578
|
+
...rest,
|
|
29579
|
+
...getAllowance.call(client, { account, spender, token })
|
|
29580
|
+
}),
|
|
29581
|
+
resolveTokenWithDecimals(client, {
|
|
29582
|
+
decimals,
|
|
29583
|
+
token
|
|
29584
|
+
})
|
|
29585
|
+
]);
|
|
29586
|
+
return toAmount(amount, resolved);
|
|
29587
|
+
}
|
|
29588
|
+
var init_getAllowance = __esm({
|
|
29589
|
+
"../../node_modules/viem/_esm/actions/token/getAllowance.js"() {
|
|
29590
|
+
init_abis();
|
|
29591
|
+
init_readContract();
|
|
29592
|
+
init_internal();
|
|
29593
|
+
(function(getAllowance2) {
|
|
29594
|
+
function call2(client, args) {
|
|
29595
|
+
return defineCall({
|
|
29596
|
+
address: resolveToken(client, args).address,
|
|
29597
|
+
abi: erc20Abi,
|
|
29598
|
+
functionName: "allowance",
|
|
29599
|
+
args: [args.account, args.spender]
|
|
29600
|
+
});
|
|
29601
|
+
}
|
|
29602
|
+
getAllowance2.call = call2;
|
|
29603
|
+
})(getAllowance || (getAllowance = {}));
|
|
29604
|
+
}
|
|
29605
|
+
});
|
|
29606
|
+
|
|
29607
|
+
// ../../node_modules/viem/_esm/actions/token/getBalance.js
|
|
29608
|
+
async function getBalance2(client, parameters) {
|
|
29609
|
+
const { account: account_ = client.account, decimals, token, ...rest } = parameters;
|
|
29610
|
+
if (!account_)
|
|
29611
|
+
throw new AccountNotFoundError();
|
|
29612
|
+
const account = parseAccount(account_).address;
|
|
29613
|
+
const [amount, { decimals: resolved }] = await Promise.all([
|
|
29614
|
+
readContract(client, {
|
|
29615
|
+
...rest,
|
|
29616
|
+
...getBalance2.call(client, { account, token })
|
|
29617
|
+
}),
|
|
29618
|
+
resolveTokenWithDecimals(client, {
|
|
29619
|
+
decimals,
|
|
29620
|
+
token
|
|
29621
|
+
})
|
|
29622
|
+
]);
|
|
29623
|
+
return toAmount(amount, resolved);
|
|
29624
|
+
}
|
|
29625
|
+
var init_getBalance2 = __esm({
|
|
29626
|
+
"../../node_modules/viem/_esm/actions/token/getBalance.js"() {
|
|
29627
|
+
init_parseAccount();
|
|
29628
|
+
init_abis();
|
|
29629
|
+
init_account();
|
|
29630
|
+
init_readContract();
|
|
29631
|
+
init_internal();
|
|
29632
|
+
(function(getBalance3) {
|
|
29633
|
+
function call2(client, args) {
|
|
29634
|
+
const account_ = args.account ?? client.account;
|
|
29635
|
+
if (!account_)
|
|
29636
|
+
throw new AccountNotFoundError();
|
|
29637
|
+
const account = parseAccount(account_).address;
|
|
29638
|
+
return defineCall({
|
|
29639
|
+
address: resolveToken(client, args).address,
|
|
29640
|
+
abi: erc20Abi,
|
|
29641
|
+
functionName: "balanceOf",
|
|
29642
|
+
args: [account]
|
|
29643
|
+
});
|
|
29644
|
+
}
|
|
29645
|
+
getBalance3.call = call2;
|
|
29646
|
+
})(getBalance2 || (getBalance2 = {}));
|
|
29647
|
+
}
|
|
29648
|
+
});
|
|
29649
|
+
|
|
29650
|
+
// ../../node_modules/viem/_esm/actions/token/getMetadata.js
|
|
29651
|
+
async function getMetadata(client, parameters) {
|
|
29652
|
+
const { token, ...rest } = parameters;
|
|
29653
|
+
const { address: address2 } = resolveToken(client, { token });
|
|
29654
|
+
const declared = findDeclaredToken(client, token);
|
|
29655
|
+
const [decimals_, name, symbol] = await Promise.all([
|
|
29656
|
+
declared?.decimals ?? readContract(client, {
|
|
29657
|
+
...rest,
|
|
29658
|
+
abi: erc20Abi,
|
|
29659
|
+
address: address2,
|
|
29660
|
+
functionName: "decimals"
|
|
29661
|
+
}),
|
|
29662
|
+
declared?.name ?? readContract(client, {
|
|
29663
|
+
...rest,
|
|
29664
|
+
abi: erc20Abi,
|
|
29665
|
+
address: address2,
|
|
29666
|
+
functionName: "name"
|
|
29667
|
+
}),
|
|
29668
|
+
declared?.symbol ?? readContract(client, {
|
|
29669
|
+
...rest,
|
|
29670
|
+
abi: erc20Abi,
|
|
29671
|
+
address: address2,
|
|
29672
|
+
functionName: "symbol"
|
|
29673
|
+
})
|
|
29674
|
+
]);
|
|
29675
|
+
return {
|
|
29676
|
+
decimals: decimals_,
|
|
29677
|
+
name,
|
|
29678
|
+
symbol
|
|
29679
|
+
};
|
|
29680
|
+
}
|
|
29681
|
+
var init_getMetadata = __esm({
|
|
29682
|
+
"../../node_modules/viem/_esm/actions/token/getMetadata.js"() {
|
|
29683
|
+
init_abis();
|
|
29684
|
+
init_readContract();
|
|
29685
|
+
init_internal();
|
|
29686
|
+
}
|
|
29687
|
+
});
|
|
29688
|
+
|
|
29689
|
+
// ../../node_modules/viem/_esm/actions/token/getTotalSupply.js
|
|
29690
|
+
async function getTotalSupply(client, parameters) {
|
|
29691
|
+
const { decimals, token, ...rest } = parameters;
|
|
29692
|
+
const [amount, { decimals: resolved }] = await Promise.all([
|
|
29693
|
+
readContract(client, {
|
|
29694
|
+
...rest,
|
|
29695
|
+
...getTotalSupply.call(client, { token })
|
|
29696
|
+
}),
|
|
29697
|
+
resolveTokenWithDecimals(client, {
|
|
29698
|
+
decimals,
|
|
29699
|
+
token
|
|
29700
|
+
})
|
|
29701
|
+
]);
|
|
29702
|
+
return toAmount(amount, resolved);
|
|
29703
|
+
}
|
|
29704
|
+
var init_getTotalSupply = __esm({
|
|
29705
|
+
"../../node_modules/viem/_esm/actions/token/getTotalSupply.js"() {
|
|
29706
|
+
init_abis();
|
|
29707
|
+
init_readContract();
|
|
29708
|
+
init_internal();
|
|
29709
|
+
(function(getTotalSupply2) {
|
|
29710
|
+
function call2(client, args) {
|
|
29711
|
+
return defineCall({
|
|
29712
|
+
address: resolveToken(client, args).address,
|
|
29713
|
+
abi: erc20Abi,
|
|
29714
|
+
args: [],
|
|
29715
|
+
functionName: "totalSupply"
|
|
29716
|
+
});
|
|
29717
|
+
}
|
|
29718
|
+
getTotalSupply2.call = call2;
|
|
29719
|
+
})(getTotalSupply || (getTotalSupply = {}));
|
|
29720
|
+
}
|
|
29721
|
+
});
|
|
29722
|
+
|
|
29723
|
+
// ../../node_modules/viem/_esm/actions/token/transfer.js
|
|
29724
|
+
async function transfer(client, parameters) {
|
|
29725
|
+
return transfer.inner(writeContract, client, parameters);
|
|
29726
|
+
}
|
|
29727
|
+
function getCall2(client, parameters) {
|
|
29728
|
+
const { amount, from: from16, to, token } = parameters;
|
|
29729
|
+
const { address: address2, decimals } = resolveToken(client, { token });
|
|
29730
|
+
const value = toBaseUnits(amount, decimals);
|
|
29731
|
+
if (from16)
|
|
29732
|
+
return {
|
|
29733
|
+
abi: erc20Abi,
|
|
29734
|
+
address: address2,
|
|
29735
|
+
args: [from16, to, value],
|
|
29736
|
+
functionName: "transferFrom"
|
|
29737
|
+
};
|
|
29738
|
+
return {
|
|
29739
|
+
abi: erc20Abi,
|
|
29740
|
+
address: address2,
|
|
29741
|
+
args: [to, value],
|
|
29742
|
+
functionName: "transfer"
|
|
29743
|
+
};
|
|
29744
|
+
}
|
|
29745
|
+
var init_transfer = __esm({
|
|
29746
|
+
"../../node_modules/viem/_esm/actions/token/transfer.js"() {
|
|
29747
|
+
init_abis();
|
|
29748
|
+
init_parseEventLogs();
|
|
29749
|
+
init_estimateContractGas();
|
|
29750
|
+
init_simulateContract();
|
|
29751
|
+
init_writeContract();
|
|
29752
|
+
init_internal();
|
|
29753
|
+
(function(transfer2) {
|
|
29754
|
+
async function inner(action, client, parameters) {
|
|
29755
|
+
return await action(client, {
|
|
29756
|
+
...parameters,
|
|
29757
|
+
...transfer2.call(client, parameters)
|
|
29758
|
+
});
|
|
29759
|
+
}
|
|
29760
|
+
transfer2.inner = inner;
|
|
29761
|
+
function call2(client, parameters) {
|
|
29762
|
+
return defineCall(getCall2(client, parameters));
|
|
29763
|
+
}
|
|
29764
|
+
transfer2.call = call2;
|
|
29765
|
+
async function estimateGas2(client, parameters) {
|
|
29766
|
+
return estimateContractGas(client, {
|
|
29767
|
+
...pickWriteParameters(parameters),
|
|
29768
|
+
...transfer2.call(client, parameters)
|
|
29769
|
+
});
|
|
29770
|
+
}
|
|
29771
|
+
transfer2.estimateGas = estimateGas2;
|
|
29772
|
+
async function simulate(client, parameters) {
|
|
29773
|
+
return simulateContract(client, {
|
|
29774
|
+
...pickWriteParameters(parameters),
|
|
29775
|
+
...transfer2.call(client, parameters)
|
|
29776
|
+
});
|
|
29777
|
+
}
|
|
29778
|
+
transfer2.simulate = simulate;
|
|
29779
|
+
function extractEvent(logs) {
|
|
29780
|
+
const [log] = parseEventLogs({
|
|
29781
|
+
abi: erc20Abi,
|
|
29782
|
+
logs,
|
|
29783
|
+
eventName: "Transfer",
|
|
29784
|
+
strict: true
|
|
29785
|
+
});
|
|
29786
|
+
if (!log)
|
|
29787
|
+
throw new Error("`Transfer` event not found.");
|
|
29788
|
+
return log;
|
|
29789
|
+
}
|
|
29790
|
+
transfer2.extractEvent = extractEvent;
|
|
29791
|
+
})(transfer || (transfer = {}));
|
|
29792
|
+
}
|
|
29793
|
+
});
|
|
29794
|
+
|
|
29795
|
+
// ../../node_modules/viem/_esm/actions/token/transferSync.js
|
|
29796
|
+
async function transferSync(client, parameters) {
|
|
29797
|
+
const { amount, token, throwOnReceiptRevert = true } = parameters;
|
|
29798
|
+
const { decimals } = resolveToken(client, { token });
|
|
29799
|
+
const resolved = resolveAmountDecimals(amount, decimals);
|
|
29800
|
+
const receipt = await transfer.inner(writeContractSync, client, {
|
|
29801
|
+
...parameters,
|
|
29802
|
+
throwOnReceiptRevert
|
|
29803
|
+
});
|
|
29804
|
+
const { args } = transfer.extractEvent(receipt.logs);
|
|
29805
|
+
return {
|
|
29806
|
+
...args,
|
|
29807
|
+
...resolved === void 0 ? {} : { decimals: resolved, formatted: formatUnits(args.value, resolved) },
|
|
29808
|
+
receipt
|
|
29809
|
+
};
|
|
29810
|
+
}
|
|
29811
|
+
var init_transferSync = __esm({
|
|
29812
|
+
"../../node_modules/viem/_esm/actions/token/transferSync.js"() {
|
|
29813
|
+
init_formatUnits();
|
|
29814
|
+
init_writeContractSync();
|
|
29815
|
+
init_internal();
|
|
29816
|
+
init_transfer();
|
|
29817
|
+
}
|
|
29818
|
+
});
|
|
29819
|
+
|
|
29820
|
+
// ../../node_modules/viem/_esm/actions/token/index.js
|
|
29821
|
+
var init_token = __esm({
|
|
29822
|
+
"../../node_modules/viem/_esm/actions/token/index.js"() {
|
|
29823
|
+
init_approve();
|
|
29824
|
+
init_approveSync();
|
|
29825
|
+
init_getAllowance();
|
|
29826
|
+
init_getBalance2();
|
|
29827
|
+
init_getMetadata();
|
|
29828
|
+
init_getTotalSupply();
|
|
29829
|
+
init_transfer();
|
|
29830
|
+
init_transferSync();
|
|
29831
|
+
}
|
|
29832
|
+
});
|
|
29833
|
+
|
|
28446
29834
|
// ../../node_modules/viem/_esm/clients/decorators/public.js
|
|
28447
29835
|
function publicActions(client) {
|
|
28448
29836
|
return {
|
|
@@ -28480,6 +29868,7 @@ function publicActions(client) {
|
|
|
28480
29868
|
getProof: (args) => getProof(client, args),
|
|
28481
29869
|
estimateMaxPriorityFeePerGas: (args) => estimateMaxPriorityFeePerGas(client, args),
|
|
28482
29870
|
fillTransaction: (args) => fillTransaction(client, args),
|
|
29871
|
+
getRawTransaction: (args) => getRawTransaction(client, args),
|
|
28483
29872
|
getStorageAt: (args) => getStorageAt(client, args),
|
|
28484
29873
|
getTransaction: (args) => getTransaction(client, args),
|
|
28485
29874
|
getTransactionConfirmations: (args) => getTransactionConfirmations(client, args),
|
|
@@ -28500,11 +29889,21 @@ function publicActions(client) {
|
|
|
28500
29889
|
verifyTypedData: (args) => verifyTypedData(client, args),
|
|
28501
29890
|
uninstallFilter: (args) => uninstallFilter(client, args),
|
|
28502
29891
|
waitForTransactionReceipt: (args) => waitForTransactionReceipt(client, args),
|
|
29892
|
+
watchBlockHeaders: (args) => watchBlockHeaders(client, args),
|
|
28503
29893
|
watchBlocks: (args) => watchBlocks(client, args),
|
|
28504
29894
|
watchBlockNumber: (args) => watchBlockNumber(client, args),
|
|
28505
29895
|
watchContractEvent: (args) => watchContractEvent(client, args),
|
|
28506
29896
|
watchEvent: (args) => watchEvent(client, args),
|
|
28507
|
-
watchPendingTransactions: (args) => watchPendingTransactions(client, args)
|
|
29897
|
+
watchPendingTransactions: (args) => watchPendingTransactions(client, args),
|
|
29898
|
+
token: bindPublicToken(client)
|
|
29899
|
+
};
|
|
29900
|
+
}
|
|
29901
|
+
function bindPublicToken(client) {
|
|
29902
|
+
return {
|
|
29903
|
+
getAllowance: bindActionDecorators(client, getAllowance),
|
|
29904
|
+
getBalance: bindActionDecorators(client, getBalance2),
|
|
29905
|
+
getMetadata: bindActionDecorators(client, getMetadata),
|
|
29906
|
+
getTotalSupply: bindActionDecorators(client, getTotalSupply)
|
|
28508
29907
|
};
|
|
28509
29908
|
}
|
|
28510
29909
|
var init_public = __esm({
|
|
@@ -28542,6 +29941,7 @@ var init_public = __esm({
|
|
|
28542
29941
|
init_getGasPrice();
|
|
28543
29942
|
init_getLogs();
|
|
28544
29943
|
init_getProof();
|
|
29944
|
+
init_getRawTransaction();
|
|
28545
29945
|
init_getStorageAt();
|
|
28546
29946
|
init_getTransaction();
|
|
28547
29947
|
init_getTransactionConfirmations();
|
|
@@ -28557,15 +29957,18 @@ var init_public = __esm({
|
|
|
28557
29957
|
init_verifyMessage();
|
|
28558
29958
|
init_verifyTypedData();
|
|
28559
29959
|
init_waitForTransactionReceipt();
|
|
29960
|
+
init_watchBlockHeaders();
|
|
28560
29961
|
init_watchBlockNumber();
|
|
28561
29962
|
init_watchBlocks();
|
|
28562
29963
|
init_watchContractEvent();
|
|
28563
29964
|
init_watchEvent();
|
|
28564
29965
|
init_watchPendingTransactions();
|
|
28565
29966
|
init_verifySiweMessage();
|
|
29967
|
+
init_token();
|
|
28566
29968
|
init_prepareTransactionRequest();
|
|
28567
29969
|
init_sendRawTransaction();
|
|
28568
29970
|
init_sendRawTransactionSync();
|
|
29971
|
+
init_createClient();
|
|
28569
29972
|
}
|
|
28570
29973
|
});
|
|
28571
29974
|
|
|
@@ -28762,193 +30165,6 @@ var init_sendCallsSync = __esm({
|
|
|
28762
30165
|
}
|
|
28763
30166
|
});
|
|
28764
30167
|
|
|
28765
|
-
// ../../node_modules/viem/_esm/actions/wallet/sendTransactionSync.js
|
|
28766
|
-
async function sendTransactionSync(client, parameters) {
|
|
28767
|
-
const { account: account_ = client.account, assertChainId = true, chain: chain2 = client.chain, accessList, authorizationList, blobs, data, dataSuffix = typeof client.dataSuffix === "string" ? client.dataSuffix : client.dataSuffix?.value, gas, gasPrice, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, nonce, pollingInterval, throwOnReceiptRevert, type, value, ...rest } = parameters;
|
|
28768
|
-
const timeout = parameters.timeout ?? Math.max((chain2?.blockTime ?? 0) * 3, 5e3);
|
|
28769
|
-
if (typeof account_ === "undefined")
|
|
28770
|
-
throw new AccountNotFoundError({
|
|
28771
|
-
docsPath: "/docs/actions/wallet/sendTransactionSync"
|
|
28772
|
-
});
|
|
28773
|
-
const account = account_ ? parseAccount(account_) : null;
|
|
28774
|
-
let nonceManagerParameters;
|
|
28775
|
-
try {
|
|
28776
|
-
assertRequest(parameters);
|
|
28777
|
-
const to = await (async () => {
|
|
28778
|
-
if (parameters.to)
|
|
28779
|
-
return parameters.to;
|
|
28780
|
-
if (parameters.to === null)
|
|
28781
|
-
return void 0;
|
|
28782
|
-
if (authorizationList && authorizationList.length > 0)
|
|
28783
|
-
return await recoverAuthorizationAddress({
|
|
28784
|
-
authorization: authorizationList[0]
|
|
28785
|
-
}).catch(() => {
|
|
28786
|
-
throw new BaseError2("`to` is required. Could not infer from `authorizationList`.");
|
|
28787
|
-
});
|
|
28788
|
-
return void 0;
|
|
28789
|
-
})();
|
|
28790
|
-
if (account?.type === "json-rpc" || account === null) {
|
|
28791
|
-
let chainId;
|
|
28792
|
-
if (chain2 !== null) {
|
|
28793
|
-
chainId = await getAction(client, getChainId, "getChainId")({});
|
|
28794
|
-
if (assertChainId)
|
|
28795
|
-
assertCurrentChain({
|
|
28796
|
-
currentChainId: chainId,
|
|
28797
|
-
chain: chain2
|
|
28798
|
-
});
|
|
28799
|
-
}
|
|
28800
|
-
const chainFormat = client.chain?.formatters?.transactionRequest?.format;
|
|
28801
|
-
const format = chainFormat || formatTransactionRequest;
|
|
28802
|
-
const request = format({
|
|
28803
|
-
// Pick out extra data that might exist on the chain's transaction request type.
|
|
28804
|
-
...extract(rest, { format: chainFormat }),
|
|
28805
|
-
accessList,
|
|
28806
|
-
account,
|
|
28807
|
-
authorizationList,
|
|
28808
|
-
blobs,
|
|
28809
|
-
chainId,
|
|
28810
|
-
data: dataSuffix ? concat([data ?? "0x", dataSuffix]) : data,
|
|
28811
|
-
gas,
|
|
28812
|
-
gasPrice,
|
|
28813
|
-
maxFeePerBlobGas,
|
|
28814
|
-
maxFeePerGas,
|
|
28815
|
-
maxPriorityFeePerGas,
|
|
28816
|
-
nonce,
|
|
28817
|
-
to,
|
|
28818
|
-
type,
|
|
28819
|
-
value
|
|
28820
|
-
}, "sendTransaction");
|
|
28821
|
-
const isWalletNamespaceSupported = supportsWalletNamespace2.get(client.uid);
|
|
28822
|
-
const method = isWalletNamespaceSupported ? "wallet_sendTransaction" : "eth_sendTransaction";
|
|
28823
|
-
const hash3 = await (async () => {
|
|
28824
|
-
try {
|
|
28825
|
-
return await client.request({
|
|
28826
|
-
method,
|
|
28827
|
-
params: [request]
|
|
28828
|
-
}, { retryCount: 0 });
|
|
28829
|
-
} catch (e6) {
|
|
28830
|
-
if (isWalletNamespaceSupported === false)
|
|
28831
|
-
throw e6;
|
|
28832
|
-
const error = e6;
|
|
28833
|
-
if (error.name === "InvalidInputRpcError" || error.name === "InvalidParamsRpcError" || error.name === "MethodNotFoundRpcError" || error.name === "MethodNotSupportedRpcError") {
|
|
28834
|
-
return await client.request({
|
|
28835
|
-
method: "wallet_sendTransaction",
|
|
28836
|
-
params: [request]
|
|
28837
|
-
}, { retryCount: 0 }).then((hash4) => {
|
|
28838
|
-
supportsWalletNamespace2.set(client.uid, true);
|
|
28839
|
-
return hash4;
|
|
28840
|
-
}).catch((e7) => {
|
|
28841
|
-
const walletNamespaceError = e7;
|
|
28842
|
-
if (walletNamespaceError.name === "MethodNotFoundRpcError" || walletNamespaceError.name === "MethodNotSupportedRpcError") {
|
|
28843
|
-
supportsWalletNamespace2.set(client.uid, false);
|
|
28844
|
-
throw error;
|
|
28845
|
-
}
|
|
28846
|
-
throw walletNamespaceError;
|
|
28847
|
-
});
|
|
28848
|
-
}
|
|
28849
|
-
throw error;
|
|
28850
|
-
}
|
|
28851
|
-
})();
|
|
28852
|
-
const receipt = await getAction(client, waitForTransactionReceipt, "waitForTransactionReceipt")({
|
|
28853
|
-
checkReplacement: false,
|
|
28854
|
-
hash: hash3,
|
|
28855
|
-
pollingInterval,
|
|
28856
|
-
timeout
|
|
28857
|
-
});
|
|
28858
|
-
if (throwOnReceiptRevert && receipt.status === "reverted")
|
|
28859
|
-
throw new TransactionReceiptRevertedError({ receipt });
|
|
28860
|
-
return receipt;
|
|
28861
|
-
}
|
|
28862
|
-
if (account?.type === "local") {
|
|
28863
|
-
if (account.nonceManager && typeof nonce === "undefined") {
|
|
28864
|
-
const requestChainId = rest.chainId;
|
|
28865
|
-
const chainId = await (async () => {
|
|
28866
|
-
if (typeof requestChainId === "number")
|
|
28867
|
-
return requestChainId;
|
|
28868
|
-
if (chain2)
|
|
28869
|
-
return chain2.id;
|
|
28870
|
-
return getAction(client, getChainId, "getChainId")({});
|
|
28871
|
-
})();
|
|
28872
|
-
nonceManagerParameters = { address: account.address, chainId };
|
|
28873
|
-
}
|
|
28874
|
-
const request = await getAction(client, prepareTransactionRequest, "prepareTransactionRequest")({
|
|
28875
|
-
account,
|
|
28876
|
-
accessList,
|
|
28877
|
-
authorizationList,
|
|
28878
|
-
blobs,
|
|
28879
|
-
chain: chain2,
|
|
28880
|
-
data: dataSuffix ? concat([data ?? "0x", dataSuffix]) : data,
|
|
28881
|
-
gas,
|
|
28882
|
-
gasPrice,
|
|
28883
|
-
maxFeePerBlobGas,
|
|
28884
|
-
maxFeePerGas,
|
|
28885
|
-
maxPriorityFeePerGas,
|
|
28886
|
-
nonce,
|
|
28887
|
-
nonceManager: account.nonceManager,
|
|
28888
|
-
parameters: [...defaultParameters, "sidecars"],
|
|
28889
|
-
type,
|
|
28890
|
-
value,
|
|
28891
|
-
...rest,
|
|
28892
|
-
to
|
|
28893
|
-
});
|
|
28894
|
-
const serializer = chain2?.serializers?.transaction;
|
|
28895
|
-
const serializedTransaction = await account.signTransaction(request, {
|
|
28896
|
-
serializer
|
|
28897
|
-
});
|
|
28898
|
-
return await getAction(client, sendRawTransactionSync, "sendRawTransactionSync")({
|
|
28899
|
-
serializedTransaction,
|
|
28900
|
-
throwOnReceiptRevert,
|
|
28901
|
-
timeout: parameters.timeout
|
|
28902
|
-
});
|
|
28903
|
-
}
|
|
28904
|
-
if (account?.type === "smart")
|
|
28905
|
-
throw new AccountTypeNotSupportedError({
|
|
28906
|
-
metaMessages: [
|
|
28907
|
-
"Consider using the `sendUserOperation` Action instead."
|
|
28908
|
-
],
|
|
28909
|
-
docsPath: "/docs/actions/bundler/sendUserOperation",
|
|
28910
|
-
type: "smart"
|
|
28911
|
-
});
|
|
28912
|
-
throw new AccountTypeNotSupportedError({
|
|
28913
|
-
docsPath: "/docs/actions/wallet/sendTransactionSync",
|
|
28914
|
-
type: account?.type
|
|
28915
|
-
});
|
|
28916
|
-
} catch (err) {
|
|
28917
|
-
if (err instanceof AccountTypeNotSupportedError)
|
|
28918
|
-
throw err;
|
|
28919
|
-
if (nonceManagerParameters && !(err instanceof TransactionReceiptRevertedError))
|
|
28920
|
-
account?.nonceManager?.reset(nonceManagerParameters);
|
|
28921
|
-
throw getTransactionError(err, {
|
|
28922
|
-
...parameters,
|
|
28923
|
-
account,
|
|
28924
|
-
chain: parameters.chain || void 0
|
|
28925
|
-
});
|
|
28926
|
-
}
|
|
28927
|
-
}
|
|
28928
|
-
var supportsWalletNamespace2;
|
|
28929
|
-
var init_sendTransactionSync = __esm({
|
|
28930
|
-
"../../node_modules/viem/_esm/actions/wallet/sendTransactionSync.js"() {
|
|
28931
|
-
init_parseAccount();
|
|
28932
|
-
init_account();
|
|
28933
|
-
init_base();
|
|
28934
|
-
init_transaction();
|
|
28935
|
-
init_recoverAuthorizationAddress();
|
|
28936
|
-
init_assertCurrentChain();
|
|
28937
|
-
init_concat();
|
|
28938
|
-
init_getTransactionError();
|
|
28939
|
-
init_extract();
|
|
28940
|
-
init_transactionRequest();
|
|
28941
|
-
init_getAction();
|
|
28942
|
-
init_lru();
|
|
28943
|
-
init_assertRequest();
|
|
28944
|
-
init_getChainId();
|
|
28945
|
-
init_waitForTransactionReceipt();
|
|
28946
|
-
init_prepareTransactionRequest();
|
|
28947
|
-
init_sendRawTransactionSync();
|
|
28948
|
-
supportsWalletNamespace2 = new LruMap(128);
|
|
28949
|
-
}
|
|
28950
|
-
});
|
|
28951
|
-
|
|
28952
30168
|
// ../../node_modules/viem/_esm/actions/wallet/showCallsStatus.js
|
|
28953
30169
|
async function showCallsStatus(client, parameters) {
|
|
28954
30170
|
const { id } = parameters;
|
|
@@ -29038,7 +30254,7 @@ async function signTransaction(client, parameters) {
|
|
|
29038
30254
|
chain: chain2
|
|
29039
30255
|
});
|
|
29040
30256
|
const formatters3 = chain2?.formatters || client.chain?.formatters;
|
|
29041
|
-
const
|
|
30257
|
+
const format2 = formatters3?.transactionRequest?.format || formatTransactionRequest;
|
|
29042
30258
|
if (account.signTransaction)
|
|
29043
30259
|
return account.signTransaction({
|
|
29044
30260
|
...transaction,
|
|
@@ -29049,7 +30265,7 @@ async function signTransaction(client, parameters) {
|
|
|
29049
30265
|
method: "eth_signTransaction",
|
|
29050
30266
|
params: [
|
|
29051
30267
|
{
|
|
29052
|
-
...
|
|
30268
|
+
...format2({
|
|
29053
30269
|
...transaction,
|
|
29054
30270
|
account
|
|
29055
30271
|
}, "signTransaction"),
|
|
@@ -29131,17 +30347,6 @@ var init_watchAsset = __esm({
|
|
|
29131
30347
|
}
|
|
29132
30348
|
});
|
|
29133
30349
|
|
|
29134
|
-
// ../../node_modules/viem/_esm/actions/wallet/writeContractSync.js
|
|
29135
|
-
async function writeContractSync(client, parameters) {
|
|
29136
|
-
return writeContract.internal(client, sendTransactionSync, "sendTransactionSync", parameters);
|
|
29137
|
-
}
|
|
29138
|
-
var init_writeContractSync = __esm({
|
|
29139
|
-
"../../node_modules/viem/_esm/actions/wallet/writeContractSync.js"() {
|
|
29140
|
-
init_sendTransactionSync();
|
|
29141
|
-
init_writeContract();
|
|
29142
|
-
}
|
|
29143
|
-
});
|
|
29144
|
-
|
|
29145
30350
|
// ../../node_modules/viem/_esm/clients/decorators/wallet.js
|
|
29146
30351
|
function walletActions(client) {
|
|
29147
30352
|
return {
|
|
@@ -29172,13 +30377,20 @@ function walletActions(client) {
|
|
|
29172
30377
|
waitForCallsStatus: (args) => waitForCallsStatus(client, args),
|
|
29173
30378
|
watchAsset: (args) => watchAsset(client, args),
|
|
29174
30379
|
writeContract: (args) => writeContract(client, args),
|
|
29175
|
-
writeContractSync: (args) => writeContractSync(client, args)
|
|
30380
|
+
writeContractSync: (args) => writeContractSync(client, args),
|
|
30381
|
+
token: {
|
|
30382
|
+
approve: bindActionDecorators(client, approve),
|
|
30383
|
+
approveSync: bindActionDecorators(client, approveSync),
|
|
30384
|
+
transfer: bindActionDecorators(client, transfer),
|
|
30385
|
+
transferSync: bindActionDecorators(client, transferSync)
|
|
30386
|
+
}
|
|
29176
30387
|
};
|
|
29177
30388
|
}
|
|
29178
30389
|
var init_wallet = __esm({
|
|
29179
30390
|
"../../node_modules/viem/_esm/clients/decorators/wallet.js"() {
|
|
29180
30391
|
init_fillTransaction();
|
|
29181
30392
|
init_getChainId();
|
|
30393
|
+
init_token();
|
|
29182
30394
|
init_addChain();
|
|
29183
30395
|
init_deployContract();
|
|
29184
30396
|
init_getAddresses();
|
|
@@ -29205,6 +30417,7 @@ var init_wallet = __esm({
|
|
|
29205
30417
|
init_watchAsset();
|
|
29206
30418
|
init_writeContract();
|
|
29207
30419
|
init_writeContractSync();
|
|
30420
|
+
init_createClient();
|
|
29208
30421
|
}
|
|
29209
30422
|
});
|
|
29210
30423
|
|
|
@@ -29280,7 +30493,7 @@ function getSignalId(signal) {
|
|
|
29280
30493
|
return nextId;
|
|
29281
30494
|
}
|
|
29282
30495
|
function http(url, config2 = {}) {
|
|
29283
|
-
const { batch, fetchFn, fetchOptions, key = "http", methods, name = "HTTP JSON-RPC", onFetchRequest, onFetchResponse, retryDelay, raw } = config2;
|
|
30496
|
+
const { batch, fetchFn, fetchOptions, key = "http", maxResponseBodySize, methods, name = "HTTP JSON-RPC", onFetchRequest, onFetchResponse, retryDelay, raw } = config2;
|
|
29284
30497
|
return ({ chain: chain2, retryCount: retryCount_, timeout: timeout_ }) => {
|
|
29285
30498
|
const { batchSize = 1e3, wait: wait2 = 0 } = typeof batch === "object" ? batch : {};
|
|
29286
30499
|
const retryCount = config2.retryCount ?? retryCount_;
|
|
@@ -29291,6 +30504,7 @@ function http(url, config2 = {}) {
|
|
|
29291
30504
|
const rpcClient = getHttpRpcClient(url_, {
|
|
29292
30505
|
fetchFn,
|
|
29293
30506
|
fetchOptions,
|
|
30507
|
+
maxResponseBodySize,
|
|
29294
30508
|
onRequest: onFetchRequest,
|
|
29295
30509
|
onResponse: onFetchResponse,
|
|
29296
30510
|
timeout
|
|
@@ -29523,15 +30737,15 @@ var init_isEip712Transaction = __esm({
|
|
|
29523
30737
|
|
|
29524
30738
|
// ../../node_modules/viem/_esm/zksync/utils/assertEip712Transaction.js
|
|
29525
30739
|
function assertEip712Transaction(transaction) {
|
|
29526
|
-
const { chainId, to, from:
|
|
30740
|
+
const { chainId, to, from: from16, paymaster, paymasterInput } = transaction;
|
|
29527
30741
|
if (!isEIP712Transaction(transaction))
|
|
29528
30742
|
throw new InvalidEip712TransactionError();
|
|
29529
30743
|
if (!chainId || chainId <= 0)
|
|
29530
30744
|
throw new InvalidChainIdError({ chainId });
|
|
29531
30745
|
if (to && !isAddress(to))
|
|
29532
30746
|
throw new InvalidAddressError({ address: to });
|
|
29533
|
-
if (
|
|
29534
|
-
throw new InvalidAddressError({ address:
|
|
30747
|
+
if (from16 && !isAddress(from16))
|
|
30748
|
+
throw new InvalidAddressError({ address: from16 });
|
|
29535
30749
|
if (paymaster && !isAddress(paymaster))
|
|
29536
30750
|
throw new InvalidAddressError({ address: paymaster });
|
|
29537
30751
|
if (paymaster && !paymasterInput) {
|
|
@@ -29559,7 +30773,7 @@ function serializeTransaction2(transaction, signature) {
|
|
|
29559
30773
|
return serializeTransaction(transaction, signature);
|
|
29560
30774
|
}
|
|
29561
30775
|
function serializeTransactionEIP712(transaction) {
|
|
29562
|
-
const { chainId, gas, nonce, to, from:
|
|
30776
|
+
const { chainId, gas, nonce, to, from: from16, value, maxFeePerGas, maxPriorityFeePerGas, customSignature, factoryDeps, paymaster, paymasterInput, gasPerPubdata, data } = transaction;
|
|
29563
30777
|
assertEip712Transaction(transaction);
|
|
29564
30778
|
const serializedTransaction = [
|
|
29565
30779
|
nonce ? toHex(nonce) : "0x",
|
|
@@ -29573,7 +30787,7 @@ function serializeTransactionEIP712(transaction) {
|
|
|
29573
30787
|
toHex(""),
|
|
29574
30788
|
toHex(""),
|
|
29575
30789
|
toHex(chainId),
|
|
29576
|
-
|
|
30790
|
+
from16 ?? "0x",
|
|
29577
30791
|
gasPerPubdata ? toHex(gasPerPubdata) : toHex(gasPerPubdataDefault),
|
|
29578
30792
|
factoryDeps ?? [],
|
|
29579
30793
|
customSignature ?? "0x",
|
|
@@ -29663,10 +30877,10 @@ var init_hashBytecode = __esm({
|
|
|
29663
30877
|
|
|
29664
30878
|
// ../../node_modules/viem/_esm/zksync/utils/getEip712Domain.js
|
|
29665
30879
|
function transactionToMessage(transaction) {
|
|
29666
|
-
const { gas, nonce, to, from:
|
|
30880
|
+
const { gas, nonce, to, from: from16, value, maxFeePerGas, maxPriorityFeePerGas, factoryDeps, paymaster, paymasterInput, gasPerPubdata, data } = transaction;
|
|
29667
30881
|
return {
|
|
29668
30882
|
txType: 113n,
|
|
29669
|
-
from: BigInt(
|
|
30883
|
+
from: BigInt(from16),
|
|
29670
30884
|
to: to ? BigInt(to) : 0n,
|
|
29671
30885
|
gasLimit: gas ?? 0n,
|
|
29672
30886
|
gasPerPubdataByteLimit: gasPerPubdata ?? gasPerPubdataDefault,
|
|
@@ -29891,6 +31105,8 @@ var init_formatters2 = __esm({
|
|
|
29891
31105
|
transactionReceipt: /* @__PURE__ */ defineTransactionReceipt({
|
|
29892
31106
|
format(args) {
|
|
29893
31107
|
return {
|
|
31108
|
+
...args.depositNonce ? { depositNonce: hexToBigInt(args.depositNonce) } : {},
|
|
31109
|
+
...args.depositReceiptVersion ? { depositReceiptVersion: hexToNumber(args.depositReceiptVersion) } : {},
|
|
29894
31110
|
l1GasPrice: args.l1GasPrice ? hexToBigInt(args.l1GasPrice) : null,
|
|
29895
31111
|
l1GasUsed: args.l1GasUsed ? hexToBigInt(args.l1GasUsed) : null,
|
|
29896
31112
|
l1Fee: args.l1Fee ? hexToBigInt(args.l1Fee) : null,
|
|
@@ -29910,10 +31126,10 @@ function serializeTransaction3(transaction, signature) {
|
|
|
29910
31126
|
}
|
|
29911
31127
|
function serializeTransactionDeposit(transaction) {
|
|
29912
31128
|
assertTransactionDeposit(transaction);
|
|
29913
|
-
const { sourceHash, data, from:
|
|
31129
|
+
const { sourceHash, data, from: from16, gas, isSystemTx, mint, to, value } = transaction;
|
|
29914
31130
|
const serializedTransaction = [
|
|
29915
31131
|
sourceHash,
|
|
29916
|
-
|
|
31132
|
+
from16,
|
|
29917
31133
|
to ?? "0x",
|
|
29918
31134
|
mint ? toHex(mint) : "0x",
|
|
29919
31135
|
value ? toHex(value) : "0x",
|
|
@@ -29934,9 +31150,9 @@ function isDeposit(transaction) {
|
|
|
29934
31150
|
return false;
|
|
29935
31151
|
}
|
|
29936
31152
|
function assertTransactionDeposit(transaction) {
|
|
29937
|
-
const { from:
|
|
29938
|
-
if (
|
|
29939
|
-
throw new InvalidAddressError({ address:
|
|
31153
|
+
const { from: from16, to } = transaction;
|
|
31154
|
+
if (from16 && !isAddress(from16))
|
|
31155
|
+
throw new InvalidAddressError({ address: from16 });
|
|
29940
31156
|
if (to && !isAddress(to))
|
|
29941
31157
|
throw new InvalidAddressError({ address: to });
|
|
29942
31158
|
}
|
|
@@ -30190,13 +31406,20 @@ var init_eduChain = __esm({
|
|
|
30190
31406
|
},
|
|
30191
31407
|
rpcUrls: {
|
|
30192
31408
|
default: {
|
|
30193
|
-
http: ["https://rpc.
|
|
31409
|
+
http: ["https://rpc.educhain.xyz"],
|
|
31410
|
+
webSocket: ["wss://rpc.educhain.xyz"]
|
|
30194
31411
|
}
|
|
30195
31412
|
},
|
|
30196
31413
|
blockExplorers: {
|
|
30197
31414
|
default: {
|
|
30198
31415
|
name: "EDU Chain Explorer",
|
|
30199
|
-
url: "https://educhain.
|
|
31416
|
+
url: "https://explorer.educhain.xyz/"
|
|
31417
|
+
}
|
|
31418
|
+
},
|
|
31419
|
+
contracts: {
|
|
31420
|
+
multicall3: {
|
|
31421
|
+
address: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
31422
|
+
blockCreated: 16410660
|
|
30200
31423
|
}
|
|
30201
31424
|
},
|
|
30202
31425
|
testnet: false
|
|
@@ -30361,7 +31584,7 @@ var init_polygonAmoy = __esm({
|
|
|
30361
31584
|
nativeCurrency: { name: "POL", symbol: "POL", decimals: 18 },
|
|
30362
31585
|
rpcUrls: {
|
|
30363
31586
|
default: {
|
|
30364
|
-
http: ["https://
|
|
31587
|
+
http: ["https://polygon-amoy.drpc.org"]
|
|
30365
31588
|
}
|
|
30366
31589
|
},
|
|
30367
31590
|
blockExplorers: {
|
|
@@ -30453,11 +31676,11 @@ var init_story = __esm({
|
|
|
30453
31676
|
init_defineChain();
|
|
30454
31677
|
story = /* @__PURE__ */ defineChain({
|
|
30455
31678
|
id: 1514,
|
|
30456
|
-
name: "
|
|
31679
|
+
name: "Data Network",
|
|
30457
31680
|
nativeCurrency: {
|
|
30458
31681
|
decimals: 18,
|
|
30459
|
-
name: "
|
|
30460
|
-
symbol: "
|
|
31682
|
+
name: "DATA",
|
|
31683
|
+
symbol: "DATA"
|
|
30461
31684
|
},
|
|
30462
31685
|
contracts: {
|
|
30463
31686
|
multicall3: {
|
|
@@ -30474,13 +31697,13 @@ var init_story = __esm({
|
|
|
30474
31697
|
}
|
|
30475
31698
|
},
|
|
30476
31699
|
rpcUrls: {
|
|
30477
|
-
default: { http: ["https://mainnet.
|
|
31700
|
+
default: { http: ["https://mainnet.datarpc.io"] }
|
|
30478
31701
|
},
|
|
30479
31702
|
blockExplorers: {
|
|
30480
31703
|
default: {
|
|
30481
|
-
name: "
|
|
30482
|
-
url: "https://
|
|
30483
|
-
apiUrl: "https://
|
|
31704
|
+
name: "Data Network explorer",
|
|
31705
|
+
url: "https://datanetscan.io",
|
|
31706
|
+
apiUrl: "https://datanetscan.io/api/v2"
|
|
30484
31707
|
}
|
|
30485
31708
|
},
|
|
30486
31709
|
ensTlds: [".ip"],
|
|
@@ -30585,9 +31808,9 @@ function alphabet(letters) {
|
|
|
30585
31808
|
function join9(separator = "") {
|
|
30586
31809
|
astr("join", separator);
|
|
30587
31810
|
return {
|
|
30588
|
-
encode: (
|
|
30589
|
-
astrArr("join.decode",
|
|
30590
|
-
return
|
|
31811
|
+
encode: (from16) => {
|
|
31812
|
+
astrArr("join.decode", from16);
|
|
31813
|
+
return from16.join(separator);
|
|
30591
31814
|
},
|
|
30592
31815
|
decode: (to) => {
|
|
30593
31816
|
astr("join.decode", to);
|
|
@@ -30595,9 +31818,9 @@ function join9(separator = "") {
|
|
|
30595
31818
|
}
|
|
30596
31819
|
};
|
|
30597
31820
|
}
|
|
30598
|
-
function convertRadix(data,
|
|
30599
|
-
if (
|
|
30600
|
-
throw new Error(`convertRadix: invalid from=${
|
|
31821
|
+
function convertRadix(data, from16, to) {
|
|
31822
|
+
if (from16 < 2)
|
|
31823
|
+
throw new Error(`convertRadix: invalid from=${from16}, base cannot be less than 2`);
|
|
30601
31824
|
if (to < 2)
|
|
30602
31825
|
throw new Error(`convertRadix: invalid to=${to}, base cannot be less than 2`);
|
|
30603
31826
|
aArr(data);
|
|
@@ -30607,26 +31830,26 @@ function convertRadix(data, from14, to) {
|
|
|
30607
31830
|
const res = [];
|
|
30608
31831
|
const digits = Array.from(data, (d) => {
|
|
30609
31832
|
anumber3(d);
|
|
30610
|
-
if (d < 0 || d >=
|
|
31833
|
+
if (d < 0 || d >= from16)
|
|
30611
31834
|
throw new Error(`invalid integer: ${d}`);
|
|
30612
31835
|
return d;
|
|
30613
31836
|
});
|
|
30614
31837
|
const dlen = digits.length;
|
|
30615
31838
|
while (true) {
|
|
30616
|
-
let
|
|
31839
|
+
let carry2 = 0;
|
|
30617
31840
|
let done = true;
|
|
30618
31841
|
for (let i = pos; i < dlen; i++) {
|
|
30619
31842
|
const digit = digits[i];
|
|
30620
|
-
const fromCarry =
|
|
31843
|
+
const fromCarry = from16 * carry2;
|
|
30621
31844
|
const digitBase = fromCarry + digit;
|
|
30622
|
-
if (!Number.isSafeInteger(digitBase) || fromCarry /
|
|
31845
|
+
if (!Number.isSafeInteger(digitBase) || fromCarry / from16 !== carry2 || digitBase - digit !== fromCarry) {
|
|
30623
31846
|
throw new Error("convertRadix: carry overflow");
|
|
30624
31847
|
}
|
|
30625
31848
|
const div = digitBase / to;
|
|
30626
|
-
|
|
31849
|
+
carry2 = digitBase % to;
|
|
30627
31850
|
const rounded = Math.floor(div);
|
|
30628
31851
|
digits[i] = rounded;
|
|
30629
|
-
if (!Number.isSafeInteger(rounded) || rounded * to +
|
|
31852
|
+
if (!Number.isSafeInteger(rounded) || rounded * to + carry2 !== digitBase)
|
|
30630
31853
|
throw new Error("convertRadix: carry overflow");
|
|
30631
31854
|
if (!done)
|
|
30632
31855
|
continue;
|
|
@@ -30635,7 +31858,7 @@ function convertRadix(data, from14, to) {
|
|
|
30635
31858
|
else
|
|
30636
31859
|
done = false;
|
|
30637
31860
|
}
|
|
30638
|
-
res.push(
|
|
31861
|
+
res.push(carry2);
|
|
30639
31862
|
if (done)
|
|
30640
31863
|
break;
|
|
30641
31864
|
}
|
|
@@ -37096,7 +38319,7 @@ var require_permessage_deflate = __commonJS({
|
|
|
37096
38319
|
acceptAsServer(offers) {
|
|
37097
38320
|
const opts = this._options;
|
|
37098
38321
|
const accepted = offers.find((params) => {
|
|
37099
|
-
if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params.client_max_window_bits) {
|
|
38322
|
+
if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && (typeof params.client_max_window_bits === "number" ? opts.clientMaxWindowBits > params.client_max_window_bits : !params.client_max_window_bits)) {
|
|
37100
38323
|
return false;
|
|
37101
38324
|
}
|
|
37102
38325
|
return true;
|
|
@@ -37665,6 +38888,7 @@ var require_receiver = __commonJS({
|
|
|
37665
38888
|
this._opcode = 0;
|
|
37666
38889
|
this._totalPayloadLength = 0;
|
|
37667
38890
|
this._messageLength = 0;
|
|
38891
|
+
this._numFragments = 0;
|
|
37668
38892
|
this._fragments = [];
|
|
37669
38893
|
this._errored = false;
|
|
37670
38894
|
this._loop = false;
|
|
@@ -38015,23 +39239,23 @@ var require_receiver = __commonJS({
|
|
|
38015
39239
|
this.controlMessage(data, cb);
|
|
38016
39240
|
return;
|
|
38017
39241
|
}
|
|
39242
|
+
if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) {
|
|
39243
|
+
const error = this.createError(
|
|
39244
|
+
RangeError,
|
|
39245
|
+
"Too many message fragments",
|
|
39246
|
+
false,
|
|
39247
|
+
1008,
|
|
39248
|
+
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
39249
|
+
);
|
|
39250
|
+
cb(error);
|
|
39251
|
+
return;
|
|
39252
|
+
}
|
|
38018
39253
|
if (this._compressed) {
|
|
38019
39254
|
this._state = INFLATING;
|
|
38020
39255
|
this.decompress(data, cb);
|
|
38021
39256
|
return;
|
|
38022
39257
|
}
|
|
38023
39258
|
if (data.length) {
|
|
38024
|
-
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
|
|
38025
|
-
const error = this.createError(
|
|
38026
|
-
RangeError,
|
|
38027
|
-
"Too many message fragments",
|
|
38028
|
-
false,
|
|
38029
|
-
1008,
|
|
38030
|
-
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
38031
|
-
);
|
|
38032
|
-
cb(error);
|
|
38033
|
-
return;
|
|
38034
|
-
}
|
|
38035
39259
|
this._messageLength = this._totalPayloadLength;
|
|
38036
39260
|
this._fragments.push(data);
|
|
38037
39261
|
}
|
|
@@ -38061,17 +39285,6 @@ var require_receiver = __commonJS({
|
|
|
38061
39285
|
cb(error);
|
|
38062
39286
|
return;
|
|
38063
39287
|
}
|
|
38064
|
-
if (this._maxFragments > 0 && this._fragments.length >= this._maxFragments) {
|
|
38065
|
-
const error = this.createError(
|
|
38066
|
-
RangeError,
|
|
38067
|
-
"Too many message fragments",
|
|
38068
|
-
false,
|
|
38069
|
-
1008,
|
|
38070
|
-
"WS_ERR_TOO_MANY_BUFFERED_PARTS"
|
|
38071
|
-
);
|
|
38072
|
-
cb(error);
|
|
38073
|
-
return;
|
|
38074
|
-
}
|
|
38075
39288
|
this._fragments.push(buf);
|
|
38076
39289
|
}
|
|
38077
39290
|
this.dataMessage(cb);
|
|
@@ -38094,6 +39307,7 @@ var require_receiver = __commonJS({
|
|
|
38094
39307
|
this._totalPayloadLength = 0;
|
|
38095
39308
|
this._messageLength = 0;
|
|
38096
39309
|
this._fragmented = 0;
|
|
39310
|
+
this._numFragments = 0;
|
|
38097
39311
|
this._fragments = [];
|
|
38098
39312
|
if (this._opcode === 2) {
|
|
38099
39313
|
let data;
|
|
@@ -39088,7 +40302,7 @@ var require_extension = __commonJS({
|
|
|
39088
40302
|
}
|
|
39089
40303
|
return offers;
|
|
39090
40304
|
}
|
|
39091
|
-
function
|
|
40305
|
+
function format2(extensions) {
|
|
39092
40306
|
return Object.keys(extensions).map((extension2) => {
|
|
39093
40307
|
let configurations = extensions[extension2];
|
|
39094
40308
|
if (!Array.isArray(configurations)) configurations = [configurations];
|
|
@@ -39103,7 +40317,7 @@ var require_extension = __commonJS({
|
|
|
39103
40317
|
}).join(", ");
|
|
39104
40318
|
}).join(", ");
|
|
39105
40319
|
}
|
|
39106
|
-
module.exports = { format, parse };
|
|
40320
|
+
module.exports = { format: format2, parse };
|
|
39107
40321
|
}
|
|
39108
40322
|
});
|
|
39109
40323
|
|
|
@@ -39137,7 +40351,7 @@ var require_websocket = __commonJS({
|
|
|
39137
40351
|
var {
|
|
39138
40352
|
EventTarget: { addEventListener, removeEventListener }
|
|
39139
40353
|
} = require_event_target();
|
|
39140
|
-
var { format, parse } = require_extension();
|
|
40354
|
+
var { format: format2, parse } = require_extension();
|
|
39141
40355
|
var { toBuffer } = require_buffer_util();
|
|
39142
40356
|
var kAborted = /* @__PURE__ */ Symbol("kAborted");
|
|
39143
40357
|
var protocolVersions = [8, 13];
|
|
@@ -39594,8 +40808,8 @@ var require_websocket = __commonJS({
|
|
|
39594
40808
|
autoPong: true,
|
|
39595
40809
|
closeTimeout: CLOSE_TIMEOUT,
|
|
39596
40810
|
protocolVersion: protocolVersions[1],
|
|
39597
|
-
maxBufferedChunks:
|
|
39598
|
-
maxFragments:
|
|
40811
|
+
maxBufferedChunks: 256 * 1024,
|
|
40812
|
+
maxFragments: 16 * 1024,
|
|
39599
40813
|
maxPayload: 100 * 1024 * 1024,
|
|
39600
40814
|
skipUTF8Validation: false,
|
|
39601
40815
|
perMessageDeflate: true,
|
|
@@ -39677,7 +40891,7 @@ var require_websocket = __commonJS({
|
|
|
39677
40891
|
isServer: false,
|
|
39678
40892
|
maxPayload: opts.maxPayload
|
|
39679
40893
|
});
|
|
39680
|
-
opts.headers["Sec-WebSocket-Extensions"] =
|
|
40894
|
+
opts.headers["Sec-WebSocket-Extensions"] = format2({
|
|
39681
40895
|
[PerMessageDeflate2.extensionName]: perMessageDeflate.offer()
|
|
39682
40896
|
});
|
|
39683
40897
|
}
|
|
@@ -40182,9 +41396,9 @@ var require_websocket_server = __commonJS({
|
|
|
40182
41396
|
* called
|
|
40183
41397
|
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
40184
41398
|
* @param {String} [options.host] The hostname where to bind the server
|
|
40185
|
-
* @param {Number} [options.maxBufferedChunks=
|
|
41399
|
+
* @param {Number} [options.maxBufferedChunks=262144] The maximum number of
|
|
40186
41400
|
* buffered data chunks
|
|
40187
|
-
* @param {Number} [options.maxFragments=
|
|
41401
|
+
* @param {Number} [options.maxFragments=16384] The maximum number of message
|
|
40188
41402
|
* fragments
|
|
40189
41403
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
40190
41404
|
* size
|
|
@@ -40207,8 +41421,8 @@ var require_websocket_server = __commonJS({
|
|
|
40207
41421
|
options = {
|
|
40208
41422
|
allowSynchronousEvents: true,
|
|
40209
41423
|
autoPong: true,
|
|
40210
|
-
maxBufferedChunks:
|
|
40211
|
-
maxFragments:
|
|
41424
|
+
maxBufferedChunks: 256 * 1024,
|
|
41425
|
+
maxFragments: 16 * 1024,
|
|
40212
41426
|
maxPayload: 100 * 1024 * 1024,
|
|
40213
41427
|
skipUTF8Validation: false,
|
|
40214
41428
|
perMessageDeflate: false,
|
|
@@ -42645,7 +43859,7 @@ function encodePayment(payment) {
|
|
|
42645
43859
|
}
|
|
42646
43860
|
throw new Error("Invalid network");
|
|
42647
43861
|
}
|
|
42648
|
-
async function signAuthorization3(walletClient, { from:
|
|
43862
|
+
async function signAuthorization3(walletClient, { from: from16, to, value, validAfter, validBefore, nonce }, { asset, network, extra }) {
|
|
42649
43863
|
const chainId = getNetworkId(network);
|
|
42650
43864
|
const name = extra?.name;
|
|
42651
43865
|
const version4 = extra?.version;
|
|
@@ -42659,7 +43873,7 @@ async function signAuthorization3(walletClient, { from: from14, to, value, valid
|
|
|
42659
43873
|
},
|
|
42660
43874
|
primaryType: "TransferWithAuthorization",
|
|
42661
43875
|
message: {
|
|
42662
|
-
from: getAddress(
|
|
43876
|
+
from: getAddress(from16),
|
|
42663
43877
|
to: getAddress(to),
|
|
42664
43878
|
value,
|
|
42665
43879
|
validAfter,
|
|
@@ -42689,7 +43903,7 @@ function createNonce() {
|
|
|
42689
43903
|
);
|
|
42690
43904
|
return toHex(cryptoObj.getRandomValues(new Uint8Array(32)));
|
|
42691
43905
|
}
|
|
42692
|
-
function preparePaymentHeader(
|
|
43906
|
+
function preparePaymentHeader(from16, x402Version, paymentRequirements) {
|
|
42693
43907
|
const nonce = createNonce();
|
|
42694
43908
|
const validAfter = BigInt(
|
|
42695
43909
|
Math.floor(Date.now() / 1e3) - 600
|
|
@@ -42705,7 +43919,7 @@ function preparePaymentHeader(from14, x402Version, paymentRequirements) {
|
|
|
42705
43919
|
payload: {
|
|
42706
43920
|
signature: void 0,
|
|
42707
43921
|
authorization: {
|
|
42708
|
-
from:
|
|
43922
|
+
from: from16,
|
|
42709
43923
|
to: paymentRequirements.payTo,
|
|
42710
43924
|
value: paymentRequirements.maxAmountRequired,
|
|
42711
43925
|
validAfter: validAfter.toString(),
|
|
@@ -42730,8 +43944,8 @@ async function signPaymentHeader(client, paymentRequirements, unsignedPaymentHea
|
|
|
42730
43944
|
};
|
|
42731
43945
|
}
|
|
42732
43946
|
async function createPayment(client, x402Version, paymentRequirements) {
|
|
42733
|
-
const
|
|
42734
|
-
const unsignedPaymentHeader = preparePaymentHeader(
|
|
43947
|
+
const from16 = isSignerWallet(client) ? client.account.address : client.address;
|
|
43948
|
+
const unsignedPaymentHeader = preparePaymentHeader(from16, x402Version, paymentRequirements);
|
|
42735
43949
|
return signPaymentHeader(client, paymentRequirements, unsignedPaymentHeader);
|
|
42736
43950
|
}
|
|
42737
43951
|
async function createPaymentHeader(client, x402Version, paymentRequirements) {
|
|
@@ -45961,7 +47175,7 @@ var COMMAND_REGISTRY = [
|
|
|
45961
47175
|
},
|
|
45962
47176
|
{
|
|
45963
47177
|
name: "provider",
|
|
45964
|
-
usage: "/provider [x402|venice|openrouter]",
|
|
47178
|
+
usage: "/provider [blockrun|x402|venice|openrouter]",
|
|
45965
47179
|
summary: "Show or select this session's LLM provider (validated immediately)",
|
|
45966
47180
|
execute: async (rest, { session, state }) => {
|
|
45967
47181
|
const config2 = await loadConfig();
|
|
@@ -45973,7 +47187,7 @@ var COMMAND_REGISTRY = [
|
|
|
45973
47187
|
throw new Error("provider selection is unavailable in demo mode");
|
|
45974
47188
|
}
|
|
45975
47189
|
if (!isProviderId(rest[0])) {
|
|
45976
|
-
throw new Error("/provider supports x402, venice, or openrouter");
|
|
47190
|
+
throw new Error("/provider supports blockrun, x402, venice, or openrouter");
|
|
45977
47191
|
}
|
|
45978
47192
|
const providerId = rest[0];
|
|
45979
47193
|
const provider = sharedTypedProvider(providerId, { timeoutMs: config2.llmTimeoutMs, x402ProxyUrl: config2.x402ProxyUrl });
|
|
@@ -46245,7 +47459,7 @@ async function sessionHasPendingReviews(session) {
|
|
|
46245
47459
|
}
|
|
46246
47460
|
function activeProviderId(session, fallback) {
|
|
46247
47461
|
const recorded = session.models?.provider;
|
|
46248
|
-
return recorded
|
|
47462
|
+
return isProviderId(recorded) ? recorded : fallback;
|
|
46249
47463
|
}
|
|
46250
47464
|
async function updateSessionModels(session, change) {
|
|
46251
47465
|
const config2 = await loadConfig();
|
|
@@ -47170,7 +48384,7 @@ async function configCommand(args) {
|
|
|
47170
48384
|
switch (key) {
|
|
47171
48385
|
case "provider": {
|
|
47172
48386
|
if (!isProviderId(value)) {
|
|
47173
|
-
throw new Error("provider must be x402, venice, or openrouter");
|
|
48387
|
+
throw new Error("provider must be blockrun, x402, venice, or openrouter");
|
|
47174
48388
|
}
|
|
47175
48389
|
await updateConfig({ provider: value });
|
|
47176
48390
|
break;
|