6.1 KiB
@oceanprotocol/lib / Exports / SmartContractWithAddress
Class: SmartContractWithAddress
Hierarchy
-
↳
SmartContractWithAddress
↳↳
Dispenser
↳↳
Router
↳↳
NftFactory
↳↳
VeOcean
↳↳
VeAllocate
↳↳
DfRewards
↳↳
DfStrategyV1
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new SmartContractWithAddress(address
, signer
, network?
, config?
, abi?
)
Instantiate the smart contract.
Parameters
Name | Type | Description |
---|---|---|
address |
string |
The address of the contract. |
signer |
Signer |
The signer object. |
network? |
string | number |
Network id or name |
config? |
Config |
The configuration object. |
abi? |
AbiItem [] |
ABI array of the smart contract |
Overrides
Defined in
contracts/SmartContractWithAddress.ts:17
Properties
abi
• abi: AbiItem
[]
Inherited from
Defined in
address
• address: string
Defined in
contracts/SmartContractWithAddress.ts:6
config
• config: Config
Inherited from
Defined in
contract
• contract: Contract
Defined in
contracts/SmartContractWithAddress.ts:7
signer
• signer: Signer
Inherited from
Defined in
Methods
amountToUnits
▸ Protected
amountToUnits(token
, amount
, tokenDecimals?
): Promise
<string
>
Converts an amount of tokens to units
Parameters
Name | Type | Description |
---|---|---|
token |
string |
The token to convert |
amount |
string |
The amount of tokens to convert |
tokenDecimals? |
number |
The number of decimals of the token |
Returns
Promise
<string
>
- The converted amount in units
Inherited from
Defined in
getContract
▸ Protected
getContract(address
, abi?
): Contract
Returns a contract instance for the given address
Parameters
Name | Type | Description |
---|---|---|
address |
string |
The address of the contract |
abi? |
AbiItem [] |
The ABI of the contract |
Returns
Contract
- The contract instance
Inherited from
Defined in
getDefaultAbi
▸ Abstract
getDefaultAbi(): any
Returns
any
Inherited from
Defined in
getFairGasPrice
▸ Protected
getFairGasPrice(): Promise
<string
>
Retruns the gas price
Returns
Promise
<string
>
- The fair gas price
Inherited from
Defined in
unitsToAmount
▸ Protected
unitsToAmount(token
, amount
, tokenDecimals?
): Promise
<string
>
Converts an amount of units to tokens
Parameters
Name | Type | Description |
---|---|---|
token |
string |
The token to convert |
amount |
string |
The amount of units to convert |
tokenDecimals? |
number |
The number of decimals in the token |
Returns
Promise
<string
>
- The converted amount in tokens