Skip to content

Commit 5751859

Browse files
authored
Documentation for Ironfish wasm (#779)
* Documentation for Ironfish wasm Includes a page for our npm wasm package. Adds it to the sidebar of our developer documentation. * removing description
1 parent 52d7850 commit 5751859

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Ironfish Wasm
3+
---
4+
5+
Iron Fish WASM package that compiles native Iron Fish code to WebAssembly with TypeScript bindings. This package allows you to use Iron Fish cryptographic functionality in browser extensions, web applications, or any JavaScript environment.
6+
7+
## Installation
8+
9+
```bash
10+
npm install @ironfish/ironfish-wasm
11+
```
12+
13+
## Features
14+
15+
- Native Iron Fish code compiled to WebAssembly
16+
- TypeScript bindings for better developer experience
17+
- Compatible with browser extensions and web applications
18+
- High-performance cryptographic operations
19+
- Cross-platform compatibility
20+
21+
## Usage
22+
23+
```typescript
24+
import { SaplingKey, Note, AssetIdentifier, UnsignedTransaction } from '@ironfish/ironfish-wasm';
25+
26+
// Generate new keys
27+
const senderKey = SaplingKey.random();
28+
const recipientKey = SaplingKey.random();
29+
30+
// Create a native asset note (IRON)
31+
const note = Note.fromParts(
32+
recipientKey.publicAddress,
33+
BigInt(100), // Amount
34+
"Transfer memo",
35+
AssetIdentifier.native,
36+
senderKey.publicAddress
37+
);
38+
39+
// Create an unsigned transaction
40+
const bytes = new Uint8Array([/* transaction bytes */]);
41+
const unsignedTx = new UnsignedTransaction(bytes);
42+
43+
// Sign the transaction
44+
const signedTx = unsignedTx.sign(senderKey);
45+
46+
// Get transaction details
47+
console.log({
48+
fee: signedTx.fee,
49+
expiration: signedTx.expiration,
50+
outputs: signedTx.outputs.length,
51+
spends: signedTx.spends.length
52+
});
53+
54+
// Export keys as hex for storage
55+
const exportedKey = senderKey.toHex();
56+
57+
// Import key from hex
58+
const importedKey = SaplingKey.fromHex(exportedKey);
59+
```
60+
61+
## Requirements
62+
63+
- Node.js 20.0.0 or higher
64+
- A JavaScript environment with WebAssembly support

content/documentation/sidebar.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ export const sidebar: SidebarDefinition = [
156156
},
157157
],
158158
},
159+
"ironfish-wasm",
159160
{
160161
label: "Recipes",
161162
items: [

search/indexes/documentation-index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)