@safe-global/relay-kit 2.0.3 → 2.1.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/src/RelayKitBasePack.d.ts +51 -20
- package/dist/src/RelayKitBasePack.js +13 -2
- package/dist/src/RelayKitBasePack.js.map +1 -1
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/packs/gelato/GelatoRelayPack.d.ts +46 -9
- package/dist/src/packs/gelato/GelatoRelayPack.js +49 -10
- package/dist/src/packs/gelato/GelatoRelayPack.js.map +1 -1
- package/dist/src/packs/gelato/GelatoRelayPack.test.js +26 -20
- package/dist/src/packs/gelato/GelatoRelayPack.test.js.map +1 -1
- package/dist/src/packs/gelato/types.d.ts +18 -0
- package/dist/src/packs/safe-4337/Safe4337Pack.d.ts +99 -0
- package/dist/src/packs/safe-4337/Safe4337Pack.js +499 -0
- package/dist/src/packs/safe-4337/Safe4337Pack.js.map +1 -0
- package/dist/src/packs/safe-4337/Safe4337Pack.test.d.ts +1 -0
- package/dist/src/packs/safe-4337/Safe4337Pack.test.js +542 -0
- package/dist/src/packs/safe-4337/Safe4337Pack.test.js.map +1 -0
- package/dist/src/packs/safe-4337/SafeOperation.d.ts +18 -0
- package/dist/src/packs/safe-4337/SafeOperation.js +62 -0
- package/dist/src/packs/safe-4337/SafeOperation.js.map +1 -0
- package/dist/src/packs/safe-4337/SafeOperation.test.d.ts +1 -0
- package/dist/src/packs/safe-4337/SafeOperation.test.js +124 -0
- package/dist/src/packs/safe-4337/SafeOperation.test.js.map +1 -0
- package/dist/src/packs/safe-4337/constants.d.ts +19 -0
- package/dist/src/packs/safe-4337/constants.js +39 -0
- package/dist/src/packs/safe-4337/constants.js.map +1 -0
- package/dist/src/packs/safe-4337/estimators/PimlicoFeeEstimator.d.ts +7 -0
- package/dist/src/packs/safe-4337/estimators/PimlicoFeeEstimator.js +41 -0
- package/dist/src/packs/safe-4337/estimators/PimlicoFeeEstimator.js.map +1 -0
- package/dist/src/packs/safe-4337/estimators/PimlicoFeeEstimator.test.d.ts +1 -0
- package/dist/src/packs/safe-4337/estimators/PimlicoFeeEstimator.test.js +75 -0
- package/dist/src/packs/safe-4337/estimators/PimlicoFeeEstimator.test.js.map +1 -0
- package/dist/src/packs/safe-4337/estimators/index.d.ts +2 -0
- package/dist/src/packs/safe-4337/estimators/index.js +6 -0
- package/dist/src/packs/safe-4337/estimators/index.js.map +1 -0
- package/dist/src/packs/safe-4337/testing-utils/fixtures.d.ts +100 -0
- package/dist/src/packs/safe-4337/testing-utils/fixtures.js +90 -0
- package/dist/src/packs/safe-4337/testing-utils/fixtures.js.map +1 -0
- package/dist/src/packs/safe-4337/testing-utils/helpers.d.ts +4 -0
- package/dist/src/packs/safe-4337/testing-utils/helpers.js +56 -0
- package/dist/src/packs/safe-4337/testing-utils/helpers.js.map +1 -0
- package/dist/src/packs/safe-4337/types.d.ts +158 -0
- package/dist/src/{types.js.map → packs/safe-4337/types.js.map} +1 -1
- package/dist/src/packs/safe-4337/utils.d.ts +35 -0
- package/dist/src/packs/safe-4337/utils.js +50 -0
- package/dist/src/packs/safe-4337/utils.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -3
- package/dist/src/types.d.ts +0 -9
- /package/dist/src/{types.js → packs/safe-4337/types.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SafeOperation.js","sourceRoot":"","sources":["../../../../src/packs/safe-4337/SafeOperation.ts"],"names":[],"mappings":";;AAAA,mCAA+B;AAE/B,4DAA+D;AAM/D,MAAM,aAAa;IAIjB,YACE,aAA4B,EAC5B,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAwB;QAJ9D,eAAU,GAA+B,IAAI,GAAG,EAAE,CAAA;QAMhD,IAAI,CAAC,IAAI,GAAG;YACV,IAAI,EAAE,aAAa,CAAC,MAAM;YAC1B,KAA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IAAI,CAAC,IAAI,CAAC,IAAI;YACtB,KAAK,EAAE,eAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;YACtC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ;YAC5B,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ;YAC5B,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY;YACpC,oBAAoB,EAAE,IAAI,CAAC,IAAI,CAAC,oBAAoB;YACpD,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,kBAAkB;YAChD,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY;YACpC,oBAAoB,EAAE,IAAI,CAAC,IAAI,CAAC,oBAAoB;YACpD,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,gBAAgB;YAC5C,SAAS,EAAE,eAAM,CAAC,cAAc,CAC9B,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAC7B,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC,CACvE;SACF,CAAA;IACH,CAAC;CACF;AAED,kBAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const ethers_1 = require("ethers");
|
|
30
|
+
const protocol_kit_1 = require("@safe-global/protocol-kit");
|
|
31
|
+
const SafeOperation_1 = __importDefault(require("./SafeOperation"));
|
|
32
|
+
const fixtures = __importStar(require("./testing-utils/fixtures"));
|
|
33
|
+
describe('SafeOperation', () => {
|
|
34
|
+
it('should create a SafeOperation from an UserOperation', () => {
|
|
35
|
+
const safeOperation = new SafeOperation_1.default(fixtures.USER_OPERATION, {
|
|
36
|
+
entryPoint: fixtures.ENTRYPOINTS[0]
|
|
37
|
+
});
|
|
38
|
+
expect(safeOperation.data).toMatchObject({
|
|
39
|
+
safe: fixtures.USER_OPERATION.sender,
|
|
40
|
+
nonce: BigInt(fixtures.USER_OPERATION.nonce),
|
|
41
|
+
initCode: fixtures.USER_OPERATION.initCode,
|
|
42
|
+
callData: fixtures.USER_OPERATION.callData,
|
|
43
|
+
callGasLimit: fixtures.USER_OPERATION.callGasLimit,
|
|
44
|
+
verificationGasLimit: fixtures.USER_OPERATION.verificationGasLimit,
|
|
45
|
+
preVerificationGas: fixtures.USER_OPERATION.preVerificationGas,
|
|
46
|
+
maxFeePerGas: fixtures.USER_OPERATION.maxFeePerGas,
|
|
47
|
+
maxPriorityFeePerGas: fixtures.USER_OPERATION.maxPriorityFeePerGas,
|
|
48
|
+
paymasterAndData: fixtures.USER_OPERATION.paymasterAndData,
|
|
49
|
+
validAfter: 0,
|
|
50
|
+
validUntil: 0,
|
|
51
|
+
entryPoint: fixtures.ENTRYPOINTS[0]
|
|
52
|
+
});
|
|
53
|
+
expect(safeOperation.signatures.size).toBe(0);
|
|
54
|
+
});
|
|
55
|
+
it('should add and retrieve signatures', () => {
|
|
56
|
+
const safeOperation = new SafeOperation_1.default(fixtures.USER_OPERATION, {
|
|
57
|
+
entryPoint: fixtures.ENTRYPOINTS[0]
|
|
58
|
+
});
|
|
59
|
+
safeOperation.addSignature(new protocol_kit_1.EthSafeSignature('0xSigner', '0xSignature'));
|
|
60
|
+
expect(safeOperation.signatures.size).toBe(1);
|
|
61
|
+
expect(safeOperation.getSignature('0xSigner')).toMatchObject({
|
|
62
|
+
signer: '0xSigner',
|
|
63
|
+
data: '0xSignature',
|
|
64
|
+
isContractSignature: false
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
it('should encode the signatures', () => {
|
|
68
|
+
const safeOperation = new SafeOperation_1.default(fixtures.USER_OPERATION, {
|
|
69
|
+
entryPoint: fixtures.ENTRYPOINTS[0]
|
|
70
|
+
});
|
|
71
|
+
safeOperation.addSignature(new protocol_kit_1.EthSafeSignature('0xSigner1', '0xSignature1'));
|
|
72
|
+
safeOperation.addSignature(new protocol_kit_1.EthSafeSignature('0xSigner2', '0xSignature2'));
|
|
73
|
+
expect(safeOperation.encodedSignatures()).toBe('0xSignature1Signature2');
|
|
74
|
+
});
|
|
75
|
+
it('should add estimations', () => {
|
|
76
|
+
const safeOperation = new SafeOperation_1.default(fixtures.USER_OPERATION, {
|
|
77
|
+
entryPoint: fixtures.ENTRYPOINTS[0]
|
|
78
|
+
});
|
|
79
|
+
safeOperation.addEstimations({
|
|
80
|
+
callGasLimit: BigInt(fixtures.GAS_ESTIMATION.callGasLimit),
|
|
81
|
+
verificationGasLimit: BigInt(fixtures.GAS_ESTIMATION.verificationGasLimit),
|
|
82
|
+
preVerificationGas: BigInt(fixtures.GAS_ESTIMATION.preVerificationGas)
|
|
83
|
+
});
|
|
84
|
+
expect(safeOperation.data).toMatchObject({
|
|
85
|
+
safe: fixtures.USER_OPERATION.sender,
|
|
86
|
+
nonce: BigInt(fixtures.USER_OPERATION.nonce),
|
|
87
|
+
initCode: fixtures.USER_OPERATION.initCode,
|
|
88
|
+
callData: fixtures.USER_OPERATION.callData,
|
|
89
|
+
callGasLimit: BigInt(fixtures.GAS_ESTIMATION.callGasLimit),
|
|
90
|
+
verificationGasLimit: BigInt(fixtures.GAS_ESTIMATION.verificationGasLimit),
|
|
91
|
+
preVerificationGas: BigInt(fixtures.GAS_ESTIMATION.preVerificationGas),
|
|
92
|
+
maxFeePerGas: fixtures.USER_OPERATION.maxFeePerGas,
|
|
93
|
+
maxPriorityFeePerGas: fixtures.USER_OPERATION.maxPriorityFeePerGas,
|
|
94
|
+
paymasterAndData: fixtures.USER_OPERATION.paymasterAndData,
|
|
95
|
+
validAfter: 0,
|
|
96
|
+
validUntil: 0,
|
|
97
|
+
entryPoint: fixtures.ENTRYPOINTS[0]
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
it('should convert to UserOperation', () => {
|
|
101
|
+
const safeOperation = new SafeOperation_1.default(fixtures.USER_OPERATION, {
|
|
102
|
+
entryPoint: fixtures.ENTRYPOINTS[0]
|
|
103
|
+
});
|
|
104
|
+
safeOperation.addSignature(new protocol_kit_1.EthSafeSignature('0xSigner', '0x000000000000000000000000a397ca32ee7fb5282256ee3465da0843485930b803d747516aac76e152f834051ac18fd2b3c0565590f9d65085538993c85c9bb189c940d15c15402c7c2885821b'));
|
|
105
|
+
expect(safeOperation.toUserOperation()).toMatchObject({
|
|
106
|
+
sender: safeOperation.data.safe,
|
|
107
|
+
nonce: ethers_1.ethers.toBeHex(fixtures.USER_OPERATION.nonce),
|
|
108
|
+
initCode: safeOperation.data.initCode,
|
|
109
|
+
callData: safeOperation.data.callData,
|
|
110
|
+
callGasLimit: safeOperation.data.callGasLimit,
|
|
111
|
+
verificationGasLimit: safeOperation.data.verificationGasLimit,
|
|
112
|
+
preVerificationGas: safeOperation.data.preVerificationGas,
|
|
113
|
+
maxFeePerGas: safeOperation.data.maxFeePerGas,
|
|
114
|
+
maxPriorityFeePerGas: safeOperation.data.maxPriorityFeePerGas,
|
|
115
|
+
paymasterAndData: safeOperation.data.paymasterAndData,
|
|
116
|
+
signature: ethers_1.ethers.solidityPacked(['uint48', 'uint48', 'bytes'], [
|
|
117
|
+
safeOperation.data.validAfter,
|
|
118
|
+
safeOperation.data.validUntil,
|
|
119
|
+
safeOperation.encodedSignatures()
|
|
120
|
+
])
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
//# sourceMappingURL=SafeOperation.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SafeOperation.test.js","sourceRoot":"","sources":["../../../../src/packs/safe-4337/SafeOperation.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA+B;AAC/B,4DAA4D;AAC5D,oEAA2C;AAC3C,mEAAoD;AAEpD,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,MAAM,aAAa,GAAG,IAAI,uBAAa,CAAC,QAAQ,CAAC,cAAc,EAAE;YAC/D,UAAU,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;SACpC,CAAC,CAAA;QAEF,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC;YACvC,IAAI,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM;YACpC,KAAK,EAAE,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,aAAa,CAAC,IAAI,CAAC,kBAAkB;YACzD,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,YAAY;YAC7C,oBAAoB,EAAE,aAAa,CAAC,IAAI,CAAC,oBAAoB;YAC7D,gBAAgB,EAAE,aAAa,CAAC,IAAI,CAAC,gBAAgB;YACrD,SAAS,EAAE,eAAM,CAAC,cAAc,CAC9B,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAC7B;gBACE,aAAa,CAAC,IAAI,CAAC,UAAU;gBAC7B,aAAa,CAAC,IAAI,CAAC,UAAU;gBAC7B,aAAa,CAAC,iBAAiB,EAAE;aAClC,CACF;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
export declare const DEFAULT_SAFE_VERSION = "1.4.1";
|
|
3
|
+
export declare const DEFAULT_SAFE_MODULES_VERSION = "0.2.0";
|
|
4
|
+
export declare const EIP712_SAFE_OPERATION_TYPE: {
|
|
5
|
+
SafeOp: {
|
|
6
|
+
type: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
export declare const INTERFACES: ethers.Interface;
|
|
11
|
+
export declare const RPC_4337_CALLS: {
|
|
12
|
+
ESTIMATE_USER_OPERATION_GAS: string;
|
|
13
|
+
SEND_USER_OPERATION: string;
|
|
14
|
+
GET_USER_OPERATION_BY_HASH: string;
|
|
15
|
+
GET_USER_OPERATION_RECEIPT: string;
|
|
16
|
+
SUPPORTED_ENTRY_POINTS: string;
|
|
17
|
+
CHAIN_ID: string;
|
|
18
|
+
SPONSOR_USER_OPERATION: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RPC_4337_CALLS = exports.INTERFACES = exports.EIP712_SAFE_OPERATION_TYPE = exports.DEFAULT_SAFE_MODULES_VERSION = exports.DEFAULT_SAFE_VERSION = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
exports.DEFAULT_SAFE_VERSION = '1.4.1';
|
|
6
|
+
exports.DEFAULT_SAFE_MODULES_VERSION = '0.2.0';
|
|
7
|
+
exports.EIP712_SAFE_OPERATION_TYPE = {
|
|
8
|
+
SafeOp: [
|
|
9
|
+
{ type: 'address', name: 'safe' },
|
|
10
|
+
{ type: 'uint256', name: 'nonce' },
|
|
11
|
+
{ type: 'bytes', name: 'initCode' },
|
|
12
|
+
{ type: 'bytes', name: 'callData' },
|
|
13
|
+
{ type: 'uint256', name: 'callGasLimit' },
|
|
14
|
+
{ type: 'uint256', name: 'verificationGasLimit' },
|
|
15
|
+
{ type: 'uint256', name: 'preVerificationGas' },
|
|
16
|
+
{ type: 'uint256', name: 'maxFeePerGas' },
|
|
17
|
+
{ type: 'uint256', name: 'maxPriorityFeePerGas' },
|
|
18
|
+
{ type: 'bytes', name: 'paymasterAndData' },
|
|
19
|
+
{ type: 'uint48', name: 'validAfter' },
|
|
20
|
+
{ type: 'uint48', name: 'validUntil' },
|
|
21
|
+
{ type: 'address', name: 'entryPoint' }
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
exports.INTERFACES = new ethers_1.ethers.Interface([
|
|
25
|
+
'function enableModules(address[])',
|
|
26
|
+
'function multiSend(bytes memory transactions) public payable',
|
|
27
|
+
'function executeUserOp(address to, uint256 value, bytes data, uint8 operation)',
|
|
28
|
+
'function approve(address _spender, uint256 _value)'
|
|
29
|
+
]);
|
|
30
|
+
exports.RPC_4337_CALLS = {
|
|
31
|
+
ESTIMATE_USER_OPERATION_GAS: 'eth_estimateUserOperationGas',
|
|
32
|
+
SEND_USER_OPERATION: 'eth_sendUserOperation',
|
|
33
|
+
GET_USER_OPERATION_BY_HASH: 'eth_getUserOperationByHash',
|
|
34
|
+
GET_USER_OPERATION_RECEIPT: 'eth_getUserOperationReceipt',
|
|
35
|
+
SUPPORTED_ENTRY_POINTS: 'eth_supportedEntryPoints',
|
|
36
|
+
CHAIN_ID: 'eth_chainId',
|
|
37
|
+
SPONSOR_USER_OPERATION: 'pm_sponsorUserOperation'
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/packs/safe-4337/constants.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAElB,QAAA,oBAAoB,GAAG,OAAO,CAAA;AAC9B,QAAA,4BAA4B,GAAG,OAAO,CAAA;AAEtC,QAAA,0BAA0B,GAAG;IACxC,MAAM,EAAE;QACN,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE;QACjC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE;QAClC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE;QACnC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE;QACnC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE;QACzC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,sBAAsB,EAAE;QACjD,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,oBAAoB,EAAE;QAC/C,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE;QACzC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,sBAAsB,EAAE;QACjD,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE;QAC3C,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE;QACtC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE;QACtC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE;KACxC;CACF,CAAA;AAEY,QAAA,UAAU,GAAG,IAAI,eAAM,CAAC,SAAS,CAAC;IAC7C,mCAAmC;IACnC,8DAA8D;IAC9D,gFAAgF;IAChF,oDAAoD;CACrD,CAAC,CAAA;AAEW,QAAA,cAAc,GAAG;IAC5B,2BAA2B,EAAE,8BAA8B;IAC3D,mBAAmB,EAAE,uBAAuB;IAC5C,0BAA0B,EAAE,4BAA4B;IACxD,0BAA0B,EAAE,6BAA6B;IACzD,sBAAsB,EAAE,0BAA0B;IAClD,QAAQ,EAAE,aAAa;IACvB,sBAAsB,EAAE,yBAAyB;CAClD,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EstimateFeeFunctionProps, EstimateGasData, EstimateSponsoredFeeFunctionProps, EstimateSponsoredGasData, IFeeEstimator } from '../types';
|
|
2
|
+
export declare class PimlicoFeeEstimator implements IFeeEstimator {
|
|
3
|
+
#private;
|
|
4
|
+
setupEstimation({ bundlerUrl }: EstimateFeeFunctionProps): Promise<EstimateGasData>;
|
|
5
|
+
adjustEstimation({ userOperation }: EstimateFeeFunctionProps): Promise<EstimateGasData>;
|
|
6
|
+
getPaymasterEstimation({ userOperation, paymasterUrl, entryPoint, sponsorshipPolicyId }: EstimateSponsoredFeeFunctionProps): Promise<EstimateSponsoredGasData>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
7
|
+
var _PimlicoFeeEstimator_instances, _PimlicoFeeEstimator_getFeeData;
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PimlicoFeeEstimator = void 0;
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
const constants_1 = require("../constants");
|
|
12
|
+
class PimlicoFeeEstimator {
|
|
13
|
+
constructor() {
|
|
14
|
+
_PimlicoFeeEstimator_instances.add(this);
|
|
15
|
+
}
|
|
16
|
+
async setupEstimation({ bundlerUrl }) {
|
|
17
|
+
const bundlerClient = (0, utils_1.getEip4337BundlerProvider)(bundlerUrl);
|
|
18
|
+
const feeData = await __classPrivateFieldGet(this, _PimlicoFeeEstimator_instances, "m", _PimlicoFeeEstimator_getFeeData).call(this, bundlerClient);
|
|
19
|
+
return feeData;
|
|
20
|
+
}
|
|
21
|
+
async adjustEstimation({ userOperation }) {
|
|
22
|
+
return {
|
|
23
|
+
callGasLimit: userOperation.callGasLimit + userOperation.callGasLimit / 2n,
|
|
24
|
+
verificationGasLimit: userOperation.verificationGasLimit + userOperation.verificationGasLimit / 2n
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
async getPaymasterEstimation({ userOperation, paymasterUrl, entryPoint, sponsorshipPolicyId }) {
|
|
28
|
+
const paymasterClient = (0, utils_1.getEip4337BundlerProvider)(paymasterUrl);
|
|
29
|
+
const params = sponsorshipPolicyId
|
|
30
|
+
? [(0, utils_1.userOperationToHexValues)(userOperation), entryPoint, { sponsorshipPolicyId }]
|
|
31
|
+
: [(0, utils_1.userOperationToHexValues)(userOperation), entryPoint];
|
|
32
|
+
const gasEstimate = await paymasterClient.send(constants_1.RPC_4337_CALLS.SPONSOR_USER_OPERATION, params);
|
|
33
|
+
return gasEstimate;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.PimlicoFeeEstimator = PimlicoFeeEstimator;
|
|
37
|
+
_PimlicoFeeEstimator_instances = new WeakSet(), _PimlicoFeeEstimator_getFeeData = async function _PimlicoFeeEstimator_getFeeData(bundlerClient) {
|
|
38
|
+
const { fast } = await bundlerClient.send('pimlico_getUserOperationGasPrice', []);
|
|
39
|
+
return fast;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=PimlicoFeeEstimator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PimlicoFeeEstimator.js","sourceRoot":"","sources":["../../../../../src/packs/safe-4337/estimators/PimlicoFeeEstimator.ts"],"names":[],"mappings":";;;;;;;;;AAQA,oCAA8E;AAC9E,4CAA6C;AAE7C,MAAa,mBAAmB;IAAhC;;IAyCA,CAAC;IAxCC,KAAK,CAAC,eAAe,CAAC,EAAE,UAAU,EAA4B;QAC5D,MAAM,aAAa,GAAG,IAAA,iCAAyB,EAAC,UAAU,CAAC,CAAA;QAE3D,MAAM,OAAO,GAAG,MAAM,uBAAA,IAAI,uEAAY,MAAhB,IAAI,EAAa,aAAa,CAAC,CAAA;QAErD,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,EAAE,aAAa,EAA4B;QAChE,OAAO;YACL,YAAY,EAAE,aAAa,CAAC,YAAY,GAAG,aAAa,CAAC,YAAY,GAAG,EAAE;YAC1E,oBAAoB,EAClB,aAAa,CAAC,oBAAoB,GAAG,aAAa,CAAC,oBAAoB,GAAG,EAAE;SAC/E,CAAA;IACH,CAAC;IAED,KAAK,CAAC,sBAAsB,CAAC,EAC3B,aAAa,EACb,YAAY,EACZ,UAAU,EACV,mBAAmB,EACe;QAClC,MAAM,eAAe,GAAG,IAAA,iCAAyB,EAAC,YAAY,CAAC,CAAA;QAE/D,MAAM,MAAM,GAAG,mBAAmB;YAChC,CAAC,CAAC,CAAC,IAAA,gCAAwB,EAAC,aAAa,CAAC,EAAE,UAAU,EAAE,EAAE,mBAAmB,EAAE,CAAC;YAChF,CAAC,CAAC,CAAC,IAAA,gCAAwB,EAAC,aAAa,CAAC,EAAE,UAAU,CAAC,CAAA;QAEzD,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,0BAAc,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAA;QAE7F,OAAO,WAAW,CAAA;IACpB,CAAC;CASF;AAzCD,kDAyCC;kFAPC,KAAK,0CACH,aAAqC;IAErC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,kCAAkC,EAAE,EAAE,CAAC,CAAA;IAEjF,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const PimlicoFeeEstimator_1 = require("./PimlicoFeeEstimator");
|
|
27
|
+
const fixtures = __importStar(require("../testing-utils/fixtures"));
|
|
28
|
+
const constants = __importStar(require("../constants"));
|
|
29
|
+
jest.mock('../utils', () => ({
|
|
30
|
+
...jest.requireActual('../utils'),
|
|
31
|
+
getEip4337BundlerProvider: () => ({
|
|
32
|
+
send: async (method) => {
|
|
33
|
+
switch (method) {
|
|
34
|
+
case constants.RPC_4337_CALLS.SPONSOR_USER_OPERATION:
|
|
35
|
+
return fixtures.SPONSORED_GAS_ESTIMATION;
|
|
36
|
+
case 'pimlico_getUserOperationGasPrice':
|
|
37
|
+
return fixtures.USER_OPERATION_GAS_PRICE;
|
|
38
|
+
default:
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
}));
|
|
44
|
+
describe('PimlicoFeeEstimator', () => {
|
|
45
|
+
let estimator;
|
|
46
|
+
beforeEach(() => {
|
|
47
|
+
estimator = new PimlicoFeeEstimator_1.PimlicoFeeEstimator();
|
|
48
|
+
});
|
|
49
|
+
it('should enable to setup the gas estimation', async () => {
|
|
50
|
+
const sponsoredGasEstimation = await estimator.setupEstimation({
|
|
51
|
+
bundlerUrl: fixtures.BUNDLER_URL,
|
|
52
|
+
userOperation: fixtures.USER_OPERATION,
|
|
53
|
+
entryPoint: fixtures.ENTRYPOINTS[0]
|
|
54
|
+
});
|
|
55
|
+
expect(sponsoredGasEstimation).toEqual(fixtures.USER_OPERATION_GAS_PRICE.fast);
|
|
56
|
+
});
|
|
57
|
+
// TODO: This tests breaks because of the BigInt serialization and requires further investigation
|
|
58
|
+
// it('should enable to adjust the gas estimation', async () => {
|
|
59
|
+
// const sponsoredGasEstimation = await estimator.adjustEstimation({
|
|
60
|
+
// bundlerUrl: fixtures.BUNDLER_URL,
|
|
61
|
+
// userOperation: fixtures.USER_OPERATION,
|
|
62
|
+
// entryPoint: fixtures.ENTRYPOINTS[0]
|
|
63
|
+
// })
|
|
64
|
+
// expect(sponsoredGasEstimation).toEqual({ verificationGasLimit: 41_528n })
|
|
65
|
+
// })
|
|
66
|
+
it('should get the paymaster estimation', async () => {
|
|
67
|
+
const paymasterGasEstimation = await estimator.getPaymasterEstimation({
|
|
68
|
+
userOperation: fixtures.USER_OPERATION,
|
|
69
|
+
paymasterUrl: fixtures.PAYMASTER_URL,
|
|
70
|
+
entryPoint: fixtures.ENTRYPOINTS[0]
|
|
71
|
+
});
|
|
72
|
+
expect(paymasterGasEstimation).toEqual(fixtures.SPONSORED_GAS_ESTIMATION);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=PimlicoFeeEstimator.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PimlicoFeeEstimator.test.js","sourceRoot":"","sources":["../../../../../src/packs/safe-4337/estimators/PimlicoFeeEstimator.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA2D;AAC3D,oEAAqD;AACrD,wDAAyC;AAEzC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3B,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC;IACjC,yBAAyB,EAAE,GAAG,EAAE,CAAC,CAAC;QAChC,IAAI,EAAE,KAAK,EAAE,MAAc,EAAE,EAAE;YAC7B,QAAQ,MAAM,EAAE,CAAC;gBACf,KAAK,SAAS,CAAC,cAAc,CAAC,sBAAsB;oBAClD,OAAO,QAAQ,CAAC,wBAAwB,CAAA;gBAC1C,KAAK,kCAAkC;oBACrC,OAAO,QAAQ,CAAC,wBAAwB,CAAA;gBAC1C;oBACE,OAAO,SAAS,CAAA;YACpB,CAAC;QACH,CAAC;KACF,CAAC;CACH,CAAC,CAAC,CAAA;AAEH,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,SAA8B,CAAA;IAElC,UAAU,CAAC,GAAG,EAAE;QACd,SAAS,GAAG,IAAI,yCAAmB,EAAE,CAAA;IACvC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;QACzD,MAAM,sBAAsB,GAAG,MAAM,SAAS,CAAC,eAAe,CAAC;YAC7D,UAAU,EAAE,QAAQ,CAAC,WAAW;YAChC,aAAa,EAAE,QAAQ,CAAC,cAAc;YACtC,UAAU,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;SACpC,CAAC,CAAA;QAEF,MAAM,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAA;IAChF,CAAC,CAAC,CAAA;IAEF,iGAAiG;IACjG,iEAAiE;IACjE,sEAAsE;IACtE,wCAAwC;IACxC,8CAA8C;IAC9C,0CAA0C;IAC1C,OAAO;IAEP,8EAA8E;IAC9E,KAAK;IAEL,EAAE,CAAC,qCAAqC,EAAE,KAAK,IAAI,EAAE;QACnD,MAAM,sBAAsB,GAAG,MAAM,SAAS,CAAC,sBAAsB,CAAC;YACpE,aAAa,EAAE,QAAQ,CAAC,cAAc;YACtC,YAAY,EAAE,QAAQ,CAAC,aAAa;YACpC,UAAU,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;SACpC,CAAC,CAAA;QAEF,MAAM,CAAC,sBAAsB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAA;IAC3E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PimlicoFeeEstimator = void 0;
|
|
4
|
+
const PimlicoFeeEstimator_1 = require("./PimlicoFeeEstimator");
|
|
5
|
+
Object.defineProperty(exports, "PimlicoFeeEstimator", { enumerable: true, get: function () { return PimlicoFeeEstimator_1.PimlicoFeeEstimator; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/packs/safe-4337/estimators/index.ts"],"names":[],"mappings":";;;AAAA,+DAA2D;AAElD,oGAFA,yCAAmB,OAEA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export declare const OWNER_1 = "0xFfAC5578BE8AC1B2B9D13b34cAf4A074B96B8A1b";
|
|
2
|
+
export declare const PREDICTED_SAFE_ADDRESS = "0x65e0d294F2d17CB9fB0f65111E9Ac8a00C4049dA";
|
|
3
|
+
export declare const SAFE_ADDRESS_v1_4_1 = "0x717f4BB83D8DF2e5a3Cc603Ee27263ac9EFB6c12";
|
|
4
|
+
export declare const SAFE_ADDRESS_v1_3_0 = "0x8C35a08Af278518B59D04ddDe3F1b370aD766D22";
|
|
5
|
+
export declare const SAFE_ADDRESS_4337_MODULE_NOT_ENABLED = "0xfC82a1e4A045a44527e8b45FC70332C8F66fc32B";
|
|
6
|
+
export declare const SAFE_ADDRESS_4337_FALLBACKHANDLER_NOT_ENABLED = "0xA6FDc4e18404E1715D1bC51B07266c91393C6622";
|
|
7
|
+
export declare const PAYMASTER_ADDRESS = "0x0000000000325602a77416A16136FDafd04b299f";
|
|
8
|
+
export declare const PAYMASTER_TOKEN_ADDRESS = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238";
|
|
9
|
+
export declare const CHAIN_ID = "0xaa36a7";
|
|
10
|
+
export declare const RPC_URL = "https://rpc.ankr.com/eth_sepolia";
|
|
11
|
+
export declare const BUNDLER_URL = "https://bundler.url";
|
|
12
|
+
export declare const PAYMASTER_URL = "https://paymaster.url";
|
|
13
|
+
export declare const USER_OPERATION_HASH = "0x3cb881d1969036174f38d636d22108d1d032145518b53104fc0b1e1296d2cc9c";
|
|
14
|
+
export declare const ENTRYPOINTS: string[];
|
|
15
|
+
export declare const USER_OPERATION_RECEIPT: {
|
|
16
|
+
userOpHash: string;
|
|
17
|
+
sender: string;
|
|
18
|
+
nonce: string;
|
|
19
|
+
actualGasUsed: string;
|
|
20
|
+
actualGasCost: string;
|
|
21
|
+
success: boolean;
|
|
22
|
+
logs: never[];
|
|
23
|
+
receipt: {
|
|
24
|
+
transactionHash: string;
|
|
25
|
+
transactionIndex: string;
|
|
26
|
+
blockHash: string;
|
|
27
|
+
blockNumber: string;
|
|
28
|
+
from: string;
|
|
29
|
+
to: string;
|
|
30
|
+
cumulativeGasUsed: string;
|
|
31
|
+
gasUsed: string;
|
|
32
|
+
contractAddress: null;
|
|
33
|
+
logs: never[];
|
|
34
|
+
logsBloom: string;
|
|
35
|
+
status: string;
|
|
36
|
+
effectiveGasPrice: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare const USER_OPERATION: {
|
|
40
|
+
sender: string;
|
|
41
|
+
nonce: string;
|
|
42
|
+
initCode: string;
|
|
43
|
+
callData: string;
|
|
44
|
+
callGasLimit: bigint;
|
|
45
|
+
verificationGasLimit: bigint;
|
|
46
|
+
preVerificationGas: bigint;
|
|
47
|
+
maxFeePerGas: bigint;
|
|
48
|
+
maxPriorityFeePerGas: bigint;
|
|
49
|
+
paymasterAndData: string;
|
|
50
|
+
signature: string;
|
|
51
|
+
};
|
|
52
|
+
export declare const USER_OPERATION_HEX_VALUES: {
|
|
53
|
+
sender: string;
|
|
54
|
+
nonce: string;
|
|
55
|
+
initCode: string;
|
|
56
|
+
callData: string;
|
|
57
|
+
callGasLimit: string;
|
|
58
|
+
verificationGasLimit: string;
|
|
59
|
+
preVerificationGas: string;
|
|
60
|
+
maxFeePerGas: string;
|
|
61
|
+
maxPriorityFeePerGas: string;
|
|
62
|
+
paymasterAndData: string;
|
|
63
|
+
signature: string;
|
|
64
|
+
};
|
|
65
|
+
export declare const USER_OPERATION_BY_HASH: {
|
|
66
|
+
userOperation: {
|
|
67
|
+
sender: string;
|
|
68
|
+
nonce: string;
|
|
69
|
+
initCode: string;
|
|
70
|
+
callData: string;
|
|
71
|
+
callGasLimit: string;
|
|
72
|
+
verificationGasLimit: string;
|
|
73
|
+
preVerificationGas: string;
|
|
74
|
+
maxFeePerGas: string;
|
|
75
|
+
maxPriorityFeePerGas: string;
|
|
76
|
+
paymasterAndData: string;
|
|
77
|
+
signature: string;
|
|
78
|
+
};
|
|
79
|
+
entryPoint: string;
|
|
80
|
+
transactionHash: string;
|
|
81
|
+
blockHash: string;
|
|
82
|
+
blockNumber: string;
|
|
83
|
+
};
|
|
84
|
+
export declare const GAS_ESTIMATION: {
|
|
85
|
+
verificationGasLimit: string;
|
|
86
|
+
preVerificationGas: string;
|
|
87
|
+
callGasLimit: string;
|
|
88
|
+
};
|
|
89
|
+
export declare const SPONSORED_GAS_ESTIMATION: {
|
|
90
|
+
verificationGasLimit: string;
|
|
91
|
+
preVerificationGas: string;
|
|
92
|
+
callGasLimit: string;
|
|
93
|
+
paymasterAndData: string;
|
|
94
|
+
};
|
|
95
|
+
export declare const USER_OPERATION_GAS_PRICE: {
|
|
96
|
+
fast: {
|
|
97
|
+
maxFeePerGas: string;
|
|
98
|
+
maxPriorityFeePerGas: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.USER_OPERATION_GAS_PRICE = exports.SPONSORED_GAS_ESTIMATION = exports.GAS_ESTIMATION = exports.USER_OPERATION_BY_HASH = exports.USER_OPERATION_HEX_VALUES = exports.USER_OPERATION = exports.USER_OPERATION_RECEIPT = exports.ENTRYPOINTS = exports.USER_OPERATION_HASH = exports.PAYMASTER_URL = exports.BUNDLER_URL = exports.RPC_URL = exports.CHAIN_ID = exports.PAYMASTER_TOKEN_ADDRESS = exports.PAYMASTER_ADDRESS = exports.SAFE_ADDRESS_4337_FALLBACKHANDLER_NOT_ENABLED = exports.SAFE_ADDRESS_4337_MODULE_NOT_ENABLED = exports.SAFE_ADDRESS_v1_3_0 = exports.SAFE_ADDRESS_v1_4_1 = exports.PREDICTED_SAFE_ADDRESS = exports.OWNER_1 = void 0;
|
|
4
|
+
exports.OWNER_1 = '0xFfAC5578BE8AC1B2B9D13b34cAf4A074B96B8A1b';
|
|
5
|
+
exports.PREDICTED_SAFE_ADDRESS = '0x65e0d294F2d17CB9fB0f65111E9Ac8a00C4049dA';
|
|
6
|
+
exports.SAFE_ADDRESS_v1_4_1 = '0x717f4BB83D8DF2e5a3Cc603Ee27263ac9EFB6c12';
|
|
7
|
+
exports.SAFE_ADDRESS_v1_3_0 = '0x8C35a08Af278518B59D04ddDe3F1b370aD766D22';
|
|
8
|
+
exports.SAFE_ADDRESS_4337_MODULE_NOT_ENABLED = '0xfC82a1e4A045a44527e8b45FC70332C8F66fc32B';
|
|
9
|
+
exports.SAFE_ADDRESS_4337_FALLBACKHANDLER_NOT_ENABLED = '0xA6FDc4e18404E1715D1bC51B07266c91393C6622';
|
|
10
|
+
exports.PAYMASTER_ADDRESS = '0x0000000000325602a77416A16136FDafd04b299f';
|
|
11
|
+
exports.PAYMASTER_TOKEN_ADDRESS = '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238';
|
|
12
|
+
exports.CHAIN_ID = '0xaa36a7';
|
|
13
|
+
exports.RPC_URL = 'https://rpc.ankr.com/eth_sepolia';
|
|
14
|
+
exports.BUNDLER_URL = 'https://bundler.url';
|
|
15
|
+
exports.PAYMASTER_URL = 'https://paymaster.url';
|
|
16
|
+
exports.USER_OPERATION_HASH = '0x3cb881d1969036174f38d636d22108d1d032145518b53104fc0b1e1296d2cc9c';
|
|
17
|
+
exports.ENTRYPOINTS = [
|
|
18
|
+
'0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789',
|
|
19
|
+
'0x0000000071727De22E5E9d8BAf0edAc6f37da032'
|
|
20
|
+
];
|
|
21
|
+
exports.USER_OPERATION_RECEIPT = {
|
|
22
|
+
userOpHash: '0x3cb881d1969036174f38d636d22108d1d032145518b53104fc0b1e1296d2cc9c',
|
|
23
|
+
sender: '0x1405B3659a11a16459fc27Fa1925b60388C38Ce1',
|
|
24
|
+
nonce: '0x1',
|
|
25
|
+
actualGasUsed: '0x27067',
|
|
26
|
+
actualGasCost: '0x42f29418377167',
|
|
27
|
+
success: true,
|
|
28
|
+
logs: [],
|
|
29
|
+
receipt: {
|
|
30
|
+
transactionHash: '0xef262d20f68e4900aa6380b8ac0f66f9c00a7d988179fa177ad9c9758f0e380e',
|
|
31
|
+
transactionIndex: '0x63',
|
|
32
|
+
blockHash: '0x65f8249337ffede2067a006a96da47d3d3445ca72492a6a82afa02899f05d2e5',
|
|
33
|
+
blockNumber: '0x5378b9',
|
|
34
|
+
from: '0x4337001Fff419768e088Ce247456c1B892888084',
|
|
35
|
+
to: '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789',
|
|
36
|
+
cumulativeGasUsed: '0xc1a846',
|
|
37
|
+
gasUsed: '0x25e6c',
|
|
38
|
+
contractAddress: null,
|
|
39
|
+
logs: [],
|
|
40
|
+
logsBloom: '0x000000000000900000000000000000000000000000000000080000000002000000080000000000000402000100000000001000000000000080000200000100000000000000000000000000080000000000000000000000000000002000002000000000000a0000000000000000000800000000000000000000000010000200000000000060100000000000000040000000800000000000000008800000000000000000000000000000400000000000000200000000000000000002000000008000000002000100000001000000000000000000000020000000000000000020010040000000000020000010000008000200000000000000000000000000000000',
|
|
41
|
+
status: '0x1',
|
|
42
|
+
effectiveGasPrice: '0x1b67f3c201'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.USER_OPERATION = {
|
|
46
|
+
sender: '0x1405B3659a11a16459fc27Fa1925b60388C38Ce1',
|
|
47
|
+
nonce: '0x1',
|
|
48
|
+
initCode: '0x',
|
|
49
|
+
callData: '0x7bb3742800000000000000000000000038869bf66a61cf6bdb996a6ae40d5853fd43b52600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001848d80ff0a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000132001c7d4b196cb0c7b01d743fbc6116a902379c723800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb000000000000000000000000d725e11588f040d86c4c49d8236e32a5868549f000000000000000000000000000000000000000000000000000000000000186a0001c7d4b196cb0c7b01d743fbc6116a902379c723800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb000000000000000000000000d725e11588f040d86c4c49d8236e32a5868549f000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
|
50
|
+
callGasLimit: 120784n,
|
|
51
|
+
verificationGasLimit: 83056n,
|
|
52
|
+
preVerificationGas: 48568n,
|
|
53
|
+
maxFeePerGas: 193584757388n,
|
|
54
|
+
maxPriorityFeePerGas: 1380000000n,
|
|
55
|
+
paymasterAndData: '0x',
|
|
56
|
+
signature: '0x000000000000000000000000a397ca32ee7fb5282256ee3465da0843485930b803d747516aac76e152f834051ac18fd2b3c0565590f9d65085538993c85c9bb189c940d15c15402c7c2885821b'
|
|
57
|
+
};
|
|
58
|
+
exports.USER_OPERATION_HEX_VALUES = {
|
|
59
|
+
sender: '0x1405B3659a11a16459fc27Fa1925b60388C38Ce1',
|
|
60
|
+
nonce: '0x1',
|
|
61
|
+
initCode: '0x',
|
|
62
|
+
callData: '0x7bb3742800000000000000000000000038869bf66a61cf6bdb996a6ae40d5853fd43b52600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001848d80ff0a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000132001c7d4b196cb0c7b01d743fbc6116a902379c723800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb000000000000000000000000d725e11588f040d86c4c49d8236e32a5868549f000000000000000000000000000000000000000000000000000000000000186a0001c7d4b196cb0c7b01d743fbc6116a902379c723800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb000000000000000000000000d725e11588f040d86c4c49d8236e32a5868549f000000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
|
|
63
|
+
callGasLimit: '0x1d7d0',
|
|
64
|
+
verificationGasLimit: '0x14470',
|
|
65
|
+
preVerificationGas: '0xbdb8',
|
|
66
|
+
maxFeePerGas: '0x2d128cfa8c',
|
|
67
|
+
maxPriorityFeePerGas: '0x52412100',
|
|
68
|
+
paymasterAndData: '0x',
|
|
69
|
+
signature: '0x000000000000000000000000a397ca32ee7fb5282256ee3465da0843485930b803d747516aac76e152f834051ac18fd2b3c0565590f9d65085538993c85c9bb189c940d15c15402c7c2885821b'
|
|
70
|
+
};
|
|
71
|
+
exports.USER_OPERATION_BY_HASH = {
|
|
72
|
+
userOperation: exports.USER_OPERATION_HEX_VALUES,
|
|
73
|
+
entryPoint: '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789',
|
|
74
|
+
transactionHash: '0xef262d20f68e4900aa6380b8ac0f66f9c00a7d988179fa177ad9c9758f0e380e',
|
|
75
|
+
blockHash: '0x65f8249337ffede2067a006a96da47d3d3445ca72492a6a82afa02899f05d2e5',
|
|
76
|
+
blockNumber: '0x5378b9'
|
|
77
|
+
};
|
|
78
|
+
exports.GAS_ESTIMATION = {
|
|
79
|
+
verificationGasLimit: '0x186A0',
|
|
80
|
+
preVerificationGas: '0x186A0',
|
|
81
|
+
callGasLimit: '0x186A0'
|
|
82
|
+
};
|
|
83
|
+
exports.SPONSORED_GAS_ESTIMATION = {
|
|
84
|
+
paymasterAndData: '0x1405B3659a11a16459fc27Fa1925b60388C38Ce1',
|
|
85
|
+
...exports.GAS_ESTIMATION
|
|
86
|
+
};
|
|
87
|
+
exports.USER_OPERATION_GAS_PRICE = {
|
|
88
|
+
fast: { maxFeePerGas: '0x186A0', maxPriorityFeePerGas: '0x30D40' }
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../../../src/packs/safe-4337/testing-utils/fixtures.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,4CAA4C,CAAA;AACtD,QAAA,sBAAsB,GAAG,4CAA4C,CAAA;AACrE,QAAA,mBAAmB,GAAG,4CAA4C,CAAA;AAClE,QAAA,mBAAmB,GAAG,4CAA4C,CAAA;AAClE,QAAA,oCAAoC,GAAG,4CAA4C,CAAA;AACnF,QAAA,6CAA6C,GACxD,4CAA4C,CAAA;AACjC,QAAA,iBAAiB,GAAG,4CAA4C,CAAA;AAChE,QAAA,uBAAuB,GAAG,4CAA4C,CAAA;AACtE,QAAA,QAAQ,GAAG,UAAU,CAAA;AAErB,QAAA,OAAO,GAAG,kCAAkC,CAAA;AAC5C,QAAA,WAAW,GAAG,qBAAqB,CAAA;AACnC,QAAA,aAAa,GAAG,uBAAuB,CAAA;AAEvC,QAAA,mBAAmB,GAC9B,oEAAoE,CAAA;AAEzD,QAAA,WAAW,GAAG;IACzB,4CAA4C;IAC5C,4CAA4C;CAC7C,CAAA;AAEY,QAAA,sBAAsB,GAAG;IACpC,UAAU,EAAE,oEAAoE;IAChF,MAAM,EAAE,4CAA4C;IACpD,KAAK,EAAE,KAAK;IACZ,aAAa,EAAE,SAAS;IACxB,aAAa,EAAE,kBAAkB;IACjC,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,EAAE;IACR,OAAO,EAAE;QACP,eAAe,EAAE,oEAAoE;QACrF,gBAAgB,EAAE,MAAM;QACxB,SAAS,EAAE,oEAAoE;QAC/E,WAAW,EAAE,UAAU;QACvB,IAAI,EAAE,4CAA4C;QAClD,EAAE,EAAE,4CAA4C;QAChD,iBAAiB,EAAE,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tC,IAAI,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,oBAAoB,EAAE,SAAS,EAAE;CACnE,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Safe4337InitOptions } from '../types';
|
|
2
|
+
import { Safe4337Pack } from '../Safe4337Pack';
|
|
3
|
+
export declare const generateTransferCallData: (to: string, value: bigint) => string;
|
|
4
|
+
export declare const createSafe4337Pack: (initOptions: Partial<Safe4337InitOptions>) => Promise<Safe4337Pack>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.createSafe4337Pack = exports.generateTransferCallData = void 0;
|
|
27
|
+
const ethers_1 = require("ethers");
|
|
28
|
+
const protocolKit = __importStar(require("@safe-global/protocol-kit"));
|
|
29
|
+
const Safe4337Pack_1 = require("../Safe4337Pack");
|
|
30
|
+
const fixtures = __importStar(require("./fixtures"));
|
|
31
|
+
const generateTransferCallData = (to, value) => {
|
|
32
|
+
const functionAbi = 'function transfer(address _to, uint256 _value) returns (bool)';
|
|
33
|
+
const iface = new ethers_1.ethers.Interface([functionAbi]);
|
|
34
|
+
return iface.encodeFunctionData('transfer', [to, value]);
|
|
35
|
+
};
|
|
36
|
+
exports.generateTransferCallData = generateTransferCallData;
|
|
37
|
+
const createSafe4337Pack = async (initOptions) => {
|
|
38
|
+
const provider = new ethers_1.ethers.JsonRpcProvider(fixtures.RPC_URL);
|
|
39
|
+
const signer = new ethers_1.ethers.Wallet(process.env.PRIVATE_KEY || '0x', provider);
|
|
40
|
+
const ethersAdapter = new protocolKit.EthersAdapter({
|
|
41
|
+
ethers: ethers_1.ethers,
|
|
42
|
+
signerOrProvider: signer
|
|
43
|
+
});
|
|
44
|
+
const safe4337Pack = await Safe4337Pack_1.Safe4337Pack.init({
|
|
45
|
+
options: {
|
|
46
|
+
safeAddress: ''
|
|
47
|
+
},
|
|
48
|
+
...initOptions,
|
|
49
|
+
ethersAdapter,
|
|
50
|
+
rpcUrl: fixtures.RPC_URL,
|
|
51
|
+
bundlerUrl: fixtures.BUNDLER_URL
|
|
52
|
+
});
|
|
53
|
+
return safe4337Pack;
|
|
54
|
+
};
|
|
55
|
+
exports.createSafe4337Pack = createSafe4337Pack;
|
|
56
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../src/packs/safe-4337/testing-utils/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA+B;AAC/B,uEAAwD;AAExD,kDAA8C;AAC9C,qDAAsC;AA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