Web3Provider for dApps

Utilize a provider that is supported for EVM Chains

This is a bridge between all Web3 libraries that are built for EVM chains. If you have a dApp with EthersJS, you can integrate Tweed with just 3 lines of code by initializing this Web3Provider and injecting it into EthersJS.

Tweed's Web3Provider allows developers to integrate Tweed into their platform as if they were integrating any other Web3 component complying with EIP1193 standard. Tweed's provider implements the chainChanged functionality to support the EVMs that are supported by the Tweed infrastructure.

You can find code examples in JavaScript and React below.


Usage Examples

JavaScript

import { TweedFrontendSDK } from '@paytweed/frontend-sdk'

const frontendSDK = TweedFrontendSDK.setup({...})

// Get the relevant chain's provider
const tweedProvider = await frontendSDK.blockchain.getProvider({
    chainId: 'ethereumSepolia', //ethereumSepolia as an example
});

// Get the provider wrapped up inside ethers
const web3Provider = new ethers.providers.Web3Provider(tweedProvider);

// Use the provider
const signer = web3Provider.getSigner();
const contract = new ethers.Contract(CONTRACT_ADDRESS, CONTRACT_ABI, signer); //Add you contract address and ABI

// Send transaction
const { hash } = await signer.sendTransaction({to: "0x0...0"})

Last updated