joshstevens19 / ethereum-abi-types-generator

Generate typings based on your ABIs, with provider wrappers exposed.
MIT License
163 stars 22 forks source link

uint256 types are converted into string #68

Open serhanguney opened 9 months ago

serhanguney commented 9 months ago

Below is a method found in the abi I'm transforming:

{
            inputs: [
                {
                    components: [
                        {
                            internalType: 'uint256',
                            name: 'amount',
                            type: 'uint256',
                        },
                        {
                            internalType: 'address',
                            name: 'itemAddress',
                            type: 'address',
                        },
                        {
                            internalType: 'uint8',
                            name: 'propertyType',
                            type: 'uint8',
                        },
                    ],
                    internalType: 'struct SafeRoom.PackageItem[]',
                    name: 'packageList',
                    type: 'tuple[]',
                },
                {
                    internalType: 'address',
                    name: 'recipient',
                    type: 'address',
                },
                {
                    components: [
                        {
                            internalType: 'uint256',
                            name: 'packageAmount',
                            type: 'uint256',
                        },
                        {
                            internalType: 'address',
                            name: 'currencyAddress',
                            type: 'address',
                        },
                    ],
                    internalType: 'struct SafeRoom.PackageCurrency',
                    name: 'currency',
                    type: 'tuple',
                },
                {
                    internalType: 'uint256',
                    name: 'packageLifeTime',
                    type: 'uint256',
                },
                {
                    internalType: 'bool',
                    name: 'isPublishToMarket',
                    type: 'bool',
                },
            ],
            name: 'createPackage',
            outputs: [],
            stateMutability: 'nonpayable',
            type: 'function',
        },
        ...

In the generated file the createPackage method is found to be as such:


createPackage(
    packageList: PackageListRequest[],
    recipient: string,
    currency: CurrencyRequest,
    packageLifeTime: string,
    isPublishToMarket: boolean
  ): MethodReturnContext;

export interface PackageListRequest {
  amount: string;
  itemAddress: string;
  propertyType: string | number;
}

export interface CurrencyRequest {
  packageAmount: string;
  currencyAddress: string;
}

As you can see the uint256 types are being transformed into string. I would expect them to be transformed into bigint type. I checked the documentation and found nothing regarding the uint256 type. Is there something I'm missing ?