@zkp2p/sdk 0.7.2 → 0.8.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/dist/react.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { Z as Zkp2pClient, P as PostDepositDetailsRequest, a0 as SignalIntentMethodParams, bF as PreparedTransaction, bI as TakerTier, E as GetTakerTierRequest, F as GetTakerTierResponse, a1 as FulfillIntentMethodParams, cZ as SendTransactionFn, c_ as SendBatchFn, cX as DelegationDepositTarget, cY as BatchResult } from './vaultUtils-CdYaZr3f.mjs';
2
- export { cV as DelegationRoute, cW as DelegationState, c$ as VAULT_ZERO_ADDRESS, cP as ZERO_RATE_MANAGER_ID, d0 as asErrorMessage, d1 as assertDelegationMethodSupport, cU as classifyDelegationState, cT as getDelegationRoute, cQ as isZeroRateManagerId, cR as normalizeRateManagerId, cS as normalizeRegistry } from './vaultUtils-CdYaZr3f.mjs';
1
+ import { Z as Zkp2pClient, P as PostDepositDetailsRequest, a0 as SignalIntentMethodParams, bF as PreparedTransaction, bI as TakerTier, E as GetTakerTierRequest, F as GetTakerTierResponse, a1 as FulfillIntentMethodParams, cZ as SendTransactionFn, c_ as SendBatchFn, cX as DelegationDepositTarget, cY as BatchResult } from './vaultUtils-BGDsoxAv.mjs';
2
+ export { cV as DelegationRoute, cW as DelegationState, c$ as VAULT_ZERO_ADDRESS, cP as ZERO_RATE_MANAGER_ID, d0 as asErrorMessage, d1 as assertDelegationMethodSupport, cU as classifyDelegationState, cT as getDelegationRoute, cQ as isZeroRateManagerId, cR as normalizeRateManagerId, cS as normalizeRegistry } from './vaultUtils-BGDsoxAv.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, a0 as SignalIntentMethodParams, bF as PreparedTransaction, bI as TakerTier, E as GetTakerTierRequest, F as GetTakerTierResponse, a1 as FulfillIntentMethodParams, cZ as SendTransactionFn, c_ as SendBatchFn, cX as DelegationDepositTarget, cY as BatchResult } from './vaultUtils-CdYaZr3f.js';
2
- export { cV as DelegationRoute, cW as DelegationState, c$ as VAULT_ZERO_ADDRESS, cP as ZERO_RATE_MANAGER_ID, d0 as asErrorMessage, d1 as assertDelegationMethodSupport, cU as classifyDelegationState, cT as getDelegationRoute, cQ as isZeroRateManagerId, cR as normalizeRateManagerId, cS as normalizeRegistry } from './vaultUtils-CdYaZr3f.js';
1
+ import { Z as Zkp2pClient, P as PostDepositDetailsRequest, a0 as SignalIntentMethodParams, bF as PreparedTransaction, bI as TakerTier, E as GetTakerTierRequest, F as GetTakerTierResponse, a1 as FulfillIntentMethodParams, cZ as SendTransactionFn, c_ as SendBatchFn, cX as DelegationDepositTarget, cY as BatchResult } from './vaultUtils-BGDsoxAv.js';
2
+ export { cV as DelegationRoute, cW as DelegationState, c$ as VAULT_ZERO_ADDRESS, cP as ZERO_RATE_MANAGER_ID, d0 as asErrorMessage, d1 as assertDelegationMethodSupport, cU as classifyDelegationState, cT as getDelegationRoute, cQ as isZeroRateManagerId, cR as normalizeRateManagerId, cS as normalizeRegistry } from './vaultUtils-BGDsoxAv.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-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';
1
+ import { getNextTakerTier, TAKER_TIER_CAPS, asErrorMessage, ZERO_ADDRESS, getDelegationRoute, assertDelegationMethodSupport, prepareClearDelegationTx, normalizeRateManagerId, normalizeRegistry, isZeroRateManagerId, assertAtomicDelegationSwitchSupport, prepareSetDelegationTx } from './chunk-EIOXBVXP.mjs';
2
+ export { ZERO_ADDRESS as VAULT_ZERO_ADDRESS, ZERO_RATE_MANAGER_ID, asErrorMessage, assertDelegationMethodSupport, classifyDelegationState, getDelegationRoute, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry } from './chunk-EIOXBVXP.mjs';
3
3
  import './chunk-J5LGTIGS.mjs';
4
4
  import { useState, useCallback, useMemo, useEffect } from 'react';
5
5
  import { formatUnits } from 'viem';
@@ -2,7 +2,7 @@ import * as _zkp2p_indexer_schema from '@zkp2p/indexer-schema';
2
2
  import { Deposit, DepositStatus as DepositStatus$2, IntentStatus as IntentStatus$1, DepositPaymentMethod, MethodCurrency, Intent as Intent$1, MakerProfitSnapshot, RateManager, ManagerAggregateStats, RateManagerRate, ManagerStats, DepositFundActivity, DepositDailySnapshot, ManagerDailySnapshot } from '@zkp2p/indexer-schema';
3
3
  import { Address, Hex, AccessList, AuthorizationList, Hash, WalletClient, PublicClient, Transport } from 'viem';
4
4
  import { Abi } from 'abitype';
5
- import { IdentityPlatform, IdentityActionTypeByPlatform, IdentityAttestationOutputFor as IdentityAttestationOutputFor$1, IdentityParamsByPlatform } from '@zkp2p/zkp2p-attestation';
5
+ import { IdentityPlatform, IdentityAttestationOutputFor as IdentityAttestationOutputFor$1, IdentityActionTypeByPlatform, IdentityParamsByPlatform } from '@zkp2p/zkp2p-attestation';
6
6
 
7
7
  /**
8
8
  * Contract resolution utilities for the SDK.
@@ -697,6 +697,11 @@ type CuratorPayeeDataInput = {
697
697
  offchainId: string;
698
698
  telegramUsername?: string | null;
699
699
  metadata?: CuratorMetadata | null;
700
+ /**
701
+ * Maker identity attestation for platforms that require verified payee
702
+ * registration, such as Wise. Forwarded as `metadata.identityAttestation`.
703
+ */
704
+ identityAttestation?: IdentityAttestationOutput | null;
700
705
  };
701
706
  /**
702
707
  * Parameters for fulfilling an intent with payment attestation
@@ -851,14 +856,17 @@ type GoogleOAuthSellerCredentialUploadBodyByPlatform = {
851
856
  venmo: VenmoGoogleOAuthSellerCredentialUploadBody;
852
857
  };
853
858
  type VenmoCredentialUploadInput = {
859
+ callerAddress?: string;
854
860
  payeeId: string;
855
861
  sessionMaterial: VenmoSessionMaterial;
856
862
  };
857
863
  type CashAppCredentialUploadInput = {
864
+ callerAddress?: string;
858
865
  payeeId: string;
859
866
  sessionMaterial: CashAppSessionMaterial;
860
867
  };
861
868
  type WiseCredentialUploadInput = {
869
+ callerAddress?: string;
862
870
  sessionMaterial: WiseSessionMaterial;
863
871
  };
864
872
  type SellerCredentialUploadInputByPlatform = {
@@ -898,6 +906,7 @@ type SellerProbeInput = SellerSignedCiphertextBundle;
898
906
  type SellerCredentialBundle = SellerSignedCiphertextBundle & {
899
907
  platform: SellerPlatform;
900
908
  credentialType: string;
909
+ identityAttestation?: IdentityAttestationOutput;
901
910
  };
902
911
  type SellerCredentialBundleUpload = SellerCredentialBundle;
903
912
  type SellerCredentialStatusValue = 'active' | 'inactive' | 'missing';
@@ -1559,7 +1568,7 @@ type TakerTierStats = {
1559
1568
  lastIntentAt: string;
1560
1569
  updatedAt: string;
1561
1570
  };
1562
- type TakerTierLevel = 'PEASANT' | 'PEER' | 'PLUS' | 'PRO' | 'PLATINUM' | 'PEER_PRESIDENT';
1571
+ type TakerTierLevel = 'PEASANT' | 'PEER' | 'PLUS' | 'PRO' | 'PLATINUM';
1563
1572
  type PlatformRiskLevel = 'LOW' | 'MEDIUM_HIGH' | 'HIGH' | 'HIGHEST';
1564
1573
  type PlatformLimit = {
1565
1574
  paymentMethodHash: string;
@@ -1592,7 +1601,7 @@ type TakerTierVolumeBreakdown = {
1592
1601
  weightedVolumeDisplay: string;
1593
1602
  };
1594
1603
  /** How the curator resolved the taker tier (see curator tier engine). */
1595
- type TakerTierSource = 'computed' | 'fallback' | 'override' | 'blocklist' | 'peer_president';
1604
+ type TakerTierSource = 'computed' | 'fallback' | 'override' | 'blocklist';
1596
1605
  type TakerTier = {
1597
1606
  owner: string;
1598
1607
  chainId: number;
@@ -2428,6 +2437,7 @@ declare class Zkp2pClient {
2428
2437
  private parseRawDepositId;
2429
2438
  private stripTrailingSlash;
2430
2439
  private defaultAttestationServiceForBaseApiUrl;
2440
+ private resolveAuthorizationToken;
2431
2441
  /**
2432
2442
  * Normalizes currency tuples by appending an empty `oracleRateConfig` when the ABI
2433
2443
  * requires it and the caller hasn't provided one.
@@ -2,7 +2,7 @@ import * as _zkp2p_indexer_schema from '@zkp2p/indexer-schema';
2
2
  import { Deposit, DepositStatus as DepositStatus$2, IntentStatus as IntentStatus$1, DepositPaymentMethod, MethodCurrency, Intent as Intent$1, MakerProfitSnapshot, RateManager, ManagerAggregateStats, RateManagerRate, ManagerStats, DepositFundActivity, DepositDailySnapshot, ManagerDailySnapshot } from '@zkp2p/indexer-schema';
3
3
  import { Address, Hex, AccessList, AuthorizationList, Hash, WalletClient, PublicClient, Transport } from 'viem';
4
4
  import { Abi } from 'abitype';
5
- import { IdentityPlatform, IdentityActionTypeByPlatform, IdentityAttestationOutputFor as IdentityAttestationOutputFor$1, IdentityParamsByPlatform } from '@zkp2p/zkp2p-attestation';
5
+ import { IdentityPlatform, IdentityAttestationOutputFor as IdentityAttestationOutputFor$1, IdentityActionTypeByPlatform, IdentityParamsByPlatform } from '@zkp2p/zkp2p-attestation';
6
6
 
7
7
  /**
8
8
  * Contract resolution utilities for the SDK.
@@ -697,6 +697,11 @@ type CuratorPayeeDataInput = {
697
697
  offchainId: string;
698
698
  telegramUsername?: string | null;
699
699
  metadata?: CuratorMetadata | null;
700
+ /**
701
+ * Maker identity attestation for platforms that require verified payee
702
+ * registration, such as Wise. Forwarded as `metadata.identityAttestation`.
703
+ */
704
+ identityAttestation?: IdentityAttestationOutput | null;
700
705
  };
701
706
  /**
702
707
  * Parameters for fulfilling an intent with payment attestation
@@ -851,14 +856,17 @@ type GoogleOAuthSellerCredentialUploadBodyByPlatform = {
851
856
  venmo: VenmoGoogleOAuthSellerCredentialUploadBody;
852
857
  };
853
858
  type VenmoCredentialUploadInput = {
859
+ callerAddress?: string;
854
860
  payeeId: string;
855
861
  sessionMaterial: VenmoSessionMaterial;
856
862
  };
857
863
  type CashAppCredentialUploadInput = {
864
+ callerAddress?: string;
858
865
  payeeId: string;
859
866
  sessionMaterial: CashAppSessionMaterial;
860
867
  };
861
868
  type WiseCredentialUploadInput = {
869
+ callerAddress?: string;
862
870
  sessionMaterial: WiseSessionMaterial;
863
871
  };
864
872
  type SellerCredentialUploadInputByPlatform = {
@@ -898,6 +906,7 @@ type SellerProbeInput = SellerSignedCiphertextBundle;
898
906
  type SellerCredentialBundle = SellerSignedCiphertextBundle & {
899
907
  platform: SellerPlatform;
900
908
  credentialType: string;
909
+ identityAttestation?: IdentityAttestationOutput;
901
910
  };
902
911
  type SellerCredentialBundleUpload = SellerCredentialBundle;
903
912
  type SellerCredentialStatusValue = 'active' | 'inactive' | 'missing';
@@ -1559,7 +1568,7 @@ type TakerTierStats = {
1559
1568
  lastIntentAt: string;
1560
1569
  updatedAt: string;
1561
1570
  };
1562
- type TakerTierLevel = 'PEASANT' | 'PEER' | 'PLUS' | 'PRO' | 'PLATINUM' | 'PEER_PRESIDENT';
1571
+ type TakerTierLevel = 'PEASANT' | 'PEER' | 'PLUS' | 'PRO' | 'PLATINUM';
1563
1572
  type PlatformRiskLevel = 'LOW' | 'MEDIUM_HIGH' | 'HIGH' | 'HIGHEST';
1564
1573
  type PlatformLimit = {
1565
1574
  paymentMethodHash: string;
@@ -1592,7 +1601,7 @@ type TakerTierVolumeBreakdown = {
1592
1601
  weightedVolumeDisplay: string;
1593
1602
  };
1594
1603
  /** How the curator resolved the taker tier (see curator tier engine). */
1595
- type TakerTierSource = 'computed' | 'fallback' | 'override' | 'blocklist' | 'peer_president';
1604
+ type TakerTierSource = 'computed' | 'fallback' | 'override' | 'blocklist';
1596
1605
  type TakerTier = {
1597
1606
  owner: string;
1598
1607
  chainId: number;
@@ -2428,6 +2437,7 @@ declare class Zkp2pClient {
2428
2437
  private parseRawDepositId;
2429
2438
  private stripTrailingSlash;
2430
2439
  private defaultAttestationServiceForBaseApiUrl;
2440
+ private resolveAuthorizationToken;
2431
2441
  /**
2432
2442
  * Normalizes currency tuples by appending an empty `oracleRateConfig` when the ABI
2433
2443
  * requires it and the caller hasn't provided one.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zkp2p/sdk",
3
- "version": "0.7.2",
3
+ "version": "0.8.1",
4
4
  "description": "ZKP2P Client SDK - TypeScript SDK for deposit management, liquidity provision, and onramping",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.cjs",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/takerTiers.ts","../src/react/hooks/vaultUtils.ts"],"names":[],"mappings":";AAwCO,IAAM,mBAAA,GAAyD;AAAA,EACpE,EAAE,MAAM,UAAA,EAAY,eAAA,EAAiB,KAAM,YAAA,EAAc,GAAA,EAAQ,cAAc,QAAA,EAAS;AAAA,EACxF,EAAE,MAAM,KAAA,EAAO,eAAA,EAAiB,MAAM,YAAA,EAAc,GAAA,EAAO,cAAc,KAAA,EAAM;AAAA,EAC/E,EAAE,MAAM,MAAA,EAAQ,eAAA,EAAiB,KAAM,YAAA,EAAc,GAAA,EAAO,cAAc,KAAA,EAAM;AAAA,EAChF,EAAE,MAAM,MAAA,EAAQ,eAAA,EAAiB,KAAK,YAAA,EAAc,GAAA,EAAM,cAAc,IAAA,EAAK;AAAA,EAC7E,EAAE,MAAM,SAAA,EAAW,eAAA,EAAiB,KAAK,YAAA,EAAc,CAAA,EAAG,cAAc,GAAA;AAC1E;AAGO,IAAM,gBAAA,GAA8C;AAAA,EACzD,SAAA;AAAA,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O,MAAA,CAAO,eAAe,OAAA,CAAQ;AAAA,IACnC,eAAe,MAAA,CAAO,MAAA;AAAA,IACtB,WAAW,MAAA,CAAO,SAAA;AAAA,IAClB,oBAAoB,MAAA,CAAO,QAAA;AAAA,IAC3B,eAAe,MAAA,CAAO,aAAA;AAAA,IACtB,GAAI,WAAW,EAAE,WAAA,EAAa,EAAE,QAAA,EAAS,KAAM;AAAC,GACjD,CAAA;AACH","file":"chunk-BQINCOSO.mjs","sourcesContent":["import type { TakerTierLevel } from './types';\n\n/**\n * Canonical taker tier schedule — the single client-side source of truth for\n * per-intent caps and volume thresholds. Mirrors the curator's authoritative\n * tier engine (curator `src/common/services/tier/tierConstants.ts`), which is\n * what the backend actually enforces.\n *\n * The live qualification signal is Peer Pay volume. Historical maker tiers\n * earned before July 1, 2026 UTC are preserved; after that cutoff, only Peer\n * Pay volume moves the tier. Curator keeps the response field name\n * `peerPayVolume` for compatibility.\n *\n * A user's *live* tier, cap, and progression always come from the taker-tier\n * API payload (`TakerTier.perIntentCapBaseUnits`, `minVolumeForTier`,\n * `volumeToNextTier`, `peerPayVolume`). Those values are DB-backed and\n * server-authoritative — they vary per environment (e.g. preprod runs\n * different thresholds than these). This static schedule is ONLY a\n * documented-default reference for displays that must show every tier at once\n * (the Fees & Tiers ladder) when no live payload is available; never gate or\n * compute a user's real cap from it.\n *\n * Volume bands track the live tuned qualification thresholds — PEER $1k,\n * PLUS $10k, PRO $50k, PLATINUM $100k. Caps ($100/$250/$1k/$2.5k/$5k) are unchanged.\n * Read the live per-user values from the API: curator can change qualification\n * inputs behind the compatibility fields without changing this reference table.\n *\n * Ordered highest tier → lowest (PLATINUM first) to match UI display order.\n * PEER_PRESIDENT is invite-only and excluded from the volume ladder.\n */\nexport interface TakerTierScheduleEntry {\n tier: TakerTierLevel;\n /** Per-intent order cap in whole USD (base, before platform risk multipliers). */\n perIntentCapUsd: number;\n /** Inclusive lower bound of Peer Pay volume (USD) that qualifies for this tier. */\n minVolumeUsd: number;\n /** Inclusive upper bound of Peer Pay volume (USD); `Infinity` for the top tier. */\n maxVolumeUsd: number;\n}\n\nexport const TAKER_TIER_SCHEDULE: readonly TakerTierScheduleEntry[] = [\n { tier: 'PLATINUM', perIntentCapUsd: 5000, minVolumeUsd: 100000, maxVolumeUsd: Infinity },\n { tier: 'PRO', perIntentCapUsd: 2500, minVolumeUsd: 50000, maxVolumeUsd: 99999 },\n { tier: 'PLUS', perIntentCapUsd: 1000, minVolumeUsd: 10000, maxVolumeUsd: 49999 },\n { tier: 'PEER', perIntentCapUsd: 250, minVolumeUsd: 1000, maxVolumeUsd: 9999 },\n { tier: 'PEASANT', perIntentCapUsd: 100, minVolumeUsd: 0, maxVolumeUsd: 999 },\n];\n\n/** Volume-based tier order, lowest → highest, for next-tier progression. */\nexport const TAKER_TIER_ORDER: readonly TakerTierLevel[] = [\n 'PEASANT',\n 'PEER',\n 'PLUS',\n 'PRO',\n 'PLATINUM',\n];\n\n/** Per-intent caps (whole USD) keyed by tier, derived from the schedule. */\nexport const TAKER_TIER_CAPS: Readonly<Record<string, number>> = Object.fromEntries(\n TAKER_TIER_SCHEDULE.map((entry) => [entry.tier, entry.perIntentCapUsd]),\n);\n\n/**\n * Default take-fee discount (in basis points) applied per tier, mirroring\n * curator `TIER_FEE_DISCOUNT_BPS`. The discount is subtracted from the base\n * service fee server-side at quote and sign time — it is NOT returned by the\n * tier endpoint. These are documented defaults for reference fee displays only;\n * the curator DB control-plane can override them, so prefer the fee shown on a\n * live quote when one is available.\n */\nexport const TAKER_TIER_FEE_DISCOUNT_BPS: Readonly<Record<TakerTierLevel, number>> = {\n PEASANT: 0,\n PEER: 5,\n PLUS: 10,\n PRO: 20,\n PLATINUM: 30,\n PEER_PRESIDENT: 30,\n};\n\n/** The default fee-discount (bps) for a tier, or 0 for unknown tiers. */\nexport function getTakerTierFeeDiscountBps(tier: string | undefined): number {\n if (!tier) return 0;\n return TAKER_TIER_FEE_DISCOUNT_BPS[tier as TakerTierLevel] ?? 0;\n}\n\n/** The next tier up from `currentTier`, or `null` at the top / for unknown tiers. */\nexport function getNextTakerTier(currentTier: string | undefined): TakerTierLevel | null {\n if (!currentTier) return null;\n const index = TAKER_TIER_ORDER.indexOf(currentTier as TakerTierLevel);\n if (index === -1 || index >= TAKER_TIER_ORDER.length - 1) return null;\n return TAKER_TIER_ORDER[index + 1];\n}\n","import type { Address, Hex } from 'viem';\nimport type { PreparedTransaction } from '../../types/prepared';\n\n// ---------------------------------------------------------------------------\n// Constants\n// ---------------------------------------------------------------------------\n\nexport const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' as const;\nexport const ZERO_RATE_MANAGER_ID =\n '0x0000000000000000000000000000000000000000000000000000000000000000' as const;\n\n// ---------------------------------------------------------------------------\n// Normalizers\n// ---------------------------------------------------------------------------\n\nexport const normalizeRateManagerId = (value?: string | null): string =>\n (value ?? ZERO_RATE_MANAGER_ID).toLowerCase();\n\nexport const normalizeRegistry = (value?: string | null): string =>\n (value ?? ZERO_ADDRESS).toLowerCase();\n\nexport const isZeroRateManagerId = (value?: string | null): boolean => {\n if (!value) return true;\n const normalized = value.toLowerCase();\n return normalized === ZERO_ADDRESS || normalized === ZERO_RATE_MANAGER_ID;\n};\n\n// ---------------------------------------------------------------------------\n// Error helper\n// ---------------------------------------------------------------------------\n\nexport const asErrorMessage = (error: unknown): string => {\n if (!error) return 'Unknown error';\n if (error instanceof Error) return error.message;\n if (typeof error === 'string') return error;\n\n const anyErr = error as Record<string, unknown>;\n if (typeof anyErr.shortMessage === 'string') return anyErr.shortMessage;\n if (typeof anyErr.details === 'string') return anyErr.details;\n if (typeof anyErr.message === 'string') return anyErr.message;\n\n try {\n return JSON.stringify(error);\n } catch {\n return String(error);\n }\n};\n\n// ---------------------------------------------------------------------------\n// Delegation state classification\n// ---------------------------------------------------------------------------\n\nexport type DelegationState = 'delegated_here' | 'delegated_elsewhere' | 'not_delegated';\n\n/**\n * Classify whether a deposit is delegated to the target vault, delegated\n * elsewhere, or not delegated at all.\n *\n * @param currentRateManagerId The deposit's current rateManagerId (from indexer)\n * @param currentRegistry The deposit's current rateManagerAddress / registry (from indexer)\n * @param targetRateManagerId The vault's rateManagerId we're comparing against\n * @param targetRegistry The vault's registry address we're comparing against\n */\nexport const classifyDelegationState = (\n currentRateManagerId: string | null | undefined,\n currentRegistry: string | null | undefined,\n targetRateManagerId: string,\n targetRegistry: string | null | undefined,\n): DelegationState => {\n if (isZeroRateManagerId(currentRateManagerId)) {\n return 'not_delegated';\n }\n\n const normalizedCurrent = normalizeRateManagerId(currentRateManagerId);\n const normalizedTarget = targetRateManagerId.toLowerCase();\n const normalizedCurrentRegistry = normalizeRegistry(currentRegistry);\n const normalizedTargetRegistry = targetRegistry ? targetRegistry.toLowerCase() : '';\n\n const idsMatch = normalizedCurrent === normalizedTarget;\n const registryMatches = normalizedTargetRegistry\n ? normalizedCurrentRegistry === normalizedTargetRegistry\n : true;\n\n if (idsMatch && registryMatches) {\n return 'delegated_here';\n }\n\n return 'delegated_elsewhere';\n};\n\nexport const assertAtomicDelegationSwitchSupport = (\n requiresSwitch: boolean,\n canBatch: boolean,\n): void => {\n if (!requiresSwitch || canBatch) return;\n throw new Error(\n 'Switching delegation targets requires smart-account batching. Clear the existing delegation first.',\n );\n};\n\n// ---------------------------------------------------------------------------\n// Contract routing\n// ---------------------------------------------------------------------------\n\nexport type DelegationRoute = 'v2';\n\nexport const getDelegationRoute = (_client: unknown, _escrow: Address): DelegationRoute => 'v2';\n\ntype DelegationMethodSupportClient = Partial<\n Record<'setRateManager' | 'clearRateManager', { prepare?: unknown }>\n>;\n\nexport const assertDelegationMethodSupport = (\n client: DelegationMethodSupportClient,\n _route: DelegationRoute,\n action: 'set' | 'clear',\n): void => {\n const method = action === 'set' ? 'setRateManager' : 'clearRateManager';\n if (client?.[method]?.prepare) return;\n throw new Error(`Delegation requires SDK ${method} support`);\n};\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface DelegationDepositTarget {\n compositeDepositId: string;\n escrow: Address;\n depositId: bigint;\n currentRateManagerId?: string | null;\n currentRateManagerRegistry?: string | null;\n}\n\nexport interface BatchResult {\n hashes: string[];\n failed: Array<{ compositeDepositId: string; error: string }>;\n}\n\n/**\n * Callback the consumer provides for sending a single prepared transaction.\n * Returns the transaction hash.\n */\nexport type SendTransactionFn = (tx: { to: Address; data: Hex; value?: bigint }) => Promise<string>;\n\n/**\n * Optional callback for batching multiple calls in a single user operation\n * (e.g. via a smart account). If not provided, transactions are sent\n * sequentially via sendTransaction.\n */\nexport type SendBatchFn = (\n txs: Array<{ to: Address; data: Hex; value?: bigint }>,\n) => Promise<string>;\n\n// ---------------------------------------------------------------------------\n// Prepare helpers (used internally by hooks)\n// ---------------------------------------------------------------------------\n\nexport const prepareClearDelegationTx = async (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n client: any,\n params: { escrow: Address; depositId: bigint },\n referrer?: string | string[],\n): Promise<PreparedTransaction> => {\n const route = getDelegationRoute(client, params.escrow);\n assertDelegationMethodSupport(client, route, 'clear');\n return client.clearRateManager.prepare({\n escrowAddress: params.escrow,\n depositId: params.depositId,\n ...(referrer ? { txOverrides: { referrer } } : {}),\n });\n};\n\nexport const prepareSetDelegationTx = async (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n client: any,\n params: {\n escrow: Address;\n depositId: bigint;\n registry: Address;\n rateManagerId: Hex;\n },\n referrer?: string | string[],\n): Promise<PreparedTransaction> => {\n const route = getDelegationRoute(client, params.escrow);\n assertDelegationMethodSupport(client, route, 'set');\n return client.setRateManager.prepare({\n escrowAddress: params.escrow,\n depositId: params.depositId,\n rateManagerAddress: params.registry,\n rateManagerId: params.rateManagerId,\n ...(referrer ? { txOverrides: { referrer } } : {}),\n });\n};\n"]}