hermez

package
v0.0.0-...-7f300a8 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PkLength represents the size of the baby jubjub private key
	PkLength uint16 = 32
)

Variables

This section is empty.

Functions

func CreateExit

func CreateExit(chainID uint16, amount *big.Int, privateKey babyjub.PrivateKey,
	fromIdx hezCommon.Idx, tokenID hezCommon.TokenID, nonce hezCommon.Nonce,
	fee hezCommon.FeeSelector) (*hezCommon.PoolL2Tx, error)

CreateExit create a L2 exit transaction

func CreateTransfer

func CreateTransfer(chainID uint16, toIdx hezCommon.Idx, amount *big.Int, privateKey babyjub.PrivateKey,
	fromIdx hezCommon.Idx, tokenID hezCommon.TokenID, nonce hezCommon.Nonce,
	fee hezCommon.FeeSelector) (*hezCommon.PoolL2Tx, error)

CreateTransfer create a L2 transfer to baby jubjub transaction

func CreateTransferToBjj

func CreateTransferToBjj(chainID uint16, to string, amount *big.Int, privateKey babyjub.PrivateKey,
	fromIdx hezCommon.Idx, tokenID hezCommon.TokenID, nonce hezCommon.Nonce,
	fee hezCommon.FeeSelector) (*hezCommon.PoolL2Tx, error)

CreateTransferToBjj create a L2 transfer to baby jubjub transaction

func CreateTransferToEthAddress

func CreateTransferToEthAddress(chainID uint16, to string, amount *big.Int, privateKey babyjub.PrivateKey,
	fromIdx hezCommon.Idx, tokenID hezCommon.TokenID, nonce hezCommon.Nonce,
	fee hezCommon.FeeSelector) (*hezCommon.PoolL2Tx, error)

CreateTransferToEthAddress create a L2 transfer to eth address transaction

func HezStrToBJJ

func HezStrToBJJ(s string) (babyjub.PublicKeyComp, error)

HezStrToBJJ convert bjj public key to babyjub.PublicKeyComp

func NewHezBJJ

func NewHezBJJ(pkComp babyjub.PublicKeyComp) string

NewHezBJJ creates a HezBJJ from a *babyjub.PublicKeyComp. Calling this method with a nil bjj causes panic

func WeiToEther

func WeiToEther(wei *big.Int) *big.Float

WeiToEther converts a wei value (*big.Int) to a ether value (*big.Float)

Types

type Wallet

type Wallet struct {
	PrivateKey    babyjub.PrivateKey
	PublicKey     babyjub.PublicKeyComp
	HezBjjAddress string
	HezEthAddress string
	Signature     string
}

Wallet represents a wallet object with a private key, public key and a baby jubjub hez address

func NewBJJ

func NewBJJ(mnemonic string, index int, chainID uint16,
	rollupContract ethCommon.Address) (*Wallet, error)

NewBJJ create a baby jubjub address from the mnemonic and the derivation path. It returns a wallet object with a private key, public key and a baby jubjub hez address and a error if occurs.

Jump to

Keyboard shortcuts

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