From 26c9824fcf8ec14d882bd855236b8e2340ae6fcd Mon Sep 17 00:00:00 2001 From: James Cramer Date: Sun, 11 Apr 2021 11:09:19 -0400 Subject: [PATCH 1/4] add travis ci --- .travis.yml | 10 ++++++++++ package.json | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..3361f19a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: node_js +node_js: + - 10 + - 12 + - 14.15 +sudo: false +script: + - npm test +after_success: + - npm run coverage \ No newline at end of file diff --git a/package.json b/package.json index bf56274d..ce4879d8 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "dist/" ], "scripts": { - "test": "npx tsc && nyc mocha", + "test": "mocha", + "coverage": "nyc npm test && nyc report --reporter=text-lcov | coveralls", "build": "npx tsc && mkdirp dist && browserify index.js --standalone slpjs > dist/slpjs.js && uglifyjs dist/slpjs.js > dist/slpjs.min.js" }, "repository": { From c0dd42f180e06ab620becac092dcba145de12529 Mon Sep 17 00:00:00 2001 From: nexerino Date: Wed, 21 Apr 2021 13:53:55 +0700 Subject: [PATCH 2/4] Update bchaddr dependency version and expose slp-regtest function --- lib/utils.ts | 4 ++++ lib/vendors.d.ts | 1 + package.json | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/utils.ts b/lib/utils.ts index 220db124..40866d6f 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -38,6 +38,10 @@ export class Utils { return Bchaddr.toSlpAddress(address); } + public static toSlpRegtestAddress(address: string) { + return Bchaddr.toSlpRegtestAddress(address); + } + public static toRegtestAddress(address: string) { return Bchaddr.toRegtestAddress(address); } diff --git a/lib/vendors.d.ts b/lib/vendors.d.ts index dc0b4c46..d25a6a7d 100644 --- a/lib/vendors.d.ts +++ b/lib/vendors.d.ts @@ -6,6 +6,7 @@ declare module "bchaddrjs-slp" { export function toLegacyAddress(address: string): string; export function isSlpAddress(address: string): boolean; export function toSlpAddress(address: string): string; + export function toSlpRegtestAddress(address: string): string; export function toRegtestAddress(address: string): string; export function decodeAddress(address: string): AddressDetails; export function encodeAsSlpaddr(decoded: AddressDetails): string; diff --git a/package.json b/package.json index ce4879d8..80a389a8 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "@types/socket.io-client": "^1.4.33", "@types/wif": "^2.0.1", "axios": "^0.21.1", - "bchaddrjs-slp": "0.2.8", + "bchaddrjs-slp": "0.2.12", "bignumber.js": "9.0.0", "crypto-js": "^4.0.0", "grpc-bchrpc": "^0.0.10", From 937303aa5d7898aebf0a29ff958c7b17ae51c0af Mon Sep 17 00:00:00 2001 From: nexerino Date: Wed, 21 Apr 2021 14:07:18 +0700 Subject: [PATCH 3/4] add unit test for slpregtest --- test/utils.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/utils.test.ts b/test/utils.test.ts index 6b99fe3f..8315ba64 100644 --- a/test/utils.test.ts +++ b/test/utils.test.ts @@ -148,6 +148,10 @@ describe("Utils", () => { const addr = Utils.toCashAddress("simpleledger:qr5agtachyxvrwxu76vzszan5pnvuzy8duhv4lxrsk"); assert.equal(addr, "bitcoincash:qr5agtachyxvrwxu76vzszan5pnvuzy8dumh7ynrwg"); }); + it("toSlpRegtestAddress()", () => { + const addr = Utils.toSlpRegtestAddress("simpleledger:qph5kuz78czq00e3t85ugpgd7xmer5kr7ccj3fcpsg"); + assert.equal(addr, "slpreg:qph5kuz78czq00e3t85ugpgd7xmer5kr7ch8j98fn9"); + }); it("isCashAddress()", () => { const addr = Utils.isCashAddress("bitcoincash:qr5agtachyxvrwxu76vzszan5pnvuzy8dumh7ynrwg"); assert.equal(addr, true); From 4553365fb828ae94dd9247bf01efa79880b34bf8 Mon Sep 17 00:00:00 2001 From: nexerino Date: Wed, 21 Apr 2021 14:15:55 +0700 Subject: [PATCH 4/4] bump version in package-lock --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index c8472494..84f98ffa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -874,9 +874,9 @@ "dev": true }, "bchaddrjs-slp": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/bchaddrjs-slp/-/bchaddrjs-slp-0.2.8.tgz", - "integrity": "sha512-Is4NQG0xhrmW8ml40n8IjQzYlg1gMqst2RkF20SWjuhiSA8VDx1F53krthFqZFp5hpB+Ig/NPx6NX4VEH9W32Q==", + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/bchaddrjs-slp/-/bchaddrjs-slp-0.2.12.tgz", + "integrity": "sha512-yRtNSo/oPqdl3R3LV9H6fvuksdA/FGvn/8A8IH2dkYLiVe5lOtBjiGV4qFMRUHCtwaXWumbBcUwgvdkXxj3cfg==", "requires": { "bs58check": "^2.1.2", "cashaddrjs-slp": "^0.2.12"