Hello,
I have a contract function with the ABI below:
{
"inputs": [
{
"internalType": "uint256",
"name": "numberOfTokens",
"type": "uint256"
},
{
"internalType": "enum SalientYachtsSYONE_v02.NFTType",
"name": "nftType",
"type": "uint8"
},
{
"internalType": "string",
"name": "affiliateId",
"type": "string"
}
],
"name": "buyYachtNFT",
"outputs": [],
"stateMutability": "payable",
"type": "function"
}
The affiliateId parameter is supposed to be optional. However, I am having an issue where if I pass a value for affiliateId, the transaction is executed (connecting with MetaMask). However, if I pass an empty string for affiliateId, I get the error below:
‘affiliateId is required’
I am not sure where that error is coming from and would like to be able to pass an empty string to the method above. How can I do that? Thanks!
The stack trace is below:
App.jsx:149 ----> noOfNfts = 1
App.jsx:150 ----> nftTxnAmount = 100000000000000000
App.jsx:151 ----> affiliateId =
App.jsx:162 Uncaught (in promise) ['affiliateId is required']0: "affiliateId is required"length: 1[[Prototype]]: Array(0)
onClick @ App.jsx:162
await in onClick (async)
handleClick @ button.js:201
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:4070
executeDispatch @ react-dom.development.js:8243
processDispatchQueueItemsInOrder @ react-dom.development.js:8275
processDispatchQueue @ react-dom.development.js:8288
dispatchEventsForPlugins @ react-dom.development.js:8299
(anonymous) @ react-dom.development.js:8508
batchedEventUpdates$1 @ react-dom.development.js:22396
batchedEventUpdates @ react-dom.development.js:3745
dispatchEventForPluginEventSystem @ react-dom.development.js:8507
attemptToDispatchEvent @ react-dom.development.js:6005
dispatchEvent @ react-dom.development.js:5924
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
discreteUpdates$1 @ react-dom.development.js:22413
discreteUpdates @ react-dom.development.js:3756
dispatchDiscreteEvent @ react-dom.development.js:5889