YieldFarm
@node-fi/sdk-core / Exports / YieldFarm
Class: YieldFarm
A class to represent a depositable position
Hierarchy
↳
YieldFarm
Table of contents
Constructors
Properties
- _apr
- _chainId
- _farmType
- _id
- _name
- _protocol
- _signer
- _totalDeposited
- _tvl
- _underlying
- _valueOfDeposit
- _walletAddress
- _walletDeposited
Accessors
- apr
- chainId
- depositToken
- depositValueInLocalCurrency
- id
- name
- protocol
- receiptToken
- signer
- totalDeposited
- tvl
- type
- underlyingTokens
- walletAddress
- walletDeposited
Methods
- additionalTransactionsForDeposit
- balanceOfMulticall
- canDirectlySwap
- connect
- deposit
- fetchClaimableTokens
- formatDepositUrl
- formatExecuteDeposit
- formatExecuteWithdrawal
- formatWithdrawUrl
- getDepositAddress
- toJSON
- withdraw
- parseJson
Constructors
constructor
• new YieldFarm(__namedParameters
, signer?
, walletAddress?
)
Parameters
Name | Type |
---|---|
__namedParameters | YieldFarmInstantionInfo |
signer? | Signer |
walletAddress? | string |
Overrides
DepositablePosition.constructor
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:69
Properties
_apr
• Private
Optional
_apr: number
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:62
_chainId
• Private
_chainId: ChainId
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:59
_farmType
• Private
_farmType: YieldFarmType
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:57
_id
• Private
_id: number
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:58
_name
• Private
Optional
_name: string
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:67
_protocol
• Private
_protocol: string
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:60
_signer
• Protected
Optional
_signer: Signer
Inherited from
Defined in
packages/sdk-core/src/Earn/DepositablePosition.ts:103
_totalDeposited
• Private
_totalDeposited: TokenAmount
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:65
_tvl
• Private
Optional
_tvl: number
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:63
_underlying
• Private
Optional
_underlying: string
[] | Token
[]
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:61
_valueOfDeposit
• Private
Optional
_valueOfDeposit: number
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:64
_walletAddress
• Protected
Optional
_walletAddress: string
Inherited from
DepositablePosition._walletAddress
Defined in
packages/sdk-core/src/Earn/DepositablePosition.ts:104
_walletDeposited
• Private
Optional
_walletDeposited: TokenAmount
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:66
Accessors
apr
• get
apr(): undefined
| number
Returns
undefined
| number
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:104
chainId
• get
chainId(): ChainId
Returns
ChainId
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:116
depositToken
• get
depositToken(): Token
Returns
Token
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:120
depositValueInLocalCurrency
• get
depositValueInLocalCurrency(): undefined
| number
Returns
undefined
| number
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:136
id
• get
id(): number
Returns
number
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:112
name
• get
name(): undefined
| string
Returns
undefined
| string
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:100
protocol
• get
protocol(): string
Returns
string
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:140
receiptToken
• get
receiptToken(): Token
The token that is received when depositing into this position
Returns
Token
Inherited from
DepositablePosition.receiptToken
Defined in
packages/sdk-core/src/Earn/DepositablePosition.ts:110
signer
• get
signer(): undefined
| Signer
The signer used to sign transactions
Returns
undefined
| Signer
Inherited from
DepositablePosition.signer
Defined in
packages/sdk-core/src/Earn/DepositablePosition.ts:117
totalDeposited
• get
totalDeposited(): TokenAmount
Returns
TokenAmount
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:132
tvl
• get
tvl(): undefined
| number
Returns
undefined
| number
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:124
type
• get
type(): YieldFarmType
Returns
YieldFarmType
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:108
underlyingTokens
• get
underlyingTokens(): undefined
| string
[] | Token
[]
Returns
undefined
| string
[] | Token
[]
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:144
walletAddress
• get
walletAddress(): undefined
| string
The address of the wallet that is connected to the signer
Returns
undefined
| string
Inherited from
DepositablePosition.walletAddress
Defined in
packages/sdk-core/src/Earn/DepositablePosition.ts:124
walletDeposited
• get
walletDeposited(): undefined
| TokenAmount
Returns
undefined
| TokenAmount
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:128
Methods
additionalTransactionsForDeposit
▸ additionalTransactionsForDeposit(_
): { data
: string
; gas
: string
; to
: string
}[]
Parameters
Name | Type |
---|---|
_ | DepositTransactionDetails |
Returns
{ data
: string
; gas
: string
; to
: string
}[]
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:196
balanceOfMulticall
▸ balanceOfMulticall(owner
): Readonly
<{ call
: Readonly
<CallStruct
> ; parseReturn
: (returnData
: string
) => JSBI
}>
Parameters
Name | Type | Description |
---|---|---|
owner | string | The wallet address to check the balance of |
Returns
Readonly
<{ call
: Readonly
<CallStruct
> ; parseReturn
: (returnData
: string
) => JSBI
}>
Multicall payload that can be executed to get the balance of the owner
Inherited from
DepositablePosition.balanceOfMulticall
Defined in
packages/sdk-core/src/Earn/DepositablePosition.ts:154
canDirectlySwap
▸ canDirectlySwap(): boolean
Returns
boolean
Overrides
DepositablePosition.canDirectlySwap
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:192
connect
▸ connect(signer?
, walletAddress?
): void
Description
Connects the depositable position to a signer and wallet address
Parameters
Name | Type | Description |
---|---|---|
signer? | Signer | Ethersjs signer |
walletAddress? | string | Wallet address |
Returns
void
Inherited from
Defined in
packages/sdk-core/src/Earn/DepositablePosition.ts:144
deposit
▸ deposit(inputToken
, inputAmount
, opts?
): Promise
<{ approvalTarget?
: string
; execute?
: TransactionStep
; expectedOutput
: TokenAmount
; minimumOutput
: TokenAmount
; transaction?
: TransactionRequest
}>
Parameters
Name | Type | Description |
---|---|---|
inputToken | string | Token to trade to the depositable position |
inputAmount | BigintIsh | Amount of input token to trade |
opts? | Partial <MinimaOptions > | Optional parameters for minima |
Returns
Promise
<{ approvalTarget?
: string
; execute?
: TransactionStep
; expectedOutput
: TokenAmount
; minimumOutput
: TokenAmount
; transaction?
: TransactionRequest
}>
The expected output amount, minimum output amount, transaction to execute, approval target, and execute function
Inherited from
Defined in
packages/sdk-core/src/Earn/DepositablePosition.ts:190
fetchClaimableTokens
▸ fetchClaimableTokens(includeTransaction?
, addressOverride?
): Promise
<{ amount
: number
[] ; token
: string
[] ; transaction?
: { data
: string
; to
: string
} ; valueInLocalCurrency
: number
} | { amount
: number
[] ; execute
: TransactionStep
; token
: string
[] ; transaction?
: { data
: string
; to
: string
} ; valueInLocalCurrency
: number
}>
Parameters
Name | Type |
---|---|
includeTransaction? | boolean |
addressOverride? | string |
Returns
Promise
<{ amount
: number
[] ; token
: string
[] ; transaction?
: { data
: string
; to
: string
} ; valueInLocalCurrency
: number
} | { amount
: number
[] ; execute
: TransactionStep
; token
: string
[] ; transaction?
: { data
: string
; to
: string
} ; valueInLocalCurrency
: number
}>
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:148
formatDepositUrl
▸ formatDepositUrl(): string
Returns
string
Overrides
DepositablePosition.formatDepositUrl
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:189
formatExecuteDeposit
▸ formatExecuteDeposit(txn
, _inputToken
, _inputAmount
): TransactionStep
Parameters
Name | Type |
---|---|
txn | TransactionRequest |
_inputToken | string |
_inputAmount | JSBI |
Returns
Inherited from
DepositablePosition.formatExecuteDeposit
Defined in
packages/sdk-core/src/Earn/DepositablePosition.ts:163
formatExecuteWithdrawal
▸ formatExecuteWithdrawal(txn
, _inputAmount
): Object
Parameters
Name | Type |
---|---|
txn | TransactionRequest |
_inputAmount | JSBI |
Returns
Object
Name | Type |
---|---|
description | string |
execute | (signer : undefined | Signer ) => Promise <TransactionResponse > |
transaction | TransactionRequest |
Inherited from
DepositablePosition.formatExecuteWithdrawal
Defined in
packages/sdk-core/src/Earn/DepositablePosition.ts:175
formatWithdrawUrl
▸ formatWithdrawUrl(): string
Returns
string
Overrides
DepositablePosition.formatWithdrawUrl
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:190
getDepositAddress
▸ Protected
getDepositAddress(): string
Returns
string
Inherited from
DepositablePosition.getDepositAddress
Defined in
packages/sdk-core/src/Earn/DepositablePosition.ts:161
toJSON
▸ toJSON(): YieldFarmApiFullResponse
Returns
A JSON representation of the depositable position
Overrides
Defined in
packages/sdk-core/src/Earn/YieldFarm.ts:204
withdraw
▸ withdraw(amount
, destinationToken
, opts?
): Promise
<{ approvalTarget?
: string
; execute?
: TransactionStep
; expectedOutput
: JSBI
| TokenAmount
; minimumOutput
: JSBI
| TokenAmount
; paths
: string
[] ; transaction?
: TransactionRequest
}>
Parameters
Name | Type | Description |
---|---|---|
amount | BigNumberish | TokenAmount | Amount of depositable position to withdraw |
destinationToken | string | Token | Token to trade to |
opts? | Partial <MinimaOptions > | Optional parameters for minima |
Returns
Promise
<{ approvalTarget?
: string
; execute?
: TransactionStep
; expectedOutput
: JSBI
| TokenAmount
; minimumOutput
: JSBI
| TokenAmount
; paths
: string
[] ; transaction?
: TransactionRequest
}>
The expected output amount, minimum output amount, transaction to execute, approval target, and execute function
Inherited from
Defined in
packages/sdk-core/src/Earn/DepositablePosition.ts:237
parseJson
▸ Static
parseJson(__namedParameters
, signer?
, walletAddress?
): YieldFarm
Parameters
Name | Type |
---|---|
__namedParameters | YieldFarmApiFullResponse |
signer? | Signer |
walletAddress? | string |