0

I want to send a signed transaction with ethers through a provider, but the sendTransaction method does not exist anywhere besides the Wallet object. I basically want to do something like this:

    const provider = new JsonRpcProvider("https://coston-api.flare.network/ext/C/rpc")

    const signedTx = Transaction.from({
        data: unsignedTx.data,
        to: unsignedTx.to,
        gasLimit: unsignedTx.gasLimit,
        gasPrice: unsignedTx.gasPrice,
        nonce: unsignedTx.nonce,
        signature: {
            r: resp.r.toString('hex'),
            s: resp.s.toString('hex'),
            v: resp.recoveryParam!
        }
    })

    // send transaction
    await provider.sendTransaction(signedTx)

I know I can use web3, or call the node API directly, but I want this to be ethers-encapsulated. How can I do it?

1 Answer 1

1

You can use the send function of the provider as per the docs: https://docs.ethers.org/v5/api/providers/jsonrpc-provider/#JsonRpcProvider-send.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.