Skip to content

Commit

Permalink
Merge pull request #795 from autonomys/update_autodrive_guide
Browse files Browse the repository at this point in the history
Update Auto Drive dev docs
  • Loading branch information
EmilFattakhov authored Dec 20, 2024
2 parents 2dc7dd4 + a99910b commit bc14977
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/develop/auto_sdk/auto-consensus.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

title: Consensus
title: Auto Consensus
sidebar_position: 2
description: Functions to interact with the consensus chain
slug: /develop/auto-sdk/consensus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Drive
sidebar_position: 6
title: Auto Drive
sidebar_position: 3
description: Utilities for creating and managing IPLD DAGs
slug: /develop/auto-sdk/drive
keywords:
Expand All @@ -25,6 +25,48 @@ The `@autonomys/auto-drive` package provides utilities for creating and managing
- **CID Management**: Utilities for working with Content Identifiers (CIDs).
- **TypeScript Support**: Fully typed for enhanced developer experience.

---

## Auto Drive Dashboard

Logging in to Auto Drive will allow you to view your upload and download limits, access files uploaded by other users, and manage and share your submissions.

1. Log in to [Auto Drive](https://auto-drive-demo.netlify.app/)
2. Sign in via Google or Discord

![Auto-Drive-1](/img/developers/Auto-Drive-1.png)

3. On the landing page (dashboard) you will see:

- Your upload limit (currently **100MB** per month)
- Your download limit (currently **5GB** per month)
- A list of **uploaded files** and their **CIDs**
- Options to **Download**, **Share**, or **Remove** each file

![Auto-Drive-2](/img/developers/Auto-Drive-2.png)

:::tip NOTE
Removing a file does not delete it from the DSN, as it is permanent storage. It only removes the file from your dashboard.
:::

You can use the in-browser environment to upload, download, or share files, or you can use the SDK functions (described later on this page) to upload files or folders via the CLI.

![Auto-Drive-3](/img/developers/Auto-Drive-3.png)


### Getting an API Key

Click on `Profile` to create your `API` key. You can then use this API key in the CLI to upload files or folders.

![Auto-Drive-4](/img/developers/Auto-Drive-4.png)

### Sharing Files

To share a file, click the `Share` button next to the file. You can share it using a link, or by providing the user’s public ID. Each user’s public ID is visible on their `Profile` page.

![Auto-Drive-5](/img/developers/Auto-Drive-5.png)

---
### Installation

Install the package via npm or yarn:
Expand All @@ -49,6 +91,7 @@ import { createFileIPLDDag, createFolderIPLDDag } from '@autonomys/auto-drive';
import * as drive from '@autonomys/auto-drive';
```


---

## Available Functions
Expand Down Expand Up @@ -89,19 +132,25 @@ import * as drive from '@autonomys/auto-drive';

## Usage Examples

### 1. Creating an IPLD DAG from a File
### 1. Uploading a File

Create an IPLD DAG for a file:

```typescript
import { createFileIPLDDag } from '@autonomys/auto-drive';
import { createAutoDriveApi, uploadFileFromFilepath } from '@autonomys/auto-drive';
import fs from 'fs';

const fileBuffer = fs.readFileSync('path/to/your/file.txt');
const filePath = fs.readFileSync('path/to/your/file.txt');
const api = createAutoDriveApi({ apiKey: 'Your_API_Key' });

const dag = createFileIPLDDag(fileBuffer, 'file.txt');
/// passing options is optional, provide `password` if you prefer to ensrypt your file
const options = {
password: 'password'
compression: true,
};

const upload = uploadFileFromFilepath(api, filePath, options);

console.log('File DAG created:', dag);
console.log('Upload:', upload);
```

### 2. Creating an IPLD DAG from a Folder
Expand Down
6 changes: 5 additions & 1 deletion docs/develop/auto_sdk/auto-id.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

title: Auto ID
sidebar_position: 3
sidebar_position: 6
description: Functions to build on Auto ID domain
slug: /develop/auto-sdk/auto-id
keywords:
Expand All @@ -15,6 +15,10 @@ keywords:

## Auto-ID Package Documentation

:::warning
Auto ID domain is not yet available on Taurus Network or Autonomys Mainnet
:::

### Introduction

The `@autonomys/auto-id` package provides functionalities for managing certificates, authenticating users, and integrating Zero-Knowledge Proofs (ZKPs) on the Autonomys Network. It enables developers to:
Expand Down
4 changes: 2 additions & 2 deletions docs/develop/auto_sdk/auto-utils.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Utils
sidebar_position: 5
title: Auto Utils
sidebar_position: 4
description: Utility functions for the Auto SDK
slug: /develop/auto-sdk/utils
keywords:
Expand Down
8 changes: 6 additions & 2 deletions docs/develop/auto_sdk/auto-xdm.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: XDM
sidebar_position: 4
title: Auto XDM
sidebar_position: 5
description: Functions to utilize Auto XDM (Cross-Domain Messaging)
slug: /develop/auto-sdk/xdm
keywords:
Expand All @@ -11,6 +11,10 @@ keywords:
- Auto XDM
---

:::warning
XDM is not yet enabled on Taurus Network or Autonomys Mainnet
:::

### Cross-Domain Transfers

- `transfer(api: ApiPromise, destination: ChainOrDomain, receiver: string, amount: Amount): Promise<SubmittableExtrinsic>`: Creates a transaction to transfer a specified amount to a receiver on a given destination, which can be either the consensus chain or a specific domain.
Expand Down
Binary file added static/img/developers/Auto-Drive-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/developers/Auto-Drive-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/developers/Auto-Drive-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/developers/Auto-Drive-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/developers/Auto-Drive-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bc14977

Please sign in to comment.