mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 09:15:42 +00:00
Raw payload return SignedPayload struct (#92)
* create SignedPayload struct * align with generic extra updates Co-authored-by: bwty <whalelephant@users.noreply.github.com>
This commit is contained in:
+7
-6
@@ -303,13 +303,14 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Creates raw payload to be signed for the supplied `Call` without private key
|
/// Creates raw payload to be signed for the supplied `Call` without private key
|
||||||
pub async fn create_raw_payload<C>(
|
pub async fn create_raw_payload<C: Encode>(
|
||||||
&self,
|
&self,
|
||||||
account_id: <T as System>::AccountId,
|
account_id: <T as System>::AccountId,
|
||||||
call: Call<C>,
|
call: Call<C>,
|
||||||
) -> Result<Vec<u8>, Error>
|
) -> Result<
|
||||||
where
|
SignedPayload<Encoded, <E as SignedExtra<T>>::Extra>,
|
||||||
C: codec::Encode,
|
Error
|
||||||
|
>
|
||||||
{
|
{
|
||||||
let account_nonce = self.account(account_id).await?.nonce;
|
let account_nonce = self.account(account_id).await?.nonce;
|
||||||
let version = self.runtime_version.spec_version;
|
let version = self.runtime_version.spec_version;
|
||||||
@@ -320,7 +321,7 @@ where
|
|||||||
.and_then(|module| module.call(&call.function, call.args))?;
|
.and_then(|module| module.call(&call.function, call.args))?;
|
||||||
let extra: E = E::new(version, account_nonce, genesis_hash);
|
let extra: E = E::new(version, account_nonce, genesis_hash);
|
||||||
let raw_payload = SignedPayload::new(call, extra.extra())?;
|
let raw_payload = SignedPayload::new(call, extra.extra())?;
|
||||||
Ok(raw_payload.encode())
|
Ok(raw_payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a transaction builder for a private key.
|
/// Create a transaction builder for a private key.
|
||||||
@@ -632,7 +633,7 @@ mod tests {
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
let raw_signature =
|
let raw_signature =
|
||||||
signer_pair.sign(raw_payload.encode().split_off(2).as_slice());
|
signer_pair.sign(raw_payload.encode().as_slice());
|
||||||
let raw_multisig = MultiSignature::from(raw_signature);
|
let raw_multisig = MultiSignature::from(raw_signature);
|
||||||
|
|
||||||
// create signature with Xtbuilder
|
// create signature with Xtbuilder
|
||||||
|
|||||||
Reference in New Issue
Block a user