tools

package
v0.0.0-...-ac1e388 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

* Copyright (C) 2020 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with The poly network . If not, see <http://www.gnu.org/licenses/>.

* Copyright (C) 2020 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with The poly network . If not, see <http://www.gnu.org/licenses/>.

* Copyright (C) 2020 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with The poly network . If not, see <http://www.gnu.org/licenses/>.

* Copyright (C) 2020 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with The poly network . If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigEndianToUint64

func BigEndianToUint64(array []byte) uint64

func EncodeBigInt

func EncodeBigInt(b *big.Int) string

func GetCurveLabel

func GetCurveLabel(name string) (byte, error)

func GetEthNoCompressKey

func GetEthNoCompressKey(key keypair.PublicKey) []byte

func GetExplorerUrl

func GetExplorerUrl(chainId uint64) string

func GetNoCompresskey

func GetNoCompresskey(key keypair.PublicKey) []byte

func GetNodeHeader

func GetNodeHeader(url string, restClient *RestClient, height uint64) ([]byte, error)

func GetNodeHeight

func GetNodeHeight(url string, restClient *RestClient) (uint64, error)

func GetProof

func GetProof(url string, contractAddress string, key string, blockheight string, restClient *RestClient) ([]byte, error)

func HexReverse

func HexReverse(arr []byte) []byte

func HexStringReverse

func HexStringReverse(value string) string

func ParseAuditpath

func ParseAuditpath(path []byte) ([]byte, []byte, [][32]byte, error)

func Uint64ToBigEndian

func Uint64ToBigEndian(i uint64) []byte

Uint64ToBigEndian - marshals uint64 to a bigendian byte slice so it can be sorted

Types

type ETHProof

type ETHProof struct {
	Address       string         `json:"address"`
	Balance       string         `json:"balance"`
	CodeHash      string         `json:"codeHash"`
	Nonce         string         `json:"nonce"`
	StorageHash   string         `json:"storageHash"`
	AccountProof  []string       `json:"accountProof"`
	StorageProofs []StorageProof `json:"storageProof"`
}

type EthKeyStore

type EthKeyStore struct {
	// contains filtered or unexported fields
}

func NewEthKeyStore

func NewEthKeyStore(sigConfig *config.ETHConfig, chainId *big.Int) *EthKeyStore

func (*EthKeyStore) GetAccounts

func (this *EthKeyStore) GetAccounts() []accounts.Account

func (*EthKeyStore) GetChainId

func (this *EthKeyStore) GetChainId() uint64

func (*EthKeyStore) SignTransaction

func (this *EthKeyStore) SignTransaction(tx *types.Transaction, acc accounts.Account) (*types.Transaction, error)

func (*EthKeyStore) TestPwd

func (this *EthKeyStore) TestPwd(acc accounts.Account, pwd string) error

func (*EthKeyStore) UnlockKeys

func (this *EthKeyStore) UnlockKeys(sigConfig *config.ETHConfig) error

type NonceManager

type NonceManager struct {
	// contains filtered or unexported fields
}

func NewNonceManager

func NewNonceManager(ethClient *ethclient.Client) *NonceManager

func (*NonceManager) DecreaseAddressNonce

func (this *NonceManager) DecreaseAddressNonce(address common.Address)

func (*NonceManager) GetAddressNonce

func (this *NonceManager) GetAddressNonce(address common.Address) uint64

return account nonce, and than nonce++

func (*NonceManager) ReturnNonce

func (this *NonceManager) ReturnNonce(addr common.Address, nonce uint64)

type RestClient

type RestClient struct {
	Addr string
	// contains filtered or unexported fields
}

func NewRestClient

func NewRestClient() *RestClient

func NewRestClientHost

func NewRestClientHost(addr string) *RestClient

addr must not ends with /

func (*RestClient) Get

func (self *RestClient) Get(path string) ([]byte, error)

func (*RestClient) SendRestRequest

func (self *RestClient) SendRestRequest(addr string, data []byte) ([]byte, error)

func (*RestClient) SetAddr

func (self *RestClient) SetAddr(addr string) *RestClient

func (*RestClient) SetRestClient

func (self *RestClient) SetRestClient(restClient *http.Client) *RestClient

type SortedNonceArr

type SortedNonceArr []uint64

func (SortedNonceArr) Len

func (arr SortedNonceArr) Len() int

func (SortedNonceArr) Less

func (arr SortedNonceArr) Less(i, j int) bool

func (SortedNonceArr) Swap

func (arr SortedNonceArr) Swap(i, j int)

type StorageProof

type StorageProof struct {
	Key   string   `json:"key"`
	Value string   `json:"value"`
	Proof []string `json:"proof"`
}

Jump to

Keyboard shortcuts

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