-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
142 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
--- | ||
icon: 'sitemap' | ||
description: | ||
'Practical step-by-step guides to help you achieve a specific goal. These | ||
guides are designed to help you get started with a specific task or feature.' | ||
description: 'Learn how to use Atomic Toolkit in your node and browser environments.' | ||
--- | ||
|
||
### Usage | ||
|
||
<CardGroup cols={2}> | ||
<Card href="/usage/installation" title="Installation" icon="circle-down"> | ||
Install Atomic Toolkit | ||
</Card> | ||
<Card href="/usage/server-side" title="Server-side Usage" icon="server"> | ||
Use Atomic Toolkit in your node environments. | ||
</Card> | ||
<Card href="/usage/browser" title="Client-side Usage" icon="chrome"> | ||
Use Atomic Toolkit in your browser environments. | ||
</Card> | ||
</CardGroup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
--- | ||
title: Installation | ||
--- | ||
|
||
## Requirements | ||
|
||
- Node.js (version 16 or higher) | ||
- npm (version 5.6 or higher) or yarn or pnpm | ||
|
||
## Installation | ||
|
||
<CodeGroup> | ||
```bash npm | ||
npm install atomic-toolkit | ||
``` | ||
|
||
```bash yarn | ||
yarn add atomic-toolkit | ||
``` | ||
|
||
```bash pnpm | ||
pnpm add atomic-toolkit | ||
``` | ||
|
||
</CodeGroup> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,96 @@ | ||
--- | ||
title: Server-side Usage | ||
description: Use Atomic Toolkit in Server Environments | ||
--- | ||
|
||
This section guides you through initializing Atomic Toolkit within a server environment like a backend application. Currently Atomic toolkit can be initializing in the following ways: | ||
|
||
1. Using Arweave Wallet | ||
2. Using Irys SDK | ||
|
||
## Using Arweave Wallet | ||
|
||
It uses the Arweave Wallet to sign transactions and interact with the Arweave network. | ||
|
||
```ts | ||
import { readFileSync } from 'fs'; | ||
import AtomicToolkit from 'atomic-toolkit'; | ||
|
||
const key = JSON.parse(readFileSync('wallet.json').toString()); | ||
|
||
const atomicToolkit = new AtomicToolkit({ | ||
environment: 'mainnet', | ||
jwk: key, | ||
}); | ||
``` | ||
|
||
### Input Parameters | ||
|
||
The following params are available for this function and they must be passed in as an object: | ||
|
||
- **environment**: `mainnet` | `testnet`: The environment to use. If testnet is used, warp for testnet will be used. | ||
- **warp (optional)**: `Warp`: A Warp Instance to use with Deploy Plugin. If not provided, the default Warp instance for Mainnet will be used. | ||
- **arweave (optional)**: `Arweave`: An Arweave Instance to use. If not provided, the default Arweave instance with gateway [arweave.net](arweave.net) will be used. | ||
- **jwk**: `JWKInterface`: The Key to use for signing transactions. Should be a JWK object. | ||
|
||
<Warning> | ||
Private keys must be kept secure at all times. Please ensure that the | ||
`wallet.json` file is not pushed to a version control (eg. GitHub). If you | ||
are using a CI/CD pipeline, ensure that the wallet.json file is not stored | ||
in the repository. | ||
</Warning> | ||
|
||
<Note> | ||
The Warp instance should use the `DeployPlugin`. It is neccessary to | ||
register Atomic Assets | ||
</Note> | ||
|
||
### Default Values | ||
|
||
```ts | ||
/** | ||
* Default Warp instance | ||
*/ | ||
const warp = WarpFactory.forMainnet().use(new DeployPlugin()); | ||
|
||
/** | ||
* Default Arweave configuration. | ||
*/ | ||
const defaultArweave = new Arweave({ | ||
host: 'arweave.net', | ||
port: 443, | ||
protocol: 'https', | ||
}); | ||
``` | ||
|
||
### Custom Instance Example | ||
|
||
```ts | ||
import Arweave from 'arweave'; | ||
import { readFileSync } from 'fs'; | ||
import AtomicToolkit from 'atomic-toolkit'; | ||
import { DeployPlugin } from 'warp-contracts-plugin-deploy'; | ||
import { WarpFactory, defaultCacheOptions } from 'warp-contracts'; | ||
|
||
const key = JSON.parse(readFileSync('wallet.json').toString()); | ||
|
||
const warp = WarpFactory.forMainnet().use(new DeployPlugin()); | ||
|
||
const arweave = new Arweave({ | ||
host: 'arweave.net', | ||
port: 443, | ||
protocol: 'https', | ||
}); | ||
|
||
const warp = WarpFactory.forMainnet({ | ||
...defaultCacheOptions, | ||
inMemory: true, | ||
}).use(new DeployPlugin()); | ||
|
||
const atomicToolkit = new AtomicToolkit({ | ||
environment: 'mainnet', | ||
warp, | ||
arweave, | ||
jwk: key, | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters