Transfers & contract calls
buildTransfer and buildScTransaction — high-level signed transaction builders.
Both methods return { encoded, hash }: encoded is the base64 transaction ready to broadcast; hash is the canonical TxHash.
wallet.buildTransfer(params)
Builds and signs a QU transfer.
import { createWallet, generateSeed } from "@qubic.org/wallet"
import { createLiveClient } from "@qubic.org/rpc"
import { toIdentity } from "@qubic.org/types"
const live = createLiveClient()
const wallet = createWallet(generateSeed())
const { tick } = await live.getTickInfo()
const { encoded, hash } = await wallet.buildTransfer({
destination: toIdentity("CFBMEMZOIDEXQAUXYYSZIURADQLAPWPMNJXQSNVQZAHYVOPYUKKJBJUCTVJL"),
amount: 1_000_000n,
targetTick: tick + 5,
currentTick: tick,
})
await live.broadcastTransaction(encoded)
console.log("TX hash:", hash)Parameters
| Name | Type | Required | Description |
|---|---|---|---|
destination | Identity | Yes | Recipient identity |
amount | bigint | Yes | QU to send |
targetTick | number | Yes | Tick by which node must process the TX |
currentTick | number | Yes | Current tick (used for expiry validation) |
Returns Promise<{ encoded: Base64, hash: TxHash }>
wallet.buildScTransaction(params)
Builds and signs a smart contract procedure call.
import { qearn } from "@qubic.org/contracts"
import { toIdentity } from "@qubic.org/types"
const destination = toIdentity("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
const { encoded, hash } = await wallet.buildScTransaction({
destination,
amount: 10_000_000n,
targetTick: tick + 5,
currentTick: tick,
inputType: qearn.LOCK_INPUT_TYPE,
payload: qearn.buildLockInput({ amount: 10_000_000n }),
})The destination for all SC calls is the 60-character all-A identity (the zero address). Each contract is identified by its inputType, not by address.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
destination | Identity | Yes | Zero identity (AAAA...) |
amount | bigint | Yes | QU attached to the call (0n for read-only procedures) |
targetTick | number | Yes | Tick deadline |
currentTick | number | Yes | Current tick |
inputType | number | Yes | Procedure input type constant |
payload | Uint8Array | Yes | Encoded procedure input |
Returns Promise<{ encoded: Base64, hash: TxHash }>
wallet.identity
The Qubic identity derived from the wallet's seed. Read-only.
const wallet = createWallet(seed)
console.log(wallet.identity) // Identity — 60 uppercase charswallet.publicKey
The 32-byte FourQ public key derived from the wallet's seed. Useful for low-level TCP calls.
const pk: Uint8Array = wallet.publicKey