Skip to content

Commit dcce623

Browse files
committed
Change wallet.url to settings function
1 parent 4433b5e commit dcce623

File tree

8 files changed

+23
-17
lines changed

8 files changed

+23
-17
lines changed

src/interfaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export interface WalletModule {
8484
}>
8585
type: 'hardware' | 'injected' | 'sdk'
8686
link?: string
87-
url?: string
87+
settings?: () => void
8888
installMessage?: (wallets: {
8989
currentWallet: string | undefined
9090
selectedWallet: string
@@ -130,6 +130,7 @@ export interface Wallet {
130130
type: 'hardware' | 'injected' | 'sdk'
131131
instance?: any
132132
connect?: () => Promise<{ message: string } | undefined>
133+
settings?: () => void
133134
}
134135

135136
export interface CommonWalletOptions {

src/modules/select/wallets/authereum.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import authereumIcon from '../wallet-icons/icon-authereum.png'
2-
import { networkName } from '../../../utilities'
2+
import { networkName, openLink } from '../../../utilities'
33
import {
44
WalletModule,
55
AuthereumOptions,
@@ -31,8 +31,6 @@ function authereum(
3131

3232
const provider = instance.getProvider()
3333

34-
console.log({ instance, provider })
35-
3634
return {
3735
provider,
3836
instance,
@@ -60,9 +58,12 @@ function authereum(
6058
type: 'sdk',
6159
desktop: true,
6260
mobile: true,
63-
url: `https://${
64-
networkId !== 1 ? `${networkName(networkId)}.` : ''
65-
}authereum.com/`,
61+
settings: () =>
62+
openLink(
63+
`https://${
64+
networkId !== 1 ? `${networkName(networkId)}.` : ''
65+
}authereum.com/`
66+
),
6667
preferred
6768
}
6869
}

src/modules/select/wallets/portis.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { networkName } from '../../../utilities'
1+
import { networkName, openLink } from '../../../utilities'
22
import {
33
SdkWalletOptions,
44
WalletModule,
@@ -72,7 +72,7 @@ function portis(options: SdkWalletOptions & CommonWalletOptions): WalletModule {
7272
type: 'sdk',
7373
desktop: true,
7474
mobile: true,
75-
url: 'https://wallet.portis.io/',
75+
settings: () => openLink('https://wallet.portis.io/'),
7676
preferred
7777
}
7878
}

src/modules/select/wallets/squarelink.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { networkName, networkToId } from '../../../utilities'
1+
import { networkName, networkToId, openLink } from '../../../utilities'
22
import {
33
SdkWalletOptions,
44
CommonWalletOptions,
@@ -67,7 +67,7 @@ function squarelink(
6767
type: 'sdk',
6868
desktop: true,
6969
mobile: true,
70-
url: 'https://app.squarelink.com/',
70+
settings: () => openLink('https://app.squarelink.com/'),
7171
preferred
7272
}
7373
}

src/modules/select/wallets/torus.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { networkName } from '../../../utilities'
1+
import { networkName, openLink } from '../../../utilities'
22
import {
33
TorusOptions,
44
CommonWalletOptions,
@@ -83,7 +83,7 @@ function torus(options: TorusOptions & CommonWalletOptions): WalletModule {
8383
type: 'sdk',
8484
desktop: true,
8585
mobile: true,
86-
url: 'https://app.tor.us/',
86+
settings: () => openLink('https://app.tor.us/'),
8787
preferred
8888
}
8989
}

src/stores.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const wallet: WritableStore = writable({
5151
provider: null,
5252
connect: null,
5353
instance: null,
54-
url: null,
54+
settings: null,
5555
type: null
5656
})
5757

@@ -119,7 +119,7 @@ export function resetWalletState(options?: {
119119
provider: undefined,
120120
connect: undefined,
121121
instance: undefined,
122-
url: undefined
122+
settings: undefined
123123
}))
124124

125125
currentInterface.disconnect && currentInterface.disconnect()
@@ -136,7 +136,7 @@ export function resetWalletState(options?: {
136136
provider: undefined,
137137
connect: undefined,
138138
instance: undefined,
139-
url: undefined
139+
settings: undefined
140140
}))
141141

142142
!disconnected &&

src/utilities.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,7 @@ export function createInterval(func: any, interval: number) {
283283
}
284284
}
285285
}
286+
287+
export function openLink(url: string) {
288+
window.open(url)
289+
}

src/views/WalletSelect.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
wallet.set({
176176
provider,
177177
instance,
178-
url: module.url,
178+
settings: module.settings,
179179
name: module.name,
180180
connect: selectedWalletInterface.connect,
181181
type: module.type

0 commit comments

Comments
 (0)