forgAE: problem after migration from 1.4 to 2.0


I had to struggle a bit with migrating from 1.4 to 2.0 but almost figured out all the problems. The last problem I faced was that I encountered an issue within forgAE when trying to call a contract-function that doesn’t return any value.

The line in my test looks like this:

await deployedContractNonRecipient.payAndSplit({value: aettos});

The function in the contract is defined as follows:

public stateful function payAndSplit() =
      require(Contract.balance > 0, "contract didn't receive any payment")
      let recipientConditions: list((address, int)) = Map.to_list(state.recipientConditions)
      split(recipientConditions, Contract.balance)
      Chain.event(PaymentReceivedAndSplitted(Call.caller, Call.value, Contract.balance))

And the error I get looks like this:

TypeError: returnType.trim is not a function
      at functions.(anonymous function) (node_modules\forgae-lib\forgae-deployer.js:260:76)
      at process._tickCallback (internal/process/next_tick.js:68:7)

@MartinG can you help me out here?

I have another issue that is more related to the aepp-sdk-js in combination with the standalone-compiler as far as I can judge this.

I am trying to pass in a Map as parameter for the following contract-function:

public stateful function updateRecipientConditions(recipients': map(address, int)) =
      require(sumWeights(recipients') == 100, "sum of weights needs to be 100")
      put(state{recipientConditions = recipients'})

The code in the test looks like this:

let recipientConditions = new Map();
recipientConditions.set(recipientOneKeyPair.publicKey, 15); recipientConditions.set(recipientTwoKeyPair.publicKey, 15);
recipientConditions.set(recipientThreeKeyPair.publicKey, 20);
recipientConditions.set(recipientFourKeyPair.publicKey, 20);
recipientConditions.set(recipientFiveKeyPair.publicKey, 25);
recipientConditions.set(recipientSixKeyPair.publicKey, 5);
await deployedContractOwner.updateRecipientConditions(recipientConditions);

The error I get is this:

Error: Http request for http://localhost:3080/encode-calldata failed with status code 403. Status: Forbidden. 
Error data: {"reason":"Type errors\nCannot unify map(address, int)\n         and string\nwhen checking the application at line 109, column 24 of\n  updateRecipientConditions : (map(address, int)) =>
()\nto arguments\n  \"[object Map]\" : string\n"}

here is the respective branch in our repository if somebody of the team wants to investigate:

Hey @marc0olo,

Monday we will release new version of forgae which will probably resolve these issues at least from first glance. I will dig more about your issue and I will comeback to you.


1 Like

thanks! looking forward to test the new forgAE version. hopefully the issues will all be solved then :slight_smile:

hey @marc0olo,

We have found and fixed the first issue and currently investigating and working on the second one. We will provide new version of forgae with the fixes as soon as possible. I will keep you posted.
Sorry for the inconvenience.


1 Like

you’re welcome to provide a pull-request to my migration-branch with the fixes :wink:

but if you can’t find time to do so I will do it by myself as soon as the issues are fixed.


Hey @marc0olo we are still working on a fix , because it came bigger than we thought. We are trying to fix and release as fast as possible. If you need a workaround, please ping me and I will help.


1 Like

thanks for letting me know. I will wait for the fix being released. it isn’t critical and I am not a big fan of workarounds :smiley:

1 Like

@MartinG any updates on that front? :slight_smile:

@marc0olo currently no, we have some progress here but nothing to release yet. I will keep you posted


1 Like

Hey, @marc0olo

We have fixed all of the issues and will be available on PR today. We will work on asap release for next week. I will ping you when the official release is made.