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

Implement ICS 721 #167

Merged
merged 11 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changelog/unreleased/features/167-ics721-impl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add ICS-721 proto: ([\#167](https://github.com/cosmos/ibc-proto-
rs/issues/167))
29 changes: 29 additions & 0 deletions scripts/sync-protobuf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ CACHE_PATH="${XDG_CACHE_HOME:-$HOME/.cache}"
COSMOS_SDK_GIT="${COSMOS_SDK_GIT:-$CACHE_PATH/cosmos/cosmos-sdk.git}"
IBC_GO_GIT="${IBC_GO_GIT:-$CACHE_PATH/ibc-go.git}"
COSMOS_ICS_GIT="${COSMOS_ICS_GIT:-$CACHE_PATH/cosmos/interchain-security.git}"
NFT_TRANSFER_GIT="${NFT_TRANSFER_GIT:-$CACHE_PATH/bianjieai/nft-transfer.git}"

COSMOS_SDK_COMMIT="$(cat src/COSMOS_SDK_COMMIT)"
IBC_GO_COMMIT="$(cat src/IBC_GO_COMMIT)"
INTERCHAIN_SECURITY_COMMIT="$(cat src/INTERCHAIN_SECURITY_COMMIT)"
NFT_TRANSFER_COMMIT="$(cat src/NFT_TRANSFER_COMMIT)"

echo "COSMOS_SDK_COMMIT: $COSMOS_SDK_COMMIT"
echo "IBC_GO_COMMIT: $IBC_GO_COMMIT"
echo "INTERCHAIN_SECURITY_COMMIT: $INTERCHAIN_SECURITY_COMMIT"
echo "NFT_TRANSFER_COMMIT: $NFT_TRANSFER_COMMIT"

# Use either --ics-commit flag for commit ID,
# or --ics-tag for git tag. Because we can't modify
Expand Down Expand Up @@ -89,6 +92,15 @@ else
echo "Using existing ibc-go bare git repository at $IBC_GO_GIT"
fi

if [[ ! -e "$NFT_TRANSFER_GIT" ]]
then
echo "Cloning nft-transfer source code to as bare git repository to $NFT_TRANSFER_GIT"
git clone --mirror https://github.com/bianjieai/nft-transfer.git "$NFT_TRANSFER_GIT"
else
echo "Using existing nft-transfer bare git repository at $NFT_TRANSFER_GIT"
fi


# Update the repositories using git fetch. This is so that
# we keep local copies of the repositories up to sync first.
pushd "$COSMOS_ICS_GIT"
Expand All @@ -103,6 +115,10 @@ pushd "$IBC_GO_GIT"
git fetch
popd

pushd "$NFT_TRANSFER_GIT"
git fetch
popd

# Create a new temporary directory to check out the
# actual source files from the bare git repositories.
# This is so that we do not accidentally use an unclean
Expand Down Expand Up @@ -154,6 +170,17 @@ cd proto
buf export -v -o ../proto-include
popd

NFT_TRANSFER_DIR=$(mktemp -d /tmp/nft-transfer-XXXXXXXX)

pushd "$NFT_TRANSFER_DIR"
git clone "$NFT_TRANSFER_GIT" .
git checkout -b "$NFT_TRANSFER_COMMIT" "$NFT_TRANSFER_COMMIT"

cd proto
buf export -v -o ../proto-include
rm ../proto-include/ibc/core/client/v1/client.proto
popd

# Remove the existing generated protobuf files
# so that the newly generated code does not
# contain removed files.
Expand All @@ -173,6 +200,7 @@ cargo run -- compile \
--ics "$COSMOS_ICS_DIR/proto-include" \
--sdk "$COSMOS_SDK_DIR/proto-include" \
--ibc "$IBC_GO_DIR/proto-include" \
--nft "$NFT_TRANSFER_DIR/proto-include" \
--out ../../src/prost

cd ../..
Expand All @@ -192,3 +220,4 @@ rm -f src/prost/tendermint.abci.rs
rm -rf "$COSMOS_ICS_DIR"
rm -rf "$COSMOS_SDK_DIR"
rm -rf "$IBC_GO_DIR"
rm -rf "$NFT_TRANSFER_DIR"
1 change: 1 addition & 0 deletions src/NFT_TRANSFER_COMMIT
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
986de3bb91434c9efc49a82544e3ba0b208e19a7
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ pub const IBC_GO_COMMIT: &str = include_str!("IBC_GO_COMMIT");
/// The version (commit hash) of Interchain Security used when generating this library.
pub const INTERCHAIN_SECURITY_COMMIT: &str = include_str!("INTERCHAIN_SECURITY_COMMIT");

/// The version (commit hash) of nft-transfer used when generating this library.
pub const NFT_TRANSFER_COMMIT: &str = include_str!("NFT_TRANSFER_COMMIT");

/// File descriptor set of compiled proto.
#[cfg(feature = "proto-descriptor")]
pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("prost/proto_descriptor.bin");
Expand Down Expand Up @@ -296,6 +299,13 @@ pub mod ibc {
}
}
}
pub mod nft_transfer {
pub mod v1 {
include_proto!("ibc.applications.nft_transfer.v1.rs");
#[cfg(feature = "serde")]
include_proto!("ibc.applications.nft_transfer.v1.serde.rs");
}
}
}
pub mod core {
pub mod channel {
Expand Down
Loading
Loading