@ardrive/turbo-sdk 1.13.0-alpha.1 → 1.13.0-alpha.3

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.
@@ -18,4 +18,4 @@
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.version = void 0;
20
20
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
21
- exports.version = '1.13.0-alpha.1';
21
+ exports.version = '1.13.0-alpha.3';
@@ -18,20 +18,19 @@
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 { cryptoFund, getBalance } from './commands.js';
22
- import { applyOptions, configFromOptions, globalOptions, optionMap, privateKeyFromOptions, tokenFromOptions, valueFromOptions, walletOptions, } from './utils.js';
21
+ import { cryptoFund, getBalance, topUp, uploadFolder } from './commands.js';
22
+ import { globalOptions, optionMap, uploadFolderOptions, walletOptions, } from './options.js';
23
+ import { applyOptions, configFromOptions, exitWithErrorLog, privateKeyFromOptions, runCommand, tokenFromOptions, valueFromOptions, } from './utils.js';
23
24
  applyOptions(program
24
25
  .name('turbo')
25
26
  .version(version)
26
27
  .description('Turbo CLI')
27
28
  .helpCommand(true), globalOptions);
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);
29
+ applyOptions(program.command('balance').description('Get balance of a Turbo address'), [optionMap.address, ...walletOptions]).action(async (_commandOptions, command) => {
30
+ await runCommand(command, getBalance);
32
31
  });
33
- applyOptions(program.command('top-up').description('Top up a Turbo address with Fiat'), [optionMap.address, optionMap.value, optionMap.token]).action((options) => {
34
- console.log('TODO: fiat top-up', options.address, options.token, options.value);
32
+ applyOptions(program.command('top-up').description('Top up a Turbo address with Fiat'), [...walletOptions, optionMap.address, optionMap.value, optionMap.currency]).action(async (_commandOptions, command) => {
33
+ await runCommand(command, topUp);
35
34
  });
36
35
  applyOptions(program.command('crypto-fund').description('Top up a wallet with crypto'), [...walletOptions, optionMap.value]).action(async (_commandOptions, command) => {
37
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -40,13 +39,16 @@ applyOptions(program.command('crypto-fund').description('Top up a wallet with cr
40
39
  const value = valueFromOptions(options);
41
40
  const privateKey = await privateKeyFromOptions(options);
42
41
  const config = configFromOptions(options);
43
- cryptoFund({ privateKey, value, token, config });
42
+ try {
43
+ await cryptoFund({ privateKey, value, token, config });
44
+ process.exit(0);
45
+ }
46
+ catch (error) {
47
+ exitWithErrorLog(error);
48
+ }
44
49
  });
45
- applyOptions(program
46
- .command('upload-folder')
47
- .description('Upload a folder to a Turbo address')
48
- .argument('<folderPath>', 'Directory to upload'), [...walletOptions, optionMap.token]).action((directory, options) => {
49
- console.log('upload-folder TODO', directory, options);
50
+ applyOptions(program.command('upload-folder').description('Upload a folder using Turbo'), uploadFolderOptions).action(async (_commandOptions, command) => {
51
+ await runCommand(command, uploadFolder);
50
52
  });
51
53
  if (process.argv[1].includes('bin/turbo') || // Running from global .bin
52
54
  process.argv[1].includes('cli/cli') // Running from source
@@ -14,19 +14,22 @@
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, tokenToBaseMap, } from '../node/index.js';
18
- import { configFromOptions, optionalPrivateKeyFromOptions } from './utils.js';
17
+ import { exec } from 'node:child_process';
18
+ import { TurboFactory, currencyMap, fiatCurrencyTypes, isCurrency, tokenToBaseMap, } from '../node/index.js';
19
+ import { sleep } from '../utils/common.js';
20
+ import { version } from '../version.js';
21
+ import { addressOrPrivateKeyFromOptions, configFromOptions, getUploadFolderOptions, privateKeyFromOptions, } from './utils.js';
19
22
  export async function getBalance(options) {
20
23
  const config = configFromOptions(options);
21
- if (options.address !== undefined) {
24
+ const { address, privateKey } = await addressOrPrivateKeyFromOptions(options);
25
+ if (address !== undefined) {
22
26
  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}`);
27
+ const { winc } = await turbo.getBalance(address);
28
+ console.log(`Turbo Balance for Native Address "${address}"\nCredits: ${+winc / 1_000_000_000_000}`);
25
29
  return;
26
30
  }
27
- const privateKey = await optionalPrivateKeyFromOptions(options);
28
31
  if (privateKey === undefined) {
29
- throw new Error('Must provide an address (--address) or use a valid wallet');
32
+ throw new Error('Must provide an (--address) or use a valid wallet');
30
33
  }
31
34
  const turbo = TurboFactory.authenticated({
32
35
  ...config,
@@ -47,3 +50,82 @@ export async function cryptoFund({ value, privateKey, token, config, }) {
47
50
  });
48
51
  console.log('Sent crypto fund transaction: \n', JSON.stringify(result, null, 2));
49
52
  }
53
+ export async function topUp(options) {
54
+ const config = configFromOptions(options);
55
+ const { address, privateKey } = await addressOrPrivateKeyFromOptions(options);
56
+ const value = options.value;
57
+ if (value === undefined) {
58
+ throw new Error('Must provide a --value to top up');
59
+ }
60
+ const currency = (options.currency ?? 'usd').toLowerCase();
61
+ if (!isCurrency(currency)) {
62
+ throw new Error(`Invalid fiat currency type ${currency}!\nPlease use one of these:\n${JSON.stringify(fiatCurrencyTypes, null, 2)}`);
63
+ }
64
+ // TODO: Pay in CLI prompts via --cli options
65
+ const { url, paymentAmount, winc } = await (async () => {
66
+ const amount = currencyMap[currency](+value);
67
+ if (address !== undefined) {
68
+ const turbo = TurboFactory.unauthenticated(config);
69
+ return turbo.createCheckoutSession({
70
+ amount,
71
+ owner: address,
72
+ });
73
+ }
74
+ if (privateKey === undefined) {
75
+ throw new Error('Must provide a wallet to top up');
76
+ }
77
+ const turbo = TurboFactory.authenticated({
78
+ ...config,
79
+ privateKey,
80
+ });
81
+ return turbo.createCheckoutSession({
82
+ amount,
83
+ owner: await turbo.signer.getNativeAddress(),
84
+ });
85
+ })();
86
+ if (url === undefined) {
87
+ throw new Error('Failed to create checkout session');
88
+ }
89
+ console.log('Got Checkout Session\n' + JSON.stringify({ url, paymentAmount, winc }));
90
+ console.log('Opening checkout session in browser...');
91
+ await sleep(2000);
92
+ openUrl(url);
93
+ }
94
+ export function openUrl(url) {
95
+ if (process.platform === 'darwin') {
96
+ // macOS
97
+ exec(`open ${url}`);
98
+ }
99
+ else if (process.platform === 'win32') {
100
+ // Windows
101
+ exec(`start "" "${url}"`, { windowsHide: true });
102
+ }
103
+ else {
104
+ // Linux/Unix
105
+ open(url);
106
+ }
107
+ }
108
+ const turboCliTags = [
109
+ { name: 'App-Name', value: 'Turbo-CLI' },
110
+ { name: 'App-Version', value: version },
111
+ { name: 'App-Platform', value: process.platform },
112
+ ];
113
+ export async function uploadFolder(options) {
114
+ const privateKey = await privateKeyFromOptions(options);
115
+ const turbo = TurboFactory.authenticated({
116
+ ...configFromOptions(options),
117
+ privateKey,
118
+ });
119
+ const { disableManifest, fallbackFile, folderPath, indexFile, maxConcurrentUploads, } = getUploadFolderOptions(options);
120
+ const result = await turbo.uploadFolder({
121
+ folderPath: folderPath,
122
+ dataItemOpts: { tags: [...turboCliTags] }, // TODO: Inject user tags
123
+ manifestOptions: {
124
+ disableManifest,
125
+ indexFile,
126
+ fallbackFile,
127
+ },
128
+ maxConcurrentUploads,
129
+ });
130
+ console.log('Uploaded folder:', JSON.stringify(result, null, 2));
131
+ }
@@ -0,0 +1,111 @@
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
+ indexFile: {
75
+ alias: '--index-file <indexFile>',
76
+ description: 'Index file to use in the manifest created for folder upload',
77
+ },
78
+ fallbackFile: {
79
+ alias: '--fallback-file <fallbackFile>',
80
+ description: 'Fallback file to use in the manifest created for folder upload',
81
+ },
82
+ manifest: {
83
+ alias: '--no-manifest',
84
+ description: 'Disable manifest creation with --no-manifest',
85
+ default: false,
86
+ },
87
+ maxConcurrency: {
88
+ alias: '--max-concurrency <maxConcurrency>',
89
+ description: 'Maximum number of concurrent uploads',
90
+ },
91
+ };
92
+ export const walletOptions = [
93
+ optionMap.walletFile,
94
+ optionMap.mnemonic,
95
+ optionMap.privateKey,
96
+ ];
97
+ export const globalOptions = [
98
+ optionMap.dev,
99
+ optionMap.gateway,
100
+ optionMap.debug,
101
+ optionMap.quiet,
102
+ optionMap.token,
103
+ ];
104
+ export const uploadFolderOptions = [
105
+ ...walletOptions,
106
+ optionMap.folderPath,
107
+ optionMap.indexFile,
108
+ optionMap.fallbackFile,
109
+ optionMap.manifest,
110
+ optionMap.maxConcurrency,
111
+ ];
@@ -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';
18
+ import { readFileSync, statSync } from 'fs';
19
19
  import { defaultTurboConfiguration, developmentTurboConfiguration, isTokenType, privateKeyFromKyveMnemonic, } from '../node/index.js';
20
20
  import { NoWalletProvidedError } from './errors.js';
21
- export const optionMap = {
22
- token: {
23
- alias: '-t, --token <type>',
24
- description: 'Token type for wallet or action',
25
- default: 'arweave',
26
- },
27
- currency: {
28
- alias: '-c, --currency <currency>',
29
- description: 'Currency type to top up with',
30
- default: 'usd',
31
- },
32
- address: {
33
- alias: '-a, --address <walletAddress>',
34
- description: 'Wallet address to use for action',
35
- },
36
- value: {
37
- alias: '-v, --value <value>',
38
- description: 'Value of fiat currency or crypto token for action',
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,6 +114,7 @@ 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
119
  export function configFromOptions({ gateway, dev, token, }) {
150
120
  let config = {};
@@ -162,3 +132,12 @@ export function configFromOptions({ gateway, dev, token, }) {
162
132
  config.token = token;
163
133
  return config;
164
134
  }
135
+ export function getUploadFolderOptions(options) {
136
+ return {
137
+ folderPath: options.folderPath,
138
+ indexFile: options.indexFile,
139
+ fallbackFile: options.fallbackFile,
140
+ disableManifest: !options.manifest,
141
+ maxConcurrentUploads: +(options.maxConcurrency ?? 1),
142
+ };
143
+ }
@@ -25,3 +25,15 @@ export const HKD = (hkd) => new TwoDecimalCurrency(hkd, 'hkd');
25
25
  export const BRL = (brl) => new TwoDecimalCurrency(brl, 'brl');
26
26
  // Zero decimal currencies that are supported by the Turbo API
27
27
  export const JPY = (jpy) => new ZeroDecimalCurrency(jpy, 'jpy');
28
+ export const currencyMap = {
29
+ usd: USD,
30
+ eur: EUR,
31
+ gbp: GBP,
32
+ cad: CAD,
33
+ aud: AUD,
34
+ inr: INR,
35
+ sgd: SGD,
36
+ hkd: HKD,
37
+ brl: BRL,
38
+ jpy: JPY,
39
+ };
@@ -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/types.js CHANGED
@@ -1,3 +1,18 @@
1
+ export const fiatCurrencyTypes = [
2
+ 'usd',
3
+ 'eur',
4
+ 'gbp',
5
+ 'cad',
6
+ 'aud',
7
+ 'jpy',
8
+ 'inr',
9
+ 'sgd',
10
+ 'hkd',
11
+ 'brl',
12
+ ];
13
+ export function isCurrency(currency) {
14
+ return fiatCurrencyTypes.includes(currency);
15
+ }
1
16
  export const tokenTypes = ['arweave', 'solana', 'ethereum', 'kyve'];
2
17
  export const isNodeUploadFolderParams = (p) => p.folderPath !== undefined;
3
18
  export const isWebUploadFolderParams = (p) => p.files !== undefined;
@@ -15,4 +15,4 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
18
- export const version = '1.13.0-alpha.1';
18
+ export const version = '1.13.0-alpha.3';
@@ -1,21 +1,5 @@
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
1
  import { TokenType, TurboUnauthenticatedConfiguration, TurboWallet } from '../node/index.js';
18
- import { AddressOptions } from './types.js';
2
+ import { AddressOptions, TopUpOptions, UploadFolderOptions } from './types.js';
19
3
  export declare function getBalance(options: AddressOptions): Promise<void>;
20
4
  export interface CryptoFundParams {
21
5
  token: TokenType;
@@ -25,4 +9,7 @@ export interface CryptoFundParams {
25
9
  }
26
10
  /** Fund the connected signer with crypto */
27
11
  export declare function cryptoFund({ value, privateKey, token, config, }: CryptoFundParams): Promise<void>;
12
+ export declare function topUp(options: TopUpOptions): Promise<void>;
13
+ export declare function openUrl(url: string): void;
14
+ export declare function uploadFolder(options: UploadFolderOptions): Promise<void>;
28
15
  //# sourceMappingURL=commands.d.ts.map
@@ -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,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"}
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,SAAS,EAET,iCAAiC,EACjC,WAAW,EAKZ,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAQ/E,wBAAsB,UAAU,CAAC,OAAO,EAAE,cAAc,iBAgCvD;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;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,CA4Bf"}
@@ -0,0 +1,147 @@
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 indexFile: {
73
+ readonly alias: "--index-file <indexFile>";
74
+ readonly description: "Index file to use in the manifest created for folder upload";
75
+ };
76
+ readonly fallbackFile: {
77
+ readonly alias: "--fallback-file <fallbackFile>";
78
+ readonly description: "Fallback file to use in the manifest created for folder upload";
79
+ };
80
+ readonly manifest: {
81
+ readonly alias: "--no-manifest";
82
+ readonly description: "Disable manifest creation with --no-manifest";
83
+ readonly default: false;
84
+ };
85
+ readonly maxConcurrency: {
86
+ readonly alias: "--max-concurrency <maxConcurrency>";
87
+ readonly description: "Maximum number of concurrent uploads";
88
+ };
89
+ };
90
+ export declare const walletOptions: ({
91
+ readonly alias: "-w, --wallet-file <filePath>";
92
+ 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";
93
+ } | {
94
+ readonly alias: "-m, --mnemonic <phrase>";
95
+ readonly description: "Mnemonic to use with the action";
96
+ } | {
97
+ readonly alias: "-p, --private-key <key>";
98
+ readonly description: "Private key to use with the action";
99
+ })[];
100
+ export declare const globalOptions: ({
101
+ readonly alias: "-t, --token <type>";
102
+ readonly description: "Crypto token type for wallet or action";
103
+ readonly default: "arweave";
104
+ } | {
105
+ readonly alias: "-g, --gateway <url>";
106
+ readonly description: "Set a custom crypto gateway URL";
107
+ readonly default: undefined;
108
+ } | {
109
+ readonly alias: "--dev";
110
+ readonly description: "Enable development endpoints";
111
+ readonly default: false;
112
+ } | {
113
+ readonly alias: "--debug";
114
+ readonly description: "Enable verbose logging";
115
+ readonly default: false;
116
+ } | {
117
+ readonly alias: "--quiet";
118
+ readonly description: "Disable logging";
119
+ readonly default: false;
120
+ })[];
121
+ export declare const uploadFolderOptions: ({
122
+ readonly alias: "-w, --wallet-file <filePath>";
123
+ 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";
124
+ } | {
125
+ readonly alias: "-m, --mnemonic <phrase>";
126
+ readonly description: "Mnemonic to use with the action";
127
+ } | {
128
+ readonly alias: "-p, --private-key <key>";
129
+ readonly description: "Private key to use with the action";
130
+ } | {
131
+ readonly alias: "-f, --folder-path <folderPath>";
132
+ readonly description: "Directory to upload";
133
+ } | {
134
+ readonly alias: "--index-file <indexFile>";
135
+ readonly description: "Index file to use in the manifest created for folder upload";
136
+ } | {
137
+ readonly alias: "--fallback-file <fallbackFile>";
138
+ readonly description: "Fallback file to use in the manifest created for folder upload";
139
+ } | {
140
+ readonly alias: "--no-manifest";
141
+ readonly description: "Disable manifest creation with --no-manifest";
142
+ readonly default: false;
143
+ } | {
144
+ readonly alias: "--max-concurrency <maxConcurrency>";
145
+ readonly description: "Maximum number of concurrent uploads";
146
+ })[];
147
+ //# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EZ,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;IAIzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;IAMzB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;IAO/B,CAAC"}