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