Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue while passing f64 value to the function #535

Open
Dimple-Kanwar opened this issue May 10, 2021 · 2 comments
Open

issue while passing f64 value to the function #535

Dimple-Kanwar opened this issue May 10, 2021 · 2 comments

Comments

@Dimple-Kanwar
Copy link

Dimple-Kanwar commented May 10, 2021

Hi,

I am passing one parameter in f64 type. but when i call that function with float value, i am getting one exception: "ExecutionError":"Smart contract panicked: Value with Key: parameter with type f64 is not a Float.

`ServerTransactionError: {"index":0,"kind":{"ExecutionError":"Smart contract panicked: Value with Key: deposit with type f64 is not a Float, filename: "~lib/near-sdk-bindgen/index.ts" line: 249 col: 5"}}
at Object.parseResultError (/home/phinelipy/.config/versions/node/v12.14.1/lib/node_modules/near-cli/node_modules/near-api-js/lib/utils/rpc_errors.js:48:29)
at Account.signAndSendTransaction (/home/phinelipy/.config/versions/node/v12.14.1/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:129:36)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async scheduleFunctionCall (/home/phinelipy/.config/versions/node/v12.14.1/lib/node_modules/near-cli/commands/call.js:44:34)
at async Object.handler (/home/phinelipy/.config/versions/node/v12.14.1/lib/node_modules/near-cli/utils/exit-on-error.js:39:9) {
[stack]: 'Error: {"index":0,"kind":{"ExecutionError":"Smart contract panicked: Value with Key: deposit with type f64 is not a Float, filename: \"~lib/near-sdk-bindgen/index.ts
" line: 249 col: 5"}}\n' +
' at Object.parseResultError (/home/phinelipy/.config/versions/node/v12.14.1/lib/node_modules/near-cli/node_modules/near-api-js/lib/utils/rpc_errors.js:48:29)\n' +
' at Account.signAndSendTransaction (/home/phinelipy/.config/versions/node/v12.14.1/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:129:36)\n' +
' at processTicksAndRejections (internal/process/task_queues.js:94:5)\n' +
' at async scheduleFunctionCall (/home/phinelipy/.config/versions/node/v12.14.1/lib/node_modules/near-cli/commands/call.js:44:34)\n' +
' at async Object.handler (/home/phinelipy/.config/versions/node/v12.14.1/lib/node_modules/near-cli/utils/exit-on-error.js:39:9)',
type: 'FunctionCallError',
context: undefined,
index: 0,
kind:

{ ExecutionError: 'Smart contract panicked: Value with Key: deposit with type f64 is not a Float, filename: "~lib/near-sdk-bindgen/index.ts" line: 249 col: 5' }

,
message: '{"index":0,"kind":{"ExecutionError":"Smart contract panicked: Value with Key: deposit with type f64 is not a Float, filename: \"~lib/near-sdk-bindgen/index.ts
" line: 249 col: 5"}}',
transaction_outcome: {
proof: [ [length]: 0 ],
block_hash: 'HzCksqhVg9BZt13nVgt1Xu6RhWe47nH38dUZhHHcH1C5',
id: '8FRfRiTfXKwwMuD1sqmgENuzpRKNzQbP3ujTJPgcaCfi',
outcome: {`

@willemneal
Copy link
Contributor

What version of AS are you using? What is the final JSON sent to the contract?

My guess is that you are encoding the f64 as a string, when js already treats all numbers as f64. E.g.
{ "parameter": "64.2" } vs { "parameter": 64.2 }

@willemneal
Copy link
Contributor

@Dimple-Kanwar, Are you still having this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants