@nullclear/x402-arbiter 1.1.1 → 1.1.2

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.cjs CHANGED
@@ -38,9 +38,15 @@ async function signX402Payment(signer, option, resourceUrl) {
38
38
  const account = (0, import_accounts.privateKeyToAccount)(signer);
39
39
  accountAddress = account.address;
40
40
  signTypedDataFn = (params) => account.signTypedData(params);
41
- } else if (typeof signer === "object" && signer !== null && "signTypedData" in signer && "account" in signer && signer.account) {
42
- const rawAccount = signer.account;
43
- accountAddress = typeof rawAccount === "string" ? rawAccount : rawAccount.address;
41
+ } else if (typeof signer === "object" && signer !== null && "signTypedData" in signer) {
42
+ if ("account" in signer && signer.account) {
43
+ const rawAccount = signer.account;
44
+ accountAddress = typeof rawAccount === "string" ? rawAccount : rawAccount.address;
45
+ } else if ("address" in signer && signer.address) {
46
+ accountAddress = signer.address;
47
+ } else {
48
+ throw new Error("Signer object missing address");
49
+ }
44
50
  signTypedDataFn = (params) => signer.signTypedData(params);
45
51
  } else {
46
52
  throw new Error("Invalid signer provided to signX402Payment: must be private key or viem account/wallet client");
@@ -79,10 +85,14 @@ async function signX402Payment(signer, option, resourceUrl) {
79
85
  nonce: authorization.nonce
80
86
  }
81
87
  });
88
+ const acceptedOption = {
89
+ ...option,
90
+ extra: option.extra || { name: "USD Coin", version: "2" }
91
+ };
82
92
  const payload = {
83
93
  x402Version: 2,
84
94
  resource: resourceUrl ? { url: resourceUrl } : void 0,
85
- accepted: option,
95
+ accepted: acceptedOption,
86
96
  payload: {
87
97
  signature,
88
98
  authorization
package/dist/index.js CHANGED
@@ -12,9 +12,15 @@ async function signX402Payment(signer, option, resourceUrl) {
12
12
  const account = privateKeyToAccount(signer);
13
13
  accountAddress = account.address;
14
14
  signTypedDataFn = (params) => account.signTypedData(params);
15
- } else if (typeof signer === "object" && signer !== null && "signTypedData" in signer && "account" in signer && signer.account) {
16
- const rawAccount = signer.account;
17
- accountAddress = typeof rawAccount === "string" ? rawAccount : rawAccount.address;
15
+ } else if (typeof signer === "object" && signer !== null && "signTypedData" in signer) {
16
+ if ("account" in signer && signer.account) {
17
+ const rawAccount = signer.account;
18
+ accountAddress = typeof rawAccount === "string" ? rawAccount : rawAccount.address;
19
+ } else if ("address" in signer && signer.address) {
20
+ accountAddress = signer.address;
21
+ } else {
22
+ throw new Error("Signer object missing address");
23
+ }
18
24
  signTypedDataFn = (params) => signer.signTypedData(params);
19
25
  } else {
20
26
  throw new Error("Invalid signer provided to signX402Payment: must be private key or viem account/wallet client");
@@ -53,10 +59,14 @@ async function signX402Payment(signer, option, resourceUrl) {
53
59
  nonce: authorization.nonce
54
60
  }
55
61
  });
62
+ const acceptedOption = {
63
+ ...option,
64
+ extra: option.extra || { name: "USD Coin", version: "2" }
65
+ };
56
66
  const payload = {
57
67
  x402Version: 2,
58
68
  resource: resourceUrl ? { url: resourceUrl } : void 0,
59
- accepted: option,
69
+ accepted: acceptedOption,
60
70
  payload: {
61
71
  signature,
62
72
  authorization
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nullclear/x402-arbiter",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "NullClear Developer and Agent SDK for safe x402 calls with deferred schema escrow",
5
5
  "license": "MIT",
6
6
  "homepage": "https://nullclear.dev",
@@ -27,12 +27,12 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@nullclear/shared": "1.1.1",
30
+ "@nullclear/shared": "1.1.2",
31
31
  "viem": "^2.23.0",
32
32
  "zod": "^3.24.2"
33
33
  },
34
34
  "devDependencies": {
35
- "@nullclear/worker-arbiter": "1.1.1",
35
+ "@nullclear/worker-arbiter": "1.1.2",
36
36
  "tsup": "^8.3.6",
37
37
  "typescript": "^5.7.3",
38
38
  "vitest": "^3.0.5"