@fiatconnect/fiatconnect-types
Advanced tools
Comparing version 11.1.3 to 12.0.0
@@ -19,2 +19,23 @@ import { z } from 'zod'; | ||
export declare const transferStatusSchema: z.ZodNativeEnum<typeof TransferStatus>; | ||
export declare enum TransferInStatusPreTx { | ||
TransferStarted = "TransferStarted", | ||
TransferFiatFundsDebited = "TransferFiatFundsDebited", | ||
TransferReceivedFiatFunds = "TransferReceivedFiatFunds", | ||
TransferFailed = "TransferFailed" | ||
} | ||
export declare const transferInStatusPreTxSchema: z.ZodNativeEnum<typeof TransferInStatusPreTx>; | ||
export declare enum TransferInStatusPostTx { | ||
TransferSendingCryptoFunds = "TransferSendingCryptoFunds", | ||
TransferComplete = "TransferComplete" | ||
} | ||
export declare const transferInStatusPostTxSchema: z.ZodNativeEnum<typeof TransferInStatusPostTx>; | ||
export declare enum TransferOutStatus { | ||
TransferStarted = "TransferStarted", | ||
TransferAmlFailed = "TransferAmlFailed", | ||
TransferReadyForUserToSendCryptoFunds = "TransferReadyForUserToSendCryptoFunds", | ||
TransferReceivedCryptoFunds = "TransferReceivedCryptoFunds", | ||
TransferComplete = "TransferComplete", | ||
TransferFailed = "TransferFailed" | ||
} | ||
export declare const transferOutStatusSchema: z.ZodNativeEnum<typeof TransferOutStatus>; | ||
export declare const transferRequestBodySchema: z.ZodObject<{ | ||
@@ -53,5 +74,5 @@ fiatAccountId: z.ZodString; | ||
export type TransferStatusRequestParams = z.infer<typeof transferStatusRequestParamsSchema>; | ||
export declare const transferStatusResponseSchema: z.ZodObject<{ | ||
status: z.ZodNativeEnum<typeof TransferStatus>; | ||
transferType: z.ZodNativeEnum<typeof TransferType>; | ||
export declare const transferInStatusResponseSchema: z.ZodUnion<[z.ZodObject<{ | ||
status: z.ZodNativeEnum<typeof TransferInStatusPreTx>; | ||
transferType: z.ZodLiteral<TransferType.TransferIn>; | ||
fiatType: z.ZodNativeEnum<typeof import("./common").FiatType>; | ||
@@ -66,7 +87,7 @@ cryptoType: z.ZodNativeEnum<typeof import("./common").CryptoType>; | ||
}, "strip", z.ZodTypeAny, { | ||
status: TransferStatus; | ||
status: TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: TransferType; | ||
transferType: TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
@@ -78,7 +99,7 @@ cryptoType: import("./common").CryptoType; | ||
}, { | ||
status: TransferStatus; | ||
status: TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: TransferType; | ||
transferType: TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
@@ -89,3 +110,176 @@ cryptoType: import("./common").CryptoType; | ||
fee?: string | undefined; | ||
}>, z.ZodObject<{ | ||
fiatAccountId: z.ZodString; | ||
transferId: z.ZodString; | ||
transferAddress: z.ZodString; | ||
transferType: z.ZodLiteral<TransferType.TransferIn>; | ||
fiatType: z.ZodNativeEnum<typeof import("./common").FiatType>; | ||
cryptoType: z.ZodNativeEnum<typeof import("./common").CryptoType>; | ||
amountProvided: z.ZodString; | ||
amountReceived: z.ZodString; | ||
fee: z.ZodOptional<z.ZodString>; | ||
status: z.ZodNativeEnum<typeof TransferInStatusPostTx>; | ||
txHash: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
status: TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
}, { | ||
status: TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
}>]>; | ||
export declare const transferOutStatusResponseSchema: z.ZodObject<{ | ||
fiatAccountId: z.ZodString; | ||
transferId: z.ZodString; | ||
transferAddress: z.ZodString; | ||
fiatType: z.ZodNativeEnum<typeof import("./common").FiatType>; | ||
cryptoType: z.ZodNativeEnum<typeof import("./common").CryptoType>; | ||
amountProvided: z.ZodString; | ||
amountReceived: z.ZodString; | ||
fee: z.ZodOptional<z.ZodString>; | ||
transferType: z.ZodLiteral<TransferType.TransferOut>; | ||
status: z.ZodNativeEnum<typeof TransferOutStatus>; | ||
}, "strip", z.ZodTypeAny, { | ||
status: TransferOutStatus; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: TransferType.TransferOut; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
fee?: string | undefined; | ||
}, { | ||
status: TransferOutStatus; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: TransferType.TransferOut; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
fee?: string | undefined; | ||
}>; | ||
export declare const transferStatusResponseSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{ | ||
status: z.ZodNativeEnum<typeof TransferInStatusPreTx>; | ||
transferType: z.ZodLiteral<TransferType.TransferIn>; | ||
fiatType: z.ZodNativeEnum<typeof import("./common").FiatType>; | ||
cryptoType: z.ZodNativeEnum<typeof import("./common").CryptoType>; | ||
amountProvided: z.ZodString; | ||
amountReceived: z.ZodString; | ||
fee: z.ZodOptional<z.ZodString>; | ||
fiatAccountId: z.ZodString; | ||
transferId: z.ZodString; | ||
transferAddress: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
status: TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
fee?: string | undefined; | ||
}, { | ||
status: TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
fee?: string | undefined; | ||
}>, z.ZodObject<{ | ||
fiatAccountId: z.ZodString; | ||
transferId: z.ZodString; | ||
transferAddress: z.ZodString; | ||
transferType: z.ZodLiteral<TransferType.TransferIn>; | ||
fiatType: z.ZodNativeEnum<typeof import("./common").FiatType>; | ||
cryptoType: z.ZodNativeEnum<typeof import("./common").CryptoType>; | ||
amountProvided: z.ZodString; | ||
amountReceived: z.ZodString; | ||
fee: z.ZodOptional<z.ZodString>; | ||
status: z.ZodNativeEnum<typeof TransferInStatusPostTx>; | ||
txHash: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
status: TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
}, { | ||
status: TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
}>]>, z.ZodObject<{ | ||
fiatAccountId: z.ZodString; | ||
transferId: z.ZodString; | ||
transferAddress: z.ZodString; | ||
fiatType: z.ZodNativeEnum<typeof import("./common").FiatType>; | ||
cryptoType: z.ZodNativeEnum<typeof import("./common").CryptoType>; | ||
amountProvided: z.ZodString; | ||
amountReceived: z.ZodString; | ||
fee: z.ZodOptional<z.ZodString>; | ||
transferType: z.ZodLiteral<TransferType.TransferOut>; | ||
status: z.ZodNativeEnum<typeof TransferOutStatus>; | ||
}, "strip", z.ZodTypeAny, { | ||
status: TransferOutStatus; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: TransferType.TransferOut; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
fee?: string | undefined; | ||
}, { | ||
status: TransferOutStatus; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: TransferType.TransferOut; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
fee?: string | undefined; | ||
}>]>; | ||
export type TransferStatusResponse = z.infer<typeof transferStatusResponseSchema>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.transferStatusResponseSchema = exports.transferStatusRequestParamsSchema = exports.transferResponseSchema = exports.transferRequestBodySchema = exports.transferStatusSchema = exports.TransferStatus = exports.transferTypeSchema = exports.TransferType = void 0; | ||
exports.transferStatusResponseSchema = exports.transferOutStatusResponseSchema = exports.transferInStatusResponseSchema = exports.transferStatusRequestParamsSchema = exports.transferResponseSchema = exports.transferRequestBodySchema = exports.transferOutStatusSchema = exports.TransferOutStatus = exports.transferInStatusPostTxSchema = exports.TransferInStatusPostTx = exports.transferInStatusPreTxSchema = exports.TransferInStatusPreTx = exports.transferStatusSchema = exports.TransferStatus = exports.transferTypeSchema = exports.TransferType = void 0; | ||
const zod_1 = require("zod"); | ||
@@ -30,2 +30,38 @@ const fiat_account_1 = require("./fiat-account"); | ||
}); | ||
// These enums are first segmented between transfers in and transfers out | ||
// since they both allow a slightly different set of statuses. | ||
// Transfer in statuses are further segmented, since once a transfer in | ||
// progresses to sending the user funds, providers are expected | ||
// to return new metadata about the transfer. This segmentation allows | ||
// us to encode those semantics into Zod schemas. | ||
var TransferInStatusPreTx; | ||
(function (TransferInStatusPreTx) { | ||
TransferInStatusPreTx["TransferStarted"] = "TransferStarted"; | ||
TransferInStatusPreTx["TransferFiatFundsDebited"] = "TransferFiatFundsDebited"; | ||
TransferInStatusPreTx["TransferReceivedFiatFunds"] = "TransferReceivedFiatFunds"; | ||
TransferInStatusPreTx["TransferFailed"] = "TransferFailed"; | ||
})(TransferInStatusPreTx = exports.TransferInStatusPreTx || (exports.TransferInStatusPreTx = {})); | ||
exports.transferInStatusPreTxSchema = zod_1.z.nativeEnum(TransferInStatusPreTx, { | ||
description: 'transferInStatusPreTxSchema', | ||
}); | ||
var TransferInStatusPostTx; | ||
(function (TransferInStatusPostTx) { | ||
TransferInStatusPostTx["TransferSendingCryptoFunds"] = "TransferSendingCryptoFunds"; | ||
TransferInStatusPostTx["TransferComplete"] = "TransferComplete"; | ||
})(TransferInStatusPostTx = exports.TransferInStatusPostTx || (exports.TransferInStatusPostTx = {})); | ||
exports.transferInStatusPostTxSchema = zod_1.z.nativeEnum(TransferInStatusPostTx, { | ||
description: 'transferInStatusPostTxSchema', | ||
}); | ||
var TransferOutStatus; | ||
(function (TransferOutStatus) { | ||
TransferOutStatus["TransferStarted"] = "TransferStarted"; | ||
TransferOutStatus["TransferAmlFailed"] = "TransferAmlFailed"; | ||
TransferOutStatus["TransferReadyForUserToSendCryptoFunds"] = "TransferReadyForUserToSendCryptoFunds"; | ||
TransferOutStatus["TransferReceivedCryptoFunds"] = "TransferReceivedCryptoFunds"; | ||
TransferOutStatus["TransferComplete"] = "TransferComplete"; | ||
TransferOutStatus["TransferFailed"] = "TransferFailed"; | ||
})(TransferOutStatus = exports.TransferOutStatus || (exports.TransferOutStatus = {})); | ||
exports.transferOutStatusSchema = zod_1.z.nativeEnum(TransferOutStatus, { | ||
description: 'transferOutStatusSchema', | ||
}); | ||
/* | ||
@@ -46,5 +82,5 @@ / Transfer Endpoint Types | ||
}, { description: 'transferStatusRequestParamsSchema' }); | ||
exports.transferStatusResponseSchema = zod_1.z.object({ | ||
status: exports.transferStatusSchema, | ||
transferType: exports.transferTypeSchema, | ||
const transferInStatusPreTxResponseSchema = zod_1.z.object({ | ||
status: exports.transferInStatusPreTxSchema, | ||
transferType: zod_1.z.literal(TransferType.TransferIn), | ||
fiatType: common_1.fiatTypeSchema, | ||
@@ -58,3 +94,13 @@ cryptoType: common_1.cryptoTypeSchema, | ||
transferAddress: zod_1.z.string(), | ||
}, { description: 'transferStatusResponseSchema' }); | ||
}, { description: 'transferInStatusPreTxResponseSchema' }); | ||
const transferInStatusPostTxResponseSchema = zod_1.z.object(transferInStatusPreTxResponseSchema.extend({ | ||
status: exports.transferInStatusPostTxSchema, | ||
txHash: zod_1.z.string(), | ||
}).shape, { description: 'transferInStatusPostTxResponseSchema' }); | ||
exports.transferInStatusResponseSchema = transferInStatusPreTxResponseSchema.or(transferInStatusPostTxResponseSchema); | ||
exports.transferOutStatusResponseSchema = zod_1.z.object(transferInStatusPreTxResponseSchema.extend({ | ||
transferType: zod_1.z.literal(TransferType.TransferOut), | ||
status: exports.transferOutStatusSchema, | ||
}).shape, { description: 'transferOutStatusResponseSchema' }); | ||
exports.transferStatusResponseSchema = exports.transferInStatusResponseSchema.or(exports.transferOutStatusResponseSchema); | ||
//# sourceMappingURL=transfer.js.map |
@@ -25,5 +25,5 @@ import { z } from 'zod'; | ||
eventType: z.ZodLiteral<WebhookEventType.TransferInStatusEvent>; | ||
payload: z.ZodObject<{ | ||
status: z.ZodNativeEnum<typeof import("./transfer").TransferStatus>; | ||
transferType: z.ZodNativeEnum<typeof import("./transfer").TransferType>; | ||
payload: z.ZodUnion<[z.ZodObject<{ | ||
status: z.ZodNativeEnum<typeof import("./transfer").TransferInStatusPreTx>; | ||
transferType: z.ZodLiteral<import("./transfer").TransferType.TransferIn>; | ||
fiatType: z.ZodNativeEnum<typeof import("./common").FiatType>; | ||
@@ -38,7 +38,7 @@ cryptoType: z.ZodNativeEnum<typeof import("./common").CryptoType>; | ||
}, "strip", z.ZodTypeAny, { | ||
status: import("./transfer").TransferStatus; | ||
status: import("./transfer").TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
@@ -50,7 +50,7 @@ cryptoType: import("./common").CryptoType; | ||
}, { | ||
status: import("./transfer").TransferStatus; | ||
status: import("./transfer").TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
@@ -61,11 +61,47 @@ cryptoType: import("./common").CryptoType; | ||
fee?: string | undefined; | ||
}>; | ||
}>, z.ZodObject<{ | ||
fiatAccountId: z.ZodString; | ||
transferId: z.ZodString; | ||
transferAddress: z.ZodString; | ||
transferType: z.ZodLiteral<import("./transfer").TransferType.TransferIn>; | ||
fiatType: z.ZodNativeEnum<typeof import("./common").FiatType>; | ||
cryptoType: z.ZodNativeEnum<typeof import("./common").CryptoType>; | ||
amountProvided: z.ZodString; | ||
amountReceived: z.ZodString; | ||
fee: z.ZodOptional<z.ZodString>; | ||
status: z.ZodNativeEnum<typeof import("./transfer").TransferInStatusPostTx>; | ||
txHash: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
status: import("./transfer").TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
}, { | ||
status: import("./transfer").TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
}>]>; | ||
}, "strip", z.ZodTypeAny, { | ||
eventType: WebhookEventType.TransferInStatusEvent; | ||
payload: { | ||
status: import("./transfer").TransferStatus; | ||
payload: ({ | ||
status: import("./transfer").TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
@@ -76,11 +112,46 @@ cryptoType: import("./common").CryptoType; | ||
fee?: string | undefined; | ||
}; | ||
} | { | ||
status: import("./transfer").TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
}) & ({ | ||
status: import("./transfer").TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
fee?: string | undefined; | ||
} | { | ||
status: import("./transfer").TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
} | undefined); | ||
}, { | ||
eventType: WebhookEventType.TransferInStatusEvent; | ||
payload: { | ||
status: import("./transfer").TransferStatus; | ||
payload: ({ | ||
status: import("./transfer").TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
@@ -91,3 +162,38 @@ cryptoType: import("./common").CryptoType; | ||
fee?: string | undefined; | ||
}; | ||
} | { | ||
status: import("./transfer").TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
}) & ({ | ||
status: import("./transfer").TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
fee?: string | undefined; | ||
} | { | ||
status: import("./transfer").TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
} | undefined); | ||
}>>; | ||
@@ -113,4 +219,5 @@ export type WebhookRequestBodyTransferIn = z.infer<typeof webhookRequestBodyTransferInSchema>; | ||
payload: z.ZodObject<{ | ||
status: z.ZodNativeEnum<typeof import("./transfer").TransferStatus>; | ||
transferType: z.ZodNativeEnum<typeof import("./transfer").TransferType>; | ||
fiatAccountId: z.ZodString; | ||
transferId: z.ZodString; | ||
transferAddress: z.ZodString; | ||
fiatType: z.ZodNativeEnum<typeof import("./common").FiatType>; | ||
@@ -121,11 +228,10 @@ cryptoType: z.ZodNativeEnum<typeof import("./common").CryptoType>; | ||
fee: z.ZodOptional<z.ZodString>; | ||
fiatAccountId: z.ZodString; | ||
transferId: z.ZodString; | ||
transferAddress: z.ZodString; | ||
transferType: z.ZodLiteral<import("./transfer").TransferType.TransferOut>; | ||
status: z.ZodNativeEnum<typeof import("./transfer").TransferOutStatus>; | ||
}, "strip", z.ZodTypeAny, { | ||
status: import("./transfer").TransferStatus; | ||
status: import("./transfer").TransferOutStatus; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferOut; | ||
fiatType: import("./common").FiatType; | ||
@@ -137,7 +243,7 @@ cryptoType: import("./common").CryptoType; | ||
}, { | ||
status: import("./transfer").TransferStatus; | ||
status: import("./transfer").TransferOutStatus; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferOut; | ||
fiatType: import("./common").FiatType; | ||
@@ -152,7 +258,7 @@ cryptoType: import("./common").CryptoType; | ||
payload: { | ||
status: import("./transfer").TransferStatus; | ||
status: import("./transfer").TransferOutStatus; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferOut; | ||
fiatType: import("./common").FiatType; | ||
@@ -167,7 +273,7 @@ cryptoType: import("./common").CryptoType; | ||
payload: { | ||
status: import("./transfer").TransferStatus; | ||
status: import("./transfer").TransferOutStatus; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferOut; | ||
fiatType: import("./common").FiatType; | ||
@@ -239,5 +345,5 @@ cryptoType: import("./common").CryptoType; | ||
eventType: z.ZodLiteral<WebhookEventType.TransferInStatusEvent>; | ||
payload: z.ZodObject<{ | ||
status: z.ZodNativeEnum<typeof import("./transfer").TransferStatus>; | ||
transferType: z.ZodNativeEnum<typeof import("./transfer").TransferType>; | ||
payload: z.ZodUnion<[z.ZodObject<{ | ||
status: z.ZodNativeEnum<typeof import("./transfer").TransferInStatusPreTx>; | ||
transferType: z.ZodLiteral<import("./transfer").TransferType.TransferIn>; | ||
fiatType: z.ZodNativeEnum<typeof import("./common").FiatType>; | ||
@@ -252,7 +358,7 @@ cryptoType: z.ZodNativeEnum<typeof import("./common").CryptoType>; | ||
}, "strip", z.ZodTypeAny, { | ||
status: import("./transfer").TransferStatus; | ||
status: import("./transfer").TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
@@ -264,7 +370,7 @@ cryptoType: import("./common").CryptoType; | ||
}, { | ||
status: import("./transfer").TransferStatus; | ||
status: import("./transfer").TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
@@ -275,11 +381,47 @@ cryptoType: import("./common").CryptoType; | ||
fee?: string | undefined; | ||
}>; | ||
}>, z.ZodObject<{ | ||
fiatAccountId: z.ZodString; | ||
transferId: z.ZodString; | ||
transferAddress: z.ZodString; | ||
transferType: z.ZodLiteral<import("./transfer").TransferType.TransferIn>; | ||
fiatType: z.ZodNativeEnum<typeof import("./common").FiatType>; | ||
cryptoType: z.ZodNativeEnum<typeof import("./common").CryptoType>; | ||
amountProvided: z.ZodString; | ||
amountReceived: z.ZodString; | ||
fee: z.ZodOptional<z.ZodString>; | ||
status: z.ZodNativeEnum<typeof import("./transfer").TransferInStatusPostTx>; | ||
txHash: z.ZodString; | ||
}, "strip", z.ZodTypeAny, { | ||
status: import("./transfer").TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
}, { | ||
status: import("./transfer").TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
}>]>; | ||
}, "strip", z.ZodTypeAny, { | ||
eventType: WebhookEventType.TransferInStatusEvent; | ||
payload: { | ||
status: import("./transfer").TransferStatus; | ||
payload: ({ | ||
status: import("./transfer").TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
@@ -290,11 +432,46 @@ cryptoType: import("./common").CryptoType; | ||
fee?: string | undefined; | ||
}; | ||
} | { | ||
status: import("./transfer").TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
}) & ({ | ||
status: import("./transfer").TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
fee?: string | undefined; | ||
} | { | ||
status: import("./transfer").TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
} | undefined); | ||
}, { | ||
eventType: WebhookEventType.TransferInStatusEvent; | ||
payload: { | ||
status: import("./transfer").TransferStatus; | ||
payload: ({ | ||
status: import("./transfer").TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
@@ -305,3 +482,38 @@ cryptoType: import("./common").CryptoType; | ||
fee?: string | undefined; | ||
}; | ||
} | { | ||
status: import("./transfer").TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
}) & ({ | ||
status: import("./transfer").TransferInStatusPreTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
fee?: string | undefined; | ||
} | { | ||
status: import("./transfer").TransferInStatusPostTx; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType.TransferIn; | ||
fiatType: import("./common").FiatType; | ||
cryptoType: import("./common").CryptoType; | ||
amountProvided: string; | ||
amountReceived: string; | ||
txHash: string; | ||
fee?: string | undefined; | ||
} | undefined); | ||
}>>, z.ZodIntersection<z.ZodObject<{ | ||
@@ -325,4 +537,5 @@ provider: z.ZodString; | ||
payload: z.ZodObject<{ | ||
status: z.ZodNativeEnum<typeof import("./transfer").TransferStatus>; | ||
transferType: z.ZodNativeEnum<typeof import("./transfer").TransferType>; | ||
fiatAccountId: z.ZodString; | ||
transferId: z.ZodString; | ||
transferAddress: z.ZodString; | ||
fiatType: z.ZodNativeEnum<typeof import("./common").FiatType>; | ||
@@ -333,11 +546,10 @@ cryptoType: z.ZodNativeEnum<typeof import("./common").CryptoType>; | ||
fee: z.ZodOptional<z.ZodString>; | ||
fiatAccountId: z.ZodString; | ||
transferId: z.ZodString; | ||
transferAddress: z.ZodString; | ||
transferType: z.ZodLiteral<import("./transfer").TransferType.TransferOut>; | ||
status: z.ZodNativeEnum<typeof import("./transfer").TransferOutStatus>; | ||
}, "strip", z.ZodTypeAny, { | ||
status: import("./transfer").TransferStatus; | ||
status: import("./transfer").TransferOutStatus; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferOut; | ||
fiatType: import("./common").FiatType; | ||
@@ -349,7 +561,7 @@ cryptoType: import("./common").CryptoType; | ||
}, { | ||
status: import("./transfer").TransferStatus; | ||
status: import("./transfer").TransferOutStatus; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferOut; | ||
fiatType: import("./common").FiatType; | ||
@@ -364,7 +576,7 @@ cryptoType: import("./common").CryptoType; | ||
payload: { | ||
status: import("./transfer").TransferStatus; | ||
status: import("./transfer").TransferOutStatus; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferOut; | ||
fiatType: import("./common").FiatType; | ||
@@ -379,7 +591,7 @@ cryptoType: import("./common").CryptoType; | ||
payload: { | ||
status: import("./transfer").TransferStatus; | ||
status: import("./transfer").TransferOutStatus; | ||
fiatAccountId: string; | ||
transferId: string; | ||
transferAddress: string; | ||
transferType: import("./transfer").TransferType; | ||
transferType: import("./transfer").TransferType.TransferOut; | ||
fiatType: import("./common").FiatType; | ||
@@ -386,0 +598,0 @@ cryptoType: import("./common").CryptoType; |
@@ -24,3 +24,3 @@ "use strict"; | ||
eventType: zod_1.z.literal(WebhookEventType.TransferInStatusEvent), | ||
payload: transfer_1.transferStatusResponseSchema, | ||
payload: transfer_1.transferInStatusResponseSchema, | ||
}), { | ||
@@ -31,3 +31,3 @@ description: 'webhookRequestBodyTransferInSchema', | ||
eventType: zod_1.z.literal(WebhookEventType.TransferOutStatusEvent), | ||
payload: transfer_1.transferStatusResponseSchema, | ||
payload: transfer_1.transferOutStatusResponseSchema, | ||
}), { | ||
@@ -34,0 +34,0 @@ description: 'webhookRequestBodyTransferOutSchema', |
{ | ||
"name": "@fiatconnect/fiatconnect-types", | ||
"version": "11.1.3", | ||
"version": "12.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.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -28,2 +28,41 @@ import { z } from 'zod' | ||
// These enums are first segmented between transfers in and transfers out | ||
// since they both allow a slightly different set of statuses. | ||
// Transfer in statuses are further segmented, since once a transfer in | ||
// progresses to sending the user funds, providers are expected | ||
// to return new metadata about the transfer. This segmentation allows | ||
// us to encode those semantics into Zod schemas. | ||
export enum TransferInStatusPreTx { | ||
TransferStarted = TransferStatus.TransferStarted, | ||
TransferFiatFundsDebited = TransferStatus.TransferFiatFundsDebited, | ||
TransferReceivedFiatFunds = TransferStatus.TransferReceivedFiatFunds, | ||
TransferFailed = TransferStatus.TransferFailed, | ||
} | ||
export const transferInStatusPreTxSchema = z.nativeEnum(TransferInStatusPreTx, { | ||
description: 'transferInStatusPreTxSchema', | ||
}) | ||
export enum TransferInStatusPostTx { | ||
TransferSendingCryptoFunds = TransferStatus.TransferSendingCryptoFunds, | ||
TransferComplete = TransferStatus.TransferComplete, | ||
} | ||
export const transferInStatusPostTxSchema = z.nativeEnum( | ||
TransferInStatusPostTx, | ||
{ | ||
description: 'transferInStatusPostTxSchema', | ||
}, | ||
) | ||
export enum TransferOutStatus { | ||
TransferStarted = TransferStatus.TransferStarted, | ||
TransferAmlFailed = TransferStatus.TransferAmlFailed, | ||
TransferReadyForUserToSendCryptoFunds = TransferStatus.TransferReadyForUserToSendCryptoFunds, | ||
TransferReceivedCryptoFunds = TransferStatus.TransferReceivedCryptoFunds, | ||
TransferComplete = TransferStatus.TransferComplete, | ||
TransferFailed = TransferStatus.TransferFailed, | ||
} | ||
export const transferOutStatusSchema = z.nativeEnum(TransferOutStatus, { | ||
description: 'transferOutStatusSchema', | ||
}) | ||
/* | ||
@@ -62,6 +101,6 @@ / Transfer Endpoint Types | ||
export const transferStatusResponseSchema = z.object( | ||
const transferInStatusPreTxResponseSchema = z.object( | ||
{ | ||
status: transferStatusSchema, | ||
transferType: transferTypeSchema, | ||
status: transferInStatusPreTxSchema, | ||
transferType: z.literal(TransferType.TransferIn), | ||
fiatType: fiatTypeSchema, | ||
@@ -76,6 +115,27 @@ cryptoType: cryptoTypeSchema, | ||
}, | ||
{ description: 'transferStatusResponseSchema' }, | ||
{ description: 'transferInStatusPreTxResponseSchema' }, | ||
) | ||
const transferInStatusPostTxResponseSchema = z.object( | ||
transferInStatusPreTxResponseSchema.extend({ | ||
status: transferInStatusPostTxSchema, | ||
txHash: z.string(), | ||
}).shape, | ||
{ description: 'transferInStatusPostTxResponseSchema' }, | ||
) | ||
export const transferInStatusResponseSchema = | ||
transferInStatusPreTxResponseSchema.or(transferInStatusPostTxResponseSchema) | ||
export const transferOutStatusResponseSchema = z.object( | ||
transferInStatusPreTxResponseSchema.extend({ | ||
transferType: z.literal(TransferType.TransferOut), | ||
status: transferOutStatusSchema, | ||
}).shape, | ||
{ description: 'transferOutStatusResponseSchema' }, | ||
) | ||
export const transferStatusResponseSchema = transferInStatusResponseSchema.or( | ||
transferOutStatusResponseSchema, | ||
) | ||
export type TransferStatusResponse = z.infer< | ||
typeof transferStatusResponseSchema | ||
> |
import { z } from 'zod' | ||
import { kycSchemaSchema, kycStatusSchema } from './kyc' | ||
import { transferStatusResponseSchema } from './transfer' | ||
import { | ||
transferInStatusResponseSchema, | ||
transferOutStatusResponseSchema, | ||
} from './transfer' | ||
@@ -25,3 +28,3 @@ export enum WebhookEventType { | ||
eventType: z.literal(WebhookEventType.TransferInStatusEvent), | ||
payload: transferStatusResponseSchema, | ||
payload: transferInStatusResponseSchema, | ||
}), | ||
@@ -40,3 +43,3 @@ { | ||
eventType: z.literal(WebhookEventType.TransferOutStatusEvent), | ||
payload: transferStatusResponseSchema, | ||
payload: transferOutStatusResponseSchema, | ||
}), | ||
@@ -43,0 +46,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
194391
4469