Skip to content

feat: upgrade to evo-sdk v3.1.0-dev.1 with typed API migration - #14

Merged
PastaPastaPasta merged 3 commits into
dashpay:mainfrom
thephez:feat/sdk-upgrade-v3.1
Feb 20, 2026
Merged

PastaPastaPasta merged 3 commits into
dashpay:mainfrom
thephez:feat/sdk-upgrade-v3.1

Conversation

@thephez

@thephez thephez commented Feb 19, 2026 •

Copy link
Copy Markdown
Contributor

Upgrade to evo-sdk v3.1.0-dev.1

Migrates all Dash Platform operations to the @dashevo/evo-sdk v3.1 API surface. The new SDK version introduces typed constructors and changes how asset lock proofs, identity keys, and state transitions are built, requiring updates across the identity, DPNS, and proof modules.

Highlights

  • Upgrade @dashevo/evo-sdk from 3.0.0-dev.9 to 3.1.0-dev.1 with regenerated lockfile
  • Replace hex-encoded JSON proof format with raw Uint8Array components via AssetLockProof.createInstantAssetLockProof(), introducing a new AssetLockProofData type
  • Switch to typed SDK constructors (Identity, IdentityPublicKey, IdentityPublicKeyInCreation, IdentitySigner, PrivateKey) instead of passing loosely-typed JSON strings
  • Update identity creation, top-up, and update flows to fetch identity objects first and pass them directly to SDK methods
  • Adapt to renamed SDK fields: key.publicKeyData → key.data, key.disabled → key.disabledAt, onPreorder → preorderCallback
  • Fix identity update bug: pass new keys' private WIFs to the IdentitySigner so the SDK can sign transitions for all involved keys

Files Changed

  • src/platform/identity.ts — Rewrite create/topUp/update to use typed SDK API
  • src/platform/dpns.ts — Adapt DPNS registration and key queries to new SDK
  • src/proof/builder.ts — Simplify to return raw proof components instead of hex-encoded JSON
  • src/types.ts — Add AssetLockProofData interface, update BridgeState
  • src/ui/state.ts — Update proof type in state transitions
  • src/main.ts — Pass privateKeyWif through for identity key updates

Testing

Tested locally

Co-Authored-By: Claude Opus 4.6 [email protected]

Summary by CodeRabbit

  • Chores

    • Updated evo-sdk dependency to version 3.1.0-dev.1 for latest compatibility
  • Refactor

    • Enhanced identity registration and top-up processes with improved data handling
    • Strengthened key management with better support for generated keys
    • Upgraded asset lock proof handling for more robust and type-safe operations

thephez and others added 3 commits February 19, 2026 16:08
Regenerate lock file to remove stale entries from previously removed
dependencies.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Migrate all platform operations to the v3.1 SDK API:

- Use AssetLockProof.createInstantAssetLockProof() with raw Uint8Array
  components instead of hex-encoded JSON via fromHex()
- Switch to typed constructors (Identity, IdentityPublicKey,
  IdentityPublicKeyInCreation, IdentitySigner, PlatformAddressSigner)
- Replace key.publicKeyData with key.data, key.disabled with
  key.disabledAt, onPreorder with preorderCallback
- Use identity.publicKeys property instead of getPublicKeys() method
- Fetch identity before topUp/update/DPNS operations
- Add AssetLockProofData type to replace hex proof strings
- Pass fundFromAssetLock outputs as plain objects for WASM serde
  compatibility with reduceOutput fee strategy

Co-Authored-By: Claude Opus 4.6 <[email protected]>
The SDK requires private keys for all keys involved in a state
transition, not just the signing key. Generated keys' WIFs were
available but never passed through to the IdentitySigner.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@coderabbitai

coderabbitai Bot commented Feb 19, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR migrates the codebase to support @dashevo/evo-sdk v3.1, introducing a structured AssetLockProofData type to replace string-encoded asset lock proofs and integrating new SDK components like IdentitySigner throughout identity and DPNS management workflows.

Changes

Cohort / File(s) Summary
Dependency Update
package.json
Updates @dashevo/evo-sdk from 3.0.0-dev.9 to 3.1.0-dev.1.
Type System Changes
src/types.ts
Introduces new AssetLockProofData interface with transactionBytes, instantLockBytes, and outputIndex fields; updates BridgeState.assetLockProof from string to AssetLockProofData type.
Proof Builder Refactoring
src/proof/builder.ts, src/proof/index.ts
Replaces InstantAssetLockProof interface and string-based encoding with structured AssetLockProofData return type; removes base64Encode, decodeAssetLockProof helpers and public exports; narrows module exports.
Identity Management Overhaul
src/platform/identity.ts
Transitions to strongly-typed AssetLockProofData for creation and top-up; introduces hexToBytes and base64ToBytes converters; switches to trusted API modes; implements full identity setup using AssetLockProof, Identity, IdentityPublicKey, IdentitySigner, and PrivateKey from SDK; updates function signatures for registerIdentity and topUpIdentity; enhances identity update flow with key conversion and per-key data handling.
DPNS Registration Updates
src/platform/dpns.ts
Adds IdentitySigner import; migrates getIdentityPublicKeys to use new data field and disabledAt logic; refactors registerDpnsName to fetch identity, retrieve identity key, construct IdentitySigner, and pass new parameters to registration call.
Configuration and State Updates
src/main.ts, src/ui/state.ts
Adds privateKeyWif field to AddKeyConfig for generated keys; updates setInstantLockReceived signature to accept AssetLockProofData instead of string.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Poem

🐰✨ Hoppity-hop, the SDK's been refactored fresh!
String-locked proofs now structured, no longer a mesh,
Signers hop in, identities dance with new grace,
From hex to bytes, we've quickened the pace!
Trust us—this version, it's tested with care! 🚀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the PR—upgrading to evo-sdk v3.1.0-dev.1 and migrating to a typed API. It is specific, concise, and clearly summarizes the primary changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/platform/identity.ts (1)

258-272: ⚠️ Potential issue | 🔴 Critical

topUp() returns a boolean, not a balance—Number(result) will be 0 or 1, not the actual identity balance.

The identities.topUp() method in evo-sdk returns a boolean success indicator, not the updated balance. The current code converts this boolean to a number (yielding 0 or 1), which misrepresents the identity's actual balance to callers. The function signature promises to return balance?: number, but cannot fulfill this from topUp() alone.

Either fetch the updated balance separately after the top-up succeeds, or remove balance from the return type and only return the success flag.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/platform/identity.ts` around lines 258 - 272, The code treats
sdk.identities.topUp(...) as returning a balance but it actually returns a
boolean; change the implementation so after withRetry(() =>
sdk.identities.topUp(...), retryOptions) succeeds you either (a) call the SDK's
balance-fetching method (e.g., sdk.identities.getBalance(identity) or the
appropriate method in your SDK) to obtain and return the numeric balance in the
returned object, or (b) if no balance API exists, remove the balance field from
the return value and only return success: true/false; update the code around
sdk.identities.topUp, the result variable, and the function's return
type/signature accordingly.
🧹 Nitpick comments (1)
src/platform/identity.ts (1)

18-41: Remove duplicate utility functions and import from established modules.

The functions hash160 and hexToBytes are already exported from src/crypto/hash.ts and src/utils/hex.ts respectively. Remove the local implementations and import them instead to eliminate duplication.

♻️ Proposed fix — import existing utilities
-import { sha256 } from '@noble/hashes/sha256';
-import { ripemd160 } from '@noble/hashes/ripemd160';
-import type { PublicKeyInfo, IdentityKeyConfig, AssetLockProofData } from '../types.js';
+import type { PublicKeyInfo, IdentityKeyConfig, AssetLockProofData } from '../types.js';
+import { hash160 } from '../crypto/hash.js';
+import { hexToBytes } from '../utils/hex.js';
 import { withRetry, type RetryOptions } from '../utils/retry.js';
-
-/**
- * Compute hash160 (RIPEMD160(SHA256(data))) of a buffer
- */
-function hash160(data: Uint8Array): Uint8Array {
-  return ripemd160(sha256(data));
-}
-
-function hexToBytes(hex: string): Uint8Array {
-  if (!hex || hex.length % 2 !== 0) {
-    throw new Error('Invalid hex string');
-  }
-  const bytes = new Uint8Array(hex.length / 2);
-  for (let i = 0; i < bytes.length; i++) {
-    bytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
-  }
-  return bytes;
-}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/platform/identity.ts` around lines 18 - 41, Remove the local
implementations of hash160 and hexToBytes and import them from the project's
shared utilities instead: delete the functions named hash160 and hexToBytes in
this file, add imports for hash160 (from the crypto/hash module) and hexToBytes
(from the utils/hex module) at the top of the file, and keep base64ToBytes as-is
if no existing utility replaces it; update any local references in this file to
use the imported symbols.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/platform/identity.ts`:
- Around line 258-272: The code treats sdk.identities.topUp(...) as returning a
balance but it actually returns a boolean; change the implementation so after
withRetry(() => sdk.identities.topUp(...), retryOptions) succeeds you either (a)
call the SDK's balance-fetching method (e.g.,
sdk.identities.getBalance(identity) or the appropriate method in your SDK) to
obtain and return the numeric balance in the returned object, or (b) if no
balance API exists, remove the balance field from the return value and only
return success: true/false; update the code around sdk.identities.topUp, the
result variable, and the function's return type/signature accordingly.

---

Nitpick comments:
In `@src/platform/identity.ts`:
- Around line 18-41: Remove the local implementations of hash160 and hexToBytes
and import them from the project's shared utilities instead: delete the
functions named hash160 and hexToBytes in this file, add imports for hash160
(from the crypto/hash module) and hexToBytes (from the utils/hex module) at the
top of the file, and keep base64ToBytes as-is if no existing utility replaces
it; update any local references in this file to use the imported symbols.

@PastaPastaPasta
PastaPastaPasta merged commit 70b35f0 into dashpay:main Feb 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants