@zkp2p/sdk 0.6.2 → 0.7.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 +24 -1
- package/dist/{chunk-6WAMIVRB.mjs → chunk-BQINCOSO.mjs} +2 -2
- package/dist/chunk-BQINCOSO.mjs.map +1 -0
- package/dist/index.cjs +139 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +20 -16
- package/dist/index.d.ts +20 -16
- package/dist/index.mjs +133 -20
- package/dist/index.mjs.map +1 -1
- package/dist/react.cjs +12 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.mjs +14 -3
- package/dist/react.mjs.map +1 -1
- package/dist/{vaultUtils-BwY9Z0aR.d.mts → vaultUtils-DI-r1LAg.d.mts} +111 -25
- package/dist/{vaultUtils-BwY9Z0aR.d.ts → vaultUtils-DI-r1LAg.d.ts} +111 -25
- package/package.json +1 -1
- package/dist/chunk-6WAMIVRB.mjs.map +0 -1
package/dist/react.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as Zkp2pClient, P as PostDepositDetailsRequest,
|
|
2
|
-
export {
|
|
1
|
+
import { Z as Zkp2pClient, P as PostDepositDetailsRequest, M as SignalIntentMethodParams, bu as PreparedTransaction, bx as TakerTier, w as GetTakerTierRequest, x as GetTakerTierResponse, N as FulfillIntentMethodParams, cO as SendTransactionFn, cP as SendBatchFn, cM as DelegationDepositTarget, cN as BatchResult } from './vaultUtils-DI-r1LAg.mjs';
|
|
2
|
+
export { cK as DelegationRoute, cL as DelegationState, cQ as VAULT_ZERO_ADDRESS, cE as ZERO_RATE_MANAGER_ID, cR as asErrorMessage, cS as assertDelegationMethodSupport, cJ as classifyDelegationState, cI as getDelegationRoute, cF as isZeroRateManagerId, cG as normalizeRateManagerId, cH as normalizeRegistry } from './vaultUtils-DI-r1LAg.mjs';
|
|
3
3
|
import { Hash, Address, Hex } from 'viem';
|
|
4
4
|
import '@zkp2p/indexer-schema';
|
|
5
5
|
import 'abitype';
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as Zkp2pClient, P as PostDepositDetailsRequest,
|
|
2
|
-
export {
|
|
1
|
+
import { Z as Zkp2pClient, P as PostDepositDetailsRequest, M as SignalIntentMethodParams, bu as PreparedTransaction, bx as TakerTier, w as GetTakerTierRequest, x as GetTakerTierResponse, N as FulfillIntentMethodParams, cO as SendTransactionFn, cP as SendBatchFn, cM as DelegationDepositTarget, cN as BatchResult } from './vaultUtils-DI-r1LAg.js';
|
|
2
|
+
export { cK as DelegationRoute, cL as DelegationState, cQ as VAULT_ZERO_ADDRESS, cE as ZERO_RATE_MANAGER_ID, cR as asErrorMessage, cS as assertDelegationMethodSupport, cJ as classifyDelegationState, cI as getDelegationRoute, cF as isZeroRateManagerId, cG as normalizeRateManagerId, cH as normalizeRegistry } from './vaultUtils-DI-r1LAg.js';
|
|
3
3
|
import { Hash, Address, Hex } from 'viem';
|
|
4
4
|
import '@zkp2p/indexer-schema';
|
|
5
5
|
import 'abitype';
|
package/dist/react.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getNextTakerTier, TAKER_TIER_CAPS, asErrorMessage, ZERO_ADDRESS, getDelegationRoute, assertDelegationMethodSupport, prepareClearDelegationTx, normalizeRateManagerId, normalizeRegistry, isZeroRateManagerId, assertAtomicDelegationSwitchSupport, prepareSetDelegationTx } from './chunk-
|
|
2
|
-
export { ZERO_ADDRESS as VAULT_ZERO_ADDRESS, ZERO_RATE_MANAGER_ID, asErrorMessage, assertDelegationMethodSupport, classifyDelegationState, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-
|
|
1
|
+
import { getNextTakerTier, TAKER_TIER_CAPS, asErrorMessage, ZERO_ADDRESS, getDelegationRoute, assertDelegationMethodSupport, prepareClearDelegationTx, normalizeRateManagerId, normalizeRegistry, isZeroRateManagerId, assertAtomicDelegationSwitchSupport, prepareSetDelegationTx } from './chunk-BQINCOSO.mjs';
|
|
2
|
+
export { ZERO_ADDRESS as VAULT_ZERO_ADDRESS, ZERO_RATE_MANAGER_ID, asErrorMessage, assertDelegationMethodSupport, classifyDelegationState, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-BQINCOSO.mjs';
|
|
3
3
|
import './chunk-J5LGTIGS.mjs';
|
|
4
4
|
import { useState, useCallback, useMemo, useEffect } from 'react';
|
|
5
5
|
import { formatUnits } from 'viem';
|
|
@@ -171,6 +171,17 @@ function formatCapFromBaseUnits(baseUnits) {
|
|
|
171
171
|
const value = Number(formatUnits(BigInt(baseUnits), 6));
|
|
172
172
|
return `$${value.toLocaleString()}`;
|
|
173
173
|
}
|
|
174
|
+
function getCapForDisplay(tier) {
|
|
175
|
+
const platformLimits = tier.platformLimits ?? [];
|
|
176
|
+
if (platformLimits.length === 0) {
|
|
177
|
+
return tier.perIntentCapBaseUnits ?? tier.maxOrderSize;
|
|
178
|
+
}
|
|
179
|
+
const bestCap = platformLimits.filter((limit) => !limit.isLocked && limit.effectiveCap && limit.effectiveCap !== "0").reduce((current, limit) => {
|
|
180
|
+
if (!current) return limit.effectiveCap;
|
|
181
|
+
return BigInt(limit.effectiveCap) > BigInt(current) ? limit.effectiveCap : current;
|
|
182
|
+
}, void 0);
|
|
183
|
+
return bestCap ?? "0";
|
|
184
|
+
}
|
|
174
185
|
function getTierDisplayInfo(tier) {
|
|
175
186
|
if (!tier) {
|
|
176
187
|
return {
|
|
@@ -189,7 +200,7 @@ function getTierDisplayInfo(tier) {
|
|
|
189
200
|
PRO: "Peer Pro",
|
|
190
201
|
PLATINUM: "Peer Platinum"
|
|
191
202
|
};
|
|
192
|
-
const capDisplay = formatCapFromBaseUnits(tier
|
|
203
|
+
const capDisplay = formatCapFromBaseUnits(getCapForDisplay(tier));
|
|
193
204
|
return {
|
|
194
205
|
tierLabel: tierLabels[tier.tier] || tier.tier,
|
|
195
206
|
capDisplay,
|