# @aldea/sdk

> A Swiss Army knife for Aldea app developers.

Latest version **0.8.0** (published 2024-10-17) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @aldea/sdk
pnpm add @aldea/sdk
yarn add @aldea/sdk
bun add @aldea/sdk
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.0 |
| Published | 2024-10-17 |
| First published | 2023-05-16 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 720.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | calvo.generico, brentongunning, libitx |

## Links

- npm: https://www.npmjs.com/package/@aldea/sdk
- npm.io page: https://npm.io/package/@aldea/sdk

## Dependencies (2)

- [ky](https://npm.io/package/ky.md) ^1.0.1
- [@aldea/core](https://npm.io/package/@aldea/core.md) ^0.7.2

## Recent versions

- 0.8.0 (latest) — 2024-10-17
- 0.7.2 — 2023-12-11
- 0.7.1 — 2023-11-23
- 0.7.0 — 2023-11-22
- 0.6.1 — 2023-11-09
- 0.6.0 — 2023-10-09
- 0.5.0 — 2023-09-21
- 0.4.0 — 2023-07-19
- 0.3.9 — 2023-06-29
- 0.3.5 — 2023-06-05
- 0.3.4 — 2023-05-30
- 0.3.2 — 2023-05-30
- 0.3.1 — 2023-05-29
- 0.3.0 — 2023-05-29
- 0.2.0 — 2023-05-24
- … 6 more at https://npm.io/package/@aldea/sdk/versions

## README

# Aldea JavaScript SDK

![Version](https://img.shields.io/npm/v/@aldea/sdk?style=flat-square)
![License](https://img.shields.io/npm/l/@aldea/sdk?style=flat-square)

> 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:

```shell
npm install @aldea/sdk
```

## Keys and addresses

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

```ts
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.

```ts
import { Aldea } from '@aldea/sdk'

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

// 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.

```ts
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](https://github.com/aldeacomputer/aldea-js/blob/main/packages/sdk/LICENSE).

© Copyright 2023 Run Computer Company, inc.

---
_Source: https://npm.io/package/@aldea/sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
