mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 22:45:40 +00:00
XCM builder pattern (#2107)
Added a proc macro to be able to write XCMs using the builder pattern.
This means we go from having to do this:
```rust
let message: Xcm<()> = Xcm(vec![
WithdrawAsset(assets),
BuyExecution { fees: asset, weight_limit: Unlimited },
DepositAsset { assets, beneficiary },
]);
```
to this:
```rust
let message: Xcm<()> = Xcm::builder()
.withdraw_asset(assets)
.buy_execution(asset, Unlimited),
.deposit_asset(assets, beneficiary)
.build();
```
---------
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: command-bot <>
This commit is contained in:
committed by
GitHub
parent
8ebb5c3319
commit
0524aa51d3
@@ -0,0 +1,24 @@
|
||||
# Schema: Parity PR Documentation Schema (prdoc)
|
||||
# See doc at https://github.com/paritytech/prdoc
|
||||
|
||||
title: Add a builder pattern to create XCM programs
|
||||
|
||||
doc:
|
||||
- audience: Core Dev
|
||||
description: |
|
||||
XCMs can now be built using a builder pattern like so:
|
||||
Xcm::builder()
|
||||
.withdraw_asset(assets)
|
||||
.buy_execution(fees, weight_limit)
|
||||
.deposit_asset(assets, beneficiary)
|
||||
.build();
|
||||
|
||||
migrations:
|
||||
db: []
|
||||
|
||||
runtime: []
|
||||
|
||||
crates:
|
||||
- name: xcm
|
||||
|
||||
host_functions: []
|
||||
Reference in New Issue
Block a user