Skip to content

Commit

Permalink
docs(kyve): init KYVE and CLI documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
fedellen committed Aug 29, 2024
1 parent e855b75 commit 93f1f93
Showing 1 changed file with 127 additions and 10 deletions.
137 changes: 127 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionality for interac
- [Typescript](#typescript)
- [Examples](#examples)
- [APIs](#apis)
- [CLI](#cli)

- [Install CLI](#install-cli)

- [TurboFactory](#turbofactory)
- [`unauthenticated()`](#unauthenticated)
- [`authenticated()`](#authenticated)
Expand All @@ -40,9 +44,10 @@ Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionality for interac
- [`getUploadCosts({ bytes })`](#getuploadcosts-bytes-)
- [`uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal })`](#uploadsigneddataitem-dataitemstreamfactory-dataitemsizefactory-signal-)
- [`createCheckoutSession({ amount, owner })`](#createcheckoutsession-amount-owner-)
- [Arweave (AR)](#arweave-ar)
- [Ethereum (ETH)](#ethereum-eth)
- [Solana (SOL)](#solana-sol)
- [Arweave (AR) Fiat Top Up](#arweave-ar-fiat-top-up)
- [Ethereum (ETH) Fiat Top Up](#ethereum-eth-fiat-top-up)
- [Solana (SOL) Fiat Top Up](#solana-sol-fiat-top-up)
- [KYVE Fiat Top Up](#kyve-fiat-top-up)
- [`submitFundTransaction({ txId })`](#submitfundtransaction-txid-)
- [TurboAuthenticatedClient](#turboauthenticatedclient)
- [`getBalance()`](#getbalance)
Expand All @@ -53,8 +58,11 @@ Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionality for interac
- [NodeJS Upload Folder](#nodejs-upload-folder)
- [Browser Upload Folder](#browser-upload-folder)
- [`topUpWithTokens({ tokenAmount, feeMultiplier })`](#topupwithtokens-tokenamount-feemultiplier-)
- [Ethereum (ETH)](#ethereum-eth-1)
- [Solana (SOL)](#solana-sol-1)
- [Arweave (AR) Crypto Top Up](#arweave-ar-crypto-top-up)
- [Ethereum (ETH) Crypto Top Up](#ethereum-eth-crypto-top-up)
- [Solana (SOL) Crypto Top Up](#solana-sol-crypto-top-up)
- [KYVE Crypto Top Up](#kyve-crypto-top-up)

- [Developers](#developers)
- [Requirements](#requirements)
- [Setup & Build](#setup--build)
Expand Down Expand Up @@ -268,6 +276,26 @@ const turbo = TurboFactory.authenticated({
});
```

##### KYVE Private Key

```typescript
const turbo = TurboFactory.authenticated({
privateKey: kyveHexadecimalPrivateKey,
token: 'kyve',
});
```

##### KYVE Mnemonic

```typescript
import { privateKeyFromKyveMnemonic } from '@ardrive/turbo-sdk';

const turbo = TurboFactory.authenticated({
privateKey: privateKeyFromKyveMnemonic(mnemonic),
token: 'kyve',
});
```

### TurboUnauthenticatedClient

#### `getSupportedCurrencies()`
Expand Down Expand Up @@ -341,7 +369,7 @@ const uploadResponse = await turbo.uploadSignedDataItem({

Creates a Stripe checkout session for a Turbo Top Up with the provided amount, currency, owner. The returned URL can be opened in the browser, all payments are processed by Stripe. To leverage promo codes, see [TurboAuthenticatedClient].

##### Arweave (AR)
##### Arweave (AR) Fiat Top Up

```typescript
const { url, winc, paymentAmount, quotedPaymentAmount, adjustments } =
Expand All @@ -364,7 +392,7 @@ if (process.platform === 'darwin') {
}
```

##### Ethereum (ETH)
##### Ethereum (ETH) Fiat Top Up

```ts
const turbo = TurboFactory.unauthenticated({ token: 'ethereum' });
Expand All @@ -375,7 +403,7 @@ const { url, winc, paymentAmount } = await turbo.createCheckoutSession({
});
```

##### Solana (SOL)
##### Solana (SOL) Fiat Top Up

```ts
const turbo = TurboFactory.unauthenticated({ token: 'solana' });
Expand All @@ -386,6 +414,17 @@ const { url, winc, paymentAmount } = await turbo.createCheckoutSession({
});
```

##### KYVE Fiat Top Up

```ts
const turbo = TurboFactory.unauthenticated({ token: 'kyve' });

const { url, winc, paymentAmount } = await turbo.createCheckoutSession({
amount: USD(10.0), // $10.00 USD
owner: publicKyveAddress,
});
```

#### `submitFundTransaction({ txId })`

Submits the transaction ID of a funding transaction to Turbo Payment Service for top up processing. The `txId` is the transaction ID of the transaction to be submitted.
Expand Down Expand Up @@ -536,6 +575,8 @@ Tops up the connected wallet with Credits by submitting a payment transaction fo
- The `tokenAmount` is the amount of tokens in the token type's smallest unit value (e.g: Winston for arweave token type) to fund the wallet with.
- The `feeMultiplier` (optional) is the multiplier to apply to the reward for the transaction to modify its chances of being mined. Credits will be added to the wallet balance after the transaction is confirmed on the given blockchain. Defaults to 1.0, meaning no multiplier.

##### Arweave (AR) Crypto Top Up

```typescript
const turbo = TurboFactory.authenticated({ signer, token: 'arweave' });

Expand All @@ -545,7 +586,7 @@ const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
});
```

##### Ethereum (ETH)
##### Ethereum (ETH) Crypto Top Up

```ts
const turbo = TurboFactory.authenticated({ signer, token: 'ethereum' });
Expand All @@ -555,7 +596,7 @@ const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
});
```

##### Solana (SOL)
##### Solana (SOL) Crypto Top Up

```ts
const turbo = TurboFactory.authenticated({ signer, token: 'solana' });
Expand All @@ -565,6 +606,78 @@ const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
});
```

##### KYVE Crypto Top Up

```ts
const turbo = TurboFactory.authenticated({ signer, token: 'kyve' });

const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
tokenAmount: KYVEToTokenAmount(0.00001), // 0.00001 KYVE
});
```

## CLI

### Install CLI

Global installation:

```shell
npm install -g @ardrive/turbo-sdk
```

or

```shell
yarn global add @ardrive/turbo-sdk
```

### Usage

```shell
turbo --help
```

or from local installation:

```shell
yarn turbo --help
```

```shell
npx turbo --help
```

```shell
Usage: turbo [options] [command]
```

#### Options

- `-V, --version` - output the version number
- `-h, --help` - display help for command
- `--dev` - Enable development endpoints (default: false)
- `-g, --gateway <url>` - Set a custom crypto gateway URL
- `-t, --token <token>` - Token type for the command or connected wallet (default: "arweave")

- `-w, --wallet-file <filePath>` - Wallet file to use with the action. Formats accepted: JWK.json, KYVE or ETH private key as a string, or SOL Secret Key as a Uint8Array
- `-m, --mnemonic <phrase>` - Mnemonic to use with the action
- `-p, --private-key <key>` - Private key to use with the action

#### Commands

##### `crypto-fund`

Fund a wallet with Turbo Credits by submitting a payment transaction for the crypto amount to the Turbo wallet and then submitting that transaction id to Turbo Payment Service for top up processing.

- `-v, --value <value>` - Amount of tokens in the token type's smallest unit value to fund the wallet with

e.g:

```shell
turbo crypto-fund --value 0.0001 --token kyve --private-key ./my-kyve-private-key.txt
```

## Developers

### Requirements
Expand Down Expand Up @@ -609,3 +722,7 @@ For more information on how to contribute, please see [CONTRIBUTING.md].
[TurboAuthenticatedClient]: #turboauthenticatedclient
[AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
[CONTRIBUTING.md]: ./CONTRIBUTING.md

```
```

0 comments on commit 93f1f93

Please sign in to comment.