@ardrive/turbo-sdk 1.0.0-alpha.22 → 1.0.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -2
- package/bundles/web.bundle.min.js +105 -20
- package/lib/cjs/common/currency.js +42 -0
- package/lib/cjs/common/index.js +1 -0
- package/lib/cjs/common/payment.js +38 -6
- package/lib/cjs/common/turbo.js +16 -10
- package/lib/esm/common/currency.js +27 -0
- package/lib/esm/common/index.js +1 -0
- package/lib/esm/common/payment.js +38 -6
- package/lib/esm/common/turbo.js +16 -10
- package/lib/types/common/currency.d.ts +43 -0
- package/lib/types/common/currency.d.ts.map +1 -0
- package/lib/types/common/index.d.ts +1 -0
- package/lib/types/common/index.d.ts.map +1 -1
- package/lib/types/common/payment.d.ts +13 -5
- package/lib/types/common/payment.d.ts.map +1 -1
- package/lib/types/common/turbo.d.ts +6 -5
- package/lib/types/common/turbo.d.ts.map +1 -1
- package/lib/types/types.d.ts +37 -6
- package/lib/types/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -172,10 +172,14 @@ Types are exported from `./lib/types/index.d.ts` and should be automatically rec
|
|
172
172
|
const rates = await turbo.getFiatRates();
|
173
173
|
```
|
174
174
|
|
175
|
-
- `getWincForFiat({ amount,
|
175
|
+
- `getWincForFiat({ amount, promoCodes })` - Returns the current amount of Winston Credits including all adjustments for the provided fiat currency, amount, and optional promo codes.
|
176
176
|
|
177
177
|
```typescript
|
178
|
-
const
|
178
|
+
const { winc, paymentAmount, quotedPaymentAmount, adjustments } =
|
179
|
+
await turbo.getWincForFiat({
|
180
|
+
amount: USD(100),
|
181
|
+
promoCodes: ['MY_PROMO_CODE'],
|
182
|
+
});
|
179
183
|
```
|
180
184
|
|
181
185
|
- `getUploadCosts({ bytes })` - Returns the estimated cost in Winston Credits for the provided file sizes, including all upload adjustments and fees.
|
@@ -196,6 +200,29 @@ Types are exported from `./lib/types/index.d.ts` and should be automatically rec
|
|
196
200
|
});
|
197
201
|
```
|
198
202
|
|
203
|
+
- `createCheckoutSession({ amount, owner, promoCodes })` - Creates a Stripe checkout session for a Turbo Top Up with the provided amount, currency, owner, and optional promo codes. The returned URL can be opened in the browser, all payments are processed by Stripe.
|
204
|
+
|
205
|
+
```typescript
|
206
|
+
const { url, winc, paymentAmount, quotedPaymentAmount, adjustments } =
|
207
|
+
await turbo.createCheckoutSession({
|
208
|
+
amount: USD(10.0), // $10.00 USD
|
209
|
+
owner: publicArweaveAddress,
|
210
|
+
promoCodes: ['MY_PROMO_CODE'],
|
211
|
+
});
|
212
|
+
|
213
|
+
// Open checkout session in a browser
|
214
|
+
if (process.platform === 'darwin') {
|
215
|
+
// macOS
|
216
|
+
exec(`open ${url}`);
|
217
|
+
} else if (process.platform === 'win32') {
|
218
|
+
// Windows
|
219
|
+
exec(`start "" "${url}"`, { shell: true });
|
220
|
+
} else {
|
221
|
+
// Linux/Unix
|
222
|
+
open(url);
|
223
|
+
}
|
224
|
+
```
|
225
|
+
|
199
226
|
### TurboAuthenticatedClient
|
200
227
|
|
201
228
|
- `getBalance()` - Issues a signed request to get the credit balance of a wallet measured in AR (measured in Winston Credits, or winc).
|
@@ -47404,24 +47404,24 @@ var TurboUnauthenticatedPaymentService = class {
|
|
47404
47404
|
retryConfig
|
47405
47405
|
});
|
47406
47406
|
}
|
47407
|
-
|
47407
|
+
getFiatRates() {
|
47408
47408
|
return this.httpService.get({
|
47409
47409
|
endpoint: "/rates"
|
47410
47410
|
});
|
47411
47411
|
}
|
47412
|
-
|
47412
|
+
getFiatToAR({
|
47413
47413
|
currency
|
47414
47414
|
}) {
|
47415
47415
|
return this.httpService.get({
|
47416
47416
|
endpoint: `/rates/${currency}`
|
47417
47417
|
});
|
47418
47418
|
}
|
47419
|
-
|
47419
|
+
getSupportedCountries() {
|
47420
47420
|
return this.httpService.get({
|
47421
47421
|
endpoint: "/countries"
|
47422
47422
|
});
|
47423
47423
|
}
|
47424
|
-
|
47424
|
+
getSupportedCurrencies() {
|
47425
47425
|
return this.httpService.get({
|
47426
47426
|
endpoint: "/currencies"
|
47427
47427
|
});
|
@@ -47437,10 +47437,37 @@ var TurboUnauthenticatedPaymentService = class {
|
|
47437
47437
|
const wincCostsForBytes = await Promise.all(fetchPricePromises);
|
47438
47438
|
return wincCostsForBytes;
|
47439
47439
|
}
|
47440
|
-
|
47440
|
+
getWincForFiat({
|
47441
|
+
amount
|
47442
|
+
}) {
|
47443
|
+
const { amount: paymentAmount, type: currencyType } = amount;
|
47441
47444
|
return this.httpService.get({
|
47442
|
-
endpoint: `/price/${
|
47445
|
+
endpoint: `/price/${currencyType}/${paymentAmount}`
|
47446
|
+
});
|
47447
|
+
}
|
47448
|
+
appendPromoCodesToQuery(promoCodes) {
|
47449
|
+
const promoCodesQuery = promoCodes.join(",");
|
47450
|
+
return promoCodesQuery ? `?promoCode=${promoCodesQuery}` : "";
|
47451
|
+
}
|
47452
|
+
async getCheckout({ amount, owner, promoCodes = [] }, headers) {
|
47453
|
+
const { amount: paymentAmount, type: currencyType } = amount;
|
47454
|
+
const endpoint = `/top-up/checkout-session/${owner}/${currencyType}/${paymentAmount}${this.appendPromoCodesToQuery(
|
47455
|
+
promoCodes
|
47456
|
+
)}`;
|
47457
|
+
const { adjustments, paymentSession, topUpQuote } = await this.httpService.get({
|
47458
|
+
endpoint,
|
47459
|
+
headers
|
47443
47460
|
});
|
47461
|
+
return {
|
47462
|
+
winc: topUpQuote.winstonCreditAmount,
|
47463
|
+
adjustments,
|
47464
|
+
url: paymentSession.url,
|
47465
|
+
paymentAmount: topUpQuote.paymentAmount,
|
47466
|
+
quotedPaymentAmount: topUpQuote.quotedPaymentAmount
|
47467
|
+
};
|
47468
|
+
}
|
47469
|
+
createCheckoutSession(params) {
|
47470
|
+
return this.getCheckout(params);
|
47444
47471
|
}
|
47445
47472
|
};
|
47446
47473
|
var TurboAuthenticatedPaymentService = class extends TurboUnauthenticatedPaymentService {
|
@@ -47461,6 +47488,21 @@ var TurboAuthenticatedPaymentService = class extends TurboUnauthenticatedPayment
|
|
47461
47488
|
});
|
47462
47489
|
return balance.winc ? balance : { winc: "0" };
|
47463
47490
|
}
|
47491
|
+
async getWincForFiat({
|
47492
|
+
amount,
|
47493
|
+
promoCodes = []
|
47494
|
+
}) {
|
47495
|
+
return this.httpService.get({
|
47496
|
+
endpoint: `/price/${amount.type}/${amount.amount}${this.appendPromoCodesToQuery(promoCodes)}`,
|
47497
|
+
headers: await this.signer.generateSignedRequestHeaders()
|
47498
|
+
});
|
47499
|
+
}
|
47500
|
+
async createCheckoutSession(params) {
|
47501
|
+
return this.getCheckout(
|
47502
|
+
params,
|
47503
|
+
await this.signer.generateSignedRequestHeaders()
|
47504
|
+
);
|
47505
|
+
}
|
47464
47506
|
};
|
47465
47507
|
|
47466
47508
|
// src/common/turbo.ts
|
@@ -47539,7 +47581,7 @@ var TurboUnauthenticatedClient = class {
|
|
47539
47581
|
/**
|
47540
47582
|
* Returns the supported fiat currency conversion rate for 1AR based on current market prices.
|
47541
47583
|
*/
|
47542
|
-
|
47584
|
+
getFiatToAR({
|
47543
47585
|
currency
|
47544
47586
|
}) {
|
47545
47587
|
return this.paymentService.getFiatToAR({ currency });
|
@@ -47550,25 +47592,25 @@ var TurboUnauthenticatedClient = class {
|
|
47550
47592
|
* Note: this does not take into account varying adjustments and promotions for different sizes of data. If you want to calculate the total
|
47551
47593
|
* cost in 'winc' for a given number of bytes, use getUploadCosts.
|
47552
47594
|
*/
|
47553
|
-
|
47595
|
+
getFiatRates() {
|
47554
47596
|
return this.paymentService.getFiatRates();
|
47555
47597
|
}
|
47556
47598
|
/**
|
47557
47599
|
* Returns a comprehensive list of supported countries that can purchase credits through the Turbo Payment Service.
|
47558
47600
|
*/
|
47559
|
-
|
47601
|
+
getSupportedCountries() {
|
47560
47602
|
return this.paymentService.getSupportedCountries();
|
47561
47603
|
}
|
47562
47604
|
/**
|
47563
47605
|
* Returns a list of all supported fiat currencies.
|
47564
47606
|
*/
|
47565
|
-
|
47607
|
+
getSupportedCurrencies() {
|
47566
47608
|
return this.paymentService.getSupportedCurrencies();
|
47567
47609
|
}
|
47568
47610
|
/**
|
47569
47611
|
* Determines the price in 'winc' to upload one data item of a specific size in bytes, including all Turbo cost adjustments and fees.
|
47570
47612
|
*/
|
47571
|
-
|
47613
|
+
getUploadCosts({
|
47572
47614
|
bytes
|
47573
47615
|
}) {
|
47574
47616
|
return this.paymentService.getUploadCosts({ bytes });
|
@@ -47576,16 +47618,13 @@ var TurboUnauthenticatedClient = class {
|
|
47576
47618
|
/**
|
47577
47619
|
* Determines the amount of 'winc' that would be returned for a given currency and amount, including all Turbo cost adjustments and fees.
|
47578
47620
|
*/
|
47579
|
-
|
47580
|
-
|
47581
|
-
currency
|
47582
|
-
}) {
|
47583
|
-
return this.paymentService.getWincForFiat({ amount, currency });
|
47621
|
+
getWincForFiat(params) {
|
47622
|
+
return this.paymentService.getWincForFiat(params);
|
47584
47623
|
}
|
47585
47624
|
/**
|
47586
47625
|
* Uploads a signed data item to the Turbo Upload Service.
|
47587
47626
|
*/
|
47588
|
-
|
47627
|
+
uploadSignedDataItem({
|
47589
47628
|
dataItemStreamFactory,
|
47590
47629
|
dataItemSizeFactory,
|
47591
47630
|
signal
|
@@ -47596,6 +47635,12 @@ var TurboUnauthenticatedClient = class {
|
|
47596
47635
|
signal
|
47597
47636
|
});
|
47598
47637
|
}
|
47638
|
+
/**
|
47639
|
+
* Creates a Turbo Checkout Session for a given amount and currency.
|
47640
|
+
*/
|
47641
|
+
createCheckoutSession(params) {
|
47642
|
+
return this.paymentService.createCheckoutSession(params);
|
47643
|
+
}
|
47599
47644
|
};
|
47600
47645
|
var TurboAuthenticatedClient = class extends TurboUnauthenticatedClient {
|
47601
47646
|
constructor({
|
@@ -47607,13 +47652,13 @@ var TurboAuthenticatedClient = class extends TurboUnauthenticatedClient {
|
|
47607
47652
|
/**
|
47608
47653
|
* Returns the current balance of the user's wallet in 'winc'.
|
47609
47654
|
*/
|
47610
|
-
|
47655
|
+
getBalance() {
|
47611
47656
|
return this.paymentService.getBalance();
|
47612
47657
|
}
|
47613
47658
|
/**
|
47614
47659
|
* Signs and uploads raw data to the Turbo Upload Service.
|
47615
47660
|
*/
|
47616
|
-
|
47661
|
+
uploadFile({
|
47617
47662
|
fileStreamFactory,
|
47618
47663
|
fileSizeFactory,
|
47619
47664
|
signal
|
@@ -47648,6 +47693,34 @@ var TurboBaseFactory = class {
|
|
47648
47693
|
// src/common/index.ts
|
47649
47694
|
init_shim();
|
47650
47695
|
|
47696
|
+
// src/common/currency.ts
|
47697
|
+
init_shim();
|
47698
|
+
var ZeroDecimalCurrency = class {
|
47699
|
+
constructor(amount, type) {
|
47700
|
+
this.amount = amount;
|
47701
|
+
this.type = type;
|
47702
|
+
}
|
47703
|
+
};
|
47704
|
+
var TwoDecimalCurrency = class {
|
47705
|
+
constructor(a, type) {
|
47706
|
+
this.a = a;
|
47707
|
+
this.type = type;
|
47708
|
+
}
|
47709
|
+
get amount() {
|
47710
|
+
return this.a * 100;
|
47711
|
+
}
|
47712
|
+
};
|
47713
|
+
var USD = (usd) => new TwoDecimalCurrency(usd, "usd");
|
47714
|
+
var EUR = (eur) => new TwoDecimalCurrency(eur, "eur");
|
47715
|
+
var GBP = (gbp) => new TwoDecimalCurrency(gbp, "gbp");
|
47716
|
+
var CAD = (cad) => new TwoDecimalCurrency(cad, "cad");
|
47717
|
+
var AUD = (aud) => new TwoDecimalCurrency(aud, "aud");
|
47718
|
+
var INR = (inr) => new TwoDecimalCurrency(inr, "inr");
|
47719
|
+
var SGD = (sgd) => new TwoDecimalCurrency(sgd, "sgd");
|
47720
|
+
var HKD = (hkd) => new TwoDecimalCurrency(hkd, "hkd");
|
47721
|
+
var BRL = (brl) => new TwoDecimalCurrency(brl, "brl");
|
47722
|
+
var JPY = (jpy) => new ZeroDecimalCurrency(jpy, "jpy");
|
47723
|
+
|
47651
47724
|
// src/web/signer.ts
|
47652
47725
|
init_shim();
|
47653
47726
|
|
@@ -55651,6 +55724,15 @@ var TurboFactory = class extends TurboBaseFactory {
|
|
55651
55724
|
// src/types.ts
|
55652
55725
|
init_shim();
|
55653
55726
|
export {
|
55727
|
+
AUD,
|
55728
|
+
BRL,
|
55729
|
+
CAD,
|
55730
|
+
EUR,
|
55731
|
+
GBP,
|
55732
|
+
HKD,
|
55733
|
+
INR,
|
55734
|
+
JPY,
|
55735
|
+
SGD,
|
55654
55736
|
TurboAuthenticatedClient,
|
55655
55737
|
TurboAuthenticatedPaymentService,
|
55656
55738
|
TurboAuthenticatedUploadService,
|
@@ -55658,7 +55740,10 @@ export {
|
|
55658
55740
|
TurboUnauthenticatedClient,
|
55659
55741
|
TurboUnauthenticatedPaymentService,
|
55660
55742
|
TurboUnauthenticatedUploadService,
|
55661
|
-
TurboWebArweaveSigner
|
55743
|
+
TurboWebArweaveSigner,
|
55744
|
+
TwoDecimalCurrency,
|
55745
|
+
USD,
|
55746
|
+
ZeroDecimalCurrency
|
55662
55747
|
};
|
55663
55748
|
/*! Bundled license information:
|
55664
55749
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.JPY = exports.BRL = exports.HKD = exports.SGD = exports.INR = exports.AUD = exports.CAD = exports.GBP = exports.EUR = exports.USD = exports.TwoDecimalCurrency = exports.ZeroDecimalCurrency = void 0;
|
4
|
+
class ZeroDecimalCurrency {
|
5
|
+
constructor(amount, type) {
|
6
|
+
this.amount = amount;
|
7
|
+
this.type = type;
|
8
|
+
}
|
9
|
+
}
|
10
|
+
exports.ZeroDecimalCurrency = ZeroDecimalCurrency;
|
11
|
+
class TwoDecimalCurrency {
|
12
|
+
constructor(a, type) {
|
13
|
+
this.a = a;
|
14
|
+
this.type = type;
|
15
|
+
}
|
16
|
+
get amount() {
|
17
|
+
return this.a * 100;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
exports.TwoDecimalCurrency = TwoDecimalCurrency;
|
21
|
+
// Two decimal currencies that are supported by the Turbo API
|
22
|
+
const USD = (usd) => new TwoDecimalCurrency(usd, 'usd');
|
23
|
+
exports.USD = USD;
|
24
|
+
const EUR = (eur) => new TwoDecimalCurrency(eur, 'eur');
|
25
|
+
exports.EUR = EUR;
|
26
|
+
const GBP = (gbp) => new TwoDecimalCurrency(gbp, 'gbp');
|
27
|
+
exports.GBP = GBP;
|
28
|
+
const CAD = (cad) => new TwoDecimalCurrency(cad, 'cad');
|
29
|
+
exports.CAD = CAD;
|
30
|
+
const AUD = (aud) => new TwoDecimalCurrency(aud, 'aud');
|
31
|
+
exports.AUD = AUD;
|
32
|
+
const INR = (inr) => new TwoDecimalCurrency(inr, 'inr');
|
33
|
+
exports.INR = INR;
|
34
|
+
const SGD = (sgd) => new TwoDecimalCurrency(sgd, 'sgd');
|
35
|
+
exports.SGD = SGD;
|
36
|
+
const HKD = (hkd) => new TwoDecimalCurrency(hkd, 'hkd');
|
37
|
+
exports.HKD = HKD;
|
38
|
+
const BRL = (brl) => new TwoDecimalCurrency(brl, 'brl');
|
39
|
+
exports.BRL = BRL;
|
40
|
+
// Zero decimal currencies that are supported by the Turbo API
|
41
|
+
const JPY = (jpy) => new ZeroDecimalCurrency(jpy, 'jpy');
|
42
|
+
exports.JPY = JPY;
|
package/lib/cjs/common/index.js
CHANGED
@@ -9,22 +9,22 @@ class TurboUnauthenticatedPaymentService {
|
|
9
9
|
retryConfig,
|
10
10
|
});
|
11
11
|
}
|
12
|
-
|
12
|
+
getFiatRates() {
|
13
13
|
return this.httpService.get({
|
14
14
|
endpoint: '/rates',
|
15
15
|
});
|
16
16
|
}
|
17
|
-
|
17
|
+
getFiatToAR({ currency, }) {
|
18
18
|
return this.httpService.get({
|
19
19
|
endpoint: `/rates/${currency}`,
|
20
20
|
});
|
21
21
|
}
|
22
|
-
|
22
|
+
getSupportedCountries() {
|
23
23
|
return this.httpService.get({
|
24
24
|
endpoint: '/countries',
|
25
25
|
});
|
26
26
|
}
|
27
|
-
|
27
|
+
getSupportedCurrencies() {
|
28
28
|
return this.httpService.get({
|
29
29
|
endpoint: '/currencies',
|
30
30
|
});
|
@@ -36,11 +36,34 @@ class TurboUnauthenticatedPaymentService {
|
|
36
36
|
const wincCostsForBytes = await Promise.all(fetchPricePromises);
|
37
37
|
return wincCostsForBytes;
|
38
38
|
}
|
39
|
-
|
39
|
+
getWincForFiat({ amount, }) {
|
40
|
+
const { amount: paymentAmount, type: currencyType } = amount;
|
40
41
|
return this.httpService.get({
|
41
|
-
endpoint: `/price/${
|
42
|
+
endpoint: `/price/${currencyType}/${paymentAmount}`,
|
42
43
|
});
|
43
44
|
}
|
45
|
+
appendPromoCodesToQuery(promoCodes) {
|
46
|
+
const promoCodesQuery = promoCodes.join(',');
|
47
|
+
return promoCodesQuery ? `?promoCode=${promoCodesQuery}` : '';
|
48
|
+
}
|
49
|
+
async getCheckout({ amount, owner, promoCodes = [] }, headers) {
|
50
|
+
const { amount: paymentAmount, type: currencyType } = amount;
|
51
|
+
const endpoint = `/top-up/checkout-session/${owner}/${currencyType}/${paymentAmount}${this.appendPromoCodesToQuery(promoCodes)}`;
|
52
|
+
const { adjustments, paymentSession, topUpQuote } = await this.httpService.get({
|
53
|
+
endpoint,
|
54
|
+
headers,
|
55
|
+
});
|
56
|
+
return {
|
57
|
+
winc: topUpQuote.winstonCreditAmount,
|
58
|
+
adjustments,
|
59
|
+
url: paymentSession.url,
|
60
|
+
paymentAmount: topUpQuote.paymentAmount,
|
61
|
+
quotedPaymentAmount: topUpQuote.quotedPaymentAmount,
|
62
|
+
};
|
63
|
+
}
|
64
|
+
createCheckoutSession(params) {
|
65
|
+
return this.getCheckout(params);
|
66
|
+
}
|
44
67
|
}
|
45
68
|
exports.TurboUnauthenticatedPaymentService = TurboUnauthenticatedPaymentService;
|
46
69
|
// NOTE: to avoid redundancy, we use inheritance here - but generally prefer composition over inheritance
|
@@ -59,5 +82,14 @@ class TurboAuthenticatedPaymentService extends TurboUnauthenticatedPaymentServic
|
|
59
82
|
// 404's don't return a balance, so default to 0
|
60
83
|
return balance.winc ? balance : { winc: '0' };
|
61
84
|
}
|
85
|
+
async getWincForFiat({ amount, promoCodes = [], }) {
|
86
|
+
return this.httpService.get({
|
87
|
+
endpoint: `/price/${amount.type}/${amount.amount}${this.appendPromoCodesToQuery(promoCodes)}`,
|
88
|
+
headers: await this.signer.generateSignedRequestHeaders(),
|
89
|
+
});
|
90
|
+
}
|
91
|
+
async createCheckoutSession(params) {
|
92
|
+
return this.getCheckout(params, await this.signer.generateSignedRequestHeaders());
|
93
|
+
}
|
62
94
|
}
|
63
95
|
exports.TurboAuthenticatedPaymentService = TurboAuthenticatedPaymentService;
|
package/lib/cjs/common/turbo.js
CHANGED
@@ -11,7 +11,7 @@ class TurboUnauthenticatedClient {
|
|
11
11
|
/**
|
12
12
|
* Returns the supported fiat currency conversion rate for 1AR based on current market prices.
|
13
13
|
*/
|
14
|
-
|
14
|
+
getFiatToAR({ currency, }) {
|
15
15
|
return this.paymentService.getFiatToAR({ currency });
|
16
16
|
}
|
17
17
|
/**
|
@@ -20,43 +20,49 @@ class TurboUnauthenticatedClient {
|
|
20
20
|
* Note: this does not take into account varying adjustments and promotions for different sizes of data. If you want to calculate the total
|
21
21
|
* cost in 'winc' for a given number of bytes, use getUploadCosts.
|
22
22
|
*/
|
23
|
-
|
23
|
+
getFiatRates() {
|
24
24
|
return this.paymentService.getFiatRates();
|
25
25
|
}
|
26
26
|
/**
|
27
27
|
* Returns a comprehensive list of supported countries that can purchase credits through the Turbo Payment Service.
|
28
28
|
*/
|
29
|
-
|
29
|
+
getSupportedCountries() {
|
30
30
|
return this.paymentService.getSupportedCountries();
|
31
31
|
}
|
32
32
|
/**
|
33
33
|
* Returns a list of all supported fiat currencies.
|
34
34
|
*/
|
35
|
-
|
35
|
+
getSupportedCurrencies() {
|
36
36
|
return this.paymentService.getSupportedCurrencies();
|
37
37
|
}
|
38
38
|
/**
|
39
39
|
* Determines the price in 'winc' to upload one data item of a specific size in bytes, including all Turbo cost adjustments and fees.
|
40
40
|
*/
|
41
|
-
|
41
|
+
getUploadCosts({ bytes, }) {
|
42
42
|
return this.paymentService.getUploadCosts({ bytes });
|
43
43
|
}
|
44
44
|
/**
|
45
45
|
* Determines the amount of 'winc' that would be returned for a given currency and amount, including all Turbo cost adjustments and fees.
|
46
46
|
*/
|
47
|
-
|
48
|
-
return this.paymentService.getWincForFiat(
|
47
|
+
getWincForFiat(params) {
|
48
|
+
return this.paymentService.getWincForFiat(params);
|
49
49
|
}
|
50
50
|
/**
|
51
51
|
* Uploads a signed data item to the Turbo Upload Service.
|
52
52
|
*/
|
53
|
-
|
53
|
+
uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal, }) {
|
54
54
|
return this.uploadService.uploadSignedDataItem({
|
55
55
|
dataItemStreamFactory,
|
56
56
|
dataItemSizeFactory,
|
57
57
|
signal,
|
58
58
|
});
|
59
59
|
}
|
60
|
+
/**
|
61
|
+
* Creates a Turbo Checkout Session for a given amount and currency.
|
62
|
+
*/
|
63
|
+
createCheckoutSession(params) {
|
64
|
+
return this.paymentService.createCheckoutSession(params);
|
65
|
+
}
|
60
66
|
}
|
61
67
|
exports.TurboUnauthenticatedClient = TurboUnauthenticatedClient;
|
62
68
|
class TurboAuthenticatedClient extends TurboUnauthenticatedClient {
|
@@ -66,13 +72,13 @@ class TurboAuthenticatedClient extends TurboUnauthenticatedClient {
|
|
66
72
|
/**
|
67
73
|
* Returns the current balance of the user's wallet in 'winc'.
|
68
74
|
*/
|
69
|
-
|
75
|
+
getBalance() {
|
70
76
|
return this.paymentService.getBalance();
|
71
77
|
}
|
72
78
|
/**
|
73
79
|
* Signs and uploads raw data to the Turbo Upload Service.
|
74
80
|
*/
|
75
|
-
|
81
|
+
uploadFile({ fileStreamFactory, fileSizeFactory, signal, }) {
|
76
82
|
return this.uploadService.uploadFile({
|
77
83
|
fileStreamFactory,
|
78
84
|
fileSizeFactory,
|
@@ -0,0 +1,27 @@
|
|
1
|
+
export class ZeroDecimalCurrency {
|
2
|
+
constructor(amount, type) {
|
3
|
+
this.amount = amount;
|
4
|
+
this.type = type;
|
5
|
+
}
|
6
|
+
}
|
7
|
+
export class TwoDecimalCurrency {
|
8
|
+
constructor(a, type) {
|
9
|
+
this.a = a;
|
10
|
+
this.type = type;
|
11
|
+
}
|
12
|
+
get amount() {
|
13
|
+
return this.a * 100;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
// Two decimal currencies that are supported by the Turbo API
|
17
|
+
export const USD = (usd) => new TwoDecimalCurrency(usd, 'usd');
|
18
|
+
export const EUR = (eur) => new TwoDecimalCurrency(eur, 'eur');
|
19
|
+
export const GBP = (gbp) => new TwoDecimalCurrency(gbp, 'gbp');
|
20
|
+
export const CAD = (cad) => new TwoDecimalCurrency(cad, 'cad');
|
21
|
+
export const AUD = (aud) => new TwoDecimalCurrency(aud, 'aud');
|
22
|
+
export const INR = (inr) => new TwoDecimalCurrency(inr, 'inr');
|
23
|
+
export const SGD = (sgd) => new TwoDecimalCurrency(sgd, 'sgd');
|
24
|
+
export const HKD = (hkd) => new TwoDecimalCurrency(hkd, 'hkd');
|
25
|
+
export const BRL = (brl) => new TwoDecimalCurrency(brl, 'brl');
|
26
|
+
// Zero decimal currencies that are supported by the Turbo API
|
27
|
+
export const JPY = (jpy) => new ZeroDecimalCurrency(jpy, 'jpy');
|
package/lib/esm/common/index.js
CHANGED
@@ -6,22 +6,22 @@ export class TurboUnauthenticatedPaymentService {
|
|
6
6
|
retryConfig,
|
7
7
|
});
|
8
8
|
}
|
9
|
-
|
9
|
+
getFiatRates() {
|
10
10
|
return this.httpService.get({
|
11
11
|
endpoint: '/rates',
|
12
12
|
});
|
13
13
|
}
|
14
|
-
|
14
|
+
getFiatToAR({ currency, }) {
|
15
15
|
return this.httpService.get({
|
16
16
|
endpoint: `/rates/${currency}`,
|
17
17
|
});
|
18
18
|
}
|
19
|
-
|
19
|
+
getSupportedCountries() {
|
20
20
|
return this.httpService.get({
|
21
21
|
endpoint: '/countries',
|
22
22
|
});
|
23
23
|
}
|
24
|
-
|
24
|
+
getSupportedCurrencies() {
|
25
25
|
return this.httpService.get({
|
26
26
|
endpoint: '/currencies',
|
27
27
|
});
|
@@ -33,11 +33,34 @@ export class TurboUnauthenticatedPaymentService {
|
|
33
33
|
const wincCostsForBytes = await Promise.all(fetchPricePromises);
|
34
34
|
return wincCostsForBytes;
|
35
35
|
}
|
36
|
-
|
36
|
+
getWincForFiat({ amount, }) {
|
37
|
+
const { amount: paymentAmount, type: currencyType } = amount;
|
37
38
|
return this.httpService.get({
|
38
|
-
endpoint: `/price/${
|
39
|
+
endpoint: `/price/${currencyType}/${paymentAmount}`,
|
39
40
|
});
|
40
41
|
}
|
42
|
+
appendPromoCodesToQuery(promoCodes) {
|
43
|
+
const promoCodesQuery = promoCodes.join(',');
|
44
|
+
return promoCodesQuery ? `?promoCode=${promoCodesQuery}` : '';
|
45
|
+
}
|
46
|
+
async getCheckout({ amount, owner, promoCodes = [] }, headers) {
|
47
|
+
const { amount: paymentAmount, type: currencyType } = amount;
|
48
|
+
const endpoint = `/top-up/checkout-session/${owner}/${currencyType}/${paymentAmount}${this.appendPromoCodesToQuery(promoCodes)}`;
|
49
|
+
const { adjustments, paymentSession, topUpQuote } = await this.httpService.get({
|
50
|
+
endpoint,
|
51
|
+
headers,
|
52
|
+
});
|
53
|
+
return {
|
54
|
+
winc: topUpQuote.winstonCreditAmount,
|
55
|
+
adjustments,
|
56
|
+
url: paymentSession.url,
|
57
|
+
paymentAmount: topUpQuote.paymentAmount,
|
58
|
+
quotedPaymentAmount: topUpQuote.quotedPaymentAmount,
|
59
|
+
};
|
60
|
+
}
|
61
|
+
createCheckoutSession(params) {
|
62
|
+
return this.getCheckout(params);
|
63
|
+
}
|
41
64
|
}
|
42
65
|
// NOTE: to avoid redundancy, we use inheritance here - but generally prefer composition over inheritance
|
43
66
|
export class TurboAuthenticatedPaymentService extends TurboUnauthenticatedPaymentService {
|
@@ -55,4 +78,13 @@ export class TurboAuthenticatedPaymentService extends TurboUnauthenticatedPaymen
|
|
55
78
|
// 404's don't return a balance, so default to 0
|
56
79
|
return balance.winc ? balance : { winc: '0' };
|
57
80
|
}
|
81
|
+
async getWincForFiat({ amount, promoCodes = [], }) {
|
82
|
+
return this.httpService.get({
|
83
|
+
endpoint: `/price/${amount.type}/${amount.amount}${this.appendPromoCodesToQuery(promoCodes)}`,
|
84
|
+
headers: await this.signer.generateSignedRequestHeaders(),
|
85
|
+
});
|
86
|
+
}
|
87
|
+
async createCheckoutSession(params) {
|
88
|
+
return this.getCheckout(params, await this.signer.generateSignedRequestHeaders());
|
89
|
+
}
|
58
90
|
}
|
package/lib/esm/common/turbo.js
CHANGED
@@ -8,7 +8,7 @@ export class TurboUnauthenticatedClient {
|
|
8
8
|
/**
|
9
9
|
* Returns the supported fiat currency conversion rate for 1AR based on current market prices.
|
10
10
|
*/
|
11
|
-
|
11
|
+
getFiatToAR({ currency, }) {
|
12
12
|
return this.paymentService.getFiatToAR({ currency });
|
13
13
|
}
|
14
14
|
/**
|
@@ -17,43 +17,49 @@ export class TurboUnauthenticatedClient {
|
|
17
17
|
* Note: this does not take into account varying adjustments and promotions for different sizes of data. If you want to calculate the total
|
18
18
|
* cost in 'winc' for a given number of bytes, use getUploadCosts.
|
19
19
|
*/
|
20
|
-
|
20
|
+
getFiatRates() {
|
21
21
|
return this.paymentService.getFiatRates();
|
22
22
|
}
|
23
23
|
/**
|
24
24
|
* Returns a comprehensive list of supported countries that can purchase credits through the Turbo Payment Service.
|
25
25
|
*/
|
26
|
-
|
26
|
+
getSupportedCountries() {
|
27
27
|
return this.paymentService.getSupportedCountries();
|
28
28
|
}
|
29
29
|
/**
|
30
30
|
* Returns a list of all supported fiat currencies.
|
31
31
|
*/
|
32
|
-
|
32
|
+
getSupportedCurrencies() {
|
33
33
|
return this.paymentService.getSupportedCurrencies();
|
34
34
|
}
|
35
35
|
/**
|
36
36
|
* Determines the price in 'winc' to upload one data item of a specific size in bytes, including all Turbo cost adjustments and fees.
|
37
37
|
*/
|
38
|
-
|
38
|
+
getUploadCosts({ bytes, }) {
|
39
39
|
return this.paymentService.getUploadCosts({ bytes });
|
40
40
|
}
|
41
41
|
/**
|
42
42
|
* Determines the amount of 'winc' that would be returned for a given currency and amount, including all Turbo cost adjustments and fees.
|
43
43
|
*/
|
44
|
-
|
45
|
-
return this.paymentService.getWincForFiat(
|
44
|
+
getWincForFiat(params) {
|
45
|
+
return this.paymentService.getWincForFiat(params);
|
46
46
|
}
|
47
47
|
/**
|
48
48
|
* Uploads a signed data item to the Turbo Upload Service.
|
49
49
|
*/
|
50
|
-
|
50
|
+
uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal, }) {
|
51
51
|
return this.uploadService.uploadSignedDataItem({
|
52
52
|
dataItemStreamFactory,
|
53
53
|
dataItemSizeFactory,
|
54
54
|
signal,
|
55
55
|
});
|
56
56
|
}
|
57
|
+
/**
|
58
|
+
* Creates a Turbo Checkout Session for a given amount and currency.
|
59
|
+
*/
|
60
|
+
createCheckoutSession(params) {
|
61
|
+
return this.paymentService.createCheckoutSession(params);
|
62
|
+
}
|
57
63
|
}
|
58
64
|
export class TurboAuthenticatedClient extends TurboUnauthenticatedClient {
|
59
65
|
constructor({ paymentService, uploadService, }) {
|
@@ -62,13 +68,13 @@ export class TurboAuthenticatedClient extends TurboUnauthenticatedClient {
|
|
62
68
|
/**
|
63
69
|
* Returns the current balance of the user's wallet in 'winc'.
|
64
70
|
*/
|
65
|
-
|
71
|
+
getBalance() {
|
66
72
|
return this.paymentService.getBalance();
|
67
73
|
}
|
68
74
|
/**
|
69
75
|
* Signs and uploads raw data to the Turbo Upload Service.
|
70
76
|
*/
|
71
|
-
|
77
|
+
uploadFile({ fileStreamFactory, fileSizeFactory, signal, }) {
|
72
78
|
return this.uploadService.uploadFile({
|
73
79
|
fileStreamFactory,
|
74
80
|
fileSizeFactory,
|
@@ -0,0 +1,43 @@
|
|
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 } from '../types.js';
|
18
|
+
export interface CurrencyMap {
|
19
|
+
amount: number;
|
20
|
+
type: Currency;
|
21
|
+
}
|
22
|
+
export declare class ZeroDecimalCurrency implements CurrencyMap {
|
23
|
+
readonly amount: number;
|
24
|
+
readonly type: Currency;
|
25
|
+
constructor(amount: number, type: Currency);
|
26
|
+
}
|
27
|
+
export declare class TwoDecimalCurrency implements CurrencyMap {
|
28
|
+
private a;
|
29
|
+
readonly type: Currency;
|
30
|
+
constructor(a: number, type: Currency);
|
31
|
+
get amount(): number;
|
32
|
+
}
|
33
|
+
export declare const USD: (usd: number) => TwoDecimalCurrency;
|
34
|
+
export declare const EUR: (eur: number) => TwoDecimalCurrency;
|
35
|
+
export declare const GBP: (gbp: number) => TwoDecimalCurrency;
|
36
|
+
export declare const CAD: (cad: number) => TwoDecimalCurrency;
|
37
|
+
export declare const AUD: (aud: number) => TwoDecimalCurrency;
|
38
|
+
export declare const INR: (inr: number) => TwoDecimalCurrency;
|
39
|
+
export declare const SGD: (sgd: number) => TwoDecimalCurrency;
|
40
|
+
export declare const HKD: (hkd: number) => TwoDecimalCurrency;
|
41
|
+
export declare const BRL: (brl: number) => TwoDecimalCurrency;
|
42
|
+
export declare const JPY: (jpy: number) => ZeroDecimalCurrency;
|
43
|
+
//# sourceMappingURL=currency.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/common/currency.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,qBAAa,mBAAoB,YAAW,WAAW;aAEnC,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,QAAQ;gBADd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,QAAQ;CAEjC;AAED,qBAAa,kBAAmB,YAAW,WAAW;IAElD,OAAO,CAAC,CAAC;aACO,IAAI,EAAE,QAAQ;gBADtB,CAAC,EAAE,MAAM,EACD,IAAI,EAAE,QAAQ;IAGhC,IAAI,MAAM,WAET;CACF;AAGD,eAAO,MAAM,GAAG,QAAS,MAAM,uBAAuC,CAAC;AACvE,eAAO,MAAM,GAAG,QAAS,MAAM,uBAAuC,CAAC;AACvE,eAAO,MAAM,GAAG,QAAS,MAAM,uBAAuC,CAAC;AACvE,eAAO,MAAM,GAAG,QAAS,MAAM,uBAAuC,CAAC;AACvE,eAAO,MAAM,GAAG,QAAS,MAAM,uBAAuC,CAAC;AACvE,eAAO,MAAM,GAAG,QAAS,MAAM,uBAAuC,CAAC;AACvE,eAAO,MAAM,GAAG,QAAS,MAAM,uBAAuC,CAAC;AACvE,eAAO,MAAM,GAAG,QAAS,MAAM,uBAAuC,CAAC;AACvE,eAAO,MAAM,GAAG,QAAS,MAAM,uBAAuC,CAAC;AAGvE,eAAO,MAAM,GAAG,QAAS,MAAM,wBAAwC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
@@ -14,7 +14,7 @@
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
|
-
import { Currency, TurboAuthenticatedPaymentServiceInterface, TurboAuthenticatedPaymentServiceInterfaceConfiguration, TurboBalanceResponse, TurboCountriesResponse, TurboCurrenciesResponse, TurboFiatToArResponse, TurboPriceResponse, TurboRatesResponse, TurboUnauthenticatedPaymentServiceInterface, TurboUnauthenticatedPaymentServiceInterfaceConfiguration, TurboWalletSigner } from '../types.js';
|
17
|
+
import { Currency, TurboAuthenticatedPaymentServiceInterface, TurboAuthenticatedPaymentServiceInterfaceConfiguration, TurboBalanceResponse, TurboCheckoutSessionParams, TurboCheckoutSessionResponse, TurboCountriesResponse, TurboCurrenciesResponse, TurboFiatToArResponse, TurboPriceResponse, TurboRatesResponse, TurboSignedRequestHeaders, TurboUnauthenticatedPaymentServiceInterface, TurboUnauthenticatedPaymentServiceInterfaceConfiguration, TurboWalletSigner, TurboWincForFiatParams, TurboWincForFiatResponse } from '../types.js';
|
18
18
|
import { TurboHTTPService } from './http.js';
|
19
19
|
export declare class TurboUnauthenticatedPaymentService implements TurboUnauthenticatedPaymentServiceInterface {
|
20
20
|
protected readonly httpService: TurboHTTPService;
|
@@ -28,14 +28,22 @@ export declare class TurboUnauthenticatedPaymentService implements TurboUnauthen
|
|
28
28
|
getUploadCosts({ bytes, }: {
|
29
29
|
bytes: number[];
|
30
30
|
}): Promise<TurboPriceResponse[]>;
|
31
|
-
getWincForFiat({ amount,
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
getWincForFiat({ amount, }: TurboWincForFiatParams): Promise<TurboWincForFiatResponse>;
|
32
|
+
protected appendPromoCodesToQuery(promoCodes: string[]): string;
|
33
|
+
protected getCheckout({ amount, owner, promoCodes }: TurboCheckoutSessionParams, headers?: TurboSignedRequestHeaders): Promise<{
|
34
|
+
winc: string;
|
35
|
+
adjustments: import("../types.js").Adjustment[];
|
36
|
+
url: string;
|
37
|
+
paymentAmount: number;
|
38
|
+
quotedPaymentAmount: number;
|
39
|
+
}>;
|
40
|
+
createCheckoutSession(params: TurboCheckoutSessionParams): Promise<TurboCheckoutSessionResponse>;
|
35
41
|
}
|
36
42
|
export declare class TurboAuthenticatedPaymentService extends TurboUnauthenticatedPaymentService implements TurboAuthenticatedPaymentServiceInterface {
|
37
43
|
protected readonly signer: TurboWalletSigner;
|
38
44
|
constructor({ url, retryConfig, signer, }: TurboAuthenticatedPaymentServiceInterfaceConfiguration);
|
39
45
|
getBalance(): Promise<TurboBalanceResponse>;
|
46
|
+
getWincForFiat({ amount, promoCodes, }: TurboWincForFiatParams): Promise<TurboWincForFiatResponse>;
|
47
|
+
createCheckoutSession(params: TurboCheckoutSessionParams): Promise<TurboCheckoutSessionResponse>;
|
40
48
|
}
|
41
49
|
//# sourceMappingURL=payment.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/common/payment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,QAAQ,
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../../src/common/payment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,QAAQ,EAER,yCAAyC,EACzC,sDAAsD,EACtD,oBAAoB,EACpB,0BAA0B,EAC1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AEjC,EACV,GAAmC,EACnC,WAAW,EACX,MAAM,GACP,EAAE,sDAAsD;IAK5C,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAY3C,cAAc,CAAC,EAC1B,MAAM,EACN,UAAe,GAChB,EAAE,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAShD,qBAAqB,CAChC,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,4BAA4B,CAAC;CAMzC"}
|
@@ -14,7 +14,7 @@
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
|
-
import { Currency, TurboAbortSignal, TurboAuthenticatedClientInterface, TurboAuthenticatedPaymentServiceInterface, TurboAuthenticatedUploadServiceInterface, TurboBalanceResponse, TurboCountriesResponse, TurboCurrenciesResponse, TurboFiatToArResponse, TurboFileFactory, TurboPriceResponse, TurboPrivateClientConfiguration, TurboPublicClientConfiguration, TurboRatesResponse, TurboSignedDataItemFactory, TurboUnauthenticatedClientInterface, TurboUnauthenticatedPaymentServiceInterface, TurboUnauthenticatedUploadServiceInterface, TurboUploadDataItemResponse } from '../types.js';
|
17
|
+
import { Currency, TurboAbortSignal, TurboAuthenticatedClientInterface, TurboAuthenticatedPaymentServiceInterface, TurboAuthenticatedUploadServiceInterface, TurboBalanceResponse, TurboCheckoutSessionParams, TurboCheckoutSessionResponse, TurboCountriesResponse, TurboCurrenciesResponse, TurboFiatToArResponse, TurboFileFactory, TurboPriceResponse, TurboPrivateClientConfiguration, TurboPublicClientConfiguration, TurboRatesResponse, TurboSignedDataItemFactory, TurboUnauthenticatedClientInterface, TurboUnauthenticatedPaymentServiceInterface, TurboUnauthenticatedUploadServiceInterface, TurboUploadDataItemResponse, TurboWincForFiatParams, TurboWincForFiatResponse } from '../types.js';
|
18
18
|
export declare class TurboUnauthenticatedClient implements TurboUnauthenticatedClientInterface {
|
19
19
|
protected paymentService: TurboUnauthenticatedPaymentServiceInterface;
|
20
20
|
protected uploadService: TurboUnauthenticatedUploadServiceInterface;
|
@@ -49,14 +49,15 @@ export declare class TurboUnauthenticatedClient implements TurboUnauthenticatedC
|
|
49
49
|
/**
|
50
50
|
* Determines the amount of 'winc' that would be returned for a given currency and amount, including all Turbo cost adjustments and fees.
|
51
51
|
*/
|
52
|
-
getWincForFiat(
|
53
|
-
amount: number;
|
54
|
-
currency: Currency;
|
55
|
-
}): Promise<Omit<TurboPriceResponse, 'adjustments'>>;
|
52
|
+
getWincForFiat(params: TurboWincForFiatParams): Promise<TurboWincForFiatResponse>;
|
56
53
|
/**
|
57
54
|
* Uploads a signed data item to the Turbo Upload Service.
|
58
55
|
*/
|
59
56
|
uploadSignedDataItem({ dataItemStreamFactory, dataItemSizeFactory, signal, }: TurboSignedDataItemFactory & TurboAbortSignal): Promise<TurboUploadDataItemResponse>;
|
57
|
+
/**
|
58
|
+
* Creates a Turbo Checkout Session for a given amount and currency.
|
59
|
+
*/
|
60
|
+
createCheckoutSession(params: TurboCheckoutSessionParams): Promise<TurboCheckoutSessionResponse>;
|
60
61
|
}
|
61
62
|
export declare class TurboAuthenticatedClient extends TurboUnauthenticatedClient implements TurboAuthenticatedClientInterface {
|
62
63
|
protected paymentService: TurboAuthenticatedPaymentServiceInterface;
|
@@ -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,
|
1
|
+
{"version":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EACnB,MAAM,GACP,EAAE,0BAA0B,GAC3B,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAQzD;;OAEG;IACH,qBAAqB,CACnB,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,4BAA4B,CAAC;CAGzC;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;IACH,UAAU,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAI3C;;OAEG;IACH,UAAU,CAAC,EACT,iBAAiB,EACjB,eAAe,EACf,MAAM,GACP,EAAE,gBAAgB,GACjB,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAO1D"}
|
package/lib/types/types.d.ts
CHANGED
@@ -21,13 +21,21 @@ import { IAxiosRetryConfig } from 'axios-retry';
|
|
21
21
|
import { Readable } from 'node:stream';
|
22
22
|
import { ReadableStream } from 'node:stream/web';
|
23
23
|
import winston from 'winston';
|
24
|
+
import { CurrencyMap } from './common/currency.js';
|
24
25
|
import { JWKInterface } from './common/jwk.js';
|
25
26
|
export type Base64String = string;
|
26
27
|
export type PublicArweaveAddress = Base64String;
|
27
28
|
export type TransactionId = Base64String;
|
28
29
|
export type UserAddress = string | PublicArweaveAddress;
|
29
|
-
export type Currency = 'usd' | 'eur' | 'gbp' | 'cad' | 'aud' | '
|
30
|
+
export type Currency = 'usd' | 'eur' | 'gbp' | 'cad' | 'aud' | 'jpy' | 'inr' | 'sgd' | 'hkd' | 'brl';
|
30
31
|
export type Country = 'United States' | 'United Kingdom' | 'Canada';
|
32
|
+
export type Adjustment = {
|
33
|
+
name: string;
|
34
|
+
description: string;
|
35
|
+
operatorMagnitude: number;
|
36
|
+
operator: 'multiply' | 'add';
|
37
|
+
adjustmentAmount: string;
|
38
|
+
};
|
31
39
|
export type CurrencyLimit = {
|
32
40
|
minimumPaymentAmount: number;
|
33
41
|
maximumPaymentAmount: number;
|
@@ -36,7 +44,32 @@ export type CurrencyLimit = {
|
|
36
44
|
};
|
37
45
|
export type TurboPriceResponse = {
|
38
46
|
winc: string;
|
39
|
-
adjustments:
|
47
|
+
adjustments: Adjustment[];
|
48
|
+
};
|
49
|
+
export type TurboWincForFiatResponse = TurboPriceResponse & {
|
50
|
+
paymentAmount: number;
|
51
|
+
quotedPaymentAmount: number;
|
52
|
+
};
|
53
|
+
export type TurboWincForFiatParams = {
|
54
|
+
amount: CurrencyMap;
|
55
|
+
promoCodes?: string[];
|
56
|
+
};
|
57
|
+
export type TurboCheckoutSessionParams = TurboWincForFiatParams & {
|
58
|
+
owner: PublicArweaveAddress;
|
59
|
+
};
|
60
|
+
export type TopUpRawResponse = {
|
61
|
+
topUpQuote: {
|
62
|
+
paymentAmount: number;
|
63
|
+
quotedPaymentAmount: number;
|
64
|
+
winstonCreditAmount: string;
|
65
|
+
};
|
66
|
+
paymentSession: {
|
67
|
+
url: string;
|
68
|
+
};
|
69
|
+
adjustments: Adjustment[];
|
70
|
+
};
|
71
|
+
export type TurboCheckoutSessionResponse = TurboWincForFiatResponse & {
|
72
|
+
url: string;
|
40
73
|
};
|
41
74
|
export type TurboBalanceResponse = Omit<TurboPriceResponse, 'adjustments'>;
|
42
75
|
export type TurboFiatToArResponse = {
|
@@ -128,13 +161,11 @@ export interface TurboUnauthenticatedPaymentServiceInterface {
|
|
128
161
|
currency: Currency;
|
129
162
|
}): Promise<TurboFiatToArResponse>;
|
130
163
|
getFiatRates(): Promise<TurboRatesResponse>;
|
131
|
-
getWincForFiat(
|
132
|
-
amount: number;
|
133
|
-
currency: Currency;
|
134
|
-
}): Promise<Omit<TurboPriceResponse, 'adjustments'>>;
|
164
|
+
getWincForFiat(params: TurboWincForFiatParams): Promise<TurboWincForFiatResponse>;
|
135
165
|
getUploadCosts({ bytes }: {
|
136
166
|
bytes: number[];
|
137
167
|
}): Promise<TurboPriceResponse[]>;
|
168
|
+
createCheckoutSession(params: TurboCheckoutSessionParams): Promise<TurboCheckoutSessionResponse>;
|
138
169
|
}
|
139
170
|
export interface TurboAuthenticatedPaymentServiceInterface extends TurboUnauthenticatedPaymentServiceInterface {
|
140
171
|
getBalance: () => Promise<TurboBalanceResponse>;
|
package/lib/types/types.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAChD,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC;AACzC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,oBAAoB,CAAC;AACxD,MAAM,MAAM,QAAQ,
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,MAAM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