-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backend: implement block explorer selection
Add the block explorer prefix url to the configuration that will be used to open the transaction. The available options to select are statically defined and the frontend can learn them by calling the available-explorers endpoint.
- Loading branch information
Showing
4 changed files
with
166 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package config | ||
|
||
// BlockExplorer defines a selectable block explorer. | ||
type BlockExplorer struct { | ||
// Name of the block explorer used for UI. | ||
Name string `json:"name"` | ||
// Url of the block explorer that the txid is appended. | ||
Url string `json:"url"` | ||
} | ||
|
||
// AvailableBlockExplorers defines all available block explorers for each coin. | ||
type AvailableBlockExplorers struct { | ||
Btc []BlockExplorer `json:"btc"` | ||
Tbtc []BlockExplorer `json:"tbtc"` | ||
Ltc []BlockExplorer `json:"ltc"` | ||
Tltc []BlockExplorer `json:"tltc"` | ||
Eth []BlockExplorer `json:"eth"` | ||
GoEth []BlockExplorer `json:"goeth"` | ||
SepEth []BlockExplorer `json:"sepeth"` | ||
} | ||
|
||
// AvailableExplorers FIXME: Localize AvailableExplorers. | ||
var AvailableExplorers = AvailableBlockExplorers{ | ||
Btc: []BlockExplorer{ | ||
{ | ||
Name: "blockstream.info", | ||
Url: "https://blockstream.info/tx/", | ||
}, | ||
{ | ||
Name: "mempool.space", | ||
Url: "https://mempool.space/tx", | ||
}, | ||
}, | ||
Tbtc: []BlockExplorer{ | ||
{ | ||
Name: "mempool.space", | ||
Url: "https://mempool.space/testnet/tx/", | ||
}, | ||
{ | ||
Name: "blockstream.info", | ||
Url: "https://blockstream.info/testnet/tx/", | ||
}, | ||
}, | ||
Ltc: []BlockExplorer{ | ||
{ | ||
Name: "sochain.com", | ||
Url: "https://sochain.com/tx/", | ||
}, | ||
{ | ||
Name: "blockchair.com", | ||
Url: "https://blockchair.com/litecoin/transaction", | ||
}, | ||
}, | ||
Tltc: []BlockExplorer{ | ||
{ | ||
Name: "sochain.com", | ||
Url: "https://sochain.com/tx/LTCTEST/", | ||
}, | ||
}, | ||
Eth: []BlockExplorer{ | ||
{ | ||
Name: "etherscan.io", | ||
Url: "https://etherscan.io/tx/", | ||
}, | ||
{ | ||
Name: "ethplorer.io", | ||
Url: "https://ethplorer.io/tx/", | ||
}, | ||
}, | ||
GoEth: []BlockExplorer{ | ||
{ | ||
Name: "etherscan.io", | ||
Url: "https://goerli.etherscan.io/tx/", | ||
}, | ||
{ | ||
Name: "ethplorer.io", | ||
Url: "https://goerli.ethplorer.io/tx/", | ||
}, | ||
}, | ||
SepEth: []BlockExplorer{ | ||
{ | ||
Name: "etherscan.io", | ||
Url: "https://sepolia.etherscan.io/tx/", | ||
}, | ||
{ | ||
Name: "ethplorer.io", | ||
Url: "https://sepolia.ethplorer.io/tx/", | ||
}, | ||
}, | ||
} |
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