account

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHermezAuthSignature added in v0.1.4

func CreateHermezAuthSignature(ethPk *ecdsa.PrivateKey, ethAccount accounts.Account, bjjPubKeyComp babyjub.PublicKeyComp, chainID int, rollupContract common.Address) (string, error)

CreateHermezAuthSignature creates the hermez wallet authentication signature

func FromBJJPubKeyCompToHezBJJAddress

func FromBJJPubKeyCompToHezBJJAddress(pkComp babyjub.PublicKeyComp) (string, error)

FromBJJPubKeyCompToHezBJJAddress creates a Hermez BJJ account from a BJJ PubKey Compressed

Types

type Account

type Account struct {
	AccountIndex       string `json:"accountIndex"`
	Balance            string `json:"balance"`
	BJJAddress         string `json:"bjj"`
	HezEthereumAddress string `json:"hezEthereumAddress"`
	ItemID             int    `json:"itemId"`
	Nonce              int    `json:"nonce"`
	Token              Token  `json:"token"`
}

type AccountAPIResponse

type AccountAPIResponse struct {
	Accounts     []Account `json:"accounts"`
	PendingItems int       `json:"pendingItems"`
}

func GetAccountInfo

func GetAccountInfo(hezClient client.HermezClient, account string) (hezAccount AccountAPIResponse, err error)

GetAccountInfo connects to a hermez node and pull account data

type AccountCreation added in v0.1.4

type AccountCreation struct {
	EthereumAddress string `json:"hezEthereumAddress"`
	HezBjjAddress   string `json:"bjj"`
	Signature       string `json:"signature"`
}

AccountCreation is used to submit new account creation to a Hermez Node

type BJJWallet

type BJJWallet struct {
	PrivateKey                   babyjub.PrivateKey
	PublicKey                    babyjub.PublicKeyComp
	HezBjjAddress                string
	EthAccount                   accounts.Account
	HezEthAddress                string
	AccountCreationAuthSignature string
}

BJJWallet BJJ Wallet

func CreateBJJWalletFromSignedMsg

func CreateBJJWalletFromSignedMsg(signedMsg []byte) (bjjWallet BJJWallet, ethAccount accounts.Account, err error)

CreateBJJWalletFromSignedMsg creates BJJWallet from signed hermez standard message to generate account

func CreateBjjWalletFromHexPvtKey

func CreateBjjWalletFromHexPvtKey(hexPvtKey string) (bjjWallet BJJWallet, ethAccount accounts.Account, err error)

CreateBjjWalletFromHexPvtKey Create a Babyjubjub Wallet from Hexdecimal Private Key

func CreateBjjWalletFromMnemonic

func CreateBjjWalletFromMnemonic(mnemonic string) (bjjWallet BJJWallet, ethAccount accounts.Account, err error)

CreateBjjWalletFromMnemonic Create a Babyjubjub Wallet from Mnemonic

func CreateBjjWalletWithAccCreationSignatureFromHexPvtKey added in v0.1.4

func CreateBjjWalletWithAccCreationSignatureFromHexPvtKey(hexPvtKey string, chainID int, rollupContractAddress string) (bjjWallet BJJWallet, ethAccount accounts.Account, err error)

CreateBjjWalletWithAccCreationSignatureFromHexPvtKey Create a Babyjubjub Wallet from Hexdecimal Private Key with hermez account creation signature

func CreateBjjWalletWithAccCreationSignatureFromPvtKey added in v0.1.6

func CreateBjjWalletWithAccCreationSignatureFromPvtKey(ecdsaPvtKey *ecdsa.PrivateKey, chainID int, rollupContractAddress string) (bjjWallet BJJWallet, ethAccount accounts.Account, err error)

CreateBjjWalletWithAccCreationSignatureFromPvtKey Create a Babyjubjub Wallet from Hexdecimal Private Key with hermez account creation signature

type Token

type Token struct {
	USD              float64   `json:"USD"`
	Decimals         int       `json:"decimals"`
	EthereumAddress  string    `json:"ethereumAddress"`
	EthereumBlockNum int       `json:"ethereumBlockNum"`
	FiatUpdate       time.Time `json:"fiatUpdate"`
	ID               int       `json:"id"`
	ItemID           int       `json:"itemId"`
	Name             string    `json:"name"`
	Symbol           string    `json:"symbol"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL