@zkp2p/sdk 0.3.0 → 0.3.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/README.md +6 -6
- package/dist/index.cjs +137 -41
- 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 +137 -41
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +4 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +4 -10
- package/dist/react.d.ts +4 -10
- package/dist/react.mjs +4 -1
- package/dist/react.mjs.map +1 -1
- package/dist/{vaultUtils-sodi4Xx-.d.mts → vaultUtils-DATqc35J.d.mts} +52 -35
- package/dist/{vaultUtils-sodi4Xx-.d.ts → vaultUtils-DATqc35J.d.ts} +52 -35
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, Q as QuotesBestByPlatformRequest, B as BestByPlatformResponse, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetOwnerDepositsRequest, e as GetOwnerDepositsResponse, f as GetTakerTierRequest, g as GetTakerTierResponse, C as CurrencyType, h as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-
|
|
2
|
-
export { m as ActionCallback, a1 as ApiDeposit, a8 as ApiIntentStatus, A as AuthorizationTokenProvider, bA as BatchResult, u as BestByPlatformResponseObject, j as CancelIntentMethodParams, t as CancelIntentParams, o as CreateDepositConversionRate, n as CreateDepositParams, b3 as Currency, ba as CurrencyData, bz as DelegationDepositTarget, bx as DelegationRoute, by as DelegationState, bl as Deposit, bn as DepositCurrency, al as DepositIntentStatistics, a4 as DepositStatus, a2 as DepositVerifier, a3 as DepositVerifierCurrency, ai as DepositVerifierData, bk as DepositView, Y as FiatResponse, F as FulfillIntentMethodParams, r as FulfillIntentParams, v as GetBestByPlatformResponse, w as GetBestByPlatformResponseObject, a5 as GetDepositByIdRequest, a6 as GetDepositByIdResponse, ad as GetIntentByHashRequest, ae as GetIntentByHashResponse, ab as GetIntentsByDepositRequest, ac as GetIntentsByDepositResponse, E as GetNearbyQuote, H as GetNearbySuggestions, a9 as GetOwnerIntentsRequest, aa as GetOwnerIntentsResponse, x as GetPlatformQuote, J as GetQuoteResponse, K as GetQuoteResponseObject, L as GetQuoteSingleResponse, ar as IndexerClient, aZ as IndexerDeploymentEnv, ax as IndexerDeposit, aO as IndexerDepositDailySnapshot, aQ as IndexerDepositFilter, aN as IndexerDepositFundActivity, aP as IndexerDepositFundActivityType, aT as IndexerDepositOrderDirection, aS as IndexerDepositOrderField, aR as IndexerDepositPagination, aA as IndexerDepositPaymentMethod, at as IndexerDepositService, b0 as IndexerFulfillmentAndPaymentResponse, a_ as IndexerFulfillmentRecord, ay as IndexerIntentFulfilled, az as IndexerIntentFulfillmentAmounts, aC as IndexerIntentStatus, aG as IndexerManagerAggregateStats, aI as IndexerManagerDailySnapshot, aH as IndexerManagerStats, aL as IndexerManualRateUpdate, aB as IndexerMethodCurrency, aM as IndexerOracleConfigUpdate, a$ as IndexerPaymentVerifiedRecord, aD as IndexerRateManager, aF as IndexerRateManagerDelegation, aW as IndexerRateManagerDelegationPagination, aK as IndexerRateManagerDetail, aU as IndexerRateManagerFilter, aJ as IndexerRateManagerListItem, aY as IndexerRateManagerOrderDirection, aX as IndexerRateManagerOrderField, aV as IndexerRateManagerPagination, aE as IndexerRateManagerRate, au as IndexerRateManagerService, a7 as Intent, bp as IntentView, $ as NearbyQuote, a0 as NearbySuggestions, Z as OfframpClient, ah as OnchainCurrency, bq as OnchainIntent, ak as OrderStats, b1 as PAYMENT_PLATFORMS, bm as PaymentMethodData, b2 as PaymentPlatformType, ap as PlatformLimit, y as PlatformQuote, aq as PlatformRiskLevel, aj as PreparedTransaction, X as QuoteFeesResponse, U as QuoteIntentResponse, z as QuoteRequest, M as QuoteResponse, N as QuoteResponseObject, O as QuoteSingleResponse, p as Range, bo as ReferralFee, af as RegisterPayeeDetailsRequest, ag as RegisterPayeeDetailsResponse, s as ReleaseFundsToPayerParams, bf as RuntimeEnv, bC as SendBatchFn, bB as SendTransactionFn, i as SignalIntentMethodParams, q as SignalIntentParams, S as SignalIntentReferralFee, am as TakerTier, ao as TakerTierLevel, an as TakerTierStats, l as TimeoutConfig, _ as TokenResponse, W as WithdrawDepositParams, br as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, k as Zkp2pClientOptions, bw as classifyDelegationState, av as compareEventCursorIdsByRecency, b4 as currencyInfo, as as defaultIndexerEndpoint, bi as enrichPvDepositView, bj as enrichPvIntentView, aw as fetchIndexerFulfillmentAndPayment, bb as getContracts, b7 as getCurrencyCodeFromHash, b6 as getCurrencyInfoFromCountryCode, b5 as getCurrencyInfoFromHash, bv as getDelegationRoute, be as getGatingServiceAddress, bd as getPaymentMethodsCatalog, bc as getRateManagerContracts, b8 as isSupportedCurrencyHash, bs as isZeroRateManagerId, b9 as mapConversionRatesToOnchainMinRate, bt as normalizeRateManagerId, bu as normalizeRegistry, bg as parseDepositView, bh as parseIntentView } from './vaultUtils-
|
|
1
|
+
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, Q as QuotesBestByPlatformRequest, B as BestByPlatformResponse, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetOwnerDepositsRequest, e as GetOwnerDepositsResponse, f as GetTakerTierRequest, g as GetTakerTierResponse, C as CurrencyType, h as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-DATqc35J.mjs';
|
|
2
|
+
export { m as ActionCallback, a1 as ApiDeposit, a8 as ApiIntentStatus, A as AuthorizationTokenProvider, bA as BatchResult, u as BestByPlatformResponseObject, j as CancelIntentMethodParams, t as CancelIntentParams, o as CreateDepositConversionRate, n as CreateDepositParams, b3 as Currency, ba as CurrencyData, bz as DelegationDepositTarget, bx as DelegationRoute, by as DelegationState, bl as Deposit, bn as DepositCurrency, al as DepositIntentStatistics, a4 as DepositStatus, a2 as DepositVerifier, a3 as DepositVerifierCurrency, ai as DepositVerifierData, bk as DepositView, Y as FiatResponse, F as FulfillIntentMethodParams, r as FulfillIntentParams, v as GetBestByPlatformResponse, w as GetBestByPlatformResponseObject, a5 as GetDepositByIdRequest, a6 as GetDepositByIdResponse, ad as GetIntentByHashRequest, ae as GetIntentByHashResponse, ab as GetIntentsByDepositRequest, ac as GetIntentsByDepositResponse, E as GetNearbyQuote, H as GetNearbySuggestions, a9 as GetOwnerIntentsRequest, aa as GetOwnerIntentsResponse, x as GetPlatformQuote, J as GetQuoteResponse, K as GetQuoteResponseObject, L as GetQuoteSingleResponse, ar as IndexerClient, aZ as IndexerDeploymentEnv, ax as IndexerDeposit, aO as IndexerDepositDailySnapshot, aQ as IndexerDepositFilter, aN as IndexerDepositFundActivity, aP as IndexerDepositFundActivityType, aT as IndexerDepositOrderDirection, aS as IndexerDepositOrderField, aR as IndexerDepositPagination, aA as IndexerDepositPaymentMethod, at as IndexerDepositService, b0 as IndexerFulfillmentAndPaymentResponse, a_ as IndexerFulfillmentRecord, ay as IndexerIntentFulfilled, az as IndexerIntentFulfillmentAmounts, aC as IndexerIntentStatus, aG as IndexerManagerAggregateStats, aI as IndexerManagerDailySnapshot, aH as IndexerManagerStats, aL as IndexerManualRateUpdate, aB as IndexerMethodCurrency, aM as IndexerOracleConfigUpdate, a$ as IndexerPaymentVerifiedRecord, aD as IndexerRateManager, aF as IndexerRateManagerDelegation, aW as IndexerRateManagerDelegationPagination, aK as IndexerRateManagerDetail, aU as IndexerRateManagerFilter, aJ as IndexerRateManagerListItem, aY as IndexerRateManagerOrderDirection, aX as IndexerRateManagerOrderField, aV as IndexerRateManagerPagination, aE as IndexerRateManagerRate, au as IndexerRateManagerService, a7 as Intent, bp as IntentView, $ as NearbyQuote, a0 as NearbySuggestions, Z as OfframpClient, ah as OnchainCurrency, bq as OnchainIntent, ak as OrderStats, b1 as PAYMENT_PLATFORMS, bm as PaymentMethodData, b2 as PaymentPlatformType, ap as PlatformLimit, y as PlatformQuote, aq as PlatformRiskLevel, aj as PreparedTransaction, X as QuoteFeesResponse, U as QuoteIntentResponse, z as QuoteRequest, M as QuoteResponse, N as QuoteResponseObject, O as QuoteSingleResponse, p as Range, bo as ReferralFee, af as RegisterPayeeDetailsRequest, ag as RegisterPayeeDetailsResponse, s as ReleaseFundsToPayerParams, bf as RuntimeEnv, bC as SendBatchFn, bB as SendTransactionFn, i as SignalIntentMethodParams, q as SignalIntentParams, S as SignalIntentReferralFee, am as TakerTier, ao as TakerTierLevel, an as TakerTierStats, l as TimeoutConfig, _ as TokenResponse, W as WithdrawDepositParams, br as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, k as Zkp2pClientOptions, bw as classifyDelegationState, av as compareEventCursorIdsByRecency, b4 as currencyInfo, as as defaultIndexerEndpoint, bi as enrichPvDepositView, bj as enrichPvIntentView, aw as fetchIndexerFulfillmentAndPayment, bb as getContracts, b7 as getCurrencyCodeFromHash, b6 as getCurrencyInfoFromCountryCode, b5 as getCurrencyInfoFromHash, bv as getDelegationRoute, be as getGatingServiceAddress, bd as getPaymentMethodsCatalog, bc as getRateManagerContracts, b8 as isSupportedCurrencyHash, bs as isZeroRateManagerId, b9 as mapConversionRatesToOnchainMinRate, bt as normalizeRateManagerId, bu as normalizeRegistry, bg as parseDepositView, bh as parseIntentView } from './vaultUtils-DATqc35J.mjs';
|
|
3
3
|
import { Address, Hex, WalletClient, Hash } from 'viem';
|
|
4
4
|
import { Abi } from 'abitype';
|
|
5
5
|
import '@zkp2p/indexer-schema';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, Q as QuotesBestByPlatformRequest, B as BestByPlatformResponse, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetOwnerDepositsRequest, e as GetOwnerDepositsResponse, f as GetTakerTierRequest, g as GetTakerTierResponse, C as CurrencyType, h as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-
|
|
2
|
-
export { m as ActionCallback, a1 as ApiDeposit, a8 as ApiIntentStatus, A as AuthorizationTokenProvider, bA as BatchResult, u as BestByPlatformResponseObject, j as CancelIntentMethodParams, t as CancelIntentParams, o as CreateDepositConversionRate, n as CreateDepositParams, b3 as Currency, ba as CurrencyData, bz as DelegationDepositTarget, bx as DelegationRoute, by as DelegationState, bl as Deposit, bn as DepositCurrency, al as DepositIntentStatistics, a4 as DepositStatus, a2 as DepositVerifier, a3 as DepositVerifierCurrency, ai as DepositVerifierData, bk as DepositView, Y as FiatResponse, F as FulfillIntentMethodParams, r as FulfillIntentParams, v as GetBestByPlatformResponse, w as GetBestByPlatformResponseObject, a5 as GetDepositByIdRequest, a6 as GetDepositByIdResponse, ad as GetIntentByHashRequest, ae as GetIntentByHashResponse, ab as GetIntentsByDepositRequest, ac as GetIntentsByDepositResponse, E as GetNearbyQuote, H as GetNearbySuggestions, a9 as GetOwnerIntentsRequest, aa as GetOwnerIntentsResponse, x as GetPlatformQuote, J as GetQuoteResponse, K as GetQuoteResponseObject, L as GetQuoteSingleResponse, ar as IndexerClient, aZ as IndexerDeploymentEnv, ax as IndexerDeposit, aO as IndexerDepositDailySnapshot, aQ as IndexerDepositFilter, aN as IndexerDepositFundActivity, aP as IndexerDepositFundActivityType, aT as IndexerDepositOrderDirection, aS as IndexerDepositOrderField, aR as IndexerDepositPagination, aA as IndexerDepositPaymentMethod, at as IndexerDepositService, b0 as IndexerFulfillmentAndPaymentResponse, a_ as IndexerFulfillmentRecord, ay as IndexerIntentFulfilled, az as IndexerIntentFulfillmentAmounts, aC as IndexerIntentStatus, aG as IndexerManagerAggregateStats, aI as IndexerManagerDailySnapshot, aH as IndexerManagerStats, aL as IndexerManualRateUpdate, aB as IndexerMethodCurrency, aM as IndexerOracleConfigUpdate, a$ as IndexerPaymentVerifiedRecord, aD as IndexerRateManager, aF as IndexerRateManagerDelegation, aW as IndexerRateManagerDelegationPagination, aK as IndexerRateManagerDetail, aU as IndexerRateManagerFilter, aJ as IndexerRateManagerListItem, aY as IndexerRateManagerOrderDirection, aX as IndexerRateManagerOrderField, aV as IndexerRateManagerPagination, aE as IndexerRateManagerRate, au as IndexerRateManagerService, a7 as Intent, bp as IntentView, $ as NearbyQuote, a0 as NearbySuggestions, Z as OfframpClient, ah as OnchainCurrency, bq as OnchainIntent, ak as OrderStats, b1 as PAYMENT_PLATFORMS, bm as PaymentMethodData, b2 as PaymentPlatformType, ap as PlatformLimit, y as PlatformQuote, aq as PlatformRiskLevel, aj as PreparedTransaction, X as QuoteFeesResponse, U as QuoteIntentResponse, z as QuoteRequest, M as QuoteResponse, N as QuoteResponseObject, O as QuoteSingleResponse, p as Range, bo as ReferralFee, af as RegisterPayeeDetailsRequest, ag as RegisterPayeeDetailsResponse, s as ReleaseFundsToPayerParams, bf as RuntimeEnv, bC as SendBatchFn, bB as SendTransactionFn, i as SignalIntentMethodParams, q as SignalIntentParams, S as SignalIntentReferralFee, am as TakerTier, ao as TakerTierLevel, an as TakerTierStats, l as TimeoutConfig, _ as TokenResponse, W as WithdrawDepositParams, br as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, k as Zkp2pClientOptions, bw as classifyDelegationState, av as compareEventCursorIdsByRecency, b4 as currencyInfo, as as defaultIndexerEndpoint, bi as enrichPvDepositView, bj as enrichPvIntentView, aw as fetchIndexerFulfillmentAndPayment, bb as getContracts, b7 as getCurrencyCodeFromHash, b6 as getCurrencyInfoFromCountryCode, b5 as getCurrencyInfoFromHash, bv as getDelegationRoute, be as getGatingServiceAddress, bd as getPaymentMethodsCatalog, bc as getRateManagerContracts, b8 as isSupportedCurrencyHash, bs as isZeroRateManagerId, b9 as mapConversionRatesToOnchainMinRate, bt as normalizeRateManagerId, bu as normalizeRegistry, bg as parseDepositView, bh as parseIntentView } from './vaultUtils-
|
|
1
|
+
import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, Q as QuotesBestByPlatformRequest, B as BestByPlatformResponse, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetOwnerDepositsRequest, e as GetOwnerDepositsResponse, f as GetTakerTierRequest, g as GetTakerTierResponse, C as CurrencyType, h as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-DATqc35J.js';
|
|
2
|
+
export { m as ActionCallback, a1 as ApiDeposit, a8 as ApiIntentStatus, A as AuthorizationTokenProvider, bA as BatchResult, u as BestByPlatformResponseObject, j as CancelIntentMethodParams, t as CancelIntentParams, o as CreateDepositConversionRate, n as CreateDepositParams, b3 as Currency, ba as CurrencyData, bz as DelegationDepositTarget, bx as DelegationRoute, by as DelegationState, bl as Deposit, bn as DepositCurrency, al as DepositIntentStatistics, a4 as DepositStatus, a2 as DepositVerifier, a3 as DepositVerifierCurrency, ai as DepositVerifierData, bk as DepositView, Y as FiatResponse, F as FulfillIntentMethodParams, r as FulfillIntentParams, v as GetBestByPlatformResponse, w as GetBestByPlatformResponseObject, a5 as GetDepositByIdRequest, a6 as GetDepositByIdResponse, ad as GetIntentByHashRequest, ae as GetIntentByHashResponse, ab as GetIntentsByDepositRequest, ac as GetIntentsByDepositResponse, E as GetNearbyQuote, H as GetNearbySuggestions, a9 as GetOwnerIntentsRequest, aa as GetOwnerIntentsResponse, x as GetPlatformQuote, J as GetQuoteResponse, K as GetQuoteResponseObject, L as GetQuoteSingleResponse, ar as IndexerClient, aZ as IndexerDeploymentEnv, ax as IndexerDeposit, aO as IndexerDepositDailySnapshot, aQ as IndexerDepositFilter, aN as IndexerDepositFundActivity, aP as IndexerDepositFundActivityType, aT as IndexerDepositOrderDirection, aS as IndexerDepositOrderField, aR as IndexerDepositPagination, aA as IndexerDepositPaymentMethod, at as IndexerDepositService, b0 as IndexerFulfillmentAndPaymentResponse, a_ as IndexerFulfillmentRecord, ay as IndexerIntentFulfilled, az as IndexerIntentFulfillmentAmounts, aC as IndexerIntentStatus, aG as IndexerManagerAggregateStats, aI as IndexerManagerDailySnapshot, aH as IndexerManagerStats, aL as IndexerManualRateUpdate, aB as IndexerMethodCurrency, aM as IndexerOracleConfigUpdate, a$ as IndexerPaymentVerifiedRecord, aD as IndexerRateManager, aF as IndexerRateManagerDelegation, aW as IndexerRateManagerDelegationPagination, aK as IndexerRateManagerDetail, aU as IndexerRateManagerFilter, aJ as IndexerRateManagerListItem, aY as IndexerRateManagerOrderDirection, aX as IndexerRateManagerOrderField, aV as IndexerRateManagerPagination, aE as IndexerRateManagerRate, au as IndexerRateManagerService, a7 as Intent, bp as IntentView, $ as NearbyQuote, a0 as NearbySuggestions, Z as OfframpClient, ah as OnchainCurrency, bq as OnchainIntent, ak as OrderStats, b1 as PAYMENT_PLATFORMS, bm as PaymentMethodData, b2 as PaymentPlatformType, ap as PlatformLimit, y as PlatformQuote, aq as PlatformRiskLevel, aj as PreparedTransaction, X as QuoteFeesResponse, U as QuoteIntentResponse, z as QuoteRequest, M as QuoteResponse, N as QuoteResponseObject, O as QuoteSingleResponse, p as Range, bo as ReferralFee, af as RegisterPayeeDetailsRequest, ag as RegisterPayeeDetailsResponse, s as ReleaseFundsToPayerParams, bf as RuntimeEnv, bC as SendBatchFn, bB as SendTransactionFn, i as SignalIntentMethodParams, q as SignalIntentParams, S as SignalIntentReferralFee, am as TakerTier, ao as TakerTierLevel, an as TakerTierStats, l as TimeoutConfig, _ as TokenResponse, W as WithdrawDepositParams, br as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, k as Zkp2pClientOptions, bw as classifyDelegationState, av as compareEventCursorIdsByRecency, b4 as currencyInfo, as as defaultIndexerEndpoint, bi as enrichPvDepositView, bj as enrichPvIntentView, aw as fetchIndexerFulfillmentAndPayment, bb as getContracts, b7 as getCurrencyCodeFromHash, b6 as getCurrencyInfoFromCountryCode, b5 as getCurrencyInfoFromHash, bv as getDelegationRoute, be as getGatingServiceAddress, bd as getPaymentMethodsCatalog, bc as getRateManagerContracts, b8 as isSupportedCurrencyHash, bs as isZeroRateManagerId, b9 as mapConversionRatesToOnchainMinRate, bt as normalizeRateManagerId, bu as normalizeRegistry, bg as parseDepositView, bh as parseIntentView } from './vaultUtils-DATqc35J.js';
|
|
3
3
|
import { Address, Hex, WalletClient, Hash } from 'viem';
|
|
4
4
|
import { Abi } from 'abitype';
|
|
5
5
|
import '@zkp2p/indexer-schema';
|
package/dist/index.mjs
CHANGED
|
@@ -367,7 +367,7 @@ function createHeaders(apiKey, authorizationToken) {
|
|
|
367
367
|
return headers2;
|
|
368
368
|
}
|
|
369
369
|
async function apiSignIntentV3(request, opts) {
|
|
370
|
-
const url = `${opts.baseApiUrl.replace(/\/$/, "")}/v3/intent`;
|
|
370
|
+
const url = `${opts.baseApiUrl.replace(/\/$/, "")}/v3/intent/sign`;
|
|
371
371
|
const json = await withRetry(
|
|
372
372
|
async () => {
|
|
373
373
|
let res;
|
|
@@ -379,7 +379,7 @@ async function apiSignIntentV3(request, opts) {
|
|
|
379
379
|
});
|
|
380
380
|
} catch (error) {
|
|
381
381
|
throw new NetworkError("Failed to connect to API server", {
|
|
382
|
-
endpoint: "/v3/intent",
|
|
382
|
+
endpoint: "/v3/intent/sign",
|
|
383
383
|
error
|
|
384
384
|
});
|
|
385
385
|
}
|
|
@@ -397,7 +397,7 @@ async function apiSignIntentV3(request, opts) {
|
|
|
397
397
|
const expStr = json?.responseObject?.intentData?.signatureExpiration ?? json?.responseObject?.signatureExpiration;
|
|
398
398
|
const preIntentHookData = json?.responseObject?.intentData?.preIntentHookData ?? json?.responseObject?.preIntentHookData;
|
|
399
399
|
const referralFees = json?.responseObject?.intentData?.referralFees ?? json?.responseObject?.referralFees;
|
|
400
|
-
if (!sig || !expStr) throw new Error("v3/intent missing signature or expiration");
|
|
400
|
+
if (!sig || !expStr) throw new Error("v3/intent/sign missing signature or expiration");
|
|
401
401
|
return {
|
|
402
402
|
signature: sig,
|
|
403
403
|
signatureExpiration: BigInt(expStr),
|
|
@@ -866,13 +866,13 @@ var IntentOperations = class {
|
|
|
866
866
|
if (response.referralFees !== void 0) {
|
|
867
867
|
referralFees = response.referralFees.map((referralFee) => {
|
|
868
868
|
if (!isValidReferrerFeeRecipient(referralFee.recipient)) {
|
|
869
|
-
throw new Error("v3/intent returned invalid referral fee recipient");
|
|
869
|
+
throw new Error("v3/intent/sign returned invalid referral fee recipient");
|
|
870
870
|
}
|
|
871
871
|
let fee;
|
|
872
872
|
try {
|
|
873
873
|
fee = BigInt(referralFee.fee);
|
|
874
874
|
} catch {
|
|
875
|
-
throw new Error("v3/intent returned non-integer referral fee value");
|
|
875
|
+
throw new Error("v3/intent/sign returned non-integer referral fee value");
|
|
876
876
|
}
|
|
877
877
|
return {
|
|
878
878
|
recipient: referralFee.recipient,
|
|
@@ -4842,7 +4842,7 @@ function convertIndexerDepositToLegacyApiDeposit(deposit) {
|
|
|
4842
4842
|
}
|
|
4843
4843
|
async function apiPostDepositDetails(req, baseApiUrl, timeoutMs, _apiKey, _authToken) {
|
|
4844
4844
|
return apiFetch({
|
|
4845
|
-
url: `${withApiBase(baseApiUrl)}/
|
|
4845
|
+
url: `${withApiBase(baseApiUrl)}/v2/makers/create`,
|
|
4846
4846
|
method: "POST",
|
|
4847
4847
|
body: req,
|
|
4848
4848
|
timeoutMs
|
|
@@ -4875,7 +4875,8 @@ async function apiGetQuote(req, baseApiUrl, timeoutMs, apiKey, authToken) {
|
|
|
4875
4875
|
[isExactFiat ? "exactFiatAmount" : "exactTokenAmount"]: String(req.amount),
|
|
4876
4876
|
amount: void 0,
|
|
4877
4877
|
isExactFiat: void 0,
|
|
4878
|
-
quotesToReturn: void 0
|
|
4878
|
+
quotesToReturn: void 0,
|
|
4879
|
+
includePrivateOrderbooks: req.includePrivateOrderbooks
|
|
4879
4880
|
};
|
|
4880
4881
|
Object.keys(requestBody).forEach((k) => requestBody[k] === void 0 && delete requestBody[k]);
|
|
4881
4882
|
return apiFetch({
|
|
@@ -4912,7 +4913,7 @@ async function apiGetQuotesBestByPlatform(req, baseApiUrl, timeoutMs, apiKey, au
|
|
|
4912
4913
|
}
|
|
4913
4914
|
async function apiGetPayeeDetails(req, apiKey, baseApiUrl, authToken, timeoutMs) {
|
|
4914
4915
|
return apiFetch({
|
|
4915
|
-
url: `${baseApiUrl.replace(/\/$/, "")}/
|
|
4916
|
+
url: `${baseApiUrl.replace(/\/$/, "")}/v2/makers/${req.processorName}/${req.hashedOnchainId}`,
|
|
4916
4917
|
method: "GET",
|
|
4917
4918
|
apiKey,
|
|
4918
4919
|
authToken,
|
|
@@ -4921,7 +4922,7 @@ async function apiGetPayeeDetails(req, apiKey, baseApiUrl, authToken, timeoutMs)
|
|
|
4921
4922
|
}
|
|
4922
4923
|
async function apiValidatePayeeDetails(req, baseApiUrl, timeoutMs) {
|
|
4923
4924
|
const data = await apiFetch({
|
|
4924
|
-
url: `${baseApiUrl.replace(/\/$/, "")}/
|
|
4925
|
+
url: `${baseApiUrl.replace(/\/$/, "")}/v2/makers/validate`,
|
|
4925
4926
|
method: "POST",
|
|
4926
4927
|
body: req,
|
|
4927
4928
|
timeoutMs
|
|
@@ -5115,6 +5116,95 @@ var ERC20_ABI = [
|
|
|
5115
5116
|
];
|
|
5116
5117
|
|
|
5117
5118
|
// src/client/Zkp2pClient.ts
|
|
5119
|
+
function isStringRecord(value) {
|
|
5120
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
5121
|
+
return false;
|
|
5122
|
+
}
|
|
5123
|
+
return Object.values(value).every((entry) => typeof entry === "string");
|
|
5124
|
+
}
|
|
5125
|
+
function normalizeTelegramUsername(value) {
|
|
5126
|
+
if (typeof value !== "string") {
|
|
5127
|
+
return value === null ? null : null;
|
|
5128
|
+
}
|
|
5129
|
+
const normalized = value.trim();
|
|
5130
|
+
return normalized.length > 0 ? normalized : null;
|
|
5131
|
+
}
|
|
5132
|
+
function extractLegacyQuotePayeeData(depositData) {
|
|
5133
|
+
if (!depositData || typeof depositData !== "object" || Array.isArray(depositData)) {
|
|
5134
|
+
return void 0;
|
|
5135
|
+
}
|
|
5136
|
+
const stringEntries = Object.entries(depositData).filter(
|
|
5137
|
+
(entry) => typeof entry[1] === "string" && entry[1].trim().length > 0
|
|
5138
|
+
);
|
|
5139
|
+
const telegramUsername = stringEntries.find(([key]) => key === "telegramUsername")?.[1] ?? null;
|
|
5140
|
+
const identifierEntries = stringEntries.filter(([key]) => key !== "telegramUsername");
|
|
5141
|
+
const [primaryEntry, ...metadataEntries] = identifierEntries;
|
|
5142
|
+
if (!primaryEntry) {
|
|
5143
|
+
return void 0;
|
|
5144
|
+
}
|
|
5145
|
+
return {
|
|
5146
|
+
offchainId: primaryEntry[1],
|
|
5147
|
+
telegramUsername,
|
|
5148
|
+
metadata: metadataEntries.length > 0 ? Object.fromEntries(metadataEntries) : null
|
|
5149
|
+
};
|
|
5150
|
+
}
|
|
5151
|
+
function normalizeQuotePayeeData(maker) {
|
|
5152
|
+
const legacy = extractLegacyQuotePayeeData(maker?.depositData);
|
|
5153
|
+
const offchainId = typeof maker?.offchainId === "string" && maker.offchainId.trim().length > 0 ? maker.offchainId : legacy?.offchainId;
|
|
5154
|
+
if (!offchainId) {
|
|
5155
|
+
return void 0;
|
|
5156
|
+
}
|
|
5157
|
+
return {
|
|
5158
|
+
offchainId,
|
|
5159
|
+
telegramUsername: normalizeTelegramUsername(maker?.telegramUsername) ?? legacy?.telegramUsername ?? null,
|
|
5160
|
+
metadata: isStringRecord(maker?.metadata) ? maker.metadata : legacy?.metadata ?? null
|
|
5161
|
+
};
|
|
5162
|
+
}
|
|
5163
|
+
function normalizePayeeDataInputItem(raw) {
|
|
5164
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
5165
|
+
return null;
|
|
5166
|
+
}
|
|
5167
|
+
const candidate = raw;
|
|
5168
|
+
if (typeof candidate.offchainId === "string" && candidate.offchainId.trim().length > 0) {
|
|
5169
|
+
return candidate;
|
|
5170
|
+
}
|
|
5171
|
+
const legacy = extractLegacyQuotePayeeData(raw);
|
|
5172
|
+
if (!legacy) {
|
|
5173
|
+
return null;
|
|
5174
|
+
}
|
|
5175
|
+
return {
|
|
5176
|
+
offchainId: legacy.offchainId,
|
|
5177
|
+
telegramUsername: legacy.telegramUsername,
|
|
5178
|
+
metadata: legacy.metadata
|
|
5179
|
+
};
|
|
5180
|
+
}
|
|
5181
|
+
function resolvePayeeDataInput(params, methodName) {
|
|
5182
|
+
const payeeData = params.payeeData ?? params.depositData;
|
|
5183
|
+
if (!Array.isArray(payeeData)) {
|
|
5184
|
+
throw new Error(`${methodName} requires payeeData`);
|
|
5185
|
+
}
|
|
5186
|
+
const normalized = payeeData.map((item, index) => {
|
|
5187
|
+
const result = normalizePayeeDataInputItem(item);
|
|
5188
|
+
if (!result) {
|
|
5189
|
+
throw new Error(
|
|
5190
|
+
`${methodName}: payeeData[${index}] must include a non-empty offchainId or a recognizable legacy identifier`
|
|
5191
|
+
);
|
|
5192
|
+
}
|
|
5193
|
+
return result;
|
|
5194
|
+
});
|
|
5195
|
+
return normalized;
|
|
5196
|
+
}
|
|
5197
|
+
function toPostDepositDetailsRequest(processorName, payeeData, index) {
|
|
5198
|
+
if (!payeeData || typeof payeeData.offchainId !== "string" || payeeData.offchainId.length === 0) {
|
|
5199
|
+
throw new Error(`payeeData[${index}] must include a non-empty offchainId`);
|
|
5200
|
+
}
|
|
5201
|
+
return {
|
|
5202
|
+
processorName,
|
|
5203
|
+
offchainId: payeeData.offchainId,
|
|
5204
|
+
telegramUsername: payeeData.telegramUsername,
|
|
5205
|
+
metadata: payeeData.metadata
|
|
5206
|
+
};
|
|
5207
|
+
}
|
|
5118
5208
|
var Zkp2pClient = class {
|
|
5119
5209
|
/**
|
|
5120
5210
|
* Creates a new Zkp2pClient instance.
|
|
@@ -5661,7 +5751,7 @@ var Zkp2pClient = class {
|
|
|
5661
5751
|
* sending fiat payment to the deposit's payee.
|
|
5662
5752
|
*
|
|
5663
5753
|
* If `gatingServiceSignature` is not provided, the SDK will automatically
|
|
5664
|
-
* fetch one from curator `/v3/intent` when `apiKey` or `authorizationToken`
|
|
5754
|
+
* fetch one from curator `/v3/intent/sign` when `apiKey` or `authorizationToken`
|
|
5665
5755
|
* is available. Otherwise you must provide `gatingServiceSignature` and
|
|
5666
5756
|
* `signatureExpiration` yourself.
|
|
5667
5757
|
*
|
|
@@ -6975,31 +7065,29 @@ var Zkp2pClient = class {
|
|
|
6975
7065
|
* register maker payment details with the curator service.
|
|
6976
7066
|
*
|
|
6977
7067
|
* @param params.processorNames - Payment platforms (e.g., ['wise', 'revolut'])
|
|
6978
|
-
* @param params.
|
|
7068
|
+
* @param params.payeeData - Payee details per processor (e.g., [{ offchainId: 'you@example.com' }]). Required when the SDK needs to register payee details with the curator.
|
|
6979
7069
|
* @returns The posted deposit details and their corresponding hashed on-chain IDs
|
|
6980
7070
|
*
|
|
6981
7071
|
* @example
|
|
6982
7072
|
* ```typescript
|
|
6983
7073
|
* const { hashedOnchainIds } = await client.registerPayeeDetails({
|
|
6984
7074
|
* processorNames: ['wise'],
|
|
6985
|
-
*
|
|
7075
|
+
* payeeData: [{ offchainId: 'you@example.com' }],
|
|
6986
7076
|
* });
|
|
6987
7077
|
* // Then pass hashedOnchainIds to createDeposit
|
|
6988
7078
|
* ```
|
|
6989
7079
|
*/
|
|
6990
7080
|
async registerPayeeDetails(params) {
|
|
7081
|
+
const payeeData = resolvePayeeDataInput(params, "registerPayeeDetails");
|
|
6991
7082
|
if (!Array.isArray(params.processorNames) || params.processorNames.length === 0) {
|
|
6992
7083
|
throw new Error("processorNames must be a non-empty array");
|
|
6993
7084
|
}
|
|
6994
|
-
if (params.processorNames.length !==
|
|
6995
|
-
throw new Error("processorNames and
|
|
7085
|
+
if (params.processorNames.length !== payeeData.length) {
|
|
7086
|
+
throw new Error("processorNames and payeeData length mismatch");
|
|
6996
7087
|
}
|
|
6997
7088
|
const baseApiUrl = (this.baseApiUrl ?? "https://api.zkp2p.xyz").replace(/\/$/, "");
|
|
6998
7089
|
const depositDetails = params.processorNames.map(
|
|
6999
|
-
(processorName, index) => (
|
|
7000
|
-
processorName,
|
|
7001
|
-
depositData: params.depositData[index] || {}
|
|
7002
|
-
})
|
|
7090
|
+
(processorName, index) => toPostDepositDetailsRequest(processorName, payeeData[index], index)
|
|
7003
7091
|
);
|
|
7004
7092
|
const apiResponses = await Promise.all(
|
|
7005
7093
|
depositDetails.map((req) => apiPostDepositDetails(req, baseApiUrl, this.apiTimeoutMs))
|
|
@@ -7026,16 +7114,17 @@ var Zkp2pClient = class {
|
|
|
7026
7114
|
* @param params.amount - Total deposit amount in token units (6 decimals for USDC)
|
|
7027
7115
|
* @param params.intentAmountRange - Min/max amount per intent
|
|
7028
7116
|
* @param params.processorNames - Payment platforms to accept (e.g., ['wise', 'revolut'])
|
|
7029
|
-
* @param params.
|
|
7117
|
+
* @param params.payeeData - Payee details per processor (e.g., [{ offchainId: 'you@example.com' }])
|
|
7030
7118
|
* @param params.conversionRates - Conversion rates per processor, grouped by currency
|
|
7031
7119
|
* @param params.payeeDetailsHashes - Pre-computed hashed on-chain IDs (from registerPayeeDetails). When provided, skips the curator API call entirely.
|
|
7032
7120
|
* @param params.delegate - Optional delegate address that can manage the deposit
|
|
7033
7121
|
* @param params.intentGuardian - Optional guardian for intent approval
|
|
7034
7122
|
* @param params.retainOnEmpty - Keep deposit active when balance reaches zero
|
|
7035
7123
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
7036
|
-
* @returns The deposit details posted to API and the transaction hash
|
|
7124
|
+
* @returns The deposit details posted to API (empty when payee registration is skipped) and the transaction hash
|
|
7037
7125
|
*
|
|
7038
|
-
* @throws Error if processorNames,
|
|
7126
|
+
* @throws Error if processorNames, payeeData, and conversionRates lengths don't match
|
|
7127
|
+
* @throws Error if payeeData is missing and neither payeeDetailsHashes nor full payment method overrides are provided
|
|
7039
7128
|
* @throws Error if a currency is not supported by the specified processor
|
|
7040
7129
|
*
|
|
7041
7130
|
* @example
|
|
@@ -7046,7 +7135,7 @@ var Zkp2pClient = class {
|
|
|
7046
7135
|
* amount: 1000_000000n,
|
|
7047
7136
|
* intentAmountRange: { min: 10_000000n, max: 500_000000n },
|
|
7048
7137
|
* processorNames: ['wise'],
|
|
7049
|
-
*
|
|
7138
|
+
* payeeData: [{ offchainId: 'you@example.com' }],
|
|
7050
7139
|
* conversionRates: [[
|
|
7051
7140
|
* { currency: 'USD', conversionRate: '1020000000000000000' }, // 1.02
|
|
7052
7141
|
* { currency: 'EUR', conversionRate: '1100000000000000000' }, // 1.10
|
|
@@ -7079,24 +7168,30 @@ var Zkp2pClient = class {
|
|
|
7079
7168
|
};
|
|
7080
7169
|
}
|
|
7081
7170
|
async prepareCreateDepositInternal(params) {
|
|
7171
|
+
const hasOverrides = Boolean(
|
|
7172
|
+
params.paymentMethodsOverride || params.paymentMethodDataOverride || params.currenciesOverride
|
|
7173
|
+
);
|
|
7174
|
+
const payeeDetailsHashes = params.payeeDetailsHashes;
|
|
7175
|
+
const hasPayeeHashes = payeeDetailsHashes !== void 0;
|
|
7176
|
+
const shouldResolvePayeeData = params.payeeData !== void 0 || params.depositData !== void 0;
|
|
7177
|
+
const payeeData = shouldResolvePayeeData ? resolvePayeeDataInput(params, "createDeposit") : null;
|
|
7082
7178
|
if (!Array.isArray(params.processorNames) || params.processorNames.length === 0) {
|
|
7083
7179
|
throw new Error("processorNames must be a non-empty array");
|
|
7084
7180
|
}
|
|
7085
7181
|
if (params.processorNames.length !== params.conversionRates.length) {
|
|
7086
7182
|
throw new Error("processorNames and conversionRates length mismatch");
|
|
7087
7183
|
}
|
|
7088
|
-
if (params.processorNames.length !==
|
|
7089
|
-
throw new Error("processorNames and
|
|
7184
|
+
if (payeeData && params.processorNames.length !== payeeData.length) {
|
|
7185
|
+
throw new Error("processorNames and payeeData length mismatch");
|
|
7090
7186
|
}
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
);
|
|
7187
|
+
if (!hasOverrides && !hasPayeeHashes && !payeeData) {
|
|
7188
|
+
throw new Error(
|
|
7189
|
+
"createDeposit requires payeeData unless payeeDetailsHashes or full payment method overrides are provided"
|
|
7190
|
+
);
|
|
7191
|
+
}
|
|
7192
|
+
const depositDetails = payeeData ? params.processorNames.map(
|
|
7193
|
+
(processorName, index) => toPostDepositDetailsRequest(processorName, payeeData[index], index)
|
|
7194
|
+
) : [];
|
|
7100
7195
|
let paymentMethods;
|
|
7101
7196
|
let paymentMethodData;
|
|
7102
7197
|
let currencies;
|
|
@@ -7121,11 +7216,11 @@ var Zkp2pClient = class {
|
|
|
7121
7216
|
);
|
|
7122
7217
|
const intentGatingService = getGatingServiceAddress(this.chainId, this.runtimeEnv);
|
|
7123
7218
|
let hashedOnchainIds;
|
|
7124
|
-
if (
|
|
7125
|
-
if (
|
|
7219
|
+
if (payeeDetailsHashes !== void 0) {
|
|
7220
|
+
if (payeeDetailsHashes.length !== params.processorNames.length) {
|
|
7126
7221
|
throw new Error("payeeDetailsHashes length must match processorNames length");
|
|
7127
7222
|
}
|
|
7128
|
-
hashedOnchainIds =
|
|
7223
|
+
hashedOnchainIds = payeeDetailsHashes;
|
|
7129
7224
|
} else {
|
|
7130
7225
|
const baseApiUrl = (this.baseApiUrl ?? "https://api.zkp2p.xyz").replace(/\/$/, "");
|
|
7131
7226
|
const apiResponses = await Promise.all(
|
|
@@ -7326,8 +7421,9 @@ var Zkp2pClient = class {
|
|
|
7326
7421
|
const quotes = quote?.responseObject?.quotes ?? [];
|
|
7327
7422
|
for (const q of quotes) {
|
|
7328
7423
|
const maker = q?.maker;
|
|
7329
|
-
|
|
7330
|
-
|
|
7424
|
+
const payeeData = normalizeQuotePayeeData(maker);
|
|
7425
|
+
if (payeeData && typeof q === "object") {
|
|
7426
|
+
q.payeeData = payeeData;
|
|
7331
7427
|
}
|
|
7332
7428
|
}
|
|
7333
7429
|
return appendReferrerFeeDisplayFields(quote, referrerFeeConfig);
|
|
@@ -7372,11 +7468,11 @@ var Zkp2pClient = class {
|
|
|
7372
7468
|
...quote.responseObject,
|
|
7373
7469
|
platformQuotes: (quote.responseObject?.platformQuotes ?? []).map((platformQuote) => {
|
|
7374
7470
|
const bestQuote = platformQuote?.bestQuote;
|
|
7375
|
-
const
|
|
7376
|
-
if (!bestQuote || !
|
|
7471
|
+
const payeeData = normalizeQuotePayeeData(bestQuote?.maker);
|
|
7472
|
+
if (!bestQuote || !payeeData) return platformQuote;
|
|
7377
7473
|
return {
|
|
7378
7474
|
...platformQuote,
|
|
7379
|
-
bestQuote: { ...bestQuote, payeeData
|
|
7475
|
+
bestQuote: { ...bestQuote, payeeData }
|
|
7380
7476
|
};
|
|
7381
7477
|
})
|
|
7382
7478
|
}
|