Documentation
¶
Index ¶
- Constants
- Variables
- func InArray(val interface{}, array interface{}) (exists bool, index int, err error)
- func StringOR(values ...string) string
- type Broadcast
- type BroadcastResponse
- type Bytea
- type Client
- type HeightOperator
- type LastBlock
- type Logger
- type Message
- type MessageType
- type NS
- type OrderBy
- type Received
- type Response
- type Search
- type SearchResponse
- type Summary
- type SummaryResponse
- type Transaction
- type Type
Constants ¶
View Source
const (
HandshakeTimeout = 7 * time.Second
)
Variables ¶
View Source
var ErrAlreadyStarted = errors.New("already started")
View Source
var ErrNoConnected = errors.New("websocket: not connected")
ErrNoConnected ... Reference: https://github.com/recws-org/recws/blob/master/recws.go
View Source
var ErrNotStarted = errors.New("not started yet")
View Source
var TypesSlice = []Type{ TypeMaster, TypeAddress, TypeAddresses, TypeSubMaster, TypeSubAddresses, TypeAccount, TypeAccountInitialTXS, TypeNS, TypeMessage, TypeMessageSent, TypeMessageThreadDelete, TypeTransfer, TypeTransferCancel, TypeTransferSent, TypeTransferReceiveDelete, TypeTransferInfo, TypeStorage, TypeStorageDelete, TypeBackup, TypeContact, TypeFileVirtual, TypeFileFs, TypeRfileVirtual, TypeRfileFs, TypeDfileVirtual, TypeDfileFs, TypePfileVirtual, TypeRequest, TypeRequestIn, TypeRequestUpload, TypeRequestCancel, TypeDataRoom, TypeDataRoomPolicy, TypeDataRoomF, TypeDataRoomData, TypeDataRoomDataDelete, TypeDataRoomDataPolicy, TypeMultiStorage, TypeMultiTransfer, TypeMultiTransferSent, TypeMultiBackup, TypeMultiDataRoom, TypePasswdData, TypePasswdRoom, TypePasswdRoomPolicy, TypePasswdRoomF, TypePasswdRoomData, TypePasswdRoomDataDelete, TypePasswdRoomDataPolicy, TypePasswdDataV2, TypePasswdDataV2Policy, }
Functions ¶
Types ¶
type Broadcast ¶ added in v1.2.0
type Broadcast struct {
ID string `json:"id"` //Hash of the transaction
Version uint32 `json:"version"`
Type Type `json:"type"`
SenderAddr string `json:"sender_addr"`
RecipientAddr string `json:"recipient_addr"`
Data []byte `json:"data"`
AdditionalData *[]byte `json:"additional_data,omitempty"`
CipherData *[]byte `json:"cipher_data,omitempty"`
Sign []byte `json:"sign"`
Fee uint64 `json:"fee"`
}
type BroadcastResponse ¶ added in v1.2.0
type Client ¶
type Client interface {
// SetLogger ..
// Deprecated: use WithLogger/1
SetLogger(l Logger) Client
WithLogger(l Logger) Client
SetVerbose(verbose bool) (Client, error)
Start() error
Stop() error
SetListenCallback(func(transaction *Transaction))
Subscribe(addresses []string, signedDatas map[string]string, txTypes ...Type) error
Unsubscribe() error
Write(b []byte) error
LastBlock(chainName, chainVersion *string) (*LastBlock, error)
Tx(id string, signature string, chainName, chainVersion *string) (*Transaction, error)
TxSummary(summary *Summary) (lastBlockHeight uint64, lastTransaction *Transaction, totalCount uint64, err error)
TxSearch(search *Search) (txs []*Transaction, totalCount uint64, err error)
Broadcast(id string, version uint32, typ Type, data []byte, additionalData, cipherData *[]byte, senderAddress, recipientAddress string, sign []byte, fee uint64) (*BroadcastResponse, error)
BroadcastSync(id string, version uint32, typ Type, data []byte, additionalData, cipherData *[]byte, senderAddress, recipientAddress string, sign []byte, fee uint64) (*BroadcastResponse, error)
BroadcastCommit(id string, version uint32, typ Type, data []byte, additionalData, cipherData *[]byte, senderAddress, recipientAddress string, sign []byte, fee uint64) (*BroadcastResponse, error)
FetchNS(identifier string) (*NS, error)
Query(method string, path string, data []byte) (*Response, error)
}
Client TCABCI Read Node Websocket Client
type HeightOperator ¶ added in v1.2.0
type HeightOperator string
const ( Equal HeightOperator = "=" Less HeightOperator = "<" Greater HeightOperator = ">" EqualOrLess HeightOperator = "<=" EqualOrGreater HeightOperator = ">=" )
func (HeightOperator) IsValid ¶ added in v1.2.0
func (ho HeightOperator) IsValid() bool
type LastBlock ¶ added in v1.2.0
type LastBlock struct {
Blocks []*Transaction `json:"data"`
TotalCount uint64 `json:"total_count"`
}
type Logger ¶ added in v1.6.0
type Logger interface {
Info(args ...interface{})
Error(args ...interface{})
Print(args ...interface{})
}
type Message ¶
type Message struct {
IsWeb bool `json:"is_web"`
Type MessageType `json:"type"`
Addrs []string `json:"addrs"`
SignedAddrs map[string]string `json:"signed_addrs"`
TXTypes []Type `json:"tx_types"`
}
Message ..
type MessageType ¶
type MessageType string
MessageType ..
const ( // Subscribe message Subscribe MessageType = "subscribe" // Unsubscribe message Unsubscribe MessageType = "unsubscribe" )
type Response ¶ added in v1.2.7
type Response struct {
Message *string `json:"message,omitempty"`
Data interface{} `json:"data,omitempty"`
TotalCount uint64 `json:"total_count,omitempty"`
Error bool `json:"error"`
Errors map[string]string `json:"errors,omitempty"`
Detail *string `json:"detail,omitempty"`
}
func (*Response) GetMessage ¶ added in v1.6.0
type Search ¶ added in v1.2.0
type Search struct {
Limit uint `json:"limit"`
Height uint64 `json:"-"`
Offset uint64 `json:"offset"`
MaxHeight uint64 `json:"max_height"`
LastOrder uint64 `json:"last_order"`
Type Type `json:"typ,omitempty"`
Types []Type `json:"types,omitempty"`
PHeight string `json:"height,omitempty"`
OrderBy OrderBy `json:"order_by,omitempty"`
OrderField string `json:"order_field,omitempty"`
HeightOperator HeightOperator `json:"-"`
RecipientAddresses []string `json:"recipient_addrs,omitempty"`
SenderAddresses []string `json:"sender_addrs,omitempty"`
SignedAddresses map[string]string `json:"signed_addrs,omitempty"`
Hashes []string `json:"hashes,omitempty"`
ChainName *string `json:"chain_name,omitempty"`
ChainVersion *string `json:"chain_version,omitempty"`
}
type SearchResponse ¶ added in v1.2.0
type SearchResponse struct {
TXS []*Transaction `json:"data"`
TotalCount uint64 `json:"total_count"`
}
type Summary ¶ added in v1.2.0
type Summary struct {
RecipientAddresses []string `json:"recipient_addrs,omitempty"`
SenderAddresses []string `json:"sender_addrs,omitempty"`
Type Type `json:"typ,omitempty"`
ChainName *string `json:"chain_name,omitempty"`
ChainVersion *string `json:"chain_version,omitempty"`
SignedAddresses map[string]string `json:"signed_addrs,omitempty"`
}
type SummaryResponse ¶ added in v1.2.0
type SummaryResponse struct {
Data struct {
LastBlockHeight uint64 `json:"last_block_height"`
LastTransaction *Transaction `json:"last_transaction"`
} `json:"data"`
TotalCount uint64 `json:"total_count"`
}
type Transaction ¶
type Transaction struct {
Order *uint64 `json:"order,omitempty"`
ID interface{} `json:"id"`
Height uint64 `json:"height"`
Identifier string `json:"identifier"`
Version uint `json:"version"`
Typ Type `json:"typ"`
SenderAddr string `json:"sender_addr"`
RecipientAddr string `json:"recipient_addr"`
Data Bytea `json:"data"`
AdditionalData *Bytea `json:"additional_data,omitempty"`
CipherData *Bytea `json:"cipher_data,omitempty"`
Sign Bytea `json:"sign"`
Fee uint64 `json:"fee"`
Hash string `json:"hash"`
InsertedAt time.Time `json:"inserted_at"`
}
Transaction read node transaction model
type Type ¶ added in v1.2.0
type Type string
const ( TypeMaster Type = "initial_storage" TypeAddress Type = "interim_storage" TypeAddresses Type = "interim_storages" TypeSubMaster Type = "initial_sub_storage" TypeSubAddresses Type = "interim_sub_storages" TypeAccount Type = "initial_account" TypeAccountInitialTXS Type = "initial_account_txs" TypeNS Type = "ns" TypeMessage Type = "message" TypeMessageSent Type = "inherit_message" TypeMessageThreadDelete Type = "inherit_message_recv" TypeTransfer Type = "transfer" TypeTransferCancel Type = "transfer_Cancel" TypeTransferSent Type = "transfer_sent" TypeTransferReceiveDelete Type = "transfer_receive_delete" TypeTransferInfo Type = "transfer_info" TypeStorage Type = "storage" TypeStorageDelete Type = "storage_delete" TypeBackup Type = "backup" TypeContact Type = "interim_message" TypeFileVirtual Type = "fs_virt" TypeFileFs Type = "fs_real" TypeRfileVirtual Type = "fs_rvirt" TypeRfileFs Type = "fs_rreal" TypeDfileVirtual Type = "fs_dvirt" TypeDfileFs Type = "fs_dreal" TypePfileVirtual Type = "fs_pvirt" TypeRequest Type = "request" TypeRequestIn Type = "request_in" TypeRequestUpload Type = "request_upload" TypeRequestCancel Type = "request_Cancel" TypeDataRoom Type = "data_room" TypeDataRoomPolicy Type = "data_room_policy" TypeDataRoomF Type = "data_roomF" TypeDataRoomData Type = "data_room_data" TypeDataRoomDataDelete Type = "data_room_data_delete" TypeDataRoomDataPolicy Type = "data_room_data_policy" TypeMultiStorage Type = "multi_storage" TypeMultiTransfer Type = "multi_transfer" TypeMultiTransferSent Type = "multi_transfer_sent" TypeMultiBackup Type = "multi_backup" TypeMultiDataRoom Type = "multi_data_room" TypePasswdData Type = "passwd_data" TypePasswdRoom Type = "passwd_room" TypePasswdRoomPolicy Type = "passwd_room_policy" TypePasswdRoomF Type = "passwd_roomF" TypePasswdRoomData Type = "passwd_room_data" TypePasswdRoomDataDelete Type = "passwd_room_data_delete" TypePasswdRoomDataPolicy Type = "passwd_room_data_policy" TypePasswdDataV2 Type = "pwdd" TypePasswdDataV2Policy Type = "pwdd_policy" )
Click to show internal directories.
Click to hide internal directories.