Documentation
¶
Overview ¶
Package random describes the usage and scope of random numbers on IRISHub. This feature is currently in beta and please assess the risk yourself before using.
[More Details](https://www.junjie-bianjie.org/docs/features/random.html)
As a quick start:
baseTx := sdk.BaseTx{ From: "test1", Gas: 20000, Memo: "test", Mode: sdk.Commit, } var memory = make(map[string]string, 1) var signal = make(chan int, 0) request := rpc.RandomRequest{ BlockInterval: 2, Callback: func(reqID, randomNum string, err sdk.Error) { require.NoError(rts.T(), err) require.NoError(rts.T(), err) memory[reqID] = randomNum signal <- 1 }, Oracle: false, } reqID, err := rts.Random().Request(request, baseTx) require.NoError(rts.T(), err) memory[reqID] = "" <-signal require.NotEmpty(rts.T(), memory[reqID])
Index ¶
Constants ¶
View Source
const (
ModuleName = "random"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MsgRequestRand ¶
type MsgRequestRand struct { Consumer sdk.AccAddress `json:"consumer"` // request address BlockInterval uint64 `json:"block_interval"` // block interval after which the requested random number will be generated Oracle bool `json:"oracle"` // oracle method ServiceFeeCap sdk.Coins `json:"service_fee_cap"` // service fee cap }
MsgRequestRand represents a msg for requesting a random number
func (MsgRequestRand) GetSignBytes ¶
func (msg MsgRequestRand) GetSignBytes() []byte
Implements Msg.
func (MsgRequestRand) GetSigners ¶
func (msg MsgRequestRand) GetSigners() []sdk.AccAddress
Implements Msg.
func (MsgRequestRand) Route ¶
func (msg MsgRequestRand) Route() string
func (MsgRequestRand) ValidateBasic ¶
func (msg MsgRequestRand) ValidateBasic() error
Implements Msg.
Click to show internal directories.
Click to hide internal directories.