@ardrive/turbo-sdk 1.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +661 -0
- package/README.md +114 -0
- package/bundles/web.bundle.min.js +55429 -0
- package/lib/LICENSE.md +661 -0
- package/lib/README.md +114 -0
- package/lib/common/factory.d.ts +21 -0
- package/lib/common/factory.js +13 -0
- package/lib/common/http.d.ts +44 -0
- package/lib/common/http.js +45 -0
- package/lib/common/index.d.ts +19 -0
- package/lib/common/index.js +19 -0
- package/lib/common/payment.d.ts +41 -0
- package/lib/common/payment.js +81 -0
- package/lib/common/turbo.d.ts +73 -0
- package/lib/common/turbo.js +100 -0
- package/lib/common/upload.d.ts +29 -0
- package/lib/common/upload.js +54 -0
- package/lib/node/factory.d.ts +22 -0
- package/lib/node/factory.js +30 -0
- package/lib/node/index.d.ts +19 -0
- package/lib/node/index.js +19 -0
- package/lib/node/signer.d.ts +36 -0
- package/lib/node/signer.js +54 -0
- package/lib/package.json +106 -0
- package/lib/types/arweave.d.ts +29 -0
- package/lib/types/arweave.js +1 -0
- package/lib/types/index.d.ts +18 -0
- package/lib/types/index.js +18 -0
- package/lib/types/turbo.d.ts +149 -0
- package/lib/types/turbo.js +1 -0
- package/lib/utils/axiosClient.d.ts +23 -0
- package/lib/utils/axiosClient.js +30 -0
- package/lib/utils/base64.d.ts +9 -0
- package/lib/utils/base64.js +39 -0
- package/lib/utils/errors.d.ts +22 -0
- package/lib/utils/errors.js +28 -0
- package/lib/utils/readableStream.d.ts +22 -0
- package/lib/utils/readableStream.js +24 -0
- package/lib/web/factory.d.ts +22 -0
- package/lib/web/factory.js +30 -0
- package/lib/web/index.d.ts +19 -0
- package/lib/web/index.js +19 -0
- package/lib/web/signer.d.ts +37 -0
- package/lib/web/signer.js +61 -0
- package/package.json +106 -0
package/README.md
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
# @ardriveapp/turbo-sdk 🚀
|
2
|
+
|
3
|
+
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.
|
4
|
+
|
5
|
+
## Table of Contents
|
6
|
+
|
7
|
+
- [Installation](#installation)
|
8
|
+
- [Usage](#usage):
|
9
|
+
|
10
|
+
- [NodeJS Environments](#nodejs)
|
11
|
+
- [CommonJS](#commonjs)
|
12
|
+
- [ESM](#esm)
|
13
|
+
- [Web Environments](#web)
|
14
|
+
- [Bundlers (Webpack, Rollup, ESbuild, etc.)](#bundlers-webpack-rollup-esbuild-etc)
|
15
|
+
- [Browser](#browser)
|
16
|
+
- [Typescript](#typescript)
|
17
|
+
- [Examples](./examples)
|
18
|
+
|
19
|
+
- [Contributions](#contributions)
|
20
|
+
|
21
|
+
# Installation
|
22
|
+
|
23
|
+
```shell
|
24
|
+
npm install @ardrive/turbo-sdk
|
25
|
+
```
|
26
|
+
|
27
|
+
or
|
28
|
+
|
29
|
+
```shell
|
30
|
+
yarn add @ardrive/turbo-sdk
|
31
|
+
```
|
32
|
+
|
33
|
+
# Usage
|
34
|
+
|
35
|
+
The SDK is available in both CommonJS and ESM formats and is compatible with bundlers such as Webpack, Rollup, and ESbuild.
|
36
|
+
|
37
|
+
## Web
|
38
|
+
|
39
|
+
# Bundlers (Webpack, Rollup, ESbuild, etc.)
|
40
|
+
|
41
|
+
```javascript
|
42
|
+
import { TurboFactory } from '@ardrive/turbo-sdk/web';
|
43
|
+
|
44
|
+
const turbo = TurboFactory.unauthenticated({});
|
45
|
+
const rates = await turbo.getFiatRates();
|
46
|
+
```
|
47
|
+
|
48
|
+
### Browser
|
49
|
+
|
50
|
+
```html
|
51
|
+
<script src="https://cdn.jsdelivr.net/npm/@ardrive/turbo-sdk"></script>
|
52
|
+
<script>
|
53
|
+
const turbo = TurboFactory.unauthenticated({});
|
54
|
+
const rates = await turbo.getFiatRates();
|
55
|
+
</script>
|
56
|
+
```
|
57
|
+
|
58
|
+
## NodeJS
|
59
|
+
|
60
|
+
### CommonJS
|
61
|
+
|
62
|
+
```javascript
|
63
|
+
const { TurboFactory } = require('@ardrive/turbo-sdk/node');
|
64
|
+
|
65
|
+
const turbo = TurboFactory.unauthenticated({});
|
66
|
+
const rates = await turbo.getFiatRates();
|
67
|
+
```
|
68
|
+
|
69
|
+
### ESM
|
70
|
+
|
71
|
+
```javascript
|
72
|
+
import { TurboFactory } from '@ardrive/turbo-sdk/node';
|
73
|
+
|
74
|
+
const turbo = TurboFactory.unauthenticated({});
|
75
|
+
const rates = await turbo.getFiatRates();
|
76
|
+
```
|
77
|
+
|
78
|
+
## Typescript
|
79
|
+
|
80
|
+
The SDK provides TypeScript typings. When you import the SDK in a TypeScript project:
|
81
|
+
|
82
|
+
```typescript
|
83
|
+
import Ardrive from '@ardrive/turbo-sdk/web';
|
84
|
+
|
85
|
+
// or '@ardrive/turbo-sdk/node' for Node.js projects
|
86
|
+
```
|
87
|
+
|
88
|
+
The provided typings (`./lib/types/index.d.ts`) will be automatically recognized, offering type checking and autocompletion benefits.
|
89
|
+
|
90
|
+
# APIs (WIP)
|
91
|
+
|
92
|
+
## TurboFactory
|
93
|
+
|
94
|
+
- `public()`
|
95
|
+
- `private()`
|
96
|
+
|
97
|
+
## TurboUnauthenticatedClient
|
98
|
+
|
99
|
+
- `getFiatRates()`
|
100
|
+
- `getFiatToAR()`
|
101
|
+
- `getSupportedCountries()`
|
102
|
+
- `getSupportedCurrencies()`
|
103
|
+
- `getWincForFiat()`
|
104
|
+
- `getUploadCosts()`
|
105
|
+
- `uploadSignedDataItem()`
|
106
|
+
|
107
|
+
## TurboAuthenticatedClient
|
108
|
+
|
109
|
+
- `getBalance()`
|
110
|
+
- `uploadFile()`
|
111
|
+
|
112
|
+
# Contributions
|
113
|
+
|
114
|
+
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.
|