Documentation ¶
Index ¶
- Constants
- Variables
- func BeginBlockTxHash(blockHash []byte) string
- func EndBlockTxHash(blockHash []byte) string
- func EventToOperations(event sdk.StringEvent, status *string, index int64) []*types.Operation
- func EventsToOperations(events sdk.StringEvents, status *string, index int64) []*types.Operation
- func FeeToOperations(feePayer sdk.AccAddress, amount sdk.Coins, status *string, index int64) []*types.Operation
- func IsRetriableError(err error) bool
- func MsgToOperations(msg sdk.Msg, log sdk.ABCIMessageLog, status *string, index int64) []*types.Operation
- func ParseABCIResult(result *ctypes.ResultABCIQuery, err error) ([]byte, error)
- func TxToOperations(tx authsigning.Tx, events sdk.StringEvents, logs sdk.ABCIMessageLogs, ...) []*types.Operation
- type AccountBalanceService
- type BalanceServiceFactory
- type Client
- func (c *Client) Account(ctx context.Context, address sdk.AccAddress) (authtypes.AccountI, error)
- func (c *Client) Balance(ctx context.Context, accountIdentifier *types.AccountIdentifier, ...) (*types.AccountBalanceResponse, error)
- func (c *Client) Block(ctx context.Context, blockIdentifier *types.PartialBlockIdentifier) (*types.BlockResponse, error)
- func (c *Client) EstimateGas(ctx context.Context, tx authsigning.Tx, adjustment float64) (uint64, error)
- func (c *Client) PostTx(ctx context.Context, txBytes []byte) (*types.TransactionIdentifier, error)
- func (c *Client) Status(ctx context.Context) (*types.BlockIdentifier, int64, *types.BlockIdentifier, *types.SyncStatus, ...)
- type HTTPClient
- func (c *HTTPClient) Account(ctx context.Context, addr sdk.AccAddress, height int64) (authtypes.AccountI, error)
- func (c *HTTPClient) Balance(ctx context.Context, addr sdk.AccAddress, height int64) (sdk.Coins, error)
- func (c *HTTPClient) Delegations(ctx context.Context, addr sdk.AccAddress, height int64) (stakingtypes.DelegationResponses, error)
- func (c *HTTPClient) SimulateTx(ctx context.Context, tx authsigning.Tx) (*sdk.SimulationResponse, error)
- func (c *HTTPClient) UnbondingDelegations(ctx context.Context, addr sdk.AccAddress, height int64) (stakingtypes.UnbondingDelegations, error)
- type RPCClient
Constants ¶
const ( // BeginBlockHashStart represents the first byte of the begin blocker tx hash BeginBlockHashStart = 0x0 // EndBlockHashStart represents the first byte of the end blocker tx hash EndBlockHashStart = 0x1 )
const ( // NodeVersion is the version of fury we are using NodeVersion = "v0.16.1" // Blockchain is always Fury Blockchain = "Fury" // HistoricalBalanceSupported is whether historical balance is supported. HistoricalBalanceSupported = true // IncludeMempoolCoins does not apply to rosetta-fury as it is not UTXO-based. IncludeMempoolCoins = false // SuccessStatus is the status of any // Fury operation considered successful. SuccessStatus = "success" // FailureStatus is the status of any // Fury operation considered unsuccessful. FailureStatus = "failure" // FeeOpType is used to reference fee operations FeeOpType = "fee" // TransferOpType is used to reference transfer operations TransferOpType = "transfer" // MintOpType is used to reference mint operations MintOpType = "mint" // BurnOpType is used to reference burn operations BurnOpType = "burn" // AccLiquid represents spendable coins AccLiquid = "liquid" // AccLiquidDelegated represents delgated spendable coins AccLiquidDelegated = "liquid_delegated" // AccLiquidUnbonding represents unbonding spendable coins AccLiquidUnbonding = "liquid_unbonding" // AccVesting represents vesting (non-spendable) coins AccVesting = "vesting" // AccVestingDelegated represents vesting coins that are delegated AccVestingDelegated = "vesting_delegated" // AccVestingUnbonding represents vesting coins that are unbonding AccVestingUnbonding = "vesting_unbonding" )
Variables ¶
var ( // OperationTypes are all suppoorted operation types. OperationTypes = []string{ FeeOpType, TransferOpType, MintOpType, BurnOpType, } // OperationStatuses are all supported operation statuses. OperationStatuses = []*types.OperationStatus{ { Status: SuccessStatus, Successful: true, }, { Status: FailureStatus, Successful: false, }, } // CallMethods are all supported call methods. CallMethods = []string{} // BalanceExemptions lists sub-accounts that are balance exempt BalanceExemptions = []*types.BalanceExemption{ &types.BalanceExemption{ SubAccountAddress: strToPtr(AccLiquid), ExemptionType: types.BalanceDynamic, }, &types.BalanceExemption{ SubAccountAddress: strToPtr(AccVesting), ExemptionType: types.BalanceDynamic, }, &types.BalanceExemption{ SubAccountAddress: strToPtr(AccLiquidDelegated), ExemptionType: types.BalanceDynamic, }, &types.BalanceExemption{ SubAccountAddress: strToPtr(AccVestingDelegated), ExemptionType: types.BalanceDynamic, }, &types.BalanceExemption{ SubAccountAddress: strToPtr(AccLiquidUnbonding), ExemptionType: types.BalanceDynamic, }, &types.BalanceExemption{ SubAccountAddress: strToPtr(AccVestingUnbonding), ExemptionType: types.BalanceDynamic, }, } )
var Currencies = map[string]*types.Currency{ "ufury": &types.Currency{ Symbol: "FURY", Decimals: 6, }, "hard": &types.Currency{ Symbol: "HARD", Decimals: 6, }, "swp": &types.Currency{ Symbol: "SWP", Decimals: 6, }, "usdx": &types.Currency{ Symbol: "USDX", Decimals: 6, }, }
Currencies represents supported fury denom to rosetta currencies
var Denoms = map[string]string{
"FURY": "ufury",
"HARD": "hard",
"SWP": "swp",
"USDX": "usdx",
}
Denoms represents rosetta symbol to fury denom conversion
Functions ¶
func BeginBlockTxHash ¶
BeginBlockTxHash caluclates the begin blocker transaction hash
func EndBlockTxHash ¶
EndBlockTxHash caluclates the end blocker transaction hash
func EventToOperations ¶
EventToOperations returns rosetta operations from a abci block event
func EventsToOperations ¶
EventsToOperations returns rosetta operations from abci block events
func FeeToOperations ¶
func FeeToOperations(feePayer sdk.AccAddress, amount sdk.Coins, status *string, index int64) []*types.Operation
FeeToOperations returns rosetta operations from a transaction fee
func IsRetriableError ¶
IsRetriableError returns true if the error is retriable or temporary and may succeed on new attempt
func MsgToOperations ¶
func MsgToOperations(msg sdk.Msg, log sdk.ABCIMessageLog, status *string, index int64) []*types.Operation
MsgToOperations returns rosetta operations for a cosmos sdk or fury message
func ParseABCIResult ¶
func ParseABCIResult(result *ctypes.ResultABCIQuery, err error) ([]byte, error)
ParseABCIResult returns the Value of a ABCI Query
func TxToOperations ¶
func TxToOperations(tx authsigning.Tx, events sdk.StringEvents, logs sdk.ABCIMessageLogs, feeStatus *string, opStatus *string) []*types.Operation
TxToOperations returns rosetta operations from a transaction
Types ¶
type AccountBalanceService ¶
type AccountBalanceService interface { GetCoinsAndSequenceForSubAccount( ctx context.Context, subAccount *types.SubAccountIdentifier, ) (sdk.Coins, uint64, error) }
AccountBalanceService provides an interface fetch a balance from an account subtype
type BalanceServiceFactory ¶
type BalanceServiceFactory func(ctx context.Context, addr sdk.AccAddress, blockHeader *tmtypes.Header) (AccountBalanceService, error)
BalanceServiceFactory provides an interface for creating a balance service for specifc a account and block
func NewRPCBalanceFactory ¶
func NewRPCBalanceFactory(rpc RPCClient) BalanceServiceFactory
NewRPCBalanceFactory returns a balance service factory that uses an RPCClient to get an accounts balance
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements services.Client interface for communicating with the fury chain
func NewClient ¶
func NewClient(rpc RPCClient, balanceServiceFactory BalanceServiceFactory) (*Client, error)
NewClient initialized a new Client with the provided rpc client
func (*Client) Account ¶
Account returns the account for the provided address at the latest block height
func (*Client) Balance ¶
func (c *Client) Balance( ctx context.Context, accountIdentifier *types.AccountIdentifier, blockIdentifier *types.PartialBlockIdentifier, currencies []*types.Currency, ) (*types.AccountBalanceResponse, error)
Balance fetches and returns the account balance for an account
func (*Client) Block ¶
func (c *Client) Block( ctx context.Context, blockIdentifier *types.PartialBlockIdentifier, ) (*types.BlockResponse, error)
Block returns rosetta block for an index or hash
func (*Client) EstimateGas ¶
func (c *Client) EstimateGas(ctx context.Context, tx authsigning.Tx, adjustment float64) (uint64, error)
EstimateGas returns a gas wanted estimate from a tx with a provided adjustment
func (*Client) PostTx ¶
PostTx broadcasts a transaction and returns an error if it does not get into mempool
func (*Client) Status ¶
func (c *Client) Status(ctx context.Context) ( *types.BlockIdentifier, int64, *types.BlockIdentifier, *types.SyncStatus, []*types.Peer, error, )
Status fetches latest status from a fury node and returns the results
type HTTPClient ¶
HTTPClient extends the tendermint http client to enable finding blocks by hash
func NewHTTPClient ¶
func NewHTTPClient(remote string) (*HTTPClient, error)
NewHTTPClient returns a new HTTPClient with additional capabilities
func (*HTTPClient) Account ¶
func (c *HTTPClient) Account(ctx context.Context, addr sdk.AccAddress, height int64) (authtypes.AccountI, error)
Account returns the Account for a given address
func (*HTTPClient) Balance ¶
func (c *HTTPClient) Balance(ctx context.Context, addr sdk.AccAddress, height int64) (sdk.Coins, error)
Balance returns the Balance for a given address
func (*HTTPClient) Delegations ¶
func (c *HTTPClient) Delegations(ctx context.Context, addr sdk.AccAddress, height int64) (stakingtypes.DelegationResponses, error)
Delegations returns the delegations for an acc address
func (*HTTPClient) SimulateTx ¶
func (c *HTTPClient) SimulateTx(ctx context.Context, tx authsigning.Tx) (*sdk.SimulationResponse, error)
SimulateTx simulates a transaction and returns the response containing the gas used and result
func (*HTTPClient) UnbondingDelegations ¶
func (c *HTTPClient) UnbondingDelegations(ctx context.Context, addr sdk.AccAddress, height int64) (stakingtypes.UnbondingDelegations, error)
UnbondingDelegations returns the unbonding delegations for an address
type RPCClient ¶
type RPCClient interface { tmclient.Client Account(ctx context.Context, addr sdk.AccAddress, height int64) (authtypes.AccountI, error) Balance(ctx context.Context, addr sdk.AccAddress, height int64) (sdk.Coins, error) Delegations(ctx context.Context, addr sdk.AccAddress, height int64) (stakingtypes.DelegationResponses, error) UnbondingDelegations(ctx context.Context, addr sdk.AccAddress, height int64) (stakingtypes.UnbondingDelegations, error) SimulateTx(ctx context.Context, tx authsigning.Tx) (*sdk.SimulationResponse, error) }
RPCClient represents a tendermint http client with ability to get block by hash