-
Notifications
You must be signed in to change notification settings - Fork 19
/
constant.ts
156 lines (126 loc) · 4.77 KB
/
constant.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import { NetworkType, SettingsNetwork } from './types';
export const API_TIMEOUT_MILLI = 30000;
export const ENTROPY_BYTES = 16;
// while taproot addresses have a dust value of 330, we use 546 as it is more compatible with all modern addresses
export const DEFAULT_DUST_VALUE = 546n;
export const BTC_PATH = `m/49'/0'/0'/0/0`;
export const BTC_WRAPPED_SEGWIT_PATH_PURPOSE = `m/49'/`;
export const BTC_SEGWIT_PATH_PURPOSE = `m/84'/`;
export const BTC_TAPROOT_PATH_PURPOSE = `m/86'/`;
export const BTC_PATH_WITHOUT_INDEX = `m/49'/0'/0'/0/`;
export const BTC_TESTNET_PATH_WITHOUT_INDEX = `m/49'/1'/0'/0/`;
export const BTC_TAPROOT_PATH_WITHOUT_INDEX = `m/86'/0'/0'/0/`;
export const BTC_TAPROOT_TESTNET_PATH_WITHOUT_INDEX = `m/86'/1'/0'/0/`;
export const STX_PATH_WITHOUT_INDEX = `m/44'/5757'/0'/0/`;
export const WALLET_CONFIG_PATH = `m/44/5757'/0'/1`;
/**
* Network constants
*/
// BTC
export const BTC_BASE_URI_MAINNET = 'https://mempool.space/api';
export const BTC_BASE_URI_TESTNET = 'https://mempool.space/testnet/api';
export const BTC_BASE_URI_SIGNET = 'https://mempool.space/signet/api';
export const XVERSE_BTC_BASE_URI_MAINNET = 'https://btc-1.xverse.app';
export const XVERSE_BTC_BASE_URI_TESTNET = 'https://btc-testnet.xverse.app';
export const XVERSE_BTC_BASE_URI_SIGNET = 'https://btc-signet.xverse.app';
// STX
export const HIRO_MAINNET_DEFAULT = 'https://api.hiro.so';
export const HIRO_TESTNET_DEFAULT = 'https://api.testnet.hiro.so';
// !NOTE: Signet is not supported by Hiro
export const defaultMainnet: SettingsNetwork = {
type: 'Mainnet',
address: HIRO_MAINNET_DEFAULT,
btcApiUrl: BTC_BASE_URI_MAINNET,
fallbackBtcApiUrl: XVERSE_BTC_BASE_URI_MAINNET,
};
export const defaultTestnet: SettingsNetwork = {
type: 'Testnet',
address: HIRO_TESTNET_DEFAULT,
btcApiUrl: BTC_BASE_URI_TESTNET,
fallbackBtcApiUrl: XVERSE_BTC_BASE_URI_TESTNET,
};
export const defaultSignet: SettingsNetwork = {
type: 'Signet',
address: HIRO_TESTNET_DEFAULT,
btcApiUrl: BTC_BASE_URI_SIGNET,
fallbackBtcApiUrl: XVERSE_BTC_BASE_URI_SIGNET,
};
export const initialNetworksList: SettingsNetwork[] = [
{ ...defaultMainnet },
{ ...defaultTestnet },
{ ...defaultSignet },
];
export const NFT_BASE_URI = 'https://stacks.gamma.io/api/v1/collections';
const xverseApiNetworkSuffix = (network: NetworkType, mainnetOverride = '') => {
switch (network) {
case 'Mainnet':
return `${mainnetOverride}`;
case 'Testnet':
return '-testnet';
case 'Signet':
return '-signet';
default:
throw new Error('Invalid network');
}
};
export const XVERSE_API_BASE_URL = (network: NetworkType) =>
`https://api${xverseApiNetworkSuffix(network, '-3')}.xverse.app`;
export const XVERSE_INSCRIBE_URL = (network: NetworkType) =>
`https://inscribe${xverseApiNetworkSuffix(network)}.xverse.app`;
export const XORD_URL = (network: NetworkType) => `https://inscribe${xverseApiNetworkSuffix(network)}.xverse.app`;
export const ORDINALS_URL = (network: NetworkType, inscriptionId: string) =>
`https://ord${xverseApiNetworkSuffix(network)}.xverse.app/content/${inscriptionId}`;
export const ORDINALS_SERVICE_BASE_URL = (network: NetworkType = 'Mainnet') =>
`https://ordinals${xverseApiNetworkSuffix(network)}.xverse.app/v1`;
export const XVERSE_SPONSOR_URL = 'https://sponsor.xverse.app';
export const GAIA_HUB_URL = 'https://hub.hiro.so';
export const BNS_CONTRACT_ID = 'SP000000000000000000002Q6VF78.bns';
export const STX_DECIMALS = 6;
export const supportedCoins = [
{
contract: 'SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.age000-governance-token',
name: 'ALEX',
},
{
contract: 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-token',
name: 'Arkadiko Token',
},
{
contract: 'SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.auto-alex',
name: 'Auto ALEX',
},
{
contract: 'SP1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R.miamicoin-token-v2',
name: 'MiamiCoin',
},
{
contract: 'SPSCWDV3RKV5ZRN1FQD84YE1NQFEDJ9R1F4DYQ11.newyorkcitycoin-token-v2',
name: 'NewYorkCityCoin',
},
{
contract: 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.usda-token',
name: 'USDA',
},
{
contract: 'SP27BB1Y2DGSXZHS7G9YHKTSH6KQ6BD3QG0AN3CR9.vibes-token',
name: 'Vibes',
},
{
contract: 'SP3DX3H4FEYZJZ586MFBS25ZW3HZDMEW92260R2PR.Wrapped-Bitcoin',
name: 'Wrapped Bitcoin',
},
{
contract: 'SP2TZK01NKDC89J6TA56SA47SDF7RTHYEQ79AAB9A.Wrapped-USD',
name: 'Wrapped USD',
},
{
contract: 'SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-susdt',
name: 'Wrapped USDT',
},
{
contract: 'SP125J1ADVYWGWB9NQRCVGKYAG73R17ZNMV17XEJ7.slime-token',
name: 'SLIME',
},
];
export const ORDINALS_FT_INDEXER_API_URL = 'https://unisat.io/brc20-api-v2/address';
export const GAMMA_COLLECTION_API = 'https://api.gamma.io/nft-data-service/v1/collections';