Skip to content

Commit

Permalink
moved optional prevTxs to options as suggested in the guidelines
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxingloh committed Apr 16, 2021
1 parent a66fcf6 commit b3526df
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/jellyfish-api-core/src/category/rawtx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<SignRawTxWithKeyResult>}
*/
async signRawTransactionWithKey (
rawTx: string,
privKeys: string[],
prevTxs?: SignRawTxWithKeyPrevTx[],
options: SignRawTxWithKeyOptions = {}
): Promise<SignRawTxWithKeyResult> {
const { sigHashType = SigHashType.ALL } = options
return await this.client.call('signrawtransactionwithkey', [
rawTx, privKeys, prevTxs, sigHashType
rawTx, privKeys, options.prevTxs, sigHashType
], 'number')
}

Expand Down Expand Up @@ -119,6 +118,11 @@ export interface CreateRawTxOut {
[address: string]: BigNumber
}

export interface SignRawTxWithKeyOptions {
prevTxs?: SignRawTxWithKeyPrevTx[]
sigHashType?: SigHashType
}

export interface SignRawTxWithKeyPrevTx {
/**
* The transaction id
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b3526df

Please sign in to comment.