@prb/effect-evm 1.0.0-beta.3 → 1.0.0-beta.5
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/DOCS.md +13 -0
- package/README.md +1 -0
- package/dist/ens/ens.d.ts.map +1 -1
- package/dist/ens/ens.js +6 -6
- package/dist/ens/ens.js.map +1 -1
- package/dist/react-hooks/index.d.ts +4 -2
- package/dist/react-hooks/index.d.ts.map +1 -1
- package/dist/react-hooks/index.js +4 -2
- package/dist/react-hooks/index.js.map +1 -1
- package/dist/react-hooks/safe-app-origins.d.ts +8 -0
- package/dist/react-hooks/safe-app-origins.d.ts.map +1 -0
- package/dist/react-hooks/safe-app-origins.js +124 -0
- package/dist/react-hooks/safe-app-origins.js.map +1 -0
- package/dist/react-hooks/use-is-host-safe-app.d.ts +2 -0
- package/dist/react-hooks/use-is-host-safe-app.d.ts.map +1 -0
- package/dist/react-hooks/use-is-host-safe-app.js +16 -0
- package/dist/react-hooks/use-is-host-safe-app.js.map +1 -0
- package/dist/react-hooks/use-is-safe-app-context.d.ts +2 -0
- package/dist/react-hooks/use-is-safe-app-context.d.ts.map +1 -0
- package/dist/react-hooks/{use-safe-context.js → use-is-safe-app-context.js} +2 -2
- package/dist/react-hooks/use-is-safe-app-context.js.map +1 -0
- package/dist/react-hooks/use-is-safe-multisig-wallet.d.ts +2 -0
- package/dist/react-hooks/use-is-safe-multisig-wallet.d.ts.map +1 -0
- package/dist/react-hooks/use-is-safe-multisig-wallet.js +24 -0
- package/dist/react-hooks/use-is-safe-multisig-wallet.js.map +1 -0
- package/dist/safe/index.d.ts +1 -1
- package/dist/safe/index.d.ts.map +1 -1
- package/dist/safe/index.js.map +1 -1
- package/dist/safe/live.d.ts.map +1 -1
- package/dist/safe/live.js +14 -14
- package/dist/safe/live.js.map +1 -1
- package/dist/safe/service.d.ts +4 -4
- package/dist/safe/service.d.ts.map +1 -1
- package/dist/safe/service.js.map +1 -1
- package/dist/safe/service.test.integration.js +10 -12
- package/dist/safe/service.test.integration.js.map +1 -1
- package/dist/safe/simulation/abis.d.ts.map +1 -1
- package/dist/safe/simulation/abis.js.map +1 -1
- package/dist/safe/simulation/addresses.d.ts.map +1 -1
- package/dist/safe/simulation/addresses.js +40 -26
- package/dist/safe/simulation/addresses.js.map +1 -1
- package/dist/safe/simulation/internal/calldata/calldata.d.ts +5 -0
- package/dist/safe/simulation/internal/calldata/calldata.d.ts.map +1 -0
- package/dist/safe/simulation/internal/calldata/calldata.js +17 -0
- package/dist/safe/simulation/internal/calldata/calldata.js.map +1 -0
- package/dist/safe/simulation/internal/calldata/index.d.ts +2 -0
- package/dist/safe/simulation/internal/calldata/index.d.ts.map +1 -0
- package/dist/safe/simulation/internal/calldata/index.js +2 -0
- package/dist/safe/simulation/internal/calldata/index.js.map +1 -0
- package/dist/safe/simulation/internal/contracts/contracts.d.ts +5 -0
- package/dist/safe/simulation/internal/contracts/contracts.d.ts.map +1 -0
- package/dist/safe/simulation/internal/contracts/contracts.js +25 -0
- package/dist/safe/simulation/internal/contracts/contracts.js.map +1 -0
- package/dist/safe/simulation/internal/contracts/index.d.ts +2 -0
- package/dist/safe/simulation/internal/contracts/index.d.ts.map +1 -0
- package/dist/safe/simulation/internal/contracts/index.js +2 -0
- package/dist/safe/simulation/internal/contracts/index.js.map +1 -0
- package/dist/safe/simulation/internal/evaluation/evaluation.d.ts +6 -0
- package/dist/safe/simulation/internal/evaluation/evaluation.d.ts.map +1 -0
- package/dist/safe/simulation/internal/evaluation/evaluation.js +20 -0
- package/dist/safe/simulation/internal/evaluation/evaluation.js.map +1 -0
- package/dist/safe/simulation/internal/evaluation/index.d.ts +2 -0
- package/dist/safe/simulation/internal/evaluation/index.d.ts.map +1 -0
- package/dist/safe/simulation/internal/evaluation/index.js +2 -0
- package/dist/safe/simulation/internal/evaluation/index.js.map +1 -0
- package/dist/safe/simulation/internal/execution/execution.d.ts +9 -0
- package/dist/safe/simulation/internal/execution/execution.d.ts.map +1 -0
- package/dist/safe/simulation/internal/execution/execution.js +65 -0
- package/dist/safe/simulation/internal/execution/execution.js.map +1 -0
- package/dist/safe/simulation/internal/execution/index.d.ts +2 -0
- package/dist/safe/simulation/internal/execution/index.d.ts.map +1 -0
- package/dist/safe/simulation/internal/execution/index.js +2 -0
- package/dist/safe/simulation/internal/execution/index.js.map +1 -0
- package/dist/safe/simulation/internal/limits/index.d.ts +2 -0
- package/dist/safe/simulation/internal/limits/index.d.ts.map +1 -0
- package/dist/safe/simulation/internal/limits/index.js +2 -0
- package/dist/safe/simulation/internal/limits/index.js.map +1 -0
- package/dist/safe/simulation/internal/limits/limits.d.ts +5 -0
- package/dist/safe/simulation/internal/limits/limits.d.ts.map +1 -0
- package/dist/safe/simulation/internal/limits/limits.js +18 -0
- package/dist/safe/simulation/internal/limits/limits.js.map +1 -0
- package/dist/safe/simulation/internal/types/index.d.ts +2 -0
- package/dist/safe/simulation/internal/types/index.d.ts.map +1 -0
- package/dist/safe/simulation/internal/types/index.js +2 -0
- package/dist/safe/simulation/internal/types/index.js.map +1 -0
- package/dist/safe/simulation/internal/types/types.d.ts +11 -0
- package/dist/safe/simulation/internal/types/types.d.ts.map +1 -0
- package/dist/safe/simulation/internal/types/types.js +2 -0
- package/dist/safe/simulation/internal/types/types.js.map +1 -0
- package/dist/safe/simulation/internal/validation/index.d.ts +2 -0
- package/dist/safe/simulation/internal/validation/index.d.ts.map +1 -0
- package/dist/safe/simulation/internal/validation/index.js +2 -0
- package/dist/safe/simulation/internal/validation/index.js.map +1 -0
- package/dist/safe/simulation/internal/validation/validation.d.ts +5 -0
- package/dist/safe/simulation/internal/validation/validation.d.ts.map +1 -0
- package/dist/safe/simulation/internal/validation/validation.js +27 -0
- package/dist/safe/simulation/internal/validation/validation.js.map +1 -0
- package/dist/safe/simulation/service.d.ts +1 -1
- package/dist/safe/simulation/service.d.ts.map +1 -1
- package/dist/safe/simulation/service.js +12 -127
- package/dist/safe/simulation/service.js.map +1 -1
- package/dist/safe/types.d.ts +14 -14
- package/dist/safe/types.d.ts.map +1 -1
- package/dist/safe/types.js.map +1 -1
- package/dist/telemetry/tracer.d.ts +2 -2
- package/dist/telemetry/tracer.js +2 -2
- package/dist/telemetry/tracer.js.map +1 -1
- package/package.json +1 -1
- package/dist/react-hooks/use-is-safe-multisig.d.ts +0 -2
- package/dist/react-hooks/use-is-safe-multisig.d.ts.map +0 -1
- package/dist/react-hooks/use-is-safe-multisig.js +0 -44
- package/dist/react-hooks/use-is-safe-multisig.js.map +0 -1
- package/dist/react-hooks/use-safe-context.d.ts +0 -2
- package/dist/react-hooks/use-safe-context.d.ts.map +0 -1
- package/dist/react-hooks/use-safe-context.js.map +0 -1
package/dist/safe/types.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import type { Address, Hash, Hex, TransactionReceipt } from "viem";
|
|
2
2
|
export type SafeInfo = {
|
|
3
|
-
safeAddress: Address;
|
|
4
3
|
chainId: number;
|
|
4
|
+
safeAddress: Address;
|
|
5
5
|
};
|
|
6
|
-
export type
|
|
7
|
-
to: Address;
|
|
6
|
+
export type SafeMultisigTx = {
|
|
8
7
|
data: Hex;
|
|
8
|
+
to: Address;
|
|
9
9
|
value?: bigint;
|
|
10
10
|
};
|
|
11
11
|
export type SafeTxSubmission = {
|
|
12
|
-
safeTxHash: Hash;
|
|
13
|
-
safeAddress: Address;
|
|
14
12
|
chainId: number;
|
|
13
|
+
safeAddress: Address;
|
|
14
|
+
safeTxHash: Hash;
|
|
15
15
|
};
|
|
16
16
|
export type SafeTxResult = {
|
|
17
|
-
|
|
17
|
+
chainId: number;
|
|
18
18
|
onchainHash: Hash;
|
|
19
19
|
receipt: TransactionReceipt;
|
|
20
20
|
safeAddress: Address;
|
|
21
|
-
|
|
21
|
+
safeTxHash: Hash;
|
|
22
22
|
};
|
|
23
23
|
export type SignTypedDataResult = {
|
|
24
24
|
readonly _tag: "Offchain";
|
|
@@ -32,11 +32,11 @@ export type OffchainSignatureResult = {
|
|
|
32
32
|
signature: Hex;
|
|
33
33
|
};
|
|
34
34
|
export type SafeWaitPolicy = {
|
|
35
|
-
pollInterval?: number;
|
|
36
35
|
executionTimeout?: number;
|
|
36
|
+
pollInterval?: number;
|
|
37
37
|
receiptPolicy?: {
|
|
38
|
-
receiptTimeout?: number;
|
|
39
38
|
pollingInterval?: number;
|
|
39
|
+
receiptTimeout?: number;
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
export type OffchainSignaturePolicy = {
|
|
@@ -45,17 +45,17 @@ export type OffchainSignaturePolicy = {
|
|
|
45
45
|
};
|
|
46
46
|
export type EIP712TypedData = {
|
|
47
47
|
domain: {
|
|
48
|
-
name?: string;
|
|
49
|
-
version?: string;
|
|
50
48
|
chainId?: number;
|
|
51
|
-
|
|
49
|
+
name?: string;
|
|
52
50
|
salt?: string;
|
|
51
|
+
verifyingContract?: string;
|
|
52
|
+
version?: string;
|
|
53
53
|
};
|
|
54
|
+
message: Record<string, unknown>;
|
|
55
|
+
primaryType?: string;
|
|
54
56
|
types: Record<string, Array<{
|
|
55
57
|
name: string;
|
|
56
58
|
type: string;
|
|
57
59
|
}>>;
|
|
58
|
-
message: Record<string, unknown>;
|
|
59
|
-
primaryType?: string;
|
|
60
60
|
};
|
|
61
61
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/safe/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/safe/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAGnE,MAAM,MAAM,QAAQ,GAAG;IACrB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/safe/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,kBAAkB,EAAE,MAAM,MAAM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C,EAAE,MAAM,CAAC;CAClB,CAAC;AAGF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE;QACN,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;CAC9D,CAAC"}
|
package/dist/safe/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/safe/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Address, Hash, Hex, TransactionReceipt } from \"viem\";\n\n/** Safe info returned from SDK */\nexport type SafeInfo = {\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/safe/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Address, Hash, Hex, TransactionReceipt } from \"viem\";\n\n/** Safe info returned from SDK */\nexport type SafeInfo = {\n chainId: number;\n safeAddress: Address;\n};\n\n/** Tx to send via Safe multisig */\nexport type SafeMultisigTx = {\n data: Hex;\n to: Address;\n value?: bigint; // Converted to string at SDK boundary\n};\n\n/** Result from sendTxs */\nexport type SafeTxSubmission = {\n chainId: number;\n safeAddress: Address;\n safeTxHash: Hash;\n};\n\n/** Result from waitForTxReceipt */\nexport type SafeTxResult = {\n chainId: number;\n onchainHash: Hash;\n receipt: TransactionReceipt;\n safeAddress: Address;\n safeTxHash: Hash;\n};\n\n/** Discriminated union for signTypedData result */\nexport type SignTypedDataResult =\n | { readonly _tag: \"Offchain\"; readonly messageHash: Hex }\n | { readonly _tag: \"Onchain\"; readonly safeTxHash: Hash };\n\n/** Off-chain signature result */\nexport type OffchainSignatureResult = {\n messageHash: Hex;\n signature: Hex;\n};\n\n/** Policy for Safe tx waiting (aligns with TxPolicy from src/tx/policy.ts) */\nexport type SafeWaitPolicy = {\n /** Timeout for Safe tx execution in ms (default: 300000 = 5 min) */\n executionTimeout?: number;\n /** Poll interval for Safe gateway in ms (default: 3000) */\n pollInterval?: number;\n /** Policy passed to TxManager.waitForReceipt */\n receiptPolicy?: {\n pollingInterval?: number;\n receiptTimeout?: number;\n };\n};\n\n/** Policy for off-chain signature polling */\nexport type OffchainSignaturePolicy = {\n /** Poll interval in ms (default: 2000) */\n pollInterval?: number;\n /** Timeout in ms (default: 120000 = 2 min) */\n timeout?: number;\n};\n\n/** EIP-712 typed data structure (local definition to avoid SDK import) */\nexport type EIP712TypedData = {\n domain: {\n chainId?: number;\n name?: string;\n salt?: string;\n verifyingContract?: string;\n version?: string;\n };\n message: Record<string, unknown>;\n primaryType?: string;\n types: Record<string, Array<{ name: string; type: string }>>;\n};\n"]}
|
|
@@ -63,9 +63,9 @@ export declare const SpanNames: {
|
|
|
63
63
|
readonly SAFE_ENABLE_OFFCHAIN: "ew3.safe.enableOffchainSigning";
|
|
64
64
|
readonly SAFE_GET_INFO: "ew3.safe.getInfo";
|
|
65
65
|
readonly SAFE_GET_OFFCHAIN_SIG: "ew3.safe.getOffchainSignature";
|
|
66
|
-
readonly SAFE_GET_TX: "ew3.safe.
|
|
66
|
+
readonly SAFE_GET_TX: "ew3.safe.getTx";
|
|
67
67
|
readonly SAFE_POLL_OFFCHAIN_SIG: "ew3.safe.pollOffchainSignature";
|
|
68
|
-
readonly SAFE_SEND_TXS: "ew3.safe.
|
|
68
|
+
readonly SAFE_SEND_TXS: "ew3.safe.sendTxs";
|
|
69
69
|
readonly SAFE_SIGN_TYPED_DATA: "ew3.safe.signTypedData";
|
|
70
70
|
readonly SAFE_WAIT_RECEIPT: "ew3.safe.waitForReceipt";
|
|
71
71
|
readonly SIGNATURE_HASH_MESSAGE: "ew3.signature.hashMessage";
|
package/dist/telemetry/tracer.js
CHANGED
|
@@ -63,9 +63,9 @@ export const SpanNames = {
|
|
|
63
63
|
SAFE_ENABLE_OFFCHAIN: "ew3.safe.enableOffchainSigning",
|
|
64
64
|
SAFE_GET_INFO: "ew3.safe.getInfo",
|
|
65
65
|
SAFE_GET_OFFCHAIN_SIG: "ew3.safe.getOffchainSignature",
|
|
66
|
-
SAFE_GET_TX: "ew3.safe.
|
|
66
|
+
SAFE_GET_TX: "ew3.safe.getTx",
|
|
67
67
|
SAFE_POLL_OFFCHAIN_SIG: "ew3.safe.pollOffchainSignature",
|
|
68
|
-
SAFE_SEND_TXS: "ew3.safe.
|
|
68
|
+
SAFE_SEND_TXS: "ew3.safe.sendTxs",
|
|
69
69
|
SAFE_SIGN_TYPED_DATA: "ew3.safe.signTypedData",
|
|
70
70
|
SAFE_WAIT_RECEIPT: "ew3.safe.waitForReceipt",
|
|
71
71
|
SIGNATURE_HASH_MESSAGE: "ew3.signature.hashMessage",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracer.js","sourceRoot":"","sources":["../../src/telemetry/tracer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,MAAM,CAAC,MAAM,QAAQ,GACnB,CAAC,IAAY,EAAE,UAAoC,EAAE,EAAE,CACvD,CAAU,MAA8B,EAA0B,EAAE,CAClE,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;AAKlD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,aAAa,EAAE,mBAAmB;IAClC,mBAAmB,EAAE,wBAAwB;IAC7C,WAAW,EAAE,iBAAiB;IAC9B,iBAAiB,EAAE,sBAAsB;IACzC,uBAAuB,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Aa,EAAE,kBAAkB;IACjC,qBAAqB,EAAE,+BAA+B;IACtD,WAAW,EAAE,gBAAgB;IAC7B,sBAAsB,EAAE,gCAAgC;IACxD,aAAa,EAAE,kBAAkB;IACjC,oBAAoB,EAAE,wBAAwB;IAC9C,iBAAiB,EAAE,yBAAyB;IAC5C,sBAAsB,EAAE,2BAA2B;IACnD,yBAAyB,EAAE,6BAA6B;IACxD,cAAc,EAAE,oBAAoB;IACpC,yBAAyB,EAAE,8BAA8B;IACzD,oCAAoC,EAAE,uCAAuC;IAC7E,eAAe,EAAE,qBAAqB;IACtC,wBAAwB,EAAE,6BAA6B;IACvD,2BAA2B,EAAE,+BAA+B;IAC5D,mBAAmB,EAAE,yBAAyB;IAC9C,0BAA0B,EAAE,+BAA+B;IAC3D,yBAAyB,EAAE,8BAA8B;IACzD,uBAAuB,EAAE,4BAA4B;IACrD,6BAA6B,EAAE,iCAAiC;IAChE,iBAAiB,EAAE,0BAA0B;IAC7C,aAAa,EAAE,mBAAmB;IAClC,sBAAsB,EAAE,0BAA0B;IAClD,oBAAoB,EAAE,yBAAyB;IAC/C,QAAQ,EAAE,cAAc;IACxB,OAAO,EAAE,aAAa;IACtB,cAAc,EAAE,oBAAoB;IACpC,mBAAmB,EAAE,wBAAwB;IAC7C,sBAAsB,EAAE,0BAA0B;CAC1C,CAAC","sourcesContent":["import { Effect } from \"effect\";\n\n/**\n * Wrap an effect with a span for tracing\n */\nexport const withSpan =\n (name: string, attributes?: Record<string, unknown>) =>\n <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>\n Effect.withSpan(name, { attributes })(effect);\n\n/**\n * Common span names for RPC operations\n */\nexport const SpanNames = {\n BALANCE_CHECK: \"ew3.balance.check\",\n BALANCE_CHECK_TOKEN: \"ew3.balance.checkToken\",\n BALANCE_GET: \"ew3.balance.get\",\n BALANCE_GET_TOKEN: \"ew3.balance.getToken\",\n BALANCE_GET_TOKEN_BATCH: \"ew3.balance.getTokenBatch\",\n BALANCE_WATCH: \"ew3.balance.watch\",\n BALANCE_WATCH_TOKEN: \"ew3.balance.watchToken\",\n BLOCK_GET: \"ew3.block.get\",\n BLOCK_GET_BY_HASH: \"ew3.block.getByHash\",\n BLOCK_GET_NUMBER: \"ew3.block.getNumber\",\n BLOCK_GET_RANGE: \"ew3.block.getRange\",\n BLOCK_GET_TIMESTAMP: \"ew3.block.getTimestamp\",\n BLOCK_WAIT: \"ew3.block.wait\",\n BLOCK_WATCH: \"ew3.block.watch\",\n CONTRACT_ESTIMATE_GAS: \"ew3.contract.estimateGas\",\n CONTRACT_READ: \"ew3.contract.read\",\n CONTRACT_SIMULATE: \"ew3.contract.simulate\",\n CONTRACT_WRITE: \"ew3.contract.write\",\n CROSS_CHAIN_MULTICALL_ALL: \"ew3.crossChain.multicallAll\",\n CROSS_CHAIN_READ_ALL: \"ew3.crossChain.readAll\",\n CROSS_CHAIN_READ_SAME: \"ew3.crossChain.readSame\",\n DEPLOY_COMPUTE_ADDRESS: \"ew3.deploy.computeAddress\",\n DEPLOY_CONTRACT: \"ew3.deploy.contract\",\n DEPLOY_VERIFY: \"ew3.deploy.verify\",\n ENS_GET_ADDRESS: \"ew3.ens.getAddress\",\n ENS_GET_AVATAR: \"ew3.ens.getAvatar\",\n ENS_GET_NAME: \"ew3.ens.getName\",\n ENS_GET_RESOLVER: \"ew3.ens.getResolver\",\n ENS_GET_TEXT: \"ew3.ens.getText\",\n ERC721_APPROVE: \"ew3.erc721.approve\",\n ERC721_BALANCE_OF: \"ew3.erc721.balanceOf\",\n ERC721_FETCH_METADATA: \"ew3.erc721.fetchMetadata\",\n ERC721_GET_APPROVED: \"ew3.erc721.getApproved\",\n ERC721_IS_APPROVED_FOR_ALL: \"ew3.erc721.isApprovedForAll\",\n ERC721_NAME: \"ew3.erc721.name\",\n ERC721_OWNER_OF: \"ew3.erc721.ownerOf\",\n ERC721_SAFE_TRANSFER_FROM: \"ew3.erc721.safeTransferFrom\",\n ERC721_SET_APPROVAL_FOR_ALL: \"ew3.erc721.setApprovalForAll\",\n ERC721_SYMBOL: \"ew3.erc721.symbol\",\n ERC721_TOKEN_URI: \"ew3.erc721.tokenURI\",\n ERC721_TOTAL_SUPPLY: \"ew3.erc721.totalSupply\",\n ERC721_TRANSFER_FROM: \"ew3.erc721.transferFrom\",\n EVENT_BACKFILL: \"ew3.event.backfill\",\n EVENT_WATCH: \"ew3.event.watch\",\n GAS_ESTIMATE_FEES: \"ew3.gas.estimateFees\",\n GAS_ESTIMATE_GAS: \"ew3.gas.estimateGas\",\n GAS_GET_ALL_ESTIMATES: \"ew3.gas.getAllEstimates\",\n GAS_GET_BASE_FEE: \"ew3.gas.getBaseFee\",\n GAS_GET_MAX_PRIORITY_FEE: \"ew3.gas.getMaxPriorityFee\",\n GAS_SUPPORTS_EIP1559: \"ew3.gas.supportsEip1559\",\n MULTICALL: \"ew3.contract.multicall\",\n NONCE_CONFIRM: \"ew3.nonce.confirm\",\n NONCE_GET_CONFIRMED_COUNT: \"ew3.nonce.getConfirmedCount\",\n NONCE_GET_GAPS: \"ew3.nonce.getGaps\",\n NONCE_GET_NEXT: \"ew3.nonce.getNext\",\n NONCE_GET_PENDING_COUNT: \"ew3.nonce.getPendingCount\",\n NONCE_RELEASE: \"ew3.nonce.release\",\n NONCE_RESERVE: \"ew3.nonce.reserve\",\n NONCE_SYNC: \"ew3.nonce.sync\",\n SAFE_ENABLE_OFFCHAIN: \"ew3.safe.enableOffchainSigning\",\n\n // Safe Apps\n SAFE_GET_INFO: \"ew3.safe.getInfo\",\n SAFE_GET_OFFCHAIN_SIG: \"ew3.safe.getOffchainSignature\",\n SAFE_GET_TX: \"ew3.safe.getTx\",\n SAFE_POLL_OFFCHAIN_SIG: \"ew3.safe.pollOffchainSignature\",\n SAFE_SEND_TXS: \"ew3.safe.sendTxs\",\n SAFE_SIGN_TYPED_DATA: \"ew3.safe.signTypedData\",\n SAFE_WAIT_RECEIPT: \"ew3.safe.waitForReceipt\",\n SIGNATURE_HASH_MESSAGE: \"ew3.signature.hashMessage\",\n SIGNATURE_HASH_TYPED_DATA: \"ew3.signature.hashTypedData\",\n SIGNATURE_JOIN: \"ew3.signature.join\",\n SIGNATURE_RECOVER_ADDRESS: \"ew3.signature.recoverAddress\",\n SIGNATURE_RECOVER_TYPED_DATA_ADDRESS: \"ew3.signature.recoverTypedDataAddress\",\n SIGNATURE_SPLIT: \"ew3.signature.split\",\n SIGNATURE_VERIFY_MESSAGE: \"ew3.signature.verifyMessage\",\n SIGNATURE_VERIFY_TYPED_DATA: \"ew3.signature.verifyTypedData\",\n SIMULATION_SIMULATE: \"ew3.simulation.simulate\",\n SIMULATION_SIMULATE_BUNDLE: \"ew3.simulation.simulateBundle\",\n SUBSCRIPTION_WATCH_BLOCKS: \"ew3.subscription.watchBlocks\",\n SUBSCRIPTION_WATCH_LOGS: \"ew3.subscription.watchLogs\",\n SUBSCRIPTION_WATCH_PENDING_TX: \"ew3.subscription.watchPendingTx\",\n TRANSFER_ESTIMATE: \"ew3.transfer.estimateGas\",\n TRANSFER_SEND: \"ew3.transfer.send\",\n TRANSFER_SEND_AND_WAIT: \"ew3.transfer.sendAndWait\",\n TX_GET_CONFIRMATIONS: \"ew3.tx.getConfirmations\",\n TX_TRACK: \"ew3.tx.track\",\n TX_WAIT: \"ew3.tx.wait\",\n WALLET_CONNECT: \"ew3.wallet.connect\",\n WALLET_SIGN_MESSAGE: \"ew3.wallet.signMessage\",\n WALLET_SIGN_TYPED_DATA: \"ew3.wallet.signTypedData\",\n} as const;\n"]}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-is-safe-multisig.d.ts","sourceRoot":"","sources":["../../src/react-hooks/use-is-safe-multisig.ts"],"names":[],"mappings":"AAgCA,wBAAgB,iBAAiB,IAAI,OAAO,CAyB3C"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { useAccount } from "wagmi";
|
|
4
|
-
import { useSafeContext } from "./use-safe-context.js";
|
|
5
|
-
const SAFE_ORIGINS = [
|
|
6
|
-
"https://app.safe.global",
|
|
7
|
-
"https://gnosis-safe.io",
|
|
8
|
-
"https://safe.global",
|
|
9
|
-
"https://safe.berachain.com",
|
|
10
|
-
"https://safe.chiliz.com",
|
|
11
|
-
"https://safe.lightlink.io",
|
|
12
|
-
"https://safe.optimism.io",
|
|
13
|
-
];
|
|
14
|
-
export function useIsSafeMultisig() {
|
|
15
|
-
const { connector, isConnected } = useAccount();
|
|
16
|
-
const isSafeContext = useSafeContext();
|
|
17
|
-
const [isSafeIframe, setIsSafeIframe] = useState(false);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (window.parent !== window && isValidSafeOrigin()) {
|
|
20
|
-
setIsSafeIframe(true);
|
|
21
|
-
}
|
|
22
|
-
}, []);
|
|
23
|
-
if (isSafeContext) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
if (isConnected && connector?.id === "safe") {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
return isSafeIframe;
|
|
30
|
-
}
|
|
31
|
-
function isValidSafeOrigin() {
|
|
32
|
-
try {
|
|
33
|
-
const parentOrigin = window.parent.location.origin;
|
|
34
|
-
return SAFE_ORIGINS.some((origin) => parentOrigin === origin);
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
if (window.location.ancestorOrigins?.length) {
|
|
38
|
-
const ancestorOrigin = window.location.ancestorOrigins[0];
|
|
39
|
-
return SAFE_ORIGINS.some((origin) => ancestorOrigin === origin);
|
|
40
|
-
}
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=use-is-safe-multisig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-is-safe-multisig.js","sourceRoot":"","sources":["../../src/react-hooks/use-is-safe-multisig.ts"],"names":[],"mappings":"AAAA,YAAY,C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,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;YAC1D,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,KAAK,MAAM,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { useAccount } from \"wagmi\";\nimport { useSafeContext } from \"./use-safe-context.js\";\n\n/**\n * Known Safe wallet domains for iframe origin validation.\n * Includes the main Safe app and chain-specific Safe deployments.\n */\nconst SAFE_ORIGINS = [\n // Main Safe domains\n \"https://app.safe.global\",\n \"https://gnosis-safe.io\",\n \"https://safe.global\",\n // Chain-specific Safe deployments\n \"https://safe.berachain.com\",\n \"https://safe.chiliz.com\",\n \"https://safe.lightlink.io\",\n \"https://safe.optimism.io\",\n] as const;\n\n/**\n * Detect if the connected wallet is a Safe multisig.\n *\n * Detection strategy (in order of reliability):\n * 1. Safe Apps SDK detection via postMessage (most reliable, works cross-origin)\n * 2. Wagmi connector ID check\n * 3. Iframe origin validation (fallback, may fail cross-origin)\n *\n * @returns true if wallet is a Safe multisig\n */\nexport function useIsSafeMultisig(): boolean {\n const { connector, isConnected } = useAccount();\n const isSafeContext = useSafeContext();\n\n // Method 3: Iframe origin fallback (may fail cross-origin)\n // Deferred to useEffect to avoid SSR hydration mismatch\n const [isSafeIframe, setIsSafeIframe] = useState(false);\n useEffect(() => {\n if (window.parent !== window && isValidSafeOrigin()) {\n setIsSafeIframe(true);\n }\n }, []);\n\n // Method 1: Safe Apps SDK (most reliable - uses postMessage)\n if (isSafeContext) {\n return true;\n }\n\n // Method 2: Connected via Safe connector\n if (isConnected && connector?.id === \"safe\") {\n return true;\n }\n\n // Method 3: Fallback\n return isSafeIframe;\n}\n\n/**\n * Check if the parent window origin matches known Safe domains.\n * This prevents false positives from other iframe contexts.\n */\nfunction isValidSafeOrigin(): boolean {\n try {\n // Try to access parent origin (may throw SecurityError for cross-origin)\n const parentOrigin = window.parent.location.origin;\n return SAFE_ORIGINS.some((origin) => parentOrigin === origin);\n } catch {\n // Cross-origin access blocked - check ancestorOrigins if available\n if (window.location.ancestorOrigins?.length) {\n const ancestorOrigin = window.location.ancestorOrigins[0];\n return SAFE_ORIGINS.some((origin) => ancestorOrigin === origin);\n }\n // Cannot determine origin - default to false to avoid false positives\n return false;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-safe-context.d.ts","sourceRoot":"","sources":["../../src/react-hooks/use-safe-context.ts"],"names":[],"mappings":"AAkCA,wBAAgB,cAAc,IAAI,OAAO,CA6CxC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-safe-context.js","sourceRoot":"","sources":["../../src/react-hooks/use-safe-context.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAM5C,MAAM,gBAAgB,GAAG,IAAI,CAAC;AA0B9B,MAAM,UAAU,cAAc;IAC5B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5C,SAAS,CAAC,GAAG,EAAE;QAEb,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,OAAO;QACT,CAAC;QAED,IAAI,SAAS,GAAG,KAAK,CAAC;QAGtB,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9B,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,SAAS,CAAC,KAAK,CAAC,CAAC;YACnB,CAAC;QACH,CAAC,EAAE,gBAAgB,CAAC,CAAC;QAGrB,MAAM,CAAC,4BAA4B,CAAC;aACjC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;YACjC,MAAM,GAAG,GAAG,IAAI,WAAW,EAAE,CAAC;YAC9B,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAC5B,CAAC,CAAC;aACD,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,SAAS,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;QACH,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,SAAS,CAAC,KAAK,CAAC,CAAC;YACnB,CAAC;QACH,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,YAAY,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\n/**\n * Timeout for Safe SDK detection in milliseconds.\n * Safe Apps SDK uses postMessage which can hang if not in Safe context.\n */\nconst SAFE_SDK_TIMEOUT = 3000;\n\n/**\n * Detect if the app is running in a Safe App context using the Safe Apps SDK.\n *\n * This hook asynchronously checks with the Safe Apps SDK to determine if\n * we're running inside a Safe App iframe. More reliable than iframe origin\n * detection because:\n * - Uses postMessage (works cross-origin)\n * - Gets definitive answer from Safe\n * - Includes timeout to prevent hangs\n *\n * @returns true if running in Safe App context, false otherwise\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const isSafeContext = useSafeContext();\n *\n * if (isSafeContext) {\n * return <p>Running in Safe App</p>;\n * }\n * return <p>Regular browser context</p>;\n * }\n * ```\n */\nexport function useSafeContext(): boolean {\n const [isSafe, setIsSafe] = useState(false);\n\n useEffect(() => {\n // SSR guard\n if (typeof window === \"undefined\") {\n return;\n }\n\n let cancelled = false;\n\n // Timeout fallback - resolve to false if SDK doesn't respond\n const timeout = setTimeout(() => {\n if (!cancelled) {\n setIsSafe(false);\n }\n }, SAFE_SDK_TIMEOUT);\n\n // Dynamically import SDK to keep it optional\n import(\"@safe-global/safe-apps-sdk\")\n .then(({ default: SafeAppsSDK }) => {\n const sdk = new SafeAppsSDK();\n return sdk.safe.getInfo();\n })\n .then(() => {\n if (!cancelled) {\n setIsSafe(true);\n }\n })\n .catch(() => {\n if (!cancelled) {\n setIsSafe(false);\n }\n })\n .finally(() => {\n clearTimeout(timeout);\n });\n\n return () => {\n cancelled = true;\n clearTimeout(timeout);\n };\n }, []);\n\n return isSafe;\n}\n"]}
|