Files
pezkuwi-subxt/prdoc/pr_2107.prdoc
T
Francisco Aguirre 0524aa51d3 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 <>
2023-11-08 06:39:40 +01:00

25 lines
498 B
Plaintext

# 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: []