Skip to content

feat: target to rgb-lib 0.3.0-beta.5 - #1

Open
shashank-shinde wants to merge 1 commit into
mainfrom
feat/rgb-lib-0.3.0-beta.5
Open

feat: target to rgb-lib 0.3.0-beta.5#1
shashank-shinde wants to merge 1 commit into
mainfrom
feat/rgb-lib-0.3.0-beta.5

Conversation

@shashank-shinde

@shashank-shinde shashank-shinde commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added SIGNET_CUSTOM Bitcoin network support
    • Introduced getAssetMetadata API for enhanced asset information
    • Added transfer expiration timestamp configuration
    • Added dryRun mode for transaction preview
    • New INITIATED transfer status
  • Breaking Changes

    • Removed replaceRightsNum parameter from asset issuance
    • Removed REPLACE_RIGHT assignment type support
    • Renamed transfer expiration field to expirationTimestamp
  • Dependency Updates

    • Updated RGB library to 0.3.0-beta.5

@coderabbitai

coderabbitai Bot commented Apr 3, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This pull request updates the RGB library dependency from 0.3.0-beta.4 to 0.3.0-beta.5 across Android, iOS, and TypeScript SDK, adding support for new transaction parameters (expirationTimestamp, dryRun), a new Bitcoin network variant (SIGNET_CUSTOM), removing the REPLACE_RIGHT assignment type, restructuring the AssetMetadata type definition, and updating wallet initialization to use SinglesigKeys.

Changes

Cohort / File(s) Summary
Dependency & Build Configuration
android/build.gradle, scripts/download-rgb-lib-ios.js, package.json
Version bump to 0.3.0-beta.5 in Android and iOS download scripts; keywords updated to include bitcoin, rgb, rgb-protocol, wallet, turbo-module, native-module while removing platform-specific tags.
Android Native Module
android/src/main/java/com/rgb/RgbModule.kt
Wallet initialization refactored to use SinglesigKeys construction; added dryRun parameter to inflateBegin; removed replaceRightsNum from issueAssetIfa; added expirationTimestamp to send/sendBegin; updated numeric conversions to use toLong() for unsigned casts; added SIGNET_CUSTOM network support; removed REPLACE_RIGHT assignment handling; updated transfer status mappings to include INITIATED.
iOS Native Modules
ios/Rgb.mm, ios/Rgb.swift
Method signatures updated to accept dryRun parameter in inflateBegin and sendBegin; removed replaceRightsNum from issueAssetIfa; added expirationTimestamp to send and sendBegin; wallet initialization refactored to use SinglesigKeys; asset metadata structure expanded with required fields (assetSchema, knownCirculatingSupply, initialSupply) and optional token object; key retrieval switched to session.wallet.getKeys(); transfer status mapping includes INITIATED.
TypeScript SDK Types
src/Interfaces.ts, src/NativeRgb.ts
BitcoinNetwork extended with SIGNET_CUSTOM; AssignmentType union reduced by removing REPLACE_RIGHT; Transfer and RefreshedTransfer status types expanded with INITIATED; expiration field renamed from expiration to expirationTimestamp; AssetMetadata restructured with required fields and new AssetMetadataToken type; native API signatures updated across key methods.
TypeScript SDK Wrapper
src/Wallet.ts
Method signatures extended: inflateBegin adds dryRun parameter; issueAssetIfa removes replaceRightsNum; send adds expirationTimestamp; sendBegin adds both expirationTimestamp and dryRun; JSDoc updated to reflect new parameters and PSBT dry-run behavior.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 Hops of joy for updates new,
Signet custom calls to you,
Expiration stamps abound,
Keys and metadata unbound,
Beta five's a hoppy ride! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the pull request: upgrading the rgb-lib dependency to version 0.3.0-beta.5 and implementing all corresponding API changes across the codebase.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/rgb-lib-0.3.0-beta.5

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.

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (4)
src/Wallet.ts (2)

926-964: ⚠️ Potential issue | 🟠 Major

Don’t insert expirationTimestamp before the existing skipSync argument.

This changes the meaning of existing wallet.send(..., true) call sites. The sixth argument used to be skipSync; after this change it becomes expirationTimestamp, so older JS consumers will either hit a native type mismatch or send with an unintended expiry while still syncing.

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

In `@src/Wallet.ts` around lines 926 - 964, The new parameter order broke existing
call sites by inserting expirationTimestamp before skipSync; restore backward
compatibility by moving skipSync back to the original position (before
expirationTimestamp) in the Wallet.send signature (and in the call into
Rgb.send), i.e., use async send(recipientMap, donation, feeRate,
minConfirmations, skipSync: boolean = false, expirationTimestamp: number = 0)
and pass arguments to Rgb.send in the same order (this.getWalletId(),
recipientMap, donation, feeRate, minConfirmations, skipSync,
expirationTimestamp) so existing callers’ sixth argument remains skipSync;
update the parameter defaults accordingly.

725-760: ⚠️ Potential issue | 🟠 Major

Removing replaceRightsNum here is a source-breaking API change.

Extra positional args are still accepted in JS, so old wallet.issueAssetIfa(..., replaceRightsNum, rejectListUrl) call sites will now bind the former replaceRightsNum to rejectListUrl and silently drop the real URL. Keep a deprecated overload/shim for one release, or ship this as an explicit breaking change.

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

In `@src/Wallet.ts` around lines 725 - 760, The public method issueAssetIfa was
changed to drop the old positional parameter replaceRightsNum which is
source-breaking; restore a deprecated shim/overload in the Wallet.issueAssetIfa
implementation that detects when the fifth argument is a number
(replaceRightsNum) and the sixth argument (rejectListUrl) is omitted or
mis-bound, then translate the call to the new signature by passing null or the
correct rejectListUrl and handling/deprecating replaceRightsNum (e.g., log or
ignore) before delegating to Rgb.issueAssetIfa(this.getWalletId(), ...); keep
the new strict parameter order moving forward but accept the legacy form for one
release to avoid silently mis-binding replaceRightsNum into rejectListUrl.
android/src/main/java/com/rgb/RgbModule.kt (1)

199-207: ⚠️ Potential issue | 🟠 Major

Android SIGNET_CUSTOM support is only partially wired up.

getNetwork() now accepts SIGNET_CUSTOM, but generateKeys, restoreKeys, and the getWalletData network switch still only handle SIGNET. After this PR, Android can create that network in some paths and still reject it in others or throw when serializing wallet data back to JS.

Also applies to: 1096-1129

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

In `@android/src/main/java/com/rgb/RgbModule.kt` around lines 199 - 207,
getNetwork() now recognizes "SIGNET_CUSTOM" but other places still only handle
"SIGNET", causing inconsistent behavior; update the network handling in
generateKeys, restoreKeys, and getWalletData to also accept and map
"SIGNET_CUSTOM" to BitcoinNetwork.SIGNET_CUSTOM (and any related enum checks) so
the same network variant is used across all paths and wallet serialization to
JS; search for switch/when blocks or string comparisons in the functions
generateKeys, restoreKeys, and getWalletData and add the SIGNET_CUSTOM branch
(mirroring the SIGNET handling) so the network is consistently wired end-to-end.
ios/Rgb.swift (1)

1070-1076: ⚠️ Potential issue | 🔴 Critical

SIGNET_CUSTOM is still unsupported on inbound iOS paths.

These serializers now emit SIGNET_CUSTOM, but getNetwork(_:), _generateKeys, and _restoreKeys above still fall through to fatalError for that value. Initializing or regenerating keys for a custom signet wallet will hard-crash the app.

Also applies to: 2058-2065

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

In `@ios/Rgb.swift` around lines 1070 - 1076, The serializers now emit
.signetCustom but getNetwork(_:), _generateKeys, and _restoreKeys still fall
through to fatalError for that enum case; update those functions to handle
.signetCustom instead of crashing—either map .signetCustom to the same internal
behavior used for .signet (if custom parameters are not required) or read the
custom signet parameters from the wallet data and initialize the network/keys
accordingly; replace the fatalError branches in getNetwork(_:), _generateKeys,
and _restoreKeys with the appropriate handling so initializing/regenerating keys
for a SIGNET_CUSTOM wallet no longer hard-crashes.
🧹 Nitpick comments (2)
src/NativeRgb.ts (2)

405-406: Avoid leaking the 0 "unset" sentinel into the typed API.

The receive-side APIs model missing expiries as null, but send / sendBegin now require a number and rely on a comment telling callers to pass 0. Using number | null here and normalizing to 0 at the wrapper/native boundary would keep the contract symmetric and easier to call correctly.

♻️ Suggested typing change
   feeRate: number,
   minConfirmations: number,
-  expirationTimestamp: number,
+  expirationTimestamp: number | null,
   skipSync: boolean
   feeRate: number,
   minConfirmations: number,
-  expirationTimestamp: number,
+  expirationTimestamp: number | null,
   dryRun: boolean

Also applies to: 430-432

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

In `@src/NativeRgb.ts` around lines 405 - 406, Change the public API types for
expirationTimestamp from a plain number to number | null so callers can express
"unset" with null; update all type declarations that currently use
expirationTimestamp: number (including the other occurrences around the same
area) to expirationTimestamp: number | null, and then normalize to 0 at the
boundary where we call the native bridge (inside the send/sendBegin wrappers) by
mapping null -> 0 before constructing the native payload. Ensure only the
wrapper/native conversion uses the 0 sentinel and the rest of the codebase and
callers work with null to represent missing expiries.

14-20: Centralize these literal unions instead of repeating them inline.

This PR had to update the same bitcoinNetwork and assignment.type literals in six places. A shared alias would make the next enum change much less drift-prone.

♻️ Example direction
+type BitcoinNetwork =
+  | 'MAINNET'
+  | 'TESTNET'
+  | 'TESTNET4'
+  | 'REGTEST'
+  | 'SIGNET'
+  | 'SIGNET_CUSTOM';
+
+type AssignmentType =
+  | 'FUNGIBLE'
+  | 'NON_FUNGIBLE'
+  | 'INFLATION_RIGHT'
+  | 'ANY';

Then reuse BitcoinNetwork / AssignmentType in these method signatures instead of inlining the literals each time.

Also applies to: 29-35, 82-82, 396-396, 422-422, 467-467

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

In `@src/NativeRgb.ts` around lines 14 - 20, Create central type aliases for the
repeated literal unions (e.g., define type BitcoinNetwork = 'MAINNET' |
'TESTNET' | 'TESTNET4' | 'REGTEST' | 'SIGNET' | 'SIGNET_CUSTOM' and type
AssignmentType = /* the assignment.type literals seen inline */) near the top of
src/NativeRgb.ts and then replace every inline occurrence with these aliases
(references include the bitcoinNetwork unions and the assignment.type union
usages found around lines ~14-20, ~29-35, ~82, ~396, ~422, ~467). Update
function/method signatures and any interfaces or type annotations (e.g.,
parameters, return types, and object property types) to use BitcoinNetwork and
AssignmentType so all six places share the single source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ios/Rgb.swift`:
- Around line 621-627: The code is passing durationSeconds as an absolute expiry
into wallet.blindReceive (and other wallet.*Receive calls) instead of a relative
duration; change the call sites (e.g., the wallet.blindReceive invocation and
the other apply at lines ~2006-2012) to compute an absolute expirationTimestamp
by adding the current Unix time to durationSeconds (e.g., let expiration =
durationSeconds != nil ? UInt64(Date().timeIntervalSince1970) +
durationSeconds!.uint64Value : nil) and pass that expiration value into
expirationTimestamp, and make the same change in the Android bridge so both
platforms treat the JS API’s duration as a relative offset.

---

Outside diff comments:
In `@android/src/main/java/com/rgb/RgbModule.kt`:
- Around line 199-207: getNetwork() now recognizes "SIGNET_CUSTOM" but other
places still only handle "SIGNET", causing inconsistent behavior; update the
network handling in generateKeys, restoreKeys, and getWalletData to also accept
and map "SIGNET_CUSTOM" to BitcoinNetwork.SIGNET_CUSTOM (and any related enum
checks) so the same network variant is used across all paths and wallet
serialization to JS; search for switch/when blocks or string comparisons in the
functions generateKeys, restoreKeys, and getWalletData and add the SIGNET_CUSTOM
branch (mirroring the SIGNET handling) so the network is consistently wired
end-to-end.

In `@ios/Rgb.swift`:
- Around line 1070-1076: The serializers now emit .signetCustom but
getNetwork(_:), _generateKeys, and _restoreKeys still fall through to fatalError
for that enum case; update those functions to handle .signetCustom instead of
crashing—either map .signetCustom to the same internal behavior used for .signet
(if custom parameters are not required) or read the custom signet parameters
from the wallet data and initialize the network/keys accordingly; replace the
fatalError branches in getNetwork(_:), _generateKeys, and _restoreKeys with the
appropriate handling so initializing/regenerating keys for a SIGNET_CUSTOM
wallet no longer hard-crashes.

In `@src/Wallet.ts`:
- Around line 926-964: The new parameter order broke existing call sites by
inserting expirationTimestamp before skipSync; restore backward compatibility by
moving skipSync back to the original position (before expirationTimestamp) in
the Wallet.send signature (and in the call into Rgb.send), i.e., use async
send(recipientMap, donation, feeRate, minConfirmations, skipSync: boolean =
false, expirationTimestamp: number = 0) and pass arguments to Rgb.send in the
same order (this.getWalletId(), recipientMap, donation, feeRate,
minConfirmations, skipSync, expirationTimestamp) so existing callers’ sixth
argument remains skipSync; update the parameter defaults accordingly.
- Around line 725-760: The public method issueAssetIfa was changed to drop the
old positional parameter replaceRightsNum which is source-breaking; restore a
deprecated shim/overload in the Wallet.issueAssetIfa implementation that detects
when the fifth argument is a number (replaceRightsNum) and the sixth argument
(rejectListUrl) is omitted or mis-bound, then translate the call to the new
signature by passing null or the correct rejectListUrl and handling/deprecating
replaceRightsNum (e.g., log or ignore) before delegating to
Rgb.issueAssetIfa(this.getWalletId(), ...); keep the new strict parameter order
moving forward but accept the legacy form for one release to avoid silently
mis-binding replaceRightsNum into rejectListUrl.

---

Nitpick comments:
In `@src/NativeRgb.ts`:
- Around line 405-406: Change the public API types for expirationTimestamp from
a plain number to number | null so callers can express "unset" with null; update
all type declarations that currently use expirationTimestamp: number (including
the other occurrences around the same area) to expirationTimestamp: number |
null, and then normalize to 0 at the boundary where we call the native bridge
(inside the send/sendBegin wrappers) by mapping null -> 0 before constructing
the native payload. Ensure only the wrapper/native conversion uses the 0
sentinel and the rest of the codebase and callers work with null to represent
missing expiries.
- Around line 14-20: Create central type aliases for the repeated literal unions
(e.g., define type BitcoinNetwork = 'MAINNET' | 'TESTNET' | 'TESTNET4' |
'REGTEST' | 'SIGNET' | 'SIGNET_CUSTOM' and type AssignmentType = /* the
assignment.type literals seen inline */) near the top of src/NativeRgb.ts and
then replace every inline occurrence with these aliases (references include the
bitcoinNetwork unions and the assignment.type union usages found around lines
~14-20, ~29-35, ~82, ~396, ~422, ~467). Update function/method signatures and
any interfaces or type annotations (e.g., parameters, return types, and object
property types) to use BitcoinNetwork and AssignmentType so all six places share
the single source of truth.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 42e7ca46-375b-4eb7-8442-a2b016f28e10

📥 Commits

Reviewing files that changed from the base of the PR and between 3a7f033 and 8b95178.

📒 Files selected for processing (10)
  • android/build.gradle
  • android/src/main/java/com/rgb/RgbModule.kt
  • ios/Rgb.mm
  • ios/Rgb.swift
  • ios/RgbLib.swift
  • package.json
  • scripts/download-rgb-lib-ios.js
  • src/Interfaces.ts
  • src/NativeRgb.ts
  • src/Wallet.ts

Comment thread ios/Rgb.swift
Comment on lines 621 to 627
let receiveData = try session.wallet.blindReceive(
assetId: assetId,
assignment: assignmentObj,
durationSeconds: durationSeconds?.uint32Value,
expirationTimestamp: durationSeconds?.uint64Value,
transportEndpoints: endpoints,
minConfirmations: minConfirmations.uint8Value
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

durationSeconds is being forwarded as an absolute expiry.

The JS API still documents a relative duration, but both receive paths now pass that value into wallet.*Receive(... expirationTimestamp: ...). Passing 3600 will expire near Unix time 3600, not “one hour from now”. Convert to now + durationSeconds here, or rename/update the JS contract to take an absolute timestamp. Android mirrors the same conversion, so the fix needs to land in both bridges.

Also applies to: 2006-2012

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

In `@ios/Rgb.swift` around lines 621 - 627, The code is passing durationSeconds as
an absolute expiry into wallet.blindReceive (and other wallet.*Receive calls)
instead of a relative duration; change the call sites (e.g., the
wallet.blindReceive invocation and the other apply at lines ~2006-2012) to
compute an absolute expirationTimestamp by adding the current Unix time to
durationSeconds (e.g., let expiration = durationSeconds != nil ?
UInt64(Date().timeIntervalSince1970) + durationSeconds!.uint64Value : nil) and
pass that expiration value into expirationTimestamp, and make the same change in
the Android bridge so both platforms treat the JS API’s duration as a relative
offset.

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