-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into aj/tower-defense-e2e
- Loading branch information
Showing
42 changed files
with
2,273 additions
and
1,554 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package routes | ||
|
||
import ( | ||
"encoding/json" | ||
"net/http" | ||
|
||
"github.com/ethereum/go-ethereum/log" | ||
) | ||
|
||
// lazily typing numbers fixme | ||
type Transaction struct { | ||
Timestamp uint64 `json:"timestamp"` | ||
TransactionHash string `json:"transactionHash"` | ||
} | ||
|
||
type Block struct { | ||
BlockNumber int64 `json:"number"` | ||
BlockHash string `json:"hash"` | ||
// ParentBlockHash string `json:"parentHash"` | ||
} | ||
|
||
type Extensions struct { | ||
OptimismBridgeAddress string `json:"OptimismBridgeAddress"` | ||
} | ||
|
||
type TokenInfo struct { | ||
// TODO lazily typing ints go through them all with fine tooth comb once api is up | ||
ChainId int `json:"chainId"` | ||
Address string `json:"address"` | ||
Name string `json:"name"` | ||
Symbol string `json:"symbol"` | ||
Decimals int `json:"decimals"` | ||
Extensions Extensions `json:"extensions"` | ||
} | ||
|
||
func jsonResponse(w http.ResponseWriter, logger log.Logger, data interface{}, statusCode int) { | ||
w.Header().Set("Content-Type", "application/json") | ||
jsonData, err := json.Marshal(data) | ||
if err != nil { | ||
http.Error(w, "Internal server error", http.StatusInternalServerError) | ||
logger.Error("Failed to marshal JSON: %v", err) | ||
return | ||
} | ||
|
||
w.WriteHeader(statusCode) | ||
_, err = w.Write(jsonData) | ||
if err != nil { | ||
http.Error(w, "Internal server error", http.StatusInternalServerError) | ||
logger.Error("Failed to write JSON data", err) | ||
return | ||
} | ||
} |
Oops, something went wrong.