MCPcopy Create free account
hub / github.com/5afe/safe-eip7702 / encodeMetaTransaction

Function encodeMetaTransaction

safe-eip7702-backend/src/utils.ts:33–44  ·  view source on GitHub ↗
(tx: MetaTransaction)

Source from the content-addressed store, hash-verified

31
32// Function to encode a single meta-transaction
33const encodeMetaTransaction = (tx: MetaTransaction): string => {
34 // Convert data into bytes format
35 const data = toBytes(tx.data);
36
37 // Encode using encodePacked (similar to ethers' solidityPacked)
38 const encoded = encodePacked(
39 ["uint8", "address", "uint256", "uint256", "bytes"], // Solidity types
40 [0, tx.to, tx.value, BigInt(data.length), tx.data] // Values to encode
41 );
42
43 return encoded.slice(2); // Remove '0x' from the encoded result
44};
45// Function to encode multiple transactions for multiSend
46
47export const encodeMultiSend = (txs: MetaTransaction[]): `0x${string}` => {

Callers 1

encodeMultiSendFunction · 0.70

Calls 1

BigIntInterface · 0.70

Tested by

no test coverage detected