I am trying to implement a transaction in AssemblyScript. After checking thanks project I created same things in my project which can be found in here
I can call my methods and use them without any problem. After calling donating function, I can use it without problem. But if I try to use it again, then everyhing crashes.
➜ near-events git:(main) ✗ near call $CONTRACT donate '{"id":188421397,"amount":"10000"}' --accountId fatihkoc.testnet
Scheduling a call: dev-1649858201986-17302397803355.donate({"id":188421397,"amount":"10000"})
Doing account.functionCall()
Receipt: 9m9munDuPd9UZTujz5mPARhdHetWLTvp15H9QPiMgj6H
Log [dev-1649858201986-17302397803355]: transfer complete
Transaction Id 4HY7LkKBo1hvh3NYuZGvExgX1GKxP2WAJXmCKTrStxLs
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/4HY7LkKBo1hvh3NYuZGvExgX1GKxP2WAJXmCKTrStxLs
''
Transaction complete as you can see. Let's call it again.
➜ near-events git:(main) ✗ near call $CONTRACT donate '{"id":188421397,"amount":"10000"}' --accountId fatihkoc.testnet
Scheduling a call: dev-1649858201986-17302397803355.donate({"id":188421397,"amount":"10000"})
Doing account.functionCall()
Receipt: 6ZwkY4sktY3gBey7WTCdBWKwXHN3CGTXGqRGq6oGdM5u
Log [dev-1649858201986-17302397803355]: ABORT: Cannot parse JSON, filename: "~lib/assemblyscript-json/decoder.ts" line: 144 col: 5
Failure [dev-1649858201986-17302397803355]: Error: {"index":0,"kind":{"ExecutionError":"Smart contract panicked: Cannot parse JSON, filename: \"~lib/assemblyscript-json/decoder.ts\" line: 144 col: 5"}}
ServerTransactionError: {"index":0,"kind":{"ExecutionError":"Smart contract panicked: Cannot parse JSON, filename: \"~lib/assemblyscript-json/decoder.ts\" line: 144 col: 5"}}
at Object.parseResultError (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/utils/rpc_errors.js:31:29)
at Account.signAndSendTransactionV2 (/usr/local/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:160:36)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async scheduleFunctionCall (/usr/local/lib/node_modules/near-cli/commands/call.js:57:38)
at async Object.handler (/usr/local/lib/node_modules/near-cli/utils/exit-on-error.js:52:9) {
type: 'FunctionCallError',
context: undefined,
index: 0,
kind: {
ExecutionError: 'Smart contract panicked: Cannot parse JSON, filename: "~lib/assemblyscript-json/decoder.ts" line: 144 col: 5'
},
transaction_outcome: {
block_hash: 'C6t8LPWsYeoqq7tyJMSuZQQsAHbDDCUFbMfzHmMxb6ow',
id: '99SbDYZM1fp7JC9T1ZMGoNQVRVqWK9nx8tnXftp3K8m3',
outcome: {
executor_id: 'fatihkoc.testnet',
gas_burnt: 2428008201426,
logs: [],
metadata: [Object],
receipt_ids: [Array],
status: [Object],
tokens_burnt: '242800820142600000000'
},
proof: []
}
}
This error keeps coming with other functions too. It basically crashed the smart contract. How can I fix this problem? Why this is happening with smart contract? Any ideas about implementing transaction?