I want to integrate an RGB wallet into an IC canister. After importing and using rgb-std, the code can compile successfully, but I encounter an error during deployment.
Installing canisters…
Upgrading code for canister smartwallet, with canister ID bd3sg-teaaa-aaaaa-qaaba-cai
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
Failed while trying to install all canisters.
Failed to install wasm module to canister ‘smartwallet’.
Failed during wasm installation call: The replica returned a replica error: reject code CanisterError, reject message Wasm module of canister bd3sg-teaaa-aaaaa-qaaba-cai is not valid: Wasm module has an invalid import section. Module imports function ‘__wbindgen_describe’ from ‘wbindgen_placeholder’ that is not exported by the runtime., error code None
the dependencies in project root Cargo.toml:
# for RGB
amplify = "4.6.0"
strict_encoding = "2.7.0-beta.1"
strict_types = "2.7.0-beta.1"
aluvm = "0.11.0-beta.4"
bp-core = "0.11.0-beta.4"
rgb-std = { version = "0.11.0-beta.4", features = ["serde"] }
# rgb-schemata = "0.11.0-beta.4"
serde = "1.0"
serde_json = "1.0"
sha2 = "0.10.8"
[patch.crates-io]
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "master" }
rgb-std = { git = "https://github.com/RGB-WG/rgb-std", branch = "master" }
and the dependencies in workspace package:
[lib]
crate-type = ["cdylib"]
[dependencies]
candid = "0.10"
ic-cdk = "0.12"
ic-cdk-timers = "0.6" # Feel free to remove this dependency if you don't need timers
rgb-std = { workspace = true }
amplify = { workspace = true }
strict_encoding = { workspace = true }
strict_types = { workspace = true }
aluvm = { workspace = true }
bp-core = { workspace = true }
# rgb-std = { version = "0.11.0-beta.4", features = ["serde"] }
# rgb-schemata = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
sha2 = { workspace = true }
and the code in main.rs is:
use amplify::hex::FromHex;
use rgbstd::Txid;
#[ic_cdk::query]
fn greet(name: String) -> String {
// let beneficiary_txid =
// Txid::from_hex("14295d5bb1a191cdb6286dc0944df938421e3dfcbf0811353ccac4100c2068c5").unwrap();
// let beneficiary = Outpoint::new(beneficiary_txid, 1);
// let contract = NonInflatableAsset::testnet("TEST", "Test asset", None, Precision::CentiMicro)
// .expect("invalid contract data")
// .allocate(Method::TapretFirst, beneficiary, 1_000_000_000_000u64.into())
// .expect("invalid allocations")
// .issue_contract()
// .expect("invalid contract data");
// let contract_id = contract.contract_id();
format!("Hello, {} !", name)
}
the source code: https://github.com/lshoo/rgbonic
How to solve this error?
thanks