account

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 BJJWallet

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

BJJWallet BJJ Wallet

func CreateBJJWalletFromSignedMsg added in v0.0.4

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 added in v0.0.4

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

CreateBjjWalletFromMnemonic Create a Babyjubjub Wallet from Mnemonic

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