-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
im working on adding the tx builder json format support to ape-safe and the way checksum is calculated sticks out to me.
currently it uses some unhinged weird custom encoding, which looks very brittle when you consider porting into other languages.
consider using something like json-stable-stringify instead.
| const serializeJSONObject = (json: any): string => { |
example of output:
>>> serializeJSONObject(batchFileObject)
'{["chainId","createdAt","meta","transactions","version"]"4",1646321521061,{["checksum","createdFromOwnerAddress","createdFromSafeAddress","name","txBuilderVersion"]"","0x49d4450977E2c95362C13D3a31a09311E0Ea26A6","0xDF8a1Ce35c9a6ACE153B4e0767942f1E2291a1Aa","test batch file","1.4.0",},[{["contractInputsValues","contractMethod","to","value"]{["paramAddress"]"0x49d4450977E2c95362C13D3a31a09311E0Ea26A6",},{["inputs","name","payable"][{["internalType","name","type"]"address","paramAddress","address",}],"testAddress",false,},"0x49d4450977E2c95362C13D3a31a09311E0Ea26A6","0",},{["contractInputsValues","contractMethod","to","value"]{["paramAddress","paramBool"]"","false",},{["inputs","name","payable"][{["internalType","name","type"]"bool","paramBool","bool",}],"testBool",false,},"0x49d4450977E2c95362C13D3a31a09311E0Ea26A6","0",},{["data","to","value"]"0x42f4579000000000000000000000000049d4450977e2c95362c13d3a31a09311e0ea26a6","0x49d4450977E2c95362C13D3a31a09311E0Ea26A6","2000000000000000000",}],"1.0",}'Metadata
Metadata
Assignees
Labels
No labels