defi-kit 2.0.0 → 2.0.1

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/arb1.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  arb12,
4
4
  createApply,
5
5
  createExportToSafeTransactionBuilder
6
- } from "./chunk-AUSHK4AH.mjs";
6
+ } from "./chunk-QN7LFK2K.mjs";
7
7
  import "./chunk-E7RA4BMW.mjs";
8
8
 
9
9
  // src/arb1.ts
@@ -25249,6 +25249,7 @@ var POSTER_ADDRESS = "0x000000000000cd17345801aa8147b8D3950260FF";
25249
25249
  // src/export.ts
25250
25250
  import {
25251
25251
  Interface,
25252
+ Result,
25252
25253
  hexlify,
25253
25254
  isBytesLike
25254
25255
  } from "ethers";
@@ -25285,7 +25286,8 @@ var decode = (transaction) => {
25285
25286
  );
25286
25287
  }
25287
25288
  const contractInputsValues = asTxBuilderInputValues(
25288
- iface.decodeFunctionData(functionFragment, transaction.data)
25289
+ iface.decodeFunctionData(functionFragment, transaction.data),
25290
+ functionFragment.inputs
25289
25291
  );
25290
25292
  return {
25291
25293
  to: transaction.to,
@@ -25306,23 +25308,26 @@ var mapInputs = (inputs) => {
25306
25308
  components: mapInputs(input.components)
25307
25309
  }));
25308
25310
  };
25309
- var asTxBuilderInputValues = (result) => {
25311
+ var asTxBuilderInputValues = (result, params) => {
25310
25312
  const object = {};
25311
- for (const key of Object.keys(result)) {
25312
- if (isNaN(Number(key))) {
25313
- const value = result[key];
25314
- let serialized = value;
25315
- if (typeof value === "string") {
25316
- serialized = value;
25317
- } else if (typeof value === "bigint") {
25318
- serialized = value.toString();
25319
- } else if (isBytesLike(value)) {
25320
- serialized = hexlify(value);
25321
- } else {
25322
- serialized = JSON.stringify(value);
25323
- }
25324
- object[key] = serialized;
25313
+ for (const param of params) {
25314
+ const value = result[param.name];
25315
+ let serialized = value;
25316
+ if (typeof value === "string") {
25317
+ serialized = value;
25318
+ } else if (typeof value === "bigint" || typeof value === "number") {
25319
+ serialized = value.toString();
25320
+ } else if (isBytesLike(value)) {
25321
+ serialized = hexlify(value);
25322
+ } else if (value instanceof Result) {
25323
+ serialized = JSON.stringify(
25324
+ value,
25325
+ (_, v) => isBytesLike(v) ? hexlify(v) : typeof v === "bigint" ? v.toString() : v
25326
+ );
25327
+ } else {
25328
+ throw new Error(`Unexpected value type: ${typeof value}`);
25325
25329
  }
25330
+ object[param.name] = serialized;
25326
25331
  }
25327
25332
  return object;
25328
25333
  };
@@ -25337,4 +25342,4 @@ export {
25337
25342
  createApply,
25338
25343
  createExportToSafeTransactionBuilder
25339
25344
  };
25340
- //# sourceMappingURL=chunk-AUSHK4AH.mjs.map
25345
+ //# sourceMappingURL=chunk-QN7LFK2K.mjs.map