Skip to content

Commit

Permalink
Autodetect ML version available for polkdotXcm extrinsics (#64)
Browse files Browse the repository at this point in the history
* Autodetect ML version available for polkdotXcm extrinsics

* Update snapshots

* Removed origin

* Removed origin from tokens deposits definitions

* Updated tests
  • Loading branch information
fgamundi authored Mar 9, 2023
1 parent cd382fc commit d6aca26
Show file tree
Hide file tree
Showing 24 changed files with 233 additions and 601 deletions.
3 changes: 1 addition & 2 deletions packages/config/src/config/moonbase/assets/tt1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export const TT1: MoonbaseXcmConfig = {
.polkadotXcm()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V1()
.V1V2()
.X2(getPalletInstance(origin), originAssetId),
},
},
Expand Down
4 changes: 1 addition & 3 deletions packages/config/src/config/moonbase/assets/unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export const UNIT: MoonbaseXcmConfig = {
extrinsic: extrinsic
.xcmPallet()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V2(),
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted),
},
},
withdraw: {
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/config/moonbeam/assets/astr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export const ASTR: MoonbeamXcmConfig = {
.polkadotXcm()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V1()
.V1V2()
.here(),
},
},
Expand Down
4 changes: 1 addition & 3 deletions packages/config/src/config/moonbeam/assets/dot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export const DOT: MoonbeamXcmConfig = {
extrinsic: extrinsic
.xcmPallet()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V0(),
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted),
},
},
withdraw: {
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/config/moonbeam/assets/glmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ export const GLMR: MoonbeamXcmConfig = {
.polkadotXcm()
.limitedReserveWithdrawAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(astar)
.V1()
.V1V2()
.X2(getPalletInstance(astar)),
},
[bifrost.key]: {
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/config/moonbeam/assets/ring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export const RING: MoonbeamXcmConfig = {
.polkadotXcm()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V1()
.V1V2()
.X1(),
},
},
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/config/moonbeam/assets/usdt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export const USDT: MoonbeamXcmConfig = {
.polkadotXcm()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V1()
.V1V2()
.X2(getPalletInstance(origin), originAssetId),
},
},
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/config/moonriver/assets/crab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export const CRAB: MoonriverXcmConfig = {
.polkadotXcm()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V1()
.V1V2()
.X1(),
},
},
Expand Down
4 changes: 2 additions & 2 deletions packages/config/src/config/moonriver/assets/csm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export const CSM: MoonriverXcmConfig = {
.polkadotXcm()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V0(),
.V1V2()
.here(),
},
},
withdraw: {
Expand Down
4 changes: 1 addition & 3 deletions packages/config/src/config/moonriver/assets/ksm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export const KSM: MoonriverXcmConfig = {
extrinsic: extrinsic
.xcmPallet()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V0(),
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted),
},
},
withdraw: {
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/config/moonriver/assets/movr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ export const MOVR: MoonriverXcmConfig = {
.polkadotXcm()
.limitedReserveWithdrawAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(shiden)
.V1()
.V1V2()
.X2(getPalletInstance(shiden)),
},
},
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/config/moonriver/assets/rmrk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export const RMRK: MoonriverXcmConfig = {
.polkadotXcm()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V1()
.V1V2()
.X2(getPalletInstance(origin), originAssetId),
},
},
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/config/moonriver/assets/sdn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export const SDN: MoonriverXcmConfig = {
.polkadotXcm()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V1()
.V1V2()
.here(),
},
},
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/config/moonriver/assets/usdt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export const USDT: MoonriverXcmConfig = {
.polkadotXcm()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V1()
.V1V2()
.X2(getPalletInstance(origin), originAssetId),
},
},
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/config/moonriver/assets/xrt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export const XRT: MoonriverXcmConfig = {
.polkadotXcm()
.limitedReserveTransferAssets()
.successEvent(PolkadotXcmExtrinsicSuccessEvent.Attempted)
.origin(origin)
.V1()
.V1V2()
.here(),
},
},
Expand Down
4 changes: 2 additions & 2 deletions packages/config/src/extrinsic/extrinsic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export function createExtrinsicBuilder<
ChainKeys extends ChainKey,
>(chain: MoonChain) {
return {
polkadotXcm: () => polkadotXcm<ChainKeys>(chain),
xcmPallet: () => xcmPallet<ChainKeys>(chain),
polkadotXcm: () => polkadotXcm(chain),
xcmPallet: () => xcmPallet(chain),
xTokens: () => xTokens<Symbols, ChainKeys>(chain),
xTransfer: () => xTransfer<ChainKeys>(chain),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`polkadotXcm limitedReserveTransferAssets v0 should be correct config 1`] = `
exports[`polkadotXcm limitedReserveTransferAssets v1v2 here should be correct config 1`] = `
{
"extrinsic": "limitedReserveTransferAssets",
"getParams": [Function],
Expand All @@ -9,58 +9,7 @@ exports[`polkadotXcm limitedReserveTransferAssets v0 should be correct config 1`
}
`;

exports[`polkadotXcm limitedReserveTransferAssets v0 should get correct params 1`] = `
[
{
"V1": {
"interior": {
"X1": {
"Parachain": 1000,
},
},
"parents": 1,
},
},
{
"V1": {
"interior": {
"X1": {
"AccountKey20": {
"key": "0xeF46c7649270C912704fB09B75097f6E32208b85",
"network": "Any",
},
},
},
"parents": 0,
},
},
{
"V0": [
{
"ConcreteFungible": {
"amount": 1000n,
"id": "Null",
},
},
],
},
0,
{
"Limited": 1000000000,
},
]
`;

exports[`polkadotXcm limitedReserveTransferAssets v1 here should be correct config 1`] = `
{
"extrinsic": "limitedReserveTransferAssets",
"getParams": [Function],
"pallet": "polkadotXcm",
"successEvent": "Attempted",
}
`;

exports[`polkadotXcm limitedReserveTransferAssets v1 here should get correct params 1`] = `
exports[`polkadotXcm limitedReserveTransferAssets v1v2 here should get correct params 1`] = `
[
{
"V1": {
Expand Down Expand Up @@ -101,13 +50,11 @@ exports[`polkadotXcm limitedReserveTransferAssets v1 here should get correct par
],
},
0,
{
"Limited": 1000000000,
},
"Unlimited",
]
`;

exports[`polkadotXcm limitedReserveTransferAssets v1 x1 should be correct config 1`] = `
exports[`polkadotXcm limitedReserveTransferAssets v1v2 x1 should be correct config 1`] = `
{
"extrinsic": "limitedReserveTransferAssets",
"getParams": [Function],
Expand All @@ -116,7 +63,7 @@ exports[`polkadotXcm limitedReserveTransferAssets v1 x1 should be correct config
}
`;

exports[`polkadotXcm limitedReserveTransferAssets v1 x1 should get correct params 1`] = `
exports[`polkadotXcm limitedReserveTransferAssets v1v2 x1 should get correct params 1`] = `
[
{
"V1": {
Expand Down Expand Up @@ -161,13 +108,11 @@ exports[`polkadotXcm limitedReserveTransferAssets v1 x1 should get correct param
],
},
0,
{
"Limited": 1000000000,
},
"Unlimited",
]
`;

exports[`polkadotXcm limitedReserveTransferAssets v1 x2 should be correct config 1`] = `
exports[`polkadotXcm limitedReserveTransferAssets v1v2 x2 should be correct config 1`] = `
{
"extrinsic": "limitedReserveTransferAssets",
"getParams": [Function],
Expand All @@ -176,7 +121,7 @@ exports[`polkadotXcm limitedReserveTransferAssets v1 x2 should be correct config
}
`;

exports[`polkadotXcm limitedReserveTransferAssets v1 x2 should get correct params 1`] = `
exports[`polkadotXcm limitedReserveTransferAssets v1v2 x2 should get correct params 1`] = `
[
{
"V1": {
Expand Down Expand Up @@ -226,13 +171,11 @@ exports[`polkadotXcm limitedReserveTransferAssets v1 x2 should get correct param
],
},
0,
{
"Limited": 1000000000,
},
"Unlimited",
]
`;

exports[`polkadotXcm limitedReserveWithdrawAssets v1 x2 should be correct config 1`] = `
exports[`polkadotXcm limitedReserveWithdrawAssets v1v2 x2 should be correct config 1`] = `
{
"extrinsic": "limitedReserveWithdrawAssets",
"getParams": [Function],
Expand All @@ -241,7 +184,7 @@ exports[`polkadotXcm limitedReserveWithdrawAssets v1 x2 should be correct config
}
`;

exports[`polkadotXcm limitedReserveWithdrawAssets v1 x2 should get correct params 1`] = `
exports[`polkadotXcm limitedReserveWithdrawAssets v1v2 x2 should get correct params 1`] = `
[
{
"V1": {
Expand Down Expand Up @@ -291,8 +234,6 @@ exports[`polkadotXcm limitedReserveWithdrawAssets v1 x2 should get correct param
],
},
0,
{
"Limited": 1000000000,
},
"Unlimited",
]
`;
Loading

0 comments on commit d6aca26

Please sign in to comment.