
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@moonbeam-network/xcm-sdk
Advanced tools
The Moonbeam XCM SDK enables developers to easily deposit and withdraw assets to Moonbeam/Moonriver from the relay chain and other parachains in the Polkadot/Kusama ecosystem
The Moonbeam XCM SDK enables developers to easily transfer assets between chains, either between parachains or between a parachain and the relay chain, within the Polkadot/Kusama ecosystem. With the SDK, you don't need to worry about determining the multilocation of the origin or destination assets or which extrinsics are used on which networks to send XCM transfers.
The XCM SDK offers helper functions that provide a very simple interface to execute XCM transfers between chains in the Polkadot/Kusama ecosystem. In addition, the XCM config package allows any parachain project to add their information in a standard way, so they can be immediately supported by the XCM SDK.
You can find the documentation at https://moonbeam-foundation.github.io/xcm-sdk/latest/.
npm i @moonbeam-network/xcm-sdk
:warning: You need to have peer dependencies of SDK installed as well.
npm i @polkadot/api @polkadot/util-crypto
The following sections contain basic examples of how to work with the XCM SDK to build transfer data to transfer an asset from one chain to another and how to submit the transfer. For a detailed overview on how to use it, please refer to the XCM SDK docs.
import { Sdk } from '@moonbeam-network/xcm-sdk';
const fromPolkadot = async () => {
const transferData = await Sdk()
.setAsset(dot)
.setSource(polkadot)
.setDestination(moonbeam)
.setAddresses({
sourceAddress: pair.address,
destinationAddress: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
});
};
fromPolkadot();
...
const hash = await data.transfer({
amount: 1,
signers: { polkadotSigner: pair }, // Insert the signer, in this case a Substrate key pair
});
git clone git@github.com:moonbeam-foundation/xcm-sdk.git
cd xcm-sdk
pnpm install
cd examples/sdk-simple
# edit index.ts by adding your accounts
pnpm run start
First fork the repository and clone it.
git clone git@github.com:YOUR_GITHUB_USERNAME/xcm-sdk.git
pnpm install
Optionally, you can install the pre-commit hook to run the linter and tests before committing:
pnpm lefthook install
pnpm run test
pnpm run test:acc
To create a dev version go to GitHub actions and run publish dev versions workflow.
To create a release version run:
pnpm run changeset
Build the project:
pnpm run build
Link the SDK:
pnpm run clean && pnpm run build && pnpm run link
In your project where you would like to test the changes:
pnpm link @moonbeam-network/xcm-types @moonbeam-network/xcm-utils @moonbeam-network/xcm-builder @moonbeam-network/xcm-config @moonbeam-network/xcm-sdk
If you need you can link other packages too.
After testing is done, unlink the SDK:
pnpm unlink @moonbeam-network/xcm-types @moonbeam-network/xcm-utils @moonbeam-network/xcm-builder @moonbeam-network/xcm-config @moonbeam-network/xcm-sdk
FAQs
The Moonbeam XCM SDK enables developers to easily deposit and withdraw assets to Moonbeam/Moonriver from the relay chain and other parachains in the Polkadot/Kusama ecosystem
The npm package @moonbeam-network/xcm-sdk receives a total of 555 weekly downloads. As such, @moonbeam-network/xcm-sdk popularity was classified as not popular.
We found that @moonbeam-network/xcm-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.