-
Notifications
You must be signed in to change notification settings - Fork 69
@liquality.near.<internal>.Chain
@liquality/near..Chain
Represents a connection to a specific blockchain. Used to fetch chain specific data like blocks, transactions, balances and fees.
Name | Type | Description |
---|---|---|
T |
T |
type of the internal provider, e.g. JsonRpcProvider for EVM chains |
N |
Network |
type of the network. The default value of the type is Network |
-
Chain
- getBalance
- getBlockByHash
- getBlockByNumber
- getBlockHeight
- getFeeProvider
- getFees
- getNetwork
- getProvider
- getTransactionByHash
- sendRawTransaction
- sendRpcRequest
- setFeeProvider
- setNetwork
- setProvider
• new Chain<T
, N
>(network
, provider?
, feeProvider?
)
Name | Type |
---|---|
T |
T |
N |
Network |
Name | Type |
---|---|
network |
N |
provider? |
T |
feeProvider? |
Fee |
client/dist/lib/Chain.d.ts:14
• Protected
feeProvider: Fee
client/dist/lib/Chain.d.ts:11
• Protected
network: N
client/dist/lib/Chain.d.ts:12
• Protected
provider: T
client/dist/lib/Chain.d.ts:13
▸ Abstract
getBalance(addresses
, assets
): Promise
<BigNumber
[]>
virtual
Get the balance for list of accounts and list of assets
Name | Type |
---|---|
addresses |
AddressType [] |
assets |
Asset [] |
Promise
<BigNumber
[]>
client/dist/lib/Chain.d.ts:75
▸ Abstract
getBlockByHash(blockHash
, includeTx?
): Promise
<Block
<any
, any
>>
virtual
Get a block given its hash.
throws
UnsupportedMethodError - Thrown if the chain doesn't support the method
throws
BlockNotFoundError - Thrown if the block doesn't exist
Name | Type | Description |
---|---|---|
blockHash |
string |
A string that represents the hash of the desired block. |
includeTx? |
boolean |
If true, fetches transactions in the block. |
Promise
<Block
<any
, any
>>
client/dist/lib/Chain.d.ts:48
▸ Abstract
getBlockByNumber(blockNumber?
, includeTx?
): Promise
<Block
<any
, any
>>
virtual
Get a block given its number.
Name | Type | Description |
---|---|---|
blockNumber? |
number |
The number of the desired block. |
includeTx? |
boolean |
- |
Promise
<Block
<any
, any
>>
ChainProvider.getBlockByNumber
client/dist/lib/Chain.d.ts:57
▸ Abstract
getBlockHeight(): Promise
<number
>
virtual
Get current block height of the chain.
Promise
<number
>
client/dist/lib/Chain.d.ts:62
▸ getFeeProvider(): Promise
<Fee
>
Gets the fee provider
Promise
<Fee
>
client/dist/lib/Chain.d.ts:38
▸ Abstract
getFees(): Promise
<FeeDetails
>
virtual
Promise
<FeeDetails
>
The fee details - FeeDetails
client/dist/lib/Chain.d.ts:80
▸ getNetwork(): N
Gets the connected network
N
client/dist/lib/Chain.d.ts:22
▸ getProvider(): T
Gets the chain specific provider
T
client/dist/lib/Chain.d.ts:26
▸ Abstract
getTransactionByHash(txHash
): Promise
<Transaction
<any
>>
virtual
Get a transaction given its hash.
Name | Type | Description |
---|---|---|
txHash |
string |
A string that represents the hash of the desired transaction. Resolves with a Transaction with the same hash as the given input. |
Promise
<Transaction
<any
>>
ChainProvider.getTransactionByHash
client/dist/lib/Chain.d.ts:70
▸ Abstract
sendRawTransaction(rawTransaction
): Promise
<string
>
virtual
Broadcast a signed transaction to the network.
throws
UnsupportedMethodError - Thrown if the chain doesn't support sending of raw transactions
Name | Type | Description |
---|---|---|
rawTransaction |
string |
A raw transaction usually in the form of a hexadecimal string that represents the serialized transaction. |
Promise
<string
>
the transaction hash
client/dist/lib/Chain.d.ts:88
▸ Abstract
sendRpcRequest(method
, params
): Promise
<any
>
virtual
Used to send supported RPC requests to the RPC node
throws
UnsupportedMethodError - Thrown if the chain provider doesn't support RPC requests
Name | Type |
---|---|
method |
string |
params |
any [] |
Promise
<any
>
client/dist/lib/Chain.d.ts:94
▸ setFeeProvider(feeProvider
): Promise
<void
>
Sets the fee provider
Name | Type |
---|---|
feeProvider |
Fee |
Promise
<void
>
client/dist/lib/Chain.d.ts:34
▸ setNetwork(network
): void
Sets the network
Name | Type |
---|---|
network |
N |
void
client/dist/lib/Chain.d.ts:18
▸ setProvider(provider
): Promise
<void
>
Sets the chain specific provider
Name | Type |
---|---|
provider |
T |
Promise
<void
>
client/dist/lib/Chain.d.ts:30