Type: Object
Properties
type
string The type of the binding (a valid Radspec type)value
any The value of the binding
Evaluate a radspec expression with manual bindings.
Parameters
source
string The radspec expressionbindings
Bindings An object of bindings and their valuesevaluatorOptions
Object? 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
source
string The radspec expressioncall
Object The call that determines the bindings for this evaluationoptions
Object? An options object (optional, default{}
)options.ethNode
string? 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."