@zkp2p/sdk 0.4.0-rc.2 → 0.4.0-rc.4
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 +13 -0
- package/dist/index.cjs +32 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +32 -11
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/{vaultUtils-CSwo6wIa.d.mts → vaultUtils-ChVrAlJN.d.mts} +5 -4
- package/dist/{vaultUtils-CSwo6wIa.d.ts → vaultUtils-ChVrAlJN.d.ts} +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -206,6 +206,19 @@ const payeeHash = await client.resolvePayeeHash(
|
|
|
206
206
|
|
|
207
207
|
## Seller Credential Status
|
|
208
208
|
|
|
209
|
+
```ts
|
|
210
|
+
await client.uploadSellerCredential({
|
|
211
|
+
platform: 'venmo',
|
|
212
|
+
offchainId: 'alice',
|
|
213
|
+
payeeId: '123456',
|
|
214
|
+
sessionMaterial: {
|
|
215
|
+
recipientUsername: 'alice',
|
|
216
|
+
accountId: '123456',
|
|
217
|
+
sessionCookie: 'session-cookie',
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
209
222
|
```ts
|
|
210
223
|
const status = await client.getSellerCredentialStatus({
|
|
211
224
|
processorName: 'venmo',
|
package/dist/index.cjs
CHANGED
|
@@ -47078,13 +47078,14 @@ async function apiGetTakerTier(req, apiKey, baseApiUrl, timeoutMs) {
|
|
|
47078
47078
|
timeoutMs
|
|
47079
47079
|
});
|
|
47080
47080
|
}
|
|
47081
|
-
async function apiUploadSellerCredential(
|
|
47081
|
+
async function apiUploadSellerCredential(processorName, payeeDetails, bundle, baseApiUrl, timeoutMs) {
|
|
47082
|
+
const endpoint = `/v2/makers/${encodeURIComponent(processorName)}/${encodeURIComponent(
|
|
47083
|
+
payeeDetails
|
|
47084
|
+
)}/seller-credential`;
|
|
47082
47085
|
return apiFetch({
|
|
47083
|
-
url: `${withApiBase(baseApiUrl)}
|
|
47086
|
+
url: `${withApiBase(baseApiUrl)}${endpoint}`,
|
|
47084
47087
|
method: "POST",
|
|
47085
47088
|
body: bundle,
|
|
47086
|
-
apiKey,
|
|
47087
|
-
authToken,
|
|
47088
47089
|
timeoutMs
|
|
47089
47090
|
});
|
|
47090
47091
|
}
|
|
@@ -49711,9 +49712,8 @@ var Zkp2pClient = class {
|
|
|
49711
49712
|
* seller-automated-release availability is governed by curator's probe/revalidation state
|
|
49712
49713
|
* rather than these timestamps.
|
|
49713
49714
|
*
|
|
49714
|
-
*
|
|
49715
|
-
*
|
|
49716
|
-
* Create a signed seller credential bundle with attestation-service and store it on the maker via curator.
|
|
49715
|
+
* Register or recover the payee maker row, create a signed seller credential bundle with
|
|
49716
|
+
* attestation-service, and store it via curator's platform plus hashed payee-details route.
|
|
49717
49717
|
*/
|
|
49718
49718
|
async uploadSellerCredential(params, opts) {
|
|
49719
49719
|
const baseApiUrl = this.stripTrailingSlash(
|
|
@@ -49723,6 +49723,24 @@ var Zkp2pClient = class {
|
|
|
49723
49723
|
const attestationServiceUrl = this.stripTrailingSlash(
|
|
49724
49724
|
opts?.attestationServiceUrl ?? this.defaultAttestationServiceForBaseApiUrl(baseApiUrl)
|
|
49725
49725
|
);
|
|
49726
|
+
const registeredPayeePayload = {
|
|
49727
|
+
offchainId: params.offchainId,
|
|
49728
|
+
processorName: params.platform
|
|
49729
|
+
};
|
|
49730
|
+
if (params.telegramUsername !== void 0) {
|
|
49731
|
+
registeredPayeePayload.telegramUsername = params.telegramUsername;
|
|
49732
|
+
}
|
|
49733
|
+
if (params.metadata !== void 0) {
|
|
49734
|
+
registeredPayeePayload.metadata = params.metadata;
|
|
49735
|
+
}
|
|
49736
|
+
const registeredPayeeResponse = await apiPostDepositDetails(
|
|
49737
|
+
registeredPayeePayload,
|
|
49738
|
+
baseApiUrl,
|
|
49739
|
+
timeoutMs
|
|
49740
|
+
);
|
|
49741
|
+
if (!registeredPayeeResponse.success || !registeredPayeeResponse.responseObject) {
|
|
49742
|
+
throw new Error(registeredPayeeResponse.message || "Failed to register seller payee details");
|
|
49743
|
+
}
|
|
49726
49744
|
const uploadPayload = {
|
|
49727
49745
|
payeeId: params.payeeId,
|
|
49728
49746
|
sessionMaterial: params.sessionMaterial
|
|
@@ -49742,13 +49760,16 @@ var Zkp2pClient = class {
|
|
|
49742
49760
|
if (!bundleResponse.success || !bundleResponse.responseObject) {
|
|
49743
49761
|
throw new Error(bundleResponse.message || "Failed to create seller credential bundle");
|
|
49744
49762
|
}
|
|
49763
|
+
const registeredPayee = registeredPayeeResponse.responseObject;
|
|
49764
|
+
if (registeredPayee.hashedOnchainId.toLowerCase() !== bundleResponse.responseObject.payeeIdHash.toLowerCase()) {
|
|
49765
|
+
throw new Error("Seller credential payee hash does not match registered payee details");
|
|
49766
|
+
}
|
|
49745
49767
|
return apiUploadSellerCredential(
|
|
49746
|
-
params.
|
|
49768
|
+
params.platform,
|
|
49769
|
+
registeredPayee.hashedOnchainId,
|
|
49747
49770
|
bundleResponse.responseObject,
|
|
49748
49771
|
baseApiUrl,
|
|
49749
|
-
timeoutMs
|
|
49750
|
-
this.apiKey,
|
|
49751
|
-
this.authorizationToken
|
|
49772
|
+
timeoutMs
|
|
49752
49773
|
);
|
|
49753
49774
|
}
|
|
49754
49775
|
/**
|