@edgeandnode/graph-auth-kit 2.13.0 → 2.14.0
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.
- package/dist/client-CtNMlScP.js +107 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/ens/generated/network/gql.d.ts +45 -0
- package/dist/ens/generated/network/gql.d.ts.map +1 -0
- package/dist/ens/generated/network/graphql.d.ts +7478 -0
- package/dist/ens/generated/network/graphql.d.ts.map +1 -0
- package/dist/ens/generated/network/index.d.ts +2 -0
- package/dist/ens/generated/network/index.d.ts.map +1 -0
- package/dist/ens/index.d.ts +2 -0
- package/dist/ens/index.d.ts.map +1 -0
- package/dist/ens/index.js +4 -0
- package/dist/ens/network.queries.d.ts +7 -0
- package/dist/ens/network.queries.d.ts.map +1 -0
- package/dist/ens/resolver.d.ts +69 -0
- package/dist/ens/resolver.d.ts.map +1 -0
- package/dist/ens/resolver.test.d.ts +2 -0
- package/dist/ens/resolver.test.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -27
- package/dist/resolver-BQ9X_Lnn.js +229 -0
- package/dist/safe/index.js +1 -1
- package/dist/test-harness/index.js +1 -1
- package/dist/{utils-CQnV98OX.js → utils-BKwZdFsA.js} +3 -101
- package/dist/{utils-Des8_iyZ.js → utils-CpG3j9SL.js} +2 -1
- package/package.json +17 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ens/generated/network/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,KAAK,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const GraphAccount: import("@graphql-typed-document-node/core").TypedDocumentNode<import("./generated/network/graphql").GraphAccountQuery, import("./generated/network/graphql").Exact<{
|
|
2
|
+
id: import("./generated/network/graphql").Scalars["ID"]["input"];
|
|
3
|
+
}>>;
|
|
4
|
+
export declare const GraphAccounts: import("@graphql-typed-document-node/core").TypedDocumentNode<import("./generated/network/graphql").GraphAccountsQuery, import("./generated/network/graphql").Exact<{
|
|
5
|
+
id_in: Array<import("./generated/network/graphql").Scalars["ID"]["input"]>;
|
|
6
|
+
}>>;
|
|
7
|
+
//# sourceMappingURL=network.queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network.queries.d.ts","sourceRoot":"","sources":["../../src/ens/network.queries.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;QAgByssb,mDAAc;GAT9usb,CAAA;AACF,eAAO,MAAM,aAAa;iBAQy8sb,mDAAa;GAD9+sb,CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
|
+
export type EnsName = `${string}.eth`;
|
|
3
|
+
export interface EnsResolverConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the primary ENS name for the given address.
|
|
6
|
+
*
|
|
7
|
+
* Resolution steps:
|
|
8
|
+
* 1. If the user has set a default name in the GNS contract. Retrieved from the Network Subgraph.
|
|
9
|
+
* 2. Retrieved from a EnsPublicClient.getName lookup
|
|
10
|
+
*
|
|
11
|
+
* @see https://thegraph.com/explorer/subgraphs/DZz4kDTdmzWLWsV373w2bSmoar3umKKH9y82SUKr5qmp?view=Query&chain=arbitrum-one
|
|
12
|
+
* @see https://github.com/ensdomains/ensjs/blob/main/docs/public/function.getName.md
|
|
13
|
+
*
|
|
14
|
+
* @example <caption>Resolves the ENS name for the given address</caption>
|
|
15
|
+
*
|
|
16
|
+
* ```
|
|
17
|
+
* import { buildEnsResolver } from '@edgeandnode/graph-auth-kit/ens'
|
|
18
|
+
*
|
|
19
|
+
* const config = buildEnsResolver({ infuraKey: '', gatewayApiKey: '' })
|
|
20
|
+
*
|
|
21
|
+
* const ensNameMap = await config.resolveEnsName('0x123')
|
|
22
|
+
* expect(ensNameMap).toEqual('testuser.eth')
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param address wallet address to maybe retrieve the primary ENS name for
|
|
26
|
+
* @param timeout [default = 5000] time (in millisesonds) before the lookup times out and an error is thrown
|
|
27
|
+
* @throws Error if lookup exceeds the given timeout
|
|
28
|
+
* @returns The users primary ENS name (ex: `testuser.eth`) if resolved. Otherwise, null.
|
|
29
|
+
*/
|
|
30
|
+
resolveEnsName(address: Address, timeout?: number): Promise<EnsName | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Resolve the primary ENS names for the given array of addresses.
|
|
33
|
+
*
|
|
34
|
+
* Resolution steps:
|
|
35
|
+
* 1. If the user has set a default name in the GNS contract. Retrieved from the Network Subgraph.
|
|
36
|
+
* 2. Retrieved from a EnsPublicClient.getName lookup
|
|
37
|
+
*
|
|
38
|
+
* @see https://thegraph.com/explorer/subgraphs/DZz4kDTdmzWLWsV373w2bSmoar3umKKH9y82SUKr5qmp?view=Query&chain=arbitrum-one
|
|
39
|
+
* @see https://github.com/ensdomains/ensjs/blob/main/docs/public/function.getName.md
|
|
40
|
+
*
|
|
41
|
+
* @example <caption>Resolves a map of ENS names from the given array of addresses</caption>
|
|
42
|
+
*
|
|
43
|
+
* ```
|
|
44
|
+
* import { buildEnsResolver } from '@edgeandnode/graph-auth-kit/ens'
|
|
45
|
+
*
|
|
46
|
+
* const config = buildEnsResolver({ infuraKey: '', gatewayApiKey: '' })
|
|
47
|
+
*
|
|
48
|
+
* const ensNameMap = await config.resolveEnsNamesBatch(['0x123', '0x456'])
|
|
49
|
+
* expect(ensNameMap).toEqual({ '0x123': 'testuser.eth', '0x456': null })
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @param addresses List of addresses to resolve the ENS names for
|
|
53
|
+
* @returns Map of Address to the resolved primary ENS name, or null, if no ENS name found
|
|
54
|
+
*/
|
|
55
|
+
resolveEnsNamesBatch(addresses: Address[]): Promise<Record<Address, EnsName | null>>;
|
|
56
|
+
}
|
|
57
|
+
export type BuildEnsResolverArgs = {
|
|
58
|
+
/** Infura key used to resolve the ENS from the EnsPublicClient instance */
|
|
59
|
+
infuraKey: string;
|
|
60
|
+
/** The Graph Gateway API Key to query the mainnet network subgraph */
|
|
61
|
+
gatewayApiKey: string;
|
|
62
|
+
/**
|
|
63
|
+
* If true, the ENS lookups occur against sepolia.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
testnet?: boolean;
|
|
67
|
+
};
|
|
68
|
+
export declare function buildEnsResolver({ infuraKey, gatewayApiKey, testnet, }: BuildEnsResolverArgs): EnsResolverConfig;
|
|
69
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/ens/resolver.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAA;AAcnC,MAAM,MAAM,OAAO,GAAG,GAAG,MAAM,MAAM,CAAA;AAErC,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IAC3E;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC,CAAC,CAAA;CACrF;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAA;IACjB,sEAAsE;IACtE,aAAa,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AACD,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,aAAa,EACb,OAAe,GAChB,EAAE,oBAAoB,GAAG,iBAAiB,CAgI1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.test.d.ts","sourceRoot":"","sources":["../../src/ens/resolver.test.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,wBAAwB,CAAA;AACtC,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,OAAO,CAAA;AACrB,cAAc,wBAAwB,CAAA;AACtC,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { G as GraphAuthKitConnector, M as MULTISIG_AUTH_STORAGE_KEY } from "./client-CtNMlScP.js";
|
|
5
|
+
import { A, e, B, D, m, L, a, b, g, R, l, S, h, j, k, f, d, c, i } from "./client-CtNMlScP.js";
|
|
6
|
+
import { b as b2 } from "./resolver-BQ9X_Lnn.js";
|
|
7
|
+
import { c as clientToProvider, u as useGraphAuthKitInnerContext, a as MultisigSchema } from "./utils-CpG3j9SL.js";
|
|
8
|
+
import { G, f as f2, M, b as b3, g as g2, n, d as d2, j as j2, h as h2, k as k2, l as l2, i as i2, m as m2, e as e2 } from "./utils-CpG3j9SL.js";
|
|
8
9
|
import { useMutation } from "@tanstack/react-query";
|
|
9
10
|
import { watchAccount } from "@wagmi/core";
|
|
10
11
|
import { useMemo, useState, useEffect } from "react";
|
|
@@ -14,6 +15,8 @@ import { writeContractMutationOptions } from "wagmi/query";
|
|
|
14
15
|
import { VoidSigner } from "@ethersproject/abstract-signer";
|
|
15
16
|
import { OperationType } from "@safe-global/safe-core-sdk-types";
|
|
16
17
|
import { utils, BigNumber } from "ethers";
|
|
18
|
+
import { b as createSafe, c as createApiKit } from "./utils-BKwZdFsA.js";
|
|
19
|
+
import { A as A2, a as a2, S as S2, f as f3, e as e3, i as i3, d as d3 } from "./utils-BKwZdFsA.js";
|
|
17
20
|
import { jsx, jsxs } from "@theme-ui/core/jsx-runtime";
|
|
18
21
|
import { Alert, ExperimentalButton } from "@edgeandnode/gds";
|
|
19
22
|
const createLibAddress = "0x7cbB62EaA69F79e6873cD1ecB2392971036cFAa4";
|
|
@@ -177,7 +180,7 @@ class SafeEthersSigner extends VoidSigner {
|
|
|
177
180
|
));
|
|
178
181
|
return mapReceipt(receipt, safeTx);
|
|
179
182
|
}
|
|
180
|
-
} catch (
|
|
183
|
+
} catch (e4) {
|
|
181
184
|
}
|
|
182
185
|
await sleep(((_b = this.options) == null ? void 0 : _b.pollingDelay) ?? 5e3);
|
|
183
186
|
}
|
|
@@ -558,50 +561,53 @@ function SwitchChain(props) {
|
|
|
558
561
|
);
|
|
559
562
|
}
|
|
560
563
|
export {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
+
A as AUTH_STORAGE_KEY,
|
|
565
|
+
A2 as ApiKitUrlMap,
|
|
566
|
+
e as BuildClientArgs,
|
|
564
567
|
B as BuildPublicClientArgs,
|
|
565
568
|
Connected,
|
|
566
569
|
D as DefChain,
|
|
567
570
|
Disconnected,
|
|
568
571
|
GraphAuthKitConnector,
|
|
569
572
|
G as GraphAuthKitContext,
|
|
570
|
-
|
|
573
|
+
m as GraphAuthKitProps,
|
|
571
574
|
f2 as GraphAuthKitProvider,
|
|
572
575
|
L as L1Chain,
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
+
a as L1ChainTestnet,
|
|
577
|
+
b as L2Chain,
|
|
578
|
+
g as L2ChainTestnet,
|
|
576
579
|
MULTISIG_AUTH_STORAGE_KEY,
|
|
577
580
|
M as MockGraphAuthKitProvider,
|
|
578
581
|
R as RequiredInfuraKey,
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
582
|
+
l as RequiredWalletConnectProjectId,
|
|
583
|
+
a2 as SafeSupportedNetworkNames,
|
|
584
|
+
S2 as SafeSupportedNetworks,
|
|
585
|
+
S as SupportedClientChainId,
|
|
586
|
+
h as SupportedClientChains,
|
|
587
|
+
j as SupportedL1ClientChainId,
|
|
588
|
+
k as SupportedL2ClientChainId,
|
|
584
589
|
SwitchChain,
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
590
|
+
f as buildClient,
|
|
591
|
+
b2 as buildEnsResolver,
|
|
592
|
+
d as buildInfuraHttpTransport,
|
|
593
|
+
b3 as buildMockProviderState,
|
|
594
|
+
c as buildPublicClient,
|
|
589
595
|
g2 as chainIsSupportedChain,
|
|
590
596
|
clientToProvider,
|
|
591
|
-
|
|
597
|
+
n as connectedWalletIsEoA,
|
|
592
598
|
createApiKit,
|
|
593
599
|
createSafe,
|
|
594
600
|
d2 as disconnectedMockState,
|
|
595
|
-
|
|
596
|
-
|
|
601
|
+
f3 as fetchOwnedSafes,
|
|
602
|
+
i as isBuildPublicClientArgs,
|
|
597
603
|
j2 as isChainL1,
|
|
598
604
|
h2 as isChainL2,
|
|
599
605
|
k2 as isChainMainnet,
|
|
600
606
|
l2 as isChainTestnet,
|
|
601
|
-
|
|
602
|
-
|
|
607
|
+
e3 as isSafeOwner,
|
|
608
|
+
i3 as isSafeSupportedNetwork,
|
|
603
609
|
i2 as isSupportedChainId,
|
|
604
|
-
|
|
610
|
+
d3 as isValidSafe,
|
|
605
611
|
m2 as mapChainIdToChain,
|
|
606
612
|
useAuthAccount,
|
|
607
613
|
useClientToEthersSigner,
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { createEnsPublicClient, addEnsContracts } from "@ensdomains/ensjs";
|
|
2
|
+
import { getName } from "@ensdomains/ensjs/public";
|
|
3
|
+
import { GraphQLClient } from "graphql-request";
|
|
4
|
+
import { sepolia, mainnet } from "viem/chains";
|
|
5
|
+
import { d as buildInfuraHttpTransport, a as L1ChainTestnet, L as L1Chain } from "./client-CtNMlScP.js";
|
|
6
|
+
const GraphAccountDocument = {
|
|
7
|
+
kind: "Document",
|
|
8
|
+
definitions: [
|
|
9
|
+
{
|
|
10
|
+
kind: "OperationDefinition",
|
|
11
|
+
operation: "query",
|
|
12
|
+
name: { kind: "Name", value: "GraphAccount" },
|
|
13
|
+
variableDefinitions: [
|
|
14
|
+
{
|
|
15
|
+
kind: "VariableDefinition",
|
|
16
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "id" } },
|
|
17
|
+
type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } }
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
selectionSet: {
|
|
21
|
+
kind: "SelectionSet",
|
|
22
|
+
selections: [
|
|
23
|
+
{
|
|
24
|
+
kind: "Field",
|
|
25
|
+
name: { kind: "Name", value: "graphAccount" },
|
|
26
|
+
arguments: [
|
|
27
|
+
{
|
|
28
|
+
kind: "Argument",
|
|
29
|
+
name: { kind: "Name", value: "id" },
|
|
30
|
+
value: { kind: "Variable", name: { kind: "Name", value: "id" } }
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
selectionSet: {
|
|
34
|
+
kind: "SelectionSet",
|
|
35
|
+
selections: [
|
|
36
|
+
{ kind: "Field", name: { kind: "Name", value: "id" } },
|
|
37
|
+
{ kind: "Field", name: { kind: "Name", value: "defaultDisplayName" } }
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
};
|
|
46
|
+
const GraphAccountsDocument = {
|
|
47
|
+
kind: "Document",
|
|
48
|
+
definitions: [
|
|
49
|
+
{
|
|
50
|
+
kind: "OperationDefinition",
|
|
51
|
+
operation: "query",
|
|
52
|
+
name: { kind: "Name", value: "GraphAccounts" },
|
|
53
|
+
variableDefinitions: [
|
|
54
|
+
{
|
|
55
|
+
kind: "VariableDefinition",
|
|
56
|
+
variable: { kind: "Variable", name: { kind: "Name", value: "id_in" } },
|
|
57
|
+
type: {
|
|
58
|
+
kind: "NonNullType",
|
|
59
|
+
type: {
|
|
60
|
+
kind: "ListType",
|
|
61
|
+
type: { kind: "NonNullType", type: { kind: "NamedType", name: { kind: "Name", value: "ID" } } }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
selectionSet: {
|
|
67
|
+
kind: "SelectionSet",
|
|
68
|
+
selections: [
|
|
69
|
+
{
|
|
70
|
+
kind: "Field",
|
|
71
|
+
name: { kind: "Name", value: "graphAccounts" },
|
|
72
|
+
arguments: [
|
|
73
|
+
{ kind: "Argument", name: { kind: "Name", value: "first" }, value: { kind: "IntValue", value: "1000" } },
|
|
74
|
+
{ kind: "Argument", name: { kind: "Name", value: "skip" }, value: { kind: "IntValue", value: "0" } },
|
|
75
|
+
{
|
|
76
|
+
kind: "Argument",
|
|
77
|
+
name: { kind: "Name", value: "where" },
|
|
78
|
+
value: {
|
|
79
|
+
kind: "ObjectValue",
|
|
80
|
+
fields: [
|
|
81
|
+
{
|
|
82
|
+
kind: "ObjectField",
|
|
83
|
+
name: { kind: "Name", value: "id_in" },
|
|
84
|
+
value: { kind: "Variable", name: { kind: "Name", value: "id_in" } }
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
selectionSet: {
|
|
91
|
+
kind: "SelectionSet",
|
|
92
|
+
selections: [
|
|
93
|
+
{ kind: "Field", name: { kind: "Name", value: "id" } },
|
|
94
|
+
{ kind: "Field", name: { kind: "Name", value: "defaultDisplayName" } }
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
};
|
|
103
|
+
const documents = {
|
|
104
|
+
"\n query GraphAccount($id: ID!) {\n graphAccount(id: $id) {\n id\n defaultDisplayName\n }\n }\n": GraphAccountDocument,
|
|
105
|
+
"\n query GraphAccounts($id_in: [ID!]!) {\n graphAccounts(first: 1000, skip: 0, where: { id_in: $id_in }) {\n id\n defaultDisplayName\n }\n }\n": GraphAccountsDocument
|
|
106
|
+
};
|
|
107
|
+
function graphql(source) {
|
|
108
|
+
return documents[source] ?? {};
|
|
109
|
+
}
|
|
110
|
+
const GraphAccount = graphql(`
|
|
111
|
+
query GraphAccount($id: ID!) {
|
|
112
|
+
graphAccount(id: $id) {
|
|
113
|
+
id
|
|
114
|
+
defaultDisplayName
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
`);
|
|
118
|
+
const GraphAccounts = graphql(`
|
|
119
|
+
query GraphAccounts($id_in: [ID!]!) {
|
|
120
|
+
graphAccounts(first: 1000, skip: 0, where: { id_in: $id_in }) {
|
|
121
|
+
id
|
|
122
|
+
defaultDisplayName
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
`);
|
|
126
|
+
function buildEnsResolver({
|
|
127
|
+
infuraKey,
|
|
128
|
+
gatewayApiKey,
|
|
129
|
+
testnet = false
|
|
130
|
+
}) {
|
|
131
|
+
const publicClient = createEnsPublicClient({
|
|
132
|
+
chain: testnet ? addEnsContracts(sepolia) : addEnsContracts(mainnet),
|
|
133
|
+
transport: buildInfuraHttpTransport({
|
|
134
|
+
chain: testnet ? L1ChainTestnet.id : L1Chain.id,
|
|
135
|
+
infuraKey
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
const networkSubgraphId = testnet ? "8pVKDwHniAz87CHEQsiz2wgFXGZXrbMDkrxgauVVfMJC" : "9Co7EQe5PgW3ugCUJrJgRv4u9zdEuDJf8NvMWftNsBH8";
|
|
139
|
+
const networkGraphQLClient = new GraphQLClient(`https://gateway.thegraph.com/api/subgraphs/id/${networkSubgraphId}`, {
|
|
140
|
+
headers: {
|
|
141
|
+
Authorization: `Bearer ${gatewayApiKey}`
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
function maybeAppendDomain(ens) {
|
|
145
|
+
return ens.endsWith(".eth") ? ens : `${ens}.eth`;
|
|
146
|
+
}
|
|
147
|
+
async function abortableEnsNameLookup(address, timeoutDuration = 5e3) {
|
|
148
|
+
return new Promise((resolve, reject) => {
|
|
149
|
+
const timeout = setTimeout(() => {
|
|
150
|
+
reject(new Error("Lookup timed out"));
|
|
151
|
+
}, timeoutDuration);
|
|
152
|
+
void publicClient.getName({ address }).then((ens) => {
|
|
153
|
+
clearTimeout(timeout);
|
|
154
|
+
resolve(ens != null && (ens == null ? void 0 : ens.match) ? ens.name : null);
|
|
155
|
+
}).catch((err) => {
|
|
156
|
+
reject(err);
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
async function ensBulkLookup(addresses) {
|
|
161
|
+
const ids = [...new Set(addresses)];
|
|
162
|
+
const result = await publicClient.ensBatch(...ids.map((address) => getName.batch({ address })));
|
|
163
|
+
return result.reduce((map, curr, idx) => {
|
|
164
|
+
const address = ids[idx];
|
|
165
|
+
return {
|
|
166
|
+
...map,
|
|
167
|
+
[address]: curr != null && curr.match ? curr.name : null
|
|
168
|
+
};
|
|
169
|
+
}, {});
|
|
170
|
+
}
|
|
171
|
+
async function defaultNameLookup(address) {
|
|
172
|
+
var _a;
|
|
173
|
+
const result = await networkGraphQLClient.request(GraphAccount, {
|
|
174
|
+
id: address.toLowerCase()
|
|
175
|
+
});
|
|
176
|
+
return ((_a = result.graphAccount) == null ? void 0 : _a.defaultDisplayName) != null ? maybeAppendDomain(result.graphAccount.defaultDisplayName) : null;
|
|
177
|
+
}
|
|
178
|
+
async function defaultNamesBulkLookup(addresses) {
|
|
179
|
+
const result = await networkGraphQLClient.request(GraphAccounts, {
|
|
180
|
+
id_in: [...new Set(addresses.map((a) => a.toLowerCase()))]
|
|
181
|
+
});
|
|
182
|
+
const resolvedNames = addresses.reduce((acc, address) => {
|
|
183
|
+
acc[address] = null;
|
|
184
|
+
return acc;
|
|
185
|
+
}, {});
|
|
186
|
+
for (const account of result.graphAccounts) {
|
|
187
|
+
resolvedNames[account.id] = account.defaultDisplayName != null ? maybeAppendDomain(account.defaultDisplayName) : null;
|
|
188
|
+
}
|
|
189
|
+
return resolvedNames;
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
async resolveEnsName(address, timeout = 5e3) {
|
|
193
|
+
const fromGns = await defaultNameLookup(address);
|
|
194
|
+
if (fromGns != null) {
|
|
195
|
+
return fromGns;
|
|
196
|
+
}
|
|
197
|
+
const fromPublicClient = await abortableEnsNameLookup(address, timeout);
|
|
198
|
+
if (fromPublicClient != null) {
|
|
199
|
+
return fromPublicClient;
|
|
200
|
+
}
|
|
201
|
+
return null;
|
|
202
|
+
},
|
|
203
|
+
async resolveEnsNamesBatch(addresses) {
|
|
204
|
+
const resolvedNames = addresses.reduce((acc, address) => {
|
|
205
|
+
acc[address] = null;
|
|
206
|
+
return acc;
|
|
207
|
+
}, {});
|
|
208
|
+
const resolvedFromNetworkSubgraph = await defaultNamesBulkLookup(addresses);
|
|
209
|
+
addresses.forEach((addr) => {
|
|
210
|
+
if (resolvedFromNetworkSubgraph[addr] != null) {
|
|
211
|
+
resolvedNames[addr] = resolvedFromNetworkSubgraph[addr];
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
const unresolvedAddressesFromNetworkSubgraph = addresses.filter((addr) => resolvedNames[addr] == null);
|
|
215
|
+
if (unresolvedAddressesFromNetworkSubgraph.length > 0) {
|
|
216
|
+
const resolvedFromEnsSubgraph = await ensBulkLookup(unresolvedAddressesFromNetworkSubgraph);
|
|
217
|
+
unresolvedAddressesFromNetworkSubgraph.forEach((addr) => {
|
|
218
|
+
if (resolvedFromEnsSubgraph[addr] != null) {
|
|
219
|
+
resolvedNames[addr] = resolvedFromEnsSubgraph[addr];
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return resolvedNames;
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
export {
|
|
228
|
+
buildEnsResolver as b
|
|
229
|
+
};
|
package/dist/safe/index.js
CHANGED
|
@@ -1,85 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isAddress } from "viem";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import {
|
|
4
|
-
import { injected, coinbaseWallet, walletConnect } from "wagmi/connectors";
|
|
5
|
-
const AUTH_STORAGE_KEY = "thegraph__authstate";
|
|
6
|
-
const MULTISIG_AUTH_STORAGE_KEY = "multisig";
|
|
7
|
-
const L1Chain = mainnet;
|
|
8
|
-
const L1ChainTestnet = sepolia;
|
|
9
|
-
const L2Chain = arbitrum;
|
|
10
|
-
const L2ChainTestnet = arbitrumSepolia;
|
|
11
|
-
const DefChain = L2Chain;
|
|
12
|
-
const SupportedClientChainId = z.union([
|
|
13
|
-
z.literal(L1Chain.id),
|
|
14
|
-
z.literal(L1ChainTestnet.id),
|
|
15
|
-
z.literal(L2Chain.id),
|
|
16
|
-
z.literal(L2ChainTestnet.id)
|
|
17
|
-
]).readonly();
|
|
18
|
-
const SupportedClientChains = [L2Chain, L2ChainTestnet, L1Chain, L1ChainTestnet];
|
|
19
|
-
const RequiredInfuraKey = z.object({
|
|
20
|
-
infuraKey: z.string({ required_error: "The Infura Key is required" }).min(1).readonly()
|
|
21
|
-
});
|
|
22
|
-
const RequiredWalletConnectProjectId = z.object({
|
|
23
|
-
walletConnectProjectID: z.string({ required_error: "The WalletConnect Project ID is required" }).min(1).readonly()
|
|
24
|
-
});
|
|
25
|
-
const GraphAuthKitProps = RequiredInfuraKey;
|
|
26
|
-
const GraphAuthKitConnector = z.union([
|
|
27
|
-
z.literal(injected.type),
|
|
28
|
-
z.literal(coinbaseWallet.type),
|
|
29
|
-
z.literal(walletConnect.type),
|
|
30
|
-
z.literal("multisig")
|
|
31
|
-
]);
|
|
32
|
-
RequiredInfuraKey.extend({
|
|
33
|
-
chain: SupportedClientChainId.optional().nullable().default(DefChain.id)
|
|
34
|
-
});
|
|
35
|
-
function buildInfuraHttpTransport({
|
|
36
|
-
chain = DefChain.id,
|
|
37
|
-
infuraKey
|
|
38
|
-
}) {
|
|
39
|
-
switch (chain) {
|
|
40
|
-
case L1Chain.id: {
|
|
41
|
-
return http(`https://mainnet.infura.io/v3/${infuraKey}`);
|
|
42
|
-
}
|
|
43
|
-
case L1ChainTestnet.id: {
|
|
44
|
-
return http(`https://sepolia.infura.io/v3/${infuraKey}`);
|
|
45
|
-
}
|
|
46
|
-
case L2ChainTestnet.id: {
|
|
47
|
-
return http(`https://arbitrum-sepolia.infura.io/v3/${infuraKey}`);
|
|
48
|
-
}
|
|
49
|
-
default: {
|
|
50
|
-
return http(`https://arbitrum-mainnet.infura.io/v3/${infuraKey}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const BuildPublicClientArgs = RequiredInfuraKey.extend({
|
|
55
|
-
chain: z.custom().optional().default(DefChain)
|
|
56
|
-
});
|
|
57
|
-
function isBuildPublicClientArgs(args) {
|
|
58
|
-
return args != null && typeof args === "object" && typeof args.infuraKey === "string";
|
|
59
|
-
}
|
|
60
|
-
function buildPublicClient({ chain = DefChain, infuraKey }) {
|
|
61
|
-
const transport = buildInfuraHttpTransport({
|
|
62
|
-
chain: chain.id,
|
|
63
|
-
infuraKey
|
|
64
|
-
});
|
|
65
|
-
return createPublicClient({
|
|
66
|
-
chain,
|
|
67
|
-
transport
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
const BuildClientArgs = RequiredInfuraKey.extend({
|
|
71
|
-
chain: z.custom().optional().default(DefChain)
|
|
72
|
-
});
|
|
73
|
-
function buildClient({ chain = DefChain, infuraKey }) {
|
|
74
|
-
const transport = buildInfuraHttpTransport({
|
|
75
|
-
chain: chain.id,
|
|
76
|
-
infuraKey
|
|
77
|
-
});
|
|
78
|
-
return createClient({
|
|
79
|
-
chain,
|
|
80
|
-
transport
|
|
81
|
-
});
|
|
82
|
-
}
|
|
3
|
+
import { L as L1Chain, a as L1ChainTestnet, b as L2Chain, i as isBuildPublicClientArgs, c as buildPublicClient } from "./client-CtNMlScP.js";
|
|
83
4
|
const SafeSupportedNetworks = z.union([z.literal(L1Chain.id), z.literal(L1ChainTestnet.id), z.literal(L2Chain.id)]).readonly();
|
|
84
5
|
function isSafeSupportedNetwork(network) {
|
|
85
6
|
return SafeSupportedNetworks.safeParse(network).success;
|
|
@@ -269,12 +190,6 @@ async function fetchSafesByChain(signer, chain) {
|
|
|
269
190
|
}
|
|
270
191
|
export {
|
|
271
192
|
ApiKitUrlMap as A,
|
|
272
|
-
BuildPublicClientArgs as B,
|
|
273
|
-
DefChain as D,
|
|
274
|
-
GraphAuthKitConnector as G,
|
|
275
|
-
L1Chain as L,
|
|
276
|
-
MULTISIG_AUTH_STORAGE_KEY as M,
|
|
277
|
-
RequiredInfuraKey as R,
|
|
278
193
|
SafeSupportedNetworks as S,
|
|
279
194
|
SafeSupportedNetworkNames as a,
|
|
280
195
|
createSafe as b,
|
|
@@ -282,18 +197,5 @@ export {
|
|
|
282
197
|
isValidSafe as d,
|
|
283
198
|
isSafeOwner as e,
|
|
284
199
|
fetchOwnedSafes as f,
|
|
285
|
-
|
|
286
|
-
isBuildPublicClientArgs as h,
|
|
287
|
-
isSafeSupportedNetwork as i,
|
|
288
|
-
buildPublicClient as j,
|
|
289
|
-
BuildClientArgs as k,
|
|
290
|
-
buildClient as l,
|
|
291
|
-
AUTH_STORAGE_KEY as m,
|
|
292
|
-
L1ChainTestnet as n,
|
|
293
|
-
L2Chain as o,
|
|
294
|
-
L2ChainTestnet as p,
|
|
295
|
-
SupportedClientChainId as q,
|
|
296
|
-
SupportedClientChains as r,
|
|
297
|
-
RequiredWalletConnectProjectId as s,
|
|
298
|
-
GraphAuthKitProps as t
|
|
200
|
+
isSafeSupportedNetwork as i
|
|
299
201
|
};
|
|
@@ -2,13 +2,14 @@ import { jsx, jsxs, Fragment } from "@theme-ui/core/jsx-runtime";
|
|
|
2
2
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3
3
|
import { useConnect, useDisconnect, useAccountEffect, useConfig, WagmiProvider, createConfig, createStorage, cookieStorage, cookieToInitialState } from "wagmi";
|
|
4
4
|
import { injected, walletConnect, coinbaseWallet, mock } from "wagmi/connectors";
|
|
5
|
-
import {
|
|
5
|
+
import { S as SupportedClientChainId, D as DefChain, b as L2Chain, g as L2ChainTestnet, a as L1ChainTestnet, L as L1Chain, M as MULTISIG_AUTH_STORAGE_KEY, A as AUTH_STORAGE_KEY, c as buildPublicClient, G as GraphAuthKitConnector, f as buildClient, R as RequiredInfuraKey } from "./client-CtNMlScP.js";
|
|
6
6
|
import { createContext, useContext, useRef, useState, useReducer, useEffect } from "react";
|
|
7
7
|
import { Icon, ExperimentalButton, Alert, Divider, Link, ExperimentalSelect, ExperimentalInput, List, ExperimentalModal, ExperimentalLoadingIndicator } from "@edgeandnode/gds";
|
|
8
8
|
import { isAddress } from "viem";
|
|
9
9
|
import { addrShortener } from "@edgeandnode/common";
|
|
10
10
|
import { z } from "zod";
|
|
11
11
|
import { NetworkIcon } from "@edgeandnode/go";
|
|
12
|
+
import { S as SafeSupportedNetworks, e as isSafeOwner, a as SafeSupportedNetworkNames, d as isValidSafe } from "./utils-BKwZdFsA.js";
|
|
12
13
|
import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
|
|
13
14
|
import { providers } from "ethers";
|
|
14
15
|
const MultisigErrorMap = {
|