diff --git a/src/createXcmTypes/SystemToRelay.ts b/src/createXcmTypes/SystemToRelay.ts index 7dcd65ff..3a56cad2 100644 --- a/src/createXcmTypes/SystemToRelay.ts +++ b/src/createXcmTypes/SystemToRelay.ts @@ -13,10 +13,10 @@ import { export const SystemToRelay: ICreateXcmType = { /** - * Create a XcmVersionedMultiLocation type for a beneficiary. + * Create a XcmVersionedMultiLocation structured type for a beneficiary. * - * @param accountId The accountId of the beneficiary - * @param xcmVersion The accepted xcm version + * @param accountId The accountId of the beneficiary. + * @param xcmVersion The accepted xcm version. */ createBeneficiary: (accountId: string, xcmVersion?: number): XcmDestBenificiary => { if (xcmVersion === 2) { @@ -49,10 +49,10 @@ export const SystemToRelay: ICreateXcmType = { }; }, /** - * Create a XcmVersionedMultiLocation type for a destination. + * Create a XcmVersionedMultiLocation structured type for a destination. * - * @param destId The destId in this case, which is the relay chain - * @param xcmVersion The accepted xcm version + * @param destId The destId in this case, which is the relay chain. + * @param xcmVersion The accepted xcm version. */ createDest: (_: string, xcmVersion: number): XcmDestBenificiary => { if (xcmVersion === 2) { @@ -76,11 +76,10 @@ export const SystemToRelay: ICreateXcmType = { }; }, /** - * Create a VersionedMultiAsset type. + * Create a VersionedMultiAsset structured type. * - * @param assets - * @param amounts - * @param xcmVersion + * @param amounts The amount for a relay native asset. The length will always be one. + * @param xcmVersion The accepted xcm version. */ createAssets: async (amounts: string[], xcmVersion: number): Promise => { const multiAssets: XcmMultiAsset[] = []; @@ -113,12 +112,9 @@ export const SystemToRelay: ICreateXcmType = { } }, /** - * Create an XcmV3WeightLimit type. + * Create an Xcm WeightLimit structured type. * - * @param api ApiPromise - * @param isLimited Whether the tx is limited - * @param refTime amount of computation time - * @param proofSize amount of storage to be used + * @param opts Options that are used for WeightLimit. */ createWeightLimit: (opts: CreateWeightLimitOpts): XcmWeight => { return opts.isLimited && opts.weightLimit?.refTime && opts.weightLimit?.proofSize @@ -130,11 +126,9 @@ export const SystemToRelay: ICreateXcmType = { } : { Unlimited: null }; }, - /** - * returns the correct feeAssetItem based on XCM direction. - * - * @param api ApiPromise + * Return the correct feeAssetItem based on XCM direction. + * In this case it will always be zero since there is no `feeAssetItem` for this direction. */ createFeeAssetItem: async (_: ApiPromise): Promise => { return await Promise.resolve(0); diff --git a/src/createXcmTypes/SystemToSystem.ts b/src/createXcmTypes/SystemToSystem.ts index 5150fd38..e71b7bbd 100644 --- a/src/createXcmTypes/SystemToSystem.ts +++ b/src/createXcmTypes/SystemToSystem.ts @@ -31,10 +31,10 @@ import { sortMultiAssetsAscending } from './util/sortMultiAssetsAscending'; export const SystemToSystem: ICreateXcmType = { /** - * Create a XcmVersionedMultiLocation type for a beneficiary. + * Create a XcmVersionedMultiLocation structured type for a beneficiary. * - * @param accountId The accountId of the beneficiary - * @param xcmVersion The accepted xcm version + * @param accountId The accountId of the beneficiary. + * @param xcmVersion The accepted xcm version. */ createBeneficiary: (accountId: string, xcmVersion?: number): XcmDestBenificiary => { if (xcmVersion == 2) { @@ -58,10 +58,10 @@ export const SystemToSystem: ICreateXcmType = { }; }, /** - * Create a XcmVersionedMultiLocation type for a destination. + * Create a XcmVersionedMultiLocation structured type for a destination. * - * @param destId The parachain Id of the destination - * @param xcmVersion The accepted xcm version + * @param destId The parachain Id of the destination. + * @param xcmVersion The accepted xcm version. */ createDest: (destId: string, xcmVersion?: number): XcmDestBenificiary => { if (xcmVersion === 2) { @@ -76,7 +76,6 @@ export const SystemToSystem: ICreateXcmType = { }, }; } - /** * Ensure that the `parents` field is a `1` when sending a destination MultiLocation * from a system parachain to a sovereign parachain. @@ -93,11 +92,13 @@ export const SystemToSystem: ICreateXcmType = { }; }, /** - * Create a VersionedMultiAsset type. + * Create a VersionedMultiAsset structured type. * - * @param assets - * @param amounts - * @param xcmVersion + * @param amounts Amount per asset. It will match the `assets` length. + * @param xcmVersion The accepted xcm version. + * @param specName The specname of the chain the api is connected to. + * @param assets The assets to create into xcm `MultiAssets`. + * @param opts Options regarding the registry, and types of asset transfers. */ createAssets: async ( amounts: string[], @@ -130,12 +131,9 @@ export const SystemToSystem: ICreateXcmType = { } }, /** - * Create an XcmV3WeightLimit type. + * Create an Xcm WeightLimit structured type. * - * @param api ApiPromise - * @param isLimited Whether the tx is limited - * @param refTime amount of computation time - * @param proofSize amount of storage to be used + * @param opts Options that are used for WeightLimit. */ createWeightLimit: (opts: CreateWeightLimitOpts): XcmWeight => { return opts.isLimited && opts.weightLimit?.refTime && opts.weightLimit?.proofSize @@ -147,17 +145,11 @@ export const SystemToSystem: ICreateXcmType = { } : { Unlimited: null }; }, - /** - * returns the correct feeAssetItem based on XCM direction. + * Returns the correct `feeAssetItem` based on XCM direction. * * @param api ApiPromise - * @param paysWithFeeDest string - * @param specName string - * @param assetIds string[] - * @param amounts string[] - * @xcmVersion number - * + * @param opts Options that are used for fee asset construction. */ createFeeAssetItem: async (api: ApiPromise, opts: CreateFeeAssetItemOpts): Promise => { const { @@ -209,13 +201,16 @@ export const SystemToSystem: ICreateXcmType = { }; /** - * Creates and returns a MultiAsset array for system parachains based on provided specName, chain ID, assets and amounts + * Create multiassets for SystemToSystem direction. * - * @param api ApiPromise[] - * @param amounts string[] - * @param specName string - * @param assets string[] - * @param chainId string + * @param api ApiPromise + * @param amounts Amount per asset. It will match the `assets` length. + * @param specName The specname of the chain the api is connected to. + * @param assets The assets to create into xcm `MultiAssets`. + * @param xcmVersion The accepted xcm version. + * @param registry The asset registry used to construct MultiLocations. + * @param isForeignAssetsTransfer Whether this transfer is a foreign assets transfer. + * @param isLiquidTokenTransfer Whether this transfer is a liquid pool assets transfer. */ export const createSystemToSystemMultiAssets = async ( api: ApiPromise,