Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
355db5b
wip
canonbrother May 31, 2021
bda69ca
references seems working
canonbrother May 31, 2021
cd9d2bf
mapping Goto defination -> source
canonbrother May 31, 2021
e689eea
update npm run clean script
canonbrother May 31, 2021
bd0e75d
spaces
canonbrother May 31, 2021
63a8374
fix tsconfig paths and references
canonbrother May 31, 2021
aa79f3f
replace lerna build by tsc -b
canonbrother May 31, 2021
acc87be
running test without build
canonbrother Jun 1, 2021
ae45d94
remove only
canonbrother Jun 1, 2021
5514f4d
fix conflicts
canonbrother Jun 1, 2021
3d90f3a
remove unuse tsconfig
canonbrother Jun 1, 2021
ae014bc
fix conflicts
canonbrother Jun 1, 2021
f8bbb04
switch back to lerna build, update tsconfig path for more flexible ma…
canonbrother Jun 2, 2021
2131438
fix conflicts
canonbrother Jun 2, 2021
ba2e677
test tsc -b && lerna build for parcel only
canonbrother Jun 2, 2021
4c1f1bd
try silly build script
canonbrother Jun 2, 2021
b4c10d5
simply build only
canonbrother Jun 2, 2021
19e91bd
try tsc -b + lerna build with tsconfig in jellyfish
canonbrother Jun 2, 2021
6571ba2
try parcel build first then build the rest
canonbrother Jun 2, 2021
6bb2bc8
what it just parcel build
canonbrother Jun 2, 2021
2afbeea
use lerna to build
canonbrother Jun 2, 2021
87891e6
add tsconfig
canonbrother Jun 2, 2021
ceb02c3
test silly script again
canonbrother Jun 2, 2021
1b8bcd7
should work
canonbrother Jun 3, 2021
a62ec5b
Merge branch 'main' into canonbrother/ts-project-references
canonbrother Jun 4, 2021
9552b3c
Merge remote-tracking branch 'origin/main' into canonbrother/ts-proje…
fuxingloh Jun 8, 2021
924c357
fix mono repo ts config (#358)
fuxingloh Jun 9, 2021
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ coverage

# vscode
.vscode

# typescript
tsconfig.build.tsbuildinfo
25 changes: 21 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
module.exports = {
projects: [
'<rootDir>/packages/*'
],
testTimeout: 240000
preset: 'ts-jest',
testRegex: '((\\.|/)(e2e|test|spec))\\.[jt]sx?$',
moduleNameMapper: {
'@defichain/jellyfish-address': '<rootDir>/packages/jellyfish-address/src',
'@defichain/jellyfish-api-core': '<rootDir>/packages/jellyfish-api-core/src',
'@defichain/jellyfish-api-jsonrpc': '<rootDir>/packages/jellyfish-api-jsonrpc/src',
'@defichain/jellyfish-crypto': '<rootDir>/packages/jellyfish-crypto/src',
'@defichain/jellyfish-json': '<rootDir>/packages/jellyfish-json/src',
'@defichain/jellyfish-network': '<rootDir>/packages/jellyfish-network/src',
'@defichain/jellyfish-transaction': '<rootDir>/packages/jellyfish-transaction/src',
'@defichain/jellyfish-transaction-builder': '<rootDir>/packages/jellyfish-transaction-builder/src',
'@defichain/jellyfish-wallet': '<rootDir>/packages/jellyfish-wallet/src',
'@defichain/jellyfish-wallet-mnemonic': '<rootDir>/packages/jellyfish-wallet-mnemonic/src',
'@defichain/testcontainers': '<rootDir>/packages/testcontainers/src',
'@defichain/testing': '<rootDir>/packages/testing/src'
},
testTimeout: 240000,
coveragePathIgnorePatterns: [
'/node_modules/',
'.*/__tests__/.*'
]
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"node": ">=14.x"
},
"scripts": {
"clean": "rm -rf ./packages/**/dist && rm -rf ./packages/**/tsconfig.build.tsbuildinfo",
"prepare": "husky install",
"build": "lerna run build",
"version": "lerna version $1 --yes --no-push --no-git-tag-version",
Expand All @@ -29,7 +30,7 @@
"standard": "ts-standard --fix",
"test": "jest --maxWorkers=100%",
"test:ci": "jest --ci --coverage --forceExit --maxWorkers=4",
"all": "npm run build && npm run standard && npm run test"
"all": "npm run clean && npm run build && npm run standard && npm run test"
},
"devDependencies": {
"@size-limit/preset-app": "^4.10.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/jellyfish-address/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dist"
],
"scripts": {
"build": "tsc"
"build": "tsc -b ./tsconfig.build.json"
},
"dependencies": {
"@defichain/jellyfish-crypto": "0.0.0",
Expand Down
15 changes: 15 additions & 0 deletions packages/jellyfish-address/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "../../tsconfig.build.json",
"include": [
"./src/**/*"
],
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
},
"references": [
{"path": "../jellyfish-crypto/tsconfig.build.json"},
{"path": "../jellyfish-network/tsconfig.build.json"},
{"path": "../jellyfish-transaction/tsconfig.build.json"}
]
}
2 changes: 1 addition & 1 deletion packages/jellyfish-api-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dist"
],
"scripts": {
"build": "tsc"
"build": "tsc -b ./tsconfig.build.json"
},
"dependencies": {
"@defichain/jellyfish-json": "0.0.0"
Expand Down
14 changes: 14 additions & 0 deletions packages/jellyfish-api-core/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "../../tsconfig.build.json",
"include": [
"./src/**/*"
],
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
},
"references": [
{"path": "../jellyfish-json/tsconfig.build.json"},
{"path": "../testcontainers/tsconfig.build.json"}
]
}
2 changes: 1 addition & 1 deletion packages/jellyfish-api-jsonrpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dist"
],
"scripts": {
"build": "tsc"
"build": "tsc -b ./tsconfig.build.json"
},
"dependencies": {
"@defichain/jellyfish-api-core": "0.0.0",
Expand Down
14 changes: 14 additions & 0 deletions packages/jellyfish-api-jsonrpc/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "../../tsconfig.build.json",
"include": [
"./src/**/*"
],
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
},
"references": [
{"path": "../jellyfish-api-core/tsconfig.build.json"},
{"path": "../testcontainers/tsconfig.build.json"}
]
}
2 changes: 1 addition & 1 deletion packages/jellyfish-crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dist"
],
"scripts": {
"build": "tsc"
"build": "tsc -b ./tsconfig.build.json"
},
"dependencies": {
"bech32": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.build.json",
"include": [
"./src/**/*"
],
Expand Down
10 changes: 0 additions & 10 deletions packages/jellyfish-crypto/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/jellyfish-json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dist"
],
"scripts": {
"build": "tsc"
"build": "tsc -b ./tsconfig.build.json"
},
"peerDependencies": {
"bignumber.js": "^9.0.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.build.json",
"include": [
"./src/**/*"
],
Expand Down
10 changes: 0 additions & 10 deletions packages/jellyfish-json/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/jellyfish-network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
"dist"
],
"scripts": {
"build": "tsc"
"build": "tsc -b ./tsconfig.build.json"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.build.json",
"include": [
"./src/**/*"
],
Expand Down
10 changes: 0 additions & 10 deletions packages/jellyfish-network/tsconfig.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import BigNumber from 'bignumber.js'
import { JsonRpcClient } from '@defichain/jellyfish-api-jsonrpc'
import { OP_CODES } from '@defichain/jellyfish-transaction'
import { AccountToAccount } from '@defichain/jellyfish-transaction/dist/script/defi/dftx_account'
import { OP_CODES, AccountToAccount } from '@defichain/jellyfish-transaction'
import { P2WPKH } from '@defichain/jellyfish-address'
import { MasterNodeRegTestContainer } from '@defichain/testcontainers'
import { createToken, mintTokens, sendTokensToAddress, utxosToAccount } from '@defichain/testing'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import BigNumber from 'bignumber.js'
import { JsonRpcClient } from '@defichain/jellyfish-api-jsonrpc'
import { OP_CODES } from '@defichain/jellyfish-transaction'
import { AccountToUtxos } from '@defichain/jellyfish-transaction/dist/script/defi/dftx_account'
import { OP_CODES, AccountToUtxos } from '@defichain/jellyfish-transaction'
import { MasterNodeRegTestContainer } from '@defichain/testcontainers'
import { utxosToAccount } from '@defichain/testing'
import { getProviders, MockProviders } from '../provider.mock'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import BigNumber from 'bignumber.js'
import { Bech32, HASH160 } from '@defichain/jellyfish-crypto'
import { OP_CODES } from '@defichain/jellyfish-transaction'
import { UtxosToAccount } from '@defichain/jellyfish-transaction/src/script/defi/dftx_account'
import { OP_CODES, UtxosToAccount } from '@defichain/jellyfish-transaction'
import { MasterNodeRegTestContainer } from '@defichain/testcontainers'
import { JsonRpcClient } from '@defichain/jellyfish-api-jsonrpc'
import { getProviders, MockProviders } from '../provider.mock'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BigNumber from 'bignumber.js'
import { JsonRpcClient } from '@defichain/jellyfish-api-jsonrpc'
import { RegTest } from '@defichain/jellyfish-network'
import { OP_CODES } from '@defichain/jellyfish-transaction'
import { OP_CODES, PoolAddLiquidity } from '@defichain/jellyfish-transaction'
import { P2WPKH } from '@defichain/jellyfish-address'
import { MasterNodeRegTestContainer } from '@defichain/testcontainers'
import { createPoolPair, createToken, mintTokens, sendTokensToAddress, utxosToAccount } from '@defichain/testing'
Expand All @@ -13,7 +13,6 @@ import {
sendTransaction
} from '../test.utils'
import { Bech32, HASH160 } from '@defichain/jellyfish-crypto'
import { PoolAddLiquidity } from '@defichain/jellyfish-transaction/dist/script/defi/dftx_pool'

const container = new MasterNodeRegTestContainer()
let providers: MockProviders
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import BigNumber from 'bignumber.js'
import { JsonRpcClient } from '@defichain/jellyfish-api-jsonrpc'
import { OP_CODES } from '@defichain/jellyfish-transaction'
import { OP_CODES, PoolRemoveLiquidity } from '@defichain/jellyfish-transaction'
import { MasterNodeRegTestContainer } from '@defichain/testcontainers'
import { addPoolLiquidity, createPoolPair, createToken, mintTokens } from '@defichain/testing'
import { getProviders, MockProviders } from '../provider.mock'
Expand All @@ -11,7 +11,6 @@ import {
sendTransaction
} from '../test.utils'
import { Bech32, HASH160 } from '@defichain/jellyfish-crypto'
import { PoolRemoveLiquidity } from '@defichain/jellyfish-transaction/dist/script/defi/dftx_pool'

const container = new MasterNodeRegTestContainer()
let providers: MockProviders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ import { MasterNodeRegTestContainer } from '@defichain/testcontainers'
import { getProviders, MockProviders } from '../provider.mock'
import { P2WPKHTxnBuilder } from '../../src'
import { fundEllipticPair } from '../test.utils'
import { OP_DEFI_TX } from '@defichain/jellyfish-transaction/dist/script/defi'
import { CDfTx } from '@defichain/jellyfish-transaction/dist/script/defi/dftx'
import { OP_CODES } from '@defichain/jellyfish-transaction/dist'
import { DeFiOpUnmapped } from '@defichain/jellyfish-transaction/src/script/defi/dftx_unmapped'
import { DeFiOpUnmapped, OP_CODES, OP_DEFI_TX, CDfTx } from '@defichain/jellyfish-transaction'

// P2WPKHTxnBuilder is abstact and not instantiable
// P2WPKHTxnBuilder is abstract and not instantiable
class TestBuilder extends P2WPKHTxnBuilder {}

const container = new MasterNodeRegTestContainer()
Expand Down
2 changes: 1 addition & 1 deletion packages/jellyfish-transaction-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dist"
],
"scripts": {
"build": "tsc"
"build": "tsc -b ./tsconfig.build.json"
},
"peerDependencies": {
"bignumber.js": "^9.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import {
SignInputOption,
Transaction,
TransactionSegWit,
TransactionSigner, Vin, Vout
TransactionSigner, Vin, Vout, OP_DEFI_TX
} from '@defichain/jellyfish-transaction'
import { BigNumber } from 'bignumber.js'
import { EllipticPairProvider, FeeRateProvider, Prevout, PrevoutProvider } from '../provider'
import { calculateFeeP2WPKH } from './txn_fee'
import { OP_DEFI_TX } from '@defichain/jellyfish-transaction/dist/script/defi'
import { TxnBuilderError, TxnBuilderErrorType } from './txn_builder_error'

const MAX_FEE_RATE = new BigNumber('0.00100000')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import BigNumber from 'bignumber.js'
import { AccountToAccount, AccountToUtxos, UtxosToAccount } from '@defichain/jellyfish-transaction/dist/script/defi/dftx_account'
import { DeFiTransactionConstants, OP_CODES, Script, Transaction, TransactionSegWit, Vout } from '@defichain/jellyfish-transaction'
import {
AccountToAccount, AccountToUtxos, UtxosToAccount, DeFiTransactionConstants,
OP_CODES, Script, Transaction, TransactionSegWit, Vout
} from '@defichain/jellyfish-transaction'
import { P2WPKHTxnBuilder } from './txn_builder'
import { TxnBuilderError, TxnBuilderErrorType } from './txn_builder_error'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { OP_CODES, Script, TransactionSegWit } from '@defichain/jellyfish-transaction'
import { PoolSwap } from '@defichain/jellyfish-transaction/dist/script/defi/dftx_pool'
import { OP_CODES, Script, TransactionSegWit, PoolSwap } from '@defichain/jellyfish-transaction'
import { P2WPKHTxnBuilder } from './txn_builder'

export class TxnBuilderDex extends P2WPKHTxnBuilder {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { PoolAddLiquidity, PoolRemoveLiquidity } from '@defichain/jellyfish-transaction/dist/script/defi/dftx_pool'
import { OP_CODES, Script, TransactionSegWit } from '@defichain/jellyfish-transaction'
import { OP_CODES, Script, TransactionSegWit, PoolAddLiquidity, PoolRemoveLiquidity } from '@defichain/jellyfish-transaction'
import { P2WPKHTxnBuilder } from './txn_builder'
import { TxnBuilderError, TxnBuilderErrorType } from './txn_builder_error'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { AppointOracle, RemoveOracle, SetOracleData, UpdateOracle } from '@defichain/jellyfish-transaction/dist/script/defi/dftx_oracles'
import { OP_CODES, Script, TransactionSegWit } from '@defichain/jellyfish-transaction'
import {
OP_CODES, Script, TransactionSegWit,
AppointOracle, RemoveOracle, SetOracleData, UpdateOracle
} from '@defichain/jellyfish-transaction'
import { P2WPKHTxnBuilder } from './txn_builder'
import { TxnBuilderError, TxnBuilderErrorType } from './txn_builder_error'

Expand Down
15 changes: 15 additions & 0 deletions packages/jellyfish-transaction-builder/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "../../tsconfig.build.json",
"include": [
"./src/**/*"
],
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
},
"references": [
{"path": "../jellyfish-api-jsonrpc/tsconfig.build.json"},
{"path": "../testcontainers/tsconfig.build.json"},
{"path": "../testing/tsconfig.build.json"}
]
}
10 changes: 0 additions & 10 deletions packages/jellyfish-transaction-builder/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/jellyfish-transaction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dist"
],
"scripts": {
"build": "tsc"
"build": "tsc -b ./tsconfig.build.json"
},
"peerDependencies": {
"bignumber.js": "^9.0.1"
Expand Down
12 changes: 12 additions & 0 deletions packages/jellyfish-transaction/src/script/defi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ import { OP_RETURN } from '../control'
import { CDfTx, DfTx } from './dftx'
import { OP_CODES } from '../mapping'

export * from './dftx_account'
export * from './dftx_balance'
export * from './dftx_governance'
export * from './dftx_masternode'
export * from './dftx_misc'
export * from './dftx_oracles'
export * from './dftx_pool'
export * from './dftx_price'
export * from './dftx_token'
export * from './dftx_unmapped'
export * from './dftx'

const DEFI_SIGNATURE = '44665478' // DfTx

/**
Expand Down
1 change: 1 addition & 0 deletions packages/jellyfish-transaction/src/script/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export * from './data'
export * from './mapping'
export * from './opcode'
export * from './stack'
export * from './defi'
Loading