Skip to content

Commit

Permalink
MRL types (#211)
Browse files Browse the repository at this point in the history
* add mrl types to polkadot api

* add changeset

* update moonbase beta endpoint

* export getTransferData.utils functions
  • Loading branch information
mmaurello authored Mar 20, 2024
1 parent db146f4 commit 3ade51f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/new-tools-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@moonbeam-network/xcm-utils': patch
---

Add MRL types to polkadot API
2 changes: 1 addition & 1 deletion packages/config/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ export const moonbaseBeta = new EvmParachain({
parachainId: 888,
rpc: 'https://frag-moonbase-beta-rpc.g.moonbase.moonbeam.network',
ss58Format: 1287,
ws: 'wss://frag-moonbase-beta-rpc-ws.g.moonbase.moonbeam.network',
ws: 'wss://deo-moon-rpc-1-moonbase-beta-rpc-1.moonbase.ol-infra.network',
});

export const moonbeam = new EvmParachain({
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './getTransferData/getSourceData';
export * from './getTransferData/getTransferData.utils';
export * from './sdk';
export * from './sdk.interfaces';
14 changes: 14 additions & 0 deletions packages/utils/src/polkadot/polkadot.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { ApiPromise, WsProvider } from '@polkadot/api';
import { typesBundle } from '@polkadot/apps-config';
import LRU from 'lru-cache';

export enum MRLTypes {
XcmVersionedMultiLocation = 'XcmVersionedMultiLocation',
XcmRoutingUserAction = 'XcmRoutingUserAction',
VersionedUserAction = 'VersionedUserAction',
}

const cache = new LRU<string, Promise<ApiPromise>>({
max: 20,
// eslint-disable-next-line sort-keys
Expand All @@ -20,6 +26,14 @@ export async function getPolkadotApi(ws: string): Promise<ApiPromise> {
ApiPromise.create({
noInitWarn: true,
provider: new WsProvider(ws),
types: {
[MRLTypes.XcmRoutingUserAction]: {
destination: MRLTypes.XcmVersionedMultiLocation,
},
[MRLTypes.VersionedUserAction]: {
_enum: { V1: MRLTypes.XcmRoutingUserAction },
},
},
typesBundle,
});

Expand Down

0 comments on commit 3ade51f

Please sign in to comment.