Skip to content

Commit

Permalink
fix(internal): remove createType(Call) where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
TarikGul committed Nov 6, 2023
1 parent 55e531d commit 0547765
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions scripts/testNetworkLiquidAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ const mintCall = (api: ApiPromise, to: KeyringPair, amount: number) => {

const createLiquidityPoolCall = (api: ApiPromise) => {
// For now, we have to override the types of the Assets until PJS is updated
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
return api.tx.assetConversion.createPool(<any>native, <any>asset);
};

const addLiquidityCall = (api: ApiPromise, amountNative: number, amountAsset: number, to: KeyringPair) => {
// For now, we have to override the types of the Assets until PJS is updated
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
return api.tx.assetConversion.addLiquidity(<any>native, <any>asset, amountNative, amountAsset, 0, 0, to.address);
};

Expand Down
10 changes: 2 additions & 8 deletions src/AssetTransferApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ export class AssetTransferApi {
origin: string,
opts: { format?: T; paysWithFeeOrigin?: string; sendersAddr?: string }
): Promise<TxResult<T>> {
const { _api } = this;
const { format, paysWithFeeOrigin, sendersAddr } = opts;
const fmt = format ? format : 'payload';
const result: TxResult<T> = {
Expand All @@ -648,12 +647,7 @@ export class AssetTransferApi {
};

if (fmt === 'call') {
result.tx = _api.registry
.createType('Call', {
callIndex: tx.callIndex,
args: tx.args,
})
.toHex() as ConstructedFormat<T>;
result.tx = tx.method.toHex() as ConstructedFormat<T>;
}

if (fmt === 'submittable') {
Expand Down Expand Up @@ -840,7 +834,7 @@ export class AssetTransferApi {

const lastHeader = await this._api.rpc.chain.getHeader();
const blockNumber = this._api.registry.createType('BlockNumber', lastHeader.number.toNumber());
const method = this._api.registry.createType('Call', tx);
const method = tx.method;
const era = this._api.registry.createType('ExtrinsicEra', {
current: lastHeader.number.toNumber(),
period: 64,
Expand Down

0 comments on commit 0547765

Please sign in to comment.