diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6738b0b292..20cd48ddc4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -13,7 +13,17 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Build + + - name: setup + run: | + rustup install nightly + rustup component add rustfmt --toolchain nightly + + - name: fmt + run: cargo +nightly fmt --all -- --check + + - name: build run: cargo build --verbose - - name: Run tests + + - name: test run: cargo test --verbose diff --git a/LICENSE_TEMPLATE b/LICENSE_TEMPLATE index 03419d93b9..a96085a478 100644 --- a/LICENSE_TEMPLATE +++ b/LICENSE_TEMPLATE @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify diff --git a/examples/fetch_remote.rs b/examples/fetch_remote.rs index 8454daf3cc..64dbac1097 100644 --- a/examples/fetch_remote.rs +++ b/examples/fetch_remote.rs @@ -1,4 +1,4 @@ -// Copyright 2020 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify diff --git a/examples/kusama_balance_transfer.rs b/examples/kusama_balance_transfer.rs index b0ea53b17c..78076b7b87 100644 --- a/examples/kusama_balance_transfer.rs +++ b/examples/kusama_balance_transfer.rs @@ -1,4 +1,4 @@ -// Copyright 2020 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify diff --git a/examples/submit_and_watch.rs b/examples/submit_and_watch.rs index 1bc2f476cc..b587c97f00 100644 --- a/examples/submit_and_watch.rs +++ b/examples/submit_and_watch.rs @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify diff --git a/proc-macro/src/call.rs b/proc-macro/src/call.rs index a01b2e5444..7c44772aaf 100644 --- a/proc-macro/src/call.rs +++ b/proc-macro/src/call.rs @@ -1,3 +1,19 @@ +// Copyright 2019-2020 Parity Technologies (UK) Ltd. +// This file is part of substrate-subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with substrate-subxt. If not, see . + use crate::utils; use heck::{ CamelCase, diff --git a/proc-macro/src/event.rs b/proc-macro/src/event.rs index 59f64622fd..ce0c8abb15 100644 --- a/proc-macro/src/event.rs +++ b/proc-macro/src/event.rs @@ -1,3 +1,19 @@ +// Copyright 2019-2020 Parity Technologies (UK) Ltd. +// This file is part of substrate-subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with substrate-subxt. If not, see . + use crate::utils; use heck::{ CamelCase, diff --git a/proc-macro/src/lib.rs b/proc-macro/src/lib.rs index ccecbe1c62..c42006f935 100644 --- a/proc-macro/src/lib.rs +++ b/proc-macro/src/lib.rs @@ -1,3 +1,19 @@ +// Copyright 2019-2020 Parity Technologies (UK) Ltd. +// This file is part of substrate-subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with substrate-subxt. If not, see . + extern crate proc_macro; mod call; diff --git a/proc-macro/src/module.rs b/proc-macro/src/module.rs index 3327b368c4..69bee65f3a 100644 --- a/proc-macro/src/module.rs +++ b/proc-macro/src/module.rs @@ -1,3 +1,19 @@ +// Copyright 2019-2020 Parity Technologies (UK) Ltd. +// This file is part of substrate-subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with substrate-subxt. If not, see . + use crate::utils; use heck::SnakeCase; use proc_macro2::TokenStream; diff --git a/proc-macro/src/store.rs b/proc-macro/src/store.rs index 865573d0d0..d5444f5357 100644 --- a/proc-macro/src/store.rs +++ b/proc-macro/src/store.rs @@ -1,3 +1,19 @@ +// Copyright 2019-2020 Parity Technologies (UK) Ltd. +// This file is part of substrate-subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with substrate-subxt. If not, see . + use crate::utils; use heck::SnakeCase; use proc_macro2::{ diff --git a/proc-macro/src/test.rs b/proc-macro/src/test.rs index 3d270587d9..b3c2886001 100644 --- a/proc-macro/src/test.rs +++ b/proc-macro/src/test.rs @@ -1,3 +1,19 @@ +// Copyright 2019-2020 Parity Technologies (UK) Ltd. +// This file is part of substrate-subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with substrate-subxt. If not, see . + use crate::utils; use proc_macro2::TokenStream; use quote::{ diff --git a/proc-macro/src/utils.rs b/proc-macro/src/utils.rs index 3e3aaea6d5..b8c0ce361e 100644 --- a/proc-macro/src/utils.rs +++ b/proc-macro/src/utils.rs @@ -1,3 +1,19 @@ +// Copyright 2019-2020 Parity Technologies (UK) Ltd. +// This file is part of substrate-subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with substrate-subxt. If not, see . + use proc_macro2::{ Span, TokenStream, diff --git a/proc-macro/tests/balances.rs b/proc-macro/tests/balances.rs index b5b6f0b30c..3eb3321fe1 100644 --- a/proc-macro/tests/balances.rs +++ b/proc-macro/tests/balances.rs @@ -1,3 +1,19 @@ +// Copyright 2019-2020 Parity Technologies (UK) Ltd. +// This file is part of substrate-subxt. +// +// subxt is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// subxt is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with substrate-subxt. If not, see . + use codec::{ Decode, Encode, diff --git a/src/error.rs b/src/error.rs index 681b2d455c..bda8fbb527 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify diff --git a/src/events.rs b/src/events.rs index b170e1ec48..991b66af5b 100644 --- a/src/events.rs +++ b/src/events.rs @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify @@ -81,7 +81,7 @@ pub enum EventsError { /// Event decoder. pub struct EventsDecoder { - metadata: Metadata, // todo: [AJ] borrow? + metadata: Metadata, type_sizes: HashMap, marker: PhantomData T>, } diff --git a/src/extrinsic.rs b/src/extrinsic.rs index c9c53dce8e..80aad5b8bd 100644 --- a/src/extrinsic.rs +++ b/src/extrinsic.rs @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify diff --git a/src/frame/balances.rs b/src/frame/balances.rs index c597f20b1b..373a500491 100644 --- a/src/frame/balances.rs +++ b/src/frame/balances.rs @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify diff --git a/src/frame/contracts.rs b/src/frame/contracts.rs index 7060749952..e4cd4ee61d 100644 --- a/src/frame/contracts.rs +++ b/src/frame/contracts.rs @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify diff --git a/src/frame/mod.rs b/src/frame/mod.rs index 898031f753..3fca355ee9 100644 --- a/src/frame/mod.rs +++ b/src/frame/mod.rs @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify diff --git a/src/frame/system.rs b/src/frame/system.rs index d3ed9005bc..ac3282931f 100644 --- a/src/frame/system.rs +++ b/src/frame/system.rs @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify diff --git a/src/lib.rs b/src/lib.rs index 61cbe38512..67b521f5a4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify diff --git a/src/metadata.rs b/src/metadata.rs index c4dc6c4562..ae0b67bf56 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify diff --git a/src/rpc.rs b/src/rpc.rs index b2d7183710..a3c0661072 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify @@ -129,8 +129,6 @@ impl Rpc { key: StorageKey, hash: Option, ) -> Result, Error> { - // todo: update jsonrpsee::rpc_api! macro to accept shared Client (currently only RawClient) - // until then we manually construct params here and in other methods let params = Params::Array(vec![to_json_value(key)?, to_json_value(hash)?]); let data: Option = self.client.request("state_getStorage", params).await?; diff --git a/src/runtimes.rs b/src/runtimes.rs index 793aeef2a6..3ced7ce0b5 100644 --- a/src/runtimes.rs +++ b/src/runtimes.rs @@ -1,4 +1,4 @@ -// Copyright 2019 Parity Technologies (UK) Ltd. +// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of substrate-subxt. // // subxt is free software: you can redistribute it and/or modify