diff --git a/src/node.ts b/src/node.ts index f85dd2912c..1e83c8e03a 100644 --- a/src/node.ts +++ b/src/node.ts @@ -38,22 +38,24 @@ type PreserveOptional = export type TransformNodeType = Type extends (...args: infer Args) => infer Ret ? (...args: TransformNodeType) => TransformNodeType - : Type extends Array - ? Array> - : Type extends Promise - ? Promise> - : Type extends { [P in any]: any } - ? { - [Property in keyof Type]: - Property extends BigIntPropertyNames - ? PreserveOptional - : Property extends NumberPropertyNames - ? PreserveOptional - : Property extends 'txHash' - ? PreserveOptional, Type[Property]> - : TransformNodeType - } - : Type + : Type extends [infer Item, ...infer Rest] + ? [TransformNodeType, ...TransformNodeType] + : Type extends Array + ? Array> + : Type extends Promise + ? Promise> + : Type extends { [P in any]: any } + ? { + [Property in keyof Type]: + Property extends BigIntPropertyNames + ? PreserveOptional + : Property extends NumberPropertyNames + ? PreserveOptional + : Property extends 'txHash' + ? PreserveOptional, Type[Property]> + : TransformNodeType + } + : Type type TransformedNode = new (...args: ConstructorParameters) => { [Name in keyof InstanceType]: TransformNodeType } diff --git a/src/tx/index.ts b/src/tx/index.ts index 97cf0ddb3b..545447b6c0 100644 --- a/src/tx/index.ts +++ b/src/tx/index.ts @@ -94,7 +94,9 @@ export async function _buildTx ( if (txType === TX_TYPE.payingFor) { params.tx = unpackTx(params.tx) } - const extraParams = await prepareTxParams(txType, { ...params, senderId: params[senderKey] }) + const senderId = params[senderKey] + if (senderId == null) throw new UnexpectedTsError() + const extraParams = await prepareTxParams(txType, { ...params, senderId }) return syncBuildTx({ ...params, ...extraParams }, txType).tx } @@ -183,7 +185,8 @@ export async function prepareTxParams ( strategy, showWarning = false, onNode - }: TxParamsCommon & { + }: Pick & { + senderId: EncodedData<'ak'> vsn?: number gasLimit?: number | string | BigNumber absoluteTtl?: number