The goal of this spike is to discover what needs to be true for gitcoin grants to use Web3Modal library for Polygon Checkout. This means moving away from the currently implementation that is hardcoded to work with only MetaMask.
MetaMask injects an Ethereum Provider API via window.ethereum
. This usage should be dropped in favour of Web3Modal and ethereum libraries to perfrom the following operations.
Instantiate Web3Modal with the desired provider options in /web/app/assets/v2/js/wallet.js#initWallet()
. Coinbase Wallet configuration is described here https://github.com/Web3Modal/web3modal/blob/master/docs/providers/coinbasewallet.md
Connect to wallet by calling the connect
function from the Web3Modal
instance.
Initialize web3.js
or ethers.js
with the connected provider from Web3Modal because Web3Modal does not have built-in support for Ethereum interactions. For example with ethers.js
const provider = await web3Modal.connect();
const library = new ethers.providers.Web3Provider(provider);
Switch to Polygon network or add network configuration via ethers.js
or web3.js
if it does not exist in the user's wallet. Replace window.ethereum
usages in the following files
/web/app/assets/v2/js/wallet.js#setupPolygon()
/web/app/assets/v2/js/cart.js#initializeStandardCheckout()
/web/app/assets/v2/js/wallet.js#setupPolygon()
/web/app/assets/v2/js/ingest-missing-contributions.js#ingest()
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing