Skip to content

Commit

Permalink
update rgb-lib to 0.3.0-alpha.6 + bump to 0.3.0-alpha.6
Browse files Browse the repository at this point in the history
zoedberg committed Aug 29, 2024
1 parent 72e6909 commit eb39d1e
Showing 5 changed files with 159 additions and 144 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -25,8 +25,8 @@ let package = Package(
// .binaryTarget(name: "rgb_libFFI", path: "./rgb_libFFI.xcframework"),
.binaryTarget(
name: "rgb_libFFI",
url: "https://github.com/RGB-Tools/rgb-lib-swift/releases/download/0.3.0-alpha.4/rgb_libFFI.xcframework.zip",
checksum: "2c27a25e6bf1d34fdcddd680c6272346bbd03df48e5895f3cae9311c2def68e7"),
url: "https://github.com/RGB-Tools/rgb-lib-swift/releases/download/0.3.0-alpha.6/rgb_libFFI.xcframework.zip",
checksum: "e0892841c456cfc5f69b7c7e42889f1a51e71ae96d57a67ec5e999f7914ac245"),
.target(
name: "RgbLib",
dependencies: ["rgb_libFFI"]),
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

This project builds a Swift library, `RgbLib`, for the [rgb-lib]
Rust library, which is included as a git submodule. The bindings are created by
the [rgb-lib-ffi] project, which is located inside the rgb-lib submodule.
the [rgb-lib-uniffi] project, which is located inside the rgb-lib submodule.

## Usage

@@ -33,8 +33,8 @@ For example:
```swift
.binaryTarget(
name: "rgb_libFFI",
url: "https://github.com/RGB-Tools/rgb-lib-swift/releases/download/0.3.0-alpha.4/rgb_libFFI.xcframework.zip",
checksum: "2c27a25e6bf1d34fdcddd680c6272346bbd03df48e5895f3cae9311c2def68e7"),
url: "https://github.com/RGB-Tools/rgb-lib-swift/releases/download/0.3.0-alpha.6/rgb_libFFI.xcframework.zip",
checksum: "e0892841c456cfc5f69b7c7e42889f1a51e71ae96d57a67ec5e999f7914ac245"),
```

Commit the changed `Package.swift` file, then tag the commit with the new
@@ -49,4 +49,4 @@ If you get an error you might need to reset the Xcode package caches:


[rgb-lib]: https://github.com/RGB-Tools/rgb-lib
[rgb-lib-ffi]: https://github.com/RGB-Tools/rgb-lib/tree/master/rgb-lib-ffi
[rgb-lib-uniffi]: https://github.com/RGB-Tools/rgb-lib/tree/master/bindings/uniffi
261 changes: 138 additions & 123 deletions Sources/RgbLib/RgbLib.swift

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions generate.sh
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

set -euo pipefail

RGBLIBFFI_PATH="./rgb-lib/rgb-lib-ffi"
RGBLIBFFI_PATH="./rgb-lib/bindings/uniffi"
MANIFEST_PATH=(--manifest-path "$RGBLIBFFI_PATH/Cargo.toml")
XCFRAMEWORK_PATH="rgb_libFFI.xcframework"

@@ -17,14 +17,14 @@ rustup target add aarch64-apple-darwin x86_64-apple-darwin

echo "Generating Swift bindings..."
cargo run "${MANIFEST_PATH[@]}" \
--bin rgb-lib-ffi-bindgen generate $RGBLIBFFI_PATH/src/rgb-lib.udl \
--bin rgb-lib-uniffi-bindgen generate $RGBLIBFFI_PATH/src/rgb-lib.udl \
--language swift --out-dir ./Sources/RgbLib
mv Sources/RgbLib/rgb_lib.swift Sources/RgbLib/RgbLib.swift

echo "Building rgb-lib-ffi libs for Apple targets..."
echo "Building rgb-lib uniffi libs for Apple targets..."
TARGET_TRIPLES=("x86_64-apple-darwin" "aarch64-apple-darwin" "x86_64-apple-ios" "aarch64-apple-ios")
for target in "${TARGET_TRIPLES[@]}"; do
echo "Build rgb-lib-ffi lib for target $target"
echo "Build rgb-lib uniffi lib for target $target"
cargo build "${MANIFEST_PATH[@]}" --target "$target"
done
# special build for M1 ios simulator
@@ -33,15 +33,15 @@ cargo +nightly build -Z build-std \

echo "Create lipo static libs for ios-sim to support M1"
mkdir -p $RGBLIBFFI_PATH/target/lipo-ios-sim/debug
lipo $RGBLIBFFI_PATH/target/aarch64-apple-ios-sim/debug/librgblibffi.a \
$RGBLIBFFI_PATH/target/x86_64-apple-ios/debug/librgblibffi.a -create \
-output $RGBLIBFFI_PATH/target/lipo-ios-sim/debug/librgblibffi.a
lipo $RGBLIBFFI_PATH/target/aarch64-apple-ios-sim/debug/librgblibuniffi.a \
$RGBLIBFFI_PATH/target/x86_64-apple-ios/debug/librgblibuniffi.a -create \
-output $RGBLIBFFI_PATH/target/lipo-ios-sim/debug/librgblibuniffi.a

echo "Create lipo static libs for macos to support M1"
mkdir -p $RGBLIBFFI_PATH/target/lipo-macos/debug
lipo $RGBLIBFFI_PATH/target/aarch64-apple-darwin/debug/librgblibffi.a \
$RGBLIBFFI_PATH/target/x86_64-apple-darwin/debug/librgblibffi.a -create \
-output $RGBLIBFFI_PATH/target/lipo-macos/debug/librgblibffi.a
lipo $RGBLIBFFI_PATH/target/aarch64-apple-darwin/debug/librgblibuniffi.a \
$RGBLIBFFI_PATH/target/x86_64-apple-darwin/debug/librgblibuniffi.a -create \
-output $RGBLIBFFI_PATH/target/lipo-macos/debug/librgblibuniffi.a

XCFRAMEWORK_LIBS=("ios-arm64" "ios-arm64_x86_64-simulator" "macos-arm64_x86_64")
for lib in "${XCFRAMEWORK_LIBS[@]}"; do
@@ -69,10 +69,10 @@ EOF

done

echo "Copy librgblibffi.a files to $XCFRAMEWORK_PATH/rgb_libFFI"
cp $RGBLIBFFI_PATH/target/aarch64-apple-ios/debug/librgblibffi.a $XCFRAMEWORK_PATH/ios-arm64/rgb_libFFI.framework/rgb_libFFI
cp $RGBLIBFFI_PATH/target/lipo-ios-sim/debug/librgblibffi.a $XCFRAMEWORK_PATH/ios-arm64_x86_64-simulator/rgb_libFFI.framework/rgb_libFFI
cp $RGBLIBFFI_PATH/target/lipo-macos/debug/librgblibffi.a $XCFRAMEWORK_PATH/macos-arm64_x86_64/rgb_libFFI.framework/rgb_libFFI
echo "Copy librgblibuniffi.a files to $XCFRAMEWORK_PATH/rgb_libFFI"
cp $RGBLIBFFI_PATH/target/aarch64-apple-ios/debug/librgblibuniffi.a $XCFRAMEWORK_PATH/ios-arm64/rgb_libFFI.framework/rgb_libFFI
cp $RGBLIBFFI_PATH/target/lipo-ios-sim/debug/librgblibuniffi.a $XCFRAMEWORK_PATH/ios-arm64_x86_64-simulator/rgb_libFFI.framework/rgb_libFFI
cp $RGBLIBFFI_PATH/target/lipo-macos/debug/librgblibuniffi.a $XCFRAMEWORK_PATH/macos-arm64_x86_64/rgb_libFFI.framework/rgb_libFFI

# remove unneed .h and .modulemap files
rm Sources/RgbLib/rgb_libFFI.h
2 changes: 1 addition & 1 deletion rgb-lib
Submodule rgb-lib updated 63 files
+4 −3 .gitignore
+449 −460 Cargo.lock
+11 −8 Cargo.toml
+5 −6 README.md
+22 −0 bindings/README.md
+5,130 −0 bindings/c-ffi/Cargo.lock
+38 −0 bindings/c-ffi/Cargo.toml
+37 −0 bindings/c-ffi/Makefile
+49 −0 bindings/c-ffi/README.md
+19 −0 bindings/c-ffi/build.rs
+158 −0 bindings/c-ffi/cbindgen.toml
+134 −0 bindings/c-ffi/example.c
+226 −0 bindings/c-ffi/src/lib.rs
+330 −0 bindings/c-ffi/src/utils.rs
+565 −656 bindings/uniffi/Cargo.lock
+6 −6 bindings/uniffi/Cargo.toml
+30 −0 bindings/uniffi/README.md
+7 −0 bindings/uniffi/build.rs
+0 −0 bindings/uniffi/src/lib.rs
+1 −0 bindings/uniffi/src/rgb-lib.udl
+0 −0 bindings/uniffi/uniffi-bindgen.rs
+9 −0 bindings/uniffi/uniffi.toml
+2 −2 codecov.yml
+0 −38 rgb-lib-ffi/README.md
+0 −55 rgb-lib-ffi/build.rs
+0 −9 rgb-lib-ffi/uniffi.toml
+13 −13 src/api/proxy.rs
+1 −1 src/database/mod.rs
+7 −0 src/error.rs
+1 −0 src/keys.rs
+4 −5 src/lib.rs
+39 −21 src/wallet/backup.rs
+27 −0 src/wallet/offline.rs
+87 −49 src/wallet/online.rs
+8 −12 src/wallet/rust_only.rs
+99 −43 src/wallet/test/backup.rs
+26 −26 src/wallet/test/blind_receive.rs
+10 −10 src/wallet/test/create_utxos.rs
+15 −15 src/wallet/test/delete_transfers.rs
+9 −9 src/wallet/test/drain_to.rs
+2 −2 src/wallet/test/export_contract.rs
+28 −24 src/wallet/test/fail_transfers.rs
+23 −19 src/wallet/test/get_asset_balance.rs
+5 −5 src/wallet/test/get_asset_metadata.rs
+13 −8 src/wallet/test/go_online.rs
+28 −21 src/wallet/test/issue_asset_cfa.rs
+18 −18 src/wallet/test/issue_asset_nia.rs
+22 −22 src/wallet/test/issue_asset_uda.rs
+3 −3 src/wallet/test/list_assets.rs
+6 −6 src/wallet/test/list_transactions.rs
+10 −10 src/wallet/test/list_transfers.rs
+13 −13 src/wallet/test/list_unspents.rs
+6 −5 src/wallet/test/mod.rs
+8 −8 src/wallet/test/new.rs
+39 −36 src/wallet/test/refresh.rs
+21 −23 src/wallet/test/rust_only.rs
+362 −358 src/wallet/test/send.rs
+27 −40 src/wallet/test/utils/api.rs
+6 −2 src/wallet/test/utils/helpers.rs
+2 −2 src/wallet/test/witness_receive.rs
+8 −3 tests/docker-compose.yml
+177 −0 tests/regtest.sh
+0 −79 tests/start_services.sh

0 comments on commit eb39d1e

Please sign in to comment.