cloud functions - handle 2 digit chainIDs
This commit is contained in:
parent
6e32dbe403
commit
57c06dea11
|
@ -11,6 +11,7 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
@ -79,7 +80,8 @@ func fetchAddressRowsInInterval(tbl *bigtable.Table, ctx context.Context, prefix
|
|||
t.DestinationAddress = transformHexAddressToNative(chainIdStringToType(t.DestinationChain), t.DestinationAddress)
|
||||
}
|
||||
|
||||
t.LeavingChain = row.Key()[:1]
|
||||
keyParts := strings.Split(row.Key(), ":")
|
||||
t.LeavingChain = keyParts[0]
|
||||
|
||||
rows = append(rows, *t)
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
@ -90,7 +91,8 @@ func fetchTransferRowsInInterval(tbl *bigtable.Table, ctx context.Context, prefi
|
|||
}
|
||||
}
|
||||
|
||||
t.LeavingChain = row.Key()[:1]
|
||||
keyParts := strings.Split(row.Key(), ":")
|
||||
t.LeavingChain = keyParts[0]
|
||||
|
||||
rows = append(rows, *t)
|
||||
}
|
||||
|
|
|
@ -271,13 +271,13 @@ func Recent(w http.ResponseWriter, r *http.Request) {
|
|||
// create the rowkey prefix for querying, and the keySegments to use for indexing results.
|
||||
prefix := ""
|
||||
if forChain != "" {
|
||||
prefix = forChain
|
||||
prefix = forChain + ":"
|
||||
if groupBy == "" {
|
||||
// groupBy was not set, but forChain was, so set the keySegments to index by chain
|
||||
keySegments = 1
|
||||
}
|
||||
if forAddress != "" {
|
||||
prefix = forChain + ":" + forAddress
|
||||
prefix = forChain + forAddress
|
||||
if groupBy == "" {
|
||||
// groupBy was not set, but forAddress was, so set the keySegments to index by address
|
||||
keySegments = 2
|
||||
|
|
Loading…
Reference in New Issue