Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaurello committed Sep 24, 2024
2 parents 00822cf + 59027cf commit 6cddf64
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
32 changes: 16 additions & 16 deletions examples/sdk-simple/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { dot, moonbeam, polkadot } from '@moonbeam-network/xcm-config';
import { Sdk, type TransferData } from '@moonbeam-network/xcm-sdk';
import { Keyring } from '@polkadot/api';
import { cryptoWaitReady } from '@polkadot/util-crypto';
import { http, type Address, createWalletClient } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { dot, moonbeam, polkadot } from "@moonbeam-network/xcm-config";
import { Sdk, type TransferData } from "@moonbeam-network/xcm-sdk";
import { Keyring } from "@polkadot/api";
import { cryptoWaitReady } from "@polkadot/util-crypto";
import { http, type Address, createWalletClient } from "viem";
import { privateKeyToAccount } from "viem/accounts";

// Moonbeam Signer ===========================================================

const moonbeamPrivateKey = '';
const moonbeamPrivateKey = "";
const account = privateKeyToAccount(moonbeamPrivateKey as Address);
const walletClient = createWalletClient({
account,
Expand All @@ -17,12 +17,12 @@ const walletClient = createWalletClient({

// Polkadot Signer ===========================================================

const polkadotPrivateKey = '';
const polkadotPrivateKey = "";

await cryptoWaitReady();
const keyring = new Keyring({
ss58Format: polkadot.ss58Format,
type: 'sr25519',
type: "sr25519",
});
const pair = keyring.createFromUri(polkadotPrivateKey);

Expand All @@ -32,14 +32,14 @@ export function logBalances(data: TransferData): void {
console.log(
`Balance on ${data.source.chain.name} ${data.source.balance.toDecimal()} ${
data.source.balance.symbol
}`,
}`
);
console.log(
`Balance on ${
data.destination.chain.name
} ${data.destination.balance.toDecimal()} ${
data.destination.balance.symbol
}`,
}`
);
}

Expand All @@ -57,12 +57,12 @@ export function logTxDetails(data: TransferData): void {
data.source.chain.name
} and ${data.destination.fee.toDecimal()} ${
data.destination.fee.symbol
} fee on ${data.destination.chain.name}.`,
} fee on ${data.destination.chain.name}.`
);
}

export async function fromPolkadot() {
console.log('\nTransfer from Polkadot to Moonbeam\n');
console.log("\nTransfer from Polkadot to Moonbeam\n");

const data = await Sdk().getTransferData({
destinationAddress: account.address,
Expand All @@ -86,7 +86,7 @@ export async function fromPolkadot() {
}

export async function fromMoonbeam() {
console.log('\nTransfer from Moonbeam to Polkadot\n');
console.log("\nTransfer from Moonbeam to Polkadot\n");

const data = await Sdk()
.assets()
Expand Down Expand Up @@ -118,12 +118,12 @@ async function main() {
console.log(`Polkadot address: ${pair.address}.`);

await fromPolkadot();
console.log('\nWaiting 30 seconds...');
console.log("\nWaiting 30 seconds...");
await setTimeout(30000);
await fromMoonbeam();
}

main()
.then(() => console.log('done!'))
.then(() => console.log("done!"))
.catch(console.error)
.finally(() => process.exit());
6 changes: 6 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @moonbeam-network/xcm-sdk

## 2.5.14

### Patch Changes

- [#348](https://github.com/moonbeam-foundation/xcm-sdk/pull/348) [`61e7143`](https://github.com/moonbeam-foundation/xcm-sdk/commit/61e71430e7826e8450da2bf93e92a3269470b310) Thanks [@mmaurello](https://github.com/mmaurello)! - Fix Ethers contract identification

## 2.5.13

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonbeam-network/xcm-sdk",
"version": "2.5.13",
"version": "2.5.14",
"description": "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",
"scripts": {
"build": "tsup",
Expand Down

0 comments on commit 6cddf64

Please sign in to comment.