From 10fdf17dfa631e427e6e0509ff51c8db5eafcfab Mon Sep 17 00:00:00 2001 From: tarikgul Date: Wed, 29 Nov 2023 16:40:13 -0500 Subject: [PATCH] lint --- examples/localLpToken.ts | 6 +- ...raParachainPrimaryNativeReserveTransfer.ts | 6 +- examples/paraToParaTransferMultiAsset.ts | 6 +- .../paraToParaTransferMultiAssetWithFee.ts | 6 +- examples/paraToParaTransferMultiAssets.ts | 6 +- examples/paraToRelayTransferMultiAsset.ts | 6 +- .../paraToSystemParachainPrimaryNative.ts | 6 +- examples/paraToSystemTransferMultiAsset.ts | 6 +- .../paraToSystemTransferMultiAssetWithFee.ts | 6 +- examples/paraToSystemTransferMultiAssets.ts | 6 +- examples/relayToPara.ts | 6 +- examples/relayToSystem.ts | 6 +- examples/rococoAssetHubToRelay.ts | 6 +- examples/submittable.ts | 8 +- examples/systemToPara.ts | 6 +- examples/systemToParaLpToken.ts | 6 +- examples/systemToParaPaysWithFeeOrigin.ts | 6 +- ...ystemToParaReserveTransferForeignAssets.ts | 6 +- examples/systemToParaTeleportForeignAssets.ts | 6 +- examples/systemToRelay.ts | 6 +- examples/systemToSystem.ts | 6 +- examples/systemToSystemLocalForeignAssets.ts | 6 +- examples/tsconfig.json | 1 + scripts/testNetworkForeignAssets.ts | 2 +- scripts/testNetworkLiquidAssets.ts | 12 +-- scripts/testNetworkSetup.ts | 4 +- scripts/tsconfig.json | 1 + src/AssetTransferApi.spec.ts | 72 +++++++-------- src/AssetTransferApi.ts | 30 +++--- src/createCalls/assets/transfer.spec.ts | 2 +- src/createCalls/assets/transfer.ts | 2 +- .../assets/transferKeepAlive.spec.ts | 2 +- src/createCalls/assets/transferKeepAlive.ts | 2 +- src/createCalls/balances/transfer.ts | 2 +- .../balances/transferKeepAlive.spec.ts | 2 +- src/createCalls/balances/transferKeepAlive.ts | 2 +- .../foreignAssets/transfer.spec.ts | 4 +- src/createCalls/foreignAssets/transfer.ts | 2 +- .../foreignAssets/transferKeepAlive.spec.ts | 4 +- .../foreignAssets/transferKeepAlive.ts | 2 +- src/createCalls/poolAssets/transfer.spec.ts | 4 +- src/createCalls/poolAssets/transfer.ts | 2 +- .../poolAssets/transferKeepAlive.spec.ts | 4 +- .../poolAssets/transferKeepAlive.ts | 2 +- .../limitedReserveTransferAssets.spec.ts | 8 +- .../limitedReserveTransferAssets.ts | 2 +- .../polkadotXcm/limitedTeleportAssets.spec.ts | 2 +- .../polkadotXcm/limitedTeleportAssets.ts | 2 +- .../polkadotXcm/reserveTransferAssets.spec.ts | 6 +- .../polkadotXcm/reserveTransferAssets.ts | 2 +- .../polkadotXcm/teleportAssets.spec.ts | 2 +- .../polkadotXcm/teleportAssets.ts | 2 +- src/createXcmCalls/util/establishXcmPallet.ts | 6 +- .../xTokens/transferMultiAsset.spec.ts | 12 +-- .../xTokens/transferMultiAssetWithFee.spec.ts | 12 +-- .../xTokens/transferMultiAssets.spec.ts | 14 +-- .../xTokens/transferMultiasset.ts | 2 +- .../xTokens/transferMultiassetWithFee.ts | 2 +- .../xTokens/transferMultiassets.ts | 2 +- src/createXcmTypes/ParaToPara.spec.ts | 8 +- src/createXcmTypes/ParaToPara.ts | 28 +++--- src/createXcmTypes/ParaToRelay.spec.ts | 8 +- src/createXcmTypes/ParaToSystem.spec.ts | 8 +- src/createXcmTypes/ParaToSystem.ts | 28 +++--- src/createXcmTypes/RelayToPara.spec.ts | 4 +- src/createXcmTypes/RelayToSystem.spec.ts | 4 +- src/createXcmTypes/SystemToPara.spec.ts | 6 +- src/createXcmTypes/SystemToPara.ts | 14 +-- src/createXcmTypes/SystemToRelay.spec.ts | 4 +- src/createXcmTypes/SystemToSystem.spec.ts | 4 +- src/createXcmTypes/SystemToSystem.ts | 18 ++-- src/createXcmTypes/types.ts | 10 +- ...uctForeignAssetMultiLocationFromAssetId.ts | 2 +- src/createXcmTypes/util/dedupeMultiAssets.ts | 2 +- .../util/fetchPalletInstanceId.ts | 12 +-- ...gnAssetMultiLocationIsInCacheOrRegistry.ts | 4 +- .../util/foreignAssetsMultiLocationExists.ts | 6 +- src/createXcmTypes/util/getAssetId.spec.ts | 2 +- src/createXcmTypes/util/getAssetId.ts | 14 +-- .../getXcAssetMultiLocationByAssetId.spec.ts | 6 +- .../util/getXcAssetMultiLocationByAssetId.ts | 4 +- .../isParachainPrimaryNativeAsset.spec.ts | 6 +- .../util/isParachainPrimaryNativeAsset.ts | 2 +- .../util/sortMultiAssetsAscending.ts | 8 +- src/errors/checkBaseInputOptions.ts | 4 +- src/errors/checkBaseInputTypes.spec.ts | 8 +- src/errors/checkBaseInputTypes.ts | 4 +- src/errors/checkLocalTxInputs.spec.ts | 10 +- src/errors/checkLocalTxInputs.ts | 8 +- src/errors/checkXcmTxInputs.spec.ts | 56 +++++------ src/errors/checkXcmTxInputs.ts | 92 +++++++++---------- src/errors/checkXcmVersion.ts | 2 +- .../AssetsTransferApi.spec.ts | 68 +++++++------- .../parachains/moonriver.spec.ts | 12 +-- src/integrationTests/util.ts | 22 ++--- src/sanitize/sanitizeAddress.spec.ts | 6 +- .../adjustedMockBifrostParachainApi.ts | 2 +- .../adjustedMockMoonriverParachainApi.ts | 90 +++++++++--------- src/testHelpers/adjustedMockRelayApi.ts | 2 +- src/testHelpers/adjustedMockSystemApi.ts | 38 ++++---- src/types.ts | 8 +- src/util/getFeeAssetItemIndex.spec.ts | 10 +- src/util/getFeeAssetItemIndex.ts | 6 +- src/util/resolveMultiLocation.ts | 4 +- tsconfig.json | 1 + 105 files changed, 541 insertions(+), 494 deletions(-) diff --git a/examples/localLpToken.ts b/examples/localLpToken.ts index f550c106..42da3d81 100644 --- a/examples/localLpToken.ts +++ b/examples/localLpToken.ts @@ -25,7 +25,7 @@ const main = async () => { format: 'call', keepAlive: true, transferLiquidToken: true, - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -38,4 +38,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/paraToParaParachainPrimaryNativeReserveTransfer.ts b/examples/paraToParaParachainPrimaryNativeReserveTransfer.ts index 491f898b..2a9c1b15 100644 --- a/examples/paraToParaParachainPrimaryNativeReserveTransfer.ts +++ b/examples/paraToParaParachainPrimaryNativeReserveTransfer.ts @@ -28,7 +28,7 @@ const main = async () => { format: 'call', isLimited: false, xcmVersion: 3, - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -41,4 +41,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/paraToParaTransferMultiAsset.ts b/examples/paraToParaTransferMultiAsset.ts index a95942db..43e529f0 100644 --- a/examples/paraToParaTransferMultiAsset.ts +++ b/examples/paraToParaTransferMultiAsset.ts @@ -28,7 +28,7 @@ const main = async () => { format: 'call', isLimited: false, xcmVersion: 2, - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -41,4 +41,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/paraToParaTransferMultiAssetWithFee.ts b/examples/paraToParaTransferMultiAssetWithFee.ts index 2247c410..9c5e0a69 100644 --- a/examples/paraToParaTransferMultiAssetWithFee.ts +++ b/examples/paraToParaTransferMultiAssetWithFee.ts @@ -35,7 +35,7 @@ const main = async () => { // NOTE: for `xTokens` pallet `transferMultiassetWithFee` txs, `paysWithFeeDest` is the multiLocation of the asset that is intended to be used to pay for fees in the dest chain paysWithFeeDest: '{"parents": "1", "interior": {"X3": [{"Parachain": "1000"}, {"PalletInstance": "50"}, {"GeneralIndex": "1984"}]}}', - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -48,4 +48,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/paraToParaTransferMultiAssets.ts b/examples/paraToParaTransferMultiAssets.ts index cde6ad54..dd1e0e4f 100644 --- a/examples/paraToParaTransferMultiAssets.ts +++ b/examples/paraToParaTransferMultiAssets.ts @@ -28,7 +28,7 @@ const main = async () => { format: 'call', isLimited: false, xcmVersion: 2, - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -41,4 +41,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/paraToRelayTransferMultiAsset.ts b/examples/paraToRelayTransferMultiAsset.ts index edde9eb0..25701c18 100644 --- a/examples/paraToRelayTransferMultiAsset.ts +++ b/examples/paraToRelayTransferMultiAsset.ts @@ -28,7 +28,7 @@ const main = async () => { format: 'call', isLimited: false, xcmVersion: 3, - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -41,4 +41,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/paraToSystemParachainPrimaryNative.ts b/examples/paraToSystemParachainPrimaryNative.ts index 7fccf7fb..cda7f2e0 100644 --- a/examples/paraToSystemParachainPrimaryNative.ts +++ b/examples/paraToSystemParachainPrimaryNative.ts @@ -28,7 +28,7 @@ const main = async () => { format: 'call', isLimited: false, xcmVersion: 3, - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -41,4 +41,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/paraToSystemTransferMultiAsset.ts b/examples/paraToSystemTransferMultiAsset.ts index 7672442f..b827b649 100644 --- a/examples/paraToSystemTransferMultiAsset.ts +++ b/examples/paraToSystemTransferMultiAsset.ts @@ -28,7 +28,7 @@ const main = async () => { format: 'call', isLimited: false, xcmVersion: 2, - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -41,4 +41,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/paraToSystemTransferMultiAssetWithFee.ts b/examples/paraToSystemTransferMultiAssetWithFee.ts index fa0d3561..8b806de9 100644 --- a/examples/paraToSystemTransferMultiAssetWithFee.ts +++ b/examples/paraToSystemTransferMultiAssetWithFee.ts @@ -35,7 +35,7 @@ const main = async () => { // NOTE: for xTokens `transferMultiassetWithFee` txs, paysWithFeeDest is the multiLocation of the asset that is intended to be used to pay for fees in the dest chain paysWithFeeDest: '{"parents": "1", "interior": {"X3": [{"Parachain": "1000"}, {"PalletInstance": "50"}, {"GeneralIndex": "1984"}]}}', - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -48,4 +48,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/paraToSystemTransferMultiAssets.ts b/examples/paraToSystemTransferMultiAssets.ts index cee1791e..f74ff8f3 100644 --- a/examples/paraToSystemTransferMultiAssets.ts +++ b/examples/paraToSystemTransferMultiAssets.ts @@ -28,7 +28,7 @@ const main = async () => { format: 'call', isLimited: false, xcmVersion: 3, - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -41,4 +41,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/relayToPara.ts b/examples/relayToPara.ts index f8e404c2..d92c48cb 100644 --- a/examples/relayToPara.ts +++ b/examples/relayToPara.ts @@ -28,7 +28,7 @@ const main = async () => { format: 'call', isLimited: true, xcmVersion: 2, - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -41,4 +41,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/relayToSystem.ts b/examples/relayToSystem.ts index 7a499065..5e0fb6cd 100644 --- a/examples/relayToSystem.ts +++ b/examples/relayToSystem.ts @@ -28,7 +28,7 @@ const main = async () => { format: 'call', isLimited: true, xcmVersion: 2, - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -41,4 +41,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/rococoAssetHubToRelay.ts b/examples/rococoAssetHubToRelay.ts index cd64ed1f..8f1d5e22 100644 --- a/examples/rococoAssetHubToRelay.ts +++ b/examples/rococoAssetHubToRelay.ts @@ -34,7 +34,7 @@ const main = async () => { format: 'call', isLimited: true, xcmVersion: 2, - } + }, ); console.log(callInfo); @@ -47,4 +47,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/submittable.ts b/examples/submittable.ts index f0ff59fc..bded0f21 100644 --- a/examples/submittable.ts +++ b/examples/submittable.ts @@ -32,11 +32,11 @@ const main = async () => { format: 'submittable', isLimited: true, xcmVersion: 2, - } + }, ); console.log( - `${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}${RESET}` + `${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}${RESET}`, ); } catch (e) { console.error(e); @@ -51,4 +51,6 @@ const main = async () => { await callInfo.tx.signAndSend(alice); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/systemToPara.ts b/examples/systemToPara.ts index c86140a1..7d4bd8b1 100644 --- a/examples/systemToPara.ts +++ b/examples/systemToPara.ts @@ -29,7 +29,7 @@ const main = async () => { format: 'call', isLimited: true, xcmVersion: 2, - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -42,4 +42,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/systemToParaLpToken.ts b/examples/systemToParaLpToken.ts index 2d77c558..7f8dd6a5 100644 --- a/examples/systemToParaLpToken.ts +++ b/examples/systemToParaLpToken.ts @@ -43,7 +43,7 @@ const main = async () => { isLimited: true, xcmVersion: 2, transferLiquidToken: true, - } + }, ); console.log(`${PURPLE}The following call data that is returned:\n${GREEN}${JSON.stringify(callInfo, null, 4)}`); @@ -56,4 +56,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/systemToParaPaysWithFeeOrigin.ts b/examples/systemToParaPaysWithFeeOrigin.ts index 3c79f7b6..b4955e45 100644 --- a/examples/systemToParaPaysWithFeeOrigin.ts +++ b/examples/systemToParaPaysWithFeeOrigin.ts @@ -32,7 +32,7 @@ const main = async () => { isLimited: false, xcmVersion: 3, paysWithFeeOrigin: '1984', - } + }, ); console.log(callInfo); @@ -45,4 +45,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/systemToParaReserveTransferForeignAssets.ts b/examples/systemToParaReserveTransferForeignAssets.ts index 370cccc3..2a883ea0 100644 --- a/examples/systemToParaReserveTransferForeignAssets.ts +++ b/examples/systemToParaReserveTransferForeignAssets.ts @@ -30,7 +30,7 @@ const main = async () => { format: 'call', isLimited: true, xcmVersion: 3, - } + }, ); console.log(callInfo); @@ -43,4 +43,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/systemToParaTeleportForeignAssets.ts b/examples/systemToParaTeleportForeignAssets.ts index 6239f2e3..8391d8dd 100644 --- a/examples/systemToParaTeleportForeignAssets.ts +++ b/examples/systemToParaTeleportForeignAssets.ts @@ -30,7 +30,7 @@ const main = async () => { format: 'call', isLimited: true, xcmVersion: 3, - } + }, ); console.log(callInfo); @@ -43,4 +43,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/systemToRelay.ts b/examples/systemToRelay.ts index e39383c3..0c14e76e 100644 --- a/examples/systemToRelay.ts +++ b/examples/systemToRelay.ts @@ -29,7 +29,7 @@ const main = async () => { format: 'call', isLimited: true, xcmVersion: 2, - } + }, ); console.log(callInfo); @@ -42,4 +42,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/systemToSystem.ts b/examples/systemToSystem.ts index b8cf688c..94639ea8 100644 --- a/examples/systemToSystem.ts +++ b/examples/systemToSystem.ts @@ -29,7 +29,7 @@ const main = async () => { format: 'call', isLimited: true, xcmVersion: 2, - } + }, ); console.log(callInfo); @@ -42,4 +42,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/systemToSystemLocalForeignAssets.ts b/examples/systemToSystemLocalForeignAssets.ts index 4043e24d..cc46ed7d 100644 --- a/examples/systemToSystemLocalForeignAssets.ts +++ b/examples/systemToSystemLocalForeignAssets.ts @@ -30,7 +30,7 @@ const main = async () => { format: 'call', isLimited: true, xcmVersion: 2, - } + }, ); console.log(callInfo); @@ -43,4 +43,6 @@ const main = async () => { console.log(`\n${PURPLE}The following decoded tx:\n${GREEN} ${JSON.stringify(JSON.parse(decoded), null, 4)}${RESET}`); }; -main().finally(() => process.exit()); +main() + .catch((err) => console.error(err)) + .finally(() => process.exit()); diff --git a/examples/tsconfig.json b/examples/tsconfig.json index 3f315a3d..956daa53 100644 --- a/examples/tsconfig.json +++ b/examples/tsconfig.json @@ -6,6 +6,7 @@ "suppressImplicitAnyIndexErrors": true, "resolveJsonModule": true, "esModuleInterop": true, + "ignoreDeprecations": "5.0", }, "typeRoots": [ "../node_modules/@types" diff --git a/scripts/testNetworkForeignAssets.ts b/scripts/testNetworkForeignAssets.ts index 79667e1e..5f60a009 100644 --- a/scripts/testNetworkForeignAssets.ts +++ b/scripts/testNetworkForeignAssets.ts @@ -43,7 +43,7 @@ const fAssetCreateCall = (assetHubApi: ApiPromise): `0x${string}` => { const createTx = assetHubApi.tx.foreignAssets.create( trappistMultiLocation, '5Eg2fnsjAAr8RGZfa8Sy5mYFPabA9ZLNGYECCKXPD6xnK6D2', // Sibling 1836 -> ParaId - '100000000000' + '100000000000', ); const hexCall = assetHubApi.registry diff --git a/scripts/testNetworkLiquidAssets.ts b/scripts/testNetworkLiquidAssets.ts index bab1f2ff..00c2e8cd 100644 --- a/scripts/testNetworkLiquidAssets.ts +++ b/scripts/testNetworkLiquidAssets.ts @@ -135,10 +135,10 @@ const main = async () => { chalk.blue( `LP Token: ${Number(lpToken)}, Account: ${address.toString()}, Starting liquidty token balance: ${value .unwrap() - .balance.toHuman()}` - ) + .balance.toHuman()}`, + ), ); - } + }, ); await delay(24000); @@ -161,10 +161,10 @@ const main = async () => { chalk.blue( `LP Token: ${Number(lpToken)}, Account: ${address.toString()}, New liquidty token balance: ${value .unwrap() - .balance.toHuman()}` - ) + .balance.toHuman()}`, + ), ); - } + }, ); await api.disconnect().then(() => { diff --git a/scripts/testNetworkSetup.ts b/scripts/testNetworkSetup.ts index 06d49cf6..4cc80727 100644 --- a/scripts/testNetworkSetup.ts +++ b/scripts/testNetworkSetup.ts @@ -121,7 +121,7 @@ const main = async () => { assetInfo.assetId, assetInfo.assetName, assetInfo.assetSymbol, - assetInfo.assetDecimals + assetInfo.assetDecimals, ), kusamaAssetHubApi.tx.assets.mint(assetInfo.assetId, alice.address, 1000 * 120000000), ]; @@ -151,7 +151,7 @@ const main = async () => { // Other, CannotLookup, BadOrigin, no extra info console.log(error.toString()); } - } + }, ); } }); diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index b3d794f0..928e51d6 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -4,6 +4,7 @@ "baseUrl": ".", "outDir": "build", "suppressImplicitAnyIndexErrors": true, + "ignoreDeprecations": "5.0", "resolveJsonModule": true, }, } diff --git a/src/AssetTransferApi.spec.ts b/src/AssetTransferApi.spec.ts index 8361c778..c654d2ae 100644 --- a/src/AssetTransferApi.spec.ts +++ b/src/AssetTransferApi.spec.ts @@ -15,7 +15,7 @@ import { AssetType } from './types'; const mockSubmittableExt = mockSystemApi.registry.createType( 'Extrinsic', - '0xfc041f0801010100411f0100010100c224aad9c6f3bbd784120e9fceee5bfd22a62c69144ee673f76d6a34d280de160104000002043205040091010000000000' + '0xfc041f0801010100411f0100010100c224aad9c6f3bbd784120e9fceee5bfd22a62c69144ee673f76d6a34d280de160104000002043205040091010000000000', ) as SubmittableExtrinsic<'promise', ISubmittableResult>; const systemAssetsApi = new AssetTransferApi(adjustedMockSystemApi, 'statemine', 2); @@ -62,7 +62,7 @@ describe('AssetTransferAPI', () => { 'limitedReserveTransferAssets', '2023', 'statemine', - { format: 'call' } + { format: 'call' }, ); expect(res).toEqual({ dest: 'moonriver', @@ -82,7 +82,7 @@ describe('AssetTransferAPI', () => { 'limitedReserveTransferAssets', '2023', 'statemine', - { format: 'payload' } + { format: 'payload' }, ); expect(res).toEqual({ dest: 'moonriver', @@ -102,7 +102,7 @@ describe('AssetTransferAPI', () => { 'limitedReserveTransferAssets', '2023', 'Statmine', - { format: 'submittable' } + { format: 'submittable' }, ); expect(res.tx.toRawType()).toEqual('Extrinsic'); }); @@ -162,7 +162,7 @@ describe('AssetTransferAPI', () => { AssetType.Native, false, false, - relayAssetsApi.registry + relayAssetsApi.registry, ); expect(assetCallType).toEqual('Teleport'); @@ -178,7 +178,7 @@ describe('AssetTransferAPI', () => { AssetType.Native, false, false, - relayAssetsApi.registry + relayAssetsApi.registry, ); expect(assetCallType).toEqual('Reserve'); @@ -194,7 +194,7 @@ describe('AssetTransferAPI', () => { AssetType.Native, false, false, - systemAssetsApi.registry + systemAssetsApi.registry, ); expect(assetCallType).toEqual('Teleport'); @@ -210,7 +210,7 @@ describe('AssetTransferAPI', () => { AssetType.Native, false, false, - systemAssetsApi.registry + systemAssetsApi.registry, ); expect(assetCallType).toEqual('Teleport'); @@ -225,7 +225,7 @@ describe('AssetTransferAPI', () => { AssetType.Foreign, true, false, - systemAssetsApi.registry + systemAssetsApi.registry, ); expect(err).toThrow('Unable to send foreign assets in direction SystemToSystem'); @@ -241,7 +241,7 @@ describe('AssetTransferAPI', () => { AssetType.Foreign, true, false, - systemAssetsApi.registry + systemAssetsApi.registry, ); expect(assetCallType).toEqual('Teleport'); @@ -257,7 +257,7 @@ describe('AssetTransferAPI', () => { AssetType.Foreign, true, false, - systemAssetsApi.registry + systemAssetsApi.registry, ); expect(assetCallType).toEqual('Reserve'); @@ -273,7 +273,7 @@ describe('AssetTransferAPI', () => { AssetType.Foreign, false, false, - moonriverAssetsApi.registry + moonriverAssetsApi.registry, ); expect(assetCallType).toEqual('Reserve'); @@ -289,7 +289,7 @@ describe('AssetTransferAPI', () => { AssetType.Foreign, true, false, - moonriverAssetsApi.registry + moonriverAssetsApi.registry, ); expect(assetCallType).toEqual('Teleport'); @@ -303,7 +303,7 @@ describe('AssetTransferAPI', () => { AssetType.Foreign, true, true, - moonriverAssetsApi.registry + moonriverAssetsApi.registry, ); expect(assetCallType).toEqual('Teleport'); @@ -317,7 +317,7 @@ describe('AssetTransferAPI', () => { AssetType.Foreign, true, false, - moonriverAssetsApi.registry + moonriverAssetsApi.registry, ); expect(assetCallType).toEqual('Reserve'); @@ -333,7 +333,7 @@ describe('AssetTransferAPI', () => { AssetType.Foreign, true, false, - moonriverAssetsApi.registry + moonriverAssetsApi.registry, ); expect(assetCallType).toEqual('Reserve'); @@ -349,7 +349,7 @@ describe('AssetTransferAPI', () => { AssetType.Native, false, false, - moonriverAssetsApi.registry + moonriverAssetsApi.registry, ); expect(assetCallType).toEqual('Reserve'); @@ -392,7 +392,7 @@ describe('AssetTransferAPI', () => { 'limitedReserveTransferAssets', '2000', 'statemine', - { format: 'payload' } + { format: 'payload' }, ); const payloadFeeInfo = await systemAssetsApi.fetchFeeInfo(payloadTexResult.tx, 'payload'); @@ -407,7 +407,7 @@ describe('AssetTransferAPI', () => { 'limitedReserveTransferAssets', '2000', 'statmine', - { format: 'call' } + { format: 'call' }, ); const callFeeInfo = await systemAssetsApi.fetchFeeInfo(callTxResult.tx, 'call'); expect((callFeeInfo?.weight as Weight).refTime.toString()).toEqual(mockWeightInfo.weight.refTime); @@ -428,7 +428,7 @@ describe('AssetTransferAPI', () => { { format: 'call', keepAlive: false, - } + }, ); const decoded = moonriverAssetsApi.decodeExtrinsic(callTxResult.tx, 'call'); @@ -449,7 +449,7 @@ describe('AssetTransferAPI', () => { format: 'payload', keepAlive: false, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); const decoded = moonriverAssetsApi.decodeExtrinsic(payloadTxResult.tx, 'payload'); @@ -467,7 +467,7 @@ describe('AssetTransferAPI', () => { ['10000000000000'], { format: 'submittable', - } + }, ); const decoded = moonriverAssetsApi.decodeExtrinsic(callTxResult.tx.toHex(), 'submittable'); @@ -486,7 +486,7 @@ describe('AssetTransferAPI', () => { { format: 'call', keepAlive: true, - } + }, ); const decoded = relayAssetsApi.decodeExtrinsic(call.tx, 'call'); @@ -505,7 +505,7 @@ describe('AssetTransferAPI', () => { format: 'payload', keepAlive: true, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); const decoded = relayAssetsApi.decodeExtrinsic(payloadTxResult.tx, 'payload'); @@ -523,7 +523,7 @@ describe('AssetTransferAPI', () => { { format: 'submittable', keepAlive: true, - } + }, ); const decoded = relayAssetsApi.decodeExtrinsic(submittableTxResult.tx.toHex(), 'submittable'); @@ -543,7 +543,7 @@ describe('AssetTransferAPI', () => { { format: 'call', keepAlive: true, - } + }, ); const decoded = systemAssetsApi.decodeExtrinsic(callTxResult.tx, 'call'); @@ -562,7 +562,7 @@ describe('AssetTransferAPI', () => { format: 'payload', keepAlive: true, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); const decoded = systemAssetsApi.decodeExtrinsic(payloadTxResult.tx, 'payload'); @@ -580,7 +580,7 @@ describe('AssetTransferAPI', () => { { format: 'submittable', keepAlive: true, - } + }, ); const decoded = systemAssetsApi.decodeExtrinsic(submittableTxResult.tx.toHex(), 'submittable'); @@ -601,7 +601,7 @@ describe('AssetTransferAPI', () => { { format: 'call', keepAlive: false, - } + }, ); const decoded = systemAssetsApi.decodeExtrinsic(callTxResult.tx, 'call'); @@ -621,7 +621,7 @@ describe('AssetTransferAPI', () => { format: 'payload', keepAlive: false, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); const decoded = systemAssetsApi.decodeExtrinsic(callTxResult.tx, 'payload'); @@ -639,7 +639,7 @@ describe('AssetTransferAPI', () => { ['10000000000000'], { format: 'submittable', - } + }, ); const decoded = systemAssetsApi.decodeExtrinsic(callTxResult.tx.toHex(), 'submittable'); @@ -659,7 +659,7 @@ describe('AssetTransferAPI', () => { format: 'call', xcmVersion: 3, transferLiquidToken: true, - } + }, ); const decoded = systemAssetsApi.decodeExtrinsic(callTxResult.tx, 'call'); @@ -684,7 +684,7 @@ describe('AssetTransferAPI', () => { format: 'call', keepAlive: true, paysWithFeeDest: 'usdt', - } + }, ); const decoded = systemAssetsApi.decodeExtrinsic(callTxResult.tx, 'call'); @@ -704,7 +704,7 @@ describe('AssetTransferAPI', () => { xcmVersion: 3, format: 'call', keepAlive: true, - } + }, ); const decoded = systemAssetsApi.decodeExtrinsic(callTxResult.tx, 'call'); @@ -727,7 +727,7 @@ describe('AssetTransferAPI', () => { paysWithFeeDest: 'USDC', xcmVersion: 3, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); const result = mockSystemApi.registry.createType('ExtrinsicPayload', payload.tx, { @@ -752,7 +752,7 @@ describe('AssetTransferAPI', () => { paysWithFeeDest: 'USDC', xcmVersion: 3, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }).rejects.toThrowError('asset with assetId 100 is not a sufficient asset to pay for fees'); }); diff --git a/src/AssetTransferApi.ts b/src/AssetTransferApi.ts index 37ba787f..69c6eb68 100644 --- a/src/AssetTransferApi.ts +++ b/src/AssetTransferApi.ts @@ -138,7 +138,7 @@ export class AssetTransferApi { destAddr: string, assetIds: string[], amounts: string[], - opts: TransferArgsOpts = {} + opts: TransferArgsOpts = {}, ): Promise> { const { format, @@ -193,7 +193,7 @@ export class AssetTransferApi { isDestSystemParachain, isDestParachain, isOriginSystemParachain, - isOriginParachain + isOriginParachain, ); const isForeignAssetsTransfer: boolean = this.checkIsForeignAssetTransfer(assetIds); const isPrimaryParachainNativeAsset = isParachainPrimaryNativeAsset(registry, _specName, xcmDirection, assetIds[0]); @@ -232,7 +232,7 @@ export class AssetTransferApi { registry, declaredXcmVersion, isForeignAssetsTransfer, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); // Throws an error when any of the inputs are incorrect. const method = keepAlive ? 'transferKeepAlive' : 'transfer'; @@ -311,7 +311,7 @@ export class AssetTransferApi { { ...baseOpts, isPrimaryParachainNativeAsset, - } + }, ); const assetType = this.fetchAssetType(xcmDirection, isForeignAssetsTransfer); @@ -323,7 +323,7 @@ export class AssetTransferApi { assetType, isForeignAssetsTransfer, isPrimaryParachainNativeAsset, - registry + registry, ); let txMethod: Methods; @@ -409,7 +409,7 @@ export class AssetTransferApi { */ public async fetchFeeInfo( tx: ConstructedFormat, - format: T + format: T, ): Promise { const { _api } = this; @@ -421,7 +421,7 @@ export class AssetTransferApi { const ext = _api.registry.createType( 'Extrinsic', { method: extrinsicPayload.method }, - { version: EXTRINSIC_VERSION } + { version: EXTRINSIC_VERSION }, ); const u8a = ext.toU8a(); @@ -494,7 +494,7 @@ export class AssetTransferApi { destIsSystemParachain: boolean, destIsParachain: boolean, originIsSystemParachain: boolean, - originIsParachain: boolean + originIsParachain: boolean, ): Direction { if (isLocal) { return Direction.Local; @@ -563,7 +563,7 @@ export class AssetTransferApi { method: Methods, dest: string, origin: string, - opts: { format?: T; paysWithFeeOrigin?: string; sendersAddr?: string } + opts: { format?: T; paysWithFeeOrigin?: string; sendersAddr?: string }, ): Promise> { const { format, paysWithFeeOrigin, sendersAddr } = opts; const fmt = format ? format : 'payload'; @@ -627,7 +627,7 @@ export class AssetTransferApi { assetType: AssetType, isForeignAssetsTransfer: boolean, isParachainPrimaryNativeAsset: boolean, - registry: Registry + registry: Registry, ): AssetCallType { // relay to system -> teleport // system to relay -> teleport @@ -672,7 +672,7 @@ export class AssetTransferApi { if (assetType === AssetType.Foreign && xcmDirection === Direction.SystemToSystem) { throw new BaseError( `Unable to send foreign assets in direction ${xcmDirection}`, - BaseErrorsEnum.InvalidDirection + BaseErrorsEnum.InvalidDirection, ); } @@ -733,7 +733,7 @@ export class AssetTransferApi { */ private createPayload = async ( tx: SubmittableExtrinsic<'promise', ISubmittableResult>, - opts: { paysWithFeeOrigin?: string; sendersAddr: string } + opts: { paysWithFeeOrigin?: string; sendersAddr: string }, ): Promise<`0x${string}`> => { const { paysWithFeeOrigin, sendersAddr } = opts; let assetId: BN | AnyJson = new BN(0); @@ -752,7 +752,7 @@ export class AssetTransferApi { if (!isSufficient) { throw new BaseError( `asset with assetId ${assetId.toString()} is not a sufficient asset to pay for fees`, - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); } } else { @@ -763,7 +763,7 @@ export class AssetTransferApi { `paysWithFeeOrigin is an invalid asset. The asset must be a valid integer or multiLocation depending on the runtime: ${ e as string }`, - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); } } @@ -847,7 +847,7 @@ export class AssetTransferApi { if (lookup.length === 0) { throw new BaseError( `Could not find any parachain information given the destId: ${destId}`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } diff --git a/src/createCalls/assets/transfer.spec.ts b/src/createCalls/assets/transfer.spec.ts index b3c3fc5a..0b07db0a 100644 --- a/src/createCalls/assets/transfer.spec.ts +++ b/src/createCalls/assets/transfer.spec.ts @@ -9,7 +9,7 @@ describe('transfer', () => { mockSystemApi, '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', '1', - '10000' + '10000', ); expect(res.toHex()).toEqual('0x9c0432080400f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b419c'); }); diff --git a/src/createCalls/assets/transfer.ts b/src/createCalls/assets/transfer.ts index ec44779b..ad5c2250 100644 --- a/src/createCalls/assets/transfer.ts +++ b/src/createCalls/assets/transfer.ts @@ -8,7 +8,7 @@ export const transfer = ( api: ApiPromise, destAddr: string, assetId: string, - amount: string + amount: string, ): SubmittableExtrinsic<'promise', ISubmittableResult> => { return api.tx.assets.transfer(assetId, destAddr, amount); }; diff --git a/src/createCalls/assets/transferKeepAlive.spec.ts b/src/createCalls/assets/transferKeepAlive.spec.ts index 33ac5911..24fd7c28 100644 --- a/src/createCalls/assets/transferKeepAlive.spec.ts +++ b/src/createCalls/assets/transferKeepAlive.spec.ts @@ -9,7 +9,7 @@ describe('transfer', () => { mockSystemApi, '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', '1', - '10000' + '10000', ); expect(res.toHex()).toEqual('0x9c0432090400f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b419c'); }); diff --git a/src/createCalls/assets/transferKeepAlive.ts b/src/createCalls/assets/transferKeepAlive.ts index 31782899..80c4f731 100644 --- a/src/createCalls/assets/transferKeepAlive.ts +++ b/src/createCalls/assets/transferKeepAlive.ts @@ -8,7 +8,7 @@ export const transferKeepAlive = ( api: ApiPromise, destAddr: string, assetId: string, - amount: string + amount: string, ): SubmittableExtrinsic<'promise', ISubmittableResult> => { return api.tx.assets.transferKeepAlive(assetId, destAddr, amount); }; diff --git a/src/createCalls/balances/transfer.ts b/src/createCalls/balances/transfer.ts index 9b69b264..7d0f040c 100644 --- a/src/createCalls/balances/transfer.ts +++ b/src/createCalls/balances/transfer.ts @@ -7,7 +7,7 @@ import type { ISubmittableResult } from '@polkadot/types/types'; export const transfer = ( api: ApiPromise, destAddr: string, - amount: string + amount: string, ): SubmittableExtrinsic<'promise', ISubmittableResult> => { if (api.tx.balances.transferAllowDeath) { return api.tx.balances.transferAllowDeath(destAddr, amount); diff --git a/src/createCalls/balances/transferKeepAlive.spec.ts b/src/createCalls/balances/transferKeepAlive.spec.ts index edf85aa6..c21dd384 100644 --- a/src/createCalls/balances/transferKeepAlive.spec.ts +++ b/src/createCalls/balances/transferKeepAlive.spec.ts @@ -8,7 +8,7 @@ describe('transfer', () => { const res = transferKeepAlive( mockSystemApi, '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - '10000' + '10000', ); expect(res.toHex()).toEqual('0x98040a0300f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b419c'); }); diff --git a/src/createCalls/balances/transferKeepAlive.ts b/src/createCalls/balances/transferKeepAlive.ts index aedde23c..23083d8a 100644 --- a/src/createCalls/balances/transferKeepAlive.ts +++ b/src/createCalls/balances/transferKeepAlive.ts @@ -7,7 +7,7 @@ import type { ISubmittableResult } from '@polkadot/types/types'; export const transferKeepAlive = ( api: ApiPromise, destAddr: string, - amount: string + amount: string, ): SubmittableExtrinsic<'promise', ISubmittableResult> => { return api.tx.balances.transferKeepAlive(destAddr, amount); }; diff --git a/src/createCalls/foreignAssets/transfer.spec.ts b/src/createCalls/foreignAssets/transfer.spec.ts index 2a7fac5f..4bcccb26 100644 --- a/src/createCalls/foreignAssets/transfer.spec.ts +++ b/src/createCalls/foreignAssets/transfer.spec.ts @@ -24,10 +24,10 @@ describe('transfer', () => { mockSystemApi, '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', foreignAsset, - '10000' + '10000', ); expect(res.toHex()).toEqual( - '0xb40435080102003521050000f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b419c' + '0xb40435080102003521050000f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b419c', ); }); }); diff --git a/src/createCalls/foreignAssets/transfer.ts b/src/createCalls/foreignAssets/transfer.ts index 875cd35c..01e880c0 100644 --- a/src/createCalls/foreignAssets/transfer.ts +++ b/src/createCalls/foreignAssets/transfer.ts @@ -10,7 +10,7 @@ export const transfer = ( api: ApiPromise, destAddr: string, assetId: UnionXcmMultiLocation, - amount: string + amount: string, ): SubmittableExtrinsic<'promise', ISubmittableResult> => { return api.tx.foreignAssets.transfer(assetId, destAddr, amount); }; diff --git a/src/createCalls/foreignAssets/transferKeepAlive.spec.ts b/src/createCalls/foreignAssets/transferKeepAlive.spec.ts index ca88c0a2..49f8fbf5 100644 --- a/src/createCalls/foreignAssets/transferKeepAlive.spec.ts +++ b/src/createCalls/foreignAssets/transferKeepAlive.spec.ts @@ -24,10 +24,10 @@ describe('transfer', () => { mockSystemApi, '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', foreignAssetMultiLocation, - '10000' + '10000', ); expect(res.toHex()).toEqual( - '0xb40435090102003521050000f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b419c' + '0xb40435090102003521050000f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b419c', ); }); }); diff --git a/src/createCalls/foreignAssets/transferKeepAlive.ts b/src/createCalls/foreignAssets/transferKeepAlive.ts index 1ccf060f..35e7343d 100644 --- a/src/createCalls/foreignAssets/transferKeepAlive.ts +++ b/src/createCalls/foreignAssets/transferKeepAlive.ts @@ -10,7 +10,7 @@ export const transferKeepAlive = ( api: ApiPromise, destAddr: string, assetId: UnionXcmMultiLocation, - amount: string + amount: string, ): SubmittableExtrinsic<'promise', ISubmittableResult> => { return api.tx.foreignAssets.transferKeepAlive(assetId, destAddr, amount); }; diff --git a/src/createCalls/poolAssets/transfer.spec.ts b/src/createCalls/poolAssets/transfer.spec.ts index 164f201e..7e692428 100644 --- a/src/createCalls/poolAssets/transfer.spec.ts +++ b/src/createCalls/poolAssets/transfer.spec.ts @@ -9,11 +9,11 @@ describe('transfer', () => { mockSystemApi, '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', '0', - '100000' + '100000', ); expect(res.toHex()).toEqual( - '0xb00437080000000000f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b821a0600' + '0xb00437080000000000f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b821a0600', ); }); }); diff --git a/src/createCalls/poolAssets/transfer.ts b/src/createCalls/poolAssets/transfer.ts index 83602ff3..7e54c96a 100644 --- a/src/createCalls/poolAssets/transfer.ts +++ b/src/createCalls/poolAssets/transfer.ts @@ -8,7 +8,7 @@ export const transfer = ( api: ApiPromise, destAddr: string, assetId: string, - amount: string + amount: string, ): SubmittableExtrinsic<'promise', ISubmittableResult> => { return api.tx.poolAssets.transfer(assetId, destAddr, amount); }; diff --git a/src/createCalls/poolAssets/transferKeepAlive.spec.ts b/src/createCalls/poolAssets/transferKeepAlive.spec.ts index 9fbc7ef0..ef678c17 100644 --- a/src/createCalls/poolAssets/transferKeepAlive.spec.ts +++ b/src/createCalls/poolAssets/transferKeepAlive.spec.ts @@ -9,11 +9,11 @@ describe('transferKeepAlive', () => { mockSystemApi, '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', '0', - '100000' + '100000', ); expect(res.toHex()).toEqual( - '0xb00437090000000000f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b821a0600' + '0xb00437090000000000f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b821a0600', ); }); }); diff --git a/src/createCalls/poolAssets/transferKeepAlive.ts b/src/createCalls/poolAssets/transferKeepAlive.ts index fc8e01b9..baafec79 100644 --- a/src/createCalls/poolAssets/transferKeepAlive.ts +++ b/src/createCalls/poolAssets/transferKeepAlive.ts @@ -8,7 +8,7 @@ export const transferKeepAlive = ( api: ApiPromise, destAddr: string, assetId: string, - amount: string + amount: string, ): SubmittableExtrinsic<'promise', ISubmittableResult> => { return api.tx.poolAssets.transferKeepAlive(assetId, destAddr, amount); }; diff --git a/src/createXcmCalls/polkadotXcm/limitedReserveTransferAssets.spec.ts b/src/createXcmCalls/polkadotXcm/limitedReserveTransferAssets.spec.ts index 9d596ac1..aea607ba 100644 --- a/src/createXcmCalls/polkadotXcm/limitedReserveTransferAssets.spec.ts +++ b/src/createXcmCalls/polkadotXcm/limitedReserveTransferAssets.spec.ts @@ -45,7 +45,7 @@ describe('limitedReserveTransferAssets', () => { }); expect(ext.toHex()).toBe( - '0x0d01041f08010101009d1f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b0104000002043205040091010000000001a10f411f' + '0x0d01041f08010101009d1f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b0104000002043205040091010000000001a10f411f', ); }); it('Should correctly construct a tx for when a weightLimit is available', async () => { @@ -67,7 +67,7 @@ describe('limitedReserveTransferAssets', () => { }); expect(ext.toHex()).toBe( - '0x1501041f08010101009d1f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b010400000204320504009101000000000102286bee411f' + '0x1501041f08010101009d1f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b010400000204320504009101000000000102286bee411f', ); }); @@ -104,7 +104,7 @@ describe('limitedReserveTransferAssets', () => { }); expect(ext.toHex()).toBe( - '0x0901041f08010101009d1f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b0104000103043500352105000091010000000000' + '0x0901041f08010101009d1f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b0104000103043500352105000091010000000000', ); }); @@ -127,7 +127,7 @@ describe('limitedReserveTransferAssets', () => { }); expect(ext.toHex()).toBe( - '0x2101041f08010101009d1f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b010400010304350035210500009101000000000102286bee411f' + '0x2101041f08010101009d1f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b010400010304350035210500009101000000000102286bee411f', ); }); }); diff --git a/src/createXcmCalls/polkadotXcm/limitedReserveTransferAssets.ts b/src/createXcmCalls/polkadotXcm/limitedReserveTransferAssets.ts index aedbe44e..4c859c4b 100644 --- a/src/createXcmCalls/polkadotXcm/limitedReserveTransferAssets.ts +++ b/src/createXcmCalls/polkadotXcm/limitedReserveTransferAssets.ts @@ -18,7 +18,7 @@ import type { PolkadotXcmBaseArgs } from './types'; */ export const limitedReserveTransferAssets = async ( baseArgs: PolkadotXcmBaseArgs, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { const { api, direction, destAddr, assetIds, amounts, destChainId, xcmVersion, specName, registry } = baseArgs; const { isLimited, weightLimit, paysWithFeeDest, isLiquidTokenTransfer, isForeignAssetsTransfer } = opts; diff --git a/src/createXcmCalls/polkadotXcm/limitedTeleportAssets.spec.ts b/src/createXcmCalls/polkadotXcm/limitedTeleportAssets.spec.ts index 41c63ffe..a644c391 100644 --- a/src/createXcmCalls/polkadotXcm/limitedTeleportAssets.spec.ts +++ b/src/createXcmCalls/polkadotXcm/limitedTeleportAssets.spec.ts @@ -40,7 +40,7 @@ describe('limitedTeleportAssets', () => { }); expect(ext.toHex()).toBe( - '0x1501041f0901010100a10f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b010400000204320504009101000000000102286bee411f' + '0x1501041f0901010100a10f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b010400000204320504009101000000000102286bee411f', ); }); it('Should error when a api does not support the required pallets', async () => { diff --git a/src/createXcmCalls/polkadotXcm/limitedTeleportAssets.ts b/src/createXcmCalls/polkadotXcm/limitedTeleportAssets.ts index 24539605..34d53cce 100644 --- a/src/createXcmCalls/polkadotXcm/limitedTeleportAssets.ts +++ b/src/createXcmCalls/polkadotXcm/limitedTeleportAssets.ts @@ -17,7 +17,7 @@ import type { PolkadotXcmBaseArgs } from './types'; */ export const limitedTeleportAssets = async ( baseArgs: PolkadotXcmBaseArgs, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { const { api, direction, destAddr, assetIds, amounts, destChainId, xcmVersion, specName, registry } = baseArgs; const { isLimited, weightLimit, paysWithFeeDest, isForeignAssetsTransfer } = opts; diff --git a/src/createXcmCalls/polkadotXcm/reserveTransferAssets.spec.ts b/src/createXcmCalls/polkadotXcm/reserveTransferAssets.spec.ts index 1d5450e9..31beb699 100644 --- a/src/createXcmCalls/polkadotXcm/reserveTransferAssets.spec.ts +++ b/src/createXcmCalls/polkadotXcm/reserveTransferAssets.spec.ts @@ -38,7 +38,7 @@ describe('reserveTransferAssets', () => { }); expect(ext.toHex()).toBe( - '0xf8041f0201010100a10f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01040000020432050400910100000000' + '0xf8041f0201010100a10f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01040000020432050400910100000000', ); }); it('Should error when a api does not support the required pallets', async () => { @@ -67,7 +67,7 @@ describe('reserveTransferAssets', () => { }); expect(ext.toHex()).toBe( - '0x0501041f02010101009d1f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01040001030435003521050000910100000000' + '0x0501041f02010101009d1f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01040001030435003521050000910100000000', ); }); @@ -83,7 +83,7 @@ describe('reserveTransferAssets', () => { }); expect(ext.toHex()).toBe( - '0x0501041f02030101009d1f0300010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b03040001030435003521050000910100000000' + '0x0501041f02030101009d1f0300010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b03040001030435003521050000910100000000', ); }); }); diff --git a/src/createXcmCalls/polkadotXcm/reserveTransferAssets.ts b/src/createXcmCalls/polkadotXcm/reserveTransferAssets.ts index 97b45dcd..0939c97d 100644 --- a/src/createXcmCalls/polkadotXcm/reserveTransferAssets.ts +++ b/src/createXcmCalls/polkadotXcm/reserveTransferAssets.ts @@ -17,7 +17,7 @@ import type { PolkadotXcmBaseArgs } from './types'; */ export const reserveTransferAssets = async ( baseArgs: PolkadotXcmBaseArgs, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { const { api, direction, destAddr, assetIds, amounts, destChainId, xcmVersion, specName, registry } = baseArgs; const { paysWithFeeDest, isLiquidTokenTransfer, isForeignAssetsTransfer } = opts; diff --git a/src/createXcmCalls/polkadotXcm/teleportAssets.spec.ts b/src/createXcmCalls/polkadotXcm/teleportAssets.spec.ts index 655dcb0e..7059c26d 100644 --- a/src/createXcmCalls/polkadotXcm/teleportAssets.spec.ts +++ b/src/createXcmCalls/polkadotXcm/teleportAssets.spec.ts @@ -31,7 +31,7 @@ describe('teleportAssets', () => { }); expect(ext.toHex()).toBe( - '0xf8041f0101010100511f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01040000020432050400910100000000' + '0xf8041f0101010100511f0100010100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01040000020432050400910100000000', ); }); it('Should error when a api does not support the required pallets', async () => { diff --git a/src/createXcmCalls/polkadotXcm/teleportAssets.ts b/src/createXcmCalls/polkadotXcm/teleportAssets.ts index c868bd21..38f1a531 100644 --- a/src/createXcmCalls/polkadotXcm/teleportAssets.ts +++ b/src/createXcmCalls/polkadotXcm/teleportAssets.ts @@ -17,7 +17,7 @@ import type { PolkadotXcmBaseArgs } from './types'; */ export const teleportAssets = async ( baseArgs: PolkadotXcmBaseArgs, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { const { api, direction, destAddr, assetIds, amounts, destChainId, xcmVersion, specName, registry } = baseArgs; const { paysWithFeeDest, isForeignAssetsTransfer } = opts; diff --git a/src/createXcmCalls/util/establishXcmPallet.ts b/src/createXcmCalls/util/establishXcmPallet.ts index d0211349..ea83bc79 100644 --- a/src/createXcmCalls/util/establishXcmPallet.ts +++ b/src/createXcmCalls/util/establishXcmPallet.ts @@ -23,7 +23,7 @@ export const establishXcmPallet = ( api: ApiPromise, direction?: Direction, isForeignAssetsTransfer?: boolean, - isParachainPrimaryNativeAsset?: boolean + isParachainPrimaryNativeAsset?: boolean, ): XcmPalletName => { let xPallet: XcmPalletName | undefined; if (api.tx.xTokens) { @@ -48,7 +48,7 @@ export const establishXcmPallet = ( } else { throw new BaseError( "Can't find the `polkadotXcm` or `xcmPallet` pallet with the given API", - BaseErrorsEnum.PalletNotFound + BaseErrorsEnum.PalletNotFound, ); } }; @@ -62,7 +62,7 @@ const isXTokensOriginNonForeignAssetsPalletTx = ( xPallet?: XcmPalletName, direction?: Direction | string, isForeignAssetsTransfer?: boolean, - isParachainPrimaryNativeAsset?: boolean + isParachainPrimaryNativeAsset?: boolean, ): boolean => { if ( !isForeignAssetsTransfer && diff --git a/src/createXcmCalls/xTokens/transferMultiAsset.spec.ts b/src/createXcmCalls/xTokens/transferMultiAsset.spec.ts index b42b79ec..bcc886d8 100644 --- a/src/createXcmCalls/xTokens/transferMultiAsset.spec.ts +++ b/src/createXcmCalls/xTokens/transferMultiAsset.spec.ts @@ -29,7 +29,7 @@ describe('transferMultiasset', () => { }); expect(ext.toHex()).toBe( - '0xf4046a010100010300a10f043205011f0002093d0001010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b00' + '0xf4046a010100010300a10f043205011f0002093d0001010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b00', ); }); it('Should correctly construct a Limited transferMultiasset tx for V2', async () => { @@ -44,7 +44,7 @@ describe('transferMultiasset', () => { }); expect(ext.toHex()).toBe( - '0x0501046a010100010300a10f043205011f0002093d0001010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01a10f411f' + '0x0501046a010100010300a10f043205011f0002093d0001010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01a10f411f', ); }); @@ -55,11 +55,11 @@ describe('transferMultiasset', () => { isLimited: false, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(ext.toHex()).toBe( - '0xec046a010300010300a10f043205011f00910103010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b00' + '0xec046a010300010300a10f043205011f00910103010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b00', ); }); it('Should correctly construct a Limited transferMultiasset tx for V3', async () => { @@ -73,11 +73,11 @@ describe('transferMultiasset', () => { }, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(ext.toHex()).toBe( - '0xe4046a01030001000002093d0003010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01a10f411f' + '0xe4046a01030001000002093d0003010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01a10f411f', ); }); }); diff --git a/src/createXcmCalls/xTokens/transferMultiAssetWithFee.spec.ts b/src/createXcmCalls/xTokens/transferMultiAssetWithFee.spec.ts index cf61c28e..25bad0e5 100644 --- a/src/createXcmCalls/xTokens/transferMultiAssetWithFee.spec.ts +++ b/src/createXcmCalls/xTokens/transferMultiAssetWithFee.spec.ts @@ -40,7 +40,7 @@ describe('transferMultiassetWithFee', () => { }); expect(ext.toHex()).toBe( - '0x2d01046a030100010300a10f043205011f0002093d000100010300a10f043205011f000001010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b00' + '0x2d01046a030100010300a10f043205011f0002093d000100010300a10f043205011f000001010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b00', ); }); it('Should correctly construct a Limited transferMultiassetWithFee tx for V2', async () => { @@ -62,7 +62,7 @@ describe('transferMultiassetWithFee', () => { }); expect(ext.toHex()).toBe( - '0x3d01046a030100010300a10f043205011f0002093d000100010300a10f043205011f000001010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01a10f411f' + '0x3d01046a030100010300a10f043205011f0002093d000100010300a10f043205011f000001010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01a10f411f', ); }); @@ -89,11 +89,11 @@ describe('transferMultiassetWithFee', () => { paysWithFeeDest, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(ext.toHex()).toBe( - '0x1501046a0303000100000700e40b54020300010300a10f043205011f000003010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b00' + '0x1501046a0303000100000700e40b54020300010300a10f043205011f000003010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b00', ); }); it('Should correctly construct a Limited transferMultiasset tx for V3', async () => { @@ -118,11 +118,11 @@ describe('transferMultiassetWithFee', () => { paysWithFeeDest, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(ext.toHex()).toBe( - '0x3501046a030300010300a10f043205011f0091010300010300a10f043205011f000003010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01a10f411f' + '0x3501046a030300010300a10f043205011f0091010300010300a10f043205011f000003010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01a10f411f', ); }); }); diff --git a/src/createXcmCalls/xTokens/transferMultiAssets.spec.ts b/src/createXcmCalls/xTokens/transferMultiAssets.spec.ts index 84fe0f25..184a2c07 100644 --- a/src/createXcmCalls/xTokens/transferMultiAssets.spec.ts +++ b/src/createXcmCalls/xTokens/transferMultiAssets.spec.ts @@ -39,7 +39,7 @@ describe('transferMultiassets', () => { }); expect(ext.toHex()).toBe( - '0x3501046a050108000100000700e40b540200010300a10f04320520000700ba1dd2050000000001010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b00' + '0x3501046a050108000100000700e40b540200010300a10f04320520000700ba1dd2050000000001010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b00', ); expect(true).toBe(true); @@ -65,11 +65,11 @@ describe('transferMultiassets', () => { paysWithFeeDest, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(ext.toHex()).toBe( - '0x5d01046a05010800010300a10f043205200002093d0000010300a10f043205011f000700743ba40b0000000001010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01a10f411f' + '0x5d01046a05010800010300a10f043205200002093d0000010300a10f043205011f000700743ba40b0000000001010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01a10f411f', ); }); @@ -95,11 +95,11 @@ describe('transferMultiassets', () => { paysWithFeeDest, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(ext.toHex()).toBe( - '0x3101046a050308000100000700c817a80400010300a10f043205011f0002093d000100000003010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b00' + '0x3101046a050308000100000700c817a80400010300a10f043205011f0002093d000100000003010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b00', ); }); it('Should correctly construct a Limited transferMultiassets tx for V3', async () => { @@ -124,11 +124,11 @@ describe('transferMultiassets', () => { paysWithFeeDest, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(ext.toHex()).toBe( - '0x1901046a05030400010300a10f043205011f0002093d000000000003010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01a10f411f' + '0x1901046a05030400010300a10f043205011f0002093d000000000003010200a10f0100f5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b01a10f411f', ); }); }); diff --git a/src/createXcmCalls/xTokens/transferMultiasset.ts b/src/createXcmCalls/xTokens/transferMultiasset.ts index dfd811f1..b1963a9b 100644 --- a/src/createXcmCalls/xTokens/transferMultiasset.ts +++ b/src/createXcmCalls/xTokens/transferMultiasset.ts @@ -17,7 +17,7 @@ import type { XTokensBaseArgs } from './types'; */ export const transferMultiasset = async ( baseArgs: XTokensBaseArgs, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { const { api, direction, destAddr, assetIds, amounts, destChainId, xcmVersion, specName, registry } = baseArgs; const { isLimited, weightLimit, isForeignAssetsTransfer, isLiquidTokenTransfer } = opts; diff --git a/src/createXcmCalls/xTokens/transferMultiassetWithFee.ts b/src/createXcmCalls/xTokens/transferMultiassetWithFee.ts index eac85e0a..3cb48713 100644 --- a/src/createXcmCalls/xTokens/transferMultiassetWithFee.ts +++ b/src/createXcmCalls/xTokens/transferMultiassetWithFee.ts @@ -17,7 +17,7 @@ import type { XTokensBaseArgs } from './types'; */ export const transferMultiassetWithFee = async ( baseArgs: XTokensBaseArgs, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { const { api, direction, destAddr, assetIds, amounts, destChainId, xcmVersion, specName, registry } = baseArgs; const { isLimited, weightLimit, paysWithFeeDest, isForeignAssetsTransfer, isLiquidTokenTransfer } = opts; diff --git a/src/createXcmCalls/xTokens/transferMultiassets.ts b/src/createXcmCalls/xTokens/transferMultiassets.ts index 803dc2fd..06045704 100644 --- a/src/createXcmCalls/xTokens/transferMultiassets.ts +++ b/src/createXcmCalls/xTokens/transferMultiassets.ts @@ -19,7 +19,7 @@ import type { XTokensBaseArgs } from './types'; */ export const transferMultiassets = async ( baseArgs: XTokensBaseArgs, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { const { api, direction, destAddr, assetIds, amounts, destChainId, xcmVersion, specName, registry } = baseArgs; const { isLimited, weightLimit, paysWithFeeDest, isForeignAssetsTransfer, isLiquidTokenTransfer } = opts; diff --git a/src/createXcmTypes/ParaToPara.spec.ts b/src/createXcmTypes/ParaToPara.spec.ts index 8b9fe8eb..d8764f33 100644 --- a/src/createXcmTypes/ParaToPara.spec.ts +++ b/src/createXcmTypes/ParaToPara.spec.ts @@ -10,7 +10,7 @@ describe('ParaToPara', () => { it('Should work for V2', () => { const beneficiary = ParaToPara.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 2 + 2, ); const expectedRes = { @@ -51,7 +51,7 @@ describe('ParaToPara', () => { it('Should work for V3', () => { const beneficiary = ParaToPara.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 3 + 3, ); const expectedRes = { @@ -136,7 +136,7 @@ describe('ParaToPara', () => { isForeignAssetsTransfer, isLiquidTokenTransfer, api: mockMoonriverParachainApi, - } + }, ); const expectedRes = { @@ -183,7 +183,7 @@ describe('ParaToPara', () => { isForeignAssetsTransfer, isLiquidTokenTransfer, api: mockMoonriverParachainApi, - } + }, ); const expectedRes = { diff --git a/src/createXcmTypes/ParaToPara.ts b/src/createXcmTypes/ParaToPara.ts index e636adf9..b7c2262c 100644 --- a/src/createXcmTypes/ParaToPara.ts +++ b/src/createXcmTypes/ParaToPara.ts @@ -117,7 +117,7 @@ export const ParaToPara: ICreateXcmType = { xcmVersion: number, specName: string, assets: string[], - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ): Promise => { const { registry, isForeignAssetsTransfer } = opts; @@ -128,7 +128,7 @@ export const ParaToPara: ICreateXcmType = { assets, xcmVersion, registry, - isForeignAssetsTransfer + isForeignAssetsTransfer, ); if (xcmVersion === 2) { @@ -172,7 +172,7 @@ export const ParaToPara: ICreateXcmType = { assetIds, xcmVersion, registry, - isForeignAssetsTransfer + isForeignAssetsTransfer, ); const assetIndex = getFeeAssetItemIndex( @@ -182,7 +182,7 @@ export const ParaToPara: ICreateXcmType = { multiAssets, specName, xcmVersion, - isForeignAssetsTransfer + isForeignAssetsTransfer, ); return assetIndex; @@ -200,7 +200,7 @@ export const ParaToPara: ICreateXcmType = { createXTokensBeneficiary: ( destChainId: string, accountId: string, - xcmVersion: number + xcmVersion: number, ): XcmDestBenificiaryXcAssets => { if (xcmVersion === 2) { return { @@ -240,7 +240,7 @@ export const ParaToPara: ICreateXcmType = { xcmVersion: number, specName: string, assets: string[], - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ): Promise => { return await createXTokensMultiAssets(amounts, xcmVersion, specName, assets, opts); }, @@ -258,7 +258,7 @@ export const ParaToPara: ICreateXcmType = { xcmVersion: number, specName: string, assetId: string, - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ): Promise => { const { registry, api } = opts; @@ -267,7 +267,7 @@ export const ParaToPara: ICreateXcmType = { assetId, specName, xcmVersion, - registry + registry, ); const parsedMultiLocation = JSON.parse(xcAssetMultiLocationStr) as XCMAssetRegistryMultiLocation; const xcAssetMultiLocation = parsedMultiLocation.v1 as unknown as AnyJson; @@ -337,7 +337,7 @@ const createXTokensMultiAssets = async ( xcmVersion: number, specName: string, assets: string[], - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ): Promise => { const { registry, api } = opts; let multiAssets: FungibleObjMultiAsset[] = []; @@ -351,7 +351,7 @@ const createXTokensMultiAssets = async ( assetId, specName, xcmVersion, - registry + registry, ); const parsedMultiLocation = JSON.parse(xcAssetMultiLocationStr) as XCMAssetRegistryMultiLocation; const xcAssetMultiLocation = parsedMultiLocation.v1 as unknown as AnyJson; @@ -401,7 +401,7 @@ const createParaToParaMultiAssets = async ( assets: string[], xcmVersion: number, registry: Registry, - isForeignAssetsTransfer: boolean + isForeignAssetsTransfer: boolean, ): Promise => { const palletId = fetchPalletInstanceId(api, false, isForeignAssetsTransfer); let multiAssets: FungibleStrMultiAsset[] = []; @@ -410,7 +410,7 @@ const createParaToParaMultiAssets = async ( registry, specName, Direction.ParaToPara, - assets[0] + assets[0], ); if (isPrimaryParachainNativeAsset) { @@ -419,7 +419,7 @@ const createParaToParaMultiAssets = async ( parents: 0, interior: { Here: '' }, }, - xcmVersion + xcmVersion, ); const multiAsset = { @@ -442,7 +442,7 @@ const createParaToParaMultiAssets = async ( assetId, specName, xcmVersion, - registry + registry, ); const parsedMultiLocation = JSON.parse(xcAssetMultiLocationStr) as XCMAssetRegistryMultiLocation; const xcAssetMultiLocation = parsedMultiLocation.v1 as unknown as AnyJson; diff --git a/src/createXcmTypes/ParaToRelay.spec.ts b/src/createXcmTypes/ParaToRelay.spec.ts index c2cff2e0..b2a6b0e5 100644 --- a/src/createXcmTypes/ParaToRelay.spec.ts +++ b/src/createXcmTypes/ParaToRelay.spec.ts @@ -16,7 +16,7 @@ describe('ParaToRelay', () => { it('Should work for V2', () => { const beneficiary = ParaToRelay.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 2 + 2, ); const expectedRes = { @@ -38,7 +38,7 @@ describe('ParaToRelay', () => { it('Should work for V3', () => { const beneficiary = ParaToRelay.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 3 + 3, ); const expectedRes = { @@ -169,7 +169,7 @@ describe('ParaToRelay', () => { const xTokensBeneficiary = ParaToRelay.createXTokensBeneficiary( '', '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 2 + 2, ); const expected = { V2: { @@ -188,7 +188,7 @@ describe('ParaToRelay', () => { const xTokensBeneficiary = ParaToRelay.createXTokensBeneficiary( '', '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 3 + 3, ); const expected = { V3: { diff --git a/src/createXcmTypes/ParaToSystem.spec.ts b/src/createXcmTypes/ParaToSystem.spec.ts index 98aa8a97..8adc996e 100644 --- a/src/createXcmTypes/ParaToSystem.spec.ts +++ b/src/createXcmTypes/ParaToSystem.spec.ts @@ -10,7 +10,7 @@ describe('ParaToSystem', () => { it('Should work for V2', () => { const beneficiary = ParaToSystem.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 2 + 2, ); const expectedRes = { @@ -32,7 +32,7 @@ describe('ParaToSystem', () => { it('Should work for V3', () => { const beneficiary = ParaToSystem.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 3 + 3, ); const expectedRes = { @@ -99,7 +99,7 @@ describe('ParaToSystem', () => { isForeignAssetsTransfer, isLiquidTokenTransfer, api: mockMoonriverParachainApi, - } + }, ); const expectedRes = { @@ -146,7 +146,7 @@ describe('ParaToSystem', () => { isForeignAssetsTransfer, isLiquidTokenTransfer, api: mockMoonriverParachainApi, - } + }, ); const expectedRes = { diff --git a/src/createXcmTypes/ParaToSystem.ts b/src/createXcmTypes/ParaToSystem.ts index a4c1535f..28d13fed 100644 --- a/src/createXcmTypes/ParaToSystem.ts +++ b/src/createXcmTypes/ParaToSystem.ts @@ -110,7 +110,7 @@ export const ParaToSystem: ICreateXcmType = { xcmVersion: number, specName: string, assets: string[], - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ): Promise => { const sortedAndDedupedMultiAssets = await createParaToSystemMultiAssets( opts.api, @@ -119,7 +119,7 @@ export const ParaToSystem: ICreateXcmType = { assets, xcmVersion, opts.registry, - opts.isForeignAssetsTransfer + opts.isForeignAssetsTransfer, ); if (xcmVersion === 2) { @@ -163,7 +163,7 @@ export const ParaToSystem: ICreateXcmType = { assetIds, xcmVersion, registry, - opts.isForeignAssetsTransfer + opts.isForeignAssetsTransfer, ); const assetIndex = getFeeAssetItemIndex( @@ -173,7 +173,7 @@ export const ParaToSystem: ICreateXcmType = { multiAssets, specName, xcmVersion, - opts.isForeignAssetsTransfer + opts.isForeignAssetsTransfer, ); return assetIndex; @@ -191,7 +191,7 @@ export const ParaToSystem: ICreateXcmType = { createXTokensBeneficiary: ( destChainId: string, accountId: string, - xcmVersion: number + xcmVersion: number, ): XcmDestBenificiaryXcAssets => { if (xcmVersion === 2) { return { @@ -227,7 +227,7 @@ export const ParaToSystem: ICreateXcmType = { xcmVersion: number, specName: string, assets: string[], - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ): Promise => { return await createXTokensMultiAssets(amounts, xcmVersion, specName, assets, opts); }, @@ -245,7 +245,7 @@ export const ParaToSystem: ICreateXcmType = { xcmVersion: number, specName: string, assetId: string, - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ): Promise => { const { registry, api } = opts; @@ -254,7 +254,7 @@ export const ParaToSystem: ICreateXcmType = { assetId, specName, xcmVersion, - registry + registry, ); const parsedMultiLocation = JSON.parse(xcAssetMultiLocationStr) as XCMAssetRegistryMultiLocation; const xcAssetMultiLocation = parsedMultiLocation.v1 as unknown as AnyJson; @@ -323,7 +323,7 @@ const createXTokensMultiAssets = async ( xcmVersion: number, specName: string, assets: string[], - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ): Promise => { const { registry, api } = opts; let multiAssets: FungibleObjMultiAsset[] = []; @@ -337,7 +337,7 @@ const createXTokensMultiAssets = async ( assetId, specName, xcmVersion, - registry + registry, ); const parsedMultiLocation = JSON.parse(xcAssetMultiLocationStr) as XCMAssetRegistryMultiLocation; const xcAssetMultiLocation = parsedMultiLocation.v1 as unknown as AnyJson; @@ -386,7 +386,7 @@ const createParaToSystemMultiAssets = async ( assets: string[], xcmVersion: number, registry: Registry, - isForeignAssetsTransfer: boolean + isForeignAssetsTransfer: boolean, ): Promise => { const palletId = fetchPalletInstanceId(api, false, isForeignAssetsTransfer); let multiAssets: FungibleStrMultiAsset[] = []; @@ -395,7 +395,7 @@ const createParaToSystemMultiAssets = async ( registry, specName, Direction.ParaToSystem, - assets[0] + assets[0], ); if (isPrimaryParachainNativeAsset) { @@ -404,7 +404,7 @@ const createParaToSystemMultiAssets = async ( parents: 0, interior: { Here: '' }, }, - xcmVersion + xcmVersion, ); const multiAsset = { @@ -427,7 +427,7 @@ const createParaToSystemMultiAssets = async ( assetId, specName, xcmVersion, - registry + registry, ); const parsedMultiLocation = JSON.parse(xcAssetMultiLocationStr) as XCMAssetRegistryMultiLocation; const xcAssetMultiLocation = parsedMultiLocation.v1 as unknown as AnyJson; diff --git a/src/createXcmTypes/RelayToPara.spec.ts b/src/createXcmTypes/RelayToPara.spec.ts index edff6817..a167f7d5 100644 --- a/src/createXcmTypes/RelayToPara.spec.ts +++ b/src/createXcmTypes/RelayToPara.spec.ts @@ -10,7 +10,7 @@ describe('RelayToPara XcmVersioned Generation', () => { it('Should work for V2', () => { const beneficiary = RelayToPara.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 2 + 2, ); const expectedRes = { @@ -51,7 +51,7 @@ describe('RelayToPara XcmVersioned Generation', () => { it('Should work for V3', () => { const beneficiary = RelayToPara.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 3 + 3, ); const expectedRes = { diff --git a/src/createXcmTypes/RelayToSystem.spec.ts b/src/createXcmTypes/RelayToSystem.spec.ts index e645dc34..41d771a3 100644 --- a/src/createXcmTypes/RelayToSystem.spec.ts +++ b/src/createXcmTypes/RelayToSystem.spec.ts @@ -10,7 +10,7 @@ describe('RelayToSystem XcmVersioned Generation', () => { it('Should work for V2', () => { const beneficiary = RelayToSystem.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 2 + 2, ); const expectedRes = { @@ -32,7 +32,7 @@ describe('RelayToSystem XcmVersioned Generation', () => { it('Should work for V3', () => { const beneficiary = RelayToSystem.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 3 + 3, ); const expectedRes = { diff --git a/src/createXcmTypes/SystemToPara.spec.ts b/src/createXcmTypes/SystemToPara.spec.ts index 9008e0a6..5a496bd7 100644 --- a/src/createXcmTypes/SystemToPara.spec.ts +++ b/src/createXcmTypes/SystemToPara.spec.ts @@ -12,7 +12,7 @@ describe('SystemToPara XcmVersioned Generation', () => { it('Should work for V2', () => { const beneficiary = SystemToPara.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 2 + 2, ); const expectedRes = { @@ -53,7 +53,7 @@ describe('SystemToPara XcmVersioned Generation', () => { it('Should work for V3', () => { const beneficiary = SystemToPara.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 3 + 3, ); const expectedRes = { @@ -327,7 +327,7 @@ describe('SystemToPara XcmVersioned Generation', () => { registry, 2, false, - false + false, ); expect(result).toStrictEqual(expected); diff --git a/src/createXcmTypes/SystemToPara.ts b/src/createXcmTypes/SystemToPara.ts index 47b2200a..15b7ec40 100644 --- a/src/createXcmTypes/SystemToPara.ts +++ b/src/createXcmTypes/SystemToPara.ts @@ -113,7 +113,7 @@ export const SystemToPara: ICreateXcmType = { xcmVersion: number, specName: string, assets: string[], - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ): Promise => { const { registry, isForeignAssetsTransfer, isLiquidTokenTransfer, api } = opts; const sortedAndDedupedMultiAssets = await createSystemToParaMultiAssets( @@ -124,7 +124,7 @@ export const SystemToPara: ICreateXcmType = { registry, xcmVersion, isForeignAssetsTransfer, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); if (xcmVersion === 2) { @@ -178,14 +178,14 @@ export const SystemToPara: ICreateXcmType = { registry, xcmVersion, isForeignAssetsTransfer, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); const systemChainId = registry.lookupChainIdBySpecName(specName); if (!isSystemChain(systemChainId)) { throw new BaseError( `specName ${specName} did not match a valid system chain ID. Found ID ${systemChainId}`, - BaseErrorsEnum.InternalError + BaseErrorsEnum.InternalError, ); } @@ -196,7 +196,7 @@ export const SystemToPara: ICreateXcmType = { multiAssets, specName, xcmVersion, - isForeignAssetsTransfer + isForeignAssetsTransfer, ); return assetIndex; @@ -226,7 +226,7 @@ export const createSystemToParaMultiAssets = async ( registry: Registry, xcmVersion: number, isForeignAssetsTransfer: boolean, - isLiquidTokenTransfer: boolean + isLiquidTokenTransfer: boolean, ): Promise => { let multiAssets: FungibleStrMultiAsset[] = []; const palletId = fetchPalletInstanceId(api, isLiquidTokenTransfer, isForeignAssetsTransfer); @@ -235,7 +235,7 @@ export const createSystemToParaMultiAssets = async ( if (!isSystemChain(systemChainId)) { throw new BaseError( `specName ${specName} did not match a valid system chain ID. Found ID ${systemChainId}`, - BaseErrorsEnum.InternalError + BaseErrorsEnum.InternalError, ); } diff --git a/src/createXcmTypes/SystemToRelay.spec.ts b/src/createXcmTypes/SystemToRelay.spec.ts index 8e87acde..5bfe867d 100644 --- a/src/createXcmTypes/SystemToRelay.spec.ts +++ b/src/createXcmTypes/SystemToRelay.spec.ts @@ -11,7 +11,7 @@ describe('SystemToRelay XcmVersioned Generation', () => { it('Should work for V2', () => { const beneficiary = SystemToRelay.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 2 + 2, ); const expectedRes = { @@ -33,7 +33,7 @@ describe('SystemToRelay XcmVersioned Generation', () => { it('Should work for V3', () => { const beneficiary = SystemToRelay.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 3 + 3, ); const expectedRes = { diff --git a/src/createXcmTypes/SystemToSystem.spec.ts b/src/createXcmTypes/SystemToSystem.spec.ts index 416cd6e8..720cb55e 100644 --- a/src/createXcmTypes/SystemToSystem.spec.ts +++ b/src/createXcmTypes/SystemToSystem.spec.ts @@ -11,7 +11,7 @@ describe('SystemToSystem XcmVersioned Generation', () => { it('Should work for V2', () => { const beneficiary = SystemToSystem.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 2 + 2, ); const expectedRes = { @@ -33,7 +33,7 @@ describe('SystemToSystem XcmVersioned Generation', () => { it('Should work for V3', () => { const beneficiary = SystemToSystem.createBeneficiary( '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - 3 + 3, ); const expectedRes = { diff --git a/src/createXcmTypes/SystemToSystem.ts b/src/createXcmTypes/SystemToSystem.ts index e71b7bbd..cba1258d 100644 --- a/src/createXcmTypes/SystemToSystem.ts +++ b/src/createXcmTypes/SystemToSystem.ts @@ -105,7 +105,7 @@ export const SystemToSystem: ICreateXcmType = { xcmVersion: number, specName: string, assets: string[], - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ): Promise => { const { registry, isForeignAssetsTransfer, isLiquidTokenTransfer, api } = opts; @@ -117,7 +117,7 @@ export const SystemToSystem: ICreateXcmType = { registry, xcmVersion, isForeignAssetsTransfer, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); if (xcmVersion === 2) { @@ -171,7 +171,7 @@ export const SystemToSystem: ICreateXcmType = { registry, xcmVersion, isForeignAssetsTransfer, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); const systemChainId = registry.lookupChainIdBySpecName(specName); @@ -179,7 +179,7 @@ export const SystemToSystem: ICreateXcmType = { if (!isSystemChain(systemChainId)) { throw new BaseError( `specName ${specName} did not match a valid system chain ID. Found ID ${systemChainId}`, - BaseErrorsEnum.InternalError + BaseErrorsEnum.InternalError, ); } @@ -190,7 +190,7 @@ export const SystemToSystem: ICreateXcmType = { multiAssets, specName, xcmVersion, - opts.isForeignAssetsTransfer + opts.isForeignAssetsTransfer, ); return assetIndex; @@ -220,7 +220,7 @@ export const createSystemToSystemMultiAssets = async ( registry: Registry, xcmVersion: number, isForeignAssetsTransfer: boolean, - isLiquidTokenTransfer: boolean + isLiquidTokenTransfer: boolean, ): Promise => { let multiAssets: FungibleStrMultiAsset[] = []; const systemChainId = registry.lookupChainIdBySpecName(specName); @@ -229,7 +229,7 @@ export const createSystemToSystemMultiAssets = async ( if (!isSystemChain(systemChainId)) { throw new BaseError( `specName ${specName} did not match a valid system chain ID. Found ID ${systemChainId}`, - BaseErrorsEnum.InternalError + BaseErrorsEnum.InternalError, ); } @@ -270,7 +270,7 @@ export const createSystemToSystemMultiAssets = async ( parents: assetIdMultiLocation.parents, interior: JSON.parse(interiorMultiLocationStr) as RequireOnlyOne, }, - xcmVersion + xcmVersion, ); } else { const parents = isRelayNative ? 1 : 0; @@ -284,7 +284,7 @@ export const createSystemToSystemMultiAssets = async ( parents, interior, }, - xcmVersion + xcmVersion, ); } diff --git a/src/createXcmTypes/types.ts b/src/createXcmTypes/types.ts index f57fc2a9..4a796152 100644 --- a/src/createXcmTypes/types.ts +++ b/src/createXcmTypes/types.ts @@ -49,7 +49,7 @@ export interface XcmV2Junctions { XcmV2Junction, XcmV2Junction, XcmV2Junction, - XcmV2Junction + XcmV2Junction, ]; } @@ -91,7 +91,7 @@ export interface XcmV3Junctions { XcmV3Junction, XcmV3Junction, XcmV3Junction, - XcmV3Junction + XcmV3Junction, ]; } @@ -287,7 +287,7 @@ export interface ICreateXcmType { xcmVersion: number, specName: string, assets: string[], - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ) => Promise; createWeightLimit: (opts: CreateWeightLimitOpts) => XcmWeight; createFeeAssetItem: (api: ApiPromise, opts: CreateFeeAssetItemOpts) => Promise; @@ -297,14 +297,14 @@ export interface ICreateXcmType { xcmVersion: number, specName: string, assets: string[], - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ) => Promise; createXTokensAsset?: ( amount: string, xcmVersion: number, specName: string, asset: string, - opts: CreateAssetsOpts + opts: CreateAssetsOpts, ) => Promise; createXTokensWeightLimit?: (opts: CreateWeightLimitOpts) => XcmWeight; createXTokensFeeAssetItem?: (opts: CreateFeeAssetItemOpts) => UnionXcAssetsMultiLocation; diff --git a/src/createXcmTypes/util/constructForeignAssetMultiLocationFromAssetId.ts b/src/createXcmTypes/util/constructForeignAssetMultiLocationFromAssetId.ts index 31ff6806..4c2ceca3 100644 --- a/src/createXcmTypes/util/constructForeignAssetMultiLocationFromAssetId.ts +++ b/src/createXcmTypes/util/constructForeignAssetMultiLocationFromAssetId.ts @@ -17,7 +17,7 @@ import { resolveMultiLocation } from '../../util/resolveMultiLocation'; export const constructForeignAssetMultiLocationFromAssetId = ( multiLocationAssetId: string, foreignAssetsPalletInstance: string, - xcmVersion: number + xcmVersion: number, ): UnionXcmMultiLocation => { const numberOfAdditionalJunctions = 1; const assetIdMultiLocation = resolveMultiLocation(multiLocationAssetId, xcmVersion); diff --git a/src/createXcmTypes/util/dedupeMultiAssets.ts b/src/createXcmTypes/util/dedupeMultiAssets.ts index 424a019b..e2a26127 100644 --- a/src/createXcmTypes/util/dedupeMultiAssets.ts +++ b/src/createXcmTypes/util/dedupeMultiAssets.ts @@ -8,7 +8,7 @@ import type { FungibleObjMultiAsset, FungibleStrMultiAsset } from '../../createX * @param multiAssets MulitAsset[] */ export const dedupeMultiAssets = ( - multiAssets: FungibleStrMultiAsset[] | FungibleObjMultiAsset[] + multiAssets: FungibleStrMultiAsset[] | FungibleObjMultiAsset[], ): FungibleStrMultiAsset[] | FungibleObjMultiAsset[] => { const dedupedAssets = []; diff --git a/src/createXcmTypes/util/fetchPalletInstanceId.ts b/src/createXcmTypes/util/fetchPalletInstanceId.ts index a0fa64d3..8725bcd5 100644 --- a/src/createXcmTypes/util/fetchPalletInstanceId.ts +++ b/src/createXcmTypes/util/fetchPalletInstanceId.ts @@ -14,7 +14,7 @@ export const fetchPalletInstanceId = (api: ApiPromise, isLiquidToken: boolean, i if (isLiquidToken && isForeignAsset) { throw new BaseError( "Can't find the appropriate pallet when both liquid tokens and foreign assets", - BaseErrorsEnum.InternalError + BaseErrorsEnum.InternalError, ); } @@ -22,10 +22,10 @@ export const fetchPalletInstanceId = (api: ApiPromise, isLiquidToken: boolean, i isLiquidToken && api.query.poolAssets ? 'PoolAssets' : isForeignAsset && api.query.foreignAssets - ? 'ForeignAssets' - : api.query.assets - ? 'Assets' - : ''; + ? 'ForeignAssets' + : api.query.assets + ? 'Assets' + : ''; // return early if assets pallet is not found and palletName is not PoolAssets or ForeignAssets if (!api.query.assets && palletName.length === 0) { @@ -37,7 +37,7 @@ export const fetchPalletInstanceId = (api: ApiPromise, isLiquidToken: boolean, i if (pallet.length === 0) { throw new BaseError( `No ${palletName} pallet available, can't find a valid PalletInstance.`, - BaseErrorsEnum.PalletNotFound + BaseErrorsEnum.PalletNotFound, ); } diff --git a/src/createXcmTypes/util/foreignAssetMultiLocationIsInCacheOrRegistry.ts b/src/createXcmTypes/util/foreignAssetMultiLocationIsInCacheOrRegistry.ts index c5131567..f1930d13 100644 --- a/src/createXcmTypes/util/foreignAssetMultiLocationIsInCacheOrRegistry.ts +++ b/src/createXcmTypes/util/foreignAssetMultiLocationIsInCacheOrRegistry.ts @@ -9,7 +9,7 @@ import { sanitizeKeys } from '../../util/sanitizeKeys'; export const foreignAssetMultiLocationIsInCacheOrRegistry = ( multilocationStr: string, registry: Registry, - xcmVersion: number + xcmVersion: number, ): boolean => { // check if foreign asset exists in assets cache const foreignAssetsCache = registry.cache[registry.relayChain][ASSET_HUB_CHAIN_ID].foreignAssetsInfo; @@ -25,7 +25,7 @@ export const foreignAssetMultiLocationIsInCacheOrRegistry = ( const checkForeignAssetExists = ( foreignAssetsInfo: ForeignAssetsInfo, multiLocationStr: string, - xcmVersion: number + xcmVersion: number, ): boolean => { const multiLocation = resolveMultiLocation(multiLocationStr, xcmVersion); diff --git a/src/createXcmTypes/util/foreignAssetsMultiLocationExists.ts b/src/createXcmTypes/util/foreignAssetsMultiLocationExists.ts index 11cde619..30da42ca 100644 --- a/src/createXcmTypes/util/foreignAssetsMultiLocationExists.ts +++ b/src/createXcmTypes/util/foreignAssetsMultiLocationExists.ts @@ -12,7 +12,7 @@ export const foreignAssetsMultiLocationExists = async ( assetHubApi: ApiPromise, registry: Registry, multilocationStr: string, - xcmVersion: number + xcmVersion: number, ): Promise => { try { const multiLocation = resolveMultiLocation(multilocationStr, xcmVersion); @@ -48,12 +48,12 @@ export const foreignAssetsMultiLocationExists = async ( throw new BaseError( `Error creating MultiLocation type:${errorDetails}`, - BaseErrorsEnum.InvalidMultiLocationAsset + BaseErrorsEnum.InvalidMultiLocationAsset, ); } else { throw new BaseError( `Error creating multilocation type: ${(error as Error).message}`, - BaseErrorsEnum.InvalidMultiLocationAsset + BaseErrorsEnum.InvalidMultiLocationAsset, ); } } diff --git a/src/createXcmTypes/util/getAssetId.spec.ts b/src/createXcmTypes/util/getAssetId.spec.ts index f8db1ce8..7d870c8b 100644 --- a/src/createXcmTypes/util/getAssetId.spec.ts +++ b/src/createXcmTypes/util/getAssetId.spec.ts @@ -91,7 +91,7 @@ describe('getAssetId', () => { '42259045809535163221576417993425387648', 'moonriver', 2, - false + false, ); expect(result).toEqual(expected); diff --git a/src/createXcmTypes/util/getAssetId.ts b/src/createXcmTypes/util/getAssetId.ts index 24f500a0..4432e5a1 100644 --- a/src/createXcmTypes/util/getAssetId.ts +++ b/src/createXcmTypes/util/getAssetId.ts @@ -28,7 +28,7 @@ export const getAssetId = async ( asset: string, specName: string, xcmVersion: number, - isForeignAssetsTransfer?: boolean + isForeignAssetsTransfer?: boolean, ): Promise => { const currentChainId = registry.lookupChainIdBySpecName(specName); const assetIsValidInt = validateNumber(asset); @@ -62,7 +62,7 @@ export const getAssetId = async ( } else { // get the corresponding assetId index from the assets registry based on symbol const registryAssetId = Object.keys(assetsInfo).find( - (key) => assetsInfo[key].toLowerCase() === asset.toLowerCase() + (key) => assetsInfo[key].toLowerCase() === asset.toLowerCase(), ); if (registryAssetId) { @@ -113,7 +113,7 @@ export const getAssetId = async ( } else { throw new BaseError( `assetId ${asset} is not a valid symbol or integer asset id for ${specName}`, - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); } } else if (isParachain) { @@ -125,7 +125,7 @@ export const getAssetId = async ( if (!paraXcAssets || paraXcAssets.length === 0) { throw new BaseError( `unable to initialize xcAssets registry for ${currentRelayChainSpecName}`, - BaseErrorsEnum.InvalidPallet + BaseErrorsEnum.InvalidPallet, ); } @@ -165,7 +165,7 @@ export const getAssetId = async ( if (assetId.length === 0) { throw new BaseError( `parachain assetId ${asset} is not a valid symbol assetIid in ${specName}`, - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); } } else { @@ -178,7 +178,7 @@ export const getAssetId = async ( } else { throw new BaseError( `parachain assetId ${asset} is not a valid integer assetIid in ${specName}`, - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); } } @@ -203,7 +203,7 @@ export const getAssetId = async ( if (assetId.length === 0) { throw new BaseError( `parachain assetId ${asset} is not a valid symbol assetId in ${specName}`, - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); } } diff --git a/src/createXcmTypes/util/getXcAssetMultiLocationByAssetId.spec.ts b/src/createXcmTypes/util/getXcAssetMultiLocationByAssetId.spec.ts index 47eee6b0..2ca4790a 100644 --- a/src/createXcmTypes/util/getXcAssetMultiLocationByAssetId.spec.ts +++ b/src/createXcmTypes/util/getXcAssetMultiLocationByAssetId.spec.ts @@ -49,7 +49,7 @@ describe('getXcAssetMultiLocationByAssetId', () => { assetId, specName, xcmVersion, - bifrostRegistry + bifrostRegistry, ); expect(result).toStrictEqual(expected); @@ -94,7 +94,7 @@ describe('getXcAssetMultiLocationByAssetId', () => { assetId, specName, xcmVersion, - moonriverRegistry + moonriverRegistry, ); expect(result).toStrictEqual(expected); @@ -111,7 +111,7 @@ describe('getXcAssetMultiLocationByAssetId', () => { assetId, specName, xcmVersion, - moonriverRegistry + moonriverRegistry, ); expect(result).toStrictEqual(expected); diff --git a/src/createXcmTypes/util/getXcAssetMultiLocationByAssetId.ts b/src/createXcmTypes/util/getXcAssetMultiLocationByAssetId.ts index 7a954f57..ccb73582 100644 --- a/src/createXcmTypes/util/getXcAssetMultiLocationByAssetId.ts +++ b/src/createXcmTypes/util/getXcAssetMultiLocationByAssetId.ts @@ -13,7 +13,7 @@ export const getXcAssetMultiLocationByAssetId = async ( assetId: string, specName: string, xcmVersion: number, - registry: Registry + registry: Registry, ): Promise => { // if symbol, get the integer or multilocation assetId if (!validateNumber(assetId)) { @@ -35,6 +35,6 @@ export const getXcAssetMultiLocationByAssetId = async ( throw new BaseError( `assetId ${assetId} is not a valid symbol or integer asset id for ${specName}`, - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); }; diff --git a/src/createXcmTypes/util/isParachainPrimaryNativeAsset.spec.ts b/src/createXcmTypes/util/isParachainPrimaryNativeAsset.spec.ts index 6b7ab3f5..11cf9532 100644 --- a/src/createXcmTypes/util/isParachainPrimaryNativeAsset.spec.ts +++ b/src/createXcmTypes/util/isParachainPrimaryNativeAsset.spec.ts @@ -24,7 +24,7 @@ describe('isParachainPrimaryNativeAsset', () => { registry, specName, Direction.ParaToSystem, - primaryNativeAssetSymbol + primaryNativeAssetSymbol, ); expect(result).toEqual(expected); @@ -49,7 +49,7 @@ describe('isParachainPrimaryNativeAsset', () => { registry, specName, Direction.ParaToSystem, - primaryNativeAssetSymbol + primaryNativeAssetSymbol, ); expect(result).toEqual(expected); @@ -72,7 +72,7 @@ describe('isParachainPrimaryNativeAsset', () => { registry, specName, Direction.SystemToPara, - primaryNativeAssetSymbol + primaryNativeAssetSymbol, ); expect(result).toEqual(expected); diff --git a/src/createXcmTypes/util/isParachainPrimaryNativeAsset.ts b/src/createXcmTypes/util/isParachainPrimaryNativeAsset.ts index fb7385ad..79456f33 100644 --- a/src/createXcmTypes/util/isParachainPrimaryNativeAsset.ts +++ b/src/createXcmTypes/util/isParachainPrimaryNativeAsset.ts @@ -7,7 +7,7 @@ export const isParachainPrimaryNativeAsset = ( registry: Registry, specName: string, xcmDirection: Direction, - assetId?: string + assetId?: string, ) => { // check direction is origin Para if (xcmDirection != Direction.ParaToSystem && xcmDirection != Direction.ParaToPara) { diff --git a/src/createXcmTypes/util/sortMultiAssetsAscending.ts b/src/createXcmTypes/util/sortMultiAssetsAscending.ts index fa1041dd..bae1c321 100644 --- a/src/createXcmTypes/util/sortMultiAssetsAscending.ts +++ b/src/createXcmTypes/util/sortMultiAssetsAscending.ts @@ -26,11 +26,11 @@ export const sortMultiAssetsAscending = (multiAssets: FungibleStrMultiAsset[] | let fungibleSortOrder = 0; // sort order based on fungible value if (typeof a.fun.Fungible === 'string' && typeof b.fun.Fungible === 'string') { fungibleSortOrder = (a as FungibleStrMultiAsset).fun.Fungible.localeCompare( - (b as FungibleStrMultiAsset).fun.Fungible + (b as FungibleStrMultiAsset).fun.Fungible, ); } else { fungibleSortOrder = (a as FungibleObjMultiAsset).fun.Fungible.Fungible.localeCompare( - (b as FungibleObjMultiAsset).fun.Fungible.Fungible + (b as FungibleObjMultiAsset).fun.Fungible.Fungible, ); } @@ -62,7 +62,7 @@ export const sortMultiAssetsAscending = (multiAssets: FungibleStrMultiAsset[] | const getSameJunctionMultiLocationSortOrder = ( a: FungibleStrMultiAsset | FungibleObjMultiAsset, - b: FungibleStrMultiAsset | FungibleObjMultiAsset + b: FungibleStrMultiAsset | FungibleObjMultiAsset, ): number => { let sortOrder = 0; @@ -131,7 +131,7 @@ type MultiLocationJunctions = UnionJunction, UnionJunction, UnionJunction, - UnionJunction + UnionJunction, ]; enum MultiLocationJunctionType { diff --git a/src/errors/checkBaseInputOptions.ts b/src/errors/checkBaseInputOptions.ts index 0244f219..2a873555 100644 --- a/src/errors/checkBaseInputOptions.ts +++ b/src/errors/checkBaseInputOptions.ts @@ -19,7 +19,7 @@ export const checkBaseInputOptions = (opts: TransferArgsOpts, specName: if (format === 'call' || format === 'submittable') { throw new BaseError( `PaysWithFeeOrigin is only compatible with the format type payload. Received: ${format}`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } } @@ -27,7 +27,7 @@ export const checkBaseInputOptions = (opts: TransferArgsOpts, specName: if (format === 'payload' && !sendersAddr) { throw new BaseError( `The 'sendersAddr' option must be present when constructing a 'payload' format.`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } diff --git a/src/errors/checkBaseInputTypes.spec.ts b/src/errors/checkBaseInputTypes.spec.ts index 28e538e6..042d9dda 100644 --- a/src/errors/checkBaseInputTypes.spec.ts +++ b/src/errors/checkBaseInputTypes.spec.ts @@ -7,7 +7,7 @@ describe('checkBaseInputTypes', () => { 1000 as unknown as string, '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', ['TST'], - ['10000000000'] + ['10000000000'], ); expect(err).toThrow(`'destChainId' must be a string. Received: number`); @@ -23,7 +23,7 @@ describe('checkBaseInputTypes', () => { '1000', '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', 'TST' as unknown as string[], - ['10000000000'] + ['10000000000'], ); expect(err).toThrow(`'assetIds' must be a array. Received: string`); @@ -34,7 +34,7 @@ describe('checkBaseInputTypes', () => { '1000', '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', [1] as unknown as string[], - ['10000000000'] + ['10000000000'], ); expect(err).toThrow(`All inputs in the 'assetIds' array must be strings: Received: a number at index 0`); @@ -45,7 +45,7 @@ describe('checkBaseInputTypes', () => { '1000', '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', ['TST'], - 10000000000 as unknown as string[] + 10000000000 as unknown as string[], ); expect(err).toThrow(`'amounts' must be a array. Received: number`); diff --git a/src/errors/checkBaseInputTypes.ts b/src/errors/checkBaseInputTypes.ts index 0c084197..a102fc45 100644 --- a/src/errors/checkBaseInputTypes.ts +++ b/src/errors/checkBaseInputTypes.ts @@ -26,7 +26,7 @@ export const checkBaseInputTypes = (destChainId: string, destAddr: string, asset if (typeof assetIds[i] !== 'string') { throw new BaseError( `All inputs in the 'assetIds' array must be strings: Received: a ${typeof assetIds[i]} at index ${i}`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } } @@ -39,7 +39,7 @@ export const checkBaseInputTypes = (destChainId: string, destAddr: string, asset if (typeof amounts[i] !== 'string') { throw new BaseError( `All inputs in the 'amounts' array must be strings: Received: a ${typeof amounts[i]} at index ${i}`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } } diff --git a/src/errors/checkLocalTxInputs.spec.ts b/src/errors/checkLocalTxInputs.spec.ts index 3f089745..b7558e76 100644 --- a/src/errors/checkLocalTxInputs.spec.ts +++ b/src/errors/checkLocalTxInputs.spec.ts @@ -31,14 +31,14 @@ describe('checkLocalTxInput', () => { await expect(async () => { await checkLocalTxInput(systemAssetsApi._api, ['1', '2'], ['10000'], specName, registry, 2, false, false); }).rejects.toThrowError( - 'Local transactions must have the `assetIds` input be a length of 1 or 0, and the `amounts` input be a length of 1' + 'Local transactions must have the `assetIds` input be a length of 1 or 0, and the `amounts` input be a length of 1', ); }); it('Should correctly throw an error for incorrect length on `amounts`', async () => { await expect(async () => { await checkLocalTxInput(systemAssetsApi._api, ['1'], ['10000', '20000'], specName, registry, 2, false, false); }).rejects.toThrowError( - 'Local transactions must have the `assetIds` input be a length of 1 or 0, and the `amounts` input be a length of 1' + 'Local transactions must have the `assetIds` input be a length of 1 or 0, and the `amounts` input be a length of 1', ); }); it('Should correctly throw an error with an incorrect assetId', async () => { @@ -61,7 +61,7 @@ describe('checkLocalTxInput', () => { registry, 2, true, - false + false, ); expect(res).toEqual('ForeignAssets'); }); @@ -79,7 +79,7 @@ describe('checkLocalTxInput', () => { registry, 2, true, - false + false, ); }).rejects.toThrowError(expectedError); }); @@ -97,7 +97,7 @@ describe('checkLocalTxInput', () => { registry, 2, true, - false + false, ); }).rejects.toThrowError(expectedError); }); diff --git a/src/errors/checkLocalTxInputs.ts b/src/errors/checkLocalTxInputs.ts index a0645dca..8fbc953b 100644 --- a/src/errors/checkLocalTxInputs.ts +++ b/src/errors/checkLocalTxInputs.ts @@ -31,13 +31,13 @@ export const checkLocalTxInput = async ( registry: Registry, xcmVersion: number, isForeignAssetsTransfer: boolean, - isLiquidTokenTransfer: boolean + isLiquidTokenTransfer: boolean, ): Promise => { // Ensure the lengths in assetIds and amounts is correct if (assetIds.length > 1 || amounts.length !== 1) { throw new BaseError( 'Local transactions must have the `assetIds` input be a length of 1 or 0, and the `amounts` input be a length of 1', - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } @@ -45,7 +45,7 @@ export const checkLocalTxInput = async ( if (assetIds.length === 0) { throw new BaseError( 'Local foreignAsset transactions must have the `assetIds` input be a length of 1', - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } @@ -54,7 +54,7 @@ export const checkLocalTxInput = async ( const foreignAssetIsInRegistry = foreignAssetMultiLocationIsInCacheOrRegistry( multiLocationStr, registry, - xcmVersion + xcmVersion, ); if (foreignAssetIsInRegistry) { diff --git a/src/errors/checkXcmTxInputs.spec.ts b/src/errors/checkXcmTxInputs.spec.ts index 7c2b2c3a..8c970425 100644 --- a/src/errors/checkXcmTxInputs.spec.ts +++ b/src/errors/checkXcmTxInputs.spec.ts @@ -42,7 +42,7 @@ const runTests = async (tests: Test[]) => { registry, 2, false, - false + false, ); }).rejects.toThrowError(errorMessage); } @@ -68,7 +68,7 @@ describe('checkAssetsAmountMatch', () => { const err = () => checkAssetsAmountMatch(['1'], ['10', '10']); expect(err).toThrow( - '`amounts`, and `assetIds` fields should match in length when constructing a tx from a parachain to a parachain or locally on a system parachain.' + '`amounts`, and `assetIds` fields should match in length when constructing a tx from a parachain to a parachain or locally on a system parachain.', ); }); }); @@ -177,7 +177,7 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).rejects.toThrowError(errorMessage); } @@ -220,7 +220,7 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).rejects.toThrowError(errorMessage); } @@ -244,7 +244,7 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).rejects.toThrowError(errorMessage); } @@ -287,7 +287,7 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).rejects.toThrowError(errorMessage); } @@ -317,7 +317,7 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).rejects.toThrowError(errorMessage); } @@ -346,7 +346,7 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).rejects.toThrowError(errorMessage); } @@ -382,7 +382,7 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).rejects.toThrowError(errorMessage); } @@ -401,7 +401,7 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).rejects.toThrowError('(ParaToSystem) assetId 0x1234, is not a valid erc20 token.'); }); @@ -420,7 +420,7 @@ describe('checkAssetIds', () => { registry, 2, false, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); }).rejects.toThrowError('Liquid Tokens must be valid Integers'); }); @@ -439,10 +439,10 @@ describe('checkAssetIds', () => { registry, 2, false, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); }).rejects.toThrowError( - 'No liquid token asset was detected. When setting the option "transferLiquidToken" to true a valid liquid token assetId must be present.' + 'No liquid token asset was detected. When setting the option "transferLiquidToken" to true a valid liquid token assetId must be present.', ); }); it('Should not error when a valid liquid token exists', async () => { @@ -461,7 +461,7 @@ describe('checkAssetIds', () => { registry, 2, false, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); }).not.toThrow(); }); @@ -479,7 +479,7 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).not.toThrow(); // eslint-disable-next-line @typescript-eslint/await-thenable @@ -493,7 +493,7 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).not.toThrow(); // eslint-disable-next-line @typescript-eslint/await-thenable @@ -507,7 +507,7 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).not.toThrow(); // eslint-disable-next-line @typescript-eslint/await-thenable @@ -521,7 +521,7 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).not.toThrow(); }); @@ -539,10 +539,10 @@ describe('checkAssetIds', () => { registry, 2, false, - false + false, ); }).rejects.toThrowError( - "The current input for assetId's does not meet our specifications for ParaToRelay transfers." + "The current input for assetId's does not meet our specifications for ParaToRelay transfers.", ); }); }); @@ -654,7 +654,7 @@ describe('checkAssetIdsHaveNoDuplicates', () => { const err = () => checkAssetIdsHaveNoDuplicates(assetIds); expect(err).toThrow( - `AssetIds must be unique. Found duplicate assetId {"parents": "1", "interior":{"X2": [{"Parachain": "2125"}, {"GeneralIndex": "0"}]}}` + `AssetIds must be unique. Found duplicate assetId {"parents": "1", "interior":{"X2": [{"Parachain": "2125"}, {"GeneralIndex": "0"}]}}`, ); }); }); @@ -666,7 +666,7 @@ describe('checkAssetIdsAreOfSameAssetIdType', () => { const err = () => checkAssetIdsAreOfSameAssetIdType(assetIds); expect(err).toThrow( - `Found both native asset with assetID 1984 and foreign asset with assetId {"parents": "1", "interior": {"X2": [{"Parachain": "2125"}, {"GeneralIndex": "0"}]}}. Native assets and foreign assets can't be transferred within the same call.` + `Found both native asset with assetID 1984 and foreign asset with assetId {"parents": "1", "interior": {"X2": [{"Parachain": "2125"}, {"GeneralIndex": "0"}]}}. Native assets and foreign assets can't be transferred within the same call.`, ); }); @@ -676,7 +676,7 @@ describe('checkAssetIdsAreOfSameAssetIdType', () => { const err = () => checkAssetIdsAreOfSameAssetIdType(assetIds); expect(err).toThrow( - 'Found both symbol ksm and multilocation assetId {"parents": "1", "interior": {"X2": [{"Parachain": "2125"}, {"GeneralIndex": "0"}]}}. Asset Ids must be symbol and integer or multilocation exclusively.' + 'Found both symbol ksm and multilocation assetId {"parents": "1", "interior": {"X2": [{"Parachain": "2125"}, {"GeneralIndex": "0"}]}}. Asset Ids must be symbol and integer or multilocation exclusively.', ); }); @@ -686,7 +686,7 @@ describe('checkAssetIdsAreOfSameAssetIdType', () => { const err = () => checkAssetIdsAreOfSameAssetIdType(assetIds); expect(err).toThrow( - `Found both default relay native asset and foreign asset with assetId: {"parents": "1", "interior": {"X2": [{"Parachain": "2125"}, {"GeneralIndex": "0"}]}}. Relay native asset and foreign assets can't be transferred within the same call.` + `Found both default relay native asset and foreign asset with assetId: {"parents": "1", "interior": {"X2": [{"Parachain": "2125"}, {"GeneralIndex": "0"}]}}. Relay native asset and foreign assets can't be transferred within the same call.`, ); }); }); @@ -827,7 +827,7 @@ describe('checkParaAssets', () => { registry, 2, false, - false + false, ); expect(registry.cacheLookupAsset('1984')).toEqual('USDt'); @@ -853,7 +853,7 @@ describe('checkParaAssets', () => { registry, 2, false, - false + false, ); expect(registry.cacheLookupAsset('xcUSDT')).toEqual('311091173110107856861649819128533077277'); @@ -892,7 +892,7 @@ describe('checkParaAssets', () => { registry, 2, true, - false + false, ); expect(registry.cacheLookupForeignAsset('TNKR')).toEqual({ @@ -935,7 +935,7 @@ describe('checkParaAssets', () => { registry, 2, false, - true + true, ); expect(registry.cacheLookupPoolAsset('0')).toEqual({ diff --git a/src/errors/checkXcmTxInputs.ts b/src/errors/checkXcmTxInputs.ts index 7593a859..066b9053 100644 --- a/src/errors/checkXcmTxInputs.ts +++ b/src/errors/checkXcmTxInputs.ts @@ -28,7 +28,7 @@ export const checkRelayAssetIdLength = (assetIds: string[]) => { if (assetIds.length > 1) { throw new BaseError( "`assetIds` should be empty or length 1 when sending tx's to or from the relay chain.", - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } }; @@ -43,7 +43,7 @@ export const checkRelayAmountsLength = (amounts: string[]) => { if (amounts.length !== 1) { throw new BaseError( '`amounts` should be of length 1 when sending to or from a relay chain', - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } }; @@ -57,7 +57,7 @@ export const checkParaPrimaryAssetAssetIdsLength = (assetIds: string[]) => { if (assetIds.length > 1) { throw new BaseError( '`assetIds` should be of length 1 when sending a primary native parachain asset', - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } }; @@ -72,7 +72,7 @@ export const checkParaPrimaryAssetAmountsLength = (amounts: string[]) => { if (amounts.length !== 1) { throw new BaseError( '`amounts` should be of length 1 when sending a primary native parachain asset', - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } }; @@ -108,12 +108,12 @@ export const checkMultiLocationAmountsLength = (amounts: string[]) => { export const checkAssetsAmountMatch = ( assetIds: string[], amounts: string[], - isParachainPrimaryNativeAsset?: boolean + isParachainPrimaryNativeAsset?: boolean, ) => { if (!isParachainPrimaryNativeAsset && assetIds.length !== amounts.length) { throw new BaseError( '`amounts`, and `assetIds` fields should match in length when constructing a tx from a parachain to a parachain or locally on a system parachain.', - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } }; @@ -127,12 +127,12 @@ export const checkAssetsAmountMatch = ( export const CheckXTokensPalletOriginIsNonForeignAssetTx = ( xcmDirection: Direction, xcmPallet: XcmPalletName, - isForeignAssetsTransfer: boolean + isForeignAssetsTransfer: boolean, ) => { if ((xcmPallet === XcmPalletName.xTokens || xcmPallet === XcmPalletName.xtokens) && isForeignAssetsTransfer) { throw new BaseError( `(${xcmDirection}) xTokens pallet does not support foreign asset transfers`, - BaseErrorsEnum.InvalidPallet + BaseErrorsEnum.InvalidPallet, ); } }; @@ -188,7 +188,7 @@ export const checkIfNativeRelayChainAssetPresentInMultiAssetIdList = (assetIds: if (assetIds.length > 1 && containsNativeRelayAsset(assetIds, nativeRelayChainAsset)) { throw new BaseError( `Found the relay chains native asset in list [${assetIds.toString()}]. \`assetIds\` list must be empty or only contain the relay chain asset for direction SystemToSystem when sending the relay chains native asset.`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } }; @@ -206,7 +206,7 @@ export const checkIfNativeRelayChainAssetPresentInMultiAssetIdList = (assetIds: export const checkMultiLocationsContainOnlyNativeOrForeignAssetsOfDestChain = ( xcmDirection: Direction, destChainId: string, - multiLocationAssetIds: string[] + multiLocationAssetIds: string[], ) => { if (multiLocationAssetIds.length > 1) { let foreignMultiLocationAssetFound = false; @@ -225,7 +225,7 @@ export const checkMultiLocationsContainOnlyNativeOrForeignAssetsOfDestChain = ( if (nativeMultiLocationAssetFound && foreignMultiLocationAssetFound) { throw new BaseError( `(${xcmDirection}) found both foreign and native multilocations in ${multiLocationAssetIds.toString()}. multilocation XCMs must only include either native or foreign assets of the destination chain.`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } } @@ -260,7 +260,7 @@ const checkRelayToSystemAssetId = (assetId: string, relayChainInfo: ChainInfo) = if (!assetIsRelayChainNativeAsset) { throw new BaseError( `(RelayToSystem) asset ${assetId} is not ${relayChain.specName}'s native asset. Expected ${relayChainNativeAsset}`, - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); } }; @@ -295,7 +295,7 @@ const checkRelayToParaAssetId = (assetId: string, relayChainInfo: ChainInfo) => if (!assetIsRelayChainNativeAsset) { throw new BaseError( `(RelayToPara) asset ${assetId} is not ${relayChain.specName}'s native asset. Expected ${relayChainNativeAsset}`, - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); } }; @@ -327,7 +327,7 @@ const checkSystemToRelayAssetId = (assetId: string, relayChainInfo: ChainInfo) = if (!matchedRelayChainNativeToken) { throw new BaseError( `(SystemToRelay) assetId ${assetId} not native to ${relayChain.specName}. Expected ${relayChainNativeAsset}`, - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); } }; @@ -336,7 +336,7 @@ export const checkLiquidTokenValidity = async ( api: ApiPromise, registry: Registry, systemParachainInfo: ChainInfoKeys, - assetId: string + assetId: string, ) => { const isValidInt = validateNumber(assetId); if (!isValidInt) { @@ -383,7 +383,7 @@ export const checkLiquidTokenValidity = async ( // liquid token not found in cache, registry or chain state throw new BaseError( `No liquid token asset was detected. When setting the option "transferLiquidToken" to true a valid liquid token assetId must be present.`, - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); }; @@ -396,7 +396,7 @@ const checkSystemAssets = async ( xcmDirection: string, xcmVersion: number, isForeignAssetsTransfer: boolean, - isLiquidTokenTransfer?: boolean + isLiquidTokenTransfer?: boolean, ) => { const currentChainId = registry.lookupChainIdBySpecName(specName); @@ -435,7 +435,7 @@ const checkSystemAssets = async ( if (asset.isNone) { throw new BaseError( `(${xcmDirection}) integer assetId ${assetId} not found in ${specName}`, - BaseErrorsEnum.AssetNotFound + BaseErrorsEnum.AssetNotFound, ); } else { const assetSymbol = (await api.query.assets.metadata(assetId)).symbol.toHuman()?.toString(); @@ -517,7 +517,7 @@ const checkSystemAssets = async ( // if no native token for the system parachain was matched, throw an error throw new BaseError( `(${xcmDirection}) assetId ${assetId} not found for system parachain ${specName}`, - BaseErrorsEnum.AssetNotFound + BaseErrorsEnum.AssetNotFound, ); } } @@ -528,7 +528,7 @@ export const checkParaAssets = async ( assetId: string, specName: string, registry: Registry, - xcmDirection: Direction + xcmDirection: Direction, ) => { if (isParachainPrimaryNativeAsset(registry, specName, xcmDirection, assetId)) { return; @@ -546,7 +546,7 @@ export const checkParaAssets = async ( if (asset.isNone) { throw new BaseError( `(${xcmDirection}) integer assetId ${assetId} not found in ${specName}`, - BaseErrorsEnum.AssetNotFound + BaseErrorsEnum.AssetNotFound, ); } else { const assetSymbol = (await api.query.assets.metadata(assetId)).symbol.toHuman()?.toString(); @@ -562,7 +562,7 @@ export const checkParaAssets = async ( if (!paraXcAssets || paraXcAssets.length === 0) { throw new BaseError( `unable to initialize xcAssets registry for ${currentRelayChainSpecName}`, - BaseErrorsEnum.InvalidPallet + BaseErrorsEnum.InvalidPallet, ); } @@ -598,7 +598,7 @@ export const checkParaAssets = async ( if (!paraXcAssets || paraXcAssets.length === 0) { throw new BaseError( `unable to initialize xcAssets registry for ${currentRelayChainSpecName}`, - BaseErrorsEnum.InvalidPallet + BaseErrorsEnum.InvalidPallet, ); } @@ -611,7 +611,7 @@ export const checkParaAssets = async ( // if no native token for the parachain was matched, throw an error throw new BaseError( `(${xcmDirection}) symbol assetId ${assetId} not found for parachain ${specName}`, - BaseErrorsEnum.AssetNotFound + BaseErrorsEnum.AssetNotFound, ); } } else { @@ -622,7 +622,7 @@ export const checkParaAssets = async ( if (!paraXcAssets || paraXcAssets.length === 0) { throw new BaseError( `unable to initialize xcAssets registry for ${currentRelayChainSpecName}`, - BaseErrorsEnum.InvalidPallet + BaseErrorsEnum.InvalidPallet, ); } // if integer asset Id check if valid registry asset @@ -644,7 +644,7 @@ export const checkParaAssets = async ( // if no native token for the parachain was matched, throw an error throw new BaseError( `(${xcmDirection}) symbol assetId ${assetId} not found for parachain ${specName}`, - BaseErrorsEnum.AssetNotFound + BaseErrorsEnum.AssetNotFound, ); } }; @@ -665,7 +665,7 @@ const checkSystemToParaAssetId = async ( xcmDirection: Direction, xcmVersion: number, isForeignAssetsTransfer: boolean, - isLiquidTokenTransfer: boolean + isLiquidTokenTransfer: boolean, ) => { await checkIsValidSystemChainAssetId( api, @@ -676,7 +676,7 @@ const checkSystemToParaAssetId = async ( xcmDirection, xcmVersion, isForeignAssetsTransfer, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); }; @@ -689,7 +689,7 @@ export const checkIsValidSystemChainAssetId = async ( xcmDirection: Direction, xcmVersion: number, isForeignAssetsTransfer: boolean, - isLiquidTokenTransfer: boolean + isLiquidTokenTransfer: boolean, ) => { const systemChainId = registry.lookupChainIdBySpecName(specName); const systemParachainInfo = relayChainInfo[systemChainId]; @@ -704,7 +704,7 @@ export const checkIsValidSystemChainAssetId = async ( xcmDirection, xcmVersion, isForeignAssetsTransfer, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); } }; @@ -724,7 +724,7 @@ const checkParaOriginAssetId = async (api: ApiPromise, assetId: string, specName if (!ethAddr) { throw new BaseError( `(ParaToSystem) assetId ${assetId}, is not a valid erc20 token.`, - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); } @@ -750,7 +750,7 @@ const checkSystemToSystemAssetId = async ( xcmDirection: Direction, xcmVersion: number, isForeignAssetsTransfer: boolean, - isLiquidTokenTransfer: boolean + isLiquidTokenTransfer: boolean, ) => { await checkIsValidSystemChainAssetId( api, @@ -761,7 +761,7 @@ const checkSystemToSystemAssetId = async ( xcmDirection, xcmVersion, isForeignAssetsTransfer, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); }; @@ -809,7 +809,7 @@ const checkParaToRelayAssetId = (assetId: string, registry: Registry, specName: if (!assetIsRelayChainNativeAsset) { throw new BaseError( "The current input for assetId's does not meet our specifications for ParaToRelay transfers.", - BaseErrorsEnum.InvalidAsset + BaseErrorsEnum.InvalidAsset, ); } }; @@ -823,7 +823,7 @@ export const checkAssetIdsLengthIsValid = (assetIds: string[]) => { if (assetIds.length > MAX_ASSETS_FOR_TRANSFER) { throw new BaseError( `Maximum number of assets allowed for transfer is 2. Found ${assetIds.length} assetIds`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } }; @@ -856,13 +856,13 @@ export const checkAssetIdsHaveNoDuplicates = (assetIds: string[]) => { if (assetIds[0] === '') { throw new BaseError( `AssetIds must be unique. Found duplicate native relay assets as empty strings`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } throw new BaseError( `AssetIds must be unique. Found duplicate assetId ${duplicateAssetIds[0]}`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } } @@ -899,21 +899,21 @@ export const checkAssetIdsAreOfSameAssetIdType = (assetIds: string[]) => { if (relayDefaultValueFound && multiLocationAssetIdFound) { throw new BaseError( `Found both default relay native asset and foreign asset with assetId: ${multiLocationAssetIdFound}. Relay native asset and foreign assets can't be transferred within the same call.`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } if (integerAssetIdFound && multiLocationAssetIdFound) { throw new BaseError( `Found both native asset with assetID ${integerAssetIdFound} and foreign asset with assetId ${multiLocationAssetIdFound}. Native assets and foreign assets can't be transferred within the same call.`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } if (symbolAssetIdFound && multiLocationAssetIdFound) { throw new BaseError( `Found both symbol ${symbolAssetIdFound} and multilocation assetId ${multiLocationAssetIdFound}. Asset Ids must be symbol and integer or multilocation exclusively.`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } } @@ -928,7 +928,7 @@ export const checkAssetIdsAreOfSameAssetIdType = (assetIds: string[]) => { export const checkXcmVersionIsValidForPaysWithFeeDest = ( xcmDirection: Direction, xcmVersion?: number, - paysWithFeeDest?: string + paysWithFeeDest?: string, ) => { if ( xcmDirection != Direction.ParaToSystem && @@ -951,7 +951,7 @@ export const checkLiquidTokenTransferDirectionValidity = (xcmDirection: Directio if (xcmDirection !== 'SystemToPara' && isLiquidTokenTransfer) { throw new BaseError( `isLiquidTokenTransfer may not be true for the xcmDirection: ${xcmDirection}.`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } }; @@ -975,7 +975,7 @@ export const checkAssetIdInput = async ( registry: Registry, xcmVersion: number, isForeignAssetsTransfer: boolean, - isLiquidTokenTransfer: boolean + isLiquidTokenTransfer: boolean, ) => { for (let i = 0; i < assetIds.length; i++) { const assetId = assetIds[i]; @@ -1004,7 +1004,7 @@ export const checkAssetIdInput = async ( xcmDirection, xcmVersion, isForeignAssetsTransfer, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); } @@ -1018,7 +1018,7 @@ export const checkAssetIdInput = async ( xcmDirection, xcmVersion, isForeignAssetsTransfer, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); } @@ -1095,7 +1095,7 @@ export const checkXcmTxInputs = async (baseArgs: XcmBaseArgsWithPallet, opts: Ch registry, xcmVersion, isForeignAssetsTransfer, - isLiquidTokenTransfer + isLiquidTokenTransfer, ); if (direction === Direction.RelayToSystem) { diff --git a/src/errors/checkXcmVersion.ts b/src/errors/checkXcmVersion.ts index 85d5d164..234710f4 100644 --- a/src/errors/checkXcmVersion.ts +++ b/src/errors/checkXcmVersion.ts @@ -12,7 +12,7 @@ export const checkXcmVersion = (version: number) => { if (!SUPPORTED_XCM_VERSIONS.includes(version)) { throw new BaseError( `${version} is not a supported xcm version. Supported versions are: ${SUPPORTED_XCM_VERSIONS[0]} and ${SUPPORTED_XCM_VERSIONS[1]}`, - BaseErrorsEnum.InvalidXcmVersion + BaseErrorsEnum.InvalidXcmVersion, ); } }; diff --git a/src/integrationTests/AssetsTransferApi.spec.ts b/src/integrationTests/AssetsTransferApi.spec.ts index 29d6fa58..954b332e 100644 --- a/src/integrationTests/AssetsTransferApi.spec.ts +++ b/src/integrationTests/AssetsTransferApi.spec.ts @@ -20,7 +20,7 @@ describe('AssetTransferApi Integration Tests', () => { ['100'], { format: 'call', - } + }, ); expect(res).toEqual({ dest: 'statemine', @@ -41,7 +41,7 @@ describe('AssetTransferApi Integration Tests', () => { { format: 'call', keepAlive: true, - } + }, ); expect(res).toEqual({ dest: 'statemine', @@ -61,7 +61,7 @@ describe('AssetTransferApi Integration Tests', () => { ['100'], { format: 'call', - } + }, ); expect(res).toEqual({ dest: 'statemine', @@ -82,7 +82,7 @@ describe('AssetTransferApi Integration Tests', () => { { format: 'call', keepAlive: true, - } + }, ); expect(res).toEqual({ dest: 'statemine', @@ -102,7 +102,7 @@ describe('AssetTransferApi Integration Tests', () => { ['100'], { format: 'call', - } + }, ); expect(res).toEqual({ dest: 'kusama', @@ -123,7 +123,7 @@ describe('AssetTransferApi Integration Tests', () => { { format: 'call', keepAlive: true, - } + }, ); expect(res).toEqual({ dest: 'kusama', @@ -143,7 +143,7 @@ describe('AssetTransferApi Integration Tests', () => { ['100'], { format: 'call', - } + }, ); expect(res).toEqual({ dest: 'statemine', @@ -164,7 +164,7 @@ describe('AssetTransferApi Integration Tests', () => { { format: 'call', keepAlive: true, - } + }, ); expect(res).toEqual({ dest: 'statemine', @@ -185,7 +185,7 @@ describe('AssetTransferApi Integration Tests', () => { { format: 'call', transferLiquidToken: true, - } + }, ); expect(res).toEqual({ dest: 'statemine', @@ -207,7 +207,7 @@ describe('AssetTransferApi Integration Tests', () => { format: 'call', keepAlive: true, transferLiquidToken: true, - } + }, ); expect(res).toEqual({ dest: 'statemine', @@ -226,7 +226,7 @@ describe('AssetTransferApi Integration Tests', () => { isLimited: boolean, xcmVersion: number, refTime?: string, - proofSize?: string + proofSize?: string, ): Promise> => { return await systemAssetsApi.createTransferTransaction( '2000', // Since this is not `0` we know this is to a parachain @@ -242,13 +242,13 @@ describe('AssetTransferApi Integration Tests', () => { }, xcmVersion, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; const nativeBaseSystemCreateTx = async ( format: T, xcmVersion: number, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { return await systemAssetsApi.createTransferTransaction( '2000', // Since this is not `0` we know this is to a parachain @@ -261,13 +261,13 @@ describe('AssetTransferApi Integration Tests', () => { weightLimit: opts.weightLimit, isLimited: opts.isLimited, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; const foreignAssetMultiLocationBaseSystemCreateTx = async ( format: T, xcmVersion: number, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { return await systemAssetsApi.createTransferTransaction( '2023', // Since this is not `0` we know this is to a parachain @@ -280,14 +280,14 @@ describe('AssetTransferApi Integration Tests', () => { weightLimit: opts.weightLimit, xcmVersion, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; const foreignAssetMultiLocationBaseTeleportSystemCreateTx = async ( format: T, xcmVersion: number, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { return await systemAssetsApi.createTransferTransaction( '2125', // Since this is not `0` we know this is to a parachain @@ -301,13 +301,13 @@ describe('AssetTransferApi Integration Tests', () => { isLimited: opts?.isLimited, weightLimit: opts.weightLimit, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; const liquidTokenTransferCreateTx = async ( format: T, isLimited: boolean, - xcmVersion: number + xcmVersion: number, ): Promise> => { return await systemAssetsApi.createTransferTransaction( '2000', // Since this is not `0` we know this is to a parachain @@ -323,7 +323,7 @@ describe('AssetTransferApi Integration Tests', () => { }, xcmVersion, transferLiquidToken: true, - } + }, ); }; describe('V2', () => { @@ -847,7 +847,7 @@ describe('AssetTransferApi Integration Tests', () => { isLimited: boolean, xcmVersion: number, refTime?: string, - proofSize?: string + proofSize?: string, ): Promise> => { return await systemAssetsApi.createTransferTransaction( '1001', // collectives system parachain @@ -863,7 +863,7 @@ describe('AssetTransferApi Integration Tests', () => { proofSize, }, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; const nativeBaseSystemCreateTx = async ( @@ -871,7 +871,7 @@ describe('AssetTransferApi Integration Tests', () => { isLimited: boolean, xcmVersion: number, refTime?: string, - proofSize?: string + proofSize?: string, ): Promise> => { return await systemAssetsApi.createTransferTransaction( '1002', // bridge-hub system parachain @@ -887,13 +887,13 @@ describe('AssetTransferApi Integration Tests', () => { proofSize, }, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; const foreignAssetMultiLocationBaseSystemCreateTx = async ( format: T, xcmVersion: number, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { return await systemAssetsApi.createTransferTransaction( '2023', // Since this is not `0` we know this is to a parachain @@ -906,7 +906,7 @@ describe('AssetTransferApi Integration Tests', () => { isLimited: opts?.isLimited, weightLimit: opts.weightLimit, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; describe('V2', () => { @@ -1251,7 +1251,7 @@ describe('AssetTransferApi Integration Tests', () => { isLimited: boolean, xcmVersion: number, refTime?: string, - proofSize?: string + proofSize?: string, ): Promise> => { return await relayAssetsApi.createTransferTransaction( '2000', // Since this is not `0` we know this is to a parachain @@ -1267,7 +1267,7 @@ describe('AssetTransferApi Integration Tests', () => { proofSize, }, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; describe('V2', () => { @@ -1393,7 +1393,7 @@ describe('AssetTransferApi Integration Tests', () => { isLimited: boolean, xcmVersion: number, refTime?: string, - proofSize?: string + proofSize?: string, ): Promise> => { return await systemAssetsApi.createTransferTransaction( '0', // `0` indicating the dest chain is a relay chain. @@ -1409,7 +1409,7 @@ describe('AssetTransferApi Integration Tests', () => { proofSize, }, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; describe('V2', () => { @@ -1535,7 +1535,7 @@ describe('AssetTransferApi Integration Tests', () => { isLimited: boolean, xcmVersion: number, refTime?: string, - proofSize?: string + proofSize?: string, ): Promise> => { return await relayAssetsApi.createTransferTransaction( '1000', // `0` indicating the dest chain is a relay chain. @@ -1551,7 +1551,7 @@ describe('AssetTransferApi Integration Tests', () => { proofSize, }, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; describe('V2', () => { @@ -1678,10 +1678,10 @@ describe('AssetTransferApi Integration Tests', () => { '0', '5EnxxUmEbw8DkENKiYuZ1DwQuMoB2UWEQJZZXrTsxoz7SpgG', ['1', '2'], - ['100', '100'] + ['100', '100'], ); }).rejects.toThrow( - 'Local transactions must have the `assetIds` input be a length of 1 or 0, and the `amounts` input be a length of 1' + 'Local transactions must have the `assetIds` input be a length of 1 or 0, and the `amounts` input be a length of 1', ); }); }); diff --git a/src/integrationTests/parachains/moonriver.spec.ts b/src/integrationTests/parachains/moonriver.spec.ts index 4fc3f6c6..01019ba4 100644 --- a/src/integrationTests/parachains/moonriver.spec.ts +++ b/src/integrationTests/parachains/moonriver.spec.ts @@ -219,7 +219,7 @@ describe('Moonriver', () => { }, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(res).toEqual(expectedResult); @@ -241,7 +241,7 @@ describe('Moonriver', () => { }, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(res.tx.toRawType()).toEqual('Extrinsic'); }); @@ -313,7 +313,7 @@ describe('Moonriver', () => { }, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(res).toEqual(expectedResult); @@ -335,7 +335,7 @@ describe('Moonriver', () => { }, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(res.tx.toRawType()).toEqual('Extrinsic'); }); @@ -691,7 +691,7 @@ describe('Moonriver', () => { }, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(res).toEqual(expectedResult); @@ -765,7 +765,7 @@ describe('Moonriver', () => { }, isForeignAssetsTransfer: false, isLiquidTokenTransfer: false, - } + }, ); expect(res).toEqual(expectedResult); diff --git a/src/integrationTests/util.ts b/src/integrationTests/util.ts index ad88ea90..a215b2ea 100644 --- a/src/integrationTests/util.ts +++ b/src/integrationTests/util.ts @@ -8,14 +8,14 @@ export type TestMultiassets = [ parachainId: string, assetIds: string[], amounts: string[], - expected: TxResult<'payload'> + expected: TxResult<'payload'>, ]; export type TestMultiassetWithFormat = [ parachainId: string, assetId: string, format: string, - expected: TxResult<'payload'> + expected: TxResult<'payload'>, ]; export type TestMultiassetsWithFormat = [ @@ -23,7 +23,7 @@ export type TestMultiassetsWithFormat = [ assetIds: string[], amounts: string[], format: string, - expected: TxResult<'payload'> + expected: TxResult<'payload'>, ]; export const paraTransferMultiasset = async ( @@ -32,7 +32,7 @@ export const paraTransferMultiasset = async ( xcmVersion: number, destChainId: string, assetId: string, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { return await parachainATA.createTransferTransaction( destChainId, @@ -45,7 +45,7 @@ export const paraTransferMultiasset = async ( isLimited: opts.isLimited, weightLimit: opts.weightLimit, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; @@ -56,7 +56,7 @@ export const paraTransferMultiassets = async ( destChainId: string, assetIds: string[], amounts: string[], - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { return await parachainATA.createTransferTransaction( destChainId, @@ -70,7 +70,7 @@ export const paraTransferMultiassets = async ( isLimited: opts.isLimited, weightLimit: opts.weightLimit, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; @@ -80,7 +80,7 @@ export const paraTransferMultiassetWithFee = async ( xcmVersion: number, destChainId: string, assetId: string, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { return await parachainATA.createTransferTransaction( destChainId, @@ -95,7 +95,7 @@ export const paraTransferMultiassetWithFee = async ( isLimited: opts.isLimited, weightLimit: opts.weightLimit, sendersAddr: 'FBeL7DanUDs5SZrxZY1CizMaPgG9vZgJgvr52C2dg81SsF1', - } + }, ); }; @@ -104,7 +104,7 @@ export const paraTeleportNativeAsset = async ( format: T, nativeAssetId: string, xcmVersion: number, - opts: CreateXcmCallOpts + opts: CreateXcmCallOpts, ): Promise> => { return await parachainATA.createTransferTransaction( '1000', // `1000` indicating the dest chain is a system chain. @@ -117,6 +117,6 @@ export const paraTeleportNativeAsset = async ( isLimited: opts.isLimited, weightLimit: opts.weightLimit, sendersAddr: '0xf5d5714c084c112843aca74f8c498da06cc5a2d63153b825189baa51043b1f0b', - } + }, ); }; diff --git a/src/sanitize/sanitizeAddress.spec.ts b/src/sanitize/sanitizeAddress.spec.ts index f3ff5fe4..128df7d8 100644 --- a/src/sanitize/sanitizeAddress.spec.ts +++ b/src/sanitize/sanitizeAddress.spec.ts @@ -5,17 +5,17 @@ import { sanitizeAddress } from './sanitizeAddress'; describe('sanitizeAddress', () => { it('Should sanitize a SS58 address to the correct publicKey', () => { expect(sanitizeAddress('1ULZhwpUPLLg5VRYiq6rBHY8XaShAmBW7kqGBfvHBqrgBcN')).toEqual( - '0x14d97bde56483534b553ec13c1867924b2eb559cbf9767090af5d8ecf8ee2936' + '0x14d97bde56483534b553ec13c1867924b2eb559cbf9767090af5d8ecf8ee2936', ); }); it('Should return the public key if its already valid', () => { expect(sanitizeAddress('0x14d97bde56483534b553ec13c1867924b2eb559cbf9767090af5d8ecf8ee2936')).toEqual( - '0x14d97bde56483534b553ec13c1867924b2eb559cbf9767090af5d8ecf8ee2936' + '0x14d97bde56483534b553ec13c1867924b2eb559cbf9767090af5d8ecf8ee2936', ); }); it('Should error with an invalid address', () => { expect(() => sanitizeAddress('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDwU')).toThrowError( - 'Invalid decoded address checksum' + 'Invalid decoded address checksum', ); }); }); diff --git a/src/testHelpers/adjustedMockBifrostParachainApi.ts b/src/testHelpers/adjustedMockBifrostParachainApi.ts index 05d4cc3b..e6d74c2d 100644 --- a/src/testHelpers/adjustedMockBifrostParachainApi.ts +++ b/src/testHelpers/adjustedMockBifrostParachainApi.ts @@ -24,7 +24,7 @@ const getHeader = (): Promise
=> stateRoot: mockBifrostParachainApi.registry.createType('Hash'), extrinsicsRoot: mockBifrostParachainApi.registry.createType('Hash'), digest: mockBifrostParachainApi.registry.createType('Digest'), - }) + }), ); const accountNextIndex = () => mockBifrostParachainApi.registry.createType('u32', 10); diff --git a/src/testHelpers/adjustedMockMoonriverParachainApi.ts b/src/testHelpers/adjustedMockMoonriverParachainApi.ts index b436a50b..073f939e 100644 --- a/src/testHelpers/adjustedMockMoonriverParachainApi.ts +++ b/src/testHelpers/adjustedMockMoonriverParachainApi.ts @@ -30,7 +30,7 @@ const getHeader = (): Promise
=> stateRoot: mockMoonriverParachainApi.registry.createType('Hash'), extrinsicsRoot: mockMoonriverParachainApi.registry.createType('Hash'), digest: mockMoonriverParachainApi.registry.createType('Digest'), - }) + }), ); // /** // * Create a type registry for Moonriver. @@ -46,7 +46,7 @@ function createMoonriverRegistry(specVersion: number): TypeRegistry { ss58Format: 2, tokenDecimals: 12, tokenSymbol: 'MOVR', - }) + }), ); registry.register(getSpecTypes(registry, 'Moonriver', 'moonriver', specVersion)); @@ -63,19 +63,19 @@ const asset = (assetId: string): Promise> => const xcUsdtAssetInfo = { owner: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), issuer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), admin: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), freezer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), supply: mockMoonriverParachainApi.registry.createType('u128', 100), deposit: mockMoonriverParachainApi.registry.createType('u128', 100), @@ -92,19 +92,19 @@ const asset = (assetId: string): Promise> => const xcKsmAssetInfo = { owner: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), issuer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), admin: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), freezer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), supply: mockMoonriverParachainApi.registry.createType('u128', 100), deposit: mockMoonriverParachainApi.registry.createType('u128', 100), @@ -121,19 +121,19 @@ const asset = (assetId: string): Promise> => const xcBncAssetInfo = { owner: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), issuer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), admin: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), freezer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), supply: mockMoonriverParachainApi.registry.createType('u128', 100), deposit: mockMoonriverParachainApi.registry.createType('u128', 100), @@ -150,19 +150,19 @@ const asset = (assetId: string): Promise> => const xcvBncAssetInfo = { owner: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), issuer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), admin: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), freezer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), supply: mockMoonriverParachainApi.registry.createType('u128', 100), deposit: mockMoonriverParachainApi.registry.createType('u128', 100), @@ -179,19 +179,19 @@ const asset = (assetId: string): Promise> => const xcvMovrAssetInfo = { owner: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), issuer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), admin: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), freezer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), supply: mockMoonriverParachainApi.registry.createType('u128', 100), deposit: mockMoonriverParachainApi.registry.createType('u128', 100), @@ -209,19 +209,19 @@ const asset = (assetId: string): Promise> => const xcSDNAssetInfo = { owner: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), issuer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), admin: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), freezer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), supply: mockMoonriverParachainApi.registry.createType('u128', 100), deposit: mockMoonriverParachainApi.registry.createType('u128', 100), @@ -238,19 +238,19 @@ const asset = (assetId: string): Promise> => const xcRmrkAssetInfo = { owner: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), issuer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), admin: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), freezer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), supply: mockMoonriverParachainApi.registry.createType('u128', 100), deposit: mockMoonriverParachainApi.registry.createType('u128', 100), @@ -269,19 +269,19 @@ const asset = (assetId: string): Promise> => const xcTestInfo = { owner: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), issuer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), admin: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), freezer: mockMoonriverParachainApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), supply: mockMoonriverParachainApi.registry.createType('u128', 100), deposit: mockMoonriverParachainApi.registry.createType('u128', 100), @@ -345,7 +345,7 @@ const metadata = (assetId: number): Promise => }; const xcvBNCMetadata = mockMoonriverParachainApi.registry.createType( 'PalletAssetsAssetMetadata', - rawXCVBNCMetadata + rawXCVBNCMetadata, ); metadata.set('72145018963825376852137222787619937732', xcvBNCMetadata); @@ -361,7 +361,7 @@ const metadata = (assetId: number): Promise => }; const xcvMOVRMetadata = mockMoonriverParachainApi.registry.createType( 'PalletAssetsAssetMetadata', - rawXCVMOVRMetadata + rawXCVMOVRMetadata, ); metadata.set('203223821023327994093278529517083736593', xcvMOVRMetadata); @@ -389,7 +389,7 @@ const metadata = (assetId: number): Promise => }; const xcUsdtMetadata = mockMoonriverParachainApi.registry.createType( 'PalletAssetsAssetMetadata', - rawXcUsdtMetadata + rawXcUsdtMetadata, ); metadata.set('311091173110107856861649819128533077277', xcUsdtMetadata); @@ -404,7 +404,7 @@ const metadata = (assetId: number): Promise => }; const xcRmrkMetadata = mockMoonriverParachainApi.registry.createType( 'PalletAssetsAssetMetadata', - rawXcRmrkMetadata + rawXcRmrkMetadata, ); metadata.set('182365888117048807484804376330534607370', xcRmrkMetadata); @@ -451,7 +451,7 @@ export const adjustedMockMoonriverParachainApi = { }; const xcKsmMetadata = mockMoonriverParachainApi.registry.createType( 'PalletAssetsAssetMetadata', - rawXcKsmMetadata + rawXcKsmMetadata, ); metadata.set('42259045809535163221576417993425387648', xcKsmMetadata); @@ -467,7 +467,7 @@ export const adjustedMockMoonriverParachainApi = { }; const xcBNCMetadata = mockMoonriverParachainApi.registry.createType( 'PalletAssetsAssetMetadata', - rawXCBNCMetadata + rawXCBNCMetadata, ); metadata.set('319623561105283008236062145480775032445', xcBNCMetadata); @@ -483,7 +483,7 @@ export const adjustedMockMoonriverParachainApi = { }; const xcvBNCMetadata = mockMoonriverParachainApi.registry.createType( 'PalletAssetsAssetMetadata', - rawXCVBNCMetadata + rawXCVBNCMetadata, ); metadata.set('72145018963825376852137222787619937732', xcvBNCMetadata); @@ -499,7 +499,7 @@ export const adjustedMockMoonriverParachainApi = { }; const xcvMOVRMetadata = mockMoonriverParachainApi.registry.createType( 'PalletAssetsAssetMetadata', - rawXCVMOVRMetadata + rawXCVMOVRMetadata, ); metadata.set('203223821023327994093278529517083736593', xcvMOVRMetadata); @@ -515,7 +515,7 @@ export const adjustedMockMoonriverParachainApi = { }; const xcSDNMetadata = mockMoonriverParachainApi.registry.createType( 'PalletAssetsAssetMetadata', - rawXCSDNMetadata + rawXCSDNMetadata, ); metadata.set('203223821023327994093278529517083736593', xcSDNMetadata); @@ -531,7 +531,7 @@ export const adjustedMockMoonriverParachainApi = { }; const xcUsdtMetadata = mockMoonriverParachainApi.registry.createType( 'PalletAssetsAssetMetadata', - rawXcUsdtMetadata + rawXcUsdtMetadata, ); metadata.set('311091173110107856861649819128533077277', xcUsdtMetadata); @@ -546,7 +546,7 @@ export const adjustedMockMoonriverParachainApi = { }; const xcRmrkMetadata = mockMoonriverParachainApi.registry.createType( 'PalletAssetsAssetMetadata', - rawXcRmrkMetadata + rawXcRmrkMetadata, ); metadata.set('182365888117048807484804376330534607370', xcRmrkMetadata); diff --git a/src/testHelpers/adjustedMockRelayApi.ts b/src/testHelpers/adjustedMockRelayApi.ts index 44074532..a3e32ff3 100644 --- a/src/testHelpers/adjustedMockRelayApi.ts +++ b/src/testHelpers/adjustedMockRelayApi.ts @@ -26,7 +26,7 @@ const getHeader = (): Promise
=> stateRoot: mockRelayApi.registry.createType('Hash'), extrinsicsRoot: mockRelayApi.registry.createType('Hash'), digest: mockRelayApi.registry.createType('Digest'), - }) + }), ); const accountNextIndex = () => mockRelayApi.registry.createType('u32', 10); diff --git a/src/testHelpers/adjustedMockSystemApi.ts b/src/testHelpers/adjustedMockSystemApi.ts index 56967d71..682b451c 100644 --- a/src/testHelpers/adjustedMockSystemApi.ts +++ b/src/testHelpers/adjustedMockSystemApi.ts @@ -31,7 +31,7 @@ function createStatemineRegistry(specVersion: number): TypeRegistry { ss58Format: 2, tokenDecimals: 12, tokenSymbol: 'KSM', - }) + }), ); registry.register(getSpecTypes(registry, 'Statemine', 'statemine', specVersion)); @@ -67,7 +67,7 @@ const getHeader = (): Promise
=> stateRoot: mockSystemApi.registry.createType('Hash'), extrinsicsRoot: mockSystemApi.registry.createType('Hash'), digest: mockSystemApi.registry.createType('Digest'), - }) + }), ); const createType = mockSystemApi.registry.createType.bind(mockSystemApi); @@ -76,19 +76,19 @@ const accountNextIndex = () => mockSystemApi.registry.createType('u32', 10); const multiLocationAssetInfo = { owner: mockSystemApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), issuer: mockSystemApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), admin: mockSystemApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), freezer: mockSystemApi.registry.createType( 'AccountId32', - '0x0987654309876543098765430987654309876543098765430987654309876543' + '0x0987654309876543098765430987654309876543098765430987654309876543', ), supply: mockSystemApi.registry.createType('u128', 100), deposit: mockSystemApi.registry.createType('u128', 100), @@ -107,19 +107,19 @@ const asset = (assetId: number | string | BN): Promise> => }); const pools = ( - _arg: ITuple<[PalletAssetConversionNativeOrAssetId, PalletAssetConversionNativeOrAssetId]> + _arg: ITuple<[PalletAssetConversionNativeOrAssetId, PalletAssetConversionNativeOrAssetId]>, ): Promise<[PalletAssetConversionNativeOrAssetId, PalletAssetConversionPoolInfo]> => Promise.resolve().then(() => { const palletAssetConversionNativeOrAssetId = mockSystemApi.registry.createType( @@ -261,7 +261,7 @@ const pools = ( parents: 0, interior: { X2: [{ PalletInstance: 50 }, { GeneralIndex: 100 }] }, }, - ] + ], ); const poolInfo = mockSystemApi.registry.createType('PalletAssetConversionPoolInfo', { @@ -336,7 +336,7 @@ export const adjustedMockSystemApi = { ], ]; }, - } + }, ); const poolInfo = Object.assign( @@ -349,7 +349,7 @@ export const adjustedMockSystemApi = { lpToken: mockSystemApi.registry.createType('u32', 0), }; }, - } + }, ); return [[palletAssetConversionNativeOrAssetId, poolInfo]]; diff --git a/src/types.ts b/src/types.ts index 887183f1..33736738 100644 --- a/src/types.ts +++ b/src/types.ts @@ -93,10 +93,10 @@ export type Format = 'payload' | 'call' | 'submittable'; export type ConstructedFormat = T extends 'payload' ? `0x${string}` : T extends 'call' - ? `0x${string}` - : T extends 'submittable' - ? SubmittableExtrinsic<'promise', ISubmittableResult> - : never; + ? `0x${string}` + : T extends 'submittable' + ? SubmittableExtrinsic<'promise', ISubmittableResult> + : never; /** * The types of local transactions the api can construct. diff --git a/src/util/getFeeAssetItemIndex.spec.ts b/src/util/getFeeAssetItemIndex.spec.ts index 51358321..832a7397 100644 --- a/src/util/getFeeAssetItemIndex.spec.ts +++ b/src/util/getFeeAssetItemIndex.spec.ts @@ -14,7 +14,7 @@ type Test = [ specName: string, multiAssets: FungibleStrMultiAsset[], api: ApiPromise, - expected: number + expected: number, ]; describe('getFeeAssetItemIndex', () => { @@ -107,7 +107,7 @@ describe('getFeeAssetItemIndex', () => { const [paysWithFeeDest, specName, multiAssets, api, expected] = test; expect(await getFeeAssetItemIndex(api, registry, paysWithFeeDest, multiAssets, specName, 2, false)).toEqual( - expected + expected, ); } }); @@ -210,7 +210,7 @@ describe('getFeeAssetItemIndex', () => { const [paysWithFeeDest, specName, multiAssets, api, expected] = test; expect(await getFeeAssetItemIndex(api, registry, paysWithFeeDest, multiAssets, specName, 2, false)).toEqual( - expected + expected, ); } }); @@ -244,7 +244,7 @@ describe('getFeeAssetItemIndex', () => { const [paysWithFeeDest, specName, multiAssets, api, expected] = test; expect(await getFeeAssetItemIndex(api, registry, paysWithFeeDest, multiAssets, specName, 2, true)).toEqual( - expected + expected, ); } }); @@ -283,7 +283,7 @@ describe('getFeeAssetItemIndex', () => { await expect(async () => { await getFeeAssetItemIndex(systemAssetsApi._api, registry, paysWithFeeDest, multiAssets, specName, 2, false); }).rejects.toThrowError( - 'Invalid paysWithFeeDest value. 1984 did not match any asset in assets: {"X2":[{"PalletInstance":"50"},{"GeneralIndex":"1337"}]},{"Here":""}' + 'Invalid paysWithFeeDest value. 1984 did not match any asset in assets: {"X2":[{"PalletInstance":"50"},{"GeneralIndex":"1337"}]},{"Here":""}', ); }); }); diff --git a/src/util/getFeeAssetItemIndex.ts b/src/util/getFeeAssetItemIndex.ts index 3001d600..181be56e 100644 --- a/src/util/getFeeAssetItemIndex.ts +++ b/src/util/getFeeAssetItemIndex.ts @@ -24,7 +24,7 @@ export const getFeeAssetItemIndex = async ( multiAssets: FungibleStrMultiAsset[], specName: string, xcmVersion: number, - isForeignAssetsTransfer?: boolean + isForeignAssetsTransfer?: boolean, ): Promise => { let result = -1; @@ -56,7 +56,7 @@ export const getFeeAssetItemIndex = async ( paysWithFeeDest, specName, xcmVersion, - isForeignAssetsTransfer + isForeignAssetsTransfer, ); // if isForeignAssetsTransfer, compare the multiAsset interior to the the paysWithFeeDestGeneralIndex as a multilocation if (isForeignAssetsTransfer) { @@ -101,7 +101,7 @@ export const getFeeAssetItemIndex = async ( `Invalid paysWithFeeDest value. ${paysWithFeeDest} did not match any asset in assets: ${multiAssets .map((asset) => JSON.stringify(asset.id.Concrete.interior)) .join(',')}`, - BaseErrorsEnum.InvalidInput + BaseErrorsEnum.InvalidInput, ); } diff --git a/src/util/resolveMultiLocation.ts b/src/util/resolveMultiLocation.ts index d83c80ea..4f9b9453 100644 --- a/src/util/resolveMultiLocation.ts +++ b/src/util/resolveMultiLocation.ts @@ -22,7 +22,7 @@ export const resolveMultiLocation = (multiLocation: AnyJson, xcmVersion: number) if (xcmVersion < 3 && hasGlobalConsensus) { throw new BaseError( 'XcmVersion must be version 2 for MultiLocations that contain a GlobalConsensus junction.', - BaseErrorsEnum.InvalidXcmVersion + BaseErrorsEnum.InvalidXcmVersion, ); } @@ -30,7 +30,7 @@ export const resolveMultiLocation = (multiLocation: AnyJson, xcmVersion: number) if (xcmVersion != 2 && hasGeneralKey) { throw new BaseError( 'XcmVersion must be version 2 for MultiLocations that contain a GeneralKey junction.', - BaseErrorsEnum.InvalidXcmVersion + BaseErrorsEnum.InvalidXcmVersion, ); } diff --git a/tsconfig.json b/tsconfig.json index 8cb66623..89651654 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,7 @@ "outDir": "lib", "rootDirs": ["./src", "./scripts"], "suppressImplicitAnyIndexErrors": true, + "ignoreDeprecations": "5.0", "resolveJsonModule": true, "esModuleInterop": true, },