26 releases (major breaking)
22.0.0 | Apr 3, 2025 |
---|---|
21.1.0 | Mar 27, 2025 |
21.0.0 | Jan 13, 2025 |
20.0.0 | Sep 26, 2024 |
0.1.0-dev.2 | Jul 27, 2023 |
#67 in #payment
13,486 downloads per month
Used in 40 crates
(4 directly)
3MB
48K
SLoC
Asset Conversion Transaction Payment Pallet
This pallet allows runtimes that include it to pay for transactions in assets other than the chain's native asset.
Overview
This pallet provides a TransactionExtension
with an optional AssetId
that specifies the
asset to be used for payment (defaulting to the native token on None
). It expects an
OnChargeAssetTransaction
implementation analogous to pallet-transaction-payment
. The
included SwapAssetAdapter
(implementing OnChargeAssetTransaction
) determines the
fee amount by converting the fee calculated by pallet-transaction-payment
in the native
asset into the amount required of the specified asset.
Pallet API
This pallet does not have any dispatchable calls or storage. It wraps FRAME's Transaction
Payment pallet and functions as a replacement. This means you should include both pallets in
your construct_runtime
macro, but only include this pallet's TransactionExtension
(ChargeAssetTxPayment
).
Terminology
- Native Asset or Native Currency: The asset that a chain considers native, as in its default for transaction fee payment, deposits, inflation, etc.
- Other assets: Other assets that may exist on chain, for example under the Assets pallet.
pallet-asset-conversion-tx-payment
Asset Conversion Transaction Payment Pallet
This pallet allows runtimes that include it to pay for transactions in assets other than the native token of the chain.
Overview
It does this by extending transactions to include an optional AssetId
that specifies the asset
to be used for payment (defaulting to the native token on None
). It expects an
OnChargeAssetTransaction
implementation analogously to pallet-transaction-payment
. The
included AssetConversionAdapter
(implementing OnChargeAssetTransaction
) determines the fee
amount by converting the fee calculated by pallet-transaction-payment
into the desired
asset.
Integration
This pallet wraps FRAME's transaction payment pallet and functions as a replacement. This means
you should include both pallets in your construct_runtime
macro, but only include this
pallet's TransactionExtension
(ChargeAssetTxPayment
).
License: Apache-2.0
Dependencies
~20–35MB
~589K SLoC