@ardrive/turbo-sdk 1.14.0-alpha.1 → 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 CHANGED
@@ -70,6 +70,7 @@ Welcome to the `@ardrive/turbo-sdk`! This SDK provides functionality for interac
70
70
  - [`top-up`](#top-up)
71
71
  - [`crypto-fund`](#crypto-fund)
72
72
  - [`upload-folder`](#upload-folder)
73
+ - [`upload-file`](#upload-file)
73
74
  - [Developers](#developers)
74
75
  - [Requirements](#requirements)
75
76
  - [Setup & Build](#setup--build)
@@ -756,6 +757,20 @@ e.g:
756
757
  turbo upload-folder --folder-path '../path/to/my/folder' --token solana --wallet-file ../path/to/sol/sec/key.json
757
758
  ```
758
759
 
760
+ ##### `upload-file`
761
+
762
+ Upload a file to the Turbo Upload Service.
763
+
764
+ Command Options:
765
+
766
+ - `-f, --file-path <filePath>` - Path to the file to upload
767
+
768
+ e.g:
769
+
770
+ ```shell
771
+ turbo upload-file --file-path '../path/to/my/file.txt' --token ethereum --wallet-file ../path/to/eth/private/key.txt
772
+ ```
773
+
759
774
  ## Developers
760
775
 
761
776
  ### 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.13.0";
312254
+ var version16 = "1.14.0-alpha.1";
312255
312255
 
312256
312256
  // src/common/logger.ts
312257
312257
  var TurboWinstonLogger = class _TurboWinstonLogger {
@@ -35,23 +35,14 @@ const utils_js_1 = require("./utils.js");
35
35
  await (0, utils_js_1.runCommand)(command, commands_js_1.topUp);
36
36
  });
37
37
  (0, utils_js_1.applyOptions)(commander_1.program.command('crypto-fund').description('Top up a wallet with crypto'), [...options_js_1.walletOptions, options_js_1.optionMap.value]).action(async (_commandOptions, command) => {
38
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
- const options = command.optsWithGlobals();
40
- const token = (0, utils_js_1.tokenFromOptions)(options);
41
- const value = (0, utils_js_1.valueFromOptions)(options);
42
- const privateKey = await (0, utils_js_1.privateKeyFromOptions)(options);
43
- const config = (0, utils_js_1.configFromOptions)(options);
44
- try {
45
- await (0, commands_js_1.cryptoFund)({ privateKey, value, token, config });
46
- process.exit(0);
47
- }
48
- catch (error) {
49
- (0, utils_js_1.exitWithErrorLog)(error);
50
- }
38
+ await (0, utils_js_1.runCommand)(command, commands_js_1.cryptoFund);
51
39
  });
52
40
  (0, utils_js_1.applyOptions)(commander_1.program.command('upload-folder').description('Upload a folder using Turbo'), options_js_1.uploadFolderOptions).action(async (_commandOptions, command) => {
53
41
  await (0, utils_js_1.runCommand)(command, commands_js_1.uploadFolder);
54
42
  });
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
+ await (0, utils_js_1.runCommand)(command, commands_js_1.uploadFile);
45
+ });
55
46
  if (process.argv[1].includes('bin/turbo') || // Running from global .bin
56
47
  process.argv[1].includes('cli/cli') // Running from source
57
48
  ) {
@@ -5,6 +5,7 @@ exports.cryptoFund = cryptoFund;
5
5
  exports.topUp = topUp;
6
6
  exports.openUrl = openUrl;
7
7
  exports.uploadFolder = uploadFolder;
8
+ exports.uploadFile = uploadFile;
8
9
  /**
9
10
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
10
11
  *
@@ -22,6 +23,7 @@ exports.uploadFolder = uploadFolder;
22
23
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
24
  */
24
25
  const node_child_process_1 = require("node:child_process");
26
+ const node_fs_1 = require("node:fs");
25
27
  const index_js_1 = require("../node/index.js");
26
28
  const common_js_1 = require("../utils/common.js");
27
29
  const version_js_1 = require("../version.js");
@@ -46,13 +48,14 @@ async function getBalance(options) {
46
48
  console.log(`Turbo Balance for Wallet Address "${await turbo.signer.getNativeAddress()}"\nCredits: ${+winc / 1_000_000_000_000}`);
47
49
  }
48
50
  /** Fund the connected signer with crypto */
49
- async function cryptoFund({ value, privateKey, token, config, }) {
50
- const authenticatedTurbo = index_js_1.TurboFactory.authenticated({
51
- ...config,
52
- privateKey: privateKey,
53
- token,
54
- });
55
- const result = await authenticatedTurbo.topUpWithTokens({
51
+ async function cryptoFund(options) {
52
+ const value = options.value;
53
+ if (value === undefined) {
54
+ throw new Error('Must provide a --value to top up');
55
+ }
56
+ const turbo = await (0, utils_js_1.turboFromOptions)(options);
57
+ const token = (0, utils_js_1.tokenFromOptions)(options);
58
+ const result = await turbo.topUpWithTokens({
56
59
  tokenAmount: index_js_1.tokenToBaseMap[token](value),
57
60
  });
58
61
  console.log('Sent crypto fund transaction: \n', JSON.stringify(result, null, 2));
@@ -118,11 +121,7 @@ const turboCliTags = [
118
121
  { name: 'App-Platform', value: process.platform },
119
122
  ];
120
123
  async function uploadFolder(options) {
121
- const privateKey = await (0, utils_js_1.privateKeyFromOptions)(options);
122
- const turbo = index_js_1.TurboFactory.authenticated({
123
- ...(0, utils_js_1.configFromOptions)(options),
124
- privateKey,
125
- });
124
+ const turbo = await (0, utils_js_1.turboFromOptions)(options);
126
125
  const { disableManifest, fallbackFile, folderPath, indexFile, maxConcurrentUploads, } = (0, utils_js_1.getUploadFolderOptions)(options);
127
126
  const result = await turbo.uploadFolder({
128
127
  folderPath: folderPath,
@@ -136,3 +135,17 @@ async function uploadFolder(options) {
136
135
  });
137
136
  console.log('Uploaded folder:', JSON.stringify(result, null, 2));
138
137
  }
138
+ async function uploadFile(options) {
139
+ const { filePath } = options;
140
+ if (filePath === undefined) {
141
+ throw new Error('Must provide a --file-path to upload');
142
+ }
143
+ const turbo = await (0, utils_js_1.turboFromOptions)(options);
144
+ const fileSize = (0, node_fs_1.statSync)(filePath).size;
145
+ const result = await turbo.uploadFile({
146
+ fileStreamFactory: () => (0, node_fs_1.createReadStream)(filePath),
147
+ fileSizeFactory: () => fileSize,
148
+ dataItemOpts: { tags: [...turboCliTags] }, // TODO: Inject user tags
149
+ });
150
+ console.log('Uploaded file:', JSON.stringify(result, null, 2));
151
+ }
@@ -16,7 +16,7 @@
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.uploadFolderOptions = exports.globalOptions = exports.walletOptions = exports.optionMap = void 0;
19
+ exports.uploadFileOptions = exports.uploadFolderOptions = exports.globalOptions = exports.walletOptions = exports.optionMap = void 0;
20
20
  exports.optionMap = {
21
21
  token: {
22
22
  alias: '-t, --token <type>',
@@ -74,6 +74,10 @@ exports.optionMap = {
74
74
  alias: '-f, --folder-path <folderPath>',
75
75
  description: 'Directory to upload',
76
76
  },
77
+ filePath: {
78
+ alias: '-f, --file-path <filePath>',
79
+ description: 'File to upload',
80
+ },
77
81
  indexFile: {
78
82
  alias: '--index-file <indexFile>',
79
83
  description: 'Index file to use in the manifest created for folder upload',
@@ -85,7 +89,7 @@ exports.optionMap = {
85
89
  manifest: {
86
90
  alias: '--no-manifest',
87
91
  description: 'Disable manifest creation with --no-manifest',
88
- default: false,
92
+ default: true,
89
93
  },
90
94
  maxConcurrency: {
91
95
  alias: '--max-concurrency <maxConcurrency>',
@@ -112,3 +116,4 @@ exports.uploadFolderOptions = [
112
116
  exports.optionMap.manifest,
113
117
  exports.optionMap.maxConcurrency,
114
118
  ];
119
+ exports.uploadFileOptions = [...exports.walletOptions, exports.optionMap.filePath];
@@ -1,2 +1,18 @@
1
1
  "use strict";
2
+ /**
3
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU Affero General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
2
18
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -13,6 +13,7 @@ exports.addressOrPrivateKeyFromOptions = addressOrPrivateKeyFromOptions;
13
13
  exports.optionalPrivateKeyFromOptions = optionalPrivateKeyFromOptions;
14
14
  exports.privateKeyFromOptions = privateKeyFromOptions;
15
15
  exports.configFromOptions = configFromOptions;
16
+ exports.turboFromOptions = turboFromOptions;
16
17
  exports.getUploadFolderOptions = getUploadFolderOptions;
17
18
  /**
18
19
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
@@ -132,9 +133,11 @@ const tokenToDevGatewayMap = {
132
133
  kyve: 'https://api.korellia.kyve.network',
133
134
  // matic: 'https://rpc-amoy.polygon.technology',
134
135
  };
135
- function configFromOptions({ gateway, dev, token, }) {
136
+ function configFromOptions(options) {
136
137
  let config = {};
137
- if (dev) {
138
+ const token = tokenFromOptions(options);
139
+ config.token = token;
140
+ if (options.dev) {
138
141
  config = index_js_1.developmentTurboConfiguration;
139
142
  config.gatewayUrl = tokenToDevGatewayMap[token];
140
143
  }
@@ -142,13 +145,22 @@ function configFromOptions({ gateway, dev, token, }) {
142
145
  config = index_js_1.defaultTurboConfiguration;
143
146
  }
144
147
  // If gateway is provided, override the default or dev gateway
145
- if (gateway !== undefined) {
146
- config.gatewayUrl = gateway;
148
+ if (options.gateway !== undefined) {
149
+ config.gatewayUrl = options.gateway;
147
150
  }
148
- config.token = token;
149
151
  return config;
150
152
  }
153
+ async function turboFromOptions(options) {
154
+ const privateKey = await privateKeyFromOptions(options);
155
+ return index_js_1.TurboFactory.authenticated({
156
+ ...configFromOptions(options),
157
+ privateKey,
158
+ });
159
+ }
151
160
  function getUploadFolderOptions(options) {
161
+ if (options.folderPath === undefined) {
162
+ throw new Error('--folder-path is required');
163
+ }
152
164
  return {
153
165
  folderPath: options.folderPath,
154
166
  indexFile: options.indexFile,
@@ -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.14.0-alpha.1';
21
+ exports.version = '1.14.0-alpha.2';
@@ -18,9 +18,9 @@
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, 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';
21
+ import { cryptoFund, getBalance, topUp, uploadFile, uploadFolder, } from './commands.js';
22
+ import { globalOptions, optionMap, uploadFileOptions, uploadFolderOptions, walletOptions, } from './options.js';
23
+ import { applyOptions, runCommand } from './utils.js';
24
24
  applyOptions(program
25
25
  .name('turbo')
26
26
  .version(version)
@@ -33,23 +33,14 @@ applyOptions(program.command('top-up').description('Top up a Turbo address with
33
33
  await runCommand(command, topUp);
34
34
  });
35
35
  applyOptions(program.command('crypto-fund').description('Top up a wallet with crypto'), [...walletOptions, optionMap.value]).action(async (_commandOptions, command) => {
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
- const options = command.optsWithGlobals();
38
- const token = tokenFromOptions(options);
39
- const value = valueFromOptions(options);
40
- const privateKey = await privateKeyFromOptions(options);
41
- const config = configFromOptions(options);
42
- try {
43
- await cryptoFund({ privateKey, value, token, config });
44
- process.exit(0);
45
- }
46
- catch (error) {
47
- exitWithErrorLog(error);
48
- }
36
+ await runCommand(command, cryptoFund);
49
37
  });
50
38
  applyOptions(program.command('upload-folder').description('Upload a folder using Turbo'), uploadFolderOptions).action(async (_commandOptions, command) => {
51
39
  await runCommand(command, uploadFolder);
52
40
  });
41
+ applyOptions(program.command('upload-file').description('Upload a file using Turbo'), uploadFileOptions).action(async (_commandOptions, command) => {
42
+ await runCommand(command, uploadFile);
43
+ });
53
44
  if (process.argv[1].includes('bin/turbo') || // Running from global .bin
54
45
  process.argv[1].includes('cli/cli') // Running from source
55
46
  ) {
@@ -15,10 +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
21
  import { version } from '../version.js';
21
- import { addressOrPrivateKeyFromOptions, configFromOptions, getUploadFolderOptions, privateKeyFromOptions, } from './utils.js';
22
+ import { addressOrPrivateKeyFromOptions, configFromOptions, getUploadFolderOptions, tokenFromOptions, turboFromOptions, } from './utils.js';
22
23
  export async function getBalance(options) {
23
24
  const config = configFromOptions(options);
24
25
  const { address, privateKey } = await addressOrPrivateKeyFromOptions(options);
@@ -39,13 +40,14 @@ export async function getBalance(options) {
39
40
  console.log(`Turbo Balance for Wallet Address "${await turbo.signer.getNativeAddress()}"\nCredits: ${+winc / 1_000_000_000_000}`);
40
41
  }
41
42
  /** Fund the connected signer with crypto */
42
- export async function cryptoFund({ value, privateKey, token, config, }) {
43
- const authenticatedTurbo = TurboFactory.authenticated({
44
- ...config,
45
- privateKey: privateKey,
46
- token,
47
- });
48
- const result = await authenticatedTurbo.topUpWithTokens({
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({
49
51
  tokenAmount: tokenToBaseMap[token](value),
50
52
  });
51
53
  console.log('Sent crypto fund transaction: \n', JSON.stringify(result, null, 2));
@@ -111,11 +113,7 @@ const turboCliTags = [
111
113
  { name: 'App-Platform', value: process.platform },
112
114
  ];
113
115
  export async function uploadFolder(options) {
114
- const privateKey = await privateKeyFromOptions(options);
115
- const turbo = TurboFactory.authenticated({
116
- ...configFromOptions(options),
117
- privateKey,
118
- });
116
+ const turbo = await turboFromOptions(options);
119
117
  const { disableManifest, fallbackFile, folderPath, indexFile, maxConcurrentUploads, } = getUploadFolderOptions(options);
120
118
  const result = await turbo.uploadFolder({
121
119
  folderPath: folderPath,
@@ -129,3 +127,17 @@ export async function uploadFolder(options) {
129
127
  });
130
128
  console.log('Uploaded folder:', JSON.stringify(result, null, 2));
131
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
+ }
@@ -71,6 +71,10 @@ export const optionMap = {
71
71
  alias: '-f, --folder-path <folderPath>',
72
72
  description: 'Directory to upload',
73
73
  },
74
+ filePath: {
75
+ alias: '-f, --file-path <filePath>',
76
+ description: 'File to upload',
77
+ },
74
78
  indexFile: {
75
79
  alias: '--index-file <indexFile>',
76
80
  description: 'Index file to use in the manifest created for folder upload',
@@ -82,7 +86,7 @@ export const optionMap = {
82
86
  manifest: {
83
87
  alias: '--no-manifest',
84
88
  description: 'Disable manifest creation with --no-manifest',
85
- default: false,
89
+ default: true,
86
90
  },
87
91
  maxConcurrency: {
88
92
  alias: '--max-concurrency <maxConcurrency>',
@@ -109,3 +113,4 @@ export const uploadFolderOptions = [
109
113
  optionMap.manifest,
110
114
  optionMap.maxConcurrency,
111
115
  ];
116
+ export const uploadFileOptions = [...walletOptions, optionMap.filePath];
@@ -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 {};
@@ -16,7 +16,7 @@
16
16
  */
17
17
  import bs58 from 'bs58';
18
18
  import { readFileSync, statSync } from 'fs';
19
- import { defaultTurboConfiguration, developmentTurboConfiguration, isTokenType, privateKeyFromKyveMnemonic, } from '../node/index.js';
19
+ import { TurboFactory, defaultTurboConfiguration, developmentTurboConfiguration, isTokenType, privateKeyFromKyveMnemonic, } from '../node/index.js';
20
20
  import { NoWalletProvidedError } from './errors.js';
21
21
  export function exitWithErrorLog(error) {
22
22
  console.error(error instanceof Error ? error.message : error);
@@ -116,9 +116,11 @@ const tokenToDevGatewayMap = {
116
116
  kyve: 'https://api.korellia.kyve.network',
117
117
  // matic: 'https://rpc-amoy.polygon.technology',
118
118
  };
119
- export function configFromOptions({ gateway, dev, token, }) {
119
+ export function configFromOptions(options) {
120
120
  let config = {};
121
- if (dev) {
121
+ const token = tokenFromOptions(options);
122
+ config.token = token;
123
+ if (options.dev) {
122
124
  config = developmentTurboConfiguration;
123
125
  config.gatewayUrl = tokenToDevGatewayMap[token];
124
126
  }
@@ -126,13 +128,22 @@ export function configFromOptions({ gateway, dev, token, }) {
126
128
  config = defaultTurboConfiguration;
127
129
  }
128
130
  // If gateway is provided, override the default or dev gateway
129
- if (gateway !== undefined) {
130
- config.gatewayUrl = gateway;
131
+ if (options.gateway !== undefined) {
132
+ config.gatewayUrl = options.gateway;
131
133
  }
132
- config.token = token;
133
134
  return config;
134
135
  }
136
+ export async function turboFromOptions(options) {
137
+ const privateKey = await privateKeyFromOptions(options);
138
+ return TurboFactory.authenticated({
139
+ ...configFromOptions(options),
140
+ privateKey,
141
+ });
142
+ }
135
143
  export function getUploadFolderOptions(options) {
144
+ if (options.folderPath === undefined) {
145
+ throw new Error('--folder-path is required');
146
+ }
136
147
  return {
137
148
  folderPath: options.folderPath,
138
149
  indexFile: options.indexFile,
@@ -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.14.0-alpha.1';
18
+ export const version = '1.14.0-alpha.2';
@@ -1,15 +1,9 @@
1
- import { TokenType, TurboUnauthenticatedConfiguration, TurboWallet } from '../node/index.js';
2
- import { AddressOptions, TopUpOptions, UploadFolderOptions } from './types.js';
1
+ import { AddressOptions, CryptoFundOptions, TopUpOptions, UploadFileOptions, UploadFolderOptions } from './types.js';
3
2
  export declare function getBalance(options: AddressOptions): Promise<void>;
4
- export interface CryptoFundParams {
5
- token: TokenType;
6
- value: string;
7
- privateKey: TurboWallet;
8
- config: TurboUnauthenticatedConfiguration;
9
- }
10
3
  /** Fund the connected signer with crypto */
11
- export declare function cryptoFund({ value, privateKey, token, config, }: CryptoFundParams): Promise<void>;
4
+ export declare function cryptoFund(options: CryptoFundOptions): Promise<void>;
12
5
  export declare function topUp(options: TopUpOptions): Promise<void>;
13
6
  export declare function openUrl(url: string): void;
14
7
  export declare function uploadFolder(options: UploadFolderOptions): Promise<void>;
8
+ export declare function uploadFile(options: UploadFileOptions): Promise<void>;
15
9
  //# sourceMappingURL=commands.d.ts.map
@@ -1 +1 @@
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"}
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"}
@@ -69,6 +69,10 @@ export declare const optionMap: {
69
69
  readonly alias: "-f, --folder-path <folderPath>";
70
70
  readonly description: "Directory to upload";
71
71
  };
72
+ readonly filePath: {
73
+ readonly alias: "-f, --file-path <filePath>";
74
+ readonly description: "File to upload";
75
+ };
72
76
  readonly indexFile: {
73
77
  readonly alias: "--index-file <indexFile>";
74
78
  readonly description: "Index file to use in the manifest created for folder upload";
@@ -80,7 +84,7 @@ export declare const optionMap: {
80
84
  readonly manifest: {
81
85
  readonly alias: "--no-manifest";
82
86
  readonly description: "Disable manifest creation with --no-manifest";
83
- readonly default: false;
87
+ readonly default: true;
84
88
  };
85
89
  readonly maxConcurrency: {
86
90
  readonly alias: "--max-concurrency <maxConcurrency>";
@@ -139,9 +143,22 @@ export declare const uploadFolderOptions: ({
139
143
  } | {
140
144
  readonly alias: "--no-manifest";
141
145
  readonly description: "Disable manifest creation with --no-manifest";
142
- readonly default: false;
146
+ readonly default: true;
143
147
  } | {
144
148
  readonly alias: "--max-concurrency <maxConcurrency>";
145
149
  readonly description: "Maximum number of concurrent uploads";
146
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
+ })[];
147
164
  //# sourceMappingURL=options.d.ts.map
@@ -1 +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"}
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"}
@@ -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: TokenType;
22
+ token: string;
24
23
  };
25
24
  export type WalletOptions = GlobalOptions & {
26
25
  walletFile: string | undefined;
@@ -35,10 +34,16 @@ export type TopUpOptions = AddressOptions & {
35
34
  currency: string | undefined;
36
35
  };
37
36
  export type UploadFolderOptions = WalletOptions & {
38
- folderPath: string;
37
+ folderPath: string | undefined;
39
38
  indexFile: string | undefined;
40
39
  fallbackFile: string | undefined;
41
40
  manifest: boolean;
42
41
  maxConcurrency: number | undefined;
43
42
  };
43
+ export type UploadFileOptions = WalletOptions & {
44
+ filePath: string | undefined;
45
+ };
46
+ export type CryptoFundOptions = WalletOptions & {
47
+ value: string | undefined;
48
+ };
44
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;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;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,CAAC;IACnB,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"}
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"}
@@ -1,5 +1,5 @@
1
1
  import { Command, OptionValues } from 'commander';
2
- import { TokenType, TurboUnauthenticatedConfiguration } from '../node/index.js';
2
+ import { TokenType, TurboAuthenticatedClient, TurboUnauthenticatedConfiguration } from '../node/index.js';
3
3
  import { AddressOptions, GlobalOptions, UploadFolderOptions, WalletOptions } from './types.js';
4
4
  export declare function exitWithErrorLog(error: unknown): void;
5
5
  export declare function runCommand<O extends OptionValues>(command: Command, action: (options: O) => Promise<void>): Promise<void>;
@@ -18,7 +18,8 @@ export declare function addressOrPrivateKeyFromOptions(options: AddressOptions):
18
18
  }>;
19
19
  export declare function optionalPrivateKeyFromOptions(options: WalletOptions): Promise<string | undefined>;
20
20
  export declare function privateKeyFromOptions({ mnemonic, privateKey, walletFile, token, }: WalletOptions): Promise<string>;
21
- export declare function configFromOptions({ gateway, dev, token, }: GlobalOptions): TurboUnauthenticatedConfiguration;
21
+ export declare function configFromOptions(options: GlobalOptions): TurboUnauthenticatedConfiguration;
22
+ export declare function turboFromOptions(options: WalletOptions): Promise<TurboAuthenticatedClient>;
22
23
  export declare function getUploadFolderOptions(options: UploadFolderOptions): {
23
24
  folderPath: string;
24
25
  indexFile: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/cli/utils.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGlD,OAAO,EACL,SAAS,EACT,iCAAiC,EAKlC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,QAG9C;AAED,wBAAsB,UAAU,CAAC,CAAC,SAAS,YAAY,EACrD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,iBAUtC;AAED,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAC1B,O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;IACnB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,eAAe,EAAE,OAAO,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAYA"}
@@ -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.13.0";
17
+ export declare const version = "1.14.0-alpha.1";
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,WAAW,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,eAAO,MAAM,OAAO,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ardrive/turbo-sdk",
3
- "version": "1.14.0-alpha.1",
3
+ "version": "1.14.0-alpha.2",
4
4
  "main": "./lib/cjs/node/index.js",
5
5
  "types": "./lib/types/node/index.d.ts",
6
6
  "module": "./lib/esm/node/index.js",