@prb/effect-evm 1.0.0-beta.5 → 1.0.0-beta.7
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/constants/index.d.ts +0 -4
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +1 -5
- package/dist/constants/index.js.map +1 -1
- package/dist/contract/pipeline/internal/core.d.ts +2 -2
- package/dist/contract/pipeline/internal/core.d.ts.map +1 -1
- package/dist/contract/pipeline/internal/core.js.map +1 -1
- package/dist/contract/pipeline/internal/receipt.d.ts +2 -2
- package/dist/contract/pipeline/internal/receipt.d.ts.map +1 -1
- package/dist/contract/pipeline/internal/receipt.js +1 -1
- package/dist/contract/pipeline/internal/receipt.js.map +1 -1
- package/dist/contract/pipeline/service.d.ts +3 -3
- package/dist/contract/pipeline/service.d.ts.map +1 -1
- package/dist/contract/pipeline/service.js.map +1 -1
- package/dist/contract/pipeline/types.d.ts +2 -2
- package/dist/contract/pipeline/types.d.ts.map +1 -1
- package/dist/contract/pipeline/types.js.map +1 -1
- package/dist/contract/pipeline/write-and-track.d.ts.map +1 -1
- package/dist/contract/pipeline/write-and-track.js +5 -6
- package/dist/contract/pipeline/write-and-track.js.map +1 -1
- package/dist/contract/pipeline/write-and-wait.d.ts +1 -1
- package/dist/contract/pipeline/write-and-wait.d.ts.map +1 -1
- package/dist/core/errors/transaction.d.ts +7 -7
- package/dist/core/errors/transaction.d.ts.map +1 -1
- package/dist/core/errors/transaction.js +2 -2
- package/dist/core/errors/transaction.js.map +1 -1
- package/dist/core/errors/viem-mapper.d.ts +3 -3
- package/dist/core/errors/viem-mapper.d.ts.map +1 -1
- package/dist/core/errors/viem-mapper.js +3 -3
- package/dist/core/errors/viem-mapper.js.map +1 -1
- package/dist/deploy/service.d.ts +3 -3
- package/dist/deploy/service.d.ts.map +1 -1
- package/dist/deploy/service.js.map +1 -1
- package/dist/eip7702/errors.d.ts +3 -3
- package/dist/eip7702/errors.d.ts.map +1 -1
- package/dist/eip7702/errors.js +1 -1
- package/dist/eip7702/errors.js.map +1 -1
- package/dist/eip7702/service.d.ts +8 -8
- package/dist/eip7702/service.d.ts.map +1 -1
- package/dist/eip7702/service.js +2 -2
- package/dist/eip7702/service.js.map +1 -1
- package/dist/react-hooks/index.d.ts +0 -4
- package/dist/react-hooks/index.d.ts.map +1 -1
- package/dist/react-hooks/index.js +0 -4
- package/dist/react-hooks/index.js.map +1 -1
- package/dist/subscriptions/pending-tx.d.ts +1 -1
- package/dist/subscriptions/pending-tx.d.ts.map +1 -1
- package/dist/subscriptions/pending-tx.js +1 -1
- package/dist/subscriptions/pending-tx.js.map +1 -1
- package/dist/subscriptions/service.d.ts +2 -2
- package/dist/subscriptions/service.d.ts.map +1 -1
- package/dist/subscriptions/service.js +4 -4
- package/dist/subscriptions/service.js.map +1 -1
- package/dist/testing-kit/mock-subscription-service.d.ts +2 -2
- package/dist/testing-kit/mock-subscription-service.d.ts.map +1 -1
- package/dist/testing-kit/mock-subscription-service.js +5 -5
- package/dist/testing-kit/mock-subscription-service.js.map +1 -1
- package/dist/testing-kit/mock-transfer-service.d.ts +3 -3
- package/dist/testing-kit/mock-transfer-service.d.ts.map +1 -1
- package/dist/testing-kit/mock-transfer-service.js.map +1 -1
- package/dist/transfer/service.d.ts +3 -3
- package/dist/transfer/service.d.ts.map +1 -1
- package/dist/transfer/service.js +3 -3
- package/dist/transfer/service.js.map +1 -1
- package/dist/tx/manager.d.ts +3 -2
- package/dist/tx/manager.d.ts.map +1 -1
- package/dist/tx/manager.js +232 -216
- package/dist/tx/manager.js.map +1 -1
- package/dist/tx/manager.test.integration.js +25 -5
- package/dist/tx/manager.test.integration.js.map +1 -1
- package/dist/tx/policy.d.ts +0 -1
- package/dist/tx/policy.d.ts.map +1 -1
- package/dist/tx/policy.js.map +1 -1
- package/dist/tx/replacement.d.ts +3 -3
- package/dist/tx/replacement.d.ts.map +1 -1
- package/dist/tx/replacement.js +3 -3
- package/dist/tx/replacement.js.map +1 -1
- package/dist/tx/tracker.d.ts +6 -6
- package/dist/tx/tracker.d.ts.map +1 -1
- package/dist/tx/tracker.js +9 -9
- package/dist/tx/tracker.js.map +1 -1
- package/dist/types/params.d.ts +1 -1
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/params.js.map +1 -1
- package/dist/wallet/errors.d.ts +3 -3
- package/dist/wallet/errors.d.ts.map +1 -1
- package/dist/wallet/errors.js +1 -1
- package/dist/wallet/errors.js.map +1 -1
- package/dist/wallet/operations.d.ts +2 -2
- package/dist/wallet/operations.d.ts.map +1 -1
- package/dist/wallet/operations.js +2 -2
- package/dist/wallet/operations.js.map +1 -1
- package/dist/wallet/service.d.ts +2 -2
- package/dist/wallet/service.d.ts.map +1 -1
- package/dist/wallet/service.js.map +1 -1
- package/package.json +1 -6
- package/dist/react-hooks/safe-app-origins.d.ts +0 -8
- package/dist/react-hooks/safe-app-origins.d.ts.map +0 -1
- package/dist/react-hooks/safe-app-origins.js +0 -124
- package/dist/react-hooks/safe-app-origins.js.map +0 -1
- package/dist/react-hooks/use-is-host-safe-app.d.ts +0 -2
- package/dist/react-hooks/use-is-host-safe-app.d.ts.map +0 -1
- package/dist/react-hooks/use-is-host-safe-app.js +0 -16
- package/dist/react-hooks/use-is-host-safe-app.js.map +0 -1
- package/dist/react-hooks/use-is-safe-app-context.d.ts +0 -2
- package/dist/react-hooks/use-is-safe-app-context.d.ts.map +0 -1
- package/dist/react-hooks/use-is-safe-app-context.js +0 -41
- package/dist/react-hooks/use-is-safe-app-context.js.map +0 -1
- package/dist/react-hooks/use-is-safe-multisig-wallet.d.ts +0 -2
- package/dist/react-hooks/use-is-safe-multisig-wallet.d.ts.map +0 -1
- package/dist/react-hooks/use-is-safe-multisig-wallet.js +0 -24
- package/dist/react-hooks/use-is-safe-multisig-wallet.js.map +0 -1
- package/dist/safe/adapter.d.ts +0 -9
- package/dist/safe/adapter.d.ts.map +0 -1
- package/dist/safe/adapter.js +0 -13
- package/dist/safe/adapter.js.map +0 -1
- package/dist/safe/detection.d.ts +0 -26
- package/dist/safe/detection.d.ts.map +0 -1
- package/dist/safe/detection.js +0 -102
- package/dist/safe/detection.js.map +0 -1
- package/dist/safe/detection.test.integration.d.ts +0 -2
- package/dist/safe/detection.test.integration.d.ts.map +0 -1
- package/dist/safe/detection.test.integration.js +0 -92
- package/dist/safe/detection.test.integration.js.map +0 -1
- package/dist/safe/errors.d.ts +0 -79
- package/dist/safe/errors.d.ts.map +0 -1
- package/dist/safe/errors.js +0 -34
- package/dist/safe/errors.js.map +0 -1
- package/dist/safe/index.d.ts +0 -8
- package/dist/safe/index.d.ts.map +0 -1
- package/dist/safe/index.js +0 -6
- package/dist/safe/index.js.map +0 -1
- package/dist/safe/live.d.ts +0 -8
- package/dist/safe/live.d.ts.map +0 -1
- package/dist/safe/live.js +0 -250
- package/dist/safe/live.js.map +0 -1
- package/dist/safe/service.d.ts +0 -26
- package/dist/safe/service.d.ts.map +0 -1
- package/dist/safe/service.js +0 -4
- package/dist/safe/service.js.map +0 -1
- package/dist/safe/service.test.integration.d.ts +0 -2
- package/dist/safe/service.test.integration.d.ts.map +0 -1
- package/dist/safe/service.test.integration.js +0 -171
- package/dist/safe/service.test.integration.js.map +0 -1
- package/dist/safe/simulation/abis.d.ts +0 -73
- package/dist/safe/simulation/abis.d.ts.map +0 -1
- package/dist/safe/simulation/abis.js +0 -61
- package/dist/safe/simulation/abis.js.map +0 -1
- package/dist/safe/simulation/addresses.d.ts +0 -4
- package/dist/safe/simulation/addresses.d.ts.map +0 -1
- package/dist/safe/simulation/addresses.js +0 -54
- package/dist/safe/simulation/addresses.js.map +0 -1
- package/dist/safe/simulation/encoding.d.ts +0 -16
- package/dist/safe/simulation/encoding.d.ts.map +0 -1
- package/dist/safe/simulation/encoding.js +0 -36
- package/dist/safe/simulation/encoding.js.map +0 -1
- package/dist/safe/simulation/errors.d.ts +0 -56
- package/dist/safe/simulation/errors.d.ts.map +0 -1
- package/dist/safe/simulation/errors.js +0 -37
- package/dist/safe/simulation/errors.js.map +0 -1
- package/dist/safe/simulation/index.d.ts +0 -7
- package/dist/safe/simulation/index.d.ts.map +0 -1
- package/dist/safe/simulation/index.js +0 -6
- package/dist/safe/simulation/index.js.map +0 -1
- package/dist/safe/simulation/internal/calldata/calldata.d.ts +0 -5
- package/dist/safe/simulation/internal/calldata/calldata.d.ts.map +0 -1
- package/dist/safe/simulation/internal/calldata/calldata.js +0 -17
- package/dist/safe/simulation/internal/calldata/calldata.js.map +0 -1
- package/dist/safe/simulation/internal/calldata/index.d.ts +0 -2
- package/dist/safe/simulation/internal/calldata/index.d.ts.map +0 -1
- package/dist/safe/simulation/internal/calldata/index.js +0 -2
- package/dist/safe/simulation/internal/calldata/index.js.map +0 -1
- package/dist/safe/simulation/internal/contracts/contracts.d.ts +0 -5
- package/dist/safe/simulation/internal/contracts/contracts.d.ts.map +0 -1
- package/dist/safe/simulation/internal/contracts/contracts.js +0 -25
- package/dist/safe/simulation/internal/contracts/contracts.js.map +0 -1
- package/dist/safe/simulation/internal/contracts/index.d.ts +0 -2
- package/dist/safe/simulation/internal/contracts/index.d.ts.map +0 -1
- package/dist/safe/simulation/internal/contracts/index.js +0 -2
- package/dist/safe/simulation/internal/contracts/index.js.map +0 -1
- package/dist/safe/simulation/internal/evaluation/evaluation.d.ts +0 -6
- package/dist/safe/simulation/internal/evaluation/evaluation.d.ts.map +0 -1
- package/dist/safe/simulation/internal/evaluation/evaluation.js +0 -20
- package/dist/safe/simulation/internal/evaluation/evaluation.js.map +0 -1
- package/dist/safe/simulation/internal/evaluation/index.d.ts +0 -2
- package/dist/safe/simulation/internal/evaluation/index.d.ts.map +0 -1
- package/dist/safe/simulation/internal/evaluation/index.js +0 -2
- package/dist/safe/simulation/internal/evaluation/index.js.map +0 -1
- package/dist/safe/simulation/internal/execution/execution.d.ts +0 -9
- package/dist/safe/simulation/internal/execution/execution.d.ts.map +0 -1
- package/dist/safe/simulation/internal/execution/execution.js +0 -65
- package/dist/safe/simulation/internal/execution/execution.js.map +0 -1
- package/dist/safe/simulation/internal/execution/index.d.ts +0 -2
- package/dist/safe/simulation/internal/execution/index.d.ts.map +0 -1
- package/dist/safe/simulation/internal/execution/index.js +0 -2
- package/dist/safe/simulation/internal/execution/index.js.map +0 -1
- package/dist/safe/simulation/internal/limits/index.d.ts +0 -2
- package/dist/safe/simulation/internal/limits/index.d.ts.map +0 -1
- package/dist/safe/simulation/internal/limits/index.js +0 -2
- package/dist/safe/simulation/internal/limits/index.js.map +0 -1
- package/dist/safe/simulation/internal/limits/limits.d.ts +0 -5
- package/dist/safe/simulation/internal/limits/limits.d.ts.map +0 -1
- package/dist/safe/simulation/internal/limits/limits.js +0 -18
- package/dist/safe/simulation/internal/limits/limits.js.map +0 -1
- package/dist/safe/simulation/internal/types/index.d.ts +0 -2
- package/dist/safe/simulation/internal/types/index.d.ts.map +0 -1
- package/dist/safe/simulation/internal/types/index.js +0 -2
- package/dist/safe/simulation/internal/types/index.js.map +0 -1
- package/dist/safe/simulation/internal/types/types.d.ts +0 -11
- package/dist/safe/simulation/internal/types/types.d.ts.map +0 -1
- package/dist/safe/simulation/internal/types/types.js +0 -2
- package/dist/safe/simulation/internal/types/types.js.map +0 -1
- package/dist/safe/simulation/internal/validation/index.d.ts +0 -2
- package/dist/safe/simulation/internal/validation/index.d.ts.map +0 -1
- package/dist/safe/simulation/internal/validation/index.js +0 -2
- package/dist/safe/simulation/internal/validation/index.js.map +0 -1
- package/dist/safe/simulation/internal/validation/validation.d.ts +0 -5
- package/dist/safe/simulation/internal/validation/validation.d.ts.map +0 -1
- package/dist/safe/simulation/internal/validation/validation.js +0 -27
- package/dist/safe/simulation/internal/validation/validation.js.map +0 -1
- package/dist/safe/simulation/service.d.ts +0 -14
- package/dist/safe/simulation/service.d.ts.map +0 -1
- package/dist/safe/simulation/service.js +0 -25
- package/dist/safe/simulation/service.js.map +0 -1
- package/dist/safe/simulation/types.d.ts +0 -20
- package/dist/safe/simulation/types.d.ts.map +0 -1
- package/dist/safe/simulation/types.js +0 -2
- package/dist/safe/simulation/types.js.map +0 -1
- package/dist/safe/types.d.ts +0 -61
- package/dist/safe/types.d.ts.map +0 -1
- package/dist/safe/types.js +0 -2
- package/dist/safe/types.js.map +0 -1
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
export declare const safeAbis: {
|
|
2
|
-
readonly multiSend: readonly [{
|
|
3
|
-
readonly inputs: readonly [{
|
|
4
|
-
readonly internalType: "bytes";
|
|
5
|
-
readonly name: "transactions";
|
|
6
|
-
readonly type: "bytes";
|
|
7
|
-
}];
|
|
8
|
-
readonly name: "multiSend";
|
|
9
|
-
readonly outputs: readonly [];
|
|
10
|
-
readonly stateMutability: "payable";
|
|
11
|
-
readonly type: "function";
|
|
12
|
-
}];
|
|
13
|
-
readonly multisig: readonly [{
|
|
14
|
-
readonly inputs: readonly [];
|
|
15
|
-
readonly name: "getOwners";
|
|
16
|
-
readonly outputs: readonly [{
|
|
17
|
-
readonly name: "";
|
|
18
|
-
readonly type: "address[]";
|
|
19
|
-
}];
|
|
20
|
-
readonly stateMutability: "view";
|
|
21
|
-
readonly type: "function";
|
|
22
|
-
}, {
|
|
23
|
-
readonly inputs: readonly [{
|
|
24
|
-
readonly internalType: "address";
|
|
25
|
-
readonly name: "targetContract";
|
|
26
|
-
readonly type: "address";
|
|
27
|
-
}, {
|
|
28
|
-
readonly internalType: "bytes";
|
|
29
|
-
readonly name: "calldataPayload";
|
|
30
|
-
readonly type: "bytes";
|
|
31
|
-
}];
|
|
32
|
-
readonly name: "simulateAndRevert";
|
|
33
|
-
readonly outputs: readonly [];
|
|
34
|
-
readonly stateMutability: "nonpayable";
|
|
35
|
-
readonly type: "function";
|
|
36
|
-
}];
|
|
37
|
-
readonly simulateAccessor: readonly [{
|
|
38
|
-
readonly inputs: readonly [{
|
|
39
|
-
readonly internalType: "address";
|
|
40
|
-
readonly name: "to";
|
|
41
|
-
readonly type: "address";
|
|
42
|
-
}, {
|
|
43
|
-
readonly internalType: "uint256";
|
|
44
|
-
readonly name: "value";
|
|
45
|
-
readonly type: "uint256";
|
|
46
|
-
}, {
|
|
47
|
-
readonly internalType: "bytes";
|
|
48
|
-
readonly name: "data";
|
|
49
|
-
readonly type: "bytes";
|
|
50
|
-
}, {
|
|
51
|
-
readonly internalType: "enum Enum.Operation";
|
|
52
|
-
readonly name: "operation";
|
|
53
|
-
readonly type: "uint8";
|
|
54
|
-
}];
|
|
55
|
-
readonly name: "simulate";
|
|
56
|
-
readonly outputs: readonly [{
|
|
57
|
-
readonly internalType: "uint256";
|
|
58
|
-
readonly name: "estimate";
|
|
59
|
-
readonly type: "uint256";
|
|
60
|
-
}, {
|
|
61
|
-
readonly internalType: "bool";
|
|
62
|
-
readonly name: "success";
|
|
63
|
-
readonly type: "bool";
|
|
64
|
-
}, {
|
|
65
|
-
readonly internalType: "bytes";
|
|
66
|
-
readonly name: "returnData";
|
|
67
|
-
readonly type: "bytes";
|
|
68
|
-
}];
|
|
69
|
-
readonly stateMutability: "nonpayable";
|
|
70
|
-
readonly type: "function";
|
|
71
|
-
}];
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=abis.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abis.d.ts","sourceRoot":"","sources":["../../../src/safe/simulation/abis.ts"],"names":[],"mappings":"AAkEA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIX,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
const multisigAbi = [
|
|
2
|
-
{
|
|
3
|
-
inputs: [],
|
|
4
|
-
name: "getOwners",
|
|
5
|
-
outputs: [
|
|
6
|
-
{
|
|
7
|
-
name: "",
|
|
8
|
-
type: "address[]",
|
|
9
|
-
},
|
|
10
|
-
],
|
|
11
|
-
stateMutability: "view",
|
|
12
|
-
type: "function",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
inputs: [
|
|
16
|
-
{ internalType: "address", name: "targetContract", type: "address" },
|
|
17
|
-
{ internalType: "bytes", name: "calldataPayload", type: "bytes" },
|
|
18
|
-
],
|
|
19
|
-
name: "simulateAndRevert",
|
|
20
|
-
outputs: [],
|
|
21
|
-
stateMutability: "nonpayable",
|
|
22
|
-
type: "function",
|
|
23
|
-
},
|
|
24
|
-
];
|
|
25
|
-
const multiSendAbi = [
|
|
26
|
-
{
|
|
27
|
-
inputs: [{ internalType: "bytes", name: "transactions", type: "bytes" }],
|
|
28
|
-
name: "multiSend",
|
|
29
|
-
outputs: [],
|
|
30
|
-
stateMutability: "payable",
|
|
31
|
-
type: "function",
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
const simulateAccessorAbi = [
|
|
35
|
-
{
|
|
36
|
-
inputs: [
|
|
37
|
-
{ internalType: "address", name: "to", type: "address" },
|
|
38
|
-
{ internalType: "uint256", name: "value", type: "uint256" },
|
|
39
|
-
{ internalType: "bytes", name: "data", type: "bytes" },
|
|
40
|
-
{
|
|
41
|
-
internalType: "enum Enum.Operation",
|
|
42
|
-
name: "operation",
|
|
43
|
-
type: "uint8",
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
name: "simulate",
|
|
47
|
-
outputs: [
|
|
48
|
-
{ internalType: "uint256", name: "estimate", type: "uint256" },
|
|
49
|
-
{ internalType: "bool", name: "success", type: "bool" },
|
|
50
|
-
{ internalType: "bytes", name: "returnData", type: "bytes" },
|
|
51
|
-
],
|
|
52
|
-
stateMutability: "nonpayable",
|
|
53
|
-
type: "function",
|
|
54
|
-
},
|
|
55
|
-
];
|
|
56
|
-
export const safeAbis = {
|
|
57
|
-
multiSend: multiSendAbi,
|
|
58
|
-
multisig: multisigAbi,
|
|
59
|
-
simulateAccessor: simulateAccessorAbi,
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=abis.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abis.js","sourceRoot":"","sources":["../../../src/safe/simulation/abis.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,GAAG;IAClB;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,WAAW;aAClB;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE;YACN,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE;YACpE,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,EAAE;SAClE;QACD,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAM,YAAY,GAAG;IACnB;QACE,MAAM,EAAE,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QACxE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,SAAS;QAC1B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAM,mBAAmB,GAAG;IAC1B;QACE,MAAM,EAAE;YACN,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;YACxD,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;YAC3D,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE;YACtD;gBACE,YAAY,EAAE,qBAAqB;gBACnC,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,OAAO;aACd;SACF;QACD,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE;YACP,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;YAC9D,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE;YACvD,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE;SAC7D;QACD,eAAe,EAAE,YAAY;QAC7B,IAAI,EAAE,UAAU;KACjB;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE,WAAW;IACrB,gBAAgB,EAAE,mBAAmB;CAC7B,CAAC","sourcesContent":["/**\n * Safe multisig ABIs for gas simulation and multi-send operations.\n *\n * @see https://github.com/safe-global/safe-deployments\n * @see https://github.com/safe-global/safe-core-sdk/issues/1182\n * @see https://ethereum.stackexchange.com/q/168410/24693\n */\n\nconst multisigAbi = [\n {\n inputs: [],\n name: \"getOwners\",\n outputs: [\n {\n name: \"\",\n type: \"address[]\",\n },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { internalType: \"address\", name: \"targetContract\", type: \"address\" },\n { internalType: \"bytes\", name: \"calldataPayload\", type: \"bytes\" },\n ],\n name: \"simulateAndRevert\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n\nconst multiSendAbi = [\n {\n inputs: [{ internalType: \"bytes\", name: \"transactions\", type: \"bytes\" }],\n name: \"multiSend\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n] as const;\n\nconst simulateAccessorAbi = [\n {\n inputs: [\n { internalType: \"address\", name: \"to\", type: \"address\" },\n { internalType: \"uint256\", name: \"value\", type: \"uint256\" },\n { internalType: \"bytes\", name: \"data\", type: \"bytes\" },\n {\n internalType: \"enum Enum.Operation\",\n name: \"operation\",\n type: \"uint8\",\n },\n ],\n name: \"simulate\",\n outputs: [\n { internalType: \"uint256\", name: \"estimate\", type: \"uint256\" },\n { internalType: \"bool\", name: \"success\", type: \"bool\" },\n { internalType: \"bytes\", name: \"returnData\", type: \"bytes\" },\n ],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n] as const;\n\nexport const safeAbis = {\n multiSend: multiSendAbi,\n multisig: multisigAbi,\n simulateAccessor: simulateAccessorAbi,\n} as const;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../../src/safe/simulation/addresses.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAwEpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAmBxE;AAOD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAmB/E"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { abstract, arbitrum, avalanche, base, baseSepolia, berachain, blast, bsc, gnosis, lightlinkPhoenix, linea, mainnet, mode, monad, morph, optimism, polygon, scroll, sei, sepolia, sonic, unichainSepolia, xdc, zksync, } from "viem/chains";
|
|
2
|
-
const SAFE_MULTI_SEND_CHAIN_IDS = [
|
|
3
|
-
abstract.id,
|
|
4
|
-
arbitrum.id,
|
|
5
|
-
avalanche.id,
|
|
6
|
-
base.id,
|
|
7
|
-
baseSepolia.id,
|
|
8
|
-
berachain.id,
|
|
9
|
-
blast.id,
|
|
10
|
-
bsc.id,
|
|
11
|
-
gnosis.id,
|
|
12
|
-
lightlinkPhoenix.id,
|
|
13
|
-
linea.id,
|
|
14
|
-
mainnet.id,
|
|
15
|
-
mode.id,
|
|
16
|
-
monad.id,
|
|
17
|
-
morph.id,
|
|
18
|
-
optimism.id,
|
|
19
|
-
polygon.id,
|
|
20
|
-
scroll.id,
|
|
21
|
-
sei.id,
|
|
22
|
-
sepolia.id,
|
|
23
|
-
sonic.id,
|
|
24
|
-
unichainSepolia.id,
|
|
25
|
-
xdc.id,
|
|
26
|
-
zksync.id,
|
|
27
|
-
];
|
|
28
|
-
const ZK_ROLLUP_CHAIN_IDS = [abstract.id, zksync.id];
|
|
29
|
-
const CUSTOM_DEPLOYMENT_CHAIN_IDS = [lightlinkPhoenix.id, xdc.id];
|
|
30
|
-
export function getMultiSendAddress(chainId) {
|
|
31
|
-
if (!SAFE_MULTI_SEND_CHAIN_IDS.includes(chainId)) {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
if (ZK_ROLLUP_CHAIN_IDS.includes(chainId)) {
|
|
35
|
-
return "0xf220D3b4DFb23C4ade8C88E526C1353AbAcbC38F";
|
|
36
|
-
}
|
|
37
|
-
if (CUSTOM_DEPLOYMENT_CHAIN_IDS.includes(chainId)) {
|
|
38
|
-
return "0x40A2aCCbd92BCA938b02010E17A5b8929b49130D";
|
|
39
|
-
}
|
|
40
|
-
return "0x9641d764fc13c8B624c04430C7356C1C7C8102e2";
|
|
41
|
-
}
|
|
42
|
-
export function getSimulateAccessorAddress(chainId) {
|
|
43
|
-
if (!SAFE_MULTI_SEND_CHAIN_IDS.includes(chainId)) {
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
if (ZK_ROLLUP_CHAIN_IDS.includes(chainId)) {
|
|
47
|
-
return "0x4191E2e12E8BC5002424CE0c51f9947b02675a44";
|
|
48
|
-
}
|
|
49
|
-
if (CUSTOM_DEPLOYMENT_CHAIN_IDS.includes(chainId)) {
|
|
50
|
-
return "0x59AD6735bCd8152B84860Cb256dD9e96b85F69Da";
|
|
51
|
-
}
|
|
52
|
-
return "0x3d4BA2E0884aa488718476ca2FB8Efc291A46199";
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=addresses.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/safe/simulation/addresses.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,WAAW,EACX,SAAS,EACT,KAAK,EACL,GAAG,EACH,MAAM,EACN,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,IAAI,EACJ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,OAAO,EACP,MAAM,EACN,GAAG,EACH,OAAO,EACP,KAAK,EACL,eAAe,EACf,GAAG,EACH,MAAM,GACP,MAAM,aAAa,CAAC;AAQrB,MAAM,yBAAyB,GAAG;IAChC,QAAQ,CAAC,EAAE;IACX,QAAQ,CAAC,EAAE;IACX,SAAS,CAAC,EAAE;IACZ,IAAI,CAAC,EAAE;IACP,WAAW,CAAC,EAAE;IACd,SAAS,CAAC,EAAE;IACZ,KAAK,CAAC,EAAE;IACR,GAAG,CAAC,EAAE;IACN,MAAM,CAAC,EAAE;IACT,gBAAgB,CAAC,EAAE;IACnB,KAAK,CAAC,EAAE;IACR,OAAO,CAAC,EAAE;IACV,IAAI,CAAC,EAAE;IACP,KAAK,CAAC,EAAE;IACR,KAAK,CAAC,EAAE;IACR,QAAQ,CAAC,EAAE;IACX,OAAO,CAAC,EAAE;IACV,MAAM,CAAC,EAAE;IACT,GAAG,CAAC,EAAE;IACN,OAAO,CAAC,EAAE;IACV,KAAK,CAAC,EAAE;IACR,eAAe,CAAC,EAAE;IAClB,GAAG,CAAC,EAAE;IACN,MAAM,CAAC,EAAE;CACD,CAAC;AAGX,MAAM,mBAAmB,GAAG,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAU,CAAC;AAG9D,MAAM,2BAA2B,GAAG,CAAC,gBAAgB,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAU,CAAC;AAO3E,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,IAAI,CAAC,yBAAyB,CAAC,QAAQ,CAAC,OAAqD,CAAC,EAAE,CAAC;QAC/F,OAAO,SAAS,CAAC;IACnB,CAAC;IAGD,IAAI,mBAAmB,CAAC,QAAQ,CAAC,OAA+C,CAAC,EAAE,CAAC;QAClF,OAAO,4CAA4C,CAAC;IACtD,CAAC;IAGD,IACE,2BAA2B,CAAC,QAAQ,CAAC,OAAuD,CAAC,EAC7F,CAAC;QACD,OAAO,4CAA4C,CAAC;IACtD,CAAC;IAGD,OAAO,4CAA4C,CAAC;AACtD,CAAC;AAOD,MAAM,UAAU,0BAA0B,CAAC,OAAe;IACxD,IAAI,CAAC,yBAAyB,CAAC,QAAQ,CAAC,OAAqD,CAAC,EAAE,CAAC;QAC/F,OAAO,SAAS,CAAC;IACnB,CAAC;IAGD,IAAI,mBAAmB,CAAC,QAAQ,CAAC,OAA+C,CAAC,EAAE,CAAC;QAClF,OAAO,4CAA4C,CAAC;IACtD,CAAC;IAGD,IACE,2BAA2B,CAAC,QAAQ,CAAC,OAAuD,CAAC,EAC7F,CAAC;QACD,OAAO,4CAA4C,CAAC;IACtD,CAAC;IAGD,OAAO,4CAA4C,CAAC;AACtD,CAAC","sourcesContent":["/**\n * Safe contract addresses for gas simulation and multi-send operations.\n *\n * @see https://github.com/safe-global/safe-deployments/blob/main/src/assets/v1.4.1/multi_send_call_only.json\n * @see https://github.com/safe-global/safe-deployments/blob/main/src/assets/v1.4.1/simulate_tx_accessor.json\n */\nimport type { Address } from \"viem\";\nimport {\n abstract,\n arbitrum,\n avalanche,\n base,\n baseSepolia,\n berachain,\n blast,\n bsc,\n gnosis,\n lightlinkPhoenix,\n linea,\n mainnet,\n mode,\n monad,\n morph,\n optimism,\n polygon,\n scroll,\n sei,\n sepolia,\n sonic,\n unichainSepolia,\n xdc,\n zksync,\n} from \"viem/chains\";\n\n/**\n * Chain IDs for address resolution.\n * These are defined as constants for clarity and maintainability.\n */\n\n/** Chains where Safe MultiSend is available (sourced from old-ui) */\nconst SAFE_MULTI_SEND_CHAIN_IDS = [\n abstract.id,\n arbitrum.id,\n avalanche.id,\n base.id,\n baseSepolia.id,\n berachain.id,\n blast.id,\n bsc.id,\n gnosis.id,\n lightlinkPhoenix.id,\n linea.id,\n mainnet.id,\n mode.id,\n monad.id,\n morph.id,\n optimism.id,\n polygon.id,\n scroll.id,\n sei.id,\n sepolia.id,\n sonic.id,\n unichainSepolia.id,\n xdc.id,\n zksync.id,\n] as const;\n\n/** ZK rollups with custom Safe deployments */\nconst ZK_ROLLUP_CHAIN_IDS = [abstract.id, zksync.id] as const;\n\n/** Chains with custom (non-canonical) Safe deployments */\nconst CUSTOM_DEPLOYMENT_CHAIN_IDS = [lightlinkPhoenix.id, xdc.id] as const;\n\n/**\n * Get the MultiSend contract address for a given chain.\n *\n * Returns undefined for chains where Safe is not deployed.\n */\nexport function getMultiSendAddress(chainId: number): Address | undefined {\n if (!SAFE_MULTI_SEND_CHAIN_IDS.includes(chainId as (typeof SAFE_MULTI_SEND_CHAIN_IDS)[number])) {\n return undefined;\n }\n\n // ZK rollups with custom deployments (Abstract, ZKsync)\n if (ZK_ROLLUP_CHAIN_IDS.includes(chainId as (typeof ZK_ROLLUP_CHAIN_IDS)[number])) {\n return \"0xf220D3b4DFb23C4ade8C88E526C1353AbAcbC38F\";\n }\n\n // Chains with custom deployments (Lightlink, XDC)\n if (\n CUSTOM_DEPLOYMENT_CHAIN_IDS.includes(chainId as (typeof CUSTOM_DEPLOYMENT_CHAIN_IDS)[number])\n ) {\n return \"0x40A2aCCbd92BCA938b02010E17A5b8929b49130D\";\n }\n\n // Canonical deployment for all other chains\n return \"0x9641d764fc13c8B624c04430C7356C1C7C8102e2\";\n}\n\n/**\n * Get the SimulateAccessor contract address for a given chain.\n *\n * Returns undefined for chains where Safe is not deployed.\n */\nexport function getSimulateAccessorAddress(chainId: number): Address | undefined {\n if (!SAFE_MULTI_SEND_CHAIN_IDS.includes(chainId as (typeof SAFE_MULTI_SEND_CHAIN_IDS)[number])) {\n return undefined;\n }\n\n // ZK rollups with custom deployments (Abstract, ZKsync)\n if (ZK_ROLLUP_CHAIN_IDS.includes(chainId as (typeof ZK_ROLLUP_CHAIN_IDS)[number])) {\n return \"0x4191E2e12E8BC5002424CE0c51f9947b02675a44\";\n }\n\n // Chains with custom deployments (Lightlink, XDC)\n if (\n CUSTOM_DEPLOYMENT_CHAIN_IDS.includes(chainId as (typeof CUSTOM_DEPLOYMENT_CHAIN_IDS)[number])\n ) {\n return \"0x59AD6735bCd8152B84860Cb256dD9e96b85F69Da\";\n }\n\n // Canonical deployment for all other chains\n return \"0x3d4BA2E0884aa488718476ca2FB8Efc291A46199\";\n}\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Address, Hex } from "viem";
|
|
2
|
-
import type { SafeSimulationTransaction } from "./types.js";
|
|
3
|
-
type InternalTransaction = {
|
|
4
|
-
data: Hex;
|
|
5
|
-
operation: 0 | 1;
|
|
6
|
-
to: Address;
|
|
7
|
-
value: bigint;
|
|
8
|
-
};
|
|
9
|
-
export declare function encodeInternalTransaction(tx: InternalTransaction): string;
|
|
10
|
-
export declare function encodeMultiSend(transactions: SafeSimulationTransaction[]): Hex;
|
|
11
|
-
export declare function decodeSimulationData(revertData: string): {
|
|
12
|
-
gas: bigint;
|
|
13
|
-
success: boolean;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=encoding.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../../src/safe/simulation/encoding.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAGzC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAG5D,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,GAAG,CAAC;IACV,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC;IACjB,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAoBF,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,mBAAmB,GAAG,MAAM,CAMzE;AAQD,wBAAgB,eAAe,CAAC,YAAY,EAAE,yBAAyB,EAAE,GAAG,GAAG,CAe9E;AAeD,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG;IACxD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;CAClB,CAyBA"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { decodeAbiParameters, encodeFunctionData, encodePacked } from "viem";
|
|
2
|
-
import { safeAbis } from "./abis.js";
|
|
3
|
-
export function encodeInternalTransaction(tx) {
|
|
4
|
-
const encoded = encodePacked(["uint8", "address", "uint256", "uint256", "bytes"], [tx.operation, tx.to, tx.value, BigInt((tx.data.length - 2) / 2), tx.data]);
|
|
5
|
-
return encoded.slice(2);
|
|
6
|
-
}
|
|
7
|
-
export function encodeMultiSend(transactions) {
|
|
8
|
-
const internals = transactions.map((tx) => ({
|
|
9
|
-
data: tx.data,
|
|
10
|
-
operation: tx.operation ?? 0,
|
|
11
|
-
to: tx.to,
|
|
12
|
-
value: tx.value,
|
|
13
|
-
}));
|
|
14
|
-
const packedData = `0x${internals.map(encodeInternalTransaction).join("")}`;
|
|
15
|
-
return encodeFunctionData({
|
|
16
|
-
abi: safeAbis.multiSend,
|
|
17
|
-
args: [packedData],
|
|
18
|
-
functionName: "multiSend",
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
export function decodeSimulationData(revertData) {
|
|
22
|
-
const minLength = 258;
|
|
23
|
-
if (revertData.length < minLength) {
|
|
24
|
-
throw new Error(`Invalid simulation data: revert data too short. Expected at least ${minLength} characters (${(minLength - 2) / 2} bytes), got ${revertData.length} characters (${Math.max(0, (revertData.length - 2) / 2)} bytes)`);
|
|
25
|
-
}
|
|
26
|
-
const gasAndSuccessData = revertData.slice(2).slice(128, 256);
|
|
27
|
-
const decoded = decodeAbiParameters([
|
|
28
|
-
{ name: "estimate", type: "uint256" },
|
|
29
|
-
{ name: "success", type: "bool" },
|
|
30
|
-
], `0x${gasAndSuccessData}`);
|
|
31
|
-
return {
|
|
32
|
-
gas: decoded[0],
|
|
33
|
-
success: decoded[1],
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=encoding.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../../src/safe/simulation/encoding.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AA6BrC,MAAM,UAAU,yBAAyB,CAAC,EAAuB;IAC/D,MAAM,OAAO,GAAG,YAAY,CAC1B,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EACnD,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAC3E,CAAC;IACF,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC;AAQD,MAAM,UAAU,eAAe,CAAC,YAAyC;IACvE,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC1C,IAAI,EAAE,EAAE,CAAC,IAAI;QACb,SAAS,EAAE,EAAE,CAAC,SAAS,IAAI,CAAC;QAC5B,EAAE,EAAE,EAAE,CAAC,EAAE;QACT,KAAK,EAAE,EAAE,CAAC,KAAK;KAChB,CAAC,CAAC,CAAC;IAEJ,MAAM,UAAU,GAAG,KAAK,SAAS,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAS,CAAC;IAEnF,OAAO,kBAAkB,CAAC;QACxB,GAAG,EAAE,QAAQ,CAAC,SAAS;QACvB,IAAI,EAAE,CAAC,UAAU,CAAC;QAClB,YAAY,EAAE,WAAW;KAC1B,CAAC,CAAC;AACL,CAAC;AAeD,MAAM,UAAU,oBAAoB,CAAC,UAAkB;IAOrD,MAAM,SAAS,GAAG,GAAG,CAAC;IACtB,IAAI,UAAU,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,qEAAqE,SAAS,gBAAgB,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,gBAAgB,UAAU,CAAC,MAAM,gBAAgB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CACpN,CAAC;IACJ,CAAC;IAED,MAAM,iBAAiB,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAE9D,MAAM,OAAO,GAAG,mBAAmB,CACjC;QACE,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;QACrC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE;KAClC,EACD,KAAK,iBAAiB,EAAS,CAChC,CAAC;IAEF,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;QACf,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;KACpB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Encoding utilities for Safe multisig batch transactions.\n *\n * Based on Safe's multiSend encoding scheme and simulation data decoding.\n * @see https://github.com/safe-global/safe-smart-account/blob/c4859f4/contracts/common/StorageAccessible.sol#L32-L43\n * @see https://github.com/safe-global/safe-core-sdk/blob/4f4a0f6/packages/protocol-kit/src/utils/transactions/gas.ts#L353-L358\n */\nimport type { Address, Hex } from \"viem\";\nimport { decodeAbiParameters, encodeFunctionData, encodePacked } from \"viem\";\nimport { safeAbis } from \"./abis.js\";\nimport type { SafeSimulationTransaction } from \"./types.js\";\n\n/** Internal transaction format for Safe multiSend encoding */\ntype InternalTransaction = {\n data: Hex;\n operation: 0 | 1;\n to: Address;\n value: bigint;\n};\n\n/**\n * Encode a single transaction for Safe's multiSend batch execution.\n *\n * Packs transaction data into Safe's internal transaction format using tight encoding:\n * - `operation` (uint8): 0 for CALL, 1 for DELEGATECALL\n * - `to` (address): Target contract address\n * - `value` (uint256): ETH value to send\n * - `dataLength` (uint256): Byte length of calldata\n * - `data` (bytes): ABI-encoded function call\n *\n * The encoding follows Safe's multiSend contract specification where multiple transactions\n * are concatenated into a single bytes payload.\n *\n * @param tx - Transaction to encode\n * @returns Hex-encoded transaction bytes without 0x prefix (for concatenation with other transactions)\n *\n * @see https://github.com/safe-global/safe-smart-account/blob/c4859f4/contracts/common/StorageAccessible.sol#L32-L43\n */\nexport function encodeInternalTransaction(tx: InternalTransaction): string {\n const encoded = encodePacked(\n [\"uint8\", \"address\", \"uint256\", \"uint256\", \"bytes\"],\n [tx.operation, tx.to, tx.value, BigInt((tx.data.length - 2) / 2), tx.data]\n );\n return encoded.slice(2); // Remove 0x prefix for concatenation\n}\n\n/**\n * Encode multiple transactions for Safe multiSend.\n *\n * @param transactions - Array of transactions to encode\n * @returns Encoded calldata for multiSend function\n */\nexport function encodeMultiSend(transactions: SafeSimulationTransaction[]): Hex {\n const internals = transactions.map((tx) => ({\n data: tx.data,\n operation: tx.operation ?? 0,\n to: tx.to,\n value: tx.value,\n }));\n\n const packedData = `0x${internals.map(encodeInternalTransaction).join(\"\")}` as Hex;\n\n return encodeFunctionData({\n abi: safeAbis.multiSend,\n args: [packedData],\n functionName: \"multiSend\",\n });\n}\n\n/**\n * Decode simulation revert data to extract gas estimate and success flag.\n *\n * Safe uses a custom encoding scheme for the revert data. The gas limit is the 3rd EVM word,\n * and success is the 4th one. Each word is 64 hex chars (32 bytes).\n *\n * IMPORTANT: This function may throw an error when the revert data is not due to a legitimate\n * response from `simulateAndRevert`.\n *\n * @param revertData - The revert data from simulateAndRevert call\n * @returns Gas estimate and success flag\n * @throws Error if revert data is too short to contain valid gas and success data\n */\nexport function decodeSimulationData(revertData: string): {\n gas: bigint;\n success: boolean;\n} {\n // Gas estimate is at EVM word 3, success at word 4\n // Each word is 64 hex chars (32 bytes)\n // Total required: 0x prefix (2) + 128 chars (4 words) + 128 chars (2 words for gas and success) = 258 chars\n const minLength = 258;\n if (revertData.length < minLength) {\n throw new Error(\n `Invalid simulation data: revert data too short. Expected at least ${minLength} characters (${(minLength - 2) / 2} bytes), got ${revertData.length} characters (${Math.max(0, (revertData.length - 2) / 2)} bytes)`\n );\n }\n\n const gasAndSuccessData = revertData.slice(2).slice(128, 256);\n\n const decoded = decodeAbiParameters(\n [\n { name: \"estimate\", type: \"uint256\" },\n { name: \"success\", type: \"bool\" },\n ],\n `0x${gasAndSuccessData}` as Hex\n );\n\n return {\n gas: decoded[0],\n success: decoded[1],\n };\n}\n"]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
declare const GasLimitOverflowError_base: Schema.TaggedErrorClass<GasLimitOverflowError, "GasLimitOverflowError", {
|
|
3
|
-
readonly _tag: Schema.tag<"GasLimitOverflowError">;
|
|
4
|
-
} & {
|
|
5
|
-
blockGasLimit: typeof Schema.BigInt;
|
|
6
|
-
estimatedGas: typeof Schema.BigInt;
|
|
7
|
-
message: typeof Schema.String;
|
|
8
|
-
threshold: typeof Schema.BigInt;
|
|
9
|
-
}>;
|
|
10
|
-
export declare class GasLimitOverflowError extends GasLimitOverflowError_base {
|
|
11
|
-
}
|
|
12
|
-
declare const SafeSimulationFailedError_base: Schema.TaggedErrorClass<SafeSimulationFailedError, "SafeSimulationFailedError", {
|
|
13
|
-
readonly _tag: Schema.tag<"SafeSimulationFailedError">;
|
|
14
|
-
} & {
|
|
15
|
-
cause: Schema.optional<typeof Schema.Unknown>;
|
|
16
|
-
message: typeof Schema.String;
|
|
17
|
-
}>;
|
|
18
|
-
export declare class SafeSimulationFailedError extends SafeSimulationFailedError_base {
|
|
19
|
-
}
|
|
20
|
-
declare const SafeContractsNotDeployedError_base: Schema.TaggedErrorClass<SafeContractsNotDeployedError, "SafeContractsNotDeployedError", {
|
|
21
|
-
readonly _tag: Schema.tag<"SafeContractsNotDeployedError">;
|
|
22
|
-
} & {
|
|
23
|
-
chainId: typeof Schema.Number;
|
|
24
|
-
message: typeof Schema.String;
|
|
25
|
-
missingContract: Schema.Literal<["multiSend", "simulateAccessor"]>;
|
|
26
|
-
}>;
|
|
27
|
-
export declare class SafeContractsNotDeployedError extends SafeContractsNotDeployedError_base {
|
|
28
|
-
}
|
|
29
|
-
declare const TransactionSizeTooLargeError_base: Schema.TaggedErrorClass<TransactionSizeTooLargeError, "TransactionSizeTooLargeError", {
|
|
30
|
-
readonly _tag: Schema.tag<"TransactionSizeTooLargeError">;
|
|
31
|
-
} & {
|
|
32
|
-
actualSize: typeof Schema.Number;
|
|
33
|
-
maxSize: typeof Schema.Number;
|
|
34
|
-
message: typeof Schema.String;
|
|
35
|
-
}>;
|
|
36
|
-
export declare class TransactionSizeTooLargeError extends TransactionSizeTooLargeError_base {
|
|
37
|
-
}
|
|
38
|
-
declare const SimulationDecodeError_base: Schema.TaggedErrorClass<SimulationDecodeError, "SimulationDecodeError", {
|
|
39
|
-
readonly _tag: Schema.tag<"SimulationDecodeError">;
|
|
40
|
-
} & {
|
|
41
|
-
cause: typeof Schema.Unknown;
|
|
42
|
-
message: typeof Schema.String;
|
|
43
|
-
revertData: typeof Schema.String;
|
|
44
|
-
}>;
|
|
45
|
-
export declare class SimulationDecodeError extends SimulationDecodeError_base {
|
|
46
|
-
}
|
|
47
|
-
declare const InvalidGasThresholdError_base: Schema.TaggedErrorClass<InvalidGasThresholdError, "InvalidGasThresholdError", {
|
|
48
|
-
readonly _tag: Schema.tag<"InvalidGasThresholdError">;
|
|
49
|
-
} & {
|
|
50
|
-
message: typeof Schema.String;
|
|
51
|
-
value: typeof Schema.Number;
|
|
52
|
-
}>;
|
|
53
|
-
export declare class InvalidGasThresholdError extends InvalidGasThresholdError_base {
|
|
54
|
-
}
|
|
55
|
-
export {};
|
|
56
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/safe/simulation/errors.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;;;;;;AAGhC,qBAAa,qBAAsB,SAAQ,0BAQ1C;CAAG;;;;;;;AAGJ,qBAAa,yBAA0B,SAAQ,8BAM9C;CAAG;;;;;;;;AAGJ,qBAAa,6BAA8B,SAAQ,kCAOlD;CAAG;;;;;;;;AAGJ,qBAAa,4BAA6B,SAAQ,iCAOjD;CAAG;;;;;;;;AAGJ,qBAAa,qBAAsB,SAAQ,0BAO1C;CAAG;;;;;;;AAGJ,qBAAa,wBAAyB,SAAQ,6BAM7C;CAAG"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
export class GasLimitOverflowError extends Schema.TaggedError()("GasLimitOverflowError", {
|
|
3
|
-
blockGasLimit: Schema.BigInt,
|
|
4
|
-
estimatedGas: Schema.BigInt,
|
|
5
|
-
message: Schema.String,
|
|
6
|
-
threshold: Schema.BigInt,
|
|
7
|
-
}) {
|
|
8
|
-
}
|
|
9
|
-
export class SafeSimulationFailedError extends Schema.TaggedError()("SafeSimulationFailedError", {
|
|
10
|
-
cause: Schema.optional(Schema.Unknown),
|
|
11
|
-
message: Schema.String,
|
|
12
|
-
}) {
|
|
13
|
-
}
|
|
14
|
-
export class SafeContractsNotDeployedError extends Schema.TaggedError()("SafeContractsNotDeployedError", {
|
|
15
|
-
chainId: Schema.Number,
|
|
16
|
-
message: Schema.String,
|
|
17
|
-
missingContract: Schema.Literal("multiSend", "simulateAccessor"),
|
|
18
|
-
}) {
|
|
19
|
-
}
|
|
20
|
-
export class TransactionSizeTooLargeError extends Schema.TaggedError()("TransactionSizeTooLargeError", {
|
|
21
|
-
actualSize: Schema.Number,
|
|
22
|
-
maxSize: Schema.Number,
|
|
23
|
-
message: Schema.String,
|
|
24
|
-
}) {
|
|
25
|
-
}
|
|
26
|
-
export class SimulationDecodeError extends Schema.TaggedError()("SimulationDecodeError", {
|
|
27
|
-
cause: Schema.Unknown,
|
|
28
|
-
message: Schema.String,
|
|
29
|
-
revertData: Schema.String,
|
|
30
|
-
}) {
|
|
31
|
-
}
|
|
32
|
-
export class InvalidGasThresholdError extends Schema.TaggedError()("InvalidGasThresholdError", {
|
|
33
|
-
message: Schema.String,
|
|
34
|
-
value: Schema.Number,
|
|
35
|
-
}) {
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/safe/simulation/errors.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,MAAM,OAAO,qBAAsB,SAAQ,MAAM,CAAC,WAAW,EAAyB,CACpF,uBAAuB,EACvB;IACE,aAAa,EAAE,MAAM,CAAC,MAAM;IAC5B,YAAY,EAAE,MAAM,CAAC,MAAM;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,SAAS,EAAE,MAAM,CAAC,MAAM;CACzB,CACF;CAAG;AAGJ,MAAM,OAAO,yBAA0B,SAAQ,MAAM,CAAC,WAAW,EAA6B,CAC5F,2BAA2B,EAC3B;IACE,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAGJ,MAAM,OAAO,6BAA8B,SAAQ,MAAM,CAAC,WAAW,EAAiC,CACpG,+BAA+B,EAC/B;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,kBAAkB,CAAC;CACjE,CACF;CAAG;AAGJ,MAAM,OAAO,4BAA6B,SAAQ,MAAM,CAAC,WAAW,EAAgC,CAClG,8BAA8B,EAC9B;IACE,UAAU,EAAE,MAAM,CAAC,MAAM;IACzB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM;CACvB,CACF;CAAG;AAGJ,MAAM,OAAO,qBAAsB,SAAQ,MAAM,CAAC,WAAW,EAAyB,CACpF,uBAAuB,EACvB;IACE,KAAK,EAAE,MAAM,CAAC,OAAO;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,UAAU,EAAE,MAAM,CAAC,MAAM;CAC1B,CACF;CAAG;AAGJ,MAAM,OAAO,wBAAyB,SAAQ,MAAM,CAAC,WAAW,EAA4B,CAC1F,0BAA0B,EAC1B;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM;CACrB,CACF;CAAG","sourcesContent":["/**\n * Tagged errors for Safe multisig gas simulation operations.\n *\n * These errors use Effect-TS Schema.TaggedError pattern for type-safe error handling.\n */\nimport { Schema } from \"effect\";\n\n/** Gas consumption exceeds block gas limit threshold */\nexport class GasLimitOverflowError extends Schema.TaggedError<GasLimitOverflowError>()(\n \"GasLimitOverflowError\",\n {\n blockGasLimit: Schema.BigInt,\n estimatedGas: Schema.BigInt,\n message: Schema.String,\n threshold: Schema.BigInt,\n }\n) {}\n\n/** Safe simulation failed */\nexport class SafeSimulationFailedError extends Schema.TaggedError<SafeSimulationFailedError>()(\n \"SafeSimulationFailedError\",\n {\n cause: Schema.optional(Schema.Unknown),\n message: Schema.String,\n }\n) {}\n\n/** Safe contracts not deployed on this chain */\nexport class SafeContractsNotDeployedError extends Schema.TaggedError<SafeContractsNotDeployedError>()(\n \"SafeContractsNotDeployedError\",\n {\n chainId: Schema.Number,\n message: Schema.String,\n missingContract: Schema.Literal(\"multiSend\", \"simulateAccessor\"),\n }\n) {}\n\n/** Transaction size too large */\nexport class TransactionSizeTooLargeError extends Schema.TaggedError<TransactionSizeTooLargeError>()(\n \"TransactionSizeTooLargeError\",\n {\n actualSize: Schema.Number,\n maxSize: Schema.Number,\n message: Schema.String,\n }\n) {}\n\n/** Simulation revert data decode failed */\nexport class SimulationDecodeError extends Schema.TaggedError<SimulationDecodeError>()(\n \"SimulationDecodeError\",\n {\n cause: Schema.Unknown,\n message: Schema.String,\n revertData: Schema.String,\n }\n) {}\n\n/** Invalid gas threshold percent */\nexport class InvalidGasThresholdError extends Schema.TaggedError<InvalidGasThresholdError>()(\n \"InvalidGasThresholdError\",\n {\n message: Schema.String,\n value: Schema.Number,\n }\n) {}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { safeAbis } from "./abis.js";
|
|
2
|
-
export { getMultiSendAddress, getSimulateAccessorAddress, } from "./addresses.js";
|
|
3
|
-
export { decodeSimulationData, encodeMultiSend } from "./encoding.js";
|
|
4
|
-
export { GasLimitOverflowError, InvalidGasThresholdError, SafeContractsNotDeployedError, SafeSimulationFailedError, SimulationDecodeError, TransactionSizeTooLargeError, } from "./errors.js";
|
|
5
|
-
export { SafeSimulationService, SafeSimulationServiceLive, type SafeSimulationServiceShape, } from "./service.js";
|
|
6
|
-
export type { SafeOperation, SafeSimulateBatchParams, SafeSimulationResult, SafeSimulationTransaction, } from "./types.js";
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/safe/simulation/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EACL,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,6BAA6B,EAC7B,yBAAyB,EACzB,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,KAAK,0BAA0B,GAChC,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,YAAY,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { safeAbis } from "./abis.js";
|
|
2
|
-
export { getMultiSendAddress, getSimulateAccessorAddress, } from "./addresses.js";
|
|
3
|
-
export { decodeSimulationData, encodeMultiSend } from "./encoding.js";
|
|
4
|
-
export { GasLimitOverflowError, InvalidGasThresholdError, SafeContractsNotDeployedError, SafeSimulationFailedError, SimulationDecodeError, TransactionSizeTooLargeError, } from "./errors.js";
|
|
5
|
-
export { SafeSimulationService, SafeSimulationServiceLive, } from "./service.js";
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/safe/simulation/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EACL,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,6BAA6B,EAC7B,yBAAyB,EACzB,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAE1B,MAAM,cAAc,CAAC","sourcesContent":["// Errors\n\n// ABIs (for advanced usage)\nexport { safeAbis } from \"./abis.js\";\n// Address utilities\nexport {\n getMultiSendAddress,\n getSimulateAccessorAddress,\n} from \"./addresses.js\";\n// Encoding utilities\nexport { decodeSimulationData, encodeMultiSend } from \"./encoding.js\";\nexport {\n GasLimitOverflowError,\n InvalidGasThresholdError,\n SafeContractsNotDeployedError,\n SafeSimulationFailedError,\n SimulationDecodeError,\n TransactionSizeTooLargeError,\n} from \"./errors.js\";\n// Service\nexport {\n SafeSimulationService,\n SafeSimulationServiceLive,\n type SafeSimulationServiceShape,\n} from \"./service.js\";\n// Types\nexport type {\n SafeOperation,\n SafeSimulateBatchParams,\n SafeSimulationResult,\n SafeSimulationTransaction,\n} from \"./types.js\";\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Hex } from "viem";
|
|
2
|
-
import type { SafeSimulateBatchParams } from "../../types.js";
|
|
3
|
-
import type { SafeContracts } from "../types/index.js";
|
|
4
|
-
export declare function buildSafeCalldata(contracts: SafeContracts, transactions: SafeSimulateBatchParams["transactions"]): Hex;
|
|
5
|
-
//# sourceMappingURL=calldata.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calldata.d.ts","sourceRoot":"","sources":["../../../../../src/safe/simulation/internal/calldata/calldata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAIhC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKvD,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,aAAa,EACxB,YAAY,EAAE,uBAAuB,CAAC,cAAc,CAAC,GACpD,GAAG,CAcL"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { encodeFunctionData } from "viem";
|
|
2
|
-
import { safeAbis } from "../../abis.js";
|
|
3
|
-
import { encodeMultiSend } from "../../encoding.js";
|
|
4
|
-
export function buildSafeCalldata(contracts, transactions) {
|
|
5
|
-
const multiSendCalldata = encodeMultiSend(transactions);
|
|
6
|
-
const simulateAccessorCalldata = encodeFunctionData({
|
|
7
|
-
abi: safeAbis.simulateAccessor,
|
|
8
|
-
args: [contracts.multiSendAddr, 0n, multiSendCalldata, 1],
|
|
9
|
-
functionName: "simulate",
|
|
10
|
-
});
|
|
11
|
-
return encodeFunctionData({
|
|
12
|
-
abi: safeAbis.multisig,
|
|
13
|
-
args: [contracts.simulateAccessorAddr, simulateAccessorCalldata],
|
|
14
|
-
functionName: "simulateAndRevert",
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=calldata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calldata.js","sourceRoot":"","sources":["../../../../../src/safe/simulation/internal/calldata/calldata.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAOpD,MAAM,UAAU,iBAAiB,CAC/B,SAAwB,EACxB,YAAqD;IAErD,MAAM,iBAAiB,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAExD,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;QAClD,GAAG,EAAE,QAAQ,CAAC,gBAAgB;QAC9B,IAAI,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC;QACzD,YAAY,EAAE,UAAU;KACzB,CAAC,CAAC;IAEH,OAAO,kBAAkB,CAAC;QACxB,GAAG,EAAE,QAAQ,CAAC,QAAQ;QACtB,IAAI,EAAE,CAAC,SAAS,CAAC,oBAAoB,EAAE,wBAAwB,CAAC;QAChE,YAAY,EAAE,mBAAmB;KAClC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * Calldata construction utilities for Safe simulation.\n */\nimport type { Hex } from \"viem\";\nimport { encodeFunctionData } from \"viem\";\nimport { safeAbis } from \"../../abis.js\";\nimport { encodeMultiSend } from \"../../encoding.js\";\nimport type { SafeSimulateBatchParams } from \"../../types.js\";\nimport type { SafeContracts } from \"../types/index.js\";\n\n/**\n * Build the final simulateAndRevert calldata for Safe.\n */\nexport function buildSafeCalldata(\n contracts: SafeContracts,\n transactions: SafeSimulateBatchParams[\"transactions\"]\n): Hex {\n const multiSendCalldata = encodeMultiSend(transactions);\n\n const simulateAccessorCalldata = encodeFunctionData({\n abi: safeAbis.simulateAccessor,\n args: [contracts.multiSendAddr, 0n, multiSendCalldata, 1], // 1 = DelegateCall\n functionName: \"simulate\",\n });\n\n return encodeFunctionData({\n abi: safeAbis.multisig,\n args: [contracts.simulateAccessorAddr, simulateAccessorCalldata],\n functionName: \"simulateAndRevert\",\n });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/safe/simulation/internal/calldata/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/safe/simulation/internal/calldata/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { buildSafeCalldata } from \"./calldata.js\";\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import { SafeContractsNotDeployedError } from "../../errors.js";
|
|
3
|
-
import type { SafeContracts } from "../types/index.js";
|
|
4
|
-
export declare function resolveSafeContracts(chainId: number): Effect.Effect<SafeContracts, SafeContractsNotDeployedError>;
|
|
5
|
-
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../../../src/safe/simulation/internal/contracts/contracts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKvD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,6BAA6B,CAAC,CA2B7D"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import { getMultiSendAddress, getSimulateAccessorAddress } from "../../addresses.js";
|
|
3
|
-
import { SafeContractsNotDeployedError } from "../../errors.js";
|
|
4
|
-
export function resolveSafeContracts(chainId) {
|
|
5
|
-
return Effect.gen(function* () {
|
|
6
|
-
const multiSendAddr = getMultiSendAddress(chainId);
|
|
7
|
-
const simulateAccessorAddr = getSimulateAccessorAddress(chainId);
|
|
8
|
-
if (!multiSendAddr) {
|
|
9
|
-
return yield* Effect.fail(new SafeContractsNotDeployedError({
|
|
10
|
-
chainId,
|
|
11
|
-
message: "MultiSend contract not deployed on this chain",
|
|
12
|
-
missingContract: "multiSend",
|
|
13
|
-
}));
|
|
14
|
-
}
|
|
15
|
-
if (!simulateAccessorAddr) {
|
|
16
|
-
return yield* Effect.fail(new SafeContractsNotDeployedError({
|
|
17
|
-
chainId,
|
|
18
|
-
message: "SimulateAccessor contract not deployed on this chain",
|
|
19
|
-
missingContract: "simulateAccessor",
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
return { multiSendAddr, simulateAccessorAddr };
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=contracts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../../../src/safe/simulation/internal/contracts/contracts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAMhE,MAAM,UAAU,oBAAoB,CAClC,OAAe;IAEf,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACzB,MAAM,aAAa,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACnD,MAAM,oBAAoB,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;QAEjE,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CACvB,IAAI,6BAA6B,CAAC;gBAChC,OAAO;gBACP,OAAO,EAAE,+CAA+C;gBACxD,eAAe,EAAE,WAAW;aAC7B,CAAC,CACH,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC1B,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CACvB,IAAI,6BAA6B,CAAC;gBAChC,OAAO;gBACP,OAAO,EAAE,sDAAsD;gBAC/D,eAAe,EAAE,kBAAkB;aACpC,CAAC,CACH,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * Resolve contract addresses needed to construct Safe simulation calldata.\n */\nimport { Effect } from \"effect\";\nimport { getMultiSendAddress, getSimulateAccessorAddress } from \"../../addresses.js\";\nimport { SafeContractsNotDeployedError } from \"../../errors.js\";\nimport type { SafeContracts } from \"../types/index.js\";\n\n/**\n * Resolve the Safe helper contract addresses for the chain.\n */\nexport function resolveSafeContracts(\n chainId: number\n): Effect.Effect<SafeContracts, SafeContractsNotDeployedError> {\n return Effect.gen(function* () {\n const multiSendAddr = getMultiSendAddress(chainId);\n const simulateAccessorAddr = getSimulateAccessorAddress(chainId);\n\n if (!multiSendAddr) {\n return yield* Effect.fail(\n new SafeContractsNotDeployedError({\n chainId,\n message: \"MultiSend contract not deployed on this chain\",\n missingContract: \"multiSend\",\n })\n );\n }\n\n if (!simulateAccessorAddr) {\n return yield* Effect.fail(\n new SafeContractsNotDeployedError({\n chainId,\n message: \"SimulateAccessor contract not deployed on this chain\",\n missingContract: \"simulateAccessor\",\n })\n );\n }\n\n return { multiSendAddr, simulateAccessorAddr };\n });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/safe/simulation/internal/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/safe/simulation/internal/contracts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { resolveSafeContracts } from \"./contracts.js\";\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import { GasLimitOverflowError, SafeSimulationFailedError } from "../../errors.js";
|
|
3
|
-
import type { SafeSimulationResult } from "../../types.js";
|
|
4
|
-
import type { LatestBlock, SimulationDecoded } from "../types/index.js";
|
|
5
|
-
export declare function evaluateSimulationResult(result: SimulationDecoded, block: LatestBlock, gasThresholdPercent?: number): Effect.Effect<SafeSimulationResult, GasLimitOverflowError | SafeSimulationFailedError>;
|
|
6
|
-
//# sourceMappingURL=evaluation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../../../../src/safe/simulation/internal/evaluation/evaluation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAKxE,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,WAAW,EAClB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,MAAM,CAAC,MAAM,CAAC,oBAAoB,EAAE,qBAAqB,GAAG,yBAAyB,CAAC,CAwBxF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import { GasLimitOverflowError, SafeSimulationFailedError } from "../../errors.js";
|
|
3
|
-
export function evaluateSimulationResult(result, block, gasThresholdPercent) {
|
|
4
|
-
const threshold = (block.gasLimit * BigInt(gasThresholdPercent ?? 95)) / 100n;
|
|
5
|
-
if (result.success && result.gas > threshold) {
|
|
6
|
-
return Effect.fail(new GasLimitOverflowError({
|
|
7
|
-
blockGasLimit: block.gasLimit,
|
|
8
|
-
estimatedGas: result.gas,
|
|
9
|
-
message: "Gas consumption exceeds threshold of block gas limit. Try splitting into smaller batches.",
|
|
10
|
-
threshold,
|
|
11
|
-
}));
|
|
12
|
-
}
|
|
13
|
-
if (!result.success) {
|
|
14
|
-
return Effect.fail(new SafeSimulationFailedError({
|
|
15
|
-
message: "Transaction simulation failed - the transaction would revert",
|
|
16
|
-
}));
|
|
17
|
-
}
|
|
18
|
-
return Effect.succeed({ estimatedGas: result.gas, success: true });
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=evaluation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation.js","sourceRoot":"","sources":["../../../../../src/safe/simulation/internal/evaluation/evaluation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAOnF,MAAM,UAAU,wBAAwB,CACtC,MAAyB,EACzB,KAAkB,EAClB,mBAA4B;IAE5B,MAAM,SAAS,GAAG,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;IAE9E,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,GAAG,SAAS,EAAE,CAAC;QAC7C,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,qBAAqB,CAAC;YACxB,aAAa,EAAE,KAAK,CAAC,QAAQ;YAC7B,YAAY,EAAE,MAAM,CAAC,GAAG;YACxB,OAAO,EACL,2FAA2F;YAC7F,SAAS;SACV,CAAC,CACH,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,yBAAyB,CAAC;YAC5B,OAAO,EAAE,8DAA8D;SACxE,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;AACrE,CAAC","sourcesContent":["/**\n * Final evaluation of simulation outcomes against policy thresholds.\n */\nimport { Effect } from \"effect\";\nimport { GasLimitOverflowError, SafeSimulationFailedError } from \"../../errors.js\";\nimport type { SafeSimulationResult } from \"../../types.js\";\nimport type { LatestBlock, SimulationDecoded } from \"../types/index.js\";\n\n/**\n * Apply success and gas threshold checks to the decoded result.\n */\nexport function evaluateSimulationResult(\n result: SimulationDecoded,\n block: LatestBlock,\n gasThresholdPercent?: number\n): Effect.Effect<SafeSimulationResult, GasLimitOverflowError | SafeSimulationFailedError> {\n const threshold = (block.gasLimit * BigInt(gasThresholdPercent ?? 95)) / 100n;\n\n if (result.success && result.gas > threshold) {\n return Effect.fail(\n new GasLimitOverflowError({\n blockGasLimit: block.gasLimit,\n estimatedGas: result.gas,\n message:\n \"Gas consumption exceeds threshold of block gas limit. Try splitting into smaller batches.\",\n threshold,\n })\n );\n }\n\n if (!result.success) {\n return Effect.fail(\n new SafeSimulationFailedError({\n message: \"Transaction simulation failed - the transaction would revert\",\n })\n );\n }\n\n return Effect.succeed({ estimatedGas: result.gas, success: true });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/safe/simulation/internal/evaluation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/safe/simulation/internal/evaluation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { evaluateSimulationResult } from \"./evaluation.js\";\n"]}
|