Documentation ¶
Index ¶
- func AmountToFloat40(amount *big.Int) (*big.Int, error)
- func AtomicTransfer(hezClient client.HermezClient, txs []AtomicTxItem) (serverResponse string, atomicGroupID hezCommon.AtomicGroupID, err error)
- func AtomicTransferJSON(hezClient client.HermezClient, txsJSON []string) (serverResponse string, atomicGroupID hezCommon.AtomicGroupID, err error)
- func BjjToString(bjj babyjub.PublicKeyComp) string
- func CreateFullTxs(hezClient client.HermezClient, txs []AtomicTxItem) (fullTxs []hezCommon.PoolL2Tx, err error)
- func IdxToHez(idx hezCommon.Idx, tokenSymbol string) string
- func SendAtomicTxsGroup(hezClient client.HermezClient, atomicTxs hezCommon.AtomicGroup) (serverResponse string, err error)
- func SetAtomicGroupID(atomicGroup hezCommon.AtomicGroup) hezCommon.AtomicGroup
- type APITx
- func ExecuteL2Transaction(hezClient client.HermezClient, apiTx APITx) (apiTxReturn APITx, serverResponse string, err error)
- func L2Transfer(hezClient client.HermezClient, senderBjjWallet account.BJJWallet, ...) (apiTxReturn APITx, serverResponse string, err error)
- func MarshalTransaction(itemToTransfer string, senderAcctDetails account.AccountAPIResponse, ...) (apiTxRequest APITx, err error)
- func NewHermezAPITxRequest(poolTx *hezCommon.PoolL2Tx, token hezCommon.Token) APITx
- func NewSignedAPITxToEthAddr(chainID int, fromBjjWallet account.BJJWallet, fromIdx uint64, ...) (APITx, error)
- func SignAPITx(chainID int, fromBjjWallet account.BJJWallet, token hezCommon.Token, ...) (APITx, error)
- type AtomicTxItem
- type PoolTxAPI
- type TransactionsAPIResponse
- type TxReceiverMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicTransfer ¶ added in v0.1.3
func AtomicTransfer(hezClient client.HermezClient, txs []AtomicTxItem) (serverResponse string, atomicGroupID hezCommon.AtomicGroupID, err error)
AtomicTransfer creates PoolL2Txs using basic information provided in the AtomicTxItems, set metadata and fields based on the current state. Also links the txs setting the Rq* fields and sign txs. After performs token or ETH transfers in a pool of transactions.
func AtomicTransferJSON ¶ added in v0.1.4
func AtomicTransferJSON(hezClient client.HermezClient, txsJSON []string) (serverResponse string, atomicGroupID hezCommon.AtomicGroupID, err error)
AtomicTransferJSON receives an array of AtomicTxItems in JSON format, create PoolL2Txs, atomic group, sign and post
func BjjToString ¶
func BjjToString(bjj babyjub.PublicKeyComp) string
BjjToString convert the BJJ public key to string
func CreateFullTxs ¶ added in v0.1.4
func CreateFullTxs(hezClient client.HermezClient, txs []AtomicTxItem) (fullTxs []hezCommon.PoolL2Tx, err error)
CreateFullTxs turn the basic information in a PoolL2Tx, set metadata and fields based on the current state. Also links the txs setting the Rq* fields.
func SendAtomicTxsGroup ¶ added in v0.1.4
func SendAtomicTxsGroup(hezClient client.HermezClient, atomicTxs hezCommon.AtomicGroup) (serverResponse string, err error)
SendAtomicTxsGroup submits Atomic transaction to the current coordinator endpoint
func SetAtomicGroupID ¶ added in v0.1.4
func SetAtomicGroupID(atomicGroup hezCommon.AtomicGroup) hezCommon.AtomicGroup
SetAtomicGroupID defines the AtomicGroup ID and propagate to txs
Types ¶
type APITx ¶
type APITx 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"` }
APITx is a representation of a transaction API request.
func ExecuteL2Transaction ¶
func ExecuteL2Transaction(hezClient client.HermezClient, apiTx APITx) (apiTxReturn APITx, serverResponse string, err error)
ExecuteL2Transaction submits L2 transaction to the current coordinator endpoint
func L2Transfer ¶
func L2Transfer(hezClient client.HermezClient, senderBjjWallet account.BJJWallet, receiverAddress string, tokenSymbolToTransfer string, amount *big.Int, feeRangeSelectedID int) (apiTxReturn APITx, serverResponse string, err error)
L2Transfer perform token or ETH transfer within Hermez network (we say L2 or Layer2)
func MarshalTransaction ¶
func MarshalTransaction(itemToTransfer string, senderAcctDetails account.AccountAPIResponse, receiverAcctDetails account.AccountAPIResponse, senderBjjWallet account.BJJWallet, amount *big.Int, feeSelector int, ethereumChainID int) (apiTxRequest APITx, err error)
MarshalTransaction marshal transaction information into a Hermez transaction API request
func NewHermezAPITxRequest ¶
NewHermezAPITxRequest convert L2 tx to Hermez API request model
func NewSignedAPITxToEthAddr ¶ added in v0.1.5
func NewSignedAPITxToEthAddr(chainID int, fromBjjWallet account.BJJWallet, fromIdx uint64, toEthAddress string, amount *big.Int, feeSelector hezCommon.FeeSelector, token hezCommon.Token, nonce int) (APITx, error)
NewSignedAPITxToEthAddr creates and signs a new APITx to transfer to eth addr
type AtomicTxItem ¶ added in v0.1.3
type PoolTxAPI ¶ added in v0.1.4
type PoolTxAPI struct { ItemID uint64 `json:"itemId"` TxID hezcommon.TxID `json:"id"` FromIdx apitypes.HezIdx `json:"fromAccountIndex"` EffectiveFromEthAddr apitypes.HezEthAddr `json:"fromHezEthereumAddress"` EffectiveFromBJJ apitypes.HezBJJ `json:"fromBJJ"` ToIdx apitypes.HezIdx `json:"toAccountIndex"` EffectiveToEthAddr apitypes.HezEthAddr `json:"toHezEthereumAddress"` EffectiveToBJJ apitypes.HezBJJ `json:"toBJJ"` Amount apitypes.BigIntStr `json:"amount"` Fee hezcommon.FeeSelector `json:"fee"` Nonce hezcommon.Nonce `json:"nonce"` State hezcommon.PoolL2TxState `json:"state"` MaxNumBatch uint32 `json:"maxNumBatch"` Info string `json:"info"` ErrorCode int `json:"errorCode"` ErrorType string `json:"errorType"` Signature babyjub.SignatureComp `json:"signature"` RqFromIdx apitypes.HezIdx `json:"requestFromAccountIndex"` RqToIdx apitypes.HezIdx `json:"requestToAccountIndex"` RqToEthAddr apitypes.HezEthAddr `json:"requestToHezEthereumAddress"` RqToBJJ apitypes.HezBJJ `json:"requestToBJJ"` RqTokenID hezcommon.TokenID `json:"requestTokenId"` RqAmount apitypes.BigIntStr `json:"requestAmount"` RqFee hezcommon.FeeSelector `json:"requestFee"` RqNonce hezcommon.Nonce `json:"requestNonce"` Type hezcommon.TxType `json:"type"` Timestamp time.Time `json:"timestamp"` TotalItems uint64 `json:"total_items"` Token token.Token `json:"token"` }
func GetTransactionPool ¶ added in v0.1.8
func GetTransactionPool(hezClient client.HermezClient, txID hezCommon.TxID) (transaction PoolTxAPI, err error)
GetTransactionInPool connects to the hezClient.CurrentCoordinatorURL and pull a single transaction from the pool based on it's ID
type TransactionsAPIResponse ¶ added in v0.1.4
type TransactionsAPIResponse struct {
Transactions []PoolTxAPI `json:"transactions"`
}
func GetTransactionsInPool ¶ added in v0.1.4
func GetTransactionsInPool(hezClient client.HermezClient) (transactions TransactionsAPIResponse, err error)
GetTransactionsInPool connects to a hermez node and pull all transactions in the pool