mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2026-01-03 22:34:25 +01:00
kitchen sink peer connect and channel create
This commit is contained in:
10
src/utils/eify.ts
Normal file
10
src/utils/eify.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/// Sometimes we catch an error as `unknown` so this turns it into an Error.
|
||||
export default function eify(e: unknown): Error {
|
||||
if (e instanceof Error) {
|
||||
return e;
|
||||
} else if (typeof e === 'string') {
|
||||
return new Error(e);
|
||||
} else {
|
||||
return new Error('Unknown error');
|
||||
}
|
||||
}
|
||||
21
src/utils/mempoolTxUrl.ts
Normal file
21
src/utils/mempoolTxUrl.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
export default function mempoolTxUrl(txid?: string, network?: string) {
|
||||
if (!txid || !network) {
|
||||
console.error("Problem creating the mempool url")
|
||||
return "#"
|
||||
}
|
||||
|
||||
if (network) {
|
||||
switch (network) {
|
||||
case "mainnet":
|
||||
return `https://mempool.space/tx/${txid}`
|
||||
case "testnet":
|
||||
return `https://mempool.space/testnet/tx/${txid}`
|
||||
case "signet":
|
||||
return `https://mutinynet.com/tx/${txid}`
|
||||
default:
|
||||
return `https://mempool.space/tx/${txid}`
|
||||
}
|
||||
}
|
||||
|
||||
return `https://mempool.space/tx/${txid}`
|
||||
}
|
||||
Reference in New Issue
Block a user