@zkp2p/cash 0.4.3 → 0.4.5

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.js CHANGED
@@ -1,5 +1,5 @@
1
- import { MARKET_SPREAD_BPS, ORACLE_MIN_CONVERSION_RATE_SENTINEL, CASH_RETAIN_ON_EMPTY, CASH_INTENT_GUARDIAN_ADDRESS, BASE_USDC_ADDRESS, USDC_DECIMALS, BASE_CHAIN_ID, errors, isCashError, CASH_ORDER_STATUSES, mapChainError, CashError } from './chunk-IHEOGLAS.js';
2
- export { BASE_CHAIN_ID, BASE_USDC_ADDRESS, CASH_ORDER_POLL_INTERVAL_MS, CASH_ORDER_STATUSES, CASH_RETAIN_ON_EMPTY, CashError, MARKET_SPREAD_BPS, ORACLE_MIN_CONVERSION_RATE_SENTINEL, USDC_DECIMALS, errors, isCashError, isUserRejectedError } from './chunk-IHEOGLAS.js';
1
+ import { MARKET_SPREAD_BPS, ORACLE_MIN_CONVERSION_RATE_SENTINEL, CASH_RETAIN_ON_EMPTY, CASH_INTENT_GUARDIAN_ADDRESS, BASE_USDC_ADDRESS, USDC_DECIMALS, BASE_CHAIN_ID, CASH_RESTRICTED_PLATFORMS, errors, isCashError, CASH_ORDER_STATUSES, mapChainError, CashError, CASH_ACCESS_GROUP_IDS } from './chunk-YD5VHZXR.js';
2
+ export { BASE_CHAIN_ID, BASE_USDC_ADDRESS, CASH_ORDER_POLL_INTERVAL_MS, CASH_ORDER_STATUSES, CASH_RETAIN_ON_EMPTY, CashError, MARKET_SPREAD_BPS, ORACLE_MIN_CONVERSION_RATE_SENTINEL, USDC_DECIMALS, errors, isCashError, isUserRejectedError } from './chunk-YD5VHZXR.js';
3
3
  import { parseAbi, parseEventLogs, isAddress, http, createWalletClient, encodeFunctionData } from 'viem';
4
4
  import { base } from 'viem/chains';
5
5
  import { getSpreadOracleConfig, currencyInfo, getPaymentMethodsCatalog, getGatingServiceAddress, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash, getCurrencyCodeFromHash, createCompositeDepositId, appendAttributionToCalldata, Zkp2pClient, CHAINLINK_ORACLE_FEEDS } from '@zkp2p/sdk';
@@ -461,7 +461,8 @@ function buildCapabilities(environment) {
461
461
  platform,
462
462
  currencies: [...new Set(currencies2)].sort(),
463
463
  payeeHint: PAYEE_HINTS[platform] ?? "Your payment handle for this platform",
464
- requiresIdentityAttestation: IDENTITY_ATTESTATION_PLATFORMS.has(platform)
464
+ requiresIdentityAttestation: IDENTITY_ATTESTATION_PLATFORMS.has(platform),
465
+ requiresAtomicAccessPolicy: CASH_RESTRICTED_PLATFORMS.has(platform)
465
466
  };
466
467
  }).filter((p) => p.currencies.length > 0).sort((a, b) => a.platform.localeCompare(b.platform));
467
468
  const currencies = [...new Set(platforms.flatMap((p) => p.currencies))].sort();
@@ -1427,6 +1428,12 @@ function createCashClient(options) {
1427
1428
  ...range ? { intentAmountRange: range } : {}
1428
1429
  };
1429
1430
  }
1431
+ function assertGenericCashoutSupported(payoutInput) {
1432
+ const restrictedPlatforms = payoutInput.payouts.map((payout) => payout.processorName.toLowerCase()).filter((platform) => CASH_RESTRICTED_PLATFORMS.has(platform));
1433
+ if (restrictedPlatforms.length > 0) {
1434
+ throw errors.atomicAccessPolicyRequired(restrictedPlatforms);
1435
+ }
1436
+ }
1430
1437
  function isCashPayoutSet(payouts) {
1431
1438
  return payouts.length > 0 && payouts.every((payout) => payout.pricing.marketRate && payout.pricing.spreadBps === 0);
1432
1439
  }
@@ -1666,6 +1673,28 @@ function createCashClient(options) {
1666
1673
  if (lastNonceError) throw lastNonceError;
1667
1674
  throw new Error(`Signer provider did not observe Relay nonce ${afterRelay - 1}`);
1668
1675
  }
1676
+ function prepareCashoutAccess(depositId, client = readClient) {
1677
+ const { compositeId, escrowAddress, onchainDepositId } = parseDepositId(depositId);
1678
+ const groupIds = CASH_ACCESS_GROUP_IDS[environment];
1679
+ try {
1680
+ const prepared = client.accessPolicy.prepareConfigureDeposit({
1681
+ escrow: escrowAddress,
1682
+ depositId: onchainDepositId,
1683
+ enabled: true,
1684
+ groupIds,
1685
+ takers: [],
1686
+ txOverrides: attribution
1687
+ });
1688
+ return {
1689
+ to: prepared.to,
1690
+ data: prepared.data,
1691
+ value: prepared.value,
1692
+ chainId: prepared.chainId
1693
+ };
1694
+ } catch (err) {
1695
+ throw errors.accessPolicyConfigurationFailed(compositeId, groupIds, err);
1696
+ }
1697
+ }
1669
1698
  return {
1670
1699
  capabilities,
1671
1700
  async sourceCapabilities() {
@@ -1703,6 +1732,7 @@ function createCashClient(options) {
1703
1732
  },
1704
1733
  async cashout(input, opts) {
1705
1734
  const payoutInput = validatePayout(input);
1735
+ assertGenericCashoutSupported(payoutInput);
1706
1736
  const client = await signingClient("cashout", opts);
1707
1737
  const owner = opts.signer.account.address;
1708
1738
  let sourceResult;
@@ -1870,6 +1900,7 @@ function createCashClient(options) {
1870
1900
  async prepare(input) {
1871
1901
  if (input.source) throw errors.sourceRouteUnsupportedInPrepare();
1872
1902
  const depositInput = validateDepositInput(input.amount, input);
1903
+ assertGenericCashoutSupported(depositInput);
1873
1904
  const params = await buildDepositParams(readClient, depositInput);
1874
1905
  const { prepared } = await readClient.prepareCreateDeposit({
1875
1906
  ...params,
@@ -1901,7 +1932,8 @@ function createCashClient(options) {
1901
1932
  description: "Create the protocol-held cash-out order."
1902
1933
  }
1903
1934
  ],
1904
- register: { hashedOnchainIds }
1935
+ register: { hashedOnchainIds },
1936
+ accessPolicyRequired: false
1905
1937
  };
1906
1938
  },
1907
1939
  finalizePreparedCashout(receipt) {
@@ -1930,6 +1962,7 @@ function createCashClient(options) {
1930
1962
  })
1931
1963
  };
1932
1964
  },
1965
+ prepareAccessPolicy: prepareCashoutAccess,
1933
1966
  async order(depositId) {
1934
1967
  return fetchOrder(depositId);
1935
1968
  },
@@ -2384,6 +2417,7 @@ var cashoutResultJsonSchema = z.object({
2384
2417
  escrowAddress: z.string(),
2385
2418
  onchainDepositId: nonNegativeBigintString,
2386
2419
  order: cashOrderJsonSchema,
2420
+ accessPolicyTxHash: z.string().optional(),
2387
2421
  source: z.object({
2388
2422
  amount: nonNegativeBigintString,
2389
2423
  requestId: z.string().optional(),
@@ -2394,7 +2428,8 @@ var cashoutResultJsonSchema = z.object({
2394
2428
  var prepareResultJsonSchema = z.object({
2395
2429
  txs: z.array(preparedTransactionJsonSchema),
2396
2430
  steps: z.array(cashPreparedStepJsonSchema),
2397
- register: z.object({ hashedOnchainIds: z.array(z.string()) })
2431
+ register: z.object({ hashedOnchainIds: z.array(z.string()) }),
2432
+ accessPolicyRequired: z.boolean()
2398
2433
  });
2399
2434
  var withdrawResultJsonSchema = z.object({
2400
2435
  depositId: z.string(),
@@ -2425,7 +2460,8 @@ var cashCapabilitiesJsonSchema = z.object({
2425
2460
  platform: z.string(),
2426
2461
  currencies: z.array(z.string()),
2427
2462
  payeeHint: z.string(),
2428
- requiresIdentityAttestation: z.boolean()
2463
+ requiresIdentityAttestation: z.boolean(),
2464
+ requiresAtomicAccessPolicy: z.boolean().optional()
2429
2465
  })
2430
2466
  ),
2431
2467
  currencies: z.array(z.string()),
@@ -2461,6 +2497,7 @@ var CASH_ERROR_CODES = defineCashErrorCodes([
2461
2497
  "ORDER_NOT_FOUND",
2462
2498
  "PAYEE_REGISTRATION_FAILED",
2463
2499
  "PAYEE_VERIFICATION_REQUIRED",
2500
+ "ATOMIC_ACCESS_POLICY_REQUIRED",
2464
2501
  "SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE",
2465
2502
  "SOURCE_RECIPIENT_MISMATCH",
2466
2503
  "SOURCE_CAPABILITIES_FAILED",
@@ -2472,6 +2509,7 @@ var CASH_ERROR_CODES = defineCashErrorCodes([
2472
2509
  "SOURCE_CASHOUT_SUBMISSION_UNKNOWN",
2473
2510
  "SOURCE_CASHOUT_STATUS_UNKNOWN",
2474
2511
  "DEPOSIT_RESOLUTION_FAILED",
2512
+ "ACCESS_POLICY_CONFIGURATION_FAILED",
2475
2513
  "ALLOWANCE_NOT_VISIBLE",
2476
2514
  "SIGNER_REQUIRED",
2477
2515
  "SIGNER_CHAIN_MISMATCH",
@@ -2517,6 +2555,12 @@ var cashErrorRecoveryJsonSchema = z.discriminatedUnion("kind", [
2517
2555
  kind: z.literal("inspect-base-transaction"),
2518
2556
  transactionHash: z.string(),
2519
2557
  operation: z.string()
2558
+ }).strict(),
2559
+ z.object({
2560
+ kind: z.literal("configure-cashout-access-policy"),
2561
+ depositId: z.string(),
2562
+ groupIds: z.array(z.string()),
2563
+ transactionHash: z.string().optional()
2520
2564
  }).strict()
2521
2565
  ]);
2522
2566
  var cashErrorJsonSchema = z.object({
@@ -2774,6 +2818,7 @@ function cashoutResultToJson(result) {
2774
2818
  escrowAddress: result.escrowAddress,
2775
2819
  onchainDepositId: result.onchainDepositId.toString(),
2776
2820
  order: orderToJson(result.order),
2821
+ accessPolicyTxHash: result.accessPolicyTxHash,
2777
2822
  source: result.source ? {
2778
2823
  ...result.source,
2779
2824
  amount: result.source.amount.toString()
@@ -2788,6 +2833,7 @@ function cashoutResultFromJson(json) {
2788
2833
  escrowAddress: parsed.escrowAddress,
2789
2834
  onchainDepositId: BigInt(parsed.onchainDepositId),
2790
2835
  order: orderFromJson(parsed.order),
2836
+ accessPolicyTxHash: parsed.accessPolicyTxHash,
2791
2837
  source: parsed.source ? {
2792
2838
  ...parsed.source,
2793
2839
  amount: BigInt(parsed.source.amount)
@@ -2798,7 +2844,8 @@ function prepareResultToJson(result) {
2798
2844
  return {
2799
2845
  txs: result.txs.map(preparedTxToJson),
2800
2846
  steps: result.steps.map(preparedStepToJson),
2801
- register: result.register
2847
+ register: result.register,
2848
+ accessPolicyRequired: result.accessPolicyRequired
2802
2849
  };
2803
2850
  }
2804
2851
  function prepareResultFromJson(json) {
@@ -2806,7 +2853,8 @@ function prepareResultFromJson(json) {
2806
2853
  return {
2807
2854
  txs: parsed.txs.map(preparedTxFromJson),
2808
2855
  steps: parsed.steps.map(preparedStepFromJson),
2809
- register: parsed.register
2856
+ register: parsed.register,
2857
+ accessPolicyRequired: parsed.accessPolicyRequired
2810
2858
  };
2811
2859
  }
2812
2860
  function withdrawResultToJson(result) {
@@ -2857,7 +2905,8 @@ function capabilitiesFromJson(json) {
2857
2905
  },
2858
2906
  platforms: parsed.platforms.map((p) => ({
2859
2907
  ...p,
2860
- currencies: p.currencies
2908
+ currencies: p.currencies,
2909
+ requiresAtomicAccessPolicy: p.requiresAtomicAccessPolicy ?? CASH_RESTRICTED_PLATFORMS.has(p.platform)
2861
2910
  })),
2862
2911
  currencies: parsed.currencies,
2863
2912
  amount: {
@@ -2886,6 +2935,13 @@ function cashErrorFromJson(json) {
2886
2935
  transactionHash: parsed.recovery.transactionHash,
2887
2936
  operation: parsed.recovery.operation
2888
2937
  };
2938
+ } else if (parsed.recovery.kind === "configure-cashout-access-policy") {
2939
+ recovery = {
2940
+ kind: parsed.recovery.kind,
2941
+ depositId: parsed.recovery.depositId,
2942
+ groupIds: parsed.recovery.groupIds,
2943
+ ...parsed.recovery.transactionHash !== void 0 ? { transactionHash: parsed.recovery.transactionHash } : {}
2944
+ };
2889
2945
  } else if (parsed.recovery.kind === "inspect-base-operation-submission") {
2890
2946
  recovery = {
2891
2947
  kind: parsed.recovery.kind,
package/dist/react.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CurrencyType } from '@zkp2p/sdk';
2
- import { s as CashClient, L as EstimateInput, i as CashEstimate, J as CashoutOptions, h as CashoutResult, H as CashoutInput, T as TopUpResult, W as WithdrawResult, e as CashOrder } from './createCashClient-CYSM84-K.cjs';
2
+ import { s as CashClient, L as EstimateInput, i as CashEstimate, J as CashoutOptions, h as CashoutResult, H as CashoutInput, T as TopUpResult, W as WithdrawResult, e as CashOrder } from './createCashClient-CL1SCbqF.cjs';
3
3
  import { WalletClient } from 'viem';
4
4
  import '@relayprotocol/relay-sdk';
5
5
 
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CurrencyType } from '@zkp2p/sdk';
2
- import { s as CashClient, L as EstimateInput, i as CashEstimate, J as CashoutOptions, h as CashoutResult, H as CashoutInput, T as TopUpResult, W as WithdrawResult, e as CashOrder } from './createCashClient-CYSM84-K.js';
2
+ import { s as CashClient, L as EstimateInput, i as CashEstimate, J as CashoutOptions, h as CashoutResult, H as CashoutInput, T as TopUpResult, W as WithdrawResult, e as CashOrder } from './createCashClient-CL1SCbqF.js';
3
3
  import { WalletClient } from 'viem';
4
4
  import '@relayprotocol/relay-sdk';
5
5
 
package/dist/react.js CHANGED
@@ -1,4 +1,4 @@
1
- import { isCashError, CASH_ORDER_POLL_INTERVAL_MS } from './chunk-IHEOGLAS.js';
1
+ import { isCashError, CASH_ORDER_POLL_INTERVAL_MS } from './chunk-YD5VHZXR.js';
2
2
  import { useState, useRef, useCallback, useEffect, useMemo } from 'react';
3
3
 
4
4
  function useEstimate({
package/dist/tools.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // package.json
4
4
  var package_default = {
5
- version: "0.4.3"};
5
+ version: "0.4.5"};
6
6
 
7
7
  // src/tools/index.ts
8
8
  var bigintString = {
@@ -164,7 +164,7 @@ var builtInCashTools = [
164
164
  },
165
165
  {
166
166
  name: "cash_cashout",
167
- description: "Start a Base-USDC cash-out using the custody-separated prepare path. Returns UNSIGNED transactions plus same-index steps [approve, createDeposit]; signing and ordered submission stay host-side. For another source asset, complete cash_source_quote and cash_source_status first, then pass the guaranteed Base USDC output amount here.",
167
+ description: "Start an unrestricted-rail Base-USDC cash-out using the custody-separated prepare path. Returns UNSIGNED transactions plus same-index steps [approve, createDeposit]; signing and ordered submission stay host-side. Platforms marked requiresAtomicAccessPolicy fail closed because this tool cannot safely prepare them. For another source asset, complete cash_source_quote and cash_source_status first, then pass the guaranteed Base USDC output amount here.",
168
168
  inputSchema: {
169
169
  type: "object",
170
170
  properties: {
package/dist/tools.d.cts CHANGED
@@ -145,7 +145,7 @@ declare const builtInCashTools: readonly [{
145
145
  };
146
146
  }, {
147
147
  readonly name: "cash_cashout";
148
- readonly description: "Start a Base-USDC cash-out using the custody-separated prepare path. Returns UNSIGNED transactions plus same-index steps [approve, createDeposit]; signing and ordered submission stay host-side. For another source asset, complete cash_source_quote and cash_source_status first, then pass the guaranteed Base USDC output amount here.";
148
+ readonly description: "Start an unrestricted-rail Base-USDC cash-out using the custody-separated prepare path. Returns UNSIGNED transactions plus same-index steps [approve, createDeposit]; signing and ordered submission stay host-side. Platforms marked requiresAtomicAccessPolicy fail closed because this tool cannot safely prepare them. For another source asset, complete cash_source_quote and cash_source_status first, then pass the guaranteed Base USDC output amount here.";
149
149
  readonly inputSchema: {
150
150
  readonly type: "object";
151
151
  readonly properties: {
package/dist/tools.d.ts CHANGED
@@ -145,7 +145,7 @@ declare const builtInCashTools: readonly [{
145
145
  };
146
146
  }, {
147
147
  readonly name: "cash_cashout";
148
- readonly description: "Start a Base-USDC cash-out using the custody-separated prepare path. Returns UNSIGNED transactions plus same-index steps [approve, createDeposit]; signing and ordered submission stay host-side. For another source asset, complete cash_source_quote and cash_source_status first, then pass the guaranteed Base USDC output amount here.";
148
+ readonly description: "Start an unrestricted-rail Base-USDC cash-out using the custody-separated prepare path. Returns UNSIGNED transactions plus same-index steps [approve, createDeposit]; signing and ordered submission stay host-side. Platforms marked requiresAtomicAccessPolicy fail closed because this tool cannot safely prepare them. For another source asset, complete cash_source_quote and cash_source_status first, then pass the guaranteed Base USDC output amount here.";
149
149
  readonly inputSchema: {
150
150
  readonly type: "object";
151
151
  readonly properties: {
package/dist/tools.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // package.json
2
2
  var package_default = {
3
- version: "0.4.3"};
3
+ version: "0.4.5"};
4
4
 
5
5
  // src/tools/index.ts
6
6
  var bigintString = {
@@ -162,7 +162,7 @@ var builtInCashTools = [
162
162
  },
163
163
  {
164
164
  name: "cash_cashout",
165
- description: "Start a Base-USDC cash-out using the custody-separated prepare path. Returns UNSIGNED transactions plus same-index steps [approve, createDeposit]; signing and ordered submission stay host-side. For another source asset, complete cash_source_quote and cash_source_status first, then pass the guaranteed Base USDC output amount here.",
165
+ description: "Start an unrestricted-rail Base-USDC cash-out using the custody-separated prepare path. Returns UNSIGNED transactions plus same-index steps [approve, createDeposit]; signing and ordered submission stay host-side. Platforms marked requiresAtomicAccessPolicy fail closed because this tool cannot safely prepare them. For another source asset, complete cash_source_quote and cash_source_status first, then pass the guaranteed Base USDC output amount here.",
166
166
  inputSchema: {
167
167
  type: "object",
168
168
  properties: {
@@ -65,6 +65,16 @@ but the host or a signer-backed client must execute the route before
65
65
  transaction confirms, call `finalizePreparedCashout(receipt)` to decode it with
66
66
  the environment-correct escrow ABI and obtain the resumable `CashoutResult`.
67
67
 
68
+ Venmo, Cash App, and PayPal require atomic deposit creation and access-policy
69
+ configuration. The generic `cashout()` and `prepare()` paths reject these rails
70
+ with `ATOMIC_ACCESS_POLICY_REQUIRED` before wallet access, Relay work, payee
71
+ registration, allowance, or deposit submission. Peer web performs the required
72
+ guard-before, create, guard-after, and policy configuration in one Curator-backed
73
+ batch. A host must provide the same atomic guarantee to support these rails.
74
+ Discovery marks them with `requiresAtomicAccessPolicy: true`.
75
+ `prepareAccessPolicy(depositId)` is retained only to recover a restricted
76
+ deposit already created by `0.4.4`; it is not a safe new-order sequence.
77
+
68
78
  There is no static chain/token allowlist in Peer Cash. Relay decides source
69
79
  support through its metadata and quote execution, filtered to the viem/EVM
70
80
  execution surface this SDK can sign. Peer Cash hardcodes only the Base USDC
@@ -291,6 +301,7 @@ explicit override.
291
301
  | `INVALID_PAYOUT_PLATFORMS` | no | The payout leg set is empty or repeats a platform. Pass one leg, or an array of legs using each platform at most once. |
292
302
  | `PAYEE_VERIFICATION_REQUIRED` | no | A new Wise/PayPal payee needs an attestation. Register it through Peer first; an existing registration can be reused. |
293
303
  | `PAYEE_REGISTRATION_FAILED` | yes | Curator rejected the handle or was unavailable. Check `payeeHint` and retry. |
304
+ | `ATOMIC_ACCESS_POLICY_REQUIRED` | no | Venmo, Cash App, or PayPal needs atomic creation and group policy setup. Use Peer web or an equivalent atomic host; nothing was submitted. |
294
305
  | `SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE` | no | `prepare()` accepts Base USDC only. Use signed source execution, or complete Relay first and then prepare the Base cashout. |
295
306
  | `SOURCE_RECIPIENT_MISMATCH` | no | Relay output recipient differs from the cashout depositor. Use the depositor address. |
296
307
  | `SOURCE_CAPABILITIES_FAILED` | yes | Relay source discovery failed. Retry or use Base USDC. |
@@ -308,6 +319,7 @@ explicit override.
308
319
  | `TRANSACTION_SUBMISSION_UNKNOWN` | no | A Base mutation returned no hash but may have broadcast. Inspect wallet/protocol state and its recovery action before any retry. |
309
320
  | `TRANSACTION_STATUS_UNKNOWN` | no | A transaction was submitted but its receipt is unknown. Inspect `recovery.transactionHash` before resubmitting. |
310
321
  | `DEPOSIT_RESOLUTION_FAILED` | no | Base tx succeeded but no `DepositReceived` was decoded. Inspect its logs and recover the composite id. |
322
+ | `ACCESS_POLICY_CONFIGURATION_FAILED` | no | A `0.4.4` cash-out exists without confirmed group policy. Configure that existing deposit from recovery data; never create it again. |
311
323
  | `INVALID_DEPOSIT_ID` | no | The id is not `escrowAddress_onchainId`. A bare number cannot cold-hydrate; use the value returned by `cashout()`. |
312
324
  | `ORDER_NOT_FOUND` | yes | Unknown id or immediate indexer lag. Verify the id and retry shortly after creation. |
313
325
  | `INDEXER_LAG` | yes | Indexer trails the chain. Retry the read shortly. |
@@ -104,10 +104,16 @@ console.log(`manifest: ${cashToolManifest.name}@${cashToolManifest.version}`);
104
104
  console.log(`tools: ${cashToolManifest.tools.map((t) => t.name).join(', ')}\n`);
105
105
 
106
106
  const caps = (await executeTool('cash_capabilities', {})) as {
107
- platforms: { platform: string; currencies: string[]; payeeHint: string }[];
107
+ platforms: {
108
+ platform: string;
109
+ currencies: string[];
110
+ payeeHint: string;
111
+ requiresAtomicAccessPolicy: boolean;
112
+ }[];
108
113
  };
109
- console.log(`agent sees ${caps.platforms.length} platforms; venmo hint:`);
110
- console.log(` "${caps.platforms.find((p) => p.platform === 'venmo')?.payeeHint}"\n`);
114
+ const venmo = caps.platforms.find((p) => p.platform === 'venmo');
115
+ console.log(`agent sees ${caps.platforms.length} platforms; venmo capability:`);
116
+ console.log(` hint="${venmo?.payeeHint}" atomic=${venmo?.requiresAtomicAccessPolicy}\n`);
111
117
 
112
118
  const est = await executeTool('cash_estimate', {
113
119
  amount: usdc(250).toString(),
@@ -11,8 +11,10 @@
11
11
  * The curator validates supported handles against the live platform, so the
12
12
  * payee must be a real account. A new Wise/PayPal registration also needs the
13
13
  * identity attestation created by Peer; an existing registered handle can be
14
- * reused. Override the demo corridor with:
15
- * CASH_PLATFORM=venmo CASH_CURRENCY=USD CASH_PAYEE=@your-venmo
14
+ * reused. Venmo, Cash App, and PayPal require Peer web or another host that
15
+ * creates the deposit and access policy atomically, so this generic demo uses
16
+ * Chime by default. Override the demo corridor with:
17
+ * CASH_PLATFORM=revolut CASH_CURRENCY=EUR CASH_PAYEE=your-revtag
16
18
  */
17
19
  import { createWalletClient, http } from 'viem';
18
20
  import { privateKeyToAccount } from 'viem/accounts';
@@ -26,9 +28,9 @@ const signer = createWalletClient({ account, chain: base, transport: http() });
26
28
  // One leg here; `receive` also accepts an array of legs to offer several
27
29
  // platforms on one order (each platform at most once, all at the oracle rate).
28
30
  const receive = {
29
- platform: process.env.CASH_PLATFORM ?? 'venmo',
31
+ platform: process.env.CASH_PLATFORM ?? 'chime',
30
32
  currency: (process.env.CASH_CURRENCY ?? 'USD') as CurrencyType,
31
- payee: { offchainId: process.env.CASH_PAYEE ?? '@your-venmo' },
33
+ payee: { offchainId: process.env.CASH_PAYEE ?? '$your-chime-sign' },
32
34
  };
33
35
 
34
36
  const cash = createCashClient({ environment: 'staging' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zkp2p/cash",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Peer Cash - offramp-only SDK for routing crypto to Base USDC, then cashing out to fiat at the live oracle market rate.",
5
5
  "license": "MIT",
6
6
  "author": "Peer (https://peer.xyz)",