@ardrive/turbo-sdk 1.23.4-alpha.2 → 1.23.5
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 +100 -154
- package/bundles/web.bundle.min.js +17 -12
- package/lib/cjs/common/token/arweave.js +16 -11
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/token/arweave.js +16 -11
- package/lib/esm/version.js +1 -1
- package/lib/types/common/token/arweave.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 +2 -2
package/README.md
CHANGED
@@ -13,79 +13,17 @@ Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionality for interac
|
|
13
13
|
- [Quick Start](#quick-start)
|
14
14
|
- [Usage](#usage)
|
15
15
|
- [Web](#web)
|
16
|
-
- [Bundlers (Webpack, Rollup, ESbuild, etc.)](#bundlers-webpack-rollup-esbuild-etc)
|
17
|
-
- [Browser](#browser)
|
18
16
|
- [NodeJS](#nodejs)
|
19
|
-
- [CommonJS](#commonjs)
|
20
|
-
- [ESM](#esm)
|
21
17
|
- [Typescript](#typescript)
|
22
18
|
- [Examples](#examples)
|
23
19
|
- [Logging](#logging)
|
24
20
|
- [APIs](#apis)
|
25
21
|
- [TurboFactory](#turbofactory)
|
26
|
-
- [`unauthenticated()`](#unauthenticated)
|
27
|
-
- [`authenticated()`](#authenticated)
|
28
|
-
- [Arweave JWK](#arweave-jwk)
|
29
|
-
- [ArweaveSigner](#arweavesigner)
|
30
|
-
- [ArconnectSigner](#arconnectsigner)
|
31
|
-
- [EthereumSigner](#ethereumsigner)
|
32
|
-
- [Ethereum Private Key](#ethereum-private-key)
|
33
|
-
- [POL (MATIC) Private Key](#pol-matic-private-key)
|
34
|
-
- [HexSolanaSigner](#hexsolanasigner)
|
35
|
-
- [Solana Secret Key](#solana-secret-key)
|
36
|
-
- [KYVE Private Key](#kyve-private-key)
|
37
|
-
- [KYVE Mnemonic](#kyve-mnemonic)
|
38
22
|
- [TurboUnauthenticatedClient](#turbounauthenticatedclient)
|
39
|
-
- [`getSupportedCurrencies()`](#getsupportedcurrencies)
|
40
|
-
- [`getSupportedCountries()`](#getsupportedcountries)
|
41
|
-
- [`getFiatToAR({ currency })`](#getfiattoar-currency-)
|
42
|
-
- [`getFiatRates()`](#getfiatrates)
|
43
|
-
- [`getWincForFiat({ amount })`](#getwincforfiat-amount-)
|
44
|
-
- [`getWincForToken({ tokenAmount })`](#getwincfortoken-tokenamount-)
|
45
|
-
- [`getTokenPriceForBytes({ byteCount })`](#gettokenpriceforbytes-bytecount-)
|
46
|
-
- [`getUploadCosts({ bytes })`](#getuploadcosts-bytes-)
|
47
|
-
- [`uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal })`](#uploadsigneddataitem-dataitemstreamfactory-dataitemsizefactory-signal-)
|
48
|
-
- [`createCheckoutSession({ amount, owner })`](#createcheckoutsession-amount-owner-)
|
49
|
-
- [Arweave (AR) Fiat Top Up](#arweave-ar-fiat-top-up)
|
50
|
-
- [Ethereum (ETH) Fiat Top Up](#ethereum-eth-fiat-top-up)
|
51
|
-
- [Solana (SOL) Fiat Top Up](#solana-sol-fiat-top-up)
|
52
|
-
- [Polygon (POL / MATIC) Fiat Top Up](#polygon-pol--matic-fiat-top-up)
|
53
|
-
- [KYVE Fiat Top Up](#kyve-fiat-top-up)
|
54
|
-
- [`submitFundTransaction({ txId })`](#submitfundtransaction-txid-)
|
55
23
|
- [TurboAuthenticatedClient](#turboauthenticatedclient)
|
56
|
-
- [`getBalance()`](#getbalance)
|
57
|
-
- [`signer.getNativeAddress()`](#signergetnativeaddress)
|
58
|
-
- [`getWincForFiat({ amount, promoCodes })`](#getwincforfiat-amount-promocodes-)
|
59
|
-
- [`createCheckoutSession({ amount, owner, promoCodes })`](#createcheckoutsession-amount-owner-promocodes-)
|
60
|
-
- [`uploadFile({ fileStreamFactory, fileSizeFactory, signal, dataItemOpts })`](#uploadfile-filestreamfactory-filesizefactory-signal-dataitemopts-)
|
61
|
-
- [`uploadFolder({ folderPath, files, dataItemOpts, signal, maxConcurrentUploads, throwOnFailure, manifestOptions })`](#uploadfolder-folderpath-files-dataitemopts-signal-maxconcurrentuploads-throwonfailure-manifestoptions-)
|
62
|
-
- [NodeJS Upload Folder](#nodejs-upload-folder)
|
63
|
-
- [Browser Upload Folder](#browser-upload-folder)
|
64
|
-
- [`topUpWithTokens({ tokenAmount, feeMultiplier })`](#topupwithtokens-tokenamount-feemultiplier-)
|
65
|
-
- [Arweave (AR) Crypto Top Up](#arweave-ar-crypto-top-up)
|
66
|
-
- [Ethereum (ETH) Crypto Top Up](#ethereum-eth-crypto-top-up)
|
67
|
-
- [Polygon (POL / MATIC) Crypto Top Up](#polygon-pol--matic-crypto-top-up)
|
68
|
-
- [Eth on Base Network Crypto Top Up](#eth-on-base-network-crypto-top-up)
|
69
|
-
- [Solana (SOL) Crypto Top Up](#solana-sol-crypto-top-up)
|
70
|
-
- [KYVE Crypto Top Up](#kyve-crypto-top-up)
|
71
|
-
- [`shareCredits({ approvedAddress, approvedWincAmount, expiresBySeconds })`](#sharecredits-approvedaddress-approvedwincamount-expiresbyseconds-)
|
72
|
-
- [`revokeCredits({ approvedAddress })`](#revokecredits-approvedaddress-)
|
73
|
-
- [`getCreditShareApprovals({ userAddress })`](#getcreditshareapprovals-useraddress-)
|
74
24
|
- [CLI](#cli)
|
75
|
-
- [
|
76
|
-
- [
|
77
|
-
- [Options](#options)
|
78
|
-
- [Commands](#commands)
|
79
|
-
- [`balance`](#balance)
|
80
|
-
- [`top-up`](#top-up)
|
81
|
-
- [`crypto-fund`](#crypto-fund)
|
82
|
-
- [`upload-folder`](#upload-folder)
|
83
|
-
- [`upload-file`](#upload-file)
|
84
|
-
- [`price`](#price)
|
85
|
-
- [`token-price`](#token-price)
|
86
|
-
- [`share-credits`](#share-credits)
|
87
|
-
- [`revoke-credits`](#revoke-credits)
|
88
|
-
- [`list-shares`](#list-shares)
|
25
|
+
- [Installation](#installation-1)
|
26
|
+
- [Usage](#usage-1)
|
89
27
|
- [Turbo Credit Sharing](#turbo-credit-sharing)
|
90
28
|
- [Developers](#developers)
|
91
29
|
- [Requirements](#requirements)
|
@@ -111,55 +49,74 @@ yarn add @ardrive/turbo-sdk
|
|
111
49
|
## Quick Start
|
112
50
|
|
113
51
|
```typescript
|
114
|
-
import {
|
52
|
+
import { ArweaveSigner, TurboFactory } from '@ardrive/turbo-sdk';
|
53
|
+
import Arweave from 'arweave';
|
54
|
+
import fs from 'fs';
|
55
|
+
import open from 'open';
|
56
|
+
import path from 'path';
|
115
57
|
|
116
|
-
|
117
|
-
|
118
|
-
const
|
119
|
-
const
|
120
|
-
|
121
|
-
|
122
|
-
const signer = new ArweaveSigner(jwk);
|
123
|
-
const turbo = TurboFactory.authenticated({ signer });
|
58
|
+
async function uploadWithTurbo() {
|
59
|
+
// load your JWK directly to authenticate
|
60
|
+
const arweave = Arweave({});
|
61
|
+
const jwk = JSON.parse(fs.readFileSync('./my-jwk.json', 'utf-8'));
|
62
|
+
const address = await arweave.wallets.jwkToAddress(jwk);
|
63
|
+
const turbo = TurboFactory.authenticated({ privateKey: jwk });
|
124
64
|
|
125
|
-
//
|
126
|
-
const
|
65
|
+
// or provide your own signer
|
66
|
+
// const signer = new ArweaveSigner(jwk);
|
67
|
+
// const turbo = TurboFactory.authenticated({ signer });
|
127
68
|
|
128
|
-
//
|
129
|
-
const
|
130
|
-
const fileSize = fs.statSync(filePath).size;
|
69
|
+
// get the wallet balance
|
70
|
+
const { winc: balance } = await turbo.getBalance();
|
131
71
|
|
132
|
-
//
|
133
|
-
const
|
134
|
-
|
135
|
-
});
|
72
|
+
// prep file for upload
|
73
|
+
const filePath = path.join(__dirname, './my-image.png');
|
74
|
+
const fileSize = fs.statSync(filePath).size;
|
136
75
|
|
137
|
-
//
|
138
|
-
|
139
|
-
|
140
|
-
amount: fileSizeCost,
|
141
|
-
owner: address,
|
142
|
-
// add a promo code if you have one
|
76
|
+
// get the cost of uploading the file
|
77
|
+
const [{ winc: fileSizeCost }] = await turbo.getUploadCosts({
|
78
|
+
bytes: [fileSize],
|
143
79
|
});
|
144
|
-
// open the URL to top-up, continue when done
|
145
|
-
open(url);
|
146
|
-
return;
|
147
|
-
}
|
148
80
|
|
149
|
-
// upload
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
81
|
+
// check if balance greater than upload cost, and if in browser
|
82
|
+
if (balance < fileSizeCost && window !== undefined) {
|
83
|
+
const { url } = await turbo.createCheckoutSession({
|
84
|
+
amount: fileSizeCost,
|
85
|
+
owner: address,
|
86
|
+
// add a promo code if you have one
|
87
|
+
});
|
88
|
+
|
89
|
+
// open the URL to top-up if in browser
|
90
|
+
window.open(url, '_blank');
|
91
|
+
} else {
|
92
|
+
// otherwise, print the URL to the console
|
93
|
+
console.log('Please top up your balance via the CLI before uploading', {
|
94
|
+
balance,
|
95
|
+
fileSizeCost,
|
96
|
+
});
|
97
|
+
}
|
98
|
+
|
99
|
+
// upload the file
|
100
|
+
try {
|
101
|
+
const { id, owner, dataCaches, fastFinalityIndexes } =
|
102
|
+
await turbo.uploadFile({
|
103
|
+
fileStreamFactory: () => fs.createReadStream(filePath),
|
104
|
+
fileSizeFactory: () => fileSize,
|
105
|
+
});
|
106
|
+
// upload complete!
|
107
|
+
console.log('Successfully upload data item!', {
|
108
|
+
id,
|
109
|
+
owner,
|
110
|
+
dataCaches,
|
111
|
+
fastFinalityIndexes,
|
112
|
+
});
|
113
|
+
} catch (error) {
|
114
|
+
// upload failed
|
115
|
+
console.error('Failed to upload data item!', error);
|
116
|
+
} finally {
|
117
|
+
const { winc: newBalance } = await turbo.getBalance();
|
118
|
+
console.log('New balance:', newBalance);
|
119
|
+
}
|
163
120
|
}
|
164
121
|
```
|
165
122
|
|
@@ -169,24 +126,13 @@ The SDK is provided in both CommonJS and ESM formats, and it's compatible with b
|
|
169
126
|
|
170
127
|
### Web
|
171
128
|
|
172
|
-
#### Bundlers (Webpack, Rollup, ESbuild, etc.)
|
173
|
-
|
174
|
-
CommonJS:
|
175
|
-
|
176
|
-
```javascript
|
177
|
-
import { TurboFactory } from '@ardrive/turbo-sdk';
|
178
|
-
|
179
|
-
const turbo = TurboFactory.unauthenticated();
|
180
|
-
const rates = await turbo.getFiatRates();
|
181
|
-
```
|
182
|
-
|
183
129
|
> [!WARNING]
|
184
130
|
> Polyfills are not provided by default for bundled web projects (Vite, ESBuild, Webpack, Rollup, etc.) . Depending on your apps bundler configuration and plugins, you will need to provide polyfills for various imports including `crypto`, `process`, `fs` and `buffer`. Refer to your bundler's documentation for how to provide the necessary polyfills.
|
185
131
|
|
186
|
-
|
132
|
+
#### Bundlers (Webpack, Rollup, ESbuild, etc.)
|
187
133
|
|
188
|
-
```
|
189
|
-
import { TurboFactory } from '@ardrive/turbo-sdk
|
134
|
+
```typescript
|
135
|
+
import { TurboFactory } from '@ardrive/turbo-sdk/web';
|
190
136
|
|
191
137
|
const turbo = TurboFactory.unauthenticated();
|
192
138
|
const rates = await turbo.getFiatRates();
|
@@ -207,11 +153,25 @@ const rates = await turbo.getFiatRates();
|
|
207
153
|
|
208
154
|
#### CommonJS
|
209
155
|
|
210
|
-
|
156
|
+
Full example available in the [examples/typescript/cjs].
|
157
|
+
|
158
|
+
```typescript
|
159
|
+
import { TurboFactory } from '@ardrive/turbo-sdk';
|
160
|
+
|
161
|
+
const turbo = TurboFactory.unauthenticated();
|
162
|
+
const rates = await turbo.getFiatRates();
|
163
|
+
```
|
211
164
|
|
212
165
|
#### ESM
|
213
166
|
|
214
|
-
|
167
|
+
Full example available in the [examples/typescript/esm].
|
168
|
+
|
169
|
+
```typescript
|
170
|
+
import { TurboFactory } from '@ardrive/turbo-sdk/node';
|
171
|
+
|
172
|
+
const turbo = TurboFactory.unauthenticated();
|
173
|
+
const rates = await turbo.getFiatRates();
|
174
|
+
```
|
215
175
|
|
216
176
|
### Typescript
|
217
177
|
|
@@ -444,21 +404,12 @@ const { url, winc, paymentAmount, quotedPaymentAmount, adjustments } =
|
|
444
404
|
});
|
445
405
|
|
446
406
|
// Open checkout session in a browser
|
447
|
-
|
448
|
-
// macOS
|
449
|
-
exec(`open ${url}`);
|
450
|
-
} else if (process.platform === 'win32') {
|
451
|
-
// Windows
|
452
|
-
exec(`start "" "${url}"`, { shell: true });
|
453
|
-
} else {
|
454
|
-
// Linux/Unix
|
455
|
-
open(url);
|
456
|
-
}
|
407
|
+
window.open(url, '_blank');
|
457
408
|
```
|
458
409
|
|
459
410
|
##### Ethereum (ETH) Fiat Top Up
|
460
411
|
|
461
|
-
```
|
412
|
+
```typescript
|
462
413
|
const turbo = TurboFactory.unauthenticated({ token: 'ethereum' });
|
463
414
|
|
464
415
|
const { url, winc, paymentAmount } = await turbo.createCheckoutSession({
|
@@ -469,7 +420,7 @@ const { url, winc, paymentAmount } = await turbo.createCheckoutSession({
|
|
469
420
|
|
470
421
|
##### Solana (SOL) Fiat Top Up
|
471
422
|
|
472
|
-
```
|
423
|
+
```typescript
|
473
424
|
const turbo = TurboFactory.unauthenticated({ token: 'solana' });
|
474
425
|
|
475
426
|
const { url, winc, paymentAmount } = await turbo.createCheckoutSession({
|
@@ -480,7 +431,7 @@ const { url, winc, paymentAmount } = await turbo.createCheckoutSession({
|
|
480
431
|
|
481
432
|
##### Polygon (POL / MATIC) Fiat Top Up
|
482
433
|
|
483
|
-
```
|
434
|
+
```typescript
|
484
435
|
const turbo = TurboFactory.unauthenticated({ token: 'pol' });
|
485
436
|
|
486
437
|
const { url, winc, paymentAmount } = await turbo.createCheckoutSession({
|
@@ -491,7 +442,7 @@ const { url, winc, paymentAmount } = await turbo.createCheckoutSession({
|
|
491
442
|
|
492
443
|
##### KYVE Fiat Top Up
|
493
444
|
|
494
|
-
```
|
445
|
+
```typescript
|
495
446
|
const turbo = TurboFactory.unauthenticated({ token: 'kyve' });
|
496
447
|
|
497
448
|
const { url, winc, paymentAmount } = await turbo.createCheckoutSession({
|
@@ -556,17 +507,8 @@ const { url, winc, paymentAmount, quotedPaymentAmount, adjustments } =
|
|
556
507
|
promoCodes: ['MY_PROMO_CODE'], // promo codes require an authenticated client
|
557
508
|
});
|
558
509
|
|
559
|
-
//
|
560
|
-
|
561
|
-
// macOS
|
562
|
-
exec(`open ${url}`);
|
563
|
-
} else if (process.platform === 'win32') {
|
564
|
-
// Windows
|
565
|
-
exec(`start "" "${url}"`, { shell: true });
|
566
|
-
} else {
|
567
|
-
// Linux/Unix
|
568
|
-
open(url);
|
569
|
-
}
|
510
|
+
// open checkout session in a browser
|
511
|
+
window.open(url, '_blank');
|
570
512
|
```
|
571
513
|
|
572
514
|
#### `uploadFile({ fileStreamFactory, fileSizeFactory, signal, dataItemOpts })`
|
@@ -671,7 +613,7 @@ const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
|
|
671
613
|
|
672
614
|
##### Ethereum (ETH) Crypto Top Up
|
673
615
|
|
674
|
-
```
|
616
|
+
```typescript
|
675
617
|
const turbo = TurboFactory.authenticated({ signer, token: 'ethereum' });
|
676
618
|
|
677
619
|
const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
|
@@ -681,7 +623,7 @@ const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
|
|
681
623
|
|
682
624
|
##### Polygon (POL / MATIC) Crypto Top Up
|
683
625
|
|
684
|
-
```
|
626
|
+
```typescript
|
685
627
|
const turbo = TurboFactory.authenticated({ signer, token: 'pol' });
|
686
628
|
|
687
629
|
const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
|
@@ -691,7 +633,7 @@ const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
|
|
691
633
|
|
692
634
|
##### Eth on Base Network Crypto Top Up
|
693
635
|
|
694
|
-
```
|
636
|
+
```typescript
|
695
637
|
const turbo = TurboFactory.authenticated({ signer, token: 'base-eth' });
|
696
638
|
|
697
639
|
const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
|
@@ -701,7 +643,7 @@ const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
|
|
701
643
|
|
702
644
|
##### Solana (SOL) Crypto Top Up
|
703
645
|
|
704
|
-
```
|
646
|
+
```typescript
|
705
647
|
const turbo = TurboFactory.authenticated({ signer, token: 'solana' });
|
706
648
|
|
707
649
|
const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
|
@@ -711,7 +653,7 @@ const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
|
|
711
653
|
|
712
654
|
##### KYVE Crypto Top Up
|
713
655
|
|
714
|
-
```
|
656
|
+
```typescript
|
715
657
|
const turbo = TurboFactory.authenticated({ signer, token: 'kyve' });
|
716
658
|
|
717
659
|
const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
|
@@ -754,7 +696,9 @@ const { givenApprovals, receivedApprovals } =
|
|
754
696
|
|
755
697
|
## CLI
|
756
698
|
|
757
|
-
|
699
|
+
<!-- markdownlint-disable MD024 -->
|
700
|
+
|
701
|
+
### Installation
|
758
702
|
|
759
703
|
Global installation:
|
760
704
|
|
@@ -780,7 +724,9 @@ or
|
|
780
724
|
yarn add -D @ardrive/turbo-sdk
|
781
725
|
```
|
782
726
|
|
783
|
-
|
727
|
+
<!-- markdownlint-disable MD024 -->
|
728
|
+
|
729
|
+
### Usage
|
784
730
|
|
785
731
|
```shell
|
786
732
|
turbo --help
|
@@ -313886,7 +313886,7 @@ var import_winston = __toESM(require_winston(), 1);
|
|
313886
313886
|
init_dirname();
|
313887
313887
|
init_buffer2();
|
313888
313888
|
init_process2();
|
313889
|
-
var version16 = "1.23.4
|
313889
|
+
var version16 = "1.23.4";
|
313890
313890
|
|
313891
313891
|
// src/common/logger.ts
|
313892
313892
|
var TurboWinstonLogger = class _TurboWinstonLogger {
|
@@ -318227,22 +318227,27 @@ var ArweaveToken = class {
|
|
318227
318227
|
let transaction;
|
318228
318228
|
attempts++;
|
318229
318229
|
try {
|
318230
|
-
const
|
318231
|
-
query: `
|
318230
|
+
const gqlQuery = `
|
318232
318231
|
query {
|
318233
|
-
|
318234
|
-
|
318235
|
-
|
318236
|
-
|
318237
|
-
|
318238
|
-
|
318239
|
-
|
318232
|
+
transactions(ids: ["${txId}"]) {
|
318233
|
+
edges {
|
318234
|
+
node {
|
318235
|
+
recipient
|
318236
|
+
owner {
|
318237
|
+
address
|
318238
|
+
}
|
318239
|
+
quantity {
|
318240
|
+
winston
|
318241
|
+
}
|
318242
|
+
}
|
318240
318243
|
}
|
318241
318244
|
}
|
318242
318245
|
}
|
318243
|
-
|
318246
|
+
`;
|
318247
|
+
const response = await this.arweave.api.post(`/graphql`, {
|
318248
|
+
query: gqlQuery
|
318244
318249
|
});
|
318245
|
-
transaction = response?.data?.data?.
|
318250
|
+
transaction = response?.data?.data?.transactions?.edges[0]?.node;
|
318246
318251
|
} catch (err) {
|
318247
318252
|
this.logger.debug("Failed to poll for transaction...", { err });
|
318248
318253
|
}
|
@@ -87,22 +87,27 @@ class ArweaveToken {
|
|
87
87
|
let transaction;
|
88
88
|
attempts++;
|
89
89
|
try {
|
90
|
-
const
|
91
|
-
query: `
|
90
|
+
const gqlQuery = `
|
92
91
|
query {
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
92
|
+
transactions(ids: ["${txId}"]) {
|
93
|
+
edges {
|
94
|
+
node {
|
95
|
+
recipient
|
96
|
+
owner {
|
97
|
+
address
|
98
|
+
}
|
99
|
+
quantity {
|
100
|
+
winston
|
101
|
+
}
|
102
|
+
}
|
100
103
|
}
|
101
104
|
}
|
102
105
|
}
|
103
|
-
|
106
|
+
`;
|
107
|
+
const response = await this.arweave.api.post(`/graphql`, {
|
108
|
+
query: gqlQuery,
|
104
109
|
});
|
105
|
-
transaction = response?.data?.data?.
|
110
|
+
transaction = response?.data?.data?.transactions?.edges[0]?.node;
|
106
111
|
}
|
107
112
|
catch (err) {
|
108
113
|
// Continue retries when request errors
|
package/lib/cjs/version.js
CHANGED
@@ -81,22 +81,27 @@ export class ArweaveToken {
|
|
81
81
|
let transaction;
|
82
82
|
attempts++;
|
83
83
|
try {
|
84
|
-
const
|
85
|
-
query: `
|
84
|
+
const gqlQuery = `
|
86
85
|
query {
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
86
|
+
transactions(ids: ["${txId}"]) {
|
87
|
+
edges {
|
88
|
+
node {
|
89
|
+
recipient
|
90
|
+
owner {
|
91
|
+
address
|
92
|
+
}
|
93
|
+
quantity {
|
94
|
+
winston
|
95
|
+
}
|
96
|
+
}
|
94
97
|
}
|
95
98
|
}
|
96
99
|
}
|
97
|
-
|
100
|
+
`;
|
101
|
+
const response = await this.arweave.api.post(`/graphql`, {
|
102
|
+
query: gqlQuery,
|
98
103
|
});
|
99
|
-
transaction = response?.data?.data?.
|
104
|
+
transaction = response?.data?.data?.transactions?.edges[0]?.node;
|
100
105
|
}
|
101
106
|
catch (err) {
|
102
107
|
// Continue retries when request errors
|
package/lib/esm/version.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"arweave.d.ts","sourceRoot":"","sources":["../../../../src/common/token/arweave.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,aAAa,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,EACV,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAUxB,qBAAa,YAAa,YAAW,UAAU;IAC7C,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;IAC9B,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC;IACjC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,cAAc,EAAE,mBAAmB,CAAC;gBAElC,EACV,UAAkC,EAClC,OAAO,EACP,MAAmC,EACnC,KAAY,EACZ,cAIC,GACF,GAAE;QACD,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,aAAa,CAAC;QACxB,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,cAAc,CAAC,EAAE,mBAAmB,CAAC;KACjC;IAeO,iBAAiB,CAAC,EAC7B,aAAa,EACb,MAAM,EACN,WAAW,EACX,MAAM,GACP,EAAE,mBAAmB,GAAG,OAAO,CAAC;QAC/B,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IA4CW,uBAAuB,CAAC,EACnC,IAAI,GACL,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,IAAI,CAAC;
|
1
|
+
{"version":3,"file":"arweave.d.ts","sourceRoot":"","sources":["../../../../src/common/token/arweave.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,aAAa,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,EACV,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAUxB,qBAAa,YAAa,YAAW,UAAU;IAC7C,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;IAC9B,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC;IACjC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,cAAc,EAAE,mBAAmB,CAAC;gBAElC,EACV,UAAkC,EAClC,OAAO,EACP,MAAmC,EACnC,KAAY,EACZ,cAIC,GACF,GAAE;QACD,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,aAAa,CAAC;QACxB,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,cAAc,CAAC,EAAE,mBAAmB,CAAC;KACjC;IAeO,iBAAiB,CAAC,EAC7B,aAAa,EACb,MAAM,EACN,WAAW,EACX,MAAM,GACP,EAAE,mBAAmB,GAAG,OAAO,CAAC;QAC/B,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IA4CW,uBAAuB,CAAC,EACnC,IAAI,GACL,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,IAAI,CAAC;IA2DJ,QAAQ,CAAC,EAAE,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;CAqB9C;AAED,eAAO,MAAM,oBAAoB,YAAa,SAAS,CAAC,KAAK,oBAAY,CAAC;AAC1E,eAAO,MAAM,eAAe,OAAQ,SAAS,CAAC,KAAK,WACV,CAAC"}
|
package/lib/types/version.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,eAAO,MAAM,OAAO,
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ardrive/turbo-sdk",
|
3
|
-
"version": "1.23.
|
3
|
+
"version": "1.23.5",
|
4
4
|
"main": "./lib/cjs/node/index.js",
|
5
5
|
"types": "./lib/types/node/index.d.ts",
|
6
6
|
"module": "./lib/esm/node/index.js",
|
@@ -71,7 +71,7 @@
|
|
71
71
|
"example:ts:cjs": "cd examples/typescript/cjs && yarn && yarn test",
|
72
72
|
"docker:up": "docker compose up --quiet-pull -d",
|
73
73
|
"docker:down": "docker compose down -v",
|
74
|
-
"docs": "markdown-toc-gen insert README.md"
|
74
|
+
"docs": "markdown-toc-gen insert README.md --max-depth 3"
|
75
75
|
},
|
76
76
|
"dependencies": {
|
77
77
|
"@cosmjs/amino": "^0.32.4",
|