From 2335a33befeecfc6488fd10c893230b448a7069c Mon Sep 17 00:00:00 2001 From: Eric Viana Date: Mon, 3 Aug 2026 16:46:03 -0300 Subject: [PATCH] feat!: rename transfer-quote and tos receiver flags/fields to customer (wave 2) Post-#1799 the wire contract uses customer_wallet_address, customer_token, customer_network on transfer-quote creation and customer_id on tos initiate. Flags follow: --customer-wallet-address, --customer-token, --customer-network, --customer-id. receiver_amount on quote responses is unchanged (never renamed). Claude-Session: https://claude.ai/code/session_01F1stiNzuNtJXoXtiW9ZCbs --- bun.lock | 1 + package.json | 2 +- src/__tests__/resources.test.ts | 24 ++++++++++++------------ src/commands/resources.ts | 16 ++++++++-------- src/index.ts | 12 ++++++------ 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/bun.lock b/bun.lock index 3aead91..997fd6a 100644 --- a/bun.lock +++ b/bun.lock @@ -1,5 +1,6 @@ { "lockfileVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "@blindpay/cli", diff --git a/package.json b/package.json index f214a72..09d3a43 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@blindpay/cli", "type": "module", - "version": "0.5.0", + "version": "0.6.0", "description": "Blindpay CLI - manage receivers, bank accounts, payouts, payins, and more from the terminal", "license": "MIT", "author": "Blindpay (https://blindpay.com/)", diff --git a/src/__tests__/resources.test.ts b/src/__tests__/resources.test.ts index 1cd6a8e..06da941 100644 --- a/src/__tests__/resources.test.ts +++ b/src/__tests__/resources.test.ts @@ -787,9 +787,9 @@ describe('Transfer Quotes', () => { await resources.createTransferQuote({ walletId: 'bl_1', senderToken: 'USDC', - receiverWalletAddress: '0xabc', - receiverToken: 'USDC', - receiverNetwork: 'polygon', + customerWalletAddress: '0xabc', + customerToken: 'USDC', + customerNetwork: 'polygon', requestAmount: '1000', amountReference: 'sender', coverFees: true, @@ -801,9 +801,9 @@ describe('Transfer Quotes', () => { expect(lastCall().body).toEqual({ wallet_id: 'bl_1', sender_token: 'USDC', - receiver_wallet_address: '0xabc', - receiver_token: 'USDC', - receiver_network: 'polygon', + customer_wallet_address: '0xabc', + customer_token: 'USDC', + customer_network: 'polygon', request_amount: 1000, amount_reference: 'sender', cover_fees: true, @@ -816,9 +816,9 @@ describe('Transfer Quotes', () => { await resources.createTransferQuote({ walletId: 'bl_1', senderToken: 'USDC', - receiverWalletAddress: '0xabc', - receiverToken: 'USDC', - receiverNetwork: 'polygon', + customerWalletAddress: '0xabc', + customerToken: 'USDC', + customerNetwork: 'polygon', requestAmount: '1000', amountReference: 'sender', json: true, @@ -846,7 +846,7 @@ describe('Terms of Service', () => { mockResponse.body = { url: 'https://app.blindpay.com/e/terms-of-service?...' } await resources.initiateTos({ idempotencyKey: 'idem-1', - receiverId: 're_xyz', + customerId: 're_xyz', redirectUrl: 'https://example.com', json: true, }) @@ -854,12 +854,12 @@ describe('Terms of Service', () => { expect(lastCall().url).toBe('https://api.blindpay.com/v1/e/instances/in_testInstance/tos') expect(lastCall().body).toEqual({ idempotency_key: 'idem-1', - receiver_id: 're_xyz', + customer_id: 're_xyz', redirect_url: 'https://example.com', }) }) - test('omits receiver_id and redirect_url from the body when not passed', async () => { + test('omits customer_id and redirect_url from the body when not passed', async () => { mockResponse.body = { url: 'https://...' } await resources.initiateTos({ idempotencyKey: 'idem-2', json: true }) expect(lastCall().body).toEqual({ idempotency_key: 'idem-2' }) diff --git a/src/commands/resources.ts b/src/commands/resources.ts index 20f7cc9..b3da819 100644 --- a/src/commands/resources.ts +++ b/src/commands/resources.ts @@ -1075,9 +1075,9 @@ export async function trackTransfer(id: string, options: { json: boolean }) { export async function createTransferQuote(options: { walletId: string senderToken: string - receiverWalletAddress: string - receiverToken: string - receiverNetwork: string + customerWalletAddress: string + customerToken: string + customerNetwork: string requestAmount: string amountReference: string coverFees?: boolean @@ -1089,9 +1089,9 @@ export async function createTransferQuote(options: { const body: Record = { wallet_id: options.walletId, sender_token: options.senderToken, - receiver_wallet_address: options.receiverWalletAddress, - receiver_token: options.receiverToken, - receiver_network: options.receiverNetwork, + customer_wallet_address: options.customerWalletAddress, + customer_token: options.customerToken, + customer_network: options.customerNetwork, request_amount: parseAmount(options.requestAmount, 0, options.json), amount_reference: options.amountReference, cover_fees: options.coverFees ?? false, @@ -1119,11 +1119,11 @@ export async function getInstanceFees(options: { json: boolean }) { } // Terms of Service -export async function initiateTos(options: { idempotencyKey: string, receiverId?: string, redirectUrl?: string, json: boolean }) { +export async function initiateTos(options: { idempotencyKey: string, customerId?: string, redirectUrl?: string, json: boolean }) { try { const ctx = resolveContext() const body: Record = { idempotency_key: options.idempotencyKey } - if (options.receiverId !== undefined) body.receiver_id = options.receiverId + if (options.customerId !== undefined) body.customer_id = options.customerId if (options.redirectUrl !== undefined) body.redirect_url = options.redirectUrl const res = await apiPost<{ url: string }>(ctx, `/v1/e/instances/${ctx.instanceId}/tos`, body) if (!options.json) clack.log.success(`Open this URL to accept the Terms of Service:\n${res.url}`) diff --git a/src/index.ts b/src/index.ts index 34a26d1..b2f3381 100644 --- a/src/index.ts +++ b/src/index.ts @@ -739,7 +739,7 @@ const transferQuotes = program.command('transfer_quotes').description('Manage tr .addHelpText('after', ` Examples: $ blindpay transfer_quotes create --wallet-id --sender-token USDC \\ - --receiver-wallet-address 0x... --receiver-token USDC --receiver-network polygon \\ + --customer-wallet-address 0x... --customer-token USDC --customer-network polygon \\ --request-amount 1000 --amount-reference sender`) transferQuotes @@ -747,9 +747,9 @@ transferQuotes .description('Create a transfer quote') .requiredOption('--wallet-id ', 'Sender wallet ID (bl_...)') .requiredOption('--sender-token ', 'Sender token (USDC, USDT, ...)') - .requiredOption('--receiver-wallet-address ', 'Receiver wallet address') - .requiredOption('--receiver-token ', 'Receiver token') - .requiredOption('--receiver-network ', 'Receiver network') + .requiredOption('--customer-wallet-address ', 'Customer wallet address') + .requiredOption('--customer-token ', 'Customer token') + .requiredOption('--customer-network ', 'Customer network') .requiredOption('--request-amount ', 'Request amount in cents') .requiredOption('--amount-reference ', 'Amount reference (sender or receiver)') .option('--cover-fees', 'Sender covers the fees', false) @@ -775,13 +775,13 @@ const tos = program.command('tos').description('Initiate Terms of Service flow') .addHelpText('after', ` Examples: $ blindpay tos initiate --idempotency-key - $ blindpay tos initiate --idempotency-key --receiver-id --redirect-url https://example.com`) + $ blindpay tos initiate --idempotency-key --customer-id --redirect-url https://example.com`) tos .command('initiate') .description('Initiate a Terms of Service session and return a hosted URL') .requiredOption('--idempotency-key ', 'Idempotency key') - .option('--receiver-id ', 'Receiver ID') + .option('--customer-id ', 'Customer ID') .option('--redirect-url ', 'Redirect URL after acceptance') .option('--json', 'Output as JSON', false) .action(opts => initiateTos(opts))