gbangbola-stx-transactions
v1.0.0
Published
Build, sign, broadcast, batch, and manage Stacks L2 transactions
Maintainers
Readme
gbangbola-stx-transactions
STX transfers, fee estimation, and transaction confirmation for Stacks L2.
| | Link |
|---|------|
| npm | gbangbola-stx-transactions |
| Repository | Gbangbolaoluwagbemiga/gbangbola-stx-transactions |
Install
npm install gbangbola-stx-transactionsDepends on @stacks/transactions, @stacks/network, and richiey1-stacks-helpers-types.
Usage
import { transferSTX, estimateFee, waitForConfirmation } from "gbangbola-stx-transactions";
// Transfer STX
const result = await transferSTX({
recipient: "SP...",
amount: 1000000n,
senderKey: "your-private-key",
});
// Estimate fees
const fees = await estimateFee("token_transfer");
// Returns: { low: 2500, medium: 3750, high: 5000 }
// Wait for transaction confirmation
const confirmation = await waitForConfirmation("0x...");
// Returns: { success: true, status: "success" }API
transferSTX(options)
Send STX to a recipient. Options:
recipient— Address to send toamount— Amount in uSTX (bigint)senderKey— Sender's private keynetwork?— Stacks network (default: mainnet)nonce?— Transaction noncefee?— Transaction fee in uSTX
estimateFee(txType, networkUrl?)
Estimate fees for a transaction type. Returns { low, medium, high }.
waitForConfirmation(txid, networkUrl?, timeoutMs?, pollMs?)
Poll for transaction confirmation. Returns { success, status }.
Development
npm install
npm run buildLicense
MIT
Author
gbangbolaoluwagbemiga
