Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/add bg cycle deps checker (#2671)
* fix: overview subscribe * Revert "fix: lazy dispatch (#2668)" This reverts commit 2b304d5. * fix: add cycle deps check * Revert "Revert "fix: lazy dispatch (#2668)"" This reverts commit 1313d28. * fix: add eslint rule * fix: lint * fix: cycle deps
- Loading branch information
1 parent
aed9d48
commit 3b0a597
Showing
23 changed files
with
172 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// getNetworkImplFromNetworkId | ||
// getImplFromNetworkId | ||
import { SEPERATOR } from '@onekeyhq/shared/src/engine/engineConsts'; | ||
|
||
export function getNetworkImpl(networkId: string) { | ||
const [impl] = networkId.split(SEPERATOR); | ||
return impl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
packages/engine/src/vaults/factory.createVaultSettings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* eslint-disable new-cap, @typescript-eslint/require-await, @typescript-eslint/no-unsafe-member-access */ | ||
import { | ||
IMPL_ADA, | ||
IMPL_ALGO, | ||
IMPL_APTOS, | ||
IMPL_BCH, | ||
IMPL_BTC, | ||
IMPL_CFX, | ||
IMPL_COSMOS, | ||
IMPL_DOGE, | ||
IMPL_DOT, | ||
IMPL_EVM, | ||
IMPL_FIL, | ||
IMPL_LTC, | ||
IMPL_NEAR, | ||
IMPL_SOL, | ||
IMPL_STC, | ||
IMPL_SUI, | ||
IMPL_TBTC, | ||
IMPL_TRON, | ||
IMPL_XRP, | ||
} from '@onekeyhq/shared/src/engine/engineConsts'; | ||
|
||
import { OneKeyInternalError } from '../errors'; | ||
import { getNetworkImpl } from '../managers/network.utils'; | ||
|
||
import type { IVaultSettings } from './types'; | ||
|
||
export function createVaultSettings(options: { | ||
networkId?: string; | ||
impl?: string; | ||
}): IVaultSettings { | ||
if (!options.impl && !options.networkId) { | ||
throw new Error('networkId and impl require at least one parameter'); | ||
} | ||
let { impl } = options; | ||
if (options.networkId) { | ||
impl = getNetworkImpl(options.networkId); | ||
} | ||
|
||
if (impl === IMPL_EVM) { | ||
return require('./impl/evm/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_NEAR) { | ||
return require('./impl/near/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_CFX) { | ||
return require('./impl/cfx/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_BTC) { | ||
return require('./impl/btc/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_TBTC) { | ||
return require('./impl/tbtc/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_STC) { | ||
return require('./impl/stc/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_SOL) { | ||
return require('./impl/sol/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_TRON) { | ||
return require('./impl/tron/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_APTOS) { | ||
return require('./impl/apt/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_DOGE) { | ||
return require('./impl/doge/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_LTC) { | ||
return require('./impl/ltc/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_ALGO) { | ||
return require('./impl/algo/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_BCH) { | ||
return require('./impl/bch/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_XRP) { | ||
return require('./impl/xrp/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_COSMOS) { | ||
return require('./impl/cosmos/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_ADA) { | ||
return require('./impl/ada/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_SUI) { | ||
return require('./impl/sui/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_FIL) { | ||
return require('./impl/fil/settings').default as IVaultSettings; | ||
} | ||
if (impl === IMPL_DOT) { | ||
return require('./impl/dot/settings').default as IVaultSettings; | ||
} | ||
throw new OneKeyInternalError( | ||
`VaultSettings not found for: networkId=${options.networkId ?? ''}, impl=${ | ||
impl ?? '' | ||
}`, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const TYPE_PREFIX = { | ||
ecdsa: new Uint8Array([2]), | ||
ed25519: new Uint8Array([0]), | ||
ethereum: new Uint8Array([2]), | ||
sr25519: new Uint8Array([1]), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.