Get Partner Config

The ParabolAccount class provides two methods to retrieve partner configuration information:

  • getPartnerConfigById: Retrieves partner information using a partner ID.
  • getPartnerConfigByOwner: Retrieves partner information using the owner’s address.

getPartnerConfigById

Usage

import { ParabolAccount, SupportedChainIds } from "@parabolfi/core";
 
async function getPartnerConfigById() {
  const privateKey = "0x..."; // Your private key
  const chainId = SupportedChainIds.ZKSYNC;
 
  const account = await ParabolAccount.fromPrivateKey({
    privateKey,
    chainId,
  });
 
  const partnerId = "0x..."; // The partner ID to look up
 
  try {
    const partnerConfig = await account.getPartnerConfigById(partnerId);
    console.log("Partner Config:", partnerConfig);
  } catch (error) {
    console.error("Error fetching partner config:", error);
  }
}

Parameters

  • partnerId: string - The ID of the partner to look up.

getPartnerConfigByOwner

Usage

import { ParabolAccount, SupportedChainIds } from "@parabolfi/core";
 
async function getPartnerConfigByOwner() {
  const privateKey = "0x..."; // Your private key
  const chainId = SupportedChainIds.ZKSYNC;
 
  const account = await ParabolAccount.fromPrivateKey({
    privateKey,
    chainId,
  });
 
  const owner = "0x..."; // The owner's address to look up
 
  try {
    const partnerConfig = await account.getPartnerConfigByOwner(owner);
    console.log("Partner Config:", partnerConfig);
  } catch (error) {
    console.error("Error fetching partner config:", error);
  }
}

Parameters

  • owner: string - The owner’s address to look up.

Returns

  • Promise<PartnerConfig> - A promise that resolves to the partner configuration object.

PartnerConfig Structure

{
  id: string;
  partnerOwner: string;
  partnerVault: string;
  partnerFeeBPS: string;
}

Example

{
  "id": "0xf86413094669713f8a2a804d93acd71249ed481ab264a5db88f52eac99dac159",
  "partnerOwner": "0x4ea830109b8df82d4e05f1fa7780b27f8f6Dc7D7",
  "partnerVault": "0x4ea830109b8df82d4e05f1fa7780b27f8f6Dc7D7",
  "partnerFeeBPS": "100"
}
⚠️

partnerFeeBPS: 100 = 1%

Error Handling

Both methods may throw a ParabolSDKError if the read operation fails. Always wrap the calls in try-catch blocks to handle potential errors.

Use Cases

  • Retrieving partner information for display in a user interface.
  • Verifying partner details before performing partner-specific operations.
  • Auditing partner configurations and fee structures.
  • Configuring services for partner-specific operations.