mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Various simplifications re: Serai transactions
Removes PairSigner for the pair directly. Resets spec_version to 1. Defines the extrinsic without its length prefix, only prefixing during publish.
This commit is contained in:
@@ -20,7 +20,7 @@ use serai_client::{
|
||||
primitives::{InInstruction, InInstructionWithBalance, Batch},
|
||||
},
|
||||
coins::{primitives::OutInstruction, CoinsEvent},
|
||||
PairSigner, Serai, SeraiCoins,
|
||||
Serai, SeraiCoins,
|
||||
};
|
||||
|
||||
mod common;
|
||||
@@ -91,7 +91,7 @@ serai_test!(
|
||||
serai,
|
||||
&serai
|
||||
.sign(
|
||||
&PairSigner::new(pair),
|
||||
&pair,
|
||||
&SeraiCoins::burn_with_instruction(instruction.clone()),
|
||||
0,
|
||||
Default::default(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use serai_runtime::primitives::{Coin, Amount};
|
||||
|
||||
use serai_client::{Serai, SeraiDex, PairSigner};
|
||||
use serai_client::{Serai, SeraiDex};
|
||||
use sp_core::{sr25519::Pair, Pair as PairTrait};
|
||||
|
||||
use crate::common::tx::publish_tx;
|
||||
@@ -17,7 +17,7 @@ pub async fn add_liquidity(
|
||||
let address = pair.public();
|
||||
|
||||
let tx = serai.sign(
|
||||
&PairSigner::new(pair),
|
||||
&pair,
|
||||
&SeraiDex::add_liquidity(coin, coin_amount, sri_amount, Amount(1), Amount(1), address.into()),
|
||||
nonce,
|
||||
Default::default(),
|
||||
@@ -39,7 +39,7 @@ pub async fn swap(
|
||||
let address = pair.public();
|
||||
|
||||
let tx = serai.sign(
|
||||
&PairSigner::new(pair),
|
||||
&pair,
|
||||
&SeraiDex::swap(from_coin, to_coin, amount_in, amount_out_min, address.into()),
|
||||
nonce,
|
||||
Default::default(),
|
||||
|
||||
@@ -34,7 +34,7 @@ pub async fn publish_tx(serai: &Serai, tx: &[u8]) -> [u8; 32] {
|
||||
};
|
||||
|
||||
for transaction in block.transactions() {
|
||||
if transaction.0 == tx[2 ..] {
|
||||
if transaction.0 == tx {
|
||||
return block.hash();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user