1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00
ocean.js/docs/classes/SmartContractWithAddress.md
2023-05-02 18:18:30 +01:00

6.1 KiB

@oceanprotocol/lib / Exports / SmartContractWithAddress

Class: SmartContractWithAddress

Hierarchy

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

SmartContract.constructor

Defined in

contracts/SmartContractWithAddress.ts:17

Properties

abi

abi: AbiItem[]

Inherited from

SmartContract.abi

Defined in

contracts/SmartContract.ts:14


address

address: string

Defined in

contracts/SmartContractWithAddress.ts:6


config

config: Config

Inherited from

SmartContract.config

Defined in

contracts/SmartContract.ts:13


contract

contract: Contract

Defined in

contracts/SmartContractWithAddress.ts:7


signer

signer: Signer

Inherited from

SmartContract.signer

Defined in

contracts/SmartContract.ts:12

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

SmartContract.amountToUnits

Defined in

contracts/SmartContract.ts:43


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

SmartContract.getContract

Defined in

contracts/SmartContract.ts:80


getDefaultAbi

Abstract getDefaultAbi(): any

Returns

any

Inherited from

SmartContract.getDefaultAbi

Defined in

contracts/SmartContract.ts:16


getFairGasPrice

Protected getFairGasPrice(): Promise<string>

Retruns the gas price

Returns

Promise<string>

  • The fair gas price

Inherited from

SmartContract.getFairGasPrice

Defined in

contracts/SmartContract.ts:70


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

Inherited from

SmartContract.unitsToAmount

Defined in

contracts/SmartContract.ts:58