fix: gofmt -s across repo (CI format check)

This commit is contained in:
2026-06-02 11:38:29 -07:00
parent 21683d2393
commit f04061d5fa
31 changed files with 488 additions and 248 deletions
+39 -25
View File
@@ -127,43 +127,57 @@ func TestSchema_Privacy(t *testing.T) {
func TestSchema_Quantum(t *testing.T) {
eng := setupChainEngine(t, "qchain")
resp := eng.Execute(nil, &engine.Request{Query: `{ coronaSignatures(first: 10) { id } }`})
if len(resp.Errors) > 0 { t.Fatal(resp.Errors[0].Message) }
if len(resp.Errors) > 0 {
t.Fatal(resp.Errors[0].Message)
}
}
func TestSchema_Key(t *testing.T) {
eng := setupChainEngine(t, "kchain")
resp := eng.Execute(nil, &engine.Request{Query: `{ managedKeys(first: 10) { id } }`})
if len(resp.Errors) > 0 { t.Fatal(resp.Errors[0].Message) }
if len(resp.Errors) > 0 {
t.Fatal(resp.Errors[0].Message)
}
}
func TestSchema_AI(t *testing.T) {
eng := setupChainEngine(t, "achain")
resp := eng.Execute(nil, &engine.Request{Query: `{ inferenceProofs(first: 10) { id } }`})
if len(resp.Errors) > 0 { t.Fatal(resp.Errors[0].Message) }
if len(resp.Errors) > 0 {
t.Fatal(resp.Errors[0].Message)
}
}
func TestSchema_Identity(t *testing.T) {
eng := setupChainEngine(t, "ichain")
resp := eng.Execute(nil, &engine.Request{Query: `{ dids(first: 10) { id } }`})
if len(resp.Errors) > 0 { t.Fatal(resp.Errors[0].Message) }
if len(resp.Errors) > 0 {
t.Fatal(resp.Errors[0].Message)
}
}
func TestSchema_Oracle(t *testing.T) {
eng := setupChainEngine(t, "ochain")
resp := eng.Execute(nil, &engine.Request{Query: `{ priceFeeds(first: 10) { id } }`})
if len(resp.Errors) > 0 { t.Fatal(resp.Errors[0].Message) }
if len(resp.Errors) > 0 {
t.Fatal(resp.Errors[0].Message)
}
}
func TestSchema_Relay(t *testing.T) {
eng := setupChainEngine(t, "rchain")
resp := eng.Execute(nil, &engine.Request{Query: `{ warpMessages(first: 10) { id } }`})
if len(resp.Errors) > 0 { t.Fatal(resp.Errors[0].Message) }
if len(resp.Errors) > 0 {
t.Fatal(resp.Errors[0].Message)
}
}
func TestSchema_ServiceNode(t *testing.T) {
eng := setupChainEngine(t, "schain")
resp := eng.Execute(nil, &engine.Request{Query: `{ serviceNodes(first: 10) { id } }`})
if len(resp.Errors) > 0 { t.Fatal(resp.Errors[0].Message) }
if len(resp.Errors) > 0 {
t.Fatal(resp.Errors[0].Message)
}
}
func TestSchema_Precompile(t *testing.T) {
@@ -190,25 +204,25 @@ func TestSchema_All(t *testing.T) {
// Every chain type must resolve without errors
queries := []string{
`{ factories(first: 1) { id } }`, // AMM (C-Chain)
`{ orders(first: 1) { id } }`, // DEX (D-Chain)
`{ dkgCeremonies(first: 1) { id } }`, // FHE (T-Chain)
`{ validators(first: 1) { id } }`, // Platform (P-Chain)
`{ assets(first: 1) { id } }`, // Exchange (X-Chain)
`{ bridgeTransfers(first: 1) { id } }`, // Bridge (B-Chain)
`{ shieldedTransfers(first: 1) { id } }`, // Privacy (Z-Chain)
`{ factories(first: 1) { id } }`, // AMM (C-Chain)
`{ orders(first: 1) { id } }`, // DEX (D-Chain)
`{ dkgCeremonies(first: 1) { id } }`, // FHE (T-Chain)
`{ validators(first: 1) { id } }`, // Platform (P-Chain)
`{ assets(first: 1) { id } }`, // Exchange (X-Chain)
`{ bridgeTransfers(first: 1) { id } }`, // Bridge (B-Chain)
`{ shieldedTransfers(first: 1) { id } }`, // Privacy (Z-Chain)
`{ coronaSignatures(first: 1) { id } }`, // Quantum (Q-Chain)
`{ managedKeys(first: 1) { id } }`, // Key (K-Chain)
`{ inferenceProofs(first: 1) { id } }`, // AI (A-Chain)
`{ dids(first: 1) { id } }`, // Identity (I-Chain)
`{ priceFeeds(first: 1) { id } }`, // Oracle (O-Chain)
`{ warpMessages(first: 1) { id } }`, // Relay (R-Chain)
`{ serviceNodes(first: 1) { id } }`, // ServiceNode (S-Chain)
`{ precompileCalls(first: 1) { id } }`, // Precompiles
`{ fheOperations(first: 1) { id } }`, // FHE precompile
`{ zkVerifications(first: 1) { id } }`, // ZK precompile
`{ tokens(first: 1) { id } }`, // ERC20
`{ nfts(first: 1) { id } }`, // ERC721
`{ managedKeys(first: 1) { id } }`, // Key (K-Chain)
`{ inferenceProofs(first: 1) { id } }`, // AI (A-Chain)
`{ dids(first: 1) { id } }`, // Identity (I-Chain)
`{ priceFeeds(first: 1) { id } }`, // Oracle (O-Chain)
`{ warpMessages(first: 1) { id } }`, // Relay (R-Chain)
`{ serviceNodes(first: 1) { id } }`, // ServiceNode (S-Chain)
`{ precompileCalls(first: 1) { id } }`, // Precompiles
`{ fheOperations(first: 1) { id } }`, // FHE precompile
`{ zkVerifications(first: 1) { id } }`, // ZK precompile
`{ tokens(first: 1) { id } }`, // ERC20
`{ nfts(first: 1) { id } }`, // ERC721
}
for _, q := range queries {
+6 -6
View File
@@ -22,18 +22,18 @@ func (e *Engine) registerAMMResolvers() {
e.resolvers["bundles"] = e.resolveBundles
e.resolvers["pool"] = e.resolvePool
e.resolvers["pools"] = e.resolvePools
e.resolvers["pair"] = e.resolvePair // v2
e.resolvers["pairs"] = e.resolvePairs // v2
e.resolvers["pair"] = e.resolvePair // v2
e.resolvers["pairs"] = e.resolvePairs // v2
e.resolvers["swap"] = e.resolveSwap
e.resolvers["swaps"] = e.resolveSwaps
e.resolvers["mint"] = e.resolveMint
e.resolvers["mints"] = e.resolveMints
e.resolvers["burn"] = e.resolveBurn
e.resolvers["burns"] = e.resolveBurns
e.resolvers["tick"] = e.resolveTick // v3
e.resolvers["ticks"] = e.resolveTicks // v3
e.resolvers["position"] = e.resolvePosition // v3
e.resolvers["positions"] = e.resolvePositions // v3
e.resolvers["tick"] = e.resolveTick // v3
e.resolvers["ticks"] = e.resolveTicks // v3
e.resolvers["position"] = e.resolvePosition // v3
e.resolvers["positions"] = e.resolvePositions // v3
// Collect / Flash (V3)
e.resolvers["collect"] = e.resolveCollect
+1 -1
View File
@@ -25,8 +25,8 @@ import (
"github.com/luxfi/graph/resolvers/identity"
"github.com/luxfi/graph/resolvers/key"
"github.com/luxfi/graph/resolvers/liquid"
"github.com/luxfi/graph/resolvers/liquidprotocol"
"github.com/luxfi/graph/resolvers/liquidity"
"github.com/luxfi/graph/resolvers/liquidprotocol"
"github.com/luxfi/graph/resolvers/mpc"
"github.com/luxfi/graph/resolvers/oracle"
"github.com/luxfi/graph/resolvers/platform"
+12 -12
View File
@@ -8,13 +8,13 @@ package engine
type Factory struct {
ID string `json:"id"`
PoolCount int64 `json:"poolCount"`
PairCount int64 `json:"pairCount"` // v2
PairCount int64 `json:"pairCount"` // v2
TxCount int64 `json:"txCount"`
TotalVolumeUSD string `json:"totalVolumeUSD"`
TotalVolumeETH string `json:"totalVolumeETH"`
TotalFeesUSD string `json:"totalFeesUSD"`
TotalValueLockedUSD string `json:"totalValueLockedUSD"`
TotalLiquidityUSD string `json:"totalLiquidityUSD"` // v2 compat
TotalLiquidityUSD string `json:"totalLiquidityUSD"` // v2 compat
TotalValueLockedETH string `json:"totalValueLockedETH"`
}
@@ -22,7 +22,7 @@ type Factory struct {
type Bundle struct {
ID string `json:"id"`
EthPriceUSD string `json:"ethPriceUSD"`
EthPrice string `json:"ethPrice"` // v2 compat
EthPrice string `json:"ethPrice"` // v2 compat
LuxPriceUSD string `json:"luxPriceUSD"`
}
@@ -41,10 +41,10 @@ type Token struct {
PoolCount int64 `json:"poolCount"`
TotalValueLocked string `json:"totalValueLocked"`
TotalValueLockedUSD string `json:"totalValueLockedUSD"`
TotalLiquidity string `json:"totalLiquidity"` // v2
TotalLiquidity string `json:"totalLiquidity"` // v2
DerivedETH string `json:"derivedETH"`
TradeVolume string `json:"tradeVolume"` // v2
TradeVolumeUSD string `json:"tradeVolumeUSD"` // v2
TradeVolume string `json:"tradeVolume"` // v2
TradeVolumeUSD string `json:"tradeVolumeUSD"` // v2
}
// Pool — V3 concentrated liquidity pool
@@ -98,7 +98,7 @@ type Swap struct {
Transaction string `json:"transaction"`
Timestamp int64 `json:"timestamp"`
Pool string `json:"pool"`
Pair string `json:"pair"` // v2
Pair string `json:"pair"` // v2
Token0 string `json:"token0"`
Token1 string `json:"token1"`
Sender string `json:"sender"`
@@ -190,12 +190,12 @@ type PoolDayData struct {
}
type PairDayData struct {
ID string `json:"id"`
Date int64 `json:"date"`
Pair *Pair `json:"pair"`
VolumeUSD string `json:"dailyVolumeUSD"`
ID string `json:"id"`
Date int64 `json:"date"`
Pair *Pair `json:"pair"`
VolumeUSD string `json:"dailyVolumeUSD"`
ReserveUSD string `json:"reserveUSD"`
TxCount int64 `json:"dailyTxns"`
TxCount int64 `json:"dailyTxns"`
}
type FactoryDayData struct {
+28 -28
View File
@@ -5,19 +5,19 @@ package engine
// PoolManager — V4 singleton (replaces per-factory pattern)
type PoolManager struct {
ID string `json:"id"`
PoolCount int64 `json:"poolCount"`
TxCount int64 `json:"txCount"`
TotalVolumeUSD string `json:"totalVolumeUSD"`
TotalVolumeETH string `json:"totalVolumeETH"`
TotalFeesUSD string `json:"totalFeesUSD"`
TotalFeesETH string `json:"totalFeesETH"`
UntrackedVolumeUSD string `json:"untrackedVolumeUSD"`
TotalValueLockedUSD string `json:"totalValueLockedUSD"`
TotalValueLockedETH string `json:"totalValueLockedETH"`
TotalValueLockedUSDUntracked string `json:"totalValueLockedUSDUntracked"`
TotalValueLockedETHUntracked string `json:"totalValueLockedETHUntracked"`
Owner string `json:"owner"`
ID string `json:"id"`
PoolCount int64 `json:"poolCount"`
TxCount int64 `json:"txCount"`
TotalVolumeUSD string `json:"totalVolumeUSD"`
TotalVolumeETH string `json:"totalVolumeETH"`
TotalFeesUSD string `json:"totalFeesUSD"`
TotalFeesETH string `json:"totalFeesETH"`
UntrackedVolumeUSD string `json:"untrackedVolumeUSD"`
TotalValueLockedUSD string `json:"totalValueLockedUSD"`
TotalValueLockedETH string `json:"totalValueLockedETH"`
TotalValueLockedUSDUntracked string `json:"totalValueLockedUSDUntracked"`
TotalValueLockedETHUntracked string `json:"totalValueLockedETHUntracked"`
Owner string `json:"owner"`
}
// ModifyLiquidity — V4 unified liquidity event (replaces separate Mint/Burn)
@@ -30,7 +30,7 @@ type ModifyLiquidity struct {
Token1 string `json:"token1"`
Sender string `json:"sender"`
Origin string `json:"origin"`
Amount string `json:"amount"` // liquidityDelta (positive=mint, negative=burn)
Amount string `json:"amount"` // liquidityDelta (positive=mint, negative=burn)
Amount0 string `json:"amount0"`
Amount1 string `json:"amount1"`
AmountUSD string `json:"amountUSD"`
@@ -71,24 +71,24 @@ type Unsubscribe struct {
// PoolV4 extends Pool with V4-specific fields
type PoolV4 struct {
Pool
TickSpacing int64 `json:"tickSpacing"`
Hooks string `json:"hooks"`
IsExternalLiquidity bool `json:"isExternalLiquidity"`
CollectedFeesToken0 string `json:"collectedFeesToken0"`
CollectedFeesToken1 string `json:"collectedFeesToken1"`
CollectedFeesUSD string `json:"collectedFeesUSD"`
LiquidityProviderCount int64 `json:"liquidityProviderCount"`
TickSpacing int64 `json:"tickSpacing"`
Hooks string `json:"hooks"`
IsExternalLiquidity bool `json:"isExternalLiquidity"`
CollectedFeesToken0 string `json:"collectedFeesToken0"`
CollectedFeesToken1 string `json:"collectedFeesToken1"`
CollectedFeesUSD string `json:"collectedFeesUSD"`
LiquidityProviderCount int64 `json:"liquidityProviderCount"`
}
// UniswapDayData — V4 daily aggregate (same name as V3 for compat)
type UniswapDayData struct {
ID string `json:"id"`
Date int64 `json:"date"`
VolumeETH string `json:"volumeETH"`
VolumeUSD string `json:"volumeUSD"`
FeesUSD string `json:"feesUSD"`
TxCount int64 `json:"txCount"`
TvlUSD string `json:"tvlUSD"`
ID string `json:"id"`
Date int64 `json:"date"`
VolumeETH string `json:"volumeETH"`
VolumeUSD string `json:"volumeUSD"`
FeesUSD string `json:"feesUSD"`
TxCount int64 `json:"txCount"`
TvlUSD string `json:"tvlUSD"`
}
// PoolHourData — hourly pool snapshot
+10 -10
View File
@@ -30,17 +30,17 @@ func LiquidTopics() []string {
// LiquidEvent represents a LiquidLUX vault event.
type LiquidEvent struct {
From string
Amount *big.Int
FeeType string // bytes32 hex (fees_received only)
PerfFee *big.Int
ToReserve *big.Int
From string
Amount *big.Int
FeeType string // bytes32 hex (fees_received only)
PerfFee *big.Int
ToReserve *big.Int
FromReserve *big.Int
Socialized *big.Int
Event string // "fees_received", "validator_rewards", "slashing", "emergency_withdrawal"
Contract string
Block uint64
TxHash string
Socialized *big.Int
Event string // "fees_received", "validator_rewards", "slashing", "emergency_withdrawal"
Contract string
Block uint64
TxHash string
}
// ParseLiquidEvents extracts LiquidLUX vault events from EVM logs.
+6 -6
View File
@@ -176,12 +176,12 @@ const (
// Known factory addresses per network.
type NetworkConfig struct {
Name string `json:"name" yaml:"name"`
ChainID int64 `json:"chainId" yaml:"chain_id"`
FactoryV2 string `json:"factoryV2" yaml:"factory_v2"`
FactoryV3 string `json:"factoryV3" yaml:"factory_v3"`
WETH string `json:"weth" yaml:"weth"` // wrapped native token
StableTokens []string `json:"stableTokens" yaml:"stable_tokens"`
Name string `json:"name" yaml:"name"`
ChainID int64 `json:"chainId" yaml:"chain_id"`
FactoryV2 string `json:"factoryV2" yaml:"factory_v2"`
FactoryV3 string `json:"factoryV3" yaml:"factory_v3"`
WETH string `json:"weth" yaml:"weth"` // wrapped native token
StableTokens []string `json:"stableTokens" yaml:"stable_tokens"`
}
// Lux network configs — same addresses as exchange subgraphs.
+5 -5
View File
@@ -84,11 +84,11 @@ func (idx *Indexer) handleAddressFrozen(l *logEntry, blockNum uint64, txHash, lo
// Live snapshot
snapID := fmt.Sprintf("%s:%s", l.Address, user)
idx.store.SetEntity("FrozenAccount", snapID, map[string]interface{}{
"id": snapID,
"token": l.Address,
"user": user,
"frozen": isFrozen,
"updated": blockNum,
"id": snapID,
"token": l.Address,
"user": user,
"frozen": isFrozen,
"updated": blockNum,
})
}
+18 -6
View File
@@ -29,35 +29,45 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveInferenceProof(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("InferenceProof", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("InferenceProof", fmt.Sprint(id))
}
return nil, fmt.Errorf("inferenceProof requires id")
}
func resolveInferenceProofs(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("InferenceProof", pl(args))
}
func resolveModelHash(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("ModelHash", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("ModelHash", fmt.Sprint(id))
}
return nil, fmt.Errorf("modelHash requires id")
}
func resolveModelHashes(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("ModelHash", pl(args))
}
func resolveComputeAttestation(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("ComputeAttestation", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("ComputeAttestation", fmt.Sprint(id))
}
return nil, fmt.Errorf("computeAttestation requires id")
}
func resolveComputeAttestations(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("ComputeAttestation", pl(args))
}
func resolveAIJob(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("AIJob", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("AIJob", fmt.Sprint(id))
}
return nil, fmt.Errorf("aiJob requires id")
}
func resolveAIJobs(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("AIJob", pl(args))
}
func resolveTrainingRun(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("TrainingRun", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("TrainingRun", fmt.Sprint(id))
}
return nil, fmt.Errorf("trainingRun requires id")
}
func resolveTrainingRuns(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -69,6 +79,8 @@ func resolveAIStats(_ context.Context, s *storage.Store, _ map[string]interface{
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+15 -5
View File
@@ -27,28 +27,36 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveBridgeTransfer(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("BridgeTransfer", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("BridgeTransfer", fmt.Sprint(id))
}
return nil, fmt.Errorf("bridgeTransfer requires id")
}
func resolveBridgeTransfers(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("BridgeTransfer", pl(args))
}
func resolveMPCSignature(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("MPCSignature", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("MPCSignature", fmt.Sprint(id))
}
return nil, fmt.Errorf("mpcSignature requires id")
}
func resolveMPCSignatures(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("MPCSignature", pl(args))
}
func resolveWrappedAsset(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("WrappedAsset", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("WrappedAsset", fmt.Sprint(id))
}
return nil, fmt.Errorf("wrappedAsset requires id")
}
func resolveWrappedAssets(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("WrappedAsset", pl(args))
}
func resolveBridgeRequest(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("BridgeRequest", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("BridgeRequest", fmt.Sprint(id))
}
return nil, fmt.Errorf("bridgeRequest requires id")
}
func resolveBridgeRequests(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -60,6 +68,8 @@ func resolveBridgeStats(_ context.Context, s *storage.Store, _ map[string]interf
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+12 -4
View File
@@ -25,21 +25,27 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveDAOProposal(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("DAOProposal", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("DAOProposal", fmt.Sprint(id))
}
return nil, fmt.Errorf("daoProposal requires id")
}
func resolveDAOProposals(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("DAOProposal", pl(args))
}
func resolveDAOMember(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("DAOMember", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("DAOMember", fmt.Sprint(id))
}
return nil, fmt.Errorf("daoMember requires id")
}
func resolveDAOMembers(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("DAOMember", pl(args))
}
func resolveDAOTreasury(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("DAOTreasury", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("DAOTreasury", fmt.Sprint(id))
}
return nil, fmt.Errorf("daoTreasury requires id")
}
func resolveDAOTreasuries(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -51,6 +57,8 @@ func resolveDAOStats(_ context.Context, s *storage.Store, _ map[string]interface
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+12 -4
View File
@@ -25,21 +25,27 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveDerivativeContract(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("DerivativeContract", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("DerivativeContract", fmt.Sprint(id))
}
return nil, fmt.Errorf("derivativeContract requires id")
}
func resolveDerivativeContracts(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("DerivativeContract", pl(args))
}
func resolveDerivativeSettlement(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("DerivativeSettlement", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("DerivativeSettlement", fmt.Sprint(id))
}
return nil, fmt.Errorf("derivativeSettlement requires id")
}
func resolveDerivativeSettlements(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("DerivativeSettlement", pl(args))
}
func resolveDerivativeExercise(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("DerivativeExercise", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("DerivativeExercise", fmt.Sprint(id))
}
return nil, fmt.Errorf("derivativeExercise requires id")
}
func resolveDerivativeExercises(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -51,6 +57,8 @@ func resolveDerivativeStats(_ context.Context, s *storage.Store, _ map[string]in
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+24 -8
View File
@@ -34,49 +34,63 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveOrder(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Order", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Order", fmt.Sprint(id))
}
return nil, fmt.Errorf("order requires id")
}
func resolveOrders(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Order", parseLimit(args))
}
func resolveFill(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Fill", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Fill", fmt.Sprint(id))
}
return nil, fmt.Errorf("fill requires id")
}
func resolveFills(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Fill", parseLimit(args))
}
func resolveMarket(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Market", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Market", fmt.Sprint(id))
}
return nil, fmt.Errorf("market requires id")
}
func resolveMarkets(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Market", parseLimit(args))
}
func resolvePerpPosition(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("PerpPosition", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("PerpPosition", fmt.Sprint(id))
}
return nil, fmt.Errorf("perpPosition requires id")
}
func resolvePerpPositions(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("PerpPosition", parseLimit(args))
}
func resolveFundingRate(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("FundingRate", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("FundingRate", fmt.Sprint(id))
}
return nil, fmt.Errorf("fundingRate requires id")
}
func resolveFundingRates(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("FundingRate", parseLimit(args))
}
func resolveLiquidation(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Liquidation", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Liquidation", fmt.Sprint(id))
}
return nil, fmt.Errorf("liquidation requires id")
}
func resolveLiquidations(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Liquidation", parseLimit(args))
}
func resolveOrderbook(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Orderbook", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Orderbook", fmt.Sprint(id))
}
return nil, fmt.Errorf("orderbook requires market id")
}
func resolveMarketDayDatas(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -85,6 +99,8 @@ func resolveMarketDayDatas(_ context.Context, s *storage.Store, args map[string]
func parseLimit(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return limit
}
+12 -4
View File
@@ -25,21 +25,27 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveDIDDocument(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("DIDDocument", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("DIDDocument", fmt.Sprint(id))
}
return nil, fmt.Errorf("didDocument requires id")
}
func resolveDIDDocuments(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("DIDDocument", pl(args))
}
func resolveDIDDelegate(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("DIDDelegate", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("DIDDelegate", fmt.Sprint(id))
}
return nil, fmt.Errorf("didDelegate requires id")
}
func resolveDIDDelegates(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("DIDDelegate", pl(args))
}
func resolveDIDAttribute(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("DIDAttribute", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("DIDAttribute", fmt.Sprint(id))
}
return nil, fmt.Errorf("didAttribute requires id")
}
func resolveDIDAttributes(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -51,6 +57,8 @@ func resolveDIDStats(_ context.Context, s *storage.Store, _ map[string]interface
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+21 -7
View File
@@ -30,42 +30,54 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveAsset(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Asset", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Asset", fmt.Sprint(id))
}
return nil, fmt.Errorf("asset requires id")
}
func resolveAssets(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Asset", pl(args))
}
func resolveUTXO(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("UTXO", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("UTXO", fmt.Sprint(id))
}
return nil, fmt.Errorf("utxo requires id")
}
func resolveUTXOs(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("UTXO", pl(args))
}
func resolveXTransfer(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("XTransfer", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("XTransfer", fmt.Sprint(id))
}
return nil, fmt.Errorf("xTransfer requires id")
}
func resolveXTransfers(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("XTransfer", pl(args))
}
func resolveAssetCreation(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("AssetCreation", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("AssetCreation", fmt.Sprint(id))
}
return nil, fmt.Errorf("assetCreation requires id")
}
func resolveAssetCreations(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("AssetCreation", pl(args))
}
func resolveImportTx(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("ImportTx", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("ImportTx", fmt.Sprint(id))
}
return nil, fmt.Errorf("importTx requires id")
}
func resolveImportTxs(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("ImportTx", pl(args))
}
func resolveExportTx(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("ExportTx", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("ExportTx", fmt.Sprint(id))
}
return nil, fmt.Errorf("exportTx requires id")
}
func resolveExportTxs(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -74,6 +86,8 @@ func resolveExportTxs(_ context.Context, s *storage.Store, args map[string]inter
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+12 -4
View File
@@ -25,21 +25,27 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveProposal(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Proposal", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Proposal", fmt.Sprint(id))
}
return nil, fmt.Errorf("proposal requires id")
}
func resolveProposals(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Proposal", pl(args))
}
func resolveVote(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Vote", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Vote", fmt.Sprint(id))
}
return nil, fmt.Errorf("vote requires id")
}
func resolveVotes(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Vote", pl(args))
}
func resolveDelegation(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Delegation", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Delegation", fmt.Sprint(id))
}
return nil, fmt.Errorf("delegation requires id")
}
func resolveDelegations(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -51,6 +57,8 @@ func resolveGovernanceStats(_ context.Context, s *storage.Store, _ map[string]in
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+18 -6
View File
@@ -29,35 +29,45 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveDID(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("DID", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("DID", fmt.Sprint(id))
}
return nil, fmt.Errorf("did requires id")
}
func resolveDIDs(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("DID", pl(args))
}
func resolveVerifiableCredential(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("VerifiableCredential", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("VerifiableCredential", fmt.Sprint(id))
}
return nil, fmt.Errorf("verifiableCredential requires id")
}
func resolveVerifiableCredentials(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("VerifiableCredential", pl(args))
}
func resolveAttestation(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Attestation", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Attestation", fmt.Sprint(id))
}
return nil, fmt.Errorf("attestation requires id")
}
func resolveAttestations(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Attestation", pl(args))
}
func resolveIdentityRegistry(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("IdentityRegistry", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("IdentityRegistry", fmt.Sprint(id))
}
return nil, fmt.Errorf("identityRegistry requires id")
}
func resolveIdentityRegistries(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("IdentityRegistry", pl(args))
}
func resolveCredentialSchema(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("CredentialSchema", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("CredentialSchema", fmt.Sprint(id))
}
return nil, fmt.Errorf("credentialSchema requires id")
}
func resolveCredentialSchemas(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -69,6 +79,8 @@ func resolveIdentityStats(_ context.Context, s *storage.Store, _ map[string]inte
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+18 -6
View File
@@ -29,35 +29,45 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveManagedKey(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("ManagedKey", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("ManagedKey", fmt.Sprint(id))
}
return nil, fmt.Errorf("managedKey requires id")
}
func resolveManagedKeys(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("ManagedKey", pl(args))
}
func resolveKeyRotation(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("KeyRotation", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("KeyRotation", fmt.Sprint(id))
}
return nil, fmt.Errorf("keyRotation requires id")
}
func resolveKeyRotations(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("KeyRotation", pl(args))
}
func resolveKeyShare(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("KeyShare", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("KeyShare", fmt.Sprint(id))
}
return nil, fmt.Errorf("keyShare requires id")
}
func resolveKeyShares(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("KeyShare", pl(args))
}
func resolveKeyCeremony(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("KeyCeremony", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("KeyCeremony", fmt.Sprint(id))
}
return nil, fmt.Errorf("keyCeremony requires id")
}
func resolveKeyCeremonies(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("KeyCeremony", pl(args))
}
func resolveKeyAttestation(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("KeyAttestation", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("KeyAttestation", fmt.Sprint(id))
}
return nil, fmt.Errorf("keyAttestation requires id")
}
func resolveKeyAttestations(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -69,6 +79,8 @@ func resolveKeyStats(_ context.Context, s *storage.Store, _ map[string]interface
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+15 -5
View File
@@ -27,28 +27,36 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveLiquidStake(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("LiquidStake", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("LiquidStake", fmt.Sprint(id))
}
return nil, fmt.Errorf("liquidStake requires id")
}
func resolveLiquidStakes(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("LiquidStake", pl(args))
}
func resolveLiquidUnstake(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("LiquidUnstake", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("LiquidUnstake", fmt.Sprint(id))
}
return nil, fmt.Errorf("liquidUnstake requires id")
}
func resolveLiquidUnstakes(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("LiquidUnstake", pl(args))
}
func resolveLiquidReward(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("LiquidReward", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("LiquidReward", fmt.Sprint(id))
}
return nil, fmt.Errorf("liquidReward requires id")
}
func resolveLiquidRewards(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("LiquidReward", pl(args))
}
func resolveLiquidValidator(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("LiquidValidator", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("LiquidValidator", fmt.Sprint(id))
}
return nil, fmt.Errorf("liquidValidator requires id")
}
func resolveLiquidValidators(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -60,6 +68,8 @@ func resolveLiquidStats(_ context.Context, s *storage.Store, _ map[string]interf
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+18 -6
View File
@@ -29,35 +29,45 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolvePriceFeed(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("PriceFeed", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("PriceFeed", fmt.Sprint(id))
}
return nil, fmt.Errorf("priceFeed requires id")
}
func resolvePriceFeeds(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("PriceFeed", pl(args))
}
func resolveDataRequest(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("DataRequest", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("DataRequest", fmt.Sprint(id))
}
return nil, fmt.Errorf("dataRequest requires id")
}
func resolveDataRequests(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("DataRequest", pl(args))
}
func resolveOracleReport(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("OracleReport", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("OracleReport", fmt.Sprint(id))
}
return nil, fmt.Errorf("oracleReport requires id")
}
func resolveOracleReports(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("OracleReport", pl(args))
}
func resolveOracleNode(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("OracleNode", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("OracleNode", fmt.Sprint(id))
}
return nil, fmt.Errorf("oracleNode requires id")
}
func resolveOracleNodes(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("OracleNode", pl(args))
}
func resolveDataAttestation(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("DataAttestation", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("DataAttestation", fmt.Sprint(id))
}
return nil, fmt.Errorf("dataAttestation requires id")
}
func resolveDataAttestations(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -69,6 +79,8 @@ func resolveOracleStats(_ context.Context, s *storage.Store, _ map[string]interf
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+18 -6
View File
@@ -29,35 +29,45 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveValidator(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Validator", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Validator", fmt.Sprint(id))
}
return nil, fmt.Errorf("validator requires id (NodeID)")
}
func resolveValidators(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Validator", parseLimit(args))
}
func resolveDelegator(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Delegator", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Delegator", fmt.Sprint(id))
}
return nil, fmt.Errorf("delegator requires id")
}
func resolveDelegators(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Delegator", parseLimit(args))
}
func resolveSubnet(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Subnet", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Subnet", fmt.Sprint(id))
}
return nil, fmt.Errorf("subnet requires id")
}
func resolveSubnets(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Subnet", parseLimit(args))
}
func resolveBlockchain(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Blockchain", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Blockchain", fmt.Sprint(id))
}
return nil, fmt.Errorf("blockchain requires id")
}
func resolveBlockchains(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Blockchain", parseLimit(args))
}
func resolveStakingReward(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("StakingReward", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("StakingReward", fmt.Sprint(id))
}
return nil, fmt.Errorf("stakingReward requires id")
}
func resolveStakingRewards(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -69,6 +79,8 @@ func resolveNetworkStats(_ context.Context, s *storage.Store, _ map[string]inter
func parseLimit(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return limit
}
+28 -28
View File
@@ -89,34 +89,34 @@ func Register(resolvers map[string]ResolverFunc) {
// Known precompile address ranges for reference.
var Addresses = map[string]string{
"warp": "0x0200000000000000000000000000000000000007",
"aiMining": "0x0300000000000000000000000000000000000000",
"poseidon2": "0x0500000000000000000000000000000000000001",
"pedersen": "0x0500000000000000000000000000000000000003",
"ed25519": "0x0500000000000000000000000000000000000004",
"fhe": "0x0700000000000000000000000000000000000000",
"fheACL": "0x0700000000000000000000000000000000000001",
"fheGateway": "0x0700000000000000000000000000000000000003",
"zkVerify": "0x0900000000000000000000000000000000000000",
"groth16": "0x0900000000000000000000000000000000000001",
"plonk": "0x0900000000000000000000000000000000000002",
"fflonk": "0x0900000000000000000000000000000000000003",
"halo2": "0x0900000000000000000000000000000000000004",
"kzg": "0x0900000000000000000000000000000000000010",
"ipa": "0x0900000000000000000000000000000000000012",
"privacyPool": "0x0900000000000000000000000000000000000020",
"nullifier": "0x0900000000000000000000000000000000000021",
"commitment": "0x0900000000000000000000000000000000000022",
"rangeProof": "0x0900000000000000000000000000000000000023",
"rollupVerify": "0x0900000000000000000000000000000000000030",
"stateRoot": "0x0900000000000000000000000000000000000031",
"batchProof": "0x0900000000000000000000000000000000000032",
"graph": "0x0A00000000000000000000000000000000000001",
"blake3": "0x9003",
"dexLimit": "0x9200",
"dexMarket": "0x9201",
"dexCancel": "0x9202",
"corona": "0xB002",
"warp": "0x0200000000000000000000000000000000000007",
"aiMining": "0x0300000000000000000000000000000000000000",
"poseidon2": "0x0500000000000000000000000000000000000001",
"pedersen": "0x0500000000000000000000000000000000000003",
"ed25519": "0x0500000000000000000000000000000000000004",
"fhe": "0x0700000000000000000000000000000000000000",
"fheACL": "0x0700000000000000000000000000000000000001",
"fheGateway": "0x0700000000000000000000000000000000000003",
"zkVerify": "0x0900000000000000000000000000000000000000",
"groth16": "0x0900000000000000000000000000000000000001",
"plonk": "0x0900000000000000000000000000000000000002",
"fflonk": "0x0900000000000000000000000000000000000003",
"halo2": "0x0900000000000000000000000000000000000004",
"kzg": "0x0900000000000000000000000000000000000010",
"ipa": "0x0900000000000000000000000000000000000012",
"privacyPool": "0x0900000000000000000000000000000000000020",
"nullifier": "0x0900000000000000000000000000000000000021",
"commitment": "0x0900000000000000000000000000000000000022",
"rangeProof": "0x0900000000000000000000000000000000000023",
"rollupVerify": "0x0900000000000000000000000000000000000030",
"stateRoot": "0x0900000000000000000000000000000000000031",
"batchProof": "0x0900000000000000000000000000000000000032",
"graph": "0x0A00000000000000000000000000000000000001",
"blake3": "0x9003",
"dexLimit": "0x9200",
"dexMarket": "0x9201",
"dexCancel": "0x9202",
"corona": "0xB002",
}
func resolvePrecompileCall(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
+12 -4
View File
@@ -25,21 +25,27 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolvePredictionMarket(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("PredictionMarket", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("PredictionMarket", fmt.Sprint(id))
}
return nil, fmt.Errorf("predictionMarket requires id")
}
func resolvePredictionMarkets(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("PredictionMarket", pl(args))
}
func resolvePredictionPosition(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("PredictionPosition", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("PredictionPosition", fmt.Sprint(id))
}
return nil, fmt.Errorf("predictionPosition requires id")
}
func resolvePredictionPositions(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("PredictionPosition", pl(args))
}
func resolvePredictionResolution(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("PredictionResolution", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("PredictionResolution", fmt.Sprint(id))
}
return nil, fmt.Errorf("predictionResolution requires id")
}
func resolvePredictionResolutions(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -51,6 +57,8 @@ func resolvePredictionStats(_ context.Context, s *storage.Store, _ map[string]in
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+18 -6
View File
@@ -28,35 +28,45 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveShieldedTransfer(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("ShieldedTransfer", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("ShieldedTransfer", fmt.Sprint(id))
}
return nil, fmt.Errorf("shieldedTransfer requires id")
}
func resolveShieldedTransfers(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("ShieldedTransfer", pl(args))
}
func resolveZKProof(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("ZKProof", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("ZKProof", fmt.Sprint(id))
}
return nil, fmt.Errorf("zkProof requires id")
}
func resolveZKProofs(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("ZKProof", pl(args))
}
func resolveNullifier(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Nullifier", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Nullifier", fmt.Sprint(id))
}
return nil, fmt.Errorf("nullifier requires id")
}
func resolveNullifiers(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Nullifier", pl(args))
}
func resolveCommitment(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("Commitment", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("Commitment", fmt.Sprint(id))
}
return nil, fmt.Errorf("commitment requires id")
}
func resolveCommitments(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("Commitment", pl(args))
}
func resolvePrivacyPool(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("PrivacyPool", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("PrivacyPool", fmt.Sprint(id))
}
return nil, fmt.Errorf("privacyPool requires id")
}
func resolvePrivacyPools(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -65,6 +75,8 @@ func resolvePrivacyPools(_ context.Context, s *storage.Store, args map[string]in
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+18 -6
View File
@@ -29,35 +29,45 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveCoronaSignature(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("CoronaSignature", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("CoronaSignature", fmt.Sprint(id))
}
return nil, fmt.Errorf("coronaSignature requires id")
}
func resolveCoronaSignatures(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("CoronaSignature", pl(args))
}
func resolveQuantumProof(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("QuantumProof", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("QuantumProof", fmt.Sprint(id))
}
return nil, fmt.Errorf("quantumProof requires id")
}
func resolveQuantumProofs(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("QuantumProof", pl(args))
}
func resolvePQKeyPair(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("PQKeyPair", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("PQKeyPair", fmt.Sprint(id))
}
return nil, fmt.Errorf("pqKeyPair requires id")
}
func resolvePQKeyPairs(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("PQKeyPair", pl(args))
}
func resolveQuantumFinality(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("QuantumFinality", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("QuantumFinality", fmt.Sprint(id))
}
return nil, fmt.Errorf("quantumFinality requires id")
}
func resolveQuantumFinalitys(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("QuantumFinality", pl(args))
}
func resolveQuantumAttestation(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("QuantumAttestation", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("QuantumAttestation", fmt.Sprint(id))
}
return nil, fmt.Errorf("quantumAttestation requires id")
}
func resolveQuantumAttestations(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -69,6 +79,8 @@ func resolveQuantumStats(_ context.Context, s *storage.Store, _ map[string]inter
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+18 -6
View File
@@ -29,35 +29,45 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveWarpMessage(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("WarpMessage", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("WarpMessage", fmt.Sprint(id))
}
return nil, fmt.Errorf("warpMessage requires id")
}
func resolveWarpMessages(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("WarpMessage", pl(args))
}
func resolveRelayRequest(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("RelayRequest", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("RelayRequest", fmt.Sprint(id))
}
return nil, fmt.Errorf("relayRequest requires id")
}
func resolveRelayRequests(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("RelayRequest", pl(args))
}
func resolveRelayProof(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("RelayProof", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("RelayProof", fmt.Sprint(id))
}
return nil, fmt.Errorf("relayProof requires id")
}
func resolveRelayProofs(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("RelayProof", pl(args))
}
func resolveRelayRoute(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("RelayRoute", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("RelayRoute", fmt.Sprint(id))
}
return nil, fmt.Errorf("relayRoute requires id")
}
func resolveRelayRoutes(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("RelayRoute", pl(args))
}
func resolveMessageReceipt(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("MessageReceipt", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("MessageReceipt", fmt.Sprint(id))
}
return nil, fmt.Errorf("messageReceipt requires id")
}
func resolveMessageReceipts(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -69,6 +79,8 @@ func resolveRelayStats(_ context.Context, s *storage.Store, _ map[string]interfa
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+18 -6
View File
@@ -29,35 +29,45 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveServiceNode(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("ServiceNode", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("ServiceNode", fmt.Sprint(id))
}
return nil, fmt.Errorf("serviceNode requires id")
}
func resolveServiceNodes(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("ServiceNode", pl(args))
}
func resolveServiceRegistration(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("ServiceRegistration", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("ServiceRegistration", fmt.Sprint(id))
}
return nil, fmt.Errorf("serviceRegistration requires id")
}
func resolveServiceRegistrations(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("ServiceRegistration", pl(args))
}
func resolveSLARecord(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("SLARecord", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("SLARecord", fmt.Sprint(id))
}
return nil, fmt.Errorf("slaRecord requires id")
}
func resolveSLARecords(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("SLARecord", pl(args))
}
func resolveUptimeProof(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("UptimeProof", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("UptimeProof", fmt.Sprint(id))
}
return nil, fmt.Errorf("uptimeProof requires id")
}
func resolveUptimeProofs(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("UptimeProof", pl(args))
}
func resolveServiceEndpoint(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("ServiceEndpoint", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("ServiceEndpoint", fmt.Sprint(id))
}
return nil, fmt.Errorf("serviceEndpoint requires id")
}
func resolveServiceEndpoints(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -69,6 +79,8 @@ func resolveServiceStats(_ context.Context, s *storage.Store, _ map[string]inter
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+15 -5
View File
@@ -27,28 +27,36 @@ func Register(resolvers map[string]ResolverFunc) {
}
func resolveTreasuryDeposit(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("TreasuryDeposit", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("TreasuryDeposit", fmt.Sprint(id))
}
return nil, fmt.Errorf("treasuryDeposit requires id")
}
func resolveTreasuryDeposits(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("TreasuryDeposit", pl(args))
}
func resolveTreasuryWithdrawal(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("TreasuryWithdrawal", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("TreasuryWithdrawal", fmt.Sprint(id))
}
return nil, fmt.Errorf("treasuryWithdrawal requires id")
}
func resolveTreasuryWithdrawals(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("TreasuryWithdrawal", pl(args))
}
func resolveTreasuryAllocation(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("TreasuryAllocation", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("TreasuryAllocation", fmt.Sprint(id))
}
return nil, fmt.Errorf("treasuryAllocation requires id")
}
func resolveTreasuryAllocations(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
return s.ListByType("TreasuryAllocation", pl(args))
}
func resolveTreasuryBudget(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
if id, ok := args["id"]; ok { return s.GetByType("TreasuryBudget", fmt.Sprint(id)) }
if id, ok := args["id"]; ok {
return s.GetByType("TreasuryBudget", fmt.Sprint(id))
}
return nil, fmt.Errorf("treasuryBudget requires id")
}
func resolveTreasuryBudgets(_ context.Context, s *storage.Store, args map[string]interface{}) (interface{}, error) {
@@ -60,6 +68,8 @@ func resolveTreasuryStats(_ context.Context, s *storage.Store, _ map[string]inte
func pl(args map[string]interface{}) int {
limit := 100
if l, ok := args["first"]; ok { fmt.Sscanf(fmt.Sprint(l), "%d", &limit) }
if l, ok := args["first"]; ok {
fmt.Sscanf(fmt.Sprint(l), "%d", &limit)
}
return min(limit, 1000)
}
+7 -4
View File
@@ -127,15 +127,19 @@ func (s *Store) ListByType(entityType string, limit int) (interface{}, error) {
// --- Block queries ---
func (s *Store) GetBlock(_ context.Context, id string) (interface{}, error) { return nil, nil }
func (s *Store) GetBlock(_ context.Context, id string) (interface{}, error) { return nil, nil }
func (s *Store) GetBlockByNumber(_ context.Context, num string) (interface{}, error) { return nil, nil }
func (s *Store) GetLatestBlock(_ context.Context) (interface{}, error) { return nil, nil }
func (s *Store) GetBlocks(_ context.Context, limit int) (interface{}, error) { return []interface{}{}, nil }
func (s *Store) GetBlocks(_ context.Context, limit int) (interface{}, error) {
return []interface{}{}, nil
}
// --- Transaction queries ---
func (s *Store) GetTransaction(_ context.Context, hash string) (interface{}, error) { return nil, nil }
func (s *Store) GetTransactions(_ context.Context, limit int) (interface{}, error) { return []interface{}{}, nil }
func (s *Store) GetTransactions(_ context.Context, limit int) (interface{}, error) {
return []interface{}{}, nil
}
// --- Token queries ---
@@ -369,4 +373,3 @@ func (s *Store) GetPoolHourDatas(_ context.Context, limit int, orderBy, orderDir
func (s *Store) GetTokenHourDatas(_ context.Context, limit int, orderBy, orderDirection string) (interface{}, error) {
return []interface{}{}, nil
}
+27 -12
View File
@@ -172,15 +172,19 @@ func (s *Store) ListByType(entityType string, limit int) (interface{}, error) {
// --- Block queries (stubs) ---
func (s *Store) GetBlock(_ context.Context, id string) (interface{}, error) { return nil, nil }
func (s *Store) GetBlock(_ context.Context, id string) (interface{}, error) { return nil, nil }
func (s *Store) GetBlockByNumber(_ context.Context, num string) (interface{}, error) { return nil, nil }
func (s *Store) GetLatestBlock(_ context.Context) (interface{}, error) { return nil, nil }
func (s *Store) GetBlocks(_ context.Context, limit int) (interface{}, error) { return []interface{}{}, nil }
func (s *Store) GetBlocks(_ context.Context, limit int) (interface{}, error) {
return []interface{}{}, nil
}
// --- Transaction queries (stubs) ---
func (s *Store) GetTransaction(_ context.Context, hash string) (interface{}, error) { return nil, nil }
func (s *Store) GetTransactions(_ context.Context, limit int) (interface{}, error) { return []interface{}{}, nil }
func (s *Store) GetTransactions(_ context.Context, limit int) (interface{}, error) {
return []interface{}{}, nil
}
// --- Token queries ---
@@ -493,14 +497,26 @@ func (s *Store) GetNFTs(_ context.Context, limit int, orderBy, orderDirection st
// --- V4 storage methods ---
func (s *Store) GetModifyLiquidity(_ context.Context, id string) (interface{}, error) { return nil, nil }
func (s *Store) GetModifyLiquiditys(_ context.Context, limit int, orderBy, orderDirection string) (interface{}, error) { return []interface{}{}, nil }
func (s *Store) GetSubscribe(_ context.Context, id string) (interface{}, error) { return nil, nil }
func (s *Store) GetSubscribes(_ context.Context, limit int, orderBy, orderDirection string) (interface{}, error) { return []interface{}{}, nil }
func (s *Store) GetUnsubscribe(_ context.Context, id string) (interface{}, error) { return nil, nil }
func (s *Store) GetUnsubscribes(_ context.Context, limit int, orderBy, orderDirection string) (interface{}, error) { return []interface{}{}, nil }
func (s *Store) GetPoolHourDatas(_ context.Context, limit int, orderBy, orderDirection string) (interface{}, error) { return []interface{}{}, nil }
func (s *Store) GetTokenHourDatas(_ context.Context, limit int, orderBy, orderDirection string) (interface{}, error) { return []interface{}{}, nil }
func (s *Store) GetModifyLiquidity(_ context.Context, id string) (interface{}, error) {
return nil, nil
}
func (s *Store) GetModifyLiquiditys(_ context.Context, limit int, orderBy, orderDirection string) (interface{}, error) {
return []interface{}{}, nil
}
func (s *Store) GetSubscribe(_ context.Context, id string) (interface{}, error) { return nil, nil }
func (s *Store) GetSubscribes(_ context.Context, limit int, orderBy, orderDirection string) (interface{}, error) {
return []interface{}{}, nil
}
func (s *Store) GetUnsubscribe(_ context.Context, id string) (interface{}, error) { return nil, nil }
func (s *Store) GetUnsubscribes(_ context.Context, limit int, orderBy, orderDirection string) (interface{}, error) {
return []interface{}{}, nil
}
func (s *Store) GetPoolHourDatas(_ context.Context, limit int, orderBy, orderDirection string) (interface{}, error) {
return []interface{}{}, nil
}
func (s *Store) GetTokenHourDatas(_ context.Context, limit int, orderBy, orderDirection string) (interface{}, error) {
return []interface{}{}, nil
}
// --- Internal helpers ---
@@ -542,4 +558,3 @@ func (s *Store) loadPool(id string) (*SeedPoolData, error) {
json.Unmarshal([]byte(raw), &p)
return &p, nil
}
+7 -7
View File
@@ -51,12 +51,12 @@ type Subgraph struct {
// DataSource maps a contract to its WASM handler module.
type DataSource struct {
Name string `yaml:"name"`
Kind string `yaml:"kind"`
Network string `yaml:"network"`
Source ContractSource `yaml:"source"`
Mapping Mapping `yaml:"mapping"`
wasmBytes []byte
Name string `yaml:"name"`
Kind string `yaml:"kind"`
Network string `yaml:"network"`
Source ContractSource `yaml:"source"`
Mapping Mapping `yaml:"mapping"`
wasmBytes []byte
}
// ContractSource identifies the contract to watch.
@@ -85,7 +85,7 @@ type ABIRef struct {
// EventHandler maps an EVM event signature to a WASM handler function.
type EventHandler struct {
Event string `yaml:"event"` // e.g., "Swap(indexed address,uint256,uint256,uint256,uint256,indexed address)"
Event string `yaml:"event"` // e.g., "Swap(indexed address,uint256,uint256,uint256,uint256,indexed address)"
Handler string `yaml:"handler"` // e.g., "handleSwap"
}