@zkp2p/cash 0.6.1 → 0.6.3-rc.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/AGENTS.md +18 -12
- package/README.md +48 -1
- package/dist/{createCashClient-LTZshulP.d.cts → createCashClient-p7RZVUmC.d.cts} +4 -2
- package/dist/{createCashClient-LTZshulP.d.ts → createCashClient-p7RZVUmC.d.ts} +4 -2
- package/dist/index.cjs +5 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/tools.cjs +1 -1
- package/dist/tools.js +1 -1
- package/docs/partner-integrations.md +12 -12
- package/examples/node-cashout.ts +2 -0
- package/examples/onchain-demo/package.json +1 -1
- package/examples/onchain-demo/src/stubs/viem-chains.mjs +2 -1
- package/examples/venmo-link.ts +5 -0
- package/llms.txt +10 -1
- package/package.json +2 -2
- package/skills/peer-cash-integration/SKILL.md +18 -12
package/AGENTS.md
CHANGED
|
@@ -61,6 +61,12 @@ deposit-level integration share instead of applying maker L1/L2.
|
|
|
61
61
|
- **Cash App is non-chargebackable.** Cash App cash-outs stay public, do not
|
|
62
62
|
attach a Peer Pay merchant policy, and never require dispute-protection stake.
|
|
63
63
|
|
|
64
|
+
- **X Money supports USD.** Use `platform: 'xmoney'` and a receiving X username
|
|
65
|
+
with X Money enabled. Raw string payees accept a leading `@` and normalize to
|
|
66
|
+
the bare lowercase handle; structured `offchainId` values must already be
|
|
67
|
+
normalized. Curator does not verify account existence or X Money enrollment.
|
|
68
|
+
No identity attestation or Peer Pay merchant policy is required.
|
|
69
|
+
|
|
64
70
|
- **Wise, PayPal, and Alipay** carry `requiresIdentityAttestation: true`. A new curator
|
|
65
71
|
registration needs a signed maker identity attestation this SDK cannot mint
|
|
66
72
|
(first-party Peer web obtains it through the Peer TEE browser extension).
|
|
@@ -353,15 +359,15 @@ button click. Re-prepare when the selected handle changes. Use
|
|
|
353
359
|
tab or an ambiguous closure; service errors reject, and only an active Google
|
|
354
360
|
credential counts as connected. Persist the hash with its environment and user.
|
|
355
361
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
branding
|
|
366
|
-
|
|
367
|
-
|
|
362
|
+
For native apps, use `prepareVenmoGmailConnect(handle, { returnUrl })` and
|
|
363
|
+
open `link.url` with Expo's `openAuthSessionAsync(link.url, returnUrl)`.
|
|
364
|
+
Register the scheme in your app binary; no registration with Peer is needed.
|
|
365
|
+
Peer appends no data to the callback. Omitted/empty callbacks attempt closure;
|
|
366
|
+
tabs that block it keep the success page. Always re-check status on return.
|
|
367
|
+
|
|
368
|
+
The hosted flow verifies actual Venmo receipts, including Google-hosted custom
|
|
369
|
+
inboxes. `VenmoGmailConnectError` is separate from `CashError`; no emails or
|
|
370
|
+
Google tokens reach the partner. Configure `venmoGmail: { appearance, popup }`
|
|
371
|
+
for branding and desktop dimensions; omission keeps Peer defaults.
|
|
372
|
+
See the README for error codes, native callbacks, package-free URLs, and
|
|
373
|
+
customization, plus `examples/venmo-link.ts`.
|
package/README.md
CHANGED
|
@@ -144,7 +144,7 @@ arbitrary protocol operations.
|
|
|
144
144
|
|
|
145
145
|
| Verb | What it does |
|
|
146
146
|
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
147
|
-
| `prepareVenmoGmailConnect(payee)`
|
|
147
|
+
| `prepareVenmoGmailConnect(payee, { returnUrl }?)` | Optional Venmo handle registration; returns the payee hash and hosted URL, with an optional app callback |
|
|
148
148
|
| `openVenmoGmailConnect(payeeDetails)` | Optional browser popup/tab; call directly from a click |
|
|
149
149
|
| `isVenmoGmailConnected(payeeDetails)` | Read whether an active Google receipt credential exists |
|
|
150
150
|
| `capabilities()` | Sync discovery: Base USDC destination/default source, platforms × currencies × payee hints × amount bounds |
|
|
@@ -239,6 +239,46 @@ never pass through the partner app or Cash SDK.
|
|
|
239
239
|
See [the browser example](examples/venmo-link.ts). JSON codecs are exported for
|
|
240
240
|
`PreparedVenmoGmailConnect` and `VenmoGmailConnectResult`.
|
|
241
241
|
|
|
242
|
+
### Return to an Expo / React Native app
|
|
243
|
+
|
|
244
|
+
Cash `0.6.2` supports an optional callback on the prepared URL. The popup
|
|
245
|
+
helper is browser-only; native apps open the URL using their system browser
|
|
246
|
+
session:
|
|
247
|
+
|
|
248
|
+
```ts
|
|
249
|
+
import { createCashClient } from '@zkp2p/cash';
|
|
250
|
+
import * as WebBrowser from 'expo-web-browser';
|
|
251
|
+
|
|
252
|
+
const cash = createCashClient({ environment: 'production' });
|
|
253
|
+
const returnUrl = 'partner-app://venmo-linked';
|
|
254
|
+
const link = await cash.prepareVenmoGmailConnect('@yourhandle', { returnUrl });
|
|
255
|
+
await WebBrowser.openAuthSessionAsync(link.url, returnUrl);
|
|
256
|
+
const connected = await cash.isVenmoGmailConnected(link.payeeDetails);
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Register the callback scheme in your app binary and test on iOS and Android;
|
|
260
|
+
see [Expo's callback requirements](https://docs.expo.dev/versions/latest/sdk/webbrowser/#webbrowseropenauthsessionasyncurl-redirecturl-options).
|
|
261
|
+
Peer requires no callback registration or deployment configuration. After
|
|
262
|
+
verification, the hosted page navigates to `returnUrl` unchanged: no Google
|
|
263
|
+
credentials, email, account hash, or status are appended. Errors remain on
|
|
264
|
+
the page with a manual return button. Always re-check connection status on
|
|
265
|
+
return or dismissal; a browser return alone is not proof of linking.
|
|
266
|
+
|
|
267
|
+
Preparation and status checks can stay on your backend. If it already has
|
|
268
|
+
`payeeDetails`, your app needs no Cash package:
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
const connectUrl = new URL('https://app.peer.xyz/connect/venmo');
|
|
272
|
+
connectUrl.searchParams.set('returnUrl', returnUrl);
|
|
273
|
+
connectUrl.hash = payeeDetails;
|
|
274
|
+
await WebBrowser.openAuthSessionAsync(connectUrl.toString(), returnUrl);
|
|
275
|
+
// Re-check seller-credential/status through your backend.
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Without a callback, or with an empty one, the hosted page attempts to close
|
|
279
|
+
after verification. Script-opened desktop popups can close; mobile tabs that
|
|
280
|
+
block closure retain the success page for manual dismissal.
|
|
281
|
+
|
|
242
282
|
### Customize the hosted popup
|
|
243
283
|
|
|
244
284
|
With `@zkp2p/cash@0.6.1`, configure branding once on the client. The same
|
|
@@ -283,10 +323,17 @@ See the [full appearance options](https://www.npmjs.com/package/@zkp2p/sdk#popup
|
|
|
283
323
|
| Venmo | Peer Pay merchant policy attaches for that payment method | Curator validates the live handle |
|
|
284
324
|
| PayPal | Same method-scoped Peer Pay follow-up | Requires a Peer TEE browser-extension identity attestation |
|
|
285
325
|
| Cash App | No access-policy follow-up; non-chargebackable and no stake required | Curator validates the live handle |
|
|
326
|
+
| X Money (USD) | No access-policy follow-up | Bare lowercase X username; X Money must be enabled on the receiving account |
|
|
286
327
|
| Wise | No access-policy follow-up | Requires a Peer TEE browser-extension identity attestation |
|
|
287
328
|
| UPI | No access-policy follow-up | Any valid UPI ID; no account connection or identity attestation |
|
|
288
329
|
| Other supported rails | No access-policy follow-up; use `capabilities()` for currencies and format | Follow the `payeeHint`; live-validation behavior is described in the integration guide |
|
|
289
330
|
|
|
331
|
+
Use `receive: { platform: 'xmoney', currency: 'USD', payee: '@YourHandle' }`
|
|
332
|
+
for X Money. Raw handles are trimmed, lowercased, and stripped of a leading `@`;
|
|
333
|
+
structured payee data must already use `offchainId: 'yourhandle'`. Registration
|
|
334
|
+
normalizes the handle but does not verify that the X account exists or can receive
|
|
335
|
+
X Money. Confirm that the receiving account has X Money enabled before cashing out.
|
|
336
|
+
|
|
290
337
|
No platform requires an atomic access-policy flow. `cashout()` and `prepare()`
|
|
291
338
|
work with any viem `WalletClient`, including a local or externally connected
|
|
292
339
|
EOA; no Privy wallet or signer API is required. The deprecated
|
|
@@ -861,8 +861,10 @@ interface OrdersOptions {
|
|
|
861
861
|
limit?: number;
|
|
862
862
|
}
|
|
863
863
|
interface CashClient {
|
|
864
|
-
/**
|
|
865
|
-
prepareVenmoGmailConnect(payee: string
|
|
864
|
+
/** Register a Venmo handle and prepare a hosted URL, optionally returning to a native app. No deposit. */
|
|
865
|
+
prepareVenmoGmailConnect(payee: string, options?: {
|
|
866
|
+
returnUrl?: string;
|
|
867
|
+
}): Promise<PreparedVenmoGmailConnect>;
|
|
866
868
|
/** Optional, browser-only: call directly from a click handler with the prepared payee hash. */
|
|
867
869
|
openVenmoGmailConnect(payeeDetails: Hash): Promise<VenmoGmailConnectResult>;
|
|
868
870
|
/** True only for an active Google receipt credential; errors reject instead of reporting unlinked. */
|
|
@@ -861,8 +861,10 @@ interface OrdersOptions {
|
|
|
861
861
|
limit?: number;
|
|
862
862
|
}
|
|
863
863
|
interface CashClient {
|
|
864
|
-
/**
|
|
865
|
-
prepareVenmoGmailConnect(payee: string
|
|
864
|
+
/** Register a Venmo handle and prepare a hosted URL, optionally returning to a native app. No deposit. */
|
|
865
|
+
prepareVenmoGmailConnect(payee: string, options?: {
|
|
866
|
+
returnUrl?: string;
|
|
867
|
+
}): Promise<PreparedVenmoGmailConnect>;
|
|
866
868
|
/** Optional, browser-only: call directly from a click handler with the prepared payee hash. */
|
|
867
869
|
openVenmoGmailConnect(payeeDetails: Hash): Promise<VenmoGmailConnectResult>;
|
|
868
870
|
/** True only for an active Google receipt credential; errors reject instead of reporting unlinked. */
|
package/dist/index.cjs
CHANGED
|
@@ -618,6 +618,7 @@ var PAYEE_HINTS = {
|
|
|
618
618
|
mercadopago: "Mercado Pago alias or CVU",
|
|
619
619
|
monzo: "Monzo.me username",
|
|
620
620
|
chime: "ChimeSign (e.g. $andrew)",
|
|
621
|
+
xmoney: "X username with X Money enabled, with or without the leading @ (e.g. @andrew)",
|
|
621
622
|
luxon: "Luxon Pay ID or account email",
|
|
622
623
|
n26: "MoneyBeam email or phone number",
|
|
623
624
|
alipay: "Email address linked to your Alipay account",
|
|
@@ -1893,6 +1894,8 @@ function normalizeCashPayee(platform, payee) {
|
|
|
1893
1894
|
switch (platform) {
|
|
1894
1895
|
case "venmo":
|
|
1895
1896
|
return { offchainId: trimmed.replace(/^@+/, "") };
|
|
1897
|
+
case "xmoney":
|
|
1898
|
+
return { offchainId: trimmed.replace(/^@/, "").toLowerCase() };
|
|
1896
1899
|
case "cashapp":
|
|
1897
1900
|
return { offchainId: trimmed.replace(/^\$+/, "") };
|
|
1898
1901
|
case "chime":
|
|
@@ -3429,7 +3432,7 @@ function createCashClient(options) {
|
|
|
3429
3432
|
return hashes;
|
|
3430
3433
|
}
|
|
3431
3434
|
return {
|
|
3432
|
-
async prepareVenmoGmailConnect(payee) {
|
|
3435
|
+
async prepareVenmoGmailConnect(payee, connectOptions) {
|
|
3433
3436
|
const { hashedOnchainIds } = await readClient.registerPayeeDetails({
|
|
3434
3437
|
processorNames: ["venmo"],
|
|
3435
3438
|
payeeData: [normalizeCashPayee("venmo", payee)]
|
|
@@ -3437,6 +3440,7 @@ function createCashClient(options) {
|
|
|
3437
3440
|
const payeeDetails = hashedOnchainIds[0];
|
|
3438
3441
|
const url = sdk.getVenmoGmailConnectUrl({
|
|
3439
3442
|
...options.venmoGmail,
|
|
3443
|
+
...connectOptions,
|
|
3440
3444
|
payeeDetails,
|
|
3441
3445
|
peerOrigin: options.peerOrigin ?? DEFAULT_PEER_ORIGINS[environment]
|
|
3442
3446
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CashPayoutInfo, I as IntentEntity, a as CashBuyerProfile, b as CashDepositInput, c as CreateDepositParamsArg, d as CashOrder, e as CashFill, f as CashCapabilities, g as CashoutResult, h as CashEstimate, i as CashFillStats, N as NearIntentsSourceCapabilities, j as NearIntentsDepositInput, k as NearIntentsQuote, l as NearIntentsQuoteInput, m as NearIntentsStatus, n as NearIntentsStatusInput, P as PrepareResult, o as CashPreparedStep, p as PreparedVenmoGmailConnect, R as RelayExecutionResult, q as RelayQuote, r as RelayStatus, s as CashSourceCapabilities, T as TopUpResult, W as WithdrawResult } from './createCashClient-
|
|
2
|
-
export { B as BASE_CHAIN_ID, t as BASE_USDC_ADDRESS, u as CASH_ATTRIBUTION_CODE, v as CASH_ORDER_POLL_INTERVAL_MS, w as CASH_ORDER_STATUSES, x as CASH_REFERRAL_ATTRIBUTION_PREFIX, y as CASH_RETAIN_ON_EMPTY, z as CashAsset, A as CashChain, D as CashClient, E as CashClientOptions, F as CashCorridorPricing, G as CashFillEta, H as CashLeg, J as CashMultiCurrencyLeg, K as CashNextAction, L as CashOrderState, M as CashPairFillStats, O as CashPayeeInput, Q as CashPayout, S as CashPayoutPricing, U as CashPlatformCapability, V as CashPreparedStepKind, X as CashReceiveLeg, Y as CashoutInput, Z as CashoutOptions, _ as CuratorPayeeDataInput, $ as EstimateInput, a0 as EstimateOptions, a1 as MARKET_SPREAD_BPS, a2 as MIN_CASHOUT_AMOUNT, a3 as NEAR_INTENTS_API_URL, a4 as NEAR_INTENTS_BASE_USDC_ASSET_ID, a5 as NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS, a6 as NEAR_INTENTS_STATUSES, a7 as NearIntentsClient, a8 as NearIntentsOptions, a9 as NearIntentsQuoteRequest, aa as NearIntentsStatusCode, ab as NearIntentsToken, ac as NearIntentsTradeType, ad as NearIntentsTransaction, ae as ORACLE_MIN_CONVERSION_RATE_SENTINEL, af as OrdersOptions, ag as PreparedCashoutReceipt, ah as RECOMMENDED_MIN_CASHOUT_AMOUNT, ai as RelayOptions, aj as RelayQuoteInput, ak as RelaySourceInput, al as RelayTransaction, am as SignerOptions, an as USDC_DECIMALS, ao as WatchOptions, ap as WithdrawOptions, aq as buildCapabilities, ar as createCashClient, as as createNearIntentsClient, at as normalizeCashPayee, au as quoteNearIntentsToBaseUsdc, av as readNearIntentsSourceCapabilities, aw as readNearIntentsStatus, ax as submitNearIntentsDeposit, ay as toCashReferralAttributionCode } from './createCashClient-
|
|
1
|
+
import { C as CashPayoutInfo, I as IntentEntity, a as CashBuyerProfile, b as CashDepositInput, c as CreateDepositParamsArg, d as CashOrder, e as CashFill, f as CashCapabilities, g as CashoutResult, h as CashEstimate, i as CashFillStats, N as NearIntentsSourceCapabilities, j as NearIntentsDepositInput, k as NearIntentsQuote, l as NearIntentsQuoteInput, m as NearIntentsStatus, n as NearIntentsStatusInput, P as PrepareResult, o as CashPreparedStep, p as PreparedVenmoGmailConnect, R as RelayExecutionResult, q as RelayQuote, r as RelayStatus, s as CashSourceCapabilities, T as TopUpResult, W as WithdrawResult } from './createCashClient-p7RZVUmC.cjs';
|
|
2
|
+
export { B as BASE_CHAIN_ID, t as BASE_USDC_ADDRESS, u as CASH_ATTRIBUTION_CODE, v as CASH_ORDER_POLL_INTERVAL_MS, w as CASH_ORDER_STATUSES, x as CASH_REFERRAL_ATTRIBUTION_PREFIX, y as CASH_RETAIN_ON_EMPTY, z as CashAsset, A as CashChain, D as CashClient, E as CashClientOptions, F as CashCorridorPricing, G as CashFillEta, H as CashLeg, J as CashMultiCurrencyLeg, K as CashNextAction, L as CashOrderState, M as CashPairFillStats, O as CashPayeeInput, Q as CashPayout, S as CashPayoutPricing, U as CashPlatformCapability, V as CashPreparedStepKind, X as CashReceiveLeg, Y as CashoutInput, Z as CashoutOptions, _ as CuratorPayeeDataInput, $ as EstimateInput, a0 as EstimateOptions, a1 as MARKET_SPREAD_BPS, a2 as MIN_CASHOUT_AMOUNT, a3 as NEAR_INTENTS_API_URL, a4 as NEAR_INTENTS_BASE_USDC_ASSET_ID, a5 as NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS, a6 as NEAR_INTENTS_STATUSES, a7 as NearIntentsClient, a8 as NearIntentsOptions, a9 as NearIntentsQuoteRequest, aa as NearIntentsStatusCode, ab as NearIntentsToken, ac as NearIntentsTradeType, ad as NearIntentsTransaction, ae as ORACLE_MIN_CONVERSION_RATE_SENTINEL, af as OrdersOptions, ag as PreparedCashoutReceipt, ah as RECOMMENDED_MIN_CASHOUT_AMOUNT, ai as RelayOptions, aj as RelayQuoteInput, ak as RelaySourceInput, al as RelayTransaction, am as SignerOptions, an as USDC_DECIMALS, ao as WatchOptions, ap as WithdrawOptions, aq as buildCapabilities, ar as createCashClient, as as createNearIntentsClient, at as normalizeCashPayee, au as quoteNearIntentsToBaseUsdc, av as readNearIntentsSourceCapabilities, aw as readNearIntentsStatus, ax as submitNearIntentsDeposit, ay as toCashReferralAttributionCode } from './createCashClient-p7RZVUmC.cjs';
|
|
3
3
|
import { PublicClient, Log, Abi } from 'viem';
|
|
4
4
|
import { PaymentMethodCatalog, CurrencyType, OracleAdapterOverrides, OnchainCurrency, Zkp2pClient, PreparedTransaction, VenmoGmailConnectResult } from '@zkp2p/sdk';
|
|
5
5
|
export { CurrencyType, PreparedTransaction, RuntimeEnv, VenmoGmailAppearance, VenmoGmailConnectError, VenmoGmailConnectResult, VenmoGmailPopupOptions } from '@zkp2p/sdk';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CashPayoutInfo, I as IntentEntity, a as CashBuyerProfile, b as CashDepositInput, c as CreateDepositParamsArg, d as CashOrder, e as CashFill, f as CashCapabilities, g as CashoutResult, h as CashEstimate, i as CashFillStats, N as NearIntentsSourceCapabilities, j as NearIntentsDepositInput, k as NearIntentsQuote, l as NearIntentsQuoteInput, m as NearIntentsStatus, n as NearIntentsStatusInput, P as PrepareResult, o as CashPreparedStep, p as PreparedVenmoGmailConnect, R as RelayExecutionResult, q as RelayQuote, r as RelayStatus, s as CashSourceCapabilities, T as TopUpResult, W as WithdrawResult } from './createCashClient-
|
|
2
|
-
export { B as BASE_CHAIN_ID, t as BASE_USDC_ADDRESS, u as CASH_ATTRIBUTION_CODE, v as CASH_ORDER_POLL_INTERVAL_MS, w as CASH_ORDER_STATUSES, x as CASH_REFERRAL_ATTRIBUTION_PREFIX, y as CASH_RETAIN_ON_EMPTY, z as CashAsset, A as CashChain, D as CashClient, E as CashClientOptions, F as CashCorridorPricing, G as CashFillEta, H as CashLeg, J as CashMultiCurrencyLeg, K as CashNextAction, L as CashOrderState, M as CashPairFillStats, O as CashPayeeInput, Q as CashPayout, S as CashPayoutPricing, U as CashPlatformCapability, V as CashPreparedStepKind, X as CashReceiveLeg, Y as CashoutInput, Z as CashoutOptions, _ as CuratorPayeeDataInput, $ as EstimateInput, a0 as EstimateOptions, a1 as MARKET_SPREAD_BPS, a2 as MIN_CASHOUT_AMOUNT, a3 as NEAR_INTENTS_API_URL, a4 as NEAR_INTENTS_BASE_USDC_ASSET_ID, a5 as NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS, a6 as NEAR_INTENTS_STATUSES, a7 as NearIntentsClient, a8 as NearIntentsOptions, a9 as NearIntentsQuoteRequest, aa as NearIntentsStatusCode, ab as NearIntentsToken, ac as NearIntentsTradeType, ad as NearIntentsTransaction, ae as ORACLE_MIN_CONVERSION_RATE_SENTINEL, af as OrdersOptions, ag as PreparedCashoutReceipt, ah as RECOMMENDED_MIN_CASHOUT_AMOUNT, ai as RelayOptions, aj as RelayQuoteInput, ak as RelaySourceInput, al as RelayTransaction, am as SignerOptions, an as USDC_DECIMALS, ao as WatchOptions, ap as WithdrawOptions, aq as buildCapabilities, ar as createCashClient, as as createNearIntentsClient, at as normalizeCashPayee, au as quoteNearIntentsToBaseUsdc, av as readNearIntentsSourceCapabilities, aw as readNearIntentsStatus, ax as submitNearIntentsDeposit, ay as toCashReferralAttributionCode } from './createCashClient-
|
|
1
|
+
import { C as CashPayoutInfo, I as IntentEntity, a as CashBuyerProfile, b as CashDepositInput, c as CreateDepositParamsArg, d as CashOrder, e as CashFill, f as CashCapabilities, g as CashoutResult, h as CashEstimate, i as CashFillStats, N as NearIntentsSourceCapabilities, j as NearIntentsDepositInput, k as NearIntentsQuote, l as NearIntentsQuoteInput, m as NearIntentsStatus, n as NearIntentsStatusInput, P as PrepareResult, o as CashPreparedStep, p as PreparedVenmoGmailConnect, R as RelayExecutionResult, q as RelayQuote, r as RelayStatus, s as CashSourceCapabilities, T as TopUpResult, W as WithdrawResult } from './createCashClient-p7RZVUmC.js';
|
|
2
|
+
export { B as BASE_CHAIN_ID, t as BASE_USDC_ADDRESS, u as CASH_ATTRIBUTION_CODE, v as CASH_ORDER_POLL_INTERVAL_MS, w as CASH_ORDER_STATUSES, x as CASH_REFERRAL_ATTRIBUTION_PREFIX, y as CASH_RETAIN_ON_EMPTY, z as CashAsset, A as CashChain, D as CashClient, E as CashClientOptions, F as CashCorridorPricing, G as CashFillEta, H as CashLeg, J as CashMultiCurrencyLeg, K as CashNextAction, L as CashOrderState, M as CashPairFillStats, O as CashPayeeInput, Q as CashPayout, S as CashPayoutPricing, U as CashPlatformCapability, V as CashPreparedStepKind, X as CashReceiveLeg, Y as CashoutInput, Z as CashoutOptions, _ as CuratorPayeeDataInput, $ as EstimateInput, a0 as EstimateOptions, a1 as MARKET_SPREAD_BPS, a2 as MIN_CASHOUT_AMOUNT, a3 as NEAR_INTENTS_API_URL, a4 as NEAR_INTENTS_BASE_USDC_ASSET_ID, a5 as NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS, a6 as NEAR_INTENTS_STATUSES, a7 as NearIntentsClient, a8 as NearIntentsOptions, a9 as NearIntentsQuoteRequest, aa as NearIntentsStatusCode, ab as NearIntentsToken, ac as NearIntentsTradeType, ad as NearIntentsTransaction, ae as ORACLE_MIN_CONVERSION_RATE_SENTINEL, af as OrdersOptions, ag as PreparedCashoutReceipt, ah as RECOMMENDED_MIN_CASHOUT_AMOUNT, ai as RelayOptions, aj as RelayQuoteInput, ak as RelaySourceInput, al as RelayTransaction, am as SignerOptions, an as USDC_DECIMALS, ao as WatchOptions, ap as WithdrawOptions, aq as buildCapabilities, ar as createCashClient, as as createNearIntentsClient, at as normalizeCashPayee, au as quoteNearIntentsToBaseUsdc, av as readNearIntentsSourceCapabilities, aw as readNearIntentsStatus, ax as submitNearIntentsDeposit, ay as toCashReferralAttributionCode } from './createCashClient-p7RZVUmC.js';
|
|
3
3
|
import { PublicClient, Log, Abi } from 'viem';
|
|
4
4
|
import { PaymentMethodCatalog, CurrencyType, OracleAdapterOverrides, OnchainCurrency, Zkp2pClient, PreparedTransaction, VenmoGmailConnectResult } from '@zkp2p/sdk';
|
|
5
5
|
export { CurrencyType, PreparedTransaction, RuntimeEnv, VenmoGmailAppearance, VenmoGmailConnectError, VenmoGmailConnectResult, VenmoGmailPopupOptions } from '@zkp2p/sdk';
|
package/dist/index.js
CHANGED
|
@@ -597,6 +597,7 @@ var PAYEE_HINTS = {
|
|
|
597
597
|
mercadopago: "Mercado Pago alias or CVU",
|
|
598
598
|
monzo: "Monzo.me username",
|
|
599
599
|
chime: "ChimeSign (e.g. $andrew)",
|
|
600
|
+
xmoney: "X username with X Money enabled, with or without the leading @ (e.g. @andrew)",
|
|
600
601
|
luxon: "Luxon Pay ID or account email",
|
|
601
602
|
n26: "MoneyBeam email or phone number",
|
|
602
603
|
alipay: "Email address linked to your Alipay account",
|
|
@@ -1400,6 +1401,8 @@ function normalizeCashPayee(platform, payee) {
|
|
|
1400
1401
|
switch (platform) {
|
|
1401
1402
|
case "venmo":
|
|
1402
1403
|
return { offchainId: trimmed.replace(/^@+/, "") };
|
|
1404
|
+
case "xmoney":
|
|
1405
|
+
return { offchainId: trimmed.replace(/^@/, "").toLowerCase() };
|
|
1403
1406
|
case "cashapp":
|
|
1404
1407
|
return { offchainId: trimmed.replace(/^\$+/, "") };
|
|
1405
1408
|
case "chime":
|
|
@@ -2936,7 +2939,7 @@ function createCashClient(options) {
|
|
|
2936
2939
|
return hashes;
|
|
2937
2940
|
}
|
|
2938
2941
|
return {
|
|
2939
|
-
async prepareVenmoGmailConnect(payee) {
|
|
2942
|
+
async prepareVenmoGmailConnect(payee, connectOptions) {
|
|
2940
2943
|
const { hashedOnchainIds } = await readClient.registerPayeeDetails({
|
|
2941
2944
|
processorNames: ["venmo"],
|
|
2942
2945
|
payeeData: [normalizeCashPayee("venmo", payee)]
|
|
@@ -2944,6 +2947,7 @@ function createCashClient(options) {
|
|
|
2944
2947
|
const payeeDetails = hashedOnchainIds[0];
|
|
2945
2948
|
const url = getVenmoGmailConnectUrl({
|
|
2946
2949
|
...options.venmoGmail,
|
|
2950
|
+
...connectOptions,
|
|
2947
2951
|
payeeDetails,
|
|
2948
2952
|
peerOrigin: options.peerOrigin ?? DEFAULT_PEER_ORIGINS[environment]
|
|
2949
2953
|
});
|
package/dist/react.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CurrencyType } from '@zkp2p/sdk';
|
|
2
|
-
import { D as CashClient, $ as EstimateInput, h as CashEstimate, Z as CashoutOptions, g as CashoutResult, Y as CashoutInput, T as TopUpResult, W as WithdrawResult, d as CashOrder } from './createCashClient-
|
|
2
|
+
import { D as CashClient, $ as EstimateInput, h as CashEstimate, Z as CashoutOptions, g as CashoutResult, Y as CashoutInput, T as TopUpResult, W as WithdrawResult, d as CashOrder } from './createCashClient-p7RZVUmC.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 { D as CashClient, $ as EstimateInput, h as CashEstimate, Z as CashoutOptions, g as CashoutResult, Y as CashoutInput, T as TopUpResult, W as WithdrawResult, d as CashOrder } from './createCashClient-
|
|
2
|
+
import { D as CashClient, $ as EstimateInput, h as CashEstimate, Z as CashoutOptions, g as CashoutResult, Y as CashoutInput, T as TopUpResult, W as WithdrawResult, d as CashOrder } from './createCashClient-p7RZVUmC.js';
|
|
3
3
|
import { WalletClient } from 'viem';
|
|
4
4
|
import '@relayprotocol/relay-sdk';
|
|
5
5
|
|
package/dist/tools.cjs
CHANGED
package/dist/tools.js
CHANGED
|
@@ -150,15 +150,15 @@ button click. Re-prepare when the selected handle changes. Use
|
|
|
150
150
|
tab or an ambiguous closure; service errors reject, and only an active Google
|
|
151
151
|
credential counts as connected. Persist the hash with its environment and user.
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
branding
|
|
163
|
-
|
|
164
|
-
|
|
153
|
+
For native apps, use `prepareVenmoGmailConnect(handle, { returnUrl })` and
|
|
154
|
+
open `link.url` with Expo's `openAuthSessionAsync(link.url, returnUrl)`.
|
|
155
|
+
Register the scheme in your app binary; no registration with Peer is needed.
|
|
156
|
+
Peer appends no data to the callback. Omitted/empty callbacks attempt closure;
|
|
157
|
+
tabs that block it keep the success page. Always re-check status on return.
|
|
158
|
+
|
|
159
|
+
The hosted flow verifies actual Venmo receipts, including Google-hosted custom
|
|
160
|
+
inboxes. `VenmoGmailConnectError` is separate from `CashError`; no emails or
|
|
161
|
+
Google tokens reach the partner. Configure `venmoGmail: { appearance, popup }`
|
|
162
|
+
for branding and desktop dimensions; omission keeps Peer defaults.
|
|
163
|
+
See the README for error codes, native callbacks, package-free URLs, and
|
|
164
|
+
customization, plus `examples/venmo-link.ts`.
|
package/examples/node-cashout.ts
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
* no Privy wallet is required. Venmo and PayPal attach their access
|
|
17
17
|
* policy in a confirmed follow-up transaction. Override the demo corridor with:
|
|
18
18
|
* CASH_PLATFORM=revolut CASH_CURRENCY=EUR CASH_PAYEE=your-revtag
|
|
19
|
+
* CASH_PLATFORM=xmoney CASH_CURRENCY=USD CASH_PAYEE=@your-x-username
|
|
20
|
+
* X Money requires an enrolled receiving account; registration does not check enrollment.
|
|
19
21
|
*/
|
|
20
22
|
import { createWalletClient, http } from 'viem';
|
|
21
23
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Peer Cash Demo: the express sell flow stored entirely onchain on Base, after zSwap by z0r0z",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@zkp2p/cash": "0.
|
|
7
|
+
"@zkp2p/cash": "0.6.1",
|
|
8
8
|
"esbuild": "0.28.2",
|
|
9
9
|
"solc": "0.8.36",
|
|
10
10
|
"viem": "2.55.18"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Slim stand-in for viem/chains. The full catalog is ~700 chain definitions
|
|
2
2
|
// (~250 KB minified) and every byte of this page is paid for in deploy gas;
|
|
3
|
-
// the app and its SDKs only ever import these
|
|
3
|
+
// the app and its SDKs only ever import these.
|
|
4
4
|
export { base } from '../../node_modules/viem/_esm/chains/definitions/base.js';
|
|
5
5
|
export { hardhat } from '../../node_modules/viem/_esm/chains/definitions/hardhat.js';
|
|
6
6
|
export { mainnet } from '../../node_modules/viem/_esm/chains/definitions/mainnet.js';
|
|
7
|
+
export { polygon } from '../../node_modules/viem/_esm/chains/definitions/polygon.js';
|
|
7
8
|
export { sepolia } from '../../node_modules/viem/_esm/chains/definitions/sepolia.js';
|
package/examples/venmo-link.ts
CHANGED
|
@@ -18,6 +18,11 @@ export async function prepareVenmoLink(handle: string) {
|
|
|
18
18
|
return cash.prepareVenmoGmailConnect(handle);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/** Native: open link.url with expo-web-browser's openAuthSessionAsync(url, returnUrl). */
|
|
22
|
+
export async function prepareNativeVenmoLink(handle: string, returnUrl: string) {
|
|
23
|
+
return cash.prepareVenmoGmailConnect(handle, { returnUrl });
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
/** Bind this to a click. Keep registration/other awaits outside the handler. */
|
|
22
27
|
export function linkVenmo(link: PreparedVenmoGmailConnect) {
|
|
23
28
|
return cash.openVenmoGmailConnect(link.payeeDetails).catch((error: unknown) => {
|
package/llms.txt
CHANGED
|
@@ -17,7 +17,11 @@ Key facts:
|
|
|
17
17
|
openVenmoGmailConnect(payeeDetails) opens the environment's hosted flow.
|
|
18
18
|
isVenmoGmailConnected(payeeDetails) checks for an active Google credential;
|
|
19
19
|
lookup errors reject. Cashout and prepare never call or require these steps.
|
|
20
|
-
|
|
20
|
+
Native hosts use prepareVenmoGmailConnect(handle, { returnUrl }) and open
|
|
21
|
+
link.url with Expo openAuthSessionAsync(link.url, returnUrl). Register the
|
|
22
|
+
app scheme in the binary; Peer needs no callback registration and appends
|
|
23
|
+
no data. Omitted/empty callbacks attempt closure; blocked tabs keep the
|
|
24
|
+
success page. Always check status on return or ambiguous popup closure.
|
|
21
25
|
Google-hosted school/custom domains are supported; actual receipt failures
|
|
22
26
|
use VenmoGmailConnectError.code, including venmo_google_oauth_receipt_not_found.
|
|
23
27
|
Partner apps receive neither emails nor Google tokens. Re-prepare when the
|
|
@@ -52,6 +56,11 @@ Key facts:
|
|
|
52
56
|
fillStats() separately.
|
|
53
57
|
- capabilities() exposes one Zelle platform. A zelle cashout attaches only the
|
|
54
58
|
generic Zelle payment method to the on-chain deposit.
|
|
59
|
+
- X Money supports USD with `platform: 'xmoney'`. Raw payees such as
|
|
60
|
+
'@YourHandle' become 'yourhandle'; structured offchainId values must already
|
|
61
|
+
be normalized. The receiving account must have X Money enabled; registration
|
|
62
|
+
does not verify account existence or enrollment. No identity attestation or
|
|
63
|
+
Peer Pay merchant policy is required.
|
|
55
64
|
- UPI/INR is available without feature flags. For example, use
|
|
56
65
|
`createCashClient({ environment: 'preproduction' })`.
|
|
57
66
|
Any valid UPI ID from any bank can receive without a seller login,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zkp2p/cash",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3-rc.0",
|
|
4
4
|
"description": "Peer Cash - offramp-only SDK for routing Relay or NEAR Intents assets to Base USDC, then cashing out to fiat at zero-spread Chainlink market rates.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Peer (https://peer.xyz)",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|
|
110
110
|
"@relayprotocol/relay-sdk": "^7.0.1",
|
|
111
|
-
"@zkp2p/sdk": "0.14.
|
|
111
|
+
"@zkp2p/sdk": "0.14.5-rc.0",
|
|
112
112
|
"zod": "^4.4.3"
|
|
113
113
|
},
|
|
114
114
|
"peerDependencies": {
|
|
@@ -188,6 +188,12 @@ UPI ID from any bank; do not add a seller bank-login, extension, identity
|
|
|
188
188
|
attestation, or pre-registration step. Buyers pay and verify through Amazon Pay using standard UPI; UPI Lite and
|
|
189
189
|
merchant payments are unsupported.
|
|
190
190
|
|
|
191
|
+
X Money accepts `receive: { platform: 'xmoney', currency: 'USD', payee: '@YourHandle' }`.
|
|
192
|
+
Raw handles normalize to the bare lowercase username. Structured payee data must
|
|
193
|
+
already use `offchainId: 'yourhandle'`. Confirm that the receiving account has
|
|
194
|
+
X Money enabled: registration does not verify account existence or enrollment.
|
|
195
|
+
No identity attestation or Peer Pay merchant policy is required.
|
|
196
|
+
|
|
191
197
|
## 4. Order management - indexer-native
|
|
192
198
|
|
|
193
199
|
- A cash order IS a deposit; the chain is the database. No storage layer.
|
|
@@ -293,15 +299,15 @@ button click. Re-prepare when the selected handle changes. Use
|
|
|
293
299
|
tab or an ambiguous closure; service errors reject, and only an active Google
|
|
294
300
|
credential counts as connected. Persist the hash with its environment and user.
|
|
295
301
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
branding
|
|
306
|
-
|
|
307
|
-
|
|
302
|
+
For native apps, use `prepareVenmoGmailConnect(handle, { returnUrl })` and
|
|
303
|
+
open `link.url` with Expo's `openAuthSessionAsync(link.url, returnUrl)`.
|
|
304
|
+
Register the scheme in your app binary; no registration with Peer is needed.
|
|
305
|
+
Peer appends no data to the callback. Omitted/empty callbacks attempt closure;
|
|
306
|
+
tabs that block it keep the success page. Always re-check status on return.
|
|
307
|
+
|
|
308
|
+
The hosted flow verifies actual Venmo receipts, including Google-hosted custom
|
|
309
|
+
inboxes. `VenmoGmailConnectError` is separate from `CashError`; no emails or
|
|
310
|
+
Google tokens reach the partner. Configure `venmoGmail: { appearance, popup }`
|
|
311
|
+
for branding and desktop dimensions; omission keeps Peer defaults.
|
|
312
|
+
See the README for error codes, native callbacks, package-free URLs, and
|
|
313
|
+
customization, plus `examples/venmo-link.ts`.
|