From 953648e67719cc3c663ac75a702fd653e33b7c8f Mon Sep 17 00:00:00 2001 From: Derek Sonnenberg Date: Wed, 16 Oct 2024 15:17:39 -0500 Subject: [PATCH] feat(delegated payments): add paid-by headers for uploads when applicable PE-6754 --- src/cli/commands/uploadFile.ts | 4 ++-- src/cli/options.ts | 5 +++++ src/cli/types.ts | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cli/commands/uploadFile.ts b/src/cli/commands/uploadFile.ts index 43ff13ad..3629bd3c 100644 --- a/src/cli/commands/uploadFile.ts +++ b/src/cli/commands/uploadFile.ts @@ -20,7 +20,7 @@ import { UploadFileOptions } from '../types.js'; import { turboFromOptions } from '../utils.js'; export async function uploadFile(options: UploadFileOptions): Promise { - const { filePath } = options; + const { filePath, paidBy } = options; if (filePath === undefined) { throw new Error('Must provide a --file-path to upload'); } @@ -32,7 +32,7 @@ export async function uploadFile(options: UploadFileOptions): Promise { const result = await turbo.uploadFile({ fileStreamFactory: () => createReadStream(filePath), fileSizeFactory: () => fileSize, - dataItemOpts: { tags: [...turboCliTags] }, // TODO: Inject user tags + dataItemOpts: { tags: [...turboCliTags], paidBy }, // TODO: Inject user tags }); console.log('Uploaded file:', JSON.stringify(result, null, 2)); diff --git a/src/cli/options.ts b/src/cli/options.ts index b66113aa..4182fae1 100644 --- a/src/cli/options.ts +++ b/src/cli/options.ts @@ -120,6 +120,11 @@ export const optionMap = { alias: '--max-concurrency ', description: 'Maximum number of concurrent uploads', }, + paidBy: { + alias: '--paid-by ', + description: 'Address to pay for the upload', + type: 'array', + }, } as const; export const walletOptions = [ diff --git a/src/cli/types.ts b/src/cli/types.ts index 5c4edcb5..e2365570 100644 --- a/src/cli/types.ts +++ b/src/cli/types.ts @@ -50,6 +50,7 @@ export type UploadFolderOptions = WalletOptions & { export type UploadFileOptions = WalletOptions & { filePath: string | undefined; + paidBy: string[]; }; export type PriceOptions = GlobalOptions & {