@gearbox-protocol/deploy-tools 5.16.12 → 5.16.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +803 -413
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -4168,15 +4168,15 @@ var init_structs = __esm({
|
|
|
4168
4168
|
// ../../node_modules/abitype/dist/esm/human-readable/parseAbi.js
|
|
4169
4169
|
function parseAbi(signatures) {
|
|
4170
4170
|
const structs = parseStructs(signatures);
|
|
4171
|
-
const
|
|
4171
|
+
const abi25 = [];
|
|
4172
4172
|
const length = signatures.length;
|
|
4173
4173
|
for (let i = 0; i < length; i++) {
|
|
4174
4174
|
const signature = signatures[i];
|
|
4175
4175
|
if (isStructSignature(signature))
|
|
4176
4176
|
continue;
|
|
4177
|
-
|
|
4177
|
+
abi25.push(parseSignature(signature, structs));
|
|
4178
4178
|
}
|
|
4179
|
-
return
|
|
4179
|
+
return abi25;
|
|
4180
4180
|
}
|
|
4181
4181
|
var init_parseAbi = __esm({
|
|
4182
4182
|
"../../node_modules/abitype/dist/esm/human-readable/parseAbi.js"() {
|
|
@@ -5893,9 +5893,9 @@ var init_toFunctionSelector = __esm({
|
|
|
5893
5893
|
|
|
5894
5894
|
// ../../node_modules/viem/_esm/utils/abi/getAbiItem.js
|
|
5895
5895
|
function getAbiItem(parameters) {
|
|
5896
|
-
const { abi:
|
|
5896
|
+
const { abi: abi25, args = [], name } = parameters;
|
|
5897
5897
|
const isSelector = isHex(name, { strict: false });
|
|
5898
|
-
const abiItems =
|
|
5898
|
+
const abiItems = abi25.filter((abiItem) => {
|
|
5899
5899
|
if (isSelector) {
|
|
5900
5900
|
if (abiItem.type === "function")
|
|
5901
5901
|
return toFunctionSelector(abiItem) === name;
|
|
@@ -6025,11 +6025,11 @@ var init_parseAccount = __esm({
|
|
|
6025
6025
|
|
|
6026
6026
|
// ../../node_modules/viem/_esm/utils/abi/prepareEncodeFunctionData.js
|
|
6027
6027
|
function prepareEncodeFunctionData(parameters) {
|
|
6028
|
-
const { abi:
|
|
6029
|
-
let abiItem =
|
|
6028
|
+
const { abi: abi25, args, functionName } = parameters;
|
|
6029
|
+
let abiItem = abi25[0];
|
|
6030
6030
|
if (functionName) {
|
|
6031
6031
|
const item = getAbiItem({
|
|
6032
|
-
abi:
|
|
6032
|
+
abi: abi25,
|
|
6033
6033
|
args,
|
|
6034
6034
|
name: functionName
|
|
6035
6035
|
});
|
|
@@ -6058,12 +6058,12 @@ var init_prepareEncodeFunctionData = __esm({
|
|
|
6058
6058
|
// ../../node_modules/viem/_esm/utils/abi/encodeFunctionData.js
|
|
6059
6059
|
function encodeFunctionData(parameters) {
|
|
6060
6060
|
const { args } = parameters;
|
|
6061
|
-
const { abi:
|
|
6061
|
+
const { abi: abi25, functionName } = (() => {
|
|
6062
6062
|
if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
|
|
6063
6063
|
return parameters;
|
|
6064
6064
|
return prepareEncodeFunctionData(parameters);
|
|
6065
6065
|
})();
|
|
6066
|
-
const abiItem =
|
|
6066
|
+
const abiItem = abi25[0];
|
|
6067
6067
|
const signature = functionName;
|
|
6068
6068
|
const data = "inputs" in abiItem && abiItem.inputs ? encodeAbiParameters(abiItem.inputs, args ?? []) : void 0;
|
|
6069
6069
|
return concatHex([signature, data ?? "0x"]);
|
|
@@ -6558,11 +6558,11 @@ var init_decodeAbiParameters = __esm({
|
|
|
6558
6558
|
|
|
6559
6559
|
// ../../node_modules/viem/_esm/utils/abi/decodeErrorResult.js
|
|
6560
6560
|
function decodeErrorResult(parameters) {
|
|
6561
|
-
const { abi:
|
|
6561
|
+
const { abi: abi25, data } = parameters;
|
|
6562
6562
|
const signature = slice(data, 0, 4);
|
|
6563
6563
|
if (signature === "0x")
|
|
6564
6564
|
throw new AbiDecodingZeroDataError();
|
|
6565
|
-
const abi_ = [...
|
|
6565
|
+
const abi_ = [...abi25 || [], solidityError, solidityPanic];
|
|
6566
6566
|
const abiItem = abi_.find((x) => x.type === "error" && signature === toFunctionSelector(formatAbiItem2(x)));
|
|
6567
6567
|
if (!abiItem)
|
|
6568
6568
|
throw new AbiErrorSignatureNotFoundError(signature, {
|
|
@@ -6905,8 +6905,8 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
6905
6905
|
}
|
|
6906
6906
|
};
|
|
6907
6907
|
ContractFunctionExecutionError = class extends BaseError2 {
|
|
6908
|
-
constructor(cause, { abi:
|
|
6909
|
-
const abiItem = getAbiItem({ abi:
|
|
6908
|
+
constructor(cause, { abi: abi25, args, contractAddress, docsPath: docsPath6, functionName, sender }) {
|
|
6909
|
+
const abiItem = getAbiItem({ abi: abi25, args, name: functionName });
|
|
6910
6910
|
const formattedArgs = abiItem ? formatAbiItemWithArgs({
|
|
6911
6911
|
abiItem,
|
|
6912
6912
|
args,
|
|
@@ -6972,7 +6972,7 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
6972
6972
|
writable: true,
|
|
6973
6973
|
value: void 0
|
|
6974
6974
|
});
|
|
6975
|
-
this.abi =
|
|
6975
|
+
this.abi = abi25;
|
|
6976
6976
|
this.args = args;
|
|
6977
6977
|
this.cause = cause;
|
|
6978
6978
|
this.contractAddress = contractAddress;
|
|
@@ -6981,14 +6981,14 @@ ${prettyStateOverride(stateOverride)}`;
|
|
|
6981
6981
|
}
|
|
6982
6982
|
};
|
|
6983
6983
|
ContractFunctionRevertedError = class extends BaseError2 {
|
|
6984
|
-
constructor({ abi:
|
|
6984
|
+
constructor({ abi: abi25, data, functionName, message }) {
|
|
6985
6985
|
let cause;
|
|
6986
6986
|
let decodedData = void 0;
|
|
6987
6987
|
let metaMessages;
|
|
6988
6988
|
let reason;
|
|
6989
6989
|
if (data && data !== "0x") {
|
|
6990
6990
|
try {
|
|
6991
|
-
decodedData = decodeErrorResult({ abi:
|
|
6991
|
+
decodedData = decodeErrorResult({ abi: abi25, data });
|
|
6992
6992
|
const { abiItem, errorName, args: errorArgs } = decodedData;
|
|
6993
6993
|
if (errorName === "Error") {
|
|
6994
6994
|
reason = errorArgs[0];
|
|
@@ -10595,10 +10595,10 @@ var init_isAddressEqual = __esm({
|
|
|
10595
10595
|
|
|
10596
10596
|
// ../../node_modules/viem/_esm/utils/abi/decodeFunctionResult.js
|
|
10597
10597
|
function decodeFunctionResult(parameters) {
|
|
10598
|
-
const { abi:
|
|
10599
|
-
let abiItem =
|
|
10598
|
+
const { abi: abi25, args, functionName, data } = parameters;
|
|
10599
|
+
let abiItem = abi25[0];
|
|
10600
10600
|
if (functionName) {
|
|
10601
|
-
const item = getAbiItem({ abi:
|
|
10601
|
+
const item = getAbiItem({ abi: abi25, args, name: functionName });
|
|
10602
10602
|
if (!item)
|
|
10603
10603
|
throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath4 });
|
|
10604
10604
|
abiItem = item;
|
|
@@ -11434,10 +11434,10 @@ var init_chain = __esm({
|
|
|
11434
11434
|
|
|
11435
11435
|
// ../../node_modules/viem/_esm/utils/abi/encodeDeployData.js
|
|
11436
11436
|
function encodeDeployData(parameters) {
|
|
11437
|
-
const { abi:
|
|
11437
|
+
const { abi: abi25, args, bytecode } = parameters;
|
|
11438
11438
|
if (!args || args.length === 0)
|
|
11439
11439
|
return bytecode;
|
|
11440
|
-
const description =
|
|
11440
|
+
const description = abi25.find((x) => "type" in x && x.type === "constructor");
|
|
11441
11441
|
if (!description)
|
|
11442
11442
|
throw new AbiConstructorNotFoundError({ docsPath: docsPath5 });
|
|
11443
11443
|
if (!("inputs" in description))
|
|
@@ -21294,13 +21294,13 @@ var require_interface = __commonJS({
|
|
|
21294
21294
|
function Interface2(fragments) {
|
|
21295
21295
|
var _newTarget = this.constructor;
|
|
21296
21296
|
var _this = this;
|
|
21297
|
-
var
|
|
21297
|
+
var abi25 = [];
|
|
21298
21298
|
if (typeof fragments === "string") {
|
|
21299
|
-
|
|
21299
|
+
abi25 = JSON.parse(fragments);
|
|
21300
21300
|
} else {
|
|
21301
|
-
|
|
21301
|
+
abi25 = fragments;
|
|
21302
21302
|
}
|
|
21303
|
-
(0, properties_1.defineReadOnly)(this, "fragments",
|
|
21303
|
+
(0, properties_1.defineReadOnly)(this, "fragments", abi25.map(function(fragment) {
|
|
21304
21304
|
return fragments_1.Fragment.from(fragment);
|
|
21305
21305
|
}).filter(function(fragment) {
|
|
21306
21306
|
return fragment != null;
|
|
@@ -21354,15 +21354,15 @@ var require_interface = __commonJS({
|
|
|
21354
21354
|
if (format === fragments_1.FormatTypes.sighash) {
|
|
21355
21355
|
logger2.throwArgumentError("interface does not support formatting sighash", "format", format);
|
|
21356
21356
|
}
|
|
21357
|
-
var
|
|
21357
|
+
var abi25 = this.fragments.map(function(fragment) {
|
|
21358
21358
|
return fragment.format(format);
|
|
21359
21359
|
});
|
|
21360
21360
|
if (format === fragments_1.FormatTypes.json) {
|
|
21361
|
-
return JSON.stringify(
|
|
21361
|
+
return JSON.stringify(abi25.map(function(j) {
|
|
21362
21362
|
return JSON.parse(j);
|
|
21363
21363
|
}));
|
|
21364
21364
|
}
|
|
21365
|
-
return
|
|
21365
|
+
return abi25;
|
|
21366
21366
|
};
|
|
21367
21367
|
Interface2.getAbiCoder = function() {
|
|
21368
21368
|
return abi_coder_1.defaultAbiCoder;
|
|
@@ -37061,14 +37061,14 @@ var require_lib29 = __commonJS({
|
|
|
37061
37061
|
if (typeof compilerOutput === "string") {
|
|
37062
37062
|
compilerOutput = JSON.parse(compilerOutput);
|
|
37063
37063
|
}
|
|
37064
|
-
var
|
|
37064
|
+
var abi25 = compilerOutput.abi;
|
|
37065
37065
|
var bytecode = null;
|
|
37066
37066
|
if (compilerOutput.bytecode) {
|
|
37067
37067
|
bytecode = compilerOutput.bytecode;
|
|
37068
37068
|
} else if (compilerOutput.evm && compilerOutput.evm.bytecode) {
|
|
37069
37069
|
bytecode = compilerOutput.evm.bytecode;
|
|
37070
37070
|
}
|
|
37071
|
-
return new this(
|
|
37071
|
+
return new this(abi25, bytecode, signer);
|
|
37072
37072
|
};
|
|
37073
37073
|
ContractFactory2.getInterface = function(contractInterface) {
|
|
37074
37074
|
return Contract.getInterface(contractInterface);
|
|
@@ -50175,7 +50175,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
50175
50175
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
50176
50176
|
var vars = process.config && process.config.variables || {};
|
|
50177
50177
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
50178
|
-
var
|
|
50178
|
+
var abi25 = process.versions.modules;
|
|
50179
50179
|
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
50180
50180
|
var arch = process.env.npm_config_arch || os2.arch();
|
|
50181
50181
|
var platform = process.env.npm_config_platform || os2.platform();
|
|
@@ -50207,7 +50207,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
50207
50207
|
"platform=" + platform,
|
|
50208
50208
|
"arch=" + arch,
|
|
50209
50209
|
"runtime=" + runtime,
|
|
50210
|
-
"abi=" +
|
|
50210
|
+
"abi=" + abi25,
|
|
50211
50211
|
"uv=" + uv,
|
|
50212
50212
|
armv ? "armv=" + armv : "",
|
|
50213
50213
|
"libc=" + libc,
|
|
@@ -50223,7 +50223,7 @@ var require_node_gyp_build = __commonJS({
|
|
|
50223
50223
|
if (!tuple) return;
|
|
50224
50224
|
var prebuilds = path12.join(dir2, "prebuilds", tuple.name);
|
|
50225
50225
|
var parsed = readdirSync(prebuilds).map(parseTags);
|
|
50226
|
-
var candidates = parsed.filter(matchTags(runtime,
|
|
50226
|
+
var candidates = parsed.filter(matchTags(runtime, abi25));
|
|
50227
50227
|
var winner = candidates.sort(compareTags(runtime))[0];
|
|
50228
50228
|
if (winner) return path12.join(prebuilds, winner.file);
|
|
50229
50229
|
}
|
|
@@ -50288,11 +50288,11 @@ var require_node_gyp_build = __commonJS({
|
|
|
50288
50288
|
}
|
|
50289
50289
|
return tags;
|
|
50290
50290
|
}
|
|
50291
|
-
function matchTags(runtime2,
|
|
50291
|
+
function matchTags(runtime2, abi26) {
|
|
50292
50292
|
return function(tags) {
|
|
50293
50293
|
if (tags == null) return false;
|
|
50294
50294
|
if (tags.runtime && tags.runtime !== runtime2 && !runtimeAgnostic(tags)) return false;
|
|
50295
|
-
if (tags.abi && tags.abi !==
|
|
50295
|
+
if (tags.abi && tags.abi !== abi26 && !tags.napi) return false;
|
|
50296
50296
|
if (tags.uv && tags.uv !== uv) return false;
|
|
50297
50297
|
if (tags.armv && tags.armv !== armv) return false;
|
|
50298
50298
|
if (tags.libc && tags.libc !== libc) return false;
|
|
@@ -113406,17 +113406,17 @@ var require_interface2 = __commonJS({
|
|
|
113406
113406
|
* Create a new Interface for the %%fragments%%.
|
|
113407
113407
|
*/
|
|
113408
113408
|
constructor(fragments) {
|
|
113409
|
-
let
|
|
113409
|
+
let abi25 = [];
|
|
113410
113410
|
if (typeof fragments === "string") {
|
|
113411
|
-
|
|
113411
|
+
abi25 = JSON.parse(fragments);
|
|
113412
113412
|
} else {
|
|
113413
|
-
|
|
113413
|
+
abi25 = fragments;
|
|
113414
113414
|
}
|
|
113415
113415
|
this.#functions = /* @__PURE__ */ new Map();
|
|
113416
113416
|
this.#errors = /* @__PURE__ */ new Map();
|
|
113417
113417
|
this.#events = /* @__PURE__ */ new Map();
|
|
113418
113418
|
const frags = [];
|
|
113419
|
-
for (const a of
|
|
113419
|
+
for (const a of abi25) {
|
|
113420
113420
|
try {
|
|
113421
113421
|
frags.push(fragments_js_1.Fragment.from(a));
|
|
113422
113422
|
} catch (error) {
|
|
@@ -113480,16 +113480,16 @@ var require_interface2 = __commonJS({
|
|
|
113480
113480
|
*/
|
|
113481
113481
|
format(minimal) {
|
|
113482
113482
|
const format = minimal ? "minimal" : "full";
|
|
113483
|
-
const
|
|
113484
|
-
return
|
|
113483
|
+
const abi25 = this.fragments.map((f) => f.format(format));
|
|
113484
|
+
return abi25;
|
|
113485
113485
|
}
|
|
113486
113486
|
/**
|
|
113487
113487
|
* Return the JSON-encoded ABI. This is the format Solidiy
|
|
113488
113488
|
* returns.
|
|
113489
113489
|
*/
|
|
113490
113490
|
formatJson() {
|
|
113491
|
-
const
|
|
113492
|
-
return JSON.stringify(
|
|
113491
|
+
const abi25 = this.fragments.map((f) => f.format("json"));
|
|
113492
|
+
return JSON.stringify(abi25.map((j) => JSON.parse(j)));
|
|
113493
113493
|
}
|
|
113494
113494
|
/**
|
|
113495
113495
|
* The ABI coder that will be used to encode and decode binary
|
|
@@ -116257,12 +116257,12 @@ var require_contract = __commonJS({
|
|
|
116257
116257
|
* optionally connected to a %%runner%% to perform operations on behalf
|
|
116258
116258
|
* of.
|
|
116259
116259
|
*/
|
|
116260
|
-
constructor(target,
|
|
116260
|
+
constructor(target, abi25, runner, _deployTx) {
|
|
116261
116261
|
(0, index_js_3.assertArgument)(typeof target === "string" || (0, index_js_2.isAddressable)(target), "invalid value for Contract target", "target", target);
|
|
116262
116262
|
if (runner == null) {
|
|
116263
116263
|
runner = null;
|
|
116264
116264
|
}
|
|
116265
|
-
const iface = index_js_1.Interface.from(
|
|
116265
|
+
const iface = index_js_1.Interface.from(abi25);
|
|
116266
116266
|
(0, index_js_3.defineProperties)(this, { target, runner, interface: iface });
|
|
116267
116267
|
Object.defineProperty(this, internal, { value: {} });
|
|
116268
116268
|
let addrPromise;
|
|
@@ -116625,10 +116625,10 @@ var require_contract = __commonJS({
|
|
|
116625
116625
|
/**
|
|
116626
116626
|
* Create a new Class for the %%abi%%.
|
|
116627
116627
|
*/
|
|
116628
|
-
static buildClass(
|
|
116628
|
+
static buildClass(abi25) {
|
|
116629
116629
|
class CustomContract extends _BaseContract {
|
|
116630
116630
|
constructor(address, runner = null) {
|
|
116631
|
-
super(address,
|
|
116631
|
+
super(address, abi25, runner);
|
|
116632
116632
|
}
|
|
116633
116633
|
}
|
|
116634
116634
|
return CustomContract;
|
|
@@ -116636,11 +116636,11 @@ var require_contract = __commonJS({
|
|
|
116636
116636
|
/**
|
|
116637
116637
|
* Create a new BaseContract with a specified Interface.
|
|
116638
116638
|
*/
|
|
116639
|
-
static from(target,
|
|
116639
|
+
static from(target, abi25, runner) {
|
|
116640
116640
|
if (runner == null) {
|
|
116641
116641
|
runner = null;
|
|
116642
116642
|
}
|
|
116643
|
-
const contract = new this(target,
|
|
116643
|
+
const contract = new this(target, abi25, runner);
|
|
116644
116644
|
return contract;
|
|
116645
116645
|
}
|
|
116646
116646
|
};
|
|
@@ -116684,8 +116684,8 @@ var require_factory = __commonJS({
|
|
|
116684
116684
|
* The %%bytecode%% may be the ``bytecode`` property within the
|
|
116685
116685
|
* standard Solidity JSON output.
|
|
116686
116686
|
*/
|
|
116687
|
-
constructor(
|
|
116688
|
-
const iface = index_js_1.Interface.from(
|
|
116687
|
+
constructor(abi25, bytecode, runner) {
|
|
116688
|
+
const iface = index_js_1.Interface.from(abi25);
|
|
116689
116689
|
if (bytecode instanceof Uint8Array) {
|
|
116690
116690
|
bytecode = (0, index_js_3.hexlify)((0, index_js_3.getBytes)(bytecode));
|
|
116691
116691
|
} else {
|
|
@@ -116755,14 +116755,14 @@ var require_factory = __commonJS({
|
|
|
116755
116755
|
if (typeof output === "string") {
|
|
116756
116756
|
output = JSON.parse(output);
|
|
116757
116757
|
}
|
|
116758
|
-
const
|
|
116758
|
+
const abi25 = output.abi;
|
|
116759
116759
|
let bytecode = "";
|
|
116760
116760
|
if (output.bytecode) {
|
|
116761
116761
|
bytecode = output.bytecode;
|
|
116762
116762
|
} else if (output.evm && output.evm.bytecode) {
|
|
116763
116763
|
bytecode = output.evm.bytecode;
|
|
116764
116764
|
}
|
|
116765
|
-
return new this(
|
|
116765
|
+
return new this(abi25, bytecode, runner);
|
|
116766
116766
|
}
|
|
116767
116767
|
};
|
|
116768
116768
|
exports2.ContractFactory = ContractFactory;
|
|
@@ -121690,8 +121690,8 @@ var require_provider_etherscan = __commonJS({
|
|
|
121690
121690
|
action: "getabi",
|
|
121691
121691
|
address
|
|
121692
121692
|
});
|
|
121693
|
-
const
|
|
121694
|
-
return new index_js_2.Contract(address,
|
|
121693
|
+
const abi25 = JSON.parse(resp);
|
|
121694
|
+
return new index_js_2.Contract(address, abi25, this);
|
|
121695
121695
|
} catch (error) {
|
|
121696
121696
|
return null;
|
|
121697
121697
|
}
|
|
@@ -147255,9 +147255,9 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
147255
147255
|
var vars = process.config && process.config.variables || {};
|
|
147256
147256
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
147257
147257
|
var versions = process.versions;
|
|
147258
|
-
var
|
|
147258
|
+
var abi25 = versions.modules;
|
|
147259
147259
|
if (versions.deno || process.isBun) {
|
|
147260
|
-
|
|
147260
|
+
abi25 = "unsupported";
|
|
147261
147261
|
}
|
|
147262
147262
|
var runtime = isElectron() ? "electron" : "node";
|
|
147263
147263
|
var arch = process.arch;
|
|
@@ -147304,7 +147304,7 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
147304
147304
|
"platform=" + platform,
|
|
147305
147305
|
"arch=" + arch,
|
|
147306
147306
|
"runtime=" + runtime,
|
|
147307
|
-
"abi=" +
|
|
147307
|
+
"abi=" + abi25,
|
|
147308
147308
|
"uv=" + uv,
|
|
147309
147309
|
armv ? "armv=" + armv : "",
|
|
147310
147310
|
"libc=" + libc,
|
|
@@ -147322,7 +147322,7 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
147322
147322
|
}
|
|
147323
147323
|
function resolveFile(prebuilds) {
|
|
147324
147324
|
var parsed = readdirSync(prebuilds).map(parseTags);
|
|
147325
|
-
var candidates = parsed.filter(matchTags(runtime,
|
|
147325
|
+
var candidates = parsed.filter(matchTags(runtime, abi25));
|
|
147326
147326
|
var winner = candidates.sort(compareTags(runtime))[0];
|
|
147327
147327
|
if (winner) return path12.join(prebuilds, winner.file);
|
|
147328
147328
|
}
|
|
@@ -147387,11 +147387,11 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
147387
147387
|
}
|
|
147388
147388
|
return tags;
|
|
147389
147389
|
}
|
|
147390
|
-
function matchTags(runtime2,
|
|
147390
|
+
function matchTags(runtime2, abi26) {
|
|
147391
147391
|
return function(tags) {
|
|
147392
147392
|
if (tags == null) return false;
|
|
147393
147393
|
if (tags.runtime !== runtime2 && !runtimeAgnostic(tags)) return false;
|
|
147394
|
-
if (tags.abi !==
|
|
147394
|
+
if (tags.abi !== abi26 && !tags.napi) return false;
|
|
147395
147395
|
if (tags.uv && tags.uv !== uv) return false;
|
|
147396
147396
|
if (tags.armv && tags.armv !== armv) return false;
|
|
147397
147397
|
if (tags.libc && tags.libc !== libc) return false;
|
|
@@ -153416,11 +153416,11 @@ var require_formatAbi = __commonJS({
|
|
|
153416
153416
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
153417
153417
|
exports2.formatAbi = formatAbi;
|
|
153418
153418
|
var formatAbiItem_js_1 = require_formatAbiItem();
|
|
153419
|
-
function formatAbi(
|
|
153419
|
+
function formatAbi(abi25) {
|
|
153420
153420
|
const signatures = [];
|
|
153421
|
-
const length =
|
|
153421
|
+
const length = abi25.length;
|
|
153422
153422
|
for (let i = 0; i < length; i++) {
|
|
153423
|
-
const abiItem =
|
|
153423
|
+
const abiItem = abi25[i];
|
|
153424
153424
|
const signature = (0, formatAbiItem_js_1.formatAbiItem)(abiItem);
|
|
153425
153425
|
signatures.push(signature);
|
|
153426
153426
|
}
|
|
@@ -154183,15 +154183,15 @@ var require_parseAbi = __commonJS({
|
|
|
154183
154183
|
var utils_js_1 = require_utils14();
|
|
154184
154184
|
function parseAbi2(signatures) {
|
|
154185
154185
|
const structs = (0, structs_js_1.parseStructs)(signatures);
|
|
154186
|
-
const
|
|
154186
|
+
const abi25 = [];
|
|
154187
154187
|
const length = signatures.length;
|
|
154188
154188
|
for (let i = 0; i < length; i++) {
|
|
154189
154189
|
const signature = signatures[i];
|
|
154190
154190
|
if ((0, signatures_js_1.isStructSignature)(signature))
|
|
154191
154191
|
continue;
|
|
154192
|
-
|
|
154192
|
+
abi25.push((0, utils_js_1.parseSignature)(signature, structs));
|
|
154193
154193
|
}
|
|
154194
|
-
return
|
|
154194
|
+
return abi25;
|
|
154195
154195
|
}
|
|
154196
154196
|
}
|
|
154197
154197
|
});
|
|
@@ -163983,9 +163983,9 @@ var require_getAbiItem = __commonJS({
|
|
|
163983
163983
|
var toEventSelector_js_1 = require_toEventSelector();
|
|
163984
163984
|
var toFunctionSelector_js_1 = require_toFunctionSelector();
|
|
163985
163985
|
function getAbiItem2(parameters) {
|
|
163986
|
-
const { abi:
|
|
163986
|
+
const { abi: abi25, args = [], name } = parameters;
|
|
163987
163987
|
const isSelector = (0, isHex_js_1.isHex)(name, { strict: false });
|
|
163988
|
-
const abiItems =
|
|
163988
|
+
const abiItems = abi25.filter((abiItem) => {
|
|
163989
163989
|
if (isSelector) {
|
|
163990
163990
|
if (abiItem.type === "function")
|
|
163991
163991
|
return (0, toFunctionSelector_js_1.toFunctionSelector)(abiItem) === name;
|
|
@@ -164110,10 +164110,10 @@ var require_encodeEventTopics = __commonJS({
|
|
|
164110
164110
|
var getAbiItem_js_1 = require_getAbiItem();
|
|
164111
164111
|
var docsPath6 = "/docs/contract/encodeEventTopics";
|
|
164112
164112
|
function encodeEventTopics2(parameters) {
|
|
164113
|
-
const { abi:
|
|
164114
|
-
let abiItem =
|
|
164113
|
+
const { abi: abi25, eventName, args } = parameters;
|
|
164114
|
+
let abiItem = abi25[0];
|
|
164115
164115
|
if (eventName) {
|
|
164116
|
-
const item = (0, getAbiItem_js_1.getAbiItem)({ abi:
|
|
164116
|
+
const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi25, name: eventName });
|
|
164117
164117
|
if (!item)
|
|
164118
164118
|
throw new abi_js_1.AbiEventNotFoundError(eventName, { docsPath: docsPath6 });
|
|
164119
164119
|
abiItem = item;
|
|
@@ -164174,12 +164174,12 @@ var require_createContractEventFilter = __commonJS({
|
|
|
164174
164174
|
var toHex_js_1 = require_toHex();
|
|
164175
164175
|
var createFilterRequestScope_js_1 = require_createFilterRequestScope();
|
|
164176
164176
|
async function createContractEventFilter2(client, parameters) {
|
|
164177
|
-
const { address, abi:
|
|
164177
|
+
const { address, abi: abi25, args, eventName, fromBlock, strict, toBlock } = parameters;
|
|
164178
164178
|
const getRequest = (0, createFilterRequestScope_js_1.createFilterRequestScope)(client, {
|
|
164179
164179
|
method: "eth_newFilter"
|
|
164180
164180
|
});
|
|
164181
164181
|
const topics = eventName ? (0, encodeEventTopics_js_1.encodeEventTopics)({
|
|
164182
|
-
abi:
|
|
164182
|
+
abi: abi25,
|
|
164183
164183
|
args,
|
|
164184
164184
|
eventName
|
|
164185
164185
|
}) : void 0;
|
|
@@ -164195,7 +164195,7 @@ var require_createContractEventFilter = __commonJS({
|
|
|
164195
164195
|
]
|
|
164196
164196
|
});
|
|
164197
164197
|
return {
|
|
164198
|
-
abi:
|
|
164198
|
+
abi: abi25,
|
|
164199
164199
|
args,
|
|
164200
164200
|
eventName,
|
|
164201
164201
|
id,
|
|
@@ -164233,11 +164233,11 @@ var require_prepareEncodeFunctionData = __commonJS({
|
|
|
164233
164233
|
var getAbiItem_js_1 = require_getAbiItem();
|
|
164234
164234
|
var docsPath6 = "/docs/contract/encodeFunctionData";
|
|
164235
164235
|
function prepareEncodeFunctionData2(parameters) {
|
|
164236
|
-
const { abi:
|
|
164237
|
-
let abiItem =
|
|
164236
|
+
const { abi: abi25, args, functionName } = parameters;
|
|
164237
|
+
let abiItem = abi25[0];
|
|
164238
164238
|
if (functionName) {
|
|
164239
164239
|
const item = (0, getAbiItem_js_1.getAbiItem)({
|
|
164240
|
-
abi:
|
|
164240
|
+
abi: abi25,
|
|
164241
164241
|
args,
|
|
164242
164242
|
name: functionName
|
|
164243
164243
|
});
|
|
@@ -164266,12 +164266,12 @@ var require_encodeFunctionData = __commonJS({
|
|
|
164266
164266
|
var prepareEncodeFunctionData_js_1 = require_prepareEncodeFunctionData();
|
|
164267
164267
|
function encodeFunctionData2(parameters) {
|
|
164268
164268
|
const { args } = parameters;
|
|
164269
|
-
const { abi:
|
|
164269
|
+
const { abi: abi25, functionName } = (() => {
|
|
164270
164270
|
if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
|
|
164271
164271
|
return parameters;
|
|
164272
164272
|
return (0, prepareEncodeFunctionData_js_1.prepareEncodeFunctionData)(parameters);
|
|
164273
164273
|
})();
|
|
164274
|
-
const abiItem =
|
|
164274
|
+
const abiItem = abi25[0];
|
|
164275
164275
|
const signature = functionName;
|
|
164276
164276
|
const data = "inputs" in abiItem && abiItem.inputs ? (0, encodeAbiParameters_js_1.encodeAbiParameters)(abiItem.inputs, args ?? []) : void 0;
|
|
164277
164277
|
return (0, concat_js_1.concatHex)([signature, data ?? "0x"]);
|
|
@@ -164803,11 +164803,11 @@ var require_decodeErrorResult = __commonJS({
|
|
|
164803
164803
|
var decodeAbiParameters_js_1 = require_decodeAbiParameters();
|
|
164804
164804
|
var formatAbiItem_js_1 = require_formatAbiItem2();
|
|
164805
164805
|
function decodeErrorResult2(parameters) {
|
|
164806
|
-
const { abi:
|
|
164806
|
+
const { abi: abi25, data } = parameters;
|
|
164807
164807
|
const signature = (0, slice_js_1.slice)(data, 0, 4);
|
|
164808
164808
|
if (signature === "0x")
|
|
164809
164809
|
throw new abi_js_1.AbiDecodingZeroDataError();
|
|
164810
|
-
const abi_ = [...
|
|
164810
|
+
const abi_ = [...abi25 || [], solidity_js_1.solidityError, solidity_js_1.solidityPanic];
|
|
164811
164811
|
const abiItem = abi_.find((x) => x.type === "error" && signature === (0, toFunctionSelector_js_1.toFunctionSelector)((0, formatAbiItem_js_1.formatAbiItem)(x)));
|
|
164812
164812
|
if (!abiItem)
|
|
164813
164813
|
throw new abi_js_1.AbiErrorSignatureNotFoundError(signature, {
|
|
@@ -165229,8 +165229,8 @@ ${(0, stateOverride_js_1.prettyStateOverride)(stateOverride)}`;
|
|
|
165229
165229
|
};
|
|
165230
165230
|
exports2.CallExecutionError = CallExecutionError2;
|
|
165231
165231
|
var ContractFunctionExecutionError2 = class extends base_js_1.BaseError {
|
|
165232
|
-
constructor(cause, { abi:
|
|
165233
|
-
const abiItem = (0, getAbiItem_js_1.getAbiItem)({ abi:
|
|
165232
|
+
constructor(cause, { abi: abi25, args, contractAddress, docsPath: docsPath6, functionName, sender }) {
|
|
165233
|
+
const abiItem = (0, getAbiItem_js_1.getAbiItem)({ abi: abi25, args, name: functionName });
|
|
165234
165234
|
const formattedArgs = abiItem ? (0, formatAbiItemWithArgs_js_1.formatAbiItemWithArgs)({
|
|
165235
165235
|
abiItem,
|
|
165236
165236
|
args,
|
|
@@ -165296,7 +165296,7 @@ ${(0, stateOverride_js_1.prettyStateOverride)(stateOverride)}`;
|
|
|
165296
165296
|
writable: true,
|
|
165297
165297
|
value: void 0
|
|
165298
165298
|
});
|
|
165299
|
-
this.abi =
|
|
165299
|
+
this.abi = abi25;
|
|
165300
165300
|
this.args = args;
|
|
165301
165301
|
this.cause = cause;
|
|
165302
165302
|
this.contractAddress = contractAddress;
|
|
@@ -165306,14 +165306,14 @@ ${(0, stateOverride_js_1.prettyStateOverride)(stateOverride)}`;
|
|
|
165306
165306
|
};
|
|
165307
165307
|
exports2.ContractFunctionExecutionError = ContractFunctionExecutionError2;
|
|
165308
165308
|
var ContractFunctionRevertedError2 = class extends base_js_1.BaseError {
|
|
165309
|
-
constructor({ abi:
|
|
165309
|
+
constructor({ abi: abi25, data, functionName, message }) {
|
|
165310
165310
|
let cause;
|
|
165311
165311
|
let decodedData = void 0;
|
|
165312
165312
|
let metaMessages;
|
|
165313
165313
|
let reason;
|
|
165314
165314
|
if (data && data !== "0x") {
|
|
165315
165315
|
try {
|
|
165316
|
-
decodedData = (0, decodeErrorResult_js_1.decodeErrorResult)({ abi:
|
|
165316
|
+
decodedData = (0, decodeErrorResult_js_1.decodeErrorResult)({ abi: abi25, data });
|
|
165317
165317
|
const { abiItem, errorName, args: errorArgs } = decodedData;
|
|
165318
165318
|
if (errorName === "Error") {
|
|
165319
165319
|
reason = errorArgs[0];
|
|
@@ -165913,7 +165913,7 @@ var require_getContractError = __commonJS({
|
|
|
165913
165913
|
var request_js_1 = require_request();
|
|
165914
165914
|
var rpc_js_1 = require_rpc();
|
|
165915
165915
|
var EXECUTION_REVERTED_ERROR_CODE2 = 3;
|
|
165916
|
-
function getContractError2(err, { abi:
|
|
165916
|
+
function getContractError2(err, { abi: abi25, address, args, docsPath: docsPath6, functionName, sender }) {
|
|
165917
165917
|
const error = err instanceof contract_js_1.RawContractError ? err : err instanceof base_js_1.BaseError ? err.walk((err2) => "data" in err2) || err.walk() : {};
|
|
165918
165918
|
const { code, data, details, message, shortMessage } = error;
|
|
165919
165919
|
const cause = (() => {
|
|
@@ -165921,7 +165921,7 @@ var require_getContractError = __commonJS({
|
|
|
165921
165921
|
return new contract_js_1.ContractFunctionZeroDataError({ functionName });
|
|
165922
165922
|
if ([EXECUTION_REVERTED_ERROR_CODE2, rpc_js_1.InternalRpcError.code].includes(code) && (data || details || message || shortMessage)) {
|
|
165923
165923
|
return new contract_js_1.ContractFunctionRevertedError({
|
|
165924
|
-
abi:
|
|
165924
|
+
abi: abi25,
|
|
165925
165925
|
data: typeof data === "object" ? data.data : data,
|
|
165926
165926
|
functionName,
|
|
165927
165927
|
message: error instanceof request_js_1.RpcRequestError ? details : shortMessage ?? message
|
|
@@ -165930,7 +165930,7 @@ var require_getContractError = __commonJS({
|
|
|
165930
165930
|
return err;
|
|
165931
165931
|
})();
|
|
165932
165932
|
return new contract_js_1.ContractFunctionExecutionError(cause, {
|
|
165933
|
-
abi:
|
|
165933
|
+
abi: abi25,
|
|
165934
165934
|
args,
|
|
165935
165935
|
contractAddress: address,
|
|
165936
165936
|
docsPath: docsPath6,
|
|
@@ -170397,9 +170397,9 @@ var require_estimateContractGas = __commonJS({
|
|
|
170397
170397
|
var getAction_js_1 = require_getAction();
|
|
170398
170398
|
var estimateGas_js_1 = require_estimateGas2();
|
|
170399
170399
|
async function estimateContractGas2(client, parameters) {
|
|
170400
|
-
const { abi:
|
|
170400
|
+
const { abi: abi25, address, args, functionName, dataSuffix, ...request } = parameters;
|
|
170401
170401
|
const data = (0, encodeFunctionData_js_1.encodeFunctionData)({
|
|
170402
|
-
abi:
|
|
170402
|
+
abi: abi25,
|
|
170403
170403
|
args,
|
|
170404
170404
|
functionName
|
|
170405
170405
|
});
|
|
@@ -170413,7 +170413,7 @@ var require_estimateContractGas = __commonJS({
|
|
|
170413
170413
|
} catch (error) {
|
|
170414
170414
|
const account = request.account ? (0, parseAccount_js_1.parseAccount)(request.account) : void 0;
|
|
170415
170415
|
throw (0, getContractError_js_1.getContractError)(error, {
|
|
170416
|
-
abi:
|
|
170416
|
+
abi: abi25,
|
|
170417
170417
|
address,
|
|
170418
170418
|
args,
|
|
170419
170419
|
docsPath: "/docs/contract/estimateContractGas",
|
|
@@ -170457,15 +170457,15 @@ var require_decodeEventLog = __commonJS({
|
|
|
170457
170457
|
var formatAbiItem_js_1 = require_formatAbiItem2();
|
|
170458
170458
|
var docsPath6 = "/docs/contract/decodeEventLog";
|
|
170459
170459
|
function decodeEventLog2(parameters) {
|
|
170460
|
-
const { abi:
|
|
170460
|
+
const { abi: abi25, data, strict: strict_, topics } = parameters;
|
|
170461
170461
|
const strict = strict_ ?? true;
|
|
170462
170462
|
const [signature, ...argTopics] = topics;
|
|
170463
170463
|
if (!signature)
|
|
170464
170464
|
throw new abi_js_1.AbiEventSignatureEmptyTopicsError({ docsPath: docsPath6 });
|
|
170465
170465
|
const abiItem = (() => {
|
|
170466
|
-
if (
|
|
170467
|
-
return
|
|
170468
|
-
return
|
|
170466
|
+
if (abi25.length === 1)
|
|
170467
|
+
return abi25[0];
|
|
170468
|
+
return abi25.find((x) => x.type === "event" && signature === (0, toEventSelector_js_1.toEventSelector)((0, formatAbiItem_js_1.formatAbiItem)(x)));
|
|
170469
170469
|
})();
|
|
170470
170470
|
if (!(abiItem && "name" in abiItem) || abiItem.type !== "event")
|
|
170471
170471
|
throw new abi_js_1.AbiEventSignatureNotFoundError(signature, { docsPath: docsPath6 });
|
|
@@ -170545,7 +170545,7 @@ var require_parseEventLogs = __commonJS({
|
|
|
170545
170545
|
var toEventSelector_js_1 = require_toEventSelector();
|
|
170546
170546
|
var decodeEventLog_js_1 = require_decodeEventLog();
|
|
170547
170547
|
function parseEventLogs2(parameters) {
|
|
170548
|
-
const { abi:
|
|
170548
|
+
const { abi: abi25, args, logs, strict = true } = parameters;
|
|
170549
170549
|
const eventName = (() => {
|
|
170550
170550
|
if (!parameters.eventName)
|
|
170551
170551
|
return void 0;
|
|
@@ -170555,7 +170555,7 @@ var require_parseEventLogs = __commonJS({
|
|
|
170555
170555
|
})();
|
|
170556
170556
|
return logs.map((log2) => {
|
|
170557
170557
|
try {
|
|
170558
|
-
const abiItem =
|
|
170558
|
+
const abiItem = abi25.find((abiItem2) => abiItem2.type === "event" && log2.topics[0] === (0, toEventSelector_js_1.toEventSelector)(abiItem2));
|
|
170559
170559
|
if (!abiItem)
|
|
170560
170560
|
return null;
|
|
170561
170561
|
const event = (0, decodeEventLog_js_1.decodeEventLog)({
|
|
@@ -170716,9 +170716,9 @@ var require_getContractEvents = __commonJS({
|
|
|
170716
170716
|
var getAction_js_1 = require_getAction();
|
|
170717
170717
|
var getLogs_js_1 = require_getLogs();
|
|
170718
170718
|
async function getContractEvents2(client, parameters) {
|
|
170719
|
-
const { abi:
|
|
170720
|
-
const event = eventName ? (0, getAbiItem_js_1.getAbiItem)({ abi:
|
|
170721
|
-
const events = !event ?
|
|
170719
|
+
const { abi: abi25, address, args, blockHash, eventName, fromBlock, toBlock, strict } = parameters;
|
|
170720
|
+
const event = eventName ? (0, getAbiItem_js_1.getAbiItem)({ abi: abi25, name: eventName }) : void 0;
|
|
170721
|
+
const events = !event ? abi25.filter((x) => x.type === "event") : void 0;
|
|
170722
170722
|
return (0, getAction_js_1.getAction)(client, getLogs_js_1.getLogs, "getLogs")({
|
|
170723
170723
|
address,
|
|
170724
170724
|
args,
|
|
@@ -170744,10 +170744,10 @@ var require_decodeFunctionResult = __commonJS({
|
|
|
170744
170744
|
var getAbiItem_js_1 = require_getAbiItem();
|
|
170745
170745
|
var docsPath6 = "/docs/contract/decodeFunctionResult";
|
|
170746
170746
|
function decodeFunctionResult2(parameters) {
|
|
170747
|
-
const { abi:
|
|
170748
|
-
let abiItem =
|
|
170747
|
+
const { abi: abi25, args, functionName, data } = parameters;
|
|
170748
|
+
let abiItem = abi25[0];
|
|
170749
170749
|
if (functionName) {
|
|
170750
|
-
const item = (0, getAbiItem_js_1.getAbiItem)({ abi:
|
|
170750
|
+
const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi25, args, name: functionName });
|
|
170751
170751
|
if (!item)
|
|
170752
170752
|
throw new abi_js_1.AbiFunctionNotFoundError(functionName, { docsPath: docsPath6 });
|
|
170753
170753
|
abiItem = item;
|
|
@@ -172302,10 +172302,10 @@ var require_encodeDeployData = __commonJS({
|
|
|
172302
172302
|
var encodeAbiParameters_js_1 = require_encodeAbiParameters();
|
|
172303
172303
|
var docsPath6 = "/docs/contract/encodeDeployData";
|
|
172304
172304
|
function encodeDeployData2(parameters) {
|
|
172305
|
-
const { abi:
|
|
172305
|
+
const { abi: abi25, args, bytecode } = parameters;
|
|
172306
172306
|
if (!args || args.length === 0)
|
|
172307
172307
|
return bytecode;
|
|
172308
|
-
const description =
|
|
172308
|
+
const description = abi25.find((x) => "type" in x && x.type === "constructor");
|
|
172309
172309
|
if (!description)
|
|
172310
172310
|
throw new abi_js_1.AbiConstructorNotFoundError({ docsPath: docsPath6 });
|
|
172311
172311
|
if (!("inputs" in description))
|
|
@@ -172844,9 +172844,9 @@ var require_readContract = __commonJS({
|
|
|
172844
172844
|
var getAction_js_1 = require_getAction();
|
|
172845
172845
|
var call_js_1 = require_call();
|
|
172846
172846
|
async function readContract2(client, parameters) {
|
|
172847
|
-
const { abi:
|
|
172847
|
+
const { abi: abi25, address, args, functionName, ...rest } = parameters;
|
|
172848
172848
|
const calldata = (0, encodeFunctionData_js_1.encodeFunctionData)({
|
|
172849
|
-
abi:
|
|
172849
|
+
abi: abi25,
|
|
172850
172850
|
args,
|
|
172851
172851
|
functionName
|
|
172852
172852
|
});
|
|
@@ -172857,14 +172857,14 @@ var require_readContract = __commonJS({
|
|
|
172857
172857
|
to: address
|
|
172858
172858
|
});
|
|
172859
172859
|
return (0, decodeFunctionResult_js_1.decodeFunctionResult)({
|
|
172860
|
-
abi:
|
|
172860
|
+
abi: abi25,
|
|
172861
172861
|
args,
|
|
172862
172862
|
functionName,
|
|
172863
172863
|
data: data || "0x"
|
|
172864
172864
|
});
|
|
172865
172865
|
} catch (error) {
|
|
172866
172866
|
throw (0, getContractError_js_1.getContractError)(error, {
|
|
172867
|
-
abi:
|
|
172867
|
+
abi: abi25,
|
|
172868
172868
|
address,
|
|
172869
172869
|
args,
|
|
172870
172870
|
docsPath: "/docs/contract/readContract",
|
|
@@ -172888,9 +172888,9 @@ var require_simulateContract = __commonJS({
|
|
|
172888
172888
|
var getAction_js_1 = require_getAction();
|
|
172889
172889
|
var call_js_1 = require_call();
|
|
172890
172890
|
async function simulateContract2(client, parameters) {
|
|
172891
|
-
const { abi:
|
|
172891
|
+
const { abi: abi25, address, args, dataSuffix, functionName, ...callRequest } = parameters;
|
|
172892
172892
|
const account = callRequest.account ? (0, parseAccount_js_1.parseAccount)(callRequest.account) : client.account;
|
|
172893
|
-
const calldata = (0, encodeFunctionData_js_1.encodeFunctionData)({ abi:
|
|
172893
|
+
const calldata = (0, encodeFunctionData_js_1.encodeFunctionData)({ abi: abi25, args, functionName });
|
|
172894
172894
|
try {
|
|
172895
172895
|
const { data } = await (0, getAction_js_1.getAction)(client, call_js_1.call, "call")({
|
|
172896
172896
|
batch: false,
|
|
@@ -172900,12 +172900,12 @@ var require_simulateContract = __commonJS({
|
|
|
172900
172900
|
account
|
|
172901
172901
|
});
|
|
172902
172902
|
const result = (0, decodeFunctionResult_js_1.decodeFunctionResult)({
|
|
172903
|
-
abi:
|
|
172903
|
+
abi: abi25,
|
|
172904
172904
|
args,
|
|
172905
172905
|
functionName,
|
|
172906
172906
|
data: data || "0x"
|
|
172907
172907
|
});
|
|
172908
|
-
const minimizedAbi =
|
|
172908
|
+
const minimizedAbi = abi25.filter((abiItem) => "name" in abiItem && abiItem.name === parameters.functionName);
|
|
172909
172909
|
return {
|
|
172910
172910
|
result,
|
|
172911
172911
|
request: {
|
|
@@ -172920,7 +172920,7 @@ var require_simulateContract = __commonJS({
|
|
|
172920
172920
|
};
|
|
172921
172921
|
} catch (error) {
|
|
172922
172922
|
throw (0, getContractError_js_1.getContractError)(error, {
|
|
172923
|
-
abi:
|
|
172923
|
+
abi: abi25,
|
|
172924
172924
|
address,
|
|
172925
172925
|
args,
|
|
172926
172926
|
docsPath: "/docs/contract/simulateContract",
|
|
@@ -173162,7 +173162,7 @@ var require_watchContractEvent = __commonJS({
|
|
|
173162
173162
|
var getFilterChanges_js_1 = require_getFilterChanges();
|
|
173163
173163
|
var uninstallFilter_js_1 = require_uninstallFilter();
|
|
173164
173164
|
function watchContractEvent2(client, parameters) {
|
|
173165
|
-
const { abi:
|
|
173165
|
+
const { abi: abi25, address, args, batch = true, eventName, fromBlock, onError, onLogs, poll: poll_, pollingInterval = client.pollingInterval, strict: strict_ } = parameters;
|
|
173166
173166
|
const enablePolling = (() => {
|
|
173167
173167
|
if (typeof poll_ !== "undefined")
|
|
173168
173168
|
return poll_;
|
|
@@ -173197,7 +173197,7 @@ var require_watchContractEvent = __commonJS({
|
|
|
173197
173197
|
if (!initialized) {
|
|
173198
173198
|
try {
|
|
173199
173199
|
filter = await (0, getAction_js_1.getAction)(client, createContractEventFilter_js_1.createContractEventFilter, "createContractEventFilter")({
|
|
173200
|
-
abi:
|
|
173200
|
+
abi: abi25,
|
|
173201
173201
|
address,
|
|
173202
173202
|
args,
|
|
173203
173203
|
eventName,
|
|
@@ -173217,7 +173217,7 @@ var require_watchContractEvent = __commonJS({
|
|
|
173217
173217
|
const blockNumber = await (0, getAction_js_1.getAction)(client, getBlockNumber_js_1.getBlockNumber, "getBlockNumber")({});
|
|
173218
173218
|
if (previousBlockNumber && previousBlockNumber < blockNumber) {
|
|
173219
173219
|
logs = await (0, getAction_js_1.getAction)(client, getContractEvents_js_1.getContractEvents, "getContractEvents")({
|
|
173220
|
-
abi:
|
|
173220
|
+
abi: abi25,
|
|
173221
173221
|
address,
|
|
173222
173222
|
args,
|
|
173223
173223
|
eventName,
|
|
@@ -173281,7 +173281,7 @@ var require_watchContractEvent = __commonJS({
|
|
|
173281
173281
|
return client.transport;
|
|
173282
173282
|
})();
|
|
173283
173283
|
const topics = eventName ? (0, encodeEventTopics_js_1.encodeEventTopics)({
|
|
173284
|
-
abi:
|
|
173284
|
+
abi: abi25,
|
|
173285
173285
|
eventName,
|
|
173286
173286
|
args
|
|
173287
173287
|
}) : [];
|
|
@@ -173293,7 +173293,7 @@ var require_watchContractEvent = __commonJS({
|
|
|
173293
173293
|
const log2 = data.result;
|
|
173294
173294
|
try {
|
|
173295
173295
|
const { eventName: eventName2, args: args2 } = (0, decodeEventLog_js_1.decodeEventLog)({
|
|
173296
|
-
abi:
|
|
173296
|
+
abi: abi25,
|
|
173297
173297
|
data: log2.data,
|
|
173298
173298
|
topics: log2.topics,
|
|
173299
173299
|
strict: strict_
|
|
@@ -173591,14 +173591,14 @@ var require_writeContract = __commonJS({
|
|
|
173591
173591
|
var getAction_js_1 = require_getAction();
|
|
173592
173592
|
var sendTransaction_js_1 = require_sendTransaction();
|
|
173593
173593
|
async function writeContract2(client, parameters) {
|
|
173594
|
-
const { abi:
|
|
173594
|
+
const { abi: abi25, account: account_ = client.account, address, args, dataSuffix, functionName, ...request } = parameters;
|
|
173595
173595
|
if (typeof account_ === "undefined")
|
|
173596
173596
|
throw new account_js_1.AccountNotFoundError({
|
|
173597
173597
|
docsPath: "/docs/contract/writeContract"
|
|
173598
173598
|
});
|
|
173599
173599
|
const account = account_ ? (0, parseAccount_js_1.parseAccount)(account_) : null;
|
|
173600
173600
|
const data = (0, encodeFunctionData_js_1.encodeFunctionData)({
|
|
173601
|
-
abi:
|
|
173601
|
+
abi: abi25,
|
|
173602
173602
|
args,
|
|
173603
173603
|
functionName
|
|
173604
173604
|
});
|
|
@@ -173611,7 +173611,7 @@ var require_writeContract = __commonJS({
|
|
|
173611
173611
|
});
|
|
173612
173612
|
} catch (error) {
|
|
173613
173613
|
throw (0, getContractError_js_1.getContractError)(error, {
|
|
173614
|
-
abi:
|
|
173614
|
+
abi: abi25,
|
|
173615
173615
|
address,
|
|
173616
173616
|
args,
|
|
173617
173617
|
docsPath: "/docs/contract/writeContract",
|
|
@@ -173639,7 +173639,7 @@ var require_getContract = __commonJS({
|
|
|
173639
173639
|
var simulateContract_js_1 = require_simulateContract();
|
|
173640
173640
|
var watchContractEvent_js_1 = require_watchContractEvent();
|
|
173641
173641
|
var writeContract_js_1 = require_writeContract();
|
|
173642
|
-
function getContract2({ abi:
|
|
173642
|
+
function getContract2({ abi: abi25, address, client: client_ }) {
|
|
173643
173643
|
const client = client_;
|
|
173644
173644
|
const [publicClient, walletClient] = (() => {
|
|
173645
173645
|
if (!client)
|
|
@@ -173658,7 +173658,7 @@ var require_getContract = __commonJS({
|
|
|
173658
173658
|
let hasReadFunction = false;
|
|
173659
173659
|
let hasWriteFunction = false;
|
|
173660
173660
|
let hasEvent = false;
|
|
173661
|
-
for (const item of
|
|
173661
|
+
for (const item of abi25) {
|
|
173662
173662
|
if (item.type === "function")
|
|
173663
173663
|
if (item.stateMutability === "view" || item.stateMutability === "pure")
|
|
173664
173664
|
hasReadFunction = true;
|
|
@@ -173676,7 +173676,7 @@ var require_getContract = __commonJS({
|
|
|
173676
173676
|
return (...parameters) => {
|
|
173677
173677
|
const { args, options } = getFunctionParameters2(parameters);
|
|
173678
173678
|
return (0, getAction_js_1.getAction)(publicClient, readContract_js_1.readContract, "readContract")({
|
|
173679
|
-
abi:
|
|
173679
|
+
abi: abi25,
|
|
173680
173680
|
address,
|
|
173681
173681
|
functionName,
|
|
173682
173682
|
args,
|
|
@@ -173691,7 +173691,7 @@ var require_getContract = __commonJS({
|
|
|
173691
173691
|
return (...parameters) => {
|
|
173692
173692
|
const { args, options } = getFunctionParameters2(parameters);
|
|
173693
173693
|
return (0, getAction_js_1.getAction)(publicClient, simulateContract_js_1.simulateContract, "simulateContract")({
|
|
173694
|
-
abi:
|
|
173694
|
+
abi: abi25,
|
|
173695
173695
|
address,
|
|
173696
173696
|
functionName,
|
|
173697
173697
|
args,
|
|
@@ -173704,10 +173704,10 @@ var require_getContract = __commonJS({
|
|
|
173704
173704
|
contract.createEventFilter = new Proxy({}, {
|
|
173705
173705
|
get(_, eventName) {
|
|
173706
173706
|
return (...parameters) => {
|
|
173707
|
-
const abiEvent =
|
|
173707
|
+
const abiEvent = abi25.find((x) => x.type === "event" && x.name === eventName);
|
|
173708
173708
|
const { args, options } = getEventParameters2(parameters, abiEvent);
|
|
173709
173709
|
return (0, getAction_js_1.getAction)(publicClient, createContractEventFilter_js_1.createContractEventFilter, "createContractEventFilter")({
|
|
173710
|
-
abi:
|
|
173710
|
+
abi: abi25,
|
|
173711
173711
|
address,
|
|
173712
173712
|
eventName,
|
|
173713
173713
|
args,
|
|
@@ -173719,10 +173719,10 @@ var require_getContract = __commonJS({
|
|
|
173719
173719
|
contract.getEvents = new Proxy({}, {
|
|
173720
173720
|
get(_, eventName) {
|
|
173721
173721
|
return (...parameters) => {
|
|
173722
|
-
const abiEvent =
|
|
173722
|
+
const abiEvent = abi25.find((x) => x.type === "event" && x.name === eventName);
|
|
173723
173723
|
const { args, options } = getEventParameters2(parameters, abiEvent);
|
|
173724
173724
|
return (0, getAction_js_1.getAction)(publicClient, getContractEvents_js_1.getContractEvents, "getContractEvents")({
|
|
173725
|
-
abi:
|
|
173725
|
+
abi: abi25,
|
|
173726
173726
|
address,
|
|
173727
173727
|
eventName,
|
|
173728
173728
|
args,
|
|
@@ -173734,10 +173734,10 @@ var require_getContract = __commonJS({
|
|
|
173734
173734
|
contract.watchEvent = new Proxy({}, {
|
|
173735
173735
|
get(_, eventName) {
|
|
173736
173736
|
return (...parameters) => {
|
|
173737
|
-
const abiEvent =
|
|
173737
|
+
const abiEvent = abi25.find((x) => x.type === "event" && x.name === eventName);
|
|
173738
173738
|
const { args, options } = getEventParameters2(parameters, abiEvent);
|
|
173739
173739
|
return (0, getAction_js_1.getAction)(publicClient, watchContractEvent_js_1.watchContractEvent, "watchContractEvent")({
|
|
173740
|
-
abi:
|
|
173740
|
+
abi: abi25,
|
|
173741
173741
|
address,
|
|
173742
173742
|
eventName,
|
|
173743
173743
|
args,
|
|
@@ -173755,7 +173755,7 @@ var require_getContract = __commonJS({
|
|
|
173755
173755
|
return (...parameters) => {
|
|
173756
173756
|
const { args, options } = getFunctionParameters2(parameters);
|
|
173757
173757
|
return (0, getAction_js_1.getAction)(walletClient, writeContract_js_1.writeContract, "writeContract")({
|
|
173758
|
-
abi:
|
|
173758
|
+
abi: abi25,
|
|
173759
173759
|
address,
|
|
173760
173760
|
functionName,
|
|
173761
173761
|
args,
|
|
@@ -173773,7 +173773,7 @@ var require_getContract = __commonJS({
|
|
|
173773
173773
|
const { args, options } = getFunctionParameters2(parameters);
|
|
173774
173774
|
const client2 = publicClient ?? walletClient;
|
|
173775
173775
|
return (0, getAction_js_1.getAction)(client2, estimateContractGas_js_1.estimateContractGas, "estimateContractGas")({
|
|
173776
|
-
abi:
|
|
173776
|
+
abi: abi25,
|
|
173777
173777
|
address,
|
|
173778
173778
|
functionName,
|
|
173779
173779
|
args,
|
|
@@ -173785,7 +173785,7 @@ var require_getContract = __commonJS({
|
|
|
173785
173785
|
});
|
|
173786
173786
|
}
|
|
173787
173787
|
contract.address = address;
|
|
173788
|
-
contract.abi =
|
|
173788
|
+
contract.abi = abi25;
|
|
173789
173789
|
return contract;
|
|
173790
173790
|
}
|
|
173791
173791
|
function getFunctionParameters2(values) {
|
|
@@ -175408,7 +175408,7 @@ var require_getEip712Domain = __commonJS({
|
|
|
175408
175408
|
const { address, factory, factoryData } = parameters;
|
|
175409
175409
|
try {
|
|
175410
175410
|
const [fields, name, version4, chainId, verifyingContract, salt, extensions] = await (0, getAction_js_1.getAction)(client, readContract_js_1.readContract, "readContract")({
|
|
175411
|
-
abi:
|
|
175411
|
+
abi: abi25,
|
|
175412
175412
|
address,
|
|
175413
175413
|
functionName: "eip712Domain",
|
|
175414
175414
|
factory,
|
|
@@ -175433,7 +175433,7 @@ var require_getEip712Domain = __commonJS({
|
|
|
175433
175433
|
throw error;
|
|
175434
175434
|
}
|
|
175435
175435
|
}
|
|
175436
|
-
var
|
|
175436
|
+
var abi25 = [
|
|
175437
175437
|
{
|
|
175438
175438
|
inputs: [],
|
|
175439
175439
|
name: "eip712Domain",
|
|
@@ -179762,9 +179762,9 @@ var require_decodeFunctionData = __commonJS({
|
|
|
179762
179762
|
var decodeAbiParameters_js_1 = require_decodeAbiParameters();
|
|
179763
179763
|
var formatAbiItem_js_1 = require_formatAbiItem2();
|
|
179764
179764
|
function decodeFunctionData2(parameters) {
|
|
179765
|
-
const { abi:
|
|
179765
|
+
const { abi: abi25, data } = parameters;
|
|
179766
179766
|
const signature = (0, slice_js_1.slice)(data, 0, 4);
|
|
179767
|
-
const description =
|
|
179767
|
+
const description = abi25.find((x) => x.type === "function" && signature === (0, toFunctionSelector_js_1.toFunctionSelector)((0, formatAbiItem_js_1.formatAbiItem)(x)));
|
|
179768
179768
|
if (!description)
|
|
179769
179769
|
throw new abi_js_1.AbiFunctionSignatureNotFoundError(signature, {
|
|
179770
179770
|
docsPath: "/docs/contract/decodeFunctionData"
|
|
@@ -179791,10 +179791,10 @@ var require_encodeErrorResult = __commonJS({
|
|
|
179791
179791
|
var getAbiItem_js_1 = require_getAbiItem();
|
|
179792
179792
|
var docsPath6 = "/docs/contract/encodeErrorResult";
|
|
179793
179793
|
function encodeErrorResult(parameters) {
|
|
179794
|
-
const { abi:
|
|
179795
|
-
let abiItem =
|
|
179794
|
+
const { abi: abi25, errorName, args } = parameters;
|
|
179795
|
+
let abiItem = abi25[0];
|
|
179796
179796
|
if (errorName) {
|
|
179797
|
-
const item = (0, getAbiItem_js_1.getAbiItem)({ abi:
|
|
179797
|
+
const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi25, args, name: errorName });
|
|
179798
179798
|
if (!item)
|
|
179799
179799
|
throw new abi_js_1.AbiErrorNotFoundError(errorName, { docsPath: docsPath6 });
|
|
179800
179800
|
abiItem = item;
|
|
@@ -179825,10 +179825,10 @@ var require_encodeFunctionResult = __commonJS({
|
|
|
179825
179825
|
var getAbiItem_js_1 = require_getAbiItem();
|
|
179826
179826
|
var docsPath6 = "/docs/contract/encodeFunctionResult";
|
|
179827
179827
|
function encodeFunctionResult(parameters) {
|
|
179828
|
-
const { abi:
|
|
179829
|
-
let abiItem =
|
|
179828
|
+
const { abi: abi25, functionName, result } = parameters;
|
|
179829
|
+
let abiItem = abi25[0];
|
|
179830
179830
|
if (functionName) {
|
|
179831
|
-
const item = (0, getAbiItem_js_1.getAbiItem)({ abi:
|
|
179831
|
+
const item = (0, getAbiItem_js_1.getAbiItem)({ abi: abi25, name: functionName });
|
|
179832
179832
|
if (!item)
|
|
179833
179833
|
throw new abi_js_1.AbiFunctionNotFoundError(functionName, { docsPath: docsPath6 });
|
|
179834
179834
|
abiItem = item;
|
|
@@ -182111,9 +182111,9 @@ var require_multicall2 = __commonJS({
|
|
|
182111
182111
|
let currentChunk = 0;
|
|
182112
182112
|
let currentChunkSize = 0;
|
|
182113
182113
|
for (let i = 0; i < contracts2.length; i++) {
|
|
182114
|
-
const { abi:
|
|
182114
|
+
const { abi: abi25, address, args, functionName } = contracts2[i];
|
|
182115
182115
|
try {
|
|
182116
|
-
const callData = (0, encodeFunctionData_js_1.encodeFunctionData)({ abi:
|
|
182116
|
+
const callData = (0, encodeFunctionData_js_1.encodeFunctionData)({ abi: abi25, args, functionName });
|
|
182117
182117
|
currentChunkSize += (callData.length - 2) / 2;
|
|
182118
182118
|
if (batchSize > 0 && currentChunkSize > batchSize && chunkedCalls[currentChunk].length > 0) {
|
|
182119
182119
|
currentChunk++;
|
|
@@ -182130,7 +182130,7 @@ var require_multicall2 = __commonJS({
|
|
|
182130
182130
|
];
|
|
182131
182131
|
} catch (err) {
|
|
182132
182132
|
const error = (0, getContractError_js_1.getContractError)(err, {
|
|
182133
|
-
abi:
|
|
182133
|
+
abi: abi25,
|
|
182134
182134
|
address,
|
|
182135
182135
|
args,
|
|
182136
182136
|
docsPath: "/docs/contract/multicall",
|
|
@@ -182176,14 +182176,14 @@ var require_multicall2 = __commonJS({
|
|
|
182176
182176
|
for (let j = 0; j < aggregate3Result.length; j++) {
|
|
182177
182177
|
const { returnData, success } = aggregate3Result[j];
|
|
182178
182178
|
const { callData } = chunkedCalls[i][j];
|
|
182179
|
-
const { abi:
|
|
182179
|
+
const { abi: abi25, address, functionName, args } = contracts2[results.length];
|
|
182180
182180
|
try {
|
|
182181
182181
|
if (callData === "0x")
|
|
182182
182182
|
throw new abi_js_1.AbiDecodingZeroDataError();
|
|
182183
182183
|
if (!success)
|
|
182184
182184
|
throw new contract_js_1.RawContractError({ data: returnData });
|
|
182185
182185
|
const result2 = (0, decodeFunctionResult_js_1.decodeFunctionResult)({
|
|
182186
|
-
abi:
|
|
182186
|
+
abi: abi25,
|
|
182187
182187
|
args,
|
|
182188
182188
|
data: returnData,
|
|
182189
182189
|
functionName
|
|
@@ -182191,7 +182191,7 @@ var require_multicall2 = __commonJS({
|
|
|
182191
182191
|
results.push(allowFailure ? { result: result2, status: "success" } : result2);
|
|
182192
182192
|
} catch (err) {
|
|
182193
182193
|
const error = (0, getContractError_js_1.getContractError)(err, {
|
|
182194
|
-
abi:
|
|
182194
|
+
abi: abi25,
|
|
182195
182195
|
address,
|
|
182196
182196
|
args,
|
|
182197
182197
|
docsPath: "/docs/contract/multicall",
|
|
@@ -183243,13 +183243,13 @@ var require_simulateBlocks = __commonJS({
|
|
|
183243
183243
|
return result.map((block2, i) => ({
|
|
183244
183244
|
...(0, block_js_1.formatBlock)(block2),
|
|
183245
183245
|
calls: block2.calls.map((call2, j) => {
|
|
183246
|
-
const { abi:
|
|
183246
|
+
const { abi: abi25, args, functionName, to } = blocks[i].calls[j];
|
|
183247
183247
|
const data = call2.error?.data ?? call2.returnData;
|
|
183248
183248
|
const gasUsed = BigInt(call2.gasUsed);
|
|
183249
183249
|
const logs = call2.logs?.map((log2) => (0, log_js_1.formatLog)(log2));
|
|
183250
183250
|
const status = call2.status === "0x1" ? "success" : "failure";
|
|
183251
|
-
const result2 =
|
|
183252
|
-
abi:
|
|
183251
|
+
const result2 = abi25 && status === "success" ? (0, decodeFunctionResult_js_1.decodeFunctionResult)({
|
|
183252
|
+
abi: abi25,
|
|
183253
183253
|
data,
|
|
183254
183254
|
functionName
|
|
183255
183255
|
}) : null;
|
|
@@ -183264,7 +183264,7 @@ var require_simulateBlocks = __commonJS({
|
|
|
183264
183264
|
if (!error2)
|
|
183265
183265
|
return void 0;
|
|
183266
183266
|
return (0, getContractError_js_1.getContractError)(error2, {
|
|
183267
|
-
abi:
|
|
183267
|
+
abi: abi25 ?? [],
|
|
183268
183268
|
address: to,
|
|
183269
183269
|
args,
|
|
183270
183270
|
functionName: functionName ?? "<unknown>"
|
|
@@ -183844,10 +183844,10 @@ var require_AbiItem = __commonJS({
|
|
|
183844
183844
|
...prepare ? { hash: getSignatureHash2(item) } : {}
|
|
183845
183845
|
};
|
|
183846
183846
|
}
|
|
183847
|
-
function fromAbi3(
|
|
183847
|
+
function fromAbi3(abi25, name, options) {
|
|
183848
183848
|
const { args = [], prepare = true } = options ?? {};
|
|
183849
183849
|
const isSelector = Hex.validate(name, { strict: false });
|
|
183850
|
-
const abiItems =
|
|
183850
|
+
const abiItems = abi25.filter((abiItem2) => {
|
|
183851
183851
|
if (isSelector) {
|
|
183852
183852
|
if (abiItem2.type === "function" || abiItem2.type === "error")
|
|
183853
183853
|
return getSelector3(abiItem2) === Hex.slice(name, 0, 4);
|
|
@@ -184990,8 +184990,8 @@ var require_AbiConstructor = __commonJS({
|
|
|
184990
184990
|
function from5(abiConstructor) {
|
|
184991
184991
|
return AbiItem.from(abiConstructor);
|
|
184992
184992
|
}
|
|
184993
|
-
function fromAbi3(
|
|
184994
|
-
const item =
|
|
184993
|
+
function fromAbi3(abi25) {
|
|
184994
|
+
const item = abi25.find((item2) => item2.type === "constructor");
|
|
184995
184995
|
if (!item)
|
|
184996
184996
|
throw new AbiItem.NotFoundError({ name: "constructor" });
|
|
184997
184997
|
return item;
|
|
@@ -185066,8 +185066,8 @@ var require_AbiFunction = __commonJS({
|
|
|
185066
185066
|
function from5(abiFunction, options = {}) {
|
|
185067
185067
|
return AbiItem.from(abiFunction, options);
|
|
185068
185068
|
}
|
|
185069
|
-
function fromAbi3(
|
|
185070
|
-
const item = AbiItem.fromAbi(
|
|
185069
|
+
function fromAbi3(abi25, name, options) {
|
|
185070
|
+
const item = AbiItem.fromAbi(abi25, name, options);
|
|
185071
185071
|
if (item.type !== "function")
|
|
185072
185072
|
throw new AbiItem.NotFoundError({ name, type: "function" });
|
|
185073
185073
|
return item;
|
|
@@ -186967,8 +186967,8 @@ var require_deployContract = __commonJS({
|
|
|
186967
186967
|
var encodeDeployData_js_1 = require_encodeDeployData();
|
|
186968
186968
|
var sendTransaction_js_1 = require_sendTransaction();
|
|
186969
186969
|
function deployContract2(walletClient, parameters) {
|
|
186970
|
-
const { abi:
|
|
186971
|
-
const calldata = (0, encodeDeployData_js_1.encodeDeployData)({ abi:
|
|
186970
|
+
const { abi: abi25, args, bytecode, ...request } = parameters;
|
|
186971
|
+
const calldata = (0, encodeDeployData_js_1.encodeDeployData)({ abi: abi25, args, bytecode });
|
|
186972
186972
|
return (0, sendTransaction_js_1.sendTransaction)(walletClient, {
|
|
186973
186973
|
...request,
|
|
186974
186974
|
data: calldata
|
|
@@ -187391,10 +187391,10 @@ var require_decodeDeployData = __commonJS({
|
|
|
187391
187391
|
var decodeAbiParameters_js_1 = require_decodeAbiParameters();
|
|
187392
187392
|
var docsPath6 = "/docs/contract/decodeDeployData";
|
|
187393
187393
|
function decodeDeployData(parameters) {
|
|
187394
|
-
const { abi:
|
|
187394
|
+
const { abi: abi25, bytecode, data } = parameters;
|
|
187395
187395
|
if (data === bytecode)
|
|
187396
187396
|
return { bytecode };
|
|
187397
|
-
const description =
|
|
187397
|
+
const description = abi25.find((x) => "type" in x && x.type === "constructor");
|
|
187398
187398
|
if (!description)
|
|
187399
187399
|
throw new abi_js_1.AbiConstructorNotFoundError({ docsPath: docsPath6 });
|
|
187400
187400
|
if (!("inputs" in description))
|
|
@@ -231836,21 +231836,21 @@ var require_BaseContract2 = __commonJS({
|
|
|
231836
231836
|
return this.contractAddress;
|
|
231837
231837
|
};
|
|
231838
231838
|
this.encode = (functionToEncode, args) => {
|
|
231839
|
-
const
|
|
231839
|
+
const abi25 = this.contractAbi;
|
|
231840
231840
|
const functionName = functionToEncode;
|
|
231841
231841
|
const params = args;
|
|
231842
231842
|
return (0, viem_1.encodeFunctionData)({
|
|
231843
|
-
abi:
|
|
231843
|
+
abi: abi25,
|
|
231844
231844
|
functionName,
|
|
231845
231845
|
args: params
|
|
231846
231846
|
});
|
|
231847
231847
|
};
|
|
231848
231848
|
this.estimateGas = async (functionToEstimate, args, options = {}) => {
|
|
231849
231849
|
const contractOptions = this.convertOptions(options);
|
|
231850
|
-
const
|
|
231850
|
+
const abi25 = this.contractAbi;
|
|
231851
231851
|
const params = args;
|
|
231852
231852
|
return (0, actions_1.estimateContractGas)(this.runner, {
|
|
231853
|
-
abi:
|
|
231853
|
+
abi: abi25,
|
|
231854
231854
|
functionName: functionToEstimate,
|
|
231855
231855
|
address: this.getAddress(),
|
|
231856
231856
|
args: params,
|
|
@@ -279458,17 +279458,17 @@ var require_interface3 = __commonJS({
|
|
|
279458
279458
|
* Create a new Interface for the %%fragments%%.
|
|
279459
279459
|
*/
|
|
279460
279460
|
constructor(fragments) {
|
|
279461
|
-
let
|
|
279461
|
+
let abi25 = [];
|
|
279462
279462
|
if (typeof fragments === "string") {
|
|
279463
|
-
|
|
279463
|
+
abi25 = JSON.parse(fragments);
|
|
279464
279464
|
} else {
|
|
279465
|
-
|
|
279465
|
+
abi25 = fragments;
|
|
279466
279466
|
}
|
|
279467
279467
|
this.#functions = /* @__PURE__ */ new Map();
|
|
279468
279468
|
this.#errors = /* @__PURE__ */ new Map();
|
|
279469
279469
|
this.#events = /* @__PURE__ */ new Map();
|
|
279470
279470
|
const frags = [];
|
|
279471
|
-
for (const a of
|
|
279471
|
+
for (const a of abi25) {
|
|
279472
279472
|
try {
|
|
279473
279473
|
frags.push(fragments_js_1.Fragment.from(a));
|
|
279474
279474
|
} catch (error) {
|
|
@@ -279532,16 +279532,16 @@ var require_interface3 = __commonJS({
|
|
|
279532
279532
|
*/
|
|
279533
279533
|
format(minimal) {
|
|
279534
279534
|
const format = minimal ? "minimal" : "full";
|
|
279535
|
-
const
|
|
279536
|
-
return
|
|
279535
|
+
const abi25 = this.fragments.map((f) => f.format(format));
|
|
279536
|
+
return abi25;
|
|
279537
279537
|
}
|
|
279538
279538
|
/**
|
|
279539
279539
|
* Return the JSON-encoded ABI. This is the format Solidiy
|
|
279540
279540
|
* returns.
|
|
279541
279541
|
*/
|
|
279542
279542
|
formatJson() {
|
|
279543
|
-
const
|
|
279544
|
-
return JSON.stringify(
|
|
279543
|
+
const abi25 = this.fragments.map((f) => f.format("json"));
|
|
279544
|
+
return JSON.stringify(abi25.map((j) => JSON.parse(j)));
|
|
279545
279545
|
}
|
|
279546
279546
|
/**
|
|
279547
279547
|
* The ABI coder that will be used to encode and decode binary
|
|
@@ -282309,12 +282309,12 @@ var require_contract5 = __commonJS({
|
|
|
282309
282309
|
* optionally connected to a %%runner%% to perform operations on behalf
|
|
282310
282310
|
* of.
|
|
282311
282311
|
*/
|
|
282312
|
-
constructor(target,
|
|
282312
|
+
constructor(target, abi25, runner, _deployTx) {
|
|
282313
282313
|
(0, index_js_3.assertArgument)(typeof target === "string" || (0, index_js_2.isAddressable)(target), "invalid value for Contract target", "target", target);
|
|
282314
282314
|
if (runner == null) {
|
|
282315
282315
|
runner = null;
|
|
282316
282316
|
}
|
|
282317
|
-
const iface = index_js_1.Interface.from(
|
|
282317
|
+
const iface = index_js_1.Interface.from(abi25);
|
|
282318
282318
|
(0, index_js_3.defineProperties)(this, { target, runner, interface: iface });
|
|
282319
282319
|
Object.defineProperty(this, internal, { value: {} });
|
|
282320
282320
|
let addrPromise;
|
|
@@ -282677,10 +282677,10 @@ var require_contract5 = __commonJS({
|
|
|
282677
282677
|
/**
|
|
282678
282678
|
* Create a new Class for the %%abi%%.
|
|
282679
282679
|
*/
|
|
282680
|
-
static buildClass(
|
|
282680
|
+
static buildClass(abi25) {
|
|
282681
282681
|
class CustomContract extends _BaseContract {
|
|
282682
282682
|
constructor(address, runner = null) {
|
|
282683
|
-
super(address,
|
|
282683
|
+
super(address, abi25, runner);
|
|
282684
282684
|
}
|
|
282685
282685
|
}
|
|
282686
282686
|
return CustomContract;
|
|
@@ -282688,11 +282688,11 @@ var require_contract5 = __commonJS({
|
|
|
282688
282688
|
/**
|
|
282689
282689
|
* Create a new BaseContract with a specified Interface.
|
|
282690
282690
|
*/
|
|
282691
|
-
static from(target,
|
|
282691
|
+
static from(target, abi25, runner) {
|
|
282692
282692
|
if (runner == null) {
|
|
282693
282693
|
runner = null;
|
|
282694
282694
|
}
|
|
282695
|
-
const contract = new this(target,
|
|
282695
|
+
const contract = new this(target, abi25, runner);
|
|
282696
282696
|
return contract;
|
|
282697
282697
|
}
|
|
282698
282698
|
};
|
|
@@ -282736,8 +282736,8 @@ var require_factory2 = __commonJS({
|
|
|
282736
282736
|
* The %%bytecode%% may be the ``bytecode`` property within the
|
|
282737
282737
|
* standard Solidity JSON output.
|
|
282738
282738
|
*/
|
|
282739
|
-
constructor(
|
|
282740
|
-
const iface = index_js_1.Interface.from(
|
|
282739
|
+
constructor(abi25, bytecode, runner) {
|
|
282740
|
+
const iface = index_js_1.Interface.from(abi25);
|
|
282741
282741
|
if (bytecode instanceof Uint8Array) {
|
|
282742
282742
|
bytecode = (0, index_js_3.hexlify)((0, index_js_3.getBytes)(bytecode));
|
|
282743
282743
|
} else {
|
|
@@ -282807,14 +282807,14 @@ var require_factory2 = __commonJS({
|
|
|
282807
282807
|
if (typeof output === "string") {
|
|
282808
282808
|
output = JSON.parse(output);
|
|
282809
282809
|
}
|
|
282810
|
-
const
|
|
282810
|
+
const abi25 = output.abi;
|
|
282811
282811
|
let bytecode = "";
|
|
282812
282812
|
if (output.bytecode) {
|
|
282813
282813
|
bytecode = output.bytecode;
|
|
282814
282814
|
} else if (output.evm && output.evm.bytecode) {
|
|
282815
282815
|
bytecode = output.evm.bytecode;
|
|
282816
282816
|
}
|
|
282817
|
-
return new this(
|
|
282817
|
+
return new this(abi25, bytecode, runner);
|
|
282818
282818
|
}
|
|
282819
282819
|
};
|
|
282820
282820
|
exports2.ContractFactory = ContractFactory;
|
|
@@ -287764,8 +287764,8 @@ var require_provider_etherscan2 = __commonJS({
|
|
|
287764
287764
|
action: "getabi",
|
|
287765
287765
|
address
|
|
287766
287766
|
});
|
|
287767
|
-
const
|
|
287768
|
-
return new index_js_2.Contract(address,
|
|
287767
|
+
const abi25 = JSON.parse(resp);
|
|
287768
|
+
return new index_js_2.Contract(address, abi25, this);
|
|
287769
287769
|
} catch (error) {
|
|
287770
287770
|
return null;
|
|
287771
287771
|
}
|
|
@@ -338232,10 +338232,10 @@ init_formatAbiItem2();
|
|
|
338232
338232
|
init_getAbiItem();
|
|
338233
338233
|
var docsPath = "/docs/contract/encodeEventTopics";
|
|
338234
338234
|
function encodeEventTopics(parameters) {
|
|
338235
|
-
const { abi:
|
|
338236
|
-
let abiItem =
|
|
338235
|
+
const { abi: abi25, eventName, args } = parameters;
|
|
338236
|
+
let abiItem = abi25[0];
|
|
338237
338237
|
if (eventName) {
|
|
338238
|
-
const item = getAbiItem({ abi:
|
|
338238
|
+
const item = getAbiItem({ abi: abi25, name: eventName });
|
|
338239
338239
|
if (!item)
|
|
338240
338240
|
throw new AbiEventNotFoundError(eventName, { docsPath });
|
|
338241
338241
|
abiItem = item;
|
|
@@ -338282,12 +338282,12 @@ function createFilterRequestScope(client, { method }) {
|
|
|
338282
338282
|
|
|
338283
338283
|
// ../../node_modules/viem/_esm/actions/public/createContractEventFilter.js
|
|
338284
338284
|
async function createContractEventFilter(client, parameters) {
|
|
338285
|
-
const { address, abi:
|
|
338285
|
+
const { address, abi: abi25, args, eventName, fromBlock, strict, toBlock } = parameters;
|
|
338286
338286
|
const getRequest = createFilterRequestScope(client, {
|
|
338287
338287
|
method: "eth_newFilter"
|
|
338288
338288
|
});
|
|
338289
338289
|
const topics = eventName ? encodeEventTopics({
|
|
338290
|
-
abi:
|
|
338290
|
+
abi: abi25,
|
|
338291
338291
|
args,
|
|
338292
338292
|
eventName
|
|
338293
338293
|
}) : void 0;
|
|
@@ -338303,7 +338303,7 @@ async function createContractEventFilter(client, parameters) {
|
|
|
338303
338303
|
]
|
|
338304
338304
|
});
|
|
338305
338305
|
return {
|
|
338306
|
-
abi:
|
|
338306
|
+
abi: abi25,
|
|
338307
338307
|
args,
|
|
338308
338308
|
eventName,
|
|
338309
338309
|
id,
|
|
@@ -338324,7 +338324,7 @@ init_contract();
|
|
|
338324
338324
|
init_request();
|
|
338325
338325
|
init_rpc();
|
|
338326
338326
|
var EXECUTION_REVERTED_ERROR_CODE = 3;
|
|
338327
|
-
function getContractError(err, { abi:
|
|
338327
|
+
function getContractError(err, { abi: abi25, address, args, docsPath: docsPath6, functionName, sender }) {
|
|
338328
338328
|
const error = err instanceof RawContractError ? err : err instanceof BaseError2 ? err.walk((err2) => "data" in err2) || err.walk() : {};
|
|
338329
338329
|
const { code, data, details, message, shortMessage } = error;
|
|
338330
338330
|
const cause = (() => {
|
|
@@ -338332,7 +338332,7 @@ function getContractError(err, { abi: abi24, address, args, docsPath: docsPath6,
|
|
|
338332
338332
|
return new ContractFunctionZeroDataError({ functionName });
|
|
338333
338333
|
if ([EXECUTION_REVERTED_ERROR_CODE, InternalRpcError.code].includes(code) && (data || details || message || shortMessage)) {
|
|
338334
338334
|
return new ContractFunctionRevertedError({
|
|
338335
|
-
abi:
|
|
338335
|
+
abi: abi25,
|
|
338336
338336
|
data: typeof data === "object" ? data.data : data,
|
|
338337
338337
|
functionName,
|
|
338338
338338
|
message: error instanceof RpcRequestError ? details : shortMessage ?? message
|
|
@@ -338341,7 +338341,7 @@ function getContractError(err, { abi: abi24, address, args, docsPath: docsPath6,
|
|
|
338341
338341
|
return err;
|
|
338342
338342
|
})();
|
|
338343
338343
|
return new ContractFunctionExecutionError(cause, {
|
|
338344
|
-
abi:
|
|
338344
|
+
abi: abi25,
|
|
338345
338345
|
args,
|
|
338346
338346
|
contractAddress: address,
|
|
338347
338347
|
docsPath: docsPath6,
|
|
@@ -339294,9 +339294,9 @@ async function estimateGas(client, args) {
|
|
|
339294
339294
|
|
|
339295
339295
|
// ../../node_modules/viem/_esm/actions/public/estimateContractGas.js
|
|
339296
339296
|
async function estimateContractGas(client, parameters) {
|
|
339297
|
-
const { abi:
|
|
339297
|
+
const { abi: abi25, address, args, functionName, dataSuffix, ...request } = parameters;
|
|
339298
339298
|
const data = encodeFunctionData({
|
|
339299
|
-
abi:
|
|
339299
|
+
abi: abi25,
|
|
339300
339300
|
args,
|
|
339301
339301
|
functionName
|
|
339302
339302
|
});
|
|
@@ -339310,7 +339310,7 @@ async function estimateContractGas(client, parameters) {
|
|
|
339310
339310
|
} catch (error) {
|
|
339311
339311
|
const account = request.account ? parseAccount(request.account) : void 0;
|
|
339312
339312
|
throw getContractError(error, {
|
|
339313
|
-
abi:
|
|
339313
|
+
abi: abi25,
|
|
339314
339314
|
address,
|
|
339315
339315
|
args,
|
|
339316
339316
|
docsPath: "/docs/contract/estimateContractGas",
|
|
@@ -339339,15 +339339,15 @@ init_decodeAbiParameters();
|
|
|
339339
339339
|
init_formatAbiItem2();
|
|
339340
339340
|
var docsPath3 = "/docs/contract/decodeEventLog";
|
|
339341
339341
|
function decodeEventLog(parameters) {
|
|
339342
|
-
const { abi:
|
|
339342
|
+
const { abi: abi25, data, strict: strict_, topics } = parameters;
|
|
339343
339343
|
const strict = strict_ ?? true;
|
|
339344
339344
|
const [signature, ...argTopics] = topics;
|
|
339345
339345
|
if (!signature)
|
|
339346
339346
|
throw new AbiEventSignatureEmptyTopicsError({ docsPath: docsPath3 });
|
|
339347
339347
|
const abiItem = (() => {
|
|
339348
|
-
if (
|
|
339349
|
-
return
|
|
339350
|
-
return
|
|
339348
|
+
if (abi25.length === 1)
|
|
339349
|
+
return abi25[0];
|
|
339350
|
+
return abi25.find((x) => x.type === "event" && signature === toEventSelector(formatAbiItem2(x)));
|
|
339351
339351
|
})();
|
|
339352
339352
|
if (!(abiItem && "name" in abiItem) || abiItem.type !== "event")
|
|
339353
339353
|
throw new AbiEventSignatureNotFoundError(signature, { docsPath: docsPath3 });
|
|
@@ -339414,7 +339414,7 @@ function decodeTopic({ param, value }) {
|
|
|
339414
339414
|
|
|
339415
339415
|
// ../../node_modules/viem/_esm/utils/abi/parseEventLogs.js
|
|
339416
339416
|
function parseEventLogs(parameters) {
|
|
339417
|
-
const { abi:
|
|
339417
|
+
const { abi: abi25, args, logs, strict = true } = parameters;
|
|
339418
339418
|
const eventName = (() => {
|
|
339419
339419
|
if (!parameters.eventName)
|
|
339420
339420
|
return void 0;
|
|
@@ -339424,7 +339424,7 @@ function parseEventLogs(parameters) {
|
|
|
339424
339424
|
})();
|
|
339425
339425
|
return logs.map((log2) => {
|
|
339426
339426
|
try {
|
|
339427
|
-
const abiItem =
|
|
339427
|
+
const abiItem = abi25.find((abiItem2) => abiItem2.type === "event" && log2.topics[0] === toEventSelector(abiItem2));
|
|
339428
339428
|
if (!abiItem)
|
|
339429
339429
|
return null;
|
|
339430
339430
|
const event = decodeEventLog({
|
|
@@ -339560,9 +339560,9 @@ async function getLogs(client, { address, blockHash, fromBlock, toBlock, event,
|
|
|
339560
339560
|
|
|
339561
339561
|
// ../../node_modules/viem/_esm/actions/public/getContractEvents.js
|
|
339562
339562
|
async function getContractEvents(client, parameters) {
|
|
339563
|
-
const { abi:
|
|
339564
|
-
const event = eventName ? getAbiItem({ abi:
|
|
339565
|
-
const events = !event ?
|
|
339563
|
+
const { abi: abi25, address, args, blockHash, eventName, fromBlock, toBlock, strict } = parameters;
|
|
339564
|
+
const event = eventName ? getAbiItem({ abi: abi25, name: eventName }) : void 0;
|
|
339565
|
+
const events = !event ? abi25.filter((x) => x.type === "event") : void 0;
|
|
339566
339566
|
return getAction(client, getLogs, "getLogs")({
|
|
339567
339567
|
address,
|
|
339568
339568
|
args,
|
|
@@ -339580,9 +339580,9 @@ init_decodeFunctionResult();
|
|
|
339580
339580
|
init_encodeFunctionData();
|
|
339581
339581
|
init_call();
|
|
339582
339582
|
async function readContract(client, parameters) {
|
|
339583
|
-
const { abi:
|
|
339583
|
+
const { abi: abi25, address, args, functionName, ...rest } = parameters;
|
|
339584
339584
|
const calldata = encodeFunctionData({
|
|
339585
|
-
abi:
|
|
339585
|
+
abi: abi25,
|
|
339586
339586
|
args,
|
|
339587
339587
|
functionName
|
|
339588
339588
|
});
|
|
@@ -339593,14 +339593,14 @@ async function readContract(client, parameters) {
|
|
|
339593
339593
|
to: address
|
|
339594
339594
|
});
|
|
339595
339595
|
return decodeFunctionResult({
|
|
339596
|
-
abi:
|
|
339596
|
+
abi: abi25,
|
|
339597
339597
|
args,
|
|
339598
339598
|
functionName,
|
|
339599
339599
|
data: data || "0x"
|
|
339600
339600
|
});
|
|
339601
339601
|
} catch (error) {
|
|
339602
339602
|
throw getContractError(error, {
|
|
339603
|
-
abi:
|
|
339603
|
+
abi: abi25,
|
|
339604
339604
|
address,
|
|
339605
339605
|
args,
|
|
339606
339606
|
docsPath: "/docs/contract/readContract",
|
|
@@ -339615,9 +339615,9 @@ init_decodeFunctionResult();
|
|
|
339615
339615
|
init_encodeFunctionData();
|
|
339616
339616
|
init_call();
|
|
339617
339617
|
async function simulateContract(client, parameters) {
|
|
339618
|
-
const { abi:
|
|
339618
|
+
const { abi: abi25, address, args, dataSuffix, functionName, ...callRequest } = parameters;
|
|
339619
339619
|
const account = callRequest.account ? parseAccount(callRequest.account) : client.account;
|
|
339620
|
-
const calldata = encodeFunctionData({ abi:
|
|
339620
|
+
const calldata = encodeFunctionData({ abi: abi25, args, functionName });
|
|
339621
339621
|
try {
|
|
339622
339622
|
const { data } = await getAction(client, call, "call")({
|
|
339623
339623
|
batch: false,
|
|
@@ -339627,12 +339627,12 @@ async function simulateContract(client, parameters) {
|
|
|
339627
339627
|
account
|
|
339628
339628
|
});
|
|
339629
339629
|
const result = decodeFunctionResult({
|
|
339630
|
-
abi:
|
|
339630
|
+
abi: abi25,
|
|
339631
339631
|
args,
|
|
339632
339632
|
functionName,
|
|
339633
339633
|
data: data || "0x"
|
|
339634
339634
|
});
|
|
339635
|
-
const minimizedAbi =
|
|
339635
|
+
const minimizedAbi = abi25.filter((abiItem) => "name" in abiItem && abiItem.name === parameters.functionName);
|
|
339636
339636
|
return {
|
|
339637
339637
|
result,
|
|
339638
339638
|
request: {
|
|
@@ -339647,7 +339647,7 @@ async function simulateContract(client, parameters) {
|
|
|
339647
339647
|
};
|
|
339648
339648
|
} catch (error) {
|
|
339649
339649
|
throw getContractError(error, {
|
|
339650
|
-
abi:
|
|
339650
|
+
abi: abi25,
|
|
339651
339651
|
address,
|
|
339652
339652
|
args,
|
|
339653
339653
|
docsPath: "/docs/contract/simulateContract",
|
|
@@ -339815,7 +339815,7 @@ async function uninstallFilter(_client, { filter }) {
|
|
|
339815
339815
|
|
|
339816
339816
|
// ../../node_modules/viem/_esm/actions/public/watchContractEvent.js
|
|
339817
339817
|
function watchContractEvent(client, parameters) {
|
|
339818
|
-
const { abi:
|
|
339818
|
+
const { abi: abi25, address, args, batch = true, eventName, fromBlock, onError, onLogs, poll: poll_, pollingInterval = client.pollingInterval, strict: strict_ } = parameters;
|
|
339819
339819
|
const enablePolling = (() => {
|
|
339820
339820
|
if (typeof poll_ !== "undefined")
|
|
339821
339821
|
return poll_;
|
|
@@ -339850,7 +339850,7 @@ function watchContractEvent(client, parameters) {
|
|
|
339850
339850
|
if (!initialized) {
|
|
339851
339851
|
try {
|
|
339852
339852
|
filter = await getAction(client, createContractEventFilter, "createContractEventFilter")({
|
|
339853
|
-
abi:
|
|
339853
|
+
abi: abi25,
|
|
339854
339854
|
address,
|
|
339855
339855
|
args,
|
|
339856
339856
|
eventName,
|
|
@@ -339870,7 +339870,7 @@ function watchContractEvent(client, parameters) {
|
|
|
339870
339870
|
const blockNumber = await getAction(client, getBlockNumber, "getBlockNumber")({});
|
|
339871
339871
|
if (previousBlockNumber && previousBlockNumber < blockNumber) {
|
|
339872
339872
|
logs = await getAction(client, getContractEvents, "getContractEvents")({
|
|
339873
|
-
abi:
|
|
339873
|
+
abi: abi25,
|
|
339874
339874
|
address,
|
|
339875
339875
|
args,
|
|
339876
339876
|
eventName,
|
|
@@ -339934,7 +339934,7 @@ function watchContractEvent(client, parameters) {
|
|
|
339934
339934
|
return client.transport;
|
|
339935
339935
|
})();
|
|
339936
339936
|
const topics = eventName ? encodeEventTopics({
|
|
339937
|
-
abi:
|
|
339937
|
+
abi: abi25,
|
|
339938
339938
|
eventName,
|
|
339939
339939
|
args
|
|
339940
339940
|
}) : [];
|
|
@@ -339946,7 +339946,7 @@ function watchContractEvent(client, parameters) {
|
|
|
339946
339946
|
const log2 = data.result;
|
|
339947
339947
|
try {
|
|
339948
339948
|
const { eventName: eventName2, args: args2 } = decodeEventLog({
|
|
339949
|
-
abi:
|
|
339949
|
+
abi: abi25,
|
|
339950
339950
|
data: log2.data,
|
|
339951
339951
|
topics: log2.topics,
|
|
339952
339952
|
strict: strict_
|
|
@@ -340197,14 +340197,14 @@ async function sendTransaction(client, parameters) {
|
|
|
340197
340197
|
|
|
340198
340198
|
// ../../node_modules/viem/_esm/actions/wallet/writeContract.js
|
|
340199
340199
|
async function writeContract(client, parameters) {
|
|
340200
|
-
const { abi:
|
|
340200
|
+
const { abi: abi25, account: account_ = client.account, address, args, dataSuffix, functionName, ...request } = parameters;
|
|
340201
340201
|
if (typeof account_ === "undefined")
|
|
340202
340202
|
throw new AccountNotFoundError({
|
|
340203
340203
|
docsPath: "/docs/contract/writeContract"
|
|
340204
340204
|
});
|
|
340205
340205
|
const account = account_ ? parseAccount(account_) : null;
|
|
340206
340206
|
const data = encodeFunctionData({
|
|
340207
|
-
abi:
|
|
340207
|
+
abi: abi25,
|
|
340208
340208
|
args,
|
|
340209
340209
|
functionName
|
|
340210
340210
|
});
|
|
@@ -340217,7 +340217,7 @@ async function writeContract(client, parameters) {
|
|
|
340217
340217
|
});
|
|
340218
340218
|
} catch (error) {
|
|
340219
340219
|
throw getContractError(error, {
|
|
340220
|
-
abi:
|
|
340220
|
+
abi: abi25,
|
|
340221
340221
|
address,
|
|
340222
340222
|
args,
|
|
340223
340223
|
docsPath: "/docs/contract/writeContract",
|
|
@@ -340228,7 +340228,7 @@ async function writeContract(client, parameters) {
|
|
|
340228
340228
|
}
|
|
340229
340229
|
|
|
340230
340230
|
// ../../node_modules/viem/_esm/actions/getContract.js
|
|
340231
|
-
function getContract({ abi:
|
|
340231
|
+
function getContract({ abi: abi25, address, client: client_ }) {
|
|
340232
340232
|
const client = client_;
|
|
340233
340233
|
const [publicClient, walletClient] = (() => {
|
|
340234
340234
|
if (!client)
|
|
@@ -340247,7 +340247,7 @@ function getContract({ abi: abi24, address, client: client_ }) {
|
|
|
340247
340247
|
let hasReadFunction = false;
|
|
340248
340248
|
let hasWriteFunction = false;
|
|
340249
340249
|
let hasEvent = false;
|
|
340250
|
-
for (const item of
|
|
340250
|
+
for (const item of abi25) {
|
|
340251
340251
|
if (item.type === "function")
|
|
340252
340252
|
if (item.stateMutability === "view" || item.stateMutability === "pure")
|
|
340253
340253
|
hasReadFunction = true;
|
|
@@ -340265,7 +340265,7 @@ function getContract({ abi: abi24, address, client: client_ }) {
|
|
|
340265
340265
|
return (...parameters) => {
|
|
340266
340266
|
const { args, options } = getFunctionParameters(parameters);
|
|
340267
340267
|
return getAction(publicClient, readContract, "readContract")({
|
|
340268
|
-
abi:
|
|
340268
|
+
abi: abi25,
|
|
340269
340269
|
address,
|
|
340270
340270
|
functionName,
|
|
340271
340271
|
args,
|
|
@@ -340280,7 +340280,7 @@ function getContract({ abi: abi24, address, client: client_ }) {
|
|
|
340280
340280
|
return (...parameters) => {
|
|
340281
340281
|
const { args, options } = getFunctionParameters(parameters);
|
|
340282
340282
|
return getAction(publicClient, simulateContract, "simulateContract")({
|
|
340283
|
-
abi:
|
|
340283
|
+
abi: abi25,
|
|
340284
340284
|
address,
|
|
340285
340285
|
functionName,
|
|
340286
340286
|
args,
|
|
@@ -340293,10 +340293,10 @@ function getContract({ abi: abi24, address, client: client_ }) {
|
|
|
340293
340293
|
contract.createEventFilter = new Proxy({}, {
|
|
340294
340294
|
get(_, eventName) {
|
|
340295
340295
|
return (...parameters) => {
|
|
340296
|
-
const abiEvent =
|
|
340296
|
+
const abiEvent = abi25.find((x) => x.type === "event" && x.name === eventName);
|
|
340297
340297
|
const { args, options } = getEventParameters(parameters, abiEvent);
|
|
340298
340298
|
return getAction(publicClient, createContractEventFilter, "createContractEventFilter")({
|
|
340299
|
-
abi:
|
|
340299
|
+
abi: abi25,
|
|
340300
340300
|
address,
|
|
340301
340301
|
eventName,
|
|
340302
340302
|
args,
|
|
@@ -340308,10 +340308,10 @@ function getContract({ abi: abi24, address, client: client_ }) {
|
|
|
340308
340308
|
contract.getEvents = new Proxy({}, {
|
|
340309
340309
|
get(_, eventName) {
|
|
340310
340310
|
return (...parameters) => {
|
|
340311
|
-
const abiEvent =
|
|
340311
|
+
const abiEvent = abi25.find((x) => x.type === "event" && x.name === eventName);
|
|
340312
340312
|
const { args, options } = getEventParameters(parameters, abiEvent);
|
|
340313
340313
|
return getAction(publicClient, getContractEvents, "getContractEvents")({
|
|
340314
|
-
abi:
|
|
340314
|
+
abi: abi25,
|
|
340315
340315
|
address,
|
|
340316
340316
|
eventName,
|
|
340317
340317
|
args,
|
|
@@ -340323,10 +340323,10 @@ function getContract({ abi: abi24, address, client: client_ }) {
|
|
|
340323
340323
|
contract.watchEvent = new Proxy({}, {
|
|
340324
340324
|
get(_, eventName) {
|
|
340325
340325
|
return (...parameters) => {
|
|
340326
|
-
const abiEvent =
|
|
340326
|
+
const abiEvent = abi25.find((x) => x.type === "event" && x.name === eventName);
|
|
340327
340327
|
const { args, options } = getEventParameters(parameters, abiEvent);
|
|
340328
340328
|
return getAction(publicClient, watchContractEvent, "watchContractEvent")({
|
|
340329
|
-
abi:
|
|
340329
|
+
abi: abi25,
|
|
340330
340330
|
address,
|
|
340331
340331
|
eventName,
|
|
340332
340332
|
args,
|
|
@@ -340344,7 +340344,7 @@ function getContract({ abi: abi24, address, client: client_ }) {
|
|
|
340344
340344
|
return (...parameters) => {
|
|
340345
340345
|
const { args, options } = getFunctionParameters(parameters);
|
|
340346
340346
|
return getAction(walletClient, writeContract, "writeContract")({
|
|
340347
|
-
abi:
|
|
340347
|
+
abi: abi25,
|
|
340348
340348
|
address,
|
|
340349
340349
|
functionName,
|
|
340350
340350
|
args,
|
|
@@ -340362,7 +340362,7 @@ function getContract({ abi: abi24, address, client: client_ }) {
|
|
|
340362
340362
|
const { args, options } = getFunctionParameters(parameters);
|
|
340363
340363
|
const client2 = publicClient ?? walletClient;
|
|
340364
340364
|
return getAction(client2, estimateContractGas, "estimateContractGas")({
|
|
340365
|
-
abi:
|
|
340365
|
+
abi: abi25,
|
|
340366
340366
|
address,
|
|
340367
340367
|
functionName,
|
|
340368
340368
|
args,
|
|
@@ -340374,7 +340374,7 @@ function getContract({ abi: abi24, address, client: client_ }) {
|
|
|
340374
340374
|
});
|
|
340375
340375
|
}
|
|
340376
340376
|
contract.address = address;
|
|
340377
|
-
contract.abi =
|
|
340377
|
+
contract.abi = abi25;
|
|
340378
340378
|
return contract;
|
|
340379
340379
|
}
|
|
340380
340380
|
function getFunctionParameters(values) {
|
|
@@ -342081,9 +342081,9 @@ init_toFunctionSelector();
|
|
|
342081
342081
|
init_decodeAbiParameters();
|
|
342082
342082
|
init_formatAbiItem2();
|
|
342083
342083
|
function decodeFunctionData(parameters) {
|
|
342084
|
-
const { abi:
|
|
342084
|
+
const { abi: abi25, data } = parameters;
|
|
342085
342085
|
const signature = slice(data, 0, 4);
|
|
342086
|
-
const description =
|
|
342086
|
+
const description = abi25.find((x) => x.type === "function" && signature === toFunctionSelector(formatAbiItem2(x)));
|
|
342087
342087
|
if (!description)
|
|
342088
342088
|
throw new AbiFunctionSignatureNotFoundError(signature, {
|
|
342089
342089
|
docsPath: "/docs/contract/decodeFunctionData"
|
|
@@ -342727,9 +342727,9 @@ async function multicall(client, parameters) {
|
|
|
342727
342727
|
let currentChunk = 0;
|
|
342728
342728
|
let currentChunkSize = 0;
|
|
342729
342729
|
for (let i = 0; i < contracts2.length; i++) {
|
|
342730
|
-
const { abi:
|
|
342730
|
+
const { abi: abi25, address, args, functionName } = contracts2[i];
|
|
342731
342731
|
try {
|
|
342732
|
-
const callData = encodeFunctionData({ abi:
|
|
342732
|
+
const callData = encodeFunctionData({ abi: abi25, args, functionName });
|
|
342733
342733
|
currentChunkSize += (callData.length - 2) / 2;
|
|
342734
342734
|
if (
|
|
342735
342735
|
// Check if batching is enabled.
|
|
@@ -342751,7 +342751,7 @@ async function multicall(client, parameters) {
|
|
|
342751
342751
|
];
|
|
342752
342752
|
} catch (err) {
|
|
342753
342753
|
const error = getContractError(err, {
|
|
342754
|
-
abi:
|
|
342754
|
+
abi: abi25,
|
|
342755
342755
|
address,
|
|
342756
342756
|
args,
|
|
342757
342757
|
docsPath: "/docs/contract/multicall",
|
|
@@ -342797,14 +342797,14 @@ async function multicall(client, parameters) {
|
|
|
342797
342797
|
for (let j = 0; j < aggregate3Result.length; j++) {
|
|
342798
342798
|
const { returnData, success } = aggregate3Result[j];
|
|
342799
342799
|
const { callData } = chunkedCalls[i][j];
|
|
342800
|
-
const { abi:
|
|
342800
|
+
const { abi: abi25, address, functionName, args } = contracts2[results.length];
|
|
342801
342801
|
try {
|
|
342802
342802
|
if (callData === "0x")
|
|
342803
342803
|
throw new AbiDecodingZeroDataError();
|
|
342804
342804
|
if (!success)
|
|
342805
342805
|
throw new RawContractError({ data: returnData });
|
|
342806
342806
|
const result2 = decodeFunctionResult({
|
|
342807
|
-
abi:
|
|
342807
|
+
abi: abi25,
|
|
342808
342808
|
args,
|
|
342809
342809
|
data: returnData,
|
|
342810
342810
|
functionName
|
|
@@ -342812,7 +342812,7 @@ async function multicall(client, parameters) {
|
|
|
342812
342812
|
results.push(allowFailure ? { result: result2, status: "success" } : result2);
|
|
342813
342813
|
} catch (err) {
|
|
342814
342814
|
const error = getContractError(err, {
|
|
342815
|
-
abi:
|
|
342815
|
+
abi: abi25,
|
|
342816
342816
|
address,
|
|
342817
342817
|
args,
|
|
342818
342818
|
docsPath: "/docs/contract/multicall",
|
|
@@ -343351,13 +343351,13 @@ async function simulateBlocks(client, parameters) {
|
|
|
343351
343351
|
return result.map((block2, i) => ({
|
|
343352
343352
|
...formatBlock(block2),
|
|
343353
343353
|
calls: block2.calls.map((call2, j) => {
|
|
343354
|
-
const { abi:
|
|
343354
|
+
const { abi: abi25, args, functionName, to } = blocks[i].calls[j];
|
|
343355
343355
|
const data = call2.error?.data ?? call2.returnData;
|
|
343356
343356
|
const gasUsed = BigInt(call2.gasUsed);
|
|
343357
343357
|
const logs = call2.logs?.map((log2) => formatLog(log2));
|
|
343358
343358
|
const status = call2.status === "0x1" ? "success" : "failure";
|
|
343359
|
-
const result2 =
|
|
343360
|
-
abi:
|
|
343359
|
+
const result2 = abi25 && status === "success" ? decodeFunctionResult({
|
|
343360
|
+
abi: abi25,
|
|
343361
343361
|
data,
|
|
343362
343362
|
functionName
|
|
343363
343363
|
}) : null;
|
|
@@ -343372,7 +343372,7 @@ async function simulateBlocks(client, parameters) {
|
|
|
343372
343372
|
if (!error2)
|
|
343373
343373
|
return void 0;
|
|
343374
343374
|
return getContractError(error2, {
|
|
343375
|
-
abi:
|
|
343375
|
+
abi: abi25 ?? [],
|
|
343376
343376
|
address: to,
|
|
343377
343377
|
args,
|
|
343378
343378
|
functionName: functionName ?? "<unknown>"
|
|
@@ -343649,10 +343649,10 @@ function from2(abiItem, options = {}) {
|
|
|
343649
343649
|
...prepare ? { hash: getSignatureHash(item) } : {}
|
|
343650
343650
|
};
|
|
343651
343651
|
}
|
|
343652
|
-
function fromAbi(
|
|
343652
|
+
function fromAbi(abi25, name, options) {
|
|
343653
343653
|
const { args = [], prepare = true } = options ?? {};
|
|
343654
343654
|
const isSelector = validate(name, { strict: false });
|
|
343655
|
-
const abiItems =
|
|
343655
|
+
const abiItems = abi25.filter((abiItem2) => {
|
|
343656
343656
|
if (isSelector) {
|
|
343657
343657
|
if (abiItem2.type === "function" || abiItem2.type === "error")
|
|
343658
343658
|
return getSelector(abiItem2) === slice2(name, 0, 4);
|
|
@@ -344252,8 +344252,8 @@ function encodeData2(abiFunction, ...args) {
|
|
|
344252
344252
|
function from4(abiFunction, options = {}) {
|
|
344253
344253
|
return from2(abiFunction, options);
|
|
344254
344254
|
}
|
|
344255
|
-
function fromAbi2(
|
|
344256
|
-
const item = fromAbi(
|
|
344255
|
+
function fromAbi2(abi25, name, options) {
|
|
344256
|
+
const item = fromAbi(abi25, name, options);
|
|
344257
344257
|
if (item.type !== "function")
|
|
344258
344258
|
throw new NotFoundError({ name, type: "function" });
|
|
344259
344259
|
return item;
|
|
@@ -345672,8 +345672,8 @@ function createTestClient(parameters) {
|
|
|
345672
345672
|
// ../../node_modules/viem/_esm/actions/wallet/deployContract.js
|
|
345673
345673
|
init_encodeDeployData();
|
|
345674
345674
|
function deployContract(walletClient, parameters) {
|
|
345675
|
-
const { abi:
|
|
345676
|
-
const calldata = encodeDeployData({ abi:
|
|
345675
|
+
const { abi: abi25, args, bytecode, ...request } = parameters;
|
|
345676
|
+
const calldata = encodeDeployData({ abi: abi25, args, bytecode });
|
|
345677
345677
|
return sendTransaction(walletClient, {
|
|
345678
345678
|
...request,
|
|
345679
345679
|
data: calldata
|
|
@@ -353482,12 +353482,12 @@ var json_parse = (s) => {
|
|
|
353482
353482
|
function createRawTx(to, parameters, description) {
|
|
353483
353483
|
const { args } = parameters;
|
|
353484
353484
|
const fname = parameters.functionName;
|
|
353485
|
-
const { abi:
|
|
353485
|
+
const { abi: abi25, functionName } = (() => {
|
|
353486
353486
|
if (parameters.abi.length === 1 && parameters.functionName?.startsWith("0x"))
|
|
353487
353487
|
return parameters;
|
|
353488
353488
|
return prepareEncodeFunctionData(parameters);
|
|
353489
353489
|
})();
|
|
353490
|
-
const abiItem =
|
|
353490
|
+
const abiItem = abi25[0];
|
|
353491
353491
|
const signature = functionName;
|
|
353492
353492
|
const data = "inputs" in abiItem && abiItem.inputs ? encodeAbiParameters(abiItem.inputs, args ?? []) : void 0;
|
|
353493
353493
|
const functionEncodedData = concatHex([signature, data ?? "0x"]);
|
|
@@ -360931,9 +360931,9 @@ async function simulateMulticall(client, parameters) {
|
|
|
360931
360931
|
let currentChunk = 0;
|
|
360932
360932
|
let currentChunkSize = 0;
|
|
360933
360933
|
for (const contract of contracts2) {
|
|
360934
|
-
const { abi:
|
|
360934
|
+
const { abi: abi25, address, args, functionName } = contract;
|
|
360935
360935
|
try {
|
|
360936
|
-
const callData = encodeFunctionData({ abi:
|
|
360936
|
+
const callData = encodeFunctionData({ abi: abi25, args, functionName });
|
|
360937
360937
|
currentChunkSize += (callData.length - 2) / 2;
|
|
360938
360938
|
if (
|
|
360939
360939
|
// Check if batching is enabled.
|
|
@@ -360955,7 +360955,7 @@ async function simulateMulticall(client, parameters) {
|
|
|
360955
360955
|
];
|
|
360956
360956
|
} catch (err) {
|
|
360957
360957
|
const error = getContractError(err, {
|
|
360958
|
-
abi:
|
|
360958
|
+
abi: abi25,
|
|
360959
360959
|
address,
|
|
360960
360960
|
args,
|
|
360961
360961
|
docsPath: "/docs/contract/multicall",
|
|
@@ -361012,12 +361012,12 @@ async function simulateMulticall(client, parameters) {
|
|
|
361012
361012
|
for (let j = 0; j < aggregate3Result.length; j++) {
|
|
361013
361013
|
const { returnData, success } = aggregate3Result[j];
|
|
361014
361014
|
const { callData } = chunkedCalls[i][j];
|
|
361015
|
-
const { abi:
|
|
361015
|
+
const { abi: abi25, address, functionName, args } = contracts2[results.length];
|
|
361016
361016
|
try {
|
|
361017
361017
|
if (callData === "0x") throw new AbiDecodingZeroDataError();
|
|
361018
361018
|
if (!success) throw new RawContractError({ data: returnData });
|
|
361019
361019
|
const result2 = decodeFunctionResult({
|
|
361020
|
-
abi:
|
|
361020
|
+
abi: abi25,
|
|
361021
361021
|
args,
|
|
361022
361022
|
data: returnData,
|
|
361023
361023
|
functionName
|
|
@@ -361025,7 +361025,7 @@ async function simulateMulticall(client, parameters) {
|
|
|
361025
361025
|
results.push(allowFailure ? { result: result2, status: "success" } : result2);
|
|
361026
361026
|
} catch (err) {
|
|
361027
361027
|
const error = getContractError(err, {
|
|
361028
|
-
abi:
|
|
361028
|
+
abi: abi25,
|
|
361029
361029
|
address,
|
|
361030
361030
|
args,
|
|
361031
361031
|
docsPath: "/docs/contract/multicall",
|
|
@@ -371699,12 +371699,13 @@ var PriceOracleBaseContract = class extends BaseContract {
|
|
|
371699
371699
|
)
|
|
371700
371700
|
);
|
|
371701
371701
|
}
|
|
371702
|
+
const [address] = this.sdk.addressProvider.getLatestVersion(
|
|
371703
|
+
AP_PRICE_FEED_COMPRESSOR
|
|
371704
|
+
);
|
|
371702
371705
|
return {
|
|
371703
371706
|
call: {
|
|
371704
371707
|
abi: iPriceFeedCompressorAbi,
|
|
371705
|
-
address
|
|
371706
|
-
AP_PRICE_FEED_COMPRESSOR
|
|
371707
|
-
),
|
|
371708
|
+
address,
|
|
371708
371709
|
functionName: "getPriceFeeds",
|
|
371709
371710
|
args
|
|
371710
371711
|
},
|
|
@@ -373198,6 +373199,54 @@ var iSwapperV300Abi = [
|
|
|
373198
373199
|
}
|
|
373199
373200
|
];
|
|
373200
373201
|
|
|
373202
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/router/AbstractRouterContract.js
|
|
373203
|
+
var AbstractRouterContract = class extends BaseContract {
|
|
373204
|
+
hooks = new Hooks();
|
|
373205
|
+
addHook = this.hooks.addHook.bind(this.hooks);
|
|
373206
|
+
removeHook = this.hooks.removeHook.bind(this.hooks);
|
|
373207
|
+
getExpectedAndLeftover(ca, cm, balances) {
|
|
373208
|
+
const b = balances || this.getDefaultExpectedAndLeftover(ca);
|
|
373209
|
+
const { leftoverBalances, expectedBalances } = b;
|
|
373210
|
+
const expected = new AddressMap();
|
|
373211
|
+
const leftover = new AddressMap();
|
|
373212
|
+
for (const token of cm.collateralTokens) {
|
|
373213
|
+
const actual = expectedBalances.get(token)?.balance || 0n;
|
|
373214
|
+
expected.upsert(token, { token, balance: actual > 10n ? actual : 0n });
|
|
373215
|
+
leftover.upsert(token, {
|
|
373216
|
+
token,
|
|
373217
|
+
balance: leftoverBalances.get(token)?.balance || 1n
|
|
373218
|
+
});
|
|
373219
|
+
}
|
|
373220
|
+
return { expectedBalances: expected, leftoverBalances: leftover };
|
|
373221
|
+
}
|
|
373222
|
+
getDefaultExpectedAndLeftover(ca) {
|
|
373223
|
+
const expectedBalances = new AddressMap();
|
|
373224
|
+
const leftoverBalances = new AddressMap();
|
|
373225
|
+
for (const { token: t, balance, mask } of ca.tokens) {
|
|
373226
|
+
const token = t;
|
|
373227
|
+
const isEnabled = (mask & ca.enabledTokensMask) !== 0n;
|
|
373228
|
+
expectedBalances.upsert(token, { token, balance });
|
|
373229
|
+
const decimals2 = this.sdk.tokensMeta.decimals(token);
|
|
373230
|
+
const minBalance = 10n ** BigInt(Math.max(8, decimals2) - 8);
|
|
373231
|
+
if (balance < minBalance || !isEnabled) {
|
|
373232
|
+
leftoverBalances.upsert(token, { token, balance });
|
|
373233
|
+
}
|
|
373234
|
+
}
|
|
373235
|
+
return { expectedBalances, leftoverBalances };
|
|
373236
|
+
}
|
|
373237
|
+
};
|
|
373238
|
+
|
|
373239
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/router/helpers.js
|
|
373240
|
+
function balancesMap(assets) {
|
|
373241
|
+
return new AddressMap(assets.map(({ token, balance }) => [token, balance]));
|
|
373242
|
+
}
|
|
373243
|
+
function compareRouterResults(a, b) {
|
|
373244
|
+
return a.amount > b.amount ? a : b;
|
|
373245
|
+
}
|
|
373246
|
+
function assetsMap(assets) {
|
|
373247
|
+
return new AddressMap(assets.map((a) => [a.token, a]));
|
|
373248
|
+
}
|
|
373249
|
+
|
|
373201
373250
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/router/PathOptionFactory.js
|
|
373202
373251
|
var PathOptionFactory = class _PathOptionFactory {
|
|
373203
373252
|
// TODO: get rid of token data from SDK
|
|
@@ -373276,7 +373325,7 @@ var PathOptionFactory = class _PathOptionFactory {
|
|
|
373276
373325
|
}
|
|
373277
373326
|
};
|
|
373278
373327
|
|
|
373279
|
-
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/router/
|
|
373328
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/router/RouterV300Contract.js
|
|
373280
373329
|
var MAX_GAS_PER_ROUTE = 200000000n;
|
|
373281
373330
|
var GAS_PER_BLOCK = 400000000n;
|
|
373282
373331
|
var LOOPS_PER_TX = Number(GAS_PER_BLOCK / MAX_GAS_PER_ROUTE);
|
|
@@ -373293,19 +373342,16 @@ var PT_IN = {
|
|
|
373293
373342
|
var OUT = {
|
|
373294
373343
|
["0x9D39A5DE30e57443BfF2A8307A4256c8797A3497".toLowerCase()]: "sUSDe"
|
|
373295
373344
|
};
|
|
373296
|
-
var
|
|
373345
|
+
var RouterV300Contract = class extends AbstractRouterContract {
|
|
373297
373346
|
#connectors;
|
|
373298
|
-
#hooks = new Hooks();
|
|
373299
373347
|
constructor(sdk, address) {
|
|
373300
373348
|
super(sdk, {
|
|
373301
373349
|
addr: address,
|
|
373302
|
-
name: "
|
|
373350
|
+
name: "RouterV300",
|
|
373303
373351
|
abi: iRouterV300Abi
|
|
373304
373352
|
});
|
|
373305
373353
|
this.#connectors = getConnectors(sdk.provider.networkType);
|
|
373306
373354
|
}
|
|
373307
|
-
addHook = this.#hooks.addHook.bind(this.#hooks);
|
|
373308
|
-
removeHook = this.#hooks.removeHook.bind(this.#hooks);
|
|
373309
373355
|
/**
|
|
373310
373356
|
* Finds all available swaps for NORMAL tokens
|
|
373311
373357
|
* @param ca
|
|
@@ -373378,7 +373424,7 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
373378
373424
|
creditManager.collateralTokens
|
|
373379
373425
|
);
|
|
373380
373426
|
const isPTOverrideRedeem = PT_IN[tokenIn.toLowerCase()] && OUT[tokenOut.toLowerCase()];
|
|
373381
|
-
const { result } = await (isPTOverrideRedeem ? this
|
|
373427
|
+
const { result } = await (isPTOverrideRedeem ? this.#overridePTRedeem(props) : this.contract.simulate.findOneTokenPath(
|
|
373382
373428
|
[
|
|
373383
373429
|
tokenIn,
|
|
373384
373430
|
amount,
|
|
@@ -373397,74 +373443,6 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
373397
373443
|
calls: [...result.calls]
|
|
373398
373444
|
};
|
|
373399
373445
|
}
|
|
373400
|
-
// TODO: remove me when new router will be added
|
|
373401
|
-
async overridePTRedeem({
|
|
373402
|
-
creditAccount,
|
|
373403
|
-
creditManager,
|
|
373404
|
-
tokenIn,
|
|
373405
|
-
tokenOut,
|
|
373406
|
-
amount,
|
|
373407
|
-
slippage
|
|
373408
|
-
}) {
|
|
373409
|
-
const pendleSwapperAddress = await this.contract.read.componentAddressById([
|
|
373410
|
-
37
|
|
373411
|
-
]);
|
|
373412
|
-
const cm = this.sdk.marketRegister.findCreditManager(creditManager.address);
|
|
373413
|
-
const PENDLE_ROUTER_BY_NETWORK = {
|
|
373414
|
-
Mainnet: "0x888888888889758F76e7103c6CbF23ABbF58F946",
|
|
373415
|
-
Arbitrum: "0x0",
|
|
373416
|
-
Optimism: "0x0",
|
|
373417
|
-
Base: "0x0",
|
|
373418
|
-
Sonic: "0x0"
|
|
373419
|
-
};
|
|
373420
|
-
const pendleRouter = PENDLE_ROUTER_BY_NETWORK[this.sdk.provider.networkType];
|
|
373421
|
-
const pendleAdapter = cm.creditManager.adapters.mustGet(pendleRouter);
|
|
373422
|
-
const pendleSwapper = getContract({
|
|
373423
|
-
address: pendleSwapperAddress,
|
|
373424
|
-
abi: iSwapperV300Abi,
|
|
373425
|
-
client: this.sdk.provider.publicClient
|
|
373426
|
-
});
|
|
373427
|
-
const result = await pendleSwapper.simulate.getBestDirectPairSwap([
|
|
373428
|
-
{
|
|
373429
|
-
swapOperation: 1,
|
|
373430
|
-
creditAccount: creditAccount.creditAccount,
|
|
373431
|
-
tokenIn,
|
|
373432
|
-
tokenOut,
|
|
373433
|
-
connectors: [],
|
|
373434
|
-
amount,
|
|
373435
|
-
leftoverAmount: 0n
|
|
373436
|
-
},
|
|
373437
|
-
pendleAdapter.address
|
|
373438
|
-
]);
|
|
373439
|
-
const minAmount = result.result.amount * (PERCENTAGE_FACTOR - BigInt(slippage)) / PERCENTAGE_FACTOR;
|
|
373440
|
-
const storeExpectedBalances = {
|
|
373441
|
-
target: creditManager.creditFacade,
|
|
373442
|
-
callData: encodeFunctionData({
|
|
373443
|
-
abi: iCreditFacadeV300MulticallAbi,
|
|
373444
|
-
functionName: "storeExpectedBalances",
|
|
373445
|
-
args: [[{ token: tokenOut, amount: minAmount }]]
|
|
373446
|
-
})
|
|
373447
|
-
};
|
|
373448
|
-
const compareBalances = {
|
|
373449
|
-
target: creditManager.creditFacade,
|
|
373450
|
-
callData: encodeFunctionData({
|
|
373451
|
-
abi: iCreditFacadeV300MulticallAbi,
|
|
373452
|
-
functionName: "compareBalances",
|
|
373453
|
-
args: []
|
|
373454
|
-
})
|
|
373455
|
-
};
|
|
373456
|
-
return {
|
|
373457
|
-
result: {
|
|
373458
|
-
amount: result.result.amount,
|
|
373459
|
-
minAmount,
|
|
373460
|
-
calls: [
|
|
373461
|
-
storeExpectedBalances,
|
|
373462
|
-
result.result.multiCall,
|
|
373463
|
-
compareBalances
|
|
373464
|
-
]
|
|
373465
|
-
}
|
|
373466
|
-
};
|
|
373467
|
-
}
|
|
373468
373446
|
/**
|
|
373469
373447
|
* @dev Finds the best path for opening Credit Account and converting all NORMAL tokens and LP token in the way to TARGET
|
|
373470
373448
|
* @param creditManager CreditManagerData which represents credit manager you want to use to open Credit Account
|
|
@@ -373545,7 +373523,7 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
373545
373523
|
leftoverBalances: assetsMap(balances.leftoverBalances)
|
|
373546
373524
|
} : void 0
|
|
373547
373525
|
);
|
|
373548
|
-
await this
|
|
373526
|
+
await this.hooks.triggerHooks("foundPathOptions", {
|
|
373549
373527
|
creditAccount: ca.creditAccount,
|
|
373550
373528
|
pathOptions,
|
|
373551
373529
|
expected,
|
|
@@ -373593,61 +373571,473 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
373593
373571
|
}
|
|
373594
373572
|
/**
|
|
373595
373573
|
* Finds input to be used with findBestClosePath
|
|
373574
|
+
* Is used by batch liquidator
|
|
373596
373575
|
* @param ca
|
|
373597
373576
|
* @param cm
|
|
373598
373577
|
* @returns
|
|
373599
373578
|
*/
|
|
373600
373579
|
getFindClosePathInput(ca, cm, balances) {
|
|
373601
|
-
const
|
|
373602
|
-
|
|
373580
|
+
const { expectedBalances, leftoverBalances } = this.getExpectedAndLeftover(
|
|
373581
|
+
ca,
|
|
373582
|
+
cm,
|
|
373583
|
+
balances
|
|
373584
|
+
);
|
|
373603
373585
|
const pathOptions = PathOptionFactory.generatePathOptions(
|
|
373604
373586
|
ca.tokens,
|
|
373605
373587
|
this.provider.networkType,
|
|
373606
373588
|
LOOPS_PER_TX
|
|
373607
373589
|
);
|
|
373608
|
-
const expected = cm.collateralTokens.map((token) => {
|
|
373609
|
-
const actual = expectedBalances.get(token)?.balance || 0n;
|
|
373610
|
-
return {
|
|
373611
|
-
token,
|
|
373612
|
-
balance: actual > 10n ? actual : 0n
|
|
373613
|
-
};
|
|
373614
|
-
});
|
|
373615
|
-
const leftover = cm.collateralTokens.map((token) => ({
|
|
373616
|
-
token,
|
|
373617
|
-
balance: leftoverBalances.get(token)?.balance || 1n
|
|
373618
|
-
}));
|
|
373619
373590
|
const connectors2 = this.getAvailableConnectors(cm.collateralTokens);
|
|
373620
|
-
return {
|
|
373621
|
-
|
|
373622
|
-
|
|
373623
|
-
|
|
373624
|
-
|
|
373625
|
-
|
|
373626
|
-
const token = t;
|
|
373627
|
-
const isEnabled = (mask & ca.enabledTokensMask) !== 0n;
|
|
373628
|
-
expectedBalances.upsert(token, { token, balance });
|
|
373629
|
-
const decimals2 = this.sdk.tokensMeta.decimals(token);
|
|
373630
|
-
const minBalance = 10n ** BigInt(Math.max(8, decimals2) - 8);
|
|
373631
|
-
if (balance < minBalance || !isEnabled) {
|
|
373632
|
-
leftoverBalances.upsert(token, { token, balance });
|
|
373633
|
-
}
|
|
373634
|
-
}
|
|
373635
|
-
return { expectedBalances, leftoverBalances };
|
|
373591
|
+
return {
|
|
373592
|
+
expected: expectedBalances.values(),
|
|
373593
|
+
leftover: leftoverBalances.values(),
|
|
373594
|
+
connectors: connectors2,
|
|
373595
|
+
pathOptions
|
|
373596
|
+
};
|
|
373636
373597
|
}
|
|
373637
373598
|
getAvailableConnectors(collateralTokens) {
|
|
373638
373599
|
return collateralTokens.filter(
|
|
373639
373600
|
(t) => this.#connectors.includes(t.toLowerCase())
|
|
373640
373601
|
);
|
|
373641
373602
|
}
|
|
373603
|
+
// TODO: remove me when new router will be added
|
|
373604
|
+
async #overridePTRedeem({
|
|
373605
|
+
creditAccount,
|
|
373606
|
+
creditManager,
|
|
373607
|
+
tokenIn,
|
|
373608
|
+
tokenOut,
|
|
373609
|
+
amount,
|
|
373610
|
+
slippage
|
|
373611
|
+
}) {
|
|
373612
|
+
const pendleSwapperAddress = await this.contract.read.componentAddressById([
|
|
373613
|
+
37
|
|
373614
|
+
]);
|
|
373615
|
+
const cm = this.sdk.marketRegister.findCreditManager(creditManager.address);
|
|
373616
|
+
const PENDLE_ROUTER_BY_NETWORK = {
|
|
373617
|
+
Mainnet: "0x888888888889758F76e7103c6CbF23ABbF58F946",
|
|
373618
|
+
Arbitrum: "0x0",
|
|
373619
|
+
Optimism: "0x0",
|
|
373620
|
+
Base: "0x0",
|
|
373621
|
+
Sonic: "0x0"
|
|
373622
|
+
};
|
|
373623
|
+
const pendleRouter = PENDLE_ROUTER_BY_NETWORK[this.sdk.provider.networkType];
|
|
373624
|
+
const pendleAdapter = cm.creditManager.adapters.mustGet(pendleRouter);
|
|
373625
|
+
const pendleSwapper = getContract({
|
|
373626
|
+
address: pendleSwapperAddress,
|
|
373627
|
+
abi: iSwapperV300Abi,
|
|
373628
|
+
client: this.sdk.provider.publicClient
|
|
373629
|
+
});
|
|
373630
|
+
const result = await pendleSwapper.simulate.getBestDirectPairSwap([
|
|
373631
|
+
{
|
|
373632
|
+
swapOperation: 1,
|
|
373633
|
+
creditAccount: creditAccount.creditAccount,
|
|
373634
|
+
tokenIn,
|
|
373635
|
+
tokenOut,
|
|
373636
|
+
connectors: [],
|
|
373637
|
+
amount,
|
|
373638
|
+
leftoverAmount: 0n
|
|
373639
|
+
},
|
|
373640
|
+
pendleAdapter.address
|
|
373641
|
+
]);
|
|
373642
|
+
const minAmount = result.result.amount * (PERCENTAGE_FACTOR - BigInt(slippage)) / PERCENTAGE_FACTOR;
|
|
373643
|
+
const storeExpectedBalances = {
|
|
373644
|
+
target: creditManager.creditFacade,
|
|
373645
|
+
callData: encodeFunctionData({
|
|
373646
|
+
abi: iCreditFacadeV300MulticallAbi,
|
|
373647
|
+
functionName: "storeExpectedBalances",
|
|
373648
|
+
args: [[{ token: tokenOut, amount: minAmount }]]
|
|
373649
|
+
})
|
|
373650
|
+
};
|
|
373651
|
+
const compareBalances = {
|
|
373652
|
+
target: creditManager.creditFacade,
|
|
373653
|
+
callData: encodeFunctionData({
|
|
373654
|
+
abi: iCreditFacadeV300MulticallAbi,
|
|
373655
|
+
functionName: "compareBalances",
|
|
373656
|
+
args: []
|
|
373657
|
+
})
|
|
373658
|
+
};
|
|
373659
|
+
return {
|
|
373660
|
+
result: {
|
|
373661
|
+
amount: result.result.amount,
|
|
373662
|
+
minAmount,
|
|
373663
|
+
calls: [
|
|
373664
|
+
storeExpectedBalances,
|
|
373665
|
+
result.result.multiCall,
|
|
373666
|
+
compareBalances
|
|
373667
|
+
]
|
|
373668
|
+
}
|
|
373669
|
+
};
|
|
373670
|
+
}
|
|
373642
373671
|
};
|
|
373643
|
-
|
|
373644
|
-
|
|
373645
|
-
|
|
373646
|
-
|
|
373647
|
-
|
|
373648
|
-
|
|
373649
|
-
|
|
373650
|
-
|
|
373672
|
+
|
|
373673
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/abi/routerV310.js
|
|
373674
|
+
var iGearboxRouterV310Abi = [
|
|
373675
|
+
{
|
|
373676
|
+
type: "function",
|
|
373677
|
+
name: "componentAddressByType",
|
|
373678
|
+
inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
|
|
373679
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
373680
|
+
stateMutability: "view"
|
|
373681
|
+
},
|
|
373682
|
+
{
|
|
373683
|
+
type: "function",
|
|
373684
|
+
name: "contractType",
|
|
373685
|
+
inputs: [],
|
|
373686
|
+
outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }],
|
|
373687
|
+
stateMutability: "view"
|
|
373688
|
+
},
|
|
373689
|
+
{
|
|
373690
|
+
type: "function",
|
|
373691
|
+
name: "futureRouter",
|
|
373692
|
+
inputs: [],
|
|
373693
|
+
outputs: [{ name: "", type: "address", internalType: "address" }],
|
|
373694
|
+
stateMutability: "view"
|
|
373695
|
+
},
|
|
373696
|
+
{
|
|
373697
|
+
type: "function",
|
|
373698
|
+
name: "isRouterConfigurator",
|
|
373699
|
+
inputs: [{ name: "account", type: "address", internalType: "address" }],
|
|
373700
|
+
outputs: [{ name: "", type: "bool", internalType: "bool" }],
|
|
373701
|
+
stateMutability: "view"
|
|
373702
|
+
},
|
|
373703
|
+
{
|
|
373704
|
+
type: "function",
|
|
373705
|
+
name: "knownComponentTypes",
|
|
373706
|
+
inputs: [],
|
|
373707
|
+
outputs: [{ name: "", type: "bytes32[]", internalType: "bytes32[]" }],
|
|
373708
|
+
stateMutability: "view"
|
|
373709
|
+
},
|
|
373710
|
+
{
|
|
373711
|
+
type: "function",
|
|
373712
|
+
name: "routeManyToOne",
|
|
373713
|
+
inputs: [
|
|
373714
|
+
{ name: "creditAccount", type: "address", internalType: "address" },
|
|
373715
|
+
{ name: "target", type: "address", internalType: "address" },
|
|
373716
|
+
{ name: "slippage", type: "uint256", internalType: "uint256" },
|
|
373717
|
+
{
|
|
373718
|
+
name: "tData",
|
|
373719
|
+
type: "tuple[]",
|
|
373720
|
+
internalType: "struct TokenData[]",
|
|
373721
|
+
components: [
|
|
373722
|
+
{ name: "token", type: "address", internalType: "address" },
|
|
373723
|
+
{ name: "balance", type: "uint256", internalType: "uint256" },
|
|
373724
|
+
{ name: "leftoverBalance", type: "uint256", internalType: "uint256" },
|
|
373725
|
+
{ name: "numSplits", type: "uint256", internalType: "uint256" }
|
|
373726
|
+
]
|
|
373727
|
+
}
|
|
373728
|
+
],
|
|
373729
|
+
outputs: [
|
|
373730
|
+
{
|
|
373731
|
+
name: "",
|
|
373732
|
+
type: "tuple",
|
|
373733
|
+
internalType: "struct RouterResult",
|
|
373734
|
+
components: [
|
|
373735
|
+
{ name: "amount", type: "uint256", internalType: "uint256" },
|
|
373736
|
+
{ name: "minAmount", type: "uint256", internalType: "uint256" },
|
|
373737
|
+
{
|
|
373738
|
+
name: "calls",
|
|
373739
|
+
type: "tuple[]",
|
|
373740
|
+
internalType: "struct MultiCall[]",
|
|
373741
|
+
components: [
|
|
373742
|
+
{ name: "target", type: "address", internalType: "address" },
|
|
373743
|
+
{ name: "callData", type: "bytes", internalType: "bytes" }
|
|
373744
|
+
]
|
|
373745
|
+
}
|
|
373746
|
+
]
|
|
373747
|
+
}
|
|
373748
|
+
],
|
|
373749
|
+
stateMutability: "nonpayable"
|
|
373750
|
+
},
|
|
373751
|
+
{
|
|
373752
|
+
type: "function",
|
|
373753
|
+
name: "routeOneToOne",
|
|
373754
|
+
inputs: [
|
|
373755
|
+
{ name: "creditAccount", type: "address", internalType: "address" },
|
|
373756
|
+
{ name: "tokenIn", type: "address", internalType: "address" },
|
|
373757
|
+
{ name: "amount", type: "uint256", internalType: "uint256" },
|
|
373758
|
+
{ name: "target", type: "address", internalType: "address" },
|
|
373759
|
+
{ name: "slippage", type: "uint256", internalType: "uint256" },
|
|
373760
|
+
{ name: "numSplits", type: "uint256", internalType: "uint256" }
|
|
373761
|
+
],
|
|
373762
|
+
outputs: [
|
|
373763
|
+
{
|
|
373764
|
+
name: "",
|
|
373765
|
+
type: "tuple",
|
|
373766
|
+
internalType: "struct RouterResult",
|
|
373767
|
+
components: [
|
|
373768
|
+
{ name: "amount", type: "uint256", internalType: "uint256" },
|
|
373769
|
+
{ name: "minAmount", type: "uint256", internalType: "uint256" },
|
|
373770
|
+
{
|
|
373771
|
+
name: "calls",
|
|
373772
|
+
type: "tuple[]",
|
|
373773
|
+
internalType: "struct MultiCall[]",
|
|
373774
|
+
components: [
|
|
373775
|
+
{ name: "target", type: "address", internalType: "address" },
|
|
373776
|
+
{ name: "callData", type: "bytes", internalType: "bytes" }
|
|
373777
|
+
]
|
|
373778
|
+
}
|
|
373779
|
+
]
|
|
373780
|
+
}
|
|
373781
|
+
],
|
|
373782
|
+
stateMutability: "nonpayable"
|
|
373783
|
+
},
|
|
373784
|
+
{
|
|
373785
|
+
type: "function",
|
|
373786
|
+
name: "routeOneToOneDiff",
|
|
373787
|
+
inputs: [
|
|
373788
|
+
{ name: "creditAccount", type: "address", internalType: "address" },
|
|
373789
|
+
{ name: "tokenIn", type: "address", internalType: "address" },
|
|
373790
|
+
{ name: "balance", type: "uint256", internalType: "uint256" },
|
|
373791
|
+
{ name: "leftoverBalance", type: "uint256", internalType: "uint256" },
|
|
373792
|
+
{ name: "target", type: "address", internalType: "address" },
|
|
373793
|
+
{ name: "slippage", type: "uint256", internalType: "uint256" },
|
|
373794
|
+
{ name: "numSplits", type: "uint256", internalType: "uint256" }
|
|
373795
|
+
],
|
|
373796
|
+
outputs: [
|
|
373797
|
+
{
|
|
373798
|
+
name: "",
|
|
373799
|
+
type: "tuple",
|
|
373800
|
+
internalType: "struct RouterResult",
|
|
373801
|
+
components: [
|
|
373802
|
+
{ name: "amount", type: "uint256", internalType: "uint256" },
|
|
373803
|
+
{ name: "minAmount", type: "uint256", internalType: "uint256" },
|
|
373804
|
+
{
|
|
373805
|
+
name: "calls",
|
|
373806
|
+
type: "tuple[]",
|
|
373807
|
+
internalType: "struct MultiCall[]",
|
|
373808
|
+
components: [
|
|
373809
|
+
{ name: "target", type: "address", internalType: "address" },
|
|
373810
|
+
{ name: "callData", type: "bytes", internalType: "bytes" }
|
|
373811
|
+
]
|
|
373812
|
+
}
|
|
373813
|
+
]
|
|
373814
|
+
}
|
|
373815
|
+
],
|
|
373816
|
+
stateMutability: "nonpayable"
|
|
373817
|
+
},
|
|
373818
|
+
{
|
|
373819
|
+
type: "function",
|
|
373820
|
+
name: "routeOpenManyToOne",
|
|
373821
|
+
inputs: [
|
|
373822
|
+
{ name: "creditManager", type: "address", internalType: "address" },
|
|
373823
|
+
{ name: "target", type: "address", internalType: "address" },
|
|
373824
|
+
{ name: "slippage", type: "uint256", internalType: "uint256" },
|
|
373825
|
+
{
|
|
373826
|
+
name: "tData",
|
|
373827
|
+
type: "tuple[]",
|
|
373828
|
+
internalType: "struct TokenData[]",
|
|
373829
|
+
components: [
|
|
373830
|
+
{ name: "token", type: "address", internalType: "address" },
|
|
373831
|
+
{ name: "balance", type: "uint256", internalType: "uint256" },
|
|
373832
|
+
{ name: "leftoverBalance", type: "uint256", internalType: "uint256" },
|
|
373833
|
+
{ name: "numSplits", type: "uint256", internalType: "uint256" }
|
|
373834
|
+
]
|
|
373835
|
+
}
|
|
373836
|
+
],
|
|
373837
|
+
outputs: [
|
|
373838
|
+
{
|
|
373839
|
+
name: "",
|
|
373840
|
+
type: "tuple",
|
|
373841
|
+
internalType: "struct RouterResult",
|
|
373842
|
+
components: [
|
|
373843
|
+
{ name: "amount", type: "uint256", internalType: "uint256" },
|
|
373844
|
+
{ name: "minAmount", type: "uint256", internalType: "uint256" },
|
|
373845
|
+
{
|
|
373846
|
+
name: "calls",
|
|
373847
|
+
type: "tuple[]",
|
|
373848
|
+
internalType: "struct MultiCall[]",
|
|
373849
|
+
components: [
|
|
373850
|
+
{ name: "target", type: "address", internalType: "address" },
|
|
373851
|
+
{ name: "callData", type: "bytes", internalType: "bytes" }
|
|
373852
|
+
]
|
|
373853
|
+
}
|
|
373854
|
+
]
|
|
373855
|
+
}
|
|
373856
|
+
],
|
|
373857
|
+
stateMutability: "nonpayable"
|
|
373858
|
+
},
|
|
373859
|
+
{
|
|
373860
|
+
type: "function",
|
|
373861
|
+
name: "version",
|
|
373862
|
+
inputs: [],
|
|
373863
|
+
outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
|
|
373864
|
+
stateMutability: "view"
|
|
373865
|
+
},
|
|
373866
|
+
{
|
|
373867
|
+
type: "event",
|
|
373868
|
+
name: "RouterComponentUpdate",
|
|
373869
|
+
inputs: [
|
|
373870
|
+
{ name: "", type: "bytes32", indexed: true, internalType: "bytes32" },
|
|
373871
|
+
{ name: "", type: "address", indexed: true, internalType: "address" },
|
|
373872
|
+
{
|
|
373873
|
+
name: "version",
|
|
373874
|
+
type: "uint256",
|
|
373875
|
+
indexed: false,
|
|
373876
|
+
internalType: "uint256"
|
|
373877
|
+
}
|
|
373878
|
+
],
|
|
373879
|
+
anonymous: false
|
|
373880
|
+
},
|
|
373881
|
+
{
|
|
373882
|
+
type: "event",
|
|
373883
|
+
name: "SetFutureRouter",
|
|
373884
|
+
inputs: [
|
|
373885
|
+
{ name: "", type: "address", indexed: true, internalType: "address" }
|
|
373886
|
+
],
|
|
373887
|
+
anonymous: false
|
|
373888
|
+
}
|
|
373889
|
+
];
|
|
373890
|
+
|
|
373891
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/router/RouterV310Contract.js
|
|
373892
|
+
var abi20 = iGearboxRouterV310Abi;
|
|
373893
|
+
var ERR_NOT_IMPLEMENTED = new Error("Not implemented in router v3.1");
|
|
373894
|
+
var RouterV310Contract = class extends AbstractRouterContract {
|
|
373895
|
+
constructor(sdk, address) {
|
|
373896
|
+
super(sdk, {
|
|
373897
|
+
addr: address,
|
|
373898
|
+
name: "RouterV300",
|
|
373899
|
+
abi: abi20
|
|
373900
|
+
});
|
|
373901
|
+
}
|
|
373902
|
+
/**
|
|
373903
|
+
* Finds best path to swap all Normal tokens and tokens "on the way" to target one and vice versa
|
|
373904
|
+
* @param creditAccount
|
|
373905
|
+
* @param creditManager
|
|
373906
|
+
* @param tokenIn
|
|
373907
|
+
* @param tokenOut
|
|
373908
|
+
* @param amount
|
|
373909
|
+
* @param slippage
|
|
373910
|
+
* @returns
|
|
373911
|
+
*/
|
|
373912
|
+
async findOneTokenPath(props) {
|
|
373913
|
+
const { result } = await this.contract.simulate.routeOneToOne([
|
|
373914
|
+
props.creditAccount.creditAccount,
|
|
373915
|
+
props.tokenIn,
|
|
373916
|
+
props.amount,
|
|
373917
|
+
props.tokenOut,
|
|
373918
|
+
BigInt(props.slippage),
|
|
373919
|
+
4n
|
|
373920
|
+
// TODO:? how many 4n or 0n for underlying
|
|
373921
|
+
]);
|
|
373922
|
+
return {
|
|
373923
|
+
amount: result.amount,
|
|
373924
|
+
minAmount: result.minAmount,
|
|
373925
|
+
calls: [...result.calls]
|
|
373926
|
+
};
|
|
373927
|
+
}
|
|
373928
|
+
/**
|
|
373929
|
+
* @dev Finds the best path for opening Credit Account and converting all NORMAL tokens and LP token in the way to TARGET
|
|
373930
|
+
* @param creditManager CreditManagerData which represents credit manager you want to use to open Credit Account
|
|
373931
|
+
* @param expectedBalances Expected balances which would be on account accounting also debt. For example,
|
|
373932
|
+
* if you open an USDC Credit Account, borrow 50_000 USDC and provide 10 WETH and 10_USDC as collateral
|
|
373933
|
+
* from your own funds, expectedBalances should be: { "USDC": 60_000 * (10**6), "<address of WETH>": WAD.mul(10) }
|
|
373934
|
+
* @param leftoverBalances Balances to keep on account after opening
|
|
373935
|
+
* @param target Address of symbol of desired token
|
|
373936
|
+
* @param slippage Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
|
|
373937
|
+
* @returns PathFinderOpenStrategyResult which
|
|
373938
|
+
*/
|
|
373939
|
+
async findOpenStrategyPath(props) {
|
|
373940
|
+
const {
|
|
373941
|
+
creditManager: cm,
|
|
373942
|
+
expectedBalances,
|
|
373943
|
+
leftoverBalances,
|
|
373944
|
+
target,
|
|
373945
|
+
slippage
|
|
373946
|
+
} = props;
|
|
373947
|
+
const [expectedMap, leftoverMap] = [
|
|
373948
|
+
balancesMap(expectedBalances),
|
|
373949
|
+
balancesMap(leftoverBalances)
|
|
373950
|
+
];
|
|
373951
|
+
const tData = cm.collateralTokens.map(
|
|
373952
|
+
(token) => ({
|
|
373953
|
+
token,
|
|
373954
|
+
balance: expectedMap.get(token) ?? 0n,
|
|
373955
|
+
leftoverBalance: leftoverMap.get(token) ?? 0n,
|
|
373956
|
+
numSplits: 4n
|
|
373957
|
+
// TODO:? how many 4n or 0n for underlying
|
|
373958
|
+
})
|
|
373959
|
+
);
|
|
373960
|
+
const { result } = await this.contract.simulate.routeOpenManyToOne([
|
|
373961
|
+
cm.address,
|
|
373962
|
+
target,
|
|
373963
|
+
BigInt(slippage),
|
|
373964
|
+
tData
|
|
373965
|
+
]);
|
|
373966
|
+
return {
|
|
373967
|
+
balances: {},
|
|
373968
|
+
// TODO:?
|
|
373969
|
+
minBalances: {},
|
|
373970
|
+
// TODO:?
|
|
373971
|
+
amount: result.amount,
|
|
373972
|
+
minAmount: result.minAmount,
|
|
373973
|
+
calls: [...result.calls]
|
|
373974
|
+
};
|
|
373975
|
+
}
|
|
373976
|
+
/**
|
|
373977
|
+
* @dev Finds the path to swap / withdraw all assets from CreditAccount into underlying asset
|
|
373978
|
+
* Can bu used for closing Credit Account and for liquidations as well.
|
|
373979
|
+
* @param creditAccount CreditAccountStruct object used for close path computation
|
|
373980
|
+
* @param creditManager CreditManagerSlice for corresponding credit manager
|
|
373981
|
+
* @param slippage Slippage in PERCENTAGE_FORMAT (100% = 10_000) per operation
|
|
373982
|
+
* @return The best option in PathFinderCloseResult format, which
|
|
373983
|
+
* - underlyingBalance - total balance of underlying token
|
|
373984
|
+
* - calls - list of calls which should be done to swap & unwrap everything to underlying token
|
|
373985
|
+
*/
|
|
373986
|
+
async findBestClosePath(props) {
|
|
373987
|
+
const { creditAccount: ca, creditManager: cm, slippage, balances } = props;
|
|
373988
|
+
const { expectedBalances, leftoverBalances } = this.getExpectedAndLeftover(
|
|
373989
|
+
ca,
|
|
373990
|
+
cm,
|
|
373991
|
+
balances ? {
|
|
373992
|
+
expectedBalances: assetsMap(balances.expectedBalances),
|
|
373993
|
+
leftoverBalances: assetsMap(balances.leftoverBalances)
|
|
373994
|
+
} : void 0
|
|
373995
|
+
);
|
|
373996
|
+
const tData = [];
|
|
373997
|
+
for (const token of cm.collateralTokens) {
|
|
373998
|
+
tData.push({
|
|
373999
|
+
token,
|
|
374000
|
+
balance: expectedBalances.get(token)?.balance || 0n,
|
|
374001
|
+
leftoverBalance: leftoverBalances.get(token)?.balance || 0n,
|
|
374002
|
+
numSplits: 4n
|
|
374003
|
+
// TODO:? how many 4n or 0n for underlying
|
|
374004
|
+
});
|
|
374005
|
+
}
|
|
374006
|
+
const { result } = await this.contract.simulate.routeManyToOne([
|
|
374007
|
+
cm.address,
|
|
374008
|
+
ca.underlying,
|
|
374009
|
+
BigInt(slippage),
|
|
374010
|
+
tData
|
|
374011
|
+
]);
|
|
374012
|
+
return {
|
|
374013
|
+
underlyingBalance: 0n,
|
|
374014
|
+
// TODO:?
|
|
374015
|
+
amount: result.amount,
|
|
374016
|
+
minAmount: result.minAmount,
|
|
374017
|
+
calls: [...result.calls]
|
|
374018
|
+
};
|
|
374019
|
+
}
|
|
374020
|
+
findAllSwaps(props) {
|
|
374021
|
+
throw ERR_NOT_IMPLEMENTED;
|
|
374022
|
+
}
|
|
374023
|
+
getAvailableConnectors(collateralTokens) {
|
|
374024
|
+
throw ERR_NOT_IMPLEMENTED;
|
|
374025
|
+
}
|
|
374026
|
+
getFindClosePathInput(ca, cm, balances) {
|
|
374027
|
+
throw ERR_NOT_IMPLEMENTED;
|
|
374028
|
+
}
|
|
374029
|
+
};
|
|
374030
|
+
|
|
374031
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/router/createRouter.js
|
|
374032
|
+
function createRouter(sdk) {
|
|
374033
|
+
const [address, v] = sdk.addressProvider.getLatestVersion(AP_ROUTER);
|
|
374034
|
+
if (v >= 300 && v < 310) {
|
|
374035
|
+
return new RouterV300Contract(sdk, address);
|
|
374036
|
+
}
|
|
374037
|
+
if (v === 310) {
|
|
374038
|
+
return new RouterV310Contract(sdk, address);
|
|
374039
|
+
}
|
|
374040
|
+
throw new Error(`Unsupported router version ${v}`);
|
|
373651
374041
|
}
|
|
373652
374042
|
|
|
373653
374043
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/accounts/CreditAccountsService.js
|
|
@@ -373657,7 +374047,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
373657
374047
|
#logger;
|
|
373658
374048
|
constructor(sdk, options) {
|
|
373659
374049
|
super(sdk);
|
|
373660
|
-
this.#compressor = sdk.addressProvider.getLatestVersion(
|
|
374050
|
+
[this.#compressor] = sdk.addressProvider.getLatestVersion(
|
|
373661
374051
|
AP_CREDIT_ACCOUNT_COMPRESSOR
|
|
373662
374052
|
);
|
|
373663
374053
|
this.#batchSize = options?.batchSize;
|
|
@@ -374419,10 +374809,12 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
374419
374809
|
return this.sdk.marketRegister.marketConfigurators.map((mc) => mc.address);
|
|
374420
374810
|
}
|
|
374421
374811
|
get rewardCompressor() {
|
|
374422
|
-
return this.sdk.addressProvider.getLatestVersion(AP_REWARDS_COMPRESSOR);
|
|
374812
|
+
return this.sdk.addressProvider.getLatestVersion(AP_REWARDS_COMPRESSOR)[0];
|
|
374423
374813
|
}
|
|
374424
374814
|
get peripheryCompressor() {
|
|
374425
|
-
return this.sdk.addressProvider.getLatestVersion(
|
|
374815
|
+
return this.sdk.addressProvider.getLatestVersion(
|
|
374816
|
+
AP_PERIPHERY_COMPRESSOR
|
|
374817
|
+
)[0];
|
|
374426
374818
|
}
|
|
374427
374819
|
};
|
|
374428
374820
|
|
|
@@ -374456,13 +374848,12 @@ var AbstractAddressProviderContract = class extends BaseContract {
|
|
|
374456
374848
|
return result;
|
|
374457
374849
|
}
|
|
374458
374850
|
getLatestVersion(contract) {
|
|
374459
|
-
|
|
374851
|
+
const version4 = this.#latest[contract];
|
|
374852
|
+
if (!version4) {
|
|
374460
374853
|
throw new Error(`Latest version for ${contract} not found`);
|
|
374461
374854
|
}
|
|
374462
|
-
this.logger?.debug(
|
|
374463
|
-
|
|
374464
|
-
);
|
|
374465
|
-
return this.getAddress(contract, this.#latest[contract]);
|
|
374855
|
+
this.logger?.debug(`Latest version found for ${contract} : ${version4}`);
|
|
374856
|
+
return [this.getAddress(contract, version4), version4];
|
|
374466
374857
|
}
|
|
374467
374858
|
get state() {
|
|
374468
374859
|
return {
|
|
@@ -374503,7 +374894,7 @@ var AbstractAddressProviderContract = class extends BaseContract {
|
|
|
374503
374894
|
};
|
|
374504
374895
|
|
|
374505
374896
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/address-provider/AddressProviderV3_1Contract.js
|
|
374506
|
-
var
|
|
374897
|
+
var abi21 = iAddressProviderV310Abi;
|
|
374507
374898
|
var AddressProviderContractV3_1 = class extends AbstractAddressProviderContract {
|
|
374508
374899
|
constructor(sdk, address, addresses = {}) {
|
|
374509
374900
|
super(
|
|
@@ -374511,7 +374902,7 @@ var AddressProviderContractV3_1 = class extends AbstractAddressProviderContract
|
|
|
374511
374902
|
{
|
|
374512
374903
|
addr: address,
|
|
374513
374904
|
name: "AddressProviderV3_1",
|
|
374514
|
-
abi:
|
|
374905
|
+
abi: abi21,
|
|
374515
374906
|
version: 310
|
|
374516
374907
|
},
|
|
374517
374908
|
addresses
|
|
@@ -374559,7 +374950,7 @@ var AddressProviderContractV3_1 = class extends AbstractAddressProviderContract
|
|
|
374559
374950
|
};
|
|
374560
374951
|
|
|
374561
374952
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/address-provider/AddressProviderV3Contract.js
|
|
374562
|
-
var
|
|
374953
|
+
var abi22 = iAddressProviderV300Abi;
|
|
374563
374954
|
var AddressProviderContractV3 = class extends AbstractAddressProviderContract {
|
|
374564
374955
|
constructor(sdk, address, addresses = {}) {
|
|
374565
374956
|
super(
|
|
@@ -374567,7 +374958,7 @@ var AddressProviderContractV3 = class extends AbstractAddressProviderContract {
|
|
|
374567
374958
|
{
|
|
374568
374959
|
addr: address,
|
|
374569
374960
|
name: "AddressProviderV3",
|
|
374570
|
-
abi:
|
|
374961
|
+
abi: abi22,
|
|
374571
374962
|
version: 300
|
|
374572
374963
|
},
|
|
374573
374964
|
addresses
|
|
@@ -374626,8 +375017,8 @@ var AddressProviderContractV3 = class extends AbstractAddressProviderContract {
|
|
|
374626
375017
|
}
|
|
374627
375018
|
};
|
|
374628
375019
|
|
|
374629
|
-
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/address-provider/
|
|
374630
|
-
async function
|
|
375020
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/address-provider/createAddressProvider.js
|
|
375021
|
+
async function createAddressProvider(sdk, address, options) {
|
|
374631
375022
|
const addr = options?.state?.baseParams.addr ?? address;
|
|
374632
375023
|
let v = options?.state?.baseParams.version ?? options?.version;
|
|
374633
375024
|
if (!v) {
|
|
@@ -374657,12 +375048,12 @@ async function getAddressProvider(sdk, address, options) {
|
|
|
374657
375048
|
}
|
|
374658
375049
|
|
|
374659
375050
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/BotListV3Contract.js
|
|
374660
|
-
var
|
|
375051
|
+
var abi23 = iBotListV300Abi;
|
|
374661
375052
|
var BotListContract = class extends BaseContract {
|
|
374662
375053
|
#approvedCreditManagers;
|
|
374663
375054
|
#currentBlock;
|
|
374664
375055
|
constructor(sdk, address) {
|
|
374665
|
-
super(sdk, { addr: address, name: "BotListV3", abi:
|
|
375056
|
+
super(sdk, { addr: address, name: "BotListV3", abi: abi23 });
|
|
374666
375057
|
this.#currentBlock = ADDRESS_PROVIDER_BLOCK[sdk.provider.networkType];
|
|
374667
375058
|
}
|
|
374668
375059
|
parseFunctionParams(params) {
|
|
@@ -374728,10 +375119,10 @@ var BotListContract = class extends BaseContract {
|
|
|
374728
375119
|
};
|
|
374729
375120
|
|
|
374730
375121
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/core/GearStakingV3Contract.js
|
|
374731
|
-
var
|
|
375122
|
+
var abi24 = iGearStakingV300Abi;
|
|
374732
375123
|
var GearStakingContract = class extends BaseContract {
|
|
374733
375124
|
constructor(sdk, address) {
|
|
374734
|
-
super(sdk, { addr: address, name: "GearStakingV3", abi:
|
|
375125
|
+
super(sdk, { addr: address, name: "GearStakingV3", abi: abi24 });
|
|
374735
375126
|
}
|
|
374736
375127
|
parseFunctionParams(params) {
|
|
374737
375128
|
switch (params.functionName) {
|
|
@@ -374909,7 +375300,7 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
374909
375300
|
},
|
|
374910
375301
|
"attaching"
|
|
374911
375302
|
);
|
|
374912
|
-
this.#addressProvider = await
|
|
375303
|
+
this.#addressProvider = await createAddressProvider(this, addressProvider);
|
|
374913
375304
|
this.logger?.debug(
|
|
374914
375305
|
`address provider version: ${this.#addressProvider.version}`
|
|
374915
375306
|
);
|
|
@@ -374934,8 +375325,7 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
374934
375325
|
ignoreUpdateablePrices
|
|
374935
375326
|
);
|
|
374936
375327
|
try {
|
|
374937
|
-
|
|
374938
|
-
this.#router = new RouterV3Contract(this, router);
|
|
375328
|
+
this.#router = createRouter(this);
|
|
374939
375329
|
} catch (e) {
|
|
374940
375330
|
this.logger?.warn("Router not found", e);
|
|
374941
375331
|
}
|
|
@@ -392587,7 +392977,7 @@ function normalizeTransactions(batch) {
|
|
|
392587
392977
|
});
|
|
392588
392978
|
}
|
|
392589
392979
|
function normalizeDirectTx(t) {
|
|
392590
|
-
const
|
|
392980
|
+
const abi25 = [
|
|
392591
392981
|
{
|
|
392592
392982
|
type: "function",
|
|
392593
392983
|
outputs: [],
|
|
@@ -392609,10 +392999,10 @@ function normalizeDirectTx(t) {
|
|
|
392609
392999
|
return {
|
|
392610
393000
|
target: t.to,
|
|
392611
393001
|
value: t.value,
|
|
392612
|
-
signature: formatAbiItem2(
|
|
393002
|
+
signature: formatAbiItem2(abi25[0], { includeName: false }),
|
|
392613
393003
|
parameters,
|
|
392614
393004
|
data: encodeFunctionData({
|
|
392615
|
-
abi:
|
|
393005
|
+
abi: abi25,
|
|
392616
393006
|
functionName: t.contractMethod.name,
|
|
392617
393007
|
args: values
|
|
392618
393008
|
})
|
|
@@ -403435,9 +403825,9 @@ var AbstractParser = class {
|
|
|
403435
403825
|
};
|
|
403436
403826
|
}
|
|
403437
403827
|
parseConstructor(address, encodedArgs) {
|
|
403438
|
-
for (const { abi:
|
|
403828
|
+
for (const { abi: abi25, comment } of this.constructorAbis) {
|
|
403439
403829
|
try {
|
|
403440
|
-
return this.#parseConstructor(address, encodedArgs,
|
|
403830
|
+
return this.#parseConstructor(address, encodedArgs, abi25, comment);
|
|
403441
403831
|
} catch (e) {
|
|
403442
403832
|
this.logger.warn(`constructor ${comment} of ${address} failed to parse args: ${e}`);
|
|
403443
403833
|
}
|
|
@@ -407595,7 +407985,7 @@ function getRenderer(opts) {
|
|
|
407595
407985
|
var package_default = {
|
|
407596
407986
|
name: "@gearbox-protocol/deploy-tools",
|
|
407597
407987
|
description: "Gearbox deploy tools",
|
|
407598
|
-
version: "5.16.
|
|
407988
|
+
version: "5.16.14",
|
|
407599
407989
|
homepage: "https://gearbox.fi",
|
|
407600
407990
|
keywords: [
|
|
407601
407991
|
"gearbox"
|
|
@@ -407638,7 +408028,7 @@ var package_default = {
|
|
|
407638
408028
|
"@gearbox-protocol/deploy-tools-node": "0.0.0",
|
|
407639
408029
|
"@gearbox-protocol/deploy-tools-shared": "0.0.0",
|
|
407640
408030
|
"@gearbox-protocol/deploy-tools-types": "0.0.0",
|
|
407641
|
-
"@gearbox-protocol/sdk": "3.0.0-vfour.
|
|
408031
|
+
"@gearbox-protocol/sdk": "3.0.0-vfour.280",
|
|
407642
408032
|
"@gearbox-protocol/sdk-gov": "^2.36.5",
|
|
407643
408033
|
"@types/lodash-es": "^4.17.12",
|
|
407644
408034
|
"@types/node": "^22.13.5",
|