Skip to content

Commit

Permalink
feat(delegated payments): add paid-by headers for uploads when applic…
Browse files Browse the repository at this point in the history
…able PE-6754
  • Loading branch information
fedellen committed Oct 16, 2024
1 parent e565bf7 commit 953648e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cli/commands/uploadFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { UploadFileOptions } from '../types.js';
import { turboFromOptions } from '../utils.js';

export async function uploadFile(options: UploadFileOptions): Promise<void> {
const { filePath } = options;
const { filePath, paidBy } = options;
if (filePath === undefined) {
throw new Error('Must provide a --file-path to upload');
}
Expand All @@ -32,7 +32,7 @@ export async function uploadFile(options: UploadFileOptions): Promise<void> {
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));
Expand Down
5 changes: 5 additions & 0 deletions src/cli/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ export const optionMap = {
alias: '--max-concurrency <maxConcurrency>',
description: 'Maximum number of concurrent uploads',
},
paidBy: {
alias: '--paid-by <paidBy...>',
description: 'Address to pay for the upload',
type: 'array',
},
} as const;

export const walletOptions = [
Expand Down
1 change: 1 addition & 0 deletions src/cli/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export type UploadFolderOptions = WalletOptions & {

export type UploadFileOptions = WalletOptions & {
filePath: string | undefined;
paidBy: string[];
};

export type PriceOptions = GlobalOptions & {
Expand Down

0 comments on commit 953648e

Please sign in to comment.