UNPKG

@samudai_xyz/web3-sdk

Version:

## All in one web3 integrations for Samudai

20 lines (19 loc) 717 B
import Web3 from 'web3'; import { UserTokenBalance } from '../../tokenBalance/src/tokenbalance'; export const encodeData = (address, value) => { const web3 = new Web3(); const encodedCallData = web3.eth.abi.encodeFunctionCall({ name: 'transfer', type: 'function', inputs: [ { name: 'dst', type: 'address' }, { name: 'wad', type: 'uint256' }, ], }, [address, value]); return encodedCallData; }; export const getDecimalsForToken = async (chainId, tokenAddress) => { const userTokenBalance = new UserTokenBalance(); const tokenMetaData = await userTokenBalance.getTokenMetadata(chainId, tokenAddress); return tokenMetaData.decimals; };