-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(PE-4472): add uploadFile, uploadSignedDataItem implementations for node and web #9
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
7c454f5
feat: add uploadFiles implementation for node and web
56269be
feat: break services into auth vs unauth
254b457
chore: update examples
c2448fd
feat: introduce uploadSignedDataItem interface, implement for node
50dd308
chore: update tests and types
fee5675
feat: remove TurboDataItemVerifier
8262c90
chore: remove unused 'bundle' flag on uploadFiles, update tests to p…
6dc641d
chore(tests): tests should be failing, add errors to upload responses
b165cb5
chore: cleanup some examples and pluarlize
538f2f8
chore: some cleanup items
61c6b5f
chore: update examples, add file posting to index.cjs
f361dab
chore: update tests
1ccbbfa
fix: revert to single file upload/data item upload
bd4f69d
feat: abstract JWKInterface used in AuthenticatedPayment and Authenti…
97fd29b
fix: update web signer and cleanup examples
6592ac8
feat: abstract axios to TurboHTTPService class
8f636b1
feat: introduce AbortController
16ff144
chore: use inheritance for private classes
ebd43b3
chore: update c8 coverage files
e025b97
chore: add AbortController to examples
5c7315e
chore: add some comments and TODOs
6098c1a
chore: break apart tests, update config, add ReadableStream test
a426b08
chore: exit mocha flag to tests to avoid hanging tests involving read…
b308861
chore: cleanup unused utility functions
80fef4d
chore: fix imports of arbundles in web
f0a19e0
chore: update build outputs to avoid SubtleCrypto errors
3acba94
chore(README): add a skeleton README with placeholders for API specs
96208ea
chore: pull up TurboBaseFactory to common
b56216e
chore: cleanup comments, fix lib package outputs
b1559f7
chore: move from public/private factory functions to unauthenticated/…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,114 @@ | ||
# turbo-sdk | ||
# @ardriveapp/turbo-sdk 🚀 | ||
|
||
Hello developer, welcome to this SDK!! | ||
Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionalities for interacting with the Turbo Upload and Payment Services. It is available in both NodeJS and Web environments. | ||
|
||
## Table of Contents | ||
|
||
- [Installation](#installation) | ||
- [Usage](#usage): | ||
|
||
- [NodeJS Environments](#nodejs) | ||
- [CommonJS](#commonjs) | ||
- [ESM](#esm) | ||
- [Web Environments](#web) | ||
- [Bundlers (Webpack, Rollup, ESbuild, etc.)](#bundlers-webpack-rollup-esbuild-etc) | ||
- [Browser](#browser) | ||
- [Typescript](#typescript) | ||
- [Examples](./examples) | ||
|
||
- [Contributions](#contributions) | ||
|
||
# Installation | ||
|
||
```shell | ||
npm install @ardrive/turbo-sdk | ||
``` | ||
|
||
or | ||
|
||
```shell | ||
yarn add @ardrive/turbo-sdk | ||
``` | ||
|
||
# Usage | ||
|
||
The SDK is available in both CommonJS and ESM formats and is compatible with bundlers such as Webpack, Rollup, and ESbuild. | ||
|
||
## Web | ||
|
||
# Bundlers (Webpack, Rollup, ESbuild, etc.) | ||
|
||
```javascript | ||
import { TurboFactory } from '@ardrive/turbo-sdk/web'; | ||
|
||
const turbo = TurboFactory.unauthenticated({}); | ||
const rates = await turbo.getFiatRates(); | ||
``` | ||
|
||
### Browser | ||
|
||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/@ardrive/turbo-sdk"></script> | ||
<script> | ||
const turbo = TurboFactory.unauthenticated({}); | ||
const rates = await turbo.getFiatRates(); | ||
</script> | ||
``` | ||
|
||
## NodeJS | ||
|
||
### CommonJS | ||
|
||
```javascript | ||
const { TurboFactory } = require('@ardrive/turbo-sdk/node'); | ||
|
||
const turbo = TurboFactory.unauthenticated({}); | ||
const rates = await turbo.getFiatRates(); | ||
``` | ||
|
||
### ESM | ||
|
||
```javascript | ||
import { TurboFactory } from '@ardrive/turbo-sdk/node'; | ||
|
||
const turbo = TurboFactory.unauthenticated({}); | ||
const rates = await turbo.getFiatRates(); | ||
``` | ||
|
||
## Typescript | ||
|
||
The SDK provides TypeScript typings. When you import the SDK in a TypeScript project: | ||
|
||
```typescript | ||
import Ardrive from '@ardrive/turbo-sdk/web'; | ||
|
||
// or '@ardrive/turbo-sdk/node' for Node.js projects | ||
``` | ||
|
||
The provided typings (`./lib/types/index.d.ts`) will be automatically recognized, offering type checking and autocompletion benefits. | ||
|
||
# APIs (WIP) | ||
|
||
## TurboFactory | ||
|
||
- `public()` | ||
- `private()` | ||
|
||
## TurboUnauthenticatedClient | ||
|
||
- `getFiatRates()` | ||
- `getFiatToAR()` | ||
- `getSupportedCountries()` | ||
- `getSupportedCurrencies()` | ||
- `getWincForFiat()` | ||
- `getUploadCosts()` | ||
- `uploadSignedDataItem()` | ||
|
||
## TurboAuthenticatedClient | ||
|
||
- `getBalance()` | ||
- `uploadFile()` | ||
|
||
# Contributions | ||
|
||
If you encounter any issues or have feature requests, please file an issue on our GitHub repository. Contributions, pull requests, and feedback are welcome and encouraged. |
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
Empty file.
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Writing down some aside thoughts on exposing our ArDrive Turbo "testnet"
This public test API (payment.ardrive.dev / upload.ardrive.dev):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel our testnet could offer developers great advantages during building. But our test data should expire and never make it to a live arweave node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed - we may need to consider a separate public test environment that is low-cost for us but dev friendly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also a good point to provide some testing utils and constants to help devs write unit tests with the SDK (e.g. test card numbers)