diff --git a/CHANGELOG.md b/CHANGELOG.md index bf26f71035..d7567eadeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1080,4 +1080,4 @@ fix(AEP exampe): Fix contract in AEPP example ### Bug Fixes -* **Chore** More consistent code examples +* **Chore** More consistent code examples \ No newline at end of file diff --git a/docs/api/ae/contract.md b/docs/api/ae/contract.md index 8292ecb9e7..fd8874c53c 100644 --- a/docs/api/ae/contract.md +++ b/docs/api/ae/contract.md @@ -215,7 +215,10 @@ Compile contract source code | source | `String` | | Contract sourece code | | [options] | `Object` | {} | Transaction options (fee, ttl, gas, amount, deposit) | | [options.filesystem] | `Object` | {} | Contract external namespaces map* @return {Promise} Result object | +<<<<<<< HEAD +======= | [options.backend] | `Object` | 'aevm' | Contract backend version (aevm|fate) | +>>>>>>> develop **Example** ```js diff --git a/es/channel/handlers.js b/es/channel/handlers.js index ee05f6d369..953edfa65c 100644 --- a/es/channel/handlers.js +++ b/es/channel/handlers.js @@ -174,6 +174,8 @@ export async function channelOpen (channel, message, state) { case 'died': changeStatus(channel, 'died') return { handler: channelClosed } + case 'shutdown': + return { handler: channelOpen } } break case 'channels.on_chain_tx': diff --git a/package-lock.json b/package-lock.json index 910d4e1c7e..8c26abed4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12143,4 +12143,4 @@ } } } -} +} \ No newline at end of file diff --git a/test/integration/channel.js b/test/integration/channel.js index 4fabcad6d5..600fb9c1fb 100644 --- a/test/integration/channel.js +++ b/test/integration/channel.js @@ -29,8 +29,8 @@ const wsUrl = process.env.TEST_WS_URL || 'ws://localhost:3014/channel' plan(BigNumber('1000e18').toString()) const identityContract = ` -payable contract Identity = - payable entrypoint main(x : int): int = x +contract Identity = + entrypoint main(x : int) : int = x ` function waitForChannel (channel) { @@ -73,7 +73,8 @@ describe.skip('Channel', function () { ttl: 10000, host: 'localhost', port: 3001, - lockPeriod: 1 + lockPeriod: 1, + statePassword: 'correct horse battery staple' } before(async function () { @@ -735,24 +736,24 @@ describe.skip('Channel', function () { sign: responderSign }) await Promise.all([waitForChannel(initiatorCh), waitForChannel(responderCh)]) - const code = await initiator.compileContractAPI(identityContract) - const callData = await initiator.contractEncodeCallDataAPI(identityContract, 'init', []) + const code = await initiator.compileContractAPI(identityContract, { backend: 'aevm' }) + const callData = await initiator.contractEncodeCallDataAPI(identityContract, 'init', [], { backend: 'aevm' }) const result = await initiatorCh.createContract({ code, callData, deposit: 1000, - vmVersion: 4, + vmVersion: 6, abiVersion: 1 }, async (tx) => initiator.signTransaction(tx)) result.should.eql({ accepted: true, address: result.address, signedTx: (await initiatorCh.state()).signedTx }) contractAddress = result.address - contractEncodeCall = (method, args) => initiator.contractEncodeCallDataAPI(identityContract, method, args) + contractEncodeCall = (method, args) => initiator.contractEncodeCallDataAPI(identityContract, method, args, { backend: 'aevm' }) }) it('can create a contract and reject', async () => { responderShouldRejectUpdate = true - const code = await initiator.compileContractAPI(identityContract) - const callData = await initiator.contractEncodeCallDataAPI(identityContract, 'init', []) + const code = await initiator.compileContractAPI(identityContract, { backend: 'aevm' }) + const callData = await initiator.contractEncodeCallDataAPI(identityContract, 'init', [], { backend: 'aevm' }) const result = await initiatorCh.createContract({ code, callData, @@ -808,7 +809,7 @@ describe.skip('Channel', function () { it('can call a contract using dry-run', async () => { const result = await initiatorCh.callContractStatic({ - amount: BigNumber('2e18'), + amount: 0, callData: await contractEncodeCall('main', ['42']), contract: contractAddress, abiVersion: 1 @@ -834,7 +835,7 @@ describe.skip('Channel', function () { caller: await initiator.address(), contract: contractAddress, round: callerNonce - }).should.eventually.be.rejectedWith('Rejected: Call not found') + }).should.eventually.be.rejected }) it('can get contract state', async () => { @@ -847,7 +848,7 @@ describe.skip('Channel', function () { id: contractAddress, ownerId: await initiator.address(), referrerIds: [], - vmVersion: 4 + vmVersion: 6 }, contractState: result.contractState })