-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(jellyfish-api-core): listVaultHistory RPC #834
base: main
Are you sure you want to change the base?
Conversation
Code Climate has analyzed commit efa469e and detected 0 issues on this pull request. View more on Code Climate. |
Codecov Report
@@ Coverage Diff @@
## main #834 +/- ##
==========================================
- Coverage 95.74% 93.14% -2.60%
==========================================
Files 140 140
Lines 4485 4493 +8
Branches 586 587 +1
==========================================
- Hits 4294 4185 -109
- Misses 191 306 +115
- Partials 0 2 +2
Continue to review full report at Codecov.
|
packages/jellyfish-api-core/__tests__/category/loan/getVaultHistory.test.ts
Outdated
Show resolved
Hide resolved
✔️ Deploy Preview for jellyfish-defi ready! 🔨 Explore the source changes: efa469e 🔍 Inspect the deploy log: https://app.netlify.com/sites/jellyfish-defi/deploys/619e8c92d7c7010008f724ed 😎 Browse the preview: https://deploy-preview-834--jellyfish-defi.netlify.app |
import { MasterNodeRegTestContainer } from './Masternode' | ||
|
||
/** | ||
* @deprecated use MasterNodeRegTestContainer instead | ||
*/ | ||
export class LoanMasterNodeRegTestContainer extends MasterNodeRegTestContainer { | ||
constructor (masternodeKey: MasterNodeKey = RegTestFoundationKeys[0]) { | ||
super(masternodeKey, 'defi/defichain:HEAD-b810eda') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is merged to master a few hours ago. However, when I connect to MasterNodeRegTestContainer
directly, funny error returned.
* @param {number} [pagination.maxBlockHeight] Maximum block height | ||
* @param {number} [pagination.depth] Maximum Depth, from the genesis block is the default | ||
* @param {string} [pagination.token] Token | ||
* @param {string} [pagination.txtype] Tx type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
txtype
should be txType
. We may need to inform C++ side to change this
} | ||
|
||
interface CreateLoanScheme { | ||
minColRatio: number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C++ side return this as ratio
. Need to tell them to use minColRatio
like how other RPC does
|
||
interface CreateLoanScheme { | ||
minColRatio: number | ||
interestRate: BigNumber |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C++ side return this as rate
. Need to tell them to use interestRate
like how other RPC does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interestRate
currently is a whole number. Need to tell C++ side to change to the number with 8 decimal places.
import { GenesisKeys, LoanMasterNodeRegTestContainer } from '@defichain/testcontainers' | ||
import { ListVaultHistory } from '../../../src/category/loan' | ||
|
||
describe('Loan listVaultHistory', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add all the possible scenarios for loan to this PR
expect(vaultHistory[9].blockHeight).toStrictEqual(auctionBidBlockHeight1) | ||
expect(vaultHistory[9].amounts).toStrictEqual(['-5000.00000000@AAPL']) | ||
|
||
if (vaultHistory[10].address === bobColAddr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 entries are made if a bid outbid by another bid.
However the order is inconsistent.
Need to tell this to C++ side.
|
||
it('should listAuctionHistory with depth only', async () => { | ||
{ | ||
const vaultHistory = await alice.rpc.loan.listVaultHistory(createVaultTxId, { depth: 1 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If pass in depth = 2, the RPC returns 1 record too.
I am not sure why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kresovic-milos I see a lot of comments from @jingyi2811 about inconsistencies in this RPC. Could you test these, and based on your results compile a list? Then we can share with cpp side.
Code Climate has analyzed commit efa469e and detected 0 issues on this pull request. View more on Code Climate. |
What kind of PR is this?:
/kind feature
What this PR does / why we need it:
Add getVaultHistory rpc
Which issue(s) does this PR fixes?:
Fixes part of #488
Additional comments?: