Module offchain
Expand description
Module helpers for off-chain calls.
§Overview
This module provides transaction related helpers to:
- Submit a raw unsigned transaction
- Submit an unsigned transaction with a signed payload
- Submit a signed transaction.
§Usage
Please refer to example-offchain-worker
for
a concrete example usage of this crate.
§Submit a raw unsigned transaction
To submit a raw unsigned transaction, SubmitTransaction
can be used.
§Signing transactions
To be able to use signing, the following trait should be implemented:
AppCrypto
: where an application-specific key is defined and can be used by this module’s helpers for signing.CreateSignedTransaction
: where the manner in which the transaction is constructed is defined.
§Submit an unsigned transaction with a signed payload
Initially, a payload instance that implements the SignedPayload
trait should be defined.
See PricePayload
The payload type that is defined defined can then be signed and submitted onchain.
§Submit a signed transaction
Signer
can be used to sign/verify payloads
Structs§
- Account
- Details of an account for which a private key is contained in the keystore.
- ForAll
- Marker struct used to flag using all supported keys to sign a payload.
- ForAny
- Marker struct used to flag using any of the supported keys to sign a payload.
- Signer
- Provides an implementation for signing transaction payloads.
- Submit
Transaction - Provides the ability to directly submit signed and unsigned transaction onchain.
Traits§
- AppCrypto
- A type binding runtime-level
Public/Signature
pair with crypto wrapped byRuntimeAppPublic
. - Create
Authorized Transaction - Interface for creating a transaction for a call that will be authorized.
- Create
Bare - Interface for creating a bare extrinsic.
- Create
Inherent - Interface for creating a bare extrinsic.
- Create
Signed Transaction - Interface for creating an old-school signed transaction.
- Create
Transaction - Interface for creating a transaction.
- Create
Transaction Base - Common interface for the
CreateTransaction
trait family to unify theCall
type. - Send
Signed Transaction - Submit a signed transaction to the transaction pool.
- Send
Unsigned Transaction - Submit an unsigned transaction onchain with a signed payload
- Sign
Message - A message signer.
- Signed
Payload - Utility trait to be implemented on payloads that can be signed.
- Signing
Types - A wrapper around the types which are used for signing.