@fun-xyz/fiat-contract 0.36.0-uda.4 → 0.36.0-uda.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-WFLO72JO.mjs → chunk-S6CA2WGQ.mjs} +4 -4
- package/dist/index.js +13 -13
- package/dist/index.mjs +10 -10
- package/dist/providers/moonpay.d.ts +3 -3
- package/dist/routing.d.ts +3 -3
- package/dist/schemas.d.ts +2 -2
- package/dist/table.js +4 -4
- package/dist/table.mjs +1 -1
- package/dist/types.d.ts +8 -7
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.36.0-uda.
|
|
2
|
+
var version = "0.36.0-uda.5";
|
|
3
3
|
|
|
4
4
|
// src/table.ts
|
|
5
5
|
var TABLE_VERSION = version;
|
|
@@ -366,7 +366,7 @@ var TRANSITION_TABLE = {
|
|
|
366
366
|
id: "delivery",
|
|
367
367
|
mode: "AWAIT",
|
|
368
368
|
endpoint: "GET /fiat/orders/:id/delivery",
|
|
369
|
-
when: "status is SETTLED and the order is converted: the provider paid a deposit address that converts into the
|
|
369
|
+
when: "status is SETTLED and the order is converted: the provider paid a deposit address that converts into the destinationAsset",
|
|
370
370
|
note: "The backend decides; the client never infers a converted order. It follows this transition when offered, and otherwise treats SETTLED as done."
|
|
371
371
|
},
|
|
372
372
|
{
|
|
@@ -418,7 +418,7 @@ var TRANSITION_TABLE = {
|
|
|
418
418
|
mayReturn: ["DELIVERY:PENDING", "DELIVERY:SUCCEEDED", "DELIVERY:FAILED"],
|
|
419
419
|
terminal: false,
|
|
420
420
|
notes: [
|
|
421
|
-
"The fiat leg is SETTLED; a crypto asset provider is converting it into the
|
|
421
|
+
"The fiat leg is SETTLED; a crypto asset provider is converting it into the destinationAsset and paying the user. The client shows a generic processing screen."
|
|
422
422
|
]
|
|
423
423
|
},
|
|
424
424
|
"DELIVERY:SUCCEEDED": {
|
|
@@ -430,7 +430,7 @@ var TRANSITION_TABLE = {
|
|
|
430
430
|
allowedTransitions: [],
|
|
431
431
|
mayReturn: [],
|
|
432
432
|
terminal: true,
|
|
433
|
-
notes: ["The
|
|
433
|
+
notes: ["The destinationAsset reached the user. txHash is the transaction that paid them."]
|
|
434
434
|
},
|
|
435
435
|
"DELIVERY:FAILED": {
|
|
436
436
|
key: "DELIVERY:FAILED",
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ __export(index_exports, {
|
|
|
31
31
|
CryptoAmountSchema: () => CryptoAmountSchema,
|
|
32
32
|
DOCUMENTED_ENDPOINTS: () => DOCUMENTED_ENDPOINTS,
|
|
33
33
|
DeliveryStateSchema: () => DeliveryStateSchema,
|
|
34
|
+
DestinationAssetSchema: () => DestinationAssetSchema,
|
|
34
35
|
ENDPOINT_PATTERN: () => ENDPOINT_PATTERN,
|
|
35
36
|
FIAT_CURRENCY_NAMES: () => FIAT_CURRENCY_NAMES,
|
|
36
37
|
FIAT_TERMS_ENDPOINT: () => FIAT_TERMS_ENDPOINT,
|
|
@@ -42,7 +43,6 @@ __export(index_exports, {
|
|
|
42
43
|
FeeLineSchema: () => FeeLineSchema,
|
|
43
44
|
FiatAmountSchema: () => FiatAmountSchema,
|
|
44
45
|
FiatCurrencyCode: () => FiatCurrencyCode,
|
|
45
|
-
FiatDestinationSchema: () => FiatDestinationSchema,
|
|
46
46
|
FiatEndpointSchema: () => FiatEndpointSchema,
|
|
47
47
|
FiatGeoSchema: () => FiatGeoSchema,
|
|
48
48
|
FiatNextRequestSchema: () => FiatNextRequestSchema,
|
|
@@ -1068,7 +1068,7 @@ var $evmAddress = import_zod.z.custom(
|
|
|
1068
1068
|
"must be an EVM address: 0x and 40 hex digits"
|
|
1069
1069
|
);
|
|
1070
1070
|
var $solanaAddress = import_zod.z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/, "must be a Solana base58 address");
|
|
1071
|
-
var $
|
|
1071
|
+
var $evmDestinationAsset = obj({
|
|
1072
1072
|
vm: import_zod.z.literal("EVM"),
|
|
1073
1073
|
chainId: import_zod.z.number().int().positive(),
|
|
1074
1074
|
asset: import_zod.z.discriminatedUnion("kind", [
|
|
@@ -1086,7 +1086,7 @@ var $evmDestination = obj({
|
|
|
1086
1086
|
})
|
|
1087
1087
|
])
|
|
1088
1088
|
});
|
|
1089
|
-
var $
|
|
1089
|
+
var $solanaDestinationAsset = obj({
|
|
1090
1090
|
vm: import_zod.z.literal("SOLANA"),
|
|
1091
1091
|
asset: import_zod.z.discriminatedUnion("kind", [
|
|
1092
1092
|
obj({
|
|
@@ -1099,8 +1099,8 @@ var $solanaDestination = obj({
|
|
|
1099
1099
|
obj({ kind: import_zod.z.literal("NON_FUNGIBLE"), mint: $solanaAddress })
|
|
1100
1100
|
])
|
|
1101
1101
|
});
|
|
1102
|
-
var $
|
|
1103
|
-
var
|
|
1102
|
+
var $destinationAsset = import_zod.z.discriminatedUnion("vm", [$evmDestinationAsset, $solanaDestinationAsset]);
|
|
1103
|
+
var DestinationAssetSchema = $destinationAsset;
|
|
1104
1104
|
var $decimalAmount = import_zod.z.string().regex(/^(?:0|[1-9]\d*)(?:\.\d+)?$/, "must be a decimal string");
|
|
1105
1105
|
var compareDecimals = (left, right) => {
|
|
1106
1106
|
const [leftWhole = "", leftFraction = ""] = left.split(".");
|
|
@@ -1128,7 +1128,7 @@ var $routingTableRequest = obj({
|
|
|
1128
1128
|
// Duplicates are allowed; the response lists each method once.
|
|
1129
1129
|
methods: import_zod.z.array(import_zod.z.enum(PAYMENT_METHOD_CATEGORIES)).min(1),
|
|
1130
1130
|
providers: $routingTableProviderInputs.optional(),
|
|
1131
|
-
|
|
1131
|
+
destinationAsset: $destinationAsset.optional()
|
|
1132
1132
|
}).refine((request) => hasUsRegion(request.country, request.region), { message: US_REGION_REQUIRED, path: ["region"] });
|
|
1133
1133
|
var FiatRoutingTableRequestSchema = $routingTableRequest;
|
|
1134
1134
|
var $routingTableProvider = obj({
|
|
@@ -1174,7 +1174,7 @@ var $routingQuoteTermsShape = {
|
|
|
1174
1174
|
),
|
|
1175
1175
|
prepareSessionAuth: import_zod.z.boolean().optional(),
|
|
1176
1176
|
routingOverrides: obj({ providers: import_zod.z.array($routingProvider) }).optional(),
|
|
1177
|
-
|
|
1177
|
+
destinationAsset: $destinationAsset.optional()
|
|
1178
1178
|
};
|
|
1179
1179
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
1180
1180
|
var FiatRoutingQuoteTermsSchema = $routingQuoteTerms;
|
|
@@ -1230,7 +1230,7 @@ var $routingQuoteErrorBody = import_zod.z.union([$routingNoRouteErrorBody, $rout
|
|
|
1230
1230
|
var FiatRoutingQuoteErrorBodySchema = $routingQuoteErrorBody;
|
|
1231
1231
|
var $fiatGeo = obj({ alpha2: import_zod.z.string().regex(/^[A-Z]{2}$/), region: $nonBlank.optional(), ip: $nonBlank.optional() });
|
|
1232
1232
|
var FiatGeoSchema = $fiatGeo;
|
|
1233
|
-
var $nextRequest = import_zod.z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo,
|
|
1233
|
+
var $nextRequest = import_zod.z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo, destinationAsset: $destinationAsset.optional() }).catchall(import_zod.z.unknown());
|
|
1234
1234
|
var FiatNextRequestSchema = $nextRequest;
|
|
1235
1235
|
var $providerBoundStepResponse = obj({
|
|
1236
1236
|
state: $providerBoundFlowState,
|
|
@@ -1291,7 +1291,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $blockedStep
|
|
|
1291
1291
|
var FiatStepResponseSchema = $stepResponse;
|
|
1292
1292
|
|
|
1293
1293
|
// package.json
|
|
1294
|
-
var version = "0.36.0-uda.
|
|
1294
|
+
var version = "0.36.0-uda.5";
|
|
1295
1295
|
|
|
1296
1296
|
// src/table.ts
|
|
1297
1297
|
var TABLE_VERSION = version;
|
|
@@ -1658,7 +1658,7 @@ var TRANSITION_TABLE = {
|
|
|
1658
1658
|
id: "delivery",
|
|
1659
1659
|
mode: "AWAIT",
|
|
1660
1660
|
endpoint: "GET /fiat/orders/:id/delivery",
|
|
1661
|
-
when: "status is SETTLED and the order is converted: the provider paid a deposit address that converts into the
|
|
1661
|
+
when: "status is SETTLED and the order is converted: the provider paid a deposit address that converts into the destinationAsset",
|
|
1662
1662
|
note: "The backend decides; the client never infers a converted order. It follows this transition when offered, and otherwise treats SETTLED as done."
|
|
1663
1663
|
},
|
|
1664
1664
|
{
|
|
@@ -1710,7 +1710,7 @@ var TRANSITION_TABLE = {
|
|
|
1710
1710
|
mayReturn: ["DELIVERY:PENDING", "DELIVERY:SUCCEEDED", "DELIVERY:FAILED"],
|
|
1711
1711
|
terminal: false,
|
|
1712
1712
|
notes: [
|
|
1713
|
-
"The fiat leg is SETTLED; a crypto asset provider is converting it into the
|
|
1713
|
+
"The fiat leg is SETTLED; a crypto asset provider is converting it into the destinationAsset and paying the user. The client shows a generic processing screen."
|
|
1714
1714
|
]
|
|
1715
1715
|
},
|
|
1716
1716
|
"DELIVERY:SUCCEEDED": {
|
|
@@ -1722,7 +1722,7 @@ var TRANSITION_TABLE = {
|
|
|
1722
1722
|
allowedTransitions: [],
|
|
1723
1723
|
mayReturn: [],
|
|
1724
1724
|
terminal: true,
|
|
1725
|
-
notes: ["The
|
|
1725
|
+
notes: ["The destinationAsset reached the user. txHash is the transaction that paid them."]
|
|
1726
1726
|
},
|
|
1727
1727
|
"DELIVERY:FAILED": {
|
|
1728
1728
|
key: "DELIVERY:FAILED",
|
|
@@ -3111,7 +3111,7 @@ var $checkout = obj2({
|
|
|
3111
3111
|
var MoonPayCheckoutSchema = $checkout;
|
|
3112
3112
|
var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
|
|
3113
3113
|
var MoonPaySdkCredentialsSchema = $credentials;
|
|
3114
|
-
var $context = { checkout: $checkout, credentials: $credentials.optional(),
|
|
3114
|
+
var $context = { checkout: $checkout, credentials: $credentials.optional(), destinationAsset: DestinationAssetSchema.optional() };
|
|
3115
3115
|
var $requestContext = obj2($context);
|
|
3116
3116
|
var MoonPayRequestContextSchema = $requestContext;
|
|
3117
3117
|
var $quoteInput = obj2({
|
package/dist/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
tableEntry,
|
|
13
13
|
unofferedEndpoints,
|
|
14
14
|
unreachableStates
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-S6CA2WGQ.mjs";
|
|
16
16
|
import {
|
|
17
17
|
MOONPAY_ENDPOINTS
|
|
18
18
|
} from "./chunk-TIEGTTFY.mjs";
|
|
@@ -918,7 +918,7 @@ var $evmAddress = z.custom(
|
|
|
918
918
|
"must be an EVM address: 0x and 40 hex digits"
|
|
919
919
|
);
|
|
920
920
|
var $solanaAddress = z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/, "must be a Solana base58 address");
|
|
921
|
-
var $
|
|
921
|
+
var $evmDestinationAsset = obj({
|
|
922
922
|
vm: z.literal("EVM"),
|
|
923
923
|
chainId: z.number().int().positive(),
|
|
924
924
|
asset: z.discriminatedUnion("kind", [
|
|
@@ -936,7 +936,7 @@ var $evmDestination = obj({
|
|
|
936
936
|
})
|
|
937
937
|
])
|
|
938
938
|
});
|
|
939
|
-
var $
|
|
939
|
+
var $solanaDestinationAsset = obj({
|
|
940
940
|
vm: z.literal("SOLANA"),
|
|
941
941
|
asset: z.discriminatedUnion("kind", [
|
|
942
942
|
obj({
|
|
@@ -949,8 +949,8 @@ var $solanaDestination = obj({
|
|
|
949
949
|
obj({ kind: z.literal("NON_FUNGIBLE"), mint: $solanaAddress })
|
|
950
950
|
])
|
|
951
951
|
});
|
|
952
|
-
var $
|
|
953
|
-
var
|
|
952
|
+
var $destinationAsset = z.discriminatedUnion("vm", [$evmDestinationAsset, $solanaDestinationAsset]);
|
|
953
|
+
var DestinationAssetSchema = $destinationAsset;
|
|
954
954
|
var $decimalAmount = z.string().regex(/^(?:0|[1-9]\d*)(?:\.\d+)?$/, "must be a decimal string");
|
|
955
955
|
var compareDecimals = (left, right) => {
|
|
956
956
|
const [leftWhole = "", leftFraction = ""] = left.split(".");
|
|
@@ -978,7 +978,7 @@ var $routingTableRequest = obj({
|
|
|
978
978
|
// Duplicates are allowed; the response lists each method once.
|
|
979
979
|
methods: z.array(z.enum(PAYMENT_METHOD_CATEGORIES)).min(1),
|
|
980
980
|
providers: $routingTableProviderInputs.optional(),
|
|
981
|
-
|
|
981
|
+
destinationAsset: $destinationAsset.optional()
|
|
982
982
|
}).refine((request) => hasUsRegion(request.country, request.region), { message: US_REGION_REQUIRED, path: ["region"] });
|
|
983
983
|
var FiatRoutingTableRequestSchema = $routingTableRequest;
|
|
984
984
|
var $routingTableProvider = obj({
|
|
@@ -1024,7 +1024,7 @@ var $routingQuoteTermsShape = {
|
|
|
1024
1024
|
),
|
|
1025
1025
|
prepareSessionAuth: z.boolean().optional(),
|
|
1026
1026
|
routingOverrides: obj({ providers: z.array($routingProvider) }).optional(),
|
|
1027
|
-
|
|
1027
|
+
destinationAsset: $destinationAsset.optional()
|
|
1028
1028
|
};
|
|
1029
1029
|
var $routingQuoteTerms = obj($routingQuoteTermsShape);
|
|
1030
1030
|
var FiatRoutingQuoteTermsSchema = $routingQuoteTerms;
|
|
@@ -1080,7 +1080,7 @@ var $routingQuoteErrorBody = z.union([$routingNoRouteErrorBody, $routingAmountEr
|
|
|
1080
1080
|
var FiatRoutingQuoteErrorBodySchema = $routingQuoteErrorBody;
|
|
1081
1081
|
var $fiatGeo = obj({ alpha2: z.string().regex(/^[A-Z]{2}$/), region: $nonBlank.optional(), ip: $nonBlank.optional() });
|
|
1082
1082
|
var FiatGeoSchema = $fiatGeo;
|
|
1083
|
-
var $nextRequest = z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo,
|
|
1083
|
+
var $nextRequest = z.object({ provider: $provider, action: $nonBlank, geo: $fiatGeo, destinationAsset: $destinationAsset.optional() }).catchall(z.unknown());
|
|
1084
1084
|
var FiatNextRequestSchema = $nextRequest;
|
|
1085
1085
|
var $providerBoundStepResponse = obj({
|
|
1086
1086
|
state: $providerBoundFlowState,
|
|
@@ -2328,7 +2328,7 @@ var $checkout = obj2({
|
|
|
2328
2328
|
var MoonPayCheckoutSchema = $checkout;
|
|
2329
2329
|
var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
|
|
2330
2330
|
var MoonPaySdkCredentialsSchema = $credentials;
|
|
2331
|
-
var $context = { checkout: $checkout, credentials: $credentials.optional(),
|
|
2331
|
+
var $context = { checkout: $checkout, credentials: $credentials.optional(), destinationAsset: DestinationAssetSchema.optional() };
|
|
2332
2332
|
var $requestContext = obj2($context);
|
|
2333
2333
|
var MoonPayRequestContextSchema = $requestContext;
|
|
2334
2334
|
var $quoteInput = obj2({
|
|
@@ -2524,6 +2524,7 @@ export {
|
|
|
2524
2524
|
CryptoAmountSchema,
|
|
2525
2525
|
DOCUMENTED_ENDPOINTS,
|
|
2526
2526
|
DeliveryStateSchema,
|
|
2527
|
+
DestinationAssetSchema,
|
|
2527
2528
|
ENDPOINT_PATTERN,
|
|
2528
2529
|
FIAT_CURRENCY_NAMES,
|
|
2529
2530
|
FIAT_TERMS_ENDPOINT,
|
|
@@ -2535,7 +2536,6 @@ export {
|
|
|
2535
2536
|
FeeLineSchema,
|
|
2536
2537
|
FiatAmountSchema,
|
|
2537
2538
|
FiatCurrencyCode,
|
|
2538
|
-
FiatDestinationSchema,
|
|
2539
2539
|
FiatEndpointSchema,
|
|
2540
2540
|
FiatGeoSchema,
|
|
2541
2541
|
FiatNextRequestSchema,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import type { FiatCurrencyCode } from '../codes';
|
|
23
23
|
import type { FiatTermsRequest, TermsDocument } from '../terms';
|
|
24
|
-
import type { FiatAmount,
|
|
24
|
+
import type { FiatAmount, DestinationAsset, FiatGeo, FiatStepResponse, FormField, KYCProvider, KycFieldId, KycSdkResultReport } from '../types';
|
|
25
25
|
export declare const MOONPAY_ENDPOINTS: {
|
|
26
26
|
readonly next: "POST /fiat/next";
|
|
27
27
|
};
|
|
@@ -43,13 +43,13 @@ export interface MoonPaySdkCredentials {
|
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* On every request, not part of the result. `credentials` is present after `connect`.
|
|
46
|
-
* `
|
|
46
|
+
* `destinationAsset` is the asset the user receives at the end; `checkout.destination` stays the quote's
|
|
47
47
|
* asset, which MoonPay delivers.
|
|
48
48
|
*/
|
|
49
49
|
export type MoonPayRequestContext = {
|
|
50
50
|
checkout: MoonPayCheckout;
|
|
51
51
|
credentials?: MoonPaySdkCredentials;
|
|
52
|
-
|
|
52
|
+
destinationAsset?: DestinationAsset;
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
55
55
|
* The parameters for the device `client.getQuote`, not a quote. The backend builds them because the
|
package/dist/routing.d.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* an extra key or a blank string fails them, so send only the declared fields.
|
|
22
22
|
*/
|
|
23
23
|
import type { CountryCode, FiatCurrencyCode, PaymentMethodCategory } from './codes';
|
|
24
|
-
import type { FiatAmount,
|
|
24
|
+
import type { FiatAmount, DestinationAsset, FiatProvider, QuoteLimitRange } from './types';
|
|
25
25
|
export declare const ROUTING_ENDPOINTS: {
|
|
26
26
|
readonly table: "POST /fiat/routing/table";
|
|
27
27
|
/** Temporary: `POST /fiat/next` replaces it for each provider that moves there. */
|
|
@@ -59,7 +59,7 @@ export interface FiatRoutingTableRequest {
|
|
|
59
59
|
* The asset the user receives. Always sent; the backend adds a conversion only when it differs
|
|
60
60
|
* from the partner's configured asset. Optional so an older client still parses.
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
destinationAsset?: DestinationAsset;
|
|
63
63
|
}
|
|
64
64
|
/** What a provider needs from this buyer before it can take the payment. */
|
|
65
65
|
export type RoutingNextStep = 'READY' | 'AUTH' | 'DECLARATIVE_KYC' | 'DOCUMENTARY_KYC' | 'PENDING_REVIEW';
|
|
@@ -136,7 +136,7 @@ export interface FiatRoutingQuoteTerms {
|
|
|
136
136
|
* The asset the user receives. Always sent; the backend adds a conversion only when it differs
|
|
137
137
|
* from the partner's configured asset. Optional so an older client still parses.
|
|
138
138
|
*/
|
|
139
|
-
|
|
139
|
+
destinationAsset?: DestinationAsset;
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
142
|
* `POST /fiat/routing/quote`: the terms plus which providers to price, in one of two forms.
|
package/dist/schemas.d.ts
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import { z } from 'zod';
|
|
30
30
|
import type { UsStateCode } from './codes';
|
|
31
|
-
import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatProvider, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, KycReviewDuration, OrderRef, OrderStatus, OrderSummary, PollSpec, PreparedPayment, PaymentSurface, Quote, QuoteLimitRange, QuoteLimits, Recovery, Refund, ReportSpec, SelectOption, StatusHistoryEntry, Surface, PreferredIdentityDocument, KycFieldId, ClientExecutedDelivery, KycSdkResultReport, SurfaceKind, SurfaceProvider, TermsAcceptance, Transition, TransitionInputs, TransitionParams, Tx,
|
|
31
|
+
import type { BlockedReason, CryptoAmount, FailureReason, FeeLine, FiatAmount, FiatEndpoint, FiatProvider, FiatStepResponse, FieldSpec, FlowState, FormDescriptor, FormField, FormFieldType, InstructionField, Instructions, Instrument, JsonValue, KYCProvider, KycReviewDuration, OrderRef, OrderStatus, OrderSummary, PollSpec, PreparedPayment, PaymentSurface, Quote, QuoteLimitRange, QuoteLimits, Recovery, Refund, ReportSpec, SelectOption, StatusHistoryEntry, Surface, PreferredIdentityDocument, KycFieldId, ClientExecutedDelivery, KycSdkResultReport, SurfaceKind, SurfaceProvider, TermsAcceptance, Transition, TransitionInputs, TransitionParams, Tx, DestinationAsset, FiatGeo, FiatNextRequest } from './types';
|
|
32
32
|
import type { FiatTermsErrorBody, FiatTermsRequest, FiatTermsResponse, TermsDocument, TermsDocumentAcceptance } from './terms';
|
|
33
33
|
import type { FiatRoutingQuoteErrorBody, FiatRoutingQuoteRequest, FiatRoutingQuoteTerms, FiatRoutingTableErrorBody, FiatRoutingTableRequest, FiatRoutingTableResponse } from './routing';
|
|
34
34
|
export declare const JsonSchema: z.ZodType<JsonValue>;
|
|
@@ -114,7 +114,7 @@ export declare const TermsDocumentAcceptanceSchema: z.ZodType<TermsDocumentAccep
|
|
|
114
114
|
export declare const FiatTermsRequestSchema: z.ZodType<FiatTermsRequest>;
|
|
115
115
|
export declare const FiatTermsResponseSchema: z.ZodType<FiatTermsResponse>;
|
|
116
116
|
export declare const FiatTermsErrorBodySchema: z.ZodType<FiatTermsErrorBody>;
|
|
117
|
-
export declare const
|
|
117
|
+
export declare const DestinationAssetSchema: z.ZodType<DestinationAsset>;
|
|
118
118
|
export declare const FiatRoutingTableRequestSchema: z.ZodType<FiatRoutingTableRequest>;
|
|
119
119
|
export declare const FiatRoutingTableResponseSchema: z.ZodType<FiatRoutingTableResponse>;
|
|
120
120
|
export declare const FiatRoutingQuoteTermsSchema: z.ZodType<FiatRoutingQuoteTerms>;
|
package/dist/table.js
CHANGED
|
@@ -36,7 +36,7 @@ __export(table_exports, {
|
|
|
36
36
|
module.exports = __toCommonJS(table_exports);
|
|
37
37
|
|
|
38
38
|
// package.json
|
|
39
|
-
var version = "0.36.0-uda.
|
|
39
|
+
var version = "0.36.0-uda.5";
|
|
40
40
|
|
|
41
41
|
// src/table.ts
|
|
42
42
|
var TABLE_VERSION = version;
|
|
@@ -403,7 +403,7 @@ var TRANSITION_TABLE = {
|
|
|
403
403
|
id: "delivery",
|
|
404
404
|
mode: "AWAIT",
|
|
405
405
|
endpoint: "GET /fiat/orders/:id/delivery",
|
|
406
|
-
when: "status is SETTLED and the order is converted: the provider paid a deposit address that converts into the
|
|
406
|
+
when: "status is SETTLED and the order is converted: the provider paid a deposit address that converts into the destinationAsset",
|
|
407
407
|
note: "The backend decides; the client never infers a converted order. It follows this transition when offered, and otherwise treats SETTLED as done."
|
|
408
408
|
},
|
|
409
409
|
{
|
|
@@ -455,7 +455,7 @@ var TRANSITION_TABLE = {
|
|
|
455
455
|
mayReturn: ["DELIVERY:PENDING", "DELIVERY:SUCCEEDED", "DELIVERY:FAILED"],
|
|
456
456
|
terminal: false,
|
|
457
457
|
notes: [
|
|
458
|
-
"The fiat leg is SETTLED; a crypto asset provider is converting it into the
|
|
458
|
+
"The fiat leg is SETTLED; a crypto asset provider is converting it into the destinationAsset and paying the user. The client shows a generic processing screen."
|
|
459
459
|
]
|
|
460
460
|
},
|
|
461
461
|
"DELIVERY:SUCCEEDED": {
|
|
@@ -467,7 +467,7 @@ var TRANSITION_TABLE = {
|
|
|
467
467
|
allowedTransitions: [],
|
|
468
468
|
mayReturn: [],
|
|
469
469
|
terminal: true,
|
|
470
|
-
notes: ["The
|
|
470
|
+
notes: ["The destinationAsset reached the user. txHash is the transaction that paid them."]
|
|
471
471
|
},
|
|
472
472
|
"DELIVERY:FAILED": {
|
|
473
473
|
key: "DELIVERY:FAILED",
|
package/dist/table.mjs
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ export type FiatProvider = 'TRANSAK' | 'SWAPPED' | 'BANXA' | 'MOONPAY' | 'STRIPE
|
|
|
77
77
|
export type OrderStatus = 'CREATING' | 'AWAITING_PAYMENT' | 'PAYMENT_VERIFYING' | 'PROCESSING' | 'PENDING_DELIVERY' | 'ON_HOLD' | 'CRYPTO_SENT'
|
|
78
78
|
/**
|
|
79
79
|
* The provider's crypto reached the deposit address. Terminal for the order. A converted order
|
|
80
|
-
* (the provider pays a deposit address that converts into the
|
|
80
|
+
* (the provider pays a deposit address that converts into the `destinationAsset`) offers the `delivery`
|
|
81
81
|
* transition here, and the purchase continues in `DELIVERY`.
|
|
82
82
|
*/
|
|
83
83
|
| 'SETTLED' | 'EXPIRED' | 'CANCELLED' | 'FAILED' | 'REFUNDED'
|
|
@@ -771,15 +771,16 @@ export type FiatStepResponse = (FiatStepResponseBase & {
|
|
|
771
771
|
/**
|
|
772
772
|
* The asset the user receives at the end of the purchase. The client always sends it. The backend
|
|
773
773
|
* compares it with the partner's configured asset and adds a conversion only when they differ,
|
|
774
|
-
* so its presence never turns a conversion on.
|
|
775
|
-
* that predates it still parses; a missing
|
|
776
|
-
*
|
|
774
|
+
* so its presence never turns a conversion on. Every request field that carries it is named
|
|
775
|
+
* `destinationAsset`, optional only so a client that predates it still parses; a missing
|
|
776
|
+
* `destinationAsset` means the partner's configured asset. The recipient always comes from the
|
|
777
|
+
* verified partner assertion, never from this field.
|
|
777
778
|
*
|
|
778
779
|
* Split by VM, then by asset kind. Solana carries no chain id: the backend maps each VM to its own
|
|
779
780
|
* chain ids in one place. `NON_FUNGIBLE` is reserved: the backend does not serve it yet and answers
|
|
780
781
|
* it as unservable.
|
|
781
782
|
*/
|
|
782
|
-
export type
|
|
783
|
+
export type DestinationAsset = {
|
|
783
784
|
vm: 'EVM';
|
|
784
785
|
/** The EVM chain id: `8453` for Base. */
|
|
785
786
|
chainId: number;
|
|
@@ -820,7 +821,7 @@ export type FiatGeo = {
|
|
|
820
821
|
ip?: string;
|
|
821
822
|
};
|
|
822
823
|
/**
|
|
823
|
-
* The body of every `POST /fiat/next`: `provider`, `geo`, the `
|
|
824
|
+
* The body of every `POST /fiat/next`: `provider`, `geo`, the `destinationAsset`, and the
|
|
824
825
|
* provider's own request, which names its `action`. Each provider defines its actions and their
|
|
825
826
|
* fields (`./moonpay`).
|
|
826
827
|
*/
|
|
@@ -828,6 +829,6 @@ export type FiatNextRequest = {
|
|
|
828
829
|
provider: FiatProvider;
|
|
829
830
|
action: string;
|
|
830
831
|
geo: FiatGeo;
|
|
831
|
-
|
|
832
|
+
destinationAsset?: DestinationAsset;
|
|
832
833
|
} & Record<string, unknown>;
|
|
833
834
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fun-xyz/fiat-contract",
|
|
3
|
-
"version": "0.36.0-uda.
|
|
3
|
+
"version": "0.36.0-uda.5",
|
|
4
4
|
"description": "Published conformance contract for Fun's headless fiat onramp: FlowState/Transition types, zod schemas, the transition table as data, recorded fixtures, assertion helpers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|