diff --git a/Cargo.lock b/Cargo.lock index b28f1db9..693d0b2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3718,6 +3718,7 @@ dependencies = [ "futures", "jsonrpsee", "log", + "meta-defichain-rpc", "meta-runtime", "pallet-transaction-payment-rpc", "parity-scale-codec", @@ -3760,6 +3761,8 @@ dependencies = [ "frame-support", "frame-system", "frame-system-rpc-runtime-api", + "meta-defichain", + "meta-defichain-rpc-runtime-api", "pallet-balances", "pallet-base-fee", "pallet-dynamic-fee", diff --git a/meta/meta-node/Cargo.toml b/meta/meta-node/Cargo.toml index 005fbd1a..66f1e64c 100644 --- a/meta/meta-node/Cargo.toml +++ b/meta/meta-node/Cargo.toml @@ -53,8 +53,9 @@ fp-dynamic-fee = { git = "https://github.com/paritytech/frontier.git", branc fp-evm = { git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.27" } fp-rpc = { git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.27" } fp-storage = { git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.27" } -# local packages -meta-runtime = { package = "meta-runtime", path = "../meta-runtime" } +# Local +meta-runtime = { package = "meta-runtime", path = "../meta-runtime" } +meta-defichain-rpc = { package = "meta-defichain-rpc", path = "../meta-defichain/rpc"} [build-dependencies] substrate-build-script-utils = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.27" } diff --git a/meta/meta-node/src/rpc.rs b/meta/meta-node/src/rpc.rs index 1cc30db1..48f3f821 100644 --- a/meta/meta-node/src/rpc.rs +++ b/meta/meta-node/src/rpc.rs @@ -112,6 +112,7 @@ where C::Api: substrate_frame_rpc_system::AccountNonceApi, C::Api: BlockBuilder, C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, + C::Api: meta_defichain_rpc::DefichainRuntimeApi, C::Api: fp_rpc::ConvertTransactionRuntimeApi, C::Api: fp_rpc::EthereumRuntimeRPCApi, P: TransactionPool + 'static, @@ -121,6 +122,7 @@ where Eth, EthApiServer, EthDevSigner, EthFilter, EthFilterApiServer, EthPubSub, EthPubSubApiServer, EthSigner, Net, NetApiServer, Web3, Web3ApiServer, }; + use meta_defichain_rpc::{Defichain, DefichainApiServer}; use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; use substrate_frame_rpc_system::{System, SystemApiServer}; @@ -145,6 +147,7 @@ where module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?; module.merge(TransactionPayment::new(client.clone()).into_rpc())?; + module.merge(Defichain::new(client.clone()).into_rpc())?; let mut signers = Vec::new(); if enable_dev_signer { diff --git a/meta/meta-runtime/Cargo.toml b/meta/meta-runtime/Cargo.toml index 4a59f6ff..53f65e97 100644 --- a/meta/meta-runtime/Cargo.toml +++ b/meta/meta-runtime/Cargo.toml @@ -41,6 +41,9 @@ pallet-dynamic-fee = { default-features = false, git = "https://github.co pallet-ethereum = { default-features = false, git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.27" } pallet-evm = { default-features = false, git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.27" } pallet-evm-chain-id = { default-features = false, git = "https://github.com/paritytech/frontier.git", branch = "polkadot-v0.9.27" } +# Local +meta-defichain = { default-features = false, path = "../meta-defichain", package = "meta-defichain"} +meta-defichain-rpc-runtime-api = { default-features = false, path = "../meta-defichain/rpc/runtime-api", package = "meta-defichain-rpc-runtime-api"} [build-dependencies] substrate-wasm-builder = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.27" } @@ -84,4 +87,7 @@ std = [ "pallet-sudo/std", "pallet-timestamp/std", "pallet-transaction-payment/std", + # Local + "meta-defichain/std", + "meta-defichain-rpc-runtime-api/std", ] diff --git a/meta/meta-runtime/src/lib.rs b/meta/meta-runtime/src/lib.rs index 1db74971..e0545784 100644 --- a/meta/meta-runtime/src/lib.rs +++ b/meta/meta-runtime/src/lib.rs @@ -312,6 +312,11 @@ impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = (); } +impl meta_defichain::Config for Runtime { + type Event = Event; + type Balance = Balance; +} + construct_runtime!( pub enum Runtime where Block = Block, @@ -328,6 +333,7 @@ construct_runtime!( EVMChainId: pallet_evm_chain_id, DynamicFee: pallet_dynamic_fee, BaseFee: pallet_base_fee, + Defichain: meta_defichain, } ); @@ -688,4 +694,10 @@ impl_runtime_apis! { ) } } + + impl meta_defichain_rpc_runtime_api::DefichainApi for Runtime { + fn get_7() -> u64 { + Defichain::get_7() + } + } }