Skip to content

Instantly share code, notes, and snippets.

Avatar

Bernd Strehl Strernd

  • Hamburg, Germany
View GitHub Profile
View serverless_cost.csv
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 -
View handler.js
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));
View ibm.js
'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 Jun 7, 2021
Parses an ERC20 Transfer from the Ethereum API.
View parseErc20Transfer.js
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"