uvd-x402-sdk 2.92.0 → 2.93.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.
Files changed (108) hide show
  1. package/README.md +5 -3
  2. package/dist/adapters/index.d.mts +1 -1
  3. package/dist/adapters/index.d.ts +1 -1
  4. package/dist/adapters/index.js +42 -0
  5. package/dist/adapters/index.js.map +1 -1
  6. package/dist/adapters/index.mjs +42 -0
  7. package/dist/adapters/index.mjs.map +1 -1
  8. package/dist/backend/index.d.mts +2 -2
  9. package/dist/backend/index.d.ts +2 -2
  10. package/dist/backend/index.js +123 -10
  11. package/dist/backend/index.js.map +1 -1
  12. package/dist/backend/index.mjs +124 -11
  13. package/dist/backend/index.mjs.map +1 -1
  14. package/dist/erc8128/index.js +2 -0
  15. package/dist/erc8128/index.js.map +1 -1
  16. package/dist/erc8128/index.mjs +2 -0
  17. package/dist/erc8128/index.mjs.map +1 -1
  18. package/dist/{index-B-iLEkAH.d.mts → index-BGqIAgsJ.d.ts} +5 -5
  19. package/dist/{index-DbauIMV2.d.mts → index-CBjEM00M.d.mts} +11 -2
  20. package/dist/{index-DbauIMV2.d.ts → index-CBjEM00M.d.ts} +11 -2
  21. package/dist/{index-s6ot_Mu-.d.ts → index-DQorHgSa.d.ts} +1 -1
  22. package/dist/{index-DRk6i654.d.mts → index-DzCTT20R.d.mts} +1 -1
  23. package/dist/{index-DkoNhJfq.d.ts → index-H4dVoRFp.d.mts} +5 -5
  24. package/dist/index.d.mts +9 -4
  25. package/dist/index.d.ts +9 -4
  26. package/dist/index.js +274 -13
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +271 -15
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/providers/algorand/index.d.mts +1 -1
  31. package/dist/providers/algorand/index.d.ts +1 -1
  32. package/dist/providers/algorand/index.js +41 -0
  33. package/dist/providers/algorand/index.js.map +1 -1
  34. package/dist/providers/algorand/index.mjs +41 -0
  35. package/dist/providers/algorand/index.mjs.map +1 -1
  36. package/dist/providers/evm/index.d.mts +1 -1
  37. package/dist/providers/evm/index.d.ts +1 -1
  38. package/dist/providers/evm/index.js +41 -0
  39. package/dist/providers/evm/index.js.map +1 -1
  40. package/dist/providers/evm/index.mjs +41 -0
  41. package/dist/providers/evm/index.mjs.map +1 -1
  42. package/dist/providers/hedera/index.d.mts +84 -0
  43. package/dist/providers/hedera/index.d.ts +84 -0
  44. package/dist/providers/hedera/index.js +192 -0
  45. package/dist/providers/hedera/index.js.map +1 -0
  46. package/dist/providers/hedera/index.mjs +182 -0
  47. package/dist/providers/hedera/index.mjs.map +1 -0
  48. package/dist/providers/near/index.d.mts +1 -1
  49. package/dist/providers/near/index.d.ts +1 -1
  50. package/dist/providers/near/index.js +36 -0
  51. package/dist/providers/near/index.js.map +1 -1
  52. package/dist/providers/near/index.mjs +36 -0
  53. package/dist/providers/near/index.mjs.map +1 -1
  54. package/dist/providers/solana/index.d.mts +1 -1
  55. package/dist/providers/solana/index.d.ts +1 -1
  56. package/dist/providers/solana/index.js +36 -0
  57. package/dist/providers/solana/index.js.map +1 -1
  58. package/dist/providers/solana/index.mjs +36 -0
  59. package/dist/providers/solana/index.mjs.map +1 -1
  60. package/dist/providers/stellar/index.d.mts +1 -1
  61. package/dist/providers/stellar/index.d.ts +1 -1
  62. package/dist/providers/stellar/index.js +36 -0
  63. package/dist/providers/stellar/index.js.map +1 -1
  64. package/dist/providers/stellar/index.mjs +36 -0
  65. package/dist/providers/stellar/index.mjs.map +1 -1
  66. package/dist/providers/sui/index.d.mts +1 -1
  67. package/dist/providers/sui/index.d.ts +1 -1
  68. package/dist/providers/sui/index.js +36 -0
  69. package/dist/providers/sui/index.js.map +1 -1
  70. package/dist/providers/sui/index.mjs +36 -0
  71. package/dist/providers/sui/index.mjs.map +1 -1
  72. package/dist/providers/xrpl/index.d.mts +1 -1
  73. package/dist/providers/xrpl/index.d.ts +1 -1
  74. package/dist/providers/xrpl/index.js +36 -0
  75. package/dist/providers/xrpl/index.js.map +1 -1
  76. package/dist/providers/xrpl/index.mjs +36 -0
  77. package/dist/providers/xrpl/index.mjs.map +1 -1
  78. package/dist/react/index.d.mts +3 -3
  79. package/dist/react/index.d.ts +3 -3
  80. package/dist/react/index.js +67 -6
  81. package/dist/react/index.js.map +1 -1
  82. package/dist/react/index.mjs +67 -6
  83. package/dist/react/index.mjs.map +1 -1
  84. package/dist/react/picker/index.d.mts +1 -1
  85. package/dist/react/picker/index.d.ts +1 -1
  86. package/dist/react/picker/index.js +34 -1
  87. package/dist/react/picker/index.js.map +1 -1
  88. package/dist/react/picker/index.mjs +34 -1
  89. package/dist/react/picker/index.mjs.map +1 -1
  90. package/dist/utils/index.d.mts +2 -2
  91. package/dist/utils/index.d.ts +2 -2
  92. package/dist/utils/index.js +42 -0
  93. package/dist/utils/index.js.map +1 -1
  94. package/dist/utils/index.mjs +42 -0
  95. package/dist/utils/index.mjs.map +1 -1
  96. package/dist/{validity-C0z0GqH6.d.ts → validity-CHJ8HAVL.d.ts} +2 -2
  97. package/dist/{validity-BTMBMmuj.d.mts → validity-DZdjHKsU.d.mts} +2 -2
  98. package/package.json +20 -5
  99. package/src/backend/index.ts +15 -0
  100. package/src/chains/index.ts +32 -1
  101. package/src/client/X402Client.ts +25 -5
  102. package/src/facilitator.ts +6 -0
  103. package/src/index.ts +5 -1
  104. package/src/providers/hedera/index.ts +179 -0
  105. package/src/react/NetworkPicker.tsx +1 -0
  106. package/src/types/index.ts +9 -2
  107. package/src/utils/validation.ts +7 -1
  108. package/src/utils/x402.ts +1 -0
package/README.md CHANGED
@@ -1,14 +1,16 @@
1
1
  # uvd-x402-sdk
2
2
 
3
- Gasless crypto payments across 27 blockchain networks using the x402 protocol.
3
+ Gasless crypto payments across 29 blockchain networks using the x402 protocol.
4
4
 
5
5
  Users sign a message or transaction, and the Ultravioleta facilitator handles on-chain settlement. No gas fees for users.
6
6
 
7
+ **New in v2.93.0**: Native Hedera mainnet and testnet with sponsored HBAR/USDC payments, offline signing and buyer/merchant helpers. [Hedera guide](docs/networks/hedera.md). Arc USDC remains supported on mainnet and testnet.
8
+
7
9
  ## Features
8
10
 
9
- - **25 Networks**: EVM (15 including Scroll, SKALE Base, Robinhood Chain), Solana, Fogo, Stellar, NEAR, Algorand, Sui, XRP Ledger (mainnet + testnet)
11
+ - **29 Networks**: EVM (17 including Arc, Scroll, SKALE Base, Robinhood Chain), Solana, Fogo, Stellar, NEAR, Algorand, Sui, XRP Ledger, Hedera (mainnet + testnet)
10
12
  - **Multi-Stablecoin**: USDC, EURC, AUSD, PYUSD, USDT, USDG (Robinhood Chain)
11
- - **x402 v1 & v2**: Both protocol versions with auto-detection
13
+ - **x402 v1 & v2**: Protocol auto-detection; native Hedera supports v2/exact only
12
14
  - **Gasless**: Facilitator pays all network fees
13
15
  - **Buyer Policy**: Per-payment and cumulative budgets, payee allowlist and offer expiry, evaluated against the offer in hand **before signing** — six closed refusal codes in a fixed order
14
16
  - **Type-Safe**: Full TypeScript support
@@ -1,4 +1,4 @@
1
- import { X as X402Version, a as PaymentResult } from '../index-DbauIMV2.mjs';
1
+ import { X as X402Version, a as PaymentResult } from '../index-CBjEM00M.mjs';
2
2
  export { E as EnvKeyAdapter, O as OWSWallet, a as OWSWalletAdapter } from '../ows-Z9v4GxOZ.mjs';
3
3
  import '../wallet-w7BnImDG.mjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { X as X402Version, a as PaymentResult } from '../index-DbauIMV2.js';
1
+ import { X as X402Version, a as PaymentResult } from '../index-CBjEM00M.js';
2
2
  export { E as EnvKeyAdapter, O as OWSWallet, a as OWSWalletAdapter } from '../ows-C-KmORG9.js';
3
3
  import '../wallet-w7BnImDG.js';
4
4
 
@@ -5,6 +5,38 @@ var ethers = require('ethers');
5
5
  // src/chains/index.ts
6
6
  var DEFAULT_FACILITATOR_URL = "https://facilitator.ultravioletadao.xyz";
7
7
  var SUPPORTED_CHAINS = {
8
+ "hedera:mainnet": {
9
+ chainId: 0,
10
+ chainIdHex: "0x0",
11
+ name: "hedera:mainnet",
12
+ displayName: "Hedera",
13
+ networkType: "hedera",
14
+ rpcUrl: "https://mainnet-public.mirrornode.hedera.com",
15
+ explorerUrl: "https://hashscan.io/mainnet",
16
+ nativeCurrency: { name: "HBAR", symbol: "HBAR", decimals: 8 },
17
+ usdc: { address: "0.0.456858", decimals: 6, name: "USDC", version: "" },
18
+ tokens: {
19
+ usdc: { address: "0.0.456858", decimals: 6, name: "USDC", version: "" },
20
+ hbar: { address: "0.0.0", decimals: 8, name: "HBAR", version: "", usdPegged: false }
21
+ },
22
+ x402: { facilitatorUrl: DEFAULT_FACILITATOR_URL, enabled: true }
23
+ },
24
+ "hedera:testnet": {
25
+ chainId: 0,
26
+ chainIdHex: "0x0",
27
+ name: "hedera:testnet",
28
+ displayName: "Hedera Testnet",
29
+ networkType: "hedera",
30
+ rpcUrl: "https://testnet.mirrornode.hedera.com",
31
+ explorerUrl: "https://hashscan.io/testnet",
32
+ nativeCurrency: { name: "HBAR", symbol: "HBAR", decimals: 8 },
33
+ usdc: { address: "0.0.429274", decimals: 6, name: "USDC", version: "" },
34
+ tokens: {
35
+ usdc: { address: "0.0.429274", decimals: 6, name: "USDC", version: "" },
36
+ hbar: { address: "0.0.0", decimals: 8, name: "HBAR", version: "", usdPegged: false }
37
+ },
38
+ x402: { facilitatorUrl: DEFAULT_FACILITATOR_URL, enabled: true }
39
+ },
8
40
  // ============================================================================
9
41
  // EVM CHAINS (16 enabled + BSC, disabled)
10
42
  // ============================================================================
@@ -1074,6 +1106,8 @@ var SUPPORTED_CHAINS = {
1074
1106
  }
1075
1107
  };
1076
1108
  var CHAIN_ALIASES = {
1109
+ hedera: "hedera:mainnet",
1110
+ "hedera-testnet": "hedera:testnet",
1077
1111
  // Renamed in 2.85.0: the facilitator advertises the mainnet as `xrpl`.
1078
1112
  "xrpl-mainnet": "xrpl"
1079
1113
  };
@@ -1084,6 +1118,8 @@ function getChainByName(name) {
1084
1118
 
1085
1119
  // src/types/index.ts
1086
1120
  var CAIP2_IDENTIFIERS = {
1121
+ "hedera:mainnet": "hedera:mainnet",
1122
+ "hedera:testnet": "hedera:testnet",
1087
1123
  // EVM chains
1088
1124
  base: "eip155:8453",
1089
1125
  ethereum: "eip155:1",
@@ -1169,6 +1205,7 @@ function encodeX402Header(header) {
1169
1205
  return encodeBase64Json(header);
1170
1206
  }
1171
1207
  function createX402V1Header(network, payload) {
1208
+ if (getChainByName(network)?.networkType === "hedera") throw new Error("Native Hedera supports only x402 v2");
1172
1209
  return {
1173
1210
  x402Version: 1,
1174
1211
  scheme: "exact",
@@ -1241,6 +1278,11 @@ function validateRecipient(recipient, networkType) {
1241
1278
  );
1242
1279
  }
1243
1280
  break;
1281
+ case "hedera":
1282
+ if (!/^0\.0\.[1-9][0-9]*$/.test(trimmed)) {
1283
+ throw new X402Error("Hedera recipient must be a native numeric account ID", "INVALID_RECIPIENT");
1284
+ }
1285
+ break;
1244
1286
  case "xrpl":
1245
1287
  if (!XRPL_ADDRESS_REGEX.test(trimmed)) {
1246
1288
  throw new X402Error(