@ardrive/turbo-sdk 1.0.0-alpha.8 → 1.0.0-beta.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.
Files changed (92) hide show
  1. package/README.md +130 -23
  2. package/bundles/web.bundle.min.js +55668 -0
  3. package/lib/cjs/common/factory.js +6 -2
  4. package/lib/cjs/common/http.js +16 -29
  5. package/lib/cjs/common/payment.js +29 -52
  6. package/lib/cjs/common/turbo.js +20 -47
  7. package/lib/cjs/common/upload.js +21 -34
  8. package/lib/cjs/node/factory.js +8 -2
  9. package/lib/cjs/node/index.js +1 -1
  10. package/lib/cjs/node/signer.js +9 -20
  11. package/lib/cjs/package.json +1 -0
  12. package/lib/cjs/utils/axiosClient.js +18 -9
  13. package/lib/cjs/utils/readableStream.js +11 -22
  14. package/lib/cjs/web/factory.js +8 -2
  15. package/lib/cjs/web/index.js +1 -1
  16. package/lib/cjs/web/signer.js +19 -31
  17. package/lib/esm/common/factory.js +6 -2
  18. package/lib/esm/common/http.js +16 -29
  19. package/lib/esm/common/payment.js +29 -52
  20. package/lib/esm/common/turbo.js +20 -47
  21. package/lib/esm/common/upload.js +21 -34
  22. package/lib/esm/node/factory.js +8 -2
  23. package/lib/esm/node/index.js +1 -1
  24. package/lib/esm/node/signer.js +9 -20
  25. package/lib/esm/utils/axiosClient.js +18 -9
  26. package/lib/esm/utils/readableStream.js +11 -22
  27. package/lib/esm/web/factory.js +8 -2
  28. package/lib/esm/web/index.js +1 -1
  29. package/lib/esm/web/signer.js +19 -31
  30. package/lib/{cjs → types}/common/factory.d.ts +2 -1
  31. package/lib/types/common/factory.d.ts.map +1 -0
  32. package/lib/{cjs → types}/common/http.d.ts +4 -3
  33. package/lib/types/common/http.d.ts.map +1 -0
  34. package/lib/{esm → types}/common/index.d.ts +1 -0
  35. package/lib/types/common/index.d.ts.map +1 -0
  36. package/lib/{esm/types/arweave.d.ts → types/common/jwk.d.ts} +1 -0
  37. package/lib/types/common/jwk.d.ts.map +1 -0
  38. package/lib/{esm → types}/common/payment.d.ts +2 -2
  39. package/lib/types/common/payment.d.ts.map +1 -0
  40. package/lib/{cjs → types}/common/turbo.d.ts +6 -5
  41. package/lib/types/common/turbo.d.ts.map +1 -0
  42. package/lib/{esm → types}/common/upload.d.ts +2 -2
  43. package/lib/types/common/upload.d.ts.map +1 -0
  44. package/lib/{esm → types}/node/factory.d.ts +2 -1
  45. package/lib/types/node/factory.d.ts.map +1 -0
  46. package/lib/{esm → types}/node/index.d.ts +2 -1
  47. package/lib/types/node/index.d.ts.map +1 -0
  48. package/lib/{cjs → types}/node/signer.d.ts +3 -2
  49. package/lib/types/node/signer.d.ts.map +1 -0
  50. package/lib/{cjs/types/turbo.d.ts → types/types.d.ts} +4 -3
  51. package/lib/types/types.d.ts.map +1 -0
  52. package/lib/{esm → types}/utils/axiosClient.d.ts +3 -2
  53. package/lib/types/utils/axiosClient.d.ts.map +1 -0
  54. package/lib/{cjs → types}/utils/base64.d.ts +3 -2
  55. package/lib/types/utils/base64.d.ts.map +1 -0
  56. package/lib/{esm → types}/utils/errors.d.ts +1 -0
  57. package/lib/types/utils/errors.d.ts.map +1 -0
  58. package/lib/{cjs → types}/utils/readableStream.d.ts +1 -0
  59. package/lib/types/utils/readableStream.d.ts.map +1 -0
  60. package/lib/{cjs → types}/web/factory.d.ts +2 -1
  61. package/lib/types/web/factory.d.ts.map +1 -0
  62. package/lib/{cjs → types}/web/index.d.ts +2 -1
  63. package/lib/types/web/index.d.ts.map +1 -0
  64. package/lib/{cjs → types}/web/signer.d.ts +3 -2
  65. package/lib/types/web/signer.d.ts.map +1 -0
  66. package/package.json +15 -15
  67. package/lib/cjs/common/index.d.ts +0 -19
  68. package/lib/cjs/common/payment.d.ts +0 -41
  69. package/lib/cjs/common/upload.d.ts +0 -29
  70. package/lib/cjs/node/factory.d.ts +0 -22
  71. package/lib/cjs/node/index.d.ts +0 -20
  72. package/lib/cjs/types/arweave.d.ts +0 -29
  73. package/lib/cjs/types/index.d.ts +0 -18
  74. package/lib/cjs/types/index.js +0 -34
  75. package/lib/cjs/utils/axiosClient.d.ts +0 -23
  76. package/lib/cjs/utils/errors.d.ts +0 -22
  77. package/lib/esm/common/factory.d.ts +0 -21
  78. package/lib/esm/common/http.d.ts +0 -44
  79. package/lib/esm/common/turbo.d.ts +0 -73
  80. package/lib/esm/node/signer.d.ts +0 -36
  81. package/lib/esm/types/index.d.ts +0 -18
  82. package/lib/esm/types/index.js +0 -18
  83. package/lib/esm/types/turbo.d.ts +0 -149
  84. package/lib/esm/utils/base64.d.ts +0 -9
  85. package/lib/esm/utils/readableStream.d.ts +0 -22
  86. package/lib/esm/web/factory.d.ts +0 -22
  87. package/lib/esm/web/index.d.ts +0 -20
  88. package/lib/esm/web/signer.d.ts +0 -37
  89. /package/lib/cjs/{types/arweave.js → common/jwk.js} +0 -0
  90. /package/lib/cjs/{types/turbo.js → types.js} +0 -0
  91. /package/lib/esm/{types/arweave.js → common/jwk.js} +0 -0
  92. /package/lib/esm/{types/turbo.js → types.js} +0 -0
@@ -1,22 +0,0 @@
1
- /**
2
- * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
3
- *
4
- * This program is free software: you can redistribute it and/or modify
5
- * it under the terms of the GNU Affero General Public License as published by
6
- * the Free Software Foundation, either version 3 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU Affero General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU Affero General Public License
15
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- */
17
- export declare class UnauthenticatedRequestError extends Error {
18
- constructor();
19
- }
20
- export declare class FailedRequestError extends Error {
21
- constructor(status: number, message: string);
22
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
3
- *
4
- * This program is free software: you can redistribute it and/or modify
5
- * it under the terms of the GNU Affero General Public License as published by
6
- * the Free Software Foundation, either version 3 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU Affero General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU Affero General Public License
15
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- */
17
- import { TurboPublicConfiguration } from '../types/turbo.js';
18
- import { TurboUnauthenticatedClient } from './turbo.js';
19
- export declare class TurboBaseFactory {
20
- static unauthenticated({ paymentServiceConfig, uploadServiceConfig, }?: TurboPublicConfiguration): TurboUnauthenticatedClient;
21
- }
@@ -1,44 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- /// <reference types="node" resolution-mode="require"/>
4
- /**
5
- * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
6
- *
7
- * This program is free software: you can redistribute it and/or modify
8
- * it under the terms of the GNU Affero General Public License as published by
9
- * the Free Software Foundation, either version 3 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU Affero General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Affero General Public License
18
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
- */
20
- import { AxiosInstance } from 'axios';
21
- import { RetryConfig } from 'retry-axios';
22
- import { Readable } from 'stream';
23
- import { ReadableStream } from 'stream/web';
24
- import { TurboHTTPServiceInterface, TurboSignedRequestHeaders } from '../types/turbo.js';
25
- export declare class TurboHTTPService implements TurboHTTPServiceInterface {
26
- protected axios: AxiosInstance;
27
- constructor({ url, retryConfig, }: {
28
- url: string;
29
- retryConfig?: RetryConfig;
30
- });
31
- get<T>({ endpoint, signal, allowedStatuses, headers, }: {
32
- endpoint: string;
33
- signal?: AbortSignal;
34
- allowedStatuses?: number[];
35
- headers?: Partial<TurboSignedRequestHeaders> & Record<string, string>;
36
- }): Promise<T>;
37
- post<T>({ endpoint, signal, allowedStatuses, headers, data, }: {
38
- endpoint: string;
39
- signal?: AbortSignal;
40
- allowedStatuses?: number[];
41
- headers?: Partial<TurboSignedRequestHeaders> & Record<string, string>;
42
- data: Readable | Buffer | ReadableStream;
43
- }): Promise<T>;
44
- }
@@ -1,73 +0,0 @@
1
- /**
2
- * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
3
- *
4
- * This program is free software: you can redistribute it and/or modify
5
- * it under the terms of the GNU Affero General Public License as published by
6
- * the Free Software Foundation, either version 3 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU Affero General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU Affero General Public License
15
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- */
17
- import { Currency, TurboAbortSignal, TurboAuthenticatedClientInterface, TurboAuthenticatedPaymentServiceInterface, TurboAuthenticatedUploadServiceInterface, TurboBalanceResponse, TurboCountriesResponse, TurboCurrenciesResponse, TurboFiatToArResponse, TurboFileFactory, TurboPriceResponse, TurboPrivateClientConfiguration, TurboPublicClientConfiguration, TurboRatesResponse, TurboSignedDataItemFactory, TurboUnauthenticatedClientInterface, TurboUnauthenticatedPaymentServiceInterface, TurboUnauthenticatedUploadServiceInterface, TurboUploadDataItemResponse } from '../types/index.js';
18
- export declare class TurboUnauthenticatedClient implements TurboUnauthenticatedClientInterface {
19
- protected readonly paymentService: TurboUnauthenticatedPaymentServiceInterface;
20
- protected readonly uploadService: TurboUnauthenticatedUploadServiceInterface;
21
- constructor({ uploadService, paymentService, }: TurboPublicClientConfiguration);
22
- /**
23
- * Returns the supported fiat currency conversion rate for 1AR based on current market prices.
24
- */
25
- getFiatToAR({ currency, }: {
26
- currency: Currency;
27
- }): Promise<TurboFiatToArResponse>;
28
- /**
29
- * Returns the latest conversion rates to purchase 1GiB of data for all supported currencies, including all adjustments and fees.
30
- *
31
- * Note: this does not take into account varying adjustments and promotions for different sizes of data. If you want to calculate the total
32
- * cost in 'winc' for a given number of bytes, use getUploadCosts.
33
- */
34
- getFiatRates(): Promise<TurboRatesResponse>;
35
- /**
36
- * Returns a comprehensive list of supported countries that can purchase credits through the Turbo Payment Service.
37
- */
38
- getSupportedCountries(): Promise<TurboCountriesResponse>;
39
- /**
40
- * Returns a list of all supported fiat currencies.
41
- */
42
- getSupportedCurrencies(): Promise<TurboCurrenciesResponse>;
43
- /**
44
- * Determines the price in 'winc' to upload one data item of a specific size in bytes, including all Turbo cost adjustments and fees.
45
- */
46
- getUploadCosts({ bytes, }: {
47
- bytes: number[];
48
- }): Promise<TurboPriceResponse[]>;
49
- /**
50
- * Determines the amount of 'winc' that would be returned for a given currency and amount, including all Turbo cost adjustments and fees.
51
- */
52
- getWincForFiat({ amount, currency, }: {
53
- amount: number;
54
- currency: Currency;
55
- }): Promise<Omit<TurboPriceResponse, 'adjustments'>>;
56
- /**
57
- * Uploads a signed data item to the Turbo Upload Service.
58
- */
59
- uploadSignedDataItem({ dataItemStreamFactory, signal, }: TurboSignedDataItemFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
60
- }
61
- export declare class TurboAuthenticatedClient extends TurboUnauthenticatedClient implements TurboAuthenticatedClientInterface {
62
- protected readonly paymentService: TurboAuthenticatedPaymentServiceInterface;
63
- protected readonly uploadService: TurboAuthenticatedUploadServiceInterface;
64
- constructor({ paymentService, uploadService, }: TurboPrivateClientConfiguration);
65
- /**
66
- * Returns the current balance of the user's wallet in 'winc'.
67
- */
68
- getBalance(): Promise<TurboBalanceResponse>;
69
- /**
70
- * Signs and uploads raw data to the Turbo Upload Service.
71
- */
72
- uploadFile({ fileStreamFactory, signal, }: TurboFileFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
73
- }
@@ -1,36 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /**
3
- * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU Affero General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU Affero General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Affero General Public License
16
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
- */
18
- import { ArweaveSigner } from 'arbundles';
19
- import { Readable } from 'node:stream';
20
- import { JWKInterface } from '../types/arweave.js';
21
- import { TurboWalletSigner } from '../types/turbo.js';
22
- export declare class TurboNodeArweaveSigner implements TurboWalletSigner {
23
- protected privateKey: JWKInterface;
24
- protected signer: ArweaveSigner;
25
- constructor({ privateKey }: {
26
- privateKey: JWKInterface;
27
- });
28
- signDataItem({ fileStreamFactory, }: {
29
- fileStreamFactory: () => Readable;
30
- }): Promise<Readable>;
31
- generateSignedRequestHeaders(): Promise<{
32
- 'x-public-key': string;
33
- 'x-nonce': string;
34
- 'x-signature': string;
35
- }>;
36
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
3
- *
4
- * This program is free software: you can redistribute it and/or modify
5
- * it under the terms of the GNU Affero General Public License as published by
6
- * the Free Software Foundation, either version 3 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU Affero General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU Affero General Public License
15
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- */
17
- export * from './arweave.js';
18
- export * from './turbo.js';
@@ -1,18 +0,0 @@
1
- /**
2
- * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
3
- *
4
- * This program is free software: you can redistribute it and/or modify
5
- * it under the terms of the GNU Affero General Public License as published by
6
- * the Free Software Foundation, either version 3 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU Affero General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU Affero General Public License
15
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- */
17
- export * from './arweave.js';
18
- export * from './turbo.js';
@@ -1,149 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- /// <reference types="node" resolution-mode="require"/>
4
- /**
5
- * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
6
- *
7
- * This program is free software: you can redistribute it and/or modify
8
- * it under the terms of the GNU Affero General Public License as published by
9
- * the Free Software Foundation, either version 3 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU Affero General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Affero General Public License
18
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
- */
20
- import { Readable } from 'node:stream';
21
- import { ReadableStream } from 'node:stream/web';
22
- import { RetryConfig } from 'retry-axios';
23
- import winston from 'winston';
24
- import { JWKInterface } from './arweave.js';
25
- export type Base64String = string;
26
- export type PublicArweaveAddress = Base64String;
27
- export type TransactionId = Base64String;
28
- export type UserAddress = string | PublicArweaveAddress;
29
- export type Currency = 'usd' | 'eur' | 'gbp' | 'cad' | 'aud' | 'nzd' | 'jpy';
30
- export type Country = 'United States' | 'United Kingdom' | 'Canada';
31
- export type CurrencyLimit = {
32
- minimumPaymentAmount: number;
33
- maximumPaymentAmount: number;
34
- suggestedPaymentAmount: number[];
35
- zeroDecimalCurrency: boolean;
36
- };
37
- export type TurboPriceResponse = {
38
- winc: string;
39
- adjustments: any;
40
- };
41
- export type TurboBalanceResponse = Omit<TurboPriceResponse, 'adjustments'>;
42
- export type TurboFiatToArResponse = {
43
- currency: Currency;
44
- rate: number;
45
- };
46
- export type TurboRatesResponse = TurboPriceResponse & Record<'fiat', Record<Currency, number>>;
47
- export type TurboCountriesResponse = Country[];
48
- export type TurboCurrenciesResponse = {
49
- supportedCurrencies: Currency[];
50
- limits: Record<Currency, CurrencyLimit>;
51
- };
52
- export type TurboUploadDataItemResponse = {
53
- dataCaches: string[];
54
- fastFinalityIndexes: string[];
55
- id: TransactionId;
56
- owner: PublicArweaveAddress;
57
- };
58
- export type TurboWallet = JWKInterface;
59
- export type TurboSignedRequestHeaders = {
60
- 'x-public-key': string;
61
- 'x-nonce': string;
62
- 'x-signature': string;
63
- };
64
- type TurboAuthConfiguration = {
65
- signer: TurboWalletSigner;
66
- };
67
- type TurboServiceConfiguration = {
68
- url?: string;
69
- retryConfig?: RetryConfig;
70
- logger?: winston.Logger;
71
- };
72
- export type TurboUnauthenticatedUploadServiceInterfaceConfiguration = TurboServiceConfiguration;
73
- export type TurboAuthenticatedUploadServiceConfiguration = TurboUnauthenticatedUploadServiceInterfaceConfiguration & TurboAuthConfiguration;
74
- export type TurboUnauthenticatedPaymentServiceInterfaceConfiguration = TurboServiceConfiguration;
75
- export type TurboAuthenticatedPaymentServiceInterfaceConfiguration = TurboServiceConfiguration & TurboAuthConfiguration;
76
- export type TurboPublicConfiguration = {
77
- paymentServiceConfig?: TurboUnauthenticatedPaymentServiceInterfaceConfiguration;
78
- uploadServiceConfig?: TurboUnauthenticatedUploadServiceInterfaceConfiguration;
79
- };
80
- export type TurboPrivateConfiguration = TurboPublicConfiguration & {
81
- privateKey: TurboWallet;
82
- };
83
- export type TurboPublicClientConfiguration = {
84
- paymentService: TurboUnauthenticatedPaymentServiceInterface;
85
- uploadService: TurboUnauthenticatedUploadServiceInterface;
86
- };
87
- export type TurboPrivateClientConfiguration = {
88
- paymentService: TurboAuthenticatedPaymentServiceInterface;
89
- uploadService: TurboAuthenticatedUploadServiceInterface;
90
- };
91
- export type FileStreamFactory = (() => Readable) | (() => ReadableStream) | (() => Buffer);
92
- export type SignedDataStreamFactory = FileStreamFactory;
93
- export type TurboFileFactory = {
94
- fileStreamFactory: FileStreamFactory;
95
- };
96
- export type TurboSignedDataItemFactory = {
97
- dataItemStreamFactory: SignedDataStreamFactory;
98
- };
99
- export type TurboAbortSignal = {
100
- signal?: AbortSignal;
101
- };
102
- export interface TurboHTTPServiceInterface {
103
- get<T>({ endpoint, signal, headers, allowedStatuses, }: {
104
- endpoint: string;
105
- signal?: AbortSignal;
106
- headers?: Partial<TurboSignedRequestHeaders> & Record<string, string>;
107
- allowedStatuses?: number[];
108
- }): Promise<T>;
109
- post<T>({ endpoint, signal, headers, allowedStatuses, data, }: {
110
- endpoint: string;
111
- signal: AbortSignal;
112
- headers?: Partial<TurboSignedRequestHeaders> & Record<string, string>;
113
- allowedStatuses?: number[];
114
- data: Readable | ReadableStream | Buffer;
115
- }): Promise<T>;
116
- }
117
- export interface TurboWalletSigner {
118
- signDataItem({ fileStreamFactory, }: TurboFileFactory): Promise<Readable> | Promise<Buffer>;
119
- generateSignedRequestHeaders(): Promise<TurboSignedRequestHeaders>;
120
- }
121
- export interface TurboUnauthenticatedPaymentServiceInterface {
122
- getSupportedCurrencies(): Promise<TurboCurrenciesResponse>;
123
- getSupportedCountries(): Promise<TurboCountriesResponse>;
124
- getFiatToAR({ currency, }: {
125
- currency: Currency;
126
- }): Promise<TurboFiatToArResponse>;
127
- getFiatRates(): Promise<TurboRatesResponse>;
128
- getWincForFiat({ amount, currency, }: {
129
- amount: number;
130
- currency: Currency;
131
- }): Promise<Omit<TurboPriceResponse, 'adjustments'>>;
132
- getUploadCosts({ bytes }: {
133
- bytes: number[];
134
- }): Promise<TurboPriceResponse[]>;
135
- }
136
- export interface TurboAuthenticatedPaymentServiceInterface extends TurboUnauthenticatedPaymentServiceInterface {
137
- getBalance: () => Promise<TurboBalanceResponse>;
138
- }
139
- export interface TurboUnauthenticatedUploadServiceInterface {
140
- uploadSignedDataItem({ dataItemStreamFactory, signal, }: TurboSignedDataItemFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
141
- }
142
- export interface TurboAuthenticatedUploadServiceInterface extends TurboUnauthenticatedUploadServiceInterface {
143
- uploadFile({ fileStreamFactory, }: TurboFileFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
144
- }
145
- export interface TurboUnauthenticatedClientInterface extends TurboUnauthenticatedPaymentServiceInterface, TurboUnauthenticatedUploadServiceInterface {
146
- }
147
- export interface TurboAuthenticatedClientInterface extends TurboAuthenticatedPaymentServiceInterface, TurboAuthenticatedUploadServiceInterface {
148
- }
149
- export {};
@@ -1,9 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import { JWKInterface } from '../types/index.js';
3
- import { Base64String, PublicArweaveAddress } from '../types/index.js';
4
- export declare const base64URLRegex: RegExp;
5
- export declare function jwkToPublicArweaveAddress(jwk: JWKInterface): PublicArweaveAddress;
6
- export declare function ownerToAddress(owner: Base64String): PublicArweaveAddress;
7
- export declare function fromB64Url(input: Base64String): Buffer;
8
- export declare function toB64Url(buffer: Buffer): Base64String;
9
- export declare function sha256B64Url(input: Buffer): Base64String;
@@ -1,22 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- /**
4
- * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU Affero General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU Affero General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Affero General Public License
17
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
- */
19
- import { ReadableStream } from 'node:stream/web';
20
- export declare function readableStreamToBuffer({ stream, }: {
21
- stream: ReadableStream;
22
- }): Promise<Buffer>;
@@ -1,22 +0,0 @@
1
- /**
2
- * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
3
- *
4
- * This program is free software: you can redistribute it and/or modify
5
- * it under the terms of the GNU Affero General Public License as published by
6
- * the Free Software Foundation, either version 3 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU Affero General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU Affero General Public License
15
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- */
17
- import { TurboBaseFactory } from '../common/factory.js';
18
- import { TurboAuthenticatedClient } from '../common/index.js';
19
- import { TurboPrivateConfiguration } from '../types/index.js';
20
- export declare class TurboFactory extends TurboBaseFactory {
21
- static authenticated({ privateKey, paymentServiceConfig, uploadServiceConfig, }: TurboPrivateConfiguration): TurboAuthenticatedClient;
22
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
3
- *
4
- * This program is free software: you can redistribute it and/or modify
5
- * it under the terms of the GNU Affero General Public License as published by
6
- * the Free Software Foundation, either version 3 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU Affero General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU Affero General Public License
15
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- */
17
- export * from './factory.js';
18
- export * from './signer.js';
19
- export * from '../common/index.js';
20
- export * from '../types/index.js';
@@ -1,37 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- /**
4
- * Copyright (C) 2022-2023 Permanent Data Solutions, Inc. All Rights Reserved.
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU Affero General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU Affero General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Affero General Public License
17
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
- */
19
- import { ArweaveSigner } from 'arbundles';
20
- import { ReadableStream } from 'node:stream/web';
21
- import { JWKInterface } from '../types/arweave.js';
22
- import { TurboWalletSigner } from '../types/turbo.js';
23
- export declare class TurboWebArweaveSigner implements TurboWalletSigner {
24
- protected privateKey: JWKInterface;
25
- protected signer: ArweaveSigner;
26
- constructor({ privateKey }: {
27
- privateKey: JWKInterface;
28
- });
29
- signDataItem({ fileStreamFactory, }: {
30
- fileStreamFactory: () => ReadableStream;
31
- }): Promise<Buffer>;
32
- generateSignedRequestHeaders(): Promise<{
33
- 'x-public-key': string;
34
- 'x-nonce': string;
35
- 'x-signature': string;
36
- }>;
37
- }
File without changes
File without changes
File without changes
File without changes