Skip to content
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

api-core to use named export instead of * #124

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RegTestContainer, MasterNodeRegTestContainer } from '@defichain/testcontainers'
import { ContainerAdapterClient } from '../container_adapter_client'
import waitForExpect from 'wait-for-expect'
import { BigNumber, Block, Transaction } from '../../src'
import { BigNumber, blockchain as bc } from '../../src'

describe('non masternode', () => {
const container = new RegTestContainer()
Expand Down Expand Up @@ -103,7 +103,7 @@ describe('masternode', () => {

it('should getBlock with verbosity 1 and return block with tx as hex', async () => {
const blockHash = await waitForBlockHash(1)
const block: Block<string> = await client.blockchain.getBlock(blockHash, 1)
const block: bc.Block<string> = await client.blockchain.getBlock(blockHash, 1)

expect(block.hash.length).toBe(64)

Expand Down Expand Up @@ -139,7 +139,7 @@ describe('masternode', () => {

it('should getBlock with verbosity 2 and return block with tx as RawText', async () => {
const blockHash = await waitForBlockHash(1)
const block: Block<Transaction> = await client.blockchain.getBlock(blockHash, 2)
const block: bc.Block<bc.Transaction> = await client.blockchain.getBlock(blockHash, 2)

expect(block.tx.length).toBeGreaterThanOrEqual(1)
expect(block.tx[0].vin[0].coinbase).toStrictEqual('5100')
Expand Down
4 changes: 2 additions & 2 deletions packages/jellyfish-api-core/__tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MintingInfo, ApiClient, ClientApiError } from '../src'
import { mining, ApiClient, ClientApiError } from '../src'
import { ContainerAdapterClient } from './container_adapter_client'
import { RegTestContainer } from '@defichain/testcontainers'

Expand All @@ -17,7 +17,7 @@ it('should export client', async () => {
it('should export categories', async () => {
const client = new TestClient()
await expect(async () => {
const info: MintingInfo = await client.mining.getMintingInfo()
const info: mining.MintingInfo = await client.mining.getMintingInfo()
console.log(info)
}).rejects.toThrowError(ClientApiError)
})
Expand Down
6 changes: 3 additions & 3 deletions packages/jellyfish-api-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Mining } from './category/mining'
import { Wallet } from './category/wallet'

export * from '@defichain/jellyfish-json'
export * from './category/blockchain'
export * from './category/mining'
export * from './category/wallet'
export * as blockchain from './category/blockchain'
export * as mining from './category/mining'
export * as wallet from './category/wallet'

/**
* ApiClient; a protocol agnostic DeFiChain node client, RPC calls are separated into their category.
Expand Down