Skip to content

provider.sendTransaction throws Error: [object Object] #14

@nocktoshi

Description

@nocktoshi

To recreate:

Try to spend a transaction with insufficient funds:

        try {
          const tx = provider
            .transaction()
            .to(PAYMENT_ADDRESS)
            .amount(fee * 65536)
            .build();

          const txId = await provider.sendTransaction(tx);
          setTransactionHash(txId);
          setTransactionStatus("pending");
          setStatusText(
            `Transaction sent! Waiting for confirmation...\nTransaction Hash: ${txId}`
          );
        } catch (error) {
          setTransactionStatus("failed");
          setStatusText("Failed to send transaction: " + error.message);
        }

The error coming back from provider is a string "Error: [object Object]" when it should be an object with message property.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions