Let’s dive into a quick installation and setup guide to get you started with Atomic Toolkit.
Install the SDK
npm install atomic-toolkit
Setup the SDK
First, import the SDK into your project. You can do this on the server-side or client-side depending on your use case.
import AtomicToolkit from 'atomic-toolkit';
Currently, Atomic Toolkit can be initialized using a Arweave Wallet or Irys SDK.
Using an Arweave Wallet
const key = JSON.parse(readFileSync('wallet.json').toString());
const toolkit = new AtomicToolkit({
key: key,
});
Using Irys
import Irys from '@irys/sdk';
const irys = new Irys({
url: 'https://node2.irys.xyz',
token: 'matic',
key: 'your-private-key',
});
await irys.ready();
const toolkit = new AtomicToolkit({
irys: irys,
});
Create a Atomic Asset
Now that you have the SDK setup, you can create a new Atomic Asset.
const toolkit = new AtomicToolkitWeb({});
// Simple Text File
const file = new File(['hello world'], 'hello.txt', {
type: 'text/plain',
});
const res = await toolkit.assets.createAtomicAsset(file, {
initialState: {
ticker: 'HELLO',
name: 'Hello World',
balances: {
'9WQ7xH2LOuqfAccjGquck8eaKARg1vMhRJaOo3LJL14': 1,
},
claimable: [],
},
discoverability: {
title: 'Hello World',
description: 'Hello World',
type: 'text',
},
});
console.log(res.contractTxId);
console.log(res?.srcTxId);
// F4YEvnMmcFFBtF0Qe4Hycl_6Ocgr-fBCoCdIuJSYUI8
// Of9pi--Gj7hCTawhgxOwbuWnFI1h24TTgO5pw8ENJNQ