Documentation
¶
Index ¶
- Constants
- func DisplayBalance(b *WatcherBalanceFromAddress)
- func DisplayGetResponse(response *TransactionGetResponse)
- func DisplaySubmitResponse(response *TransactionSubmitResponse)
- func DisplayUTXOS(u *WatcherUTXOsFromAddress)
- func ProcessExits(numberExitsToProcess int64, p ProcessExit)
- func Sign(t TransactionSigner) ([][]byte, error)
- type Block
- type ByzantineEvents
- type ChallengeUTXOData
- type CreateTransaction
- type CreateTransactionResponse
- type Data
- type Domain
- type EIP712Domain
- type ErrorData
- type Fee
- type GetTxData
- type Input
- type Input0
- type Input1
- type Input2
- type Input3
- type Inputs
- type InvalidExitDetails
- type Message
- type Messages
- type Output
- type Output0
- type Output1
- type Output2
- type Output3
- type Outputs
- type Payments
- type PlasmaDeposit
- type PlasmaTransaction
- type ProcessExit
- type SingleSigner
- type StandardExit
- type StandardExitUTXOData
- type Transaction
- type TransactionGetResponse
- type TransactionSigner
- type TransactionSubmitFailureResponse
- type TransactionSubmitResponse
- type Transactions
- type TypedData
- type TypedTransaction
- type Types
- type WatcherBalanceFromAddress
- type WatcherStatus
- type WatcherUTXOsFromAddress
Constants ¶
const ( EthCurrency = "0x0000000000000000000000000000000000000000" DefaultMetadata = "0x0000000000000000000000000000000000000000000000000000000000000000" )
Variables ¶
This section is empty.
Functions ¶
func DisplayBalance ¶
func DisplayBalance(b *WatcherBalanceFromAddress)
log the balance data in a human friendly format
func DisplayGetResponse ¶
func DisplayGetResponse(response *TransactionGetResponse)
Display transaction.get response
func DisplaySubmitResponse ¶
func DisplaySubmitResponse(response *TransactionSubmitResponse)
Display transaction.submit response
func DisplayUTXOS ¶
func DisplayUTXOS(u *WatcherUTXOsFromAddress)
log the UTXO data in a human friendly format
func ProcessExits ¶
func ProcessExits(numberExitsToProcess int64, p ProcessExit)
Calls the processExits in the Plasma smart contract to start processing exits that have completed the challenge period.
func Sign ¶
func Sign(t TransactionSigner) ([][]byte, error)
Sign function takes a transaction signer interface and calls sign
Types ¶
type ByzantineEvents ¶
func DisplayByzantineEvents ¶
func DisplayByzantineEvents(b *WatcherStatus) ByzantineEvents
TODO: Display all events in the specs parse byzantine events data based on event names
type ChallengeUTXOData ¶
type ChallengeUTXOData struct { Version string `json:"version"` Success bool `json:"success"` Data struct { ExitId *big.Int `json:"exit_id"` InputIndex uint8 `json:"input_index"` Sig string `json:"sig"` Txbytes string `json:"txbytes"` } `json:"data"` }
func GetChallengeData ¶
func GetChallengeData(watcher string, utxoPosition int) (ChallengeUTXOData, error)
get challenge data from watcher
func (*ChallengeUTXOData) ChallengeInvalidExit ¶
func (c *ChallengeUTXOData) ChallengeInvalidExit(ethereumClient string, contract string, private string)
challenge invalid exit on the root chain
type CreateTransaction ¶
type CreateTransaction struct { Owner string `json:"owner"` Payments []Payments `json:"payments"` Fee Fee `json:"fee"` Metadata string `json:"metadata"` WatcherEndpoint string }
plasma transaction to call via the convenient transaction.create endpoint
func NewCreateTransaction ¶
func NewCreateTransaction() CreateTransaction
NewCreateTransaction returns a new CreateTransaction struct
func (*CreateTransaction) CreateTransaction ¶
func (c *CreateTransaction) CreateTransaction() (*CreateTransactionResponse, error)
CreateTransaction creates a transaction by calling `/transaction.create` endpoint
type Data ¶
type Data struct { Result string `json:"result"` Transactions []Transactions `json:"transactions"` Object string `json:"object"` Code string `json:"code"` Description string `json:"description"` }
type EIP712Domain ¶
type InvalidExitDetails ¶
type Message ¶
type Message struct { Input0 Input0 `json:"input0"` Input1 Input1 `json:"input1"` Input2 Input2 `json:"input2"` Input3 Input3 `json:"input3"` Output0 Output0 `json:"output0"` Output1 Output1 `json:"output1"` Output2 Output2 `json:"output2"` Output3 Output3 `json:"output3"` Metadata string `json:"metadata"` }
type PlasmaDeposit ¶
type PlasmaDeposit struct { PrivateKey string Client string Contract string Amount uint64 Owner string Currency string }
func (*PlasmaDeposit) DepositToPlasmaContract ¶
func (d *PlasmaDeposit) DepositToPlasmaContract()
Deposit ETH into the already deployed Plasma MoreVP contract on Ethereum
type PlasmaTransaction ¶
type PlasmaTransaction interface {
Submit() (*TransactionSubmitResponse, error)
}
type ProcessExit ¶
type SingleSigner ¶
func (SingleSigner) Sign ¶
func (s SingleSigner) Sign() ([][]byte, error)
Sign will sign a has with a single private key
type StandardExit ¶
func (*StandardExit) StartStandardExit ¶
func (s *StandardExit) StartStandardExit(watcher string)
Start a standard exit from user provided UTXO & private key
type StandardExitUTXOData ¶
type StandardExitUTXOData struct { Version string `json:"version"` Success bool `json:"success"` Data struct { UtxoPos *big.Int `json:"utxo_pos"` Txbytes string `json:"txbytes"` Proof string `json:"proof"` } `json:"data"` }
func GetUTXOExitData ¶
func GetUTXOExitData(watcher string, utxoPosition int) (StandardExitUTXOData, error)
Retrieve the UTXO exit data from the UTXO position
func (*StandardExitUTXOData) StartStandardExit ¶
func (s *StandardExitUTXOData) StartStandardExit(ethereumClient string, contract string, private string)
Start standard exit by calling the method in the smart contract
type Transaction ¶
type TransactionGetResponse ¶
type TransactionGetResponse struct { Version string `json:"version"` Success bool `json:"success"` Data GetTxData `json:"data"` }
func GetTransaction ¶
func GetTransaction(txHash string, watcher string) (*TransactionGetResponse, error)
Get transaction
type TransactionSigner ¶
type TransactionSubmitFailureResponse ¶
type TransactionSubmitFailureResponse struct { Version string `json:"version"` Success bool `json:"success"` Data struct { Object string `json:"object"` Code string `json:"code"` Description string `json:"description"` Messages struct { ErrorKey string `json:"error_key"` } `json:"messages"` } `json:"data"` }
type TransactionSubmitResponse ¶
type TransactionSubmitResponse struct { Version string `json:"version"` Success bool `json:"success"` Data struct { Blknum int `json:"blknum"` Txindex int `json:"txindex"` Txhash string `json:"txhash"` Object string `json:"object"` Code string `json:"code"` Description string `json:"description"` } `json:"data"` }
func Submit ¶
func Submit(p PlasmaTransaction) (*TransactionSubmitResponse, error)
Submit function takes a plasma transaction interface and calls Submit
type Transactions ¶
type Transactions struct { Inputs []Inputs `json:"inputs"` Outputs []Outputs `json:"outputs"` Fee Fee `json:"fee"` Metadata string `json:"metadata"` Txbytes string `json:"txbytes"` SignHash string `json:"sign_hash"` TypedData TypedData `json:"typed_data"` }
func (*Transactions) GetToSignHash ¶
func (t *Transactions) GetToSignHash() string
GetToSignHash returns a typed data hash to be signed
func (*Transactions) GetTypedData ¶
func (t *Transactions) GetTypedData() TypedData
GetTypedData returns the typed data
type TypedTransaction ¶
type TypedTransaction struct { Domain Domain `json:"domain"` Message Message `json:"message"` Signatures []string `json:"signatures"` WatcherEndpoint string }
func CreateTypedTransaction ¶
func CreateTypedTransaction(d Domain, m Message, sigs [][]byte, w string) (*TypedTransaction, error)
CreateTypedTransaction takse domain, message and signatures, returns a typed transaction
func (TypedTransaction) Submit ¶
func (t TypedTransaction) Submit() (*TransactionSubmitResponse, error)
Submit takes a typed transaction and it to "transaction.submit_typed/" endpoint
type Types ¶
type Types struct { EIP712Domain []EIP712Domain `json:"EIP712Domain"` Transaction []Transaction `json:"Transaction"` Input []Input `json:"Input"` Output []Output `json:"Output"` }
type WatcherBalanceFromAddress ¶
type WatcherBalanceFromAddress struct { Version string `json:"version"` Success bool `json:"success"` Data []struct { Currency string `json:"currency"` Amount float64 `json:"amount"` } `json:"data"` }
balance of an address returned from watcher
func GetBalance ¶
func GetBalance(address string, watcher string) (*WatcherBalanceFromAddress, error)
Get balance for a certain address
type WatcherStatus ¶
type WatcherStatus struct { Version string `json:"version"` Success bool `json:"success"` Data struct { LastValidatedChildBlockNumber int `json:"last_validated_child_block_number"` LastMinedChildBlockTimestamp int `json:"last_mined_child_block_timestamp"` LastMinedChildBlockNumber int `json:"last_mined_child_block_number"` EthSyncing bool `json:"eth_syncing"` ByzantineEvents []struct { Event string `json:"event"` Details map[string]interface{} `json:"details"` } `json:"byzantine_events"` } `json:"data"` }
only displaying invalid exit details for now
func GetWatcherStatus ¶
func GetWatcherStatus(w string) (*WatcherStatus, error)
Get the Watcher's status
type WatcherUTXOsFromAddress ¶
type WatcherUTXOsFromAddress struct { Version string `json:"version"` Success bool `json:"success"` Data []struct { UtxoPos *big.Int `json:"utxo_pos"` Txindex int `json:"txindex"` Owner string `json:"owner"` Oindex int `json:"oindex"` Currency string `json:"currency"` Blknum int `json:"blknum"` Amount float64 `json:"amount"` } `json:"data"` }
UTXOs of an address returned from watcher
func GetUTXOsFromAddress ¶
func GetUTXOsFromAddress(address string, w string) (*WatcherUTXOsFromAddress, error)
Retrieve the UTXOs associated with an address from the Watcher