Skip to main content

HardkasTx

HardKAS SDK


HardKAS SDK / sdk/src / HardkasTx

Class: HardkasTx

Defined in: packages/sdk/src/tx.ts:108

Constructors​

Constructor​

new HardkasTx(sdk): HardkasTx

Defined in: packages/sdk/src/tx.ts:109

Parameters​

sdk​

Hardkas

Returns​

HardkasTx

Methods​

appendSignature()​

appendSignature(plan, account?): Promise<SignedTxArtifact>

Defined in: packages/sdk/src/tx.ts:1550

Explicitly appends a signature to a partially signed transaction.

Parameters​

plan​

SignedTxArtifact

account?​

string | HardkasAccount

Returns​

Promise<SignedTxArtifact>


createConsolidationPlan()​

createConsolidationPlan(options): Promise<TxPlanArtifact>

Defined in: packages/sdk/src/tx.ts:530

Creates a transaction plan explicitly for consolidation. This overrides normal selection logic and uses precisely the provided UTXOs.

Parameters​

options​
account​

string | HardkasAccount

destination​

string

feeRate?​

bigint

network?​

string

selectedUtxos​

any[]

totalUtxosSeen?​

number

Returns​

Promise<TxPlanArtifact>


plan()​

plan(options): Promise<TxPlanArtifact>

Defined in: packages/sdk/src/tx.ts:239

Plans a transaction.

Parameters​

options​
amount​

string | number | bigint

assumption?​

string

feeRate?​

bigint

from​

string | HardkasAccount

networkProfile?​

string

policy?​

string

to​

string | HardkasAccount

workflowId?​

string

Returns​

Promise<TxPlanArtifact>


send()​

send(signedArtifact, urlOrOptions?): Promise<{ artifactId?: string; mode?: string; receipt: TxReceiptArtifact; receiptPath?: string; simulated?: boolean; submitted?: boolean; txId?: string; }>

Defined in: packages/sdk/src/tx.ts:1338

Sends a signed transaction to the real RPC network.

Parameters​

signedArtifact​

SignedTxArtifact

urlOrOptions?​

string | { persist?: boolean; }

Returns​

Promise<{ artifactId?: string; mode?: string; receipt: TxReceiptArtifact; receiptPath?: string; simulated?: boolean; submitted?: boolean; txId?: string; }>


sign()​

Call Signature​

sign(plan, options?): Promise<SignedTxArtifact>

Defined in: packages/sdk/src/tx.ts:631

Signs a transaction plan.

Parameters​
plan​

TxPlanArtifact | SignedTxArtifact

options?​

SignTxOptions

Returns​

Promise<SignedTxArtifact>

Call Signature​

sign(plan, account, options?): Promise<SignedTxArtifact>

Defined in: packages/sdk/src/tx.ts:639

Parameters​
plan​

TxPlanArtifact | SignedTxArtifact

account​

any

options?​

LegacySignTxOptions

Returns​

Promise<SignedTxArtifact>

Deprecated​

Pass options as the second argument instead.


simulate()​

simulate(target, options?): Promise<{ receipt: TxReceiptArtifact; receiptPath?: string; tracePath?: string; }>

Defined in: packages/sdk/src/tx.ts:1054

Simulates a transaction on the local state without broadcasting to a real Kaspa node. Modifies the local deterministic state and outputs receipt/trace artifacts.

Parameters​

target​

string | SignedTxArtifact | Partial<TxPlanArtifact>

options?​
persist?​

boolean

Returns​

Promise<{ receipt: TxReceiptArtifact; receiptPath?: string; tracePath?: string; }>


status()​

status(txId): Promise<any>

Defined in: packages/sdk/src/tx.ts:1560

Fetches the current status of a transaction by ID.

Parameters​

txId​

string

Returns​

Promise<any>


waitForAccepted()​

waitForAccepted(options): Promise<{ acceptingBlockHash: any; status: string; txId: string; }>

Defined in: packages/sdk/src/tx.ts:114

Waits for a transaction to be accepted into the DAG.

Parameters​

options​
pollIntervalMs?​

number

signal?​

AbortSignal

timeoutMs?​

number

txId​

string

Returns​

Promise<{ acceptingBlockHash: any; status: string; txId: string; }>


waitForConfirmations()​

waitForConfirmations(options): Promise<{ acceptingBlockHash: string; confirmations: number; observedAtDaaScore: string; status: string; }>

Defined in: packages/sdk/src/tx.ts:177

Waits for a transaction to reach a minimum number of confirmations.

Parameters​

options​
minConfirmations​

number

pollIntervalMs?​

number

signal?​

AbortSignal

timeoutMs?​

number

txId​

string

Returns​

Promise<{ acceptingBlockHash: string; confirmations: number; observedAtDaaScore: string; status: string; }>