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

Miguel/nalgebra dep #183

Merged
merged 9 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
3,149 changes: 1,749 additions & 1,400 deletions Cargo.lock

Large diffs are not rendered by default.

15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ frame-system-rpc-runtime-api = { path = "pallets/system/rpc/runtime-api" }
frame-system-benchmarking = { path = "pallets/system/benchmarking" }

# DA Primitives
da-primitives = { version = "0.4", git="https://github.com/availproject/avail-core", tag = "da-primitives/v0.4.7" }
kate = { version = "0.7", git="https://github.com/availproject/avail-core", tag = "da-primitives/v0.4.7" }
kate-recovery = { version = "0.8", git="https://github.com/availproject/avail-core", tag = "da-primitives/v0.4.7" }
avail-core = { version = "0.5", git="https://github.com/availproject/avail-core", tag = "avail-core/v0.5.0" }
kate = { version = "0.8", git="https://github.com/availproject/avail-core", tag = "avail-core/v0.5.0" }
kate-recovery = { version = "0.9", git="https://github.com/availproject/avail-core", tag = "avail-core/v0.5.0" }

# Nomad
nomad-signature = { version = "0.1", git="https://github.com/availproject/avail-core", tag = "da-primitives/v0.4.7" }
nomad-merkle = { version = "0.1", git="https://github.com/availproject/avail-core", tag = "da-primitives/v0.4.7" }
nomad-base = { version = "0.1", git="https://github.com/availproject/avail-core", tag = "da-primitives/v0.4.7" }
nomad-core = { version = "0.1", git="https://github.com/availproject/avail-core", tag = "da-primitives/v0.4.7" }
nomad-signature = { version = "0.1", git="https://github.com/availproject/avail-core", tag = "avail-core/v0.5.0" }
nomad-merkle = { version = "0.1", git="https://github.com/availproject/avail-core", tag = "avail-core/v0.5.0" }
nomad-base = { version = "0.1", git="https://github.com/availproject/avail-core", tag = "avail-core/v0.5.0" }
nomad-core = { version = "0.1", git="https://github.com/availproject/avail-core", tag = "avail-core/v0.5.0" }

# Other stuff
uint = { git = "https://github.com/paritytech/parity-common.git", tag = "rlp-v0.5.2" }
Expand Down Expand Up @@ -127,6 +127,7 @@ pallet-child-bounties = { git = "https://github.com/paritytech/substrate.git", b
pallet-preimage = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37" }
pallet-nomination-pools = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37" }
pallet-election-provider-support-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37" }
substrate-wasm-builder = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.37" }



Expand Down
17 changes: 9 additions & 8 deletions avail-subxt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
name = "avail-subxt"
version = "0.2.1"
version = "0.3.0"
authors = ["Luka Borkovic <[email protected]>"]
edition = "2021"
license = "Apache-2.0"

[lib]
name = "avail_subxt"
Expand All @@ -26,12 +27,12 @@ curve25519-dalek = "2.1.3"
schnorrkel = "0.9.1"

# Substrate
subxt = "0.27"
sp-core = { version = "16.0.0", default-features = false }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "full", "bit-vec"] }
serde = { version = "1.0", features = ["derive"] }
subxt = "0.29"
sp-core = { version = "*", default-features = false }
codec = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full", "bit-vec"] }
serde = { version = "1", features = ["derive"] }
serde-hex = "0.1"
scale-info = { version = "2.0.0", features = ["bit-vec"] }
scale-info = { version = "2", features = ["bit-vec"] }


[dev-dependencies]
Expand All @@ -47,12 +48,12 @@ indicatif = "0.17"


# Substrate
sp-keyring = "18.0.0"
sp-keyring = "*"

[features]
default = ["api-dev", "std"]
api-dev = []
api-main = []
std = [ "sp-core/std"]
std = [ "sp-core/std", "codec/std"]

[workspace]
53 changes: 28 additions & 25 deletions avail-subxt/build_api.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
#!/bin/sh
echo "⛓ Installing SubXt..."
cargo install --git https://github.com/paritytech/subxt --tag v0.27.1 || true
cargo install --git https://github.com/paritytech/subxt --tag v0.29.0 subxt-cli || true
echo "🔨 Generating Avail-SubXt API from localhost..."
subxt codegen \
--derive Clone \
--derive PartialEq \
--derive Eq \
--derive-for-type da_primitives::header::extension::HeaderExtension=serde::Serialize \
--derive-for-type da_primitives::header::extension::HeaderExtension=serde::Deserialize \
--derive-for-type da_primitives::header::extension::v1::HeaderExtension=serde::Serialize \
--derive-for-type da_primitives::header::extension::v1::HeaderExtension=serde::Deserialize \
--derive-for-type da_primitives::header::extension::v1::HeaderExtension=Default \
--derive-for-type da_primitives::header::extension::v2::HeaderExtension=serde::Serialize \
--derive-for-type da_primitives::header::extension::v2::HeaderExtension=serde::Deserialize \
--derive-for-type da_primitives::header::extension::v2::HeaderExtension=Default \
--derive-for-type da_primitives::kate_commitment::v1::KateCommitment=serde::Serialize \
--derive-for-type da_primitives::kate_commitment::v1::KateCommitment=serde::Deserialize \
--derive-for-type da_primitives::kate_commitment::v1::KateCommitment=Default \
--derive-for-type da_primitives::kate_commitment::v2::KateCommitment=serde::Serialize \
--derive-for-type da_primitives::kate_commitment::v2::KateCommitment=serde::Deserialize \
--derive-for-type da_primitives::kate_commitment::v2::KateCommitment=Default \
--derive-for-type da_primitives::asdr::data_lookup::DataLookup=serde::Serialize \
--derive-for-type da_primitives::asdr::data_lookup::DataLookup=serde::Deserialize \
--derive-for-type da_primitives::asdr::data_lookup::DataLookup=Default \
--derive-for-type da_primitives::asdr::data_lookup::DataLookupIndexItem=serde::Serialize \
--derive-for-type da_primitives::asdr::data_lookup::DataLookupIndexItem=serde::Deserialize \
--derive-for-type da_primitives::asdr::AppId=serde::Serialize \
--derive-for-type da_primitives::asdr::AppId=serde::Deserialize \
--derive-for-type da_primitives::asdr::AppId=Default \
--derive-for-type da_primitives::asdr::AppId=Copy \
--derive-for-type da_primitives::asdr::AppId=derive_more::From \
--derive-for-type avail_core::header::extension::HeaderExtension=serde::Serialize \
--derive-for-type avail_core::header::extension::HeaderExtension=serde::Deserialize \
--derive-for-type avail_core::header::extension::v1::HeaderExtension=serde::Serialize \
--derive-for-type avail_core::header::extension::v1::HeaderExtension=serde::Deserialize \
--derive-for-type avail_core::header::extension::v1::HeaderExtension=Default \
--derive-for-type avail_core::header::extension::v2::HeaderExtension=serde::Serialize \
--derive-for-type avail_core::header::extension::v2::HeaderExtension=serde::Deserialize \
--derive-for-type avail_core::header::extension::v2::HeaderExtension=Default \
--derive-for-type avail_core::kate_commitment::v1::KateCommitment=serde::Serialize \
--derive-for-type avail_core::kate_commitment::v1::KateCommitment=serde::Deserialize \
--derive-for-type avail_core::kate_commitment::v1::KateCommitment=Default \
--derive-for-type avail_core::kate_commitment::v2::KateCommitment=serde::Serialize \
--derive-for-type avail_core::kate_commitment::v2::KateCommitment=serde::Deserialize \
--derive-for-type avail_core::kate_commitment::v2::KateCommitment=Default \
--derive-for-type avail_core::data_lookup::DataLookup=serde::Serialize \
--derive-for-type avail_core::data_lookup::DataLookup=serde::Deserialize \
--derive-for-type avail_core::data_lookup::DataLookup=Default \
--derive-for-type avail_core::data_lookup::compact::CompactDataLookup=Default \
--derive-for-type avail_core::data_lookup::compact::CompactDataLookup=serde::Serialize \
--derive-for-type avail_core::data_lookup::compact::CompactDataLookup=serde::Deserialize \
--derive-for-type avail_core::data_lookup::compact::DataLookupItem=serde::Serialize \
--derive-for-type avail_core::data_lookup::compact::DataLookupItem=serde::Deserialize \
--derive-for-type avail_core::AppId=serde::Serialize \
--derive-for-type avail_core::AppId=serde::Deserialize \
--derive-for-type avail_core::AppId=Default \
--derive-for-type avail_core::AppId=Copy \
--derive-for-type avail_core::AppId=derive_more::From \
--url http://localhost:9933 \
| sed -En "s/pub struct KateCommitment/#\[serde\(rename_all = \"camelCase\"\)\] \0/p" \
| sed -E '1i \#\[allow(clippy::all)]' \
Expand Down
12 changes: 7 additions & 5 deletions avail-subxt/examples/accounts_from_mnemonics.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use anyhow::Result;
use avail_subxt::{api, build_client, primitives::AvailExtrinsicParams, AvailConfig, Opts};
use sp_core::crypto::Pair as _;
use sp_keyring::sr25519::sr25519::{self, Pair};
use structopt::StructOpt;
use subxt::{tx::PairSigner, utils::MultiAddress};
use subxt::{
ext::sp_core::{sr25519::Pair, Pair as _},
tx::PairSigner,
utils::MultiAddress,
};

/// This example demonstrates using mnemonic seed for generating signer pairs. It creates Alice and Bob
/// from seeds, but could also be used for an arbitrary account.
Expand All @@ -18,9 +20,9 @@ async fn main() -> Result<()> {

// Accounts
let pair_a = Pair::from_string_with_seed(ALICE_SEED, None).unwrap();
let signer_a = PairSigner::<AvailConfig, sr25519::Pair>::new(pair_a.0);
let signer_a = PairSigner::<AvailConfig, Pair>::new(pair_a.0);
let pair_b = Pair::from_string_with_seed(BOB_SEED, None).unwrap();
let signer_b = PairSigner::<AvailConfig, sr25519::Pair>::new(pair_b.0);
let signer_b = PairSigner::<AvailConfig, Pair>::new(pair_b.0);

// Transfer and wait finalized
let balance_transfer = api::tx()
Expand Down
6 changes: 3 additions & 3 deletions avail-subxt/examples/da_bridge_actor.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
use anyhow::Result;
use avail_subxt::{
api::{
self, data_availability::calls::SubmitData,
self, data_availability::calls::types::SubmitData,
runtime_types::sp_core::bounded::bounded_vec::BoundedVec,
},
build_client, Opts,
};
use sp_keyring::AccountKeyring::Alice;
use structopt::StructOpt;
use subxt::{
tx::{PairSigner, StaticTxPayload},
tx::{PairSigner, Payload},
utils::H160,
};

const DESTINATION_DOMAIN: u32 = 1000;
const DA_BRIDGE_ROUTER_ADDRESS: &str = "0x3f28a3e66326c3aa494d4f8e9477d1397ee94432";

fn submit_some_data() -> Result<StaticTxPayload<SubmitData>> {
fn submit_some_data() -> Result<Payload<SubmitData>> {
let data = BoundedVec(b"Test Data".to_vec());
let submit_data_tx = api::tx().data_availability().submit_data(data);
Ok(submit_data_tx)
Expand Down
Loading