Skip to content

Commit

Permalink
integrate irys as an asset uploader service
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmaayan committed Mar 1, 2024
1 parent a23ccc6 commit 9b52f97
Show file tree
Hide file tree
Showing 11 changed files with 3,355 additions and 1,763 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to the Aptos TypeScript SDK will be captured in this file. T
# Unreleased

- [`Deprecate`] IIFE build support
- Add generic `AssetUploader` module support
- Integrate `Irys` asset uploader provider as an optional dependency

# 1.9.1 (2024-02-28)

Expand Down
38 changes: 38 additions & 0 deletions examples/typescript/asset_uploader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Account, AptosConfig, Network, Aptos, AssetUploader } from "@aptos-labs/ts-sdk";

const example = async () => {
const account = Account.generate();
const aptosConfig = new AptosConfig({
network: Network.TESTNET,
});
const aptos = new Aptos(aptosConfig);

const assetUploader = await AssetUploader.init(aptosConfig);

await aptos.fundAccount({ accountAddress: account.accountAddress, amount: 1_000_000 });

// Fund a node
const fundResponse = await assetUploader.fundNode({ account, amount: 1000 });
console.log("fund response", fundResponse);

Check warning on line 16 in examples/typescript/asset_uploader.ts

View workflow job for this annotation

GitHub Actions / run-tests

Unexpected console statement

// Upload data
const uploadDataResponse = await assetUploader.uploadData({ account, data: "Hello Aptos" });
console.log("upload response", uploadDataResponse);

Check warning on line 20 in examples/typescript/asset_uploader.ts

View workflow job for this annotation

GitHub Actions / run-tests

Unexpected console statement

// Upload file
const uploadFileResponse = await assetUploader.uploadFile({
account,
filePathToUpload: "<path-to-file>",
});
console.log("uploadFileResponse", uploadFileResponse);

Check warning on line 27 in examples/typescript/asset_uploader.ts

View workflow job for this annotation

GitHub Actions / run-tests

Unexpected console statement

// Upload folder
const uploadFolderResponse = await assetUploader.uploadFolder({
account,
folderToUpload: "<path-to-folder>",
});
console.log("uploadFolderResponse", uploadFolderResponse);

Check warning on line 34 in examples/typescript/asset_uploader.ts

View workflow job for this annotation

GitHub Actions / run-tests

Unexpected console statement
process.exit(0);
};

example();
1 change: 1 addition & 0 deletions examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"external_signing": "ts-node external_signing.ts",
"your_coin": "ts-node your_coin.ts",
"your_fungible_asset": "ts-node your_fungible_asset.ts",
"asset_uploader": "ts-node asset_uploader.ts",
"test": "run-s simple_transfer multi_agent_transfer simple_sponsored_transaction transfer_coin custom_client publish_package_from_filepath external_signing sign_struct"
},
"keywords": [],
Expand Down
Loading

0 comments on commit 9b52f97

Please sign in to comment.