@waffo/waffo-node 2.5.1 → 2.6.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Waffo Node.js SDK
2
2
 
3
- <!-- Synced with waffo-sdk/README.md @ commit c23c86f -->
3
+ <!-- Synced with waffo-sdk/README.md @ commit 738f4ca -->
4
4
 
5
5
  **English** | [中文](README_CN.md)
6
6
 
@@ -678,6 +678,37 @@ if (response.isSuccess()) {
678
678
  }
679
679
  ```
680
680
 
681
+ ### Wallet Address Inquiry (x402)
682
+
683
+ Inquire the on-chain stablecoin receiving address for an x402 payment. The response returns the target network, the on-chain token contract, and the Waffo platform wallet address to send funds to. Phase 1 supports `USDC`.
684
+
685
+ ```typescript
686
+ // paymentRequestId: unique idempotency key for this inquiry
687
+ // orderCurrency: settlement currency of the order (Phase 1 supports USDC)
688
+ // merchantInfo is auto-injected from config if not provided
689
+ const response = await waffo.wallet().inquiry({
690
+ paymentRequestId: 'unique-request-id',
691
+ orderCurrency: 'USDC',
692
+ });
693
+
694
+ if (response.isSuccess()) {
695
+ const data = response.getData();
696
+ console.log('Network:', data?.network); // CAIP-2 network id, e.g. eip155:8453 (Base mainnet)
697
+ console.log('Asset:', data?.asset); // on-chain token contract address
698
+ console.log('Pay to:', data?.payTo); // Waffo platform receiving wallet address
699
+ } else {
700
+ console.error('Wallet inquiry failed:', response.getCode(), response.getMessage());
701
+ }
702
+ ```
703
+
704
+ #### Wallet Inquiry Response Fields
705
+
706
+ | Field | Description |
707
+ |-------|-------------|
708
+ | `network` | CAIP-2 network id (Phase 1: `eip155:8453`, Base mainnet) |
709
+ | `asset` | On-chain token contract address for the network + currency |
710
+ | `payTo` | Waffo platform receiving wallet address (send funds here) |
711
+
681
712
  ## Webhook Handling
682
713
 
683
714
  Waffo pushes payment results, refund results, subscription status changes, and more via webhooks.
@@ -862,6 +893,8 @@ The following examples show the actual payload structure for each notification t
862
893
  }
863
894
  ```
864
895
 
896
+ For x402 stablecoin payments, `PAYMENT_NOTIFICATION.result` also includes `x402Info` with `x402Request`, `paymentSignatureHeader`, and `x402Response`.
897
+
865
898
  #### SUBSCRIPTION_STATUS_NOTIFICATION / SUBSCRIPTION_PERIOD_CHANGED_NOTIFICATION
866
899
 
867
900
  These two notification types share the same payload structure:
@@ -1294,7 +1327,7 @@ Error codes are classified by first letter:
1294
1327
  | `S0004` | Response Signature Verification Failed | `ApiResponse.error()` | Check Waffo public key config, contact Waffo |
1295
1328
  | `S0005` | Request Serialization Failed | `ApiResponse.error()` | Check request parameter format |
1296
1329
  | `S0006` | SDK Unknown Error | `ApiResponse.error()` | Check logs, contact technical support |
1297
- | `S0007` | Invalid Private Key | `WaffoError` | Check if private key is valid Base64 PKCS8 DER or unencrypted PKCS8 PEM format |
1330
+ | `S0007` | Invalid Private Key | `WaffoError` | Check if private key is valid Base64 encoded PKCS8 format |
1298
1331
 
1299
1332
  > **Important**: `S0001` and `E0001` (returned by server) indicate **unknown status**. Do not close order directly! Should call query API or wait for webhook to confirm actual status.
1300
1333