Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bitcoin/Rust] Add support for creating Ordinal NFT inscriptions #3297

Merged
merged 53 commits into from
Jul 17, 2023

Conversation

lamafab
Copy link
Contributor

@lamafab lamafab commented Jul 7, 2023

This PR allows you to create Ordinal NFT inscriptions, example: https://www.blockchain.com/explorer/transactions/btc/173f8350b722243d44cc8db5584de76b432eb6d0888d9e66e662db51584f44ac

Generally ready, two things to consider:

  1. The TransactionVariant protobuf enum now has the variants:
enum TransactionVariant {
    P2PKH = 0;
    P2WPKH = 1;
    P2TRKEYPATH = 2;
    BRC20TRANSFER = 3;
    NFTINSCRIPTION = 4;
}

The last two can technically be combined, I propose calling it P2ScriptPath (P2TRKEYPATH should be lowercased, too). But that's a breaking change afaik.

EDIT: We're keeping it like this now, we're planning on writing a new interface as part of a larger task anyway.

  1. Would be nice if someone could quickly write Script::buildNftInscription in src/Bitcoin.cpp in order to expose it. Note that one has to pass on the MimeType from src/nft.rs. Done

EDIT: Additionally, added tests for C++ and Swift, Kotlin is WIP... having some build/dependency error (?). Will change this from Draft to Open, let the CI run.

lamafab added 30 commits July 5, 2023 18:00
Copy link
Collaborator

@satoshiotomakan satoshiotomakan left a comment

Choose a reason for hiding this comment

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

Good job! Just a few questions/suggestions/reminders

include/TrustWalletCore/TWOrdMimeType.h Outdated Show resolved Hide resolved
rust/tw_bitcoin/src/ffi/mod.rs Outdated Show resolved Hide resolved
rust/tw_bitcoin/src/ffi/scripts.rs Outdated Show resolved Hide resolved
src/Bitcoin/Script.cpp Outdated Show resolved Hide resolved
swift/Tests/Blockchains/BitcoinTests.swift Outdated Show resolved Hide resolved
@lamafab
Copy link
Contributor Author

lamafab commented Jul 13, 2023

@satoshiotomakan finally :) done

rust/tw_bitcoin/src/ffi/scripts.rs Outdated Show resolved Hide resolved
samples/kmp/iosApp/Podfile.lock Outdated Show resolved Hide resolved
samples/osx/cocoapods/Podfile.lock Outdated Show resolved Hide resolved
swift/Example/Podfile.lock Outdated Show resolved Hide resolved
swift/Podfile.lock Outdated Show resolved Hide resolved
Copy link
Collaborator

@satoshiotomakan satoshiotomakan left a comment

Choose a reason for hiding this comment

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

LGTM 🔥

@lamafab lamafab merged commit 53c1b1d into master Jul 17, 2023
12 checks passed
@lamafab lamafab deleted the bitcoin-nft-inscriptions branch July 17, 2023 15:24
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.

3 participants