-
Notifications
You must be signed in to change notification settings - Fork 10
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 #287 from blocto/develop
docs: batch transaction
- Loading branch information
Showing
47 changed files
with
7,233 additions
and
2,223 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 @@ | ||
--- | ||
'@blocto/sdk': patch | ||
--- | ||
|
||
adjust eth_accounts to not require prior enable |
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,10 @@ | ||
--- | ||
'@blocto/connectkit-connector': patch | ||
'@blocto/rainbowkit-connector': patch | ||
'@blocto/web3-react-connector': patch | ||
'@blocto/web3modal-connector': patch | ||
'@blocto/wagmi-connector': patch | ||
'@blocto/sdk': patch | ||
--- | ||
|
||
Fix export unreconize type for old typescript |
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 @@ | ||
--- | ||
'@blocto/web3-react-connector': patch | ||
--- | ||
|
||
refactor: adjust web3-react-connector's activate method to comply with @blocto/sdk's changes |
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 @@ | ||
--- | ||
'@blocto/dappauth': minor | ||
--- | ||
|
||
restructure @blocto/dappauth and using rollup bundle |
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 @@ | ||
--- | ||
'@blocto/sdk': patch | ||
--- | ||
|
||
AccountChange use addSelfRemovableHandler |
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,8 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: 'yarn' | ||
directory: '/' | ||
schedule: | ||
interval: 'daily' | ||
ignore: | ||
- dependency-name: 'web3' |
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
1,775 changes: 1,538 additions & 237 deletions
1,775
examples/with-evm-blocto-batch-transaction/yarn.lock
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,47 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
|
||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
|
||
/coverage | ||
|
||
# vite | ||
|
||
dist | ||
dist-ssr | ||
|
||
# production | ||
|
||
/build | ||
|
||
# misc | ||
|
||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
\*.pem | ||
*.local | ||
|
||
# debug | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
|
||
.env | ||
.env\*.local | ||
|
||
# vercel | ||
|
||
.vercel | ||
|
||
# typescript | ||
|
||
\*.tsbuildinfo | ||
next-env.d.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 |
---|---|---|
@@ -1,6 +1,19 @@ | ||
# [Create React App](https://github.com/facebook/create-react-app) + [TypeScript](https://www.typescriptlang.org/) + ConnectKit Example | ||
This is a [wagmi](https://wagmi.sh) + [ConnectKit](https://docs.family.co/connectkit) project bootstrapped with [Create React App](https://github.com/facebook/create-react-app), Simultaneously Integrating [Blocto](https://blocto.io) wallet. | ||
|
||
This is a simple example of how to implement ConnectKit with [Create React App](https://github.com/facebook/create-react-app) in TypeScript. | ||
# Getting Started | ||
|
||
- If you'd like to look at an example online, try this [CodeSandbox](https://codesandbox.io/s/5rhqm0?file=/README.md) | ||
- If you want to run the example locally have a look at the [instructions in the main README](https://github.com/family/connectkit/blob/main/README.md#running-examples-locally) | ||
### `npm start` | ||
|
||
Runs the app in the development mode.\ | ||
Open [http://localhost:3000](http://localhost:3000) to view it in your browser. | ||
|
||
The page will reload when you make changes.\ | ||
You may also see any lint errors in the console. | ||
|
||
# Learn more | ||
|
||
To learn more about [ConnectKit](https://docs.family.co/connectkit) or [wagmi](https://wagmi.sh), check out the following resources: | ||
|
||
- [wagmi Documentation](https://wagmi.sh) – learn about wagmi Hooks and API. | ||
- [wagmi Examples](https://wagmi.sh/examples/connect-wallet) – a suite of simple examples using wagmi. | ||
- [ConnectKit Documentation](https://docs.family.co/connectkit) – learn more about ConnectKit (configuration, theming, advanced usage, etc). |
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
import { ConnectKitButton } from 'connectkit'; | ||
import { useAccount } from 'wagmi'; | ||
import SignMessage from './components/SignMessage'; | ||
import SendTransaction from './components/SendTransaction'; | ||
import { useAccount } from 'wagmi' | ||
|
||
function App() { | ||
const { isConnected } = useAccount(); | ||
import { NetworkSwitcher } from './components/NetworkSwitcher' | ||
import { SendTransaction } from './components/SendTransaction' | ||
import { SignMessage } from './components/SignMessage' | ||
import { SignTypedData } from './components/SignTypedData' | ||
import { ConnectKitButton } from 'connectkit' | ||
|
||
export function App() { | ||
const { isConnected } = useAccount() | ||
|
||
return ( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
gap: '10px', | ||
height: '100vh', | ||
}} | ||
> | ||
<> | ||
<h1>wagmi + Connectkit</h1> | ||
|
||
<ConnectKitButton /> | ||
|
||
{isConnected && ( | ||
<> | ||
<hr /> | ||
<h2>Network</h2> | ||
<NetworkSwitcher /> | ||
<br /> | ||
<hr /> | ||
<h2>Send Transaction</h2> | ||
<SendTransaction /> | ||
<br /> | ||
<hr /> | ||
<h2>Sign Message</h2> | ||
<SignMessage /> | ||
<br /> | ||
<hr /> | ||
<h2>Sign Typed Data</h2> | ||
<SignTypedData /> | ||
</> | ||
)} | ||
</div> | ||
); | ||
</> | ||
) | ||
} | ||
|
||
export default App; |
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,32 @@ | ||
import { BaseError } from 'viem' | ||
import { useAccount, useConnect, useDisconnect } from 'wagmi' | ||
|
||
export function Connect() { | ||
const { connector, isConnected } = useAccount() | ||
const { connect, connectors, error, isLoading, pendingConnector } = | ||
useConnect() | ||
const { disconnect } = useDisconnect() | ||
|
||
return ( | ||
<div> | ||
<div> | ||
{isConnected && ( | ||
<button onClick={() => disconnect()}> | ||
Disconnect from {connector?.name} | ||
</button> | ||
)} | ||
|
||
{connectors | ||
.filter((x) => x.ready && x.id !== connector?.id) | ||
.map((x) => ( | ||
<button key={x.id} onClick={() => connect({ connector: x })}> | ||
{x.name} | ||
{isLoading && x.id === pendingConnector?.id && ' (connecting)'} | ||
</button> | ||
))} | ||
</div> | ||
|
||
{error && <div>{(error as BaseError).shortMessage}</div>} | ||
</div> | ||
) | ||
} |
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,8 @@ | ||
import { useAccount } from 'wagmi' | ||
|
||
export function Connected({ children }: { children: React.ReactNode }) { | ||
const { isConnected } = useAccount() | ||
|
||
if (!isConnected) return null | ||
return <>{children}</> | ||
} |
32 changes: 32 additions & 0 deletions
32
examples/with-evm-connectkit/src/components/NetworkSwitcher.tsx
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,32 @@ | ||
import { useNetwork, useSwitchNetwork } from 'wagmi' | ||
|
||
export function NetworkSwitcher() { | ||
const { chain } = useNetwork() | ||
const { chains, error, isLoading, pendingChainId, switchNetwork } = | ||
useSwitchNetwork() | ||
|
||
return ( | ||
<div> | ||
<div> | ||
Connected to {chain?.name ?? chain?.id} | ||
{chain?.unsupported && ' (unsupported)'} | ||
</div> | ||
<br /> | ||
{switchNetwork && ( | ||
<div> | ||
Switch to:{' '} | ||
{chains.map((x) => | ||
x.id === chain?.id ? null : ( | ||
<button key={x.id} onClick={() => switchNetwork(x.id)}> | ||
{x.name} | ||
{isLoading && x.id === pendingChainId && ' (switching)'} | ||
</button> | ||
), | ||
)} | ||
</div> | ||
)} | ||
|
||
<div>{error?.message}</div> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.