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

feat: add unit test for creating and signing vault related bitcoin transactions #4

Merged
merged 2 commits into from
Jun 3, 2024
Merged
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
10 changes: 10 additions & 0 deletions .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,13 @@ jobs:

- name: Commit Message
uses: wagoid/commitlint-github-action@v4

test-unit:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/provision

- name: Unit Test
run: yarn test
8 changes: 8 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/?(*.)+(spec|test).ts'],
moduleNameMapper: {
'^(\\.\\.?\\/.+)\\.js$': '$1',
},
};
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "module",
"name": "dlc-btc-lib",
"version": "1.0.2",
"version": "1.0.4",
"description": "This library provides a comprehensive set of interfaces and functions for minting dlcBTC tokens on supported blockchains.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -19,8 +19,7 @@
"scripts": {
"clean": "rm -rf dist && rm -rf node_modules",
"build": "tsc",
"start": "node dist/example.js",
"test": "ts-node index.ts",
"test": "jest",
"lint": "concurrently -g 'yarn lint:eslint' 'yarn lint:prettier' 'yarn run lint:typecheck'",
"lint:eslint": "eslint \"src/**/*.{js,ts}\"",
"lint:eslint:fix": "eslint --fix \"src/**/*.{js,ts}\"",
Expand All @@ -39,22 +38,25 @@
"author": "DLC.Link",
"license": "ISC",
"devDependencies": {
"@ledgerhq/hw-transport-node-hid": "^6.28.6",
"@ledgerhq/hw-transport-webusb": "^6.28.6",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/jest": "^29.5.12",
"@types/prompts": "^2.4.9",
"concurrently": "^8.2.2",
"eslint": "^9.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"lint": "^0.8.19",
"ls-lint": "^0.1.2",
"prettier": "^3.2.5",
"prettier-eslint": "^16.3.0",
"ts-jest": "^29.1.4",
"ts-node": "^10.9.2",
"typescript": "4.7.4",
"typescript-eslint": "^7.7.0",
"@ledgerhq/hw-transport-node-hid": "^6.28.6",
"@ledgerhq/hw-transport-webusb": "^6.28.6",
"typecheck": "^0.1.2",
"prettier-eslint": "^16.3.0",
"lint": "^0.8.19",
"ls-lint": "^0.1.2",
"@trivago/prettier-plugin-sort-imports": "^4.3.0"
"typescript": "^5.4.5",
"typescript-eslint": "^7.7.0"
},
"dependencies": {
"@ledgerhq/hw-app-btc": "^10.2.4",
Expand Down
37 changes: 0 additions & 37 deletions src/constants/example-constants.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/dlc-handlers/software-wallet-dlc-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class SoftwareWalletDLCHandler {
const taprootMultisigPayment = createTaprootMultisigPayment(
unspendableDerivedPublicKey,
attestorDerivedPublicKey,
Buffer.from(this.taprootDerivedPublicKey),
Buffer.from(this.taprootDerivedPublicKey, 'hex'),
this.bitcoinNetwork
);

Expand Down
250 changes: 0 additions & 250 deletions src/example.ts

This file was deleted.

Loading
Loading