-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/required features #324
base: feat/extra-currency
Are you sure you want to change the base?
Changes from 3 commits
e49e7ab
3ba0c46
eec8699
4e2c5b1
24d33df
ee96df4
20b914a
58619ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
node_modules | ||
dist | ||
.idea | ||
.vscode | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,12 +60,7 @@ export class WalletsListManager { | |
public async getEmbeddedWallet(): Promise<WalletInfoCurrentlyEmbedded | null> { | ||
const walletsList = await this.getWallets(); | ||
const embeddedWallets = walletsList.filter(isWalletInfoCurrentlyEmbedded); | ||
|
||
if (embeddedWallets.length !== 1) { | ||
return null; | ||
} | ||
|
||
return embeddedWallets[0]!; | ||
return embeddedWallets.length === 1 ? embeddedWallets[0]! : null; | ||
} | ||
|
||
private async fetchWalletsList(): Promise<WalletInfo[]> { | ||
|
@@ -87,7 +82,7 @@ export class WalletsListManager { | |
if (wrongFormatWallets.length) { | ||
logError( | ||
`Wallet(s) ${wrongFormatWallets | ||
.map(wallet => wallet.name) | ||
.map(wallet => (wallet as WalletInfoDTO)?.name || 'unknown') | ||
.join( | ||
', ' | ||
)} config format is wrong. They were removed from the wallets list.` | ||
|
@@ -115,7 +110,7 @@ export class WalletsListManager { | |
|
||
private walletConfigDTOListToWalletConfigList(walletConfigDTO: WalletInfoDTO[]): WalletInfo[] { | ||
return walletConfigDTO.map(walletConfigDTO => { | ||
const walletConfigBase: WalletInfoBase = { | ||
const walletConfig: WalletInfoBase = { | ||
name: walletConfigDTO.name, | ||
appName: walletConfigDTO.app_name, | ||
imageUrl: walletConfigDTO.image, | ||
|
@@ -124,16 +119,13 @@ export class WalletsListManager { | |
platforms: walletConfigDTO.platforms | ||
}; | ||
|
||
const walletConfig: WalletInfo = walletConfigBase as WalletInfo; | ||
|
||
walletConfigDTO.bridge.forEach(bridge => { | ||
if (bridge.type === 'sse') { | ||
(walletConfig as WalletInfoRemote).bridgeUrl = bridge.url; | ||
(walletConfig as WalletInfoRemote).universalLink = | ||
walletConfigDTO.universal_url!; | ||
(walletConfig as WalletInfoRemote).deepLink = walletConfigDTO.deepLink; | ||
} | ||
|
||
if (bridge.type === 'js') { | ||
const jsBridgeKey = bridge.key; | ||
(walletConfig as WalletInfoInjectable).jsBridgeKey = jsBridgeKey; | ||
|
@@ -143,8 +135,7 @@ export class WalletsListManager { | |
InjectedProvider.isInsideWalletBrowser(jsBridgeKey); | ||
} | ||
}); | ||
|
||
return walletConfig; | ||
return walletConfig as WalletInfo; | ||
}); | ||
} | ||
|
||
|
@@ -209,9 +200,9 @@ export class WalletsListManager { | |
|
||
if (sseBridge) { | ||
if ( | ||
!('url' in sseBridge) || | ||
!(sseBridge && typeof sseBridge === 'object' && 'url' in sseBridge) || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check exception |
||
!(sseBridge as { url: string }).url || | ||
!(value as { universal_url: string }).universal_url | ||
!(value as unknown as { universal_url: string }).universal_url | ||
) { | ||
return false; | ||
} | ||
|
@@ -220,7 +211,11 @@ export class WalletsListManager { | |
const jsBridge = bridge.find(item => (item as { type: string }).type === 'js'); | ||
|
||
if (jsBridge) { | ||
if (!('key' in jsBridge) || !(jsBridge as { key: string }).key) { | ||
if ( | ||
typeof jsBridge !== 'object' || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check exception |
||
!('key' in jsBridge) || | ||
!(jsBridge as { key: string }).key | ||
) { | ||
return false; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove changes in protocolo