@devasher/kuru-sdk
Version:
Ethers v6 SDK to interact with Kuru (forked from @kuru-labs/kuru-sdk)
110 lines • 6.96 kB
TypeScript
import { ethers, TransactionReceipt } from 'ethers';
import { MarketParams, TransactionOptions } from 'src/types';
export declare abstract class Vault {
static deposit(providerOrSigner: ethers.JsonRpcProvider | ethers.AbstractSigner, ammVaultAddress: string, amount1: bigint, amount2: bigint, receiver: string): Promise<TransactionReceipt>;
static withdraw(providerOrSigner: ethers.JsonRpcProvider | ethers.AbstractSigner, shares: bigint, receiver: string, owner: string): Promise<TransactionReceipt>;
/**
* Return the shares owned by an address in a vault
* @param vaultAddress The address of vault contract
* @param signer The signer to use for the transaction
* @returns A promise resolving to the number of shares of an address in a vault
*/
static getVaultShares(vaultAddress: string, userAddress: string, providerOrSigner: ethers.JsonRpcProvider | ethers.AbstractSigner): Promise<bigint>;
/**
*
* @param vaultAddress The address of the vault contract
* @param marketAddress The address of the market contract
* @param marginAccountAddress The address of the margin account contract
* @param providerOrSigner The provider or signer to use for the transaction
* @returns A promise that resolves to an object containing token1 and token2 address and balance
*/
static getVaultLiquidity(vaultAddress: string, baseAssetAddress: string, quoteAssetAddress: string, marginAccountAddress: string, providerOrSigner: ethers.JsonRpcProvider | ethers.AbstractSigner): Promise<{
token1: {
address: string;
balance: any;
};
token2: {
address: string;
balance: any;
};
}>;
/**
* Calculate the amount of tokens needed to deposit for a given number of shares
* @param shares The number of shares to mint
* @param vaultAddress The address of the vault contract
* @param providerOrSigner The provider or signer to use for the transaction
* @returns A promise that resolves to an object containing amount1 and amount2
*/
static calculateDepositForShares(shares: bigint, vaultAddress: string, providerOrSigner: ethers.JsonRpcProvider | ethers.AbstractSigner): Promise<{
amount1: bigint;
amount2: bigint;
}>;
/**
* Calculate the amount of tokens to be received for a given number of shares to withdraw
* @param shares The number of shares to burn
* @param vaultAddress The address of the vault contract
* @param providerOrSigner The provider or signer to use for the transaction
* @returns A promise that resolves to an object containing amount1 and amount2
*/
static calculateWithdrawForShares(shares: bigint, vaultAddress: string, providerOrSigner: ethers.JsonRpcProvider | ethers.AbstractSigner): Promise<{
amount1: bigint;
amount2: bigint;
}>;
/**
* Calculate the number of shares to be received for a given deposit of tokens
* @param amount1 The amount of token1 to deposit
* @param amount2 The amount of token2 to deposit
* @param vaultAddress The address of the vault contract
* @param providerOrSigner The provider or signer to use for the transaction
* @returns A promise that resolves to the number of shares
*/
static calculateSharesForDeposit(amount1: bigint, amount2: bigint, vaultAddress: string, providerOrSigner: ethers.JsonRpcProvider | ethers.AbstractSigner): Promise<bigint>;
/**
* Calculate the amount of token2 needed for a specific amount of token1 based on current price
* @param amount1 The amount of token1
* @param marketAddress The address of the market contract
* @param providerOrSigner The provider or signer to use for the transaction
* @returns A promise that resolves to the amount of token2 needed
*/
static calculateAmount2ForAmount1(amount1: bigint, marketAddress: string, marketParams: MarketParams, providerOrSigner: ethers.JsonRpcProvider | ethers.AbstractSigner): Promise<bigint>;
/**
* Calculate the amount of token1 needed for a specific amount of token2 based on current price
* @param amount2 The amount of token2
* @param marketAddress The address of the market contract
* @param providerOrSigner The provider or signer to use for the transaction
* @returns A promise that resolves to the amount of token1 needed
*/
static calculateAmount1ForAmount2(amount2: bigint, marketAddress: string, marketParams: MarketParams, providerOrSigner: ethers.JsonRpcProvider | ethers.AbstractSigner): Promise<bigint>;
/**
* Deposit tokens into the vault based on the number of shares to mint
* @param shares The number of shares to mint
* @param marketAddress The address of the market contract
* @param vaultAddress The address of the vault contract
* @param signer The signer to use for the transaction
* @param shouldApprove Whether to approve the tokens before depositing
* @returns A promise that resolves to the transaction receipt
*/
static depositBasedOnShares(shares: bigint, marketParams: MarketParams, vaultAddress: string, signer: ethers.AbstractSigner, shouldApprove?: boolean): Promise<TransactionReceipt>;
/**
* Withdraw tokens from the vault based on the number of shares to burn
* @param shares The number of shares to burn
* @param vaultAddress The address of the vault contract
* @param signer The signer to use for the transaction
* @returns A promise that resolves to the transaction receipt
*/
static withdrawBasedOnShares(shares: bigint, vaultAddress: string, signer: ethers.AbstractSigner): Promise<TransactionReceipt>;
/**
* Deposit tokens into the vault with given amounts of token1 and token2
* @param amount1 The amount of token1 to deposit
* @param amount2 The amount of token2 to deposit
* @param marketAddress The address of the market contract
* @param vaultAddress The address of the vault contract
* @param signer The signer to use for the transaction
* @param shouldApprove Whether to approve the tokens before depositing
* @returns A promise that resolves to the transaction receipt
*/
static depositWithAmounts(amount1: bigint, amount2: bigint, baseAssetAddress: string, quoteAssetAddress: string, vaultAddress: string, signer: ethers.AbstractSigner, shouldApprove?: boolean): Promise<TransactionReceipt>;
static constructDepositTransaction(amount1: bigint, amount2: bigint, baseAssetAddress: string, quoteAssetAddress: string, vaultAddress: string, signer: ethers.AbstractSigner, txOptions?: TransactionOptions): Promise<ethers.TransactionRequest>;
static constructWithdrawTransaction(shares: bigint, vaultAddress: string, signer: ethers.AbstractSigner, txOptions?: TransactionOptions): Promise<ethers.TransactionRequest>;
}
//# sourceMappingURL=vault.d.ts.map