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

Merged
merged 38 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 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
23d2465
Update develop/toolkit/interoperability/asset-transfer-api/reference.md
nhussein11 Jan 8, 2025
026a76b
Update develop/toolkit/interoperability/asset-transfer-api/reference.md
nhussein11 Jan 8, 2025
0369f5a
Update tutorials/polkadot-sdk/system-chains/asset-hub/asset-conversio…
nhussein11 Jan 8, 2025
6846f35
fix: polkadot sdk links attached to variable
nhussein11 Jan 8, 2025
db2b6e8
fix: polkadot js api links atttached to variable now
nhussein11 Jan 8, 2025
465eb02
Apply suggestions from code review
nhussein11 Jan 20, 2025
b04545d
fix: removing unnecessary image
nhussein11 Jan 20, 2025
8ae9eb4
Update develop/interoperability/test-and-debug.md
nhussein11 Jan 20, 2025
128682a
fix: update link to Pallet Testing article in test-and-debug document…
nhussein11 Jan 20, 2025
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/{{ dependencies.polkadot_js_api.version}}/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/{{ dependencies.polkadot_js_api.version}}/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.

20 changes: 10 additions & 10 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/{{dependencies.polkadot_sdk.stable_version}}/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/{{dependencies.polkadot_sdk.stable_version}}/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/{{dependencies.polkadot_sdk.stable_version}}/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/{{dependencies.polkadot_sdk.stable_version}}/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 pattern 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/{{dependencies.polkadot_sdk.stable_version}}/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/{{dependencies.polkadot_sdk.stable_version}}/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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't click it here to leave a suggestion but the next paragraphs contain an error:

For guidance on implementing a mock runtime for a Polkadot SDK-based chain, refer to the [Pallet Testing](/develop/parachains/customize-parachain/pallet-testing/){target=\_blank} article. This framework enables thorough testing of runtime and cross-chain interactions.

The link to Pallet Testing is returning 404. Please investigate. Thank you!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 128682a


```rust
decl_test_network! {
Expand All @@ -75,14 +75,14 @@ The `xcm-simulator` provides the following macros for building a mocked simulati

By leveraging these macros, developers can customize their testing networks by defining relay chains and parachains tailored to their needs.

For guidance on implementing a mock runtime for a Polkadot SDK-based chain, refer to the [Pallet Testing](/develop/parachains/customize-parachain/pallet-testing/){target=\_blank} article. This framework enables thorough testing of runtime and cross-chain interactions.
For guidance on implementing a mock runtime for a Polkadot SDK-based chain, refer to the [Pallet Testing](/develop/parachains/testing/pallet-testing/){target=\_blank} article. This framework enables thorough testing of runtime and cross-chain interactions.

For a complete example of how to use the `xcm-simulator`, explore the [`sample`](https://github.com/paritytech/polkadot-sdk/tree/master/polkadot/xcm/xcm-simulator/example){target=\_blank} provided in the `xcm-simulator` codebase.


## 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/{{dependencies.polkadot_sdk.stable_version}}/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/{{dependencies.polkadot_sdk.stable_version}}/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/{{dependencies.polkadot_sdk.stable_version}}/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
Loading
Loading