mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Replace substrate/client's use of Payload with usage of RuntimeCall
Gains explicit typing.
This commit is contained in:
@@ -3,8 +3,6 @@ use serai_runtime::primitives::{Coin, Amount};
|
||||
use serai_client::{Serai, SeraiDex, PairSigner};
|
||||
use sp_core::{sr25519::Pair, Pair as PairTrait};
|
||||
|
||||
use subxt::config::extrinsic_params::BaseExtrinsicParamsBuilder;
|
||||
|
||||
use crate::common::tx::publish_tx;
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -18,14 +16,12 @@ pub async fn add_liquidity(
|
||||
) -> [u8; 32] {
|
||||
let address = pair.public();
|
||||
|
||||
let tx = serai
|
||||
.sign(
|
||||
&PairSigner::new(pair),
|
||||
&SeraiDex::add_liquidity(coin, coin_amount, sri_amount, Amount(1), Amount(1), address.into()),
|
||||
nonce,
|
||||
BaseExtrinsicParamsBuilder::new(),
|
||||
)
|
||||
.unwrap();
|
||||
let tx = serai.sign(
|
||||
&PairSigner::new(pair),
|
||||
&SeraiDex::add_liquidity(coin, coin_amount, sri_amount, Amount(1), Amount(1), address.into()),
|
||||
nonce,
|
||||
Default::default(),
|
||||
);
|
||||
|
||||
publish_tx(serai, &tx).await
|
||||
}
|
||||
@@ -42,14 +38,12 @@ pub async fn swap(
|
||||
) -> [u8; 32] {
|
||||
let address = pair.public();
|
||||
|
||||
let tx = serai
|
||||
.sign(
|
||||
&PairSigner::new(pair),
|
||||
&SeraiDex::swap(from_coin, to_coin, amount_in, amount_out_min, address.into()),
|
||||
nonce,
|
||||
BaseExtrinsicParamsBuilder::new(),
|
||||
)
|
||||
.unwrap();
|
||||
let tx = serai.sign(
|
||||
&PairSigner::new(pair),
|
||||
&SeraiDex::swap(from_coin, to_coin, amount_in, amount_out_min, address.into()),
|
||||
nonce,
|
||||
Default::default(),
|
||||
);
|
||||
|
||||
publish_tx(serai, &tx).await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user