-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from NearSocial/dev
## 1.3.0 - Support `ethers.js` based on NearSocial/viewer#130 - Expose `Ethers` and `ethers` in the global scope. - Add custom `Web3Connect` component that renders Web3 connect/disconnect button. Currently, the API is heavily influenced by Web3Onboard API. - VM now exports `EthersProviderContext` React context type. A gateway that wants to support Ethers.js should wrap the app with `EthersProviderContext.Provider` component with the object value `{provider}`. Provider is Web3 provider that can be used to create an Ethers.js provider. - Fix `initNear` logic to assign provided `config` values on top of the default values, instead of reverse. - Update `near-api-js` dependency to ^2.1.0 - Fix `elliptic` library by doing a lazy `deepClone` when it's first requested a VM instance. - Update VM to reflect `0.10.0` SocialDB changes. NearSocial/social-db#8 - Assume the permission to write is granted by default when `set` is called on the current account. - Use `get_account_storage` to account for the shared storage.
- Loading branch information
Showing
13 changed files
with
691 additions
and
52 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,27 @@ | ||
import React, { useContext } from "react"; | ||
|
||
export const EthersProviderContext = React.createContext(null); | ||
|
||
export const Web3ConnectButton = (props) => { | ||
const ethersProviderContext = useContext(EthersProviderContext); | ||
const [{ wallet, connecting }, connect, disconnect] = | ||
ethersProviderContext?.useConnectWallet | ||
? ethersProviderContext?.useConnectWallet() | ||
: [{}]; | ||
|
||
return ( | ||
<button | ||
className={`btn ${props.className} ${ | ||
connecting || wallet ? "btn-outline-secondary" : "btn-outline-primary" | ||
}`} | ||
disabled={(wallet ? !disconnect : !connect) || connecting} | ||
onClick={() => (wallet ? disconnect?.(wallet) : connect?.())} | ||
> | ||
{connecting | ||
? props.connectingLabel ?? "Connecting" | ||
: wallet | ||
? props.disconnectLabel ?? "Disconnect Web3 Wallet" | ||
: props.connectLabel ?? "Connect Web3 Wallet"} | ||
</button> | ||
); | ||
}; |
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
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
Oops, something went wrong.