-
Notifications
You must be signed in to change notification settings - Fork 90
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 for which a handler was implemented in this commit.
- Loading branch information
Showing
4 changed files
with
154 additions
and
16 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,91 @@ | ||
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 holds all available block explorers for each coin. | ||
// It is returned from the available-explorers endpoint. | ||
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