Skip to content

Commit

Permalink
resolve conflcits
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrouid committed Mar 22, 2022
2 parents 908a3d0 + 15a553c commit a51a6fa
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 4 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A single Web3 / Ethereum provider solution for all Wallets

Web3Modal is an easy-to-use library to help developers add support for multiple providers in their apps with a simple customizable configuration.

By default Web3Modal Library supports injected providers like (**Metamask**, **Dapper**, **Gnosis Safe**, **Frame**, Web3 Browsers, etc) and **WalletConnect**, You can also easily configure the library to support **Portis**, **Fortmatic**, **Squarelink**, **Torus**, **Authereum**, **D'CENT Wallet** and **Venly**.
By default Web3Modal Library supports injected providers like (**Metamask**, **Tally**, **Dapper**, **Gnosis Safe**, **Frame**, Web3 Browsers, etc) and **WalletConnect**, You can also easily configure the library to support **Portis**, **Fortmatic**, **Squarelink**, **Torus**, **Authereum**, **D'CENT Wallet** and **Venly**.

## Preview

Expand All @@ -32,6 +32,7 @@ _Open a PR to add your project to the list!_
- [Forever in Ether](https://ineth.net/)
- [Civilization](https://app.civfund.org/)
- [OlympusDAO](https://app.olympusdao.finance/)
- [The Unit](https://app.theunit.one/)
- etc

## Related Efforts
Expand Down Expand Up @@ -79,7 +80,7 @@ const web3 = new Web3(provider);

## Using with [ethers.js](https://github.com/ethers-io/ethers.js/)

```
```js
import { ethers } from "ethers";
import Web3Modal from "web3modal";

Expand All @@ -99,6 +100,37 @@ const provider = new ethers.providers.Web3Provider(instance);
const signer = provider.getSigner();
```

## Using with [Vite](https://github.com/vitejs/vite)

```js
//vite.config.js
import nodePolyfills from 'rollup-plugin-polyfill-node';
const production = process.env.NODE_ENV === 'production';

export default {

plugins: [
// ↓ Needed for development mode
!production && nodePolyfills({
include: ['node_modules/**/*.js', new RegExp('node_modules/.vite/.*js')]
})
],

build: {
rollupOptions: {
plugins: [
// ↓ Needed for build
nodePolyfills()
]
},
// ↓ Needed for build if using WalletConnect and other providers
commonjsOptions: {
transformMixedEsModules: true
}
}
}
```

## Using in vanilla JavaScript

You can use the modal from the old fashioned web page JavaScript as well.
Expand Down
11 changes: 11 additions & 0 deletions docs/providers/boltx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Bolt-X Wallet

1. Set Provider Options

```typescript
const providerOptions = {
boltx: {
package: true
}
};
```
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"ethereum",
"web3modal",
"metamask",
"tally",
"walletconnect",
"portis",
"fortmatic",
Expand Down
12 changes: 12 additions & 0 deletions src/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ export const CHAIN_DATA_LIST: ChainDataList = {
network: "lukso-l15-testnet",
networkId: 23
},
25: {
chainId: 25,
chain: "CRO",
network: "cronos",
networkId: 25
},
30: {
chainId: 30,
chain: "RSK",
Expand Down Expand Up @@ -223,6 +229,12 @@ export const CHAIN_DATA_LIST: ChainDataList = {
network: "hpb",
networkId: 100
},
338: {
chainId: 338,
chain: "CRO",
network: "cronos-testnet",
networkId: 338
},
385: {
chainId: 385,
chain: "CRO",
Expand Down
16 changes: 16 additions & 0 deletions src/providers/connectors/boltx.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const ConnectToBoltX = async () => {
let provider = null;
if (typeof (window as any).boltX !== 'undefined') {
provider = (window as any).boltX.ethereum;
try {
await provider.request({ method: 'eth_requestAccounts' })
} catch (error) {
throw new Error("User Rejected");
}
} else {
throw new Error("BoltX not found");
}
return provider;
};

export default ConnectToBoltX;
2 changes: 2 additions & 0 deletions src/providers/connectors/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import injected from "./injected";
import boltx from "./boltx";
import walletconnect from "./walletconnect";
import portis from "./portis";
import fortmatic from "./fortmatic";
Expand All @@ -16,6 +17,7 @@ import walletlink from "./walletlink";
export {
injected,
walletconnect,
boltx,
portis,
torus,
fortmatic,
Expand Down
33 changes: 31 additions & 2 deletions src/providers/injected/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import FrameLogo from "../logos/frame.svg";
// @ts-ignore
import LiqualityLogo from "../logos/liquality.png";
// @ts-ignore
import BoltXLogo from "../logos/boltx.svg";
// @ts-ignore
import MathWalletLogo from "../logos/mathwallet.png";
// @ts-ignore
import RWalletLogo from "../logos/rwallet.svg";
Expand All @@ -40,7 +42,10 @@ import XDEFILogo from "../logos/xdefi.svg";
import CeloExtensionWalletLogo from "../logos/celoExtensionWallet.svg";
// @ts-ignore
import BlockWalletLogo from "../logos/blockwallet.svg";

// @ts-ignore
import TallyLogo from "../logos/tally.svg";
// @ts-ignore
import PortalLogo from "../logos/portal.svg";

export const FALLBACK: IProviderInfo = {
id: "injected",
Expand Down Expand Up @@ -154,6 +159,14 @@ export const LIQUALITY: IProviderInfo = {
check: "isLiquality"
};

export const BOLTX: IProviderInfo = {
id: "boltx",
name: "Bolt-X",
logo: BoltXLogo,
type: "injected",
check: "isBoltX"
};

export const MATHWALLET: IProviderInfo = {
id: "injected",
name: "Math Wallet",
Expand Down Expand Up @@ -194,10 +207,26 @@ export const CELOINJECTED: IProviderInfo = {
check: "isCelo"
};

export const blockwallet: IProviderInfo = {
export const BLOCKWALLET: IProviderInfo = {
id: "injected",
name: "BlockWallet",
logo: BlockWalletLogo,
type: "injected",
check: "isBlockWallet"
};

export const TALLYINJECTED: IProviderInfo = {
id: "injected",
name: "Tally",
logo: TallyLogo,
type: "injected",
check: "isTally"
};

export const PORTAL: IProviderInfo = {
id: "injected",
name: "Ripio Portal",
logo: PortalLogo,
type: "injected",
check: "isPortal"
};
Binary file added src/providers/logos/boltx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions src/providers/logos/boltx.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/providers/logos/portal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/providers/logos/tally.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a51a6fa

Please sign in to comment.