24.11.1 • Published 9 months ago

@nexajs/transaction v24.11.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

NEXA.js Transaction

Manage the construction of a new or existing Transaction; as well as handle the unlocking (by use of redeem scripts) and authorize the transaction for on-chain broadcast.

The Transaction Builder represents a transaction internally and is used to build a transaction step-by-step. It can then be expressed as a hexadecimal string ready to be sent to a Nexa node and broadcast to the entire network.

The necessary steps to create a Transaction are: 1. Add input(s) 2. Add output(s) 3. Set lock time (optional) 4. Sign input(s)

Simple Transaction

import { Transaction } from '@nexajs/transaction'

// Provide one or more Locksmiths (e.g. Wallet Import Format WIF).
const locksmith = [
    // TODO
]

// Initialize the transaction.
const tx = new Transaction()

// Add inputs.
tx.addInputs([{
    // TODO
}])

// Add outputs.
tx.addOutputs([{
    // TODO
}])

console.log(tx) // without signatures
// {
//   inputs: [...],
//   outputs: [...],
// }

// Sign the transaction (using an array of one or more Locksmiths).
tx.sign(locksmith)

console.log(tx) // with signatures
// {
//   inputs: [...],
//   outputs: [...],
// }

console.log(tx.hex) // in hexadecimal format (for broadcast via node)
// abc123...

TODO: Add more examples...

24.11.1

9 months ago

24.10.1

10 months ago

24.9.25

10 months ago

24.9.22

10 months ago

24.9.20

10 months ago

24.9.21

10 months ago

24.9.11

10 months ago

24.9.10

10 months ago

24.9.5

10 months ago

24.7.16

12 months ago

24.7.17

12 months ago

24.7.11

1 year ago

24.7.15

12 months ago

24.7.12

1 year ago

24.6.23

1 year ago

24.7.20

12 months ago

24.8.16

11 months ago

24.7.9

1 year ago

24.7.8

1 year ago

24.7.7

1 year ago

23.12.29

2 years ago

23.12.26

2 years ago

23.12.13

2 years ago

23.12.9

2 years ago

23.12.3

2 years ago

23.10.8

2 years ago

23.10.7

2 years ago

23.7.15

2 years ago

23.9.2

2 years ago

23.10.25

2 years ago

23.11.14

2 years ago

23.8.20

2 years ago

23.8.18

2 years ago

23.7.27

2 years ago

23.7.26

2 years ago

23.7.22

2 years ago

23.7.21

2 years ago

23.7.20

2 years ago

23.5.1

2 years ago

23.5.13

2 years ago

23.5.25

2 years ago

23.5.14

2 years ago

23.5.15

2 years ago

23.5.16

2 years ago

23.5.17

2 years ago

23.4.14

2 years ago

23.4.13

2 years ago

23.4.12

2 years ago

23.3.19

2 years ago

23.3.18

2 years ago

23.3.17

2 years ago

23.3.16

2 years ago