@paxoslabs/earn-sdk
Version:
Paxos Labs Earn SDK
126 lines (117 loc) • 4.17 kB
TypeScript
import { Address } from 'viem';
export { Address } from 'viem';
import { C as ChainId } from './vault-config-BNzhv3QV.js';
export { f as fetchVaultConfig, t as toChainId } from './vault-config-BNzhv3QV.js';
export { B as BridgeData, g as getPreviewFee } from './teller-DhrMj3mv.js';
import './config-BQynVNDC.js';
type AccountantBaseProps = {
accountantAddress: Address;
chainId: ChainId;
};
type RateInQuoteWithAssetDecimalsProps = AccountantBaseProps & {
assetAddress: Address;
};
declare const getRateInQuoteWithAssetDecimals: ({ assetAddress, accountantAddress, chainId, }: RateInQuoteWithAssetDecimalsProps) => Promise<[{
error: Error;
result?: undefined;
status: "failure";
} | {
error?: undefined;
result: number;
status: "success";
}, {
error?: undefined;
result: bigint;
status: "success";
} | {
error: Error;
result?: undefined;
status: "failure";
}]>;
type AllowanceProps = {
tokenAddress: Address;
spenderAddress: Address;
userAddress: Address;
chainId: ChainId;
};
declare function getVaultAllowance({ tokenAddress, spenderAddress, userAddress, chainId, }: AllowanceProps): Promise<bigint>;
type TotalSupplyProps = {
tokenAddress: Address;
chainId: ChainId;
};
declare function getTotalSupply({ tokenAddress, chainId, }: TotalSupplyProps): Promise<bigint>;
interface GetEthPriceProps {
chainId: ChainId;
}
declare function getEthPrice({ chainId, }: GetEthPriceProps): Promise<bigint>;
interface GetErc20BalanceParams {
chainId: ChainId;
tokenAddress: Address;
userAddress: Address;
}
declare const getErc20Balance: ({ chainId, tokenAddress, userAddress, }: GetErc20BalanceParams) => Promise<bigint>;
interface GetErc20DecimalsParams {
chainId: ChainId;
tokenAddress: Address;
}
declare const getErc20Decimals: ({ chainId, tokenAddress, }: GetErc20DecimalsParams) => Promise<number>;
interface GetErc20AllowanceParams {
chainId: ChainId;
tokenAddress: Address;
userAddress: Address;
spenderAddress: Address;
}
declare const getErc20Allowance: ({ chainId, tokenAddress, userAddress, spenderAddress, }: GetErc20AllowanceParams) => Promise<bigint>;
type PausedStatusProps = {
accountantAddress: Address;
tellerAddress: Address;
chainId: ChainId;
};
declare const getPausedStates: ({ accountantAddress, tellerAddress, chainId, }: PausedStatusProps) => Promise<[{
error: Error;
result?: undefined;
status: "failure";
} | {
error?: undefined;
result: boolean;
status: "success";
}, {
error: Error;
result?: undefined;
status: "failure";
} | {
error?: undefined;
result: readonly [`0x${string}`, bigint, bigint, bigint, number, number, bigint, boolean, number, number];
status: "success";
}]>;
interface WithdrawAssetsResponse {
[chainId: string]: {
[vaultAddress: string]: {
[tokenAddress: string]: number;
};
};
}
/**
* Interface for optional parameters when fetching withdraw assets
*/
interface FetchWithdrawAssetsParams {
chainId?: ChainId;
vaultAddress?: Address;
}
/**
* Fetches withdraw assets configuration from the API
* @param params Optional parameters for chainId and vaultAddress
* @returns Promise<WithdrawAssetsResponse>
*/
declare function fetchWithdrawAssets(params?: FetchWithdrawAssetsParams): Promise<WithdrawAssetsResponse>;
/**
* Gets the slippage value for a specific asset in a vault
* @param chainId The chain ID
* @param vaultAddress The boring vault address
* @param tokenAddress The token address
* @param defaultSlippage Optional default slippage value if none is found (defaults to 0)
* @returns Promise<number> The slippage value
* @throws {AssetSlippageError} If there's an error fetching or processing the slippage data
*/
declare function getAssetSlippage(chainId: ChainId, vaultAddress: Address, tokenAddress: Address, defaultSlippage?: number): Promise<number>;
export { ChainId, fetchWithdrawAssets, getAssetSlippage, getErc20Allowance, getErc20Balance, getErc20Decimals, getEthPrice, getPausedStates, getRateInQuoteWithAssetDecimals, getTotalSupply, getVaultAllowance };