@fiatconnect/fiatconnect-types
v13.3.8
Published
Types used in the FiatConnect specification. Offered as standalone module for payment providers and wallets to both use for FiatConnect APIs and integrations.
Downloads
5,066
Readme
fiatconnect-types
Types used in the FiatConnect specification. Offered as standalone module for payment providers and wallets to both use for FiatConnect APIs and integrations.
Installation
From your project directory, run:
yarn add @fiatconnect/fiatconnect-types
or
npm i @fiatconnect/fiatconnect-types
Example usage
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
}
Zod Schemas
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
}
Contributing
- 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).