utils

package
v0.0.0-...-b94ffa6 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: LGPL-3.0 Imports: 15 Imported by: 3

Documentation

Overview

SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team

  • Copyright (C) 2018 The ontology Authors
  • This file is part of The ontology library. *
  • The ontology 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 ontology 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 ontology. If not, see <http://www.gnu.org/licenses/>.

SPDX-License-Identifier: LGPL-3.0-or-later Copyright 2019 DNA Dev team

  • Copyright (C) 2018 The ontology Authors
  • This file is part of The ontology library. *
  • The ontology 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 ontology 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 ontology. If not, see <http://www.gnu.org/licenses/>.

Provide some utils for dna-go-sdk

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressFromBase58

func AddressFromBase58(s string) (common.Address, error)

func AddressFromHexString

func AddressFromHexString(s string) (common.Address, error)

func AddressParseFromBytes

func AddressParseFromBytes(b []byte) (common.Address, error)

func GetAssetAddress

func GetAssetAddress(asset string) (common.Address, error)

func GetBlock

func GetBlock(data []byte) (*types.Block, error)

func GetBlockTxHashes

func GetBlockTxHashes(data []byte) (*sdkcom.BlockTxHashes, error)

func GetContractAddress

func GetContractAddress(contractCode string) (common.Address, error)

func GetInt

func GetInt(data []byte) (int, error)

func GetMemPoolTxCount

func GetMemPoolTxCount(data []byte) (*sdkcom.MemPoolTxCount, error)

func GetMemPoolTxState

func GetMemPoolTxState(data []byte) (*sdkcom.MemPoolTxState, error)

func GetMerkleProof

func GetMerkleProof(data []byte) (*sdkcom.MerkleProof, error)

func GetSmartContactEvents

func GetSmartContactEvents(data []byte) ([]*sdkcom.SmartContactEvent, error)

func GetSmartContract

func GetSmartContract(data []byte) (*payload.DeployCode, error)

func GetSmartContractEvent

func GetSmartContractEvent(data []byte) (*sdkcom.SmartContactEvent, error)

func GetSmartContractEventLog

func GetSmartContractEventLog(data []byte) (*sdkcom.SmartContractEventLog, error)

func GetStorage

func GetStorage(data []byte) ([]byte, error)

func GetTransaction

func GetTransaction(data []byte) (*types.Transaction, error)

func GetUint256

func GetUint256(data []byte) (common.Uint256, error)

func GetUint32

func GetUint32(data []byte) (uint32, error)

func GetUint64

func GetUint64(data []byte) (uint64, error)

func GetVersion

func GetVersion(data []byte) (string, error)

func HasAlreadySig

func HasAlreadySig(data []byte, pk keypair.PublicKey, sigDatas [][]byte) bool

func IsEmptyJsonArray

func IsEmptyJsonArray(data []byte) bool

func IsFileExist

func IsFileExist(file string) bool

IsFileExist return is file is exist

func PubKeysEqual

func PubKeysEqual(pks1, pks2 []keypair.PublicKey) bool

func TransactionFromHexString

func TransactionFromHexString(rawTx string) (*types.Transaction, error)

func Uint256FromHexString

func Uint256FromHexString(s string) (common.Uint256, error)

func Uint256ParseFromBytes

func Uint256ParseFromBytes(f []byte) (common.Uint256, error)

Types

type WebSocketClient

type WebSocketClient struct {
	OnConnect func(address string)
	OnClose   func(address string)
	OnError   func(address string, err error)
	OnMessage func([]byte)
	// contains filtered or unexported fields
}

WebSocketClient use for client to operation web socket

func NewWebSocketClient

func NewWebSocketClient() *WebSocketClient

Create WebSocketClient instance

func (*WebSocketClient) Close

func (this *WebSocketClient) Close() error

Close the connection of server

func (*WebSocketClient) Connect

func (this *WebSocketClient) Connect(addr string) (err error)

Connect to server

func (*WebSocketClient) Send

func (this *WebSocketClient) Send(data []byte) error

Send data to server

func (*WebSocketClient) Status

func (this *WebSocketClient) Status() bool

Status return the status of connection of client and server

Jump to

Keyboard shortcuts

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