I am creating an Node app that interacts with the Ethereum block chain via azimuth-js. There are multiple methods that must be run in sequence (creating an unsigned transaction, signing it, sending it, etc.) because making the actual blockchain transaction. I am sequencing these with an AWS Step Function with the particular steps executing code in AWS Lambdas.
The strict size limit on Lambdas requires relatively finely-grained splitting out, and I want to do so anyway for visualization purposes. Most of the Azimuth methods I'm using require the passing in the contracts object created by initContractsPartial. This is very large, and it exceeds the limit of what can directly be passed as output and input between Step Function steps. According to this Stack Overflow answer, the best solution is to store data in an S3 bucket and pull from there.
I have done so, using JSON.stringify
before upload. But when I pull it out, the methods that were in the object are gone. Previously, the methods object was of the following form (with certain sensitive numbers removed):
methods: {
escapeRequestsIndexes: [Function: bound _createTxObject],
<SOME_NUMBERS_HERE>: [Function: bound _createTxObject],
'escapeRequestsIndexes(uint32,uint32)': [Function: bound _createTxObject],
votingFor: [Function: bound _createTxObject],
<SOME_NUMBERS_HERE>: [Function: bound _createTxObject],
'votingFor(address,uint256)': [Function: bound _createTxObject],
...
}
After pulling it from the S3 bucket, this has become:
methods: {}
It seems that JSON.stringify
evaluates them before stringification and that makes them vanish. Specifically, the object that contains a JSON object of the methods is now an empty object. Non-function parts of the original larger object are fine.
I have tried other methods of getting it into S3-ready form, such as creating a Buffer
or using fs
to create a file I then upload, but the same thing always happens.
I have not been able to find a solution online. How can I achieve my goals?