starknet-io / starknet.js

JavaScript library for StarkNet
https://www.starknetjs.com
MIT License
1.21k stars 739 forks source link

meta-class functions do not handle Uint256 type #601

Closed PhilippeR26 closed 1 year ago

PhilippeR26 commented 1 year ago

Describe the bug In v5.9.0, if I use meta-class, and if I have to send an uint256, it works fine with a BigNumberish (for example, a bignumber (10n). But it fails if I provide a Uint256 variable. multiType is including Uint256, but the code do not handle it.

To Reproduce this contract has a test_u256 function, that requires a uint256 variable.

const param1:uint256.Uint256 = uint256.bnToUint256(10n);
const res2a = await myTestContract.test_u256(10n); // succeed in v5.9.0
const res2 = await myTestContract.test_u256(param1); // 🚨 fail in v5.9.0

extracted from https://github.com/PhilippeR26/starknet.js-workshop-typescript/blob/main/src/scripts/cairo11-devnet/12b.CallInvokeContractTest3.ts

Expected behavior A meta-class function should handle all multiType types.

Desktop (please complete the following information):

PhilippeR26 commented 1 year ago

I proposed PR #602 .