Skip to content

Commit

Permalink
Refactor code and improve comments / docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jingyi2811 committed May 18, 2021
1 parent d5a2bf1 commit 8e14fbe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
16 changes: 4 additions & 12 deletions packages/jellyfish-api-core/__tests__/category/account.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,19 +482,11 @@ describe('masternode', () => {
})

describe('utxosToAccount', () => {
let address1: string
let address2: string

beforeAll(async () => {
address1 = await container.call('getnewaddress')
address2 = await container.call('getnewaddress')
})

it('should utxosToAccount', async () => {
const payload: UtxosToAccountPayload = {}
// NOTE(jingyi2811): Only support sending utxos to DFI account.
payload[address1] = '5@DFI'
payload[address2] = '5@DFI'
payload[await container.getNewAddress()] = '5@DFI'
payload[await container.getNewAddress()] = '5@DFI'

const data = await client.account.utxosToAccount(payload)

Expand All @@ -505,8 +497,8 @@ describe('masternode', () => {
it('should utxosToAccount with utxos', async () => {
const payload: UtxosToAccountPayload = {}
// NOTE(jingyi2811): Only support sending utxos to DFI account.
payload[address1] = '5@DFI'
payload[address2] = '5@DFI'
payload[await container.getNewAddress()] = '5@DFI'
payload[await container.getNewAddress()] = '5@DFI'

const utxos = await container.call('listunspent')
const inputs = utxos.map((utxo: { txid: string, vout: number }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/jellyfish-api-core/src/category/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ export class Account {
}

/**
* Creates (and submits to local node and network) a transfer transaction from the wallet UTXOs to specfied account.
* The second optional argument (may be empty array) is an array of specific UTXOs to spend.
* Creates and submits to a connect node; a transfer transaction from the wallet UTXOs to a specified account.
* Optionally, specific UTXOs to spend to create that transaction.
*
* @param {UtxosToAccountPayload} payload
* @param {string} payload[address]
Expand Down
4 changes: 2 additions & 2 deletions website/docs/jellyfish/api/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ interface AccountHistoryOptions {

## utxosToAccount

Creates (and submits to local node and network) a transfer transaction from the wallet UTXOs to specfied account.
The second optional argument (may be empty array) is an array of specific UTXOs to spend.
Creates and submits to a connect node; a transfer transaction from the wallet UTXOs to a specified account.
Optionally, specific UTXOs to spend to create that transaction.

```ts title="client.account.utxosToAccount()"
interface account {
Expand Down

0 comments on commit 8e14fbe

Please sign in to comment.