Skip to content

Commit 6916da7

Browse files
committed
fix: Add temporary patch for joy.id ethereum provider
1 parent ac6cda8 commit 6916da7

File tree

3 files changed

+45
-6
lines changed

3 files changed

+45
-6
lines changed

javascript/tokenscript-viewer/package-lock.json

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
diff --git a/node_modules/@joyid/ethereum-provider/dist/index.js b/node_modules/@joyid/ethereum-provider/dist/index.js
2+
index 994b6cc..922a08d 100644
3+
--- a/node_modules/@joyid/ethereum-provider/dist/index.js
4+
+++ b/node_modules/@joyid/ethereum-provider/dist/index.js
5+
@@ -52,6 +52,7 @@ var EthereumProvider = class extends _eventemitter32.default {
6+
}
7+
case "wallet_switchEthereumChain": {
8+
const [chainId] = args.params;
9+
+ this.switchChain(chainId);
10+
this.emit("chainChanged", chainId);
11+
return void 0;
12+
}
13+
diff --git a/node_modules/@joyid/ethereum-provider/dist/index.mjs b/node_modules/@joyid/ethereum-provider/dist/index.mjs
14+
index e182344..3746b80 100644
15+
--- a/node_modules/@joyid/ethereum-provider/dist/index.mjs
16+
+++ b/node_modules/@joyid/ethereum-provider/dist/index.mjs
17+
@@ -52,6 +52,7 @@ var EthereumProvider = class extends EventEmitter {
18+
}
19+
case "wallet_switchEthereumChain": {
20+
const [chainId] = args.params;
21+
+ this.switchChain(chainId);
22+
this.emit("chainChanged", chainId);
23+
return void 0;
24+
}
25+
diff --git a/node_modules/@joyid/ethereum-provider/src/index.ts b/node_modules/@joyid/ethereum-provider/src/index.ts
26+
index 2bb2aa8..0c55f0c 100644
27+
--- a/node_modules/@joyid/ethereum-provider/src/index.ts
28+
+++ b/node_modules/@joyid/ethereum-provider/src/index.ts
29+
@@ -150,6 +150,7 @@ export class EthereumProvider extends EventEmitter {
30+
}
31+
case 'wallet_switchEthereumChain': {
32+
const [chainId] = args.params as [chainId: string]
33+
+ this.switchChain(chainId)
34+
this.emit('chainChanged', chainId)
35+
return undefined
36+
}

javascript/tokenscript-viewer/src/components/wallet/providers/JoyIDProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { EthereumProvider, EvmConfig } from "@joyid/ethereum-provider";
22
import {WC_V2_DEFAULT_CHAINS} from "./WalletConnectV2Provider";
33
import {Chain} from "viem";
4-
import {CHAIN_CONFIG} from "../../../integration/constants";
4+
import {CHAIN_CONFIG, CHAIN_NAME_MAP} from "../../../integration/constants";
55

66
export const getJoyIDProviderInstance = async () => {
77

@@ -11,7 +11,7 @@ export const getJoyIDProviderInstance = async () => {
1111

1212
return <Chain>{
1313
id: chainId,
14-
name: "ChainID " + chainId,
14+
name: CHAIN_NAME_MAP[chainId],
1515
nativeCurrency: {
1616
name: "Ethereum",
1717
symbol: "ETH",

0 commit comments

Comments
 (0)