Skip to content

feat: add Safe inscription APIs - #511

Merged
hundredark merged 3 commits into
MixinNetwork:mainfrom
LixvYang:feat/safe-inscription-apis
Sep 18, 2026
Merged

hundredark merged 3 commits into
MixinNetwork:mainfrom
LixvYang:feat/safe-inscription-apis

Conversation

@LixvYang

Copy link
Copy Markdown
Contributor

Summary

Add Safe inscription (collectible) support to the Node SDK, aligned with the Go SDK (bot-api-go-client v3.25.7).

New APIs

Transfer

const results = await client.safe.transferInscription({
  inscriptionHash: '...',
  receivers: ['user-uuid'],
  threshold: 1,
  memo: 'enjoy your collectible', // optional
});
  • The spend private key defaults to keystore.spend_private_key, so bots can transfer with just their keystore
  • Spends the inscription output entirely to the recipient (inscriptions can't be split, no change output)
  • Accepts an utxo directly to skip the output lookup, and signerIndex for multisig-owned inscriptions

Utilities

  • getInscriptionOutput(utxoClient, inscriptionHash) — locates the unspent output carrying a given inscription (paginates /safe/outputs)
  • buildInscriptionOperationExtra / decodeInscriptionOperationExtra — encode/decode inscription operation payloads (deploy / inscribe / distribute / occupy) carried in transaction extras

Fields & types

  • SafeSnapshot.inscription_hash, SafeMultisigsResponse.inscription_hash
  • Blaze: TransferSafeView (with deposit_hash / inscription_hash), SYSTEM_SAFE_SNAPSHOT and SYSTEM_SAFE_INSCRIPTION message categories
  • SafeCollection.treasury, inscription operation payload types
  • AppKeystore.spend_private_key (already present in bot dashboard keystores)

Safety

getUnspentOutputsForRecipients now skips inscription outputs by default so ordinary transfers never spend collectibles as fungible inputs (opt-in via { includeInscriptions: true }).

Tests

Unit tests for extra encoding/decoding, inscription-aware output selection, output pagination, and the full transfer flow (build → verify → sign → submit) with a mocked client.

yanglixin added 3 commits September 18, 2026 20:02
- Add client.safe.transferInscription for transferring inscriptions, with
  the spend private key defaulting to keystore.spend_private_key
- Add inscription_hash to SafeSnapshot, SafeMultisigsResponse and the
  blaze TransferSafeView, plus SYSTEM_SAFE_SNAPSHOT / SYSTEM_SAFE_INSCRIPTION
  message categories, aligned with the Go SDK
- Add inscription operation payload types (deploy/inscribe/distribute/occupy)
  with buildInscriptionOperationExtra / decodeInscriptionOperationExtra
- Add getInscriptionOutput to locate the unspent output carrying an inscription
- Skip inscription outputs in getUnspentOutputsForRecipients by default to
  avoid spending collectibles as fungible inputs (opt-in via includeInscriptions)
- Add treasury to SafeCollection and spend_private_key to AppKeystore
- Add unit tests and an example
Add optional inscription and inscriptionCollection fields to
PaymentParams and include them as the inscription and
inscription_collection query params in buildMixinOneSafePaymentUri,
so a payment deep link can request a specific NFT collectible or let
the payer pick one from a collection. Both params are omitted from
the URI when not provided, as with the existing optional params.
The distribution extra wire format is defined by the Mixin inscription
protocol and the Go SDK as the JSON key distribute, i.e.
{"distribute":"distribute","sequence":N}, not
{"operation":"distribute",...}. Rename the field and update the
decoder accordingly, and reject the operation-keyed shape as unknown.
@hundredark
hundredark merged commit 6b9f230 into MixinNetwork:main Sep 18, 2026
3 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