Socket
Socket
Sign inDemoInstall

@fiatconnect/fiatconnect-types

Package Overview
Dependencies
Maintainers
6
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fiatconnect/fiatconnect-types - npm Package Compare versions

Comparing version 8.0.0 to 9.0.0

dist/auth.d.ts

313

dist/index.d.ts

@@ -1,305 +0,8 @@

export declare type ClockResponse = {
time: string;
};
export interface AuthRequestBody {
message: string;
signature: string;
}
export declare type QuoteRequestBody = {
fiatType: FiatType;
cryptoType: CryptoType;
address: string;
fiatAmount?: string;
cryptoAmount?: string;
country: string;
region?: string;
};
export declare type QuoteResponse = {
quote: {
fiatType: FiatType;
cryptoType: CryptoType;
fiatAmount: string;
cryptoAmount: string;
guaranteedUntil: string;
quoteId: string;
transferType: TransferType;
fee?: string;
feeType?: FeeType;
feeFrequency?: FeeFrequency;
};
kyc: {
kycRequired: boolean;
kycSchemas: QuoteResponseKycSchema[];
};
fiatAccount: Partial<Record<FiatAccountType, FiatAccountTypeQuoteData>>;
};
export declare type QuoteResponseKycSchema = {
kycSchema: KycSchema;
allowedValues: {
[key: string]: string[];
};
};
export declare type QuoteErrorResponse = {
error: FiatConnectError;
minimumFiatAmount?: string;
maximumFiatAmount?: string;
minimumCryptoAmount?: string;
maximumCryptoAmount?: string;
};
export declare type FiatAccountTypeQuoteData = {
fiatAccountSchemas: QuoteResponseFiatAccountSchema[];
settlementTimeLowerBound?: string;
settlementTimeUpperBound?: string;
};
export declare type QuoteResponseFiatAccountSchema = {
fiatAccountSchema: FiatAccountSchema;
allowedValues: {
[key: string]: string[];
};
};
export declare type KycRequestParams = {
kycSchema: KycSchema;
};
export declare type KycStatusResponse = {
kycStatus: KycStatus;
};
export declare type PostFiatAccountRequestBody<T extends FiatAccountSchema> = {
fiatAccountSchema: T;
data: FiatAccountSchemas[T];
};
export declare type DeleteFiatAccountRequestParams = {
fiatAccountId: FiatAccountId;
};
export declare type GetFiatAccountsResponse = Partial<Record<FiatAccountType, ObfuscatedFiatAccountData[]>>;
export declare type PostFiatAccountResponse = ObfuscatedFiatAccountData;
export declare type ObfuscatedFiatAccountData = {
fiatAccountId: string;
accountName: string;
institutionName: string;
fiatAccountType: FiatAccountType;
fiatAccountSchema: FiatAccountSchema;
};
export declare type TransferRequestBody = {
fiatAccountId: string;
quoteId: string;
};
export declare type TransferResponse = {
transferId: string;
transferStatus: TransferStatus;
transferAddress: string;
};
export declare type TransferStatusRequestParams = {
transferId: string;
};
export declare type TransferStatusResponse = {
status: TransferStatus;
transferType: TransferType;
fiatType: FiatType;
cryptoType: CryptoType;
amountProvided: string;
amountReceived: string;
fee?: string;
fiatAccountId: string;
transferId: string;
transferAddress: string;
};
export declare type FiatAccountId = string;
export declare enum TransferType {
TransferIn = "TransferIn",
TransferOut = "TransferOut"
}
export declare enum TransferStatus {
TransferStarted = "TransferStarted",
TransferFiatFundsDebited = "TransferFiatFundsDebited",
TransferSendingCryptoFunds = "TransferSendingCryptoFunds",
TransferAmlFailed = "TransferAmlFailed",
TransferReadyForUserToSendCryptoFunds = "TransferReadyForUserToSendCryptoFunds",
TransferReceivedCryptoFunds = "TransferReceivedCryptoFunds",
TransferComplete = "TransferComplete",
TransferFailed = "TransferFailed"
}
export declare enum KycStatus {
KycNotCreated = "KycNotCreated",
KycPending = "KycPending",
KycApproved = "KycApproved",
KycDenied = "KycDenied",
KycExpired = "KycExpired"
}
export declare enum FeeType {
KycFee = "KycFee",
PlatformFee = "PlatformFee"
}
export declare enum FeeFrequency {
OneTime = "OneTime",
Recurring = "Recurring"
}
export declare enum WebhookEventType {
KycStatusEvent = "WebhookKycStatusEvent",
TransferInStatusEvent = "WebhookTransferInStatusEvent",
TransferOutStatusEvent = "WebhookTransferOutStatusEvent"
}
declare type WebhookEventPayload = {
[WebhookEventType.KycStatusEvent]: {
kycSchema: KycSchema;
kycStatus: KycStatus;
};
[WebhookEventType.TransferInStatusEvent]: TransferStatusResponse;
[WebhookEventType.TransferOutStatusEvent]: TransferStatusResponse;
};
export declare type WebhookRequestBody<T extends WebhookEventType> = {
eventType: T;
provider: string;
eventId: string;
timestamp: string;
address: string;
payload: WebhookEventPayload[T];
};
export declare enum FiatConnectError {
InvalidSignature = "InvalidSignature",
GeoNotSupported = "GeoNotSupported",
CryptoAmountTooLow = "CryptoAmountTooLow",
CryptoAmountTooHigh = "CryptoAmountTooHigh",
FiatAmountTooLow = "FiatAmountTooLow",
FiatAmountTooHigh = "FiatAmountTooHigh",
CryptoNotSupported = "CryptoNotSupported",
FiatNotSupported = "FiatNotSupported",
UnsupportedSchema = "UnsupportedSchema",
InvalidSchema = "InvalidSchema",
ResourceExists = "ResourceExists",
ResourceNotFound = "ResourceNotFound",
TransferNotAllowed = "TransferNotAllowed",
KycExpired = "KycExpired",
Unauthorized = "Unauthorized",
SessionExpired = "SessionExpired",
InvalidParameters = "InvalidParameters",
ContractLoginNotSupported = "ContractLoginNotSupported",
NonceInUse = "NonceInUse",
IssuedTooEarly = "IssuedTooEarly",
ExpirationTooLong = "ExpirationTooLong",
InvalidFiatAccount = "InvalidFiatAccount"
}
export declare enum Network {
Alfajores = "Alfajores",
Mainnet = "Mainnet"
}
export declare enum FiatType {
USD = "USD",
EUR = "EUR",
BRL = "BRL",
GNF = "GNF",
INR = "INR",
NGN = "NGN",
GHS = "GHS",
KES = "KES",
ZAR = "ZAR",
PHP = "PHP",
UGX = "UGX",
GBP = "GBP",
XOF = "XOF",
RWF = "RWF",
CNY = "CNY",
XAF = "XAF",
ARS = "ARS",
BOB = "BOB",
CLP = "CLP",
COP = "COP",
FKP = "FKP",
GYD = "GYD",
PYG = "PYG",
PEN = "PEN",
SRD = "SRD",
UYU = "UYU",
VES = "VES",
MXN = "MXN",
PAB = "PAB"
}
export declare enum CryptoType {
cUSD = "cUSD",
cEUR = "cEUR",
cREAL = "cREAL",
CELO = "CELO"
}
export declare enum KycSchema {
PersonalDataAndDocuments = "PersonalDataAndDocuments"
}
export declare enum FiatAccountSchema {
AccountNumber = "AccountNumber",
MobileMoney = "MobileMoney",
DuniaWallet = "DuniaWallet",
IBANNumber = "IBANNumber",
IFSCAccount = "IFSCAccount"
}
export declare enum FiatAccountType {
BankAccount = "BankAccount",
MobileMoney = "MobileMoney",
DuniaWallet = "DuniaWallet"
}
interface RequiredFiatAccountSchemaFields {
accountName: string;
institutionName: string;
fiatAccountType: FiatAccountType;
}
declare type AccountNumber = RequiredFiatAccountSchemaFields & {
accountNumber: string;
country: string;
fiatAccountType: FiatAccountType.BankAccount;
};
declare type MobileMoney = RequiredFiatAccountSchemaFields & {
mobile: string;
country: string;
operator: SupportedOperatorEnum;
fiatAccountType: FiatAccountType.MobileMoney;
};
declare type DuniaWallet = RequiredFiatAccountSchemaFields & {
mobile: string;
fiatAccountType: FiatAccountType.DuniaWallet;
};
declare type IBANNumber = RequiredFiatAccountSchemaFields & {
iban: string;
country: string;
fiatAccountType: FiatAccountType.BankAccount;
};
declare type IFSCAccount = RequiredFiatAccountSchemaFields & {
ifsc: string;
accountNumber: string;
country: string;
fiatAccountType: FiatAccountType.BankAccount;
};
export declare enum SupportedOperatorEnum {
ORANGE = "ORANGE",
MOOV = "MOOV",
MTN = "MTN",
WAVE = "WAVE"
}
export declare type FiatAccountSchemas = {
[FiatAccountSchema.AccountNumber]: AccountNumber;
[FiatAccountSchema.MobileMoney]: MobileMoney;
[FiatAccountSchema.DuniaWallet]: DuniaWallet;
[FiatAccountSchema.IBANNumber]: IBANNumber;
[FiatAccountSchema.IFSCAccount]: IFSCAccount;
};
interface PersonalDataAndDocumentsKyc {
firstName: string;
middleName?: string;
lastName: string;
dateOfBirth: {
day: string;
month: string;
year: string;
};
address: {
address1: string;
address2?: string;
isoCountryCode: string;
isoRegionCode: string;
city: string;
postalCode?: string;
};
phoneNumber: string;
selfieDocument: string;
identificationDocument: string;
}
export declare type KycSchemas = {
[KycSchema.PersonalDataAndDocuments]: PersonalDataAndDocumentsKyc;
};
export {};
export * from './clock';
export * from './auth';
export * from './common';
export * from './fiat-account';
export * from './kyc';
export * from './quote';
export * from './transfer';
export * from './webhook';
"use strict";
/*
/ Types for request and response bodies.
/
/ Typings for requests are grouped into three categories, each following a common naming convention
/ that mimics the convention used by Express.
/ - Request Query Parameters: Typed as `xxxRequestQuery`
/ - Request Path Parameters: Typed as `xxxRequestParams`
/ - Request Body: Typed as `xxxRequestBody`
/
/ Typings for responses always correspond to the response body, and use a single naming convention.
/ - Response Body: Typed as `xxxResponse`
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SupportedOperatorEnum = exports.FiatAccountType = exports.FiatAccountSchema = exports.KycSchema = exports.CryptoType = exports.FiatType = exports.Network = exports.FiatConnectError = exports.WebhookEventType = exports.FeeFrequency = exports.FeeType = exports.KycStatus = exports.TransferStatus = exports.TransferType = void 0;
var TransferType;
(function (TransferType) {
TransferType["TransferIn"] = "TransferIn";
TransferType["TransferOut"] = "TransferOut";
})(TransferType = exports.TransferType || (exports.TransferType = {}));
var TransferStatus;
(function (TransferStatus) {
TransferStatus["TransferStarted"] = "TransferStarted";
TransferStatus["TransferFiatFundsDebited"] = "TransferFiatFundsDebited";
TransferStatus["TransferSendingCryptoFunds"] = "TransferSendingCryptoFunds";
TransferStatus["TransferAmlFailed"] = "TransferAmlFailed";
TransferStatus["TransferReadyForUserToSendCryptoFunds"] = "TransferReadyForUserToSendCryptoFunds";
TransferStatus["TransferReceivedCryptoFunds"] = "TransferReceivedCryptoFunds";
TransferStatus["TransferComplete"] = "TransferComplete";
TransferStatus["TransferFailed"] = "TransferFailed";
})(TransferStatus = exports.TransferStatus || (exports.TransferStatus = {}));
var KycStatus;
(function (KycStatus) {
KycStatus["KycNotCreated"] = "KycNotCreated";
KycStatus["KycPending"] = "KycPending";
KycStatus["KycApproved"] = "KycApproved";
KycStatus["KycDenied"] = "KycDenied";
KycStatus["KycExpired"] = "KycExpired";
})(KycStatus = exports.KycStatus || (exports.KycStatus = {}));
var FeeType;
(function (FeeType) {
FeeType["KycFee"] = "KycFee";
FeeType["PlatformFee"] = "PlatformFee";
})(FeeType = exports.FeeType || (exports.FeeType = {}));
var FeeFrequency;
(function (FeeFrequency) {
FeeFrequency["OneTime"] = "OneTime";
FeeFrequency["Recurring"] = "Recurring";
})(FeeFrequency = exports.FeeFrequency || (exports.FeeFrequency = {}));
// Types for request bodies sent from FiatConnect webhooks
var WebhookEventType;
(function (WebhookEventType) {
WebhookEventType["KycStatusEvent"] = "WebhookKycStatusEvent";
WebhookEventType["TransferInStatusEvent"] = "WebhookTransferInStatusEvent";
WebhookEventType["TransferOutStatusEvent"] = "WebhookTransferOutStatusEvent";
})(WebhookEventType = exports.WebhookEventType || (exports.WebhookEventType = {}));
// Errors returned by FiatConnect endpoints
var FiatConnectError;
(function (FiatConnectError) {
FiatConnectError["InvalidSignature"] = "InvalidSignature";
FiatConnectError["GeoNotSupported"] = "GeoNotSupported";
FiatConnectError["CryptoAmountTooLow"] = "CryptoAmountTooLow";
FiatConnectError["CryptoAmountTooHigh"] = "CryptoAmountTooHigh";
FiatConnectError["FiatAmountTooLow"] = "FiatAmountTooLow";
FiatConnectError["FiatAmountTooHigh"] = "FiatAmountTooHigh";
FiatConnectError["CryptoNotSupported"] = "CryptoNotSupported";
FiatConnectError["FiatNotSupported"] = "FiatNotSupported";
FiatConnectError["UnsupportedSchema"] = "UnsupportedSchema";
FiatConnectError["InvalidSchema"] = "InvalidSchema";
FiatConnectError["ResourceExists"] = "ResourceExists";
FiatConnectError["ResourceNotFound"] = "ResourceNotFound";
FiatConnectError["TransferNotAllowed"] = "TransferNotAllowed";
FiatConnectError["KycExpired"] = "KycExpired";
FiatConnectError["Unauthorized"] = "Unauthorized";
FiatConnectError["SessionExpired"] = "SessionExpired";
FiatConnectError["InvalidParameters"] = "InvalidParameters";
FiatConnectError["ContractLoginNotSupported"] = "ContractLoginNotSupported";
FiatConnectError["NonceInUse"] = "NonceInUse";
FiatConnectError["IssuedTooEarly"] = "IssuedTooEarly";
FiatConnectError["ExpirationTooLong"] = "ExpirationTooLong";
FiatConnectError["InvalidFiatAccount"] = "InvalidFiatAccount";
})(FiatConnectError = exports.FiatConnectError || (exports.FiatConnectError = {}));
var Network;
(function (Network) {
Network["Alfajores"] = "Alfajores";
Network["Mainnet"] = "Mainnet";
})(Network = exports.Network || (exports.Network = {}));
/*
* FiatConnect dynamic type definitions.
*
* The following types contain information about currencies, tokens, KYC information, and Fiat Account information
* that are currently supported by payment providers. The types can be added to via a pull request to the FiatConnect
* specification repo -- for example, when support for a new currency or account type is added.
*
* Any interfaces/enum values prefixed with `Mock` are not officially supported by the FiatConnect specification,
* and are only included here as examples.
*/
var FiatType;
(function (FiatType) {
FiatType["USD"] = "USD";
FiatType["EUR"] = "EUR";
FiatType["BRL"] = "BRL";
FiatType["GNF"] = "GNF";
FiatType["INR"] = "INR";
FiatType["NGN"] = "NGN";
FiatType["GHS"] = "GHS";
FiatType["KES"] = "KES";
FiatType["ZAR"] = "ZAR";
FiatType["PHP"] = "PHP";
FiatType["UGX"] = "UGX";
FiatType["GBP"] = "GBP";
FiatType["XOF"] = "XOF";
FiatType["RWF"] = "RWF";
FiatType["CNY"] = "CNY";
FiatType["XAF"] = "XAF";
FiatType["ARS"] = "ARS";
FiatType["BOB"] = "BOB";
FiatType["CLP"] = "CLP";
FiatType["COP"] = "COP";
FiatType["FKP"] = "FKP";
FiatType["GYD"] = "GYD";
FiatType["PYG"] = "PYG";
FiatType["PEN"] = "PEN";
FiatType["SRD"] = "SRD";
FiatType["UYU"] = "UYU";
FiatType["VES"] = "VES";
FiatType["MXN"] = "MXN";
FiatType["PAB"] = "PAB";
})(FiatType = exports.FiatType || (exports.FiatType = {}));
var CryptoType;
(function (CryptoType) {
CryptoType["cUSD"] = "cUSD";
CryptoType["cEUR"] = "cEUR";
CryptoType["cREAL"] = "cREAL";
CryptoType["CELO"] = "CELO";
})(CryptoType = exports.CryptoType || (exports.CryptoType = {}));
var KycSchema;
(function (KycSchema) {
KycSchema["PersonalDataAndDocuments"] = "PersonalDataAndDocuments";
})(KycSchema = exports.KycSchema || (exports.KycSchema = {}));
var FiatAccountSchema;
(function (FiatAccountSchema) {
FiatAccountSchema["AccountNumber"] = "AccountNumber";
FiatAccountSchema["MobileMoney"] = "MobileMoney";
FiatAccountSchema["DuniaWallet"] = "DuniaWallet";
FiatAccountSchema["IBANNumber"] = "IBANNumber";
FiatAccountSchema["IFSCAccount"] = "IFSCAccount";
})(FiatAccountSchema = exports.FiatAccountSchema || (exports.FiatAccountSchema = {}));
var FiatAccountType;
(function (FiatAccountType) {
FiatAccountType["BankAccount"] = "BankAccount";
FiatAccountType["MobileMoney"] = "MobileMoney";
FiatAccountType["DuniaWallet"] = "DuniaWallet";
})(FiatAccountType = exports.FiatAccountType || (exports.FiatAccountType = {}));
var SupportedOperatorEnum;
(function (SupportedOperatorEnum) {
SupportedOperatorEnum["ORANGE"] = "ORANGE";
SupportedOperatorEnum["MOOV"] = "MOOV";
SupportedOperatorEnum["MTN"] = "MTN";
SupportedOperatorEnum["WAVE"] = "WAVE";
})(SupportedOperatorEnum = exports.SupportedOperatorEnum || (exports.SupportedOperatorEnum = {}));
__exportStar(require("./clock"), exports);
__exportStar(require("./auth"), exports);
__exportStar(require("./common"), exports);
__exportStar(require("./fiat-account"), exports);
__exportStar(require("./kyc"), exports);
__exportStar(require("./quote"), exports);
__exportStar(require("./transfer"), exports);
__exportStar(require("./webhook"), exports);
//# sourceMappingURL=index.js.map
{
"name": "@fiatconnect/fiatconnect-types",
"version": "8.0.0",
"version": "9.0.0",
"description": "Types used in the FiatConnect specification. Offered as standalone module for payment providers and wallets to both use for FiatConnect APIs and integrations.",

@@ -30,13 +30,13 @@ "scripts": {

"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@valora/eslint-config-typescript": "^1.0.1",
"@valora/prettier-config": "^0.0.1",
"conventional-changelog-conventionalcommits": "^5.0.0",
"eslint": "^8.25.0",
"eslint": "^8.26.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.1.1",
"eslint-plugin-jest": "^27.1.3",
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-native": "^4.0.0",
"jest": "^29.1.2",
"jest": "^29.2.2",
"prettier": "^2.7.1",

@@ -52,3 +52,6 @@ "semantic-release": "^19.0.5",

"preset": "conventionalcommits"
},
"dependencies": {
"zod": "^3.19.1"
}
}

@@ -36,2 +36,27 @@ # fiatconnect-types

## Zod Schemas
For each type exported from this package there is also a corresponding [zod schema](https://www.npmjs.com/package/zod) with the name `{typeWithFirstCharLowercase}Schema`. So for example `TransferStatus` has `transferStatusSchema`.
```typescript
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

@@ -38,0 +63,0 @@

@@ -1,425 +0,8 @@

/*
/ Types for request and response bodies.
/
/ Typings for requests are grouped into three categories, each following a common naming convention
/ that mimics the convention used by Express.
/ - Request Query Parameters: Typed as `xxxRequestQuery`
/ - Request Path Parameters: Typed as `xxxRequestParams`
/ - Request Body: Typed as `xxxRequestBody`
/
/ Typings for responses always correspond to the response body, and use a single naming convention.
/ - Response Body: Typed as `xxxResponse`
*/
/*
/ Clock Endpoint Types
*/
// Response body for GET /clock
export type ClockResponse = {
time: string
}
/*
/ Auth Endpoint Types
*/
// Request body for /auth/login endpoint
export interface AuthRequestBody {
message: string
signature: string
}
/*
/ Quote Endpoint Types
*/
// Request body for all /quote endpoints
export type QuoteRequestBody = {
fiatType: FiatType
cryptoType: CryptoType
address: string
fiatAmount?: string
cryptoAmount?: string
country: string
region?: string
}
// Response body for all /quote endpoints
export type QuoteResponse = {
quote: {
fiatType: FiatType
cryptoType: CryptoType
fiatAmount: string
cryptoAmount: string
guaranteedUntil: string
quoteId: string
transferType: TransferType
fee?: string
feeType?: FeeType
feeFrequency?: FeeFrequency
}
kyc: {
kycRequired: boolean
kycSchemas: QuoteResponseKycSchema[]
}
fiatAccount: Partial<Record<FiatAccountType, FiatAccountTypeQuoteData>>
}
// Helper type
export type QuoteResponseKycSchema = {
kycSchema: KycSchema
allowedValues: {
[key: string]: string[]
}
}
export type QuoteErrorResponse = {
error: FiatConnectError
minimumFiatAmount?: string
maximumFiatAmount?: string
minimumCryptoAmount?: string
maximumCryptoAmount?: string
}
// Helper type
export type FiatAccountTypeQuoteData = {
fiatAccountSchemas: QuoteResponseFiatAccountSchema[]
settlementTimeLowerBound?: string // ISO-8601 Duration
settlementTimeUpperBound?: string // ISO-8601 Duration
}
// Helper type
export type QuoteResponseFiatAccountSchema = {
fiatAccountSchema: FiatAccountSchema
allowedValues: {
[key: string]: string[]
}
}
/*
/ KYC Endpoint Types
*/
// Path parameters for all KYC endpoints
export type KycRequestParams = {
kycSchema: KycSchema
}
// Response body for POST /kyc/:kycSchema and GET /kyc/:kycSchema/status
export type KycStatusResponse = {
kycStatus: KycStatus
}
/*
/ Fiat Account Endpoint Types
*/
// Request body for POST /accounts/
export type PostFiatAccountRequestBody<T extends FiatAccountSchema> = {
fiatAccountSchema: T
data: FiatAccountSchemas[T]
}
// Path parameters for DELETE /accounts/:fiatAccountId
export type DeleteFiatAccountRequestParams = {
fiatAccountId: FiatAccountId
}
// Response body for GET /accounts/
export type GetFiatAccountsResponse = Partial<
Record<FiatAccountType, ObfuscatedFiatAccountData[]>
>
// Response body for POST /accounts/
export type PostFiatAccountResponse = ObfuscatedFiatAccountData
// Helper type. Generic representation of a fiat account, with personal information stripped.
export type ObfuscatedFiatAccountData = {
fiatAccountId: string
accountName: string
institutionName: string
fiatAccountType: FiatAccountType
fiatAccountSchema: FiatAccountSchema
}
/*
/ Transfer Endpoint Types
*/
// Request body for POST /transfer/in and POST /transfer/out
export type TransferRequestBody = {
fiatAccountId: string
quoteId: string
}
// Response body for POST /transfer/in and POST /transfer/out
export type TransferResponse = {
transferId: string
transferStatus: TransferStatus
transferAddress: string
}
// Path parameters for GET /transfer/:transferId/status
export type TransferStatusRequestParams = {
transferId: string
}
// Response body for GET /transfer/:transferId/status
export type TransferStatusResponse = {
status: TransferStatus
transferType: TransferType
fiatType: FiatType
cryptoType: CryptoType
amountProvided: string
amountReceived: string
fee?: string
fiatAccountId: string
transferId: string
transferAddress: string
}
/*
* FiatConnect static type definitions.
*/
export type FiatAccountId = string
export enum TransferType {
TransferIn = 'TransferIn',
TransferOut = 'TransferOut',
}
export enum TransferStatus {
TransferStarted = 'TransferStarted',
TransferFiatFundsDebited = 'TransferFiatFundsDebited',
TransferSendingCryptoFunds = 'TransferSendingCryptoFunds',
TransferAmlFailed = 'TransferAmlFailed',
TransferReadyForUserToSendCryptoFunds = 'TransferReadyForUserToSendCryptoFunds',
TransferReceivedCryptoFunds = 'TransferReceivedCryptoFunds',
TransferComplete = 'TransferComplete',
TransferFailed = 'TransferFailed',
}
export enum KycStatus {
KycNotCreated = 'KycNotCreated',
KycPending = 'KycPending',
KycApproved = 'KycApproved',
KycDenied = 'KycDenied',
KycExpired = 'KycExpired',
}
export enum FeeType {
KycFee = 'KycFee',
PlatformFee = 'PlatformFee',
}
export enum FeeFrequency {
OneTime = 'OneTime',
Recurring = 'Recurring',
}
// Types for request bodies sent from FiatConnect webhooks
export enum WebhookEventType {
KycStatusEvent = 'WebhookKycStatusEvent',
TransferInStatusEvent = 'WebhookTransferInStatusEvent',
TransferOutStatusEvent = 'WebhookTransferOutStatusEvent',
}
type WebhookEventPayload = {
[WebhookEventType.KycStatusEvent]: {
kycSchema: KycSchema
kycStatus: KycStatus
}
[WebhookEventType.TransferInStatusEvent]: TransferStatusResponse
[WebhookEventType.TransferOutStatusEvent]: TransferStatusResponse
}
export type WebhookRequestBody<T extends WebhookEventType> = {
eventType: T
provider: string
eventId: string
timestamp: string
address: string
payload: WebhookEventPayload[T]
}
// Errors returned by FiatConnect endpoints
export enum FiatConnectError {
InvalidSignature = 'InvalidSignature',
GeoNotSupported = 'GeoNotSupported',
CryptoAmountTooLow = 'CryptoAmountTooLow',
CryptoAmountTooHigh = 'CryptoAmountTooHigh',
FiatAmountTooLow = 'FiatAmountTooLow',
FiatAmountTooHigh = 'FiatAmountTooHigh',
CryptoNotSupported = 'CryptoNotSupported',
FiatNotSupported = 'FiatNotSupported',
UnsupportedSchema = 'UnsupportedSchema',
InvalidSchema = 'InvalidSchema',
ResourceExists = 'ResourceExists',
ResourceNotFound = 'ResourceNotFound',
TransferNotAllowed = 'TransferNotAllowed',
KycExpired = 'KycExpired',
Unauthorized = 'Unauthorized',
SessionExpired = 'SessionExpired',
InvalidParameters = 'InvalidParameters',
ContractLoginNotSupported = 'ContractLoginNotSupported',
NonceInUse = 'NonceInUse',
IssuedTooEarly = 'IssuedTooEarly',
ExpirationTooLong = 'ExpirationTooLong',
InvalidFiatAccount = 'InvalidFiatAccount',
}
export enum Network {
Alfajores = 'Alfajores',
Mainnet = 'Mainnet',
}
/*
* FiatConnect dynamic type definitions.
*
* The following types contain information about currencies, tokens, KYC information, and Fiat Account information
* that are currently supported by payment providers. The types can be added to via a pull request to the FiatConnect
* specification repo -- for example, when support for a new currency or account type is added.
*
* Any interfaces/enum values prefixed with `Mock` are not officially supported by the FiatConnect specification,
* and are only included here as examples.
*/
export enum FiatType {
USD = 'USD',
EUR = 'EUR',
BRL = 'BRL',
GNF = 'GNF',
INR = 'INR',
NGN = 'NGN',
GHS = 'GHS',
KES = 'KES',
ZAR = 'ZAR',
PHP = 'PHP',
UGX = 'UGX',
GBP = 'GBP',
XOF = 'XOF',
RWF = 'RWF',
CNY = 'CNY',
XAF = 'XAF',
ARS = 'ARS',
BOB = 'BOB',
CLP = 'CLP',
COP = 'COP',
FKP = 'FKP',
GYD = 'GYD',
PYG = 'PYG',
PEN = 'PEN',
SRD = 'SRD',
UYU = 'UYU',
VES = 'VES',
MXN = 'MXN',
PAB = 'PAB',
}
export enum CryptoType {
cUSD = 'cUSD',
cEUR = 'cEUR',
cREAL = 'cREAL',
CELO = 'CELO',
}
export enum KycSchema {
PersonalDataAndDocuments = 'PersonalDataAndDocuments',
}
export enum FiatAccountSchema {
AccountNumber = 'AccountNumber',
MobileMoney = 'MobileMoney',
DuniaWallet = 'DuniaWallet',
IBANNumber = 'IBANNumber',
IFSCAccount = 'IFSCAccount',
}
export enum FiatAccountType {
BankAccount = 'BankAccount',
MobileMoney = 'MobileMoney',
DuniaWallet = 'DuniaWallet',
}
interface RequiredFiatAccountSchemaFields {
accountName: string
institutionName: string
fiatAccountType: FiatAccountType
}
type AccountNumber = RequiredFiatAccountSchemaFields & {
accountNumber: string
country: string
fiatAccountType: FiatAccountType.BankAccount
}
type MobileMoney = RequiredFiatAccountSchemaFields & {
mobile: string
country: string
operator: SupportedOperatorEnum
fiatAccountType: FiatAccountType.MobileMoney
}
type DuniaWallet = RequiredFiatAccountSchemaFields & {
mobile: string
fiatAccountType: FiatAccountType.DuniaWallet
}
type IBANNumber = RequiredFiatAccountSchemaFields & {
iban: string
country: string
fiatAccountType: FiatAccountType.BankAccount
}
type IFSCAccount = RequiredFiatAccountSchemaFields & {
ifsc: string
accountNumber: string
country: string
fiatAccountType: FiatAccountType.BankAccount
}
export enum SupportedOperatorEnum {
ORANGE = 'ORANGE',
MOOV = 'MOOV',
MTN = 'MTN',
WAVE = 'WAVE',
}
// Map of all supported fiat account schemas to the corresponding schema type. List must be manually updated
export type FiatAccountSchemas = {
[FiatAccountSchema.AccountNumber]: AccountNumber
[FiatAccountSchema.MobileMoney]: MobileMoney
[FiatAccountSchema.DuniaWallet]: DuniaWallet
[FiatAccountSchema.IBANNumber]: IBANNumber
[FiatAccountSchema.IFSCAccount]: IFSCAccount
}
// https://github.com/fiatconnect/specification/blob/5929f7ea8ca99796608e89a9c8da4c1033dacf05/fiatconnect-api.md#728-personaldataanddocuments
interface PersonalDataAndDocumentsKyc {
firstName: string
middleName?: string
lastName: string
dateOfBirth: {
day: string
month: string
year: string
}
address: {
address1: string
address2?: string
isoCountryCode: string
isoRegionCode: string
city: string
postalCode?: string
}
phoneNumber: string
selfieDocument: string
identificationDocument: string
}
// Map of all supported KYC schemas to the corresponding schema type. List must be manually updated
export type KycSchemas = {
[KycSchema.PersonalDataAndDocuments]: PersonalDataAndDocumentsKyc
}
export * from './clock'
export * from './auth'
export * from './common'
export * from './fiat-account'
export * from './kyc'
export * from './quote'
export * from './transfer'
export * from './webhook'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc