Skip to content

Commit

Permalink
Merge pull request #18 from Brahma-fi/ft-rabby-support
Browse files Browse the repository at this point in the history
Rabby support
  • Loading branch information
Pradeep-selva committed May 7, 2024
2 parents be8aa1c + a22bfe9 commit 798e326
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "brahma-connect",
"version": "2.0.1",
"version": "2.0.2",
"description": "Chained execution tool for console.brahma.fi",
"main": "index.js",
"repository": "https://github.com/Brahma-fi/brahma-connect.git",
Expand Down
4 changes: 2 additions & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "Brahma Connect",
"description": "Console connection mode for dApp interactions",
"version": "2.0.1",
"version_name": "2.0.1",
"version": "2.0.2",
"version_name": "2.0.2",
"manifest_version": 3,
"icons": {
"16": "favicon.png",
Expand Down
17 changes: 2 additions & 15 deletions src/injection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@ declare let window: Window & {
web3: { currentProvider: InjectedProvider }
}

if (window.ethereum) {
// There is already a provider injected
const descriptor = Object.getOwnPropertyDescriptor(window, 'ethereum')
if (descriptor?.writable === false) {
// We got a problem: The provider is not configurable (most probably Rabby)
alert(
`Disable Rabby by setting it to 'banned' to use Brahma Connect. Switch to an alternative wallet.`
)
}
}

const chainIdEl = document.getElementById('kernel-chain-id')

if (!chainIdEl) throw new Error('Invalid chain ID')
Expand All @@ -24,10 +13,8 @@ const chainId = chainIdEl.innerHTML
// inject bridged ethereum provider
const injectedProvider = new InjectedProvider(chainId)

window.ethereum = injectedProvider
window.web3 = {
currentProvider: injectedProvider,
}
window.ethereum.request = injectedProvider.request
window.web3.currentProvider.request = injectedProvider.request
console.log('injected into', document.title, window.ethereum, window.web3)

// establish message bridge for location requests
Expand Down

0 comments on commit 798e326

Please sign in to comment.