Skip to content

Commit

Permalink
tenscan api names
Browse files Browse the repository at this point in the history
  • Loading branch information
badgersrus committed Apr 11, 2024
1 parent c793514 commit 835d410
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions go/host/rpc/clientapi/client_api_scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ func (s *ScanAPI) GetTotalContractCount() (*big.Int, error) {
}

// GetTotalTxCount returns the number of recorded transactions on the network.
func (s *ScanAPI) GetTotalTxCount() (*big.Int, error) {
func (s *ScanAPI) GetTotalTransactionCount() (*big.Int, error) {
return s.host.Storage().FetchTotalTxCount()
}

// GetBatchListing returns a paginated list of batches
func (s *ScanAPI) GetBatchListing(pagination *common.QueryPagination) (*common.BatchListingResponse, error) {
// GetBatchListingNew returns a paginated list of batches
func (s *ScanAPI) GetBatchListingNew(pagination *common.QueryPagination) (*common.BatchListingResponse, error) {
return s.host.Storage().FetchBatchListing(pagination)
}

// GetBatchListingDeprecated returns the deprecated version of batch listing
func (s *ScanAPI) GetBatchListingDeprecated(pagination *common.QueryPagination) (*common.BatchListingResponseDeprecated, error) {
// GetBatchListing returns the deprecated version of batch listing
func (s *ScanAPI) GetBatchListing(pagination *common.QueryPagination) (*common.BatchListingResponseDeprecated, error) {
return s.host.Storage().FetchBatchListingDeprecated(pagination)
}

Expand Down
4 changes: 2 additions & 2 deletions go/obsclient/obsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (oc *ObsClient) GetPublicTxListing(pagination *common.QueryPagination) (*co
// GetBatchesListing returns a list of batches
func (oc *ObsClient) GetBatchesListing(pagination *common.QueryPagination) (*common.BatchListingResponse, error) {
var result common.BatchListingResponse
err := oc.rpcClient.Call(&result, rpc.GetBatchListing, pagination)
err := oc.rpcClient.Call(&result, rpc.GetBatchListingNew, pagination)
if err != nil {
return nil, err
}
Expand All @@ -162,7 +162,7 @@ func (oc *ObsClient) GetBatchesListing(pagination *common.QueryPagination) (*com
// GetBatchesListingDeprecated returns a list of batches
func (oc *ObsClient) GetBatchesListingDeprecated(pagination *common.QueryPagination) (*common.BatchListingResponseDeprecated, error) {
var result common.BatchListingResponseDeprecated
err := oc.rpcClient.Call(&result, rpc.GetBatchListingDeprecated, pagination)
err := oc.rpcClient.Call(&result, rpc.GetBatchListing, pagination)
if err != nil {
return nil, err
}
Expand Down
27 changes: 14 additions & 13 deletions go/rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,20 @@ const (
SubscriptionTypeLogs = "logs"
SubscriptionTypeNewHeads = "newHeads"

GetBatchByTx = "scan_getBatchByTx"
GetLatestRollupHeader = "scan_getLatestRollupHeader"
GetTotalTxCount = "scan_getTotalTxCount"
GetTotalContractCount = "scan_getTotalContractCount"
GetPublicTransactionData = "scan_getPublicTransactionData"
GetBatchListing = "scan_getBatchListing"
GetBatchListingDeprecated = "scan_getBatchListingDeprecated"
GetBlockListing = "scan_getBlockListing"
GetRollupListing = "scan_getRollupListing"
GetBatch = "scan_getBatch"
GetLatestBatch = "scan_getLatestBatch"
GetPublicBatchByHash = "scan_getPublicBatchByHash"
GetBatchByHeight = "scan_getBatchByHeight"
GetBatchByTx = "scan_getBatchByTx"
GetLatestRollupHeader = "scan_getLatestRollupHeader"
GetTotalTxCount = "scan_getTotalTransactionCount"
GetTotalContractCount = "scan_getTotalContractCount"
GetPublicTransactionData = "scan_getPublicTransactionData"
GetBatchListing = "scan_getBatchListing"
GetBatchListingNew = "scan_getBatchListingNew"
GetBlockListing = "scan_getBlockListing"
GetRollupListing = "scan_getRollupListing"
GetBatch = "scan_getBatch"
GetLatestBatch = "scan_getLatestBatch"
GetPublicBatchByHash = "scan_getPublicBatchByHash"
GetBatchByHeight = "scan_getBatchByHeight"
GetLatestTransactions = "scan_getLatestTransactions"
)

// Client is used by client applications to interact with the Ten node
Expand Down
8 changes: 4 additions & 4 deletions integration/simulation/p2p/in_mem_obscuro_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (c *inMemObscuroClient) Call(result interface{}, method string, args ...int
case rpc.GetBatch:
return c.getBatch(result, args)

case rpc.GetBatchListingDeprecated:
case rpc.GetBatchListingNew:
return c.getBatchListingDeprecated(result, args)

case rpc.GetRollupListing:
Expand Down Expand Up @@ -327,16 +327,16 @@ func (c *inMemObscuroClient) getBatch(result interface{}, args []interface{}) er

func (c *inMemObscuroClient) getBatchListingDeprecated(result interface{}, args []interface{}) error {
if len(args) != 1 {
return fmt.Errorf("expected 1 arg to %s, got %d", rpc.GetBatchListingDeprecated, len(args))
return fmt.Errorf("expected 1 arg to %s, got %d", rpc.GetBatchListingNew, len(args))
}
pagination, ok := args[0].(*common.QueryPagination)
if !ok {
return fmt.Errorf("first arg to %s is of type %T, expected type int", rpc.GetBatchListingDeprecated, args[0])
return fmt.Errorf("first arg to %s is of type %T, expected type int", rpc.GetBatchListingNew, args[0])
}

batches, err := c.tenScanAPI.GetBatchListingDeprecated(pagination)

Check failure on line 337 in integration/simulation/p2p/in_mem_obscuro_client.go

View workflow job for this annotation

GitHub Actions / lint

c.tenScanAPI.GetBatchListingDeprecated undefined (type *clientapi.ScanAPI has no field or method GetBatchListingDeprecated) (typecheck)

Check failure on line 337 in integration/simulation/p2p/in_mem_obscuro_client.go

View workflow job for this annotation

GitHub Actions / lint

c.tenScanAPI.GetBatchListingDeprecated undefined (type *clientapi.ScanAPI has no field or method GetBatchListingDeprecated)) (typecheck)

Check failure on line 337 in integration/simulation/p2p/in_mem_obscuro_client.go

View workflow job for this annotation

GitHub Actions / build

c.tenScanAPI.GetBatchListingDeprecated undefined (type *clientapi.ScanAPI has no field or method GetBatchListingDeprecated)
if err != nil {
return fmt.Errorf("`%s` call failed. Cause: %w", rpc.GetBatchListingDeprecated, err)
return fmt.Errorf("`%s` call failed. Cause: %w", rpc.GetBatchListingNew, err)
}

res, ok := result.(*common.BatchListingResponseDeprecated)
Expand Down
2 changes: 1 addition & 1 deletion integration/simulation/validate_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ func checkTotalTransactions(t *testing.T, client rpc.Client, nodeIdx int) {
func checkForLatestBatches(t *testing.T, client rpc.Client, nodeIdx int) {
var latestBatches common.BatchListingResponseDeprecated
pagination := common.QueryPagination{Offset: uint64(0), Size: uint(5)}
err := client.Call(&latestBatches, rpc.GetBatchListingDeprecated, &pagination)
err := client.Call(&latestBatches, rpc.GetBatchListingNew, &pagination)
if err != nil {
t.Errorf("node %d: could not retrieve latest batches. Cause: %s", nodeIdx, err)
}
Expand Down
1 change: 0 additions & 1 deletion tools/tenscan/backend/webserver/webserver_routes_items.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ func routeItems(r *gin.Engine, server *WebServer) {
r.GET("/items/batch/:hash", server.getBatch)
r.GET("/items/rollup/latest/", server.getLatestRollupHeader)
r.GET("/items/rollups/", server.getRollupListing) // New
r.GET("/items/batchs/", server.getBatchListing)
r.GET("/items/batches/", server.getBatchListingDeprecated)
r.GET("/items/blocks/", server.getBlockListing) // Deprecated
r.GET("/items/transactions/", server.getPublicTransactions)
Expand Down

0 comments on commit 835d410

Please sign in to comment.