@aibtc/tx-schemas 0.1.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/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/core/enums.d.ts +161 -0
- package/dist/core/enums.d.ts.map +1 -0
- package/dist/core/enums.js +98 -0
- package/dist/core/enums.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/payment.d.ts +267 -0
- package/dist/core/payment.d.ts.map +1 -0
- package/dist/core/payment.js +85 -0
- package/dist/core/payment.js.map +1 -0
- package/dist/core/primitives.d.ts +11 -0
- package/dist/core/primitives.d.ts.map +1 -0
- package/dist/core/primitives.js +29 -0
- package/dist/core/primitives.js.map +1 -0
- package/dist/core/schemas.d.ts +2 -0
- package/dist/core/schemas.d.ts.map +1 -0
- package/dist/core/schemas.js +2 -0
- package/dist/core/schemas.js.map +1 -0
- package/dist/core/terminal-reasons.d.ts +154 -0
- package/dist/core/terminal-reasons.d.ts.map +1 -0
- package/dist/core/terminal-reasons.js +82 -0
- package/dist/core/terminal-reasons.js.map +1 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +2 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/schemas.d.ts +424 -0
- package/dist/http/schemas.d.ts.map +1 -0
- package/dist/http/schemas.js +171 -0
- package/dist/http/schemas.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/rpc/index.d.ts +2 -0
- package/dist/rpc/index.d.ts.map +1 -0
- package/dist/rpc/index.js +2 -0
- package/dist/rpc/index.js.map +1 -0
- package/dist/rpc/schemas.d.ts +339 -0
- package/dist/rpc/schemas.d.ts.map +1 -0
- package/dist/rpc/schemas.js +91 -0
- package/dist/rpc/schemas.js.map +1 -0
- package/docs/package-schemas.md +52 -0
- package/docs/x402-approval-spec.md +530 -0
- package/docs/x402-state-machines.md +241 -0
- package/package.json +101 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 aibtcdev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# @aibtc/tx-schemas
|
|
2
|
+
|
|
3
|
+
Shared zod schemas for AIBTC payment state models, first-party relay RPC schemas,
|
|
4
|
+
and external x402 HTTP schemas.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @aibtc/tx-schemas zod
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Package Shape
|
|
13
|
+
|
|
14
|
+
- `@aibtc/tx-schemas` exports the full surface
|
|
15
|
+
- `@aibtc/tx-schemas/core` exports canonical payment enums, terminal reasons, and shared primitives
|
|
16
|
+
- `@aibtc/tx-schemas/rpc` exports internal relay service-binding schemas
|
|
17
|
+
- `@aibtc/tx-schemas/http` exports external x402 facilitator and polling schemas
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { PaymentStateSchema, PaymentStateCategoryByState } from "@aibtc/tx-schemas/core";
|
|
23
|
+
import { RpcSubmitPaymentResultSchema } from "@aibtc/tx-schemas/rpc";
|
|
24
|
+
import { HttpSettleRequestSchema } from "@aibtc/tx-schemas/http";
|
|
25
|
+
import { TERMINAL_REASONS } from "@aibtc/tx-schemas/terminal-reasons";
|
|
26
|
+
|
|
27
|
+
const state = PaymentStateSchema.parse("confirmed");
|
|
28
|
+
const category = PaymentStateCategoryByState[state];
|
|
29
|
+
const terminalReasons = TERMINAL_REASONS;
|
|
30
|
+
|
|
31
|
+
const rpcResult = RpcSubmitPaymentResultSchema.parse({
|
|
32
|
+
accepted: true,
|
|
33
|
+
paymentId: "pay_01J7QZXK5XRGBVMK3N9RTNF4WW",
|
|
34
|
+
status: "queued",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const settleRequest = HttpSettleRequestSchema.parse({
|
|
38
|
+
paymentPayload: {
|
|
39
|
+
x402Version: 2,
|
|
40
|
+
payload: { transaction: "0x1234" },
|
|
41
|
+
},
|
|
42
|
+
paymentRequirements: {
|
|
43
|
+
scheme: "exact",
|
|
44
|
+
network: "stacks:2147483648",
|
|
45
|
+
amount: "1000000",
|
|
46
|
+
asset: "STX",
|
|
47
|
+
payTo: "ST000000000000000000002AMW42H",
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Subpath Imports
|
|
53
|
+
|
|
54
|
+
- `@aibtc/tx-schemas`
|
|
55
|
+
- `@aibtc/tx-schemas/core`
|
|
56
|
+
- `@aibtc/tx-schemas/core/enums`
|
|
57
|
+
- `@aibtc/tx-schemas/core/schemas`
|
|
58
|
+
- `@aibtc/tx-schemas/core/primitives`
|
|
59
|
+
- `@aibtc/tx-schemas/terminal-reasons`
|
|
60
|
+
- `@aibtc/tx-schemas/core/terminal-reasons`
|
|
61
|
+
- `@aibtc/tx-schemas/rpc`
|
|
62
|
+
- `@aibtc/tx-schemas/http`
|
|
63
|
+
|
|
64
|
+
## Schema Rules
|
|
65
|
+
|
|
66
|
+
- Canonical payment states live in `core` and are the only shared payment-state source of truth.
|
|
67
|
+
- `rpc` and `http` may differ in field names and transport ergonomics, but they must reuse the same state semantics.
|
|
68
|
+
- The default protected-resource delivery invariant is `deliver-only-on-confirmed`.
|
|
69
|
+
- Any product that delivers on in-flight states should document that as an application exception, not a canonical package rule.
|
|
70
|
+
|
|
71
|
+
More detail lives in [docs/package-schemas.md](docs/package-schemas.md),
|
|
72
|
+
[docs/x402-approval-spec.md](docs/x402-approval-spec.md), and
|
|
73
|
+
[docs/x402-state-machines.md](docs/x402-state-machines.md).
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PAYMENT_STATES: readonly ["requires_payment", "submitted", "queued", "broadcasting", "mempool", "confirmed", "failed", "replaced", "not_found"];
|
|
3
|
+
export declare const TRACKED_PAYMENT_STATES: readonly ["submitted", "queued", "broadcasting", "mempool", "confirmed", "failed", "replaced", "not_found"];
|
|
4
|
+
export declare const PAYMENT_STATE_CATEGORIES: readonly ["pre-payment", "in-flight", "terminal-success", "terminal-failure"];
|
|
5
|
+
export declare const PRE_PAYMENT_STATES: readonly ["requires_payment"];
|
|
6
|
+
export declare const IN_FLIGHT_STATES: readonly ["submitted", "queued", "broadcasting", "mempool"];
|
|
7
|
+
export declare const TERMINAL_SUCCESS_STATES: readonly ["confirmed"];
|
|
8
|
+
export declare const TERMINAL_FAILURE_STATES: readonly ["failed", "replaced", "not_found"];
|
|
9
|
+
export declare const PaymentStateSchema: z.ZodEnum<{
|
|
10
|
+
requires_payment: "requires_payment";
|
|
11
|
+
submitted: "submitted";
|
|
12
|
+
queued: "queued";
|
|
13
|
+
broadcasting: "broadcasting";
|
|
14
|
+
mempool: "mempool";
|
|
15
|
+
confirmed: "confirmed";
|
|
16
|
+
failed: "failed";
|
|
17
|
+
replaced: "replaced";
|
|
18
|
+
not_found: "not_found";
|
|
19
|
+
}>;
|
|
20
|
+
export declare const TrackedPaymentStateSchema: z.ZodEnum<{
|
|
21
|
+
submitted: "submitted";
|
|
22
|
+
queued: "queued";
|
|
23
|
+
broadcasting: "broadcasting";
|
|
24
|
+
mempool: "mempool";
|
|
25
|
+
confirmed: "confirmed";
|
|
26
|
+
failed: "failed";
|
|
27
|
+
replaced: "replaced";
|
|
28
|
+
not_found: "not_found";
|
|
29
|
+
}>;
|
|
30
|
+
export declare const PaymentStateCategorySchema: z.ZodEnum<{
|
|
31
|
+
"pre-payment": "pre-payment";
|
|
32
|
+
"in-flight": "in-flight";
|
|
33
|
+
"terminal-success": "terminal-success";
|
|
34
|
+
"terminal-failure": "terminal-failure";
|
|
35
|
+
}>;
|
|
36
|
+
export declare const InFlightPaymentStateSchema: z.ZodEnum<{
|
|
37
|
+
submitted: "submitted";
|
|
38
|
+
queued: "queued";
|
|
39
|
+
broadcasting: "broadcasting";
|
|
40
|
+
mempool: "mempool";
|
|
41
|
+
}>;
|
|
42
|
+
export declare const TerminalFailureStateSchema: z.ZodEnum<{
|
|
43
|
+
failed: "failed";
|
|
44
|
+
replaced: "replaced";
|
|
45
|
+
not_found: "not_found";
|
|
46
|
+
}>;
|
|
47
|
+
export declare const PAYMENT_STATE_TO_CATEGORY: {
|
|
48
|
+
readonly requires_payment: "pre-payment";
|
|
49
|
+
readonly submitted: "in-flight";
|
|
50
|
+
readonly queued: "in-flight";
|
|
51
|
+
readonly broadcasting: "in-flight";
|
|
52
|
+
readonly mempool: "in-flight";
|
|
53
|
+
readonly confirmed: "terminal-success";
|
|
54
|
+
readonly failed: "terminal-failure";
|
|
55
|
+
readonly replaced: "terminal-failure";
|
|
56
|
+
readonly not_found: "terminal-failure";
|
|
57
|
+
};
|
|
58
|
+
export declare const PAYMENT_STATE_DEFAULT_DELIVERY: {
|
|
59
|
+
readonly requires_payment: false;
|
|
60
|
+
readonly submitted: false;
|
|
61
|
+
readonly queued: false;
|
|
62
|
+
readonly broadcasting: false;
|
|
63
|
+
readonly mempool: false;
|
|
64
|
+
readonly confirmed: true;
|
|
65
|
+
readonly failed: false;
|
|
66
|
+
readonly replaced: false;
|
|
67
|
+
readonly not_found: false;
|
|
68
|
+
};
|
|
69
|
+
export declare const PaymentStateCategoryByState: {
|
|
70
|
+
readonly requires_payment: "pre-payment";
|
|
71
|
+
readonly submitted: "in-flight";
|
|
72
|
+
readonly queued: "in-flight";
|
|
73
|
+
readonly broadcasting: "in-flight";
|
|
74
|
+
readonly mempool: "in-flight";
|
|
75
|
+
readonly confirmed: "terminal-success";
|
|
76
|
+
readonly failed: "terminal-failure";
|
|
77
|
+
readonly replaced: "terminal-failure";
|
|
78
|
+
readonly not_found: "terminal-failure";
|
|
79
|
+
};
|
|
80
|
+
export declare const paymentStateCategoryByState: {
|
|
81
|
+
readonly requires_payment: "pre-payment";
|
|
82
|
+
readonly submitted: "in-flight";
|
|
83
|
+
readonly queued: "in-flight";
|
|
84
|
+
readonly broadcasting: "in-flight";
|
|
85
|
+
readonly mempool: "in-flight";
|
|
86
|
+
readonly confirmed: "terminal-success";
|
|
87
|
+
readonly failed: "terminal-failure";
|
|
88
|
+
readonly replaced: "terminal-failure";
|
|
89
|
+
readonly not_found: "terminal-failure";
|
|
90
|
+
};
|
|
91
|
+
export declare const PaymentStateDefaultDeliveryByState: {
|
|
92
|
+
readonly requires_payment: false;
|
|
93
|
+
readonly submitted: false;
|
|
94
|
+
readonly queued: false;
|
|
95
|
+
readonly broadcasting: false;
|
|
96
|
+
readonly mempool: false;
|
|
97
|
+
readonly confirmed: true;
|
|
98
|
+
readonly failed: false;
|
|
99
|
+
readonly replaced: false;
|
|
100
|
+
readonly not_found: false;
|
|
101
|
+
};
|
|
102
|
+
export declare const paymentStateDefaultDeliveryByState: {
|
|
103
|
+
readonly requires_payment: false;
|
|
104
|
+
readonly submitted: false;
|
|
105
|
+
readonly queued: false;
|
|
106
|
+
readonly broadcasting: false;
|
|
107
|
+
readonly mempool: false;
|
|
108
|
+
readonly confirmed: true;
|
|
109
|
+
readonly failed: false;
|
|
110
|
+
readonly replaced: false;
|
|
111
|
+
readonly not_found: false;
|
|
112
|
+
};
|
|
113
|
+
export declare const PAYMENT_STATE_TRANSITIONS: {
|
|
114
|
+
readonly requires_payment: readonly [];
|
|
115
|
+
readonly submitted: readonly ["queued", "failed"];
|
|
116
|
+
readonly queued: readonly ["queued", "broadcasting", "failed"];
|
|
117
|
+
readonly broadcasting: readonly ["queued", "mempool", "failed"];
|
|
118
|
+
readonly mempool: readonly ["mempool", "confirmed", "failed", "replaced"];
|
|
119
|
+
readonly confirmed: readonly [];
|
|
120
|
+
readonly failed: readonly [];
|
|
121
|
+
readonly replaced: readonly [];
|
|
122
|
+
readonly not_found: readonly [];
|
|
123
|
+
};
|
|
124
|
+
export declare const PaymentStateTransitionMap: {
|
|
125
|
+
readonly requires_payment: readonly [];
|
|
126
|
+
readonly submitted: readonly ["queued", "failed"];
|
|
127
|
+
readonly queued: readonly ["queued", "broadcasting", "failed"];
|
|
128
|
+
readonly broadcasting: readonly ["queued", "mempool", "failed"];
|
|
129
|
+
readonly mempool: readonly ["mempool", "confirmed", "failed", "replaced"];
|
|
130
|
+
readonly confirmed: readonly [];
|
|
131
|
+
readonly failed: readonly [];
|
|
132
|
+
readonly replaced: readonly [];
|
|
133
|
+
readonly not_found: readonly [];
|
|
134
|
+
};
|
|
135
|
+
export declare const paymentStateTransitionMap: {
|
|
136
|
+
readonly requires_payment: readonly [];
|
|
137
|
+
readonly submitted: readonly ["queued", "failed"];
|
|
138
|
+
readonly queued: readonly ["queued", "broadcasting", "failed"];
|
|
139
|
+
readonly broadcasting: readonly ["queued", "mempool", "failed"];
|
|
140
|
+
readonly mempool: readonly ["mempool", "confirmed", "failed", "replaced"];
|
|
141
|
+
readonly confirmed: readonly [];
|
|
142
|
+
readonly failed: readonly [];
|
|
143
|
+
readonly replaced: readonly [];
|
|
144
|
+
readonly not_found: readonly [];
|
|
145
|
+
};
|
|
146
|
+
export declare const ProtectedResourceDeliverableStateSchema: z.ZodLiteral<"confirmed">;
|
|
147
|
+
export declare const CanonicalDomainBoundary: {
|
|
148
|
+
readonly defaultProtectedResourceDelivery: {
|
|
149
|
+
readonly defaultRule: "deliver-only-on-confirmed";
|
|
150
|
+
readonly deliverableStates: readonly ["confirmed"];
|
|
151
|
+
};
|
|
152
|
+
readonly transportBoundaries: {
|
|
153
|
+
readonly sharedDomain: readonly ["state", "category", "terminal-reason"];
|
|
154
|
+
readonly rpc: readonly ["service-binding request/response shapes", "internal relay error codes"];
|
|
155
|
+
readonly http: readonly ["x402 request/response shapes", "polling and error envelopes"];
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
export type PaymentState = z.infer<typeof PaymentStateSchema>;
|
|
159
|
+
export type TrackedPaymentState = z.infer<typeof TrackedPaymentStateSchema>;
|
|
160
|
+
export type PaymentStateCategory = z.infer<typeof PaymentStateCategorySchema>;
|
|
161
|
+
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/core/enums.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc,iIAUjB,CAAC;AAEX,eAAO,MAAM,sBAAsB,6GASzB,CAAC;AAEX,eAAO,MAAM,wBAAwB,+E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,98 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const PAYMENT_STATES = [
|
|
3
|
+
"requires_payment",
|
|
4
|
+
"submitted",
|
|
5
|
+
"queued",
|
|
6
|
+
"broadcasting",
|
|
7
|
+
"mempool",
|
|
8
|
+
"confirmed",
|
|
9
|
+
"failed",
|
|
10
|
+
"replaced",
|
|
11
|
+
"not_found",
|
|
12
|
+
];
|
|
13
|
+
export const TRACKED_PAYMENT_STATES = [
|
|
14
|
+
"submitted",
|
|
15
|
+
"queued",
|
|
16
|
+
"broadcasting",
|
|
17
|
+
"mempool",
|
|
18
|
+
"confirmed",
|
|
19
|
+
"failed",
|
|
20
|
+
"replaced",
|
|
21
|
+
"not_found",
|
|
22
|
+
];
|
|
23
|
+
export const PAYMENT_STATE_CATEGORIES = [
|
|
24
|
+
"pre-payment",
|
|
25
|
+
"in-flight",
|
|
26
|
+
"terminal-success",
|
|
27
|
+
"terminal-failure",
|
|
28
|
+
];
|
|
29
|
+
export const PRE_PAYMENT_STATES = ["requires_payment"];
|
|
30
|
+
export const IN_FLIGHT_STATES = [
|
|
31
|
+
"submitted",
|
|
32
|
+
"queued",
|
|
33
|
+
"broadcasting",
|
|
34
|
+
"mempool",
|
|
35
|
+
];
|
|
36
|
+
export const TERMINAL_SUCCESS_STATES = ["confirmed"];
|
|
37
|
+
export const TERMINAL_FAILURE_STATES = [
|
|
38
|
+
"failed",
|
|
39
|
+
"replaced",
|
|
40
|
+
"not_found",
|
|
41
|
+
];
|
|
42
|
+
export const PaymentStateSchema = z.enum(PAYMENT_STATES);
|
|
43
|
+
export const TrackedPaymentStateSchema = z.enum(TRACKED_PAYMENT_STATES);
|
|
44
|
+
export const PaymentStateCategorySchema = z.enum(PAYMENT_STATE_CATEGORIES);
|
|
45
|
+
export const InFlightPaymentStateSchema = z.enum(IN_FLIGHT_STATES);
|
|
46
|
+
export const TerminalFailureStateSchema = z.enum(TERMINAL_FAILURE_STATES);
|
|
47
|
+
export const PAYMENT_STATE_TO_CATEGORY = {
|
|
48
|
+
requires_payment: "pre-payment",
|
|
49
|
+
submitted: "in-flight",
|
|
50
|
+
queued: "in-flight",
|
|
51
|
+
broadcasting: "in-flight",
|
|
52
|
+
mempool: "in-flight",
|
|
53
|
+
confirmed: "terminal-success",
|
|
54
|
+
failed: "terminal-failure",
|
|
55
|
+
replaced: "terminal-failure",
|
|
56
|
+
not_found: "terminal-failure",
|
|
57
|
+
};
|
|
58
|
+
export const PAYMENT_STATE_DEFAULT_DELIVERY = {
|
|
59
|
+
requires_payment: false,
|
|
60
|
+
submitted: false,
|
|
61
|
+
queued: false,
|
|
62
|
+
broadcasting: false,
|
|
63
|
+
mempool: false,
|
|
64
|
+
confirmed: true,
|
|
65
|
+
failed: false,
|
|
66
|
+
replaced: false,
|
|
67
|
+
not_found: false,
|
|
68
|
+
};
|
|
69
|
+
export const PaymentStateCategoryByState = PAYMENT_STATE_TO_CATEGORY;
|
|
70
|
+
export const paymentStateCategoryByState = PAYMENT_STATE_TO_CATEGORY;
|
|
71
|
+
export const PaymentStateDefaultDeliveryByState = PAYMENT_STATE_DEFAULT_DELIVERY;
|
|
72
|
+
export const paymentStateDefaultDeliveryByState = PAYMENT_STATE_DEFAULT_DELIVERY;
|
|
73
|
+
export const PAYMENT_STATE_TRANSITIONS = {
|
|
74
|
+
requires_payment: [],
|
|
75
|
+
submitted: ["queued", "failed"],
|
|
76
|
+
queued: ["queued", "broadcasting", "failed"],
|
|
77
|
+
broadcasting: ["queued", "mempool", "failed"],
|
|
78
|
+
mempool: ["mempool", "confirmed", "failed", "replaced"],
|
|
79
|
+
confirmed: [],
|
|
80
|
+
failed: [],
|
|
81
|
+
replaced: [],
|
|
82
|
+
not_found: [],
|
|
83
|
+
};
|
|
84
|
+
export const PaymentStateTransitionMap = PAYMENT_STATE_TRANSITIONS;
|
|
85
|
+
export const paymentStateTransitionMap = PAYMENT_STATE_TRANSITIONS;
|
|
86
|
+
export const ProtectedResourceDeliverableStateSchema = z.literal("confirmed");
|
|
87
|
+
export const CanonicalDomainBoundary = {
|
|
88
|
+
defaultProtectedResourceDelivery: {
|
|
89
|
+
defaultRule: "deliver-only-on-confirmed",
|
|
90
|
+
deliverableStates: ["confirmed"],
|
|
91
|
+
},
|
|
92
|
+
transportBoundaries: {
|
|
93
|
+
sharedDomain: ["state", "category", "terminal-reason"],
|
|
94
|
+
rpc: ["service-binding request/response shapes", "internal relay error codes"],
|
|
95
|
+
http: ["x402 request/response shapes", "polling and error envelopes"],
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=enums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/core/enums.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,kBAAkB;IAClB,WAAW;IACX,QAAQ;IACR,cAAc;IACd,SAAS;IACT,WAAW;IACX,QAAQ;IACR,UAAU;IACV,WAAW;CACH,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,WAAW;IACX,QAAQ;IACR,cAAc;IACd,SAAS;IACT,WAAW;IACX,QAAQ;IACR,UAAU;IACV,WAAW;CACH,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,aAAa;IACb,WAAW;IACX,kBAAkB;IAClB,kBAAkB;CACV,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,kBAAkB,CAAU,CAAC;AAEhE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,WAAW;IACX,QAAQ;IACR,cAAc;IACd,SAAS;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,WAAW,CAAU,CAAC;AAE9D,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ;IACR,UAAU;IACV,WAAW;CACH,CAAC;AAEX,MAAM,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;IAC7B,SAAS,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAU;IACxC,MAAM,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,QAAQ,CAAU;IACrD,YAAY,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAU;IACtD,OAAO,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAU;IAChE,SAAS,EAAE,EAAW;IACtB,MAAM,EAAE,EAAW;IACnB,QAAQ,EAAE,EAAW;IACrB,SAAS,EAAE,EAAW;CACgF,CAAC;AAEzG,MAAM,CAAC,MAAM,yBAAyB,GAAG,yBAAyB,CAAC;AACnE,MAAM,CAAC,MAAM,yBAAyB,GAAG,yBAAyB,CAAC;AACnE,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,gCAAgC,EAAE;QAChC,WAAW,EAAE,2BAA2B;QACxC,iBAAiB,EAAE,CAAC,WAAW,CAAU;KAC1C;IACD,mBAAmB,EAAE;QACnB,YAAY,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,iBAAiB,CAAU;QAC/D,GAAG,EAAE,CAAC,yCAAyC,EAAE,4BAA4B,CAAU;QACvF,IAAI,EAAE,CAAC,8BAA8B,EAAE,6BAA6B,CAAU;KAC/E;CACO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const RequiresPaymentStatusSchema: z.ZodObject<{
|
|
3
|
+
state: z.ZodLiteral<"requires_payment">;
|
|
4
|
+
category: z.ZodLiteral<"pre-payment">;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export declare const SubmittedPaymentStatusSchema: z.ZodObject<{
|
|
7
|
+
state: z.ZodLiteral<"submitted" | "queued" | "broadcasting" | "mempool">;
|
|
8
|
+
category: z.ZodLiteral<"in-flight">;
|
|
9
|
+
paymentId: z.ZodString;
|
|
10
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const QueuedPaymentStatusSchema: z.ZodObject<{
|
|
13
|
+
state: z.ZodLiteral<"submitted" | "queued" | "broadcasting" | "mempool">;
|
|
14
|
+
category: z.ZodLiteral<"in-flight">;
|
|
15
|
+
paymentId: z.ZodString;
|
|
16
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const BroadcastingPaymentStatusSchema: z.ZodObject<{
|
|
19
|
+
state: z.ZodLiteral<"submitted" | "queued" | "broadcasting" | "mempool">;
|
|
20
|
+
category: z.ZodLiteral<"in-flight">;
|
|
21
|
+
paymentId: z.ZodString;
|
|
22
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const MempoolPaymentStatusSchema: z.ZodObject<{
|
|
25
|
+
state: z.ZodLiteral<"submitted" | "queued" | "broadcasting" | "mempool">;
|
|
26
|
+
category: z.ZodLiteral<"in-flight">;
|
|
27
|
+
paymentId: z.ZodString;
|
|
28
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export declare const ConfirmedPaymentStatusSchema: z.ZodObject<{
|
|
31
|
+
state: z.ZodLiteral<"confirmed">;
|
|
32
|
+
category: z.ZodLiteral<"terminal-success">;
|
|
33
|
+
paymentId: z.ZodString;
|
|
34
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
35
|
+
blockHeight: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
confirmedAt: z.ZodOptional<z.ZodString>;
|
|
37
|
+
explorerUrl: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export declare const FailedPaymentStatusSchema: z.ZodObject<{
|
|
40
|
+
state: z.ZodLiteral<"failed">;
|
|
41
|
+
category: z.ZodLiteral<"terminal-failure">;
|
|
42
|
+
paymentId: z.ZodString;
|
|
43
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
44
|
+
reason: z.ZodEnum<{
|
|
45
|
+
invalid_transaction: "invalid_transaction";
|
|
46
|
+
not_sponsored: "not_sponsored";
|
|
47
|
+
sender_nonce_stale: "sender_nonce_stale";
|
|
48
|
+
sender_nonce_gap: "sender_nonce_gap";
|
|
49
|
+
sender_nonce_duplicate: "sender_nonce_duplicate";
|
|
50
|
+
queue_unavailable: "queue_unavailable";
|
|
51
|
+
sponsor_failure: "sponsor_failure";
|
|
52
|
+
broadcast_failure: "broadcast_failure";
|
|
53
|
+
chain_abort: "chain_abort";
|
|
54
|
+
internal_error: "internal_error";
|
|
55
|
+
}>;
|
|
56
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
57
|
+
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export declare const ReplacedPaymentStatusSchema: z.ZodObject<{
|
|
60
|
+
state: z.ZodLiteral<"replaced">;
|
|
61
|
+
category: z.ZodLiteral<"terminal-failure">;
|
|
62
|
+
paymentId: z.ZodString;
|
|
63
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
64
|
+
reason: z.ZodEnum<{
|
|
65
|
+
nonce_replacement: "nonce_replacement";
|
|
66
|
+
superseded: "superseded";
|
|
67
|
+
}>;
|
|
68
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export declare const NotFoundPaymentStatusSchema: z.ZodObject<{
|
|
71
|
+
state: z.ZodLiteral<"not_found">;
|
|
72
|
+
category: z.ZodLiteral<"terminal-failure">;
|
|
73
|
+
paymentId: z.ZodString;
|
|
74
|
+
reason: z.ZodEnum<{
|
|
75
|
+
expired: "expired";
|
|
76
|
+
unknown_payment_identity: "unknown_payment_identity";
|
|
77
|
+
}>;
|
|
78
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
export declare const PaymentStatusSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
81
|
+
state: z.ZodLiteral<"requires_payment">;
|
|
82
|
+
category: z.ZodLiteral<"pre-payment">;
|
|
83
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
84
|
+
state: z.ZodLiteral<"submitted" | "queued" | "broadcasting" | "mempool">;
|
|
85
|
+
category: z.ZodLiteral<"in-flight">;
|
|
86
|
+
paymentId: z.ZodString;
|
|
87
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
88
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
89
|
+
state: z.ZodLiteral<"submitted" | "queued" | "broadcasting" | "mempool">;
|
|
90
|
+
category: z.ZodLiteral<"in-flight">;
|
|
91
|
+
paymentId: z.ZodString;
|
|
92
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
state: z.ZodLiteral<"submitted" | "queued" | "broadcasting" | "mempool">;
|
|
95
|
+
category: z.ZodLiteral<"in-flight">;
|
|
96
|
+
paymentId: z.ZodString;
|
|
97
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
99
|
+
state: z.ZodLiteral<"submitted" | "queued" | "broadcasting" | "mempool">;
|
|
100
|
+
category: z.ZodLiteral<"in-flight">;
|
|
101
|
+
paymentId: z.ZodString;
|
|
102
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
104
|
+
state: z.ZodLiteral<"confirmed">;
|
|
105
|
+
category: z.ZodLiteral<"terminal-success">;
|
|
106
|
+
paymentId: z.ZodString;
|
|
107
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
108
|
+
blockHeight: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
confirmedAt: z.ZodOptional<z.ZodString>;
|
|
110
|
+
explorerUrl: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
state: z.ZodLiteral<"failed">;
|
|
113
|
+
category: z.ZodLiteral<"terminal-failure">;
|
|
114
|
+
paymentId: z.ZodString;
|
|
115
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
116
|
+
reason: z.ZodEnum<{
|
|
117
|
+
invalid_transaction: "invalid_transaction";
|
|
118
|
+
not_sponsored: "not_sponsored";
|
|
119
|
+
sender_nonce_stale: "sender_nonce_stale";
|
|
120
|
+
sender_nonce_gap: "sender_nonce_gap";
|
|
121
|
+
sender_nonce_duplicate: "sender_nonce_duplicate";
|
|
122
|
+
queue_unavailable: "queue_unavailable";
|
|
123
|
+
sponsor_failure: "sponsor_failure";
|
|
124
|
+
broadcast_failure: "broadcast_failure";
|
|
125
|
+
chain_abort: "chain_abort";
|
|
126
|
+
internal_error: "internal_error";
|
|
127
|
+
}>;
|
|
128
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
129
|
+
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
130
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
131
|
+
state: z.ZodLiteral<"replaced">;
|
|
132
|
+
category: z.ZodLiteral<"terminal-failure">;
|
|
133
|
+
paymentId: z.ZodString;
|
|
134
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
135
|
+
reason: z.ZodEnum<{
|
|
136
|
+
nonce_replacement: "nonce_replacement";
|
|
137
|
+
superseded: "superseded";
|
|
138
|
+
}>;
|
|
139
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
140
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
141
|
+
state: z.ZodLiteral<"not_found">;
|
|
142
|
+
category: z.ZodLiteral<"terminal-failure">;
|
|
143
|
+
paymentId: z.ZodString;
|
|
144
|
+
reason: z.ZodEnum<{
|
|
145
|
+
expired: "expired";
|
|
146
|
+
unknown_payment_identity: "unknown_payment_identity";
|
|
147
|
+
}>;
|
|
148
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
149
|
+
}, z.core.$strip>], "state">;
|
|
150
|
+
export declare const TrackedPaymentStatusSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
151
|
+
state: z.ZodLiteral<"submitted" | "queued" | "broadcasting" | "mempool">;
|
|
152
|
+
category: z.ZodLiteral<"in-flight">;
|
|
153
|
+
paymentId: z.ZodString;
|
|
154
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
155
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
156
|
+
state: z.ZodLiteral<"submitted" | "queued" | "broadcasting" | "mempool">;
|
|
157
|
+
category: z.ZodLiteral<"in-flight">;
|
|
158
|
+
paymentId: z.ZodString;
|
|
159
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
161
|
+
state: z.ZodLiteral<"submitted" | "queued" | "broadcasting" | "mempool">;
|
|
162
|
+
category: z.ZodLiteral<"in-flight">;
|
|
163
|
+
paymentId: z.ZodString;
|
|
164
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
state: z.ZodLiteral<"submitted" | "queued" | "broadcasting" | "mempool">;
|
|
167
|
+
category: z.ZodLiteral<"in-flight">;
|
|
168
|
+
paymentId: z.ZodString;
|
|
169
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
170
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
171
|
+
state: z.ZodLiteral<"confirmed">;
|
|
172
|
+
category: z.ZodLiteral<"terminal-success">;
|
|
173
|
+
paymentId: z.ZodString;
|
|
174
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
175
|
+
blockHeight: z.ZodOptional<z.ZodNumber>;
|
|
176
|
+
confirmedAt: z.ZodOptional<z.ZodString>;
|
|
177
|
+
explorerUrl: z.ZodOptional<z.ZodString>;
|
|
178
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
179
|
+
state: z.ZodLiteral<"failed">;
|
|
180
|
+
category: z.ZodLiteral<"terminal-failure">;
|
|
181
|
+
paymentId: z.ZodString;
|
|
182
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
183
|
+
reason: z.ZodEnum<{
|
|
184
|
+
invalid_transaction: "invalid_transaction";
|
|
185
|
+
not_sponsored: "not_sponsored";
|
|
186
|
+
sender_nonce_stale: "sender_nonce_stale";
|
|
187
|
+
sender_nonce_gap: "sender_nonce_gap";
|
|
188
|
+
sender_nonce_duplicate: "sender_nonce_duplicate";
|
|
189
|
+
queue_unavailable: "queue_unavailable";
|
|
190
|
+
sponsor_failure: "sponsor_failure";
|
|
191
|
+
broadcast_failure: "broadcast_failure";
|
|
192
|
+
chain_abort: "chain_abort";
|
|
193
|
+
internal_error: "internal_error";
|
|
194
|
+
}>;
|
|
195
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
196
|
+
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
197
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
198
|
+
state: z.ZodLiteral<"replaced">;
|
|
199
|
+
category: z.ZodLiteral<"terminal-failure">;
|
|
200
|
+
paymentId: z.ZodString;
|
|
201
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
202
|
+
reason: z.ZodEnum<{
|
|
203
|
+
nonce_replacement: "nonce_replacement";
|
|
204
|
+
superseded: "superseded";
|
|
205
|
+
}>;
|
|
206
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
207
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
208
|
+
state: z.ZodLiteral<"not_found">;
|
|
209
|
+
category: z.ZodLiteral<"terminal-failure">;
|
|
210
|
+
paymentId: z.ZodString;
|
|
211
|
+
reason: z.ZodEnum<{
|
|
212
|
+
expired: "expired";
|
|
213
|
+
unknown_payment_identity: "unknown_payment_identity";
|
|
214
|
+
}>;
|
|
215
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
216
|
+
}, z.core.$strip>], "state">;
|
|
217
|
+
export declare const TerminalPaymentStatusSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
218
|
+
state: z.ZodLiteral<"confirmed">;
|
|
219
|
+
category: z.ZodLiteral<"terminal-success">;
|
|
220
|
+
paymentId: z.ZodString;
|
|
221
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
222
|
+
blockHeight: z.ZodOptional<z.ZodNumber>;
|
|
223
|
+
confirmedAt: z.ZodOptional<z.ZodString>;
|
|
224
|
+
explorerUrl: z.ZodOptional<z.ZodString>;
|
|
225
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
226
|
+
state: z.ZodLiteral<"failed">;
|
|
227
|
+
category: z.ZodLiteral<"terminal-failure">;
|
|
228
|
+
paymentId: z.ZodString;
|
|
229
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
230
|
+
reason: z.ZodEnum<{
|
|
231
|
+
invalid_transaction: "invalid_transaction";
|
|
232
|
+
not_sponsored: "not_sponsored";
|
|
233
|
+
sender_nonce_stale: "sender_nonce_stale";
|
|
234
|
+
sender_nonce_gap: "sender_nonce_gap";
|
|
235
|
+
sender_nonce_duplicate: "sender_nonce_duplicate";
|
|
236
|
+
queue_unavailable: "queue_unavailable";
|
|
237
|
+
sponsor_failure: "sponsor_failure";
|
|
238
|
+
broadcast_failure: "broadcast_failure";
|
|
239
|
+
chain_abort: "chain_abort";
|
|
240
|
+
internal_error: "internal_error";
|
|
241
|
+
}>;
|
|
242
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
243
|
+
retryable: z.ZodOptional<z.ZodBoolean>;
|
|
244
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
245
|
+
state: z.ZodLiteral<"replaced">;
|
|
246
|
+
category: z.ZodLiteral<"terminal-failure">;
|
|
247
|
+
paymentId: z.ZodString;
|
|
248
|
+
txid: z.ZodOptional<z.ZodString>;
|
|
249
|
+
reason: z.ZodEnum<{
|
|
250
|
+
nonce_replacement: "nonce_replacement";
|
|
251
|
+
superseded: "superseded";
|
|
252
|
+
}>;
|
|
253
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
254
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
255
|
+
state: z.ZodLiteral<"not_found">;
|
|
256
|
+
category: z.ZodLiteral<"terminal-failure">;
|
|
257
|
+
paymentId: z.ZodString;
|
|
258
|
+
reason: z.ZodEnum<{
|
|
259
|
+
expired: "expired";
|
|
260
|
+
unknown_payment_identity: "unknown_payment_identity";
|
|
261
|
+
}>;
|
|
262
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
263
|
+
}, z.core.$strip>], "state">;
|
|
264
|
+
export type PaymentStatus = z.infer<typeof PaymentStatusSchema>;
|
|
265
|
+
export type TrackedPaymentStatus = z.infer<typeof TrackedPaymentStatusSchema>;
|
|
266
|
+
export type TerminalPaymentStatus = z.infer<typeof TerminalPaymentStatusSchema>;
|
|
267
|
+
//# sourceMappingURL=payment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment.d.ts","sourceRoot":"","sources":["../../src/core/payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkCxB,eAAO,MAAM,2BAA2B;;;iBAGtC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;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