@aldea/sdk / Exports / TxBuilder
Class: TxBuilder
Transaction Builder
A simple API for building transactions.
Table of contents
Constructors
Properties
Accessors
Methods
- applyHooks
- build
- call
- deploy
- exec
- fund
- getResult
- import
- load
- loadByOrigin
- lock
- new
- push
- refuteBuilding
- refuteMutation
- resultFromInstruction
- resultFromReturnType
- sign
- signTo
Constructors
constructor
• new TxBuilder(aldea
, opts?
): TxBuilder
Parameters
Name | Type |
---|---|
aldea | Aldea |
opts | TxBuilderOpts |
Returns
Defined in
packages/sdk/src/tx-builder.ts:91
Properties
_tx
• Private
_tx: Tx
Defined in
packages/sdk/src/tx-builder.ts:89
afterHooks
• Private
afterHooks: TxBuildHook
[]
Defined in
packages/sdk/src/tx-builder.ts:86
aldea
• Private
aldea: Aldea
Defined in
packages/sdk/src/tx-builder.ts:83
buildHooks
• Private
buildHooks: TxBuildHook
[]
Defined in
packages/sdk/src/tx-builder.ts:85
buildSteps
• Private
buildSteps: [TxBuildStep
, any
[]][]
Defined in
packages/sdk/src/tx-builder.ts:84
isBuilding
• Private
isBuilding: boolean
= false
Defined in
packages/sdk/src/tx-builder.ts:88
results
• Private
results: InstructionResult
[]
Defined in
packages/sdk/src/tx-builder.ts:87
Accessors
tx
• get
tx(): Tx
Returns the transaction being built. Can only be accessed during building.
Returns
Defined in
packages/sdk/src/tx-builder.ts:166
Methods
applyHooks
▸ applyHooks(hooks
, instruction
, idx
): Promise
<Instruction
>
Parameters
Name | Type |
---|---|
hooks | TxBuildHook [] |
instruction | Instruction | Promise <Instruction > |
idx | number |
Returns
Promise
<Instruction
>
Defined in
packages/sdk/src/tx-builder.ts:284
build
▸ build(): Promise
<Tx
>
Builds the transaction. Executes the build steps and returns the Tx.
Returns
Promise
<Tx
>
Defined in
packages/sdk/src/tx-builder.ts:118
call
▸ call(ref
, methodName
, args?
): InstructionRef
Pushes a CALL instruction onto the Transaction. Accepts an InstructionRef (which must refer to a JigResult), a method name and a list of args.
Parameters
Name | Type | Default value |
---|---|---|
ref | InstructionRef | undefined |
methodName | string | undefined |
args | any [] | [] |
Returns
Defined in
packages/sdk/src/tx-builder.ts:207
deploy
▸ deploy(code
): InstructionRef
Pushes a DEPLOY instruction onto the Transaction.
Parameters
Name | Type |
---|---|
code | Map <string , string > |
Returns
Defined in
packages/sdk/src/tx-builder.ts:239
▸ deploy(entry
, code
): InstructionRef
Parameters
Name | Type |
---|---|
entry | string | string [] |
code | Map <string , string > |
Returns
Defined in
packages/sdk/src/tx-builder.ts:240
exec
▸ exec(ref
, functionName
, args?
): InstructionRef
Pushes an EXEC instruction onto the Transaction. Accepts an InstructionRef (which must refer to a PkgResult), a function name and a list of args.
Parameters
Name | Type | Default value |
---|---|---|
ref | InstructionRef | undefined |
functionName | string | undefined |
args | any [] | [] |
Returns
Defined in
packages/sdk/src/tx-builder.ts:215
fund
▸ fund(ref
): InstructionRef
Pushes a FUND instruction onto the Transaction. Accepts an InstructionRef (which must refer to a JigResult).
Parameters
Name | Type |
---|---|
ref | InstructionRef |
Returns
Defined in
packages/sdk/src/tx-builder.ts:223
getResult
▸ getResult(ref
, type
): InstructionResult
Gets an InstructionResult from the stack of results.
Parameters
Name | Type |
---|---|
ref | InstructionRef |
type | ResultType |
Returns
InstructionResult
Defined in
packages/sdk/src/tx-builder.ts:151
import
▸ import(pkgId
): InstructionRef
Pushes an IMPORT instruction onto the Transaction.
Parameters
Name | Type |
---|---|
pkgId | string | Uint8Array |
Returns
Defined in
packages/sdk/src/tx-builder.ts:174
load
▸ load(outputId
): InstructionRef
Pushes a LOAD instruction onto the Transaction.
Parameters
Name | Type |
---|---|
outputId | string | Uint8Array |
Returns
Defined in
packages/sdk/src/tx-builder.ts:182
loadByOrigin
▸ loadByOrigin(origin
): InstructionRef
Pushes a LOADBYORIGIN instruction onto the Transaction.
Parameters
Name | Type |
---|---|
origin | string | Pointer |
Returns
Defined in
packages/sdk/src/tx-builder.ts:190
lock
▸ lock(ref
, address
): InstructionRef
Pushes a LOCK instruction onto the Transaction. Accepts an InstructionRef (which must refer to a JigResult), and an address instance of string.
Parameters
Name | Type |
---|---|
ref | InstructionRef |
address | string | Address |
Returns
Defined in
packages/sdk/src/tx-builder.ts:231
new
▸ new(ref
, className
, args?
): InstructionRef
Pushes a NEW instruction onto the Transaction. Accepts an InstructionRef (which must refer to a PkgResult), a class name and a list of args.
Parameters
Name | Type | Default value |
---|---|---|
ref | InstructionRef | undefined |
className | string | undefined |
args | any [] | [] |
Returns
Defined in
packages/sdk/src/tx-builder.ts:199
push
▸ push(instruction
, ...args
): InstructionRef
Pushes a build step onto the stack of steps. The build step must return an instruction.
Parameters
Name | Type |
---|---|
instruction | Instruction | TxBuildStep |
...args | any [] |
Returns
Defined in
packages/sdk/src/tx-builder.ts:276
refuteBuilding
▸ refuteBuilding(name?
): void
Parameters
Name | Type |
---|---|
name? | string |
Returns
void
Defined in
packages/sdk/src/tx-builder.ts:392
refuteMutation
▸ refuteMutation(txid
): void
Parameters
Name | Type |
---|---|
txid | string |
Returns
void
Defined in
packages/sdk/src/tx-builder.ts:400
resultFromInstruction
▸ resultFromInstruction(instruction
): Promise
<InstructionResult
>
Parameters
Name | Type |
---|---|
instruction | Instruction |
Returns
Promise
<InstructionResult
>
Defined in
packages/sdk/src/tx-builder.ts:299
resultFromReturnType
▸ resultFromReturnType(abi
, rtype
): Promise
<InstructionResult
>
Parameters
Name | Type |
---|---|
abi | Abi |
rtype | null | TypeNode |
Returns
Promise
<InstructionResult
>
Defined in
packages/sdk/src/tx-builder.ts:357
sign
▸ sign(privKey
): InstructionRef
Pushes a SIGN instruction onto the Transaction. The given PrivKey is used to create the signature used in the instruction.
Parameters
Name | Type |
---|---|
privKey | PrivKey | HDPrivKey |
Returns
Defined in
packages/sdk/src/tx-builder.ts:260
signTo
▸ signTo(privKey
): InstructionRef
Pushes a SIGNTO instruction onto the Transaction. The given PrivKey is used to create the signature used in the instruction.
Parameters
Name | Type |
---|---|
privKey | PrivKey | HDPrivKey |
Returns
Defined in
packages/sdk/src/tx-builder.ts:268