페이지에서 NFT를 민팅하는 부분을 제작하고 있습니다.
현재 바오밥 테스트넷에서 테스트하고 있는데
카이카스 결제창을 열어서 승인하는 것까지는 성공을 했습니다.
아래 링크는 실패한 트랜잭션입니다.
저는 아무래도 디버깅하느라 새벽까지 못 잘 것 같습니다 ㅜㅜ
밑에는 execution reverted 트랜잭션인데
“status”: false가 되는 게 마음에 걸립니다 ㅜㅜ
Uncaught (in promise) Error: evm: execution reverted
{
“blockHash”: “0xa410bb67ef6851e97f7b08c3d132e240ce6421cd8d65dd7a752f4e2f72ebc3c3”,
“blockNumber”: 86039043,
“contractAddress”: null,
“from”: “0x4d4a42a16e5d025b48a6a7bc989f36fcdebddd7d”,
“gas”: “0x1e8480”,
“gasPrice”: “0xae9f7bcc00”,
“gasUsed”: 30390,
“input”: “0x2db115440000000000000000000000000000000000000000000000000000000000000001”,
“logs”: [],
“logsBloom”: “0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000”,
“nonce”: “0xa”,
“senderTxHash”: “0x49dfbdd2da39ca3f090712972ce88d3cd05ee1f894b0a2467c67d9f883161b75”,
“signatures”: [
{
“V”: “0x7f6”,
“R”: “0x708cbe195da9daa5794aeeddf25669ec9d27da8886277fb27e961e9abab54b9e”,
“S”: “0x41224fd9c490d896d50718742020f5d9ba0573aade4de2e513fd2541128c8ea4”
}
],
“status”: false,
“to”: “0x630ebb044c3baf105dd04df825c371629fd42f11”,
“transactionHash”: “0x49dfbdd2da39ca3f090712972ce88d3cd05ee1f894b0a2467c67d9f883161b75”,
“transactionIndex”: 0,
“txError”: “0x9”,
“type”: “TxTypeSmartContractExecution”,
“typeInt”: 48,
“value”: “0xde0b6b3a7640000”
}
아래는 구글 크롬으로 디버깅하고 있는데 나온 에러 사항입니다.
솔직히, 도저히 갈피를 못 잡겠습니다.
at checkForNormalTx (index.js:770:1)
at index.js:646:1
// Unhappy case: trasaction has error. A.K.A 'bad receipt'.
if (!receipt) return
const receiptJSON = JSON.stringify(receipt, null, 2)
const { txError } = receipt
if (txError && errors.txErrorTable[txError]) {
utils._fireError( -----> at checkForNormalTx (index.js:770:1)
new Error(`${errors.txErrorTable[txError]}\n ${receiptJSON}`),
mutableConfirmationPack.defer.eventEmitter,
mutableConfirmationPack.defer.reject
)
} else if (receipt.status === false || receipt.status === '0x0') {
utils._fireError(
errors.transactionReverted(receiptJSON),
mutableConfirmationPack.defer.eventEmitter,
mutableConfirmationPack.defer.reject
)
// if we have a valid receipt we don't need to send a request
return (
((existingReceipt && utils.promiEvent.resolve(existingReceipt)) || _klaytnCall.getTransactionReceipt(result))
// if CONFIRMATION listener exists check for confirmations, by setting canUnsubscribe = false
.then(receipt => {
checkIsReceiptInBlock(receipt)
const formattedReceipt = formatReceipt(receipt, method)
if (mutableConfirmationPack.promiseResolved) return
return isContractDeployment -----> index.js:646:1
? checkForContractDeployment(mutableConfirmationPack, formattedReceipt, sub)
: checkForNormalTx(mutableConfirmationPack, formattedReceipt, sub)
})
.catch(countTimeout)
)
아래는 자바스크립트 소스 입니다.
var oneKlayToPeb = cav.utils.toPeb(config.OneKLAYMintForStarting_Price, 'KLAY');
console.log("oneKlayToPeb : ", oneKlayToPeb);
const CONTRACT_ADDR = config.contract_addr;
const caverForSend = new Caver(window.klaytn);
const conForSend = new caverForSend.klay.Contract(config.abi, CONTRACT_ADDR);
console.log("conForSend : ", conForSend);
const inputDataForSend = await conForSend.methods.publicMint(1).encodeABI();
console.log("inputDataForSend : ", inputDataForSend);
const result = await caverForSend.klay.sendTransaction(
{
type: 'SMART_CONTRACT_EXECUTION',
from: account,
to: CONTRACT_ADDR,
data: inputDataForSend,
gas: '2000000',
value: oneKlayToPeb,
})
.on('transactionHash', (txHash) => {
console.log(`
Sending a transaction... (Call contract's function 'publicMint')
txHash: ${txHash}
`);
})
.on('receipt', (receipt) => {
// success
console.log(`
receipt: ${receipt}
`);
})
.on('error', (e) => {
// failed
console.log(`
error: ${e}
`);
alert(e.message);
});
긴 글 읽어주셔서 감사합니다.
어떤 문제인지 아시는 분은 부디 답글을 주셨으면 좋겠습니다.
간곡히 부탁드리겠습니다.
감사합니다.