@agent-score/commerce 2.6.1 → 2.6.3

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@agent-score/commerce.svg)](https://www.npmjs.com/package/@agent-score/commerce)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
5
 
6
- The full merchant-side SDK for [AgentScore](https://www.agentscore.com): agent commerce in one install. Ships identity gating, payment rail helpers, 402 challenge builders, MPP discovery, and Stripe multichain support. Built and maintained by AgentScore; works with any 402/MPP merchant in the ecosystem, AgentScore-gated or not.
6
+ The full merchant-side SDK for [AgentScore](https://www.agentscore.com): agent commerce in one install. Ships identity gating, payment rail helpers, 402 challenge builders, MPP discovery, and Stripe multichain support. Built and maintained by AgentScore; works with any x402/MPP merchant in the ecosystem, AgentScore-gated or not.
7
7
 
8
8
  ## Install
9
9
 
@@ -476,7 +476,7 @@ The `getGateDegradedState` helper is exported by the context-getter adapters (Ho
476
476
 
477
477
  ## Examples
478
478
 
479
- The [examples/](./examples) directory has 9 runnable single-file Hono apps covering common merchant scenarios; copy-paste templates, not frameworks. See [examples/README.md](./examples/README.md) for the full table.
479
+ The [examples/](./examples) directory has 8 runnable single-file Hono apps covering common merchant scenarios; copy-paste templates, not frameworks. See [examples/README.md](./examples/README.md) for the full table.
480
480
 
481
481
  ## Vendor profile examples
482
482
 
package/dist/core.js CHANGED
@@ -227,7 +227,7 @@ function createAgentScoreCore(options) {
227
227
  } = options;
228
228
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
229
229
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
230
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
230
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
231
231
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
232
232
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
233
233
  const sessionSdkCache = /* @__PURE__ */ new Map();
package/dist/core.mjs CHANGED
@@ -209,7 +209,7 @@ function createAgentScoreCore(options) {
209
209
  } = options;
210
210
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
211
211
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
212
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
212
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
213
213
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
214
214
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
215
215
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -920,7 +920,7 @@ function createAgentScoreCore(options) {
920
920
  } = options;
921
921
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
922
922
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
923
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
923
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
924
924
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
925
925
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
926
926
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -892,7 +892,7 @@ function createAgentScoreCore(options) {
892
892
  } = options;
893
893
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
894
894
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
895
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
895
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
896
896
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
897
897
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
898
898
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -921,7 +921,7 @@ function createAgentScoreCore(options) {
921
921
  } = options;
922
922
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
923
923
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
924
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
924
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
925
925
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
926
926
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
927
927
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -892,7 +892,7 @@ function createAgentScoreCore(options) {
892
892
  } = options;
893
893
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
894
894
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
895
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
895
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
896
896
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
897
897
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
898
898
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -901,7 +901,7 @@ function createAgentScoreCore(options) {
901
901
  } = options;
902
902
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
903
903
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
904
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
904
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
905
905
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
906
906
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
907
907
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -873,7 +873,7 @@ function createAgentScoreCore(options) {
873
873
  } = options;
874
874
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
875
875
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
876
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
876
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
877
877
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
878
878
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
879
879
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -922,7 +922,7 @@ function createAgentScoreCore(options) {
922
922
  } = options;
923
923
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
924
924
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
925
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
925
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
926
926
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
927
927
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
928
928
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -897,7 +897,7 @@ function createAgentScoreCore(options) {
897
897
  } = options;
898
898
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
899
899
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
900
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
900
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
901
901
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
902
902
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
903
903
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -898,7 +898,7 @@ function createAgentScoreCore(options) {
898
898
  } = options;
899
899
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
900
900
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
901
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
901
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
902
902
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
903
903
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
904
904
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -873,7 +873,7 @@ function createAgentScoreCore(options) {
873
873
  } = options;
874
874
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
875
875
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
876
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
876
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
877
877
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
878
878
  const sdk = new AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
879
879
  const sessionSdkCache = /* @__PURE__ */ new Map();
package/dist/index.js CHANGED
@@ -5535,9 +5535,9 @@ function stringifyPrimitive(value) {
5535
5535
  return `"${value}"`;
5536
5536
  return `${value}`;
5537
5537
  }
5538
- function optionalKeys(shape) {
5539
- return Object.keys(shape).filter((k) => {
5540
- return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
5538
+ function optionalKeys(shape2) {
5539
+ return Object.keys(shape2).filter((k) => {
5540
+ return shape2[k]._zod.optin === "optional" && shape2[k]._zod.optout === "optional";
5541
5541
  });
5542
5542
  }
5543
5543
  function pick(schema, mask) {
@@ -5590,15 +5590,15 @@ function omit(schema, mask) {
5590
5590
  });
5591
5591
  return clone(schema, def);
5592
5592
  }
5593
- function extend(schema, shape) {
5594
- if (!isPlainObject(shape)) {
5593
+ function extend(schema, shape2) {
5594
+ if (!isPlainObject(shape2)) {
5595
5595
  throw new Error("Invalid input to extend: expected a plain object");
5596
5596
  }
5597
5597
  const checks = schema._zod.def.checks;
5598
5598
  const hasChecks = checks && checks.length > 0;
5599
5599
  if (hasChecks) {
5600
5600
  const existingShape = schema._zod.def.shape;
5601
- for (const key in shape) {
5601
+ for (const key in shape2) {
5602
5602
  if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
5603
5603
  throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
5604
5604
  }
@@ -5606,20 +5606,20 @@ function extend(schema, shape) {
5606
5606
  }
5607
5607
  const def = mergeDefs(schema._zod.def, {
5608
5608
  get shape() {
5609
- const _shape = { ...schema._zod.def.shape, ...shape };
5609
+ const _shape = { ...schema._zod.def.shape, ...shape2 };
5610
5610
  assignProp(this, "shape", _shape);
5611
5611
  return _shape;
5612
5612
  }
5613
5613
  });
5614
5614
  return clone(schema, def);
5615
5615
  }
5616
- function safeExtend(schema, shape) {
5617
- if (!isPlainObject(shape)) {
5616
+ function safeExtend(schema, shape2) {
5617
+ if (!isPlainObject(shape2)) {
5618
5618
  throw new Error("Invalid input to safeExtend: expected a plain object");
5619
5619
  }
5620
5620
  const def = mergeDefs(schema._zod.def, {
5621
5621
  get shape() {
5622
- const _shape = { ...schema._zod.def.shape, ...shape };
5622
+ const _shape = { ...schema._zod.def.shape, ...shape2 };
5623
5623
  assignProp(this, "shape", _shape);
5624
5624
  return _shape;
5625
5625
  }
@@ -5653,7 +5653,7 @@ function partial(Class2, schema, mask) {
5653
5653
  const def = mergeDefs(schema._zod.def, {
5654
5654
  get shape() {
5655
5655
  const oldShape = schema._zod.def.shape;
5656
- const shape = { ...oldShape };
5656
+ const shape2 = { ...oldShape };
5657
5657
  if (mask) {
5658
5658
  for (const key in mask) {
5659
5659
  if (!(key in oldShape)) {
@@ -5661,21 +5661,21 @@ function partial(Class2, schema, mask) {
5661
5661
  }
5662
5662
  if (!mask[key])
5663
5663
  continue;
5664
- shape[key] = Class2 ? new Class2({
5664
+ shape2[key] = Class2 ? new Class2({
5665
5665
  type: "optional",
5666
5666
  innerType: oldShape[key]
5667
5667
  }) : oldShape[key];
5668
5668
  }
5669
5669
  } else {
5670
5670
  for (const key in oldShape) {
5671
- shape[key] = Class2 ? new Class2({
5671
+ shape2[key] = Class2 ? new Class2({
5672
5672
  type: "optional",
5673
5673
  innerType: oldShape[key]
5674
5674
  }) : oldShape[key];
5675
5675
  }
5676
5676
  }
5677
- assignProp(this, "shape", shape);
5678
- return shape;
5677
+ assignProp(this, "shape", shape2);
5678
+ return shape2;
5679
5679
  },
5680
5680
  checks: []
5681
5681
  });
@@ -5685,29 +5685,29 @@ function required(Class2, schema, mask) {
5685
5685
  const def = mergeDefs(schema._zod.def, {
5686
5686
  get shape() {
5687
5687
  const oldShape = schema._zod.def.shape;
5688
- const shape = { ...oldShape };
5688
+ const shape2 = { ...oldShape };
5689
5689
  if (mask) {
5690
5690
  for (const key in mask) {
5691
- if (!(key in shape)) {
5691
+ if (!(key in shape2)) {
5692
5692
  throw new Error(`Unrecognized key: "${key}"`);
5693
5693
  }
5694
5694
  if (!mask[key])
5695
5695
  continue;
5696
- shape[key] = new Class2({
5696
+ shape2[key] = new Class2({
5697
5697
  type: "nonoptional",
5698
5698
  innerType: oldShape[key]
5699
5699
  });
5700
5700
  }
5701
5701
  } else {
5702
5702
  for (const key in oldShape) {
5703
- shape[key] = new Class2({
5703
+ shape2[key] = new Class2({
5704
5704
  type: "nonoptional",
5705
5705
  innerType: oldShape[key]
5706
5706
  });
5707
5707
  }
5708
5708
  }
5709
- assignProp(this, "shape", shape);
5710
- return shape;
5709
+ assignProp(this, "shape", shape2);
5710
+ return shape2;
5711
5711
  }
5712
5712
  });
5713
5713
  return clone(schema, def);
@@ -8002,10 +8002,10 @@ var init_schemas = __esm({
8002
8002
  }
8003
8003
  const _normalized = cached(() => normalizeDef(def));
8004
8004
  defineLazy(inst._zod, "propValues", () => {
8005
- const shape = def.shape;
8005
+ const shape2 = def.shape;
8006
8006
  const propValues = {};
8007
- for (const key in shape) {
8008
- const field = shape[key]._zod;
8007
+ for (const key in shape2) {
8008
+ const field = shape2[key]._zod;
8009
8009
  if (field.values) {
8010
8010
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
8011
8011
  for (const v of field.values)
@@ -8031,9 +8031,9 @@ var init_schemas = __esm({
8031
8031
  }
8032
8032
  payload.value = {};
8033
8033
  const proms = [];
8034
- const shape = value.shape;
8034
+ const shape2 = value.shape;
8035
8035
  for (const key of value.keys) {
8036
- const el = shape[key];
8036
+ const el = shape2[key];
8037
8037
  const isOptionalIn = el._zod.optin === "optional";
8038
8038
  const isOptionalOut = el._zod.optout === "optional";
8039
8039
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
@@ -8053,7 +8053,7 @@ var init_schemas = __esm({
8053
8053
  $ZodObject.init(inst, def);
8054
8054
  const superParse = inst._zod.parse;
8055
8055
  const _normalized = cached(() => normalizeDef(def));
8056
- const generateFastpass = (shape) => {
8056
+ const generateFastpass = (shape2) => {
8057
8057
  const doc = new Doc(["shape", "payload", "ctx"]);
8058
8058
  const normalized = _normalized.value;
8059
8059
  const parseStr = (key) => {
@@ -8070,7 +8070,7 @@ var init_schemas = __esm({
8070
8070
  for (const key of normalized.keys) {
8071
8071
  const id = ids[key];
8072
8072
  const k = esc(key);
8073
- const schema = shape[key];
8073
+ const schema = shape2[key];
8074
8074
  const isOptionalIn = schema?._zod?.optin === "optional";
8075
8075
  const isOptionalOut = schema?._zod?.optout === "optional";
8076
8076
  doc.write(`const ${id} = ${parseStr(key)};`);
@@ -8144,7 +8144,7 @@ var init_schemas = __esm({
8144
8144
  doc.write(`payload.value = newResult;`);
8145
8145
  doc.write(`return payload;`);
8146
8146
  const fn = doc.compile();
8147
- return (payload, ctx) => fn(shape, payload, ctx);
8147
+ return (payload, ctx) => fn(shape2, payload, ctx);
8148
8148
  };
8149
8149
  let fastpass;
8150
8150
  const isObject3 = isObject;
@@ -17202,14 +17202,14 @@ var init_json_schema_processors = __esm({
17202
17202
  const def = schema._zod.def;
17203
17203
  json2.type = "object";
17204
17204
  json2.properties = {};
17205
- const shape = def.shape;
17206
- for (const key in shape) {
17207
- json2.properties[key] = process2(shape[key], ctx, {
17205
+ const shape2 = def.shape;
17206
+ for (const key in shape2) {
17207
+ json2.properties[key] = process2(shape2[key], ctx, {
17208
17208
  ...params,
17209
17209
  path: [...params.path, "properties", key]
17210
17210
  });
17211
17211
  }
17212
- const allKeys = new Set(Object.keys(shape));
17212
+ const allKeys = new Set(Object.keys(shape2));
17213
17213
  const requiredKeys = new Set([...allKeys].filter((key) => {
17214
17214
  const v = def.shape[key]._zod;
17215
17215
  if (ctx.io === "input") {
@@ -18070,47 +18070,47 @@ function array(element, params) {
18070
18070
  }
18071
18071
  // @__NO_SIDE_EFFECTS__
18072
18072
  function keyof(schema) {
18073
- const shape = schema._zod.def.shape;
18074
- return /* @__PURE__ */ _enum2(Object.keys(shape));
18073
+ const shape2 = schema._zod.def.shape;
18074
+ return /* @__PURE__ */ _enum2(Object.keys(shape2));
18075
18075
  }
18076
18076
  // @__NO_SIDE_EFFECTS__
18077
- function object(shape, params) {
18077
+ function object(shape2, params) {
18078
18078
  const def = {
18079
18079
  type: "object",
18080
- shape: shape ?? {},
18080
+ shape: shape2 ?? {},
18081
18081
  ...normalizeParams(params)
18082
18082
  };
18083
18083
  return new ZodMiniObject(def);
18084
18084
  }
18085
18085
  // @__NO_SIDE_EFFECTS__
18086
- function strictObject(shape, params) {
18086
+ function strictObject(shape2, params) {
18087
18087
  return new ZodMiniObject({
18088
18088
  type: "object",
18089
- shape,
18089
+ shape: shape2,
18090
18090
  catchall: /* @__PURE__ */ never(),
18091
18091
  ...normalizeParams(params)
18092
18092
  });
18093
18093
  }
18094
18094
  // @__NO_SIDE_EFFECTS__
18095
- function looseObject(shape, params) {
18095
+ function looseObject(shape2, params) {
18096
18096
  return new ZodMiniObject({
18097
18097
  type: "object",
18098
- shape,
18098
+ shape: shape2,
18099
18099
  catchall: /* @__PURE__ */ unknown(),
18100
18100
  ...normalizeParams(params)
18101
18101
  });
18102
18102
  }
18103
18103
  // @__NO_SIDE_EFFECTS__
18104
- function extend2(schema, shape) {
18105
- return extend(schema, shape);
18104
+ function extend2(schema, shape2) {
18105
+ return extend(schema, shape2);
18106
18106
  }
18107
18107
  // @__NO_SIDE_EFFECTS__
18108
- function safeExtend2(schema, shape) {
18109
- return safeExtend(schema, shape);
18108
+ function safeExtend2(schema, shape2) {
18109
+ return safeExtend(schema, shape2);
18110
18110
  }
18111
18111
  // @__NO_SIDE_EFFECTS__
18112
- function merge2(schema, shape) {
18113
- return extend(schema, shape);
18112
+ function merge2(schema, shape2) {
18113
+ return extend(schema, shape2);
18114
18114
  }
18115
18115
  // @__NO_SIDE_EFFECTS__
18116
18116
  function pick2(schema, mask) {
@@ -20148,7 +20148,7 @@ var version3;
20148
20148
  var init_version2 = __esm({
20149
20149
  "node_modules/viem/_esm/errors/version.js"() {
20150
20150
  "use strict";
20151
- version3 = "2.54.4";
20151
+ version3 = "2.54.6";
20152
20152
  }
20153
20153
  });
20154
20154
 
@@ -21143,14 +21143,14 @@ function fromResponse2(response) {
21143
21143
  throw new Error(`Missing ${Headers2.paymentReceipt} header.`);
21144
21144
  return deserialize4(header);
21145
21145
  }
21146
- var Schema2;
21146
+ var shape, BaseSchema, Schema2;
21147
21147
  var init_Receipt = __esm({
21148
21148
  "node_modules/mppx/dist/Receipt.js"() {
21149
21149
  "use strict";
21150
21150
  init_esm2();
21151
21151
  init_Constants();
21152
21152
  init_zod();
21153
- Schema2 = object({
21153
+ shape = {
21154
21154
  /** Payment method used (e.g., "tempo", "stripe"). */
21155
21155
  method: string2(),
21156
21156
  /** Method-specific reference (e.g., transaction hash). */
@@ -21163,7 +21163,9 @@ var init_Receipt = __esm({
21163
21163
  status: literal("success"),
21164
21164
  /** RFC 3339 settlement timestamp. */
21165
21165
  timestamp: datetime3()
21166
- });
21166
+ };
21167
+ BaseSchema = object(shape);
21168
+ Schema2 = looseObject(shape);
21167
21169
  }
21168
21170
  });
21169
21171
 
@@ -22662,7 +22664,7 @@ function createAgentScoreCore(options) {
22662
22664
  } = options;
22663
22665
  const baseUrl = stripTrailingSlashes(rawBaseUrl);
22664
22666
  const agentMemoryHint = buildAgentMemoryHint(aipTrustedIssuers);
22665
- const defaultUa = `@agent-score/commerce@${"2.6.1"}`;
22667
+ const defaultUa = `@agent-score/commerce@${"2.6.3"}`;
22666
22668
  const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
22667
22669
  const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
22668
22670
  const sessionSdkCache = /* @__PURE__ */ new Map();
@@ -26068,21 +26070,33 @@ var Checkout = class {
26068
26070
  if (ctx.pricing.amountUsd !== 0) return null;
26069
26071
  const headers = normalizeHeadersToLowercase(ctx.request.headers);
26070
26072
  let zero;
26073
+ let railKey;
26071
26074
  if (rail === "x402-base") {
26072
- const x402Header = headers["payment-signature"] ?? headers["x-payment"];
26073
- let payload = null;
26074
- if (typeof x402Header === "string" && x402Header.length > 0) {
26075
- try {
26076
- payload = JSON.parse(atob(x402Header));
26077
- } catch {
26078
- payload = null;
26079
- }
26075
+ const fakeRequest = new Request(ctx.request.url, {
26076
+ method: ctx.request.method,
26077
+ headers: ctx.request.headers
26078
+ });
26079
+ const verified = await verifyX402Request({
26080
+ request: fakeRequest,
26081
+ isCachedAddress: (addr) => this.asyncIsCachedAddress(addr, ctx),
26082
+ acceptedNetwork: this.x402BaseNetwork ?? ""
26083
+ });
26084
+ if (!verified.ok) {
26085
+ return {
26086
+ status: verified.status,
26087
+ body: verified.body,
26088
+ headers: {},
26089
+ referenceId: ctx.referenceId,
26090
+ settled: false,
26091
+ settlePhase: "verify_failed"
26092
+ };
26080
26093
  }
26081
- zero = zeroAmountCarveOut({ rail, payload });
26094
+ zero = zeroAmountCarveOut({ rail, payload: verified.payload });
26095
+ railKey = this.x402RailKey();
26082
26096
  } else {
26083
26097
  zero = zeroAmountCarveOut({ rail, authorizationHeader: headers["authorization"] });
26098
+ railKey = (zero.signerNetwork !== null ? this.railsKeyForMppxMethod(zero.signerNetwork === "solana" ? "solana" : "tempo") : void 0) ?? this.mppRailKey();
26084
26099
  }
26085
- const railKey = rail === "x402-base" ? this.x402RailKey() : this.mppRailKey();
26086
26100
  const outcome = {
26087
26101
  rail: rail === "x402-base" ? "x402" : "mpp",
26088
26102
  paymentResponseHeader: null,