Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make the web3 interface extendable #18

Merged
merged 2 commits into from
Jan 26, 2024
Merged

Conversation

frolovdev
Copy link
Contributor

@frolovdev frolovdev commented Jan 26, 2024

IWeb3 and I prefixing - naming negotiatable

Wanna achieve something like this

import {Web3ProviderConnector} from '1inch/multicall';

declare module '1inch/multicall' {
    interface IWeb3CallInfo {
        ololol: string
        someNewField: string
    }
}

class OlololProvider extends Web3ProviderConnector {
    ethCall(
        contractAddress: string,
        callData: string,
        blockNumber = 'latest'
    ): Promise<string> {
        return this.web3Provider.eth.call(
            {
                to: contractAddress,
                data: callData,
                ololol: 'ololol',
                someNewField: 'someNewField'
            },
            blockNumber
        );
    }
}

required to support custom eth call, for example

 return this.web3Provider.eth.call(
            {
                to: contractAddress,
                data: callData,
                maxFeePerGas: '50000000000000',
                maxPriorityFeePerGas: '0',
                gas: 100000000
            },
            blockNumber
        )

@frolovdev frolovdev merged commit febfbca into master Jan 26, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants