From b3526dfa67703d32780dd19e0ec3b2eadb1e1ee4 Mon Sep 17 00:00:00 2001 From: Fuxing Loh Date: Fri, 16 Apr 2021 19:39:34 +0800 Subject: [PATCH] moved optional prevTxs to options as suggested in the guidelines --- .../jellyfish-api-core/src/category/rawtx.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/jellyfish-api-core/src/category/rawtx.ts b/packages/jellyfish-api-core/src/category/rawtx.ts index 61703aa522..bf1aedf066 100644 --- a/packages/jellyfish-api-core/src/category/rawtx.ts +++ b/packages/jellyfish-api-core/src/category/rawtx.ts @@ -49,20 +49,19 @@ export class RawTx { * * @param {string} rawTx unsigned raw transaction * @param {string[]} privKeys array of base58-encoded private keys for signing (WIF) - * @param {SignRawTxWithKeyPrevTx[]} prevTxs array of previous dependent transaction outputs * @param {SignRawTxWithKeyOptions} options - * @param {SigHashType} options.sigHashType The signature hash type to use + * @param {SigHashType} options.sigHashType the signature hash type to use + * @param {SignRawTxWithKeyPrevTx[]} options.prevTxs array of previous dependent transaction outputs * @return {Promise} */ async signRawTransactionWithKey ( rawTx: string, privKeys: string[], - prevTxs?: SignRawTxWithKeyPrevTx[], options: SignRawTxWithKeyOptions = {} ): Promise { const { sigHashType = SigHashType.ALL } = options return await this.client.call('signrawtransactionwithkey', [ - rawTx, privKeys, prevTxs, sigHashType + rawTx, privKeys, options.prevTxs, sigHashType ], 'number') } @@ -119,6 +118,11 @@ export interface CreateRawTxOut { [address: string]: BigNumber } +export interface SignRawTxWithKeyOptions { + prevTxs?: SignRawTxWithKeyPrevTx[] + sigHashType?: SigHashType +} + export interface SignRawTxWithKeyPrevTx { /** * The transaction id @@ -146,10 +150,6 @@ export interface SignRawTxWithKeyPrevTx { amount?: BigNumber } -export interface SignRawTxWithKeyOptions { - sigHashType?: SigHashType -} - export interface SignRawTxWithKeyResult { /** * The hex-encoded raw transaction with signature(s)