Solidity
使用對像數組對參數進行錯誤編碼
嗨,我正在嘗試傳遞一組對象-
[ { "tokenId": "6719509505", "merkleProof": ["0x3dd7537d9d901bc746ff8bfcf0315067c981c161693dc3c75267d83ec0d688d2", "0xcf0fd76a410d5c3d4b7a983e5da832494b991497ff5b9d68491c7cf99254c905", "0x32f9484ca0223b15dd93dc5c833d022ed854a21d1e69a8235787094f696ebb1b"] }, { "tokenId": "6231137281", "merkleProof": ["0x77319cc263c886aa6fa366c5182cb765a6bb587d4d5758e53e471305a06b0b35", "0xcf0fd76a410d5c3d4b7a983e5da832494b991497ff5b9d68491c7cf99254c905", "0x32f9484ca0223b15dd93dc5c833d022ed854a21d1e69a8235787094f696ebb1b"] }, { "tokenId": "6231137285", "merkleProof": ["0xc1178a9fc48c60b6504ffe104f028f8b3fae85d75353ad61c419cb8390ab7e7b", "0x0c88393d69e0dc6038f666403e26286b19cffbb7e44d0ead07494afea017ecc7", "0x3f1ae32d2fc63976e18bda6a0d7c6458f34d82c14224024732428400299e25d1"] } ]
到我在 Remix 中的功能-
function mint(Proof[] memory proofs) public {
但我收到了這個錯誤 -
transact to merkle.mint errored: Error encoding arguments: Error: cannot encode object for signature with missing names (argument="values", coder={"name":"uint256","type":"uint256","localName":null,"dynamic":false,"size":32,"signed":false}, value={"tokenId":"6719509505","merkleProof":["0x3dd7537d9d901bc746ff8bfcf0315067c981c161693dc3c75267d83ec0d688d2","0xcf0fd76a410d5c3d4b7a983e5da832494b991497ff5b9d68491c7cf99254c905","0x32f9484ca0223b15dd93dc5c833d022ed854a21d1e69a8235787094f696ebb1b"]}, code=INVALID_ARGUMENT, version=abi/5.5.0)
關於為什麼的任何想法?
弄清楚了。問題是大括號
{}
,我不需要傳遞鍵名,只需要傳遞值。