RPC
Defined in: packages/iso-filecoin/src/rpc.js:124
RPC
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RPC(
options,fetchOptions?):RPC
Defined in: packages/iso-filecoin/src/rpc.js:133
TODO: remove fetch from Options and use fetch from RequestOptions TODO: either remove token or merge this.headers with fetchOptions.headers
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options | Options |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”RPC
Properties
Section titled “Properties”api:
URL
Defined in: packages/iso-filecoin/src/rpc.js:143
fetch()
Section titled “fetch()”fetch: {(
input,init?):Promise<Response>; (input,init?):Promise<Response>; }
Defined in: packages/iso-filecoin/src/rpc.js:142
Call Signature
Section titled “Call Signature”Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input | URL | RequestInfo |
init? | RequestInit |
Returns
Section titled “Returns”Call Signature
Section titled “Call Signature”Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input | string | URL | Request |
init? | RequestInit |
Returns
Section titled “Returns”fetchOptions
Section titled “fetchOptions”fetchOptions:
RequestOptions
Defined in: packages/iso-filecoin/src/rpc.js:150
headers
Section titled “headers”headers:
object
Defined in: packages/iso-filecoin/src/rpc.js:145
Authorization?
Section titled “Authorization?”
optionalAuthorization:string
Content-Type
Section titled “Content-Type”Content-Type:
string='application/json'
network
Section titled “network”network:
Network
Defined in: packages/iso-filecoin/src/rpc.js:144
Methods
Section titled “Methods”balance()
Section titled “balance()”balance(
address,fetchOptions?):Promise<MaybeResult<string,RequestErrors|RpcError|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:230
WalletBalance returns the balance of the given address at the current head of the chain.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
address | string |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<string, RequestErrors | RpcError | JsonRpcError>>
https://lotus.filecoin.io/reference/lotus/wallet/#walletbalance
call()
Section titled “call()”call<
R>(rpcOptions,fetchOptions?):Promise<MaybeResult<R,RequestErrors|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:589
Generic method to call any method on the lotus rpc api.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
R |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
rpcOptions | RpcOptions |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<R, RequestErrors | JsonRpcError>>
chainHead()
Section titled “chainHead()”chainHead(
fetchOptions?):Promise<MaybeResult<TipSet,RequestErrors|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:470
The current head of the chain.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<TipSet, RequestErrors | JsonRpcError>>
https://github.com/filecoin-project/filecoin-docs/blob/main/reference/json-rpc/chain.md#chainhead
filecoinAddressToEthAddress()
Section titled “filecoinAddressToEthAddress()”filecoinAddressToEthAddress(
params,fetchOptions?):Promise<MaybeResult<string,RequestErrors|RpcError|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:339
Converts any Filecoin address to an EthAddress.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | FilecoinAddressToEthAddressParams |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<string, RequestErrors | RpcError | JsonRpcError>>
gasEstimate()
Section titled “gasEstimate()”gasEstimate(
params,fetchOptions?):Promise<MaybeResult<LotusMessage,RequestErrors|RpcError|JsonRpcError|ValidationRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:185
GasEstimateMessageGas estimates gas values for unset message gas fields
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | GasEstimateParams |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<LotusMessage, RequestErrors | RpcError | JsonRpcError | ValidationRpcError>>
https://lotus.filecoin.io/reference/lotus/gas/#gasestimatemessagegas
getIDAddress()
Section titled “getIDAddress()”getIDAddress(
params,fetchOptions?):Promise<MaybeResult<string,RequestErrors|RpcError|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:551
Get the ID address for an address with different safety guarantees
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | { address: string; safety?: Safety; } |
params.address | string |
params.safety? | Safety |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<string, RequestErrors | RpcError | JsonRpcError>>
getTipSetByHeight()
Section titled “getTipSetByHeight()”getTipSetByHeight(
params,fetchOptions?):Promise<MaybeResult<TipSet,RequestErrors|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:490
Get tipset at the specified epoch (height). If there are no blocks at the specified epoch, a tipset at an earlier epoch will be returned.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | ChainGetTipSetByHeightParams |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<TipSet, RequestErrors | JsonRpcError>>
lookBackTipSet()
Section titled “lookBackTipSet()”lookBackTipSet(
lookback,fetchOptions?):Promise<MaybeResult<TipSet,RequestErrors|RpcError|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:512
Looks back from latest height for a tipset
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
lookback | number | Chain epoch to look back to |
fetchOptions? | RequestOptions | - |
Returns
Section titled “Returns”Promise<MaybeResult<TipSet, RequestErrors | RpcError | JsonRpcError>>
networkName()
Section titled “networkName()”networkName(
fetchOptions?):Promise<MaybeResult<Network,RequestErrors|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:170
NetworkName returns the name of the network the node is synced to.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<Network, RequestErrors | JsonRpcError>>
nonce()
Section titled “nonce()”nonce(
address,fetchOptions?):Promise<MaybeResult<number,RequestErrors|RpcError|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:248
MpoolGetNonce gets next nonce for the specified sender. Note that this method may not be atomic. Use MpoolPushMessage instead.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
address | string |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<number, RequestErrors | RpcError | JsonRpcError>>
https://lotus.filecoin.io/reference/lotus/mpool/#mpoolgetnonce
pushMessage()
Section titled “pushMessage()”pushMessage(
params,fetchOptions?):Promise<MaybeResult<CID,RequestErrors|RpcError|JsonRpcError|ValidationRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:267
MpoolPush pushes a signed message to mempool.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | PushMessageParams |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<CID, RequestErrors | RpcError | JsonRpcError | ValidationRpcError>>
https://lotus.filecoin.io/reference/lotus/mpool/#mpoolpush
stateAccountKey()
Section titled “stateAccountKey()”stateAccountKey(
params,fetchOptions?):Promise<MaybeResult<string,RequestErrors|RpcError|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:364
Public key address of the given ID address.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | StateAccountKeyParams |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<string, RequestErrors | RpcError | JsonRpcError>>
stateLookupID()
Section titled “stateLookupID()”stateLookupID(
params,fetchOptions?):Promise<MaybeResult<string,RequestErrors|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:439
Retrieves the ID address of the given address for a tipset. If you dont have a specific tipset in mind, better to use getIDAddress.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | StateAccountKeyParams |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<string, RequestErrors | JsonRpcError>>
stateLookupRobustAddress()
Section titled “stateLookupRobustAddress()”stateLookupRobustAddress(
params,fetchOptions?):Promise<MaybeResult<string,RequestErrors|RpcError|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:401
Public key address of the given non-account ID address.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | StateAccountKeyParams |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<string, RequestErrors | RpcError | JsonRpcError>>
version()
Section titled “version()”version(
fetchOptions?):Promise<MaybeResult<VersionResponse,RequestErrors|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:158
Version returns the version of the Filecoin node.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<VersionResponse, RequestErrors | JsonRpcError>>
waitMsg()
Section titled “waitMsg()”waitMsg(
params,fetchOptions?):Promise<MaybeResult<CID,RequestErrors|JsonRpcError>>
Defined in: packages/iso-filecoin/src/rpc.js:316
StateWaitMsg looks back in the chain for a message. If not found, it blocks until the message arrives on chain, and gets to the indicated confidence depth.
Timeout is increased to 60s instead of the default 5s.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
params | waitMsgParams |
fetchOptions? | RequestOptions |
Returns
Section titled “Returns”Promise<MaybeResult<CID, RequestErrors | JsonRpcError>>
https://lotus.filecoin.io/reference/lotus/state/#statewaitmsg