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/eth.js CHANGED
@@ -25308,7 +25308,8 @@ var decode = (transaction) => {
25308
25308
  );
25309
25309
  }
25310
25310
  const contractInputsValues = asTxBuilderInputValues(
25311
- iface.decodeFunctionData(functionFragment, transaction.data)
25311
+ iface.decodeFunctionData(functionFragment, transaction.data),
25312
+ functionFragment.inputs
25312
25313
  );
25313
25314
  return {
25314
25315
  to: transaction.to,
@@ -25329,23 +25330,26 @@ var mapInputs = (inputs) => {
25329
25330
  components: mapInputs(input.components)
25330
25331
  }));
25331
25332
  };
25332
- var asTxBuilderInputValues = (result) => {
25333
+ var asTxBuilderInputValues = (result, params) => {
25333
25334
  const object = {};
25334
- for (const key of Object.keys(result)) {
25335
- if (isNaN(Number(key))) {
25336
- const value = result[key];
25337
- let serialized = value;
25338
- if (typeof value === "string") {
25339
- serialized = value;
25340
- } else if (typeof value === "bigint") {
25341
- serialized = value.toString();
25342
- } else if ((0, import_ethers11.isBytesLike)(value)) {
25343
- serialized = (0, import_ethers11.hexlify)(value);
25344
- } else {
25345
- serialized = JSON.stringify(value);
25346
- }
25347
- object[key] = serialized;
25335
+ for (const param of params) {
25336
+ const value = result[param.name];
25337
+ let serialized = value;
25338
+ if (typeof value === "string") {
25339
+ serialized = value;
25340
+ } else if (typeof value === "bigint" || typeof value === "number") {
25341
+ serialized = value.toString();
25342
+ } else if ((0, import_ethers11.isBytesLike)(value)) {
25343
+ serialized = (0, import_ethers11.hexlify)(value);
25344
+ } else if (value instanceof import_ethers11.Result) {
25345
+ serialized = JSON.stringify(
25346
+ value,
25347
+ (_, v) => (0, import_ethers11.isBytesLike)(v) ? (0, import_ethers11.hexlify)(v) : typeof v === "bigint" ? v.toString() : v
25348
+ );
25349
+ } else {
25350
+ throw new Error(`Unexpected value type: ${typeof value}`);
25348
25351
  }
25352
+ object[param.name] = serialized;
25349
25353
  }
25350
25354
  return object;
25351
25355
  };