-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
The ParameterWithValue.value field is typed as String, offering no obvious way to pass an array.
If the array is serialized as JSON string it is serialized again, causing it to be double escaped. This causes 500 errors when calling contract functions with array parameters.
Environment
- Fireblocks Java SDK version: 13.0.0.
- Java: 21
Reproduction
// Kotlin
val addresses = listOf("0x2838a9dcc507c5ea4f07ca68a15ec53d1e5911a0", "0x07c5fb2c857fca6b53856c6e30556a865858d167")
val dto = WriteCallFunctionDto(
vaultAccountId,
WriteCallFunctionDtoAbiFunction(
WriteAbiFunction(
WriteAbiFunction.StateMutabilityEnum.NONPAYABLE,
WriteAbiFunction.TypeEnum.FUNCTION,
listOf(
ParameterWithValue("accounts", "address[]").apply {
value = objectMapper.writeValueAsString(addresses)
},
),
).apply {
name = "batchAddBlacklist"
outputs = listOf()
},
),
)
client.contractInteractions().writeCallFunction(dto, contractAddress, assetId, idempotencyKey)Actual Behavior
The value field is serialized as an escaped JSON string:
{
"inputs": [{
"name": "accounts",
"type": "address[]",
"value": "[\"0xabc...\",\"0xdef...\"]"
}]
}Expected Behavior
The value field should be a native JSON array:
{
"inputs": [{
"name": "accounts",
"type": "address[]",
"value": ["0xabc...", "0xdef..."]
}]
}Root Cause
ParameterWithValue.value is typed as String, forcing array values to be double-serialized.
Solution
Change ParameterWithValue.value from String to Object to support both primitive values and complex types (arrays, objects).
Workaround
Raw HTTP requests with manually constructed JSON work correctly, but that is sidestepping the whole SDK.
Metadata
Metadata
Assignees
Labels
No labels