@armory-sh/base 0.2.13 → 0.2.14

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.
@@ -88,8 +88,8 @@ export interface AcceptPaymentOptions {
88
88
  tokens?: TokenId[];
89
89
  /** Facilitator(s) for payment verification/settlement */
90
90
  facilitators?: FacilitatorConfig | FacilitatorConfig[];
91
- /** Protocol version (default: auto-detect) */
92
- version?: 1 | 2 | "auto";
91
+ /** Protocol version (V2 only) */
92
+ version?: 2;
93
93
  /** Pricing configurations - if not provided, uses amount from top-level config */
94
94
  pricing?: PricingConfig[];
95
95
  }
@@ -172,8 +172,8 @@ export interface ResolvedPaymentConfig {
172
172
  token: ResolvedToken;
173
173
  /** Facilitator(s) to use */
174
174
  facilitators: ResolvedFacilitator[];
175
- /** Protocol version */
176
- version: 1 | 2 | "auto";
175
+ /** Protocol version (V2 only) */
176
+ version: 2;
177
177
  /** Recipient address */
178
178
  payTo: Address;
179
179
  /** Amount to charge */
@@ -1,22 +1,13 @@
1
1
  /**
2
- * Protocol Union Types and Version Detection
2
+ * Protocol Types - x402 V2 Only
3
3
  *
4
- * Handles both x402 V1 and V2 formats along with legacy Armory formats
4
+ * Simplified to support only x402 V2 format (Coinbase compatible)
5
5
  */
6
- import type { X402PaymentPayloadV1, X402PaymentRequiredV1, X402PaymentRequirementsV1, X402SettlementResponseV1, LegacyPaymentPayloadV1, LegacyPaymentRequirementsV1, LegacySettlementResponseV1 } from "./v1";
7
6
  import type { PaymentPayloadV2, PaymentRequirementsV2, SettlementResponseV2, PaymentRequiredV2, Address } from "./v2";
8
- /**
9
- * All x402 compatible payment payload types
10
- */
11
- export type PaymentPayload = X402PaymentPayloadV1 | PaymentPayloadV2 | LegacyPaymentPayloadV1;
12
- /**
13
- * All x402 compatible payment requirements types
14
- */
15
- export type PaymentRequirements = X402PaymentRequirementsV1 | PaymentRequirementsV2 | LegacyPaymentRequirementsV1;
16
- /**
17
- * All x402 compatible settlement response types
18
- */
19
- export type SettlementResponse = X402SettlementResponseV1 | SettlementResponseV2 | LegacySettlementResponseV1;
7
+ export type PaymentPayload = PaymentPayloadV2;
8
+ export type PaymentRequirements = PaymentRequirementsV2;
9
+ export type SettlementResponse = SettlementResponseV2;
10
+ export type PaymentRequired = PaymentRequiredV2;
20
11
  /**
21
12
  * Configuration for connecting to a facilitator service
22
13
  */
@@ -50,10 +41,6 @@ export type SettlementMode = "verify" | "settle" | "async";
50
41
  * Payment destination - address, CAIP-2 chain ID, or CAIP asset ID
51
42
  */
52
43
  export type PayToAddress = Address | CAIP2ChainId | CAIPAssetId;
53
- /**
54
- * All x402 compatible payment required response types
55
- */
56
- export type PaymentRequired = X402PaymentRequiredV1 | PaymentRequiredV2;
57
44
  /**
58
45
  * CAIP-2 chain ID type (e.g., eip155:8453)
59
46
  */
@@ -62,87 +49,43 @@ export type CAIP2ChainId = `eip155:${string}`;
62
49
  * CAIP-2 asset ID type (e.g., eip155:8453/erc20:0xa0b8691...)
63
50
  */
64
51
  export type CAIPAssetId = `eip155:${string}/erc20:${string}`;
65
- /**
66
- * Check if payload is x402 V1 format
67
- */
68
- export declare function isX402V1Payload(obj: unknown): obj is X402PaymentPayloadV1;
69
52
  /**
70
53
  * Check if payload is x402 V2 format (Coinbase format)
71
54
  */
72
55
  export declare function isX402V2Payload(obj: unknown): obj is PaymentPayloadV2;
73
- /**
74
- * Check if payload is legacy Armory V1 format
75
- */
76
- export declare function isLegacyV1Payload(obj: unknown): obj is LegacyPaymentPayloadV1;
77
56
  /**
78
57
  * Check if payload is legacy Armory V2 format
79
58
  */
80
59
  export declare function isLegacyV2Payload(obj: unknown): boolean;
81
- /**
82
- * Get x402 version from payload
83
- */
84
- export declare function getPaymentVersion(payload: PaymentPayload): 1 | 2;
85
- /**
86
- * Check if requirements is x402 V1 format
87
- */
88
- export declare function isX402V1Requirements(obj: unknown): obj is X402PaymentRequirementsV1;
89
60
  /**
90
61
  * Check if requirements is x402 V2 format
91
62
  */
92
63
  export declare function isX402V2Requirements(obj: unknown): obj is PaymentRequirementsV2;
93
- /**
94
- * Get x402 version from requirements
95
- */
96
- export declare function getRequirementsVersion(requirements: PaymentRequirements): 1 | 2;
97
- /**
98
- * Check if settlement response is x402 V1 format
99
- */
100
- export declare function isX402V1Settlement(obj: unknown): obj is X402SettlementResponseV1;
101
64
  /**
102
65
  * Check if settlement response is x402 V2 format
103
66
  */
104
67
  export declare function isX402V2Settlement(obj: unknown): obj is SettlementResponseV2;
105
- /**
106
- * Get x402 version from settlement response
107
- */
108
- export declare function getSettlementVersion(response: SettlementResponse): 1 | 2;
109
- /**
110
- * Check if payment required is x402 V1 format
111
- */
112
- export declare function isX402V1PaymentRequired(obj: unknown): obj is X402PaymentRequiredV1;
113
68
  /**
114
69
  * Check if payment required is x402 V2 format
115
70
  */
116
71
  export declare function isX402V2PaymentRequired(obj: unknown): obj is PaymentRequiredV2;
117
72
  /**
118
- * Get x402 version from payment required
119
- */
120
- export declare function getPaymentRequiredVersion(obj: PaymentRequired): 1 | 2;
121
- /**
122
- * Get payment header name for version
73
+ * x402 V2 payment header name
123
74
  */
124
- export declare function getPaymentHeaderName(version: 1 | 2): string;
75
+ export declare const PAYMENT_SIGNATURE_HEADER: "PAYMENT-SIGNATURE";
125
76
  /**
126
- * Get payment response header name for version
77
+ * x402 V2 payment response header name
127
78
  */
128
- export declare function getPaymentResponseHeaderName(version: 1 | 2): string;
79
+ export declare const PAYMENT_RESPONSE_HEADER: "PAYMENT-RESPONSE";
129
80
  /**
130
- * Get payment required header name for version
81
+ * x402 V2 payment required header name
131
82
  */
132
- export declare function getPaymentRequiredHeaderName(version: 1 | 2): string;
83
+ export declare const PAYMENT_REQUIRED_HEADER: "PAYMENT-REQUIRED";
133
84
  /**
134
85
  * Check if settlement was successful
135
86
  */
136
87
  export declare function isSettlementSuccessful(response: SettlementResponse): boolean;
137
88
  /**
138
- * Get transaction hash from settlement response
89
+ * Get transaction hash from settlement response (V2 only)
139
90
  */
140
91
  export declare function getTxHash(response: SettlementResponse): string | undefined;
141
- /**
142
- * @deprecated Use isX402V1Payload or isLegacyV1Payload instead
143
- */
144
- export declare function isV1(obj: unknown): boolean;
145
- /**
146
- * @deprecated Use isX402V2Payload or isLegacyV2Payload instead
147
- */
148
- export declare function isV2(obj: unknown): boolean;
@@ -50,7 +50,11 @@ export interface PaymentRequirementsV2 {
50
50
  payTo: Address;
51
51
  /** Maximum time allowed for payment completion */
52
52
  maxTimeoutSeconds: number;
53
- /** Scheme-specific additional information (token name, version, etc.) */
53
+ /** EIP-712 domain parameter: token name */
54
+ name?: string;
55
+ /** EIP-712 domain parameter: token version */
56
+ version?: string;
57
+ /** Scheme-specific additional information */
54
58
  extra?: Extensions;
55
59
  }
56
60
  /**
@@ -52,18 +52,17 @@ export interface UnsignedPaymentPayload {
52
52
  }
53
53
  /**
54
54
  * Payment requirements for 402 response
55
+ * Matches x402 SDK format
55
56
  */
56
57
  export interface PaymentRequirements {
57
58
  scheme: Scheme;
58
59
  network: Network;
59
- maxAmountRequired: string;
60
- resource: string;
61
- description: string;
62
- mimeType: string;
63
- outputSchema?: Record<string, unknown>;
60
+ amount: string;
64
61
  payTo: Address;
65
62
  maxTimeoutSeconds: number;
66
63
  asset: Address;
64
+ name?: string;
65
+ version?: string;
67
66
  extra?: Record<string, unknown>;
68
67
  }
69
68
  /**
@@ -2,15 +2,7 @@
2
2
  * Comprehensive validation for Armory configurations
3
3
  * Ensures networks, tokens, and facilitators are compatible
4
4
  */
5
- import type { NetworkId, TokenId, FacilitatorConfig, ResolvedNetwork, ResolvedToken, ResolvedFacilitator, ResolvedPaymentConfig, ValidationError, PaymentErrorCode } from "./types/simple";
6
- export declare const CustomTokenSchema: import("arktype/internal/variants/object.ts").ObjectType<{
7
- symbol: string;
8
- name: string;
9
- version: string;
10
- contractAddress: `0x${string}`;
11
- chainId: number;
12
- decimals?: number | undefined;
13
- }, {}>;
5
+ import type { NetworkId, TokenId, FacilitatorConfig, ResolvedNetwork, ResolvedToken, ResolvedFacilitator, ResolvedPaymentConfig, ValidationError, PaymentErrorCode } from "./types/api";
14
6
  export declare const createError: (code: PaymentErrorCode, message: string, details?: Partial<ValidationError>) => ValidationError;
15
7
  export declare const normalizeNetworkName: (name: string) => string;
16
8
  export declare const resolveNetwork: (input: unknown) => ResolvedNetwork | ValidationError;
@@ -26,7 +18,7 @@ export declare const validateAcceptConfig: (options: {
26
18
  networks?: NetworkId[];
27
19
  tokens?: TokenId[];
28
20
  facilitators?: FacilitatorConfig | FacilitatorConfig[];
29
- version?: 1 | 2 | "auto";
21
+ version?: 2;
30
22
  }, payTo: string, amount: string) => {
31
23
  success: true;
32
24
  config: ResolvedPaymentConfig[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armory-sh/base",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "license": "MIT",
5
5
  "author": "Sawyer Cutler <sawyer@dirtroad.dev>",
6
6
  "type": "module",
@@ -24,12 +24,9 @@
24
24
  "repository": {
25
25
  "type": "git",
26
26
  "url": "git+https://github.com/thegreataxios/armory.git",
27
- "directory": "packages/core"
28
- },
29
- "dependencies": {
30
- "arktype": "^2.1.29",
31
- "viem": "2.45.0"
27
+ "directory": "packages/base"
32
28
  },
29
+ "dependencies": {},
33
30
  "devDependencies": {
34
31
  "@types/node": "^25.2.1",
35
32
  "bun-types": "latest",