2020-09-29 15:25:45 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2023-03-25 07:33:05 +00:00
|
|
|
blocks "github.com/ipfs/go-block-format"
|
2020-10-23 14:51:27 +00:00
|
|
|
"github.com/ipfs/go-cid"
|
|
|
|
|
2020-09-29 15:25:45 +00:00
|
|
|
"github.com/filecoin-project/go-address"
|
2023-01-31 10:00:15 +00:00
|
|
|
"github.com/filecoin-project/go-jsonrpc"
|
2020-10-02 14:14:30 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
2023-08-18 07:28:01 +00:00
|
|
|
verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
|
2020-10-23 14:51:27 +00:00
|
|
|
"github.com/filecoin-project/go-state-types/dline"
|
|
|
|
|
2021-03-23 12:42:56 +00:00
|
|
|
apitypes "github.com/filecoin-project/lotus/api/types"
|
2023-08-29 13:16:05 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
2020-09-29 15:25:45 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/types"
|
2022-12-13 17:14:03 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/types/ethtypes"
|
2023-03-08 16:53:19 +00:00
|
|
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
2020-09-29 15:25:45 +00:00
|
|
|
)
|
|
|
|
|
2021-04-26 18:36:20 +00:00
|
|
|
// MODIFYING THE API INTERFACE
|
|
|
|
//
|
|
|
|
// NOTE: This is the V1 (Unstable) API - to add methods to the V0 (Stable) API
|
|
|
|
// you'll have to add those methods to interfaces in `api/v0api`
|
|
|
|
//
|
|
|
|
// When adding / changing methods in this file:
|
|
|
|
// * Do the change here
|
|
|
|
// * Adjust implementation in `node/impl/`
|
2023-03-09 00:10:22 +00:00
|
|
|
// * Run `make clean && make deps && make gen` - this will:
|
2021-04-26 18:36:20 +00:00
|
|
|
// * Generate proxy structs
|
|
|
|
// * Generate mocks
|
|
|
|
// * Generate markdown docs
|
|
|
|
// * Generate openrpc blobs
|
|
|
|
|
2021-03-23 12:42:56 +00:00
|
|
|
type Gateway interface {
|
2023-03-24 18:39:15 +00:00
|
|
|
MpoolPending(context.Context, types.TipSetKey) ([]*types.SignedMessage, error)
|
|
|
|
ChainGetBlock(context.Context, cid.Cid) (*types.BlockHeader, error)
|
|
|
|
MinerGetBaseInfo(context.Context, address.Address, abi.ChainEpoch, types.TipSetKey) (*MiningBaseInfo, error)
|
2023-03-11 07:27:42 +00:00
|
|
|
StateMinerSectorCount(context.Context, address.Address, types.TipSetKey) (MinerSectors, error)
|
|
|
|
GasEstimateGasPremium(context.Context, uint64, address.Address, int64, types.TipSetKey) (types.BigInt, error)
|
|
|
|
StateReplay(context.Context, types.TipSetKey, cid.Cid) (*InvocResult, error)
|
2020-10-15 10:15:21 +00:00
|
|
|
ChainHasObj(context.Context, cid.Cid) (bool, error)
|
2022-06-07 03:14:16 +00:00
|
|
|
ChainPutObj(context.Context, blocks.Block) error
|
2020-09-29 15:25:45 +00:00
|
|
|
ChainHead(ctx context.Context) (*types.TipSet, error)
|
2021-11-18 21:55:33 +00:00
|
|
|
ChainGetParentMessages(context.Context, cid.Cid) ([]Message, error)
|
|
|
|
ChainGetParentReceipts(context.Context, cid.Cid) ([]*types.MessageReceipt, error)
|
2020-10-09 11:41:09 +00:00
|
|
|
ChainGetBlockMessages(context.Context, cid.Cid) (*BlockMessages, error)
|
|
|
|
ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Message, error)
|
2021-08-27 19:25:43 +00:00
|
|
|
ChainGetPath(ctx context.Context, from, to types.TipSetKey) ([]*HeadChange, error)
|
2020-09-29 15:25:45 +00:00
|
|
|
ChainGetTipSet(ctx context.Context, tsk types.TipSetKey) (*types.TipSet, error)
|
2020-10-02 14:14:30 +00:00
|
|
|
ChainGetTipSetByHeight(ctx context.Context, h abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error)
|
2021-08-05 17:53:12 +00:00
|
|
|
ChainGetTipSetAfterHeight(ctx context.Context, h abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error)
|
2020-10-09 11:41:09 +00:00
|
|
|
ChainNotify(context.Context) (<-chan []*HeadChange, error)
|
2020-10-15 10:15:21 +00:00
|
|
|
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
2021-11-18 21:55:33 +00:00
|
|
|
ChainGetGenesis(context.Context) (*types.TipSet, error)
|
2020-10-05 15:09:21 +00:00
|
|
|
GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *MessageSendSpec, tsk types.TipSetKey) (*types.Message, error)
|
2023-03-08 16:53:19 +00:00
|
|
|
MpoolGetNonce(ctx context.Context, addr address.Address) (uint64, error)
|
2020-09-29 15:25:45 +00:00
|
|
|
MpoolPush(ctx context.Context, sm *types.SignedMessage) (cid.Cid, error)
|
2020-10-07 16:14:12 +00:00
|
|
|
MsigGetAvailableBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.BigInt, error)
|
2021-02-04 04:46:10 +00:00
|
|
|
MsigGetPending(context.Context, address.Address, types.TipSetKey) ([]*MsigTransaction, error)
|
2022-02-16 07:30:07 +00:00
|
|
|
MsigGetVested(ctx context.Context, addr address.Address, start types.TipSetKey, end types.TipSetKey) (types.BigInt, error)
|
|
|
|
MsigGetVestingSchedule(ctx context.Context, addr address.Address, tsk types.TipSetKey) (MsigVesting, error)
|
2020-09-29 15:25:45 +00:00
|
|
|
StateAccountKey(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
|
2023-03-08 01:15:52 +00:00
|
|
|
StateCall(ctx context.Context, msg *types.Message, tsk types.TipSetKey) (*InvocResult, error)
|
2020-10-09 11:41:09 +00:00
|
|
|
StateDealProviderCollateralBounds(ctx context.Context, size abi.PaddedPieceSize, verified bool, tsk types.TipSetKey) (DealCollateralBounds, error)
|
2023-03-08 01:15:52 +00:00
|
|
|
StateDecodeParams(ctx context.Context, toAddr address.Address, method abi.MethodNum, params []byte, tsk types.TipSetKey) (interface{}, error)
|
2020-09-30 14:36:16 +00:00
|
|
|
StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error)
|
2023-08-18 07:28:01 +00:00
|
|
|
StateGetAllocationForPendingDeal(ctx context.Context, dealId abi.DealID, tsk types.TipSetKey) (*verifregtypes.Allocation, error)
|
|
|
|
StateGetAllocation(ctx context.Context, clientAddr address.Address, allocationId verifregtypes.AllocationId, tsk types.TipSetKey) (*verifregtypes.Allocation, error)
|
|
|
|
StateGetAllocations(ctx context.Context, clientAddr address.Address, tsk types.TipSetKey) (map[verifregtypes.AllocationId]verifregtypes.Allocation, error)
|
|
|
|
StateGetClaim(ctx context.Context, providerAddr address.Address, claimId verifregtypes.ClaimId, tsk types.TipSetKey) (*verifregtypes.Claim, error)
|
|
|
|
StateGetClaims(ctx context.Context, providerAddr address.Address, tsk types.TipSetKey) (map[verifregtypes.ClaimId]verifregtypes.Claim, error)
|
2023-03-08 01:15:52 +00:00
|
|
|
StateReadState(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*ActorState, error)
|
2020-10-09 11:41:09 +00:00
|
|
|
StateListMiners(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error)
|
2020-09-30 14:36:16 +00:00
|
|
|
StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
|
2020-10-09 11:41:09 +00:00
|
|
|
StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (MarketBalance, error)
|
|
|
|
StateMarketStorageDeal(ctx context.Context, dealId abi.DealID, tsk types.TipSetKey) (*MarketDeal, error)
|
2022-04-20 21:34:28 +00:00
|
|
|
StateMinerInfo(ctx context.Context, actor address.Address, tsk types.TipSetKey) (MinerInfo, error)
|
2020-10-23 14:51:27 +00:00
|
|
|
StateMinerProvingDeadline(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*dline.Info, error)
|
|
|
|
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*MinerPower, error)
|
2023-03-07 17:36:11 +00:00
|
|
|
StateNetworkName(context.Context) (dtypes.NetworkName, error)
|
2021-03-23 12:42:56 +00:00
|
|
|
StateNetworkVersion(context.Context, types.TipSetKey) (apitypes.NetworkVersion, error)
|
2020-11-20 16:30:17 +00:00
|
|
|
StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error)
|
2023-03-14 17:35:26 +00:00
|
|
|
StateVerifierStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
|
2020-10-20 15:08:25 +00:00
|
|
|
StateVerifiedClientStatus(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*abi.StoragePower, error)
|
2021-04-05 11:47:10 +00:00
|
|
|
StateSearchMsg(ctx context.Context, from types.TipSetKey, msg cid.Cid, limit abi.ChainEpoch, allowReplaced bool) (*MsgLookup, error)
|
|
|
|
StateWaitMsg(ctx context.Context, cid cid.Cid, confidence uint64, limit abi.ChainEpoch, allowReplaced bool) (*MsgLookup, error)
|
2021-04-21 04:55:47 +00:00
|
|
|
WalletBalance(context.Context, address.Address) (types.BigInt, error)
|
2021-06-28 17:00:49 +00:00
|
|
|
Version(context.Context) (APIVersion, error)
|
2022-05-27 11:35:23 +00:00
|
|
|
Discover(context.Context) (apitypes.OpenRPCDocument, error)
|
2022-12-13 17:14:03 +00:00
|
|
|
|
|
|
|
EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error)
|
|
|
|
EthBlockNumber(ctx context.Context) (ethtypes.EthUint64, error)
|
|
|
|
EthGetBlockTransactionCountByNumber(ctx context.Context, blkNum ethtypes.EthUint64) (ethtypes.EthUint64, error)
|
|
|
|
EthGetBlockTransactionCountByHash(ctx context.Context, blkHash ethtypes.EthHash) (ethtypes.EthUint64, error)
|
|
|
|
EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthHash, fullTxInfo bool) (ethtypes.EthBlock, error)
|
|
|
|
EthGetBlockByNumber(ctx context.Context, blkNum string, fullTxInfo bool) (ethtypes.EthBlock, error)
|
|
|
|
EthGetTransactionByHash(ctx context.Context, txHash *ethtypes.EthHash) (*ethtypes.EthTx, error)
|
2023-03-14 15:45:56 +00:00
|
|
|
EthGetTransactionByHashLimited(ctx context.Context, txHash *ethtypes.EthHash, limit abi.ChainEpoch) (*ethtypes.EthTx, error)
|
2023-02-02 12:25:50 +00:00
|
|
|
EthGetTransactionHashByCid(ctx context.Context, cid cid.Cid) (*ethtypes.EthHash, error)
|
|
|
|
EthGetMessageCidByTransactionHash(ctx context.Context, txHash *ethtypes.EthHash) (*cid.Cid, error)
|
2023-06-21 17:36:04 +00:00
|
|
|
EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthUint64, error)
|
2022-12-13 17:14:03 +00:00
|
|
|
EthGetTransactionReceipt(ctx context.Context, txHash ethtypes.EthHash) (*EthTxReceipt, error)
|
2023-03-14 15:45:56 +00:00
|
|
|
EthGetTransactionReceiptLimited(ctx context.Context, txHash ethtypes.EthHash, limit abi.ChainEpoch) (*EthTxReceipt, error)
|
2023-06-21 17:36:04 +00:00
|
|
|
EthGetCode(ctx context.Context, address ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error)
|
|
|
|
EthGetStorageAt(ctx context.Context, address ethtypes.EthAddress, position ethtypes.EthBytes, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error)
|
|
|
|
EthGetBalance(ctx context.Context, address ethtypes.EthAddress, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBigInt, error)
|
2022-12-13 17:14:03 +00:00
|
|
|
EthChainId(ctx context.Context) (ethtypes.EthUint64, error)
|
2023-04-21 12:02:40 +00:00
|
|
|
EthSyncing(ctx context.Context) (ethtypes.EthSyncingResult, error)
|
2022-12-13 17:14:03 +00:00
|
|
|
NetVersion(ctx context.Context) (string, error)
|
|
|
|
NetListening(ctx context.Context) (bool, error)
|
|
|
|
EthProtocolVersion(ctx context.Context) (ethtypes.EthUint64, error)
|
|
|
|
EthGasPrice(ctx context.Context) (ethtypes.EthBigInt, error)
|
2023-02-10 18:33:59 +00:00
|
|
|
EthFeeHistory(ctx context.Context, p jsonrpc.RawParams) (ethtypes.EthFeeHistory, error)
|
2022-12-13 17:14:03 +00:00
|
|
|
EthMaxPriorityFeePerGas(ctx context.Context) (ethtypes.EthBigInt, error)
|
2023-11-29 10:17:10 +00:00
|
|
|
EthEstimateGas(ctx context.Context, p jsonrpc.RawParams) (ethtypes.EthUint64, error)
|
2023-06-21 17:36:04 +00:00
|
|
|
EthCall(ctx context.Context, tx ethtypes.EthCall, blkParam ethtypes.EthBlockNumberOrHash) (ethtypes.EthBytes, error)
|
2022-12-13 17:14:03 +00:00
|
|
|
EthSendRawTransaction(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error)
|
|
|
|
EthGetLogs(ctx context.Context, filter *ethtypes.EthFilterSpec) (*ethtypes.EthFilterResult, error)
|
|
|
|
EthGetFilterChanges(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error)
|
|
|
|
EthGetFilterLogs(ctx context.Context, id ethtypes.EthFilterID) (*ethtypes.EthFilterResult, error)
|
|
|
|
EthNewFilter(ctx context.Context, filter *ethtypes.EthFilterSpec) (ethtypes.EthFilterID, error)
|
|
|
|
EthNewBlockFilter(ctx context.Context) (ethtypes.EthFilterID, error)
|
|
|
|
EthNewPendingTransactionFilter(ctx context.Context) (ethtypes.EthFilterID, error)
|
|
|
|
EthUninstallFilter(ctx context.Context, id ethtypes.EthFilterID) (bool, error)
|
2023-01-31 10:00:15 +00:00
|
|
|
EthSubscribe(ctx context.Context, params jsonrpc.RawParams) (ethtypes.EthSubscriptionID, error)
|
2022-12-13 17:14:03 +00:00
|
|
|
EthUnsubscribe(ctx context.Context, id ethtypes.EthSubscriptionID) (bool, error)
|
2023-02-02 12:25:50 +00:00
|
|
|
Web3ClientVersion(ctx context.Context) (string, error)
|
2023-08-22 16:15:14 +00:00
|
|
|
EthTraceBlock(ctx context.Context, blkNum string) ([]*ethtypes.EthTraceBlock, error)
|
|
|
|
EthTraceReplayBlockTransactions(ctx context.Context, blkNum string, traceTypes []string) ([]*ethtypes.EthTraceReplayBlockTransaction, error)
|
2020-09-29 15:25:45 +00:00
|
|
|
}
|