@zkp2p/cash 0.6.0-rc.1 → 0.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/AGENTS.md CHANGED
@@ -342,3 +342,20 @@ Alipay/CNY retains the Ethereum registry and `creationRateRpcUrl` /
342
342
  `creationRateTransport`. UPI rejects the wrong chain, invalid rounds, and
343
343
  observations older than 24 hours; market closures do not bypass freshness.
344
344
  UPI is available in production, preproduction, and staging without a feature flag.
345
+
346
+ ## Optional Venmo receipt linking
347
+
348
+ Offer this separately; `cashout()` and `prepare()` never require or invoke it.
349
+ Run `cash.prepareVenmoGmailConnect(handle)` when the user selects Venmo, then
350
+ call `cash.openVenmoGmailConnect(link.payeeDetails)` directly from a separate
351
+ button click. Re-prepare when the selected handle changes. Use
352
+ `cash.isVenmoGmailConnected(link.payeeDetails)` after returning from a mobile
353
+ tab or an ambiguous closure; service errors reject, and only an active Google
354
+ credential counts as connected. Persist the hash with its environment and user.
355
+
356
+ The hosted flow accepts Google-hosted school/custom domains and verifies actual
357
+ Venmo receipts. `VenmoGmailConnectError` retains codes such as
358
+ `venmo_google_oauth_receipt_not_found`, `popup_blocked`, `connection_closed`,
359
+ and `connection_timeout`; it is separate from `CashError`. No emails or Google
360
+ tokens reach the partner. `link.url` supports redirect/native hosts, which
361
+ must check status on return. See the README and `examples/venmo-link.ts`.
package/README.md CHANGED
@@ -144,6 +144,9 @@ arbitrary protocol operations.
144
144
 
145
145
  | Verb | What it does |
146
146
  | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
147
+ | `prepareVenmoGmailConnect(payee)` | Optional Venmo handle registration; returns the payee hash and hosted URL |
148
+ | `openVenmoGmailConnect(payeeDetails)` | Optional browser popup/tab; call directly from a click |
149
+ | `isVenmoGmailConnected(payeeDetails)` | Read whether an active Google receipt credential exists |
147
150
  | `capabilities()` | Sync discovery: Base USDC destination/default source, platforms × currencies × payee hints × amount bounds |
148
151
  | `capabilities({ includeRelaySources: true })` | Async discovery: adds live Relay SDK EVM source chains/tokens |
149
152
  | `capabilities({ includeNearIntentsSources: true })` | Async discovery: adds live NEAR Intents 1Click source assets |
@@ -182,6 +185,60 @@ indexed deposit is unsupported, `orders()` excludes the whole deposit and
182
185
  `order()` returns `ORDER_NOT_FOUND`; Peer Cash never partially reclassifies a
183
186
  mixed historical deposit.
184
187
 
188
+ ## Optional Venmo receipt linking
189
+
190
+ Partners such as Tailgate can offer **Link Venmo** separately from cash-out.
191
+ `cashout()` and `prepare()` never open Gmail, check receipt credentials, or
192
+ require this step. Skipping or cancelling linking leaves cash-out available.
193
+
194
+ ```ts
195
+ import { createCashClient, VenmoGmailConnectError } from '@zkp2p/cash';
196
+
197
+ const cash = createCashClient({ environment: 'production' });
198
+ // Run when the user selects their Venmo account, before enabling Link Venmo.
199
+ const link = await cash.prepareVenmoGmailConnect('@yourhandle');
200
+
201
+ // Call directly from the button click, with no async work before this call.
202
+ linkButton.onclick = () => {
203
+ cash.openVenmoGmailConnect(link.payeeDetails).catch((error: unknown) => {
204
+ if (error instanceof VenmoGmailConnectError) {
205
+ console.log(error.code, error.message);
206
+ }
207
+ });
208
+ };
209
+
210
+ // After completion, returning from a tab, or an ambiguous popup closure:
211
+ const connected = await cash.isVenmoGmailConnected(link.payeeDetails);
212
+ ```
213
+
214
+ The handle is registered with the environment's Curator and its authoritative
215
+ payee hash goes to the hosted link. Re-prepare if the selected handle changes.
216
+ Persist the hash with the environment and user account for later status checks.
217
+ `link.url` also works as a normal link for redirect or native-browser hosts;
218
+ those hosts must check status after the user returns.
219
+
220
+ Production uses `app.peer.xyz`, preproduction `ramp-preprod.peer.xyz`, and
221
+ staging `ramp-staging.peer.xyz`. `peerOrigin` and `curatorUrl` allow explicit
222
+ overrides. Browser helpers require no React, extension, wallet, or signer.
223
+ Preparation and status reads also work on the server.
224
+
225
+ Desktop opens a popup; mobile requests a new browser tab (including Safari).
226
+ The browser controls presentation and may sever the opener connection. In that
227
+ case check status rather than assuming `connection_closed` or
228
+ `connection_timeout` means verification failed. Status is true only for an
229
+ active `google_oauth` credential; lookup failures reject.
230
+
231
+ Gmail and Google-hosted school/custom-domain inboxes are accepted. The hosted
232
+ flow verifies actual receipts; there is no email-domain precheck. A missing
233
+ receipt reports `venmo_google_oauth_receipt_not_found` through
234
+ `VenmoGmailConnectError.code`. Cancellation, popup blocking, and other hosted
235
+ errors retain their codes. This error class is separate from `CashError`;
236
+ registration and status service errors also reject. Emails and Google tokens
237
+ never pass through the partner app or Cash SDK.
238
+
239
+ See [the browser example](examples/venmo-link.ts). JSON codecs are exported for
240
+ `PreparedVenmoGmailConnect` and `VenmoGmailConnectResult`.
241
+
185
242
  ## Payout rails and access policies
186
243
 
187
244
  | Payout rail | Access-policy behavior | New payee registration |
@@ -1,5 +1,5 @@
1
- import { Address, WalletClient, Hash, Hex, Log, Transport } from 'viem';
2
- import { IndexerIntentStatus, Zkp2pClient, IndexerIntent, CurrencyType, PreparedTransaction, RuntimeEnv } from '@zkp2p/sdk';
1
+ import { Address, Hash, WalletClient, Hex, Log, Transport } from 'viem';
2
+ import { IndexerIntentStatus, Zkp2pClient, IndexerIntent, CurrencyType, PreparedTransaction, RuntimeEnv, VenmoGmailConnectResult } from '@zkp2p/sdk';
3
3
  import { Execute, RelayClient, RelayChain, ProgressData } from '@relayprotocol/relay-sdk';
4
4
 
5
5
  /**
@@ -665,6 +665,10 @@ declare const CASH_ATTRIBUTION_CODE = "peer-cash";
665
665
  declare const CASH_REFERRAL_ATTRIBUTION_PREFIX = "peer-ref-";
666
666
  /** Convert a Peer referral code into its financially meaningful ERC-8021 marker. */
667
667
  declare function toCashReferralAttributionCode(rawCode: string): string;
668
+ interface PreparedVenmoGmailConnect {
669
+ payeeDetails: Hash;
670
+ url: string;
671
+ }
668
672
  interface CashClientOptions {
669
673
  /** `'production' | 'preproduction' | 'staging'` - selects contracts, curator, and indexer. */
670
674
  environment: RuntimeEnv;
@@ -678,6 +682,8 @@ interface CashClientOptions {
678
682
  indexerApiKey?: string;
679
683
  /** Curator (ZKP2P API) URL override. */
680
684
  curatorUrl?: string;
685
+ /** Peer web origin override for optional Venmo receipt linking. Defaults by environment. */
686
+ peerOrigin?: string;
681
687
  /** Optional ZKP2P API key. */
682
688
  apiKey?: string;
683
689
  /** Ethereum transport used only to snapshot Alipay/CNY's creation-time rate. */
@@ -850,6 +856,12 @@ interface OrdersOptions {
850
856
  limit?: number;
851
857
  }
852
858
  interface CashClient {
859
+ /** Optional: register the Venmo handle before enabling a separate link button. No deposit. */
860
+ prepareVenmoGmailConnect(payee: string): Promise<PreparedVenmoGmailConnect>;
861
+ /** Optional, browser-only: call directly from a click handler with the prepared payee hash. */
862
+ openVenmoGmailConnect(payeeDetails: Hash): Promise<VenmoGmailConnectResult>;
863
+ /** True only for an active Google receipt credential; errors reject instead of reporting unlinked. */
864
+ isVenmoGmailConnected(payeeDetails: Hash): Promise<boolean>;
853
865
  /** 0 - Discovery: sync, static. */
854
866
  capabilities(): CashCapabilities;
855
867
  /** 0b - Discovery with live Relay-supported EVM source chains/tokens. */
@@ -941,4 +953,4 @@ interface CashClient {
941
953
  }
942
954
  declare function createCashClient(options: CashClientOptions): CashClient;
943
955
 
944
- export { type EstimateOptions as $, type CashClient as A, BASE_CHAIN_ID as B, type CashPayoutInfo as C, type CashClientOptions as D, type CashCorridorPricing as E, type CashFillEta as F, type CashLeg as G, type CashMultiCurrencyLeg as H, type IntentEntity as I, type CashNextAction as J, type CashOrderState as K, type CashPairFillStats as L, type CashPayeeInput as M, type NearIntentsSourceCapabilities as N, type CashPayout as O, type PrepareResult as P, type CashPayoutPricing as Q, type RelayExecutionResult as R, type CashPlatformCapability as S, type TopUpResult as T, type CashPreparedStepKind as U, type CashReceiveLeg as V, type WithdrawResult as W, type CashoutInput as X, type CashoutOptions as Y, type CuratorPayeeDataInput as Z, type EstimateInput as _, type CashBuyerProfile as a, MARKET_SPREAD_BPS as a0, MIN_CASHOUT_AMOUNT as a1, NEAR_INTENTS_API_URL as a2, NEAR_INTENTS_BASE_USDC_ASSET_ID as a3, NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS as a4, NEAR_INTENTS_STATUSES as a5, type NearIntentsClient as a6, type NearIntentsOptions as a7, type NearIntentsQuoteRequest as a8, type NearIntentsStatusCode as a9, type NearIntentsToken as aa, type NearIntentsTradeType as ab, type NearIntentsTransaction as ac, ORACLE_MIN_CONVERSION_RATE_SENTINEL as ad, type OrdersOptions as ae, type PreparedCashoutReceipt as af, RECOMMENDED_MIN_CASHOUT_AMOUNT as ag, type RelayOptions as ah, type RelayQuoteInput as ai, type RelaySourceInput as aj, type RelayTransaction as ak, type SignerOptions as al, USDC_DECIMALS as am, type WatchOptions as an, type WithdrawOptions as ao, buildCapabilities as ap, createCashClient as aq, createNearIntentsClient as ar, normalizeCashPayee as as, quoteNearIntentsToBaseUsdc as at, readNearIntentsSourceCapabilities as au, readNearIntentsStatus as av, submitNearIntentsDeposit as aw, toCashReferralAttributionCode as ax, type CashDepositInput as b, type CreateDepositParamsArg as c, type CashOrder as d, type CashFill as e, type CashCapabilities as f, type CashoutResult as g, type CashEstimate as h, type CashFillStats as i, type NearIntentsDepositInput as j, type NearIntentsQuote as k, type NearIntentsQuoteInput as l, type NearIntentsStatus as m, type NearIntentsStatusInput as n, type CashPreparedStep as o, type RelayQuote as p, type RelayStatus as q, type CashSourceCapabilities as r, BASE_USDC_ADDRESS as s, CASH_ATTRIBUTION_CODE as t, CASH_ORDER_POLL_INTERVAL_MS as u, CASH_ORDER_STATUSES as v, CASH_REFERRAL_ATTRIBUTION_PREFIX as w, CASH_RETAIN_ON_EMPTY as x, type CashAsset as y, type CashChain as z };
956
+ export { type EstimateInput as $, type CashChain as A, BASE_CHAIN_ID as B, type CashPayoutInfo as C, type CashClient as D, type CashClientOptions as E, type CashCorridorPricing as F, type CashFillEta as G, type CashLeg as H, type IntentEntity as I, type CashMultiCurrencyLeg as J, type CashNextAction as K, type CashOrderState as L, type CashPairFillStats as M, type NearIntentsSourceCapabilities as N, type CashPayeeInput as O, type PrepareResult as P, type CashPayout as Q, type RelayExecutionResult as R, type CashPayoutPricing as S, type TopUpResult as T, type CashPlatformCapability as U, type CashPreparedStepKind as V, type WithdrawResult as W, type CashReceiveLeg as X, type CashoutInput as Y, type CashoutOptions as Z, type CuratorPayeeDataInput as _, type CashBuyerProfile as a, type EstimateOptions as a0, MARKET_SPREAD_BPS as a1, MIN_CASHOUT_AMOUNT as a2, NEAR_INTENTS_API_URL as a3, NEAR_INTENTS_BASE_USDC_ASSET_ID as a4, NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS as a5, NEAR_INTENTS_STATUSES as a6, type NearIntentsClient as a7, type NearIntentsOptions as a8, type NearIntentsQuoteRequest as a9, type NearIntentsStatusCode as aa, type NearIntentsToken as ab, type NearIntentsTradeType as ac, type NearIntentsTransaction as ad, ORACLE_MIN_CONVERSION_RATE_SENTINEL as ae, type OrdersOptions as af, type PreparedCashoutReceipt as ag, RECOMMENDED_MIN_CASHOUT_AMOUNT as ah, type RelayOptions as ai, type RelayQuoteInput as aj, type RelaySourceInput as ak, type RelayTransaction as al, type SignerOptions as am, USDC_DECIMALS as an, type WatchOptions as ao, type WithdrawOptions as ap, buildCapabilities as aq, createCashClient as ar, createNearIntentsClient as as, normalizeCashPayee as at, quoteNearIntentsToBaseUsdc as au, readNearIntentsSourceCapabilities as av, readNearIntentsStatus as aw, submitNearIntentsDeposit as ax, toCashReferralAttributionCode as ay, type CashDepositInput as b, type CreateDepositParamsArg as c, type CashOrder as d, type CashFill as e, type CashCapabilities as f, type CashoutResult as g, type CashEstimate as h, type CashFillStats as i, type NearIntentsDepositInput as j, type NearIntentsQuote as k, type NearIntentsQuoteInput as l, type NearIntentsStatus as m, type NearIntentsStatusInput as n, type CashPreparedStep as o, type PreparedVenmoGmailConnect as p, type RelayQuote as q, type RelayStatus as r, type CashSourceCapabilities as s, BASE_USDC_ADDRESS as t, CASH_ATTRIBUTION_CODE as u, CASH_ORDER_POLL_INTERVAL_MS as v, CASH_ORDER_STATUSES as w, CASH_REFERRAL_ATTRIBUTION_PREFIX as x, CASH_RETAIN_ON_EMPTY as y, type CashAsset as z };
@@ -1,5 +1,5 @@
1
- import { Address, WalletClient, Hash, Hex, Log, Transport } from 'viem';
2
- import { IndexerIntentStatus, Zkp2pClient, IndexerIntent, CurrencyType, PreparedTransaction, RuntimeEnv } from '@zkp2p/sdk';
1
+ import { Address, Hash, WalletClient, Hex, Log, Transport } from 'viem';
2
+ import { IndexerIntentStatus, Zkp2pClient, IndexerIntent, CurrencyType, PreparedTransaction, RuntimeEnv, VenmoGmailConnectResult } from '@zkp2p/sdk';
3
3
  import { Execute, RelayClient, RelayChain, ProgressData } from '@relayprotocol/relay-sdk';
4
4
 
5
5
  /**
@@ -665,6 +665,10 @@ declare const CASH_ATTRIBUTION_CODE = "peer-cash";
665
665
  declare const CASH_REFERRAL_ATTRIBUTION_PREFIX = "peer-ref-";
666
666
  /** Convert a Peer referral code into its financially meaningful ERC-8021 marker. */
667
667
  declare function toCashReferralAttributionCode(rawCode: string): string;
668
+ interface PreparedVenmoGmailConnect {
669
+ payeeDetails: Hash;
670
+ url: string;
671
+ }
668
672
  interface CashClientOptions {
669
673
  /** `'production' | 'preproduction' | 'staging'` - selects contracts, curator, and indexer. */
670
674
  environment: RuntimeEnv;
@@ -678,6 +682,8 @@ interface CashClientOptions {
678
682
  indexerApiKey?: string;
679
683
  /** Curator (ZKP2P API) URL override. */
680
684
  curatorUrl?: string;
685
+ /** Peer web origin override for optional Venmo receipt linking. Defaults by environment. */
686
+ peerOrigin?: string;
681
687
  /** Optional ZKP2P API key. */
682
688
  apiKey?: string;
683
689
  /** Ethereum transport used only to snapshot Alipay/CNY's creation-time rate. */
@@ -850,6 +856,12 @@ interface OrdersOptions {
850
856
  limit?: number;
851
857
  }
852
858
  interface CashClient {
859
+ /** Optional: register the Venmo handle before enabling a separate link button. No deposit. */
860
+ prepareVenmoGmailConnect(payee: string): Promise<PreparedVenmoGmailConnect>;
861
+ /** Optional, browser-only: call directly from a click handler with the prepared payee hash. */
862
+ openVenmoGmailConnect(payeeDetails: Hash): Promise<VenmoGmailConnectResult>;
863
+ /** True only for an active Google receipt credential; errors reject instead of reporting unlinked. */
864
+ isVenmoGmailConnected(payeeDetails: Hash): Promise<boolean>;
853
865
  /** 0 - Discovery: sync, static. */
854
866
  capabilities(): CashCapabilities;
855
867
  /** 0b - Discovery with live Relay-supported EVM source chains/tokens. */
@@ -941,4 +953,4 @@ interface CashClient {
941
953
  }
942
954
  declare function createCashClient(options: CashClientOptions): CashClient;
943
955
 
944
- export { type EstimateOptions as $, type CashClient as A, BASE_CHAIN_ID as B, type CashPayoutInfo as C, type CashClientOptions as D, type CashCorridorPricing as E, type CashFillEta as F, type CashLeg as G, type CashMultiCurrencyLeg as H, type IntentEntity as I, type CashNextAction as J, type CashOrderState as K, type CashPairFillStats as L, type CashPayeeInput as M, type NearIntentsSourceCapabilities as N, type CashPayout as O, type PrepareResult as P, type CashPayoutPricing as Q, type RelayExecutionResult as R, type CashPlatformCapability as S, type TopUpResult as T, type CashPreparedStepKind as U, type CashReceiveLeg as V, type WithdrawResult as W, type CashoutInput as X, type CashoutOptions as Y, type CuratorPayeeDataInput as Z, type EstimateInput as _, type CashBuyerProfile as a, MARKET_SPREAD_BPS as a0, MIN_CASHOUT_AMOUNT as a1, NEAR_INTENTS_API_URL as a2, NEAR_INTENTS_BASE_USDC_ASSET_ID as a3, NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS as a4, NEAR_INTENTS_STATUSES as a5, type NearIntentsClient as a6, type NearIntentsOptions as a7, type NearIntentsQuoteRequest as a8, type NearIntentsStatusCode as a9, type NearIntentsToken as aa, type NearIntentsTradeType as ab, type NearIntentsTransaction as ac, ORACLE_MIN_CONVERSION_RATE_SENTINEL as ad, type OrdersOptions as ae, type PreparedCashoutReceipt as af, RECOMMENDED_MIN_CASHOUT_AMOUNT as ag, type RelayOptions as ah, type RelayQuoteInput as ai, type RelaySourceInput as aj, type RelayTransaction as ak, type SignerOptions as al, USDC_DECIMALS as am, type WatchOptions as an, type WithdrawOptions as ao, buildCapabilities as ap, createCashClient as aq, createNearIntentsClient as ar, normalizeCashPayee as as, quoteNearIntentsToBaseUsdc as at, readNearIntentsSourceCapabilities as au, readNearIntentsStatus as av, submitNearIntentsDeposit as aw, toCashReferralAttributionCode as ax, type CashDepositInput as b, type CreateDepositParamsArg as c, type CashOrder as d, type CashFill as e, type CashCapabilities as f, type CashoutResult as g, type CashEstimate as h, type CashFillStats as i, type NearIntentsDepositInput as j, type NearIntentsQuote as k, type NearIntentsQuoteInput as l, type NearIntentsStatus as m, type NearIntentsStatusInput as n, type CashPreparedStep as o, type RelayQuote as p, type RelayStatus as q, type CashSourceCapabilities as r, BASE_USDC_ADDRESS as s, CASH_ATTRIBUTION_CODE as t, CASH_ORDER_POLL_INTERVAL_MS as u, CASH_ORDER_STATUSES as v, CASH_REFERRAL_ATTRIBUTION_PREFIX as w, CASH_RETAIN_ON_EMPTY as x, type CashAsset as y, type CashChain as z };
956
+ export { type EstimateInput as $, type CashChain as A, BASE_CHAIN_ID as B, type CashPayoutInfo as C, type CashClient as D, type CashClientOptions as E, type CashCorridorPricing as F, type CashFillEta as G, type CashLeg as H, type IntentEntity as I, type CashMultiCurrencyLeg as J, type CashNextAction as K, type CashOrderState as L, type CashPairFillStats as M, type NearIntentsSourceCapabilities as N, type CashPayeeInput as O, type PrepareResult as P, type CashPayout as Q, type RelayExecutionResult as R, type CashPayoutPricing as S, type TopUpResult as T, type CashPlatformCapability as U, type CashPreparedStepKind as V, type WithdrawResult as W, type CashReceiveLeg as X, type CashoutInput as Y, type CashoutOptions as Z, type CuratorPayeeDataInput as _, type CashBuyerProfile as a, type EstimateOptions as a0, MARKET_SPREAD_BPS as a1, MIN_CASHOUT_AMOUNT as a2, NEAR_INTENTS_API_URL as a3, NEAR_INTENTS_BASE_USDC_ASSET_ID as a4, NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS as a5, NEAR_INTENTS_STATUSES as a6, type NearIntentsClient as a7, type NearIntentsOptions as a8, type NearIntentsQuoteRequest as a9, type NearIntentsStatusCode as aa, type NearIntentsToken as ab, type NearIntentsTradeType as ac, type NearIntentsTransaction as ad, ORACLE_MIN_CONVERSION_RATE_SENTINEL as ae, type OrdersOptions as af, type PreparedCashoutReceipt as ag, RECOMMENDED_MIN_CASHOUT_AMOUNT as ah, type RelayOptions as ai, type RelayQuoteInput as aj, type RelaySourceInput as ak, type RelayTransaction as al, type SignerOptions as am, USDC_DECIMALS as an, type WatchOptions as ao, type WithdrawOptions as ap, buildCapabilities as aq, createCashClient as ar, createNearIntentsClient as as, normalizeCashPayee as at, quoteNearIntentsToBaseUsdc as au, readNearIntentsSourceCapabilities as av, readNearIntentsStatus as aw, submitNearIntentsDeposit as ax, toCashReferralAttributionCode as ay, type CashDepositInput as b, type CreateDepositParamsArg as c, type CashOrder as d, type CashFill as e, type CashCapabilities as f, type CashoutResult as g, type CashEstimate as h, type CashFillStats as i, type NearIntentsDepositInput as j, type NearIntentsQuote as k, type NearIntentsQuoteInput as l, type NearIntentsStatus as m, type NearIntentsStatusInput as n, type CashPreparedStep as o, type PreparedVenmoGmailConnect as p, type RelayQuote as q, type RelayStatus as r, type CashSourceCapabilities as s, BASE_USDC_ADDRESS as t, CASH_ATTRIBUTION_CODE as u, CASH_ORDER_POLL_INTERVAL_MS as v, CASH_ORDER_STATUSES as w, CASH_REFERRAL_ATTRIBUTION_PREFIX as x, CASH_RETAIN_ON_EMPTY as y, type CashAsset as z };
package/dist/index.cjs CHANGED
@@ -2466,6 +2466,12 @@ var cashErrorJsonSchema = zod.z.object({
2466
2466
  remediation: zod.z.string(),
2467
2467
  recovery: cashErrorRecoveryJsonSchema.optional()
2468
2468
  }).strict();
2469
+ var venmoGmailConnectResultJsonSchema = zod.z.object({
2470
+ payeeDetails: zod.z.string().regex(/^0x[0-9a-f]{64}$/i)
2471
+ });
2472
+ var preparedVenmoGmailConnectJsonSchema = venmoGmailConnectResultJsonSchema.extend({
2473
+ url: zod.z.url()
2474
+ });
2469
2475
 
2470
2476
  // src/client/nearIntents.ts
2471
2477
  var NEAR_INTENTS_API_URL = "https://1click.chaindefuser.com";
@@ -2856,6 +2862,11 @@ var DEFAULT_CURATOR_URLS = {
2856
2862
  preproduction: "https://api-preprod.zkp2p.xyz",
2857
2863
  staging: "https://api-staging.zkp2p.xyz"
2858
2864
  };
2865
+ var DEFAULT_PEER_ORIGINS = {
2866
+ production: "https://app.peer.xyz",
2867
+ preproduction: "https://ramp-preprod.peer.xyz",
2868
+ staging: "https://ramp-staging.peer.xyz"
2869
+ };
2859
2870
  var ERC20_APPROVE_ABI = viem.parseAbi([
2860
2871
  "function approve(address spender, uint256 amount) returns (bool)"
2861
2872
  ]);
@@ -3418,6 +3429,31 @@ function createCashClient(options) {
3418
3429
  return hashes;
3419
3430
  }
3420
3431
  return {
3432
+ async prepareVenmoGmailConnect(payee) {
3433
+ const { hashedOnchainIds } = await readClient.registerPayeeDetails({
3434
+ processorNames: ["venmo"],
3435
+ payeeData: [normalizeCashPayee("venmo", payee)]
3436
+ });
3437
+ const payeeDetails = hashedOnchainIds[0];
3438
+ const url = sdk.getVenmoGmailConnectUrl({
3439
+ payeeDetails,
3440
+ peerOrigin: options.peerOrigin ?? DEFAULT_PEER_ORIGINS[environment]
3441
+ });
3442
+ return { payeeDetails, url };
3443
+ },
3444
+ openVenmoGmailConnect(payeeDetails) {
3445
+ return sdk.openVenmoGmailConnect({
3446
+ payeeDetails,
3447
+ peerOrigin: options.peerOrigin ?? DEFAULT_PEER_ORIGINS[environment]
3448
+ });
3449
+ },
3450
+ async isVenmoGmailConnected(payeeDetails) {
3451
+ const { responseObject } = await readClient.getSellerCredentialStatus({
3452
+ processorName: "venmo",
3453
+ payeeDetails
3454
+ });
3455
+ return responseObject.status === "active" && responseObject.credentialType === "google_oauth";
3456
+ },
3421
3457
  capabilities,
3422
3458
  async sourceCapabilities() {
3423
3459
  return readRelaySourceCapabilities(options.relay);
@@ -4501,7 +4537,28 @@ function cashErrorFromJson(json) {
4501
4537
  ...recovery ? { recovery } : {}
4502
4538
  });
4503
4539
  }
4540
+ function preparedVenmoGmailConnectToJson(value) {
4541
+ return preparedVenmoGmailConnectJsonSchema.parse(value);
4542
+ }
4543
+ function preparedVenmoGmailConnectFromJson(json) {
4544
+ const parsed = preparedVenmoGmailConnectJsonSchema.parse(json);
4545
+ return {
4546
+ ...parsed,
4547
+ payeeDetails: parsed.payeeDetails
4548
+ };
4549
+ }
4550
+ function venmoGmailConnectResultToJson(value) {
4551
+ return venmoGmailConnectResultJsonSchema.parse(value);
4552
+ }
4553
+ function venmoGmailConnectResultFromJson(json) {
4554
+ const parsed = venmoGmailConnectResultJsonSchema.parse(json);
4555
+ return { payeeDetails: parsed.payeeDetails };
4556
+ }
4504
4557
 
4558
+ Object.defineProperty(exports, "VenmoGmailConnectError", {
4559
+ enumerable: true,
4560
+ get: function () { return sdk.VenmoGmailConnectError; }
4561
+ });
4505
4562
  exports.BASE_CHAIN_ID = BASE_CHAIN_ID;
4506
4563
  exports.BASE_USDC_ADDRESS = BASE_USDC_ADDRESS;
4507
4564
  exports.CASH_ATTRIBUTION_CODE = CASH_ATTRIBUTION_CODE;
@@ -4614,6 +4671,9 @@ exports.preparedStepToJson = preparedStepToJson;
4614
4671
  exports.preparedTransactionJsonSchema = preparedTransactionJsonSchema;
4615
4672
  exports.preparedTxFromJson = preparedTxFromJson;
4616
4673
  exports.preparedTxToJson = preparedTxToJson;
4674
+ exports.preparedVenmoGmailConnectFromJson = preparedVenmoGmailConnectFromJson;
4675
+ exports.preparedVenmoGmailConnectJsonSchema = preparedVenmoGmailConnectJsonSchema;
4676
+ exports.preparedVenmoGmailConnectToJson = preparedVenmoGmailConnectToJson;
4617
4677
  exports.quoteNearIntentsToBaseUsdc = quoteNearIntentsToBaseUsdc;
4618
4678
  exports.rateToNumber = rateToNumber;
4619
4679
  exports.readAlipayCnyCreationRate = readAlipayCnyCreationRate;
@@ -4639,6 +4699,9 @@ exports.topUpResultFromJson = topUpResultFromJson;
4639
4699
  exports.topUpResultJsonSchema = topUpResultJsonSchema;
4640
4700
  exports.topUpResultToJson = topUpResultToJson;
4641
4701
  exports.usdc = usdc;
4702
+ exports.venmoGmailConnectResultFromJson = venmoGmailConnectResultFromJson;
4703
+ exports.venmoGmailConnectResultJsonSchema = venmoGmailConnectResultJsonSchema;
4704
+ exports.venmoGmailConnectResultToJson = venmoGmailConnectResultToJson;
4642
4705
  exports.withExplain = withExplain;
4643
4706
  exports.withdrawResultFromJson = withdrawResultFromJson;
4644
4707
  exports.withdrawResultJsonSchema = withdrawResultJsonSchema;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
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, R as RelayExecutionResult, p as RelayQuote, q as RelayStatus, r as CashSourceCapabilities, T as TopUpResult, W as WithdrawResult } from './createCashClient-94tPE0dH.cjs';
2
- export { B as BASE_CHAIN_ID, s as BASE_USDC_ADDRESS, t as CASH_ATTRIBUTION_CODE, u as CASH_ORDER_POLL_INTERVAL_MS, v as CASH_ORDER_STATUSES, w as CASH_REFERRAL_ATTRIBUTION_PREFIX, x as CASH_RETAIN_ON_EMPTY, y as CashAsset, z as CashChain, A as CashClient, D as CashClientOptions, E as CashCorridorPricing, F as CashFillEta, G as CashLeg, H as CashMultiCurrencyLeg, J as CashNextAction, K as CashOrderState, L as CashPairFillStats, M as CashPayeeInput, O as CashPayout, Q as CashPayoutPricing, S as CashPlatformCapability, U as CashPreparedStepKind, V as CashReceiveLeg, X as CashoutInput, Y as CashoutOptions, Z as CuratorPayeeDataInput, _ as EstimateInput, $ as EstimateOptions, a0 as MARKET_SPREAD_BPS, a1 as MIN_CASHOUT_AMOUNT, a2 as NEAR_INTENTS_API_URL, a3 as NEAR_INTENTS_BASE_USDC_ASSET_ID, a4 as NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS, a5 as NEAR_INTENTS_STATUSES, a6 as NearIntentsClient, a7 as NearIntentsOptions, a8 as NearIntentsQuoteRequest, a9 as NearIntentsStatusCode, aa as NearIntentsToken, ab as NearIntentsTradeType, ac as NearIntentsTransaction, ad as ORACLE_MIN_CONVERSION_RATE_SENTINEL, ae as OrdersOptions, af as PreparedCashoutReceipt, ag as RECOMMENDED_MIN_CASHOUT_AMOUNT, ah as RelayOptions, ai as RelayQuoteInput, aj as RelaySourceInput, ak as RelayTransaction, al as SignerOptions, am as USDC_DECIMALS, an as WatchOptions, ao as WithdrawOptions, ap as buildCapabilities, aq as createCashClient, ar as createNearIntentsClient, as as normalizeCashPayee, at as quoteNearIntentsToBaseUsdc, au as readNearIntentsSourceCapabilities, av as readNearIntentsStatus, aw as submitNearIntentsDeposit, ax as toCashReferralAttributionCode } from './createCashClient-94tPE0dH.cjs';
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-CZgoTClw.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-CZgoTClw.cjs';
3
3
  import { PublicClient, Log, Abi } from 'viem';
4
- import { PaymentMethodCatalog, CurrencyType, OracleAdapterOverrides, OnchainCurrency, Zkp2pClient, PreparedTransaction } from '@zkp2p/sdk';
5
- export { CurrencyType, PreparedTransaction, RuntimeEnv } from '@zkp2p/sdk';
4
+ import { PaymentMethodCatalog, CurrencyType, OracleAdapterOverrides, OnchainCurrency, Zkp2pClient, PreparedTransaction, VenmoGmailConnectResult } from '@zkp2p/sdk';
5
+ export { CurrencyType, PreparedTransaction, RuntimeEnv, VenmoGmailConnectError, VenmoGmailConnectResult } from '@zkp2p/sdk';
6
6
  import { z } from 'zod';
7
7
  import '@relayprotocol/relay-sdk';
8
8
 
@@ -1540,6 +1540,15 @@ type RelayStatusJson = z.infer<typeof relayStatusJsonSchema>;
1540
1540
  type RelayExecutionResultJson = z.infer<typeof relayExecutionResultJsonSchema>;
1541
1541
  type CashErrorRecoveryJson = z.infer<typeof cashErrorRecoveryJsonSchema>;
1542
1542
  type CashErrorJson = z.infer<typeof cashErrorJsonSchema>;
1543
+ declare const venmoGmailConnectResultJsonSchema: z.ZodObject<{
1544
+ payeeDetails: z.ZodString;
1545
+ }, z.core.$strip>;
1546
+ declare const preparedVenmoGmailConnectJsonSchema: z.ZodObject<{
1547
+ payeeDetails: z.ZodString;
1548
+ url: z.ZodURL;
1549
+ }, z.core.$strip>;
1550
+ type VenmoGmailConnectResultJson = z.infer<typeof venmoGmailConnectResultJsonSchema>;
1551
+ type PreparedVenmoGmailConnectJson = z.infer<typeof preparedVenmoGmailConnectJsonSchema>;
1543
1552
 
1544
1553
  /**
1545
1554
  * JSON codecs - lossless (de)serialization for every wire type. bigints encode
@@ -1593,5 +1602,9 @@ declare function capabilitiesToJson(caps: CashCapabilities): CashCapabilitiesJso
1593
1602
  declare function capabilitiesFromJson(json: unknown): CashCapabilities;
1594
1603
  declare function cashErrorToJson(error: CashErrorShape): CashErrorJson;
1595
1604
  declare function cashErrorFromJson(json: unknown): CashError;
1605
+ declare function preparedVenmoGmailConnectToJson(value: PreparedVenmoGmailConnect): PreparedVenmoGmailConnectJson;
1606
+ declare function preparedVenmoGmailConnectFromJson(json: unknown): PreparedVenmoGmailConnect;
1607
+ declare function venmoGmailConnectResultToJson(value: VenmoGmailConnectResult): VenmoGmailConnectResultJson;
1608
+ declare function venmoGmailConnectResultFromJson(json: unknown): VenmoGmailConnectResult;
1596
1609
 
1597
- export { CREATION_RATE_MAX_STALENESS_SECONDS, type CashAssetJson, CashBuyerProfile, type CashBuyerProfileJson, CashCapabilities, type CashCapabilitiesJson, type CashChainJson, CashDepositInput, CashError, type CashErrorCode, type CashErrorJson, type CashErrorRecovery, type CashErrorRecoveryJson, type CashErrorShape, CashEstimate, type CashEstimateJson, CashFill, type CashFillJson, CashFillStats, type CashFillStatsJson, CashOrder, type CashOrderData, type CashOrderJson, CashPayoutInfo, type CashPayoutInfoJson, CashPreparedStep, type CashPreparedStepJson, CashSourceCapabilities, type CashSourceCapabilitiesJson, CashoutResult, type CashoutResultJson, type CreationRateReader, type CreationRateSnapshot, type DeriveCashOrderOptions, type MethodCurrencyLike, NearIntentsDepositInput, type NearIntentsDepositInputJson, NearIntentsQuote, NearIntentsQuoteInput, type NearIntentsQuoteInputJson, type NearIntentsQuoteJson, NearIntentsSourceCapabilities, type NearIntentsSourceCapabilitiesJson, NearIntentsStatus, NearIntentsStatusInput, type NearIntentsStatusInputJson, type NearIntentsStatusJson, type NearIntentsTokenJson, type PaymentMethodLike, PrepareResult, type PrepareResultJson, type PreparedTransactionJson, RATE_PRECISION, RelayExecutionResult, type RelayExecutionResultJson, RelayQuote, type RelayQuoteJson, RelayStatus, type RelayStatusJson, type RelayTransactionJson, type RelayTransactionsJson, type ResolvedCashDeposit, TopUpResult, type TopUpResultJson, WithdrawResult, type WithdrawResultJson, bigintString, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashFillStatsJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPairFillStatsJsonSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, deriveBuyerProfile, deriveCashOrder, derivePayouts, errors, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillStatsFromJson, fillStatsToJson, fillToJson, formatUsdc, intentStatusSchema, isCashCorridorSupported, isCashError, isCreationRateCorridor, isFillLive, isMarketRateSupported, isUserRejectedError, nearIntentsCapabilitiesFromJson, nearIntentsCapabilitiesToJson, nearIntentsDepositInputFromJson, nearIntentsDepositInputJsonSchema, nearIntentsDepositInputToJson, nearIntentsQuoteFromJson, nearIntentsQuoteInputFromJson, nearIntentsQuoteInputJsonSchema, nearIntentsQuoteInputToJson, nearIntentsQuoteJsonSchema, nearIntentsQuoteRequestJsonSchema, nearIntentsQuoteResponseSchema, nearIntentsQuoteToJson, nearIntentsSourceCapabilitiesJsonSchema, nearIntentsStatusCodeSchema, nearIntentsStatusFromJson, nearIntentsStatusInputFromJson, nearIntentsStatusInputJsonSchema, nearIntentsStatusInputToJson, nearIntentsStatusJsonSchema, nearIntentsStatusResponseSchema, nearIntentsStatusToJson, nearIntentsTokenJsonSchema, nearIntentsTokensResponseSchema, nearIntentsTransactionJsonSchema, nonNegativeBigintString, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, rateToNumber, readAlipayCnyCreationRate, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
1610
+ export { CREATION_RATE_MAX_STALENESS_SECONDS, type CashAssetJson, CashBuyerProfile, type CashBuyerProfileJson, CashCapabilities, type CashCapabilitiesJson, type CashChainJson, CashDepositInput, CashError, type CashErrorCode, type CashErrorJson, type CashErrorRecovery, type CashErrorRecoveryJson, type CashErrorShape, CashEstimate, type CashEstimateJson, CashFill, type CashFillJson, CashFillStats, type CashFillStatsJson, CashOrder, type CashOrderData, type CashOrderJson, CashPayoutInfo, type CashPayoutInfoJson, CashPreparedStep, type CashPreparedStepJson, CashSourceCapabilities, type CashSourceCapabilitiesJson, CashoutResult, type CashoutResultJson, type CreationRateReader, type CreationRateSnapshot, type DeriveCashOrderOptions, type MethodCurrencyLike, NearIntentsDepositInput, type NearIntentsDepositInputJson, NearIntentsQuote, NearIntentsQuoteInput, type NearIntentsQuoteInputJson, type NearIntentsQuoteJson, NearIntentsSourceCapabilities, type NearIntentsSourceCapabilitiesJson, NearIntentsStatus, NearIntentsStatusInput, type NearIntentsStatusInputJson, type NearIntentsStatusJson, type NearIntentsTokenJson, type PaymentMethodLike, PrepareResult, type PrepareResultJson, type PreparedTransactionJson, PreparedVenmoGmailConnect, type PreparedVenmoGmailConnectJson, RATE_PRECISION, RelayExecutionResult, type RelayExecutionResultJson, RelayQuote, type RelayQuoteJson, RelayStatus, type RelayStatusJson, type RelayTransactionJson, type RelayTransactionsJson, type ResolvedCashDeposit, TopUpResult, type TopUpResultJson, type VenmoGmailConnectResultJson, WithdrawResult, type WithdrawResultJson, bigintString, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashFillStatsJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPairFillStatsJsonSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, deriveBuyerProfile, deriveCashOrder, derivePayouts, errors, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillStatsFromJson, fillStatsToJson, fillToJson, formatUsdc, intentStatusSchema, isCashCorridorSupported, isCashError, isCreationRateCorridor, isFillLive, isMarketRateSupported, isUserRejectedError, nearIntentsCapabilitiesFromJson, nearIntentsCapabilitiesToJson, nearIntentsDepositInputFromJson, nearIntentsDepositInputJsonSchema, nearIntentsDepositInputToJson, nearIntentsQuoteFromJson, nearIntentsQuoteInputFromJson, nearIntentsQuoteInputJsonSchema, nearIntentsQuoteInputToJson, nearIntentsQuoteJsonSchema, nearIntentsQuoteRequestJsonSchema, nearIntentsQuoteResponseSchema, nearIntentsQuoteToJson, nearIntentsSourceCapabilitiesJsonSchema, nearIntentsStatusCodeSchema, nearIntentsStatusFromJson, nearIntentsStatusInputFromJson, nearIntentsStatusInputJsonSchema, nearIntentsStatusInputToJson, nearIntentsStatusJsonSchema, nearIntentsStatusResponseSchema, nearIntentsStatusToJson, nearIntentsTokenJsonSchema, nearIntentsTokensResponseSchema, nearIntentsTransactionJsonSchema, nonNegativeBigintString, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, preparedVenmoGmailConnectFromJson, preparedVenmoGmailConnectJsonSchema, preparedVenmoGmailConnectToJson, rateToNumber, readAlipayCnyCreationRate, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, venmoGmailConnectResultFromJson, venmoGmailConnectResultJsonSchema, venmoGmailConnectResultToJson, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
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, R as RelayExecutionResult, p as RelayQuote, q as RelayStatus, r as CashSourceCapabilities, T as TopUpResult, W as WithdrawResult } from './createCashClient-94tPE0dH.js';
2
- export { B as BASE_CHAIN_ID, s as BASE_USDC_ADDRESS, t as CASH_ATTRIBUTION_CODE, u as CASH_ORDER_POLL_INTERVAL_MS, v as CASH_ORDER_STATUSES, w as CASH_REFERRAL_ATTRIBUTION_PREFIX, x as CASH_RETAIN_ON_EMPTY, y as CashAsset, z as CashChain, A as CashClient, D as CashClientOptions, E as CashCorridorPricing, F as CashFillEta, G as CashLeg, H as CashMultiCurrencyLeg, J as CashNextAction, K as CashOrderState, L as CashPairFillStats, M as CashPayeeInput, O as CashPayout, Q as CashPayoutPricing, S as CashPlatformCapability, U as CashPreparedStepKind, V as CashReceiveLeg, X as CashoutInput, Y as CashoutOptions, Z as CuratorPayeeDataInput, _ as EstimateInput, $ as EstimateOptions, a0 as MARKET_SPREAD_BPS, a1 as MIN_CASHOUT_AMOUNT, a2 as NEAR_INTENTS_API_URL, a3 as NEAR_INTENTS_BASE_USDC_ASSET_ID, a4 as NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS, a5 as NEAR_INTENTS_STATUSES, a6 as NearIntentsClient, a7 as NearIntentsOptions, a8 as NearIntentsQuoteRequest, a9 as NearIntentsStatusCode, aa as NearIntentsToken, ab as NearIntentsTradeType, ac as NearIntentsTransaction, ad as ORACLE_MIN_CONVERSION_RATE_SENTINEL, ae as OrdersOptions, af as PreparedCashoutReceipt, ag as RECOMMENDED_MIN_CASHOUT_AMOUNT, ah as RelayOptions, ai as RelayQuoteInput, aj as RelaySourceInput, ak as RelayTransaction, al as SignerOptions, am as USDC_DECIMALS, an as WatchOptions, ao as WithdrawOptions, ap as buildCapabilities, aq as createCashClient, ar as createNearIntentsClient, as as normalizeCashPayee, at as quoteNearIntentsToBaseUsdc, au as readNearIntentsSourceCapabilities, av as readNearIntentsStatus, aw as submitNearIntentsDeposit, ax as toCashReferralAttributionCode } from './createCashClient-94tPE0dH.js';
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-CZgoTClw.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-CZgoTClw.js';
3
3
  import { PublicClient, Log, Abi } from 'viem';
4
- import { PaymentMethodCatalog, CurrencyType, OracleAdapterOverrides, OnchainCurrency, Zkp2pClient, PreparedTransaction } from '@zkp2p/sdk';
5
- export { CurrencyType, PreparedTransaction, RuntimeEnv } from '@zkp2p/sdk';
4
+ import { PaymentMethodCatalog, CurrencyType, OracleAdapterOverrides, OnchainCurrency, Zkp2pClient, PreparedTransaction, VenmoGmailConnectResult } from '@zkp2p/sdk';
5
+ export { CurrencyType, PreparedTransaction, RuntimeEnv, VenmoGmailConnectError, VenmoGmailConnectResult } from '@zkp2p/sdk';
6
6
  import { z } from 'zod';
7
7
  import '@relayprotocol/relay-sdk';
8
8
 
@@ -1540,6 +1540,15 @@ type RelayStatusJson = z.infer<typeof relayStatusJsonSchema>;
1540
1540
  type RelayExecutionResultJson = z.infer<typeof relayExecutionResultJsonSchema>;
1541
1541
  type CashErrorRecoveryJson = z.infer<typeof cashErrorRecoveryJsonSchema>;
1542
1542
  type CashErrorJson = z.infer<typeof cashErrorJsonSchema>;
1543
+ declare const venmoGmailConnectResultJsonSchema: z.ZodObject<{
1544
+ payeeDetails: z.ZodString;
1545
+ }, z.core.$strip>;
1546
+ declare const preparedVenmoGmailConnectJsonSchema: z.ZodObject<{
1547
+ payeeDetails: z.ZodString;
1548
+ url: z.ZodURL;
1549
+ }, z.core.$strip>;
1550
+ type VenmoGmailConnectResultJson = z.infer<typeof venmoGmailConnectResultJsonSchema>;
1551
+ type PreparedVenmoGmailConnectJson = z.infer<typeof preparedVenmoGmailConnectJsonSchema>;
1543
1552
 
1544
1553
  /**
1545
1554
  * JSON codecs - lossless (de)serialization for every wire type. bigints encode
@@ -1593,5 +1602,9 @@ declare function capabilitiesToJson(caps: CashCapabilities): CashCapabilitiesJso
1593
1602
  declare function capabilitiesFromJson(json: unknown): CashCapabilities;
1594
1603
  declare function cashErrorToJson(error: CashErrorShape): CashErrorJson;
1595
1604
  declare function cashErrorFromJson(json: unknown): CashError;
1605
+ declare function preparedVenmoGmailConnectToJson(value: PreparedVenmoGmailConnect): PreparedVenmoGmailConnectJson;
1606
+ declare function preparedVenmoGmailConnectFromJson(json: unknown): PreparedVenmoGmailConnect;
1607
+ declare function venmoGmailConnectResultToJson(value: VenmoGmailConnectResult): VenmoGmailConnectResultJson;
1608
+ declare function venmoGmailConnectResultFromJson(json: unknown): VenmoGmailConnectResult;
1596
1609
 
1597
- export { CREATION_RATE_MAX_STALENESS_SECONDS, type CashAssetJson, CashBuyerProfile, type CashBuyerProfileJson, CashCapabilities, type CashCapabilitiesJson, type CashChainJson, CashDepositInput, CashError, type CashErrorCode, type CashErrorJson, type CashErrorRecovery, type CashErrorRecoveryJson, type CashErrorShape, CashEstimate, type CashEstimateJson, CashFill, type CashFillJson, CashFillStats, type CashFillStatsJson, CashOrder, type CashOrderData, type CashOrderJson, CashPayoutInfo, type CashPayoutInfoJson, CashPreparedStep, type CashPreparedStepJson, CashSourceCapabilities, type CashSourceCapabilitiesJson, CashoutResult, type CashoutResultJson, type CreationRateReader, type CreationRateSnapshot, type DeriveCashOrderOptions, type MethodCurrencyLike, NearIntentsDepositInput, type NearIntentsDepositInputJson, NearIntentsQuote, NearIntentsQuoteInput, type NearIntentsQuoteInputJson, type NearIntentsQuoteJson, NearIntentsSourceCapabilities, type NearIntentsSourceCapabilitiesJson, NearIntentsStatus, NearIntentsStatusInput, type NearIntentsStatusInputJson, type NearIntentsStatusJson, type NearIntentsTokenJson, type PaymentMethodLike, PrepareResult, type PrepareResultJson, type PreparedTransactionJson, RATE_PRECISION, RelayExecutionResult, type RelayExecutionResultJson, RelayQuote, type RelayQuoteJson, RelayStatus, type RelayStatusJson, type RelayTransactionJson, type RelayTransactionsJson, type ResolvedCashDeposit, TopUpResult, type TopUpResultJson, WithdrawResult, type WithdrawResultJson, bigintString, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashFillStatsJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPairFillStatsJsonSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, deriveBuyerProfile, deriveCashOrder, derivePayouts, errors, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillStatsFromJson, fillStatsToJson, fillToJson, formatUsdc, intentStatusSchema, isCashCorridorSupported, isCashError, isCreationRateCorridor, isFillLive, isMarketRateSupported, isUserRejectedError, nearIntentsCapabilitiesFromJson, nearIntentsCapabilitiesToJson, nearIntentsDepositInputFromJson, nearIntentsDepositInputJsonSchema, nearIntentsDepositInputToJson, nearIntentsQuoteFromJson, nearIntentsQuoteInputFromJson, nearIntentsQuoteInputJsonSchema, nearIntentsQuoteInputToJson, nearIntentsQuoteJsonSchema, nearIntentsQuoteRequestJsonSchema, nearIntentsQuoteResponseSchema, nearIntentsQuoteToJson, nearIntentsSourceCapabilitiesJsonSchema, nearIntentsStatusCodeSchema, nearIntentsStatusFromJson, nearIntentsStatusInputFromJson, nearIntentsStatusInputJsonSchema, nearIntentsStatusInputToJson, nearIntentsStatusJsonSchema, nearIntentsStatusResponseSchema, nearIntentsStatusToJson, nearIntentsTokenJsonSchema, nearIntentsTokensResponseSchema, nearIntentsTransactionJsonSchema, nonNegativeBigintString, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, rateToNumber, readAlipayCnyCreationRate, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
1610
+ export { CREATION_RATE_MAX_STALENESS_SECONDS, type CashAssetJson, CashBuyerProfile, type CashBuyerProfileJson, CashCapabilities, type CashCapabilitiesJson, type CashChainJson, CashDepositInput, CashError, type CashErrorCode, type CashErrorJson, type CashErrorRecovery, type CashErrorRecoveryJson, type CashErrorShape, CashEstimate, type CashEstimateJson, CashFill, type CashFillJson, CashFillStats, type CashFillStatsJson, CashOrder, type CashOrderData, type CashOrderJson, CashPayoutInfo, type CashPayoutInfoJson, CashPreparedStep, type CashPreparedStepJson, CashSourceCapabilities, type CashSourceCapabilitiesJson, CashoutResult, type CashoutResultJson, type CreationRateReader, type CreationRateSnapshot, type DeriveCashOrderOptions, type MethodCurrencyLike, NearIntentsDepositInput, type NearIntentsDepositInputJson, NearIntentsQuote, NearIntentsQuoteInput, type NearIntentsQuoteInputJson, type NearIntentsQuoteJson, NearIntentsSourceCapabilities, type NearIntentsSourceCapabilitiesJson, NearIntentsStatus, NearIntentsStatusInput, type NearIntentsStatusInputJson, type NearIntentsStatusJson, type NearIntentsTokenJson, type PaymentMethodLike, PrepareResult, type PrepareResultJson, type PreparedTransactionJson, PreparedVenmoGmailConnect, type PreparedVenmoGmailConnectJson, RATE_PRECISION, RelayExecutionResult, type RelayExecutionResultJson, RelayQuote, type RelayQuoteJson, RelayStatus, type RelayStatusJson, type RelayTransactionJson, type RelayTransactionsJson, type ResolvedCashDeposit, TopUpResult, type TopUpResultJson, type VenmoGmailConnectResultJson, WithdrawResult, type WithdrawResultJson, bigintString, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashFillStatsJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPairFillStatsJsonSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, deriveBuyerProfile, deriveCashOrder, derivePayouts, errors, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillStatsFromJson, fillStatsToJson, fillToJson, formatUsdc, intentStatusSchema, isCashCorridorSupported, isCashError, isCreationRateCorridor, isFillLive, isMarketRateSupported, isUserRejectedError, nearIntentsCapabilitiesFromJson, nearIntentsCapabilitiesToJson, nearIntentsDepositInputFromJson, nearIntentsDepositInputJsonSchema, nearIntentsDepositInputToJson, nearIntentsQuoteFromJson, nearIntentsQuoteInputFromJson, nearIntentsQuoteInputJsonSchema, nearIntentsQuoteInputToJson, nearIntentsQuoteJsonSchema, nearIntentsQuoteRequestJsonSchema, nearIntentsQuoteResponseSchema, nearIntentsQuoteToJson, nearIntentsSourceCapabilitiesJsonSchema, nearIntentsStatusCodeSchema, nearIntentsStatusFromJson, nearIntentsStatusInputFromJson, nearIntentsStatusInputJsonSchema, nearIntentsStatusInputToJson, nearIntentsStatusJsonSchema, nearIntentsStatusResponseSchema, nearIntentsStatusToJson, nearIntentsTokenJsonSchema, nearIntentsTokensResponseSchema, nearIntentsTransactionJsonSchema, nonNegativeBigintString, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, preparedVenmoGmailConnectFromJson, preparedVenmoGmailConnectJsonSchema, preparedVenmoGmailConnectToJson, rateToNumber, readAlipayCnyCreationRate, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, venmoGmailConnectResultFromJson, venmoGmailConnectResultJsonSchema, venmoGmailConnectResultToJson, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
package/dist/index.js CHANGED
@@ -2,7 +2,8 @@ import { MARKET_SPREAD_BPS, ORACLE_MIN_CONVERSION_RATE_SENTINEL, CASH_RETAIN_ON_
2
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-UIELF4TY.js';
3
3
  import { parseAbi, parseEventLogs, isAddress, http, createPublicClient, createWalletClient, encodeFunctionData } from 'viem';
4
4
  import { mainnet, polygon, base } from 'viem/chains';
5
- import { getSpreadOracleConfig, currencyInfo, getGatingServiceAddress, resolvePaymentMethodNameFromHash, getCurrencyCodeFromHash, createCompositeDepositId, appendAttributionToCalldata, Zkp2pClient, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, defaultIndexerEndpoint, IndexerClient, CHAINLINK_ORACLE_FEEDS } from '@zkp2p/sdk';
5
+ import { getSpreadOracleConfig, currencyInfo, getGatingServiceAddress, resolvePaymentMethodNameFromHash, getCurrencyCodeFromHash, createCompositeDepositId, appendAttributionToCalldata, openVenmoGmailConnect, getVenmoGmailConnectUrl, Zkp2pClient, getPaymentMethodsCatalog, resolvePaymentMethodHashFromCatalog, defaultIndexerEndpoint, IndexerClient, CHAINLINK_ORACLE_FEEDS } from '@zkp2p/sdk';
6
+ export { VenmoGmailConnectError } from '@zkp2p/sdk';
6
7
  import { createClient, MAINNET_RELAY_API } from '@relayprotocol/relay-sdk';
7
8
  import { fetchChainConfigs, configureDynamicChains } from '@relayprotocol/relay-sdk/chain-utils';
8
9
  import { z } from 'zod';
@@ -1972,6 +1973,12 @@ var cashErrorJsonSchema = z.object({
1972
1973
  remediation: z.string(),
1973
1974
  recovery: cashErrorRecoveryJsonSchema.optional()
1974
1975
  }).strict();
1976
+ var venmoGmailConnectResultJsonSchema = z.object({
1977
+ payeeDetails: z.string().regex(/^0x[0-9a-f]{64}$/i)
1978
+ });
1979
+ var preparedVenmoGmailConnectJsonSchema = venmoGmailConnectResultJsonSchema.extend({
1980
+ url: z.url()
1981
+ });
1975
1982
 
1976
1983
  // src/client/nearIntents.ts
1977
1984
  var NEAR_INTENTS_API_URL = "https://1click.chaindefuser.com";
@@ -2362,6 +2369,11 @@ var DEFAULT_CURATOR_URLS = {
2362
2369
  preproduction: "https://api-preprod.zkp2p.xyz",
2363
2370
  staging: "https://api-staging.zkp2p.xyz"
2364
2371
  };
2372
+ var DEFAULT_PEER_ORIGINS = {
2373
+ production: "https://app.peer.xyz",
2374
+ preproduction: "https://ramp-preprod.peer.xyz",
2375
+ staging: "https://ramp-staging.peer.xyz"
2376
+ };
2365
2377
  var ERC20_APPROVE_ABI = parseAbi([
2366
2378
  "function approve(address spender, uint256 amount) returns (bool)"
2367
2379
  ]);
@@ -2924,6 +2936,31 @@ function createCashClient(options) {
2924
2936
  return hashes;
2925
2937
  }
2926
2938
  return {
2939
+ async prepareVenmoGmailConnect(payee) {
2940
+ const { hashedOnchainIds } = await readClient.registerPayeeDetails({
2941
+ processorNames: ["venmo"],
2942
+ payeeData: [normalizeCashPayee("venmo", payee)]
2943
+ });
2944
+ const payeeDetails = hashedOnchainIds[0];
2945
+ const url = getVenmoGmailConnectUrl({
2946
+ payeeDetails,
2947
+ peerOrigin: options.peerOrigin ?? DEFAULT_PEER_ORIGINS[environment]
2948
+ });
2949
+ return { payeeDetails, url };
2950
+ },
2951
+ openVenmoGmailConnect(payeeDetails) {
2952
+ return openVenmoGmailConnect({
2953
+ payeeDetails,
2954
+ peerOrigin: options.peerOrigin ?? DEFAULT_PEER_ORIGINS[environment]
2955
+ });
2956
+ },
2957
+ async isVenmoGmailConnected(payeeDetails) {
2958
+ const { responseObject } = await readClient.getSellerCredentialStatus({
2959
+ processorName: "venmo",
2960
+ payeeDetails
2961
+ });
2962
+ return responseObject.status === "active" && responseObject.credentialType === "google_oauth";
2963
+ },
2927
2964
  capabilities,
2928
2965
  async sourceCapabilities() {
2929
2966
  return readRelaySourceCapabilities(options.relay);
@@ -4007,5 +4044,22 @@ function cashErrorFromJson(json) {
4007
4044
  ...recovery ? { recovery } : {}
4008
4045
  });
4009
4046
  }
4047
+ function preparedVenmoGmailConnectToJson(value) {
4048
+ return preparedVenmoGmailConnectJsonSchema.parse(value);
4049
+ }
4050
+ function preparedVenmoGmailConnectFromJson(json) {
4051
+ const parsed = preparedVenmoGmailConnectJsonSchema.parse(json);
4052
+ return {
4053
+ ...parsed,
4054
+ payeeDetails: parsed.payeeDetails
4055
+ };
4056
+ }
4057
+ function venmoGmailConnectResultToJson(value) {
4058
+ return venmoGmailConnectResultJsonSchema.parse(value);
4059
+ }
4060
+ function venmoGmailConnectResultFromJson(json) {
4061
+ const parsed = venmoGmailConnectResultJsonSchema.parse(json);
4062
+ return { payeeDetails: parsed.payeeDetails };
4063
+ }
4010
4064
 
4011
- export { CASH_ATTRIBUTION_CODE, CASH_REFERRAL_ATTRIBUTION_PREFIX, CREATION_RATE_MAX_STALENESS_SECONDS, MIN_CASHOUT_AMOUNT, NEAR_INTENTS_API_URL, NEAR_INTENTS_BASE_USDC_ASSET_ID, NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS, NEAR_INTENTS_STATUSES, RATE_PRECISION, RECOMMENDED_MIN_CASHOUT_AMOUNT, bigintString, buildCapabilities, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashFillStatsJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPairFillStatsJsonSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, createCashClient, createNearIntentsClient, deriveBuyerProfile, deriveCashOrder, derivePayouts, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillStatsFromJson, fillStatsToJson, fillToJson, formatUsdc, intentStatusSchema, isCashCorridorSupported, isCreationRateCorridor, isFillLive, isMarketRateSupported, nearIntentsCapabilitiesFromJson, nearIntentsCapabilitiesToJson, nearIntentsDepositInputFromJson, nearIntentsDepositInputJsonSchema, nearIntentsDepositInputToJson, nearIntentsQuoteFromJson, nearIntentsQuoteInputFromJson, nearIntentsQuoteInputJsonSchema, nearIntentsQuoteInputToJson, nearIntentsQuoteJsonSchema, nearIntentsQuoteRequestJsonSchema, nearIntentsQuoteResponseSchema, nearIntentsQuoteToJson, nearIntentsSourceCapabilitiesJsonSchema, nearIntentsStatusCodeSchema, nearIntentsStatusFromJson, nearIntentsStatusInputFromJson, nearIntentsStatusInputJsonSchema, nearIntentsStatusInputToJson, nearIntentsStatusJsonSchema, nearIntentsStatusResponseSchema, nearIntentsStatusToJson, nearIntentsTokenJsonSchema, nearIntentsTokensResponseSchema, nearIntentsTransactionJsonSchema, nonNegativeBigintString, normalizeCashPayee, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, quoteNearIntentsToBaseUsdc, rateToNumber, readAlipayCnyCreationRate, readNearIntentsSourceCapabilities, readNearIntentsStatus, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, submitNearIntentsDeposit, toCashReferralAttributionCode, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
4065
+ export { CASH_ATTRIBUTION_CODE, CASH_REFERRAL_ATTRIBUTION_PREFIX, CREATION_RATE_MAX_STALENESS_SECONDS, MIN_CASHOUT_AMOUNT, NEAR_INTENTS_API_URL, NEAR_INTENTS_BASE_USDC_ASSET_ID, NEAR_INTENTS_DEFAULT_SLIPPAGE_BPS, NEAR_INTENTS_STATUSES, RATE_PRECISION, RECOMMENDED_MIN_CASHOUT_AMOUNT, bigintString, buildCapabilities, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashFillStatsJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPairFillStatsJsonSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, createCashClient, createNearIntentsClient, deriveBuyerProfile, deriveCashOrder, derivePayouts, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillStatsFromJson, fillStatsToJson, fillToJson, formatUsdc, intentStatusSchema, isCashCorridorSupported, isCreationRateCorridor, isFillLive, isMarketRateSupported, nearIntentsCapabilitiesFromJson, nearIntentsCapabilitiesToJson, nearIntentsDepositInputFromJson, nearIntentsDepositInputJsonSchema, nearIntentsDepositInputToJson, nearIntentsQuoteFromJson, nearIntentsQuoteInputFromJson, nearIntentsQuoteInputJsonSchema, nearIntentsQuoteInputToJson, nearIntentsQuoteJsonSchema, nearIntentsQuoteRequestJsonSchema, nearIntentsQuoteResponseSchema, nearIntentsQuoteToJson, nearIntentsSourceCapabilitiesJsonSchema, nearIntentsStatusCodeSchema, nearIntentsStatusFromJson, nearIntentsStatusInputFromJson, nearIntentsStatusInputJsonSchema, nearIntentsStatusInputToJson, nearIntentsStatusJsonSchema, nearIntentsStatusResponseSchema, nearIntentsStatusToJson, nearIntentsTokenJsonSchema, nearIntentsTokensResponseSchema, nearIntentsTransactionJsonSchema, nonNegativeBigintString, normalizeCashPayee, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, preparedVenmoGmailConnectFromJson, preparedVenmoGmailConnectJsonSchema, preparedVenmoGmailConnectToJson, quoteNearIntentsToBaseUsdc, rateToNumber, readAlipayCnyCreationRate, readNearIntentsSourceCapabilities, readNearIntentsStatus, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, submitNearIntentsDeposit, toCashReferralAttributionCode, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, venmoGmailConnectResultFromJson, venmoGmailConnectResultJsonSchema, venmoGmailConnectResultToJson, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
package/dist/react.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CurrencyType } from '@zkp2p/sdk';
2
- import { A as CashClient, _ as EstimateInput, h as CashEstimate, Y as CashoutOptions, g as CashoutResult, X as CashoutInput, T as TopUpResult, W as WithdrawResult, d as CashOrder } from './createCashClient-94tPE0dH.cjs';
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-CZgoTClw.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 { A as CashClient, _ as EstimateInput, h as CashEstimate, Y as CashoutOptions, g as CashoutResult, X as CashoutInput, T as TopUpResult, W as WithdrawResult, d as CashOrder } from './createCashClient-94tPE0dH.js';
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-CZgoTClw.js';
3
3
  import { WalletClient } from 'viem';
4
4
  import '@relayprotocol/relay-sdk';
5
5
 
package/dist/tools.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // package.json
4
4
  var package_default = {
5
- version: "0.6.0-rc.1"};
5
+ version: "0.6.0"};
6
6
 
7
7
  // src/tools/index.ts
8
8
  var bigintString = {
package/dist/tools.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // package.json
2
2
  var package_default = {
3
- version: "0.6.0-rc.1"};
3
+ version: "0.6.0"};
4
4
 
5
5
  // src/tools/index.ts
6
6
  var bigintString = {
@@ -139,3 +139,20 @@ before any resubmission.
139
139
  assets.
140
140
  - Test a small staging cash-out through `awaiting-buyer`, `withdraw()`, and
141
141
  `returned` before enabling production funds.
142
+
143
+ ## Optional Venmo receipt linking
144
+
145
+ Offer this separately; `cashout()` and `prepare()` never require or invoke it.
146
+ Run `cash.prepareVenmoGmailConnect(handle)` when the user selects Venmo, then
147
+ call `cash.openVenmoGmailConnect(link.payeeDetails)` directly from a separate
148
+ button click. Re-prepare when the selected handle changes. Use
149
+ `cash.isVenmoGmailConnected(link.payeeDetails)` after returning from a mobile
150
+ tab or an ambiguous closure; service errors reject, and only an active Google
151
+ credential counts as connected. Persist the hash with its environment and user.
152
+
153
+ The hosted flow accepts Google-hosted school/custom domains and verifies actual
154
+ Venmo receipts. `VenmoGmailConnectError` retains codes such as
155
+ `venmo_google_oauth_receipt_not_found`, `popup_blocked`, `connection_closed`,
156
+ and `connection_timeout`; it is separate from `CashError`. No emails or Google
157
+ tokens reach the partner. `link.url` supports redirect/native hosts, which
158
+ must check status on return. See the README and `examples/venmo-link.ts`.
@@ -0,0 +1,33 @@
1
+ import {
2
+ createCashClient,
3
+ VenmoGmailConnectError,
4
+ type PreparedVenmoGmailConnect,
5
+ } from '@zkp2p/cash';
6
+
7
+ /** Optional onboarding: call with the selected handle before enabling the link button. */
8
+ export async function prepareVenmoLink(handle: string) {
9
+ const cash = createCashClient({ environment: 'production' });
10
+ return cash.prepareVenmoGmailConnect(handle);
11
+ }
12
+
13
+ /** Bind this to a click. Keep registration/other awaits outside the handler. */
14
+ export function linkVenmo(link: PreparedVenmoGmailConnect) {
15
+ const cash = createCashClient({ environment: 'production' });
16
+ return cash.openVenmoGmailConnect(link.payeeDetails).catch((error: unknown) => {
17
+ if (error instanceof VenmoGmailConnectError) {
18
+ // Render error.message. For an ambiguous closure/timeout, offer a status refresh.
19
+ // Missing receipts: let the user choose the inbox that receives their receipts.
20
+ console.error(error.code, error.message);
21
+ }
22
+ throw error;
23
+ });
24
+ }
25
+
26
+ /** Also call when returning from a mobile tab or redirect opened with link.url. */
27
+ export function checkVenmoLink(link: PreparedVenmoGmailConnect) {
28
+ const cash = createCashClient({ environment: 'production' });
29
+ return cash.isVenmoGmailConnected(link.payeeDetails);
30
+ }
31
+
32
+ // cash.cashout(...) remains a separate action and does not require these helpers.
33
+ // No Gmail address is taken here: receipt verification belongs to the hosted flow.
package/llms.txt CHANGED
@@ -12,6 +12,17 @@
12
12
 
13
13
  Key facts:
14
14
 
15
+ - Optional Venmo receipt linking: prepareVenmoGmailConnect(handle) registers
16
+ the selected handle and returns { payeeDetails, url }. From a separate click,
17
+ openVenmoGmailConnect(payeeDetails) opens the environment's hosted flow.
18
+ isVenmoGmailConnected(payeeDetails) checks for an active Google credential;
19
+ lookup errors reject. Cashout and prepare never call or require these steps.
20
+ Mobile may open a tab; check status on return or ambiguous popup closure.
21
+ Google-hosted school/custom domains are supported; actual receipt failures
22
+ use VenmoGmailConnectError.code, including venmo_google_oauth_receipt_not_found.
23
+ Partner apps receive neither emails nor Google tokens. Re-prepare when the
24
+ handle changes; persist payee hash with environment and user account.
25
+
15
26
  - The cashing-out user is the MAKER: their USDC becomes a protocol-held order;
16
27
  a buyer pays fiat and proves it with TEE-TLS; the protocol releases the USDC.
17
28
  - Destination is always Base USDC. Relay sources come from live SDK metadata;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zkp2p/cash",
3
- "version": "0.6.0-rc.1",
3
+ "version": "0.6.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.2-rc.1",
111
+ "@zkp2p/sdk": "0.14.2-rc.4",
112
112
  "zod": "^4.4.3"
113
113
  },
114
114
  "peerDependencies": {
@@ -282,3 +282,20 @@ old and not in the future. Record the observation time and selected chain,
282
282
  then stop before funding if the read fails. Unit-test fixtures prove routing,
283
283
  not live availability. The authoritative feed listing is
284
284
  https://data.chain.link/feeds/polygon/mainnet/inr-usd.
285
+
286
+ ## Optional Venmo receipt linking
287
+
288
+ Offer this separately; `cashout()` and `prepare()` never require or invoke it.
289
+ Run `cash.prepareVenmoGmailConnect(handle)` when the user selects Venmo, then
290
+ call `cash.openVenmoGmailConnect(link.payeeDetails)` directly from a separate
291
+ button click. Re-prepare when the selected handle changes. Use
292
+ `cash.isVenmoGmailConnected(link.payeeDetails)` after returning from a mobile
293
+ tab or an ambiguous closure; service errors reject, and only an active Google
294
+ credential counts as connected. Persist the hash with its environment and user.
295
+
296
+ The hosted flow accepts Google-hosted school/custom domains and verifies actual
297
+ Venmo receipts. `VenmoGmailConnectError` retains codes such as
298
+ `venmo_google_oauth_receipt_not_found`, `popup_blocked`, `connection_closed`,
299
+ and `connection_timeout`; it is separate from `CashError`. No emails or Google
300
+ tokens reach the partner. `link.url` supports redirect/native hosts, which
301
+ must check status on return. See the README and `examples/venmo-link.ts`.
@@ -59,13 +59,12 @@ Inspect `disputeProtectionRequiresStake` before buyer QA so stake admission is
59
59
  not mistaken for a payment-proof failure.
60
60
 
61
61
  Buyer QA belongs to the client and attestation repositories. Amazon Pay is the
62
- sole client flow: no HDFC/Gmail selector or fallback copy. Pay with standard UPI
62
+ sole buyer proof flow. Pay with standard UPI
63
63
  to a person, then verify from the same Amazon account. Exclude UPI Lite, merchant
64
64
  payments and incoming transactions. Keep session evidence encrypted. A real
65
65
  intent requires the exact payment identity, allowed payment-time window, and an
66
66
  unused payment nullifier. Report maker deposit, buyer signal, evidence proof,
67
- and settlement as separate checkpoints. Backend HDFC support is retained until
68
- a separately authorized retirement; do not remove its server routes here.
67
+ and settlement as separate checkpoints.
69
68
 
70
69
  After buyer intents are cancelled or otherwise terminal, call the supported
71
70
  `withdraw` path and verify the receipt and returned order state. If a transaction