@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/README.md CHANGED
@@ -169,8 +169,8 @@ const result = await client.createDeposit({
169
169
  token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
170
170
  amount: 10_000_000n,
171
171
  intentAmountRange: { min: 100_000n, max: 5_000_000n },
172
- processorNames: ['wise'],
173
- depositData: [{ email: 'maker@example.com' }],
172
+ processorNames: ['revolut'],
173
+ payeeData: [{ offchainId: 'maker-revtag' }],
174
174
  conversionRates: [[{ currency: Currency.USD, conversionRate: '1020000000000000000' }]],
175
175
  });
176
176
 
@@ -185,9 +185,20 @@ If you do not pass `payeeDetailsHashes`, `createDeposit()` can register the paye
185
185
  ```ts
186
186
  import { resolvePaymentMethodHash } from '@zkp2p/sdk';
187
187
 
188
+ // App-specific: request this from the ZKP2P attestation service after capturing
189
+ // Wise registration material through PeerAuth / Buyer TEE.
190
+ const identityAttestation = await getWiseIdentityAttestation();
191
+
188
192
  const { hashedOnchainIds } = await client.registerPayeeDetails({
189
193
  processorNames: ['wise'],
190
- depositData: [{ email: 'maker@example.com' }],
194
+ payeeData: [
195
+ {
196
+ offchainId: 'maker-wisetag',
197
+ // Wise maker registration requires an identity attestation from the
198
+ // attestation service. Pass it directly or inside metadata.identityAttestation.
199
+ identityAttestation,
200
+ },
201
+ ],
191
202
  });
192
203
 
193
204
  const quote = await client.getQuote({
@@ -21,8 +21,7 @@ var TAKER_TIER_FEE_DISCOUNT_BPS = {
21
21
  PEER: 5,
22
22
  PLUS: 10,
23
23
  PRO: 20,
24
- PLATINUM: 30,
25
- PEER_PRESIDENT: 30
24
+ PLATINUM: 30
26
25
  };
27
26
  function getTakerTierFeeDiscountBps(tier) {
28
27
  if (!tier) return 0;
@@ -108,5 +107,5 @@ var prepareSetDelegationTx = async (client, params, referrer) => {
108
107
  };
109
108
 
110
109
  export { TAKER_TIER_CAPS, TAKER_TIER_FEE_DISCOUNT_BPS, TAKER_TIER_ORDER, TAKER_TIER_SCHEDULE, ZERO_ADDRESS, ZERO_RATE_MANAGER_ID, asErrorMessage, assertAtomicDelegationSwitchSupport, assertDelegationMethodSupport, classifyDelegationState, getDelegationRoute, getNextTakerTier, getTakerTierFeeDiscountBps, isZeroRateManagerId, normalizeRateManagerId, normalizeRegistry, prepareClearDelegationTx, prepareSetDelegationTx };
111
- //# sourceMappingURL=chunk-BQINCOSO.mjs.map
112
- //# sourceMappingURL=chunk-BQINCOSO.mjs.map
110
+ //# sourceMappingURL=chunk-EIOXBVXP.mjs.map
111
+ //# sourceMappingURL=chunk-EIOXBVXP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/takerTiers.ts","../src/react/hooks/vaultUtils.ts"],"names":[],"mappings":";AAuCO,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,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF;AAGO,IAAM,kBAAoD,MAAA,CAAO,WAAA;AAAA,EACtE,mBAAA,CAAoB,IAAI,CAAC,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,CAAO,aAAA;AAAA,IACtB,GAAI,WAAW,EAAE,WAAA,EAAa,EAAE,QAAA,EAAS,KAAM;AAAC,GACjD,CAAA;AACH","file":"chunk-EIOXBVXP.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 */\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};\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"]}
package/dist/index.cjs CHANGED
@@ -42469,6 +42469,7 @@ async function createEncryptedSellerCredentialUploadForPlatform({
42469
42469
  return zkp2pAttestation.createEncryptedSellerCredentialUpload({
42470
42470
  attestationServiceUrl,
42471
42471
  platform: "wise",
42472
+ ...payload.callerAddress ? { callerAddress: payload.callerAddress } : {},
42472
42473
  sessionMaterial: payload.sessionMaterial,
42473
42474
  ...typeof timeoutMs === "number" ? { timeoutMs } : {},
42474
42475
  fetch: attestationTransport.fetch,
@@ -42482,6 +42483,7 @@ async function createEncryptedSellerCredentialUploadForPlatform({
42482
42483
  return zkp2pAttestation.createEncryptedSellerCredentialUpload({
42483
42484
  attestationServiceUrl,
42484
42485
  platform,
42486
+ ...payload.callerAddress ? { callerAddress: payload.callerAddress } : {},
42485
42487
  payeeId: payload.payeeId,
42486
42488
  sessionMaterial: payload.sessionMaterial,
42487
42489
  ...typeof timeoutMs === "number" ? { timeoutMs } : {},
@@ -42610,7 +42612,10 @@ async function apiCreateSellerCredentialBundle(payload, attestationServiceUrl, p
42610
42612
  res = await attestationTransport.fetch(`${activeBaseUrl}${endpoint}`, {
42611
42613
  method: "POST",
42612
42614
  headers: headers(),
42613
- body: JSON.stringify({ encryptedUpload })
42615
+ body: JSON.stringify({
42616
+ encryptedUpload,
42617
+ ...payload.callerAddress ? { callerAddress: payload.callerAddress } : {}
42618
+ })
42614
42619
  });
42615
42620
  } catch (error) {
42616
42621
  throw new exports.NetworkError("Failed to connect to Attestation Service", {
@@ -46579,7 +46584,7 @@ async function apiUpdateReferralCode(req, opts) {
46579
46584
  });
46580
46585
  return unwrapResponseObject(response);
46581
46586
  }
46582
- async function apiUploadSellerCredential(processorName, payeeDetails, bundle, baseApiUrl, timeoutMs) {
46587
+ async function apiUploadSellerCredential(processorName, payeeDetails, bundle, baseApiUrl, timeoutMs, authorizationToken) {
46583
46588
  const endpoint = `/v2/makers/${encodeURIComponent(processorName)}/${encodeURIComponent(
46584
46589
  payeeDetails
46585
46590
  )}/seller-credential`;
@@ -46587,7 +46592,8 @@ async function apiUploadSellerCredential(processorName, payeeDetails, bundle, ba
46587
46592
  url: `${withApiBase(baseApiUrl)}${endpoint}`,
46588
46593
  method: "POST",
46589
46594
  body: bundle,
46590
- timeoutMs
46595
+ timeoutMs,
46596
+ authorizationToken
46591
46597
  });
46592
46598
  }
46593
46599
  async function apiUploadGoogleOAuthSellerCredential(processorName, payeeDetails, body, baseApiUrl, opts) {
@@ -46598,7 +46604,8 @@ async function apiUploadGoogleOAuthSellerCredential(processorName, payeeDetails,
46598
46604
  url: `${withApiBase(baseApiUrl)}${endpoint}`,
46599
46605
  method: "POST",
46600
46606
  body,
46601
- timeoutMs: opts?.timeoutMs
46607
+ timeoutMs: opts?.timeoutMs,
46608
+ authorizationToken: opts?.authorizationToken
46602
46609
  });
46603
46610
  }
46604
46611
  async function apiGetSellerCredentialStatus(processorName, payeeDetails, baseApiUrl, timeoutMs) {
@@ -47916,7 +47923,7 @@ function assertBundlePlatformMatches(params) {
47916
47923
  throw new Error("Seller credential bundle platform does not match upload platform");
47917
47924
  }
47918
47925
  }
47919
- async function apiUploadSellerCredentialBundle(params, baseApiUrl, timeoutMs) {
47926
+ async function apiUploadSellerCredentialBundle(params, baseApiUrl, timeoutMs, authorizationToken) {
47920
47927
  assertBundlePlatformMatches(params);
47921
47928
  const normalizedBaseApiUrl = normalizeBaseApiUrl(baseApiUrl);
47922
47929
  if (params.platform === "wise") {
@@ -47925,7 +47932,8 @@ async function apiUploadSellerCredentialBundle(params, baseApiUrl, timeoutMs) {
47925
47932
  params.bundle.payeeIdHash,
47926
47933
  params.bundle,
47927
47934
  normalizedBaseApiUrl,
47928
- timeoutMs
47935
+ timeoutMs,
47936
+ authorizationToken
47929
47937
  );
47930
47938
  }
47931
47939
  const registeredPayeePayload = {
@@ -47955,7 +47963,8 @@ async function apiUploadSellerCredentialBundle(params, baseApiUrl, timeoutMs) {
47955
47963
  registeredPayee.hashedOnchainId,
47956
47964
  params.bundle,
47957
47965
  normalizedBaseApiUrl,
47958
- timeoutMs
47966
+ timeoutMs,
47967
+ authorizationToken
47959
47968
  );
47960
47969
  }
47961
47970
 
@@ -48164,10 +48173,23 @@ function normalizePayeeDataInputItem(raw) {
48164
48173
  if (!legacy) {
48165
48174
  return null;
48166
48175
  }
48176
+ const metadata = legacy.metadata && isObjectRecord(legacy.metadata) ? { ...legacy.metadata } : {};
48177
+ if (candidate.identityAttestation !== void 0 && candidate.identityAttestation !== null) {
48178
+ metadata.identityAttestation = candidate.identityAttestation;
48179
+ }
48167
48180
  return {
48168
48181
  offchainId: legacy.offchainId,
48169
48182
  telegramUsername: legacy.telegramUsername,
48170
- metadata: legacy.metadata
48183
+ metadata: Object.keys(metadata).length > 0 ? metadata : null
48184
+ };
48185
+ }
48186
+ function getPayeeRegistrationMetadata(payeeData) {
48187
+ if (payeeData.identityAttestation === void 0 || payeeData.identityAttestation === null) {
48188
+ return payeeData.metadata;
48189
+ }
48190
+ return {
48191
+ ...isObjectRecord(payeeData.metadata) ? payeeData.metadata : {},
48192
+ identityAttestation: payeeData.identityAttestation
48171
48193
  };
48172
48194
  }
48173
48195
  function resolvePayeeDataInput(params, methodName) {
@@ -48194,7 +48216,7 @@ function toPostDepositDetailsRequest(processorName, payeeData, index) {
48194
48216
  processorName,
48195
48217
  offchainId: payeeData.offchainId,
48196
48218
  telegramUsername: payeeData.telegramUsername,
48197
- metadata: payeeData.metadata
48219
+ metadata: getPayeeRegistrationMetadata(payeeData)
48198
48220
  };
48199
48221
  }
48200
48222
  var Zkp2pClient = class {
@@ -49240,6 +49262,12 @@ var Zkp2pClient = class {
49240
49262
  `attestationServiceUrl is required when baseApiUrl is not a supported zkp2p API host: ${baseApiUrl}`
49241
49263
  );
49242
49264
  }
49265
+ async resolveAuthorizationToken() {
49266
+ if (this.getAuthorizationToken) {
49267
+ return await this.getAuthorizationToken() ?? void 0;
49268
+ }
49269
+ return this.authorizationToken;
49270
+ }
49243
49271
  /**
49244
49272
  * Normalizes currency tuples by appending an empty `oracleRateConfig` when the ABI
49245
49273
  * requires it and the caller hasn't provided one.
@@ -50595,6 +50623,7 @@ var Zkp2pClient = class {
50595
50623
  );
50596
50624
  if (params.platform === "wise") {
50597
50625
  const bundleResponse2 = await createBundle({
50626
+ ...params.callerAddress ? { callerAddress: params.callerAddress } : {},
50598
50627
  sessionMaterial: params.sessionMaterial
50599
50628
  });
50600
50629
  if (!bundleResponse2.success || !bundleResponse2.responseObject) {
@@ -50609,6 +50638,7 @@ var Zkp2pClient = class {
50609
50638
  );
50610
50639
  }
50611
50640
  const bundlePayload = {
50641
+ ...params.callerAddress ? { callerAddress: params.callerAddress } : {},
50612
50642
  payeeId: params.payeeId,
50613
50643
  sessionMaterial: params.sessionMaterial
50614
50644
  };
@@ -50635,7 +50665,8 @@ var Zkp2pClient = class {
50635
50665
  opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
50636
50666
  );
50637
50667
  const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
50638
- return apiUploadSellerCredentialBundle(params, baseApiUrl, timeoutMs);
50668
+ const authorizationToken = await this.resolveAuthorizationToken();
50669
+ return apiUploadSellerCredentialBundle(params, baseApiUrl, timeoutMs, authorizationToken);
50639
50670
  }
50640
50671
  /**
50641
50672
  * Upload a seller Gmail OAuth authorization code through curator.
@@ -50648,6 +50679,18 @@ var Zkp2pClient = class {
50648
50679
  opts?.baseApiUrl ?? this.baseApiUrl ?? DEFAULT_BASE_API_URL
50649
50680
  );
50650
50681
  const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
50682
+ const getUploadOptions = async () => {
50683
+ let authorizationToken;
50684
+ try {
50685
+ authorizationToken = await this.resolveAuthorizationToken();
50686
+ } catch {
50687
+ authorizationToken = void 0;
50688
+ }
50689
+ return {
50690
+ timeoutMs,
50691
+ ...authorizationToken ? { authorizationToken } : {}
50692
+ };
50693
+ };
50651
50694
  if (params.platform === "paypal") {
50652
50695
  return apiUploadGoogleOAuthSellerCredential(
50653
50696
  "paypal",
@@ -50658,9 +50701,7 @@ var Zkp2pClient = class {
50658
50701
  redirectUri: params.redirectUri
50659
50702
  },
50660
50703
  baseApiUrl,
50661
- {
50662
- timeoutMs
50663
- }
50704
+ await getUploadOptions()
50664
50705
  );
50665
50706
  }
50666
50707
  if (params.platform === "venmo") {
@@ -50673,9 +50714,7 @@ var Zkp2pClient = class {
50673
50714
  redirectUri: params.redirectUri
50674
50715
  },
50675
50716
  baseApiUrl,
50676
- {
50677
- timeoutMs
50678
- }
50717
+ await getUploadOptions()
50679
50718
  );
50680
50719
  }
50681
50720
  throw new exports.ValidationError(
@@ -50928,8 +50967,7 @@ var TAKER_TIER_FEE_DISCOUNT_BPS = {
50928
50967
  PEER: 5,
50929
50968
  PLUS: 10,
50930
50969
  PRO: 20,
50931
- PLATINUM: 30,
50932
- PEER_PRESIDENT: 30
50970
+ PLATINUM: 30
50933
50971
  };
50934
50972
  function getTakerTierFeeDiscountBps(tier) {
50935
50973
  if (!tier) return 0;