@sentio/sdk 2.18.3 → 2.18.4-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/aptos/api.d.ts +1 -1
- package/lib/aptos/context.d.ts +2 -2
- package/lib/aptos/ext/coin.js +1 -1
- package/lib/aptos/ext/coin.js.map +1 -1
- package/lib/aptos/network.d.ts +1 -1
- package/lib/aptos/network.js +1 -1
- package/lib/aptos/network.js.map +1 -1
- package/lib/core/base-context.d.ts +1 -1
- package/lib/core/base-context.js.map +1 -1
- package/lib/core/yaml-contract-config.d.ts +1 -1
- package/lib/core/yaml-contract-config.js.map +1 -1
- package/lib/eth/account-processor.d.ts +1 -1
- package/lib/eth/account-processor.js +1 -1
- package/lib/eth/account-processor.js.map +1 -1
- package/lib/eth/base-processor.d.ts +1 -1
- package/lib/eth/base-processor.js +1 -1
- package/lib/eth/base-processor.js.map +1 -1
- package/lib/eth/bind-options.d.ts +1 -1
- package/lib/eth/bind-options.js +1 -1
- package/lib/eth/bind-options.js.map +1 -1
- package/lib/eth/binds.d.ts +1 -1
- package/lib/eth/binds.js.map +1 -1
- package/lib/eth/codegen/ethers-sentio.js +1 -1
- package/lib/eth/codegen/ethers-sentio.js.map +1 -1
- package/lib/eth/context.d.ts +1 -1
- package/lib/eth/context.js.map +1 -1
- package/lib/eth/eth-plugin.js +1 -1
- package/lib/eth/eth-plugin.js.map +1 -1
- package/lib/eth/index.d.ts +1 -1
- package/lib/eth/index.js +1 -1
- package/lib/eth/index.js.map +1 -1
- package/lib/eth/provider.d.ts +1 -1
- package/lib/eth/provider.js +1 -1
- package/lib/eth/provider.js.map +1 -1
- package/lib/eth/provider.test.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/solana/solana-context.d.ts +1 -1
- package/lib/solana/solana-context.js +1 -1
- package/lib/solana/solana-context.js.map +1 -1
- package/lib/solana/solana-options.d.ts +1 -1
- package/lib/solana/solana-options.js.map +1 -1
- package/lib/solana/solana-processor.d.ts +1 -1
- package/lib/solana/solana-processor.js +1 -1
- package/lib/solana/solana-processor.js.map +1 -1
- package/lib/sui/context.d.ts +2 -2
- package/lib/sui/ext/coin.js +1 -1
- package/lib/sui/ext/coin.js.map +1 -1
- package/lib/sui/network.d.ts +1 -1
- package/lib/sui/network.js +1 -1
- package/lib/sui/network.js.map +1 -1
- package/lib/sui/sui-plugin.js +1 -1
- package/lib/sui/sui-plugin.js.map +1 -1
- package/lib/sui/sui-processor.js +11 -1
- package/lib/sui/sui-processor.js.map +1 -1
- package/lib/testing/eth-facet.d.ts +1 -1
- package/lib/testing/eth-facet.js +1 -1
- package/lib/testing/eth-facet.js.map +1 -1
- package/lib/testing/test-processor-server.js +1 -1
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/testing/test-provider.js +1 -1
- package/lib/testing/test-provider.js.map +1 -1
- package/lib/utils/dex-price.d.ts +1 -1
- package/lib/utils/dex-price.js +1 -1
- package/lib/utils/dex-price.js.map +1 -1
- package/lib/utils/erc20.test.js.map +1 -1
- package/lib/utils/price.d.ts +1 -1
- package/lib/utils/price.js.map +1 -1
- package/package.json +5 -4
- package/src/aptos/ext/coin.ts +1 -1
- package/src/aptos/network.ts +1 -1
- package/src/core/base-context.ts +1 -1
- package/src/core/yaml-contract-config.ts +1 -1
- package/src/eth/account-processor.ts +1 -1
- package/src/eth/base-processor.ts +1 -1
- package/src/eth/bind-options.ts +1 -1
- package/src/eth/binds.ts +1 -1
- package/src/eth/codegen/ethers-sentio.ts +1 -1
- package/src/eth/context.ts +1 -1
- package/src/eth/eth-plugin.ts +1 -1
- package/src/eth/index.ts +1 -1
- package/src/eth/provider.ts +1 -1
- package/src/index.ts +0 -2
- package/src/solana/solana-context.ts +1 -1
- package/src/solana/solana-options.ts +1 -1
- package/src/solana/solana-processor.ts +1 -1
- package/src/sui/ext/coin.ts +1 -1
- package/src/sui/network.ts +1 -1
- package/src/sui/sui-plugin.ts +1 -1
- package/src/sui/sui-processor.ts +13 -1
- package/src/testing/eth-facet.ts +1 -1
- package/src/testing/test-processor-server.ts +1 -1
- package/src/testing/test-provider.ts +1 -1
- package/src/utils/dex-price.ts +1 -1
- package/src/utils/price.ts +1 -1
- package/lib/core/chain.d.ts +0 -205
- package/lib/core/chain.js +0 -236
- package/lib/core/chain.js.map +0 -1
- package/src/core/chain.ts +0 -236
package/src/core/chain.ts
DELETED
@@ -1,236 +0,0 @@
|
|
1
|
-
// copy from https://github.com/DefiLlama/chainlist/blob/main/constants/chainIds.js
|
2
|
-
// and https://besu.hyperledger.org/en/stable/Concepts/NetworkID-And-ChainID/
|
3
|
-
|
4
|
-
export enum EthChainId {
|
5
|
-
KARDIA = '0',
|
6
|
-
ETHEREUM = '1',
|
7
|
-
EXPANSE = '2',
|
8
|
-
ROPSTEN = '3',
|
9
|
-
RINKEBY = '4',
|
10
|
-
GOERLI = '5',
|
11
|
-
KOTTI = '6',
|
12
|
-
UBIQ = '8',
|
13
|
-
OPTIMISM = '10',
|
14
|
-
SONGBIRD = '19',
|
15
|
-
ELASTOS = '20',
|
16
|
-
CRONOS = '25',
|
17
|
-
RSK = '30',
|
18
|
-
TELOS = '40',
|
19
|
-
XDC = '50',
|
20
|
-
CSC = '52',
|
21
|
-
ZYX = '55',
|
22
|
-
BINANCE = '56',
|
23
|
-
SYSCOIN = '57',
|
24
|
-
GOCHAIN = '60',
|
25
|
-
ETHCLASSIC = '61',
|
26
|
-
MORDOR = '63',
|
27
|
-
OKEXCHAIN = '66',
|
28
|
-
HOO = '70',
|
29
|
-
METER = '82',
|
30
|
-
TOMOCHAIN = '88',
|
31
|
-
BINANCE_TEST = '97',
|
32
|
-
XDAI = '100',
|
33
|
-
VELAS = '106',
|
34
|
-
THUNDERCORE = '108',
|
35
|
-
FUSE = '122',
|
36
|
-
HECO = '128',
|
37
|
-
POLYGON = '137',
|
38
|
-
XDAIARB = '200',
|
39
|
-
ASTOR = '212',
|
40
|
-
ENERGYWEB = '246',
|
41
|
-
FANTOM = '250',
|
42
|
-
HPB = '269',
|
43
|
-
BOBA = '288',
|
44
|
-
KUCOIN = '321',
|
45
|
-
ZKSYNC_ERA = '324',
|
46
|
-
SHIDEN = '336',
|
47
|
-
CRONOS_TESTNET = '338',
|
48
|
-
THETA = '361',
|
49
|
-
SX = '416',
|
50
|
-
CANDLE = '534',
|
51
|
-
ASTAR = '592',
|
52
|
-
CALLISTO = '820',
|
53
|
-
WANCHAIN = '888',
|
54
|
-
POLYGON_ZKEVM = '1101',
|
55
|
-
CONFLUX = '1030',
|
56
|
-
METIS = '1088',
|
57
|
-
OMCHAIN = '1246',
|
58
|
-
MOONBEAM = '1284',
|
59
|
-
MOONRIVER = '1285',
|
60
|
-
MOONBASE = '1287',
|
61
|
-
DEV = '2018',
|
62
|
-
RONIN = '2020',
|
63
|
-
KAVA = '2222',
|
64
|
-
EZCHAIN = '2612',
|
65
|
-
PHI = '4181',
|
66
|
-
IOTEX = '4689',
|
67
|
-
XLC = '5050',
|
68
|
-
NAHMII = '5551',
|
69
|
-
NMACTEST = '7777',
|
70
|
-
KLAYTN = '8217',
|
71
|
-
EVMOS = '9001',
|
72
|
-
BASE_GOERLI = '84531',
|
73
|
-
SMARTBCH = '10000',
|
74
|
-
CRYSTALEUM = '103090',
|
75
|
-
FUSION = '32659',
|
76
|
-
ARBITRUM = '42161',
|
77
|
-
CELO = '42220',
|
78
|
-
OASIS = '42262',
|
79
|
-
AVALANCHE = '43114',
|
80
|
-
GODWOKEN = '71402',
|
81
|
-
AKROMA = '200625',
|
82
|
-
POLIS = '333999',
|
83
|
-
ARBITRUM_GOERLI = '421613',
|
84
|
-
SEPOLIA = '11155111',
|
85
|
-
AURORA = '1313161554',
|
86
|
-
HARMONY = '1666600000',
|
87
|
-
PALM = '11297108109',
|
88
|
-
CURIO = '836542336838601',
|
89
|
-
}
|
90
|
-
|
91
|
-
export enum AptosChainId {
|
92
|
-
APTOS_MAINNET = 'aptos_mainnet',
|
93
|
-
APTOS_TESTNET = 'aptos_testnet',
|
94
|
-
APTOS_DEVNET = 'aptos_devnet',
|
95
|
-
}
|
96
|
-
|
97
|
-
export enum SuiChainId {
|
98
|
-
SUI_MAINNET = 'sui_mainnet',
|
99
|
-
SUI_TESTNET = 'sui_testnet',
|
100
|
-
SUI_DEVNET = 'sui_devnet',
|
101
|
-
}
|
102
|
-
|
103
|
-
export enum SolanaChainId {
|
104
|
-
SOLANA_MAINNET = 'sol_mainnet',
|
105
|
-
SOLANA_DEVNET = 'sol_devnet',
|
106
|
-
SOLANA_TESTNET = 'sol_testnet',
|
107
|
-
SOLANA_PYTH = 'sol_pyth',
|
108
|
-
}
|
109
|
-
|
110
|
-
export type ChainId = EthChainId | AptosChainId | SuiChainId | SolanaChainId
|
111
|
-
export const ChainId = {
|
112
|
-
...EthChainId,
|
113
|
-
...AptosChainId,
|
114
|
-
...SuiChainId,
|
115
|
-
...SolanaChainId,
|
116
|
-
}
|
117
|
-
|
118
|
-
export const CHAIN_MAP: Record<string, string> = {}
|
119
|
-
|
120
|
-
for (const [key, value] of Object.entries(ChainId)) {
|
121
|
-
if (value === ChainId.POLYGON_ZKEVM) {
|
122
|
-
CHAIN_MAP[value] = 'Polygon zkEVM'
|
123
|
-
} else if (value === ChainId.ZKSYNC_ERA) {
|
124
|
-
CHAIN_MAP[value] = 'zkSync Era'
|
125
|
-
} else {
|
126
|
-
const parts = key.split('_')
|
127
|
-
CHAIN_MAP[value] = parts
|
128
|
-
.map((part, index) => {
|
129
|
-
return part[0] + part.slice(1).toLowerCase()
|
130
|
-
})
|
131
|
-
.join(' ')
|
132
|
-
}
|
133
|
-
}
|
134
|
-
|
135
|
-
export function getChainName(chainId: string | number | null | undefined): string {
|
136
|
-
if (typeof chainId === 'number') {
|
137
|
-
chainId = chainId.toString()
|
138
|
-
}
|
139
|
-
if (chainId) {
|
140
|
-
const name = CHAIN_MAP[chainId]
|
141
|
-
if (name) {
|
142
|
-
return name
|
143
|
-
}
|
144
|
-
}
|
145
|
-
return chainId || ''
|
146
|
-
}
|
147
|
-
|
148
|
-
export function getChainType(chainId?: string | number): string {
|
149
|
-
const id = String(chainId).toLowerCase()
|
150
|
-
if (id.startsWith('sol')) {
|
151
|
-
return 'solana'
|
152
|
-
}
|
153
|
-
if (id.startsWith('sui')) {
|
154
|
-
return 'sui'
|
155
|
-
}
|
156
|
-
if (id.startsWith('apt')) {
|
157
|
-
return 'aptos'
|
158
|
-
}
|
159
|
-
return 'EVM'
|
160
|
-
}
|
161
|
-
|
162
|
-
export function getChainScanUrl(
|
163
|
-
chainId?: string | number,
|
164
|
-
hash?: string,
|
165
|
-
subtype?: 'block' | 'address' | 'transaction'
|
166
|
-
): string | undefined {
|
167
|
-
const chainName = getChainName(chainId)
|
168
|
-
if (chainName === 'Ethereum') {
|
169
|
-
if (subtype === 'block') {
|
170
|
-
return `https://etherscan.io/block/${hash}`
|
171
|
-
} else if (subtype === 'address') {
|
172
|
-
return `https://etherscan.io/address/${hash}`
|
173
|
-
} else {
|
174
|
-
return `https://etherscan.io/tx/${hash}`
|
175
|
-
}
|
176
|
-
}
|
177
|
-
if (chainName === 'Polygon') {
|
178
|
-
if (subtype === 'block') {
|
179
|
-
return `https://polygonscan.com/block/${hash}`
|
180
|
-
} else if (subtype === 'address') {
|
181
|
-
return `https://polygonscan.com/address/${hash}`
|
182
|
-
} else {
|
183
|
-
return `https://polygonscan.com/tx/${hash}`
|
184
|
-
}
|
185
|
-
}
|
186
|
-
if (chainName.startsWith('Aptos ')) {
|
187
|
-
if (subtype === 'block') {
|
188
|
-
return `https://explorer.aptos.io/block/${hash}`
|
189
|
-
} else if (subtype === 'address') {
|
190
|
-
return `https://explorer.aptos.io/account/${hash}`
|
191
|
-
} else {
|
192
|
-
return `https://explorer.aptos.io/txn/${hash}`
|
193
|
-
}
|
194
|
-
}
|
195
|
-
if (chainName.startsWith('Solana ')) {
|
196
|
-
if (subtype === 'block') {
|
197
|
-
return `https://explorer.solana.com/block/${hash}`
|
198
|
-
} else if (subtype === 'address') {
|
199
|
-
return `https://explorer.solana.com/address/${hash}`
|
200
|
-
} else {
|
201
|
-
return `https://explorer.solana.io/tx/${hash}`
|
202
|
-
}
|
203
|
-
}
|
204
|
-
if (chainName.startsWith('Sui ')) {
|
205
|
-
if (subtype === 'block') {
|
206
|
-
return `https://explorer.sui.io/block/${hash}`
|
207
|
-
} else if (subtype === 'address') {
|
208
|
-
return `https://explorer.sui.io/address/${hash}`
|
209
|
-
} else {
|
210
|
-
return `https://explorer.sui.io/transaction/${hash}`
|
211
|
-
}
|
212
|
-
}
|
213
|
-
return undefined
|
214
|
-
}
|
215
|
-
|
216
|
-
export function chainInitialLabel(chainType: string) {
|
217
|
-
switch (chainType) {
|
218
|
-
case 'aptos':
|
219
|
-
return 'Initial start version'
|
220
|
-
case 'sui':
|
221
|
-
return 'Initial start checkpoint'
|
222
|
-
default:
|
223
|
-
return 'Initial start block number'
|
224
|
-
}
|
225
|
-
}
|
226
|
-
|
227
|
-
export function chainBlockLabel(chainType: string) {
|
228
|
-
switch (chainType) {
|
229
|
-
case 'aptos':
|
230
|
-
return 'Version'
|
231
|
-
case 'sui':
|
232
|
-
return 'Checkpoint'
|
233
|
-
default:
|
234
|
-
return 'Block number'
|
235
|
-
}
|
236
|
-
}
|