@ethernauta/transaction
v0.0.40
Published
[](https://deno.bundlejs.com/badge?q=@ethernauta/[email protected]&treeshake=[*])
Downloads
63
Readme
Philosophy
This module allows to track transactions submitted to the blockchain. It implements a pooling system that every few seconds will call eth_getTransactionReceipt to get the latest transaction's status
Modules
API
import { eth_sendRawTransaction } from "@ethernauta/eth"
import { number_to_hex } from "@ethernauta/wallet"
import { writer, SEPOLIA_CHAIN_ID } from "./writer"
import {
watch_transaction,
register_transaction
} from "@ethernauta/transaction"
const writable = transfer([
"0x636c0fcd6da2207abfa80427b556695a4ad0af94",
number_to_hex(1),
])
const hash = await writable(
writer(SEPOLIA_CHAIN_ID),
)
// initial transaction state
// with "type" key equal "pending"
const transaction = register_transaction(hash)
watch_transaction(hash, (transaction) => {
// subsequent states that the transaction goes trough
})