Types used in the FiatConnect specification. Offered as standalone module for payment providers and wallets to both use for FiatConnect APIs and integrations.
From your project directory, run:
yarn add @fiatconnect/fiatconnect-types
or
npm i @fiatconnect/fiatconnect-types
import { TransferStatus } from '@fiatconnect/fiatconnect-types'
import axios from 'axios'
export async function getTransferStatus(
transferId: string,
): Promise<TransferStatus> {
const response = await axios
.create({ url: 'https://MOCK-PROVIDER-URL.fake' })
.get(`/transfer/${transferId}/status`)
return response.data.status
}
For each type exported from this package there is also a corresponding zod schema with the name {typeWithFirstCharLowercase}Schema
. So for example TransferStatus
has transferStatusSchema
.
import {
TransferStatus,
transferStatusSchema,
} from '@fiatconnect/fiatconnect-types'
import axios from 'axios'
import { z } from 'zod'
export async function getTransferStatus(
transferId: string,
): Promise<TransferStatus> {
const response = await axios
.create({ url: 'https://MOCK-PROVIDER-URL.fake' })
.get(`/transfer/${transferId}/status`)
// Will throw an error if the status does not match the schema
transferStatusSchema.parse(response.data.status)
return response.data.status
}
- Reporting issues
- Submitting a pull request
- Publishing updates is done automatically via semantic-release. Remember to use conventional commits or your PR will be rejected (since merging it would mess up the changelog and version numbers).