Skip to content

Commit

Permalink
change API routes
Browse files Browse the repository at this point in the history
  • Loading branch information
chris124567 committed Jun 6, 2024
1 parent 693f757 commit 1b5b16f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ func (c *Client) Transactions(ids []types.TransactionID) (resp []explorer.Transa

// AddressUTXOs returns the specified address' unspent outputs.
func (c *Client) AddressUTXOs(address types.Address, offset, limit uint64) (resp AddressUTXOsResponse, err error) {
err = c.c.GET(fmt.Sprintf("/explorer/addresses/utxos/%s?offset=%d&limit=%d", address, offset, limit), &resp)
err = c.c.GET(fmt.Sprintf("/explorer/addresses/%s/utxos?offset=%d&limit=%d", address, offset, limit), &resp)
return
}

// AddressEvents returns the specified address' events.
func (c *Client) AddressEvents(address types.Address, offset, limit uint64) (resp []explorer.Event, err error) {
err = c.c.GET(fmt.Sprintf("/explorer/addresses/events/%s?offset=%d&limit=%d", address, offset, limit), &resp)
err = c.c.GET(fmt.Sprintf("/explorer/addresses/%s/events?offset=%d&limit=%d", address, offset, limit), &resp)
return
}

// AddressBalance returns the specified address' balance.
func (c *Client) AddressBalance(address types.Address) (resp AddressBalanceResponse, err error) {
err = c.c.GET(fmt.Sprintf("/explorer/addresses/balance/%s", address), &resp)
err = c.c.GET(fmt.Sprintf("/explorer/addresses/%s/balance", address), &resp)
return
}

Expand All @@ -118,7 +118,7 @@ func (c *Client) Contracts(ids []types.FileContractID) (resp []explorer.FileCont

// ContractsKey returns the contracts for a particular ed25519 key.
func (c *Client) ContractsKey(key types.PublicKey) (resp []explorer.FileContract, err error) {
err = c.c.GET(fmt.Sprintf("/explorer/contracts/key/%s", key), &resp)
err = c.c.GET(fmt.Sprintf("/explorer/pubkey/%s/contracts", key), &resp)
return
}

Expand Down
10 changes: 5 additions & 5 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ func NewServer(e Explorer, cm ChainManager, s Syncer) http.Handler {
"GET /explorer/metrics/:id": srv.explorerMetricsIDHandler,
"GET /explorer/transactions/:id": srv.explorerTransactionsIDHandler,
"POST /explorer/transactions": srv.explorerTransactionsHandler,
"GET /explorer/addresses/utxos/:address": srv.explorerAddressessAddressUtxosHandler,
"GET /explorer/addresses/events/:address": srv.explorerAddressessAddressEventsHandler,
"GET /explorer/addresses/balance/:address": srv.explorerAddressessAddressBalanceHandler,
"GET /explorer/contracts/id/:id": srv.explorerContractIDHandler,
"GET /explorer/contracts/key/:key": srv.explorerContractKeyHandler,
"GET /explorer/addresses/:address/utxos": srv.explorerAddressessAddressUtxosHandler,
"GET /explorer/addresses/:address/events": srv.explorerAddressessAddressEventsHandler,
"GET /explorer/addresses/:address/balance": srv.explorerAddressessAddressBalanceHandler,
"GET /explorer/contracts/:id": srv.explorerContractIDHandler,
"GET /explorer/pubkey/:key/contracts": srv.explorerContractKeyHandler,
"POST /explorer/contracts": srv.explorerContractsHandler,
})
}

0 comments on commit 1b5b16f

Please sign in to comment.