Skip to content

Commit

Permalink
fixes in docs and in imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaurello committed Jan 24, 2025
1 parent c9252e4 commit a78bd24
Show file tree
Hide file tree
Showing 7 changed files with 319 additions and 129 deletions.
2 changes: 1 addition & 1 deletion examples/mrl-simple/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import {
moonbaseAlpha,
peaqAlphanet,
} from '@moonbeam-network/xcm-config';
import type { EvmSigner } from '@moonbeam-network/xcm-sdk';
import { type Asset, EvmChain, Parachain } from '@moonbeam-network/xcm-types';
import { Keyring } from '@polkadot/api';
import { cryptoWaitReady } from '@polkadot/util-crypto';
import { http, type Address, createWalletClient } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import type { EvmSigner } from '../../packages/sdk/build';

const { EVM_PRIVATE_KEY, POLKADOT_PRIVATE_KEY } = process.env;

Expand Down
3 changes: 2 additions & 1 deletion examples/mrl-simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"@moonbeam-network/mrl": "workspace:*",
"@moonbeam-network/xcm-config": "workspace:*",
"@moonbeam-network/xcm-types": "workspace:*",
"@moonbeam-network/xcm-utils": "workspace:*"
"@moonbeam-network/xcm-utils": "workspace:*",
"@moonbeam-network/xcm-sdk": "workspace:*"
},
"devDependencies": {
"bun": "^1.1.31"
Expand Down
6 changes: 3 additions & 3 deletions mkdocs/docs/contribute/xcm.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Assets are listed in alphabetical order. Please make sure you follow this order

## Add a Chain

The next step to support an asset integration is to add chain information for the chains in which your asset can be sent to and from to the [chains configuration file](https://github.com/moonbeam-foundation/xcm-sdk/blob/main/packages/config/src/chains.ts){target=\_blank}.
The next step in supporting a new asset is to add chain information for all the chains to and from which your asset can be transferred. This is done in the [chains configuration file](https://github.com/moonbeam-foundation/xcm-sdk/blob/main/packages/config/src/chains.ts){target=\_blank}.

To add a chain, take the following steps:

Expand Down Expand Up @@ -209,7 +209,7 @@ If they aren't available, feel free to open a PR or [submit an issue on GitHub](

Assuming that all of the required pallets and methods are already supported, you can create the configuration file for the source chain:

1. In the `xcm-sdk/packages/config/src/xcm-configs` directory, add a TypeScript file for the new chain. If the chain already has a configuration file, you can update it instead adding the new routes, go to step 3.
1. In the `xcm-sdk/packages/config/src/xcm-configs` directory, add a TypeScript file for the new chain. If the chain already has a configuration file, you can update it instead by adding the new routes, so you can go directly to step 3.
2. Use the following snippet as a starting point for adding the chain routes:

```ts
Expand Down Expand Up @@ -241,7 +241,7 @@ Assuming that all of the required pallets and methods are already supported, you
},
destinationFee: {
asset: INSERT_DESTINATION_FEE_ASSET, // Optional, if the fee asset in destination have different representation in the source chain
balance: INSERT_DESTINATION_FEE_BALANCE_BUILDER, // The builder function for the balancein the source chain for the asset used for fees in the destination chain
balance: INSERT_DESTINATION_FEE_BALANCE_BUILDER, // The builder function for the balance in the source chain for the asset used for fees in the destination chain
},
min: INSERT_MIN_ASSET_BUILDER, // Optional
},
Expand Down
4 changes: 2 additions & 2 deletions mkdocs/docs/example-usage/mrl.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ To get a list of the supported routes for a particular ecosystem, you can use th

```js
import { Mrl } from '@moonbeam-network/mrl';
import { Ecosystem } from '../../packages/types/build';
import { Ecosystem } from '@moonbeam-network/xcm-types';

const mrlInstance = Mrl({ ecosystem: Ecosystem.Polkadot });
const sources = mrlInstance.sources;
Expand Down Expand Up @@ -146,7 +146,7 @@ To get started, you'll use the [`Mrl`](../reference/mrl.md#the-mrl-method) funct

```js
import { Mrl } from '@moonbeam-network/mrl';
import { Ecosystem } from '../../packages/types/build';
import { Ecosystem } from '@moonbeam-network/xcm-types';

const mrlInstance = Mrl({ ecosystem: Ecosystem.Polkadot });
```
Expand Down
13 changes: 7 additions & 6 deletions mkdocs/docs/example-usage/xcm.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ To get a list of the supported assets for a particular ecosystem, you can pass i

```js
import { Sdk } from '@moonbeam-network/xcm-sdk';
import { Ecosystem } from '../../packages/types/build';
import { Ecosystem } from '@moonbeam-network/xcm-types';

const sdkInstance = Sdk({ ecosystem: Ecosystem.Polkadot });
const assets = sdkInstance.assets;
Expand All @@ -215,7 +215,7 @@ To get a list of the supported [source and destination](../reference/xcm.md#tran

```js
import { Sdk } from '@moonbeam-network/xcm-sdk';
import { Ecosystem } from '../../packages/types/build';
import { Ecosystem } from '@moonbeam-network/xcm-types';

const sdkInstance = Sdk({ ecosystem: Ecosystem.Polkadot });
const assets = sdkInstance.assets;
Expand Down Expand Up @@ -275,7 +275,7 @@ To get started, you'll use the [`Sdk`](../reference/xcm.md#the-sdk-method) metho

```js
import { Sdk } from '@moonbeam-network/xcm-sdk';
import { Ecosystem } from '../../packages/types/build';
import { Ecosystem } from '@moonbeam-network/xcm-types';

const sdkInstance = Sdk({ ecosystem: Ecosystem.Polkadot });
```
Expand All @@ -288,7 +288,7 @@ The chained methods will provide data on the assets and chains along the way, bu
const { assets, setAsset } = sdkInstance;
```

2. Call the `setAasset` function and pass in the key or asset object (which includes the key and the origin symbol) to define the asset to be transferred. For example:
2. Call the `setAsset` function and pass in the key or asset object (which includes the key and the origin symbol) to define the asset to be transferred. For example:

```js
import { dot } from '@moonbeam-network/xcm-config';
Expand All @@ -313,7 +313,7 @@ The chained methods will provide data on the assets and chains along the way, bu

This will return a list of the supported destination chains where there is an open XCM channel from the source chain for the given asset and the [`setDestination`](../reference/xcm.md#the-sdk-method) function, which is used to define the destination chain to transfer the asset to.

4. Call the `setDestination` function and pass in the the chain key or chain object (which includes the key, name, and chain type). For example:
4. Call the `setDestination` function and pass in the chain key or chain object (which includes the key, name, and chain type). For example:

```js
// Using the key
Expand All @@ -329,7 +329,8 @@ An example of the steps described above to build the transfer data to transfer D
```js
import { dot, moonbeam, polkadot } from '@moonbeam-network/xcm-config';
import { Sdk } from '@moonbeam-network/xcm-sdk';
import { Ecosystem } from '../../packages/types/build';
import { Ecosystem } from '@moonbeam-network/xcm-types';
const fromPolkadot = async () => {
const sdkInstance = Sdk({ ecosystem: Ecosystem.Polkadot });
Expand Down
6 changes: 3 additions & 3 deletions mkdocs/docs/reference/xcm.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ It extends the `Asset` object and adds properties related to the asset informati
- `min` ++"bigint"++ - The minimum amount of the asset that can be transferred
- `symbol` ++"string"++ - The symbol of the asset in the chain, if different from the origin symbol

It contains methods to get the differnet asset's ids in the chain, and some utility methods, among which:
It contains methods to get the different asset's ids in the chain, and some utility methods, among which:

- `fromAsset` - Creates a new `ChainAsset` object using an `Asset` object as a base
- `copyWith` - Creates a new `ChainAsset` object copy, with the specified properties
Expand Down Expand Up @@ -187,7 +187,7 @@ It includes builders for the queries to get the balances, fees, which asset is u
</div>

```js title="Example"
// Assert route for DOT from Polkadot to Moonbeam
// Asset route for DOT from Polkadot to Moonbeam
{
source: {
asset: dot,
Expand Down Expand Up @@ -786,7 +786,7 @@ const data = await Sdk()
<div class="grid" markdown>
<div markdown>

`toDecimal()` - Converts an asset amount to a decimal string. Useful for hanlding amounts in Wei and presenting them in a more readable format.
`toDecimal()` - Converts an asset amount to a decimal string. Useful for handling amounts in Wei and presenting them in a more readable format.

**Parameters**

Expand Down
Loading

0 comments on commit a78bd24

Please sign in to comment.