0.7.2 • Published 5 months ago

@aldea/sdk v0.7.2

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
5 months ago

Aldea JavaScript SDK

Version License

A Swiss Army knife for Aldea app developers.

The Aldea JavaScript SDK provides utility classes and functions for working with Aldea data types, creating and managing keys, building and signing transactions, and interfacing with an Aldea node.

Installation

The Aldea SDK is published to the NPM registry. Install the SDK into your project with npm or your preferred alternative NPM client:

npm install @aldea/sdk

Keys and addresses

Aldea uses BLAKE3-flavoured Ed25519 cryptography. Keys and addresses can be generated using the SDK:

import { KeyPair, Address } from '@aldea/sdk'

const keys = KeyPair.fromRandom()
const address = Address.fromPubKey(keys.pubKey)

console.log(keys.privKey.toHex())
console.log(keys.pubKey.toHex())
console.log(address.toString())

Connecting to a node

Connect to your own or a public node to interface with the Aldea Computer.

import { Aldea } from '@aldea/sdk'

const aldea = new Aldea('https://node.aldea.computer')

// Examples
const tx = await aldea.getTx(txid)
const output = await aldea.getOutput(outputId)

Building transactions

Once you have a connection to a noce, you can use the Aldea instance to build new transactions.

const tx = await aldea.createTx(tx => {
  const coin = tx.load(coinOutputId)
  const token = tx.load(jigOutputId)

  tx.call(token, 'send', [1000, recipient])
  tx.send(coin, 'send', [500, myNewAddress])
  tx.fund(coin)
  tx.sign(keys.privKey)
})

const txRes = await aldea.commitTx(tx)

License

Aldea is open source and released under the Apache-2 License.

© Copyright 2023 Run Computer Company, inc.

0.7.2

5 months ago

0.7.1

6 months ago

0.7.0

6 months ago

0.6.1

6 months ago

0.5.0

8 months ago

0.4.0

10 months ago

0.6.0

7 months ago

0.3.9

11 months ago

0.3.0

12 months ago

0.3.5

11 months ago

0.3.2

12 months ago

0.3.1

12 months ago

0.3.4

12 months ago

0.2.0

12 months ago

0.1.5

12 months ago

0.1.4

12 months ago

0.1.3

12 months ago

0.1.2

12 months ago

0.1.1

12 months ago

0.1.0

12 months ago