Documentation
¶
Index ¶
- type Account
- type AccountAPI
- type AccountAuth
- type AccountAuthAPI
- type Accounts
- type Batch
- type BatchAPI
- type BigInt
- type Client
- func (c *Client) AccountAuth(ethAddr string) (*AccountAuthAPI, error)
- func (c *Client) AccountCreationAuth(ethAddr, bjj, signature string) error
- func (c *Client) GetAccount(bjjAddress, hezEthAddress *string, tokenID hezCommon.TokenID) (*AccountAPI, error)
- func (c *Client) GetBatchTxs(batchNum hezCommon.BatchNum) (*TxAPI, error)
- func (c *Client) GetLastBatch() (*Batch, error)
- func (c *Client) GetPoolTx(txID string) (*TxHistory, error)
- func (c *Client) GetTokens() (*TokenAPI, error)
- func (c *Client) GetTx(txID string) (*TxHistory, error)
- func (c *Client) SendTransaction(tx hezCommon.PoolL2Tx, token hezCommon.Token) (string, error)
- type CollectedFees
- type CreateAccountAuthAPI
- type StrHezIdx
- type Token
- type TokenAPI
- type Tokens
- type Tx
- type TxAPI
- type TxHistory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ItemID uint64 `json:"itemId"` Idx StrHezIdx `json:"accountIndex"` BatchNum hezCommon.BatchNum `json:"batch_num"` PublicKey apitypes.HezBJJ `json:"bjj"` EthAddr apitypes.HezEthAddr `json:"hezEthereumAddress"` Nonce hezCommon.Nonce `json:"nonce"` Balance *BigInt `json:"balance"` Token hezCommon.Token `json:"token"` }
Account is a representation of a account with additional information required by the API
type AccountAPI ¶
type AccountAPI struct { Accounts Accounts `json:"accounts"` PendingItems uint64 `json:"pendingItems"` }
AccountAPI is a representation of a account API response.
type AccountAuth ¶
type AccountAuth struct { EthAddr string `json:"hezEthereumAddress"` Bjj string `json:"bjj"` Signature string `json:"signature"` }
AccountAuth is a representation of a account authentication API request.
type AccountAuthAPI ¶
type AccountAuthAPI struct { EthAddr string `json:"hezEthereumAddress"` Bjj string `json:"bjj"` Signature apitypes.EthSignature `json:"signature"` Timestamp time.Time `json:"timestamp"` Message string `json:"Message"` }
AccountAuthAPI is a representation of a account authentication API response.
type Batch ¶
type Batch struct { ItemID uint64 `json:"itemId"` BatchNum hezCommon.BatchNum `json:"batchNum"` EthBlockNum int64 `json:"ethereumBlockNum"` EthBlockHash ethCommon.Hash `json:"ethereumBlockHash"` Timestamp time.Time `json:"timestamp"` ForgerAddr ethCommon.Address `json:"forgerAddr"` CollectedFees CollectedFees `json:"collectedFees"` TotalFeesUSD *float64 `json:"historicTotalCollectedFeesUSD"` StateRoot apitypes.BigIntStr `json:"stateRoot"` NumAccounts int `json:"numAccounts"` ExitRoot apitypes.BigIntStr `json:"exitRoot"` ForgeL1TxsNum *int64 `json:"forgeL1TransactionsNum"` SlotNum int64 `json:"slotNum"` ForgedTxs int `json:"forgedTransactions"` }
Batch is a representation of a batch with additional information required by the API, and extracted by joining block table
type BigInt ¶
BigInt is big.Int wrapper
func (*BigInt) UnmarshalJSON ¶
UnmarshalJSON unmarshal BitInt object
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the node API client object https://docs.hermez.io/#/developers/api
func (*Client) AccountAuth ¶
func (c *Client) AccountAuth(ethAddr string) (*AccountAuthAPI, error)
AccountAuth get the account authentication from the node.
func (*Client) AccountCreationAuth ¶
AccountCreationAuth create an account authentication into the node.
func (*Client) GetAccount ¶
func (c *Client) GetAccount(bjjAddress, hezEthAddress *string, tokenID hezCommon.TokenID) (*AccountAPI, error)
GetAccount get an account info based in the hermez-integration address and the token id
func (*Client) GetBatchTxs ¶
GetBatchTxs get all transactions history from a batch number
func (*Client) GetLastBatch ¶
GetLastBatch get last Hermez rollup batch
type CollectedFees ¶
CollectedFees is used to retrieve common.batch.CollectedFee from the DB
type CreateAccountAuthAPI ¶
type CreateAccountAuthAPI struct {
Message string `json:"Message"`
}
CreateAccountAuthAPI is a representation of a account authentication API response.
type StrHezIdx ¶
StrHezIdx is used to unmarshal HezIdx directly into an alias of common.Idx
func (*StrHezIdx) UnmarshalText ¶
UnmarshalText unmarshal a StrHezIdx
type Token ¶
type Token struct { ItemID uint64 `json:"itemId"` TokenID hezCommon.TokenID `json:"id"` EthBlockNum int64 `json:"ethereumBlockNum"` EthAddr ethCommon.Address `json:"ethereumAddress"` Name string `json:"name"` Symbol string `json:"symbol"` Decimals uint64 `json:"decimals"` USD float64 `json:"USD"` USDUpdate time.Time `json:"fiatUpdate"` }
Token is a representation of a tokens API object.
type Tx ¶
type Tx struct { TxID hezCommon.TxID `json:"id" binding:"required"` Type string `json:"type"` TokenID uint32 `json:"tokenId"` FromIdx string `json:"fromAccountIndex" binding:"required"` ToIdx string `json:"toAccountIndex"` ToEthAddr string `json:"toHezEthereumAddress"` ToBJJ string `json:"toBjj"` Amount string `json:"amount" binding:"required"` Fee uint64 `json:"fee"` Nonce uint64 `json:"nonce"` Signature string `json:"signature"` }
Tx is a representation of a transaction API request.
type TxAPI ¶
type TxAPI struct { Txs []TxHistory `json:"transactions"` PendingItems uint64 `json:"pendingItems"` }
TxAPI is a representation of a tx history API response.
type TxHistory ¶
type TxHistory struct { Amount apitypes.BigIntStr `json:"amount"` Fee hezCommon.FeeSelector `json:"fee"` FromIdx StrHezIdx `json:"fromAccountIndex"` FromEthAddr apitypes.HezEthAddr `json:"fromHezEthereumAddress"` FromBJJ apitypes.HezBJJ `json:"fromBJJ"` TxID hezCommon.TxID `json:"id"` BatchNum hezCommon.BatchNum `json:"batchNum"` L1orL2 string `json:"L1orL2"` L1Info interface{} `json:"L1Info"` L2Info interface{} `json:"L2Info"` Nonce hezCommon.Nonce `json:"nonce"` RequestAmount apitypes.BigIntStr `json:"requestAmount"` RequestFee hezCommon.FeeSelector `json:"requestFee"` RequestFromIdx StrHezIdx `json:"requestFromAccountIndex"` RequestNonce hezCommon.Nonce `json:"requestNonce"` RequestToIdx hezCommon.Idx `json:"requestToAccountIndex"` RequestToBJJ babyjub.PublicKeyComp `json:"requestToBJJ"` RequestToEthAddr ethCommon.Address `json:"requestToHezEthereumAddress"` RequestTokenID hezCommon.TokenID `json:"requestTokenId"` Signature string `json:"signature"` State hezCommon.PoolL2TxState `json:"state"` Timestamp time.Time `json:"timestamp"` ToIdx StrHezIdx `json:"toAccountIndex"` ToEthAddr apitypes.HezEthAddr `json:"toHezEthereumAddress"` ToBJJ apitypes.HezBJJ `json:"toBjj"` Token hezCommon.Token `json:"token"` Type hezCommon.TxType `json:"type"` }
TxHistory is a representation of a transaction history API request.