Skip to content

Commit

Permalink
typing
Browse files Browse the repository at this point in the history
  • Loading branch information
SamueleA committed Feb 13, 2024
1 parent 002f957 commit e42ee79
Show file tree
Hide file tree
Showing 15 changed files with 103 additions and 69 deletions.
2 changes: 1 addition & 1 deletion examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.3.3",
"viem": "^2.0.6",
"viem": "^2.7.8",
"wagmi": "^2.5.7"
},
"devDependencies": {
Expand Down
10 changes: 6 additions & 4 deletions packages/connectors/src/connectors/apple/apple.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';
import type { Wallet } from '@0xsequence/kit'
import { CreateConnectorFn } from 'wagmi'

import { getAppleLogo, getAppleMonochromeLogo } from './AppleLogo'

import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';

export interface AppleOptions extends BaseSequenceConnectorOptions {
}

Expand All @@ -15,7 +17,7 @@ export const apple = (options: AppleOptions) => ({
monochromeLogoLight: getAppleMonochromeLogo({ isDarkMode: false }),
// iconBackground: '#fff',
name: 'Apple',
createConnector: () => {
createConnector: (() => {
const connector = sequenceWallet({
...options,
connect: {
Expand All @@ -27,5 +29,5 @@ export const apple = (options: AppleOptions) => ({
}
});
return connector
}
}) as Wallet
}) as () => CreateConnectorFn<any, any, any>
})
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { coinbaseWallet as coinbaseWalletBase, CoinbaseWalletParameters } from 'wagmi/connectors'
import { Wallet } from '@0xsequence/kit'

import { CreateConnectorFn } from 'wagmi'

import { CoinbaseWalletLogo } from './CoinbaseWalletLogo'

export const coinbaseWallet = (params: CoinbaseWalletParameters) => ({
id: 'coinbase-wallet',
logoDark: CoinbaseWalletLogo,
logoLight: CoinbaseWalletLogo,
name: 'Coinbase Wallet',
createConnector: () => {
createConnector: (() => {
const connector = coinbaseWalletBase({...params});
return connector
}
}) as Wallet
}) as () => CreateConnectorFn<any, any, any>
})
11 changes: 6 additions & 5 deletions packages/connectors/src/connectors/discord/discord.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';
import type { Wallet } from '@0xsequence/kit'
import { CreateConnectorFn } from 'wagmi'

import { getDiscordLogo } from './DiscordLogo'

import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';

export interface DiscordOptions extends BaseSequenceConnectorOptions {
}

Expand All @@ -15,7 +16,7 @@ export const discord = (options: DiscordOptions) => ({
monochromeLogoLight: getDiscordLogo({ isDarkMode: false }),
// iconBackground: '#fff',
name: 'Discord',
createConnector: () => {
createConnector: (() => {
const connector = sequenceWallet({
...options,
connect: {
Expand All @@ -27,5 +28,5 @@ export const discord = (options: DiscordOptions) => ({
}
});
return connector
}
}) as Wallet
}) as () => CreateConnectorFn<any, any, any>
})
11 changes: 6 additions & 5 deletions packages/connectors/src/connectors/email/email.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';
import type { Wallet } from '@0xsequence/kit'
import { CreateConnectorFn } from 'wagmi'

import { getEmailLogo } from './EmailLogo'

import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';

export const EMAIL_CONNECTOR_LOCAL_STORAGE_KEY = '@sequence.kit.connector.email'

export interface EmailOptions extends BaseSequenceConnectorOptions {
Expand All @@ -15,7 +16,7 @@ export const email = (options: EmailOptions) => ({
logoLight: getEmailLogo({ isDarkMode: false }),
// iconBackground: '#fff',
name: 'Email',
createConnector: () => {
createConnector: (() => {
const email = localStorage.getItem(EMAIL_CONNECTOR_LOCAL_STORAGE_KEY)

const connector = sequenceWallet({
Expand All @@ -32,5 +33,5 @@ export const email = (options: EmailOptions) => ({
});

return connector
}
}) as Wallet
}) as () => CreateConnectorFn<any, any, any>
})
11 changes: 6 additions & 5 deletions packages/connectors/src/connectors/facebook/facebook.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';
import { CreateConnectorFn } from 'wagmi'
import type { Wallet } from '@0xsequence/kit'

import { FacebookLogo, getFacebookMonochromeLogo } from './FacebookLogo'
import { sequence } from '0xsequence';

import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';

export interface FacebookOptions extends BaseSequenceConnectorOptions {
}
Expand All @@ -16,7 +17,7 @@ export const facebook = (options: FacebookOptions) => ({
monochromeLogoLight: getFacebookMonochromeLogo({ isDarkMode: false }),
// iconBackground: '#fff',
name: 'Facebook',
createConnector: () => {
createConnector: (() => {
const connector = sequenceWallet({
...options,
connect: {
Expand All @@ -28,5 +29,5 @@ export const facebook = (options: FacebookOptions) => ({
}
});
return connector
}
}) as Wallet
}) as () => CreateConnectorFn<any, any, any>
})
11 changes: 6 additions & 5 deletions packages/connectors/src/connectors/google/google.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';
import type { Wallet } from '@0xsequence/kit'
import { CreateConnectorFn } from 'wagmi'

import { GoogleLogo, getMonochromeGoogleLogo } from './GoogleLogo'

import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';

export interface GoogleOptions extends BaseSequenceConnectorOptions {
}

Expand All @@ -15,7 +16,7 @@ export const google = (options: GoogleOptions) => ({
monochromeLogoLight: getMonochromeGoogleLogo({ isDarkMode: false }),
// iconBackground: '#fff',
name: 'Google',
createConnector: () => {
createConnector: (() => {
const connector = sequenceWallet({
...options,
// @ts-ignore
Expand All @@ -28,5 +29,5 @@ export const google = (options: GoogleOptions) => ({
}
});
return connector
}
}) as Wallet
}) as () => CreateConnectorFn<any, any, any>
})
8 changes: 4 additions & 4 deletions packages/connectors/src/connectors/mock/mock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CreateConnectorFn } from 'wagmi'
import { mock as mockBase, MockParameters } from 'wagmi/connectors'
import type { Wallet } from '@0xsequence/kit'

import { SequenceLogo } from '../sequence/SequenceLogo'

Expand All @@ -10,8 +10,8 @@ export const mock = (options: MockParameters) => ({
logoLight: SequenceLogo,
// iconBackground: '#777',
name: 'Mock',
createConnector: () => {
createConnector: (() => {
const connector = mockBase(options);
return connector
}
}) as Wallet
}) as () => CreateConnectorFn<any, any, any>
})
9 changes: 5 additions & 4 deletions packages/connectors/src/connectors/sequence/sequence.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';
import { CreateConnectorFn } from 'wagmi'
import type { Wallet } from '@0xsequence/kit'

import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';
import { SequenceLogo } from './SequenceLogo'

export interface SequenceOptions extends BaseSequenceConnectorOptions {
Expand All @@ -13,10 +14,10 @@ export const sequence = (options: SequenceOptions) => ({
logoLight: SequenceLogo,
// iconBackground: '#777',
name: 'Sequence',
createConnector: () => {
createConnector: (() => {
const connector = sequenceWallet({
...options,
});
return connector
}
}) as Wallet
}) as CreateConnectorFn<any, any, any>
})
11 changes: 6 additions & 5 deletions packages/connectors/src/connectors/twitch/twitch.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { Wallet } from '@0xsequence/kit'
import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';
import { CreateConnectorFn } from 'wagmi'

import { getTwitchLogo } from './TwitchLogo'

import { sequenceWallet, BaseSequenceConnectorOptions } from '../wagmiConnectors';

export interface TwitchOptions extends BaseSequenceConnectorOptions {
}

Expand All @@ -15,7 +16,7 @@ export const twitch = (options: TwitchOptions) => ({
monochromeLogoLight: getTwitchLogo({ isDarkMode: false }),
// iconBackground: '#fff',
name: 'Twitch',
createConnector: () => {
createConnector: (() => {
const connector = sequenceWallet({
...options,
connect: {
Expand All @@ -27,5 +28,5 @@ export const twitch = (options: TwitchOptions) => ({
}
});
return connector
}
}) as Wallet
}) as () => CreateConnectorFn<any, any, any>
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Wallet } from '@0xsequence/kit'
import { CreateConnectorFn } from 'wagmi'
import { walletConnect as walletConnectbase, WalletConnectParameters } from 'wagmi/connectors'

import { WalletConnectLogo } from './WalletConnectLogo'
Expand All @@ -9,10 +9,10 @@ export const walletConnect = (options: WalletConnectParameters) => ({
logoLight: WalletConnectLogo,
// iconBackground: '#fff',
name: 'Walletconnect',
createConnector: () => {
createConnector: (() => {
const connector = walletConnectbase({
...options,
});
return connector
}
}) as Wallet
}) as () => CreateConnectorFn<any, any, any>
})
1 change: 1 addition & 0 deletions packages/connectors/src/defaultConnectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@ export const getDefaultConnectors = ({
})
])

/* @ts-ignore-next-line */
return connectors
}
2 changes: 1 addition & 1 deletion packages/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"devDependencies": {
"ethers": "5.7.2",
"0xsequence": "^1.8.2",
"viem": "^2.0.6",
"viem": "^2.7.8",
"wagmi": "^2.5.7"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/utils/getKitConnectWallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface WalletField {

export type ExtendedConnector = CreateConnectorFn<any, any, any> & WalletField

export const getKitConnectWallets = (projectAccessKey:string, wallets: Wallet[]) => {
export const getKitConnectWallets = (projectAccessKey:string, wallets: any[]): CreateConnectorFn<any, any, any>[] => {
localStorage.setItem(LocalStorageKey.ProjectAccessKey, projectAccessKey)

const connectors: CreateConnectorFn<any, any, any>[] = []
Expand Down
Loading

0 comments on commit e42ee79

Please sign in to comment.