@armory-sh/base 0.2.33 → 0.2.34

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/index.js CHANGED
@@ -622,11 +622,10 @@ function toJsonSafe(data) {
622
622
  function resolveUrl(config) {
623
623
  return config?.url ?? DEFAULT_FACILITATOR_URL;
624
624
  }
625
- async function resolveHeaders(config) {
625
+ function resolveHeaders(config) {
626
626
  const base = { "Content-Type": "application/json" };
627
- if (!config?.createHeaders) return base;
628
- const extra = await config.createHeaders();
629
- return { ...base, ...extra };
627
+ if (!config?.headers) return base;
628
+ return { ...base, ...config.headers };
630
629
  }
631
630
  async function verifyPayment(payload, requirements, config) {
632
631
  const url = resolveUrl(config);
@@ -1,7 +1,7 @@
1
1
  import type { PaymentPayload, PaymentRequirements, SettlementResponse, VerifyResponse } from "./types/x402";
2
2
  export interface FacilitatorClientConfig {
3
3
  url: string;
4
- createHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
4
+ headers?: Record<string, string>;
5
5
  }
6
6
  export declare function verifyPayment(payload: PaymentPayload, requirements: PaymentRequirements, config?: FacilitatorClientConfig): Promise<VerifyResponse>;
7
7
  export declare function settlePayment(payload: PaymentPayload, requirements: PaymentRequirements, config?: FacilitatorClientConfig): Promise<SettlementResponse>;
@@ -25,7 +25,7 @@ export interface FacilitatorConfig {
25
25
  /** Facilitator URL for verification/settlement */
26
26
  url: string;
27
27
  /** Optional authentication headers */
28
- headers?: () => Record<string, string>;
28
+ headers?: Record<string, string>;
29
29
  /** Networks this facilitator supports (auto-detected if not provided) */
30
30
  networks?: NetworkId[];
31
31
  /** Tokens this facilitator supports (optional) */
@@ -50,9 +50,9 @@ export interface FacilitatorSettleResult {
50
50
  error?: string;
51
51
  }
52
52
  /**
53
- * Settlement mode - verify only, settle only, or both
53
+ * Settlement mode - verify only or settle
54
54
  */
55
- export type SettlementMode = "verify" | "settle" | "async";
55
+ export type SettlementMode = "verify" | "settle";
56
56
  /**
57
57
  * CAIP-2 chain ID type (e.g., eip155:8453)
58
58
  */
@@ -13,7 +13,7 @@ export type PaymentRequired = PaymentRequiredV2;
13
13
  */
14
14
  export interface FacilitatorConfig {
15
15
  url: string;
16
- createHeaders?: () => Record<string, string>;
16
+ headers?: Record<string, string>;
17
17
  }
18
18
  /**
19
19
  * Result from facilitator verification
@@ -34,9 +34,9 @@ export interface FacilitatorSettleResult {
34
34
  error?: string;
35
35
  }
36
36
  /**
37
- * Settlement mode - verify only, settle only, or both
37
+ * Settlement mode - verify only or settle
38
38
  */
39
- export type SettlementMode = "verify" | "settle" | "async";
39
+ export type SettlementMode = "verify" | "settle";
40
40
  /**
41
41
  * Payment destination - address, CAIP-2 chain ID, or CAIP asset ID
42
42
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armory-sh/base",
3
- "version": "0.2.33",
3
+ "version": "0.2.34",
4
4
  "license": "MIT",
5
5
  "author": "Sawyer Cutler <sawyer@dirtroad.dev>",
6
6
  "keywords": [
@@ -9,9 +9,7 @@ import { decodeBase64ToUtf8 } from "./utils/base64";
9
9
 
10
10
  export interface FacilitatorClientConfig {
11
11
  url: string;
12
- createHeaders?: () =>
13
- | Record<string, string>
14
- | Promise<Record<string, string>>;
12
+ headers?: Record<string, string>;
15
13
  }
16
14
 
17
15
  const DEFAULT_FACILITATOR_URL = "https://facilitator.payai.network";
@@ -38,13 +36,12 @@ function resolveUrl(config?: FacilitatorClientConfig): string {
38
36
  return config?.url ?? DEFAULT_FACILITATOR_URL;
39
37
  }
40
38
 
41
- async function resolveHeaders(
39
+ function resolveHeaders(
42
40
  config?: FacilitatorClientConfig,
43
- ): Promise<Record<string, string>> {
41
+ ): Record<string, string> {
44
42
  const base: Record<string, string> = { "Content-Type": "application/json" };
45
- if (!config?.createHeaders) return base;
46
- const extra = await config.createHeaders();
47
- return { ...base, ...extra };
43
+ if (!config?.headers) return base;
44
+ return { ...base, ...config.headers };
48
45
  }
49
46
 
50
47
  export async function verifyPayment(
package/src/types/api.ts CHANGED
@@ -33,7 +33,7 @@ export interface FacilitatorConfig {
33
33
  /** Facilitator URL for verification/settlement */
34
34
  url: string;
35
35
  /** Optional authentication headers */
36
- headers?: () => Record<string, string>;
36
+ headers?: Record<string, string>;
37
37
  /** Networks this facilitator supports (auto-detected if not provided) */
38
38
  networks?: NetworkId[];
39
39
  /** Tokens this facilitator supports (optional) */
@@ -61,9 +61,9 @@ export interface FacilitatorSettleResult {
61
61
  }
62
62
 
63
63
  /**
64
- * Settlement mode - verify only, settle only, or both
64
+ * Settlement mode - verify only or settle
65
65
  */
66
- export type SettlementMode = "verify" | "settle" | "async";
66
+ export type SettlementMode = "verify" | "settle";
67
67
 
68
68
  /**
69
69
  * CAIP-2 chain ID type (e.g., eip155:8453)
@@ -30,7 +30,7 @@ export type PaymentRequired = PaymentRequiredV2;
30
30
  */
31
31
  export interface FacilitatorConfig {
32
32
  url: string;
33
- createHeaders?: () => Record<string, string>;
33
+ headers?: Record<string, string>;
34
34
  }
35
35
 
36
36
  /**
@@ -54,9 +54,9 @@ export interface FacilitatorSettleResult {
54
54
  }
55
55
 
56
56
  /**
57
- * Settlement mode - verify only, settle only, or both
57
+ * Settlement mode - verify only or settle
58
58
  */
59
- export type SettlementMode = "verify" | "settle" | "async";
59
+ export type SettlementMode = "verify" | "settle";
60
60
 
61
61
  /**
62
62
  * Payment destination - address, CAIP-2 chain ID, or CAIP asset ID