Skip to content

Commit 950b21c

Browse files
author
Pierre Gee
authored
chore(jellyfish-transaction-builder): add interface on the same package (#2158)
<!-- Thanks for sending a pull request! --> #### What this PR does / why we need it: Having package build issues, need to make the package agnostic <img width="1170" alt="image" src="https://github.com/BirthdayResearch/jellyfishsdk/assets/13292662/61b19d4f-22d6-44b3-8c1c-a24e3ec80645"> #### Which issue(s) does this PR fixes?: <!-- (Optional) Automatically closes linked issue when PR is merged. Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> Fixes # #### Additional comments?:
1 parent 8baa393 commit 950b21c

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

packages/jellyfish-transaction-builder/__tests__/provider.mock.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import BigNumber from 'bignumber.js'
22
import { Bech32, EllipticPair, Eth, HASH160, WIF } from '@defichain/jellyfish-crypto'
3-
import { EllipticPairProvider, FeeRateProvider, Prevout, PrevoutProvider } from '../src'
3+
import { EllipticPairProvider, FeeRateProvider, ListUnspentQueryOptions, Prevout, PrevoutProvider } from '../src'
44
import { MasterNodeRegTestContainer } from '@defichain/testcontainers'
55
import { OP_CODES, Script } from '@defichain/jellyfish-transaction'
66
import { randomEllipticPair } from './test.utils'
7-
import { ListUnspentQueryOptions } from '@defichain/jellyfish-api-core/src/category/wallet'
87

98
export class MockFeeRateProvider implements FeeRateProvider {
109
constructor (

packages/jellyfish-transaction-builder/src/provider.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import BigNumber from 'bignumber.js'
22
import { EllipticPair } from '@defichain/jellyfish-crypto'
33
import { Vout } from '@defichain/jellyfish-transaction'
4-
import { ListUnspentQueryOptions } from '@defichain/jellyfish-api-core/src/category/wallet'
54

65
export interface FeeRateProvider {
76
/**
@@ -10,6 +9,14 @@ export interface FeeRateProvider {
109
estimate: () => Promise<BigNumber>
1110
}
1211

12+
export interface ListUnspentQueryOptions {
13+
minimumAmount?: number
14+
maximumAmount?: number
15+
maximumCount?: number
16+
minimumSumAmount?: number
17+
tokenId?: string
18+
}
19+
1320
export interface PrevoutProvider {
1421
/**
1522
* @return {Prevout[]} all outputs to create transaction, aka to send all.

packages/jellyfish-transaction-builder/src/txn/txn_builder.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ import {
1010
} from '@defichain/jellyfish-transaction'
1111
import { SignInputOption, TransactionSigner } from '@defichain/jellyfish-transaction-signature'
1212
import BigNumber from 'bignumber.js'
13-
import { EllipticPairProvider, FeeRateProvider, Prevout, PrevoutProvider } from '../provider'
13+
import { EllipticPairProvider, FeeRateProvider, ListUnspentQueryOptions, Prevout, PrevoutProvider } from '../provider'
1414
import { calculateFeeP2WPKH } from './txn_fee'
1515
import { TxnBuilderError, TxnBuilderErrorType } from './txn_builder_error'
1616
import { EllipticPair } from '@defichain/jellyfish-crypto'
1717
import { Network } from '@defichain/jellyfish-network'
18-
import { ListUnspentQueryOptions } from '@defichain/jellyfish-api-core/src/category/wallet'
1918

2019
const MAX_FEE_RATE = new BigNumber('0.00100000')
2120

packages/jellyfish-transaction-builder/src/txn/txn_builder_account.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
} from '@defichain/jellyfish-transaction'
66
import { P2WPKHTxnBuilder } from './txn_builder'
77
import { TxnBuilderError, TxnBuilderErrorType } from './txn_builder_error'
8-
import { ListUnspentQueryOptions } from '@defichain/jellyfish-api-core/src/category/wallet'
8+
import { ListUnspentQueryOptions } from '../provider'
99

1010
export class TxnBuilderAccount extends P2WPKHTxnBuilder {
1111
/**

0 commit comments

Comments
 (0)