Skip to content

Commit

Permalink
Update Metadata, Error and Events (#597)
Browse files Browse the repository at this point in the history
* we're getting there..

* add missing file

* finaling compiling!

* fix test

* remove unused stuff

* clean up metadata

* move impl metadata

* fix build

* clean up node-api Error

* remove unused errors

* update error and event headers

* add linker comments

* remove clone
  • Loading branch information
haerdib authored Jun 28, 2023
1 parent 19c6397 commit 3162233
Show file tree
Hide file tree
Showing 23 changed files with 935 additions and 742 deletions.
107 changes: 95 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions compose-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ mod rpc;
macro_rules! compose_call {
($node_metadata: expr, $pallet: expr, $call_name: expr $(, $args: expr) *) => {
{
let pallet = $node_metadata.pallet($pallet).unwrap().to_owned();
let pallet = $node_metadata.pallet_by_name($pallet).unwrap().to_owned();

let call_index = pallet.call_indexes.get($call_name).unwrap();
let call_index = pallet.call_variant_by_name($call_name).unwrap().index;

([pallet.index, *call_index as u8] $(, ($args)) *)
([pallet.index(), call_index as u8] $(, ($args)) *)
}
};
}
Expand Down Expand Up @@ -93,7 +93,8 @@ macro_rules! compose_extrinsic_with_nonce {

debug!("Composing generic extrinsic for module {:?} and call {:?}", $module, $call);

let call = $crate::compose_call!($api.metadata().clone(), $module, $call $(, ($args)) *);
let metadata = $api.metadata();
let call = $crate::compose_call!(metadata, $module, $call $(, ($args)) *);
if let Some(signer) = $api.signer() {
$crate::compose_extrinsic_offline!(
signer,
Expand Down
7 changes: 5 additions & 2 deletions node-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ serde_json = { version = "1.0.79", default-features = false, features = ["alloc"

# scale
scale-bits = { default-features = false, features = ["scale-info", "serde"], git = "https://github.com/haerdib/scale-bits.git", branch = "bh/no-std" }
scale-decode = { default-features = false, features = ["primitive-types"], git = "https://github.com/scs/scale-decode.git", branch = "no-std" }
scale-encode = { default-features = false, features = ["bits", "primitive-types"], git = "https://github.com/scs/scale-encode.git", branch = "no-std" }
scale-decode = { default-features = false, features = ["primitive-types", "derive"], git = "https://github.com/scs/scale-decode.git", branch = "no-std" }
scale-encode = { default-features = false, features = ["bits", "primitive-types", "derive"], git = "https://github.com/scs/scale-encode.git", branch = "no-std" }

# substrate
sp-core = { default-features = false, features = ["full_crypto", "serde"], git = "https://github.com/paritytech/substrate.git", branch = "master" }
Expand All @@ -35,6 +35,9 @@ sp-storage = { default-features = false, features = ["serde"], git = "https://gi
sp-application-crypto = { default-features = false, git = "https://github.com/paritytech/substrate.git", features = ["full_crypto"], branch = "master" }
sp-runtime-interface = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }

# local
ac-primitives = { path = "../primitives", default-features = false }

[dev-dependencies]
test-case = "3.1.0"

Expand Down
Loading

0 comments on commit 3162233

Please sign in to comment.