Skip to content

Instantly share code, notes, and snippets.

View Strernd's full-sized avatar

Bernd Strehl Strernd

View GitHub Profile
Provider Per 1M Calls Per 1M GB/s Per 1M GHz/s
AWS 0.2 USD 16.7 USD -
Google 0.4 USD 2.5 USD 10 USD
IBM - 17 USD -
Azure 0.2 USD 16 USD -
const laconia = require("@laconia/core");
const api = require("@laconia/adapter-api").apigateway({ inputType: "params" });
const app = async (event, { }) => {
console.log(await event);
return event;
};
exports.handler = laconia(api(app));
'use strict';
const swf = require('serverless-workload-function');
let cold = true;
exports.handler = (params) => {
const options = params || {};
return swf(options.type || 'hash', options).then(result => {
const x = { ...result, cold };
cold = false;
return x
@Strernd
Strernd / parseErc20Transfer.js
Created June 7, 2021 11:09
Parses an ERC20 Transfer from the Ethereum API.
const converter = require("hex2dec");
const Eth = require("ethjs");
const eth = new Eth(new Eth.HttpProvider(process.env.INFURA));
async function getERC20TransferByHash(hash) {
const ethTxData = await eth.getTransactionByHash(hash);
if (ethTxData === null) throw "TX NOT FOUND";
if (
ethTxData.input.length !== 138 ||
ethTxData.input.slice(2, 10) !== "a9059cbb"