uvd-x402-sdk 2.15.2 → 2.16.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.
Files changed (77) hide show
  1. package/README.md +247 -6
  2. package/dist/adapters/index.d.mts +1 -1
  3. package/dist/adapters/index.d.ts +1 -1
  4. package/dist/adapters/index.js +82 -1
  5. package/dist/adapters/index.js.map +1 -1
  6. package/dist/adapters/index.mjs +82 -1
  7. package/dist/adapters/index.mjs.map +1 -1
  8. package/dist/backend/index.d.mts +1 -1
  9. package/dist/backend/index.d.ts +1 -1
  10. package/dist/backend/index.js +82 -1
  11. package/dist/backend/index.js.map +1 -1
  12. package/dist/backend/index.mjs +82 -1
  13. package/dist/backend/index.mjs.map +1 -1
  14. package/dist/{index-Cwi_VM05.d.ts → index-B2cQzyKa.d.ts} +10 -2
  15. package/dist/{index-BYIugZlE.d.mts → index-BE5cH7oS.d.mts} +48 -5
  16. package/dist/{index-BYIugZlE.d.ts → index-BE5cH7oS.d.ts} +48 -5
  17. package/dist/{index-D3PO3jLW.d.mts → index-oE4dj05k.d.mts} +10 -2
  18. package/dist/index.d.mts +11 -2
  19. package/dist/index.d.ts +11 -2
  20. package/dist/index.js +111 -2
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +110 -3
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/providers/algorand/index.d.mts +1 -1
  25. package/dist/providers/algorand/index.d.ts +1 -1
  26. package/dist/providers/algorand/index.js +95 -2
  27. package/dist/providers/algorand/index.js.map +1 -1
  28. package/dist/providers/algorand/index.mjs +95 -2
  29. package/dist/providers/algorand/index.mjs.map +1 -1
  30. package/dist/providers/evm/index.d.mts +1 -1
  31. package/dist/providers/evm/index.d.ts +1 -1
  32. package/dist/providers/evm/index.js +82 -1
  33. package/dist/providers/evm/index.js.map +1 -1
  34. package/dist/providers/evm/index.mjs +82 -1
  35. package/dist/providers/evm/index.mjs.map +1 -1
  36. package/dist/providers/near/index.d.mts +1 -1
  37. package/dist/providers/near/index.d.ts +1 -1
  38. package/dist/providers/near/index.js +82 -1
  39. package/dist/providers/near/index.js.map +1 -1
  40. package/dist/providers/near/index.mjs +82 -1
  41. package/dist/providers/near/index.mjs.map +1 -1
  42. package/dist/providers/solana/index.d.mts +1 -1
  43. package/dist/providers/solana/index.d.ts +1 -1
  44. package/dist/providers/solana/index.js +82 -1
  45. package/dist/providers/solana/index.js.map +1 -1
  46. package/dist/providers/solana/index.mjs +82 -1
  47. package/dist/providers/solana/index.mjs.map +1 -1
  48. package/dist/providers/stellar/index.d.mts +1 -1
  49. package/dist/providers/stellar/index.d.ts +1 -1
  50. package/dist/providers/stellar/index.js +82 -1
  51. package/dist/providers/stellar/index.js.map +1 -1
  52. package/dist/providers/stellar/index.mjs +82 -1
  53. package/dist/providers/stellar/index.mjs.map +1 -1
  54. package/dist/providers/sui/index.d.mts +105 -0
  55. package/dist/providers/sui/index.d.ts +105 -0
  56. package/dist/providers/sui/index.js +1027 -0
  57. package/dist/providers/sui/index.js.map +1 -0
  58. package/dist/providers/sui/index.mjs +1022 -0
  59. package/dist/providers/sui/index.mjs.map +1 -0
  60. package/dist/react/index.d.mts +3 -3
  61. package/dist/react/index.d.ts +3 -3
  62. package/dist/react/index.js +82 -1
  63. package/dist/react/index.js.map +1 -1
  64. package/dist/react/index.mjs +82 -1
  65. package/dist/react/index.mjs.map +1 -1
  66. package/dist/utils/index.d.mts +1 -1
  67. package/dist/utils/index.d.ts +1 -1
  68. package/dist/utils/index.js +82 -1
  69. package/dist/utils/index.js.map +1 -1
  70. package/dist/utils/index.mjs +82 -1
  71. package/dist/utils/index.mjs.map +1 -1
  72. package/package.json +15 -4
  73. package/src/chains/index.ts +98 -0
  74. package/src/facilitator.ts +18 -0
  75. package/src/index.ts +20 -1
  76. package/src/providers/sui/index.ts +431 -0
  77. package/src/types/index.ts +55 -3
@@ -1,4 +1,4 @@
1
- import { w as X402ClientConfig, P as PaymentInfo, f as PaymentResult, W as WalletState, C as ChainConfig, y as X402Event, B as X402EventHandler, a as NetworkType, T as TokenType, b as TokenConfig } from './index-BYIugZlE.js';
1
+ import { y as X402ClientConfig, P as PaymentInfo, f as PaymentResult, W as WalletState, C as ChainConfig, B as X402Event, F as X402EventHandler, a as NetworkType, T as TokenType, b as TokenConfig } from './index-BE5cH7oS.js';
2
2
 
3
3
  /**
4
4
  * uvd-x402-sdk - Main Client
@@ -184,6 +184,14 @@ declare function getSVMChains(): ChainConfig[];
184
184
  * Check if a chain is SVM-based (Solana Virtual Machine)
185
185
  */
186
186
  declare function isSVMChain(chainName: string): boolean;
187
+ /**
188
+ * Get list of Sui chains
189
+ */
190
+ declare function getSuiChains(): ChainConfig[];
191
+ /**
192
+ * Check if a chain is Sui-based
193
+ */
194
+ declare function isSuiChain(chainName: string): boolean;
187
195
  /**
188
196
  * Get network type from chain name
189
197
  */
@@ -236,4 +244,4 @@ declare function isTokenSupported(chainName: string, tokenType: TokenType): bool
236
244
  */
237
245
  declare function getChainsByToken(tokenType: TokenType): ChainConfig[];
238
246
 
239
- export { DEFAULT_CHAIN as D, SUPPORTED_CHAINS as S, X402Client as X, DEFAULT_FACILITATOR_URL as a, getChainByName as b, getEnabledChains as c, getChainsByNetworkType as d, getEVMChainIds as e, getSVMChains as f, getChainById as g, isSVMChain as h, isChainSupported as i, getNetworkType as j, getExplorerTxUrl as k, getExplorerAddressUrl as l, getTokenConfig as m, getSupportedTokens as n, isTokenSupported as o, getChainsByToken as p, getAlgorandChains as q, isAlgorandChain as r };
247
+ export { DEFAULT_CHAIN as D, SUPPORTED_CHAINS as S, X402Client as X, DEFAULT_FACILITATOR_URL as a, getChainByName as b, getEnabledChains as c, getChainsByNetworkType as d, getEVMChainIds as e, getSVMChains as f, getChainById as g, isSVMChain as h, isChainSupported as i, getNetworkType as j, getExplorerTxUrl as k, getExplorerAddressUrl as l, getTokenConfig as m, getSupportedTokens as n, isTokenSupported as o, getChainsByToken as p, getAlgorandChains as q, isAlgorandChain as r, getSuiChains as s, isSuiChain as t };
@@ -11,10 +11,11 @@
11
11
  * - 'stellar': Stellar network (use Soroban)
12
12
  * - 'near': NEAR Protocol (use NEP-366)
13
13
  * - 'algorand': Algorand network (use ASA transfers with atomic transactions)
14
+ * - 'sui': Sui blockchain (use sponsored transactions)
14
15
  *
15
16
  * @deprecated 'solana' type is deprecated, use 'svm' instead
16
17
  */
17
- type NetworkType = 'evm' | 'svm' | 'solana' | 'stellar' | 'near' | 'algorand';
18
+ type NetworkType = 'evm' | 'svm' | 'solana' | 'stellar' | 'near' | 'algorand' | 'sui';
18
19
  /**
19
20
  * Supported stablecoin token types
20
21
  * - usdc: USD Coin (Circle) - 6 decimals
@@ -174,6 +175,7 @@ interface PaymentInfo {
174
175
  near?: string;
175
176
  stellar?: string;
176
177
  algorand?: string;
178
+ sui?: string;
177
179
  };
178
180
  /** Facilitator address (for Solana fee payer) */
179
181
  facilitator?: string;
@@ -337,10 +339,34 @@ interface AlgorandPaymentPayload {
337
339
  */
338
340
  paymentGroup: string[];
339
341
  }
342
+ /**
343
+ * Sui payment payload (sponsored transaction)
344
+ *
345
+ * Uses Sui sponsored transactions where:
346
+ * - User creates a programmable transaction for USDC transfer
347
+ * - User signs the transaction
348
+ * - Facilitator sponsors (pays gas in SUI) and submits
349
+ *
350
+ * User pays: ZERO SUI
351
+ */
352
+ interface SuiPaymentPayload {
353
+ /** Base64-encoded BCS serialized TransactionData */
354
+ transactionBytes: string;
355
+ /** Base64-encoded user signature */
356
+ senderSignature: string;
357
+ /** Sender address (0x + 64 hex chars) */
358
+ from: string;
359
+ /** Recipient address (0x + 64 hex chars) */
360
+ to: string;
361
+ /** Amount in base units (string to handle large numbers) */
362
+ amount: string;
363
+ /** Coin object ID used for the transfer (REQUIRED by facilitator) */
364
+ coinObjectId: string;
365
+ }
340
366
  /**
341
367
  * Union type for all payment payloads
342
368
  */
343
- type PaymentPayload = EVMPaymentPayload | SolanaPaymentPayload | StellarPaymentPayload | NEARPaymentPayload | AlgorandPaymentPayload;
369
+ type PaymentPayload = EVMPaymentPayload | SolanaPaymentPayload | StellarPaymentPayload | NEARPaymentPayload | AlgorandPaymentPayload | SuiPaymentPayload;
344
370
  /**
345
371
  * x402 protocol version
346
372
  */
@@ -433,10 +459,27 @@ interface X402AlgorandPayload {
433
459
  /** Array of base64-encoded msgpack transactions */
434
460
  paymentGroup: string[];
435
461
  }
462
+ /**
463
+ * Sui-specific payload in x402 header (sponsored transaction)
464
+ */
465
+ interface X402SuiPayload {
466
+ /** BCS-encoded transaction bytes (base64) */
467
+ transactionBytes: string;
468
+ /** User's signature on the transaction (base64) */
469
+ senderSignature: string;
470
+ /** Sender's Sui address (0x...) */
471
+ from: string;
472
+ /** Recipient's Sui address (0x...) */
473
+ to: string;
474
+ /** Amount in smallest unit (string to avoid precision issues) */
475
+ amount: string;
476
+ /** Coin object ID used for the transfer (REQUIRED by facilitator) */
477
+ coinObjectId: string;
478
+ }
436
479
  /**
437
480
  * Union of all x402 payload types
438
481
  */
439
- type X402PayloadData = X402EVMPayload | X402SolanaPayload | X402StellarPayload | X402NEARPayload | X402AlgorandPayload;
482
+ type X402PayloadData = X402EVMPayload | X402SolanaPayload | X402StellarPayload | X402NEARPayload | X402AlgorandPayload | X402SuiPayload;
440
483
  /**
441
484
  * Multi-payment configuration for supporting multiple networks
442
485
  */
@@ -535,7 +578,7 @@ type X402EventHandler<E extends X402Event> = (data: X402EventData[E]) => void;
535
578
  /**
536
579
  * Error codes for categorizing errors
537
580
  */
538
- type X402ErrorCode = 'WALLET_NOT_FOUND' | 'WALLET_NOT_CONNECTED' | 'WALLET_CONNECTION_REJECTED' | 'WALLET_CONNECTION_TIMEOUT' | 'CHAIN_NOT_SUPPORTED' | 'CHAIN_SWITCH_REJECTED' | 'INSUFFICIENT_BALANCE' | 'SIGNATURE_REJECTED' | 'PAYMENT_FAILED' | 'PAYMENT_TIMEOUT' | 'NETWORK_ERROR' | 'INVALID_CONFIG' | 'INVALID_AMOUNT' | 'INVALID_RECIPIENT' | 'UNKNOWN_ERROR';
581
+ type X402ErrorCode = 'WALLET_NOT_FOUND' | 'WALLET_NOT_CONNECTED' | 'WALLET_NOT_SUPPORTED' | 'WALLET_CONNECTION_FAILED' | 'WALLET_CONNECTION_REJECTED' | 'WALLET_CONNECTION_TIMEOUT' | 'CHAIN_NOT_SUPPORTED' | 'CHAIN_SWITCH_REJECTED' | 'INSUFFICIENT_BALANCE' | 'SIGNATURE_REJECTED' | 'PAYMENT_FAILED' | 'PAYMENT_TIMEOUT' | 'NETWORK_ERROR' | 'INVALID_CONFIG' | 'INVALID_AMOUNT' | 'INVALID_RECIPIENT' | 'UNKNOWN_ERROR';
539
582
  /**
540
583
  * SDK-specific error class
541
584
  */
@@ -545,4 +588,4 @@ declare class X402Error extends Error {
545
588
  constructor(message: string, code: X402ErrorCode, details?: unknown);
546
589
  }
547
590
 
548
- export { type AlgorandPaymentPayload as A, type X402EventHandler as B, type ChainConfig as C, type X402ErrorCode as D, type EIP712Domain as E, X402Error as F, DEFAULT_CONFIG as G, CAIP2_IDENTIFIERS as H, CAIP2_TO_CHAIN as I, type MultiPaymentConfig as M, type NativeCurrency as N, type PaymentInfo as P, type SolanaPaymentPayload as S, type TokenType as T, type USDCConfig as U, type WalletState as W, type X402HeaderName as X, type NetworkType as a, type TokenConfig as b, type WalletAdapter as c, type EIP712Types as d, type PaymentRequest as e, type PaymentResult as f, type PaymentHeaders as g, type PaymentPayload as h, type EVMPaymentPayload as i, type StellarPaymentPayload as j, type NEARPaymentPayload as k, type X402Version as l, type X402Header as m, type X402HeaderV1 as n, type X402HeaderV2 as o, type X402PaymentOption as p, type X402PayloadData as q, type X402EVMPayload as r, type X402SolanaPayload as s, type X402StellarPayload as t, type X402NEARPayload as u, type X402AlgorandPayload as v, type X402ClientConfig as w, type NetworkBalance as x, type X402Event as y, type X402EventData as z };
591
+ export { type AlgorandPaymentPayload as A, type X402Event as B, type ChainConfig as C, type X402EventData as D, type EIP712Domain as E, type X402EventHandler as F, type X402ErrorCode as G, X402Error as H, DEFAULT_CONFIG as I, CAIP2_IDENTIFIERS as J, CAIP2_TO_CHAIN as K, type MultiPaymentConfig as M, type NativeCurrency as N, type PaymentInfo as P, type SolanaPaymentPayload as S, type TokenType as T, type USDCConfig as U, type WalletState as W, type X402HeaderName as X, type NetworkType as a, type TokenConfig as b, type WalletAdapter as c, type EIP712Types as d, type PaymentRequest as e, type PaymentResult as f, type PaymentHeaders as g, type PaymentPayload as h, type EVMPaymentPayload as i, type StellarPaymentPayload as j, type NEARPaymentPayload as k, type SuiPaymentPayload as l, type X402Version as m, type X402Header as n, type X402HeaderV1 as o, type X402HeaderV2 as p, type X402PaymentOption as q, type X402PayloadData as r, type X402EVMPayload as s, type X402SolanaPayload as t, type X402StellarPayload as u, type X402NEARPayload as v, type X402AlgorandPayload as w, type X402SuiPayload as x, type X402ClientConfig as y, type NetworkBalance as z };
@@ -11,10 +11,11 @@
11
11
  * - 'stellar': Stellar network (use Soroban)
12
12
  * - 'near': NEAR Protocol (use NEP-366)
13
13
  * - 'algorand': Algorand network (use ASA transfers with atomic transactions)
14
+ * - 'sui': Sui blockchain (use sponsored transactions)
14
15
  *
15
16
  * @deprecated 'solana' type is deprecated, use 'svm' instead
16
17
  */
17
- type NetworkType = 'evm' | 'svm' | 'solana' | 'stellar' | 'near' | 'algorand';
18
+ type NetworkType = 'evm' | 'svm' | 'solana' | 'stellar' | 'near' | 'algorand' | 'sui';
18
19
  /**
19
20
  * Supported stablecoin token types
20
21
  * - usdc: USD Coin (Circle) - 6 decimals
@@ -174,6 +175,7 @@ interface PaymentInfo {
174
175
  near?: string;
175
176
  stellar?: string;
176
177
  algorand?: string;
178
+ sui?: string;
177
179
  };
178
180
  /** Facilitator address (for Solana fee payer) */
179
181
  facilitator?: string;
@@ -337,10 +339,34 @@ interface AlgorandPaymentPayload {
337
339
  */
338
340
  paymentGroup: string[];
339
341
  }
342
+ /**
343
+ * Sui payment payload (sponsored transaction)
344
+ *
345
+ * Uses Sui sponsored transactions where:
346
+ * - User creates a programmable transaction for USDC transfer
347
+ * - User signs the transaction
348
+ * - Facilitator sponsors (pays gas in SUI) and submits
349
+ *
350
+ * User pays: ZERO SUI
351
+ */
352
+ interface SuiPaymentPayload {
353
+ /** Base64-encoded BCS serialized TransactionData */
354
+ transactionBytes: string;
355
+ /** Base64-encoded user signature */
356
+ senderSignature: string;
357
+ /** Sender address (0x + 64 hex chars) */
358
+ from: string;
359
+ /** Recipient address (0x + 64 hex chars) */
360
+ to: string;
361
+ /** Amount in base units (string to handle large numbers) */
362
+ amount: string;
363
+ /** Coin object ID used for the transfer (REQUIRED by facilitator) */
364
+ coinObjectId: string;
365
+ }
340
366
  /**
341
367
  * Union type for all payment payloads
342
368
  */
343
- type PaymentPayload = EVMPaymentPayload | SolanaPaymentPayload | StellarPaymentPayload | NEARPaymentPayload | AlgorandPaymentPayload;
369
+ type PaymentPayload = EVMPaymentPayload | SolanaPaymentPayload | StellarPaymentPayload | NEARPaymentPayload | AlgorandPaymentPayload | SuiPaymentPayload;
344
370
  /**
345
371
  * x402 protocol version
346
372
  */
@@ -433,10 +459,27 @@ interface X402AlgorandPayload {
433
459
  /** Array of base64-encoded msgpack transactions */
434
460
  paymentGroup: string[];
435
461
  }
462
+ /**
463
+ * Sui-specific payload in x402 header (sponsored transaction)
464
+ */
465
+ interface X402SuiPayload {
466
+ /** BCS-encoded transaction bytes (base64) */
467
+ transactionBytes: string;
468
+ /** User's signature on the transaction (base64) */
469
+ senderSignature: string;
470
+ /** Sender's Sui address (0x...) */
471
+ from: string;
472
+ /** Recipient's Sui address (0x...) */
473
+ to: string;
474
+ /** Amount in smallest unit (string to avoid precision issues) */
475
+ amount: string;
476
+ /** Coin object ID used for the transfer (REQUIRED by facilitator) */
477
+ coinObjectId: string;
478
+ }
436
479
  /**
437
480
  * Union of all x402 payload types
438
481
  */
439
- type X402PayloadData = X402EVMPayload | X402SolanaPayload | X402StellarPayload | X402NEARPayload | X402AlgorandPayload;
482
+ type X402PayloadData = X402EVMPayload | X402SolanaPayload | X402StellarPayload | X402NEARPayload | X402AlgorandPayload | X402SuiPayload;
440
483
  /**
441
484
  * Multi-payment configuration for supporting multiple networks
442
485
  */
@@ -535,7 +578,7 @@ type X402EventHandler<E extends X402Event> = (data: X402EventData[E]) => void;
535
578
  /**
536
579
  * Error codes for categorizing errors
537
580
  */
538
- type X402ErrorCode = 'WALLET_NOT_FOUND' | 'WALLET_NOT_CONNECTED' | 'WALLET_CONNECTION_REJECTED' | 'WALLET_CONNECTION_TIMEOUT' | 'CHAIN_NOT_SUPPORTED' | 'CHAIN_SWITCH_REJECTED' | 'INSUFFICIENT_BALANCE' | 'SIGNATURE_REJECTED' | 'PAYMENT_FAILED' | 'PAYMENT_TIMEOUT' | 'NETWORK_ERROR' | 'INVALID_CONFIG' | 'INVALID_AMOUNT' | 'INVALID_RECIPIENT' | 'UNKNOWN_ERROR';
581
+ type X402ErrorCode = 'WALLET_NOT_FOUND' | 'WALLET_NOT_CONNECTED' | 'WALLET_NOT_SUPPORTED' | 'WALLET_CONNECTION_FAILED' | 'WALLET_CONNECTION_REJECTED' | 'WALLET_CONNECTION_TIMEOUT' | 'CHAIN_NOT_SUPPORTED' | 'CHAIN_SWITCH_REJECTED' | 'INSUFFICIENT_BALANCE' | 'SIGNATURE_REJECTED' | 'PAYMENT_FAILED' | 'PAYMENT_TIMEOUT' | 'NETWORK_ERROR' | 'INVALID_CONFIG' | 'INVALID_AMOUNT' | 'INVALID_RECIPIENT' | 'UNKNOWN_ERROR';
539
582
  /**
540
583
  * SDK-specific error class
541
584
  */
@@ -545,4 +588,4 @@ declare class X402Error extends Error {
545
588
  constructor(message: string, code: X402ErrorCode, details?: unknown);
546
589
  }
547
590
 
548
- export { type AlgorandPaymentPayload as A, type X402EventHandler as B, type ChainConfig as C, type X402ErrorCode as D, type EIP712Domain as E, X402Error as F, DEFAULT_CONFIG as G, CAIP2_IDENTIFIERS as H, CAIP2_TO_CHAIN as I, type MultiPaymentConfig as M, type NativeCurrency as N, type PaymentInfo as P, type SolanaPaymentPayload as S, type TokenType as T, type USDCConfig as U, type WalletState as W, type X402HeaderName as X, type NetworkType as a, type TokenConfig as b, type WalletAdapter as c, type EIP712Types as d, type PaymentRequest as e, type PaymentResult as f, type PaymentHeaders as g, type PaymentPayload as h, type EVMPaymentPayload as i, type StellarPaymentPayload as j, type NEARPaymentPayload as k, type X402Version as l, type X402Header as m, type X402HeaderV1 as n, type X402HeaderV2 as o, type X402PaymentOption as p, type X402PayloadData as q, type X402EVMPayload as r, type X402SolanaPayload as s, type X402StellarPayload as t, type X402NEARPayload as u, type X402AlgorandPayload as v, type X402ClientConfig as w, type NetworkBalance as x, type X402Event as y, type X402EventData as z };
591
+ export { type AlgorandPaymentPayload as A, type X402Event as B, type ChainConfig as C, type X402EventData as D, type EIP712Domain as E, type X402EventHandler as F, type X402ErrorCode as G, X402Error as H, DEFAULT_CONFIG as I, CAIP2_IDENTIFIERS as J, CAIP2_TO_CHAIN as K, type MultiPaymentConfig as M, type NativeCurrency as N, type PaymentInfo as P, type SolanaPaymentPayload as S, type TokenType as T, type USDCConfig as U, type WalletState as W, type X402HeaderName as X, type NetworkType as a, type TokenConfig as b, type WalletAdapter as c, type EIP712Types as d, type PaymentRequest as e, type PaymentResult as f, type PaymentHeaders as g, type PaymentPayload as h, type EVMPaymentPayload as i, type StellarPaymentPayload as j, type NEARPaymentPayload as k, type SuiPaymentPayload as l, type X402Version as m, type X402Header as n, type X402HeaderV1 as o, type X402HeaderV2 as p, type X402PaymentOption as q, type X402PayloadData as r, type X402EVMPayload as s, type X402SolanaPayload as t, type X402StellarPayload as u, type X402NEARPayload as v, type X402AlgorandPayload as w, type X402SuiPayload as x, type X402ClientConfig as y, type NetworkBalance as z };
@@ -1,4 +1,4 @@
1
- import { w as X402ClientConfig, P as PaymentInfo, f as PaymentResult, W as WalletState, C as ChainConfig, y as X402Event, B as X402EventHandler, a as NetworkType, T as TokenType, b as TokenConfig } from './index-BYIugZlE.mjs';
1
+ import { y as X402ClientConfig, P as PaymentInfo, f as PaymentResult, W as WalletState, C as ChainConfig, B as X402Event, F as X402EventHandler, a as NetworkType, T as TokenType, b as TokenConfig } from './index-BE5cH7oS.mjs';
2
2
 
3
3
  /**
4
4
  * uvd-x402-sdk - Main Client
@@ -184,6 +184,14 @@ declare function getSVMChains(): ChainConfig[];
184
184
  * Check if a chain is SVM-based (Solana Virtual Machine)
185
185
  */
186
186
  declare function isSVMChain(chainName: string): boolean;
187
+ /**
188
+ * Get list of Sui chains
189
+ */
190
+ declare function getSuiChains(): ChainConfig[];
191
+ /**
192
+ * Check if a chain is Sui-based
193
+ */
194
+ declare function isSuiChain(chainName: string): boolean;
187
195
  /**
188
196
  * Get network type from chain name
189
197
  */
@@ -236,4 +244,4 @@ declare function isTokenSupported(chainName: string, tokenType: TokenType): bool
236
244
  */
237
245
  declare function getChainsByToken(tokenType: TokenType): ChainConfig[];
238
246
 
239
- export { DEFAULT_CHAIN as D, SUPPORTED_CHAINS as S, X402Client as X, DEFAULT_FACILITATOR_URL as a, getChainByName as b, getEnabledChains as c, getChainsByNetworkType as d, getEVMChainIds as e, getSVMChains as f, getChainById as g, isSVMChain as h, isChainSupported as i, getNetworkType as j, getExplorerTxUrl as k, getExplorerAddressUrl as l, getTokenConfig as m, getSupportedTokens as n, isTokenSupported as o, getChainsByToken as p, getAlgorandChains as q, isAlgorandChain as r };
247
+ export { DEFAULT_CHAIN as D, SUPPORTED_CHAINS as S, X402Client as X, DEFAULT_FACILITATOR_URL as a, getChainByName as b, getEnabledChains as c, getChainsByNetworkType as d, getEVMChainIds as e, getSVMChains as f, getChainById as g, isSVMChain as h, isChainSupported as i, getNetworkType as j, getExplorerTxUrl as k, getExplorerAddressUrl as l, getTokenConfig as m, getSupportedTokens as n, isTokenSupported as o, getChainsByToken as p, getAlgorandChains as q, isAlgorandChain as r, getSuiChains as s, isSuiChain as t };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- export { D as DEFAULT_CHAIN, a as DEFAULT_FACILITATOR_URL, S as SUPPORTED_CHAINS, X as X402Client, q as getAlgorandChains, g as getChainById, b as getChainByName, d as getChainsByNetworkType, p as getChainsByToken, e as getEVMChainIds, c as getEnabledChains, l as getExplorerAddressUrl, k as getExplorerTxUrl, j as getNetworkType, f as getSVMChains, n as getSupportedTokens, m as getTokenConfig, r as isAlgorandChain, i as isChainSupported, h as isSVMChain, o as isTokenSupported } from './index-D3PO3jLW.mjs';
1
+ export { D as DEFAULT_CHAIN, a as DEFAULT_FACILITATOR_URL, S as SUPPORTED_CHAINS, X as X402Client, q as getAlgorandChains, g as getChainById, b as getChainByName, d as getChainsByNetworkType, p as getChainsByToken, e as getEVMChainIds, c as getEnabledChains, l as getExplorerAddressUrl, k as getExplorerTxUrl, j as getNetworkType, f as getSVMChains, s as getSuiChains, n as getSupportedTokens, m as getTokenConfig, r as isAlgorandChain, i as isChainSupported, h as isSVMChain, t as isSuiChain, o as isTokenSupported } from './index-oE4dj05k.mjs';
2
2
  export { DEFAULT_PAYMENT_HEADER, PAYMENT_HEADER_NAMES, caip2ToChain, chainToCAIP2, convertX402Header, createPaymentHeaders, createX402Header, createX402V1Header, createX402V2Header, decodeX402Header, detectX402Version, encodeX402Header, generatePaymentOptions, getPaymentHeader, isCAIP2Format, parseNetworkIdentifier, validateAmount, validateRecipient } from './utils/index.mjs';
3
- export { A as AlgorandPaymentPayload, H as CAIP2_IDENTIFIERS, I as CAIP2_TO_CHAIN, C as ChainConfig, G as DEFAULT_CONFIG, E as EIP712Domain, d as EIP712Types, i as EVMPaymentPayload, M as MultiPaymentConfig, k as NEARPaymentPayload, N as NativeCurrency, x as NetworkBalance, a as NetworkType, g as PaymentHeaders, P as PaymentInfo, h as PaymentPayload, e as PaymentRequest, f as PaymentResult, S as SolanaPaymentPayload, j as StellarPaymentPayload, b as TokenConfig, T as TokenType, U as USDCConfig, c as WalletAdapter, W as WalletState, v as X402AlgorandPayload, w as X402ClientConfig, r as X402EVMPayload, F as X402Error, D as X402ErrorCode, y as X402Event, z as X402EventData, B as X402EventHandler, m as X402Header, X as X402HeaderName, n as X402HeaderV1, o as X402HeaderV2, u as X402NEARPayload, q as X402PayloadData, p as X402PaymentOption, s as X402SolanaPayload, t as X402StellarPayload, l as X402Version } from './index-BYIugZlE.mjs';
3
+ export { A as AlgorandPaymentPayload, J as CAIP2_IDENTIFIERS, K as CAIP2_TO_CHAIN, C as ChainConfig, I as DEFAULT_CONFIG, E as EIP712Domain, d as EIP712Types, i as EVMPaymentPayload, M as MultiPaymentConfig, k as NEARPaymentPayload, N as NativeCurrency, z as NetworkBalance, a as NetworkType, g as PaymentHeaders, P as PaymentInfo, h as PaymentPayload, e as PaymentRequest, f as PaymentResult, S as SolanaPaymentPayload, j as StellarPaymentPayload, l as SuiPaymentPayload, b as TokenConfig, T as TokenType, U as USDCConfig, c as WalletAdapter, W as WalletState, w as X402AlgorandPayload, y as X402ClientConfig, s as X402EVMPayload, H as X402Error, G as X402ErrorCode, B as X402Event, D as X402EventData, F as X402EventHandler, n as X402Header, X as X402HeaderName, o as X402HeaderV1, p as X402HeaderV2, v as X402NEARPayload, r as X402PayloadData, q as X402PaymentOption, t as X402SolanaPayload, u as X402StellarPayload, x as X402SuiPayload, m as X402Version } from './index-BE5cH7oS.mjs';
4
4
 
5
5
  /**
6
6
  * Facilitator wallet addresses by chain type
@@ -64,6 +64,15 @@ declare const FACILITATOR_ADDRESSES: {
64
64
  * Algorand facilitator address (testnet)
65
65
  */
66
66
  readonly 'algorand-testnet': "5DPPDQNYUPCTXRZWRYSF3WPYU6RKAUR25F3YG4EKXQRHV5AUAI62H5GXL4";
67
+ /**
68
+ * Sui facilitator address (mainnet)
69
+ * Used for: Sponsoring transactions (paying gas)
70
+ */
71
+ readonly sui: "0xe7bbf2b13f7d72714760aa16e024fa1b35a978793f9893d0568a4fbf356a764a";
72
+ /**
73
+ * Sui facilitator address (testnet)
74
+ */
75
+ readonly 'sui-testnet': "0xabbd16a2fab2a502c9cfe835195a6fc7d70bfc27cffb40b8b286b52a97006e67";
67
76
  };
68
77
  /**
69
78
  * Get the facilitator address for a specific chain
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { D as DEFAULT_CHAIN, a as DEFAULT_FACILITATOR_URL, S as SUPPORTED_CHAINS, X as X402Client, q as getAlgorandChains, g as getChainById, b as getChainByName, d as getChainsByNetworkType, p as getChainsByToken, e as getEVMChainIds, c as getEnabledChains, l as getExplorerAddressUrl, k as getExplorerTxUrl, j as getNetworkType, f as getSVMChains, n as getSupportedTokens, m as getTokenConfig, r as isAlgorandChain, i as isChainSupported, h as isSVMChain, o as isTokenSupported } from './index-Cwi_VM05.js';
1
+ export { D as DEFAULT_CHAIN, a as DEFAULT_FACILITATOR_URL, S as SUPPORTED_CHAINS, X as X402Client, q as getAlgorandChains, g as getChainById, b as getChainByName, d as getChainsByNetworkType, p as getChainsByToken, e as getEVMChainIds, c as getEnabledChains, l as getExplorerAddressUrl, k as getExplorerTxUrl, j as getNetworkType, f as getSVMChains, s as getSuiChains, n as getSupportedTokens, m as getTokenConfig, r as isAlgorandChain, i as isChainSupported, h as isSVMChain, t as isSuiChain, o as isTokenSupported } from './index-B2cQzyKa.js';
2
2
  export { DEFAULT_PAYMENT_HEADER, PAYMENT_HEADER_NAMES, caip2ToChain, chainToCAIP2, convertX402Header, createPaymentHeaders, createX402Header, createX402V1Header, createX402V2Header, decodeX402Header, detectX402Version, encodeX402Header, generatePaymentOptions, getPaymentHeader, isCAIP2Format, parseNetworkIdentifier, validateAmount, validateRecipient } from './utils/index.js';
3
- export { A as AlgorandPaymentPayload, H as CAIP2_IDENTIFIERS, I as CAIP2_TO_CHAIN, C as ChainConfig, G as DEFAULT_CONFIG, E as EIP712Domain, d as EIP712Types, i as EVMPaymentPayload, M as MultiPaymentConfig, k as NEARPaymentPayload, N as NativeCurrency, x as NetworkBalance, a as NetworkType, g as PaymentHeaders, P as PaymentInfo, h as PaymentPayload, e as PaymentRequest, f as PaymentResult, S as SolanaPaymentPayload, j as StellarPaymentPayload, b as TokenConfig, T as TokenType, U as USDCConfig, c as WalletAdapter, W as WalletState, v as X402AlgorandPayload, w as X402ClientConfig, r as X402EVMPayload, F as X402Error, D as X402ErrorCode, y as X402Event, z as X402EventData, B as X402EventHandler, m as X402Header, X as X402HeaderName, n as X402HeaderV1, o as X402HeaderV2, u as X402NEARPayload, q as X402PayloadData, p as X402PaymentOption, s as X402SolanaPayload, t as X402StellarPayload, l as X402Version } from './index-BYIugZlE.js';
3
+ export { A as AlgorandPaymentPayload, J as CAIP2_IDENTIFIERS, K as CAIP2_TO_CHAIN, C as ChainConfig, I as DEFAULT_CONFIG, E as EIP712Domain, d as EIP712Types, i as EVMPaymentPayload, M as MultiPaymentConfig, k as NEARPaymentPayload, N as NativeCurrency, z as NetworkBalance, a as NetworkType, g as PaymentHeaders, P as PaymentInfo, h as PaymentPayload, e as PaymentRequest, f as PaymentResult, S as SolanaPaymentPayload, j as StellarPaymentPayload, l as SuiPaymentPayload, b as TokenConfig, T as TokenType, U as USDCConfig, c as WalletAdapter, W as WalletState, w as X402AlgorandPayload, y as X402ClientConfig, s as X402EVMPayload, H as X402Error, G as X402ErrorCode, B as X402Event, D as X402EventData, F as X402EventHandler, n as X402Header, X as X402HeaderName, o as X402HeaderV1, p as X402HeaderV2, v as X402NEARPayload, r as X402PayloadData, q as X402PaymentOption, t as X402SolanaPayload, u as X402StellarPayload, x as X402SuiPayload, m as X402Version } from './index-BE5cH7oS.js';
4
4
 
5
5
  /**
6
6
  * Facilitator wallet addresses by chain type
@@ -64,6 +64,15 @@ declare const FACILITATOR_ADDRESSES: {
64
64
  * Algorand facilitator address (testnet)
65
65
  */
66
66
  readonly 'algorand-testnet': "5DPPDQNYUPCTXRZWRYSF3WPYU6RKAUR25F3YG4EKXQRHV5AUAI62H5GXL4";
67
+ /**
68
+ * Sui facilitator address (mainnet)
69
+ * Used for: Sponsoring transactions (paying gas)
70
+ */
71
+ readonly sui: "0xe7bbf2b13f7d72714760aa16e024fa1b35a978793f9893d0568a4fbf356a764a";
72
+ /**
73
+ * Sui facilitator address (testnet)
74
+ */
75
+ readonly 'sui-testnet': "0xabbd16a2fab2a502c9cfe835195a6fc7d70bfc27cffb40b8b286b52a97006e67";
67
76
  };
68
77
  /**
69
78
  * Get the facilitator address for a specific chain
package/dist/index.js CHANGED
@@ -26,7 +26,10 @@ var CAIP2_IDENTIFIERS = {
26
26
  near: "near:mainnet",
27
27
  // Algorand
28
28
  algorand: "algorand:mainnet",
29
- "algorand-testnet": "algorand:testnet"
29
+ "algorand-testnet": "algorand:testnet",
30
+ // Sui
31
+ sui: "sui:mainnet",
32
+ "sui-testnet": "sui:testnet"
30
33
  };
31
34
  var CAIP2_TO_CHAIN = Object.fromEntries(
32
35
  Object.entries(CAIP2_IDENTIFIERS).map(([k, v]) => [v, k])
@@ -665,6 +668,84 @@ var SUPPORTED_CHAINS = {
665
668
  facilitatorUrl: DEFAULT_FACILITATOR_URL,
666
669
  enabled: true
667
670
  }
671
+ },
672
+ // ============================================================================
673
+ // SUI (2 networks) - Uses sponsored transactions (facilitator pays gas)
674
+ // ============================================================================
675
+ sui: {
676
+ chainId: 0,
677
+ // Non-EVM
678
+ chainIdHex: "0x0",
679
+ name: "sui",
680
+ displayName: "Sui",
681
+ networkType: "sui",
682
+ rpcUrl: "https://fullnode.mainnet.sui.io:443",
683
+ explorerUrl: "https://suiscan.xyz/mainnet",
684
+ nativeCurrency: {
685
+ name: "Sui",
686
+ symbol: "SUI",
687
+ decimals: 9
688
+ },
689
+ usdc: {
690
+ // USDC coin type on Sui mainnet
691
+ address: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
692
+ decimals: 6,
693
+ name: "USDC",
694
+ version: "1"
695
+ },
696
+ tokens: {
697
+ usdc: {
698
+ address: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
699
+ decimals: 6,
700
+ name: "USDC",
701
+ version: "1"
702
+ },
703
+ ausd: {
704
+ // AUSD (Agora USD) coin type on Sui mainnet
705
+ address: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD",
706
+ decimals: 6,
707
+ name: "AUSD",
708
+ version: "1"
709
+ }
710
+ },
711
+ x402: {
712
+ facilitatorUrl: DEFAULT_FACILITATOR_URL,
713
+ enabled: true
714
+ }
715
+ },
716
+ "sui-testnet": {
717
+ chainId: 0,
718
+ // Non-EVM
719
+ chainIdHex: "0x0",
720
+ name: "sui-testnet",
721
+ displayName: "Sui Testnet",
722
+ networkType: "sui",
723
+ rpcUrl: "https://fullnode.testnet.sui.io:443",
724
+ explorerUrl: "https://suiscan.xyz/testnet",
725
+ nativeCurrency: {
726
+ name: "Sui",
727
+ symbol: "SUI",
728
+ decimals: 9
729
+ },
730
+ usdc: {
731
+ // USDC coin type on Sui testnet
732
+ address: "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC",
733
+ decimals: 6,
734
+ name: "USDC",
735
+ version: "1"
736
+ },
737
+ tokens: {
738
+ usdc: {
739
+ address: "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC",
740
+ decimals: 6,
741
+ name: "USDC",
742
+ version: "1"
743
+ }
744
+ },
745
+ x402: {
746
+ facilitatorUrl: DEFAULT_FACILITATOR_URL,
747
+ enabled: true
748
+ }
668
749
  }
669
750
  };
670
751
  var DEFAULT_CHAIN = "base";
@@ -700,6 +781,15 @@ function isSVMChain(chainName) {
700
781
  const chain = getChainByName(chainName);
701
782
  return chain?.networkType === "svm";
702
783
  }
784
+ function getSuiChains() {
785
+ return Object.values(SUPPORTED_CHAINS).filter(
786
+ (chain) => chain.networkType === "sui" && chain.x402.enabled
787
+ );
788
+ }
789
+ function isSuiChain(chainName) {
790
+ const chain = getChainByName(chainName);
791
+ return chain?.networkType === "sui";
792
+ }
703
793
  function getNetworkType(chainName) {
704
794
  const chain = getChainByName(chainName);
705
795
  return chain?.networkType;
@@ -719,6 +809,8 @@ function getExplorerTxUrl(chainName, txHash) {
719
809
  return `${chain.explorerUrl}/txns/${txHash}`;
720
810
  case "algorand":
721
811
  return `${chain.explorerUrl}/tx/${txHash}`;
812
+ case "sui":
813
+ return `${chain.explorerUrl}/tx/${txHash}`;
722
814
  default:
723
815
  return null;
724
816
  }
@@ -1604,7 +1696,19 @@ var FACILITATOR_ADDRESSES = {
1604
1696
  /**
1605
1697
  * Algorand facilitator address (testnet)
1606
1698
  */
1607
- "algorand-testnet": "5DPPDQNYUPCTXRZWRYSF3WPYU6RKAUR25F3YG4EKXQRHV5AUAI62H5GXL4"
1699
+ "algorand-testnet": "5DPPDQNYUPCTXRZWRYSF3WPYU6RKAUR25F3YG4EKXQRHV5AUAI62H5GXL4",
1700
+ // ============================================
1701
+ // Sui
1702
+ // ============================================
1703
+ /**
1704
+ * Sui facilitator address (mainnet)
1705
+ * Used for: Sponsoring transactions (paying gas)
1706
+ */
1707
+ sui: "0xe7bbf2b13f7d72714760aa16e024fa1b35a978793f9893d0568a4fbf356a764a",
1708
+ /**
1709
+ * Sui facilitator address (testnet)
1710
+ */
1711
+ "sui-testnet": "0xabbd16a2fab2a502c9cfe835195a6fc7d70bfc27cffb40b8b286b52a97006e67"
1608
1712
  };
1609
1713
  function getFacilitatorAddress(chainName, networkType) {
1610
1714
  const exactMatch = FACILITATOR_ADDRESSES[chainName];
@@ -1626,6 +1730,9 @@ function getFacilitatorAddress(chainName, networkType) {
1626
1730
  if (networkType === "near") {
1627
1731
  return FACILITATOR_ADDRESSES.near;
1628
1732
  }
1733
+ if (networkType === "sui") {
1734
+ return FACILITATOR_ADDRESSES.sui;
1735
+ }
1629
1736
  return void 0;
1630
1737
  }
1631
1738
 
@@ -1664,12 +1771,14 @@ exports.getFacilitatorAddress = getFacilitatorAddress;
1664
1771
  exports.getNetworkType = getNetworkType;
1665
1772
  exports.getPaymentHeader = getPaymentHeader;
1666
1773
  exports.getSVMChains = getSVMChains;
1774
+ exports.getSuiChains = getSuiChains;
1667
1775
  exports.getSupportedTokens = getSupportedTokens;
1668
1776
  exports.getTokenConfig = getTokenConfig;
1669
1777
  exports.isAlgorandChain = isAlgorandChain;
1670
1778
  exports.isCAIP2Format = isCAIP2Format;
1671
1779
  exports.isChainSupported = isChainSupported;
1672
1780
  exports.isSVMChain = isSVMChain;
1781
+ exports.isSuiChain = isSuiChain;
1673
1782
  exports.isTokenSupported = isTokenSupported;
1674
1783
  exports.parseNetworkIdentifier = parseNetworkIdentifier;
1675
1784
  exports.validateAmount = validateAmount;