From a1762479174461957bb15e61c6972f59333e7a30 Mon Sep 17 00:00:00 2001 From: polebug Date: Thu, 11 Jan 2024 14:45:55 +0800 Subject: [PATCH] feat(schema): update node schema --- internal/hub/data.go | 16 ++++++++-------- schema/node.go | 10 ++++------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/internal/hub/data.go b/internal/hub/data.go index 8cf83f7c..1442d1f2 100644 --- a/internal/hub/data.go +++ b/internal/hub/data.go @@ -26,10 +26,10 @@ func (h *Hub) getNode(ctx context.Context, address common.Address) (*schema.Node node.Name = nodeInfo.Name node.Description = nodeInfo.Description node.TaxFraction = nodeInfo.TaxFraction - node.OperatingPoolTokens = nodeInfo.OperatingPoolTokens - node.StakingPoolTokens = nodeInfo.StakingPoolTokens - node.TotalShares = nodeInfo.TotalShares - node.SlashedTokens = nodeInfo.SlashedTokens + node.OperatingPoolTokens = nodeInfo.OperatingPoolTokens.String() + node.StakingPoolTokens = nodeInfo.StakingPoolTokens.String() + node.TotalShares = nodeInfo.TotalShares.String() + node.SlashedTokens = nodeInfo.SlashedTokens.String() return node, nil } @@ -58,10 +58,10 @@ func (h *Hub) getNodes(ctx context.Context, request *BatchNodeRequest) ([]*schem node.Name = nodeInfo.Name node.Description = nodeInfo.Description node.TaxFraction = nodeInfo.TaxFraction - node.OperatingPoolTokens = nodeInfo.OperatingPoolTokens - node.StakingPoolTokens = nodeInfo.StakingPoolTokens - node.TotalShares = nodeInfo.TotalShares - node.SlashedTokens = nodeInfo.SlashedTokens + node.OperatingPoolTokens = nodeInfo.OperatingPoolTokens.String() + node.StakingPoolTokens = nodeInfo.StakingPoolTokens.String() + node.TotalShares = nodeInfo.TotalShares.String() + node.SlashedTokens = nodeInfo.SlashedTokens.String() } } diff --git a/schema/node.go b/schema/node.go index 5e1ac509..ae01b515 100644 --- a/schema/node.go +++ b/schema/node.go @@ -1,8 +1,6 @@ package schema import ( - "math/big" - "github.com/ethereum/go-ethereum/common" "github.com/naturalselectionlabs/rss3-node/config" ) @@ -13,10 +11,10 @@ type Node struct { Description string `json:"description"` TaxFraction uint64 `json:"taxFraction"` IsPublicGood bool `json:"isPublicGood"` - OperatingPoolTokens *big.Int `json:"operatingPoolTokens"` - StakingPoolTokens *big.Int `json:"stakingPoolTokens"` - TotalShares *big.Int `json:"totalShares"` - SlashedTokens *big.Int `json:"slashedTokens"` + OperatingPoolTokens string `json:"operatingPoolTokens"` + StakingPoolTokens string `json:"stakingPoolTokens"` + TotalShares string `json:"totalShares"` + SlashedTokens string `json:"slashedTokens"` Endpoint string `json:"-"` Stream *config.Stream `json:"-"` Config *config.Node `json:"-"`