|
|
@ -11,7 +11,7 @@ var executionContext = require('../src/execution/execution-context') |
|
|
|
|
|
|
|
|
|
|
|
var context |
|
|
|
var context |
|
|
|
tape('ContractParameters - (TxFormat.buildData) - format input parameters', function (t) { |
|
|
|
tape('ContractParameters - (TxFormat.buildData) - format input parameters', function (t) { |
|
|
|
var output = compiler.compileStandardWrapper(compilerInput(uintContract)) |
|
|
|
var output = compiler.compile(compilerInput(uintContract)) |
|
|
|
output = JSON.parse(output) |
|
|
|
output = JSON.parse(output) |
|
|
|
var contract = output.contracts['test.sol']['uintContractTest'] |
|
|
|
var contract = output.contracts['test.sol']['uintContractTest'] |
|
|
|
context = { output, contract } |
|
|
|
context = { output, contract } |
|
|
@ -37,7 +37,7 @@ function testWithInput (st, params, expected) { |
|
|
|
|
|
|
|
|
|
|
|
tape('ContractParameters - (TxFormat.buildData) - link Libraries', function (t) { |
|
|
|
tape('ContractParameters - (TxFormat.buildData) - link Libraries', function (t) { |
|
|
|
executionContext.setContext('vm') |
|
|
|
executionContext.setContext('vm') |
|
|
|
var compileData = compiler.compileStandardWrapper(compilerInput(deploySimpleLib)) |
|
|
|
var compileData = compiler.compile(compilerInput(deploySimpleLib)) |
|
|
|
|
|
|
|
|
|
|
|
var fakeDeployedContracts = { |
|
|
|
var fakeDeployedContracts = { |
|
|
|
lib1: '0xf7a10e525d4b168f45f74db1b61f63d3e7619e11', |
|
|
|
lib1: '0xf7a10e525d4b168f45f74db1b61f63d3e7619e11', |
|
|
@ -140,7 +140,7 @@ tape('EncodeParameter', function (t) { |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
function encodeFunctionCallTest (st) { |
|
|
|
function encodeFunctionCallTest (st) { |
|
|
|
var output = compiler.compileStandardWrapper(compilerInput(encodeFunctionCall)) |
|
|
|
var output = compiler.compile(compilerInput(encodeFunctionCall)) |
|
|
|
output = JSON.parse(output) |
|
|
|
output = JSON.parse(output) |
|
|
|
var contract = output.contracts['test.sol']['testContractLinkLibrary'] |
|
|
|
var contract = output.contracts['test.sol']['testContractLinkLibrary'] |
|
|
|
txFormat.encodeFunctionCall('123, "test string"', contract.abi[0], (error, encoded) => { |
|
|
|
txFormat.encodeFunctionCall('123, "test string"', contract.abi[0], (error, encoded) => { |
|
|
@ -154,7 +154,7 @@ function encodeFunctionCallTest (st) { |
|
|
|
tape('test fallback function', function (t) { |
|
|
|
tape('test fallback function', function (t) { |
|
|
|
t.test('(fallback)', function (st) { |
|
|
|
t.test('(fallback)', function (st) { |
|
|
|
st.plan(2) |
|
|
|
st.plan(2) |
|
|
|
var output = compiler.compileStandardWrapper(compilerInput(fallbackFunction)) |
|
|
|
var output = compiler.compile(compilerInput(fallbackFunction)) |
|
|
|
output = JSON.parse(output) |
|
|
|
output = JSON.parse(output) |
|
|
|
var contract = output.contracts['test.sol']['fallbackFunctionContract'] |
|
|
|
var contract = output.contracts['test.sol']['fallbackFunctionContract'] |
|
|
|
st.equal(txHelper.encodeFunctionId(contract.abi[0]), '0x805da4ad') |
|
|
|
st.equal(txHelper.encodeFunctionId(contract.abi[0]), '0x805da4ad') |
|
|
@ -171,7 +171,7 @@ tape('test abiEncoderV2', function (t) { |
|
|
|
var decodedData = `[${value1}, ${value2}, "${value3}"], 23` |
|
|
|
var decodedData = `[${value1}, ${value2}, "${value3}"], 23` |
|
|
|
t.test('(abiEncoderV2)', function (st) { |
|
|
|
t.test('(abiEncoderV2)', function (st) { |
|
|
|
st.plan(2) |
|
|
|
st.plan(2) |
|
|
|
var output = compiler.compileStandardWrapper(compilerInput(abiEncoderV2)) |
|
|
|
var output = compiler.compile(compilerInput(abiEncoderV2)) |
|
|
|
output = JSON.parse(output) |
|
|
|
output = JSON.parse(output) |
|
|
|
var contract = output.contracts['test.sol']['test'] |
|
|
|
var contract = output.contracts['test.sol']['test'] |
|
|
|
txFormat.encodeFunctionCall(decodedData, contract.abi[0], (error, encoded) => { |
|
|
|
txFormat.encodeFunctionCall(decodedData, contract.abi[0], (error, encoded) => { |
|
|
@ -194,7 +194,7 @@ tape('test abiEncoderV2 array of tuple', function (t) { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
st.plan(2) |
|
|
|
st.plan(2) |
|
|
|
|
|
|
|
|
|
|
|
var output = compiler.compileStandardWrapper(compilerInput(abiEncoderV2ArrayOfTuple)) |
|
|
|
var output = compiler.compile(compilerInput(abiEncoderV2ArrayOfTuple)) |
|
|
|
output = JSON.parse(output) |
|
|
|
output = JSON.parse(output) |
|
|
|
var contract = output.contracts['test.sol']['test'] |
|
|
|
var contract = output.contracts['test.sol']['test'] |
|
|
|
txFormat.encodeParams('[34, "test"]', contract.abi[0], (error, encoded) => { |
|
|
|
txFormat.encodeParams('[34, "test"]', contract.abi[0], (error, encoded) => { |
|
|
|