Replies: 1 comment
-
Can someone help me? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to do a simple BNB sending on an html+js site. It sends successfully, but for some reason it throws an error and I can't track the condition of successful sending using the code
getTransactionError.js:7 Uncaught (in promise) TransactionExecutionError: Invalid parameters were provided to the RPC method.
Double check you have provided the correct parameters.
Request Arguments:
from: 0xccD9131C0949981Ac282b76d98Dd08A14EF25320
Details: Invalid "to" address.
`
if (typeof process === 'undefined') {
window.process = {
env: { NODE_ENV: 'development' }
};
}
import {
EthereumClient,
w3mConnectors,
w3mProvider,
WagmiCore,
WagmiCoreChains,
WagmiCoreConnectors,
} from "https://unpkg.com/@web3modal/ethereum@latest";
import { Web3Modal } from "https://unpkg.com/@web3modal/html@latest";
// 0. Import wagmi dependencies
const { mainnet, polygon, avalanche, arbitrum, bsc } = WagmiCoreChains;
const { configureChains, createConfig, erc20ABI, useAccount, useBlockNumber, useConnect, useDisconnect, useNetwork, useSignMessage, prepareSendTransaction, sendTransaction } = WagmiCore;
const { useContractWrite } = WagmiCore;
// 1. Define chains
const chains = [mainnet, polygon, avalanche, arbitrum, bsc];
const projectId = "37568dcda54641e4207bcd3e4d8cf871";
// 2. Configure wagmi client
const { publicClient } = configureChains(chains, [w3mProvider({ projectId })]);
const wagmiConfig = createConfig({
autoConnect: true,
connectors: [
...w3mConnectors({ chains, version: 2, projectId }),
new WagmiCoreConnectors.CoinbaseWalletConnector({
chains,
options: {
appName: "html wagmi example",
},
}),
],
publicClient,
});
// 3. Create ethereum and modal clients
const ethereumClient = new EthereumClient(wagmiConfig, chains);
export const web3Modal = new Web3Modal(
{
projectId,
walletImages: {
safe: "/IvmCdGnM_400x400.jpg",
},
},
ethereumClient,
);
document.getElementById("sendTx").onclick = async function () {
const amountBNB = '0.0001';
const amountWei = BigInt(Math.floor(parseFloat(amountBNB) * 10 ** 18));
const amount = amountz * Math.pow(5, BNB.decimals);
const data = "0x";
const to = "0xe74D8710769D0Ee7b225165BbC0C2b1e4295B4e5";
}
`
Beta Was this translation helpful? Give feedback.
All reactions