open-index/open-npm huggingface dataset:
npm package: @keepkey/errors
Description: Common set of typed errors
Latest version: 1.1.3

# @shapeshiftoss/errors

This package contains named errors and a function to create new named errors

## Installation

It's recommend to add this package to `peerDependencies` to avoid duplicate versions of the package
which will cause `instanceof` checks to fail.

## Usage

```ts
import { ValidationError } from '@shapeshiftoss/errors'

throw new ValidationError('txId cannot be null', { details: { name: 'txId', expected: 'not null', actual: 'null' }})
```

### Create a new named error
```ts
import { createErrorClass } from '@shapeshiftoss/errors'

const MyError = createErrorClass<{ myDetails: string }>('MyError')

try {
  throw new MyError('My cool error', { details: { myDetails: 'string' } })
} catch (e) {
  assert.ok(e instanceof MyError)
}

```

### Error.code

All errors support a `code` property. This property is designed to be used for internationalization
so that translated text can be displayed based on the `code` rather than on the `message`.

```ts
import { RateLimitError } from '@shapeshiftoss/errors'

const e = new RateLimitError('Something bad happened', { code: 'ERR_RATE_LIMIT_INFURA' })
```

## Types

```
ForbiddenError - Authorized but not allowed access request resource
NotFoundError - Can not find requested entity
RateLimitError - API returned a 429 error
UnauthorizedError - Trying to access a protected resource
ValidationError - Invalid data provided
```
npm package: @keepkey/investor-foxy
Description: An API layer for interaction with the ShapeShift FOXy contract
Latest version: 7.0.2

# @shapeshiftoss/investor-foxy

ShapeShift's Yearn investor package.

## Installation

```bash
yarn add @shapeshiftoss/investor-foxy
```

## Initialization

```javascript
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

```javascript
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
})
```
npm package: @keepkey/investor-idle
Description: An api layer for interaction with the ShapeShift Idle Router Contract and the Idle Vault contracts
Latest version: 2.1.5

# @shapeshiftoss/investor-idle

ShapeShift's Idle investor package.

## Installation

```bash
yarn add @shapeshiftoss/investor-idle
```

## Initialization

```javascript
import { IdleVaultApi } from '@shapeshiftoss/investor-idle'

const api = new IdleVaultApi({
  adapter: adapters.byChainId(KnownChainIds.EthereumMainnet), // adapter is an ETH @shapeshiftoss/chain-adapters
  providerUrl: '<your eth node privider url>'
})
await api.initialize()
```

### Functions

* initialize
* findAll
* findByDepositVaultAddress
* findByVaultTokenId
* getGasPrice
* getTxReceipt
* checksumAddress
* getVaultId
* estimateApproveGas
* approve
* allowance
* estimateDepositGas
* deposit
* estimateWithdrawGas
* withdraw
* balance
* token
* totalSupply
* pricePerShare
* apy

### Examples
```javascript

await api.initialize()

// (object)
await api.deposit({
  amountDesired: new BigNumber(10).times(`1e+18`), // 10 underlying tokens
  tokenContractAddress: '0xdef1cafe',
  vaultAddress: '0xdef1c4fe',
  userAddress: '0xdef1caf3',
  dryRun: false,
  wallet: HDWallet
})

// returns a string of the txid
//   '0x2d1e60192fe3f671ecb46d9165fdf2a03bd4a4fb8764dacc2a07c5df6307ac59'

// (object)
await api.deposit({
  amountDesired: new BigNumber(10).times(`1e+18`), // 10 underlying tokens
  tokenContractAddress: '0xdef1cafe',
  vaultAddress: '0xdef1c4fe',
  userAddress: '0xdef1caf3',
  dryRun: true,
  wallet: HDWallet
})
// When dryrun is true, it returns a string signed transaction
// '0xf86c0a85046c7cfe0083016dea94d1310c1e038bc12865d3d3997275b3e4737c6302880b503be34d9fe80080269fc7eaaa9c21f59adf8ad43ed66cf5ef9ee1c317bd4d32cd65401e7aaca47cfaa0387d79c65b90be6260d09dcfb780f29dd8133b9b1ceb20b83b7e442b4bfc30cb'

// (object)
await api.estimateDepositGas({
  amountDesired: new BigNumber(10).times(`1e+18`), // 10 underlying tokens
  tokenContractAddress: '0xdef1cafe',
  vaultAddress: '0xdef1c4fe',
  userAddress: '0xdef1caf3',
})
// returns a BigNumber of the gas estimate

// (object)
await api.apy({
  vaultAddress: '0xdef1cafe'
})
// returns a string of the net_apy for that vault
// '32.59'
```
npm package: @keepkey/investor-yearn
Description: An api layer for interaction with the ShapeShift Yearn Router Contract and the Yearn Vault contracts
Latest version: 6.1.7

# @shapeshiftoss/investor-yearn

ShapeShift's Yearn investor package.

## Installation

```bash
yarn add @shapeshiftoss/investor-yearn
```

## Initialization

```javascript
import { YearnVaultApi } from '@shapeshiftoss/investor-yearn'

const api = new YearnVaultApi({
  adapter: adapters.byChainId(KnownChainIds.EthereumMainnet), // adapter is an ETH @shapeshiftoss/chain-adapters
  providerUrl: '<your eth node privider url>'
})
await api.initialize()
```

### Functions

* initialize
* findAll
* findByDepositVaultAddress
* findByVaultTokenId
* getGasPrice
* getTxReceipt
* checksumAddress
* getVaultId
* estimateApproveGas
* approve
* allowance
* estimateDepositGas
* deposit
* estimateWithdrawGas
* withdraw
* balance
* token
* totalSupply
* pricePerShare
* apy

### Examples
```javascript

await api.initialize()

// (object)
await api.deposit({
  amountDesired: new BigNumber(10).times(`1e+18`), // 10 underlying tokens
  tokenContractAddress: '0xdef1cafe',
  vaultAddress: '0xdef1c4fe',
  userAddress: '0xdef1caf3',
  dryRun: false,
  wallet: HDWallet
})

// returns a string of the txid
//   '0x2d1e60192fe3f671ecb46d9165fdf2a03bd4a4fb8764dacc2a07c5df6307ac59'

// (object)
await api.deposit({
  amountDesired: new BigNumber(10).times(`1e+18`), // 10 underlying tokens
  tokenContractAddress: '0xdef1cafe',
  vaultAddress: '0xdef1c4fe',
  userAddress: '0xdef1caf3',
  dryRun: true,
  wallet: HDWallet
})
// When dryrun is true, it returns a string signed transaction
// '0xf86c0a85046c7cfe0083016dea94d1310c1e038bc12865d3d3997275b3e4737c6302880b503be34d9fe80080269fc7eaaa9c21f59adf8ad43ed66cf5ef9ee1c317bd4d32cd65401e7aaca47cfaa0387d79c65b90be6260d09dcfb780f29dd8133b9b1ceb20b83b7e442b4bfc30cb'

// (object)
await api.estimateDepositGas({
  amountDesired: new BigNumber(10).times(`1e+18`), // 10 underlying tokens
  tokenContractAddress: '0xdef1cafe',
  vaultAddress: '0xdef1c4fe',
  userAddress: '0xdef1caf3',
})
// returns a BigNumber of the gas estimate

// (object)
await api.apy({
  vaultAddress: '0xdef1cafe'
})
// returns a string of the net_apy for that vault
// '32.59'
```