Post-messaging call to contract instance don't succeed

Good day,

Hope all is well with you!

I have been struggling those days with a calling a contract instance from my app, using identity provider. After some researches came to the conclusion, that angular 8 might have troubles to resolve iframe on time.

Contract instance seems to be created correctly, but when I call a function to the contract it fails with

ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
    at TodoListComponent.<anonymous> (todo-list.component.ts:267)
    at step (main.js:2468)
    at (main.js:2449)
    at main.js:2443
    at new ZoneAwarePromise (zone.js:931)
    at push../src/app/components/todo-list/todo-list.component.ts.__awaiter (main.js:2439)
    at TodoListComponent.push../src/app/components/todo-list/todo-list.component.ts.TodoListComponent.getContractTasks (todo-list.component.ts:259)
    at TodoListComponent.<anonymous> (todo-list.component.ts:93)
    at step (main.js:2468)
    at (main.js:2449)
    at resolvePromise (zone.js:852)
    at zone.js:762
    at rejected (main.js:2441)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
    at Object.onInvoke (core.js:26769)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:390)
    at Zone.push../node_modules/zone.js/dist/ (zone.js:150)
    at zone.js:910
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:26760)

If i instantiate the client locally however this way

     this.localClient = await Universal({
      internalUrl: clientConfig.internalHost,
      keypair: keyPair,
      nativeMode: true,
      networkId: 'ae_devnet',
      compilerUrl: ''

transactions are executed successfully

Steps to reproduce

  • install forgae (npm install forgae)
  • checkout to branch feature/angular-shape-command
  • from cli
    – forgae shape angular
    – forgae deploy
    – forgae history and get the contract address ( Result )
  • in aepp-forgae-shape-angular/aepp/src/contractDetails.js enter your deployed contract address
  • ng serve aepp & identityProvider

Mostly play around with todo-list.component.ts
the error occurs in


while trying to call

this.contractInstance!.call("get_todos", []); 

That behaviour appears only while the client is instantiated with await this.getClient();
Something goes wrong with the post messaging I believe?

PS if you comment

91 await this.getClient();
267 const allToDosResponse : any = await this.contractInstance!.call("get_todos", []);
268 const allToDos = await allToDosResponse.decode();
269 const parsedToDos = this.convertSophiaListToTodos(allToDos);


262 // const allToDosResponse = await this.localContractInstance!.call("get_todos", [])
263 // const allToDos = await allToDosResponse.decode();
264 // const parsedToDos = this.convertSophiaListToTodos(allToDos);

Make sure you copied previously deployed contract address and paste it in aepp-forgae-shape-angular/aepp/src/localContractDetails.js

You would have working todo app

Any help will be much appreciated!