diff --git a/src/renderer/entities/transaction/lib/extrinsicService.ts b/src/renderer/entities/transaction/lib/extrinsicService.ts index c001b5a63..323079022 100644 --- a/src/renderer/entities/transaction/lib/extrinsicService.ts +++ b/src/renderer/entities/transaction/lib/extrinsicService.ts @@ -8,7 +8,7 @@ import { defineMethod, methods, } from '@substrate/txwrapper-polkadot'; -import sortBy from 'lodash/sortBy'; +import { sortBy, zipWith } from 'lodash'; import { type MultisigTxWrapper, type ProxyTxWrapper, type Transaction, TransactionType } from '@/shared/core'; import { toAddress } from '@/shared/lib/utils'; @@ -61,13 +61,23 @@ export const getUnsignedTransaction: Record< options, ); }, - [TransactionType.ASSET_TRANSFER]: (transaction, info, options) => { + [TransactionType.ASSET_TRANSFER]: (transaction, info, options, api) => { + const palletName = transaction.args.palletName ?? 'assets'; + const methodArgs = api.tx[palletName].transfer.meta.args; + const rawArgs = [transaction.args.asset, transaction.args.target, transaction.args.amount]; + const args = zipWith(methodArgs, rawArgs, (method, arg) => { + return [method.name.toString(), api.createType(method.type.toString(), arg)] as const; + }); + + const argsMap = Object.fromEntries(args); + return defineMethod( { method: { name: 'transfer', pallet: transaction.args.palletName ?? 'assets', - args: transaction.args, + // @ts-expect-error defineMethod type disallow Codec type + args: argsMap, }, ...info, },