Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): bump @substrate/dev from 0.7.1 to 0.8.0 #460

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e-tests/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const executor = async (testCase: string) => {
: await ApiPromise.create({
provider: new WsProvider(destWsUrl),
noInitWarn: true,
});
});

await destinationApi.isReady;
const destInitialBalance: IBalance = await balanceTracker(destinationApi, testCase, destAddr, assetIds);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"homepage": "https://github.com/paritytech/asset-transfer-api#readme",
"packageManager": "[email protected]",
"devDependencies": {
"@substrate/dev": "^0.7.1",
"@substrate/dev": "^0.8.0",
"@types/cli-progress": "^3",
"ansi-colors": "^4.1.3",
"chalk": "5.3.0",
Expand Down
28 changes: 15 additions & 13 deletions src/AssetTransferApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ export class AssetTransferApi {
}
}

const executionResult = await this.dryRunCall(sendersAddr, result.tx, fmt as Format);
const executionResult = await this.dryRunCall(sendersAddr, result.tx, fmt);

if (executionResult?.isOk) {
result.xcmExecutionResult = executionResult.asOk.executionResult;
Expand Down Expand Up @@ -1041,7 +1041,7 @@ export class AssetTransferApi {
const foreignAssets: string[] = [];
for (const asset of await api.query.foreignAssets.asset.entries()) {
const storageKey = asset[0].toHuman();
if (storageKey) {
if (storageKey && Array.isArray(storageKey) && storageKey.length > 0) {
foreignAssets.push(JSON.stringify(storageKey[0]).replace(/(\d),/g, '$1'));
}
}
Expand Down Expand Up @@ -1083,17 +1083,19 @@ export class AssetTransferApi {
const lpTokens = poolPairsData[0].toHuman(); // get asset location tuple
const lpTokenLocations = lpTokens as UnionXcmMultiLocation[];

// convert json into locations
const firstLpToken = parseLocationStrToLocation(
JSON.stringify(lpTokenLocations[0][0]).replace(/(\d),/g, '$1'),
);
const secondLpToken = parseLocationStrToLocation(
JSON.stringify(lpTokenLocations[0][1]).replace(/(\d),/g, '$1'),
);

// check locations match paysWithFeeOrigin feeAsset
if (deepEqual(sanitizeKeys(firstLpToken), feeAsset) || deepEqual(sanitizeKeys(secondLpToken), feeAsset)) {
return [true, feeAsset];
if (Array.isArray(lpTokenLocations[0])) {
// convert json into locations
const firstLpToken = parseLocationStrToLocation(
JSON.stringify(lpTokenLocations[0][0]).replace(/(\d),/g, '$1'),
);
const secondLpToken = parseLocationStrToLocation(
JSON.stringify(lpTokenLocations[0][1]).replace(/(\d),/g, '$1'),
);

// check locations match paysWithFeeOrigin feeAsset
if (deepEqual(sanitizeKeys(firstLpToken), feeAsset) || deepEqual(sanitizeKeys(secondLpToken), feeAsset)) {
return [true, feeAsset];
}
}
}
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const limitedReserveTransferAssets = async (
xcmVersion,
isForeignAssetsTransfer,
isLiquidTokenTransfer,
})
})
: 0;

return ext(dest, beneficiary, assets, feeAssetItem, weightLimitType);
Expand Down
2 changes: 1 addition & 1 deletion src/createXcmCalls/polkadotXcm/limitedTeleportAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const limitedTeleportAssets = async (
registry,
isForeignAssetsTransfer,
isLiquidTokenTransfer: false,
})
})
: 0;

return ext(dest, beneficiary, assets, feeAssetItem, weightLimitType);
Expand Down
2 changes: 1 addition & 1 deletion src/createXcmCalls/polkadotXcm/transferAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const transferAssets = async (
registry,
isForeignAssetsTransfer,
isLiquidTokenTransfer,
})
})
: 0;

return ext(dest, beneficiary, assets, feeAssetItem, weightLimitValue);
Expand Down
2 changes: 1 addition & 1 deletion src/createXcmTypes/ParaToPara.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export const ParaToPara: ICreateXcmType = {
refTime: opts.weightLimit.refTime,
proofSize: opts.weightLimit.proofSize,
},
}
}
: { Unlimited: null };
},
/**
Expand Down
2 changes: 1 addition & 1 deletion src/createXcmTypes/ParaToRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const ParaToRelay: ICreateXcmType = {
refTime: opts.weightLimit?.refTime,
proofSize: opts.weightLimit?.proofSize,
},
}
}
: { Unlimited: null };
},
/**
Expand Down
2 changes: 1 addition & 1 deletion src/createXcmTypes/ParaToSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export const ParaToSystem: ICreateXcmType = {
refTime: opts.weightLimit.refTime,
proofSize: opts.weightLimit.proofSize,
},
}
}
: { Unlimited: null };
},
/**
Expand Down
6 changes: 3 additions & 3 deletions src/createXcmTypes/RelayToBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ export const RelayToBridge: ICreateXcmType = {
X1: destination.interior.X1 as InteriorValue,
},
},
}
}
: {
V3: {
parents: 1,
interior: {
X2: destination.interior.X2 as InteriorValue,
},
},
};
};
} else {
if (destination.interior && destination.interior.X1) {
dest = {
Expand Down Expand Up @@ -174,7 +174,7 @@ export const RelayToBridge: ICreateXcmType = {
refTime: opts.weightLimit?.refTime,
proofSize: opts.weightLimit?.proofSize,
},
}
}
: { Unlimited: null };
},
/**
Expand Down
2 changes: 1 addition & 1 deletion src/createXcmTypes/RelayToPara.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export const RelayToPara: ICreateXcmType = {
refTime: opts.weightLimit?.refTime,
proofSize: opts.weightLimit?.proofSize,
},
}
}
: { Unlimited: null };
},
/**
Expand Down
2 changes: 1 addition & 1 deletion src/createXcmTypes/RelayToSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export const RelayToSystem: ICreateXcmType = {
refTime: opts.weightLimit?.refTime,
proofSize: opts.weightLimit?.proofSize,
},
}
}
: { Unlimited: null };
},
/**
Expand Down
8 changes: 4 additions & 4 deletions src/createXcmTypes/SystemToBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ export const SystemToBridge: ICreateXcmType = {
X1: destination.interior.X1 as InteriorValue,
},
},
}
}
: {
V3: {
parents: 2,
interior: {
X2: destination.interior.X2 as InteriorValue,
},
},
};
};
} else {
if (destination.interior && destination.interior.X1) {
dest = {
Expand Down Expand Up @@ -180,7 +180,7 @@ export const SystemToBridge: ICreateXcmType = {
refTime: opts.weightLimit?.refTime,
proofSize: opts.weightLimit?.proofSize,
},
}
}
: { Unlimited: null };
},
/**
Expand Down Expand Up @@ -284,7 +284,7 @@ export const createSystemToBridgeAssets = async (
? { Here: '' }
: {
X2: [{ PalletInstance: palletId }, { GeneralIndex: assetId }],
};
};

assetLocation = {
parents,
Expand Down
4 changes: 2 additions & 2 deletions src/createXcmTypes/SystemToPara.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export const SystemToPara: ICreateXcmType = {
refTime: opts.weightLimit?.refTime,
proofSize: opts.weightLimit?.proofSize,
},
}
}
: { Unlimited: null };
},
/**
Expand Down Expand Up @@ -302,7 +302,7 @@ export const createSystemToParaMultiAssets = async (
? { Here: '' }
: {
X2: [{ PalletInstance: palletId }, { GeneralIndex: assetId }],
};
};

concreteMultiLocation = {
parents,
Expand Down
2 changes: 1 addition & 1 deletion src/createXcmTypes/SystemToRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const SystemToRelay: ICreateXcmType = {
refTime: opts.weightLimit?.refTime,
proofSize: opts.weightLimit?.proofSize,
},
}
}
: { Unlimited: null };
},
/**
Expand Down
4 changes: 2 additions & 2 deletions src/createXcmTypes/SystemToSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export const SystemToSystem: ICreateXcmType = {
refTime: opts.weightLimit?.refTime,
proofSize: opts.weightLimit?.proofSize,
},
}
}
: { Unlimited: null };
},
/**
Expand Down Expand Up @@ -282,7 +282,7 @@ export const createSystemToSystemMultiAssets = async (
? { Here: '' }
: {
X2: [{ PalletInstance: palletId }, { GeneralIndex: assetId }],
};
};
concreteMultiLocation = resolveMultiLocation(
{
parents,
Expand Down
4 changes: 2 additions & 2 deletions src/createXcmTypes/util/chainDestIsBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const chainDestIsBridge = (destLocation: string): boolean => {
destIsBridge = location.interior.X1
? JSON.stringify(location.interior.X1).toLowerCase().includes('globalconsensus')
: location.interior.X2
? JSON.stringify(location.interior.X2).toLowerCase().includes('globalconsensus')
: false;
? JSON.stringify(location.interior.X2).toLowerCase().includes('globalconsensus')
: false;
}

return destIsBridge;
Expand Down
2 changes: 1 addition & 1 deletion src/createXcmTypes/util/createAssetLocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const createAssetLocations = async (
? { Here: '' }
: {
X2: [{ PalletInstance: palletId }, { GeneralIndex: assetId }],
};
};

concreteMultiLocation = {
parents,
Expand Down
6 changes: 3 additions & 3 deletions src/createXcmTypes/util/createXcmOnDestination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ export const createXcmOnDestination = (
beneficiary,
},
},
];
];

const defaultDestXcm: AnyJson =
xcmVersion === 3
? {
V3: xcmMessage,
}
}
: {
V4: xcmMessage,
};
};

return defaultDestXcm;
};
8 changes: 4 additions & 4 deletions src/createXcmTypes/util/fetchPalletInstanceId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ export const fetchPalletInstanceId = (
isLiquidToken && api.query.poolAssets
? 'PoolAssets'
: isForeignAsset && api.query.foreignAssets && assetIdIsLocation(assetId)
? '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) {
Expand Down
10 changes: 5 additions & 5 deletions src/createXcmTypes/util/resolveAssetTransferType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ export const resolveAssetTransferType = (
assetTransferType === 'LocalReserve'
? {
LocalReserve: 'null',
}
}
: assetTransferType === 'DestinationReserve'
? {
? {
DestinationReserve: 'null',
}
: {
}
: {
Teleport: 'null',
};
};
}

return transferType;
Expand Down
Loading