Skip to content

feat: enable Hashi hBTC on Sui mainnet - #10324

Draft
arvind-bg wants to merge 2 commits into
masterfrom
scaas-12506-hbtc-mainnet-statics-sdk-coin-sui
Draft

arvind-bg wants to merge 2 commits into
masterfrom
scaas-12506-hbtc-mainnet-statics-sdk-coin-sui

Conversation

@arvind-bg

@arvind-bg arvind-bg commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds the mainnet hBTC token to statics and makes the Hashi support in sdk-coin-sui work on mainnet as well as testnet.

statics

  • sui:hbtc ("Hashi BTC", 8 decimals, coin type 0xd30fb3f8914efdbeb7b8e85fae1d65dc584b44a1281f66737b92bb9f03a59d06::btc::BTC) with SUI_TOKEN_FEATURES
  • ofcsui:hbtc, its OFC counterpart
  • UnderlyingAsset['sui:hbtc']

sdk-coin-sui

  • A mainnet Hashi config: Hashi object 0x8d110642d9b5133bd661cda4873edf135ab6b91ff6918601015880874b950e5d, initial shared version 920727622, Bitcoin mainnet. The config is selected by network type, and getHashiConfig throws for any value that is not a network type.
  • Hashi mint and redeem calls are recognised for either the testnet or the mainnet package. A transaction built for one network is rejected when parsed on the other.

Values were checked against Sui mainnet on 2026-12-05. The package has a single version (1), so the original package ID is also the one called.

Issue Number

SCAAS-12506

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • mocha in modules/statics: 44,045 passing
  • mocha in modules/sdk-coin-sui: 345 passing
  • npx eslint on the changed files: no errors
  • tsc --noEmit in modules/sdk-coin-sui: clean
  • The tests that expected Hashi to throw on mainnet now cover mainnet instead. New tests cover the mainnet config, deposit and redeem addresses, mint and redeem build and rebuild, package classification, and cross-network rejection.

Register the Hashi BTC token on Sui mainnet and its OFC counterpart.

Ticket: SCAAS-12506
@linear-code

linear-code Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

SCAAS-12506

@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Compatibility checks are failing on Node.js 27-nightly (experimental, non-blocking). This does not block merge, but it signals an incompatibility to fix before this release becomes supported.

View run

@arvind-bg
arvind-bg force-pushed the scaas-12506-hbtc-mainnet-statics-sdk-coin-sui branch from c06d92a to 5245166 Compare December 5, 2026 11:36
@arvind-bg

Copy link
Copy Markdown
Contributor Author

@claude review this pr

@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @arvind-bg's task in 20s —— View job


Review of #10324: enable Hashi hBTC on Sui mainnet

  • Read the diff for statics and sdk-coin-sui
  • Check the statics registration against existing Sui tokens
  • Post the review

Verdict: Looks good. I found no blocking issues. I read the diff but did not run tests or check the on-chain values.

What I checked

  • Statics: sui:hbtc, ofcsui:hbtc and UnderlyingAsset['sui:hbtc'] are registered the same way as sui:xaum. sui:xaum appears only in allCoinsAndTokens.ts, base.ts and ofcCoins.ts, so no other file needs an entry. The coin type string matches packageId::module::symbol.
  • Config refactor: buildConfig removes the duplicated testnet literal. Both configs are lazily built and frozen, so loading the SDK does not depend on the statics version. The clock object now reuses SUI_CLOCK_OBJECT_ID.
  • Network selection: getHashiConfig(networkType) returns the mainnet config for MAINNET and the testnet config otherwise. This is a safe default. Taking NetworkType instead of the whole coin config makes the function easier to call and test.
  • Cross-network safety: getHashiTransactionType in utils.ts recognises both packages. assertCanonical in hashiTransaction.ts then compares the call package against the config for the coin's own network. A mainnet transaction parsed as testnet, or the reverse, is therefore rejected, and the PR adds tests for this.
  • Object identity: assertHashiObjectIdentity now pins the object ID from the network-specific config, so a testnet object cannot be used to build a mainnet transaction.

Minor suggestions (non-blocking)

  1. getHashiConfig sends every non-mainnet network type to the testnet config. That is fine today because only testnet and mainnet exist for Sui. An explicit TESTNET branch that throws for anything else would keep the old fail-closed behaviour if another network type is ever added.
  2. HashiBitcoinNetwork moved from bitcoin.ts to config.ts. It is no longer exported from bitcoin.ts, and hashi/index.ts does not re-export it. Nothing in the repo uses it, but any external consumer that imported it would break. Re-exporting the type from index.ts is cheap.
  3. The hard-coded mainnet values (object ID 0x8d11…0e5d, initial shared version 920727622) are only checked against mainnet by the description's claim. A short comment on where the values came from, such as the explorer link or the date checked, would help the next reader.
  4. The Node.js 27-nightly CI failure is marked experimental and non-blocking. It looks unrelated to this change.

@claude claude 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.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

@arvind-bg
arvind-bg force-pushed the scaas-12506-hbtc-mainnet-statics-sdk-coin-sui branch 2 times, most recently from dc7fdad to 79934b9 Compare December 5, 2026 12:09
@arvind-bg
arvind-bg marked this pull request as ready for review December 5, 2026 12:58
@arvind-bg
arvind-bg requested a review from a team as a code owner December 5, 2026 12:58

@claude claude 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.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

Add the mainnet Hashi config and select it by network instead of
rejecting non-testnet coins. Classify Hashi calls to either the
testnet or mainnet package; a transaction built for one network is
still rejected when parsed on the other.

Ticket: SCAAS-12506
@arvind-bg
arvind-bg force-pushed the scaas-12506-hbtc-mainnet-statics-sdk-coin-sui branch from 79934b9 to 587a75a Compare December 5, 2026 13:30
@arvind-bg
arvind-bg marked this pull request as draft December 5, 2026 13:44

This branch has not been deployed

No deployments
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.

1 participant