-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathblockchains.ts
129 lines (124 loc) · 3.78 KB
/
blockchains.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import { TRANSACTION_ID_PLACEHOLDER } from './api';
import { SupportedChains } from './supported-chains';
// TODO: ideally this list comes from @vaultie/lds-merkle-proof-2019 from the Keymap definition
enum BlinkCodes {
btc = 'btc',
eth = 'eth',
mocknet = 'mocknet'
}
export interface IBlockchainObject {
code: SupportedChains;
blinkCode: BlinkCodes;
name: string;
prefixes?: string[];
test?: boolean;
signatureValue: string;
transactionTemplates: {
full: string;
raw: string;
};
}
const BLOCKCHAINS: { [chain in SupportedChains]: IBlockchainObject } = {
[SupportedChains.Bitcoin]: {
code: SupportedChains.Bitcoin,
blinkCode: BlinkCodes.btc,
name: 'Bitcoin',
prefixes: ['6a20', 'OP_RETURN '],
signatureValue: 'bitcoinMainnet',
transactionTemplates: {
full: `https://blockchain.info/tx/${TRANSACTION_ID_PLACEHOLDER}`,
raw: `https://blockchain.info/rawtx/${TRANSACTION_ID_PLACEHOLDER}`
}
},
[SupportedChains.Ethmain]: {
code: SupportedChains.Ethmain,
blinkCode: BlinkCodes.eth,
name: 'Ethereum',
prefixes: ['0x'],
signatureValue: 'ethereumMainnet',
transactionTemplates: {
full: `https://etherscan.io/tx/${TRANSACTION_ID_PLACEHOLDER}`,
raw: `https://etherscan.io/tx/${TRANSACTION_ID_PLACEHOLDER}`
}
},
[SupportedChains.Ethropst]: {
code: SupportedChains.Ethropst,
blinkCode: BlinkCodes.eth,
name: 'Ethereum Testnet',
signatureValue: 'ethereumRopsten',
transactionTemplates: {
full: `https://ropsten.etherscan.io/tx/${TRANSACTION_ID_PLACEHOLDER}`,
raw: `https://ropsten.etherscan.io/getRawTx?tx=${TRANSACTION_ID_PLACEHOLDER}`
}
},
[SupportedChains.Ethrinkeby]: {
code: SupportedChains.Ethrinkeby,
blinkCode: BlinkCodes.eth,
name: 'Ethereum Testnet',
signatureValue: 'ethereumRinkeby',
transactionTemplates: {
full: `https://rinkeby.etherscan.io/tx/${TRANSACTION_ID_PLACEHOLDER}`,
raw: `https://rinkeby.etherscan.io/getRawTx?tx=${TRANSACTION_ID_PLACEHOLDER}`
}
},
[SupportedChains.Ethgoerli]: {
code: SupportedChains.Ethgoerli,
blinkCode: BlinkCodes.eth,
name: 'Ethereum Testnet',
signatureValue: 'ethereumGoerli',
transactionTemplates: {
full: `https://goerli.etherscan.io/tx/${TRANSACTION_ID_PLACEHOLDER}`,
raw: `https://goerli.etherscan.io/getRawTx?tx=${TRANSACTION_ID_PLACEHOLDER}`
}
},
[SupportedChains.Ethsepolia]: {
code: SupportedChains.Ethsepolia,
blinkCode: BlinkCodes.eth,
name: 'Ethereum Testnet',
signatureValue: 'ethereumSepolia',
transactionTemplates: {
full: `https://sepolia.etherscan.io/tx/${TRANSACTION_ID_PLACEHOLDER}`,
raw: `https://sepolia.etherscan.io/getRawTx?tx=${TRANSACTION_ID_PLACEHOLDER}`
}
},
[SupportedChains.Mocknet]: {
code: SupportedChains.Mocknet,
blinkCode: BlinkCodes.mocknet,
name: 'Mocknet',
test: true,
signatureValue: 'mockchain',
transactionTemplates: {
full: '',
raw: ''
}
},
[SupportedChains.Regtest]: {
code: SupportedChains.Regtest,
blinkCode: BlinkCodes.mocknet,
name: 'Mocknet',
test: true,
signatureValue: 'bitcoinRegtest',
transactionTemplates: {
full: '',
raw: ''
}
},
[SupportedChains.Testnet]: {
code: SupportedChains.Testnet,
blinkCode: BlinkCodes.btc,
name: 'Bitcoin Testnet',
signatureValue: 'bitcoinTestnet',
transactionTemplates: {
full: `https://testnet.blockchain.info/tx/${TRANSACTION_ID_PLACEHOLDER}`,
raw: `https://testnet.blockchain.info/rawtx/${TRANSACTION_ID_PLACEHOLDER}`
}
}
};
// TODO: use test boolean from entry?
function isTestChain (chain: SupportedChains): boolean {
return chain !== BLOCKCHAINS.bitcoin.code && chain !== BLOCKCHAINS.ethmain.code;
}
export {
BLOCKCHAINS,
isTestChain
};