Skip to content
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

add: lazy loading modal solana selector #98

Merged
merged 29 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9395c69
add: lazy loading modal solana selector
LukassF Feb 21, 2024
5678d3c
add: fetch all wallets and change type
LukassF Feb 22, 2024
5bab9f5
fix: version
LukassF Feb 22, 2024
bb51fc0
add: solana change event listener and emitter
LukassF Feb 22, 2024
bba5a77
fix: listeners
LukassF Feb 22, 2024
f26cbb6
Merge branch 'main' into solana_selector_lazy
LukassF Feb 22, 2024
bd6a67e
fix; pull main
LukassF Feb 22, 2024
de1f563
fix: decoupling types
LukassF Feb 22, 2024
11fce53
fix: partial and moved getSolanaWalletsList method to dedicated file
LukassF Feb 23, 2024
e012fc4
fix: remove partial
LukassF Feb 23, 2024
ae9b42a
remove redundant imports
LukassF Feb 23, 2024
7cff49a
add: showing error in modal
LukassF Feb 23, 2024
cdd47df
add: polkadot event emitter
LukassF Feb 23, 2024
6f25b32
fix type on connect emit
NorbertBodziony Feb 23, 2024
dad6ed4
fix hooks on connect
NorbertBodziony Feb 23, 2024
492aeb3
fix: modal display error
LukassF Feb 26, 2024
d7ecc4c
fix: linter errors
LukassF Feb 26, 2024
01004bd
fix: hooks in solana selector
LukassF Feb 26, 2024
532d76c
Merge branch 'main' into solana_selector_lazy
LukassF Feb 26, 2024
3024c96
fix: reject rather than throw error
LukassF Feb 26, 2024
0790def
remove: console log
LukassF Feb 26, 2024
cf5764e
add: external modal for solana
LukassF Feb 26, 2024
3bb97c4
fix: added listener to the newly created app when disconnecting
LukassF Feb 27, 2024
44295fb
fix: update wallets list on disconnect
LukassF Feb 27, 2024
262958d
add try catch and remove filter on modal
NorbertBodziony Feb 27, 2024
d4c6d5b
fix solana
NorbertBodziony Feb 27, 2024
8953340
add try catch blocks
LukassF Feb 27, 2024
299798c
fix: polkadot detection
LukassF Feb 27, 2024
64474f3
fix: polkadot detection v2
LukassF Feb 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 7 additions & 21 deletions sdk/bindings/WalletMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { Deeplink } from './Deeplink'
import type { Images } from './Images'
import type { Network } from './Network'
import type { Platform } from './Platform'
import type { Version } from './Version'
import type { WalletType } from './WalletType'
import type { Deeplink } from "./Deeplink";
import type { Images } from "./Images";
import type { Network } from "./Network";
import type { Platform } from "./Platform";
import type { Version } from "./Version";
import type { WalletType } from "./WalletType";

export interface WalletMetadata {
slug: string
name: string
description?: string
homepage?: string
chains?: Array<Network>
version?: Version
walletType: WalletType
mobile: Deeplink | null
desktop: Deeplink | null
image: Images
app?: Record<Platform, string>
injectPath?: Record<Network, string>
lastUpdatedTimestamp?: bigint
}
export interface WalletMetadata { slug: string, name: string, description: string, homepage: string, chains: Array<Network>, version: Version, walletType: WalletType, mobile: Deeplink | null, desktop: Deeplink | null, image: Images, app: Record<Platform, string>, injectPath: Record<Network, string>, lastUpdatedTimestamp: bigint, }
2 changes: 1 addition & 1 deletion sdk/packages/selector-base/src/detection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Wallet, getWallets } from '@wallet-standard/core'
import { WalletMetadata, type IWalletListItem, type MetadataWallet } from './types'
import { type WalletMetadata, type IWalletListItem, type MetadataWallet } from './types'

export const getWalletsList = (
presetList: WalletMetadata[],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we gonna remove this method each selecto will define it for itself

Expand Down
13 changes: 11 additions & 2 deletions sdk/packages/selector-base/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { type AppBaseInitialize } from '@nightlylabs/nightly-connect-base'
import { type Deeplink } from '@nightlylabs/nightly-connect-base/dist/types/bindings/Deeplink'
import { type Wallet } from '@wallet-standard/core'
import { type WalletType } from '../../../bindings/WalletType'
import { type WalletMetadata } from '../../../bindings/WalletMetadata'
export { type WalletMetadata } from '../../../bindings/WalletMetadata'
import { type WalletMetadata as WalletMetadataOriginal } from '../../../bindings/WalletMetadata'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just export this

import { Images } from '../../../bindings/Images'

export interface Adapter {
connect: () => Promise<void>
Expand All @@ -19,6 +19,15 @@ export interface MetadataWallet {
walletType: WalletType
}

export interface WalletMetadata extends Partial<WalletMetadataOriginal> {
slug: string
name: string
walletType: WalletType
mobile: Deeplink | null
desktop: Deeplink | null
image: Images
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WHAT ? remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But wouldnt it then force me to pass all of the fields such as homepage, version, app etc. in for example polkadot selector detection file?
walletsData[wallet.name.toLocaleLowerCase()] = { slug: wallet.name, name: wallet.name, image: { default: wallet.icon as string, sm: wallet.icon as string, md: wallet.icon as string, lg: wallet.icon as string }, desktop: null, mobile: null, recent: recentWalletName === wallet.name, detected: true, injectedWallet: wallet, walletType: 'hybrid' }

export interface IWalletListItem extends WalletMetadata {
recent?: boolean
detected?: boolean
Expand Down
5 changes: 3 additions & 2 deletions sdk/packages/selector-polkadot/src/detection.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { type Injected, type InjectedExtension } from '@polkadot/extension-inject/types'
import { type WalletIcon } from '@wallet-standard/core'
import { appToIcon } from './tempIcons'
import { IWalletListItem } from '@nightlylabs/wallet-selector-base'
import { WalletMetadata } from '@nightlylabs/nightly-connect-polkadot'
export interface PolkadotWalletInjected {
// Default Polkadot standard
Expand Down Expand Up @@ -32,7 +31,9 @@ export const getPolkadotWallets = (): PolkadotWalletInjected[] => {
}
}

export interface IPolkadotWalletListItem extends Omit<IWalletListItem, 'standardWallet'> {
export interface IPolkadotWalletListItem extends WalletMetadata {
recent?: boolean
detected?: boolean
injectedWallet?: PolkadotWalletInjected
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WalletMetadata should be one from bindings
so you almost got it


Expand Down
Loading