Skip to content

fix(wasm-sdk): correct generated TypeScript symbols and voting pagination docs #4190

Description

@thephez

Summary

The TypeScript declarations generated by packages/wasm-sdk contain three documentation/type-name inconsistencies. These propagate into downstream generated API references, including the Evo SDK website using @dashevo/wasm-sdk@4.0.0.

Issues

1. ResourceVoteChoice usage uses the wrong method casing

Source: packages/wasm-sdk/src/state_transitions/identity.rs

The JSDoc recommends:

ResourceVoteChoice.towardsIdentity()
ResourceVoteChoice.abstain()
ResourceVoteChoice.lock()

The generated class actually exports:

ResourceVoteChoice.TowardsIdentity()
ResourceVoteChoice.Abstain()
ResourceVoteChoice.Lock()

Update the JSDoc to use the exported method names.

2. Voting pagination documentation contradicts the inclusive default

Source: packages/wasm-sdk/src/queries/voting/votes.rs

startAtVoteId is described as "exclusive by default," while startAtIncluded documents @default true. The implementation confirms the inclusive default:

Some((identifier.to_buffer(), start_at_included.unwrap_or(true)))

Update the startAtVoteId prose and related pagination JSDoc to consistently describe the inclusive default behavior. The analogous voting query implementations in state.rs and voters.rs also use unwrap_or(true) and should remain consistent.

3. Address withdrawal options reference a non-exported Pooling symbol

Source: packages/wasm-sdk/src/state_transitions/addresses.rs

AddressFundsWithdrawOptions currently documents and declares:

Pooling.Never
Pooling.IfAvailable
Pooling.Standard
pooling: Pooling

The generated package exports PoolingWasm, not Pooling. Update the examples and property type to consistently use the actual exported symbol:

PoolingWasm.Never
PoolingWasm.IfAvailable
PoolingWasm.Standard
pooling: PoolingWasm

Downstream impact

The Evo SDK website generates its type reference directly from the published declarations. It currently needs a local Pooling -> PoolingWasm resolution alias so documentation generation does not fail, which produces a mismatched Pooling heading containing an export enum PoolingWasm declaration.

Acceptance criteria

  • Generated declarations recommend ResourceVoteChoice.TowardsIdentity, .Abstain, and .Lock.
  • Voting pagination prose and @default annotations consistently describe the inclusive default implemented by unwrap_or(true).
  • Address withdrawal declarations and examples consistently use an exported pooling symbol.
  • Regenerated TypeScript declarations contain no references to the nonexistent Pooling type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions