← Public packages
@kentcdodds/wise
Call Wise profiles, balances, quotes, recipients, and transfers with wiseApiToken.
src/get-transfer.ts
31 lines · 971 B · TypeScriptimport { clean, wiseRequest } from './core.ts'
/**
* Get one Wise transfer by id.
* Read-only; uses GET /v1/transfers/{transferId}.
*
* @param input.transferId - Wise transfer id (required).
*
* @example
* import getTransfer from 'kody:@kentcdodds/wise/get-transfer'
* const transfer = await getTransfer({ transferId: 123 })
*/
export default async function getTransfer(input: { transferId: number | string }) {
const transferId = clean(input.transferId)
if (!transferId) throw new Error('transferId is required')
const raw = (await wiseRequest({
path: `/v1/transfers/${transferId}`,
label: 'Wise transfer',
})) as Record<string, unknown>
return {
id: raw.id ?? null,
status: raw.status ?? null,
sourceCurrency: raw.sourceCurrency ?? null,
targetCurrency: raw.targetCurrency ?? null,
sourceValue: raw.sourceValue ?? null,
targetValue: raw.targetValue ?? null,
created: raw.created ?? null,
reference: raw.reference ?? null,
raw,
}
}