@zkp2p/sdk 0.16.0-rc.1 → 0.16.0-rc.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/README.md CHANGED
@@ -11,10 +11,10 @@ New intents use EscrowV2 and OrchestratorV4. The SDK retains reads for historica
11
11
  ## Installation
12
12
 
13
13
  ```bash
14
- npm install @zkp2p/sdk viem
14
+ npm install @zkp2p/sdk@0.16.0-rc.2 viem
15
15
  ```
16
16
 
17
- `viem` `^2.37.3` is a peer dependency. React (`>=16.8.0`) is optional and only needed for `@zkp2p/sdk/react`. Node.js runtimes need version 22 or later.
17
+ `createPeer()` ships in the `0.16.0` release candidates on the `rc` dist-tag; `latest` (0.15) does not have it. `viem` `^2.37.3` is a peer dependency. React (`>=16.8.0`) is optional and only needed for `@zkp2p/sdk/react`. Node.js runtimes need version 22 or later.
18
18
 
19
19
  ## Peer quickstart
20
20
 
@@ -52,6 +52,27 @@ try {
52
52
 
53
53
  `peer.sell()` registers the payee, approves and deposits the USDC at the zero-spread oracle market rate, and returns once the deposit confirms. `watch()` yields `awaiting-buyer`, `matched` and `delivering` until the sale ends `delivered` or `returned`. `peer.sell.capabilities()` lists each platform's currencies and payee format. Curator checks that the handle exists on its platform, PayPal.Me usernames and Wisetags included (`PAYEE_NOT_FOUND` otherwise); a new Alipay payee needs a signed identity attestation (`PAYEE_VERIFICATION_REQUIRED`). Use `peer.sell.prepare()` for unsigned transactions, and `peer.sell.withdraw(depositId, { signer })` to take back unsold USDC.
54
54
 
55
+ ### Sell another asset (Relay)
56
+
57
+ ```ts
58
+ const peer = createPeer({
59
+ environment: 'production',
60
+ relay: { apiKey: process.env.RELAY_API_KEY },
61
+ });
62
+
63
+ const { chains } = await peer.sell.sourceCapabilities(); // source chains and tokens Relay can route
64
+ const quote = await peer.sell.quoteSource({
65
+ user: signer.account.address,
66
+ amount: 5_000_000n, // source-token base units
67
+ source: { chainId: 10, currency: '0x0b2c639c533813f4aa9d7837caf62653d097ff85' }, // USDC on Optimism
68
+ });
69
+ // Send quote.txs from the source-chain wallet, then follow the route:
70
+ const status = await peer.sell.relayStatus(quote.requestId!);
71
+ // Once it succeeds, sell the Base USDC: peer.sell({ amount: quote.outputAmount, receive }, { signer })
72
+ ```
73
+
74
+ `quoteSource()` only returns routes that deliver canonical Base USDC to the requested recipient from the requested wallet and asset; `outputAmount` is Relay's guaranteed minimum. Relay's quote endpoint requires an API key.
75
+
55
76
  ### Buy Base USDC
56
77
 
57
78
  ```ts
@@ -166,7 +187,7 @@ try {
166
187
 
167
188
  A closed or timed-out window doesn't mean linking failed, and a return doesn't prove it worked. Read `client.getSellerCredentialStatus({ processorName: 'venmo', payeeDetails })`: the inbox is linked only when `status` is `active` and `isMailboxSellerCredentialType(credentialType)` is `true`.
168
189
 
169
- `openXMoneyConnect({ payeeDetails, payeeUsername })` and `getXMoneyConnectUrl()` do the same for X Money. Cash-out apps can use `@zkp2p/cash`, which also registers the payee. See the [client reference](https://docs.peer.xyz/developer/sdk/client-reference#hosted-venmo-receipt-linking) for error codes and options.
190
+ `openXMoneyConnect({ payeeDetails, payeeUsername })` and `getXMoneyConnectUrl()` do the same for X Money. For a `peer.sell()` app, see [optional receipt linking](https://docs.peer.xyz/developer/sell/guide#optional-receipt-linking). See the [client reference](https://docs.peer.xyz/developer/sdk/client-reference#hosted-venmo-receipt-linking) for error codes and options.
170
191
 
171
192
  ### Native app return
172
193
 
@@ -244,6 +265,8 @@ SDK errors extend `ZKP2PError` (`ValidationError`, `NetworkError`, `APIError`, a
244
265
 
245
266
  ## Documentation
246
267
 
268
+ - [Sell USDC with the Peer SDK](https://docs.peer.xyz/developer/sell)
269
+ - [Migrate from @zkp2p/cash](https://docs.peer.xyz/developer/sell/migrate-from-cash)
247
270
  - [SDK overview](https://docs.peer.xyz/developer/sdk)
248
271
  - [Client reference](https://docs.peer.xyz/developer/sdk/client-reference)
249
272
  - [React hooks](https://docs.peer.xyz/developer/sdk/react-hooks)
@@ -2,11 +2,11 @@
2
2
  "schemaVersion": 2,
3
3
  "source": {
4
4
  "repository": "zkp2p/zkp2p-clients",
5
- "commitSha": "27264ebccd5a3c7a281ebb59fcd9f2d3d6fcee03",
5
+ "commitSha": "88bcfc628829c0cb9ef666d70bec182015325b54",
6
6
  "kind": "github",
7
7
  "distributable": true
8
8
  },
9
- "sdkPackageVersion": "0.16.0-rc.1",
9
+ "sdkPackageVersion": "0.16.0-rc.2",
10
10
  "contractsPackageVersion": "0.4.4-rc.13",
11
11
  "indexerSchemaPackageVersion": "0.23.0-rc.0",
12
12
  "activeDisputeStack": {
@@ -1,5 +1,5 @@
1
1
  import { currencyKeccak256, getCurrencyInfoFromHash } from './chunk-PMFXZGDQ.mjs';
2
- import { __export } from './chunk-6ZIKILBZ.mjs';
2
+ import { __export } from './chunk-WHTCQ6GA.mjs';
3
3
  import { hexToBytes, keccak256, toBytes, bytesToHex } from 'viem';
4
4
 
5
5
  // src/utils/bigint.ts
@@ -158562,5 +158562,5 @@ function enrichPvIntentView(view, chainId, env = "production") {
158562
158562
  }
158563
158563
 
158564
158564
  export { DISPUTE_PROTECTION_POLICY_ABI2 as DISPUTE_PROTECTION_POLICY_ABI, DISPUTE_PROTECTION_POLICY_V2_ABI2 as DISPUTE_PROTECTION_POLICY_V2_ABI, METHOD_NAME_TO_HASH, ORCHESTRATOR_V3_ABI2 as ORCHESTRATOR_V3_ABI, ORCHESTRATOR_V4_ABI2 as ORCHESTRATOR_V4_ABI, PAYMENT_PLATFORMS, STAKE_VAULT_ABI2 as STAKE_VAULT_ABI, STAKE_VAULT_V2_ABI2 as STAKE_VAULT_V2_ABI, SUPPORTED_PAYMENT_METHOD_HASHES, asciiToBytes32, baseStaging_default4 as baseStaging_default, base_default4 as base_default, enrichPvDepositView, enrichPvIntentView, ensureBytes32, getContracts, getDisputeProtectionPolicyContract, getDisputeProtectionPolicyV2Contract, getDisputeStackAbis, getGatingServiceAddress, getIntentGuardianContract, getKnownStakeVaultContracts, getOrchestratorV3Contract, getOrchestratorV4Contract, getPaymentMethodsCatalog, getRateManagerContracts, getStakeVaultContract, getStakeVaultV2Contract, hasIntentGuardian, matchesPaymentMethodNameAndHash, matchesQuotePaymentMethod, parseBigIntLike, parseDepositView, parseIntentView, pickAddress, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash };
158565
- //# sourceMappingURL=chunk-MQPNWX5B.mjs.map
158566
- //# sourceMappingURL=chunk-MQPNWX5B.mjs.map
158565
+ //# sourceMappingURL=chunk-HJBGLG7B.mjs.map
158566
+ //# sourceMappingURL=chunk-HJBGLG7B.mjs.map