forked from cerc-io/laconicd
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1949eb514 | ||
|
|
debfb82205 | ||
|
|
3c5cd002e1 | ||
|
|
b5a76a920e | ||
|
|
f176a5889e | ||
|
|
5e7d5fc47c | ||
|
|
c162396298 |
@@ -25,6 +25,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
# Copy over binary from the builder
|
# Copy over binary from the builder
|
||||||
COPY --from=builder /go/src/git.vdb.to/cerc-io/laconicd/build/laconicd /usr/bin/laconicd
|
COPY --from=builder /go/src/git.vdb.to/cerc-io/laconicd/build/laconicd /usr/bin/laconicd
|
||||||
|
|
||||||
|
# Copy over init script from builder
|
||||||
|
COPY --from=builder /go/src/git.vdb.to/cerc-io/laconicd/scripts/init.sh scripts/init.sh
|
||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
# Run laconicd by default
|
# Run laconicd by default
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import (
|
|||||||
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
|
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
|
||||||
"github.com/cosmos/cosmos-sdk/x/genutil"
|
"github.com/cosmos/cosmos-sdk/x/genutil"
|
||||||
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||||
|
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
||||||
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
||||||
|
|
||||||
_ "cosmossdk.io/api/cosmos/tx/config/v1" // import for side-effects
|
_ "cosmossdk.io/api/cosmos/tx/config/v1" // import for side-effects
|
||||||
@@ -48,6 +49,7 @@ import (
|
|||||||
_ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects
|
_ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects
|
||||||
_ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects
|
_ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects
|
||||||
_ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects
|
_ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects
|
||||||
|
_ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects
|
||||||
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
|
_ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -76,6 +78,7 @@ type LaconicApp struct {
|
|||||||
AccountKeeper authkeeper.AccountKeeper
|
AccountKeeper authkeeper.AccountKeeper
|
||||||
BankKeeper bankkeeper.Keeper
|
BankKeeper bankkeeper.Keeper
|
||||||
StakingKeeper *stakingkeeper.Keeper
|
StakingKeeper *stakingkeeper.Keeper
|
||||||
|
SlashingKeeper slashingkeeper.Keeper
|
||||||
DistrKeeper distrkeeper.Keeper
|
DistrKeeper distrkeeper.Keeper
|
||||||
CrisisKeeper *crisiskeeper.Keeper
|
CrisisKeeper *crisiskeeper.Keeper
|
||||||
ConsensusParamsKeeper consensuskeeper.Keeper
|
ConsensusParamsKeeper consensuskeeper.Keeper
|
||||||
@@ -142,6 +145,7 @@ func NewLaconicApp(
|
|||||||
&app.AccountKeeper,
|
&app.AccountKeeper,
|
||||||
&app.BankKeeper,
|
&app.BankKeeper,
|
||||||
&app.StakingKeeper,
|
&app.StakingKeeper,
|
||||||
|
&app.SlashingKeeper,
|
||||||
&app.DistrKeeper,
|
&app.DistrKeeper,
|
||||||
&app.CrisisKeeper,
|
&app.CrisisKeeper,
|
||||||
&app.ConsensusParamsKeeper,
|
&app.ConsensusParamsKeeper,
|
||||||
|
|||||||
+5
-2
@@ -6,11 +6,11 @@ modules:
|
|||||||
# During begin block slashing happens after distr.BeginBlocker so that
|
# During begin block slashing happens after distr.BeginBlocker so that
|
||||||
# there is nothing left over in the validator fee pool, so as to keep the CanWithdrawInvariant invariant.
|
# there is nothing left over in the validator fee pool, so as to keep the CanWithdrawInvariant invariant.
|
||||||
# NOTE: staking module is required if HistoricalEntries param > 0
|
# NOTE: staking module is required if HistoricalEntries param > 0
|
||||||
begin_blockers: [distribution, staking]
|
begin_blockers: [distribution, slashing, staking]
|
||||||
end_blockers: [crisis, staking, auction, registry]
|
end_blockers: [crisis, staking, auction, registry]
|
||||||
# NOTE: The genutils module must occur after staking so that pools are properly initialized with tokens from genesis accounts.
|
# NOTE: The genutils module must occur after staking so that pools are properly initialized with tokens from genesis accounts.
|
||||||
# NOTE: The genutils module must also occur after auth so that it can access the params from auth.
|
# NOTE: The genutils module must also occur after auth so that it can access the params from auth.
|
||||||
init_genesis: [auth, bank, distribution, staking, crisis, genutil, auction, bond, registry, onboarding]
|
init_genesis: [auth, bank, distribution, staking, slashing, crisis, genutil, auction, bond, registry, onboarding]
|
||||||
override_store_keys:
|
override_store_keys:
|
||||||
- module_name: auth
|
- module_name: auth
|
||||||
kv_store_key: acc
|
kv_store_key: acc
|
||||||
@@ -39,6 +39,9 @@ modules:
|
|||||||
- name: staking
|
- name: staking
|
||||||
config:
|
config:
|
||||||
"@type": cosmos.staking.module.v1.Module
|
"@type": cosmos.staking.module.v1.Module
|
||||||
|
- name: slashing
|
||||||
|
config:
|
||||||
|
"@type": cosmos.slashing.module.v1.Module
|
||||||
- name: distribution
|
- name: distribution
|
||||||
config:
|
config:
|
||||||
"@type": cosmos.distribution.module.v1.Module
|
"@type": cosmos.distribution.module.v1.Module
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||||
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/staking"
|
"github.com/cosmos/cosmos-sdk/x/staking"
|
||||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||||
)
|
)
|
||||||
@@ -221,4 +222,16 @@ func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddr
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Handle slashing state. */
|
||||||
|
|
||||||
|
// reset start height on signing infos
|
||||||
|
app.SlashingKeeper.IterateValidatorSigningInfos(
|
||||||
|
ctx,
|
||||||
|
func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) {
|
||||||
|
info.StartHeight = 0
|
||||||
|
app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info)
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CoinUnit = "photon"
|
CoinUnit = "lnt"
|
||||||
|
BaseCoinUnit = "alnt"
|
||||||
|
LntExponent = 18
|
||||||
|
|
||||||
DefaultBondDenom = CoinUnit
|
DefaultBondDenom = BaseCoinUnit
|
||||||
|
|
||||||
// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address.
|
// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address.
|
||||||
Bech32PrefixAccAddr = "laconic"
|
Bech32PrefixAccAddr = "laconic"
|
||||||
@@ -41,6 +43,11 @@ func RegisterDenoms() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = sdk.RegisterDenom(BaseCoinUnit, math.LegacyNewDecWithPrec(1, LntExponent))
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetAddressPrefixes() {
|
func SetAddressPrefixes() {
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ func NewRootCmd() *cobra.Command {
|
|||||||
|
|
||||||
// overwrite the minimum gas price from the app configuration
|
// overwrite the minimum gas price from the app configuration
|
||||||
srvCfg := serverconfig.DefaultConfig()
|
srvCfg := serverconfig.DefaultConfig()
|
||||||
srvCfg.MinGasPrices = "0photon"
|
srvCfg.MinGasPrices = "0alnt"
|
||||||
|
|
||||||
// overwrite the block timeout
|
// overwrite the block timeout
|
||||||
cmtCfg := cmtcfg.DefaultConfig()
|
cmtCfg := cmtcfg.DefaultConfig()
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ require (
|
|||||||
github.com/agnivade/levenshtein v1.1.1 // indirect
|
github.com/agnivade/levenshtein v1.1.1 // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
|
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
|
||||||
|
github.com/bits-and-blooms/bitset v1.10.0 // indirect
|
||||||
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
|
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
|
||||||
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
|
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
|
||||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
|
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
|
||||||
|
|||||||
@@ -197,6 +197,11 @@ type AuthorityRecord {
|
|||||||
auction: Auction # Authority auction.
|
auction: Auction # Authority auction.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Authority {
|
||||||
|
name: String!
|
||||||
|
entry: AuthorityRecord!
|
||||||
|
}
|
||||||
|
|
||||||
# Name record entry, created at a particular height.
|
# Name record entry, created at a particular height.
|
||||||
type NameRecordEntry {
|
type NameRecordEntry {
|
||||||
id: String! # Target record ID.
|
id: String! # Target record ID.
|
||||||
@@ -222,7 +227,7 @@ type Query {
|
|||||||
getBondsByIds(ids: [String!]): [Bond]
|
getBondsByIds(ids: [String!]): [Bond]
|
||||||
|
|
||||||
# Query bonds.
|
# Query bonds.
|
||||||
queryBonds(attributes: [KeyValueInput!]): [Bond]
|
queryBonds: [Bond]
|
||||||
|
|
||||||
# Query bonds by owner.
|
# Query bonds by owner.
|
||||||
queryBondsByOwner(ownerAddresses: [String!]): [OwnerBonds]
|
queryBondsByOwner(ownerAddresses: [String!]): [OwnerBonds]
|
||||||
@@ -247,6 +252,9 @@ type Query {
|
|||||||
# Naming API.
|
# Naming API.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Get authorities list.
|
||||||
|
getAuthorities(owner: String): [Authority]
|
||||||
|
|
||||||
# Lookup authority information.
|
# Lookup authority information.
|
||||||
lookupAuthorities(names: [String!]): [AuthorityRecord]!
|
lookupAuthorities(names: [String!]): [AuthorityRecord]!
|
||||||
|
|
||||||
|
|||||||
+327
-35
@@ -87,6 +87,11 @@ type ComplexityRoot struct {
|
|||||||
Status func(childComplexity int) int
|
Status func(childComplexity int) int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Authority struct {
|
||||||
|
Entry func(childComplexity int) int
|
||||||
|
Name func(childComplexity int) int
|
||||||
|
}
|
||||||
|
|
||||||
AuthorityRecord struct {
|
AuthorityRecord struct {
|
||||||
Auction func(childComplexity int) int
|
Auction func(childComplexity int) int
|
||||||
BondID func(childComplexity int) int
|
BondID func(childComplexity int) int
|
||||||
@@ -169,6 +174,7 @@ type ComplexityRoot struct {
|
|||||||
Query struct {
|
Query struct {
|
||||||
GetAccounts func(childComplexity int, addresses []string) int
|
GetAccounts func(childComplexity int, addresses []string) int
|
||||||
GetAuctionsByIds func(childComplexity int, ids []string) int
|
GetAuctionsByIds func(childComplexity int, ids []string) int
|
||||||
|
GetAuthorities func(childComplexity int, owner *string) int
|
||||||
GetBondsByIds func(childComplexity int, ids []string) int
|
GetBondsByIds func(childComplexity int, ids []string) int
|
||||||
GetParticipantByAddress func(childComplexity int, address string) int
|
GetParticipantByAddress func(childComplexity int, address string) int
|
||||||
GetParticipantByNitroAddress func(childComplexity int, nitroAddress string) int
|
GetParticipantByNitroAddress func(childComplexity int, nitroAddress string) int
|
||||||
@@ -177,7 +183,7 @@ type ComplexityRoot struct {
|
|||||||
GetStatus func(childComplexity int) int
|
GetStatus func(childComplexity int) int
|
||||||
LookupAuthorities func(childComplexity int, names []string) int
|
LookupAuthorities func(childComplexity int, names []string) int
|
||||||
LookupNames func(childComplexity int, names []string) int
|
LookupNames func(childComplexity int, names []string) int
|
||||||
QueryBonds func(childComplexity int, attributes []*KeyValueInput) int
|
QueryBonds func(childComplexity int) int
|
||||||
QueryBondsByOwner func(childComplexity int, ownerAddresses []string) int
|
QueryBondsByOwner func(childComplexity int, ownerAddresses []string) int
|
||||||
QueryRecords func(childComplexity int, attributes []*KeyValueInput, all *bool) int
|
QueryRecords func(childComplexity int, attributes []*KeyValueInput, all *bool) int
|
||||||
ResolveNames func(childComplexity int, names []string) int
|
ResolveNames func(childComplexity int, names []string) int
|
||||||
@@ -227,10 +233,11 @@ type QueryResolver interface {
|
|||||||
GetStatus(ctx context.Context) (*Status, error)
|
GetStatus(ctx context.Context) (*Status, error)
|
||||||
GetAccounts(ctx context.Context, addresses []string) ([]*Account, error)
|
GetAccounts(ctx context.Context, addresses []string) ([]*Account, error)
|
||||||
GetBondsByIds(ctx context.Context, ids []string) ([]*Bond, error)
|
GetBondsByIds(ctx context.Context, ids []string) ([]*Bond, error)
|
||||||
QueryBonds(ctx context.Context, attributes []*KeyValueInput) ([]*Bond, error)
|
QueryBonds(ctx context.Context) ([]*Bond, error)
|
||||||
QueryBondsByOwner(ctx context.Context, ownerAddresses []string) ([]*OwnerBonds, error)
|
QueryBondsByOwner(ctx context.Context, ownerAddresses []string) ([]*OwnerBonds, error)
|
||||||
GetRecordsByIds(ctx context.Context, ids []string) ([]*Record, error)
|
GetRecordsByIds(ctx context.Context, ids []string) ([]*Record, error)
|
||||||
QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error)
|
QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error)
|
||||||
|
GetAuthorities(ctx context.Context, owner *string) ([]*Authority, error)
|
||||||
LookupAuthorities(ctx context.Context, names []string) ([]*AuthorityRecord, error)
|
LookupAuthorities(ctx context.Context, names []string) ([]*AuthorityRecord, error)
|
||||||
LookupNames(ctx context.Context, names []string) ([]*NameRecord, error)
|
LookupNames(ctx context.Context, names []string) ([]*NameRecord, error)
|
||||||
ResolveNames(ctx context.Context, names []string) ([]*Record, error)
|
ResolveNames(ctx context.Context, names []string) ([]*Record, error)
|
||||||
@@ -458,6 +465,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
|
|
||||||
return e.complexity.AuctionBid.Status(childComplexity), true
|
return e.complexity.AuctionBid.Status(childComplexity), true
|
||||||
|
|
||||||
|
case "Authority.entry":
|
||||||
|
if e.complexity.Authority.Entry == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Authority.Entry(childComplexity), true
|
||||||
|
|
||||||
|
case "Authority.name":
|
||||||
|
if e.complexity.Authority.Name == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Authority.Name(childComplexity), true
|
||||||
|
|
||||||
case "AuthorityRecord.auction":
|
case "AuthorityRecord.auction":
|
||||||
if e.complexity.AuthorityRecord.Auction == nil {
|
if e.complexity.AuthorityRecord.Auction == nil {
|
||||||
break
|
break
|
||||||
@@ -720,6 +741,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
|
|
||||||
return e.complexity.Query.GetAuctionsByIds(childComplexity, args["ids"].([]string)), true
|
return e.complexity.Query.GetAuctionsByIds(childComplexity, args["ids"].([]string)), true
|
||||||
|
|
||||||
|
case "Query.getAuthorities":
|
||||||
|
if e.complexity.Query.GetAuthorities == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
args, err := ec.field_Query_getAuthorities_args(context.TODO(), rawArgs)
|
||||||
|
if err != nil {
|
||||||
|
return 0, false
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Query.GetAuthorities(childComplexity, args["owner"].(*string)), true
|
||||||
|
|
||||||
case "Query.getBondsByIds":
|
case "Query.getBondsByIds":
|
||||||
if e.complexity.Query.GetBondsByIds == nil {
|
if e.complexity.Query.GetBondsByIds == nil {
|
||||||
break
|
break
|
||||||
@@ -811,12 +844,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
args, err := ec.field_Query_queryBonds_args(context.TODO(), rawArgs)
|
return e.complexity.Query.QueryBonds(childComplexity), true
|
||||||
if err != nil {
|
|
||||||
return 0, false
|
|
||||||
}
|
|
||||||
|
|
||||||
return e.complexity.Query.QueryBonds(childComplexity, args["attributes"].([]*KeyValueInput)), true
|
|
||||||
|
|
||||||
case "Query.queryBondsByOwner":
|
case "Query.queryBondsByOwner":
|
||||||
if e.complexity.Query.QueryBondsByOwner == nil {
|
if e.complexity.Query.QueryBondsByOwner == nil {
|
||||||
@@ -1141,6 +1169,21 @@ func (ec *executionContext) field_Query_getAuctionsByIds_args(ctx context.Contex
|
|||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) field_Query_getAuthorities_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||||
|
var err error
|
||||||
|
args := map[string]interface{}{}
|
||||||
|
var arg0 *string
|
||||||
|
if tmp, ok := rawArgs["owner"]; ok {
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("owner"))
|
||||||
|
arg0, err = ec.unmarshalOString2ᚖstring(ctx, tmp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args["owner"] = arg0
|
||||||
|
return args, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Query_getBondsByIds_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
func (ec *executionContext) field_Query_getBondsByIds_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]interface{}{}
|
args := map[string]interface{}{}
|
||||||
@@ -1246,21 +1289,6 @@ func (ec *executionContext) field_Query_queryBondsByOwner_args(ctx context.Conte
|
|||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Query_queryBonds_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
|
||||||
var err error
|
|
||||||
args := map[string]interface{}{}
|
|
||||||
var arg0 []*KeyValueInput
|
|
||||||
if tmp, ok := rawArgs["attributes"]; ok {
|
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("attributes"))
|
|
||||||
arg0, err = ec.unmarshalOKeyValueInput2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐKeyValueInputᚄ(ctx, tmp)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args["attributes"] = arg0
|
|
||||||
return args, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) field_Query_queryRecords_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
func (ec *executionContext) field_Query_queryRecords_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]interface{}{}
|
args := map[string]interface{}{}
|
||||||
@@ -2674,6 +2702,110 @@ func (ec *executionContext) fieldContext_AuctionBid_bidAmount(ctx context.Contex
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Authority_name(ctx context.Context, field graphql.CollectedField, obj *Authority) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_Authority_name(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.Name, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
if !graphql.HasFieldError(ctx, fc) {
|
||||||
|
ec.Errorf(ctx, "must not be null")
|
||||||
|
}
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalNString2string(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_Authority_name(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "Authority",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
return nil, errors.New("field of type String does not have child fields")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Authority_entry(ctx context.Context, field graphql.CollectedField, obj *Authority) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_Authority_entry(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.Entry, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
if !graphql.HasFieldError(ctx, fc) {
|
||||||
|
ec.Errorf(ctx, "must not be null")
|
||||||
|
}
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(*AuthorityRecord)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalNAuthorityRecord2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthorityRecord(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_Authority_entry(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "Authority",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
switch field.Name {
|
||||||
|
case "ownerAddress":
|
||||||
|
return ec.fieldContext_AuthorityRecord_ownerAddress(ctx, field)
|
||||||
|
case "ownerPublicKey":
|
||||||
|
return ec.fieldContext_AuthorityRecord_ownerPublicKey(ctx, field)
|
||||||
|
case "height":
|
||||||
|
return ec.fieldContext_AuthorityRecord_height(ctx, field)
|
||||||
|
case "status":
|
||||||
|
return ec.fieldContext_AuthorityRecord_status(ctx, field)
|
||||||
|
case "bondId":
|
||||||
|
return ec.fieldContext_AuthorityRecord_bondId(ctx, field)
|
||||||
|
case "expiryTime":
|
||||||
|
return ec.fieldContext_AuthorityRecord_expiryTime(ctx, field)
|
||||||
|
case "auction":
|
||||||
|
return ec.fieldContext_AuthorityRecord_auction(ctx, field)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("no field named %q was found under type AuthorityRecord", field.Name)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _AuthorityRecord_ownerAddress(ctx context.Context, field graphql.CollectedField, obj *AuthorityRecord) (ret graphql.Marshaler) {
|
func (ec *executionContext) _AuthorityRecord_ownerAddress(ctx context.Context, field graphql.CollectedField, obj *AuthorityRecord) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_AuthorityRecord_ownerAddress(ctx, field)
|
fc, err := ec.fieldContext_AuthorityRecord_ownerAddress(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -4426,7 +4558,7 @@ func (ec *executionContext) _Query_queryBonds(ctx context.Context, field graphql
|
|||||||
}()
|
}()
|
||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Query().QueryBonds(rctx, fc.Args["attributes"].([]*KeyValueInput))
|
return ec.resolvers.Query().QueryBonds(rctx)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ec.Error(ctx, err)
|
ec.Error(ctx, err)
|
||||||
@@ -4458,17 +4590,6 @@ func (ec *executionContext) fieldContext_Query_queryBonds(ctx context.Context, f
|
|||||||
return nil, fmt.Errorf("no field named %q was found under type Bond", field.Name)
|
return nil, fmt.Errorf("no field named %q was found under type Bond", field.Name)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
err = ec.Recover(ctx, r)
|
|
||||||
ec.Error(ctx, err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
ctx = graphql.WithFieldContext(ctx, fc)
|
|
||||||
if fc.Args, err = ec.field_Query_queryBonds_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
|
|
||||||
ec.Error(ctx, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4670,6 +4791,64 @@ func (ec *executionContext) fieldContext_Query_queryRecords(ctx context.Context,
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Query_getAuthorities(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_Query_getAuthorities(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = graphql.Null
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return ec.resolvers.Query().GetAuthorities(rctx, fc.Args["owner"].(*string))
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.([]*Authority)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalOAuthority2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_Query_getAuthorities(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "Query",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: true,
|
||||||
|
IsResolver: true,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
switch field.Name {
|
||||||
|
case "name":
|
||||||
|
return ec.fieldContext_Authority_name(ctx, field)
|
||||||
|
case "entry":
|
||||||
|
return ec.fieldContext_Authority_entry(ctx, field)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("no field named %q was found under type Authority", field.Name)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
err = ec.Recover(ctx, r)
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
if fc.Args, err = ec.field_Query_getAuthorities_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Query_lookupAuthorities(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Query_lookupAuthorities(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Query_lookupAuthorities(ctx, field)
|
fc, err := ec.fieldContext_Query_lookupAuthorities(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -8623,6 +8802,41 @@ func (ec *executionContext) _AuctionBid(ctx context.Context, sel ast.SelectionSe
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var authorityImplementors = []string{"Authority"}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Authority(ctx context.Context, sel ast.SelectionSet, obj *Authority) graphql.Marshaler {
|
||||||
|
fields := graphql.CollectFields(ec.OperationContext, sel, authorityImplementors)
|
||||||
|
out := graphql.NewFieldSet(fields)
|
||||||
|
var invalids uint32
|
||||||
|
for i, field := range fields {
|
||||||
|
switch field.Name {
|
||||||
|
case "__typename":
|
||||||
|
out.Values[i] = graphql.MarshalString("Authority")
|
||||||
|
case "name":
|
||||||
|
|
||||||
|
out.Values[i] = ec._Authority_name(ctx, field, obj)
|
||||||
|
|
||||||
|
if out.Values[i] == graphql.Null {
|
||||||
|
invalids++
|
||||||
|
}
|
||||||
|
case "entry":
|
||||||
|
|
||||||
|
out.Values[i] = ec._Authority_entry(ctx, field, obj)
|
||||||
|
|
||||||
|
if out.Values[i] == graphql.Null {
|
||||||
|
invalids++
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
panic("unknown field " + strconv.Quote(field.Name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.Dispatch()
|
||||||
|
if invalids > 0 {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
var authorityRecordImplementors = []string{"AuthorityRecord"}
|
var authorityRecordImplementors = []string{"AuthorityRecord"}
|
||||||
|
|
||||||
func (ec *executionContext) _AuthorityRecord(ctx context.Context, sel ast.SelectionSet, obj *AuthorityRecord) graphql.Marshaler {
|
func (ec *executionContext) _AuthorityRecord(ctx context.Context, sel ast.SelectionSet, obj *AuthorityRecord) graphql.Marshaler {
|
||||||
@@ -9323,6 +9537,26 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
|
|||||||
return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
|
return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.Concurrently(i, func() graphql.Marshaler {
|
||||||
|
return rrm(innerCtx)
|
||||||
|
})
|
||||||
|
case "getAuthorities":
|
||||||
|
field := field
|
||||||
|
|
||||||
|
innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
res = ec._Query_getAuthorities(ctx, field)
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
rrm := func(ctx context.Context) graphql.Marshaler {
|
||||||
|
return ec.OperationContext.RootResolverMiddleware(ctx, innerFunc)
|
||||||
|
}
|
||||||
|
|
||||||
out.Concurrently(i, func() graphql.Marshaler {
|
out.Concurrently(i, func() graphql.Marshaler {
|
||||||
return rrm(innerCtx)
|
return rrm(innerCtx)
|
||||||
})
|
})
|
||||||
@@ -10169,6 +10403,16 @@ func (ec *executionContext) marshalNAuthorityRecord2ᚕᚖgitᚗvdbᚗtoᚋcerc
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalNAuthorityRecord2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthorityRecord(ctx context.Context, sel ast.SelectionSet, v *AuthorityRecord) graphql.Marshaler {
|
||||||
|
if v == nil {
|
||||||
|
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||||
|
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
|
||||||
|
}
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
return ec._AuthorityRecord(ctx, sel, v)
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) marshalNBond2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐBond(ctx context.Context, sel ast.SelectionSet, v *Bond) graphql.Marshaler {
|
func (ec *executionContext) marshalNBond2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐBond(ctx context.Context, sel ast.SelectionSet, v *Bond) graphql.Marshaler {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||||
@@ -10956,6 +11200,54 @@ func (ec *executionContext) marshalOAuctionBid2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋl
|
|||||||
return ec._AuctionBid(ctx, sel, v)
|
return ec._AuctionBid(ctx, sel, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalOAuthority2ᚕᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx context.Context, sel ast.SelectionSet, v []*Authority) graphql.Marshaler {
|
||||||
|
if v == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ret := make(graphql.Array, len(v))
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
isLen1 := len(v) == 1
|
||||||
|
if !isLen1 {
|
||||||
|
wg.Add(len(v))
|
||||||
|
}
|
||||||
|
for i := range v {
|
||||||
|
i := i
|
||||||
|
fc := &graphql.FieldContext{
|
||||||
|
Index: &i,
|
||||||
|
Result: &v[i],
|
||||||
|
}
|
||||||
|
ctx := graphql.WithFieldContext(ctx, fc)
|
||||||
|
f := func(i int) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
ec.Error(ctx, ec.Recover(ctx, r))
|
||||||
|
ret = nil
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
if !isLen1 {
|
||||||
|
defer wg.Done()
|
||||||
|
}
|
||||||
|
ret[i] = ec.marshalOAuthority2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx, sel, v[i])
|
||||||
|
}
|
||||||
|
if isLen1 {
|
||||||
|
f(i)
|
||||||
|
} else {
|
||||||
|
go f(i)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalOAuthority2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthority(ctx context.Context, sel ast.SelectionSet, v *Authority) graphql.Marshaler {
|
||||||
|
if v == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
return ec._Authority(ctx, sel, v)
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) marshalOAuthorityRecord2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthorityRecord(ctx context.Context, sel ast.SelectionSet, v *AuthorityRecord) graphql.Marshaler {
|
func (ec *executionContext) marshalOAuthorityRecord2ᚖgitᚗvdbᚗtoᚋcercᚑioᚋlaconicdᚋgqlᚐAuthorityRecord(ctx context.Context, sel ast.SelectionSet, v *AuthorityRecord) graphql.Marshaler {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return graphql.Null
|
return graphql.Null
|
||||||
|
|||||||
@@ -52,6 +52,11 @@ type AuctionBid struct {
|
|||||||
BidAmount *Coin `json:"bidAmount"`
|
BidAmount *Coin `json:"bidAmount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Authority struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Entry *AuthorityRecord `json:"entry"`
|
||||||
|
}
|
||||||
|
|
||||||
type AuthorityRecord struct {
|
type AuthorityRecord struct {
|
||||||
OwnerAddress string `json:"ownerAddress"`
|
OwnerAddress string `json:"ownerAddress"`
|
||||||
OwnerPublicKey string `json:"ownerPublicKey"`
|
OwnerPublicKey string `json:"ownerPublicKey"`
|
||||||
|
|||||||
+32
-20
@@ -35,6 +35,36 @@ func (r *Resolver) Query() QueryResolver {
|
|||||||
|
|
||||||
type queryResolver struct{ *Resolver }
|
type queryResolver struct{ *Resolver }
|
||||||
|
|
||||||
|
func (q queryResolver) GetAuthorities(ctx context.Context, owner *string) ([]*Authority, error) {
|
||||||
|
nsQueryClient := registrytypes.NewQueryClient(q.ctx)
|
||||||
|
auctionQueryClient := auctiontypes.NewQueryClient(q.ctx)
|
||||||
|
|
||||||
|
authoritiesReq := ®istrytypes.QueryAuthoritiesRequest{}
|
||||||
|
if owner != nil {
|
||||||
|
authoritiesReq.Owner = *owner
|
||||||
|
}
|
||||||
|
|
||||||
|
authoritiesResp, err := nsQueryClient.Authorities(ctx, authoritiesReq)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
authorities := make([]*Authority, len(authoritiesResp.GetAuthorities()))
|
||||||
|
for i, a := range authoritiesResp.Authorities {
|
||||||
|
entry, err := getAuthorityRecord(*a.Entry, auctionQueryClient)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
authorities[i] = &Authority{
|
||||||
|
Name: a.Name,
|
||||||
|
Entry: entry,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return authorities, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (q queryResolver) LookupAuthorities(ctx context.Context, names []string) ([]*AuthorityRecord, error) {
|
func (q queryResolver) LookupAuthorities(ctx context.Context, names []string) ([]*AuthorityRecord, error) {
|
||||||
nsQueryClient := registrytypes.NewQueryClient(q.ctx)
|
nsQueryClient := registrytypes.NewQueryClient(q.ctx)
|
||||||
auctionQueryClient := auctiontypes.NewQueryClient(q.ctx)
|
auctionQueryClient := auctiontypes.NewQueryClient(q.ctx)
|
||||||
@@ -52,29 +82,11 @@ func (q queryResolver) LookupAuthorities(ctx context.Context, names []string) ([
|
|||||||
}
|
}
|
||||||
|
|
||||||
nameAuthority := res.GetNameAuthority()
|
nameAuthority := res.GetNameAuthority()
|
||||||
gqlNameAuthorityRecord, err := GetGQLNameAuthorityRecord(&nameAuthority)
|
gqlNameAuthorityRecord, err := getAuthorityRecord(nameAuthority, auctionQueryClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if nameAuthority.AuctionId != "" {
|
|
||||||
auctionResp, err := auctionQueryClient.GetAuction(context.Background(), &auctiontypes.QueryGetAuctionRequest{Id: nameAuthority.GetAuctionId()})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
bidsResp, err := auctionQueryClient.GetBids(context.Background(), &auctiontypes.QueryGetBidsRequest{AuctionId: nameAuthority.GetAuctionId()})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
gqlAuctionRecord, err := GetGQLAuction(auctionResp.GetAuction(), bidsResp.GetBids())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
gqlNameAuthorityRecord.Auction = gqlAuctionRecord
|
|
||||||
}
|
|
||||||
|
|
||||||
gqlResponse = append(gqlResponse, gqlNameAuthorityRecord)
|
gqlResponse = append(gqlResponse, gqlNameAuthorityRecord)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,7 +296,7 @@ func (q *queryResolver) GetBond(ctx context.Context, id string) (*Bond, error) {
|
|||||||
return getGQLBond(bondResp.GetBond())
|
return getGQLBond(bondResp.GetBond())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q queryResolver) QueryBonds(ctx context.Context, attributes []*KeyValueInput) ([]*Bond, error) {
|
func (q queryResolver) QueryBonds(ctx context.Context) ([]*Bond, error) {
|
||||||
bondQueryClient := bondtypes.NewQueryClient(q.ctx)
|
bondQueryClient := bondtypes.NewQueryClient(q.ctx)
|
||||||
bonds, err := bondQueryClient.Bonds(context.Background(), &bondtypes.QueryBondsRequest{})
|
bonds, err := bondQueryClient.Bonds(context.Background(), &bondtypes.QueryBondsRequest{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
+27
@@ -303,3 +303,30 @@ func toRPCAttributes(attrs []*KeyValueInput) []*registrytypes.QueryRecordsReques
|
|||||||
|
|
||||||
return kvPairs
|
return kvPairs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getAuthorityRecord(nameAuthority registrytypes.NameAuthority, auctionQueryClient auctiontypes.QueryClient) (*AuthorityRecord, error) {
|
||||||
|
gqlNameAuthorityRecord, err := GetGQLNameAuthorityRecord(&nameAuthority)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if nameAuthority.AuctionId != "" {
|
||||||
|
auctionResp, err := auctionQueryClient.GetAuction(context.Background(), &auctiontypes.QueryGetAuctionRequest{Id: nameAuthority.GetAuctionId()})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
bidsResp, err := auctionQueryClient.GetBids(context.Background(), &auctiontypes.QueryGetBidsRequest{AuctionId: nameAuthority.GetAuctionId()})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
gqlAuctionRecord, err := GetGQLAuction(auctionResp.GetAuction(), bidsResp.GetBids())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
gqlNameAuthorityRecord.Auction = gqlAuctionRecord
|
||||||
|
}
|
||||||
|
|
||||||
|
return gqlNameAuthorityRecord, nil
|
||||||
|
}
|
||||||
|
|||||||
+40
-9
@@ -1,10 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
KEY="alice"
|
KEY="alice"
|
||||||
CHAINID="laconic_9000-1"
|
CHAINID=${CHAINID:-"laconic_9000-1"}
|
||||||
MONIKER="localtestnet"
|
MONIKER=${MONIKER:-"localtestnet"}
|
||||||
KEYRING="test"
|
KEYRING=${KEYRING:-"test"}
|
||||||
LOGLEVEL="${LOGLEVEL:-info}"
|
DENOM=${DENOM:-"alnt"}
|
||||||
|
STAKING_AMOUNT=${STAKING_AMOUNT:-"1000000000000000"}
|
||||||
|
LOGLEVEL=${LOGLEVEL:-"info"}
|
||||||
|
|
||||||
|
input_genesis_file=${GENESIS_FILE}
|
||||||
|
|
||||||
if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
|
if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
|
||||||
# validate dependencies are installed
|
# validate dependencies are installed
|
||||||
@@ -27,7 +31,12 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
|
|||||||
laconicd keys add $KEY --keyring-backend $KEYRING
|
laconicd keys add $KEY --keyring-backend $KEYRING
|
||||||
|
|
||||||
# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
|
# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
|
||||||
laconicd init $MONIKER --chain-id $CHAINID --default-denom photon
|
laconicd init $MONIKER --chain-id $CHAINID --default-denom $DENOM
|
||||||
|
|
||||||
|
if [[ -f ${input_genesis_file} ]]; then
|
||||||
|
# Use provided genesis config
|
||||||
|
cp $input_genesis_file $HOME/.laconicd/config/genesis.json
|
||||||
|
fi
|
||||||
|
|
||||||
update_genesis() {
|
update_genesis() {
|
||||||
jq "$1" $HOME/.laconicd/config/genesis.json > $HOME/.laconicd/config/tmp_genesis.json &&
|
jq "$1" $HOME/.laconicd/config/genesis.json > $HOME/.laconicd/config/tmp_genesis.json &&
|
||||||
@@ -58,6 +67,26 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
|
|||||||
update_genesis '.app_state["onboarding"]["params"]["onboarding_enabled"]=true'
|
update_genesis '.app_state["onboarding"]["params"]["onboarding_enabled"]=true'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$AUTHORITY_AUCTION_ENABLED" == "true" ]]; then
|
||||||
|
echo "Enabling authority auctions."
|
||||||
|
update_genesis '.app_state["registry"]["params"]["authority_auction_enabled"]=true'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $AUTHORITY_AUCTION_COMMITS_DURATION ]]; then
|
||||||
|
echo "Setting authority_auction_commits_duration to $AUTHORITY_AUCTION_COMMITS_DURATION seconds."
|
||||||
|
update_genesis ".app_state[\"registry\"][\"params\"][\"authority_auction_commits_duration\"]=\"${AUTHORITY_AUCTION_COMMITS_DURATION}s\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $AUTHORITY_AUCTION_REVEALS_DURATION ]]; then
|
||||||
|
echo "Setting authority_auction_reveals_duration to $AUTHORITY_AUCTION_REVEALS_DURATION seconds."
|
||||||
|
update_genesis ".app_state[\"registry\"][\"params\"][\"authority_auction_reveals_duration\"]=\"${AUTHORITY_AUCTION_REVEALS_DURATION}s\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $AUTHORITY_GRACE_PERIOD ]]; then
|
||||||
|
echo "Setting authority_grace_period to $AUTHORITY_GRACE_PERIOD seconds."
|
||||||
|
update_genesis ".app_state[\"registry\"][\"params\"][\"authority_grace_period\"]=\"${AUTHORITY_GRACE_PERIOD}s\""
|
||||||
|
fi
|
||||||
|
|
||||||
# increase block time (?)
|
# increase block time (?)
|
||||||
update_genesis '.consensus["params"]["block"]["time_iota_ms"]="1000"'
|
update_genesis '.consensus["params"]["block"]["time_iota_ms"]="1000"'
|
||||||
|
|
||||||
@@ -70,7 +99,7 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
|
|||||||
else
|
else
|
||||||
sed -i 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.laconicd/config/config.toml
|
sed -i 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.laconicd/config/config.toml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run this to allow requests from any origin
|
# Run this to allow requests from any origin
|
||||||
sed -i 's/cors_allowed_origins.*$/cors_allowed_origins = ["*"]/' $HOME/.laconicd/config/config.toml
|
sed -i 's/cors_allowed_origins.*$/cors_allowed_origins = ["*"]/' $HOME/.laconicd/config/config.toml
|
||||||
|
|
||||||
@@ -86,10 +115,12 @@ if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Allocate genesis accounts (cosmos formatted addresses)
|
# Allocate genesis accounts (cosmos formatted addresses)
|
||||||
laconicd genesis add-genesis-account $KEY 100000000000000000000000000photon --keyring-backend $KEYRING
|
# 10^30 alnt | 10^12 lnt
|
||||||
|
laconicd genesis add-genesis-account $KEY 1000000000000000000000000000000$DENOM --keyring-backend $KEYRING
|
||||||
|
|
||||||
# Sign genesis transaction
|
# Sign genesis transaction
|
||||||
laconicd genesis gentx $KEY 1000000000000000000000photon --keyring-backend $KEYRING --chain-id $CHAINID
|
# 10^15 alnt
|
||||||
|
laconicd genesis gentx $KEY $STAKING_AMOUNT$DENOM --keyring-backend $KEYRING --chain-id $CHAINID
|
||||||
|
|
||||||
# Collect genesis tx
|
# Collect genesis tx
|
||||||
laconicd genesis collect-gentxs
|
laconicd genesis collect-gentxs
|
||||||
@@ -104,7 +135,7 @@ fi
|
|||||||
laconicd start \
|
laconicd start \
|
||||||
--pruning=nothing \
|
--pruning=nothing \
|
||||||
--log_level $LOGLEVEL \
|
--log_level $LOGLEVEL \
|
||||||
--minimum-gas-prices=0.0001photon \
|
--minimum-gas-prices=1$DENOM \
|
||||||
--api.enable \
|
--api.enable \
|
||||||
--rpc.laddr="tcp://0.0.0.0:26657" \
|
--rpc.laddr="tcp://0.0.0.0:26657" \
|
||||||
--gql-server --gql-playground
|
--gql-server --gql-playground
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ func (kts *KeeperTestSuite) createAuctionAndCommitBid(commitBid bool) (*types.Au
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create funded account(s)
|
// Create funded account(s)
|
||||||
accounts := simtestutil.AddTestAddrs(kts.BankKeeper, integrationTest.BondDenomProvider{}, ctx, accCount, math.NewInt(100))
|
accounts := simtestutil.AddTestAddrs(kts.BankKeeper, integrationTest.BondDenomProvider{}, ctx, accCount, math.NewInt(1000000))
|
||||||
|
|
||||||
params, err := k.GetParams(ctx)
|
params, err := k.GetParams(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ func (kts *KeeperTestSuite) createBond() (*bondTypes.Bond, error) {
|
|||||||
ctx := kts.SdkCtx
|
ctx := kts.SdkCtx
|
||||||
|
|
||||||
// Create a funded account
|
// Create a funded account
|
||||||
kts.accounts = simtestutil.AddTestAddrs(kts.BankKeeper, integrationTest.BondDenomProvider{}, ctx, 1, math.NewInt(100000000000))
|
kts.accounts = simtestutil.AddTestAddrs(kts.BankKeeper, integrationTest.BondDenomProvider{}, ctx, 1, math.NewInt(1000000000000))
|
||||||
|
|
||||||
bond, err := kts.BondKeeper.CreateBond(ctx, kts.accounts[0], sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(1000000000))))
|
bond, err := kts.BondKeeper.CreateBond(ctx, kts.accounts[0], sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(1000000000))))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
+7
-6
@@ -13,9 +13,10 @@ import (
|
|||||||
var (
|
var (
|
||||||
DefaultCommitsDuration = 5 * time.Minute
|
DefaultCommitsDuration = 5 * time.Minute
|
||||||
DefaultRevealsDuration = 5 * time.Minute
|
DefaultRevealsDuration = 5 * time.Minute
|
||||||
DefaultCommitFee = sdk.Coin{Amount: sdkmath.NewInt(10), Denom: sdk.DefaultBondDenom}
|
|
||||||
DefaultRevealFee = sdk.Coin{Amount: sdkmath.NewInt(10), Denom: sdk.DefaultBondDenom}
|
DefaultCommitFee = sdkmath.NewInt(1000) // 10^3 alnt
|
||||||
DefaultMinimumBid = sdk.Coin{Amount: sdkmath.NewInt(1000), Denom: sdk.DefaultBondDenom}
|
DefaultRevealFee = sdkmath.NewInt(1000) // 10^3 alnt
|
||||||
|
DefaultMinimumBid = sdkmath.NewInt(1000000) // 10^6 alnt
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewParams(commitsDuration time.Duration, revealsDuration time.Duration, commitFee sdk.Coin, revealFee sdk.Coin, minimumBid sdk.Coin) Params {
|
func NewParams(commitsDuration time.Duration, revealsDuration time.Duration, commitFee sdk.Coin, revealFee sdk.Coin, minimumBid sdk.Coin) Params {
|
||||||
@@ -33,9 +34,9 @@ func DefaultParams() Params {
|
|||||||
return Params{
|
return Params{
|
||||||
CommitsDuration: DefaultCommitsDuration,
|
CommitsDuration: DefaultCommitsDuration,
|
||||||
RevealsDuration: DefaultRevealsDuration,
|
RevealsDuration: DefaultRevealsDuration,
|
||||||
CommitFee: DefaultCommitFee,
|
CommitFee: sdk.NewCoin(sdk.DefaultBondDenom, DefaultCommitFee),
|
||||||
RevealFee: DefaultRevealFee,
|
RevealFee: sdk.NewCoin(sdk.DefaultBondDenom, DefaultRevealFee),
|
||||||
MinimumBid: DefaultMinimumBid,
|
MinimumBid: sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinimumBid),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// DefaultMaxBondAmountTokens are the default parameter values.
|
// DefaultMaxBondAmountTokens are the default parameter values.
|
||||||
var DefaultMaxBondAmountTokens = sdkmath.NewInt(100000000000)
|
var DefaultMaxBondAmountTokens = sdkmath.NewInt(1000000000000) // 10^12 alnt
|
||||||
|
|
||||||
func NewParams(maxBondAmount sdk.Coin) Params {
|
func NewParams(maxBondAmount sdk.Coin) Params {
|
||||||
return Params{MaxBondAmount: maxBondAmount}
|
return Params{MaxBondAmount: maxBondAmount}
|
||||||
|
|||||||
@@ -11,21 +11,21 @@ import (
|
|||||||
// Default parameter values.
|
// Default parameter values.
|
||||||
var (
|
var (
|
||||||
// DefaultRecordRent is the default record rent for 1 time period (see expiry time).
|
// DefaultRecordRent is the default record rent for 1 time period (see expiry time).
|
||||||
DefaultRecordRent = sdkmath.NewInt(1000000)
|
DefaultRecordRent = sdkmath.NewInt(1000000) // 10^6 alnt
|
||||||
|
|
||||||
// DefaultRecordExpiryTime is the default record expiry time (1 year).
|
// DefaultRecordExpiryTime is the default record expiry time (1 year).
|
||||||
DefaultRecordExpiryTime = time.Hour * 24 * 365
|
DefaultRecordExpiryTime = time.Hour * 24 * 365
|
||||||
|
|
||||||
DefaultAuthorityRent = sdkmath.NewInt(1000000)
|
DefaultAuthorityRent = sdkmath.NewInt(1000000) // 10^6 alnt
|
||||||
DefaultAuthorityExpiryTime = time.Hour * 24 * 365
|
DefaultAuthorityExpiryTime = time.Hour * 24 * 365
|
||||||
DefaultAuthorityGracePeriod = time.Hour * 24 * 2
|
DefaultAuthorityGracePeriod = time.Hour * 24 * 2
|
||||||
|
|
||||||
DefaultAuthorityAuctionEnabled = false
|
DefaultAuthorityAuctionEnabled = false
|
||||||
DefaultCommitsDuration = time.Hour * 24
|
DefaultCommitsDuration = time.Hour * 24
|
||||||
DefaultRevealsDuration = time.Hour * 24
|
DefaultRevealsDuration = time.Hour * 24
|
||||||
DefaultCommitFee = sdkmath.NewInt(1000000)
|
DefaultCommitFee = sdkmath.NewInt(1000000) // 10^6 alnt
|
||||||
DefaultRevealFee = sdkmath.NewInt(1000000)
|
DefaultRevealFee = sdkmath.NewInt(1000000) // 10^6 alnt
|
||||||
DefaultMinimumBid = sdkmath.NewInt(5000000)
|
DefaultMinimumBid = sdkmath.NewInt(5000000) // 5 * 10^6 alnt
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewParams creates a new Params instance
|
// NewParams creates a new Params instance
|
||||||
|
|||||||
Reference in New Issue
Block a user