@shapeshiftoss/investor-foxy
v8.0.1
Published
An API layer for interaction with the ShapeShift FOXy contract
Downloads
19
Keywords
Readme
@shapeshiftoss/investor-foxy
ShapeShift's Yearn investor package.
Installation
yarn add @shapeshiftoss/investor-foxy
Initialization
import { FoxyApi } from '@shapeshiftoss/investor-foxy'
import { toChainId, CHAIN_NAMESPACE, CHAIN_REFERENCE } from '@shapeshiftoss/caip'
const api = new FoxyApi({
adapter: await adapterManager.byChainId(
toChainId({ chainNamespace: CHAIN_NAMESPACE.Evm, chainReference: CHAIN_REFERENCE.EthereumMainnet })
), // adapter is an ETH @shapeshiftoss/chain-adapters
providerUrl: '<your eth node privider url>'
})
Functions
- getFoxyOpportunities
- getFoxyOpportunityByStakingAddress
- getGasPrice
- getTxReceipt
- checksumAddress
- estimateClaimWithdrawGas
- estimateSendWithdrawalRequestsGas
- estimateAddLiquidityGas
- estimateRemoveLiquidityGas
- estimateWithdrawGas
- estimateInstantWithdrawGas
- estimateDepositGas
- estimateApproveGas
- approve
- allowance
- deposit
- withdraw
- instantWithdraw
- claimWithdraw
- sendWithdrawalRequests
- addLiquidity
- removeLiquidity
- getTimeUntilClaimable
- balance
- totalSupply
- pricePerShare
- apy
- tvl
Examples
For more in-depth examples, check out ./src/foxycli.ts
const api = new FoxyApi({
adapter: await adapterManager.byChainId(
toChainId({ chainNamespace: CHAIN_NAMESPACE.Evm, chainReference: CHAIN_REFERENCE.EthereumMainnet })
),
providerUrl: 'https://dev-api.ethereum.shapeshift.com'
})
await api.approve({
tokenContractAddress, // FOX address
contractAddress, // Staking contract address
userAddress, // User's wallet address
wallet // HDWallet
})
await api.deposit({
contractAddress, // Staking contract address
amountDesired, // Amount to stake
userAddress, // User's wallet address
wallet // HDWallet
})
await api.withdraw({
contractAddress, // Staking contract address
amountDesired, // Amount to unstake
userAddress, // User's wallet address
wallet // HDWallet
})