Documentation ¶
Index ¶
- Constants
- func CreateExit(chainID uint16, amount *big.Int, privateKey babyjub.PrivateKey, ...) (*hezCommon.PoolL2Tx, error)
- func CreateTransfer(chainID uint16, toIdx hezCommon.Idx, amount *big.Int, ...) (*hezCommon.PoolL2Tx, error)
- func CreateTransferToBjj(chainID uint16, to string, amount *big.Int, privateKey babyjub.PrivateKey, ...) (*hezCommon.PoolL2Tx, error)
- func CreateTransferToEthAddress(chainID uint16, to string, amount *big.Int, privateKey babyjub.PrivateKey, ...) (*hezCommon.PoolL2Tx, error)
- func HezStrToBJJ(s string) (babyjub.PublicKeyComp, error)
- func NewHezBJJ(pkComp babyjub.PublicKeyComp) string
- func WeiToEther(wei *big.Int) *big.Float
- type Wallet
Constants ¶
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
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.