@ardrive/turbo-sdk 1.12.0 → 1.13.0-alpha.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.
- package/README.md +19 -0
- package/bundles/web.bundle.min.js +8 -3
- package/lib/cjs/cli/cli.js +5 -3
- package/lib/cjs/cli/commands.js +17 -11
- package/lib/cjs/cli/errors.js +26 -0
- package/lib/cjs/cli/types.js +2 -0
- package/lib/cjs/cli/utils.js +17 -2
- package/lib/cjs/utils/errors.js +10 -5
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +5 -3
- package/lib/esm/cli/commands.js +18 -12
- package/lib/esm/cli/errors.js +22 -0
- package/lib/esm/cli/types.js +1 -0
- package/lib/esm/cli/utils.js +16 -2
- package/lib/esm/utils/errors.js +8 -4
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands.d.ts +2 -1
- package/lib/types/cli/commands.d.ts.map +1 -1
- package/lib/types/cli/errors.d.ts +21 -0
- package/lib/types/cli/errors.d.ts.map +1 -0
- package/lib/types/cli/types.d.ts +33 -0
- package/lib/types/cli/types.d.ts.map +1 -0
- package/lib/types/cli/utils.d.ts +4 -10
- package/lib/types/cli/utils.d.ts.map +1 -1
- package/lib/types/utils/errors.d.ts +5 -2
- 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
@@ -67,6 +67,7 @@ Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionality for interac
|
|
67
67
|
- [Options](#options)
|
68
68
|
- [Commands](#commands)
|
69
69
|
- [`crypto-fund`](#crypto-fund)
|
70
|
+
- [`balance`](#balance)
|
70
71
|
- [Developers](#developers)
|
71
72
|
- [Requirements](#requirements)
|
72
73
|
- [Setup & Build](#setup--build)
|
@@ -700,6 +701,24 @@ e.g:
|
|
700
701
|
turbo crypto-fund --value 0.0001 --token kyve --private-key 'b27...45c'
|
701
702
|
```
|
702
703
|
|
704
|
+
##### `balance`
|
705
|
+
|
706
|
+
Get the balance of a wallet or native address in Turbo Credits.
|
707
|
+
|
708
|
+
Command Options:
|
709
|
+
|
710
|
+
- `-a, --address <address>` - Address to get the balance of
|
711
|
+
|
712
|
+
e.g:
|
713
|
+
|
714
|
+
```shell
|
715
|
+
turbo balance --address 'crypto-wallet-public-native-address'
|
716
|
+
```
|
717
|
+
|
718
|
+
```shell
|
719
|
+
turbo balance --wallet-file '../path/to/my/wallet.json'
|
720
|
+
```
|
721
|
+
|
703
722
|
## Developers
|
704
723
|
|
705
724
|
### Requirements
|
@@ -312251,7 +312251,7 @@ var import_winston = __toESM(require_winston(), 1);
|
|
312251
312251
|
init_dirname();
|
312252
312252
|
init_buffer2();
|
312253
312253
|
init_process2();
|
312254
|
-
var version16 = "1.12.0
|
312254
|
+
var version16 = "1.12.0";
|
312255
312255
|
|
312256
312256
|
// src/common/logger.ts
|
312257
312257
|
var TurboWinstonLogger = class _TurboWinstonLogger {
|
@@ -316343,10 +316343,15 @@ var createAxiosInstance = ({
|
|
316343
316343
|
init_dirname();
|
316344
316344
|
init_buffer2();
|
316345
316345
|
init_process2();
|
316346
|
-
var
|
316346
|
+
var BaseError = class extends Error {
|
316347
|
+
constructor(message) {
|
316348
|
+
super(message);
|
316349
|
+
this.name = this.constructor.name;
|
316350
|
+
}
|
316351
|
+
};
|
316352
|
+
var FailedRequestError = class extends BaseError {
|
316347
316353
|
constructor(status, message) {
|
316348
316354
|
super(`Failed request: ${status}: ${message}`);
|
316349
|
-
this.name = "FailedRequestError";
|
316350
316355
|
}
|
316351
316356
|
};
|
316352
316357
|
|
package/lib/cjs/cli/cli.js
CHANGED
@@ -27,8 +27,10 @@ const utils_js_1 = require("./utils.js");
|
|
27
27
|
.version(version_js_1.version)
|
28
28
|
.description('Turbo CLI')
|
29
29
|
.helpCommand(true), utils_js_1.globalOptions);
|
30
|
-
(0, utils_js_1.applyOptions)(commander_1.program.command('
|
31
|
-
|
30
|
+
(0, utils_js_1.applyOptions)(commander_1.program.command('balance').description('Get balance of a Turbo address'), [utils_js_1.optionMap.address, utils_js_1.optionMap.token, ...utils_js_1.walletOptions]).action(async (_commandOptions, command) => {
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
32
|
+
const options = command.optsWithGlobals();
|
33
|
+
return (0, commands_js_1.getBalance)(options);
|
32
34
|
});
|
33
35
|
(0, utils_js_1.applyOptions)(commander_1.program.command('top-up').description('Top up a Turbo address with Fiat'), [utils_js_1.optionMap.address, utils_js_1.optionMap.value, utils_js_1.optionMap.token]).action((options) => {
|
34
36
|
console.log('TODO: fiat top-up', options.address, options.token, options.value);
|
@@ -38,7 +40,7 @@ const utils_js_1 = require("./utils.js");
|
|
38
40
|
const options = command.optsWithGlobals();
|
39
41
|
const token = (0, utils_js_1.tokenFromOptions)(options);
|
40
42
|
const value = (0, utils_js_1.valueFromOptions)(options);
|
41
|
-
const privateKey = await (0, utils_js_1.privateKeyFromOptions)(options
|
43
|
+
const privateKey = await (0, utils_js_1.privateKeyFromOptions)(options);
|
42
44
|
const config = (0, utils_js_1.configFromOptions)(options);
|
43
45
|
(0, commands_js_1.cryptoFund)({ privateKey, value, token, config });
|
44
46
|
});
|
package/lib/cjs/cli/commands.js
CHANGED
@@ -19,19 +19,25 @@ exports.cryptoFund = cryptoFund;
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20
20
|
*/
|
21
21
|
const index_js_1 = require("../node/index.js");
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
const utils_js_1 = require("./utils.js");
|
23
|
+
async function getBalance(options) {
|
24
|
+
const config = (0, utils_js_1.configFromOptions)(options);
|
25
|
+
if (options.address !== undefined) {
|
26
|
+
const turbo = index_js_1.TurboFactory.unauthenticated(config);
|
27
|
+
const { winc } = await turbo.getBalance(options.address);
|
28
|
+
console.log(`Turbo Balance for Native Address "${options.address}"\nCredits: ${+winc / 1_000_000_000_000}`);
|
29
|
+
return;
|
25
30
|
}
|
26
|
-
const
|
27
|
-
|
31
|
+
const privateKey = await (0, utils_js_1.optionalPrivateKeyFromOptions)(options);
|
32
|
+
if (privateKey === undefined) {
|
33
|
+
throw new Error('Must provide an address (--address) or use a valid wallet');
|
34
|
+
}
|
35
|
+
const turbo = index_js_1.TurboFactory.authenticated({
|
36
|
+
...config,
|
37
|
+
privateKey,
|
28
38
|
});
|
29
|
-
|
30
|
-
|
31
|
-
// owner: address,
|
32
|
-
// });
|
33
|
-
// TODO: Implement unauthenticated getBalance
|
34
|
-
console.log('TODO: Get balance for', address);
|
39
|
+
const { winc } = await turbo.getBalance();
|
40
|
+
console.log(`Turbo Balance for Wallet Address "${await turbo.signer.getNativeAddress()}"\nCredits: ${+winc / 1_000_000_000_000}`);
|
35
41
|
}
|
36
42
|
/** Fund the connected signer with crypto */
|
37
43
|
async function cryptoFund({ value, privateKey, token, config, }) {
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.NoWalletProvidedError = void 0;
|
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 errors_js_1 = require("../utils/errors.js");
|
21
|
+
class NoWalletProvidedError extends errors_js_1.BaseError {
|
22
|
+
constructor() {
|
23
|
+
super('mnemonic or wallet file or private key is required');
|
24
|
+
}
|
25
|
+
}
|
26
|
+
exports.NoWalletProvidedError = NoWalletProvidedError;
|
package/lib/cjs/cli/utils.js
CHANGED
@@ -7,6 +7,7 @@ exports.globalOptions = exports.walletOptions = exports.optionMap = void 0;
|
|
7
7
|
exports.applyOptions = applyOptions;
|
8
8
|
exports.tokenFromOptions = tokenFromOptions;
|
9
9
|
exports.valueFromOptions = valueFromOptions;
|
10
|
+
exports.optionalPrivateKeyFromOptions = optionalPrivateKeyFromOptions;
|
10
11
|
exports.privateKeyFromOptions = privateKeyFromOptions;
|
11
12
|
exports.configFromOptions = configFromOptions;
|
12
13
|
/**
|
@@ -28,6 +29,7 @@ exports.configFromOptions = configFromOptions;
|
|
28
29
|
const bs58_1 = __importDefault(require("bs58"));
|
29
30
|
const fs_1 = require("fs");
|
30
31
|
const index_js_1 = require("../node/index.js");
|
32
|
+
const errors_js_1 = require("./errors.js");
|
31
33
|
exports.optionMap = {
|
32
34
|
token: {
|
33
35
|
alias: '-t, --token <type>',
|
@@ -117,7 +119,19 @@ function valueFromOptions(options) {
|
|
117
119
|
}
|
118
120
|
return value;
|
119
121
|
}
|
120
|
-
async function
|
122
|
+
async function optionalPrivateKeyFromOptions(options) {
|
123
|
+
try {
|
124
|
+
const key = await privateKeyFromOptions(options);
|
125
|
+
return key;
|
126
|
+
}
|
127
|
+
catch (error) {
|
128
|
+
if (error instanceof errors_js_1.NoWalletProvidedError) {
|
129
|
+
return undefined;
|
130
|
+
}
|
131
|
+
throw error;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
async function privateKeyFromOptions({ mnemonic, privateKey, walletFile, token, }) {
|
121
135
|
if (mnemonic !== undefined) {
|
122
136
|
if (token === 'kyve') {
|
123
137
|
return (0, index_js_1.privateKeyFromKyveMnemonic)(mnemonic);
|
@@ -136,7 +150,7 @@ async function privateKeyFromOptions({ mnemonic, privateKey, walletFile, }, toke
|
|
136
150
|
}
|
137
151
|
// TODO: Get TURBO_WALLET_FILE, TURBO_MNEMONIC, TURBO_PRIVATE_KEY or similar from ENV variables
|
138
152
|
// TODO: Add prompts for selecting wallet type and secure input
|
139
|
-
throw new
|
153
|
+
throw new errors_js_1.NoWalletProvidedError();
|
140
154
|
}
|
141
155
|
const tokenToDevGatewayMap = {
|
142
156
|
arweave: 'https://arweave.net', // No arweave test net
|
@@ -157,5 +171,6 @@ function configFromOptions({ gateway, dev, token, }) {
|
|
157
171
|
if (gateway !== undefined) {
|
158
172
|
config.gatewayUrl = gateway;
|
159
173
|
}
|
174
|
+
config.token = token;
|
160
175
|
return config;
|
161
176
|
}
|
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 = void 0;
|
3
|
+
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
|
*
|
@@ -17,17 +17,22 @@ exports.FailedRequestError = exports.UnauthenticatedRequestError = void 0;
|
|
17
17
|
* You should have received a copy of the GNU Affero General Public License
|
18
18
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
19
19
|
*/
|
20
|
-
class
|
20
|
+
class BaseError extends Error {
|
21
|
+
constructor(message) {
|
22
|
+
super(message);
|
23
|
+
this.name = this.constructor.name;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
exports.BaseError = BaseError;
|
27
|
+
class UnauthenticatedRequestError extends BaseError {
|
21
28
|
constructor() {
|
22
29
|
super('Failed authentication. JWK is required.');
|
23
|
-
this.name = 'UnauthenticatedRequestError';
|
24
30
|
}
|
25
31
|
}
|
26
32
|
exports.UnauthenticatedRequestError = UnauthenticatedRequestError;
|
27
|
-
class FailedRequestError extends
|
33
|
+
class FailedRequestError extends BaseError {
|
28
34
|
constructor(status, message) {
|
29
35
|
super(`Failed request: ${status}: ${message}`);
|
30
|
-
this.name = 'FailedRequestError';
|
31
36
|
}
|
32
37
|
}
|
33
38
|
exports.FailedRequestError = FailedRequestError;
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/cli/cli.js
CHANGED
@@ -25,8 +25,10 @@ applyOptions(program
|
|
25
25
|
.version(version)
|
26
26
|
.description('Turbo CLI')
|
27
27
|
.helpCommand(true), globalOptions);
|
28
|
-
applyOptions(program.command('
|
29
|
-
|
28
|
+
applyOptions(program.command('balance').description('Get balance of a Turbo address'), [optionMap.address, optionMap.token, ...walletOptions]).action(async (_commandOptions, command) => {
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
30
|
+
const options = command.optsWithGlobals();
|
31
|
+
return getBalance(options);
|
30
32
|
});
|
31
33
|
applyOptions(program.command('top-up').description('Top up a Turbo address with Fiat'), [optionMap.address, optionMap.value, optionMap.token]).action((options) => {
|
32
34
|
console.log('TODO: fiat top-up', options.address, options.token, options.value);
|
@@ -36,7 +38,7 @@ applyOptions(program.command('crypto-fund').description('Top up a wallet with cr
|
|
36
38
|
const options = command.optsWithGlobals();
|
37
39
|
const token = tokenFromOptions(options);
|
38
40
|
const value = valueFromOptions(options);
|
39
|
-
const privateKey = await privateKeyFromOptions(options
|
41
|
+
const privateKey = await privateKeyFromOptions(options);
|
40
42
|
const config = configFromOptions(options);
|
41
43
|
cryptoFund({ privateKey, value, token, config });
|
42
44
|
});
|
package/lib/esm/cli/commands.js
CHANGED
@@ -14,20 +14,26 @@
|
|
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 { TurboFactory,
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
import { TurboFactory, tokenToBaseMap, } from '../node/index.js';
|
18
|
+
import { configFromOptions, optionalPrivateKeyFromOptions } from './utils.js';
|
19
|
+
export async function getBalance(options) {
|
20
|
+
const config = configFromOptions(options);
|
21
|
+
if (options.address !== undefined) {
|
22
|
+
const turbo = TurboFactory.unauthenticated(config);
|
23
|
+
const { winc } = await turbo.getBalance(options.address);
|
24
|
+
console.log(`Turbo Balance for Native Address "${options.address}"\nCredits: ${+winc / 1_000_000_000_000}`);
|
25
|
+
return;
|
21
26
|
}
|
22
|
-
const
|
23
|
-
|
27
|
+
const privateKey = await optionalPrivateKeyFromOptions(options);
|
28
|
+
if (privateKey === undefined) {
|
29
|
+
throw new Error('Must provide an address (--address) or use a valid wallet');
|
30
|
+
}
|
31
|
+
const turbo = TurboFactory.authenticated({
|
32
|
+
...config,
|
33
|
+
privateKey,
|
24
34
|
});
|
25
|
-
|
26
|
-
|
27
|
-
// owner: address,
|
28
|
-
// });
|
29
|
-
// TODO: Implement unauthenticated getBalance
|
30
|
-
console.log('TODO: Get balance for', address);
|
35
|
+
const { winc } = await turbo.getBalance();
|
36
|
+
console.log(`Turbo Balance for Wallet Address "${await turbo.signer.getNativeAddress()}"\nCredits: ${+winc / 1_000_000_000_000}`);
|
31
37
|
}
|
32
38
|
/** Fund the connected signer with crypto */
|
33
39
|
export async function cryptoFund({ value, privateKey, token, config, }) {
|
@@ -0,0 +1,22 @@
|
|
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 { BaseError } from '../utils/errors.js';
|
18
|
+
export class NoWalletProvidedError extends BaseError {
|
19
|
+
constructor() {
|
20
|
+
super('mnemonic or wallet file or private key is required');
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/lib/esm/cli/utils.js
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
import bs58 from 'bs58';
|
18
18
|
import { readFileSync } from 'fs';
|
19
19
|
import { defaultTurboConfiguration, developmentTurboConfiguration, isTokenType, privateKeyFromKyveMnemonic, } from '../node/index.js';
|
20
|
+
import { NoWalletProvidedError } from './errors.js';
|
20
21
|
export const optionMap = {
|
21
22
|
token: {
|
22
23
|
alias: '-t, --token <type>',
|
@@ -106,7 +107,19 @@ export function valueFromOptions(options) {
|
|
106
107
|
}
|
107
108
|
return value;
|
108
109
|
}
|
109
|
-
export async function
|
110
|
+
export async function optionalPrivateKeyFromOptions(options) {
|
111
|
+
try {
|
112
|
+
const key = await privateKeyFromOptions(options);
|
113
|
+
return key;
|
114
|
+
}
|
115
|
+
catch (error) {
|
116
|
+
if (error instanceof NoWalletProvidedError) {
|
117
|
+
return undefined;
|
118
|
+
}
|
119
|
+
throw error;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
export async function privateKeyFromOptions({ mnemonic, privateKey, walletFile, token, }) {
|
110
123
|
if (mnemonic !== undefined) {
|
111
124
|
if (token === 'kyve') {
|
112
125
|
return privateKeyFromKyveMnemonic(mnemonic);
|
@@ -125,7 +138,7 @@ export async function privateKeyFromOptions({ mnemonic, privateKey, walletFile,
|
|
125
138
|
}
|
126
139
|
// TODO: Get TURBO_WALLET_FILE, TURBO_MNEMONIC, TURBO_PRIVATE_KEY or similar from ENV variables
|
127
140
|
// TODO: Add prompts for selecting wallet type and secure input
|
128
|
-
throw new
|
141
|
+
throw new NoWalletProvidedError();
|
129
142
|
}
|
130
143
|
const tokenToDevGatewayMap = {
|
131
144
|
arweave: 'https://arweave.net', // No arweave test net
|
@@ -146,5 +159,6 @@ export function configFromOptions({ gateway, dev, token, }) {
|
|
146
159
|
if (gateway !== undefined) {
|
147
160
|
config.gatewayUrl = gateway;
|
148
161
|
}
|
162
|
+
config.token = token;
|
149
163
|
return config;
|
150
164
|
}
|
package/lib/esm/utils/errors.js
CHANGED
@@ -14,15 +14,19 @@
|
|
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 class
|
17
|
+
export class BaseError extends Error {
|
18
|
+
constructor(message) {
|
19
|
+
super(message);
|
20
|
+
this.name = this.constructor.name;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
export class UnauthenticatedRequestError extends BaseError {
|
18
24
|
constructor() {
|
19
25
|
super('Failed authentication. JWK is required.');
|
20
|
-
this.name = 'UnauthenticatedRequestError';
|
21
26
|
}
|
22
27
|
}
|
23
|
-
export class FailedRequestError extends
|
28
|
+
export class FailedRequestError extends BaseError {
|
24
29
|
constructor(status, message) {
|
25
30
|
super(`Failed request: ${status}: ${message}`);
|
26
|
-
this.name = 'FailedRequestError';
|
27
31
|
}
|
28
32
|
}
|
package/lib/esm/version.js
CHANGED
@@ -15,7 +15,8 @@
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
17
|
import { TokenType, TurboUnauthenticatedConfiguration, TurboWallet } from '../node/index.js';
|
18
|
-
|
18
|
+
import { AddressOptions } from './types.js';
|
19
|
+
export declare function getBalance(options: AddressOptions): Promise<void>;
|
19
20
|
export interface CryptoFundParams {
|
20
21
|
token: TokenType;
|
21
22
|
value: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,SAAS,EAET,iCAAiC,EACjC,WAAW,
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,SAAS,EAET,iCAAiC,EACjC,WAAW,EAEZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,wBAAsB,UAAU,CAAC,OAAO,EAAE,cAAc,iBAkCvD;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,WAAW,CAAC;IACxB,MAAM,EAAE,iCAAiC,CAAC;CAC3C;AACD,4CAA4C;AAC5C,wBAAsB,UAAU,CAAC,EAC/B,KAAK,EACL,UAAU,EACV,KAAK,EACL,MAAM,GACP,EAAE,gBAAgB,iBAelB"}
|
@@ -0,0 +1,21 @@
|
|
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 { BaseError } from '../utils/errors.js';
|
18
|
+
export declare class NoWalletProvidedError extends BaseError {
|
19
|
+
constructor();
|
20
|
+
}
|
21
|
+
//# sourceMappingURL=errors.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/cli/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,qBAAa,qBAAsB,SAAQ,SAAS;;CAInD"}
|
@@ -0,0 +1,33 @@
|
|
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 { TokenType } from '../types.js';
|
18
|
+
export type GlobalOptions = {
|
19
|
+
dev: boolean;
|
20
|
+
gateway: string | undefined;
|
21
|
+
debug: boolean;
|
22
|
+
quiet: boolean;
|
23
|
+
token: TokenType;
|
24
|
+
};
|
25
|
+
export type WalletOptions = GlobalOptions & {
|
26
|
+
walletFile: string | undefined;
|
27
|
+
mnemonic: string | undefined;
|
28
|
+
privateKey: string | undefined;
|
29
|
+
};
|
30
|
+
export type AddressOptions = WalletOptions & {
|
31
|
+
address: string | undefined;
|
32
|
+
};
|
33
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAC1C,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG;IAC3C,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC"}
|
package/lib/types/cli/utils.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Command } from 'commander';
|
2
2
|
import { TokenType, TurboUnauthenticatedConfiguration } from '../node/index.js';
|
3
|
+
import { GlobalOptions, WalletOptions } from './types.js';
|
3
4
|
interface CommanderOption {
|
4
5
|
alias: string;
|
5
6
|
description: string;
|
@@ -91,15 +92,8 @@ export declare const globalOptions: ({
|
|
91
92
|
export declare function applyOptions(command: Command, options: CommanderOption[]): Command;
|
92
93
|
export declare function tokenFromOptions(options: unknown): TokenType;
|
93
94
|
export declare function valueFromOptions(options: unknown): string;
|
94
|
-
export declare function
|
95
|
-
|
96
|
-
|
97
|
-
privateKey: string | undefined;
|
98
|
-
}, token: TokenType): Promise<string>;
|
99
|
-
export declare function configFromOptions({ gateway, dev, token, }: {
|
100
|
-
gateway: string | undefined;
|
101
|
-
dev: boolean | undefined;
|
102
|
-
token: TokenType;
|
103
|
-
}): TurboUnauthenticatedConfiguration;
|
95
|
+
export declare function optionalPrivateKeyFromOptions(options: WalletOptions): Promise<string | undefined>;
|
96
|
+
export declare function privateKeyFromOptions({ mnemonic, privateKey, walletFile, token, }: WalletOptions): Promise<string>;
|
97
|
+
export declare function configFromOptions({ gateway, dev, token, }: GlobalOptions): TurboUnauthenticatedConfiguration;
|
104
98
|
export {};
|
105
99
|
//# sourceMappingURL=utils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/cli/utils.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EACL,SAAS,EACT,iCAAiC,EAKlC,MAAM,kBAAkB,CAAC;AAE1B,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDZ,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;IAIzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;IAMzB,CAAC;AAEF,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,eAAe,EAAE,GACzB,OAAO,CAKT;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAU5D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAMzD;AAED,wBAAsB,
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/cli/utils.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EACL,SAAS,EACT,iCAAiC,EAKlC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE1D,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDZ,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;IAIzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;IAMzB,CAAC;AAEF,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,eAAe,EAAE,GACzB,OAAO,CAKT;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAU5D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAMzD;AAED,wBAAsB,6BAA6B,CAAC,OAAO,EAAE,aAAa,+BAUzE;AAED,wBAAsB,qBAAqB,CAAC,EAC1C,QAAQ,EACR,UAAU,EACV,UAAU,EACV,KAAK,GACN,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBjC;AASD,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,GAAG,EACH,KAAK,GACN,EAAE,aAAa,GAAG,iCAAiC,CAkBnD"}
|
@@ -14,10 +14,13 @@
|
|
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 class
|
17
|
+
export declare class BaseError extends Error {
|
18
|
+
constructor(message: string);
|
19
|
+
}
|
20
|
+
export declare class UnauthenticatedRequestError extends BaseError {
|
18
21
|
constructor();
|
19
22
|
}
|
20
|
-
export declare class FailedRequestError extends
|
23
|
+
export declare class FailedRequestError extends BaseError {
|
21
24
|
constructor(status: number, message: string);
|
22
25
|
}
|
23
26
|
//# 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,2BAA4B,SAAQ,
|
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"}
|
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.12.0
|
17
|
+
export declare const version = "1.12.0";
|
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,WAAW,CAAC"}
|