Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] - remote snippets #231

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6f70fc4
fix: asset transfer api missing links
nhussein11 Dec 3, 2024
f0afa5a
fix: format snippet
nhussein11 Dec 4, 2024
329a3bb
fix: saset transfer api snippets
nhussein11 Dec 4, 2024
5c881ca
fix: typo
nhussein11 Dec 4, 2024
f216419
fix: vbles
nhussein11 Dec 4, 2024
1937b83
fix: config trait for utility pallet
nhussein11 Dec 4, 2024
e7873a3
fix: account snippets
nhussein11 Dec 4, 2024
2e766c2
fix: typo
nhussein11 Dec 16, 2024
fc1ca3d
Update .snippets/code/develop/toolkit/interoperability/asset-transfer…
nhussein11 Dec 16, 2024
8822633
fix: bounding polkadot-sdk references to polkadot-stable2412
nhussein11 Dec 19, 2024
de16373
fix: polkadot js references to v15.0.2
nhussein11 Dec 19, 2024
fad3a3d
fix: adding fungible trait example (#226)
nhussein11 Dec 4, 2024
809afd6
Tutorials > Interoperability > XCM Transfers (#221)
nhussein11 Dec 10, 2024
2e45a80
[FIX] - Adding references to tutorials (#230)
nhussein11 Dec 12, 2024
d6ed591
Tutorials > Polkadot SDK > Parachains > Build Custom Pallet > Build t…
0xLucca Dec 12, 2024
322ddde
fix: hidding polkaVM instances and adding informational banner (#251)
nhussein11 Dec 12, 2024
65164cc
Restructure Get Started section (#246)
0xLucca Dec 12, 2024
8771c21
Tutorials > Polkadot SDK > Parachains > Build Custom Pallet > Pallet …
nhussein11 Dec 12, 2024
e648fa3
changes block-beta mermaid diagrams to flowchart to correct rendering…
dawnkelly09 Dec 13, 2024
daba535
Tutorials: Update parachain tutorial (#234)
CrackTheCode016 Dec 13, 2024
1dcafb1
[FIX] - Refactoring testing section (#248)
nhussein11 Dec 13, 2024
1e8df7f
fix: typo (#258)
nhussein11 Dec 16, 2024
462ca7d
Obtain Coretime Tutorial (#250)
CrackTheCode016 Dec 16, 2024
286ecd0
add pages for legal policies and info (#255)
eshaben Dec 17, 2024
34ae526
fix: replace old links (#260)
0xLucca Dec 17, 2024
443ef31
add script to fix created dates (#259)
eshaben Dec 17, 2024
81df544
Merge dev-pathways into develop/index (#249)
dawnkelly09 Dec 17, 2024
98a01a0
Zero to Hero Tutorial (#254)
0xLucca Dec 17, 2024
dad621d
Merge branch 'master' into nhussein11/fix-remote-snippets
nhussein11 Dec 19, 2024
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

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Options for customizing the claim assets transaction. These options allow you to
??? child "Type `Format`"

```ts
--8<-- 'code/build-on-polkadot/xcm/asset-transfer-api/reference/format.ts'
--8<-- 'https://raw.githubusercontent.com/paritytech/asset-transfer-api/refs/tags/v0.3.1/src/types.ts:122:122'
```

---
Expand Down Expand Up @@ -59,7 +59,13 @@ Options for customizing the claim assets transaction. These options allow you to

??? child "Type `AssetTransferType`"

--8<-- 'code/build-on-polkadot/xcm/asset-transfer-api/reference/asset-transfer-type.md'
```ts
--8<-- 'https://raw.githubusercontent.com/paritytech/asset-transfer-api/refs/tags/v0.3.1/src/types.ts:480:480'
```

!!! note
To use the `assetTransferType` parameter, which is a string, you should use the `AssetTransferType` type as if each of its variants are strings. For example: `assetTransferType = 'LocalReserve'`.


---

Expand All @@ -75,7 +81,12 @@ Options for customizing the claim assets transaction. These options allow you to

??? child "Type `AssetTransferType`"

--8<-- 'code/build-on-polkadot/xcm/asset-transfer-api/reference/asset-transfer-type.md'
```ts
--8<-- 'https://raw.githubusercontent.com/paritytech/asset-transfer-api/refs/tags/v0.3.1/src/types.ts:480:480'
```

!!! note
To use the `feesTransferType` parameter, which is a string, you should use the `AssetTransferType` type as if each of its variants are strings. For example: `feesTransferType = 'LocalReserve'`.

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A promise containing the result of constructing the transaction.
??? child "Type `Format`"

```ts
--8<-- 'code/build-on-polkadot/xcm/asset-transfer-api/reference/format.ts'
--8<-- 'https://raw.githubusercontent.com/paritytech/asset-transfer-api/refs/tags/v0.3.1/src/types.ts:122:122'
```

---
Expand Down Expand Up @@ -109,32 +109,14 @@ A promise containing the result of constructing the transaction.
??? child "Type `Methods`"

```ts
type Methods =
| LocalTransferTypes
| 'transferAssets'
| 'transferAssetsUsingTypeAndThen'
| 'limitedReserveTransferAssets'
| 'limitedTeleportAssets'
| 'transferMultiasset'
| 'transferMultiassets'
| 'transferMultiassetWithFee'
| 'claimAssets';
--8<-- 'https://raw.githubusercontent.com/paritytech/asset-transfer-api/refs/tags/v0.3.1/src/types.ts:153:162'
```

??? child "Type `LocalTransferTypes`"


```ts
type LocalTransferTypes =
| 'assets::transfer'
| 'assets::transferKeepAlive'
| 'foreignAssets::transfer'
| 'foreignAssets::transferKeepAlive'
| 'balances::transfer'
| 'balances::transferKeepAlive'
| 'poolAssets::transfer'
| 'poolAssets::transferKeepAlive'
| 'tokens::transfer'
| 'tokens::transferKeepAlive';
--8<-- 'https://raw.githubusercontent.com/paritytech/asset-transfer-api/refs/tags/v0.3.1/src/types.ts:138:148'
```

---
Expand All @@ -145,4 +127,12 @@ A promise containing the result of constructing the transaction.

??? child "Type `ConstructedFormat<T>`"

--8<-- 'code/build-on-polkadot/xcm/asset-transfer-api/reference/constructed-format.md'
```ts
--8<-- 'https://raw.githubusercontent.com/paritytech/asset-transfer-api/refs/tags/v0.3.1/src/types.ts:127:133'
```

The `ConstructedFormat` type is a conditional type that returns a specific type based on the value of the TxResult `format` field.
nhussein11 marked this conversation as resolved.
Show resolved Hide resolved

- **Payload format** - if the format field is set to `'payload'`, the `ConstructedFormat` type will return a [`GenericExtrinsicPayload`](https://github.com/polkadot-js/api/blob/v15.0.2/packages/types/src/extrinsic/ExtrinsicPayload.ts#L83){target=\_blank}
- **Call format** - if the format field is set to `'call'`, the `ConstructedFormat` type will return a hexadecimal string (`0x${string}`). This is the encoded representation of the extrinsic call
- **Submittable format** - if the format field is set to `'submittable'`, the `ConstructedFormat` type will return a [`SubmittableExtrinsic`](https://github.com/polkadot-js/api/blob/v15.0.2/packages/api-base/src/types/submittable.ts#L56){target=\_blank}. This is a Polkadot.js type that represents a transaction that can be submitted to the blockchain

This file was deleted.

This file was deleted.

18 changes: 9 additions & 9 deletions develop/interoperability/test-and-debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This article explores two indispensable tools for XCM testing, the [XCM Simulato

## XCM Simulator

Setting up a live network with multiple interconnected parachains for XCM testing can be complex and resource-intensive. To address this, the [`xcm-simulator`](https://github.com/paritytech/polkadot-sdk/tree/master/polkadot/xcm/xcm-simulator){target=\_blank} was developed. This versatile tool enables developers to test and experiment with XCM in a controlled, simulated network environment.
Setting up a live network with multiple interconnected parachains for XCM testing can be complex and resource-intensive. To address this, the [`xcm-simulator`](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412/polkadot/xcm/xcm-simulator){target=\_blank} was developed. This versatile tool enables developers to test and experiment with XCM in a controlled, simulated network environment.

The `xcm-simulator` offers a fast and efficient way to test [XCM instructions](https://github.com/polkadot-fellows/xcm-format?tab=readme-ov-file#5-the-xcvm-instruction-set){target=\_blank} against the [`xcm-executor`](https://paritytech.github.io/polkadot-sdk/master/staging_xcm_executor/index.html){target=\_blank}. It serves as an experimental playground for developers, supporting features such as:

Expand All @@ -26,7 +26,7 @@ The `xcm-simulator` achieves this by utilizing mocked runtimes for both the rela

The `xcm-simulator` provides the following macros for building a mocked simulation environment:

- [**`decl_test_relay_chain`**](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-simulator/src/lib.rs#L110C14-L110C35){target=\_blank} - implements upward message passing (UMP) for the specified relay chain struct. The struct must define the XCM configuration for the relay chain:
- [**`decl_test_relay_chain`**](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/polkadot/xcm/xcm-simulator/src/lib.rs#L110C14-L110C35){target=\_blank} - implements upward message passing (UMP) for the specified relay chain struct. The struct must define the XCM configuration for the relay chain:

```rust
decl_test_relay_chain! {
Expand All @@ -38,10 +38,10 @@ The `xcm-simulator` provides the following macros for building a mocked simulati
}
```

The [`relay_ext()`](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-simulator/example/src/lib.rs#L117C1-L139C2){target=\_blank} sets up a test environment for the relay chain with predefined storage, then returns a [`TestExternalities`](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_frame/testing_prelude/type.TestExternalities.html){target=\_blank} instance for further testing.
The [`relay_ext()`](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/polkadot/xcm/xcm-simulator/example/src/lib.rs#L117C1-L139C2){target=\_blank} sets up a test environment for the relay chain with predefined storage, then returns a [`TestExternalities`](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_frame/testing_prelude/type.TestExternalities.html){target=\_blank} instance for further testing.


- [**`decl_test_parachain`**](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-simulator/src/lib.rs#L180){target=\_blank} - implements the [`XcmMessageHandlerT`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator/trait.XcmpMessageHandlerT.html){target=\_blank} and [`DmpMessageHandlerT`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator/trait.DmpMessageHandlerT.html){target=\_blank} traits for the specified parachain struct. Requires the parachain struct to include the `XcmpMessageHandler` and `DmpMessageHandler` pallets, which define the logic for processing messages (implemented through [`mock_message_queue`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator/mock_message_queue/index.html){target=\_blank}). The patter must be the following:
- [**`decl_test_parachain`**](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/polkadot/xcm/xcm-simulator/src/lib.rs#L180){target=\_blank} - implements the [`XcmMessageHandlerT`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator/trait.XcmpMessageHandlerT.html){target=\_blank} and [`DmpMessageHandlerT`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator/trait.DmpMessageHandlerT.html){target=\_blank} traits for the specified parachain struct. Requires the parachain struct to include the `XcmpMessageHandler` and `DmpMessageHandler` pallets, which define the logic for processing messages (implemented through [`mock_message_queue`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator/mock_message_queue/index.html){target=\_blank}). The patter must be the following:

```rust
decl_test_parachain! {
Expand All @@ -54,12 +54,12 @@ The `xcm-simulator` provides the following macros for building a mocked simulati
}
```

The [`para_ext(para_id: u32)`](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-simulator/example/src/lib.rs#L97C1-L115C2){target=\_blank} function initializes a test environment for a parachain with a specified `para_id`, sets the initial configuration of the parachain, returning a [`TestExternalities`](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_frame/testing_prelude/type.TestExternalities.html){target=\_blank} instance for testing.
The [`para_ext(para_id: u32)`](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/polkadot/xcm/xcm-simulator/example/src/lib.rs#L97C1-L115C2){target=\_blank} function initializes a test environment for a parachain with a specified `para_id`, sets the initial configuration of the parachain, returning a [`TestExternalities`](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_frame/testing_prelude/type.TestExternalities.html){target=\_blank} instance for testing.

!!!note
Developers can take this idea and define as many parachains as they want, like `ParaA`, `ParaB`, `ParaC`, etc

- [**`decl_test_network`**](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-simulator/src/lib.rs#L292){target=\_blank} - defines a testing network consisting of a relay chain and multiple parachains. Takes a network struct as input and implements functionalities for testing, including [`ParachainXcmRouter`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator_example/struct.ParachainXcmRouter.html){target=\_blank} and [`RelayChainXcmRouter`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator_example/struct.RelayChainXcmRouter.html){target=\_blank}. The struct must specify the relay chain and an indexed list of parachains to be included in the network:
- [**`decl_test_network`**](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/polkadot/xcm/xcm-simulator/src/lib.rs#L292){target=\_blank} - defines a testing network consisting of a relay chain and multiple parachains. Takes a network struct as input and implements functionalities for testing, including [`ParachainXcmRouter`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator_example/struct.ParachainXcmRouter.html){target=\_blank} and [`RelayChainXcmRouter`](https://paritytech.github.io/polkadot-sdk/master/xcm_simulator_example/struct.RelayChainXcmRouter.html){target=\_blank}. The struct must specify the relay chain and an indexed list of parachains to be included in the network:

```rust
decl_test_network! {
Expand All @@ -82,7 +82,7 @@ For a complete example of how to use the `xcm-simulator`, explore the [`sample`]

## XCM Emulator

The [`xcm-emulator`](https://github.com/paritytech/polkadot-sdk/tree/master/cumulus/xcm/xcm-emulator){target=\_blank} is a tool designed to simulate the execution of XCM programs using predefined runtime configurations. These configurations include those utilized by live networks like Kusama, Polkadot, and the Asset Hub.
The [`xcm-emulator`](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412/cumulus/xcm/xcm-emulator){target=\_blank} is a tool designed to simulate the execution of XCM programs using predefined runtime configurations. These configurations include those utilized by live networks like Kusama, Polkadot, and the Asset Hub.

This tool enables testing of cross-chain message passing, providing a way to verify outcomes, weights, and side effects efficiently.

Expand All @@ -107,9 +107,9 @@ The XCM Emulator provides both advantages and limitations when testing cross-cha

The `xcm-emulator` package builds upon the functionality provided by the `xcm-simulator` package, offering the same set of macros while extending their capabilities. In addition to the standard features, `xcm-emulator` introduces new tools that make testing cross-chain communication more comprehensive.

One of the key additions is the [`decl_test_bridges`](https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/xcm/xcm-emulator/src/lib.rs#L1178){target=\_blank} macro. This macro allows developers to define and implement mock bridges for testing interoperability in the Polkadot ecosystem.
One of the key additions is the [`decl_test_bridges`](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/cumulus/xcm/xcm-emulator/src/lib.rs#L1178){target=\_blank} macro. This macro allows developers to define and implement mock bridges for testing interoperability in the Polkadot ecosystem.

- [**`decl_test_bridges`**](https://github.com/paritytech/polkadot-sdk/blob/master/cumulus/xcm/xcm-emulator/src/lib.rs#L1178){target=\_blank} - enables the creation of multiple bridges between chains, specifying their source chain, target chain, and the handler responsible for processing messages
- [**`decl_test_bridges`**](https://github.com/paritytech/polkadot-sdk/blob/polkadot-stable2412/cumulus/xcm/xcm-emulator/src/lib.rs#L1178){target=\_blank} - enables the creation of multiple bridges between chains, specifying their source chain, target chain, and the handler responsible for processing messages

```rust
decl_test_bridges! {
Expand Down
2 changes: 1 addition & 1 deletion develop/interoperability/xcm-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The executor is highly configurable, with the [XCM builder](https://paritytech.g

## XCM Executor Configuration

The `Config` trait defines the XCM executor’s configuration, which requires several associated types. Each type has specific trait bounds that the concrete implementation must fulfill. Some types, such as `RuntimeCall`, come with a default implementation in most cases, while others use the unit type `()` as the default. For many of these types, selecting the appropriate implementation carefully is crucial. Predefined solutions and building blocks can be adapted to your specific needs. These solutions can be found in the [`xcm-builder`](https://github.com/paritytech/polkadot-sdk/tree/master/polkadot/xcm/xcm-builder){target=\_blank} folder.
The `Config` trait defines the XCM executor’s configuration, which requires several associated types. Each type has specific trait bounds that the concrete implementation must fulfill. Some types, such as `RuntimeCall`, come with a default implementation in most cases, while others use the unit type `()` as the default. For many of these types, selecting the appropriate implementation carefully is crucial. Predefined solutions and building blocks can be adapted to your specific needs. These solutions can be found in the [`xcm-builder`](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412/polkadot/xcm/xcm-builder){target=\_blank} folder.

Each type is explained below, along with an overview of some of its implementations:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ At its core, the `Config` trait typically looks like this:
This basic structure shows that every pallet must define certain types, such as `RuntimeEvent` and `WeightInfo`, to function within the runtime. The actual implementation can vary depending on the pallet’s specific needs.

??? "Example - Utility Pallet"
For instance, in the [`utility pallet`](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/utility){target=\_blank}, the `Config` trait is implemented with the following types:
For instance, in the [`utility pallet`](https://github.com/paritytech/polkadot-sdk/tree/polkadot-stable2412/substrate/frame/utility){target=\_blank}, the `Config` trait is implemented with the following types:

```rust
--8<-- 'code/develop/parachains/customize-parachain/add-existing-pallets/utility-pallet-config-trait.rs'
Expand Down
Loading