kitchen sink peer connect and channel create

This commit is contained in:
Paul Miller
2023-04-11 10:10:18 -05:00
parent 9173701c13
commit f5b48c28b2
4 changed files with 226 additions and 16 deletions

10
src/utils/eify.ts Normal file
View 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
View 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}`
}