@zkp2p/cash 0.5.4-rc.2 → 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 +20 -4
- package/README.md +68 -13
- package/dist/{createCashClient-ECL3HN5H.d.cts → createCashClient-CZgoTClw.d.cts} +16 -12
- package/dist/{createCashClient-ECL3HN5H.d.ts → createCashClient-CZgoTClw.d.ts} +16 -12
- package/dist/index.cjs +78 -27
- package/dist/index.d.cts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +71 -29
- 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 +17 -0
- package/examples/upi-staging-cashout.ts +0 -1
- package/examples/venmo-link.ts +33 -0
- package/llms.txt +14 -3
- package/package.json +2 -2
- package/skills/peer-cash-integration/SKILL.md +19 -3
- package/skills/upi-preprod-qa/SKILL.md +8 -13
package/AGENTS.md
CHANGED
|
@@ -8,7 +8,7 @@ You are integrating Peer Cash: an offramp that routes Relay-supported EVM
|
|
|
8
8
|
assets or NEAR Intents 1Click external deposits into Base USDC, then converts
|
|
9
9
|
Base USDC to fiat (Venmo, Revolut, Wise, Alipay, Zelle, ...) at a zero-spread
|
|
10
10
|
Chainlink market rate. Existing corridors bind at intent signal; Alipay/CNY
|
|
11
|
-
fixes a fresh Ethereum Chainlink snapshot during deposit preparation;
|
|
11
|
+
fixes a fresh Ethereum Chainlink snapshot during deposit preparation; UPI/INR uses Polygon Chainlink. The user whose USDC you
|
|
12
12
|
manage is the **maker**; a buyer pays them fiat and proves it with TEE-TLS; the
|
|
13
13
|
protocol releases the USDC. Funds are held by the protocol, and only the maker
|
|
14
14
|
can withdraw an unmatched deposit.
|
|
@@ -70,8 +70,7 @@ deposit-level integration share instead of applying maker L1/L2.
|
|
|
70
70
|
- **Venmo, Revolut, Cash App, Monzo** validate the handle against the live
|
|
71
71
|
platform at registration - the account must exist. The rest (Zelle, Chime,
|
|
72
72
|
etc.) are format-checked only. Match handles to the `payeeHint`.
|
|
73
|
-
- **UPI is
|
|
74
|
-
`features: { upi: true }`. Any valid UPI ID from any bank can receive; there
|
|
73
|
+
- **UPI is available in every environment without a rollout flag.** Any valid UPI ID from any bank can receive; there
|
|
75
74
|
is no seller bank login, extension, identity attestation, or prior
|
|
76
75
|
registration flow. Buyers pay and verify through Amazon Pay using standard UPI.
|
|
77
76
|
|
|
@@ -342,4 +341,21 @@ read-only RPC with `upiCreationRateRpcUrl` or `upiCreationRateTransport`.
|
|
|
342
341
|
Alipay/CNY retains the Ethereum registry and `creationRateRpcUrl` /
|
|
343
342
|
`creationRateTransport`. UPI rejects the wrong chain, invalid rounds, and
|
|
344
343
|
observations older than 24 hours; market closures do not bypass freshness.
|
|
345
|
-
UPI
|
|
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
|
@@ -4,7 +4,7 @@ Route Relay-supported EVM assets or NEAR Intents 1Click external deposits into
|
|
|
4
4
|
Base USDC, then cash out to fiat on Venmo, Revolut, Wise, Alipay, Zelle, and
|
|
5
5
|
more at a zero-spread Chainlink market rate with no centralized off-ramp
|
|
6
6
|
provider. Existing corridors bind the live oracle when a buyer signals;
|
|
7
|
-
Alipay/CNY and
|
|
7
|
+
Alipay/CNY and UPI/INR fix fresh Chainlink snapshots when the SDK prepares
|
|
8
8
|
the deposit (Ethereum for CNY; Polygon for INR).
|
|
9
9
|
|
|
10
10
|
Peer Cash is an **offramp-only** SDK for the [ZKP2P](https://peer.xyz)
|
|
@@ -98,15 +98,13 @@ for await (const order of cash.watch(depositId)) {
|
|
|
98
98
|
|
|
99
99
|
UPI requires the canonical UPI/INR catalog from `@zkp2p/sdk` 0.14.2-rc.1
|
|
100
100
|
or its approved successor; a missing catalog entry keeps the corridor disabled.
|
|
101
|
-
UPI is an opt-in
|
|
102
|
-
pending rollout review. Any valid UPI ID from any bank can receive a cash-out. The seller
|
|
101
|
+
UPI is available in every environment without an opt-in. Any valid UPI ID from any bank can receive a cash-out. The seller
|
|
103
102
|
does not connect a bank account, install an extension, or complete a separate
|
|
104
103
|
registration flow:
|
|
105
104
|
|
|
106
105
|
```ts
|
|
107
106
|
const cash = createCashClient({
|
|
108
107
|
environment: 'preproduction',
|
|
109
|
-
features: { upi: true },
|
|
110
108
|
});
|
|
111
109
|
|
|
112
110
|
await cash.cashout(
|
|
@@ -146,6 +144,9 @@ arbitrary protocol operations.
|
|
|
146
144
|
|
|
147
145
|
| Verb | What it does |
|
|
148
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 |
|
|
149
150
|
| `capabilities()` | Sync discovery: Base USDC destination/default source, platforms × currencies × payee hints × amount bounds |
|
|
150
151
|
| `capabilities({ includeRelaySources: true })` | Async discovery: adds live Relay SDK EVM source chains/tokens |
|
|
151
152
|
| `capabilities({ includeNearIntentsSources: true })` | Async discovery: adds live NEAR Intents 1Click source assets |
|
|
@@ -184,16 +185,70 @@ indexed deposit is unsupported, `orders()` excludes the whole deposit and
|
|
|
184
185
|
`order()` returns `ORDER_NOT_FOUND`; Peer Cash never partially reclassifies a
|
|
185
186
|
mixed historical deposit.
|
|
186
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
|
+
|
|
187
242
|
## Payout rails and access policies
|
|
188
243
|
|
|
189
|
-
| Payout rail
|
|
190
|
-
|
|
|
191
|
-
| Venmo
|
|
192
|
-
| PayPal
|
|
193
|
-
| Cash App
|
|
194
|
-
| Wise
|
|
195
|
-
| UPI
|
|
196
|
-
| Other supported rails
|
|
244
|
+
| Payout rail | Access-policy behavior | New payee registration |
|
|
245
|
+
| --------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
246
|
+
| Venmo | Peer Pay merchant policy attaches for that payment method | Curator validates the live handle |
|
|
247
|
+
| PayPal | Same method-scoped Peer Pay follow-up | Requires a Peer TEE browser-extension identity attestation |
|
|
248
|
+
| Cash App | No access-policy follow-up; non-chargebackable and no stake required | Curator validates the live handle |
|
|
249
|
+
| Wise | No access-policy follow-up | Requires a Peer TEE browser-extension identity attestation |
|
|
250
|
+
| UPI | No access-policy follow-up | Any valid UPI ID; no account connection or identity attestation |
|
|
251
|
+
| 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 |
|
|
197
252
|
|
|
198
253
|
No platform requires an atomic access-policy flow. `cashout()` and `prepare()`
|
|
199
254
|
work with any viem `WalletClient`, including a local or externally connected
|
|
@@ -483,7 +538,7 @@ is the default source and the only destination asset for cashout orders.
|
|
|
483
538
|
Runnable first-party examples in [`examples/`](examples):
|
|
484
539
|
|
|
485
540
|
- [`node-cashout.ts`](examples/node-cashout.ts) - server-side cash-out with a private-key signer, plus order tracking.
|
|
486
|
-
- [`upi-staging-cashout.ts`](examples/upi-staging-cashout.ts) -
|
|
541
|
+
- [`upi-staging-cashout.ts`](examples/upi-staging-cashout.ts) - UPI/INR cash-out to any valid UPI ID on staging or preproduction.
|
|
487
542
|
- [`agent-tool-use.ts`](examples/agent-tool-use.ts) - wiring the verbs into an agent tool-use loop with host-side signing.
|
|
488
543
|
- [`carpe-diem-provider-cashout`](examples/carpe-diem-provider-cashout) - cash out confirmed Carpe Diem provider DIEM revenue through the connected Base wallet.
|
|
489
544
|
- [`mpp-merchant-cashout`](examples/mpp-merchant-cashout) - turn confirmed MPP merchant revenue into an unsigned Peer Cash plan while the merchant keeps custody and signing.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Address,
|
|
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
|
/**
|
|
@@ -468,16 +468,10 @@ declare function quoteNearIntentsToBaseUsdc(input: NearIntentsQuoteInput, option
|
|
|
468
468
|
declare function submitNearIntentsDeposit(input: NearIntentsDepositInput, options?: NearIntentsOptions): Promise<NearIntentsStatus>;
|
|
469
469
|
declare function readNearIntentsStatus(input: NearIntentsStatusInput, options?: NearIntentsOptions): Promise<NearIntentsStatus>;
|
|
470
470
|
|
|
471
|
-
interface CashCatalogFeatures {
|
|
472
|
-
upi?: boolean;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
471
|
/** Hard floor: below one cent a deposit is dust and can never fill. */
|
|
476
472
|
declare const MIN_CASHOUT_AMOUNT = 10000n;
|
|
477
473
|
/** Recommended floor: sub-1-USDC deposits force min==max fills and starve matching. */
|
|
478
474
|
declare const RECOMMENDED_MIN_CASHOUT_AMOUNT = 1000000n;
|
|
479
|
-
/** Opt-in product surfaces that are not yet available on production contracts. */
|
|
480
|
-
type CashFeatureFlags = CashCatalogFeatures;
|
|
481
475
|
type CashCorridorPricing = {
|
|
482
476
|
kind: 'oracle-at-intent-signal';
|
|
483
477
|
spreadBps: 0;
|
|
@@ -560,7 +554,7 @@ interface CashCapabilities {
|
|
|
560
554
|
spreadBps: 0;
|
|
561
555
|
};
|
|
562
556
|
}
|
|
563
|
-
declare function buildCapabilities(environment: RuntimeEnv
|
|
557
|
+
declare function buildCapabilities(environment: RuntimeEnv): CashCapabilities;
|
|
564
558
|
|
|
565
559
|
interface CashPairFillStats {
|
|
566
560
|
/** Fulfilled intents through this pair or currency set inside the rolling 30-day window. */
|
|
@@ -671,11 +665,13 @@ declare const CASH_ATTRIBUTION_CODE = "peer-cash";
|
|
|
671
665
|
declare const CASH_REFERRAL_ATTRIBUTION_PREFIX = "peer-ref-";
|
|
672
666
|
/** Convert a Peer referral code into its financially meaningful ERC-8021 marker. */
|
|
673
667
|
declare function toCashReferralAttributionCode(rawCode: string): string;
|
|
668
|
+
interface PreparedVenmoGmailConnect {
|
|
669
|
+
payeeDetails: Hash;
|
|
670
|
+
url: string;
|
|
671
|
+
}
|
|
674
672
|
interface CashClientOptions {
|
|
675
673
|
/** `'production' | 'preproduction' | 'staging'` - selects contracts, curator, and indexer. */
|
|
676
674
|
environment: RuntimeEnv;
|
|
677
|
-
/** Fail-closed opt-ins for corridors that are not deployed to production. */
|
|
678
|
-
features?: CashFeatureFlags;
|
|
679
675
|
/** viem transport for RPC reads; defaults to the public Base RPC. */
|
|
680
676
|
transport?: Transport;
|
|
681
677
|
/** Convenience alternative to `transport`. */
|
|
@@ -686,6 +682,8 @@ interface CashClientOptions {
|
|
|
686
682
|
indexerApiKey?: string;
|
|
687
683
|
/** Curator (ZKP2P API) URL override. */
|
|
688
684
|
curatorUrl?: string;
|
|
685
|
+
/** Peer web origin override for optional Venmo receipt linking. Defaults by environment. */
|
|
686
|
+
peerOrigin?: string;
|
|
689
687
|
/** Optional ZKP2P API key. */
|
|
690
688
|
apiKey?: string;
|
|
691
689
|
/** Ethereum transport used only to snapshot Alipay/CNY's creation-time rate. */
|
|
@@ -858,6 +856,12 @@ interface OrdersOptions {
|
|
|
858
856
|
limit?: number;
|
|
859
857
|
}
|
|
860
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>;
|
|
861
865
|
/** 0 - Discovery: sync, static. */
|
|
862
866
|
capabilities(): CashCapabilities;
|
|
863
867
|
/** 0b - Discovery with live Relay-supported EVM source chains/tokens. */
|
|
@@ -949,4 +953,4 @@ interface CashClient {
|
|
|
949
953
|
}
|
|
950
954
|
declare function createCashClient(options: CashClientOptions): CashClient;
|
|
951
955
|
|
|
952
|
-
export { type
|
|
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,
|
|
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
|
/**
|
|
@@ -468,16 +468,10 @@ declare function quoteNearIntentsToBaseUsdc(input: NearIntentsQuoteInput, option
|
|
|
468
468
|
declare function submitNearIntentsDeposit(input: NearIntentsDepositInput, options?: NearIntentsOptions): Promise<NearIntentsStatus>;
|
|
469
469
|
declare function readNearIntentsStatus(input: NearIntentsStatusInput, options?: NearIntentsOptions): Promise<NearIntentsStatus>;
|
|
470
470
|
|
|
471
|
-
interface CashCatalogFeatures {
|
|
472
|
-
upi?: boolean;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
471
|
/** Hard floor: below one cent a deposit is dust and can never fill. */
|
|
476
472
|
declare const MIN_CASHOUT_AMOUNT = 10000n;
|
|
477
473
|
/** Recommended floor: sub-1-USDC deposits force min==max fills and starve matching. */
|
|
478
474
|
declare const RECOMMENDED_MIN_CASHOUT_AMOUNT = 1000000n;
|
|
479
|
-
/** Opt-in product surfaces that are not yet available on production contracts. */
|
|
480
|
-
type CashFeatureFlags = CashCatalogFeatures;
|
|
481
475
|
type CashCorridorPricing = {
|
|
482
476
|
kind: 'oracle-at-intent-signal';
|
|
483
477
|
spreadBps: 0;
|
|
@@ -560,7 +554,7 @@ interface CashCapabilities {
|
|
|
560
554
|
spreadBps: 0;
|
|
561
555
|
};
|
|
562
556
|
}
|
|
563
|
-
declare function buildCapabilities(environment: RuntimeEnv
|
|
557
|
+
declare function buildCapabilities(environment: RuntimeEnv): CashCapabilities;
|
|
564
558
|
|
|
565
559
|
interface CashPairFillStats {
|
|
566
560
|
/** Fulfilled intents through this pair or currency set inside the rolling 30-day window. */
|
|
@@ -671,11 +665,13 @@ declare const CASH_ATTRIBUTION_CODE = "peer-cash";
|
|
|
671
665
|
declare const CASH_REFERRAL_ATTRIBUTION_PREFIX = "peer-ref-";
|
|
672
666
|
/** Convert a Peer referral code into its financially meaningful ERC-8021 marker. */
|
|
673
667
|
declare function toCashReferralAttributionCode(rawCode: string): string;
|
|
668
|
+
interface PreparedVenmoGmailConnect {
|
|
669
|
+
payeeDetails: Hash;
|
|
670
|
+
url: string;
|
|
671
|
+
}
|
|
674
672
|
interface CashClientOptions {
|
|
675
673
|
/** `'production' | 'preproduction' | 'staging'` - selects contracts, curator, and indexer. */
|
|
676
674
|
environment: RuntimeEnv;
|
|
677
|
-
/** Fail-closed opt-ins for corridors that are not deployed to production. */
|
|
678
|
-
features?: CashFeatureFlags;
|
|
679
675
|
/** viem transport for RPC reads; defaults to the public Base RPC. */
|
|
680
676
|
transport?: Transport;
|
|
681
677
|
/** Convenience alternative to `transport`. */
|
|
@@ -686,6 +682,8 @@ interface CashClientOptions {
|
|
|
686
682
|
indexerApiKey?: string;
|
|
687
683
|
/** Curator (ZKP2P API) URL override. */
|
|
688
684
|
curatorUrl?: string;
|
|
685
|
+
/** Peer web origin override for optional Venmo receipt linking. Defaults by environment. */
|
|
686
|
+
peerOrigin?: string;
|
|
689
687
|
/** Optional ZKP2P API key. */
|
|
690
688
|
apiKey?: string;
|
|
691
689
|
/** Ethereum transport used only to snapshot Alipay/CNY's creation-time rate. */
|
|
@@ -858,6 +856,12 @@ interface OrdersOptions {
|
|
|
858
856
|
limit?: number;
|
|
859
857
|
}
|
|
860
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>;
|
|
861
865
|
/** 0 - Discovery: sync, static. */
|
|
862
866
|
capabilities(): CashCapabilities;
|
|
863
867
|
/** 0b - Discovery with live Relay-supported EVM source chains/tokens. */
|
|
@@ -949,4 +953,4 @@ interface CashClient {
|
|
|
949
953
|
}
|
|
950
954
|
declare function createCashClient(options: CashClientOptions): CashClient;
|
|
951
955
|
|
|
952
|
-
export { type
|
|
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
|
@@ -142,14 +142,8 @@ async function readCashCreationRate(publicClient, platform, currency, nowSeconds
|
|
|
142
142
|
async function readAlipayCnyCreationRate(publicClient, nowSeconds = Math.floor(Date.now() / 1e3)) {
|
|
143
143
|
return readCashCreationRate(publicClient, "alipay", "CNY", nowSeconds);
|
|
144
144
|
}
|
|
145
|
-
function getCashPaymentMethodsCatalog(environment
|
|
146
|
-
|
|
147
|
-
if ((environment === "staging" || environment === "preproduction") && features.upi === true) {
|
|
148
|
-
return catalog;
|
|
149
|
-
}
|
|
150
|
-
const enabledCatalog = { ...catalog };
|
|
151
|
-
delete enabledCatalog.upi;
|
|
152
|
-
return enabledCatalog;
|
|
145
|
+
function getCashPaymentMethodsCatalog(environment) {
|
|
146
|
+
return sdk.getPaymentMethodsCatalog(8453, environment);
|
|
153
147
|
}
|
|
154
148
|
function resolveCashPaymentMethodHash(processorName, catalog) {
|
|
155
149
|
if (processorName.trim().toLowerCase() === "upi" && !catalog.upi) {
|
|
@@ -192,12 +186,12 @@ function buildIntentAmountRange(amount) {
|
|
|
192
186
|
const min = amount < DEFAULT_MIN_ORDER_FLOOR ? amount : DEFAULT_MIN_ORDER_FLOOR;
|
|
193
187
|
return { min, max: amount };
|
|
194
188
|
}
|
|
195
|
-
async function prepareCashDepositParams(client, input, adapters, creationRateReader
|
|
189
|
+
async function prepareCashDepositParams(client, input, adapters, creationRateReader) {
|
|
196
190
|
const { payouts } = input;
|
|
197
191
|
if (!payouts.length) throw new Error("At least one payout is required");
|
|
198
192
|
const chainId = client.chainId;
|
|
199
193
|
const runtimeEnv = client.runtimeEnv;
|
|
200
|
-
const catalog = getCashPaymentMethodsCatalog(runtimeEnv
|
|
194
|
+
const catalog = getCashPaymentMethodsCatalog(runtimeEnv);
|
|
201
195
|
const intentGatingService = sdk.getGatingServiceAddress(chainId, runtimeEnv);
|
|
202
196
|
const processorNames = payouts.map((p) => p.processorName);
|
|
203
197
|
const paymentMethodsOverride = processorNames.map(
|
|
@@ -633,8 +627,8 @@ var IDENTITY_ATTESTATION_PLATFORMS = /* @__PURE__ */ new Set(["wise", "paypal",
|
|
|
633
627
|
function platformRequiresIdentityAttestation(platform) {
|
|
634
628
|
return IDENTITY_ATTESTATION_PLATFORMS.has(platform.toLowerCase());
|
|
635
629
|
}
|
|
636
|
-
function buildCapabilities(environment
|
|
637
|
-
const catalog = getCashPaymentMethodsCatalog(environment
|
|
630
|
+
function buildCapabilities(environment) {
|
|
631
|
+
const catalog = getCashPaymentMethodsCatalog(environment);
|
|
638
632
|
const platforms = Object.entries(catalog).map(([platform, entry]) => {
|
|
639
633
|
const currencies2 = (entry.currencies ?? []).map((hash) => sdk.getCurrencyCodeFromHash(hash)).filter(
|
|
640
634
|
(code) => code != null && (isMarketRateSupported(code) || isCreationRateCorridor(platform, code))
|
|
@@ -2472,6 +2466,12 @@ var cashErrorJsonSchema = zod.z.object({
|
|
|
2472
2466
|
remediation: zod.z.string(),
|
|
2473
2467
|
recovery: cashErrorRecoveryJsonSchema.optional()
|
|
2474
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
|
+
});
|
|
2475
2475
|
|
|
2476
2476
|
// src/client/nearIntents.ts
|
|
2477
2477
|
var NEAR_INTENTS_API_URL = "https://1click.chaindefuser.com";
|
|
@@ -2862,6 +2862,11 @@ var DEFAULT_CURATOR_URLS = {
|
|
|
2862
2862
|
preproduction: "https://api-preprod.zkp2p.xyz",
|
|
2863
2863
|
staging: "https://api-staging.zkp2p.xyz"
|
|
2864
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
|
+
};
|
|
2865
2870
|
var ERC20_APPROVE_ABI = viem.parseAbi([
|
|
2866
2871
|
"function approve(address spender, uint256 amount) returns (bool)"
|
|
2867
2872
|
]);
|
|
@@ -2913,8 +2918,8 @@ async function submitAndConfirm(client, verb, send) {
|
|
|
2913
2918
|
function isKnownPreBroadcastFailure(mapped) {
|
|
2914
2919
|
return mapped.code === "TRANSACTION_REJECTED" || mapped.code === "INSUFFICIENT_TOKEN_BALANCE" || mapped.code === "ALLOWANCE_NOT_VISIBLE" || mapped.code === "ESCROW_PAUSED";
|
|
2915
2920
|
}
|
|
2916
|
-
function cashoutAccessPolicyPaymentMethods(depositInput, environment
|
|
2917
|
-
const catalog = getCashPaymentMethodsCatalog(environment
|
|
2921
|
+
function cashoutAccessPolicyPaymentMethods(depositInput, environment) {
|
|
2922
|
+
const catalog = getCashPaymentMethodsCatalog(environment);
|
|
2918
2923
|
return [
|
|
2919
2924
|
...new Set(
|
|
2920
2925
|
depositInput.payouts.filter((payout) => CASH_RESTRICTED_PLATFORMS.has(payout.processorName.toLowerCase())).map((payout) => resolveCashPaymentMethodHash(payout.processorName, catalog))
|
|
@@ -3011,7 +3016,7 @@ function createCashClient(options) {
|
|
|
3011
3016
|
if (legs.length === 0) {
|
|
3012
3017
|
throw errors.invalidPayoutPlatforms("at least one payout leg is required");
|
|
3013
3018
|
}
|
|
3014
|
-
const capabilities2 = buildCapabilities(environment
|
|
3019
|
+
const capabilities2 = buildCapabilities(environment);
|
|
3015
3020
|
const seenPlatforms = /* @__PURE__ */ new Set();
|
|
3016
3021
|
const payouts = legs.map((leg) => {
|
|
3017
3022
|
const platform = capabilities2.platforms.find(
|
|
@@ -3092,8 +3097,7 @@ function createCashClient(options) {
|
|
|
3092
3097
|
} catch (err) {
|
|
3093
3098
|
throw errors.oracleReadFailed(currency, err);
|
|
3094
3099
|
}
|
|
3095
|
-
}
|
|
3096
|
-
options.features
|
|
3100
|
+
}
|
|
3097
3101
|
);
|
|
3098
3102
|
} catch (err) {
|
|
3099
3103
|
if (isCashError(err)) throw err;
|
|
@@ -3145,7 +3149,7 @@ function createCashClient(options) {
|
|
|
3145
3149
|
const payouts = derivePayouts(
|
|
3146
3150
|
deposit.paymentMethods ?? [],
|
|
3147
3151
|
deposit.currencies ?? [],
|
|
3148
|
-
getCashPaymentMethodsCatalog(environment
|
|
3152
|
+
getCashPaymentMethodsCatalog(environment)
|
|
3149
3153
|
);
|
|
3150
3154
|
let attributedToCash = false;
|
|
3151
3155
|
if (!isCashPayoutSet(payouts)) {
|
|
@@ -3203,7 +3207,7 @@ function createCashClient(options) {
|
|
|
3203
3207
|
return escrowContext(depositId);
|
|
3204
3208
|
}
|
|
3205
3209
|
function capabilities(capabilityOptions) {
|
|
3206
|
-
const baseCapabilities = buildCapabilities(environment
|
|
3210
|
+
const baseCapabilities = buildCapabilities(environment);
|
|
3207
3211
|
if (!capabilityOptions?.includeRelaySources && !capabilityOptions?.includeNearIntentsSources) {
|
|
3208
3212
|
return baseCapabilities;
|
|
3209
3213
|
}
|
|
@@ -3381,11 +3385,7 @@ function createCashClient(options) {
|
|
|
3381
3385
|
}
|
|
3382
3386
|
async function configureCashoutAccess(client, signer, depositInput, depositId, source) {
|
|
3383
3387
|
const groupIds = CASH_ACCESS_GROUP_IDS[environment];
|
|
3384
|
-
const paymentMethods = cashoutAccessPolicyPaymentMethods(
|
|
3385
|
-
depositInput,
|
|
3386
|
-
environment,
|
|
3387
|
-
options.features
|
|
3388
|
-
);
|
|
3388
|
+
const paymentMethods = cashoutAccessPolicyPaymentMethods(depositInput, environment);
|
|
3389
3389
|
const hashes = [];
|
|
3390
3390
|
for (const paymentMethod of paymentMethods) {
|
|
3391
3391
|
const prepared = prepareCashoutAccess(depositId, paymentMethod, client, source);
|
|
@@ -3429,6 +3429,31 @@ function createCashClient(options) {
|
|
|
3429
3429
|
return hashes;
|
|
3430
3430
|
}
|
|
3431
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
|
+
},
|
|
3432
3457
|
capabilities,
|
|
3433
3458
|
async sourceCapabilities() {
|
|
3434
3459
|
return readRelaySourceCapabilities(options.relay);
|
|
@@ -3691,8 +3716,7 @@ function createCashClient(options) {
|
|
|
3691
3716
|
const hashedOnchainIds = (params.paymentMethodDataOverride ?? []).map((d) => d.payeeDetails);
|
|
3692
3717
|
const accessPolicyPaymentMethods = cashoutAccessPolicyPaymentMethods(
|
|
3693
3718
|
depositInput,
|
|
3694
|
-
environment
|
|
3695
|
-
options.features
|
|
3719
|
+
environment
|
|
3696
3720
|
);
|
|
3697
3721
|
return {
|
|
3698
3722
|
txs: [approve, prepared],
|
|
@@ -3763,7 +3787,7 @@ function createCashClient(options) {
|
|
|
3763
3787
|
} catch (err) {
|
|
3764
3788
|
throw errors.indexerUnavailable("orders", err);
|
|
3765
3789
|
}
|
|
3766
|
-
const catalog = getCashPaymentMethodsCatalog(environment
|
|
3790
|
+
const catalog = getCashPaymentMethodsCatalog(environment);
|
|
3767
3791
|
let attributedCashDeposits = /* @__PURE__ */ new Set();
|
|
3768
3792
|
const fixedRateCandidates = deposits.filter((deposit) => {
|
|
3769
3793
|
const payouts = derivePayouts(
|
|
@@ -4513,7 +4537,28 @@ function cashErrorFromJson(json) {
|
|
|
4513
4537
|
...recovery ? { recovery } : {}
|
|
4514
4538
|
});
|
|
4515
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
|
+
}
|
|
4516
4557
|
|
|
4558
|
+
Object.defineProperty(exports, "VenmoGmailConnectError", {
|
|
4559
|
+
enumerable: true,
|
|
4560
|
+
get: function () { return sdk.VenmoGmailConnectError; }
|
|
4561
|
+
});
|
|
4517
4562
|
exports.BASE_CHAIN_ID = BASE_CHAIN_ID;
|
|
4518
4563
|
exports.BASE_USDC_ADDRESS = BASE_USDC_ADDRESS;
|
|
4519
4564
|
exports.CASH_ATTRIBUTION_CODE = CASH_ATTRIBUTION_CODE;
|
|
@@ -4626,6 +4671,9 @@ exports.preparedStepToJson = preparedStepToJson;
|
|
|
4626
4671
|
exports.preparedTransactionJsonSchema = preparedTransactionJsonSchema;
|
|
4627
4672
|
exports.preparedTxFromJson = preparedTxFromJson;
|
|
4628
4673
|
exports.preparedTxToJson = preparedTxToJson;
|
|
4674
|
+
exports.preparedVenmoGmailConnectFromJson = preparedVenmoGmailConnectFromJson;
|
|
4675
|
+
exports.preparedVenmoGmailConnectJsonSchema = preparedVenmoGmailConnectJsonSchema;
|
|
4676
|
+
exports.preparedVenmoGmailConnectToJson = preparedVenmoGmailConnectToJson;
|
|
4629
4677
|
exports.quoteNearIntentsToBaseUsdc = quoteNearIntentsToBaseUsdc;
|
|
4630
4678
|
exports.rateToNumber = rateToNumber;
|
|
4631
4679
|
exports.readAlipayCnyCreationRate = readAlipayCnyCreationRate;
|
|
@@ -4651,6 +4699,9 @@ exports.topUpResultFromJson = topUpResultFromJson;
|
|
|
4651
4699
|
exports.topUpResultJsonSchema = topUpResultJsonSchema;
|
|
4652
4700
|
exports.topUpResultToJson = topUpResultToJson;
|
|
4653
4701
|
exports.usdc = usdc;
|
|
4702
|
+
exports.venmoGmailConnectResultFromJson = venmoGmailConnectResultFromJson;
|
|
4703
|
+
exports.venmoGmailConnectResultJsonSchema = venmoGmailConnectResultJsonSchema;
|
|
4704
|
+
exports.venmoGmailConnectResultToJson = venmoGmailConnectResultToJson;
|
|
4654
4705
|
exports.withExplain = withExplain;
|
|
4655
4706
|
exports.withdrawResultFromJson = withdrawResultFromJson;
|
|
4656
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
|
|
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
|
|
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
|
|
|
@@ -258,7 +258,7 @@ declare function buildIntentAmountRange(amount: bigint): {
|
|
|
258
258
|
* arrays with signal-time oracle configs. Alipay/CNY and UPI/INR instead fix
|
|
259
259
|
* fresh Chainlink snapshots from Ethereum and Polygon as their maker floors.
|
|
260
260
|
*/
|
|
261
|
-
declare function prepareCashDepositParams(client: Zkp2pClient, input: CashDepositInput, adapters?: OracleAdapterOverrides, creationRateReader?: CreationRateReader
|
|
261
|
+
declare function prepareCashDepositParams(client: Zkp2pClient, input: CashDepositInput, adapters?: OracleAdapterOverrides, creationRateReader?: CreationRateReader): Promise<CreateDepositParamsArg>;
|
|
262
262
|
|
|
263
263
|
/**
|
|
264
264
|
* Whether a signaled fill can still be completed by its buyer. Uses the
|
|
@@ -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
|
|
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
|
|
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
|
|
|
@@ -258,7 +258,7 @@ declare function buildIntentAmountRange(amount: bigint): {
|
|
|
258
258
|
* arrays with signal-time oracle configs. Alipay/CNY and UPI/INR instead fix
|
|
259
259
|
* fresh Chainlink snapshots from Ethereum and Polygon as their maker floors.
|
|
260
260
|
*/
|
|
261
|
-
declare function prepareCashDepositParams(client: Zkp2pClient, input: CashDepositInput, adapters?: OracleAdapterOverrides, creationRateReader?: CreationRateReader
|
|
261
|
+
declare function prepareCashDepositParams(client: Zkp2pClient, input: CashDepositInput, adapters?: OracleAdapterOverrides, creationRateReader?: CreationRateReader): Promise<CreateDepositParamsArg>;
|
|
262
262
|
|
|
263
263
|
/**
|
|
264
264
|
* Whether a signaled fill can still be completed by its buyer. Uses the
|
|
@@ -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';
|
|
@@ -120,14 +121,8 @@ async function readCashCreationRate(publicClient, platform, currency, nowSeconds
|
|
|
120
121
|
async function readAlipayCnyCreationRate(publicClient, nowSeconds = Math.floor(Date.now() / 1e3)) {
|
|
121
122
|
return readCashCreationRate(publicClient, "alipay", "CNY", nowSeconds);
|
|
122
123
|
}
|
|
123
|
-
function getCashPaymentMethodsCatalog(environment
|
|
124
|
-
|
|
125
|
-
if ((environment === "staging" || environment === "preproduction") && features.upi === true) {
|
|
126
|
-
return catalog;
|
|
127
|
-
}
|
|
128
|
-
const enabledCatalog = { ...catalog };
|
|
129
|
-
delete enabledCatalog.upi;
|
|
130
|
-
return enabledCatalog;
|
|
124
|
+
function getCashPaymentMethodsCatalog(environment) {
|
|
125
|
+
return getPaymentMethodsCatalog(8453, environment);
|
|
131
126
|
}
|
|
132
127
|
function resolveCashPaymentMethodHash(processorName, catalog) {
|
|
133
128
|
if (processorName.trim().toLowerCase() === "upi" && !catalog.upi) {
|
|
@@ -170,12 +165,12 @@ function buildIntentAmountRange(amount) {
|
|
|
170
165
|
const min = amount < DEFAULT_MIN_ORDER_FLOOR ? amount : DEFAULT_MIN_ORDER_FLOOR;
|
|
171
166
|
return { min, max: amount };
|
|
172
167
|
}
|
|
173
|
-
async function prepareCashDepositParams(client, input, adapters, creationRateReader
|
|
168
|
+
async function prepareCashDepositParams(client, input, adapters, creationRateReader) {
|
|
174
169
|
const { payouts } = input;
|
|
175
170
|
if (!payouts.length) throw new Error("At least one payout is required");
|
|
176
171
|
const chainId = client.chainId;
|
|
177
172
|
const runtimeEnv = client.runtimeEnv;
|
|
178
|
-
const catalog = getCashPaymentMethodsCatalog(runtimeEnv
|
|
173
|
+
const catalog = getCashPaymentMethodsCatalog(runtimeEnv);
|
|
179
174
|
const intentGatingService = getGatingServiceAddress(chainId, runtimeEnv);
|
|
180
175
|
const processorNames = payouts.map((p) => p.processorName);
|
|
181
176
|
const paymentMethodsOverride = processorNames.map(
|
|
@@ -611,8 +606,8 @@ var IDENTITY_ATTESTATION_PLATFORMS = /* @__PURE__ */ new Set(["wise", "paypal",
|
|
|
611
606
|
function platformRequiresIdentityAttestation(platform) {
|
|
612
607
|
return IDENTITY_ATTESTATION_PLATFORMS.has(platform.toLowerCase());
|
|
613
608
|
}
|
|
614
|
-
function buildCapabilities(environment
|
|
615
|
-
const catalog = getCashPaymentMethodsCatalog(environment
|
|
609
|
+
function buildCapabilities(environment) {
|
|
610
|
+
const catalog = getCashPaymentMethodsCatalog(environment);
|
|
616
611
|
const platforms = Object.entries(catalog).map(([platform, entry]) => {
|
|
617
612
|
const currencies2 = (entry.currencies ?? []).map((hash) => getCurrencyCodeFromHash(hash)).filter(
|
|
618
613
|
(code) => code != null && (isMarketRateSupported(code) || isCreationRateCorridor(platform, code))
|
|
@@ -1978,6 +1973,12 @@ var cashErrorJsonSchema = z.object({
|
|
|
1978
1973
|
remediation: z.string(),
|
|
1979
1974
|
recovery: cashErrorRecoveryJsonSchema.optional()
|
|
1980
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
|
+
});
|
|
1981
1982
|
|
|
1982
1983
|
// src/client/nearIntents.ts
|
|
1983
1984
|
var NEAR_INTENTS_API_URL = "https://1click.chaindefuser.com";
|
|
@@ -2368,6 +2369,11 @@ var DEFAULT_CURATOR_URLS = {
|
|
|
2368
2369
|
preproduction: "https://api-preprod.zkp2p.xyz",
|
|
2369
2370
|
staging: "https://api-staging.zkp2p.xyz"
|
|
2370
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
|
+
};
|
|
2371
2377
|
var ERC20_APPROVE_ABI = parseAbi([
|
|
2372
2378
|
"function approve(address spender, uint256 amount) returns (bool)"
|
|
2373
2379
|
]);
|
|
@@ -2419,8 +2425,8 @@ async function submitAndConfirm(client, verb, send) {
|
|
|
2419
2425
|
function isKnownPreBroadcastFailure(mapped) {
|
|
2420
2426
|
return mapped.code === "TRANSACTION_REJECTED" || mapped.code === "INSUFFICIENT_TOKEN_BALANCE" || mapped.code === "ALLOWANCE_NOT_VISIBLE" || mapped.code === "ESCROW_PAUSED";
|
|
2421
2427
|
}
|
|
2422
|
-
function cashoutAccessPolicyPaymentMethods(depositInput, environment
|
|
2423
|
-
const catalog = getCashPaymentMethodsCatalog(environment
|
|
2428
|
+
function cashoutAccessPolicyPaymentMethods(depositInput, environment) {
|
|
2429
|
+
const catalog = getCashPaymentMethodsCatalog(environment);
|
|
2424
2430
|
return [
|
|
2425
2431
|
...new Set(
|
|
2426
2432
|
depositInput.payouts.filter((payout) => CASH_RESTRICTED_PLATFORMS.has(payout.processorName.toLowerCase())).map((payout) => resolveCashPaymentMethodHash(payout.processorName, catalog))
|
|
@@ -2517,7 +2523,7 @@ function createCashClient(options) {
|
|
|
2517
2523
|
if (legs.length === 0) {
|
|
2518
2524
|
throw errors.invalidPayoutPlatforms("at least one payout leg is required");
|
|
2519
2525
|
}
|
|
2520
|
-
const capabilities2 = buildCapabilities(environment
|
|
2526
|
+
const capabilities2 = buildCapabilities(environment);
|
|
2521
2527
|
const seenPlatforms = /* @__PURE__ */ new Set();
|
|
2522
2528
|
const payouts = legs.map((leg) => {
|
|
2523
2529
|
const platform = capabilities2.platforms.find(
|
|
@@ -2598,8 +2604,7 @@ function createCashClient(options) {
|
|
|
2598
2604
|
} catch (err) {
|
|
2599
2605
|
throw errors.oracleReadFailed(currency, err);
|
|
2600
2606
|
}
|
|
2601
|
-
}
|
|
2602
|
-
options.features
|
|
2607
|
+
}
|
|
2603
2608
|
);
|
|
2604
2609
|
} catch (err) {
|
|
2605
2610
|
if (isCashError(err)) throw err;
|
|
@@ -2651,7 +2656,7 @@ function createCashClient(options) {
|
|
|
2651
2656
|
const payouts = derivePayouts(
|
|
2652
2657
|
deposit.paymentMethods ?? [],
|
|
2653
2658
|
deposit.currencies ?? [],
|
|
2654
|
-
getCashPaymentMethodsCatalog(environment
|
|
2659
|
+
getCashPaymentMethodsCatalog(environment)
|
|
2655
2660
|
);
|
|
2656
2661
|
let attributedToCash = false;
|
|
2657
2662
|
if (!isCashPayoutSet(payouts)) {
|
|
@@ -2709,7 +2714,7 @@ function createCashClient(options) {
|
|
|
2709
2714
|
return escrowContext(depositId);
|
|
2710
2715
|
}
|
|
2711
2716
|
function capabilities(capabilityOptions) {
|
|
2712
|
-
const baseCapabilities = buildCapabilities(environment
|
|
2717
|
+
const baseCapabilities = buildCapabilities(environment);
|
|
2713
2718
|
if (!capabilityOptions?.includeRelaySources && !capabilityOptions?.includeNearIntentsSources) {
|
|
2714
2719
|
return baseCapabilities;
|
|
2715
2720
|
}
|
|
@@ -2887,11 +2892,7 @@ function createCashClient(options) {
|
|
|
2887
2892
|
}
|
|
2888
2893
|
async function configureCashoutAccess(client, signer, depositInput, depositId, source) {
|
|
2889
2894
|
const groupIds = CASH_ACCESS_GROUP_IDS[environment];
|
|
2890
|
-
const paymentMethods = cashoutAccessPolicyPaymentMethods(
|
|
2891
|
-
depositInput,
|
|
2892
|
-
environment,
|
|
2893
|
-
options.features
|
|
2894
|
-
);
|
|
2895
|
+
const paymentMethods = cashoutAccessPolicyPaymentMethods(depositInput, environment);
|
|
2895
2896
|
const hashes = [];
|
|
2896
2897
|
for (const paymentMethod of paymentMethods) {
|
|
2897
2898
|
const prepared = prepareCashoutAccess(depositId, paymentMethod, client, source);
|
|
@@ -2935,6 +2936,31 @@ function createCashClient(options) {
|
|
|
2935
2936
|
return hashes;
|
|
2936
2937
|
}
|
|
2937
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
|
+
},
|
|
2938
2964
|
capabilities,
|
|
2939
2965
|
async sourceCapabilities() {
|
|
2940
2966
|
return readRelaySourceCapabilities(options.relay);
|
|
@@ -3197,8 +3223,7 @@ function createCashClient(options) {
|
|
|
3197
3223
|
const hashedOnchainIds = (params.paymentMethodDataOverride ?? []).map((d) => d.payeeDetails);
|
|
3198
3224
|
const accessPolicyPaymentMethods = cashoutAccessPolicyPaymentMethods(
|
|
3199
3225
|
depositInput,
|
|
3200
|
-
environment
|
|
3201
|
-
options.features
|
|
3226
|
+
environment
|
|
3202
3227
|
);
|
|
3203
3228
|
return {
|
|
3204
3229
|
txs: [approve, prepared],
|
|
@@ -3269,7 +3294,7 @@ function createCashClient(options) {
|
|
|
3269
3294
|
} catch (err) {
|
|
3270
3295
|
throw errors.indexerUnavailable("orders", err);
|
|
3271
3296
|
}
|
|
3272
|
-
const catalog = getCashPaymentMethodsCatalog(environment
|
|
3297
|
+
const catalog = getCashPaymentMethodsCatalog(environment);
|
|
3273
3298
|
let attributedCashDeposits = /* @__PURE__ */ new Set();
|
|
3274
3299
|
const fixedRateCandidates = deposits.filter((deposit) => {
|
|
3275
3300
|
const payouts = derivePayouts(
|
|
@@ -4019,5 +4044,22 @@ function cashErrorFromJson(json) {
|
|
|
4019
4044
|
...recovery ? { recovery } : {}
|
|
4020
4045
|
});
|
|
4021
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
|
+
}
|
|
4022
4064
|
|
|
4023
|
-
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 { D as CashClient,
|
|
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 { D as CashClient,
|
|
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
package/dist/tools.js
CHANGED
|
@@ -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;
|
|
@@ -38,8 +49,8 @@ Key facts:
|
|
|
38
49
|
fillStats() separately.
|
|
39
50
|
- capabilities() exposes one Zelle platform. A zelle cashout attaches only the
|
|
40
51
|
generic Zelle payment method to the on-chain deposit.
|
|
41
|
-
- UPI/INR is
|
|
42
|
-
`createCashClient({ environment: 'preproduction'
|
|
52
|
+
- UPI/INR is available without feature flags. For example, use
|
|
53
|
+
`createCashClient({ environment: 'preproduction' })`.
|
|
43
54
|
Any valid UPI ID from any bank can receive without a seller login,
|
|
44
55
|
extension, identity attestation, or prior registration flow. Buyers
|
|
45
56
|
pay and verify through Amazon Pay using standard UPI.
|
|
@@ -136,4 +147,4 @@ read-only RPC with `upiCreationRateRpcUrl` or `upiCreationRateTransport`.
|
|
|
136
147
|
Alipay/CNY retains the Ethereum registry and `creationRateRpcUrl` /
|
|
137
148
|
`creationRateTransport`. UPI rejects the wrong chain, invalid rounds, and
|
|
138
149
|
observations older than 24 hours; market closures do not bypass freshness.
|
|
139
|
-
UPI
|
|
150
|
+
UPI is available in production, preproduction, and staging without a feature flag.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zkp2p/cash",
|
|
3
|
-
"version": "0.
|
|
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.
|
|
111
|
+
"@zkp2p/sdk": "0.14.2-rc.4",
|
|
112
112
|
"zod": "^4.4.3"
|
|
113
113
|
},
|
|
114
114
|
"peerDependencies": {
|
|
@@ -183,8 +183,7 @@ platforms outright: a previously registered handle can be reused with bare
|
|
|
183
183
|
payee data. Handle `PAYEE_VERIFICATION_REQUIRED` when registration is still
|
|
184
184
|
needed.
|
|
185
185
|
|
|
186
|
-
UPI is
|
|
187
|
-
with `features: { upi: true }` on a staging or preproduction client. Accept any locally valid
|
|
186
|
+
UPI is available on production, preproduction, and staging clients without feature flags. Accept any locally valid
|
|
188
187
|
UPI ID from any bank; do not add a seller bank-login, extension, identity
|
|
189
188
|
attestation, or pre-registration step. Buyers pay and verify through Amazon Pay using standard UPI; UPI Lite and
|
|
190
189
|
merchant payments are unsupported.
|
|
@@ -273,7 +272,7 @@ read-only RPC with `upiCreationRateRpcUrl` or `upiCreationRateTransport`.
|
|
|
273
272
|
Alipay/CNY retains the Ethereum registry and `creationRateRpcUrl` /
|
|
274
273
|
`creationRateTransport`. UPI rejects the wrong chain, invalid rounds, and
|
|
275
274
|
observations older than 24 hours; market closures do not bypass freshness.
|
|
276
|
-
UPI
|
|
275
|
+
UPI is available in production, preproduction, and staging without a feature flag.
|
|
277
276
|
|
|
278
277
|
Before a funded UPI QA run, call
|
|
279
278
|
`cash.estimate({ amount: 1000000n, platform: 'upi', currency: 'INR' }, { includeEta: false })`
|
|
@@ -283,3 +282,20 @@ old and not in the future. Record the observation time and selected chain,
|
|
|
283
282
|
then stop before funding if the read fails. Unit-test fixtures prove routing,
|
|
284
283
|
not live availability. The authoritative feed listing is
|
|
285
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`.
|
|
@@ -6,9 +6,8 @@ description: Verify the Cash SDK Amazon Pay UPI corridor on preproduction, inclu
|
|
|
6
6
|
# UPI preproduction QA
|
|
7
7
|
|
|
8
8
|
Use the exact published Cash candidate and record its SDK/contracts versions.
|
|
9
|
-
Require `createCashClient({ environment: 'preproduction'
|
|
10
|
-
|
|
11
|
-
UPI must be absent and unsigned preparation must reject before registration or rate reads.
|
|
9
|
+
Require `createCashClient({ environment: 'preproduction' })` to advertise UPI/INR.
|
|
10
|
+
UPI is available without feature flags in every environment.
|
|
12
11
|
The canonical contracts catalog must contain the live UPI method and INR currency;
|
|
13
12
|
never invent a catalog entry when the package or registry omits one.
|
|
14
13
|
|
|
@@ -19,13 +18,10 @@ any transaction:
|
|
|
19
18
|
import { createCashClient } from '@zkp2p/cash';
|
|
20
19
|
|
|
21
20
|
for (const environment of ['staging', 'preproduction', 'production'] as const) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (Boolean(method?.currencies.includes('INR')) !== expected) {
|
|
27
|
-
throw new Error(`Unexpected UPI catalog for ${environment}, flag=${upi}`);
|
|
28
|
-
}
|
|
21
|
+
const client = createCashClient({ environment });
|
|
22
|
+
const method = client.capabilities().platforms.find((item) => item.platform === 'upi');
|
|
23
|
+
if (!method?.currencies.includes('INR')) {
|
|
24
|
+
throw new Error(`Missing UPI catalog for ${environment}`);
|
|
29
25
|
}
|
|
30
26
|
}
|
|
31
27
|
```
|
|
@@ -63,13 +59,12 @@ Inspect `disputeProtectionRequiresStake` before buyer QA so stake admission is
|
|
|
63
59
|
not mistaken for a payment-proof failure.
|
|
64
60
|
|
|
65
61
|
Buyer QA belongs to the client and attestation repositories. Amazon Pay is the
|
|
66
|
-
sole
|
|
62
|
+
sole buyer proof flow. Pay with standard UPI
|
|
67
63
|
to a person, then verify from the same Amazon account. Exclude UPI Lite, merchant
|
|
68
64
|
payments and incoming transactions. Keep session evidence encrypted. A real
|
|
69
65
|
intent requires the exact payment identity, allowed payment-time window, and an
|
|
70
66
|
unused payment nullifier. Report maker deposit, buyer signal, evidence proof,
|
|
71
|
-
and settlement as separate checkpoints.
|
|
72
|
-
a separately authorized retirement; do not remove its server routes here.
|
|
67
|
+
and settlement as separate checkpoints.
|
|
73
68
|
|
|
74
69
|
After buyer intents are cancelled or otherwise terminal, call the supported
|
|
75
70
|
`withdraw` path and verify the receipt and returned order state. If a transaction
|