Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub mod in_mem;
#[cfg(feature = "std")]
pub mod genesis;
pub mod block_builder;
pub mod transaction_builder;
#[cfg(feature = "std")]
pub mod light;
#[cfg(feature = "std")]
Expand Down
38 changes: 38 additions & 0 deletions core/client/src/transaction_builder.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright 2019 Parity Technologies (UK) Ltd.
// This file is part of Substrate.

// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Substrate is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

//! The runtime api for building transactions.

use sr_api_macros::decl_runtime_apis;
use runtime_primitives::KeyTypeId;
use rstd::vec::Vec;

decl_runtime_apis! {
/// The `TransactionBuilder` trait that provides required functions
/// for building a transaction from a Call for the runtime.
pub trait TransactionBuilder {
/// Construct the payload.
fn signing_payload(encoded_call: Vec<u8>, encoded_account_id: Vec<u8>) -> Vec<u8>;
/// Build the transaction.
fn build_transaction(
signing_payload: Vec<u8>,
encoded_account_id: Vec<u8>, // TODO: rename to extra_payload?
signature: Vec<u8>,
) -> Vec<u8>;
/// Get list of supported crypto types.
fn possible_crypto() -> Vec<KeyTypeId>;
}
}