Vault Management

With Vault Management SDK, developers can use a library to manipulate and control Jasper vaults. They can perform actions such as initializing a vault, transferring an asset, or checking the vault's balance.

Function List

  • To initialize a new Jasper vault:

MethodParameter TypeError Message
initNewVault(type: number)
number: number;
'Error creating vault'
  • To transfer the asset between the wallet and the vault:

    • Input two addresses (either wallet or vault), asset choices and an amount of asset to transfer.

    • If from == user's wallet address: Issue the asset from user's wallet to the vault

    • If to == user's wallet address: Redeem the asset from the vault to the user's wallet

MethodParameter TypeError Message
transfer(from: Address, to: Address, asset: Address[], amount: BigNumber[])
Address: string;
Address[]: string[];
BigNumber[]: bignumber[];
'Error transfering vault'
  • To get vault address under the specific wallet

    • Input a wallet address to get a vault address under the wallet as a return

MethodParameter TypeError Message
getWalletToVault(wallet: Address)
Address: string;
'Error initializing extensions'
  • To get salt number under the specific vault

    • Input a vault address to get a salt number (ERC-4337 type)

    MethodParameter TypeError Message
    getVaultToSalt(vault: Address)
    Address: string;
    'Error getting vault to salt'
  • To get address under the specific wallet and salt number

    • Input the wallet address and salt to get the address

    MethodParameter TypeError Message
    getAddress(wallet: Address, salt: number)
    Address: string;
    number: number;
    'Error getting address'
  • To create a new account for vault

    • Input a wallet address and salt to create a new account

    MethodParameter TypeError Message
    createAccount(wallet: Address, salt: number)
    Address: string;
    number: number;
    'Error creating account'
  • To manage option writer setting

    • Input a vault address and details to edit option writer settings

    MethodParameter TypeError Message
    setOptionWriterSettings(vault_addr: Address, settings: IOptionFacet.ManagedOptionsSettingsStruct)
    Address: string;
    IOptionFacet.ManagedOptionsSettingsStruct:
    (
    bool isOpen;
    IOptionFacet.OrderType orderType;
    address writer;
    address lockAsset;
    address underlyingAsset;
    IOptionFacet.UnderlyingAssetType lockAssetType;
    uint256 underlyingNftID;
    IOptionFacet.LiquidateMode liquidateMode;
    address strikeAsset;
    uint256 maximum;
    PremiumOracleType  premiumOracleType;
    address[] premiumAssets;
    uint64[]   productTypes;    // 1h=3600 2h=7200
    uint256[]  premiumFloorUSDs;// 10u 15u
    uint256[]  premiumRates; // 1.1 ether 0.9 ether
    ) 
    'Error setOptionWriterSettings'

Last updated