Description
Some *WithProof query methods use JsValue::UNDEFINED when there's no data to return, while others correctly use JsValue::NULL. When JsValue::UNDEFINED is used, the data property is omitted entirely from the JSON response (standard JS behavior - undefined values are not serialized).
Current behavior (inconsistent queries):
{
"metadata": { ... },
"proof": { ... }
}
Expected behavior (all queries should match this):
{
"data": null,
"metadata": { ... },
"proof": { ... }
}
Affected Methods (using JsValue::UNDEFINED - incorrect)
| File |
Line |
Method |
address.rs |
107 |
getPlatformAddressWithProof |
address.rs |
152, 202 |
getPlatformAddressesWithProof (per-address in map) |
group.rs |
945 |
getGroupMembersWithProof |
token.rs |
847 |
getTokenContractInfoWithProof |
token.rs |
893 |
getTokenPerpetualDistributionLastClaimWithProof |
system.rs |
967 |
getTotalCreditsInPlatformWithProof |
system.rs |
1004 |
getPrefundedSpecializedBalanceWithProof |
Already Correct (using JsValue::NULL)
These methods already handle this correctly and can serve as reference:
identity.rs:354 - getIdentityWithProof
identity.rs:594 - getIdentityNonceWithProof
identity.rs:667 - getIdentityContractNonceWithProof
identity.rs:1041 - getIdentityBalanceWithProof
identity.rs:1089 - getIdentitiesBalancesWithProof
identity.rs:1126 - getIdentityBalanceAndRevisionWithProof
identity.rs:1168 - getIdentityByPublicKeyHashWithProof
document.rs:348, 383 - document queries
token.rs:659 - getTokenTotalSupplyWithProof
Suggested Fix
Change .unwrap_or(JsValue::UNDEFINED) to .unwrap_or(JsValue::NULL) in the affected locations.
Example in system.rs:1004:
// Before
.unwrap_or(JsValue::UNDEFINED)
// After
.unwrap_or(JsValue::NULL)
Impact
Consumers of the SDK cannot reliably check for "no data" vs "malformed response" when the data property is missing entirely. This was discovered via evo-sdk-website e2e tests which validate that all proof responses have { data, metadata, proof } structure.
Related to #2986
Description
Some
*WithProofquery methods useJsValue::UNDEFINEDwhen there's no data to return, while others correctly useJsValue::NULL. WhenJsValue::UNDEFINEDis used, thedataproperty is omitted entirely from the JSON response (standard JS behavior -undefinedvalues are not serialized).Current behavior (inconsistent queries):
{ "metadata": { ... }, "proof": { ... } }Expected behavior (all queries should match this):
{ "data": null, "metadata": { ... }, "proof": { ... } }Affected Methods (using JsValue::UNDEFINED - incorrect)
address.rsgetPlatformAddressWithProofaddress.rsgetPlatformAddressesWithProof(per-address in map)group.rsgetGroupMembersWithProoftoken.rsgetTokenContractInfoWithProoftoken.rsgetTokenPerpetualDistributionLastClaimWithProofsystem.rsgetTotalCreditsInPlatformWithProofsystem.rsgetPrefundedSpecializedBalanceWithProofAlready Correct (using JsValue::NULL)
These methods already handle this correctly and can serve as reference:
identity.rs:354-getIdentityWithProofidentity.rs:594-getIdentityNonceWithProofidentity.rs:667-getIdentityContractNonceWithProofidentity.rs:1041-getIdentityBalanceWithProofidentity.rs:1089-getIdentitiesBalancesWithProofidentity.rs:1126-getIdentityBalanceAndRevisionWithProofidentity.rs:1168-getIdentityByPublicKeyHashWithProofdocument.rs:348, 383- document queriestoken.rs:659-getTokenTotalSupplyWithProofSuggested Fix
Change
.unwrap_or(JsValue::UNDEFINED)to.unwrap_or(JsValue::NULL)in the affected locations.Example in
system.rs:1004:Impact
Consumers of the SDK cannot reliably check for "no data" vs "malformed response" when the
dataproperty is missing entirely. This was discovered via evo-sdk-website e2e tests which validate that all proof responses have{ data, metadata, proof }structure.Related to #2986