@ardrive/turbo-sdk 1.0.0-alpha.20 → 1.0.0-alpha.21

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.
@@ -6,8 +6,12 @@ const turbo_js_1 = require("./turbo.js");
6
6
  const upload_js_1 = require("./upload.js");
7
7
  class TurboBaseFactory {
8
8
  static unauthenticated({ paymentServiceConfig = {}, uploadServiceConfig = {}, } = {}) {
9
- const paymentService = new payment_js_1.TurboUnauthenticatedPaymentService(Object.assign({}, paymentServiceConfig));
10
- const uploadService = new upload_js_1.TurboUnauthenticatedUploadService(Object.assign({}, uploadServiceConfig));
9
+ const paymentService = new payment_js_1.TurboUnauthenticatedPaymentService({
10
+ ...paymentServiceConfig,
11
+ });
12
+ const uploadService = new upload_js_1.TurboUnauthenticatedUploadService({
13
+ ...uploadServiceConfig,
14
+ });
11
15
  return new turbo_js_1.TurboUnauthenticatedClient({
12
16
  uploadService,
13
17
  paymentService,
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.TurboHTTPService = void 0;
13
4
  const axiosClient_js_1 = require("../utils/axiosClient.js");
@@ -21,29 +12,25 @@ class TurboHTTPService {
21
12
  retryConfig,
22
13
  });
23
14
  }
24
- get({ endpoint, signal, allowedStatuses = [200, 202], headers, }) {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- const { status, statusText, data } = yield this.axios.get(endpoint, {
27
- headers,
28
- signal,
29
- });
30
- if (!allowedStatuses.includes(status)) {
31
- throw new errors_js_1.FailedRequestError(status, statusText);
32
- }
33
- return data;
15
+ async get({ endpoint, signal, allowedStatuses = [200, 202], headers, }) {
16
+ const { status, statusText, data } = await this.axios.get(endpoint, {
17
+ headers,
18
+ signal,
34
19
  });
20
+ if (!allowedStatuses.includes(status)) {
21
+ throw new errors_js_1.FailedRequestError(status, statusText);
22
+ }
23
+ return data;
35
24
  }
36
- post({ endpoint, signal, allowedStatuses = [200, 202], headers, data, }) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- const { status, statusText, data: response, } = yield this.axios.post(endpoint, data, {
39
- headers,
40
- signal,
41
- });
42
- if (!allowedStatuses.includes(status)) {
43
- throw new errors_js_1.FailedRequestError(status, statusText);
44
- }
45
- return response;
25
+ async post({ endpoint, signal, allowedStatuses = [200, 202], headers, data, }) {
26
+ const { status, statusText, data: response, } = await this.axios.post(endpoint, data, {
27
+ headers,
28
+ signal,
46
29
  });
30
+ if (!allowedStatuses.includes(status)) {
31
+ throw new errors_js_1.FailedRequestError(status, statusText);
32
+ }
33
+ return response;
47
34
  }
48
35
  }
49
36
  exports.TurboHTTPService = TurboHTTPService;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.TurboAuthenticatedPaymentService = exports.TurboUnauthenticatedPaymentService = void 0;
13
4
  const http_js_1 = require("./http.js");
@@ -18,48 +9,36 @@ class TurboUnauthenticatedPaymentService {
18
9
  retryConfig,
19
10
  });
20
11
  }
21
- getFiatRates() {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- return this.httpService.get({
24
- endpoint: '/rates',
25
- });
12
+ async getFiatRates() {
13
+ return this.httpService.get({
14
+ endpoint: '/rates',
26
15
  });
27
16
  }
28
- getFiatToAR({ currency, }) {
29
- return __awaiter(this, void 0, void 0, function* () {
30
- return this.httpService.get({
31
- endpoint: `/rates/${currency}`,
32
- });
17
+ async getFiatToAR({ currency, }) {
18
+ return this.httpService.get({
19
+ endpoint: `/rates/${currency}`,
33
20
  });
34
21
  }
35
- getSupportedCountries() {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- return this.httpService.get({
38
- endpoint: '/countries',
39
- });
22
+ async getSupportedCountries() {
23
+ return this.httpService.get({
24
+ endpoint: '/countries',
40
25
  });
41
26
  }
42
- getSupportedCurrencies() {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- return this.httpService.get({
45
- endpoint: '/currencies',
46
- });
27
+ async getSupportedCurrencies() {
28
+ return this.httpService.get({
29
+ endpoint: '/currencies',
47
30
  });
48
31
  }
49
- getUploadCosts({ bytes, }) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- const fetchPricePromises = bytes.map((byteCount) => this.httpService.get({
52
- endpoint: `/price/bytes/${byteCount}`,
53
- }));
54
- const wincCostsForBytes = yield Promise.all(fetchPricePromises);
55
- return wincCostsForBytes;
56
- });
32
+ async getUploadCosts({ bytes, }) {
33
+ const fetchPricePromises = bytes.map((byteCount) => this.httpService.get({
34
+ endpoint: `/price/bytes/${byteCount}`,
35
+ }));
36
+ const wincCostsForBytes = await Promise.all(fetchPricePromises);
37
+ return wincCostsForBytes;
57
38
  }
58
- getWincForFiat({ amount, currency }) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- return this.httpService.get({
61
- endpoint: `/price/${currency}/${amount}`,
62
- });
39
+ async getWincForFiat({ amount, currency }) {
40
+ return this.httpService.get({
41
+ endpoint: `/price/${currency}/${amount}`,
63
42
  });
64
43
  }
65
44
  }
@@ -70,17 +49,15 @@ class TurboAuthenticatedPaymentService extends TurboUnauthenticatedPaymentServic
70
49
  super({ url, retryConfig });
71
50
  this.signer = signer;
72
51
  }
73
- getBalance() {
74
- return __awaiter(this, void 0, void 0, function* () {
75
- const headers = yield this.signer.generateSignedRequestHeaders();
76
- const balance = yield this.httpService.get({
77
- endpoint: '/balance',
78
- headers,
79
- allowedStatuses: [200, 404],
80
- });
81
- // 404's don't return a balance, so default to 0
82
- return balance.winc ? balance : { winc: '0' };
52
+ async getBalance() {
53
+ const headers = await this.signer.generateSignedRequestHeaders();
54
+ const balance = await this.httpService.get({
55
+ endpoint: '/balance',
56
+ headers,
57
+ allowedStatuses: [200, 404],
83
58
  });
59
+ // 404's don't return a balance, so default to 0
60
+ return balance.winc ? balance : { winc: '0' };
84
61
  }
85
62
  }
86
63
  exports.TurboAuthenticatedPaymentService = TurboAuthenticatedPaymentService;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.TurboAuthenticatedClient = exports.TurboUnauthenticatedClient = void 0;
13
4
  const payment_js_1 = require("./payment.js");
@@ -20,10 +11,8 @@ class TurboUnauthenticatedClient {
20
11
  /**
21
12
  * Returns the supported fiat currency conversion rate for 1AR based on current market prices.
22
13
  */
23
- getFiatToAR({ currency, }) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- return this.paymentService.getFiatToAR({ currency });
26
- });
14
+ async getFiatToAR({ currency, }) {
15
+ return this.paymentService.getFiatToAR({ currency });
27
16
  }
28
17
  /**
29
18
  * Returns the latest conversion rates to purchase 1GiB of data for all supported currencies, including all adjustments and fees.
@@ -31,52 +20,40 @@ class TurboUnauthenticatedClient {
31
20
  * Note: this does not take into account varying adjustments and promotions for different sizes of data. If you want to calculate the total
32
21
  * cost in 'winc' for a given number of bytes, use getUploadCosts.
33
22
  */
34
- getFiatRates() {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- return this.paymentService.getFiatRates();
37
- });
23
+ async getFiatRates() {
24
+ return this.paymentService.getFiatRates();
38
25
  }
39
26
  /**
40
27
  * Returns a comprehensive list of supported countries that can purchase credits through the Turbo Payment Service.
41
28
  */
42
- getSupportedCountries() {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- return this.paymentService.getSupportedCountries();
45
- });
29
+ async getSupportedCountries() {
30
+ return this.paymentService.getSupportedCountries();
46
31
  }
47
32
  /**
48
33
  * Returns a list of all supported fiat currencies.
49
34
  */
50
- getSupportedCurrencies() {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- return this.paymentService.getSupportedCurrencies();
53
- });
35
+ async getSupportedCurrencies() {
36
+ return this.paymentService.getSupportedCurrencies();
54
37
  }
55
38
  /**
56
39
  * Determines the price in 'winc' to upload one data item of a specific size in bytes, including all Turbo cost adjustments and fees.
57
40
  */
58
- getUploadCosts({ bytes, }) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- return this.paymentService.getUploadCosts({ bytes });
61
- });
41
+ async getUploadCosts({ bytes, }) {
42
+ return this.paymentService.getUploadCosts({ bytes });
62
43
  }
63
44
  /**
64
45
  * Determines the amount of 'winc' that would be returned for a given currency and amount, including all Turbo cost adjustments and fees.
65
46
  */
66
- getWincForFiat({ amount, currency, }) {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- return this.paymentService.getWincForFiat({ amount, currency });
69
- });
47
+ async getWincForFiat({ amount, currency, }) {
48
+ return this.paymentService.getWincForFiat({ amount, currency });
70
49
  }
71
50
  /**
72
51
  * Uploads a signed data item to the Turbo Upload Service.
73
52
  */
74
- uploadSignedDataItem({ dataItemStreamFactory, signal, }) {
75
- return __awaiter(this, void 0, void 0, function* () {
76
- return this.uploadService.uploadSignedDataItem({
77
- dataItemStreamFactory,
78
- signal,
79
- });
53
+ async uploadSignedDataItem({ dataItemStreamFactory, signal, }) {
54
+ return this.uploadService.uploadSignedDataItem({
55
+ dataItemStreamFactory,
56
+ signal,
80
57
  });
81
58
  }
82
59
  }
@@ -88,18 +65,14 @@ class TurboAuthenticatedClient extends TurboUnauthenticatedClient {
88
65
  /**
89
66
  * Returns the current balance of the user's wallet in 'winc'.
90
67
  */
91
- getBalance() {
92
- return __awaiter(this, void 0, void 0, function* () {
93
- return this.paymentService.getBalance();
94
- });
68
+ async getBalance() {
69
+ return this.paymentService.getBalance();
95
70
  }
96
71
  /**
97
72
  * Signs and uploads raw data to the Turbo Upload Service.
98
73
  */
99
- uploadFile({ fileStreamFactory, signal, }) {
100
- return __awaiter(this, void 0, void 0, function* () {
101
- return this.uploadService.uploadFile({ fileStreamFactory, signal });
102
- });
74
+ async uploadFile({ fileStreamFactory, signal, }) {
75
+ return this.uploadService.uploadFile({ fileStreamFactory, signal });
103
76
  }
104
77
  }
105
78
  exports.TurboAuthenticatedClient = TurboAuthenticatedClient;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.TurboAuthenticatedUploadService = exports.TurboUnauthenticatedUploadService = void 0;
13
4
  const http_js_1 = require("./http.js");
@@ -18,17 +9,15 @@ class TurboUnauthenticatedUploadService {
18
9
  retryConfig,
19
10
  });
20
11
  }
21
- uploadSignedDataItem({ dataItemStreamFactory, signal, }) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- // TODO: add p-limit constraint or replace with separate upload class
24
- return this.httpService.post({
25
- endpoint: `/tx`,
26
- signal,
27
- data: dataItemStreamFactory(),
28
- headers: {
29
- 'content-type': 'application/octet-stream',
30
- },
31
- });
12
+ async uploadSignedDataItem({ dataItemStreamFactory, signal, }) {
13
+ // TODO: add p-limit constraint or replace with separate upload class
14
+ return this.httpService.post({
15
+ endpoint: `/tx`,
16
+ signal,
17
+ data: dataItemStreamFactory(),
18
+ headers: {
19
+ 'content-type': 'application/octet-stream',
20
+ },
32
21
  });
33
22
  }
34
23
  }
@@ -39,20 +28,18 @@ class TurboAuthenticatedUploadService extends TurboUnauthenticatedUploadService
39
28
  super({ url, retryConfig });
40
29
  this.signer = signer;
41
30
  }
42
- uploadFile({ fileStreamFactory, signal, }) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- const signedDataItem = yield this.signer.signDataItem({
45
- fileStreamFactory,
46
- });
47
- // TODO: add p-limit constraint or replace with separate upload class
48
- return this.httpService.post({
49
- endpoint: `/tx`,
50
- signal,
51
- data: signedDataItem,
52
- headers: {
53
- 'content-type': 'application/octet-stream',
54
- },
55
- });
31
+ async uploadFile({ fileStreamFactory, signal, }) {
32
+ const signedDataItem = await this.signer.signDataItem({
33
+ fileStreamFactory,
34
+ });
35
+ // TODO: add p-limit constraint or replace with separate upload class
36
+ return this.httpService.post({
37
+ endpoint: `/tx`,
38
+ signal,
39
+ data: signedDataItem,
40
+ headers: {
41
+ 'content-type': 'application/octet-stream',
42
+ },
56
43
  });
57
44
  }
58
45
  }
@@ -23,8 +23,14 @@ const signer_js_1 = require("./signer.js");
23
23
  class TurboFactory extends factory_js_1.TurboBaseFactory {
24
24
  static authenticated({ privateKey, paymentServiceConfig = {}, uploadServiceConfig = {}, }) {
25
25
  const signer = new signer_js_1.TurboNodeArweaveSigner({ privateKey });
26
- const paymentService = new index_js_1.TurboAuthenticatedPaymentService(Object.assign(Object.assign({}, paymentServiceConfig), { signer }));
27
- const uploadService = new index_js_1.TurboAuthenticatedUploadService(Object.assign(Object.assign({}, uploadServiceConfig), { signer }));
26
+ const paymentService = new index_js_1.TurboAuthenticatedPaymentService({
27
+ ...paymentServiceConfig,
28
+ signer,
29
+ });
30
+ const uploadService = new index_js_1.TurboAuthenticatedUploadService({
31
+ ...uploadServiceConfig,
32
+ signer,
33
+ });
28
34
  return new index_js_1.TurboAuthenticatedClient({
29
35
  uploadService,
30
36
  paymentService,
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -45,17 +36,15 @@ class TurboNodeArweaveSigner {
45
36
  return (0, arbundles_1.streamSigner)(stream1, stream2, this.signer);
46
37
  }
47
38
  // NOTE: this might be better in a parent class or elsewhere - easy enough to leave in here now and does require specific environment version of crypto
48
- generateSignedRequestHeaders() {
49
- return __awaiter(this, void 0, void 0, function* () {
50
- const nonce = (0, node_crypto_1.randomBytes)(16).toString('hex');
51
- const buffer = Buffer.from(nonce);
52
- const signature = yield index_js_1.default.crypto.sign(this.privateKey, buffer);
53
- return {
54
- 'x-public-key': this.privateKey.n,
55
- 'x-nonce': nonce,
56
- 'x-signature': (0, base64_js_1.toB64Url)(Buffer.from(signature)),
57
- };
58
- });
39
+ async generateSignedRequestHeaders() {
40
+ const nonce = (0, node_crypto_1.randomBytes)(16).toString('hex');
41
+ const buffer = Buffer.from(nonce);
42
+ const signature = await index_js_1.default.crypto.sign(this.privateKey, buffer);
43
+ return {
44
+ 'x-public-key': this.privateKey.n,
45
+ 'x-nonce': nonce,
46
+ 'x-signature': (0, base64_js_1.toB64Url)(Buffer.from(signature)),
47
+ };
59
48
  }
60
49
  }
61
50
  exports.TurboNodeArweaveSigner = TurboNodeArweaveSigner;
@@ -56,7 +56,10 @@ const createAxiosInstance = ({ axiosConfig = {}, retryConfig = {
56
56
  console.debug(`Request failed, ${error}. Retry attempt #${retryCount}...`);
57
57
  },
58
58
  }, }) => {
59
- const axiosInstance = axios_1.default.create(Object.assign(Object.assign({}, axiosConfig), { validateStatus: () => true }));
59
+ const axiosInstance = axios_1.default.create({
60
+ ...axiosConfig,
61
+ validateStatus: () => true, // don't throw on non-200 status codes
62
+ });
60
63
  // eslint-disable-next-line
61
64
  if (retryConfig.retries && retryConfig.retries > 0) {
62
65
  (0, axios_retry_1.default)(axiosInstance, retryConfig);
@@ -1,28 +1,17 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.readableStreamToBuffer = void 0;
13
- function readableStreamToBuffer({ stream, }) {
14
- return __awaiter(this, void 0, void 0, function* () {
15
- const reader = stream.getReader();
16
- const chunks = [];
17
- let done = false;
18
- while (!done) {
19
- const { done: streamDone, value } = yield reader.read();
20
- done = streamDone;
21
- if (!done) {
22
- chunks.push(value);
23
- }
4
+ async function readableStreamToBuffer({ stream, }) {
5
+ const reader = stream.getReader();
6
+ const chunks = [];
7
+ let done = false;
8
+ while (!done) {
9
+ const { done: streamDone, value } = await reader.read();
10
+ done = streamDone;
11
+ if (!done) {
12
+ chunks.push(value);
24
13
  }
25
- return Buffer.concat(chunks);
26
- });
14
+ }
15
+ return Buffer.concat(chunks);
27
16
  }
28
17
  exports.readableStreamToBuffer = readableStreamToBuffer;
@@ -23,8 +23,14 @@ const signer_js_1 = require("./signer.js");
23
23
  class TurboFactory extends factory_js_1.TurboBaseFactory {
24
24
  static authenticated({ privateKey, paymentServiceConfig = {}, uploadServiceConfig = {}, }) {
25
25
  const signer = new signer_js_1.TurboWebArweaveSigner({ privateKey });
26
- const paymentService = new index_js_1.TurboAuthenticatedPaymentService(Object.assign(Object.assign({}, paymentServiceConfig), { signer }));
27
- const uploadService = new index_js_1.TurboAuthenticatedUploadService(Object.assign(Object.assign({}, uploadServiceConfig), { signer }));
26
+ const paymentService = new index_js_1.TurboAuthenticatedPaymentService({
27
+ ...paymentServiceConfig,
28
+ signer,
29
+ });
30
+ const uploadService = new index_js_1.TurboAuthenticatedUploadService({
31
+ ...uploadServiceConfig,
32
+ signer,
33
+ });
28
34
  return new index_js_1.TurboAuthenticatedClient({
29
35
  uploadService,
30
36
  paymentService,
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -39,33 +30,28 @@ class TurboWebArweaveSigner {
39
30
  this.privateKey = privateKey;
40
31
  this.signer = new arbundles_1.ArweaveSigner(this.privateKey);
41
32
  }
42
- signDataItem({ fileStreamFactory, }) {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- // TODO: converts the readable stream to a buffer bc incrementally signing ReadableStreams is not trivial
45
- const buffer = yield (0, readableStream_js_1.readableStreamToBuffer)({
46
- stream: fileStreamFactory(),
47
- // TODO: add payload size to get performance improvements
48
- });
49
- const signedDataItem = (0, arbundles_1.createData)(buffer, this.signer);
50
- yield signedDataItem.sign(this.signer);
51
- return signedDataItem.getRaw();
33
+ async signDataItem({ fileStreamFactory, }) {
34
+ // TODO: converts the readable stream to a buffer bc incrementally signing ReadableStreams is not trivial
35
+ const buffer = await (0, readableStream_js_1.readableStreamToBuffer)({
36
+ stream: fileStreamFactory(),
37
+ // TODO: add payload size to get performance improvements
52
38
  });
39
+ const signedDataItem = (0, arbundles_1.createData)(buffer, this.signer);
40
+ await signedDataItem.sign(this.signer);
41
+ return signedDataItem.getRaw();
53
42
  }
54
43
  // NOTE: this might be better in a parent class or elsewhere - easy enough to leave in here now and does require specific environment version of crypto
55
- generateSignedRequestHeaders() {
56
- var _a;
57
- return __awaiter(this, void 0, void 0, function* () {
58
- // a bit hacky - but arweave exports cause issues in tests vs. browser
59
- const arweave = (_a = arweave_1.default.default) !== null && _a !== void 0 ? _a : arweave_1.default;
60
- const nonce = (0, node_crypto_1.randomBytes)(16).toString('hex');
61
- const buffer = Buffer.from(nonce);
62
- const signature = yield arweave.crypto.sign(this.privateKey, buffer, {});
63
- return {
64
- 'x-public-key': this.privateKey.n,
65
- 'x-nonce': nonce,
66
- 'x-signature': (0, base64_js_1.toB64Url)(Buffer.from(signature)),
67
- };
68
- });
44
+ async generateSignedRequestHeaders() {
45
+ // a bit hacky - but arweave exports cause issues in tests vs. browser
46
+ const arweave = arweave_1.default.default ?? arweave_1.default;
47
+ const nonce = (0, node_crypto_1.randomBytes)(16).toString('hex');
48
+ const buffer = Buffer.from(nonce);
49
+ const signature = await arweave.crypto.sign(this.privateKey, buffer, {});
50
+ return {
51
+ 'x-public-key': this.privateKey.n,
52
+ 'x-nonce': nonce,
53
+ 'x-signature': (0, base64_js_1.toB64Url)(Buffer.from(signature)),
54
+ };
69
55
  }
70
56
  }
71
57
  exports.TurboWebArweaveSigner = TurboWebArweaveSigner;
@@ -3,8 +3,12 @@ import { TurboUnauthenticatedClient } from './turbo.js';
3
3
  import { TurboUnauthenticatedUploadService } from './upload.js';
4
4
  export class TurboBaseFactory {
5
5
  static unauthenticated({ paymentServiceConfig = {}, uploadServiceConfig = {}, } = {}) {
6
- const paymentService = new TurboUnauthenticatedPaymentService(Object.assign({}, paymentServiceConfig));
7
- const uploadService = new TurboUnauthenticatedUploadService(Object.assign({}, uploadServiceConfig));
6
+ const paymentService = new TurboUnauthenticatedPaymentService({
7
+ ...paymentServiceConfig,
8
+ });
9
+ const uploadService = new TurboUnauthenticatedUploadService({
10
+ ...uploadServiceConfig,
11
+ });
8
12
  return new TurboUnauthenticatedClient({
9
13
  uploadService,
10
14
  paymentService,
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { createAxiosInstance } from '../utils/axiosClient.js';
11
2
  import { FailedRequestError } from '../utils/errors.js';
12
3
  export class TurboHTTPService {
@@ -18,28 +9,24 @@ export class TurboHTTPService {
18
9
  retryConfig,
19
10
  });
20
11
  }
21
- get({ endpoint, signal, allowedStatuses = [200, 202], headers, }) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const { status, statusText, data } = yield this.axios.get(endpoint, {
24
- headers,
25
- signal,
26
- });
27
- if (!allowedStatuses.includes(status)) {
28
- throw new FailedRequestError(status, statusText);
29
- }
30
- return data;
12
+ async get({ endpoint, signal, allowedStatuses = [200, 202], headers, }) {
13
+ const { status, statusText, data } = await this.axios.get(endpoint, {
14
+ headers,
15
+ signal,
31
16
  });
17
+ if (!allowedStatuses.includes(status)) {
18
+ throw new FailedRequestError(status, statusText);
19
+ }
20
+ return data;
32
21
  }
33
- post({ endpoint, signal, allowedStatuses = [200, 202], headers, data, }) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- const { status, statusText, data: response, } = yield this.axios.post(endpoint, data, {
36
- headers,
37
- signal,
38
- });
39
- if (!allowedStatuses.includes(status)) {
40
- throw new FailedRequestError(status, statusText);
41
- }
42
- return response;
22
+ async post({ endpoint, signal, allowedStatuses = [200, 202], headers, data, }) {
23
+ const { status, statusText, data: response, } = await this.axios.post(endpoint, data, {
24
+ headers,
25
+ signal,
43
26
  });
27
+ if (!allowedStatuses.includes(status)) {
28
+ throw new FailedRequestError(status, statusText);
29
+ }
30
+ return response;
44
31
  }
45
32
  }
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { TurboHTTPService } from './http.js';
11
2
  export class TurboUnauthenticatedPaymentService {
12
3
  constructor({ url = 'https://payment.ardrive.dev', retryConfig, }) {
@@ -15,48 +6,36 @@ export class TurboUnauthenticatedPaymentService {
15
6
  retryConfig,
16
7
  });
17
8
  }
18
- getFiatRates() {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- return this.httpService.get({
21
- endpoint: '/rates',
22
- });
9
+ async getFiatRates() {
10
+ return this.httpService.get({
11
+ endpoint: '/rates',
23
12
  });
24
13
  }
25
- getFiatToAR({ currency, }) {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- return this.httpService.get({
28
- endpoint: `/rates/${currency}`,
29
- });
14
+ async getFiatToAR({ currency, }) {
15
+ return this.httpService.get({
16
+ endpoint: `/rates/${currency}`,
30
17
  });
31
18
  }
32
- getSupportedCountries() {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- return this.httpService.get({
35
- endpoint: '/countries',
36
- });
19
+ async getSupportedCountries() {
20
+ return this.httpService.get({
21
+ endpoint: '/countries',
37
22
  });
38
23
  }
39
- getSupportedCurrencies() {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- return this.httpService.get({
42
- endpoint: '/currencies',
43
- });
24
+ async getSupportedCurrencies() {
25
+ return this.httpService.get({
26
+ endpoint: '/currencies',
44
27
  });
45
28
  }
46
- getUploadCosts({ bytes, }) {
47
- return __awaiter(this, void 0, void 0, function* () {
48
- const fetchPricePromises = bytes.map((byteCount) => this.httpService.get({
49
- endpoint: `/price/bytes/${byteCount}`,
50
- }));
51
- const wincCostsForBytes = yield Promise.all(fetchPricePromises);
52
- return wincCostsForBytes;
53
- });
29
+ async getUploadCosts({ bytes, }) {
30
+ const fetchPricePromises = bytes.map((byteCount) => this.httpService.get({
31
+ endpoint: `/price/bytes/${byteCount}`,
32
+ }));
33
+ const wincCostsForBytes = await Promise.all(fetchPricePromises);
34
+ return wincCostsForBytes;
54
35
  }
55
- getWincForFiat({ amount, currency }) {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- return this.httpService.get({
58
- endpoint: `/price/${currency}/${amount}`,
59
- });
36
+ async getWincForFiat({ amount, currency }) {
37
+ return this.httpService.get({
38
+ endpoint: `/price/${currency}/${amount}`,
60
39
  });
61
40
  }
62
41
  }
@@ -66,16 +45,14 @@ export class TurboAuthenticatedPaymentService extends TurboUnauthenticatedPaymen
66
45
  super({ url, retryConfig });
67
46
  this.signer = signer;
68
47
  }
69
- getBalance() {
70
- return __awaiter(this, void 0, void 0, function* () {
71
- const headers = yield this.signer.generateSignedRequestHeaders();
72
- const balance = yield this.httpService.get({
73
- endpoint: '/balance',
74
- headers,
75
- allowedStatuses: [200, 404],
76
- });
77
- // 404's don't return a balance, so default to 0
78
- return balance.winc ? balance : { winc: '0' };
48
+ async getBalance() {
49
+ const headers = await this.signer.generateSignedRequestHeaders();
50
+ const balance = await this.httpService.get({
51
+ endpoint: '/balance',
52
+ headers,
53
+ allowedStatuses: [200, 404],
79
54
  });
55
+ // 404's don't return a balance, so default to 0
56
+ return balance.winc ? balance : { winc: '0' };
80
57
  }
81
58
  }
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { TurboUnauthenticatedPaymentService } from './payment.js';
11
2
  import { TurboUnauthenticatedUploadService } from './upload.js';
12
3
  export class TurboUnauthenticatedClient {
@@ -17,10 +8,8 @@ export class TurboUnauthenticatedClient {
17
8
  /**
18
9
  * Returns the supported fiat currency conversion rate for 1AR based on current market prices.
19
10
  */
20
- getFiatToAR({ currency, }) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- return this.paymentService.getFiatToAR({ currency });
23
- });
11
+ async getFiatToAR({ currency, }) {
12
+ return this.paymentService.getFiatToAR({ currency });
24
13
  }
25
14
  /**
26
15
  * Returns the latest conversion rates to purchase 1GiB of data for all supported currencies, including all adjustments and fees.
@@ -28,52 +17,40 @@ export class TurboUnauthenticatedClient {
28
17
  * Note: this does not take into account varying adjustments and promotions for different sizes of data. If you want to calculate the total
29
18
  * cost in 'winc' for a given number of bytes, use getUploadCosts.
30
19
  */
31
- getFiatRates() {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- return this.paymentService.getFiatRates();
34
- });
20
+ async getFiatRates() {
21
+ return this.paymentService.getFiatRates();
35
22
  }
36
23
  /**
37
24
  * Returns a comprehensive list of supported countries that can purchase credits through the Turbo Payment Service.
38
25
  */
39
- getSupportedCountries() {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- return this.paymentService.getSupportedCountries();
42
- });
26
+ async getSupportedCountries() {
27
+ return this.paymentService.getSupportedCountries();
43
28
  }
44
29
  /**
45
30
  * Returns a list of all supported fiat currencies.
46
31
  */
47
- getSupportedCurrencies() {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- return this.paymentService.getSupportedCurrencies();
50
- });
32
+ async getSupportedCurrencies() {
33
+ return this.paymentService.getSupportedCurrencies();
51
34
  }
52
35
  /**
53
36
  * Determines the price in 'winc' to upload one data item of a specific size in bytes, including all Turbo cost adjustments and fees.
54
37
  */
55
- getUploadCosts({ bytes, }) {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- return this.paymentService.getUploadCosts({ bytes });
58
- });
38
+ async getUploadCosts({ bytes, }) {
39
+ return this.paymentService.getUploadCosts({ bytes });
59
40
  }
60
41
  /**
61
42
  * Determines the amount of 'winc' that would be returned for a given currency and amount, including all Turbo cost adjustments and fees.
62
43
  */
63
- getWincForFiat({ amount, currency, }) {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- return this.paymentService.getWincForFiat({ amount, currency });
66
- });
44
+ async getWincForFiat({ amount, currency, }) {
45
+ return this.paymentService.getWincForFiat({ amount, currency });
67
46
  }
68
47
  /**
69
48
  * Uploads a signed data item to the Turbo Upload Service.
70
49
  */
71
- uploadSignedDataItem({ dataItemStreamFactory, signal, }) {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- return this.uploadService.uploadSignedDataItem({
74
- dataItemStreamFactory,
75
- signal,
76
- });
50
+ async uploadSignedDataItem({ dataItemStreamFactory, signal, }) {
51
+ return this.uploadService.uploadSignedDataItem({
52
+ dataItemStreamFactory,
53
+ signal,
77
54
  });
78
55
  }
79
56
  }
@@ -84,17 +61,13 @@ export class TurboAuthenticatedClient extends TurboUnauthenticatedClient {
84
61
  /**
85
62
  * Returns the current balance of the user's wallet in 'winc'.
86
63
  */
87
- getBalance() {
88
- return __awaiter(this, void 0, void 0, function* () {
89
- return this.paymentService.getBalance();
90
- });
64
+ async getBalance() {
65
+ return this.paymentService.getBalance();
91
66
  }
92
67
  /**
93
68
  * Signs and uploads raw data to the Turbo Upload Service.
94
69
  */
95
- uploadFile({ fileStreamFactory, signal, }) {
96
- return __awaiter(this, void 0, void 0, function* () {
97
- return this.uploadService.uploadFile({ fileStreamFactory, signal });
98
- });
70
+ async uploadFile({ fileStreamFactory, signal, }) {
71
+ return this.uploadService.uploadFile({ fileStreamFactory, signal });
99
72
  }
100
73
  }
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { TurboHTTPService } from './http.js';
11
2
  export class TurboUnauthenticatedUploadService {
12
3
  constructor({ url = 'https://upload.ardrive.dev', retryConfig, }) {
@@ -15,17 +6,15 @@ export class TurboUnauthenticatedUploadService {
15
6
  retryConfig,
16
7
  });
17
8
  }
18
- uploadSignedDataItem({ dataItemStreamFactory, signal, }) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- // TODO: add p-limit constraint or replace with separate upload class
21
- return this.httpService.post({
22
- endpoint: `/tx`,
23
- signal,
24
- data: dataItemStreamFactory(),
25
- headers: {
26
- 'content-type': 'application/octet-stream',
27
- },
28
- });
9
+ async uploadSignedDataItem({ dataItemStreamFactory, signal, }) {
10
+ // TODO: add p-limit constraint or replace with separate upload class
11
+ return this.httpService.post({
12
+ endpoint: `/tx`,
13
+ signal,
14
+ data: dataItemStreamFactory(),
15
+ headers: {
16
+ 'content-type': 'application/octet-stream',
17
+ },
29
18
  });
30
19
  }
31
20
  }
@@ -35,20 +24,18 @@ export class TurboAuthenticatedUploadService extends TurboUnauthenticatedUploadS
35
24
  super({ url, retryConfig });
36
25
  this.signer = signer;
37
26
  }
38
- uploadFile({ fileStreamFactory, signal, }) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- const signedDataItem = yield this.signer.signDataItem({
41
- fileStreamFactory,
42
- });
43
- // TODO: add p-limit constraint or replace with separate upload class
44
- return this.httpService.post({
45
- endpoint: `/tx`,
46
- signal,
47
- data: signedDataItem,
48
- headers: {
49
- 'content-type': 'application/octet-stream',
50
- },
51
- });
27
+ async uploadFile({ fileStreamFactory, signal, }) {
28
+ const signedDataItem = await this.signer.signDataItem({
29
+ fileStreamFactory,
30
+ });
31
+ // TODO: add p-limit constraint or replace with separate upload class
32
+ return this.httpService.post({
33
+ endpoint: `/tx`,
34
+ signal,
35
+ data: signedDataItem,
36
+ headers: {
37
+ 'content-type': 'application/octet-stream',
38
+ },
52
39
  });
53
40
  }
54
41
  }
@@ -20,8 +20,14 @@ import { TurboNodeArweaveSigner } from './signer.js';
20
20
  export class TurboFactory extends TurboBaseFactory {
21
21
  static authenticated({ privateKey, paymentServiceConfig = {}, uploadServiceConfig = {}, }) {
22
22
  const signer = new TurboNodeArweaveSigner({ privateKey });
23
- const paymentService = new TurboAuthenticatedPaymentService(Object.assign(Object.assign({}, paymentServiceConfig), { signer }));
24
- const uploadService = new TurboAuthenticatedUploadService(Object.assign(Object.assign({}, uploadServiceConfig), { signer }));
23
+ const paymentService = new TurboAuthenticatedPaymentService({
24
+ ...paymentServiceConfig,
25
+ signer,
26
+ });
27
+ const uploadService = new TurboAuthenticatedUploadService({
28
+ ...uploadServiceConfig,
29
+ signer,
30
+ });
25
31
  return new TurboAuthenticatedClient({
26
32
  uploadService,
27
33
  paymentService,
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  /**
11
2
  * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
12
3
  *
@@ -39,16 +30,14 @@ export class TurboNodeArweaveSigner {
39
30
  return streamSigner(stream1, stream2, this.signer);
40
31
  }
41
32
  // NOTE: this might be better in a parent class or elsewhere - easy enough to leave in here now and does require specific environment version of crypto
42
- generateSignedRequestHeaders() {
43
- return __awaiter(this, void 0, void 0, function* () {
44
- const nonce = randomBytes(16).toString('hex');
45
- const buffer = Buffer.from(nonce);
46
- const signature = yield Arweave.crypto.sign(this.privateKey, buffer);
47
- return {
48
- 'x-public-key': this.privateKey.n,
49
- 'x-nonce': nonce,
50
- 'x-signature': toB64Url(Buffer.from(signature)),
51
- };
52
- });
33
+ async generateSignedRequestHeaders() {
34
+ const nonce = randomBytes(16).toString('hex');
35
+ const buffer = Buffer.from(nonce);
36
+ const signature = await Arweave.crypto.sign(this.privateKey, buffer);
37
+ return {
38
+ 'x-public-key': this.privateKey.n,
39
+ 'x-nonce': nonce,
40
+ 'x-signature': toB64Url(Buffer.from(signature)),
41
+ };
53
42
  }
54
43
  }
@@ -27,7 +27,10 @@ export const createAxiosInstance = ({ axiosConfig = {}, retryConfig = {
27
27
  console.debug(`Request failed, ${error}. Retry attempt #${retryCount}...`);
28
28
  },
29
29
  }, }) => {
30
- const axiosInstance = axios.create(Object.assign(Object.assign({}, axiosConfig), { validateStatus: () => true }));
30
+ const axiosInstance = axios.create({
31
+ ...axiosConfig,
32
+ validateStatus: () => true, // don't throw on non-200 status codes
33
+ });
31
34
  // eslint-disable-next-line
32
35
  if (retryConfig.retries && retryConfig.retries > 0) {
33
36
  axiosRetry(axiosInstance, retryConfig);
@@ -1,24 +1,13 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- export function readableStreamToBuffer({ stream, }) {
11
- return __awaiter(this, void 0, void 0, function* () {
12
- const reader = stream.getReader();
13
- const chunks = [];
14
- let done = false;
15
- while (!done) {
16
- const { done: streamDone, value } = yield reader.read();
17
- done = streamDone;
18
- if (!done) {
19
- chunks.push(value);
20
- }
1
+ export async function readableStreamToBuffer({ stream, }) {
2
+ const reader = stream.getReader();
3
+ const chunks = [];
4
+ let done = false;
5
+ while (!done) {
6
+ const { done: streamDone, value } = await reader.read();
7
+ done = streamDone;
8
+ if (!done) {
9
+ chunks.push(value);
21
10
  }
22
- return Buffer.concat(chunks);
23
- });
11
+ }
12
+ return Buffer.concat(chunks);
24
13
  }
@@ -20,8 +20,14 @@ import { TurboWebArweaveSigner } from './signer.js';
20
20
  export class TurboFactory extends TurboBaseFactory {
21
21
  static authenticated({ privateKey, paymentServiceConfig = {}, uploadServiceConfig = {}, }) {
22
22
  const signer = new TurboWebArweaveSigner({ privateKey });
23
- const paymentService = new TurboAuthenticatedPaymentService(Object.assign(Object.assign({}, paymentServiceConfig), { signer }));
24
- const uploadService = new TurboAuthenticatedUploadService(Object.assign(Object.assign({}, uploadServiceConfig), { signer }));
23
+ const paymentService = new TurboAuthenticatedPaymentService({
24
+ ...paymentServiceConfig,
25
+ signer,
26
+ });
27
+ const uploadService = new TurboAuthenticatedUploadService({
28
+ ...uploadServiceConfig,
29
+ signer,
30
+ });
25
31
  return new TurboAuthenticatedClient({
26
32
  uploadService,
27
33
  paymentService,
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  /**
11
2
  * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
12
3
  *
@@ -33,32 +24,27 @@ export class TurboWebArweaveSigner {
33
24
  this.privateKey = privateKey;
34
25
  this.signer = new ArweaveSigner(this.privateKey);
35
26
  }
36
- signDataItem({ fileStreamFactory, }) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- // TODO: converts the readable stream to a buffer bc incrementally signing ReadableStreams is not trivial
39
- const buffer = yield readableStreamToBuffer({
40
- stream: fileStreamFactory(),
41
- // TODO: add payload size to get performance improvements
42
- });
43
- const signedDataItem = createData(buffer, this.signer);
44
- yield signedDataItem.sign(this.signer);
45
- return signedDataItem.getRaw();
27
+ async signDataItem({ fileStreamFactory, }) {
28
+ // TODO: converts the readable stream to a buffer bc incrementally signing ReadableStreams is not trivial
29
+ const buffer = await readableStreamToBuffer({
30
+ stream: fileStreamFactory(),
31
+ // TODO: add payload size to get performance improvements
46
32
  });
33
+ const signedDataItem = createData(buffer, this.signer);
34
+ await signedDataItem.sign(this.signer);
35
+ return signedDataItem.getRaw();
47
36
  }
48
37
  // NOTE: this might be better in a parent class or elsewhere - easy enough to leave in here now and does require specific environment version of crypto
49
- generateSignedRequestHeaders() {
50
- var _a;
51
- return __awaiter(this, void 0, void 0, function* () {
52
- // a bit hacky - but arweave exports cause issues in tests vs. browser
53
- const arweave = (_a = Arweave.default) !== null && _a !== void 0 ? _a : Arweave;
54
- const nonce = randomBytes(16).toString('hex');
55
- const buffer = Buffer.from(nonce);
56
- const signature = yield arweave.crypto.sign(this.privateKey, buffer, {});
57
- return {
58
- 'x-public-key': this.privateKey.n,
59
- 'x-nonce': nonce,
60
- 'x-signature': toB64Url(Buffer.from(signature)),
61
- };
62
- });
38
+ async generateSignedRequestHeaders() {
39
+ // a bit hacky - but arweave exports cause issues in tests vs. browser
40
+ const arweave = Arweave.default ?? Arweave;
41
+ const nonce = randomBytes(16).toString('hex');
42
+ const buffer = Buffer.from(nonce);
43
+ const signature = await arweave.crypto.sign(this.privateKey, buffer, {});
44
+ return {
45
+ 'x-public-key': this.privateKey.n,
46
+ 'x-nonce': nonce,
47
+ 'x-signature': toB64Url(Buffer.from(signature)),
48
+ };
63
49
  }
64
50
  }
@@ -34,7 +34,6 @@ export declare class TurboUnauthenticatedPaymentService implements TurboUnauthen
34
34
  }): Promise<TurboPriceResponse>;
35
35
  }
36
36
  export declare class TurboAuthenticatedPaymentService extends TurboUnauthenticatedPaymentService implements TurboAuthenticatedPaymentServiceInterface {
37
- protected readonly httpService: TurboHTTPService;
38
37
  protected readonly signer: TurboWalletSigner;
39
38
  constructor({ url, retryConfig, signer, }: TurboAuthenticatedPaymentServiceInterfaceConfiguration);
40
39
  getBalance(): Promise<TurboBalanceResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/common/payment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,QAAQ,EACR,yCAAyC,EACzC,sDAAsD,EACtD,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,2CAA2C,EAC3C,wDAAwD,EACxD,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,qBAAa,kCACX,YAAW,2CAA2C;IAEtD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;gBAErC,EACV,GAAmC,EACnC,WAAW,GACZ,EAAE,wDAAwD;IAOrD,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAM3C,WAAW,CAAC,EAChB,QAAQ,GACT,EAAE;QACD,QAAQ,EAAE,QAAQ,CAAC;KACpB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAM5B,qBAAqB,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAMxD,sBAAsB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAM1D,cAAc,CAAC,EACnB,KAAK,GACN,EAAE;QACD,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAW3B,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE;;;KAAA,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAKxE;AAGD,qBAAa,gCACX,SAAQ,kCACR,YAAW,yCAAyC;IAEpD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACjD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAEjC,EACV,GAAmC,EACnC,WAAW,EACX,MAAM,GACP,EAAE,sDAAsD;IAKnD,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC;CAWlD"}
1
+ {"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/common/payment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,QAAQ,EACR,yCAAyC,EACzC,sDAAsD,EACtD,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,2CAA2C,EAC3C,wDAAwD,EACxD,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,qBAAa,kCACX,YAAW,2CAA2C;IAEtD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;gBAErC,EACV,GAAmC,EACnC,WAAW,GACZ,EAAE,wDAAwD;IAOrD,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAM3C,WAAW,CAAC,EAChB,QAAQ,GACT,EAAE;QACD,QAAQ,EAAE,QAAQ,CAAC;KACpB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAM5B,qBAAqB,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAMxD,sBAAsB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAM1D,cAAc,CAAC,EACnB,KAAK,GACN,EAAE;QACD,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAW3B,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE;;;KAAA,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAKxE;AAGD,qBAAa,gCACX,SAAQ,kCACR,YAAW,yCAAyC;IAEpD,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAEjC,EACV,GAAmC,EACnC,WAAW,EACX,MAAM,GACP,EAAE,sDAAsD;IAKnD,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC;CAWlD"}
@@ -16,8 +16,8 @@
16
16
  */
17
17
  import { Currency, TurboAbortSignal, TurboAuthenticatedClientInterface, TurboAuthenticatedPaymentServiceInterface, TurboAuthenticatedUploadServiceInterface, TurboBalanceResponse, TurboCountriesResponse, TurboCurrenciesResponse, TurboFiatToArResponse, TurboFileFactory, TurboPriceResponse, TurboPrivateClientConfiguration, TurboPublicClientConfiguration, TurboRatesResponse, TurboSignedDataItemFactory, TurboUnauthenticatedClientInterface, TurboUnauthenticatedPaymentServiceInterface, TurboUnauthenticatedUploadServiceInterface, TurboUploadDataItemResponse } from '../types.js';
18
18
  export declare class TurboUnauthenticatedClient implements TurboUnauthenticatedClientInterface {
19
- protected readonly paymentService: TurboUnauthenticatedPaymentServiceInterface;
20
- protected readonly uploadService: TurboUnauthenticatedUploadServiceInterface;
19
+ protected paymentService: TurboUnauthenticatedPaymentServiceInterface;
20
+ protected uploadService: TurboUnauthenticatedUploadServiceInterface;
21
21
  constructor({ uploadService, paymentService, }: TurboPublicClientConfiguration);
22
22
  /**
23
23
  * Returns the supported fiat currency conversion rate for 1AR based on current market prices.
@@ -59,8 +59,8 @@ export declare class TurboUnauthenticatedClient implements TurboUnauthenticatedC
59
59
  uploadSignedDataItem({ dataItemStreamFactory, signal, }: TurboSignedDataItemFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
60
60
  }
61
61
  export declare class TurboAuthenticatedClient extends TurboUnauthenticatedClient implements TurboAuthenticatedClientInterface {
62
- protected readonly paymentService: TurboAuthenticatedPaymentServiceInterface;
63
- protected readonly uploadService: TurboAuthenticatedUploadServiceInterface;
62
+ protected paymentService: TurboAuthenticatedPaymentServiceInterface;
63
+ protected uploadService: TurboAuthenticatedUploadServiceInterface;
64
64
  constructor({ paymentService, uploadService, }: TurboPrivateClientConfiguration);
65
65
  /**
66
66
  * Returns the current balance of the user's wallet in 'winc'.
@@ -1 +1 @@
1
- {"version":3,"file":"turbo.d.ts","sourceRoot":"","sources":["../../../src/common/turbo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,iCAAiC,EACjC,yCAAyC,EACzC,wCAAwC,EACxC,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC9B,kBAAkB,EAClB,0BAA0B,EAC1B,mCAAmC,EACnC,2CAA2C,EAC3C,0CAA0C,EAC1C,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AAIrB,qBAAa,0BACX,YAAW,mCAAmC;IAE9C,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,2CAA2C,CAAC;IAC/E,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,0CAA0C,CAAC;gBAEjE,EACV,aAAyD,EACzD,cAA2D,GAC5D,EAAE,8BAA8B;IAKjC;;OAEG;IACG,WAAW,CAAC,EAChB,QAAQ,GACT,EAAE;QACD,QAAQ,EAAE,QAAQ,CAAC;KACpB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIlC;;;;;OAKG;IACG,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAIjD;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAI9D;;OAEG;IACG,sBAAsB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAIhE;;OAEG;IACG,cAAc,CAAC,EACnB,KAAK,GACN,EAAE;QACD,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAIjC;;OAEG;IACG,cAAc,CAAC,EACnB,MAAM,EACN,QAAQ,GACT,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,QAAQ,CAAC;KACpB,GAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;IAIpD;;OAEG;IACG,oBAAoB,CAAC,EACzB,qBAAqB,EACrB,MAAM,GACP,EAAE,0BAA0B,GAC3B,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAM1D;AAED,qBAAa,wBACX,SAAQ,0BACR,YAAW,iCAAiC;IAE5C,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,yCAAyC,CAAC;IAC7E,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,wCAAwC,CAAC;gBAE/D,EACV,cAAc,EACd,aAAa,GACd,EAAE,+BAA+B;IAIlC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAIjD;;OAEG;IACG,UAAU,CAAC,EACf,iBAAiB,EACjB,MAAM,GACP,EAAE,gBAAgB,GACjB,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAG1D"}
1
+ {"version":3,"file":"turbo.d.ts","sourceRoot":"","sources":["../../../src/common/turbo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,iCAAiC,EACjC,yCAAyC,EACzC,wCAAwC,EACxC,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC9B,kBAAkB,EAClB,0BAA0B,EAC1B,mCAAmC,EACnC,2CAA2C,EAC3C,0CAA0C,EAC1C,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AAIrB,qBAAa,0BACX,YAAW,mCAAmC;IAE9C,SAAS,CAAC,cAAc,EAAE,2CAA2C,CAAC;IACtE,SAAS,CAAC,aAAa,EAAE,0CAA0C,CAAC;gBAExD,EACV,aAAyD,EACzD,cAA2D,GAC5D,EAAE,8BAA8B;IAKjC;;OAEG;IACG,WAAW,CAAC,EAChB,QAAQ,GACT,EAAE;QACD,QAAQ,EAAE,QAAQ,CAAC;KACpB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIlC;;;;;OAKG;IACG,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAIjD;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAI9D;;OAEG;IACG,sBAAsB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAIhE;;OAEG;IACG,cAAc,CAAC,EACnB,KAAK,GACN,EAAE;QACD,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAIjC;;OAEG;IACG,cAAc,CAAC,EACnB,MAAM,EACN,QAAQ,GACT,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,QAAQ,CAAC;KACpB,GAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;IAIpD;;OAEG;IACG,oBAAoB,CAAC,EACzB,qBAAqB,EACrB,MAAM,GACP,EAAE,0BAA0B,GAC3B,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAM1D;AAED,qBAAa,wBACX,SAAQ,0BACR,YAAW,iCAAiC;IAG5C,SAAS,CAAC,cAAc,EAAE,yCAAyC,CAAC;IACpE,SAAS,CAAC,aAAa,EAAE,wCAAwC,CAAC;gBAEtD,EACV,cAAc,EACd,aAAa,GACd,EAAE,+BAA+B;IAIlC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAIjD;;OAEG;IACG,UAAU,CAAC,EACf,iBAAiB,EACjB,MAAM,GACP,EAAE,gBAAgB,GACjB,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAG1D"}
@@ -22,7 +22,6 @@ export declare class TurboUnauthenticatedUploadService implements TurboUnauthent
22
22
  uploadSignedDataItem({ dataItemStreamFactory, signal, }: TurboSignedDataItemFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
23
23
  }
24
24
  export declare class TurboAuthenticatedUploadService extends TurboUnauthenticatedUploadService implements TurboAuthenticatedUploadServiceInterface {
25
- protected httpService: TurboHTTPService;
26
25
  protected signer: TurboWalletSigner;
27
26
  constructor({ url, retryConfig, signer, }: TurboAuthenticatedUploadServiceConfiguration);
28
27
  uploadFile({ fileStreamFactory, signal, }: TurboFileFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/common/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,gBAAgB,EAChB,4CAA4C,EAC5C,wCAAwC,EACxC,gBAAgB,EAChB,0BAA0B,EAC1B,0CAA0C,EAC1C,uDAAuD,EACvD,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,qBAAa,iCACX,YAAW,0CAA0C;IAErD,SAAS,CAAC,WAAW,EAAE,gBAAgB,CAAC;gBAE5B,EACV,GAAkC,EAClC,WAAW,GACZ,EAAE,uDAAuD;IAOpD,oBAAoB,CAAC,EACzB,qBAAqB,EACrB,MAAM,GACP,EAAE,0BAA0B,GAC3B,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAW1D;AAGD,qBAAa,+BACX,SAAQ,iCACR,YAAW,wCAAwC;IAEnD,SAAS,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACxC,SAAS,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAExB,EACV,GAAkC,EAClC,WAAW,EACX,MAAM,GACP,EAAE,4CAA4C;IAKzC,UAAU,CAAC,EACf,iBAAiB,EACjB,MAAM,GACP,EAAE,gBAAgB,GACjB,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAc1D"}
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/common/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,gBAAgB,EAChB,4CAA4C,EAC5C,wCAAwC,EACxC,gBAAgB,EAChB,0BAA0B,EAC1B,0CAA0C,EAC1C,uDAAuD,EACvD,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,qBAAa,iCACX,YAAW,0CAA0C;IAErD,SAAS,CAAC,WAAW,EAAE,gBAAgB,CAAC;gBAE5B,EACV,GAAkC,EAClC,WAAW,GACZ,EAAE,uDAAuD;IAOpD,oBAAoB,CAAC,EACzB,qBAAqB,EACrB,MAAM,GACP,EAAE,0BAA0B,GAC3B,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAW1D;AAGD,qBAAa,+BACX,SAAQ,iCACR,YAAW,wCAAwC;IAEnD,SAAS,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAExB,EACV,GAAkC,EAClC,WAAW,EACX,MAAM,GACP,EAAE,4CAA4C;IAKzC,UAAU,CAAC,EACf,iBAAiB,EACjB,MAAM,GACP,EAAE,gBAAgB,GACjB,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAc1D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ardrive/turbo-sdk",
3
- "version": "1.0.0-alpha.20",
3
+ "version": "1.0.0-alpha.21",
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",