@ardrive/turbo-sdk 1.17.0-alpha.1 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/bundles/web.bundle.min.js +33 -4
- package/lib/cjs/cli/cli.js +5 -0
- package/lib/cjs/cli/commands/index.js +1 -0
- package/lib/cjs/cli/commands/price.js +53 -0
- package/lib/cjs/cli/options.js +5 -0
- package/lib/cjs/common/currency.js +22 -3
- package/lib/cjs/utils/errors.js +7 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +6 -1
- package/lib/esm/cli/commands/index.js +1 -0
- package/lib/esm/cli/commands/price.js +50 -0
- package/lib/esm/cli/options.js +5 -0
- package/lib/esm/common/currency.js +22 -3
- package/lib/esm/utils/errors.js +5 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/index.d.ts +1 -0
- package/lib/types/cli/commands/index.d.ts.map +1 -1
- package/lib/types/cli/commands/price.d.ts +3 -0
- package/lib/types/cli/commands/price.d.ts.map +1 -0
- package/lib/types/cli/options.d.ts +5 -0
- package/lib/types/cli/options.d.ts.map +1 -1
- package/lib/types/cli/types.d.ts +4 -0
- package/lib/types/cli/types.d.ts.map +1 -1
- package/lib/types/common/currency.d.ts +7 -4
- package/lib/types/common/currency.d.ts.map +1 -1
- package/lib/types/utils/errors.d.ts +3 -0
- package/lib/types/utils/errors.d.ts.map +1 -1
- package/lib/types/version.d.ts +1 -1
- package/lib/types/version.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -75,6 +75,7 @@ Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionality for interac
|
|
75
75
|
- [`crypto-fund`](#crypto-fund)
|
76
76
|
- [`upload-folder`](#upload-folder)
|
77
77
|
- [`upload-file`](#upload-file)
|
78
|
+
- [`price`](#price)
|
78
79
|
- [Developers](#developers)
|
79
80
|
- [Requirements](#requirements)
|
80
81
|
- [Setup & Build](#setup--build)
|
@@ -820,6 +821,29 @@ e.g:
|
|
820
821
|
turbo upload-file --file-path '../path/to/my/file.txt' --token ethereum --wallet-file ../path/to/eth/private/key.txt
|
821
822
|
```
|
822
823
|
|
824
|
+
##### `price`
|
825
|
+
|
826
|
+
Get the current credit price estimate from Turbo Payment Service for a given value and price type.
|
827
|
+
|
828
|
+
Command Options:
|
829
|
+
|
830
|
+
- `--value <value>` - Value to get the price for. e.g: 10.50 for $10.50 USD, 1024 for 1 KiB, 1.1 for 1.1 AR
|
831
|
+
- `--type <type>` - Type of price to get. e.g: 'bytes', 'arweave', 'usd', 'kyve'. Default: 'bytes'
|
832
|
+
|
833
|
+
e.g:
|
834
|
+
|
835
|
+
```shell
|
836
|
+
turbo price --value 10.50 --type usd
|
837
|
+
```
|
838
|
+
|
839
|
+
```shell
|
840
|
+
turbo price --value 1024 --type bytes
|
841
|
+
```
|
842
|
+
|
843
|
+
```shell
|
844
|
+
turbo price --value 1.1 --type arweave
|
845
|
+
```
|
846
|
+
|
823
847
|
## Developers
|
824
848
|
|
825
849
|
### Requirements
|
@@ -310504,7 +310504,7 @@ var import_winston = __toESM(require_winston(), 1);
|
|
310504
310504
|
init_dirname();
|
310505
310505
|
init_buffer2();
|
310506
310506
|
init_process2();
|
310507
|
-
var version16 = "1.
|
310507
|
+
var version16 = "1.17.0-alpha.2";
|
310508
310508
|
|
310509
310509
|
// src/common/logger.ts
|
310510
310510
|
var TurboWinstonLogger = class _TurboWinstonLogger {
|
@@ -314606,6 +314606,11 @@ var FailedRequestError = class extends BaseError {
|
|
314606
314606
|
super(`Failed request: ${status}: ${message}`);
|
314607
314607
|
}
|
314608
314608
|
};
|
314609
|
+
var ProvidedInputError = class extends BaseError {
|
314610
|
+
constructor(message) {
|
314611
|
+
super(message ?? `User has provided an invalid input`);
|
314612
|
+
}
|
314613
|
+
};
|
314609
314614
|
|
314610
314615
|
// src/common/http.ts
|
314611
314616
|
var TurboHTTPService = class {
|
@@ -315453,16 +315458,40 @@ init_dirname();
|
|
315453
315458
|
init_buffer2();
|
315454
315459
|
init_process2();
|
315455
315460
|
var ZeroDecimalCurrency = class {
|
315456
|
-
constructor(
|
315457
|
-
this.
|
315461
|
+
constructor(amt, type3) {
|
315462
|
+
this.amt = amt;
|
315458
315463
|
this.type = type3;
|
315464
|
+
if (amt < 0) {
|
315465
|
+
throw new ProvidedInputError(
|
315466
|
+
`${type3} currency amount cannot be negative`
|
315467
|
+
);
|
315468
|
+
}
|
315469
|
+
this.assertDecimalPlaces(amt);
|
315470
|
+
}
|
315471
|
+
assertDecimalPlaces(a8) {
|
315472
|
+
if (a8 % 1 !== 0) {
|
315473
|
+
throw new ProvidedInputError(
|
315474
|
+
`${this.type} currency amount must have zero decimal places`
|
315475
|
+
);
|
315476
|
+
}
|
315477
|
+
}
|
315478
|
+
get amount() {
|
315479
|
+
return this.amt;
|
315459
315480
|
}
|
315460
315481
|
};
|
315461
|
-
var TwoDecimalCurrency = class {
|
315482
|
+
var TwoDecimalCurrency = class extends ZeroDecimalCurrency {
|
315462
315483
|
constructor(a8, type3) {
|
315484
|
+
super(a8, type3);
|
315463
315485
|
this.a = a8;
|
315464
315486
|
this.type = type3;
|
315465
315487
|
}
|
315488
|
+
assertDecimalPlaces(a8) {
|
315489
|
+
if (a8 * 100 % 1 !== 0) {
|
315490
|
+
throw new ProvidedInputError(
|
315491
|
+
`${this.type} currency amount must have two decimal places`
|
315492
|
+
);
|
315493
|
+
}
|
315494
|
+
}
|
315466
315495
|
get amount() {
|
315467
315496
|
return this.a * 100;
|
315468
315497
|
}
|
package/lib/cjs/cli/cli.js
CHANGED
@@ -43,6 +43,11 @@ const utils_js_1 = require("./utils.js");
|
|
43
43
|
(0, utils_js_1.applyOptions)(commander_1.program.command('upload-file').description('Upload a file using Turbo'), options_js_1.uploadFileOptions).action(async (_commandOptions, command) => {
|
44
44
|
await (0, utils_js_1.runCommand)(command, index_js_1.uploadFile);
|
45
45
|
});
|
46
|
+
(0, utils_js_1.applyOptions)(commander_1.program
|
47
|
+
.command('price')
|
48
|
+
.description('Get the current Credits estimate for byte, crypto, or fiat value'), [options_js_1.optionMap.value, options_js_1.optionMap.type]).action(async (_commandOptions, command) => {
|
49
|
+
await (0, utils_js_1.runCommand)(command, index_js_1.price);
|
50
|
+
});
|
46
51
|
if (process.argv[1].includes('bin/turbo') || // Running from global .bin
|
47
52
|
process.argv[1].includes('cli/cli') // Running from source
|
48
53
|
) {
|
@@ -32,6 +32,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
33
33
|
__exportStar(require("./balance.js"), exports);
|
34
34
|
__exportStar(require("./cryptoFund.js"), exports);
|
35
|
+
__exportStar(require("./price.js"), exports);
|
35
36
|
__exportStar(require("./topUp.js"), exports);
|
36
37
|
__exportStar(require("./uploadFile.js"), exports);
|
37
38
|
__exportStar(require("./uploadFolder.js"), exports);
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.price = price;
|
4
|
+
/**
|
5
|
+
* Copyright (C) 2022-2024 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
|
+
const currency_js_1 = require("../../common/currency.js");
|
21
|
+
const index_js_1 = require("../../common/index.js");
|
22
|
+
const factory_js_1 = require("../../node/factory.js");
|
23
|
+
const types_js_1 = require("../../types.js");
|
24
|
+
const utils_js_1 = require("../utils.js");
|
25
|
+
async function price(options) {
|
26
|
+
const value = options.value;
|
27
|
+
if (value === undefined || +value <= 0 || isNaN(+value)) {
|
28
|
+
throw new Error('Must provide a positive number --value to get price');
|
29
|
+
}
|
30
|
+
const type = options.type ?? 'bytes';
|
31
|
+
const winc = await (async () => {
|
32
|
+
if ((0, index_js_1.isTokenType)(type)) {
|
33
|
+
const turbo = factory_js_1.TurboFactory.unauthenticated({
|
34
|
+
...(0, utils_js_1.configFromOptions)(options),
|
35
|
+
token: type,
|
36
|
+
});
|
37
|
+
return (await turbo.getWincForToken({
|
38
|
+
tokenAmount: index_js_1.tokenToBaseMap[type](value),
|
39
|
+
})).winc;
|
40
|
+
}
|
41
|
+
const turbo = factory_js_1.TurboFactory.unauthenticated((0, utils_js_1.configFromOptions)(options));
|
42
|
+
if (type === 'bytes') {
|
43
|
+
return (await turbo.getUploadCosts({ bytes: [+value] }))[0].winc;
|
44
|
+
}
|
45
|
+
if ((0, types_js_1.isCurrency)(type)) {
|
46
|
+
return (await turbo.getWincForFiat({
|
47
|
+
amount: currency_js_1.currencyMap[type](+value),
|
48
|
+
})).winc;
|
49
|
+
}
|
50
|
+
throw new Error(`Invalid price type!\nMust be one of: bytes, ${types_js_1.fiatCurrencyTypes.join(', ') + ' ' + types_js_1.tokenTypes.join(', ')}`);
|
51
|
+
})();
|
52
|
+
console.log(`Current price estimate for ${value} ${type} is ~${(+winc / 1_000_000_000_000).toFixed(12)} Credits`);
|
53
|
+
}
|
package/lib/cjs/cli/options.js
CHANGED
@@ -28,6 +28,11 @@ exports.optionMap = {
|
|
28
28
|
description: 'Fiat currency type to use for the action',
|
29
29
|
default: 'usd',
|
30
30
|
},
|
31
|
+
type: {
|
32
|
+
alias: '--type <priceType>',
|
33
|
+
description: 'Price type for the action. Can be a fiat currency or crypto token or bytes',
|
34
|
+
default: 'bytes',
|
35
|
+
},
|
31
36
|
txId: {
|
32
37
|
alias: '-i, --tx-id <txId>',
|
33
38
|
description: 'Transaction ID or hash to use for action',
|
@@ -1,18 +1,37 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.currencyMap = 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
|
+
const errors_js_1 = require("../utils/errors.js");
|
4
5
|
class ZeroDecimalCurrency {
|
5
|
-
constructor(
|
6
|
-
this.
|
6
|
+
constructor(amt, type) {
|
7
|
+
this.amt = amt;
|
7
8
|
this.type = type;
|
9
|
+
if (amt < 0) {
|
10
|
+
throw new errors_js_1.ProvidedInputError(`${type} currency amount cannot be negative`);
|
11
|
+
}
|
12
|
+
this.assertDecimalPlaces(amt);
|
13
|
+
}
|
14
|
+
assertDecimalPlaces(a) {
|
15
|
+
if (a % 1 !== 0) {
|
16
|
+
throw new errors_js_1.ProvidedInputError(`${this.type} currency amount must have zero decimal places`);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
get amount() {
|
20
|
+
return this.amt;
|
8
21
|
}
|
9
22
|
}
|
10
23
|
exports.ZeroDecimalCurrency = ZeroDecimalCurrency;
|
11
|
-
class TwoDecimalCurrency {
|
24
|
+
class TwoDecimalCurrency extends ZeroDecimalCurrency {
|
12
25
|
constructor(a, type) {
|
26
|
+
super(a, type);
|
13
27
|
this.a = a;
|
14
28
|
this.type = type;
|
15
29
|
}
|
30
|
+
assertDecimalPlaces(a) {
|
31
|
+
if ((a * 100) % 1 !== 0) {
|
32
|
+
throw new errors_js_1.ProvidedInputError(`${this.type} currency amount must have two decimal places`);
|
33
|
+
}
|
34
|
+
}
|
16
35
|
get amount() {
|
17
36
|
return this.a * 100;
|
18
37
|
}
|
package/lib/cjs/utils/errors.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.FailedRequestError = exports.UnauthenticatedRequestError = exports.BaseError = void 0;
|
3
|
+
exports.ProvidedInputError = exports.FailedRequestError = exports.UnauthenticatedRequestError = exports.BaseError = void 0;
|
4
4
|
/**
|
5
5
|
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
6
6
|
*
|
@@ -36,3 +36,9 @@ class FailedRequestError extends BaseError {
|
|
36
36
|
}
|
37
37
|
}
|
38
38
|
exports.FailedRequestError = FailedRequestError;
|
39
|
+
class ProvidedInputError extends BaseError {
|
40
|
+
constructor(message) {
|
41
|
+
super(message ?? `User has provided an invalid input`);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
exports.ProvidedInputError = ProvidedInputError;
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/cli/cli.js
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
// eslint-disable-next-line header/header -- This is a CLI file
|
19
19
|
import { program } from 'commander';
|
20
20
|
import { version } from '../version.js';
|
21
|
-
import { balance, cryptoFund, topUp, uploadFile, uploadFolder, } from './commands/index.js';
|
21
|
+
import { balance, cryptoFund, price, topUp, uploadFile, uploadFolder, } from './commands/index.js';
|
22
22
|
import { globalOptions, optionMap, uploadFileOptions, uploadFolderOptions, walletOptions, } from './options.js';
|
23
23
|
import { applyOptions, runCommand } from './utils.js';
|
24
24
|
applyOptions(program
|
@@ -41,6 +41,11 @@ applyOptions(program.command('upload-folder').description('Upload a folder using
|
|
41
41
|
applyOptions(program.command('upload-file').description('Upload a file using Turbo'), uploadFileOptions).action(async (_commandOptions, command) => {
|
42
42
|
await runCommand(command, uploadFile);
|
43
43
|
});
|
44
|
+
applyOptions(program
|
45
|
+
.command('price')
|
46
|
+
.description('Get the current Credits estimate for byte, crypto, or fiat value'), [optionMap.value, optionMap.type]).action(async (_commandOptions, command) => {
|
47
|
+
await runCommand(command, price);
|
48
|
+
});
|
44
49
|
if (process.argv[1].includes('bin/turbo') || // Running from global .bin
|
45
50
|
process.argv[1].includes('cli/cli') // Running from source
|
46
51
|
) {
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (C) 2022-2024 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 { currencyMap } from '../../common/currency.js';
|
18
|
+
import { isTokenType, tokenToBaseMap } from '../../common/index.js';
|
19
|
+
import { TurboFactory } from '../../node/factory.js';
|
20
|
+
import { fiatCurrencyTypes, isCurrency, tokenTypes } from '../../types.js';
|
21
|
+
import { configFromOptions } from '../utils.js';
|
22
|
+
export async function price(options) {
|
23
|
+
const value = options.value;
|
24
|
+
if (value === undefined || +value <= 0 || isNaN(+value)) {
|
25
|
+
throw new Error('Must provide a positive number --value to get price');
|
26
|
+
}
|
27
|
+
const type = options.type ?? 'bytes';
|
28
|
+
const winc = await (async () => {
|
29
|
+
if (isTokenType(type)) {
|
30
|
+
const turbo = TurboFactory.unauthenticated({
|
31
|
+
...configFromOptions(options),
|
32
|
+
token: type,
|
33
|
+
});
|
34
|
+
return (await turbo.getWincForToken({
|
35
|
+
tokenAmount: tokenToBaseMap[type](value),
|
36
|
+
})).winc;
|
37
|
+
}
|
38
|
+
const turbo = TurboFactory.unauthenticated(configFromOptions(options));
|
39
|
+
if (type === 'bytes') {
|
40
|
+
return (await turbo.getUploadCosts({ bytes: [+value] }))[0].winc;
|
41
|
+
}
|
42
|
+
if (isCurrency(type)) {
|
43
|
+
return (await turbo.getWincForFiat({
|
44
|
+
amount: currencyMap[type](+value),
|
45
|
+
})).winc;
|
46
|
+
}
|
47
|
+
throw new Error(`Invalid price type!\nMust be one of: bytes, ${fiatCurrencyTypes.join(', ') + ' ' + tokenTypes.join(', ')}`);
|
48
|
+
})();
|
49
|
+
console.log(`Current price estimate for ${value} ${type} is ~${(+winc / 1_000_000_000_000).toFixed(12)} Credits`);
|
50
|
+
}
|
package/lib/esm/cli/options.js
CHANGED
@@ -25,6 +25,11 @@ export const optionMap = {
|
|
25
25
|
description: 'Fiat currency type to use for the action',
|
26
26
|
default: 'usd',
|
27
27
|
},
|
28
|
+
type: {
|
29
|
+
alias: '--type <priceType>',
|
30
|
+
description: 'Price type for the action. Can be a fiat currency or crypto token or bytes',
|
31
|
+
default: 'bytes',
|
32
|
+
},
|
28
33
|
txId: {
|
29
34
|
alias: '-i, --tx-id <txId>',
|
30
35
|
description: 'Transaction ID or hash to use for action',
|
@@ -1,14 +1,33 @@
|
|
1
|
+
import { ProvidedInputError } from '../utils/errors.js';
|
1
2
|
export class ZeroDecimalCurrency {
|
2
|
-
constructor(
|
3
|
-
this.
|
3
|
+
constructor(amt, type) {
|
4
|
+
this.amt = amt;
|
4
5
|
this.type = type;
|
6
|
+
if (amt < 0) {
|
7
|
+
throw new ProvidedInputError(`${type} currency amount cannot be negative`);
|
8
|
+
}
|
9
|
+
this.assertDecimalPlaces(amt);
|
10
|
+
}
|
11
|
+
assertDecimalPlaces(a) {
|
12
|
+
if (a % 1 !== 0) {
|
13
|
+
throw new ProvidedInputError(`${this.type} currency amount must have zero decimal places`);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
get amount() {
|
17
|
+
return this.amt;
|
5
18
|
}
|
6
19
|
}
|
7
|
-
export class TwoDecimalCurrency {
|
20
|
+
export class TwoDecimalCurrency extends ZeroDecimalCurrency {
|
8
21
|
constructor(a, type) {
|
22
|
+
super(a, type);
|
9
23
|
this.a = a;
|
10
24
|
this.type = type;
|
11
25
|
}
|
26
|
+
assertDecimalPlaces(a) {
|
27
|
+
if ((a * 100) % 1 !== 0) {
|
28
|
+
throw new ProvidedInputError(`${this.type} currency amount must have two decimal places`);
|
29
|
+
}
|
30
|
+
}
|
12
31
|
get amount() {
|
13
32
|
return this.a * 100;
|
14
33
|
}
|
package/lib/esm/utils/errors.js
CHANGED
package/lib/esm/version.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/price.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,iBA8ChD"}
|
@@ -25,6 +25,11 @@ export declare const optionMap: {
|
|
25
25
|
readonly description: "Fiat currency type to use for the action";
|
26
26
|
readonly default: "usd";
|
27
27
|
};
|
28
|
+
readonly type: {
|
29
|
+
readonly alias: "--type <priceType>";
|
30
|
+
readonly description: "Price type for the action. Can be a fiat currency or crypto token or bytes";
|
31
|
+
readonly default: "bytes";
|
32
|
+
};
|
28
33
|
readonly txId: {
|
29
34
|
readonly alias: "-i, --tx-id <txId>";
|
30
35
|
readonly description: "Transaction ID or hash to use for action";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/cli/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,SAAS
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/cli/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiGZ,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;IAIzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;IAOzB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;IAO/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;IAAyC,CAAC"}
|
package/lib/types/cli/types.d.ts
CHANGED
@@ -44,6 +44,10 @@ export type UploadFolderOptions = WalletOptions & {
|
|
44
44
|
export type UploadFileOptions = WalletOptions & {
|
45
45
|
filePath: string | undefined;
|
46
46
|
};
|
47
|
+
export type PriceOptions = GlobalOptions & {
|
48
|
+
value: string | undefined;
|
49
|
+
type: string | undefined;
|
50
|
+
};
|
47
51
|
export type CryptoFundOptions = WalletOptions & {
|
48
52
|
value: string | undefined;
|
49
53
|
txId: string | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/types.ts"],"names":[],"mappings":"AAAA;;;;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,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG;IAC9C,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,CAAC"}
|
@@ -20,14 +20,17 @@ export interface CurrencyMap {
|
|
20
20
|
type: Currency;
|
21
21
|
}
|
22
22
|
export declare class ZeroDecimalCurrency implements CurrencyMap {
|
23
|
-
readonly
|
23
|
+
private readonly amt;
|
24
24
|
readonly type: Currency;
|
25
|
-
constructor(
|
25
|
+
constructor(amt: number, type: Currency);
|
26
|
+
protected assertDecimalPlaces(a: number): void;
|
27
|
+
get amount(): number;
|
26
28
|
}
|
27
|
-
export declare class TwoDecimalCurrency
|
28
|
-
private a;
|
29
|
+
export declare class TwoDecimalCurrency extends ZeroDecimalCurrency {
|
30
|
+
private readonly a;
|
29
31
|
readonly type: Currency;
|
30
32
|
constructor(a: number, type: Currency);
|
33
|
+
protected assertDecimalPlaces(a: number): void;
|
31
34
|
get amount(): number;
|
32
35
|
}
|
33
36
|
export declare const USD: (usd: number) => TwoDecimalCurrency;
|
@@ -1 +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;
|
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;AAGvC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,qBAAa,mBAAoB,YAAW,WAAW;IAEnD,OAAO,CAAC,QAAQ,CAAC,GAAG;aACJ,IAAI,EAAE,QAAQ;gBADb,GAAG,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ;IAUhC,SAAS,CAAC,mBAAmB,CAAC,CAAC,EAAE,MAAM;IAQvC,IAAW,MAAM,WAEhB;CACF;AAED,qBAAa,kBAAmB,SAAQ,mBAAmB;IAEvD,OAAO,CAAC,QAAQ,CAAC,CAAC;aACF,IAAI,EAAE,QAAQ;gBADb,CAAC,EAAE,MAAM,EACV,IAAI,EAAE,QAAQ;IAKhC,SAAS,CAAC,mBAAmB,CAAC,CAAC,EAAE,MAAM;IAQvC,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;AAExE,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,WAAW,CAWzE,CAAC"}
|
@@ -23,4 +23,7 @@ export declare class UnauthenticatedRequestError extends BaseError {
|
|
23
23
|
export declare class FailedRequestError extends BaseError {
|
24
24
|
constructor(status: number, message: string);
|
25
25
|
}
|
26
|
+
export declare class ProvidedInputError extends BaseError {
|
27
|
+
constructor(message?: string);
|
28
|
+
}
|
26
29
|
//# sourceMappingURL=errors.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,2BAA4B,SAAQ,SAAS;;CAIzD;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAG5C"}
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,2BAA4B,SAAQ,SAAS;;CAIzD;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAG5C;AAED,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,OAAO,CAAC,EAAE,MAAM;CAG7B"}
|
package/lib/types/version.d.ts
CHANGED
@@ -14,5 +14,5 @@
|
|
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
|
-
export declare const version = "1.
|
17
|
+
export declare const version = "1.17.0-alpha.2";
|
18
18
|
//# sourceMappingURL=version.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,eAAO,MAAM,OAAO,
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,eAAO,MAAM,OAAO,mBAAmB,CAAC"}
|