@ledgerhq/coin-evm 9.0.1 → 10.1.0
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/.oxlintrc.json +2 -6
- package/CHANGELOG.md +18 -0
- package/lib/abis/index.d.ts +8 -0
- package/lib/abis/index.d.ts.map +1 -1
- package/lib/abis/index.js +30 -0
- package/lib/abis/index.js.map +1 -1
- package/lib/adapters/blockOperations.js +2 -2
- package/lib/adapters/blockOperations.js.map +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +2 -1
- package/lib/api/index.js.map +1 -1
- package/lib/internalTxSources.d.ts.map +1 -1
- package/lib/internalTxSources.js +21 -3
- package/lib/internalTxSources.js.map +1 -1
- package/lib/logic/common.d.ts.map +1 -1
- package/lib/logic/common.js +11 -3
- package/lib/logic/common.js.map +1 -1
- package/lib/logic/craftTransaction.d.ts.map +1 -1
- package/lib/logic/craftTransaction.js +4 -1
- package/lib/logic/craftTransaction.js.map +1 -1
- package/lib/logic/estimateFees.d.ts.map +1 -1
- package/lib/logic/estimateFees.js +4 -2
- package/lib/logic/estimateFees.js.map +1 -1
- package/lib/logic/getBalance.js +1 -1
- package/lib/logic/getBalance.js.map +1 -1
- package/lib/logic/internalTransactionsFetcher.js +2 -2
- package/lib/logic/internalTransactionsFetcher.js.map +1 -1
- package/lib/logic/listOperations.js +1 -1
- package/lib/logic/listOperations.js.map +1 -1
- package/lib/logic/predicates.d.ts +17 -0
- package/lib/logic/predicates.d.ts.map +1 -0
- package/lib/logic/predicates.js +126 -0
- package/lib/logic/predicates.js.map +1 -0
- package/lib/logic/validateIntent.d.ts.map +1 -1
- package/lib/logic/validateIntent.js +4 -6
- package/lib/logic/validateIntent.js.map +1 -1
- package/lib/network/explorer/index.d.ts +1 -1
- package/lib/network/explorer/index.d.ts.map +1 -1
- package/lib/network/explorer/index.js +2 -2
- package/lib/network/explorer/index.js.map +1 -1
- package/lib/network/explorer/ledger.js +3 -3
- package/lib/network/explorer/ledger.js.map +1 -1
- package/lib/network/explorer/types.d.ts.map +1 -1
- package/lib/network/explorer/types.js +11 -1
- package/lib/network/explorer/types.js.map +1 -1
- package/lib/network/gasTracker/ledger.d.ts +1 -2
- package/lib/network/gasTracker/ledger.d.ts.map +1 -1
- package/lib/network/gasTracker/ledger.js +3 -5
- package/lib/network/gasTracker/ledger.js.map +1 -1
- package/lib/network/gasTracker/types.d.ts +1 -2
- package/lib/network/gasTracker/types.d.ts.map +1 -1
- package/lib/network/gasTracker/types.js.map +1 -1
- package/lib/network/node/explorerProxy.d.ts.map +1 -1
- package/lib/network/node/explorerProxy.js +10 -5
- package/lib/network/node/explorerProxy.js.map +1 -1
- package/lib/network/node/gethCallTracerToTraceBlockItems.d.ts.map +1 -1
- package/lib/network/node/gethCallTracerToTraceBlockItems.js +10 -12
- package/lib/network/node/gethCallTracerToTraceBlockItems.js.map +1 -1
- package/lib/network/node/index.js +1 -1
- package/lib/network/node/index.js.map +1 -1
- package/lib/network/node/ledger.d.ts.map +1 -1
- package/lib/network/node/ledger.js +11 -7
- package/lib/network/node/ledger.js.map +1 -1
- package/lib/network/node/rpc.common.d.ts.map +1 -1
- package/lib/network/node/rpc.common.js +60 -70
- package/lib/network/node/rpc.common.js.map +1 -1
- package/lib/network/node/types.d.ts +6 -7
- package/lib/network/node/types.d.ts.map +1 -1
- package/lib/network/node/types.js +0 -27
- package/lib/network/node/types.js.map +1 -1
- package/lib/nodeSources.d.ts.map +1 -1
- package/lib/nodeSources.js +11 -3
- package/lib/nodeSources.js.map +1 -1
- package/lib/staking/contracts.d.ts.map +1 -1
- package/lib/staking/contracts.js +1 -3
- package/lib/staking/contracts.js.map +1 -1
- package/lib/staking/detectOperationType.d.ts +0 -3
- package/lib/staking/detectOperationType.d.ts.map +1 -1
- package/lib/staking/detectOperationType.js +15 -14
- package/lib/staking/detectOperationType.js.map +1 -1
- package/lib/staking/fetchers.d.ts.map +1 -1
- package/lib/staking/fetchers.js +2 -3
- package/lib/staking/fetchers.js.map +1 -1
- package/lib/staking/operations/index.d.ts.map +1 -1
- package/lib/staking/operations/index.js +18 -1
- package/lib/staking/operations/index.js.map +1 -1
- package/lib/staking/prepareIntents.d.ts.map +1 -1
- package/lib/staking/prepareIntents.js +4 -3
- package/lib/staking/prepareIntents.js.map +1 -1
- package/lib/staking/redelegations.d.ts.map +1 -1
- package/lib/staking/redelegations.js +4 -7
- package/lib/staking/redelegations.js.map +1 -1
- package/lib/staking/unbondings.d.ts.map +1 -1
- package/lib/staking/unbondings.js +3 -4
- package/lib/staking/unbondings.js.map +1 -1
- package/lib/staking/utils.d.ts.map +1 -1
- package/lib/staking/utils.js +22 -27
- package/lib/staking/utils.js.map +1 -1
- package/lib/staking/validators/monad.d.ts.map +1 -1
- package/lib/staking/validators/monad.js +16 -8
- package/lib/staking/validators/monad.js.map +1 -1
- package/lib/staking/validators/monadResolver.d.ts.map +1 -1
- package/lib/staking/validators/monadResolver.js +4 -3
- package/lib/staking/validators/monadResolver.js.map +1 -1
- package/lib/staking/validators/somnia.js +5 -5
- package/lib/staking/validators/somnia.js.map +1 -1
- package/lib/staking/validators/zero_gravity.js +5 -5
- package/lib/staking/validators/zero_gravity.js.map +1 -1
- package/lib-es/abis/index.d.ts +8 -0
- package/lib-es/abis/index.d.ts.map +1 -1
- package/lib-es/abis/index.js +29 -0
- package/lib-es/abis/index.js.map +1 -1
- package/lib-es/adapters/blockOperations.js +1 -1
- package/lib-es/adapters/blockOperations.js.map +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +2 -1
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/internalTxSources.d.ts.map +1 -1
- package/lib-es/internalTxSources.js +21 -3
- package/lib-es/internalTxSources.js.map +1 -1
- package/lib-es/logic/common.d.ts.map +1 -1
- package/lib-es/logic/common.js +11 -3
- package/lib-es/logic/common.js.map +1 -1
- package/lib-es/logic/craftTransaction.d.ts.map +1 -1
- package/lib-es/logic/craftTransaction.js +4 -1
- package/lib-es/logic/craftTransaction.js.map +1 -1
- package/lib-es/logic/estimateFees.d.ts.map +1 -1
- package/lib-es/logic/estimateFees.js +4 -2
- package/lib-es/logic/estimateFees.js.map +1 -1
- package/lib-es/logic/getBalance.js +1 -1
- package/lib-es/logic/getBalance.js.map +1 -1
- package/lib-es/logic/internalTransactionsFetcher.js +2 -2
- package/lib-es/logic/internalTransactionsFetcher.js.map +1 -1
- package/lib-es/logic/listOperations.js +1 -1
- package/lib-es/logic/listOperations.js.map +1 -1
- package/lib-es/logic/predicates.d.ts +17 -0
- package/lib-es/logic/predicates.d.ts.map +1 -0
- package/lib-es/logic/predicates.js +114 -0
- package/lib-es/logic/predicates.js.map +1 -0
- package/lib-es/logic/validateIntent.d.ts.map +1 -1
- package/lib-es/logic/validateIntent.js +4 -6
- package/lib-es/logic/validateIntent.js.map +1 -1
- package/lib-es/network/explorer/index.d.ts +1 -1
- package/lib-es/network/explorer/index.d.ts.map +1 -1
- package/lib-es/network/explorer/index.js +2 -2
- package/lib-es/network/explorer/index.js.map +1 -1
- package/lib-es/network/explorer/ledger.js +3 -3
- package/lib-es/network/explorer/ledger.js.map +1 -1
- package/lib-es/network/explorer/types.d.ts.map +1 -1
- package/lib-es/network/explorer/types.js +11 -1
- package/lib-es/network/explorer/types.js.map +1 -1
- package/lib-es/network/gasTracker/ledger.d.ts +1 -2
- package/lib-es/network/gasTracker/ledger.d.ts.map +1 -1
- package/lib-es/network/gasTracker/ledger.js +3 -5
- package/lib-es/network/gasTracker/ledger.js.map +1 -1
- package/lib-es/network/gasTracker/types.d.ts +1 -2
- package/lib-es/network/gasTracker/types.d.ts.map +1 -1
- package/lib-es/network/gasTracker/types.js.map +1 -1
- package/lib-es/network/node/explorerProxy.d.ts.map +1 -1
- package/lib-es/network/node/explorerProxy.js +10 -5
- package/lib-es/network/node/explorerProxy.js.map +1 -1
- package/lib-es/network/node/gethCallTracerToTraceBlockItems.d.ts.map +1 -1
- package/lib-es/network/node/gethCallTracerToTraceBlockItems.js +4 -6
- package/lib-es/network/node/gethCallTracerToTraceBlockItems.js.map +1 -1
- package/lib-es/network/node/index.js +1 -1
- package/lib-es/network/node/index.js.map +1 -1
- package/lib-es/network/node/ledger.d.ts.map +1 -1
- package/lib-es/network/node/ledger.js +11 -7
- package/lib-es/network/node/ledger.js.map +1 -1
- package/lib-es/network/node/rpc.common.d.ts.map +1 -1
- package/lib-es/network/node/rpc.common.js +58 -68
- package/lib-es/network/node/rpc.common.js.map +1 -1
- package/lib-es/network/node/types.d.ts +6 -7
- package/lib-es/network/node/types.d.ts.map +1 -1
- package/lib-es/network/node/types.js +0 -25
- package/lib-es/network/node/types.js.map +1 -1
- package/lib-es/nodeSources.d.ts.map +1 -1
- package/lib-es/nodeSources.js +11 -3
- package/lib-es/nodeSources.js.map +1 -1
- package/lib-es/staking/contracts.d.ts.map +1 -1
- package/lib-es/staking/contracts.js +1 -3
- package/lib-es/staking/contracts.js.map +1 -1
- package/lib-es/staking/detectOperationType.d.ts +0 -3
- package/lib-es/staking/detectOperationType.d.ts.map +1 -1
- package/lib-es/staking/detectOperationType.js +15 -14
- package/lib-es/staking/detectOperationType.js.map +1 -1
- package/lib-es/staking/fetchers.d.ts.map +1 -1
- package/lib-es/staking/fetchers.js +2 -3
- package/lib-es/staking/fetchers.js.map +1 -1
- package/lib-es/staking/operations/index.d.ts.map +1 -1
- package/lib-es/staking/operations/index.js +18 -1
- package/lib-es/staking/operations/index.js.map +1 -1
- package/lib-es/staking/prepareIntents.d.ts.map +1 -1
- package/lib-es/staking/prepareIntents.js +2 -1
- package/lib-es/staking/prepareIntents.js.map +1 -1
- package/lib-es/staking/redelegations.d.ts.map +1 -1
- package/lib-es/staking/redelegations.js +1 -4
- package/lib-es/staking/redelegations.js.map +1 -1
- package/lib-es/staking/unbondings.d.ts.map +1 -1
- package/lib-es/staking/unbondings.js +3 -4
- package/lib-es/staking/unbondings.js.map +1 -1
- package/lib-es/staking/utils.d.ts.map +1 -1
- package/lib-es/staking/utils.js +20 -25
- package/lib-es/staking/utils.js.map +1 -1
- package/lib-es/staking/validators/monad.d.ts.map +1 -1
- package/lib-es/staking/validators/monad.js +13 -5
- package/lib-es/staking/validators/monad.js.map +1 -1
- package/lib-es/staking/validators/monadResolver.d.ts.map +1 -1
- package/lib-es/staking/validators/monadResolver.js +2 -1
- package/lib-es/staking/validators/monadResolver.js.map +1 -1
- package/lib-es/staking/validators/somnia.js +3 -3
- package/lib-es/staking/validators/somnia.js.map +1 -1
- package/lib-es/staking/validators/zero_gravity.js +3 -3
- package/lib-es/staking/validators/zero_gravity.js.map +1 -1
- package/package.json +2 -2
- package/src/abis/index.test.ts +36 -0
- package/src/abis/index.ts +30 -0
- package/src/adapters/blockOperations.ts +1 -1
- package/src/api/index.cronos.integ.test.ts +28 -0
- package/src/api/index.integ.test.ts +57 -94
- package/src/api/index.ts +3 -2
- package/src/internalTxSources.ts +20 -3
- package/src/logic/common.ts +13 -3
- package/src/logic/craftTransaction.ts +4 -2
- package/src/logic/estimateFees.ts +4 -3
- package/src/logic/getBalance.ts +1 -1
- package/src/logic/internalTransactionsFetcher.ts +2 -2
- package/src/logic/listOperations.ts +1 -1
- package/src/logic/predicates.ts +124 -0
- package/src/logic/tests/craftTransaction.test.ts +1 -1
- package/src/logic/tests/getStakes.test.ts +1 -0
- package/src/logic/tests/validateIntent.test.ts +4 -1
- package/src/logic/validateIntent.ts +2 -6
- package/src/network/explorer/index.test.ts +9 -16
- package/src/network/explorer/index.ts +2 -2
- package/src/network/explorer/ledger.test.ts +21 -15
- package/src/network/explorer/ledger.ts +3 -3
- package/src/network/explorer/types.ts +12 -3
- package/src/network/gasTracker/ledger.test.ts +0 -10
- package/src/network/gasTracker/ledger.ts +2 -7
- package/src/network/gasTracker/types.ts +0 -2
- package/src/network/node/explorerProxy.ts +11 -8
- package/src/network/node/gethCallTracerToTraceBlockItems.test.ts +1 -1
- package/src/network/node/gethCallTracerToTraceBlockItems.ts +6 -9
- package/src/network/node/index.ts +1 -1
- package/src/network/node/ledger.ts +15 -12
- package/src/network/node/rpc.common.ts +92 -88
- package/src/network/node/rpc.test.ts +119 -0
- package/src/network/node/types.ts +6 -35
- package/src/nodeSources.ts +11 -3
- package/src/staking/contracts.ts +1 -3
- package/src/staking/detectOperationType.ts +15 -14
- package/src/staking/fetchers.ts +2 -3
- package/src/staking/operations/index.test.ts +1 -0
- package/src/staking/operations/index.ts +26 -7
- package/src/staking/prepareIntents.ts +2 -1
- package/src/staking/redelegations.ts +1 -5
- package/src/staking/unbondings.ts +2 -4
- package/src/staking/utils.ts +19 -26
- package/src/staking/validators/monad.test.ts +6 -4
- package/src/staking/validators/monad.ts +12 -5
- package/src/staking/validators/monadResolver.ts +2 -1
- package/src/staking/validators/somnia.test.ts +1 -0
- package/src/staking/validators/somnia.ts +5 -5
- package/src/staking/validators/zero_gravity.test.ts +1 -0
- package/src/staking/validators/zero_gravity.ts +3 -3
- package/lib/logic/evmUnit.d.ts +0 -3
- package/lib/logic/evmUnit.d.ts.map +0 -1
- package/lib/logic/evmUnit.js +0 -94
- package/lib/logic/evmUnit.js.map +0 -1
- package/lib-es/logic/evmUnit.d.ts +0 -3
- package/lib-es/logic/evmUnit.d.ts.map +0 -1
- package/lib-es/logic/evmUnit.js +0 -91
- package/lib-es/logic/evmUnit.js.map +0 -1
- package/src/logic/evmUnit.ts +0 -93
|
@@ -19,18 +19,19 @@ const OP_MAP: Partial<Record<StakingOperation, EvmStakingOperationType>> = {
|
|
|
19
19
|
/**
|
|
20
20
|
* Checks if a string is a valid staking operation
|
|
21
21
|
*/
|
|
22
|
+
const STAKING_OPERATIONS = new Set<string>([
|
|
23
|
+
'delegate',
|
|
24
|
+
'undelegate',
|
|
25
|
+
'redelegate',
|
|
26
|
+
'withdraw',
|
|
27
|
+
'getStakedBalance',
|
|
28
|
+
'getUnstakedBalance',
|
|
29
|
+
'claimReward',
|
|
30
|
+
'compoundReward',
|
|
31
|
+
])
|
|
32
|
+
|
|
22
33
|
export function isStakingOperation(value: string): value is StakingOperation {
|
|
23
|
-
|
|
24
|
-
'delegate',
|
|
25
|
-
'undelegate',
|
|
26
|
-
'redelegate',
|
|
27
|
-
'withdraw',
|
|
28
|
-
'getStakedBalance',
|
|
29
|
-
'getUnstakedBalance',
|
|
30
|
-
'claimReward',
|
|
31
|
-
'compoundReward',
|
|
32
|
-
]
|
|
33
|
-
return stakingOperations.includes(value as StakingOperation)
|
|
34
|
+
return STAKING_OPERATIONS.has(value)
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
type SelectorEntry = {
|
|
@@ -67,8 +68,8 @@ const getStakingEntries = (currencyId: string): Map<string, SelectorEntry> | und
|
|
|
67
68
|
selectorsCache.set(currencyId, entries)
|
|
68
69
|
|
|
69
70
|
for (const [op, fn] of Object.entries(config.functions)) {
|
|
70
|
-
|
|
71
|
-
const mapped = OP_MAP[
|
|
71
|
+
if (!isStakingOperation(op)) continue
|
|
72
|
+
const mapped = OP_MAP[op]
|
|
72
73
|
if (!mapped || !fn) continue
|
|
73
74
|
|
|
74
75
|
try {
|
|
@@ -80,7 +81,7 @@ const getStakingEntries = (currencyId: string): Map<string, SelectorEntry> | und
|
|
|
80
81
|
const signature = `${fn}(${paramTypes})`
|
|
81
82
|
const selector = ethers.id(signature).slice(0, 10).toLowerCase()
|
|
82
83
|
entries.set(selector, {
|
|
83
|
-
resolveAddress: (to) => config.contractAddress({ mode:
|
|
84
|
+
resolveAddress: (to) => config.contractAddress({ mode: op, valAddress: to }),
|
|
84
85
|
opType: mapped,
|
|
85
86
|
})
|
|
86
87
|
} catch {
|
package/src/staking/fetchers.ts
CHANGED
|
@@ -11,7 +11,6 @@ import type {
|
|
|
11
11
|
import type { Stake, Validator } from '@ledgerhq/coin-module-framework/api/types'
|
|
12
12
|
import type { Logger } from '@ledgerhq/coin-module-framework/config'
|
|
13
13
|
import { delay } from '@ledgerhq/coin-module-framework/promises'
|
|
14
|
-
import { evmUnit } from '../logic/evmUnit'
|
|
15
14
|
import { withApi } from '../network/node/rpc.common'
|
|
16
15
|
import { isExternalNodeConfig } from '../network/node/types'
|
|
17
16
|
import { encodeStakingData, decodeStakingResult } from './encoder'
|
|
@@ -175,7 +174,7 @@ const createStakeFromContract = async (
|
|
|
175
174
|
asset: {
|
|
176
175
|
type: 'native',
|
|
177
176
|
name: evmConfig.name,
|
|
178
|
-
unit:
|
|
177
|
+
unit: evmConfig.unit,
|
|
179
178
|
},
|
|
180
179
|
amount,
|
|
181
180
|
actions: [],
|
|
@@ -229,7 +228,7 @@ const getStakesForValidators = async (
|
|
|
229
228
|
logger: Logger
|
|
230
229
|
): Promise<Stake[]> => {
|
|
231
230
|
if (validators.length === 0) {
|
|
232
|
-
console.error('No validators available', {
|
|
231
|
+
console.error('No validators available', { currency: evmConfig.name })
|
|
233
232
|
return []
|
|
234
233
|
}
|
|
235
234
|
|
|
@@ -283,6 +283,7 @@ describe('buildTransactionParams', () => {
|
|
|
283
283
|
|
|
284
284
|
it('should throw error for unsupported operation type', () => {
|
|
285
285
|
expect(() => {
|
|
286
|
+
// @ts-expect-error invalid operation
|
|
286
287
|
buildTransactionParams('sei_evm', 'invalidOperation', {
|
|
287
288
|
valAddress: validatorAddress,
|
|
288
289
|
amount,
|
|
@@ -9,12 +9,31 @@ import seiProtocol from './sei'
|
|
|
9
9
|
import somniaProtocol from './somnia'
|
|
10
10
|
import zeroGravityProtocol from './zero_gravity'
|
|
11
11
|
|
|
12
|
-
const STAKING_PROTOCOLS
|
|
13
|
-
sei_evm: seiProtocol
|
|
14
|
-
celo: celoProtocol
|
|
15
|
-
monad: monadProtocol
|
|
16
|
-
zero_gravity: zeroGravityProtocol
|
|
17
|
-
somnia: somniaProtocol
|
|
12
|
+
const STAKING_PROTOCOLS = {
|
|
13
|
+
sei_evm: seiProtocol,
|
|
14
|
+
celo: celoProtocol,
|
|
15
|
+
monad: monadProtocol,
|
|
16
|
+
zero_gravity: zeroGravityProtocol,
|
|
17
|
+
somnia: somniaProtocol,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function isStakingProtocol(value: object): value is StakingProtocol {
|
|
21
|
+
return Object.values(value).every((entry) => typeof entry === 'function')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function stakingProtocolFor(currencyId: string): StakingProtocol | undefined {
|
|
25
|
+
switch (currencyId) {
|
|
26
|
+
case 'sei_evm':
|
|
27
|
+
case 'celo':
|
|
28
|
+
case 'monad':
|
|
29
|
+
case 'zero_gravity':
|
|
30
|
+
case 'somnia': {
|
|
31
|
+
const protocol = STAKING_PROTOCOLS[currencyId]
|
|
32
|
+
return isStakingProtocol(protocol) ? protocol : undefined
|
|
33
|
+
}
|
|
34
|
+
default:
|
|
35
|
+
return undefined
|
|
36
|
+
}
|
|
18
37
|
}
|
|
19
38
|
|
|
20
39
|
const REQUIRES_VAL_ADDRESS = new Set(['celo', 'sei_evm', 'somnia'])
|
|
@@ -24,7 +43,7 @@ export const buildTransactionParams = (
|
|
|
24
43
|
transactionType: StakingOperation,
|
|
25
44
|
params: OperationParams
|
|
26
45
|
): Array<string | bigint> => {
|
|
27
|
-
const protocol =
|
|
46
|
+
const protocol = stakingProtocolFor(currencyId)
|
|
28
47
|
if (!protocol) {
|
|
29
48
|
throw new Error(`Unsupported staking currency: ${currencyId}`)
|
|
30
49
|
}
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
} from '@ledgerhq/coin-module-framework/api/index'
|
|
10
10
|
import type { Logger } from '@ledgerhq/coin-module-framework/config'
|
|
11
11
|
import { ethers } from 'ethers'
|
|
12
|
+
import { toInterfaceAbi } from '../abis'
|
|
12
13
|
import { isStakingIntent } from '../logic-public'
|
|
13
14
|
import { withApi } from '../network/node/rpc.common'
|
|
14
15
|
import { isExternalNodeConfig } from '../network/node/types'
|
|
@@ -84,7 +85,7 @@ const prepareZeroGravityIntent: IntentPreparer = async (config, currencyId, inte
|
|
|
84
85
|
const node = config.node
|
|
85
86
|
if (!isExternalNodeConfig(node)) return intent
|
|
86
87
|
|
|
87
|
-
const iface = new ethers.Interface(abi
|
|
88
|
+
const iface = new ethers.Interface(toInterfaceAbi(abi))
|
|
88
89
|
const valAddress = intent.valAddress
|
|
89
90
|
const delegator = intent.sender
|
|
90
91
|
|
|
@@ -7,6 +7,7 @@ import type { Logger } from '@ledgerhq/coin-module-framework/config'
|
|
|
7
7
|
import network from '@ledgerhq/live-network'
|
|
8
8
|
import { BigNumber } from 'bignumber.js'
|
|
9
9
|
import { ethers } from 'ethers'
|
|
10
|
+
import { isRecord } from '../logic/predicates'
|
|
10
11
|
import { withApi } from '../network/node/rpc.common'
|
|
11
12
|
import { isExternalNodeConfig } from '../network/node/types'
|
|
12
13
|
import { getStakingABI } from './abis'
|
|
@@ -197,11 +198,6 @@ export async function fetchRedelegations(
|
|
|
197
198
|
|
|
198
199
|
// ─── Operation-derived redelegations ──────────────────────────────────────────
|
|
199
200
|
|
|
200
|
-
/** Type predicate: narrows `unknown` to a plain object record without a cast. */
|
|
201
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
202
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
203
|
-
}
|
|
204
|
-
|
|
205
201
|
/**
|
|
206
202
|
* Fetch raw EVM transaction calldata for a given tx hash directly via the
|
|
207
203
|
* chain's external RPC node. Returns `undefined` when the node is not
|
|
@@ -6,7 +6,6 @@ import type { StakingContractConfig, UnbondingStrategy } from '../types/staking'
|
|
|
6
6
|
import type { Stake } from '@ledgerhq/coin-module-framework/api/types'
|
|
7
7
|
import type { Logger } from '@ledgerhq/coin-module-framework/config'
|
|
8
8
|
import network from '@ledgerhq/live-network'
|
|
9
|
-
import { evmUnit } from '../logic/evmUnit'
|
|
10
9
|
import { isExternalNodeConfig } from '../network/node/types'
|
|
11
10
|
import { STAKING_CONTRACTS } from './contracts'
|
|
12
11
|
import { getCosmosAddr } from './redelegations'
|
|
@@ -34,7 +33,6 @@ async function fetchCosmosRestUnbondings(
|
|
|
34
33
|
evmConfig: EvmConfigInfo,
|
|
35
34
|
config: StakingContractConfig,
|
|
36
35
|
strategy: Extract<UnbondingStrategy, { type: 'cosmos-rest' }>,
|
|
37
|
-
currencyId: string,
|
|
38
36
|
evmAddress: string,
|
|
39
37
|
logger: Logger
|
|
40
38
|
): Promise<Stake[]> {
|
|
@@ -101,7 +99,7 @@ async function fetchCosmosRestUnbondings(
|
|
|
101
99
|
asset: {
|
|
102
100
|
type: 'native',
|
|
103
101
|
name: evmConfig.name,
|
|
104
|
-
unit:
|
|
102
|
+
unit: evmConfig.unit,
|
|
105
103
|
},
|
|
106
104
|
amount,
|
|
107
105
|
actions: [],
|
|
@@ -132,7 +130,7 @@ export async function fetchUnbondings(
|
|
|
132
130
|
|
|
133
131
|
switch (strategy.type) {
|
|
134
132
|
case 'cosmos-rest':
|
|
135
|
-
return fetchCosmosRestUnbondings(evmConfig, config, strategy,
|
|
133
|
+
return fetchCosmosRestUnbondings(evmConfig, config, strategy, evmAddress, logger)
|
|
136
134
|
default:
|
|
137
135
|
return []
|
|
138
136
|
}
|
package/src/staking/utils.ts
CHANGED
|
@@ -3,27 +3,23 @@
|
|
|
3
3
|
|
|
4
4
|
import type { SeiDelegation } from '../types/staking'
|
|
5
5
|
import { safeBigInt } from '../logic-public'
|
|
6
|
-
|
|
7
|
-
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
8
|
-
value !== null && typeof value === 'object'
|
|
6
|
+
import { isBigInt, isRecord, isString } from '../logic/predicates'
|
|
9
7
|
|
|
10
8
|
export const isSeiDelegation = (candidate: unknown): candidate is SeiDelegation => {
|
|
11
9
|
// Plain object format: { balance: { amount, denom }, delegation: { delegator_address, validator_address, ... } }
|
|
12
|
-
if (isRecord(candidate)
|
|
10
|
+
if (isRecord(candidate)) {
|
|
13
11
|
const balance = candidate.balance
|
|
14
12
|
const delegation = candidate.delegation
|
|
15
13
|
return (
|
|
16
14
|
isRecord(balance) &&
|
|
17
|
-
!Array.isArray(balance) &&
|
|
18
15
|
'amount' in balance &&
|
|
19
16
|
'denom' in balance &&
|
|
20
|
-
|
|
17
|
+
isString(balance.denom) &&
|
|
21
18
|
isRecord(delegation) &&
|
|
22
|
-
!Array.isArray(delegation) &&
|
|
23
19
|
'delegator_address' in delegation &&
|
|
24
20
|
'validator_address' in delegation &&
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
isString(delegation.delegator_address) &&
|
|
22
|
+
isString(delegation.validator_address)
|
|
27
23
|
)
|
|
28
24
|
}
|
|
29
25
|
|
|
@@ -35,14 +31,14 @@ export const isSeiDelegation = (candidate: unknown): candidate is SeiDelegation
|
|
|
35
31
|
return (
|
|
36
32
|
Array.isArray(balance) &&
|
|
37
33
|
balance.length === 2 &&
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
isBigInt(balance[0]) && // amount
|
|
35
|
+
isString(balance[1]) && // denom
|
|
40
36
|
Array.isArray(delegation) &&
|
|
41
37
|
delegation.length === 4 &&
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
isString(delegation[0]) && // delegator_address
|
|
39
|
+
isBigInt(delegation[1]) && // shares
|
|
40
|
+
isBigInt(delegation[2]) && // decimals
|
|
41
|
+
isString(delegation[3]) // validator_address
|
|
46
42
|
)
|
|
47
43
|
}
|
|
48
44
|
|
|
@@ -93,26 +89,23 @@ export function parseDecimalIntegerPart(amount: string): bigint {
|
|
|
93
89
|
}
|
|
94
90
|
|
|
95
91
|
function normalizeSeiDelegation(outer: unknown): SeiDelegation | undefined {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const balanceTuple = Array.isArray(outer) ? outer[0] : outer.balance
|
|
99
|
-
if (!isRecord(balanceTuple)) return undefined
|
|
92
|
+
// ethers.Result is array-like: named fields are not visible through `in`, so index into it.
|
|
93
|
+
const balanceTuple = Array.isArray(outer) ? outer[0] : isRecord(outer) ? outer.balance : undefined
|
|
100
94
|
|
|
101
95
|
let amount: unknown
|
|
102
96
|
let denom: unknown
|
|
103
|
-
|
|
104
|
-
if ('amount' in balanceTuple && 'denom' in balanceTuple) {
|
|
105
|
-
amount = balanceTuple.amount
|
|
106
|
-
denom = balanceTuple.denom
|
|
107
|
-
} else if (Array.isArray(balanceTuple) && balanceTuple.length >= 2) {
|
|
97
|
+
if (Array.isArray(balanceTuple) && balanceTuple.length >= 2) {
|
|
108
98
|
amount = balanceTuple[0]
|
|
109
99
|
denom = balanceTuple[1]
|
|
100
|
+
} else if (isRecord(balanceTuple) && 'amount' in balanceTuple && 'denom' in balanceTuple) {
|
|
101
|
+
amount = balanceTuple.amount
|
|
102
|
+
denom = balanceTuple.denom
|
|
110
103
|
} else {
|
|
111
104
|
return undefined
|
|
112
105
|
}
|
|
113
106
|
|
|
114
|
-
if (
|
|
115
|
-
if (
|
|
107
|
+
if (!isString(denom)) return undefined
|
|
108
|
+
if (!isString(amount) && typeof amount !== 'number' && !isBigInt(amount)) {
|
|
116
109
|
return undefined
|
|
117
110
|
}
|
|
118
111
|
|
|
@@ -34,6 +34,7 @@ const mockedNetwork = jest.mocked(network)
|
|
|
34
34
|
const mockConfig = createMockEvmConfigInfo({
|
|
35
35
|
chainId: 10143,
|
|
36
36
|
name: 'Monad',
|
|
37
|
+
unit: { name: 'MON', code: 'MON', magnitude: 18 },
|
|
37
38
|
node: mkExternalNode({ uri: 'https://monad.rpc/' }),
|
|
38
39
|
})
|
|
39
40
|
const ledgerConfig = createMockEvmConfigInfo({ chainId: 10143, node: mkLedgerNode() })
|
|
@@ -69,6 +70,9 @@ type CallHandler = (request: {
|
|
|
69
70
|
data?: string | Uint8Array | null
|
|
70
71
|
}) => Promise<string>
|
|
71
72
|
|
|
73
|
+
const parseCalldata = (data: string | Uint8Array) =>
|
|
74
|
+
monadIface.parseTransaction({ data: ethers.hexlify(data) })
|
|
75
|
+
|
|
72
76
|
const setupRpc = (handler: CallHandler) => {
|
|
73
77
|
const callMock = jest.fn(handler)
|
|
74
78
|
mockedWithApi.mockImplementation(async (_config, _currencyId, fn) => {
|
|
@@ -93,7 +97,7 @@ const routeByName = (responses: {
|
|
|
93
97
|
}): CallHandler => {
|
|
94
98
|
return async ({ data }) => {
|
|
95
99
|
if (!data) throw new Error('missing data')
|
|
96
|
-
const desc =
|
|
100
|
+
const desc = parseCalldata(data)
|
|
97
101
|
if (!desc) throw new Error('could not parse calldata')
|
|
98
102
|
if (desc.name === 'getExecutionValidatorSet') {
|
|
99
103
|
const startIndex: bigint = desc.args[0]
|
|
@@ -492,9 +496,7 @@ describe('staking/validators/monad', () => {
|
|
|
492
496
|
monadIface.encodeFunctionResult('getEpoch', [epoch, false])
|
|
493
497
|
|
|
494
498
|
const callNames = (callMock: ReturnType<typeof setupRpc>): (string | undefined)[] =>
|
|
495
|
-
callMock.mock.calls.map(
|
|
496
|
-
([req]) => monadIface.parseTransaction({ data: req.data ?? '0x' })?.name
|
|
497
|
-
)
|
|
499
|
+
callMock.mock.calls.map(([req]) => parseCalldata(req.data ?? '0x')?.name)
|
|
498
500
|
|
|
499
501
|
it('returns one active stake for a single delegation', async () => {
|
|
500
502
|
setupRpc(
|
|
@@ -18,7 +18,7 @@ import type { JsonRpcProvider } from 'ethers'
|
|
|
18
18
|
import network from '@ledgerhq/live-network'
|
|
19
19
|
import { makeLRUCache } from '@ledgerhq/live-network/cache'
|
|
20
20
|
import { ethers } from 'ethers'
|
|
21
|
-
import {
|
|
21
|
+
import { toInterfaceAbi } from '../../abis'
|
|
22
22
|
import { withApi } from '../../network/node/rpc.common'
|
|
23
23
|
import { isExternalNodeConfig } from '../../network/node/types'
|
|
24
24
|
import { getStakingABI } from '../abis'
|
|
@@ -55,6 +55,13 @@ type ValidatorInfo = { name: string }
|
|
|
55
55
|
* The resolved promise is cached, so a miss is not re-requested; only transient/non-404
|
|
56
56
|
* errors are rethrown so the cache evicts and a later call retries.
|
|
57
57
|
*/
|
|
58
|
+
function responseStatus(error: unknown): number | undefined {
|
|
59
|
+
if (typeof error !== 'object' || error === null || !('response' in error)) return undefined
|
|
60
|
+
const response = error.response
|
|
61
|
+
if (typeof response !== 'object' || response === null || !('status' in response)) return undefined
|
|
62
|
+
return typeof response.status === 'number' ? response.status : undefined
|
|
63
|
+
}
|
|
64
|
+
|
|
58
65
|
const fetchValidatorName = async (
|
|
59
66
|
currencyId: string,
|
|
60
67
|
secp: string,
|
|
@@ -69,7 +76,7 @@ const fetchValidatorName = async (
|
|
|
69
76
|
typeof res?.data?.name === 'string' && res.data.name.trim().length > 0 ? res.data.name : null
|
|
70
77
|
return name
|
|
71
78
|
} catch (error) {
|
|
72
|
-
const status = (error
|
|
79
|
+
const status = responseStatus(error)
|
|
73
80
|
// A 404 just means this validator hasn't published info — cache the miss.
|
|
74
81
|
if (status === 404) return null
|
|
75
82
|
// Anything else is transient: log and rethrow so the cache doesn't pin a miss.
|
|
@@ -145,7 +152,7 @@ const resolveContext = (
|
|
|
145
152
|
|
|
146
153
|
try {
|
|
147
154
|
return {
|
|
148
|
-
abi: abi
|
|
155
|
+
abi: toInterfaceAbi(abi),
|
|
149
156
|
node,
|
|
150
157
|
contractAddress: config.contractAddress(),
|
|
151
158
|
}
|
|
@@ -343,7 +350,7 @@ const fetchStakeForValId = async (
|
|
|
343
350
|
const asset: AssetInfo = {
|
|
344
351
|
type: 'native',
|
|
345
352
|
name: evmConfig.name,
|
|
346
|
-
unit:
|
|
353
|
+
unit: evmConfig.unit,
|
|
347
354
|
}
|
|
348
355
|
const details = {
|
|
349
356
|
contractAddress,
|
|
@@ -403,7 +410,7 @@ export const extractMonadKnownValIds = (
|
|
|
403
410
|
const abi = getStakingABI(currencyId)
|
|
404
411
|
if (!abi) return []
|
|
405
412
|
|
|
406
|
-
const iface = new ethers.Interface(abi
|
|
413
|
+
const iface = new ethers.Interface(toInterfaceAbi(abi))
|
|
407
414
|
const valIds = new Set<string>()
|
|
408
415
|
|
|
409
416
|
for (const op of ops) {
|
|
@@ -5,6 +5,7 @@ import type { EvmConfigInfo } from '../../config'
|
|
|
5
5
|
import type { Logger } from '@ledgerhq/coin-module-framework/config'
|
|
6
6
|
import type { JsonRpcProvider } from 'ethers'
|
|
7
7
|
import { ethers } from 'ethers'
|
|
8
|
+
import { toInterfaceAbi } from '../../abis'
|
|
8
9
|
import { withApi } from '../../network/node/rpc.common'
|
|
9
10
|
import { isExternalNodeConfig } from '../../network/node/types'
|
|
10
11
|
import { getStakingABI } from '../abis'
|
|
@@ -68,7 +69,7 @@ export const getValidatorAddressById = async (
|
|
|
68
69
|
config,
|
|
69
70
|
currencyId,
|
|
70
71
|
async (provider) => {
|
|
71
|
-
const iface = new ethers.Interface(abi
|
|
72
|
+
const iface = new ethers.Interface(toInterfaceAbi(abi))
|
|
72
73
|
const decoded = await callGetValidator(provider, iface, MONAD_PRECOMPILE, valId)
|
|
73
74
|
if (!decoded) return null
|
|
74
75
|
const [, , , , , , , , , , secpPubkey] = decoded
|
|
@@ -28,6 +28,7 @@ const mockConfig = createMockEvmConfigInfo({
|
|
|
28
28
|
chainId: 5031,
|
|
29
29
|
node: mkExternalNode({ uri: 'https://somnia-rpc.publicnode.com' }),
|
|
30
30
|
name: 'Somnia',
|
|
31
|
+
unit: { name: 'SOMI', code: 'SOMI', magnitude: 18 },
|
|
31
32
|
})
|
|
32
33
|
const ledgerConfig = createMockEvmConfigInfo({ chainId: 5031, node: mkLedgerNode() })
|
|
33
34
|
|
|
@@ -11,7 +11,7 @@ import type { JsonRpcProvider } from 'ethers'
|
|
|
11
11
|
import network from '@ledgerhq/live-network'
|
|
12
12
|
import { makeLRUCache } from '@ledgerhq/live-network/cache'
|
|
13
13
|
import { ethers } from 'ethers'
|
|
14
|
-
import {
|
|
14
|
+
import { toInterfaceAbi } from '../../abis'
|
|
15
15
|
import { withApi } from '../../network/node/rpc.common'
|
|
16
16
|
import { isExternalNodeConfig } from '../../network/node/types'
|
|
17
17
|
import { getStakingABI } from '../abis'
|
|
@@ -80,7 +80,7 @@ const resolveContext = (
|
|
|
80
80
|
|
|
81
81
|
try {
|
|
82
82
|
return {
|
|
83
|
-
abi: abi
|
|
83
|
+
abi: toInterfaceAbi(abi),
|
|
84
84
|
node,
|
|
85
85
|
contractAddress: config.contractAddress(),
|
|
86
86
|
}
|
|
@@ -146,7 +146,7 @@ const fetchValidatorDetails = async (
|
|
|
146
146
|
addresses: string[],
|
|
147
147
|
logger: Logger
|
|
148
148
|
): Promise<Validator[]> => {
|
|
149
|
-
const names = await validatorNamesCache(currencyId, logger).catch(() => ({})
|
|
149
|
+
const names = await validatorNamesCache(currencyId, logger).catch((): ValidatorNamesMap => ({}))
|
|
150
150
|
|
|
151
151
|
const items: Validator[] = []
|
|
152
152
|
|
|
@@ -328,13 +328,13 @@ export const fetchSomniaStakes = async (
|
|
|
328
328
|
// Display-name overlay, keyed by lowercased operator address. Best-effort: on failure
|
|
329
329
|
// the delegation still shows, falling back to the raw address as its name.
|
|
330
330
|
const names = await validatorNamesCache(currencyId, logger).catch(
|
|
331
|
-
() => ({})
|
|
331
|
+
(): ValidatorNamesMap => ({})
|
|
332
332
|
)
|
|
333
333
|
|
|
334
334
|
const asset: AssetInfo = {
|
|
335
335
|
type: 'native',
|
|
336
336
|
name: evmConfig.name,
|
|
337
|
-
unit:
|
|
337
|
+
unit: evmConfig.unit,
|
|
338
338
|
}
|
|
339
339
|
const stakes: Stake[] = []
|
|
340
340
|
|
|
@@ -130,6 +130,7 @@ describe('staking/validators/zero_gravity', () => {
|
|
|
130
130
|
const zgConfig = createMockEvmConfigInfo({
|
|
131
131
|
chainId: 16661,
|
|
132
132
|
name: '0G',
|
|
133
|
+
unit: { name: '0G', code: '0G', magnitude: 18 },
|
|
133
134
|
node: mkExternalNode({ uri: 'https://zero-gravity.coin.ledger.com' }),
|
|
134
135
|
})
|
|
135
136
|
const zg0Iface = new ethers.Interface(zeroGravityAbi)
|
|
@@ -10,7 +10,7 @@ import type { Logger } from '@ledgerhq/coin-module-framework/config'
|
|
|
10
10
|
import type { JsonRpcProvider } from 'ethers'
|
|
11
11
|
import network from '@ledgerhq/live-network'
|
|
12
12
|
import { ethers } from 'ethers'
|
|
13
|
-
import {
|
|
13
|
+
import { toInterfaceAbi } from '../../abis'
|
|
14
14
|
import { withApi } from '../../network/node/rpc.common'
|
|
15
15
|
import { isExternalNodeConfig } from '../../network/node/types'
|
|
16
16
|
import { getStakingABI } from '../abis'
|
|
@@ -234,7 +234,7 @@ export const fetchZeroGravityStakes = async (
|
|
|
234
234
|
const asset: AssetInfo = {
|
|
235
235
|
type: 'native',
|
|
236
236
|
name: evmConfig.name,
|
|
237
|
-
unit:
|
|
237
|
+
unit: evmConfig.unit,
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
try {
|
|
@@ -242,7 +242,7 @@ export const fetchZeroGravityStakes = async (
|
|
|
242
242
|
evmConfig,
|
|
243
243
|
currencyId,
|
|
244
244
|
async (provider) => {
|
|
245
|
-
const iface = new ethers.Interface(abi
|
|
245
|
+
const iface = new ethers.Interface(toInterfaceAbi(abi))
|
|
246
246
|
const stakes: Stake[] = []
|
|
247
247
|
const currentBlock = BigInt(await provider.getBlockNumber())
|
|
248
248
|
|
package/lib/logic/evmUnit.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evmUnit.d.ts","sourceRoot":"","sources":["../../src/logic/evmUnit.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2CAA2C,CAAA;AAErE,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAuFxC,CAAA"}
|
package/lib/logic/evmUnit.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.evmUnit = void 0;
|
|
6
|
-
exports.evmUnit = {
|
|
7
|
-
adi: { name: 'ADI', code: 'ADI', magnitude: 18 },
|
|
8
|
-
akroma: { name: 'AKA', code: 'AKA', magnitude: 8 },
|
|
9
|
-
arbitrum: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
10
|
-
arbitrum_sepolia: { name: 'ether', code: 'ETH', magnitude: 18 },
|
|
11
|
-
arc: { name: 'USDC', code: 'USDC', magnitude: 18 },
|
|
12
|
-
arc_testnet: { name: 'USDC', code: 'USDC', magnitude: 18 },
|
|
13
|
-
astar: { name: 'ASTR', code: 'ASTR', magnitude: 18 },
|
|
14
|
-
atheios: { name: 'ATH', code: 'ATH', magnitude: 8 },
|
|
15
|
-
avalanche_c_chain: { name: 'AVAX', code: 'AVAX', magnitude: 18 },
|
|
16
|
-
avalanche_c_chain_fuji: { name: 'AVAX', code: 'AVAX', magnitude: 18 },
|
|
17
|
-
base: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
18
|
-
base_sepolia: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
19
|
-
berachain: { name: 'BERA', code: 'BERA', magnitude: 18 },
|
|
20
|
-
bitlayer: { name: 'BTC', code: 'BTC', magnitude: 18 },
|
|
21
|
-
bittorrent: { name: 'BTT', code: 'BTT', magnitude: 18 },
|
|
22
|
-
blast: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
23
|
-
blast_sepolia: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
24
|
-
boba: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
25
|
-
bsc: { name: 'BNB', code: 'BNB', magnitude: 18 },
|
|
26
|
-
callisto: { name: 'CLO', code: 'CLO', magnitude: 8 },
|
|
27
|
-
celo: { name: 'CELO', code: 'CELO', magnitude: 18 },
|
|
28
|
-
core: { name: 'CORE', code: 'CORE', magnitude: 18 },
|
|
29
|
-
cronos: { name: 'CRO', code: 'CRO', magnitude: 18 },
|
|
30
|
-
dexon: { name: 'dexon', code: 'DXN', magnitude: 6 },
|
|
31
|
-
ellaism: { name: 'ELLA', code: 'ELLA', magnitude: 8 },
|
|
32
|
-
energy_web: { name: 'EWT', code: 'EWT', magnitude: 18 },
|
|
33
|
-
ether1: { name: 'ETHO', code: 'ETHO', magnitude: 18 },
|
|
34
|
-
ethereum: { name: 'ether', code: 'ETH', magnitude: 18 },
|
|
35
|
-
ethereum_classic: { name: 'ETC', code: 'ETC', magnitude: 18 },
|
|
36
|
-
ethereum_hoodi: { name: 'ether', code: 'ETH', magnitude: 18 },
|
|
37
|
-
ethereum_sepolia: { name: 'ether', code: 'ETH', magnitude: 18 },
|
|
38
|
-
ethergem: { name: 'EGEM', code: 'EGEM', magnitude: 18 },
|
|
39
|
-
etherlink: { name: 'XTZ', code: 'XTZ', magnitude: 18 },
|
|
40
|
-
ethersocial: { name: 'ESN', code: 'ESN', magnitude: 18 },
|
|
41
|
-
expanse: { name: 'EXP', code: 'EXP', magnitude: 8 },
|
|
42
|
-
fantom: { name: 'FTM', code: 'FTM', magnitude: 18 },
|
|
43
|
-
flare: { name: 'FLR', code: 'FLR', magnitude: 18 },
|
|
44
|
-
gochain: { name: 'GO', code: 'GO', magnitude: 8 },
|
|
45
|
-
hpb: { name: 'hpb', code: 'HPB', magnitude: 18 },
|
|
46
|
-
hyperevm: { name: 'HYPE', code: 'HYPE', magnitude: 18 },
|
|
47
|
-
klaytn: { name: 'KLAY', code: 'KLAY', magnitude: 18 },
|
|
48
|
-
klaytn_baobab: { name: 'KLAY', code: 'KLAY', magnitude: 18 },
|
|
49
|
-
linea: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
50
|
-
linea_sepolia: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
51
|
-
lukso: { name: 'LYX', code: 'LYX', magnitude: 18 },
|
|
52
|
-
mantle: { name: 'MNT', code: 'MNT', magnitude: 18 },
|
|
53
|
-
mantle_sepolia: { name: 'MNT', code: 'MNT', magnitude: 18 },
|
|
54
|
-
metis: { name: 'METIS', code: 'METIS', magnitude: 18 },
|
|
55
|
-
mix: { name: 'MIX', code: 'MIX', magnitude: 8 },
|
|
56
|
-
monad: { name: 'MON', code: 'MON', magnitude: 18 },
|
|
57
|
-
monad_testnet: { name: 'MON', code: 'MON', magnitude: 18 },
|
|
58
|
-
moonbeam: { name: 'GLMR', code: 'GLMR', magnitude: 18 },
|
|
59
|
-
moonriver: { name: 'MOVR', code: 'MOVR', magnitude: 18 },
|
|
60
|
-
musicoin: { name: 'MUSIC', code: 'MUSIC', magnitude: 8 },
|
|
61
|
-
neon_evm: { name: 'NEON', code: 'NEON', magnitude: 18 },
|
|
62
|
-
optimism: { name: 'ether', code: 'ETH', magnitude: 18 },
|
|
63
|
-
optimism_sepolia: { name: 'ether', code: 'ETH', magnitude: 18 },
|
|
64
|
-
pirl: { name: 'PIRL', code: 'PIRL', magnitude: 8 },
|
|
65
|
-
poa: { name: 'POA', code: 'POA', magnitude: 8 },
|
|
66
|
-
polygon: { name: 'POL', code: 'POL', magnitude: 18 },
|
|
67
|
-
polygon_amoy: { name: 'POL', code: 'POL', magnitude: 18 },
|
|
68
|
-
polygon_zk_evm: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
69
|
-
polygon_zk_evm_testnet: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
70
|
-
reosc: { name: 'REOSC', code: 'REOSC', magnitude: 16 },
|
|
71
|
-
robinhood: { name: 'ether', code: 'ETH', magnitude: 18 },
|
|
72
|
-
robinhood_testnet: { name: 'ether', code: 'ETH', magnitude: 18 },
|
|
73
|
-
rsk: { name: 'RBTC', code: 'RBTC', magnitude: 18 },
|
|
74
|
-
scroll: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
75
|
-
sei_evm: { name: 'SEI', code: 'SEI', magnitude: 18 },
|
|
76
|
-
shape: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
77
|
-
somnia: { name: 'SOMI', code: 'SOMI', magnitude: 18 },
|
|
78
|
-
songbird: { name: 'SGB', code: 'SGB', magnitude: 18 },
|
|
79
|
-
sonic: { name: 'S', code: 'S', magnitude: 18 },
|
|
80
|
-
story: { name: 'IP', code: 'IP', magnitude: 18 },
|
|
81
|
-
syscoin: { name: 'SYS', code: 'SYS', magnitude: 18 },
|
|
82
|
-
telos_evm: { name: 'TLOS', code: 'TLOS', magnitude: 18 },
|
|
83
|
-
thundercore: { name: 'TT', code: 'TT', magnitude: 18 },
|
|
84
|
-
tomo: { name: 'TOMO', code: 'TOMO', magnitude: 18 },
|
|
85
|
-
ubiq: { name: 'ubiq', code: 'UBQ', magnitude: 18 },
|
|
86
|
-
unichain: { name: 'ether', code: 'ETH', magnitude: 18 },
|
|
87
|
-
unichain_sepolia: { name: 'ether', code: 'ETH', magnitude: 18 },
|
|
88
|
-
velas_evm: { name: 'VLX', code: 'VLX', magnitude: 18 },
|
|
89
|
-
wanchain: { name: 'WAN', code: 'WAN', magnitude: 8 },
|
|
90
|
-
zero_gravity: { name: '0G', code: '0G', magnitude: 18 },
|
|
91
|
-
zksync: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
92
|
-
zksync_sepolia: { name: 'ETH', code: 'ETH', magnitude: 18 },
|
|
93
|
-
};
|
|
94
|
-
//# sourceMappingURL=evmUnit.js.map
|
package/lib/logic/evmUnit.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evmUnit.js","sourceRoot":"","sources":["../../src/logic/evmUnit.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,sCAAsC;;;AAIzB,QAAA,OAAO,GAAyB;IAC3C,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;IAChD,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE;IAClD,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;IACrD,gBAAgB,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EA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