-
Notifications
You must be signed in to change notification settings - Fork 664
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add kaia wallet * chore: changeset * fix: lint --------- Co-authored-by: Daniel Sinclair <d@niel.nyc>
- Loading branch information
1 parent
f65b5c4
commit 9c36bfd
Showing
7 changed files
with
197 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@rainbow-me/rainbowkit": patch | ||
--- | ||
|
||
Added Kaia Wallet support with `kaiaWallet` wallet connector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions
96
packages/rainbowkit/src/wallets/walletConnectors/kaiaWallet/kaiaWallet.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { DefaultWalletOptions, Wallet } from '../../Wallet'; | ||
import { | ||
getInjectedConnector, | ||
hasInjectedProvider, | ||
} from '../../getInjectedConnector'; | ||
import { getWalletConnectConnector } from '../../getWalletConnectConnector'; | ||
|
||
export type KaiaWalletOptions = DefaultWalletOptions; | ||
|
||
export const kaiaWallet = ({ | ||
projectId, | ||
walletConnectParameters, | ||
}: KaiaWalletOptions): Wallet => { | ||
const isKaiaWalletInjected = hasInjectedProvider({ | ||
namespace: 'klaytn', | ||
}); | ||
|
||
const shouldUseWalletConnect = !isKaiaWalletInjected; | ||
|
||
const getUri = (uri: string) => { | ||
return `kaikas://walletconnect?uri=${encodeURIComponent(uri)}`; | ||
}; | ||
|
||
return { | ||
id: 'kaia', | ||
name: 'Kaia Wallet', | ||
iconUrl: async () => (await import('./kaiaWallet.svg')).default, | ||
installed: isKaiaWalletInjected || undefined, | ||
iconBackground: '#fff', | ||
downloadUrls: { | ||
chrome: | ||
'https://chromewebstore.google.com/detail/kaia-wallet/jblndlipeogpafnldhgmapagcccfchpi', | ||
browserExtension: 'https://app.kaiawallet.io', | ||
qrCode: 'https://app.kaiawallet.io', | ||
ios: 'https://apps.apple.com/us/app/kaia-wallet/id6502896387', | ||
android: 'https://play.google.com/store/apps/details?id=io.klutch.wallet', | ||
mobile: 'https://app.kaiawallet.io', | ||
}, | ||
mobile: { getUri: shouldUseWalletConnect ? getUri : undefined }, | ||
qrCode: shouldUseWalletConnect | ||
? { | ||
getUri: (uri: string) => uri, | ||
instructions: { | ||
learnMoreUrl: 'https://kaiawallet.io', | ||
steps: [ | ||
{ | ||
description: 'wallet_connectors.kaia.qr_code.step1.description', | ||
step: 'install', | ||
title: 'wallet_connectors.kaia.qr_code.step1.title', | ||
}, | ||
{ | ||
description: 'wallet_connectors.kaia.qr_code.step2.description', | ||
step: 'create', | ||
title: 'wallet_connectors.kaia.qr_code.step2.title', | ||
}, | ||
{ | ||
description: 'wallet_connectors.kaia.qr_code.step3.description', | ||
step: 'refresh', | ||
title: 'wallet_connectors.kaia.qr_code.step3.title', | ||
}, | ||
], | ||
}, | ||
} | ||
: undefined, | ||
extension: { | ||
instructions: { | ||
learnMoreUrl: 'https://kaiawallet.io', | ||
steps: [ | ||
{ | ||
description: 'wallet_connectors.kaia.extension.step1.description', | ||
step: 'install', | ||
title: 'wallet_connectors.kaia.extension.step1.title', | ||
}, | ||
{ | ||
description: 'wallet_connectors.kaia.extension.step2.description', | ||
step: 'create', | ||
title: 'wallet_connectors.kaia.extension.step2.title', | ||
}, | ||
{ | ||
description: 'wallet_connectors.kaia.extension.step3.description', | ||
step: 'refresh', | ||
title: 'wallet_connectors.kaia.extension.step3.title', | ||
}, | ||
], | ||
}, | ||
}, | ||
createConnector: shouldUseWalletConnect | ||
? getWalletConnectConnector({ | ||
projectId, | ||
walletConnectParameters, | ||
}) | ||
: getInjectedConnector({ | ||
namespace: 'klaytn', | ||
}), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters