mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
* Use Monero-compatible additional TX keys This still sends a fingerprinting flare up if you send to a subaddress which needs to be fixed. Despite that, Monero no should no longer fail to scan TXs from monero-serai regarding additional keys. Previously it failed becuase we supplied one key as THE key, and n-1 as additional. Monero expects n for additional. This does correctly select when to use THE key versus when to use the additional key when sending. That removes the ability for recipients to fingerprint monero-serai by receiving to a standard address yet needing to use an additional key. * Add tokens_primitives Moves OutInstruction from in-instructions. Turns Destination into OutInstruction. * Correct in-instructions DispatchClass * Add initial tokens pallet * Don't allow pallet addresses to equal identity * Add support for InInstruction::transfer Requires a cargo update due to modifications made to serai-dex/substrate. Successfully mints a token to a SeraiAddress. * Bind InInstructions to an amount * Add a call filter to the runtime Prevents worrying about calls to the assets pallet/generally tightens things up. * Restore Destination It was meged into OutInstruction, yet it didn't make sense for OutInstruction to contain a SeraiAddress. Also deletes the excessively dated Scenarios doc. * Split PublicKey/SeraiAddress Lets us define a custom Display/ToString for SeraiAddress. Also resolves an oddity where PublicKey would be encoded as String, not [u8; 32]. * Test burning tokens/retrieving OutInstructions Modularizes processor_coinUpdates into a shared testing utility. * Misc lint * Don't use PolkadotExtrinsicParams
51 lines
1.3 KiB
Rust
51 lines
1.3 KiB
Rust
use std::sync::Arc;
|
|
|
|
use jsonrpsee::RpcModule;
|
|
|
|
use sp_blockchain::{Error as BlockchainError, HeaderBackend, HeaderMetadata};
|
|
use sp_block_builder::BlockBuilder;
|
|
use sp_api::ProvideRuntimeApi;
|
|
|
|
use serai_runtime::{
|
|
primitives::{SubstrateAmount, PublicKey},
|
|
opaque::Block,
|
|
Index,
|
|
};
|
|
|
|
pub use sc_rpc_api::DenyUnsafe;
|
|
use sc_transaction_pool_api::TransactionPool;
|
|
|
|
pub struct FullDeps<C, P> {
|
|
pub client: Arc<C>,
|
|
pub pool: Arc<P>,
|
|
pub deny_unsafe: DenyUnsafe,
|
|
}
|
|
|
|
pub fn create_full<
|
|
C: ProvideRuntimeApi<Block>
|
|
+ HeaderBackend<Block>
|
|
+ HeaderMetadata<Block, Error = BlockchainError>
|
|
+ Send
|
|
+ Sync
|
|
+ 'static,
|
|
P: TransactionPool + 'static,
|
|
>(
|
|
deps: FullDeps<C, P>,
|
|
) -> Result<RpcModule<()>, Box<dyn std::error::Error + Send + Sync>>
|
|
where
|
|
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, PublicKey, Index>
|
|
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, SubstrateAmount>
|
|
+ BlockBuilder<Block>,
|
|
{
|
|
use substrate_frame_rpc_system::{System, SystemApiServer};
|
|
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
|
|
|
|
let mut module = RpcModule::new(());
|
|
let FullDeps { client, pool, deny_unsafe } = deps;
|
|
|
|
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
|
|
module.merge(TransactionPayment::new(client).into_rpc())?;
|
|
|
|
Ok(module)
|
|
}
|