Documentation ¶
Index ¶
- Constants
- func AddressToPubkey(base58Address string) []byte
- func BindEvmAddr(publicKey, evmPrivateKey string) ([]string, error)
- func BuildSigningMessage(params []interface{}) (string, error)
- func CurrentCallerDir() string
- func GetSignInfo(rawTx, evmAddress, substrateAddress, toAddr string) ([]string, error)
- func GetStubChainID(network string) *big.Int
- func GetTxHash(params []interface{}) (string, error)
- func InstallJSModules(path, url string)
- func PubkeyToReefAddress(publicKey string) string
- func Public2address(algorithmType, publicKey string) (string, error)
- func SendBindEvm(publicKey, evmPrivateKey, blockHash, blockNumber, nonce, signature string) (string, error)
- func SendSignedTx(params []interface{}) (string, error)
- func SignMessageWithPrivate(params []interface{}) ([]string, error)
- func SupportsChainID(chainID *big.Int) bool
- type Account
- type BaseData
- type Bridge
- func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error)
- func (b *Bridge) CallContract(contract string, data hexutil.Bytes, blockNumber string) (string, error)
- func (b *Bridge) GetBalance(account string) (balance *big.Int, err error)
- func (b *Bridge) GetGetBlockHash(blockNumber uint64) (blockHash string, err error)
- func (b *Bridge) GetLatestBlockNumberOf(url string) (latest uint64, err error)
- func (b *Bridge) GetPoolNonce(reefAddress, _height string) (nonce uint64, err error)
- func (b *Bridge) GetSignedTxHashOfKeyID(sender, keyID string, rawTx interface{}) (txHash string, err error)
- func (b *Bridge) GetTransactionByHash(txHash string) (tx *types.RPCTransaction, err error)
- func (b *Bridge) GetTransactionReceipt(txHash string) (result *types.RPCTxReceipt, err error)
- func (b *Bridge) InitAfterConfig()
- func (b *Bridge) InitWS()
- func (b *Bridge) IsValidAddress(address string) bool
- func (b *Bridge) MPCSignTransaction(rawTx interface{}, args *tokens.BuildTxArgs) (signTx interface{}, txHash string, err error)
- func (b *Bridge) PublicKeyToAddress(pubKey string) (string, error)
- func (b *Bridge) QueryEvmAddress(ss58address string) (addr *common.Address, err error)
- func (b *Bridge) QueryReefAddress(evmAddress string) (addr *string, err error)
- func (b *Bridge) SendTransaction(signedTx interface{}) (txHash string, err error)
- func (b *Bridge) SignTransactionWithPrivateKey(rawTx interface{}, priKey string) (signTx interface{}, txHash string, err error)
- func (b *Bridge) VerifyMPCPubKey(mpcAddress, mpcPubkey string) error
- func (b *Bridge) VerifyMsgHash(rawTx interface{}, msgHashes []string) (err error)
- func (b *Bridge) VerifyTransaction(txHash string, args *tokens.VerifyArgs) (*tokens.SwapTxInfo, error)
- type Command
- type EventLog
- type Extrinsic
- type Fee
- type Log
- type ReefGraphQLAccountData
- type ReefGraphQLBaseResponse
- type ReefGraphQLEventLogsData
- type ReefGraphQLPayLoad
- type ReefGraphQLRequest
- type ReefGraphQLResponse
- type ReefGraphQLResponsePayload
- type ReefGraphQLTxData
- type ReefTransaction
- type SignedData
- type Syncer
- type WebSocket
- func (r *WebSocket) Close()
- func (r *WebSocket) InitConn() error
- func (r *WebSocket) QueryAccountByReefAddr(ss58address string) (*Account, error)
- func (r *WebSocket) QueryEventLogs(extrinsicId uint64) (*[]EventLog, error)
- func (r *WebSocket) QueryEvmAddress(ss58address string) (*common.Address, error)
- func (r *WebSocket) QueryReefAddress(evmAddress string) (*string, error)
- func (r *WebSocket) QueryTx(hash string) (*Extrinsic, error)
- func (r *WebSocket) ReConn()
- func (r *WebSocket) Read(inbound chan<- []byte)
- func (r *WebSocket) Run()
- func (r *WebSocket) SendCommond(cmd *ReefGraphQLRequest) error
- func (r *WebSocket) Write(outbound <-chan interface{})
Constants ¶
const EventLog_GQL = "" /* 352-byte string literal not displayed */
const EvmAddress_GQL = "" /* 163-byte string literal not displayed */
const MPC_PUBLICKEY_TYPE = "SR25519"
const ReefAddress_GQL = "" /* 166-byte string literal not displayed */
const TxHash_GQL = "" /* 284-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func BindEvmAddr ¶
func BuildSigningMessage ¶
func CurrentCallerDir ¶
func CurrentCallerDir() string
func GetSignInfo ¶
func GetStubChainID ¶
GetStubChainID get stub chainID mainnet: 1001380271430 testnet: 1001380271431 devnet: 1001380271432
func InstallJSModules ¶
func InstallJSModules(path, url string)
func Public2address ¶
func SendBindEvm ¶
func SendSignedTx ¶
func SignMessageWithPrivate ¶
Types ¶
type Bridge ¶
type Bridge struct { eth.Bridge WS []*WebSocket SubstrateAPIs []*gsrpc.SubstrateAPI MetaData *types.Metadata }
Reef Bridge extends eth bridge
func (*Bridge) BuildRawTransaction ¶
func (b *Bridge) BuildRawTransaction(args *tokens.BuildTxArgs) (rawTx interface{}, err error)
BuildRawTransaction build raw tx
func (*Bridge) CallContract ¶
func (b *Bridge) CallContract(contract string, data hexutil.Bytes, blockNumber string) (string, error)
CallContract call eth_call
func (*Bridge) GetBalance ¶
GetBalance call eth_getBalance
func (*Bridge) GetGetBlockHash ¶
func (*Bridge) GetLatestBlockNumberOf ¶
func (*Bridge) GetPoolNonce ¶
func (*Bridge) GetSignedTxHashOfKeyID ¶
func (b *Bridge) GetSignedTxHashOfKeyID(sender, keyID string, rawTx interface{}) (txHash string, err error)
GetSignedTxHashOfKeyID get signed tx hash by keyID (called by oracle)
func (*Bridge) GetTransactionByHash ¶
func (b *Bridge) GetTransactionByHash(txHash string) (tx *types.RPCTransaction, err error)
func (*Bridge) GetTransactionReceipt ¶
func (b *Bridge) GetTransactionReceipt(txHash string) (result *types.RPCTxReceipt, err error)
func (*Bridge) InitAfterConfig ¶
func (b *Bridge) InitAfterConfig()
InitAfterConfig init variables (ie. extra members) after loading config
func (*Bridge) IsValidAddress ¶
IsValidAddress check address
func (*Bridge) MPCSignTransaction ¶
func (b *Bridge) MPCSignTransaction(rawTx interface{}, args *tokens.BuildTxArgs) (signTx interface{}, txHash string, err error)
MPCSignTransaction mpc sign raw tx
func (*Bridge) PublicKeyToAddress ¶
publicKey to evmAddress by reef default
func (*Bridge) QueryEvmAddress ¶
func (*Bridge) QueryReefAddress ¶
func (*Bridge) SendTransaction ¶
func (*Bridge) SignTransactionWithPrivateKey ¶
func (b *Bridge) SignTransactionWithPrivateKey(rawTx interface{}, priKey string) (signTx interface{}, txHash string, err error)
SignTransactionWithPrivateKey sign tx with private key (use for testing)
func (*Bridge) VerifyMPCPubKey ¶
implement EvmContractBridge VerifyMPCPubKey mpcAddress maybe is pair of mpcPubkey or just calc by reef algorithem
func (*Bridge) VerifyMsgHash ¶
VerifyMsgHash verify msg hash
func (*Bridge) VerifyTransaction ¶
func (b *Bridge) VerifyTransaction(txHash string, args *tokens.VerifyArgs) (*tokens.SwapTxInfo, error)
VerifyTransaction api
type Command ¶
type Command struct { ID string `json:"id,omitempty"` Name string `json:"-"` Error *string `json:"-"` Ready chan struct{} `json:"-"` Result interface{} `json:"-"` }
func (*Command) CommandName ¶
type Extrinsic ¶
type Extrinsic struct { Args []*hexutil.Bytes `json:"args,omitempty"` BlockID *uint64 `json:"block_id,omitempty"` ID *uint64 `json:"id,omitempty"` Signer string `json:"signer,omitempty"` ErrorMessage string `json:"error_message,omitempty"` Hash *string `json:"hash,omitempty"` Timestamp string `json:"timestamp,omitempty"` Status string `json:"status,omitempty"` Type string `json:"type,omitempty"` SignedData *SignedData `json:"signed_data,omitempty"` BaseData }
type ReefGraphQLAccountData ¶
type ReefGraphQLAccountData struct {
Accounts []Account `json:"account,omitempty"`
}
type ReefGraphQLBaseResponse ¶
type ReefGraphQLEventLogsData ¶
type ReefGraphQLEventLogsData struct {
Events []EventLog `json:"event,omitempty"`
}
type ReefGraphQLPayLoad ¶
type ReefGraphQLRequest ¶
type ReefGraphQLRequest struct { *Command // ID string `json:"id,omitempty"` Type string `json:"type"` Payload ReefGraphQLPayLoad `json:"payload"` }
type ReefGraphQLResponse ¶
type ReefGraphQLResponse struct { ReefGraphQLBaseResponse Payload ReefGraphQLResponsePayload `json:"payload,omitempty"` }
type ReefGraphQLResponsePayload ¶
type ReefGraphQLResponsePayload struct {
Data interface{} `json:"data,omitempty"`
}
type ReefGraphQLTxData ¶
type ReefGraphQLTxData struct {
Extrinsic []Extrinsic `json:"extrinsic,omitempty"`
}
type ReefTransaction ¶
type SignedData ¶
type SignedData struct {
Fee *Fee `json:"fee,omitempty"`
}
type WebSocket ¶
type WebSocket struct { IsClose bool // contains filtered or unexported fields }
func NewWebSocket ¶
func (*WebSocket) Close ¶
func (r *WebSocket) Close()
Close shuts down the Remote session and blocks until all internal goroutines have been cleaned up. Any commands that are pending a response will return with an error.
func (*WebSocket) QueryAccountByReefAddr ¶
func (*WebSocket) QueryEventLogs ¶
func (*WebSocket) QueryEvmAddress ¶
func (*WebSocket) QueryReefAddress ¶
func (*WebSocket) Read ¶
readPump reads from the websocket and sends to inbound channel. Expects to receive PONGs at specified interval, or logs an error and returns.
func (*WebSocket) Run ¶
func (r *WebSocket) Run()
run spawns the read/write pumps and then runs until Close() is called.
func (*WebSocket) SendCommond ¶
func (r *WebSocket) SendCommond(cmd *ReefGraphQLRequest) error