Documentation ¶
Index ¶
- Constants
- Variables
- func BuildError(proxyErr *types.Error, lotusErr error, showDetails bool) *types.Error
- func BuildTipSetKeyHash(key filTypes.TipSetKey) (*string, error)
- func EthereumAddressFromHex(add string) (ethtypes.EthAddress, error)
- func EthereumAddressToFilecoin(add string) (address.Address, error)
- func GetActorNameFromAddress(address address.Address, lib *rosettaFilecoinLib.RosettaConstructionFilecoin) string
- func GetActorPubKey(add address.Address, lib *rosettaFilecoinLib.RosettaConstructionFilecoin) (string, *types.Error)
- func GetCurrencyData() *types.Currency
- func GetMethodName(msg *filTypes.MessageTrace, ...) (string, *types.Error)
- func GetSupportedOpList() []string
- func IsEthereumAddress(address string) bool
- func IsFilecoinAddress(add string) (bool, address.Address)
- func IsOpSupported(op string) bool
- func NewAccountAPIService(network *types.NetworkIdentifier, node *api.FullNode, ...) server.AccountAPIServicer
- func NewBlockAPIService(network *types.NetworkIdentifier, api *api.FullNode, ...) server.BlockAPIServicer
- func NewConstructionAPIService(network *types.NetworkIdentifier, node *api.FullNode, ...) server.ConstructionAPIServicer
- func NewMemPoolAPIService(network *types.NetworkIdentifier, api *api.FullNode, ...) server.MempoolAPIServicer
- func NewNetworkAPIService(network *types.NetworkIdentifier, node *api.FullNode, supportedOps []string) server.NetworkAPIServicer
- func TimeTrack(start time.Time, name string)
- func ValidateNetworkId(ctx context.Context, node *api.FullNode, networkId *types.NetworkIdentifier) *types.Error
- type AccountAPIService
- type BlockAPIService
- type ConstructionAPIService
- func (c *ConstructionAPIService) ConstructionCombine(ctx context.Context, request *types.ConstructionCombineRequest) (*types.ConstructionCombineResponse, *types.Error)
- func (c *ConstructionAPIService) ConstructionDerive(ctx context.Context, request *types.ConstructionDeriveRequest) (*types.ConstructionDeriveResponse, *types.Error)
- func (c *ConstructionAPIService) ConstructionHash(ctx context.Context, request *types.ConstructionHashRequest) (*types.TransactionIdentifierResponse, *types.Error)
- func (c *ConstructionAPIService) ConstructionMetadata(ctx context.Context, request *types.ConstructionMetadataRequest) (*types.ConstructionMetadataResponse, *types.Error)
- func (c *ConstructionAPIService) ConstructionParse(ctx context.Context, request *types.ConstructionParseRequest) (*types.ConstructionParseResponse, *types.Error)
- func (c *ConstructionAPIService) ConstructionPayloads(ctx context.Context, request *types.ConstructionPayloadsRequest) (*types.ConstructionPayloadsResponse, *types.Error)
- func (c *ConstructionAPIService) ConstructionPreprocess(ctx context.Context, request *types.ConstructionPreprocessRequest) (*types.ConstructionPreprocessResponse, *types.Error)
- func (c *ConstructionAPIService) ConstructionSubmit(ctx context.Context, request *types.ConstructionSubmitRequest) (*types.TransactionIdentifierResponse, *types.Error)
- type MemPoolAPIService
- type NetworkAPIService
- func (s *NetworkAPIService) NetworkList(ctx context.Context, request *types.MetadataRequest) (*types.NetworkListResponse, *types.Error)
- func (s *NetworkAPIService) NetworkOptions(ctx context.Context, request *types.NetworkRequest) (*types.NetworkOptionsResponse, *types.Error)
- func (s *NetworkAPIService) NetworkStatus(ctx context.Context, request *types.NetworkRequest) (*types.NetworkStatusResponse, *types.Error)
- type SyncStatus
Constants ¶
const ( // Network BlockChainName = "Filecoin" // Currency CurrencySymbol = "FIL" CurrencyDecimals = 18 // Operation status OperationStatusOk = "Ok" OperationStatusFailed = "Fail" // Account LockedBalanceStr = "LockedBalance" SpendableBalanceStr = "SpendableBalance" VestingScheduleStr = "VestingSchedule" LockedFundsKey = "LockedFunds" VestingStartEpochKey = "StartEpoch" VestingUnlockDurationKey = "UnlockDuration" VestingInitialBalanceKey = "InitialBalance" // Misc ProxyLoggerName = "rosetta-filecoin-proxy" )
const BlockCIDsKey = "blockCIDs"
BlockCIDsKey is the name of the key in the Metadata map inside a BlockResponse that specifies blocks' CIDs inside a TipSet.
const ChainIDKey = "chainID"
ChainIDKey is the name of the key in the Options map inside a ConstructionMetadataRequest that specifies the current chain id
const DestinationActorIdKey = "destinationActorId"
DestinationActorIdKey is the name of the key in the Metadata map inside a ConstructionMetadataResponse that specifies the receiver's actor id
const FactorSecondToMillisecond int64 = 1e3
const GasFeeCapKey = "gasFeeCap"
GasFeeCapKey is the name of the key in the Metadata map inside a ConstructionMetadataResponse that specifies gas fee cap
const GasLimitKey = "gasLimit"
GasLimitKey is the name of the key in the Metadata map inside a ConstructionMetadataResponse that specifies tx's gas limit
const GasPremiumKey = "gasPremium"
GasPremiumKey is the name of the key in the Metadata map inside a ConstructionMetadataResponse that specifies tx's gas premium
const LotusCallTimeOut = 60 * 4 * time.Second
LotusCallTimeOut TimeOut for RPC Lotus calls
const LotusErrKey = "lotusErr"
const NonceKey = "nonce"
NonceKey is the name of the key in the Metadata map inside a ConstructionMetadataResponse that specifies the next valid nonce.
const OptionsBlockInclKey = "blockIncl"
OptionsBlockInclKey is the name of the key in the Metadata map inside a ConstructionMetadataResponse determines on how many epochs message should included being 0 the fastest (and the most gas expensive one)
const OptionsReceiverIDKey = "idReceiver"
OptionsReceiverIDKey is the name of the key in the Options map inside a ConstructionMetadataRequest that specifies the receiver's account ID
const OptionsSenderIDKey = "idSender"
OptionsSenderIDKey is the name of the key in the Options map inside a ConstructionMetadataRequest that specifies the sender's account ID
const OptionsValueKey = "value"
OptionsValueKey is the name of the key in the Options map inside a ConstructionMetadataRequest that specifies the tokens quantity to be sent
Variables ¶
var ( // Versions info to be injected on build time RosettaSDKVersion = "Unknown" LotusVersion = "Unknown" GitRevision = "Unknown" // ServerPort to be injected on build time RosettaServerPort = "8080" // Other configs RetryConnectAttempts = "1000000" // Network name (read from api in main) NetworkName = "" )
var ( ErrUnableToGetChainID = &types.Error{ Code: 1, Message: "unable to get chain ID", Retriable: true, } ErrInvalidBlockchain = &types.Error{ Code: 2, Message: "invalid blockchain specified in network identifier", Retriable: false, } ErrInvalidSubnetwork = &types.Error{ Code: 3, Message: "invalid sub-network identifier", Retriable: false, } ErrInvalidNetwork = &types.Error{ Code: 4, Message: "invalid network specified in network identifier", Retriable: false, } ErrMissingNID = &types.Error{ Code: 5, Message: "network identifier is missing", Retriable: false, } ErrUnableToGetLatestBlk = &types.Error{ Code: 6, Message: "unable to get latest block", Retriable: true, } ErrUnableToGetGenesisBlk = &types.Error{ Code: 7, Message: "unable to get genesis block", Retriable: true, } ErrUnableToGetAccount = &types.Error{ Code: 8, Message: "unable to get account", Retriable: true, } ErrInsufficientQueryInputs = &types.Error{ Code: 9, Message: "query inputs insufficient", Retriable: false, } ErrInvalidAccountAddress = &types.Error{ Code: 10, Message: "invalid account address", Retriable: false, } ErrMustSpecifySubAccount = &types.Error{ Code: 11, Message: "a valid subaccount must be specified ('LockedBalance' or 'VestingSchedule')", Retriable: false, } ErrUnableToGetBlk = &types.Error{ Code: 12, Message: "unable to get block", Retriable: true, } ErrNotImplemented = &types.Error{ Code: 13, Message: "operation not implemented", Retriable: false, } ErrUnableToGetTxns = &types.Error{ Code: 14, Message: "unable to get transactions", Retriable: true, } ErrUnableToSubmitTx = &types.Error{ Code: 15, Message: "unable to submit transaction", Retriable: false, } ErrUnableToGetNextNonce = &types.Error{ Code: 16, Message: "unable to get next nonce", Retriable: true, } ErrMalformedValue = &types.Error{ Code: 17, Message: "malformed value", Retriable: false, } ErrUnableToGetNodeStatus = &types.Error{ Code: 18, Message: "unable to get node status", Retriable: true, } ErrUnableToGetTipsetCID = &types.Error{ Code: 19, Message: "unable to get tipset CID", Retriable: true, } ErrUnableToGetPeers = &types.Error{ Code: 20, Message: "unable to get peer list", Retriable: true, } ErrUnableToGetBalance = &types.Error{ Code: 21, Message: "unable to get balance for address", Retriable: true, } ErrUnableToGetTipset = &types.Error{ Code: 22, Message: "unable to get tipset", Retriable: true, } ErrUnableToGetParentBlk = &types.Error{ Code: 23, Message: "unable to get parent block", Retriable: true, } ErrUnableToGetNodeInfo = &types.Error{ Code: 24, Message: "unable to get node information", Retriable: true, } ErrUnableToGetSyncStatus = &types.Error{ Code: 25, Message: "unable to get sync status", Retriable: true, } ErrUnableToGetUnsyncedBlock = &types.Error{ Code: 26, Message: "requested block not yet synchronized", Retriable: true, } ErrSyncErrored = &types.Error{ Code: 27, Message: "error on node sync process", Retriable: true, } ErrUnableToBuildTipSetHash = &types.Error{ Code: 28, Message: "error on creating TipSetKey hash", Retriable: true, } ErrUnableToRetrieveNetworkName = &types.Error{ Code: 29, Message: "error when querying network name", Retriable: true, } ErrMalformedTx = &types.Error{ Code: 30, Message: "malformed transaction", Retriable: false, } ErrInvalidHash = &types.Error{ Code: 31, Message: "hash does not match with provided block index", Retriable: false, } ErrUnableToGetTxnReceipt = &types.Error{ Code: 32, Message: "unable to get transaction receipt", Retriable: true, } ErrMsgsAndReceiptsCountMismatch = &types.Error{ Code: 33, Message: "retrieved Messages count don't match with Receipts count", Retriable: false, } ErrUnableToEstimateGasPremium = &types.Error{ Code: 34, Message: "unable to estimate gas premium", Retriable: false, } ErrInsufficientBalanceForGas = &types.Error{ Code: 35, Message: "insufficient balance for gas", Retriable: false, } ErrLotusCallTimedOut = &types.Error{ Code: 36, Message: "Lotus RPC call timed out", Retriable: true, } ErrCouldNotRetrieveMethodName = &types.Error{ Code: 37, Message: "could not retrieve method name in message", Retriable: false, } ErrUnableToGetActor = &types.Error{ Code: 38, Message: "could not retrieve actor from address", Retriable: false, } ErrUnableToGetActorState = &types.Error{ Code: 39, Message: "could not retrieve actor state", Retriable: false, } ErrAddNotMSig = &types.Error{ Code: 40, Message: "address does not correspond to a multisig account", Retriable: false, } ErrNodeNotSynced = &types.Error{ Code: 41, Message: "node is not yet fully synced", Retriable: true, } ErrUnableToGetLockedBalance = &types.Error{ Code: 42, Message: "unable to get locked balance for address", Retriable: true, } ErrUnableToGetVesting = &types.Error{ Code: 43, Message: "unable to get vesting schedule parameters", Retriable: true, } ErrUnableToEstimateGasLimit = &types.Error{ Code: 44, Message: "unable to estimate gas limit", Retriable: false, } ErrUnableToEstimateGasFeeCap = &types.Error{ Code: 45, Message: "unable to estimate gas fee cap", Retriable: false, } ErrOperationNotSupported = &types.Error{ Code: 46, Message: "operation not supported", Retriable: false, } ErrUnableToGetTrace = &types.Error{ Code: 47, Message: "unable to get trace for tipSet", Retriable: true, } ErrorList = []*types.Error{ ErrUnableToGetChainID, ErrInvalidBlockchain, ErrInvalidSubnetwork, ErrInvalidNetwork, ErrUnableToRetrieveNetworkName, ErrMissingNID, ErrUnableToGetLatestBlk, ErrUnableToGetGenesisBlk, ErrUnableToGetAccount, ErrInsufficientQueryInputs, ErrInvalidAccountAddress, ErrMustSpecifySubAccount, ErrUnableToGetBlk, ErrNotImplemented, ErrUnableToGetTxns, ErrUnableToSubmitTx, ErrUnableToGetNextNonce, ErrMalformedValue, ErrUnableToGetNodeStatus, ErrUnableToGetTipsetCID, ErrUnableToGetPeers, ErrUnableToGetBalance, ErrUnableToGetTipset, ErrUnableToGetParentBlk, ErrUnableToGetNodeInfo, ErrUnableToGetSyncStatus, ErrUnableToGetUnsyncedBlock, ErrSyncErrored, ErrUnableToBuildTipSetHash, ErrMalformedTx, ErrInvalidHash, ErrUnableToGetTxnReceipt, ErrMsgsAndReceiptsCountMismatch, ErrUnableToEstimateGasPremium, ErrInsufficientBalanceForGas, ErrLotusCallTimedOut, ErrCouldNotRetrieveMethodName, ErrUnableToGetActor, ErrAddNotMSig, ErrNodeNotSynced, ErrUnableToGetActorState, ErrUnableToGetLockedBalance, ErrUnableToGetVesting, ErrUnableToEstimateGasLimit, ErrUnableToEstimateGasFeeCap, ErrOperationNotSupported, ErrUnableToGetTrace, } )
var Logger = logging.Logger(ProxyLoggerName)
var SupportedOperations = map[string]bool{ "Send": true, "Fee": true, "Exec": true, "SwapSigner": true, "Propose": true, "Approve": true, "Cancel": true, "AwardBlockReward": true, "OnDeferredCronEvent": true, "PreCommitSector": true, "ProveCommitSector": true, "SubmitWindowedPoSt": true, "ApplyRewards": true, "AddBalance": true, "RepayDebt": true, "InvokeContract": true, "InvokeContractDelegate": true, "EVM_CALL": true, "unknown": true, }
Supported operations
Functions ¶
func BuildError ¶
func EthereumAddressFromHex ¶ added in v1.2000.0
func EthereumAddressFromHex(add string) (ethtypes.EthAddress, error)
func EthereumAddressToFilecoin ¶ added in v1.2000.0
func GetActorNameFromAddress ¶ added in v1.800.0
func GetActorNameFromAddress(address address.Address, lib *rosettaFilecoinLib.RosettaConstructionFilecoin) string
func GetActorPubKey ¶ added in v0.801.2
func GetActorPubKey(add address.Address, lib *rosettaFilecoinLib.RosettaConstructionFilecoin) (string, *types.Error)
func GetCurrencyData ¶
func GetMethodName ¶
func GetMethodName(msg *filTypes.MessageTrace, lib *rosettaFilecoinLib.RosettaConstructionFilecoin) (string, *types.Error)
func GetSupportedOpList ¶
func GetSupportedOpList() []string
func IsEthereumAddress ¶ added in v1.2000.0
func IsFilecoinAddress ¶ added in v1.2000.0
func IsOpSupported ¶
func NewAccountAPIService ¶
func NewAccountAPIService(network *types.NetworkIdentifier, node *api.FullNode, r *rosettaFilecoinLib.RosettaConstructionFilecoin) server.AccountAPIServicer
NewBlockAPIService creates a new instance of a BlockAPIService.
func NewBlockAPIService ¶
func NewBlockAPIService(network *types.NetworkIdentifier, api *api.FullNode, r *filLib.RosettaConstructionFilecoin) server.BlockAPIServicer
NewBlockAPIService creates a new instance of a BlockAPIService.
func NewConstructionAPIService ¶
func NewConstructionAPIService(network *types.NetworkIdentifier, node *api.FullNode, r *filLib.RosettaConstructionFilecoin) server.ConstructionAPIServicer
NewConstructionAPIService creates a new instance of an ConstructionAPIService.
func NewMemPoolAPIService ¶
func NewMemPoolAPIService(network *types.NetworkIdentifier, api *api.FullNode, r *filLib.RosettaConstructionFilecoin) server.MempoolAPIServicer
NewBlockAPIService creates a new instance of a BlockAPIService.
func NewNetworkAPIService ¶
func NewNetworkAPIService(network *types.NetworkIdentifier, node *api.FullNode, supportedOps []string) server.NetworkAPIServicer
NewNetworkAPIService creates a new instance of a NetworkAPIService.
func ValidateNetworkId ¶
Types ¶
type AccountAPIService ¶
type AccountAPIService struct {
// contains filtered or unexported fields
}
AccountAPIService implements the server.BlockAPIServicer interface.
func (AccountAPIService) AccountBalance ¶
func (a AccountAPIService) AccountBalance(ctx context.Context, request *types.AccountBalanceRequest) (*types.AccountBalanceResponse, *types.Error)
AccountBalance implements the /account/balance endpoint.
func (AccountAPIService) AccountCoins ¶ added in v1.800.0
func (a AccountAPIService) AccountCoins(ctx context.Context, request *types.AccountCoinsRequest) (*types.AccountCoinsResponse, *types.Error)
type BlockAPIService ¶
type BlockAPIService struct {
// contains filtered or unexported fields
}
BlockAPIService implements the server.BlockAPIServicer interface.
func (*BlockAPIService) Block ¶
func (s *BlockAPIService) Block( ctx context.Context, request *types.BlockRequest, ) (*types.BlockResponse, *types.Error)
Block implements the /block endpoint.
func (*BlockAPIService) BlockTransaction ¶
func (s *BlockAPIService) BlockTransaction( ctx context.Context, request *types.BlockTransactionRequest, ) (*types.BlockTransactionResponse, *types.Error)
BlockTransaction implements the /block/transaction endpoint.
type ConstructionAPIService ¶
type ConstructionAPIService struct {
// contains filtered or unexported fields
}
ConstructionAPIService implements the server.ConstructionAPIServicer interface.
func (*ConstructionAPIService) ConstructionCombine ¶
func (c *ConstructionAPIService) ConstructionCombine(ctx context.Context, request *types.ConstructionCombineRequest) (*types.ConstructionCombineResponse, *types.Error)
func (*ConstructionAPIService) ConstructionDerive ¶
func (c *ConstructionAPIService) ConstructionDerive(ctx context.Context, request *types.ConstructionDeriveRequest) (*types.ConstructionDeriveResponse, *types.Error)
func (*ConstructionAPIService) ConstructionHash ¶
func (c *ConstructionAPIService) ConstructionHash(ctx context.Context, request *types.ConstructionHashRequest) (*types.TransactionIdentifierResponse, *types.Error)
func (*ConstructionAPIService) ConstructionMetadata ¶
func (c *ConstructionAPIService) ConstructionMetadata( ctx context.Context, request *types.ConstructionMetadataRequest, ) (*types.ConstructionMetadataResponse, *types.Error)
ConstructionMetadata implements the /construction/metadata endpoint.
func (*ConstructionAPIService) ConstructionParse ¶
func (c *ConstructionAPIService) ConstructionParse(ctx context.Context, request *types.ConstructionParseRequest) (*types.ConstructionParseResponse, *types.Error)
func (*ConstructionAPIService) ConstructionPayloads ¶
func (c *ConstructionAPIService) ConstructionPayloads(ctx context.Context, request *types.ConstructionPayloadsRequest) (*types.ConstructionPayloadsResponse, *types.Error)
func (*ConstructionAPIService) ConstructionPreprocess ¶
func (c *ConstructionAPIService) ConstructionPreprocess(ctx context.Context, request *types.ConstructionPreprocessRequest) (*types.ConstructionPreprocessResponse, *types.Error)
func (*ConstructionAPIService) ConstructionSubmit ¶
func (c *ConstructionAPIService) ConstructionSubmit( ctx context.Context, request *types.ConstructionSubmitRequest, ) (*types.TransactionIdentifierResponse, *types.Error)
ConstructionSubmit implements the /construction/submit endpoint.
type MemPoolAPIService ¶
type MemPoolAPIService struct {
// contains filtered or unexported fields
}
BlockAPIService implements the server.BlockAPIServicer interface.
func (*MemPoolAPIService) Mempool ¶
func (m *MemPoolAPIService) Mempool( ctx context.Context, request *types.NetworkRequest, ) (*types.MempoolResponse, *types.Error)
Mempool implements the /mempool endpoint.
func (MemPoolAPIService) MempoolTransaction ¶
func (m MemPoolAPIService) MempoolTransaction( ctx context.Context, request *types.MempoolTransactionRequest, ) (*types.MempoolTransactionResponse, *types.Error)
MempoolTransaction implements the /mempool/transaction endpoint.
type NetworkAPIService ¶
type NetworkAPIService struct {
// contains filtered or unexported fields
}
NetworkAPIService implements the server.NetworkAPIServicer interface.
func (*NetworkAPIService) NetworkList ¶
func (s *NetworkAPIService) NetworkList( ctx context.Context, request *types.MetadataRequest, ) (*types.NetworkListResponse, *types.Error)
NetworkList implements the /network/list endpoint
func (*NetworkAPIService) NetworkOptions ¶
func (s *NetworkAPIService) NetworkOptions( ctx context.Context, request *types.NetworkRequest, ) (*types.NetworkOptionsResponse, *types.Error)
NetworkOptions implements the /network/options endpoint.
func (*NetworkAPIService) NetworkStatus ¶
func (s *NetworkAPIService) NetworkStatus( ctx context.Context, request *types.NetworkRequest, ) (*types.NetworkStatusResponse, *types.Error)
NetworkStatus implements the /network/status endpoint.
type SyncStatus ¶
type SyncStatus struct {
// contains filtered or unexported fields
}
func CheckSyncStatus ¶
func (SyncStatus) GetMaxHeight ¶
func (status SyncStatus) GetMaxHeight() int64
func (SyncStatus) GetMinHeight ¶
func (status SyncStatus) GetMinHeight() int64
func (SyncStatus) GetTargetIndex ¶
func (status SyncStatus) GetTargetIndex() *int64
func (SyncStatus) IsSynced ¶
func (status SyncStatus) IsSynced() bool