Skip to content

Commit

Permalink
Adding immutable to default connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
corbanbrook authored and SamueleA committed Nov 7, 2024
1 parent 3bb6bba commit 2519401
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/connectors/src/connectors/immutable/immutable.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Wallet } from '@0xsequence/kit'

import { immutableConnector, BaseSequenceConnectorOptions } from '../wagmiConnectors'
import { immutableConnector } from '../wagmiConnectors'

import { ImmutableLogo } from './ImmutableLogo'

export interface ImmutableOptions extends BaseSequenceConnectorOptions {}
export interface ImmutableOptions {}

export const immutable = (options: ImmutableOptions): Wallet => ({
id: 'immutable',
Expand Down
155 changes: 155 additions & 0 deletions packages/connectors/src/defaultConnectors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
import { getKitConnectWallets } from '@0xsequence/kit'
import { CreateConnectorFn } from 'wagmi'

import { apple } from './connectors/apple'
import { appleWaas } from './connectors/apple/appleWaas'
import { coinbaseWallet } from './connectors/coinbaseWallet'
import { email } from './connectors/email'
import { emailWaas } from './connectors/email/emailWaas'
import { facebook } from './connectors/facebook'
import { google } from './connectors/google'
import { googleWaas } from './connectors/google/googleWaas'
import { immutable } from './connectors/immutable'
import { metamask } from './connectors/metamask'
import { sequence } from './connectors/sequence'
import { twitch } from './connectors/twitch'
import { walletConnect } from './connectors/walletConnect'

interface GetDefaultConnectors {
walletConnectProjectId: string
projectAccessKey: string
appName: string
defaultChainId?: number
}

export const getDefaultConnectors = ({
walletConnectProjectId,
defaultChainId,
projectAccessKey,
appName
}: GetDefaultConnectors): CreateConnectorFn[] => {
const connectors = getKitConnectWallets(projectAccessKey, [
immutable({}),
email({
defaultNetwork: defaultChainId,
connect: {
app: appName
}
}),
google({
defaultNetwork: defaultChainId,
connect: {
app: appName
}
}),
facebook({
defaultNetwork: defaultChainId,
connect: {
app: appName
}
}),
twitch({
defaultNetwork: defaultChainId,
connect: {
app: appName
}
}),
apple({
defaultNetwork: defaultChainId,
connect: {
app: appName
}
}),
sequence({
defaultNetwork: defaultChainId,
connect: {
app: appName
}
}),
walletConnect({
projectId: walletConnectProjectId
}),
metamask()
// coinbaseWallet({
// appName
// })
])

return connectors
}

interface GetDefaultWaasConnectors {
projectAccessKey: string
waasConfigKey: string
googleClientId?: string
appleClientId?: string
appleRedirectURI?: string

walletConnectProjectId: string

appName: string
defaultChainId?: number

enableConfirmationModal?: boolean

isDev?: boolean
}

export const getDefaultWaasConnectors = ({
projectAccessKey,
waasConfigKey,
googleClientId,
appleClientId,
appleRedirectURI,
walletConnectProjectId,
appName,
defaultChainId,
enableConfirmationModal,
isDev = false
}: GetDefaultWaasConnectors): CreateConnectorFn[] => {
const wallets: any[] = [
emailWaas({
projectAccessKey,
waasConfigKey,
enableConfirmationModal,
network: defaultChainId,
isDev
}),
coinbaseWallet({
appName
}),
metamask(),
walletConnect({
projectId: walletConnectProjectId
})
]
if (googleClientId) {
wallets.push(
googleWaas({
projectAccessKey,
googleClientId,
waasConfigKey,
enableConfirmationModal,
network: defaultChainId,
isDev
})
)
}
if (appleClientId && appleRedirectURI) {
wallets.push(
appleWaas({
projectAccessKey,
appleClientId,
appleRedirectURI,
waasConfigKey,
enableConfirmationModal,
network: defaultChainId,
isDev
})
)
}

const connectors = getKitConnectWallets(projectAccessKey, wallets)

return connectors
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ export interface BaseImmutableConnectorOptions {}
immutableConnector.type = 'immutable' as const

export function immutableConnector(params: BaseImmutableConnectorOptions) {
type Provider = undefined
type Provider = any
type Properties = {
params: BaseImmutableConnectorOptions
setEmail: (email: string) => void
}
type StorageItem = {}

let provider = undefined
let provider: any = undefined

return createConnector<Provider, Properties, StorageItem>(config => ({
id: 'immutable',
Expand All @@ -26,6 +25,8 @@ export function immutableConnector(params: BaseImmutableConnectorOptions) {

async connect() {
const provider = await this.getProvider()

return { accounts: [], chainId: 1 }
},

async disconnect() {
Expand All @@ -46,7 +47,7 @@ export function immutableConnector(params: BaseImmutableConnectorOptions) {
}

// return the immutable passport provider
provider = undefined
provider = {}
},

async isAuthorized() {
Expand Down

0 comments on commit 2519401

Please sign in to comment.