@ardrive/turbo-sdk 1.20.2 → 1.21.0
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/README.md +29 -0
- package/bundles/web.bundle.min.js +312 -277
- package/lib/cjs/cli/cli.js +6 -0
- package/lib/cjs/cli/commands/shareCredits.js +1 -1
- package/lib/cjs/cli/commands/tokenPrice.js +45 -0
- package/lib/cjs/cli/options.js +4 -0
- package/lib/cjs/common/payment.js +15 -0
- package/lib/cjs/common/signer.js +3 -3
- package/lib/cjs/common/token/index.js +9 -1
- package/lib/cjs/common/turbo.js +6 -0
- package/lib/cjs/utils/base64.js +2 -2
- package/lib/cjs/utils/common.js +1 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +6 -0
- package/lib/esm/cli/commands/shareCredits.js +1 -1
- package/lib/esm/cli/commands/tokenPrice.js +42 -0
- package/lib/esm/cli/options.js +4 -0
- package/lib/esm/common/payment.js +15 -0
- package/lib/esm/common/signer.js +3 -3
- package/lib/esm/common/token/index.js +8 -0
- package/lib/esm/common/turbo.js +6 -0
- package/lib/esm/utils/base64.js +2 -2
- package/lib/esm/utils/common.js +1 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/shareCredits.d.ts.map +1 -1
- package/lib/types/cli/commands/tokenPrice.d.ts +3 -0
- package/lib/types/cli/commands/tokenPrice.d.ts.map +1 -0
- package/lib/types/cli/options.d.ts +4 -0
- package/lib/types/cli/options.d.ts.map +1 -1
- package/lib/types/cli/types.d.ts +6 -3
- package/lib/types/cli/types.d.ts.map +1 -1
- package/lib/types/common/payment.d.ts +4 -1
- package/lib/types/common/payment.d.ts.map +1 -1
- package/lib/types/common/signer.d.ts.map +1 -1
- package/lib/types/common/token/index.d.ts +1 -0
- package/lib/types/common/token/index.d.ts.map +1 -1
- package/lib/types/common/turbo.d.ts +7 -1
- package/lib/types/common/turbo.d.ts.map +1 -1
- package/lib/types/types.d.ts +8 -0
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/utils/common.d.ts.map +1 -1
- package/lib/types/version.d.ts +1 -1
- package/lib/types/version.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -42,6 +42,7 @@ Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionality for interac
|
|
42
42
|
- [`getFiatRates()`](#getfiatrates)
|
43
43
|
- [`getWincForFiat({ amount })`](#getwincforfiat-amount-)
|
44
44
|
- [`getWincForToken({ tokenAmount })`](#getwincfortoken-tokenamount-)
|
45
|
+
- [`getTokenPriceForBytes({ byteCount })`](#gettokenpriceforbytes-bytecount-)
|
45
46
|
- [`getUploadCosts({ bytes })`](#getuploadcosts-bytes-)
|
46
47
|
- [`uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal })`](#uploadsigneddataitem-dataitemstreamfactory-dataitemsizefactory-signal-)
|
47
48
|
- [`createCheckoutSession({ amount, owner })`](#createcheckoutsession-amount-owner-)
|
@@ -80,6 +81,7 @@ Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionality for interac
|
|
80
81
|
- [`upload-folder`](#upload-folder)
|
81
82
|
- [`upload-file`](#upload-file)
|
82
83
|
- [`price`](#price)
|
84
|
+
- [`token-price`](#token-price)
|
83
85
|
- [`share-credits`](#share-credits)
|
84
86
|
- [`revoke-credits`](#revoke-credits)
|
85
87
|
- [`list-shares`](#list-shares)
|
@@ -390,6 +392,19 @@ const { winc, actualTokenAmount, equivalentWincTokenAmount } =
|
|
390
392
|
});
|
391
393
|
```
|
392
394
|
|
395
|
+
#### `getTokenPriceForBytes({ byteCount })`
|
396
|
+
|
397
|
+
Get the current price from the Turbo Payment Service, denominated in the specified token, for uploading a specified number of bytes to Turbo.
|
398
|
+
|
399
|
+
```typescript
|
400
|
+
const turbo = TurboFactory.unauthenticated({ token: 'solana' });
|
401
|
+
const { tokenPrice } = await turbo.getTokenPriceForBytes({
|
402
|
+
byteCount: 1024 * 1024 * 100,
|
403
|
+
});
|
404
|
+
|
405
|
+
console.log(tokenPrice); // Estimated SOL Price for 100 MiB
|
406
|
+
```
|
407
|
+
|
393
408
|
#### `getUploadCosts({ bytes })`
|
394
409
|
|
395
410
|
Returns the estimated cost in Winston Credits for the provided file sizes, including all upload adjustments and fees.
|
@@ -905,6 +920,20 @@ turbo price --value 1024 --type bytes
|
|
905
920
|
turbo price --value 1.1 --type arweave
|
906
921
|
```
|
907
922
|
|
923
|
+
##### `token-price`
|
924
|
+
|
925
|
+
Get the current price from the Turbo Payment Service, denominated in the specified token, for uploading a specified number of bytes to Turbo.
|
926
|
+
|
927
|
+
Command Options:
|
928
|
+
|
929
|
+
- `--byte-count <byteCount>` - Byte value to get the token price for
|
930
|
+
|
931
|
+
e.g:
|
932
|
+
|
933
|
+
```shell
|
934
|
+
turbo token-price --byte-count 102400 --token solana
|
935
|
+
```
|
936
|
+
|
908
937
|
##### `share-credits`
|
909
938
|
|
910
939
|
Shares credits from the connected wallet to the provided native address and approved winc amount.
|