@faremeter/types 0.1.0 → 0.2.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/src/x402.ts~ DELETED
@@ -1,72 +0,0 @@
1
-
2
- export const x402PaymentRequirements = type({
3
- scheme: "string",
4
- network: "string",
5
- maxAmountRequired: "string.numeric",
6
- resource: "string.url",
7
- description: "string",
8
- mimeType: "string",
9
- outputSchema: "object?",
10
- payTo: "string",
11
- maxTimeoutSeconds: "number.integer",
12
- asset: "string",
13
- extra: "object?",
14
- });
15
-
16
- export type x402PaymentRequirements = typeof x402PaymentRequirements.infer;
17
-
18
- export const x402PaymentRequiredResponse = type({
19
- x402Version: "number.integer",
20
- accepts: x402PaymentRequirements.array(),
21
- error: "string?",
22
- });
23
-
24
- export type x402PaymentRequiredResponse =
25
- typeof x402PaymentRequiredResponse.infer;
26
-
27
- export const x402PaymentPayload = type({
28
- x402Version: "number.integer",
29
- scheme: "string",
30
- network: "string",
31
- payload: "object",
32
- });
33
-
34
- export type x402PaymentPayload = typeof x402PaymentPayload.infer;
35
-
36
- export function headerToX402PaymentPayload(header: string) {
37
- return type("string.base64")
38
- .pipe.try((x) => atob(x))
39
- .to("string.json.parse")
40
- .to(x402PaymentPayload)(header);
41
- }
42
-
43
- export const x402VerifyRequest = type({
44
- x402Version: "number.integer",
45
- paymentHeader: "string",
46
- paymentRequirements: x402PaymentRequirements,
47
- });
48
-
49
- export type x402VerifyRequest = typeof x402VerifyRequest.infer;
50
-
51
- export const x402SettleRequest = x402VerifyRequest;
52
- export type x402SettleRequest = typeof x402SettleRequest.infer;
53
-
54
- export const x402SettleResponse = type({
55
- success: "boolean",
56
- error: "string | null",
57
- txHash: "string | null",
58
- networkId: "string | null",
59
- });
60
-
61
- export type x402SettleResponse = typeof x402SettleResponse.infer;
62
-
63
- export const x402SupportedResponse = type({
64
- kinds: [
65
- {
66
- scheme: "string",
67
- network: "string",
68
- },
69
- ],
70
- });
71
-
72
- export type x402SupportedResponse = typeof x402SupportedResponse.infer;
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "noEmit": false
6
- },
7
- "include": ["src/**/*"]
8
- }