token-contract icon indicating copy to clipboard operation
token-contract copied to clipboard

minterController.ts: api.getContractState is not a function

Open zapletnev opened this issue 1 year ago • 4 comments

  1. Clone the repo
  2. npm install
  3. npx blueprint run -> minterController
  4. The file couldn't be compiled with the error:

TypeError: api.getContractState is not a function

The same problem in the ui-utils.ts file.

zapletnev avatar Jan 18 '24 11:01 zapletnev

Same problem ! Any solution for this error ?

phamthanhphuocloc1995 avatar Jun 11 '24 16:06 phamthanhphuocloc1995

Same problem! Any solution for this type error?

veebull avatar Jul 11 '24 16:07 veebull

looks like this repo is died

cemeheeb avatar Aug 13 '24 17:08 cemeheeb

i guess i found solution

  1. force cast TonClient | TonClient4 to TonClient4
  2. get seqno of latest block const seqno = (await api.getLastBlock()).last.seqno;
  3. use TonClient4 instance to obtain contract state const contractState = (await api.getAccount(seqno, minterAddress)).account.state;

getting cell from contract state code: const stateCode = Cell.fromBase64(contractState.code!);

cemeheeb avatar Aug 13 '24 17:08 cemeheeb