Skip to content

Commit 85ba513

Browse files
authored
Merge pull request #158 from argentlabs/feat/argent-webwallet-theme
feat: webwallet connector theme option
2 parents 0135584 + 210a16b commit 85ba513

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

src/connectors/webwallet/helpers/trpc.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ const appRouter = t.router({
6161
}),
6262
connect: t.procedure.mutation(async () => ""),
6363
connectWebwallet: t.procedure
64+
.input(
65+
z.object({
66+
theme: z.enum(["light", "dark", "auto"]).optional(),
67+
}),
68+
)
6469
.output(
6570
z.object({
6671
account: z.string().array().optional(),

src/connectors/webwallet/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,17 @@ import {
2828
import { DEFAULT_WEBWALLET_ICON, DEFAULT_WEBWALLET_URL } from "./constants"
2929
import { openWebwallet } from "./helpers/openWebwallet"
3030
import { setPopupOptions } from "./helpers/trpc"
31-
import type { WebWalletStarknetWindowObject } from "./starknetWindowObject/argentStarknetWindowObject"
31+
import type {
32+
Theme,
33+
WebWalletStarknetWindowObject,
34+
} from "./starknetWindowObject/argentStarknetWindowObject"
3235

3336
let _wallet: StarknetWindowObject | null = null
3437
let _address: string | null = null
3538

3639
interface WebWalletConnectorOptions {
3740
url?: string
41+
theme?: Theme
3842
ssoToken?: string
3943
authorizedPartyId?: string
4044
}
@@ -125,7 +129,7 @@ export class WebWalletConnector extends Connector {
125129
} else {
126130
const connectResponse = await (
127131
this._wallet as WebWalletStarknetWindowObject
128-
).connectWebwallet()
132+
).connectWebwallet({ theme: this._options.theme })
129133
account = connectResponse.account
130134
chainId = connectResponse.chainId
131135
}

src/connectors/webwallet/starknetWindowObject/argentStarknetWindowObject.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,15 @@ export type LoginStatus = {
3333
isPreauthorized?: boolean
3434
}
3535

36+
export type Theme = "light" | "dark"
37+
38+
type ConnectWebwalletProps = {
39+
theme?: Theme
40+
}
41+
3642
export type WebWalletStarknetWindowObject = StarknetWindowObject & {
3743
getLoginStatus(): Promise<LoginStatus>
38-
connectWebwallet(): Promise<{
44+
connectWebwallet(props?: ConnectWebwalletProps): Promise<{
3945
account?: string[]
4046
chainId?: string
4147
}>
@@ -57,8 +63,9 @@ export const getArgentStarknetWindowObject = (
5763
getLoginStatus: () => {
5864
return proxyLink.getLoginStatus.mutate()
5965
},
60-
connectWebwallet: () => {
61-
return proxyLink.connectWebwallet.mutate()
66+
connectWebwallet: (props = {}) => {
67+
const { theme } = props
68+
return proxyLink.connectWebwallet.mutate({ theme })
6269
},
6370
connectWebwalletSSO: (token, authorizedPartyId) => {
6471
return proxyLink.connectWebwalletSSO.mutate({ token, authorizedPartyId })

src/connectors/webwallet/starknetWindowObject/wormhole.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const applyModalStyle = (iframe: HTMLIFrameElement) => {
2020
background.style.left = "0"
2121
background.style.right = "0"
2222
background.style.bottom = "0"
23-
background.style.backgroundColor = "rgba(0, 0, 0, 0.5)"
2423
background.style.zIndex = "99999"
2524
;(background.style as any).backdropFilter = "blur(4px)"
2625

0 commit comments

Comments
 (0)