I’m using the Fireblocks Java SDK (version 10.4.0), I’m having trouble executing write functions where the input is an array type (uint256[]
) using the writeCallFunction API. For example, i have a simple contract with this solidity code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract NumberStorage {
uint256 private numberSingle;
uint256[] private numberList;
constructor() {
numberSingle = 42;
numberList = [1, 2, 3, 4, 5];
}
function getNumberSingle() public view returns (uint256) {
return numberSingle;
}
function setNumberSingle(uint256 _newNumber) public {
numberSingle = _newNumber;
}
function getNumberList() public view returns (uint256[] memory) {
return numberList;
}
function setNumberList(uint256[] memory _newList) public {
numberList = _newList;
}
}
To execute the setNumberList function, i construct the WriteAbiFunction object like this:
class WriteAbiFunction {
stateMutability: nonpayable
outputs: null
type: function
name: setNumberList
inputs: [class ParameterWithValue {
name: _newList
description: null
internalType: null
type: uint256[]
components: null
value: [1,2,3,4,5]
functionValue: null
}]
description: null
}
I set the value of the ParameterWithValue to “[1,2,3,4,5]”, since in the ParameterWithValue class the value
is provided as String type:
However, the writeCallFunction api call always return with server error.
Exception in thread "main" java.util.concurrent.CompletionException: com.fireblocks.sdk.ApiException: writeCallFunction call failed with: 500 - {"error":"Internal Server Error","statusCode":500}
at java.base/java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:368)
at java.base/java.util.concurrent.CompletableFuture.completeRelay(CompletableFuture.java:377)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1152)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
at java.base/java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:387)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java)
I tried a lot of diffirent formats of the input value (like [“1”, “2”, “3”, “4”, “5”] or “1, 2, 3, 4, 5”,…) but none of them work.
Given this, is there any way to successfully execute a write function with array input type (uint256[]
) using the writeCallFunction
API in the Fireblocks SDK? (I cannot use createTransaction API because of the client’s requirement)
I hope to get your support on this, thank you very much!