@edgeandnode/graph-auth-kit 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,24 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Compute, type ExactPartial } from '@wagmi/core/internal';
|
|
2
|
+
import { type AddEthereumChainParameter } from 'viem';
|
|
3
|
+
import { type Config, type Connector, type ResolvedRegister } from 'wagmi';
|
|
2
4
|
export type SwitchChainProps<config extends Config = ResolvedRegister['config']> = {
|
|
3
5
|
/** The chain to switch to. Must be one of the available chains in the registered config */
|
|
4
6
|
requestedChain: config['chains'][number];
|
|
7
|
+
/**
|
|
8
|
+
* Listens to the switchChain success event and emits.
|
|
9
|
+
* Useful for updating the UI when the chain switches.
|
|
10
|
+
*/
|
|
11
|
+
onSuccess?(data: {
|
|
12
|
+
[key in keyof Extract<config['chains'][number], {
|
|
13
|
+
id: Config extends config ? number : config['chains'][number]['id'];
|
|
14
|
+
}>]: Extract<config['chains'][number], {
|
|
15
|
+
id: Config extends config ? number : config['chains'][number]['id'];
|
|
16
|
+
}>[key];
|
|
17
|
+
}, variables: {
|
|
18
|
+
connector?: Connector | undefined;
|
|
19
|
+
chainId: config['chains'][number]['id'];
|
|
20
|
+
addEthereumChainParameter?: Compute<ExactPartial<Omit<AddEthereumChainParameter, 'chainId'>>> | undefined;
|
|
21
|
+
}): Promise<void> | void;
|
|
5
22
|
};
|
|
6
23
|
export declare function SwitchChain<const config extends Config = ResolvedRegister['config']>(props: SwitchChainProps<config>): import("react").JSX.Element | null;
|
|
7
24
|
//# sourceMappingURL=SwitchChain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwitchChain.d.ts","sourceRoot":"","sources":["../../src/Components/SwitchChain.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAA6B,MAAM,OAAO,CAAA;
|
|
1
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,CAAA;KAC1G,GACA,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CACxB,CAAA;AACD,wBAAgB,WAAW,CAAC,KAAK,CAAC,MAAM,SAAS,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC,sCAuCpH"}
|
package/dist/index.js
CHANGED
|
@@ -499,7 +499,15 @@ function Disconnected({ children }) {
|
|
|
499
499
|
function SwitchChain(props) {
|
|
500
500
|
const conf = useConfig();
|
|
501
501
|
const account = useGraphAuthKitAccount();
|
|
502
|
-
const { switchChain, error } = useSwitchChain({
|
|
502
|
+
const { switchChain, error } = useSwitchChain({
|
|
503
|
+
config: conf,
|
|
504
|
+
mutation: {
|
|
505
|
+
onSuccess(data, variables) {
|
|
506
|
+
var _a;
|
|
507
|
+
void ((_a = props.onSuccess) == null ? void 0 : _a.call(props, data, variables));
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
});
|
|
503
511
|
if (account.connector == null || account.chainId === props.requestedChain.id) {
|
|
504
512
|
return null;
|
|
505
513
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edgeandnode/graph-auth-kit",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Wallet authentication connect kit in The Graph suite of applications",
|
|
6
6
|
"author": "Edge & Node",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"theme-ui": "^0.16",
|
|
41
41
|
"viem": "^2.20",
|
|
42
42
|
"wagmi": "^2.12",
|
|
43
|
-
"@edgeandnode/common": "^6.20.0",
|
|
44
43
|
"@edgeandnode/gds": "^5.29.0",
|
|
45
|
-
"@edgeandnode/go": "^6.46.0"
|
|
44
|
+
"@edgeandnode/go": "^6.46.0",
|
|
45
|
+
"@edgeandnode/common": "^6.20.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@emotion/react": "^11.13",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"ts-node": "^10.9.2",
|
|
62
62
|
"viem": "^2.20.1",
|
|
63
63
|
"wagmi": "^2.12.7",
|
|
64
|
-
"@edgeandnode/gds": "^5.29.0",
|
|
65
64
|
"@edgeandnode/common": "^6.20.0",
|
|
66
|
-
"@edgeandnode/
|
|
67
|
-
"@edgeandnode/go": "^6.46.0"
|
|
65
|
+
"@edgeandnode/gds": "^5.29.0",
|
|
66
|
+
"@edgeandnode/go": "^6.46.0",
|
|
67
|
+
"@edgeandnode/test-utils": "^2.0.0"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@ethersproject/abstract-signer": "^5.7.0",
|