Injects metering into webassembly binaries
npm install wasm-metering
const metering = require('wasm-metering')
const wasm = require('./test.wasm')
const meteredWasm = metering.meterWASM(wasm)
Injects metering into a JSON output of wasm2json
Parameters
json
Object the json tobe meteredconstTable
Object the cost table to meter with. See these notes about the default.costTable
Object (optional, defaultdefaultCostTable
) the cost table to meter with. See these notes about the default.moduleStr
[String](default 'metering') the import string for the metering functionfieldStr
[String](default 'usegas') the field string for the metering function
Returns Object This contains the fields initailAmount
, the amount it
cost to start the module and module
, the metered json.
Injects metering into a webassembly binary
Parameters
wasm
Object the wasm tobe meteredconstTable
Object the cost table to meter with. See these notes about the default.costTable
Object (optional, defaultdefaultCostTable
) the cost table to meter with. See these notes about the default.moduleStr
[String](default 'metering') the import string for the metering functionfieldStr
[String](default 'usegas') the field string for the metering function
Returns Object This contains the fields initailAmount
, the amount it
cost to start the module and module
, the metered json.