스마트컨트랙트 토큰을 전송하려는데 You must provide the json interface of the contract when instantiating a contract object

You must provide the json interface of the contract when instantiating a contract object

const ceik_contract_abi = require("../app/abi/ceikABI.json");
const ceik_tokenAddress = "0x18814b01b5cc76f7043e10fd268cc4364df47da0";  // ceik
const TokenInstance = new caver.klay.Contract(ceik_contract_abi, ceik_tokenAddress);
TokenInstance.methods.transfer(txt_to_address, txt_to_amt)
.send({from: txt_my_addr})
.on('transactionHash', (hash) => { console.log("### transactionHash ###"); console.log(hash);})
.once('receipt', (receipt) => {
  console.log("blockNumber " + receipt.blockNumber + " / contractAddress" + receipt.contractAddress + " / blockHash" + receipt.blockHash + " / transactionHash" + receipt.transactionHash);
  save_db_sendlog_ceik_end(tidx ,receipt.blockNumber, receipt.contractAddress, receipt.blockHash, receipt.transactionHash ,'Y');
})
// .on('confirmation', (confirmationNumber, receipt) => { console.log("### confirmation ###" + confirmationNumber);})
.on('error', console.error);

스마트컨트랙트 토큰을 전송하려는데
You must provide the json interface of the contract when instantiating a contract object
이런 오류가 납니다.

잘 모르겠어서 문의 드립니다.

json 파일 이슈가있었나봅니다.

에서 복사해서 변경 하니 해당 이슈는 넘어갔습니다.
Error: “gas” is missing
가스 에러가 나는데 일단 처리해보겠습니다.

감사합니다.

TokenInstance.methods.transfer(…).send(…).on is not a function

web3 에선 이렇게 하니 되었는데 caver 에선 안되는 군요 . . .

caver.klay.sendTransaction({
  type: 'SMART_CONTRACT_EXECUTION',
  from: txt_my_addr,
  to: txt_to_address,
  value: (caver.utils.toPeb(txt_to_amt, 'KLAY') *0.0000000001),
  data: ceik_tokenAddress,
  gas: 100000
}).
//on('confirmation', function(confNumber, receipt, latestBlockHash){ console.log('CONFIRMED'); })
once('sent', function(payload){ console.log('sendTrCEIK'); })
.then(function(receipt){
  save_db_sendlog_ceik_end(tidx ,receipt.blockNumber, receipt.contractAddress, receipt.blockHash, receipt.transactionHash ,'Y');
});

이렇게 하니 된듯 한데 소수점 18자리가 아니라서 . . . 이 부분 내일 조금 더 보겠습니다.

안녕하세요
confirmation은 caver-js 에서 제공되지 않습니다.
또한 eventEmitter는 receipt, transactionHash, error에 대해서만 지원됩니다.

1개의 좋아요

안녕하세요

smart contract 로 토큰을 전송하는 샘플이 있으면 공유 부탁 드립니다.
data : 0x9166c8d72e513a9e3b8389c11481ec071da93e37370fc62bf99c51a7b869a7dd

이렇게 넣어도 결과에 smart contract null 로 나와서요 . . .

에러 내용이 에이비 아이가 문제 있는듯한데 그쪽 확인해보심이 어떨가요

감사합니다. 해당 부분은 제가 다른 abi 를 넣어서 나는 에러였었습니다 (__)

잘 되는데 로그에 contract address 만 안 나오는 거였습니다.

감사합니다.