-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
610f65a
commit ef78189
Showing
46 changed files
with
44,342 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package random | ||
|
||
import ( | ||
"github.com/irisnet/core-sdk-go/common/codec" | ||
"github.com/irisnet/core-sdk-go/common/codec/types" | ||
cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" | ||
sdk "github.com/irisnet/core-sdk-go/types" | ||
) | ||
|
||
var ( | ||
amino = codec.NewLegacyAmino() | ||
ModuleCdc = codec.NewAminoCodec(amino) | ||
) | ||
|
||
func init() { | ||
cryptocodec.RegisterCrypto(amino) | ||
amino.Seal() | ||
} | ||
|
||
func RegisterInterfaces(registry types.InterfaceRegistry) { | ||
registry.RegisterImplementations((*sdk.Msg)(nil), | ||
&MsgRequestRandom{}, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package random | ||
|
||
import sdk "github.com/irisnet/core-sdk-go/types" | ||
|
||
// expose Random module api for user | ||
type Client interface { | ||
sdk.Module | ||
|
||
RequestRandom(request RequestRandomRequest, basTx sdk.BaseTx) (RequestRandomResp, sdk.ResultTx, sdk.Error) | ||
|
||
QueryRandom(ReqId string) (QueryRandomResp, sdk.Error) | ||
QueryRandomRequestQueue(height int64) ([]QueryRandomRequestQueueResp, sdk.Error) | ||
} | ||
|
||
type RequestRandomRequest struct { | ||
BlockInterval uint64 `json:"block_interval"` | ||
Oracle bool `json:"oracle"` | ||
ServiceFeeCap sdk.Coins `json:"service_fee_cap"` | ||
} | ||
|
||
type RequestRandomResp struct { | ||
Height int64 `json:"height"` | ||
ReqID string `json:"req_id"` | ||
} | ||
|
||
type QueryRandomResp struct { | ||
RequestTxHash string `json:"request_tx_hash" yaml:"request_tx_hash"` | ||
Height int64 `json:"height" yaml:"height"` | ||
Value string `json:"value" yaml:"value"` | ||
} | ||
|
||
type QueryRandomRequestQueueResp struct { | ||
Height int64 `json:"height" yaml:"height"` | ||
Consumer string `json:"consumer" yaml:"consumer"` | ||
TxHash string `json:"tx_hash" yaml:"tx_hash"` | ||
Oracle bool `json:"oracle" yaml:"oracle"` | ||
ServiceFeeCap sdk.Coins `json:"service_fee_cap" yaml:"service_fee_cap"` | ||
ServiceContextId string `json:"service_context_id" yaml:"service_context_id"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module random | ||
|
||
go 1.16 | ||
|
||
require ( | ||
github.com/irisnet/core-sdk-go v0.1.0 | ||
github.com/gogo/protobuf v1.3.3 | ||
) | ||
|
||
replace ( | ||
github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk | ||
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 | ||
) |
Oops, something went wrong.