@ardrive/turbo-sdk 1.13.0 → 1.14.0-alpha.2
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 +34 -0
- package/bundles/web.bundle.min.js +1 -1
- package/lib/cjs/cli/cli.js +13 -43
- package/lib/cjs/cli/commands.js +48 -19
- package/lib/cjs/cli/options.js +119 -0
- package/lib/cjs/cli/types.js +16 -0
- package/lib/cjs/cli/utils.js +67 -72
- package/lib/cjs/node/upload.js +3 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +11 -41
- package/lib/esm/cli/commands.js +45 -17
- package/lib/esm/cli/options.js +116 -0
- package/lib/esm/cli/types.js +16 -0
- package/lib/esm/cli/utils.js +63 -73
- package/lib/esm/node/upload.js +3 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands.d.ts +4 -13
- package/lib/types/cli/commands.d.ts.map +1 -1
- package/lib/types/cli/options.d.ts +164 -0
- package/lib/types/cli/options.d.ts.map +1 -0
- package/lib/types/cli/types.d.ts +14 -2
- package/lib/types/cli/types.d.ts.map +1 -1
- package/lib/types/cli/utils.d.ts +19 -87
- package/lib/types/cli/utils.d.ts.map +1 -1
- package/lib/types/node/upload.d.ts.map +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/esm/cli/commands.js
CHANGED
@@ -15,18 +15,11 @@
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
17
|
import { exec } from 'node:child_process';
|
18
|
+
import { createReadStream, statSync } from 'node:fs';
|
18
19
|
import { TurboFactory, currencyMap, fiatCurrencyTypes, isCurrency, tokenToBaseMap, } from '../node/index.js';
|
19
20
|
import { sleep } from '../utils/common.js';
|
20
|
-
import {
|
21
|
-
|
22
|
-
if (options.address !== undefined) {
|
23
|
-
return { address: options.address, privateKey: undefined };
|
24
|
-
}
|
25
|
-
return {
|
26
|
-
address: undefined,
|
27
|
-
privateKey: await optionalPrivateKeyFromOptions(options),
|
28
|
-
};
|
29
|
-
}
|
21
|
+
import { version } from '../version.js';
|
22
|
+
import { addressOrPrivateKeyFromOptions, configFromOptions, getUploadFolderOptions, tokenFromOptions, turboFromOptions, } from './utils.js';
|
30
23
|
export async function getBalance(options) {
|
31
24
|
const config = configFromOptions(options);
|
32
25
|
const { address, privateKey } = await addressOrPrivateKeyFromOptions(options);
|
@@ -47,13 +40,14 @@ export async function getBalance(options) {
|
|
47
40
|
console.log(`Turbo Balance for Wallet Address "${await turbo.signer.getNativeAddress()}"\nCredits: ${+winc / 1_000_000_000_000}`);
|
48
41
|
}
|
49
42
|
/** Fund the connected signer with crypto */
|
50
|
-
export async function cryptoFund(
|
51
|
-
const
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
const
|
43
|
+
export async function cryptoFund(options) {
|
44
|
+
const value = options.value;
|
45
|
+
if (value === undefined) {
|
46
|
+
throw new Error('Must provide a --value to top up');
|
47
|
+
}
|
48
|
+
const turbo = await turboFromOptions(options);
|
49
|
+
const token = tokenFromOptions(options);
|
50
|
+
const result = await turbo.topUpWithTokens({
|
57
51
|
tokenAmount: tokenToBaseMap[token](value),
|
58
52
|
});
|
59
53
|
console.log('Sent crypto fund transaction: \n', JSON.stringify(result, null, 2));
|
@@ -113,3 +107,37 @@ export function openUrl(url) {
|
|
113
107
|
open(url);
|
114
108
|
}
|
115
109
|
}
|
110
|
+
const turboCliTags = [
|
111
|
+
{ name: 'App-Name', value: 'Turbo-CLI' },
|
112
|
+
{ name: 'App-Version', value: version },
|
113
|
+
{ name: 'App-Platform', value: process.platform },
|
114
|
+
];
|
115
|
+
export async function uploadFolder(options) {
|
116
|
+
const turbo = await turboFromOptions(options);
|
117
|
+
const { disableManifest, fallbackFile, folderPath, indexFile, maxConcurrentUploads, } = getUploadFolderOptions(options);
|
118
|
+
const result = await turbo.uploadFolder({
|
119
|
+
folderPath: folderPath,
|
120
|
+
dataItemOpts: { tags: [...turboCliTags] }, // TODO: Inject user tags
|
121
|
+
manifestOptions: {
|
122
|
+
disableManifest,
|
123
|
+
indexFile,
|
124
|
+
fallbackFile,
|
125
|
+
},
|
126
|
+
maxConcurrentUploads,
|
127
|
+
});
|
128
|
+
console.log('Uploaded folder:', JSON.stringify(result, null, 2));
|
129
|
+
}
|
130
|
+
export async function uploadFile(options) {
|
131
|
+
const { filePath } = options;
|
132
|
+
if (filePath === undefined) {
|
133
|
+
throw new Error('Must provide a --file-path to upload');
|
134
|
+
}
|
135
|
+
const turbo = await turboFromOptions(options);
|
136
|
+
const fileSize = statSync(filePath).size;
|
137
|
+
const result = await turbo.uploadFile({
|
138
|
+
fileStreamFactory: () => createReadStream(filePath),
|
139
|
+
fileSizeFactory: () => fileSize,
|
140
|
+
dataItemOpts: { tags: [...turboCliTags] }, // TODO: Inject user tags
|
141
|
+
});
|
142
|
+
console.log('Uploaded file:', JSON.stringify(result, null, 2));
|
143
|
+
}
|
@@ -0,0 +1,116 @@
|
|
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
|
+
export const optionMap = {
|
18
|
+
token: {
|
19
|
+
alias: '-t, --token <type>',
|
20
|
+
description: 'Crypto token type for wallet or action',
|
21
|
+
default: 'arweave',
|
22
|
+
},
|
23
|
+
currency: {
|
24
|
+
alias: '-c, --currency <currency>',
|
25
|
+
description: 'Fiat currency type to use for the action',
|
26
|
+
default: 'usd',
|
27
|
+
},
|
28
|
+
address: {
|
29
|
+
alias: '-a, --address <nativeAddress>',
|
30
|
+
description: 'Native address to use for action',
|
31
|
+
},
|
32
|
+
value: {
|
33
|
+
alias: '-v, --value <value>',
|
34
|
+
description: 'Value of fiat currency or crypto token for action. e.g: 10.50 for $10.50 USD or 0.0001 for 0.0001 AR',
|
35
|
+
},
|
36
|
+
walletFile: {
|
37
|
+
alias: '-w, --wallet-file <filePath>',
|
38
|
+
description: 'Wallet file to use with the action. Formats accepted: JWK.json, KYVE or ETH private key as a string, or SOL Secret Key as a Uint8Array',
|
39
|
+
},
|
40
|
+
mnemonic: {
|
41
|
+
alias: '-m, --mnemonic <phrase>',
|
42
|
+
description: 'Mnemonic to use with the action',
|
43
|
+
},
|
44
|
+
privateKey: {
|
45
|
+
alias: '-p, --private-key <key>',
|
46
|
+
description: 'Private key to use with the action',
|
47
|
+
},
|
48
|
+
gateway: {
|
49
|
+
alias: '-g, --gateway <url>',
|
50
|
+
description: 'Set a custom crypto gateway URL',
|
51
|
+
default: undefined,
|
52
|
+
},
|
53
|
+
dev: {
|
54
|
+
alias: '--dev',
|
55
|
+
description: 'Enable development endpoints',
|
56
|
+
default: false,
|
57
|
+
},
|
58
|
+
debug: {
|
59
|
+
// TODO: Implement
|
60
|
+
alias: '--debug',
|
61
|
+
description: 'Enable verbose logging',
|
62
|
+
default: false,
|
63
|
+
},
|
64
|
+
quiet: {
|
65
|
+
// TODO: Implement
|
66
|
+
alias: '--quiet',
|
67
|
+
description: 'Disable logging',
|
68
|
+
default: false,
|
69
|
+
},
|
70
|
+
folderPath: {
|
71
|
+
alias: '-f, --folder-path <folderPath>',
|
72
|
+
description: 'Directory to upload',
|
73
|
+
},
|
74
|
+
filePath: {
|
75
|
+
alias: '-f, --file-path <filePath>',
|
76
|
+
description: 'File to upload',
|
77
|
+
},
|
78
|
+
indexFile: {
|
79
|
+
alias: '--index-file <indexFile>',
|
80
|
+
description: 'Index file to use in the manifest created for folder upload',
|
81
|
+
},
|
82
|
+
fallbackFile: {
|
83
|
+
alias: '--fallback-file <fallbackFile>',
|
84
|
+
description: 'Fallback file to use in the manifest created for folder upload',
|
85
|
+
},
|
86
|
+
manifest: {
|
87
|
+
alias: '--no-manifest',
|
88
|
+
description: 'Disable manifest creation with --no-manifest',
|
89
|
+
default: true,
|
90
|
+
},
|
91
|
+
maxConcurrency: {
|
92
|
+
alias: '--max-concurrency <maxConcurrency>',
|
93
|
+
description: 'Maximum number of concurrent uploads',
|
94
|
+
},
|
95
|
+
};
|
96
|
+
export const walletOptions = [
|
97
|
+
optionMap.walletFile,
|
98
|
+
optionMap.mnemonic,
|
99
|
+
optionMap.privateKey,
|
100
|
+
];
|
101
|
+
export const globalOptions = [
|
102
|
+
optionMap.dev,
|
103
|
+
optionMap.gateway,
|
104
|
+
optionMap.debug,
|
105
|
+
optionMap.quiet,
|
106
|
+
optionMap.token,
|
107
|
+
];
|
108
|
+
export const uploadFolderOptions = [
|
109
|
+
...walletOptions,
|
110
|
+
optionMap.folderPath,
|
111
|
+
optionMap.indexFile,
|
112
|
+
optionMap.fallbackFile,
|
113
|
+
optionMap.manifest,
|
114
|
+
optionMap.maxConcurrency,
|
115
|
+
];
|
116
|
+
export const uploadFileOptions = [...walletOptions, optionMap.filePath];
|
package/lib/esm/cli/types.js
CHANGED
@@ -1 +1,17 @@
|
|
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
|
+
*/
|
1
17
|
export {};
|
package/lib/esm/cli/utils.js
CHANGED
@@ -15,75 +15,23 @@
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
*/
|
17
17
|
import bs58 from 'bs58';
|
18
|
-
import { readFileSync } from 'fs';
|
19
|
-
import { defaultTurboConfiguration, developmentTurboConfiguration, isTokenType, privateKeyFromKyveMnemonic, } from '../node/index.js';
|
18
|
+
import { readFileSync, statSync } from 'fs';
|
19
|
+
import { TurboFactory, defaultTurboConfiguration, developmentTurboConfiguration, isTokenType, privateKeyFromKyveMnemonic, } from '../node/index.js';
|
20
20
|
import { NoWalletProvidedError } from './errors.js';
|
21
|
-
export
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
},
|
36
|
-
value: {
|
37
|
-
alias: '-v, --value <value>',
|
38
|
-
description: 'Value of fiat currency or crypto token for action. e.g: 10.50 for $10.50 USD or 0.0001 for 0.0001 AR',
|
39
|
-
},
|
40
|
-
walletFile: {
|
41
|
-
alias: '-w, --wallet-file <filePath>',
|
42
|
-
description: 'Wallet file to use with the action. Formats accepted: JWK.json, KYVE or ETH private key as a string, or SOL Secret Key as a Uint8Array',
|
43
|
-
},
|
44
|
-
mnemonic: {
|
45
|
-
alias: '-m, --mnemonic <phrase>',
|
46
|
-
description: 'Mnemonic to use with the action',
|
47
|
-
},
|
48
|
-
privateKey: {
|
49
|
-
alias: '-p, --private-key <key>',
|
50
|
-
description: 'Private key to use with the action',
|
51
|
-
},
|
52
|
-
gateway: {
|
53
|
-
alias: '-g, --gateway <url>',
|
54
|
-
description: 'Set a custom crypto gateway URL',
|
55
|
-
default: undefined,
|
56
|
-
},
|
57
|
-
dev: {
|
58
|
-
alias: '--dev',
|
59
|
-
description: 'Enable development endpoints',
|
60
|
-
default: false,
|
61
|
-
},
|
62
|
-
debug: {
|
63
|
-
// TODO: Implement
|
64
|
-
alias: '--debug',
|
65
|
-
description: 'Enable verbose logging',
|
66
|
-
default: false,
|
67
|
-
},
|
68
|
-
quiet: {
|
69
|
-
// TODO: Implement
|
70
|
-
alias: '--quiet',
|
71
|
-
description: 'Disable logging',
|
72
|
-
default: false,
|
73
|
-
},
|
74
|
-
};
|
75
|
-
export const walletOptions = [
|
76
|
-
optionMap.walletFile,
|
77
|
-
optionMap.mnemonic,
|
78
|
-
optionMap.privateKey,
|
79
|
-
];
|
80
|
-
export const globalOptions = [
|
81
|
-
optionMap.dev,
|
82
|
-
optionMap.gateway,
|
83
|
-
optionMap.debug,
|
84
|
-
optionMap.quiet,
|
85
|
-
optionMap.token,
|
86
|
-
];
|
21
|
+
export function exitWithErrorLog(error) {
|
22
|
+
console.error(error instanceof Error ? error.message : error);
|
23
|
+
process.exit(1);
|
24
|
+
}
|
25
|
+
export async function runCommand(command, action) {
|
26
|
+
const options = command.optsWithGlobals();
|
27
|
+
try {
|
28
|
+
await action(options);
|
29
|
+
process.exit(0);
|
30
|
+
}
|
31
|
+
catch (error) {
|
32
|
+
exitWithErrorLog(error);
|
33
|
+
}
|
34
|
+
}
|
87
35
|
export function applyOptions(command, options) {
|
88
36
|
[...options].forEach((option) => {
|
89
37
|
command.option(option.alias, option.description, option.default);
|
@@ -107,6 +55,27 @@ export function valueFromOptions(options) {
|
|
107
55
|
}
|
108
56
|
return value;
|
109
57
|
}
|
58
|
+
export function getFolderPathFromOptions(options) {
|
59
|
+
const folderPath = options.folderPath;
|
60
|
+
if (folderPath === undefined) {
|
61
|
+
throw new Error('Folder path is required. Use --folderPath <path>');
|
62
|
+
}
|
63
|
+
// Check if path exists and is a directory
|
64
|
+
const stats = statSync(folderPath);
|
65
|
+
if (!stats.isDirectory()) {
|
66
|
+
throw new Error('Folder path is not a directory');
|
67
|
+
}
|
68
|
+
return folderPath;
|
69
|
+
}
|
70
|
+
export async function addressOrPrivateKeyFromOptions(options) {
|
71
|
+
if (options.address !== undefined) {
|
72
|
+
return { address: options.address, privateKey: undefined };
|
73
|
+
}
|
74
|
+
return {
|
75
|
+
address: undefined,
|
76
|
+
privateKey: await optionalPrivateKeyFromOptions(options),
|
77
|
+
};
|
78
|
+
}
|
110
79
|
export async function optionalPrivateKeyFromOptions(options) {
|
111
80
|
try {
|
112
81
|
const key = await privateKeyFromOptions(options);
|
@@ -145,10 +114,13 @@ const tokenToDevGatewayMap = {
|
|
145
114
|
solana: 'https://api.devnet.solana.com',
|
146
115
|
ethereum: 'https://ethereum-holesky-rpc.publicnode.com',
|
147
116
|
kyve: 'https://api.korellia.kyve.network',
|
117
|
+
// matic: 'https://rpc-amoy.polygon.technology',
|
148
118
|
};
|
149
|
-
export function configFromOptions(
|
119
|
+
export function configFromOptions(options) {
|
150
120
|
let config = {};
|
151
|
-
|
121
|
+
const token = tokenFromOptions(options);
|
122
|
+
config.token = token;
|
123
|
+
if (options.dev) {
|
152
124
|
config = developmentTurboConfiguration;
|
153
125
|
config.gatewayUrl = tokenToDevGatewayMap[token];
|
154
126
|
}
|
@@ -156,9 +128,27 @@ export function configFromOptions({ gateway, dev, token, }) {
|
|
156
128
|
config = defaultTurboConfiguration;
|
157
129
|
}
|
158
130
|
// If gateway is provided, override the default or dev gateway
|
159
|
-
if (gateway !== undefined) {
|
160
|
-
config.gatewayUrl = gateway;
|
131
|
+
if (options.gateway !== undefined) {
|
132
|
+
config.gatewayUrl = options.gateway;
|
161
133
|
}
|
162
|
-
config.token = token;
|
163
134
|
return config;
|
164
135
|
}
|
136
|
+
export async function turboFromOptions(options) {
|
137
|
+
const privateKey = await privateKeyFromOptions(options);
|
138
|
+
return TurboFactory.authenticated({
|
139
|
+
...configFromOptions(options),
|
140
|
+
privateKey,
|
141
|
+
});
|
142
|
+
}
|
143
|
+
export function getUploadFolderOptions(options) {
|
144
|
+
if (options.folderPath === undefined) {
|
145
|
+
throw new Error('--folder-path is required');
|
146
|
+
}
|
147
|
+
return {
|
148
|
+
folderPath: options.folderPath,
|
149
|
+
indexFile: options.indexFile,
|
150
|
+
fallbackFile: options.fallbackFile,
|
151
|
+
disableManifest: !options.manifest,
|
152
|
+
maxConcurrentUploads: +(options.maxConcurrency ?? 1),
|
153
|
+
};
|
154
|
+
}
|
package/lib/esm/node/upload.js
CHANGED
@@ -29,6 +29,9 @@ export class TurboAuthenticatedUploadService extends TurboAuthenticatedBaseUploa
|
|
29
29
|
// Walk the directory and add all file paths to the array
|
30
30
|
const files = await promises.readdir(folderPath);
|
31
31
|
for (const file of files) {
|
32
|
+
if (file === '.DS_Store') {
|
33
|
+
continue;
|
34
|
+
}
|
32
35
|
const absoluteFilePath = join(folderPath, file);
|
33
36
|
const stat = await promises.stat(absoluteFilePath);
|
34
37
|
if (stat.isDirectory()) {
|
package/lib/esm/version.js
CHANGED
@@ -1,18 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
import { AddressOptions, TopUpOptions } from './types.js';
|
3
|
-
export declare function addressOrPrivateKeyFromOptions(options: AddressOptions): Promise<{
|
4
|
-
address: string | undefined;
|
5
|
-
privateKey: string | undefined;
|
6
|
-
}>;
|
1
|
+
import { AddressOptions, CryptoFundOptions, TopUpOptions, UploadFileOptions, UploadFolderOptions } from './types.js';
|
7
2
|
export declare function getBalance(options: AddressOptions): Promise<void>;
|
8
|
-
export interface CryptoFundParams {
|
9
|
-
token: TokenType;
|
10
|
-
value: string;
|
11
|
-
privateKey: TurboWallet;
|
12
|
-
config: TurboUnauthenticatedConfiguration;
|
13
|
-
}
|
14
3
|
/** Fund the connected signer with crypto */
|
15
|
-
export declare function cryptoFund(
|
4
|
+
export declare function cryptoFund(options: CryptoFundOptions): Promise<void>;
|
16
5
|
export declare function topUp(options: TopUpOptions): Promise<void>;
|
17
6
|
export declare function openUrl(url: string): void;
|
7
|
+
export declare function uploadFolder(options: UploadFolderOptions): Promise<void>;
|
8
|
+
export declare function uploadFile(options: UploadFileOptions): Promise<void>;
|
18
9
|
//# sourceMappingURL=commands.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands.ts"],"names":[],"mappings":"AA4BA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AASpB,wBAAsB,UAAU,CAAC,OAAO,EAAE,cAAc,iBAgCvD;AAED,4CAA4C;AAC5C,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,iBAkB1D;AAED,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,iBA4DhD;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,QAWlC;AAQD,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB1E"}
|
@@ -0,0 +1,164 @@
|
|
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
|
+
export declare const optionMap: {
|
18
|
+
readonly token: {
|
19
|
+
readonly alias: "-t, --token <type>";
|
20
|
+
readonly description: "Crypto token type for wallet or action";
|
21
|
+
readonly default: "arweave";
|
22
|
+
};
|
23
|
+
readonly currency: {
|
24
|
+
readonly alias: "-c, --currency <currency>";
|
25
|
+
readonly description: "Fiat currency type to use for the action";
|
26
|
+
readonly default: "usd";
|
27
|
+
};
|
28
|
+
readonly address: {
|
29
|
+
readonly alias: "-a, --address <nativeAddress>";
|
30
|
+
readonly description: "Native address to use for action";
|
31
|
+
};
|
32
|
+
readonly value: {
|
33
|
+
readonly alias: "-v, --value <value>";
|
34
|
+
readonly description: "Value of fiat currency or crypto token for action. e.g: 10.50 for $10.50 USD or 0.0001 for 0.0001 AR";
|
35
|
+
};
|
36
|
+
readonly walletFile: {
|
37
|
+
readonly alias: "-w, --wallet-file <filePath>";
|
38
|
+
readonly description: "Wallet file to use with the action. Formats accepted: JWK.json, KYVE or ETH private key as a string, or SOL Secret Key as a Uint8Array";
|
39
|
+
};
|
40
|
+
readonly mnemonic: {
|
41
|
+
readonly alias: "-m, --mnemonic <phrase>";
|
42
|
+
readonly description: "Mnemonic to use with the action";
|
43
|
+
};
|
44
|
+
readonly privateKey: {
|
45
|
+
readonly alias: "-p, --private-key <key>";
|
46
|
+
readonly description: "Private key to use with the action";
|
47
|
+
};
|
48
|
+
readonly gateway: {
|
49
|
+
readonly alias: "-g, --gateway <url>";
|
50
|
+
readonly description: "Set a custom crypto gateway URL";
|
51
|
+
readonly default: undefined;
|
52
|
+
};
|
53
|
+
readonly dev: {
|
54
|
+
readonly alias: "--dev";
|
55
|
+
readonly description: "Enable development endpoints";
|
56
|
+
readonly default: false;
|
57
|
+
};
|
58
|
+
readonly debug: {
|
59
|
+
readonly alias: "--debug";
|
60
|
+
readonly description: "Enable verbose logging";
|
61
|
+
readonly default: false;
|
62
|
+
};
|
63
|
+
readonly quiet: {
|
64
|
+
readonly alias: "--quiet";
|
65
|
+
readonly description: "Disable logging";
|
66
|
+
readonly default: false;
|
67
|
+
};
|
68
|
+
readonly folderPath: {
|
69
|
+
readonly alias: "-f, --folder-path <folderPath>";
|
70
|
+
readonly description: "Directory to upload";
|
71
|
+
};
|
72
|
+
readonly filePath: {
|
73
|
+
readonly alias: "-f, --file-path <filePath>";
|
74
|
+
readonly description: "File to upload";
|
75
|
+
};
|
76
|
+
readonly indexFile: {
|
77
|
+
readonly alias: "--index-file <indexFile>";
|
78
|
+
readonly description: "Index file to use in the manifest created for folder upload";
|
79
|
+
};
|
80
|
+
readonly fallbackFile: {
|
81
|
+
readonly alias: "--fallback-file <fallbackFile>";
|
82
|
+
readonly description: "Fallback file to use in the manifest created for folder upload";
|
83
|
+
};
|
84
|
+
readonly manifest: {
|
85
|
+
readonly alias: "--no-manifest";
|
86
|
+
readonly description: "Disable manifest creation with --no-manifest";
|
87
|
+
readonly default: true;
|
88
|
+
};
|
89
|
+
readonly maxConcurrency: {
|
90
|
+
readonly alias: "--max-concurrency <maxConcurrency>";
|
91
|
+
readonly description: "Maximum number of concurrent uploads";
|
92
|
+
};
|
93
|
+
};
|
94
|
+
export declare const walletOptions: ({
|
95
|
+
readonly alias: "-w, --wallet-file <filePath>";
|
96
|
+
readonly description: "Wallet file to use with the action. Formats accepted: JWK.json, KYVE or ETH private key as a string, or SOL Secret Key as a Uint8Array";
|
97
|
+
} | {
|
98
|
+
readonly alias: "-m, --mnemonic <phrase>";
|
99
|
+
readonly description: "Mnemonic to use with the action";
|
100
|
+
} | {
|
101
|
+
readonly alias: "-p, --private-key <key>";
|
102
|
+
readonly description: "Private key to use with the action";
|
103
|
+
})[];
|
104
|
+
export declare const globalOptions: ({
|
105
|
+
readonly alias: "-t, --token <type>";
|
106
|
+
readonly description: "Crypto token type for wallet or action";
|
107
|
+
readonly default: "arweave";
|
108
|
+
} | {
|
109
|
+
readonly alias: "-g, --gateway <url>";
|
110
|
+
readonly description: "Set a custom crypto gateway URL";
|
111
|
+
readonly default: undefined;
|
112
|
+
} | {
|
113
|
+
readonly alias: "--dev";
|
114
|
+
readonly description: "Enable development endpoints";
|
115
|
+
readonly default: false;
|
116
|
+
} | {
|
117
|
+
readonly alias: "--debug";
|
118
|
+
readonly description: "Enable verbose logging";
|
119
|
+
readonly default: false;
|
120
|
+
} | {
|
121
|
+
readonly alias: "--quiet";
|
122
|
+
readonly description: "Disable logging";
|
123
|
+
readonly default: false;
|
124
|
+
})[];
|
125
|
+
export declare const uploadFolderOptions: ({
|
126
|
+
readonly alias: "-w, --wallet-file <filePath>";
|
127
|
+
readonly description: "Wallet file to use with the action. Formats accepted: JWK.json, KYVE or ETH private key as a string, or SOL Secret Key as a Uint8Array";
|
128
|
+
} | {
|
129
|
+
readonly alias: "-m, --mnemonic <phrase>";
|
130
|
+
readonly description: "Mnemonic to use with the action";
|
131
|
+
} | {
|
132
|
+
readonly alias: "-p, --private-key <key>";
|
133
|
+
readonly description: "Private key to use with the action";
|
134
|
+
} | {
|
135
|
+
readonly alias: "-f, --folder-path <folderPath>";
|
136
|
+
readonly description: "Directory to upload";
|
137
|
+
} | {
|
138
|
+
readonly alias: "--index-file <indexFile>";
|
139
|
+
readonly description: "Index file to use in the manifest created for folder upload";
|
140
|
+
} | {
|
141
|
+
readonly alias: "--fallback-file <fallbackFile>";
|
142
|
+
readonly description: "Fallback file to use in the manifest created for folder upload";
|
143
|
+
} | {
|
144
|
+
readonly alias: "--no-manifest";
|
145
|
+
readonly description: "Disable manifest creation with --no-manifest";
|
146
|
+
readonly default: true;
|
147
|
+
} | {
|
148
|
+
readonly alias: "--max-concurrency <maxConcurrency>";
|
149
|
+
readonly description: "Maximum number of concurrent uploads";
|
150
|
+
})[];
|
151
|
+
export declare const uploadFileOptions: ({
|
152
|
+
readonly alias: "-w, --wallet-file <filePath>";
|
153
|
+
readonly description: "Wallet file to use with the action. Formats accepted: JWK.json, KYVE or ETH private key as a string, or SOL Secret Key as a Uint8Array";
|
154
|
+
} | {
|
155
|
+
readonly alias: "-m, --mnemonic <phrase>";
|
156
|
+
readonly description: "Mnemonic to use with the action";
|
157
|
+
} | {
|
158
|
+
readonly alias: "-p, --private-key <key>";
|
159
|
+
readonly description: "Private key to use with the action";
|
160
|
+
} | {
|
161
|
+
readonly alias: "-f, --file-path <filePath>";
|
162
|
+
readonly description: "File to upload";
|
163
|
+
})[];
|
164
|
+
//# sourceMappingURL=options.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/cli/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFZ,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;IAIzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;IAMzB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;IAO/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;IAAyC,CAAC"}
|
package/lib/types/cli/types.d.ts
CHANGED
@@ -14,13 +14,12 @@
|
|
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 { TokenType } from '../types.js';
|
18
17
|
export type GlobalOptions = {
|
19
18
|
dev: boolean;
|
20
19
|
gateway: string | undefined;
|
21
20
|
debug: boolean;
|
22
21
|
quiet: boolean;
|
23
|
-
token:
|
22
|
+
token: string;
|
24
23
|
};
|
25
24
|
export type WalletOptions = GlobalOptions & {
|
26
25
|
walletFile: string | undefined;
|
@@ -34,4 +33,17 @@ export type TopUpOptions = AddressOptions & {
|
|
34
33
|
value: string | undefined;
|
35
34
|
currency: string | undefined;
|
36
35
|
};
|
36
|
+
export type UploadFolderOptions = WalletOptions & {
|
37
|
+
folderPath: string | undefined;
|
38
|
+
indexFile: string | undefined;
|
39
|
+
fallbackFile: string | undefined;
|
40
|
+
manifest: boolean;
|
41
|
+
maxConcurrency: number | undefined;
|
42
|
+
};
|
43
|
+
export type UploadFileOptions = WalletOptions & {
|
44
|
+
filePath: string | undefined;
|
45
|
+
};
|
46
|
+
export type CryptoFundOptions = WalletOptions & {
|
47
|
+
value: string | undefined;
|
48
|
+
};
|
37
49
|
//# sourceMappingURL=types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,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,MAAM,CAAC;CACf,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;AAEF,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG;IAC1C,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAChD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG;IAC9C,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG;IAC9C,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC"}
|