@fun-xyz/fiat-contract 0.39.0 → 0.42.0
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/coinbase.d.ts +1 -0
- package/coinbase.js +2 -0
- package/dist/assert.d.ts +1 -1
- package/dist/{chunk-LMF4OMUW.mjs → chunk-RGQE53YP.mjs} +44 -12
- package/dist/chunk-SFR4SCDU.mjs +17 -0
- package/dist/fixtures/index.d.ts +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +435 -38
- package/dist/index.mjs +385 -27
- package/dist/providers/coinbase.d.ts +220 -0
- package/dist/providers/coinbase.js +37 -0
- package/dist/providers/coinbase.mjs +8 -0
- package/dist/providers/coinbase.schemas.d.ts +38 -0
- package/dist/schemas.d.ts +7 -2
- package/dist/table.d.ts +5 -2
- package/dist/table.js +44 -12
- package/dist/table.mjs +3 -1
- package/dist/types.d.ts +80 -13
- package/package.json +11 -1
package/coinbase.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/providers/coinbase';
|
package/coinbase.js
ADDED
package/dist/assert.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare function endpointMatches(template: EndpointTemplate, actual: stri
|
|
|
23
23
|
export interface EmissionCheck {
|
|
24
24
|
state: StateKey;
|
|
25
25
|
issues: readonly string[];
|
|
26
|
-
/** True when the docs publish no legal transition set for this state
|
|
26
|
+
/** True when the docs publish no legal transition set for this state. */
|
|
27
27
|
unjudgeable: boolean;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.42.0";
|
|
3
3
|
|
|
4
4
|
// src/table.ts
|
|
5
5
|
var TABLE_VERSION = version;
|
|
@@ -10,6 +10,13 @@ var TERMINAL_ORDER_STATUSES = [
|
|
|
10
10
|
"FAILED",
|
|
11
11
|
"REFUNDED"
|
|
12
12
|
];
|
|
13
|
+
var FUN_AUTH_ERROR_CODES = [
|
|
14
|
+
"INVALID_EMAIL",
|
|
15
|
+
"BAD_CODE",
|
|
16
|
+
"CODE_EXPIRED",
|
|
17
|
+
"TOO_MANY_ATTEMPTS",
|
|
18
|
+
"OTP_DISPATCH_THROTTLED"
|
|
19
|
+
];
|
|
13
20
|
var KYC_ANY = [
|
|
14
21
|
"KYC/CAPTURE",
|
|
15
22
|
"KYC/INPUT_REQUIRED",
|
|
@@ -44,12 +51,6 @@ var TRANSITION_TABLE = {
|
|
|
44
51
|
when: "returning user, session + KYC valid, order-first rail \u2014 the quote screen doubles as review",
|
|
45
52
|
note: "Narrowed to the order-first rail: on a capture-first method the order cannot be created before the payment is authorised, so the sibling payment-session entry is the one that applies."
|
|
46
53
|
},
|
|
47
|
-
{
|
|
48
|
-
id: "continue",
|
|
49
|
-
mode: "SUBMIT",
|
|
50
|
-
endpoint: "POST /fiat/auth",
|
|
51
|
-
when: "no ambient Fun identity (non-fomo surfaces only)"
|
|
52
|
-
},
|
|
53
54
|
{
|
|
54
55
|
id: "capture",
|
|
55
56
|
mode: "CLIENT_SURFACE",
|
|
@@ -87,12 +88,31 @@ var TRANSITION_TABLE = {
|
|
|
87
88
|
key: "FUN_AUTH",
|
|
88
89
|
kind: "FUN_AUTH",
|
|
89
90
|
screens: [],
|
|
90
|
-
docStatus: "
|
|
91
|
-
allowedTransitions: [
|
|
91
|
+
docStatus: "SPECIFIED",
|
|
92
|
+
allowedTransitions: [
|
|
93
|
+
{ id: "start", mode: "SUBMIT", endpoint: "POST /fiat/auth", when: "phase IDENTIFIER \u2014 inputs { email: TEXT }" },
|
|
94
|
+
{
|
|
95
|
+
id: "verify",
|
|
96
|
+
mode: "SUBMIT",
|
|
97
|
+
endpoint: "POST /fiat/auth/verify",
|
|
98
|
+
when: "phase CODE \u2014 params { verificationRef }, inputs { otpCode: TEXT length 6, regex ^\\d{6}$ }"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: "resend",
|
|
102
|
+
mode: "SUBMIT",
|
|
103
|
+
endpoint: "POST /fiat/auth",
|
|
104
|
+
when: "phase CODE, once resendAvailableAtMs has passed \u2014 params { verificationRef }"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
mayReturn: ["FUN_AUTH"],
|
|
92
108
|
terminal: false,
|
|
93
109
|
notes: [
|
|
94
|
-
"
|
|
95
|
-
"
|
|
110
|
+
"Answered, in phase IDENTIFIER with the start transition, to the entry quote request (POST /fiat/routing/quote or POST /fiat/quote) of a Fun-run login that holds no session; no state returns it, and a customer-asserted identity never sees it.",
|
|
111
|
+
"VERIFIED carries no transitions. A Fun-run login also carries `session` on the envelope; the SDK then starts the flow at QUOTE with `accessToken` as Bearer.",
|
|
112
|
+
"Not in the FE doc, so no screen number: the client renders it on its contact and OTP screens.",
|
|
113
|
+
"Every FUN_AUTH error is category USER_ERROR with a code from FUN_AUTH_ERROR_CODES. A wrong code re-enters CODE with BAD_CODE and a lower attemptsRemaining; TOO_MANY_ATTEMPTS and CODE_EXPIRED drop the challenge and offer resend; OTP_DISPATCH_THROTTLED re-enters with resendAvailableAtMs set.",
|
|
114
|
+
"resend carries the verificationRef the client holds, even one the server has dropped (expired, too many attempts); the server starts a fresh challenge for the same email while it still remembers the challenge (its code expiry plus a short grace); once it is forgotten the answer is IDENTIFIER with CODE_EXPIRED.",
|
|
115
|
+
"POST /fiat/auth/refresh and /revoke are called by the SDK session store, never offered as transitions."
|
|
96
116
|
]
|
|
97
117
|
},
|
|
98
118
|
SESSION_AUTH: {
|
|
@@ -455,6 +475,9 @@ var DOCUMENTED_ENDPOINTS = [
|
|
|
455
475
|
"GET /fiat/payment-methods",
|
|
456
476
|
"POST /fiat/quote",
|
|
457
477
|
"POST /fiat/auth",
|
|
478
|
+
"POST /fiat/auth/verify",
|
|
479
|
+
"POST /fiat/auth/refresh",
|
|
480
|
+
"POST /fiat/auth/revoke",
|
|
458
481
|
"POST /fiat/payment-session",
|
|
459
482
|
"POST /fiat/session",
|
|
460
483
|
"POST /fiat/session/verify",
|
|
@@ -478,6 +501,14 @@ var UNOFFERED_ENDPOINTS = [
|
|
|
478
501
|
endpoint: "GET /fiat/payment-methods",
|
|
479
502
|
reason: "Discovery, called before any flow state exists \u2014 there is no state to hang it off."
|
|
480
503
|
},
|
|
504
|
+
{
|
|
505
|
+
endpoint: "POST /fiat/auth/refresh",
|
|
506
|
+
reason: "SDK session store, not a transition."
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
endpoint: "POST /fiat/auth/revoke",
|
|
510
|
+
reason: "SDK session store, not a transition."
|
|
511
|
+
},
|
|
481
512
|
{
|
|
482
513
|
endpoint: "POST /fiat/kyc/document",
|
|
483
514
|
reason: "FILE fields use it for a direct provider/vendor upload handshake and completion report; the harness owns that auxiliary path and it is not a transition (see KYC/INPUT_REQUIRED notes)."
|
|
@@ -498,7 +529,7 @@ var UNOFFERED_ENDPOINTS = [
|
|
|
498
529
|
var UNREACHABLE_STATES = [
|
|
499
530
|
{
|
|
500
531
|
stateKey: "FUN_AUTH",
|
|
501
|
-
reason: "
|
|
532
|
+
reason: "Answered to the entry quote request of a Fun-run login with no session, before any state exists; no state returns it."
|
|
502
533
|
}
|
|
503
534
|
];
|
|
504
535
|
function unofferedEndpoints() {
|
|
@@ -562,6 +593,7 @@ function isTerminal(state) {
|
|
|
562
593
|
export {
|
|
563
594
|
TABLE_VERSION,
|
|
564
595
|
TERMINAL_ORDER_STATUSES,
|
|
596
|
+
FUN_AUTH_ERROR_CODES,
|
|
565
597
|
TRANSITION_TABLE,
|
|
566
598
|
STATE_KEYS,
|
|
567
599
|
DOCUMENTED_ENDPOINTS,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/providers/coinbase.ts
|
|
2
|
+
var COINBASE_ENDPOINTS = {
|
|
3
|
+
next: "POST /fiat/next"
|
|
4
|
+
};
|
|
5
|
+
var COINBASE_TERMS = {
|
|
6
|
+
id: "COINBASE_TERMS",
|
|
7
|
+
kind: "PROVIDER_TERMS",
|
|
8
|
+
stage: "CHECKOUT",
|
|
9
|
+
version: "2026-01",
|
|
10
|
+
contentDigest: "22db1a8292d9ecd60b53adf640c8748ad8477646c26a31971a83f7a43457f1fe",
|
|
11
|
+
links: [{ label: "Coinbase User Agreement", url: "https://www.coinbase.com/legal/user_agreement" }]
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
COINBASE_ENDPOINTS,
|
|
16
|
+
COINBASE_TERMS
|
|
17
|
+
};
|
package/dist/fixtures/index.d.ts
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* wire, and the contract has no half-response shape.
|
|
15
15
|
*/
|
|
16
16
|
import type { StateKey } from '../table';
|
|
17
|
-
|
|
17
|
+
/** `IDENTITY_DOC` is the Fun identity design that specifies `FUN_AUTH` and the Fun session. */
|
|
18
|
+
export type FixtureSource = 'FE_DOC' | 'CONTRACT_DOC' | 'KYC_DOC' | 'IDENTITY_DOC';
|
|
18
19
|
export interface FixtureMeta {
|
|
19
20
|
id: string;
|
|
20
21
|
file: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -14,4 +14,6 @@ export * from './terms';
|
|
|
14
14
|
export * from './routing';
|
|
15
15
|
export * from './providers/moonpay';
|
|
16
16
|
export * from './providers/moonpay.schemas';
|
|
17
|
+
export * from './providers/coinbase';
|
|
18
|
+
export * from './providers/coinbase.schemas';
|
|
17
19
|
export { FIXTURES, FIXTURE_COVERAGE_GAPS, fixtureMeta, loadFixture, loadFixtures, type FixtureMeta, type FixtureSource, type LoadedFixture, } from './fixtures/index';
|