Type: Object
Properties
typestring The type of the binding (a valid Radspec type)valueany The value of the binding
Evaluate a radspec expression with manual bindings.
Parameters
sourcestring The radspec expressionbindingsBindings An object of bindings and their valuesevaluatorOptionsObject? An options object for the evaluator
Examples
import radspec from 'radspec'
radspec.evaluateRaw('a is `a`', {
a: { type: 'int256', value: 10 }
}).then(console.log)Returns Promise<string> The result of the evaluation
Evaluate a radspec expression (source) for a transaction (call)
Parameters
sourcestring The radspec expressioncallObject The call that determines the bindings for this evaluationoptionsObject? An options object (optional, default{})options.ethNodestring? The URL to an Ethereum node
Examples
import radspec from 'radspec'
const expression = 'Will multiply `a` by 7 and return `a * 7`.'
const call = {
abi: [{
name: 'multiply',
constant: false,
type: 'function',
inputs: [{
name: 'a',
type: 'uint256'
}],
outputs: [{
name: 'd',
type: 'uint256'
}]
}],
transaction: {
to: '0x8521742d3f456bd237e312d6e30724960f72517a',
data: '0xc6888fa1000000000000000000000000000000000000000000000000000000000000007a'
}
}
radspec.evaluate(expression, call)
.then(console.log) // => "Will multiply 122 by 7 and return 854."