@zkp2p/sdk 0.3.2-rc.0 → 0.4.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -1
- package/dist/chunk-J5LGTIGS.mjs +9 -0
- package/dist/chunk-J5LGTIGS.mjs.map +1 -0
- package/dist/chunk-L526MKG3.mjs +41021 -0
- package/dist/chunk-L526MKG3.mjs.map +1 -0
- package/dist/{currency-PKI2EGJD.mjs → currency-MARF3D2J.mjs} +3 -2
- package/dist/{currency-PKI2EGJD.mjs.map → currency-MARF3D2J.mjs.map} +1 -1
- package/dist/index.cjs +41232 -216
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +17 -25
- package/dist/index.d.ts +17 -25
- package/dist/index.mjs +168 -35
- package/dist/index.mjs.map +1 -1
- package/dist/protocolViewerParsers-GGSM2243.mjs +5 -0
- package/dist/{protocolViewerParsers-ZQZ6QGEX.mjs.map → protocolViewerParsers-GGSM2243.mjs.map} +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.mjs +1 -0
- package/dist/react.mjs.map +1 -1
- package/dist/{timeout-QB7K5SOB.mjs → timeout-YLP3WHZF.mjs} +3 -2
- package/dist/timeout-YLP3WHZF.mjs.map +1 -0
- package/dist/{vaultUtils-C-9Z50Ak.d.mts → vaultUtils-BBdtW9in.d.mts} +25 -13
- package/dist/{vaultUtils-C-9Z50Ak.d.ts → vaultUtils-BBdtW9in.d.ts} +25 -13
- package/package.json +3 -2
- package/dist/chunk-ENH4KRFK.mjs +0 -506
- package/dist/chunk-ENH4KRFK.mjs.map +0 -1
- package/dist/protocolViewerParsers-ZQZ6QGEX.mjs +0 -4
- package/dist/timeout-QB7K5SOB.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Stable TypeScript SDK for trustless fiat-to-crypto on Base. ZKP2P combines escrowed on-chain settlement, TLS attestations for payment verification, and API/indexer helpers so makers, takers, wallets, and embedded ramps can ship production-grade fiat liquidity flows without building their own contract or indexing stack.
|
|
8
8
|
|
|
9
|
-
Current version: `0.3.
|
|
9
|
+
Current version: `0.3.3`
|
|
10
10
|
|
|
11
11
|
## Why This SDK
|
|
12
12
|
|
|
@@ -96,6 +96,7 @@ Indexer defaults by environment:
|
|
|
96
96
|
| Intents | `signalIntent`, `fulfillIntent`, `cancelIntent`, `releaseFundsToPayer`, `getFulfillIntentInputs` |
|
|
97
97
|
| Prepared transactions | `client.prepareCreateDeposit(...)`, `client.signalIntent.prepare(...)`, `client.fulfillIntent.prepare(...)`, `client.setVaultFee.prepare(...)`, and equivalent prepare flows across the rest of the prepareable write surface |
|
|
98
98
|
| Payee and quote APIs | `registerPayeeDetails`, `resolvePayeeHash`, `getQuote`, `getQuotesBestByPlatform`, `getTakerTier` |
|
|
99
|
+
| Seller automated release | `uploadSellerCredential`, `getSellerCredentialStatus`, `verifySellerPayment` |
|
|
99
100
|
| Delegation and hooks | `setDelegate`, `removeDelegate`, `setRateManager`, `clearRateManager`, `setDepositRateManager`, `clearDepositRateManager`, `setDepositPreIntentHook`, `setDepositWhitelistHook` |
|
|
100
101
|
| Vault / DRM | `createRateManager`, `setVaultMinRate`, `setVaultMinRatesBatch`, `setVaultFee`, `setVaultConfig`, `getDepositRateManager`, `getManagerFee`, `getEffectiveRate` |
|
|
101
102
|
| Oracle config | `setOracleRateConfig`, `setOracleRateConfigBatch`, `removeOracleRateConfig`, `updateCurrencyConfigBatch`, `deactivateCurrenciesBatch`, `supportsInlineOracleRateConfig`, `validateOracleFeedsOnChain` |
|
|
@@ -104,6 +105,51 @@ Indexer defaults by environment:
|
|
|
104
105
|
| React hooks | `@zkp2p/sdk/react` exports hooks for deposits, intents, delegation, vaults, payment methods, and taker tier |
|
|
105
106
|
| Attribution | ERC-8021 helpers like `sendTransactionWithAttribution`, `encodeWithAttribution`, and `txOverrides.referrer` support |
|
|
106
107
|
|
|
108
|
+
## Extension Onramp Deeplinks
|
|
109
|
+
|
|
110
|
+
Use `createPeerExtensionSdk()` when a third-party page has signaled an intent and should hand payment authentication and proof generation into the Peer extension.
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import { createPeerExtensionSdk } from '@zkp2p/sdk';
|
|
114
|
+
|
|
115
|
+
const peer = createPeerExtensionSdk();
|
|
116
|
+
const intentHash = await client.signalIntent({
|
|
117
|
+
// quote-selected intent params
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const submitPreparedTransaction = async ({ transaction }) => {
|
|
121
|
+
await walletClient.sendTransaction({
|
|
122
|
+
to: transaction.to,
|
|
123
|
+
data: transaction.data,
|
|
124
|
+
value: BigInt(transaction.value),
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const existing = await peer.getOnrampTransaction(intentHash);
|
|
129
|
+
if (existing) {
|
|
130
|
+
await submitPreparedTransaction(existing);
|
|
131
|
+
} else {
|
|
132
|
+
peer.onramp(
|
|
133
|
+
{
|
|
134
|
+
intentHash,
|
|
135
|
+
referrer: 'Liquidity Page',
|
|
136
|
+
inputCurrency: 'USD',
|
|
137
|
+
inputAmount: '500',
|
|
138
|
+
paymentPlatform: 'venmo',
|
|
139
|
+
depositId: '12345678901234567890',
|
|
140
|
+
amountUsdc: '488280000',
|
|
141
|
+
toToken: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
142
|
+
recipientAddress: '0xRecipient',
|
|
143
|
+
},
|
|
144
|
+
submitPreparedTransaction,
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
For exact-deposit handoffs, pass `depositId` as a string or bigint unless it is known to be a JavaScript-safe integer. The extension derives payment method hashes from `paymentPlatform`; do not pass escrow addresses, payment method hashes, or hashed on-chain ids through the onramp URL. `getOnrampTransaction(intentHash)` is the pull recovery path for prepared calldata when the callback message was missed.
|
|
150
|
+
|
|
151
|
+
See [Extension Onramp Deeplinks](../../docs/extension-onramp-deeplinks.md) for the full parameter contract, exact-deposit semantics, and prepared calldata recovery behavior.
|
|
152
|
+
|
|
107
153
|
## Create a Deposit
|
|
108
154
|
|
|
109
155
|
```ts
|
|
@@ -158,6 +204,17 @@ const payeeHash = await client.resolvePayeeHash(
|
|
|
158
204
|
|
|
159
205
|
`getQuote()` returns available liquidity plus payee details when authenticated. Use `getQuotesBestByPlatform()` to fetch the best quote per supported payment platform in a single call (handy for cross-platform comparison UIs). `getTakerTier()` returns limits and cooldown data for taker UX.
|
|
160
206
|
|
|
207
|
+
## Seller Credential Status
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
const status = await client.getSellerCredentialStatus({
|
|
211
|
+
processorName: 'venmo',
|
|
212
|
+
payeeDetails: '0xPAYEE_DETAILS_HASH',
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
`payeeDetails` is the hashed payee details bytes32 used by maker registration, quotes, and on-chain intents. The public status endpoint returns `{ platform, payeeIdHash, status, credentialType }`; maker row ids are intentionally not returned by status or upload responses.
|
|
217
|
+
|
|
161
218
|
## Signal, Fulfill, and Release Intents
|
|
162
219
|
|
|
163
220
|
```ts
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export { __export };
|
|
8
|
+
//# sourceMappingURL=chunk-J5LGTIGS.mjs.map
|
|
9
|
+
//# sourceMappingURL=chunk-J5LGTIGS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-J5LGTIGS.mjs"}
|