@ardrive/turbo-sdk 1.19.2 → 1.20.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.
Files changed (67) hide show
  1. package/README.md +123 -1
  2. package/bundles/web.bundle.min.js +148 -14
  3. package/lib/cjs/cli/cli.js +18 -0
  4. package/lib/cjs/cli/commands/balance.js +26 -15
  5. package/lib/cjs/cli/commands/cryptoFund.js +3 -1
  6. package/lib/cjs/cli/commands/listShares.js +58 -0
  7. package/lib/cjs/cli/commands/price.js +2 -1
  8. package/lib/cjs/cli/commands/revokeCredits.js +15 -0
  9. package/lib/cjs/cli/commands/shareCredits.js +39 -0
  10. package/lib/cjs/cli/commands/uploadFile.js +2 -1
  11. package/lib/cjs/cli/commands/uploadFolder.js +2 -1
  12. package/lib/cjs/cli/constants.js +2 -1
  13. package/lib/cjs/cli/options.js +43 -4
  14. package/lib/cjs/cli/utils.js +31 -0
  15. package/lib/cjs/common/payment.js +30 -4
  16. package/lib/cjs/common/token/solana.js +2 -2
  17. package/lib/cjs/common/turbo.js +31 -2
  18. package/lib/cjs/common/upload.js +73 -6
  19. package/lib/cjs/version.js +1 -1
  20. package/lib/esm/cli/cli.js +19 -1
  21. package/lib/esm/cli/commands/balance.js +26 -15
  22. package/lib/esm/cli/commands/cryptoFund.js +3 -1
  23. package/lib/esm/cli/commands/listShares.js +55 -0
  24. package/lib/esm/cli/commands/price.js +2 -1
  25. package/lib/esm/cli/commands/revokeCredits.js +12 -0
  26. package/lib/esm/cli/commands/shareCredits.js +36 -0
  27. package/lib/esm/cli/commands/uploadFile.js +3 -2
  28. package/lib/esm/cli/commands/uploadFolder.js +3 -2
  29. package/lib/esm/cli/constants.js +1 -0
  30. package/lib/esm/cli/options.js +42 -3
  31. package/lib/esm/cli/utils.js +30 -0
  32. package/lib/esm/common/payment.js +30 -4
  33. package/lib/esm/common/token/solana.js +2 -2
  34. package/lib/esm/common/turbo.js +31 -2
  35. package/lib/esm/common/upload.js +72 -5
  36. package/lib/esm/version.js +1 -1
  37. package/lib/types/cli/commands/balance.d.ts.map +1 -1
  38. package/lib/types/cli/commands/cryptoFund.d.ts.map +1 -1
  39. package/lib/types/cli/commands/listShares.d.ts +3 -0
  40. package/lib/types/cli/commands/listShares.d.ts.map +1 -0
  41. package/lib/types/cli/commands/price.d.ts.map +1 -1
  42. package/lib/types/cli/commands/revokeCredits.d.ts +18 -0
  43. package/lib/types/cli/commands/revokeCredits.d.ts.map +1 -0
  44. package/lib/types/cli/commands/shareCredits.d.ts +3 -0
  45. package/lib/types/cli/commands/shareCredits.d.ts.map +1 -0
  46. package/lib/types/cli/commands/uploadFile.d.ts.map +1 -1
  47. package/lib/types/cli/commands/uploadFolder.d.ts.map +1 -1
  48. package/lib/types/cli/constants.d.ts +1 -0
  49. package/lib/types/cli/constants.d.ts.map +1 -1
  50. package/lib/types/cli/options.d.ts +121 -2
  51. package/lib/types/cli/options.d.ts.map +1 -1
  52. package/lib/types/cli/types.d.ts +17 -2
  53. package/lib/types/cli/types.d.ts.map +1 -1
  54. package/lib/types/cli/utils.d.ts +2 -1
  55. package/lib/types/cli/utils.d.ts.map +1 -1
  56. package/lib/types/common/payment.d.ts +8 -2
  57. package/lib/types/common/payment.d.ts.map +1 -1
  58. package/lib/types/common/token/solana.d.ts.map +1 -1
  59. package/lib/types/common/turbo.d.ts +27 -2
  60. package/lib/types/common/turbo.d.ts.map +1 -1
  61. package/lib/types/common/upload.d.ts +9 -1
  62. package/lib/types/common/upload.d.ts.map +1 -1
  63. package/lib/types/types.d.ts +54 -3
  64. package/lib/types/types.d.ts.map +1 -1
  65. package/lib/types/utils/axiosClient.d.ts.map +1 -1
  66. package/lib/types/version.d.ts +1 -1
  67. package/package.json +4 -3
@@ -15,18 +15,19 @@
15
15
  */
16
16
  import { createReadStream, statSync } from 'fs';
17
17
  import { turboCliTags } from '../constants.js';
18
- import { turboFromOptions } from '../utils.js';
18
+ import { paidByFromOptions, turboFromOptions } from '../utils.js';
19
19
  export async function uploadFile(options) {
20
20
  const { filePath } = options;
21
21
  if (filePath === undefined) {
22
22
  throw new Error('Must provide a --file-path to upload');
23
23
  }
24
24
  const turbo = await turboFromOptions(options);
25
+ const paidBy = await paidByFromOptions(options, turbo);
25
26
  const fileSize = statSync(filePath).size;
26
27
  const result = await turbo.uploadFile({
27
28
  fileStreamFactory: () => createReadStream(filePath),
28
29
  fileSizeFactory: () => fileSize,
29
- dataItemOpts: { tags: [...turboCliTags] }, // TODO: Inject user tags
30
+ dataItemOpts: { tags: [...turboCliTags], paidBy }, // TODO: Inject user tags
30
31
  });
31
32
  console.log('Uploaded file:', JSON.stringify(result, null, 2));
32
33
  }
@@ -14,13 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { turboCliTags } from '../constants.js';
17
- import { getUploadFolderOptions, turboFromOptions } from '../utils.js';
17
+ import { getUploadFolderOptions, paidByFromOptions, turboFromOptions, } from '../utils.js';
18
18
  export async function uploadFolder(options) {
19
19
  const turbo = await turboFromOptions(options);
20
+ const paidBy = await paidByFromOptions(options, turbo);
20
21
  const { disableManifest, fallbackFile, folderPath, indexFile, maxConcurrentUploads, } = getUploadFolderOptions(options);
21
22
  const result = await turbo.uploadFolder({
22
23
  folderPath: folderPath,
23
- dataItemOpts: { tags: [...turboCliTags] }, // TODO: Inject user tags
24
+ dataItemOpts: { tags: [...turboCliTags], paidBy }, // TODO: Inject user tags
24
25
  manifestOptions: {
25
26
  disableManifest,
26
27
  indexFile,
@@ -19,3 +19,4 @@ export const turboCliTags = [
19
19
  { name: 'App-Version', value: version },
20
20
  { name: 'App-Platform', value: process.platform },
21
21
  ];
22
+ export const wincPerCredit = 1_000_000_000_000;
@@ -70,7 +70,12 @@ export const optionMap = {
70
70
  },
71
71
  dev: {
72
72
  alias: '--dev',
73
- description: 'Enable development endpoints',
73
+ description: 'Enable Turbo development endpoints',
74
+ default: false,
75
+ },
76
+ local: {
77
+ alias: '--local',
78
+ description: 'Enable local development endpoints',
74
79
  default: false,
75
80
  },
76
81
  debug: {
@@ -115,6 +120,25 @@ export const optionMap = {
115
120
  alias: '--max-concurrency <maxConcurrency>',
116
121
  description: 'Maximum number of concurrent uploads',
117
122
  },
123
+ paidBy: {
124
+ alias: '--paid-by <paidBy...>',
125
+ description: 'Address to pay for the upload',
126
+ type: 'array',
127
+ },
128
+ expiresBySeconds: {
129
+ alias: '--expires-by-seconds <expiresBySeconds>',
130
+ description: 'Expiration time in seconds',
131
+ },
132
+ ignoreApprovals: {
133
+ alias: '--ignore-approvals',
134
+ description: "Ignore all credit share approvals, only use signing wallet's balance",
135
+ default: false,
136
+ },
137
+ useSignerBalanceFirst: {
138
+ alias: '--use-signer-balance-first',
139
+ description: 'Use the signer balance first before using credit share approvals',
140
+ default: false,
141
+ },
118
142
  };
119
143
  export const walletOptions = [
120
144
  optionMap.walletFile,
@@ -123,6 +147,7 @@ export const walletOptions = [
123
147
  ];
124
148
  export const globalOptions = [
125
149
  optionMap.dev,
150
+ optionMap.local,
126
151
  optionMap.gateway,
127
152
  optionMap.debug,
128
153
  optionMap.quiet,
@@ -131,12 +156,26 @@ export const globalOptions = [
131
156
  optionMap.paymentUrl,
132
157
  optionMap.uploadUrl,
133
158
  ];
134
- export const uploadFolderOptions = [
159
+ export const uploadOptions = [
135
160
  ...walletOptions,
161
+ optionMap.paidBy,
162
+ optionMap.ignoreApprovals,
163
+ optionMap.useSignerBalanceFirst,
164
+ ];
165
+ export const uploadFolderOptions = [
166
+ ...uploadOptions,
136
167
  optionMap.folderPath,
137
168
  optionMap.indexFile,
138
169
  optionMap.fallbackFile,
139
170
  optionMap.manifest,
140
171
  optionMap.maxConcurrency,
141
172
  ];
142
- export const uploadFileOptions = [...walletOptions, optionMap.filePath];
173
+ export const uploadFileOptions = [...uploadOptions, optionMap.filePath];
174
+ export const shareCreditsOptions = [
175
+ ...walletOptions,
176
+ optionMap.value,
177
+ optionMap.address,
178
+ optionMap.expiresBySeconds,
179
+ ];
180
+ export const revokeCreditsOptions = [...walletOptions, optionMap.address];
181
+ export const listSharesOptions = revokeCreditsOptions;
@@ -121,12 +121,21 @@ export function configFromOptions(options) {
121
121
  let paymentUrl = undefined;
122
122
  let uploadUrl = undefined;
123
123
  let gatewayUrl = undefined;
124
+ if (options.local && options.dev) {
125
+ throw new Error('Cannot use both --local and --dev flags');
126
+ }
124
127
  if (options.dev) {
125
128
  // Use development endpoints
126
129
  paymentUrl = developmentTurboConfiguration.paymentServiceConfig.url;
127
130
  uploadUrl = developmentTurboConfiguration.uploadServiceConfig.url;
128
131
  gatewayUrl = tokenToDevGatewayMap[token];
129
132
  }
133
+ else if (options.local) {
134
+ // Use local endpoints
135
+ paymentUrl = 'http://localhost:4000';
136
+ uploadUrl = 'http://localhost:3000';
137
+ gatewayUrl = 'http://localhost:1984';
138
+ }
130
139
  else {
131
140
  // Use default endpoints
132
141
  paymentUrl = defaultTurboConfiguration.paymentServiceConfig.url;
@@ -157,6 +166,27 @@ export async function turboFromOptions(options) {
157
166
  privateKey,
158
167
  });
159
168
  }
169
+ export async function paidByFromOptions({ paidBy: paidByCliInput, ignoreApprovals, useSignerBalanceFirst, }, turbo) {
170
+ const paidBy = await (async () => {
171
+ if (paidByCliInput !== undefined && paidByCliInput.length > 0) {
172
+ return paidByCliInput;
173
+ }
174
+ if (ignoreApprovals) {
175
+ return undefined;
176
+ }
177
+ const { receivedApprovals } = await turbo.getBalance();
178
+ if (receivedApprovals !== undefined && receivedApprovals.length !== 0) {
179
+ // get unique paying addresses from any received approvals
180
+ return Array.from(new Set(receivedApprovals.map((approval) => approval.payingAddress)));
181
+ }
182
+ return undefined;
183
+ })();
184
+ if (paidBy !== undefined && useSignerBalanceFirst) {
185
+ // Add the signer's address to the front of the paidBy array
186
+ paidBy.unshift(await turbo.signer.getNativeAddress());
187
+ }
188
+ return paidBy;
189
+ }
160
190
  export function getUploadFolderOptions(options) {
161
191
  if (options.folderPath === undefined) {
162
192
  throw new Error('--folder-path is required');
@@ -34,7 +34,15 @@ export class TurboUnauthenticatedPaymentService {
34
34
  endpoint: `/account/balance/${this.token}?address=${address}`,
35
35
  allowedStatuses: [200, 404],
36
36
  });
37
- return balance.winc ? balance : { winc: '0' };
37
+ return balance.winc
38
+ ? balance
39
+ : {
40
+ winc: '0',
41
+ controlledWinc: '0',
42
+ effectiveBalance: '0',
43
+ givenApprovals: [],
44
+ receivedApprovals: [],
45
+ };
38
46
  }
39
47
  getFiatRates() {
40
48
  return this.httpService.get({
@@ -153,6 +161,20 @@ export class TurboUnauthenticatedPaymentService {
153
161
  }
154
162
  throw new Error('Unknown response from payment service: ' + response);
155
163
  }
164
+ async getCreditShareApprovals({ userAddress, }) {
165
+ const response = await this.httpService.get({
166
+ endpoint: `/account/approvals/get?userAddress=${userAddress}`,
167
+ allowedStatuses: [200, 404],
168
+ });
169
+ if (response?.givenApprovals === undefined &&
170
+ response?.receivedApprovals === undefined) {
171
+ return {
172
+ givenApprovals: [],
173
+ receivedApprovals: [],
174
+ };
175
+ }
176
+ return response;
177
+ }
156
178
  }
157
179
  // NOTE: to avoid redundancy, we use inheritance here - but generally prefer composition over inheritance
158
180
  export class TurboAuthenticatedPaymentService extends TurboUnauthenticatedPaymentService {
@@ -161,9 +183,13 @@ export class TurboAuthenticatedPaymentService extends TurboUnauthenticatedPaymen
161
183
  this.signer = signer;
162
184
  this.tokenTools = tokenTools;
163
185
  }
164
- async getBalance(address) {
165
- address ??= await this.signer.getNativeAddress();
166
- return super.getBalance(address);
186
+ async getBalance(userAddress) {
187
+ userAddress ??= await this.signer.getNativeAddress();
188
+ return super.getBalance(userAddress);
189
+ }
190
+ async getCreditShareApprovals({ userAddress, }) {
191
+ userAddress ??= await this.signer.getNativeAddress();
192
+ return super.getCreditShareApprovals({ userAddress });
167
193
  }
168
194
  async getWincForFiat({ amount, promoCodes = [], }) {
169
195
  return super.getWincForFiat({
@@ -33,7 +33,7 @@ export class SolanaToken {
33
33
  this.pollingOptions = pollingOptions;
34
34
  }
35
35
  async createAndSubmitTx({ target, tokenAmount, signer, }) {
36
- const publicKey = new PublicKey(bs58.encode(await signer.getPublicKey()));
36
+ const publicKey = new PublicKey(bs58.encode(Uint8Array.from(await signer.getPublicKey())));
37
37
  const tx = new Transaction({
38
38
  feePayer: publicKey,
39
39
  ...(await this.connection.getLatestBlockhash()),
@@ -44,7 +44,7 @@ export class SolanaToken {
44
44
  lamports: +new BigNumber(tokenAmount),
45
45
  }));
46
46
  const serializedTx = tx.serializeMessage();
47
- const signature = await signer.signData(serializedTx);
47
+ const signature = await signer.signData(Uint8Array.from(serializedTx));
48
48
  tx.addSignature(publicKey, Buffer.from(signature));
49
49
  const id = bs58.encode(signature);
50
50
  await this.submitTx(tx, id);
@@ -105,6 +105,12 @@ export class TurboUnauthenticatedClient {
105
105
  wallets.pol = wallets.matic;
106
106
  return wallets;
107
107
  }
108
+ /**
109
+ * Returns a list of all credit share approvals for the user.
110
+ */
111
+ getCreditShareApprovals(p) {
112
+ return this.paymentService.getCreditShareApprovals(p);
113
+ }
108
114
  }
109
115
  export class TurboAuthenticatedClient extends TurboUnauthenticatedClient {
110
116
  constructor({ paymentService, uploadService, signer, }) {
@@ -114,8 +120,14 @@ export class TurboAuthenticatedClient extends TurboUnauthenticatedClient {
114
120
  /**
115
121
  * Returns the current balance of the user's wallet in 'winc'.
116
122
  */
117
- getBalance(address) {
118
- return this.paymentService.getBalance(address);
123
+ getBalance(userAddress) {
124
+ return this.paymentService.getBalance(userAddress);
125
+ }
126
+ /**
127
+ * Returns a list of all credit share approvals for the user.
128
+ */
129
+ getCreditShareApprovals(p = {}) {
130
+ return this.paymentService.getCreditShareApprovals(p);
119
131
  }
120
132
  /**
121
133
  * Signs and uploads raw data to the Turbo Upload Service.
@@ -138,4 +150,21 @@ export class TurboAuthenticatedClient extends TurboUnauthenticatedClient {
138
150
  topUpWithTokens(p) {
139
151
  return this.paymentService.topUpWithTokens(p);
140
152
  }
153
+ /**
154
+ * Creates a data item with tags that designate it as a credit share approval.
155
+ * Signs the data item and sends it to the Turbo Upload Service, which will verify
156
+ * the signature and forward the admin action towards the Turbo Payment Service.
157
+ */
158
+ shareCredits(p) {
159
+ return this.uploadService.shareCredits(p);
160
+ }
161
+ /**
162
+ * Creates a data item with tags that designate it as a revoke action for credit
163
+ * share approvals for target revokedAddress. Signs the data item and sends it to
164
+ * the Turbo Upload Service, which will verify the signature and forward the admin
165
+ * action towards the Turbo Payment Service.
166
+ */
167
+ revokeCredits(p) {
168
+ return this.uploadService.revokeCredits(p);
169
+ }
141
170
  }
@@ -14,9 +14,16 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Buffer } from 'node:buffer';
17
+ import { Readable } from 'node:stream';
17
18
  import { pLimit } from 'plimit-lit';
18
19
  import { TurboHTTPService } from './http.js';
19
20
  import { TurboWinstonLogger } from './logger.js';
21
+ export const creditSharingTagNames = {
22
+ shareCredits: 'x-approve-payment',
23
+ sharedWincAmount: 'x-amount',
24
+ approvalExpiresBySeconds: 'x-expires-seconds',
25
+ revokeCredits: 'x-delete-payment-approval',
26
+ };
20
27
  export const developmentUploadServiceURL = 'https://upload.ardrive.dev';
21
28
  export const defaultUploadServiceURL = 'https://upload.ardrive.io';
22
29
  export class TurboUnauthenticatedUploadService {
@@ -57,17 +64,25 @@ export class TurboAuthenticatedBaseUploadService extends TurboUnauthenticatedUpl
57
64
  dataItemOpts,
58
65
  });
59
66
  const signedDataItem = dataItemStreamFactory();
60
- const fileSize = dataItemSizeFactory();
61
67
  this.logger.debug('Uploading signed data item...');
62
68
  // TODO: add p-limit constraint or replace with separate upload class
69
+ const headers = {
70
+ 'content-type': 'application/octet-stream',
71
+ 'content-length': `${dataItemSizeFactory()}`,
72
+ };
73
+ if (dataItemOpts !== undefined && dataItemOpts.paidBy !== undefined) {
74
+ const paidBy = Array.isArray(dataItemOpts.paidBy)
75
+ ? dataItemOpts.paidBy
76
+ : [dataItemOpts.paidBy];
77
+ if (dataItemOpts.paidBy.length > 0) {
78
+ headers['x-paid-by'] = paidBy;
79
+ }
80
+ }
63
81
  return this.httpService.post({
64
82
  endpoint: `/tx/${this.token}`,
65
83
  signal,
66
84
  data: signedDataItem,
67
- headers: {
68
- 'content-type': 'application/octet-stream',
69
- 'content-length': `${fileSize}`,
70
- },
85
+ headers,
71
86
  });
72
87
  }
73
88
  async generateManifest({ paths, indexFile, fallbackFile, }) {
@@ -178,4 +193,56 @@ export class TurboAuthenticatedBaseUploadService extends TurboUnauthenticatedUpl
178
193
  manifestResponse,
179
194
  };
180
195
  }
196
+ async shareCredits({ approvedAddress, approvedWincAmount, expiresBySeconds, }) {
197
+ const dataItemOpts = {
198
+ tags: [
199
+ {
200
+ name: creditSharingTagNames.shareCredits,
201
+ value: approvedAddress,
202
+ },
203
+ {
204
+ name: creditSharingTagNames.sharedWincAmount,
205
+ value: approvedWincAmount.toString(),
206
+ },
207
+ ],
208
+ };
209
+ if (expiresBySeconds !== undefined) {
210
+ dataItemOpts.tags.push({
211
+ name: creditSharingTagNames.approvalExpiresBySeconds,
212
+ value: expiresBySeconds.toString(),
213
+ });
214
+ }
215
+ const nonceData = Buffer.from(approvedAddress + approvedWincAmount + Date.now());
216
+ const { createdApproval, ...uploadResponse } = await this.uploadFile({
217
+ fileStreamFactory: () => Readable.from(nonceData),
218
+ fileSizeFactory: () => nonceData.byteLength,
219
+ dataItemOpts,
220
+ });
221
+ if (!createdApproval) {
222
+ throw new Error('Failed to create credit share approval but upload has succeeded\n' +
223
+ JSON.stringify(uploadResponse));
224
+ }
225
+ return createdApproval;
226
+ }
227
+ async revokeCredits({ revokedAddress, }) {
228
+ const dataItemOpts = {
229
+ tags: [
230
+ {
231
+ name: creditSharingTagNames.revokeCredits,
232
+ value: revokedAddress,
233
+ },
234
+ ],
235
+ };
236
+ const nonceData = Buffer.from(revokedAddress + Date.now());
237
+ const { revokedApprovals, ...uploadResponse } = await this.uploadFile({
238
+ fileStreamFactory: () => Readable.from(nonceData),
239
+ fileSizeFactory: () => nonceData.byteLength,
240
+ dataItemOpts,
241
+ });
242
+ if (!revokedApprovals) {
243
+ throw new Error('Failed to revoke credit share approvals but upload has succeeded\n' +
244
+ JSON.stringify(uploadResponse));
245
+ }
246
+ return revokedApprovals;
247
+ }
181
248
  }
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '1.19.2';
17
+ export const version = '1.20.0-alpha.2';
@@ -1 +1 @@
1
- {"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/balance.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,wBAAsB,OAAO,CAAC,OAAO,EAAE,cAAc,iBAgCpD"}
1
+ {"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/balance.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C,wBAAsB,OAAO,CAAC,OAAO,EAAE,cAAc,iBAoCpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"cryptoFund.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/cryptoFund.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOhD,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,iBAqD1D"}
1
+ {"version":3,"file":"cryptoFund.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/cryptoFund.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOhD,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,iBAqD1D"}
@@ -0,0 +1,3 @@
1
+ import { ListSharesOptions } from '../types.js';
2
+ export declare function listShares(options: ListSharesOptions): Promise<void>;
3
+ //# sourceMappingURL=listShares.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listShares.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/listShares.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6C1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/price.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,iBA8ChD"}
1
+ {"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/price.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,iBA8ChD"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { RevokeCreditsOptions } from '../types.js';
17
+ export declare function revokeCredits(options: RevokeCreditsOptions): Promise<void>;
18
+ //# sourceMappingURL=revokeCredits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revokeCredits.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/revokeCredits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,wBAAsB,aAAa,CACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAqBf"}
@@ -0,0 +1,3 @@
1
+ import { ShareCreditsOptions } from '../types.js';
2
+ export declare function shareCredits(options: ShareCreditsOptions): Promise<void>;
3
+ //# sourceMappingURL=shareCredits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shareCredits.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/shareCredits.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAiCf"}
@@ -1 +1 @@
1
- {"version":3,"file":"uploadFile.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/uploadFile.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB1E"}
1
+ {"version":3,"file":"uploadFile.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/uploadFile.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"uploadFolder.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/uploadFolder.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAuBf"}
1
+ {"version":3,"file":"uploadFolder.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/uploadFolder.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAOlD,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAwBf"}
@@ -2,4 +2,5 @@ export declare const turboCliTags: {
2
2
  name: string;
3
3
  value: string;
4
4
  }[];
5
+ export declare const wincPerCredit = 1000000000000;
5
6
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/cli/constants.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,YAAY,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAIzD,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/cli/constants.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,YAAY,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAIzD,CAAC;AAEF,eAAO,MAAM,aAAa,gBAAoB,CAAC"}
@@ -70,7 +70,12 @@ export declare const optionMap: {
70
70
  };
71
71
  readonly dev: {
72
72
  readonly alias: "--dev";
73
- readonly description: "Enable development endpoints";
73
+ readonly description: "Enable Turbo development endpoints";
74
+ readonly default: false;
75
+ };
76
+ readonly local: {
77
+ readonly alias: "--local";
78
+ readonly description: "Enable local development endpoints";
74
79
  readonly default: false;
75
80
  };
76
81
  readonly debug: {
@@ -113,6 +118,25 @@ export declare const optionMap: {
113
118
  readonly alias: "--max-concurrency <maxConcurrency>";
114
119
  readonly description: "Maximum number of concurrent uploads";
115
120
  };
121
+ readonly paidBy: {
122
+ readonly alias: "--paid-by <paidBy...>";
123
+ readonly description: "Address to pay for the upload";
124
+ readonly type: "array";
125
+ };
126
+ readonly expiresBySeconds: {
127
+ readonly alias: "--expires-by-seconds <expiresBySeconds>";
128
+ readonly description: "Expiration time in seconds";
129
+ };
130
+ readonly ignoreApprovals: {
131
+ readonly alias: "--ignore-approvals";
132
+ readonly description: "Ignore all credit share approvals, only use signing wallet's balance";
133
+ readonly default: false;
134
+ };
135
+ readonly useSignerBalanceFirst: {
136
+ readonly alias: "--use-signer-balance-first";
137
+ readonly description: "Use the signer balance first before using credit share approvals";
138
+ readonly default: false;
139
+ };
116
140
  };
117
141
  export declare const walletOptions: ({
118
142
  readonly alias: "-w, --wallet-file <filePath>";
@@ -142,7 +166,11 @@ export declare const globalOptions: ({
142
166
  readonly default: undefined;
143
167
  } | {
144
168
  readonly alias: "--dev";
145
- readonly description: "Enable development endpoints";
169
+ readonly description: "Enable Turbo development endpoints";
170
+ readonly default: false;
171
+ } | {
172
+ readonly alias: "--local";
173
+ readonly description: "Enable local development endpoints";
146
174
  readonly default: false;
147
175
  } | {
148
176
  readonly alias: "--debug";
@@ -157,6 +185,28 @@ export declare const globalOptions: ({
157
185
  readonly description: "Skip all confirmation prompts";
158
186
  readonly default: false;
159
187
  })[];
188
+ export declare const uploadOptions: ({
189
+ readonly alias: "-w, --wallet-file <filePath>";
190
+ 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";
191
+ } | {
192
+ readonly alias: "-m, --mnemonic <phrase>";
193
+ readonly description: "Mnemonic to use with the action";
194
+ } | {
195
+ readonly alias: "-p, --private-key <key>";
196
+ readonly description: "Private key to use with the action";
197
+ } | {
198
+ readonly alias: "--paid-by <paidBy...>";
199
+ readonly description: "Address to pay for the upload";
200
+ readonly type: "array";
201
+ } | {
202
+ readonly alias: "--ignore-approvals";
203
+ readonly description: "Ignore all credit share approvals, only use signing wallet's balance";
204
+ readonly default: false;
205
+ } | {
206
+ readonly alias: "--use-signer-balance-first";
207
+ readonly description: "Use the signer balance first before using credit share approvals";
208
+ readonly default: false;
209
+ })[];
160
210
  export declare const uploadFolderOptions: ({
161
211
  readonly alias: "-w, --wallet-file <filePath>";
162
212
  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";
@@ -182,6 +232,18 @@ export declare const uploadFolderOptions: ({
182
232
  } | {
183
233
  readonly alias: "--max-concurrency <maxConcurrency>";
184
234
  readonly description: "Maximum number of concurrent uploads";
235
+ } | {
236
+ readonly alias: "--paid-by <paidBy...>";
237
+ readonly description: "Address to pay for the upload";
238
+ readonly type: "array";
239
+ } | {
240
+ readonly alias: "--ignore-approvals";
241
+ readonly description: "Ignore all credit share approvals, only use signing wallet's balance";
242
+ readonly default: false;
243
+ } | {
244
+ readonly alias: "--use-signer-balance-first";
245
+ readonly description: "Use the signer balance first before using credit share approvals";
246
+ readonly default: false;
185
247
  })[];
186
248
  export declare const uploadFileOptions: ({
187
249
  readonly alias: "-w, --wallet-file <filePath>";
@@ -195,5 +257,62 @@ export declare const uploadFileOptions: ({
195
257
  } | {
196
258
  readonly alias: "-f, --file-path <filePath>";
197
259
  readonly description: "File to upload";
260
+ } | {
261
+ readonly alias: "--paid-by <paidBy...>";
262
+ readonly description: "Address to pay for the upload";
263
+ readonly type: "array";
264
+ } | {
265
+ readonly alias: "--ignore-approvals";
266
+ readonly description: "Ignore all credit share approvals, only use signing wallet's balance";
267
+ readonly default: false;
268
+ } | {
269
+ readonly alias: "--use-signer-balance-first";
270
+ readonly description: "Use the signer balance first before using credit share approvals";
271
+ readonly default: false;
272
+ })[];
273
+ export declare const shareCreditsOptions: ({
274
+ readonly alias: "-a, --address <nativeAddress>";
275
+ readonly description: "Native address to use for action";
276
+ } | {
277
+ readonly alias: "-v, --value <value>";
278
+ 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";
279
+ } | {
280
+ readonly alias: "-w, --wallet-file <filePath>";
281
+ 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";
282
+ } | {
283
+ readonly alias: "-m, --mnemonic <phrase>";
284
+ readonly description: "Mnemonic to use with the action";
285
+ } | {
286
+ readonly alias: "-p, --private-key <key>";
287
+ readonly description: "Private key to use with the action";
288
+ } | {
289
+ readonly alias: "--expires-by-seconds <expiresBySeconds>";
290
+ readonly description: "Expiration time in seconds";
291
+ })[];
292
+ export declare const revokeCreditsOptions: ({
293
+ readonly alias: "-a, --address <nativeAddress>";
294
+ readonly description: "Native address to use for action";
295
+ } | {
296
+ readonly alias: "-w, --wallet-file <filePath>";
297
+ 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";
298
+ } | {
299
+ readonly alias: "-m, --mnemonic <phrase>";
300
+ readonly description: "Mnemonic to use with the action";
301
+ } | {
302
+ readonly alias: "-p, --private-key <key>";
303
+ readonly description: "Private key to use with the action";
304
+ })[];
305
+ export declare const listSharesOptions: ({
306
+ readonly alias: "-a, --address <nativeAddress>";
307
+ readonly description: "Native address to use for action";
308
+ } | {
309
+ readonly alias: "-w, --wallet-file <filePath>";
310
+ 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";
311
+ } | {
312
+ readonly alias: "-m, --mnemonic <phrase>";
313
+ readonly description: "Mnemonic to use with the action";
314
+ } | {
315
+ readonly alias: "-p, --private-key <key>";
316
+ readonly description: "Private key to use with the action";
198
317
  })[];
199
318
  //# sourceMappingURL=options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/cli/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0GZ,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;IAIzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASzB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;IAO/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;IAAyC,CAAC"}
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/cli/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoIZ,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;IAIzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAUzB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;IAKzB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAO/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;IAAyC,CAAC;AAExE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;IAK/B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;IAAwC,CAAC;AAE1E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;IAAuB,CAAC"}