Skip to content

Commit d05539d

Browse files
committed
added wagmi-v1 example + viem test
1 parent 3dbff31 commit d05539d

24 files changed

Lines changed: 1798 additions & 87 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This monorepo includes the source code for the following Sapphire packages:
4242
[hardhat-size]: https://img.shields.io/bundlephobia/minzip/@oasisprotocol/sapphire-hardhat
4343
[client-size]: https://img.shields.io/bundlephobia/minzip/@oasisprotocol/sapphire-paratime
4444
[ethers-v6-size]: https://img.shields.io/bundlephobia/minzip/@oasisprotocol/sapphire-ethers-v6
45-
[wagmi-v2-size]: https://img.shields.io/bundlephobia/minzip/@oasisprotocol/sapphire-viem-v2
45+
[viem-v2-size]: https://img.shields.io/bundlephobia/minzip/@oasisprotocol/sapphire-viem-v2
4646
[wagmi-v2-size]: https://img.shields.io/bundlephobia/minzip/@oasisprotocol/sapphire-wagmi-v2
4747

4848
[hardhat-bundlephobia]: https://bundlephobia.com/package/@oasisprotocol/sapphire-hardhat

clients/js/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The format is inspired by [Keep a Changelog].
66

77
[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
88

9-
## 1.3.3 (2024-04-05)
9+
## 2.0.0-alpha.1 (2024-06)
1010

1111
### Added
1212

clients/js/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ then you'll see this error.
5454

5555
**Fix:** The simplest thing to do is connect a provider. Alternatively, you can pass in
5656
a pre-initialized `Cipher` object as the second argument to `wrap`; and then also generate
57-
signed queries manually using the `overrides` parameter to `SignedCallDataPack.make`. This
58-
latter approach
57+
signed queries manually using the `overrides` parameter to `SignedCallDataPack.make`.
5958

6059
## See Also
6160

clients/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"dependencies": {
4545
"@noble/hashes": "1.3.2",
46-
"@oasisprotocol/deoxysii": "0.0.5",
46+
"@oasisprotocol/deoxysii": "0.0.6",
4747
"cborg": "1.10.2"
4848
},
4949
"devDependencies": {

clients/js/scripts/proxy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { createServer, IncomingMessage, ServerResponse } from 'node:http';
22

3-
import { formatEther, getBytes, toBigInt, Transaction } from 'ethers';
3+
import { formatEther, toBigInt, Transaction } from 'ethers';
44

5-
import { Envelope, EnvelopeError } from '@oasisprotocol/sapphire-paratime';
5+
import { Envelope, EnvelopeError, getBytes } from '@oasisprotocol/sapphire-paratime';
66

77
import { decode as cborgDecode } from 'cborg';
88

clients/js/src/provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function wrapEthereumProvider<P extends EIP2696_EthereumProvider>(
9393

9494
const filled_options = fillOptions(options);
9595

96-
// if it providers a send() function but no request function
96+
// if upstream provides a send() function but not request function
9797
// then derive a request() function from the send() function
9898
// if we do this, don't then re-wrap the send() function
9999
// only wrap the send() function if there was a request() function

examples/wagmi-v1/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist
2+
stats.html
3+

examples/wagmi-v1/Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
NPM ?= pnpm
2+
3+
all: build
4+
5+
build:
6+
$(NPM) build
7+
8+
clean:
9+
rm -rf dist stats.html
10+
11+
distclean: clean
12+
rm -rf node_modules
13+
14+
dependencies:
15+
$(MAKE) -C ../../integrations/wagmi-v2 full
16+
17+
full: dependencies build
18+
19+
test:
20+
@echo Please make tests for wagmi-v2 example!
21+
22+
run:
23+
$(NPM) run dev
24+
25+
run-proxied:
26+
SAPPHIRE_LOCALNET_HTTP_PROXY_PORT=3001 $(NPM) run dev
27+
28+
.PHONY: all clean distclean dependencies full test run run-proxied

examples/wagmi-v1/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Create Wagmi</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="/src/main.tsx"></script>
11+
</body>
12+
</html>

examples/wagmi-v1/package.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "sapphire-examples-wagmi-v1",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"license": "Apache-2.0",
7+
"scripts": {
8+
"dev": "vite",
9+
"build": "tsc && vite build",
10+
"lint": "biome check .",
11+
"format": "biome format --write .",
12+
"preview": "vite preview",
13+
"start:server": "vite --port 3000"
14+
},
15+
"dependencies": {
16+
"@oasisprotocol/sapphire-paratime": "workspace:^",
17+
"abitype": "^1.0.2",
18+
"react": "^18.2.0",
19+
"react-dom": "^18.2.0",
20+
"wagmi": "1.4.13",
21+
"viem": "2.9.19"
22+
},
23+
"devDependencies": {
24+
"@biomejs/biome": "^1.7.0",
25+
"@types/react": "^18.2.79",
26+
"@types/react-dom": "^18.2.25",
27+
"@vitejs/plugin-react": "^4.2.1",
28+
"buffer": "^6.0.3",
29+
"rollup-plugin-visualizer": "^5.12.0",
30+
"typescript": "^5.4.5",
31+
"vite": "^4.5.3"
32+
}
33+
}

0 commit comments

Comments
 (0)