many frontend changes that need generic change
This commit is contained in:
Generated
+56
-250
@@ -5,49 +5,49 @@
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@angular/common": {
|
||||
"version": "8.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@angular/common/-/common-8.2.3.tgz",
|
||||
"integrity": "sha512-Y8ttd66bAApnJgxjndVnBP0aMsID8AzttR2TKp1KpdDKy4n6td22+1DeHZJqPMOBwoTDEdjHZqFQ7XRNYe3IVw==",
|
||||
"version": "8.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@angular/common/-/common-8.2.6.tgz",
|
||||
"integrity": "sha512-OlU3LCPShHJEsOHS+qczY52P0kWtjJD8N7NDHaGMB6Xp8GMgItjQIeeO6yf8DJyaCIC4qk4G7jPdnQk6IE1SbQ==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"@angular/core": {
|
||||
"version": "8.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@angular/core/-/core-8.2.3.tgz",
|
||||
"integrity": "sha512-wNlq6r0RI8q0BCr3I16NHfteliJLVjZN3MsLfzYi4u08LcGTemGL9YwcVjCOPEH4xREo3xX0ebvmuLwObu75lQ==",
|
||||
"version": "8.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@angular/core/-/core-8.2.6.tgz",
|
||||
"integrity": "sha512-l+BrvPGwtPUh/rQyB9mjtonMsFEAoRHgDYWeQu/QukIZbItNdFqrhewn2zQ8Skx75BpwFLAVIVXp9ioDyvP2eQ==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"@angular/forms": {
|
||||
"version": "8.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@angular/forms/-/forms-8.2.3.tgz",
|
||||
"integrity": "sha512-BDphHWx6FI3wfOd9XqhiUBKuIg4dnpr9Aw5+n1by4y9e2avBwWoefHJ15FtEZdop5qMwVWlCcHjdwZ2+q65f4g==",
|
||||
"version": "8.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@angular/forms/-/forms-8.2.6.tgz",
|
||||
"integrity": "sha512-sYUspJYJGq0OaBuxgdUXPf0TwYyED9OVWNCl9jDJCW//2NAbrZG8BSujvV54Dtg2emY1Uc7EFyQ8Wc8yxS7KSg==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"@angular/platform-browser": {
|
||||
"version": "8.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-8.2.3.tgz",
|
||||
"integrity": "sha512-hKC5V2n0jfrFc9DXvHW+NtHDSfC417WZz8onmUhMR2Eo3fjBm5cuZi5CNgnbZt9zUoXXOfwCy6p3N7FbPDXxLQ==",
|
||||
"version": "8.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-8.2.6.tgz",
|
||||
"integrity": "sha512-wUgcdTXItforNA+6qykPL9SDmV1uSIUQcEZrm3YCoVt7CuwMav3dq9Lg1zZ7HKv0A8It0fAKpXBkamzpRxvZEw==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"@angular/router": {
|
||||
"version": "8.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@angular/router/-/router-8.2.3.tgz",
|
||||
"integrity": "sha512-PMZ5JA0GonaNpwV3VfGWUkL6eo2KbtYUZERu6AnTYpQTTzGBiS6pakQTczE7lb9KZ9u+LIhKBaxQ8hrGLWqgKw==",
|
||||
"version": "8.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@angular/router/-/router-8.2.6.tgz",
|
||||
"integrity": "sha512-XAqhrPbU+z/ztf2b0VxFytHPJRpWfhnhCJ2qf9Tie1Cov6zOlgIKInOSF+WtsFEUZAnwSbAfGk4KSXrwBWw8zA==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"@clr/angular": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@clr/angular/-/angular-2.1.2.tgz",
|
||||
"integrity": "sha512-S8rgtvbniAKobVlCJcIwxD38pkOc0av5mM85Q3jrC2SJy+tNVq4so8QwciwtgUjEP7PeHm/4wWJDItoTzk7aEA==",
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@clr/angular/-/angular-2.2.0.tgz",
|
||||
"integrity": "sha512-+E93SBFlOZVQgZTD3lDsmdaSrv9ylE1r2siTDZeTqRtFz5W/NI055wFqVKAj3U3+/5kUYApeUEmfvSgE0cs80A==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
@@ -140,18 +140,10 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/is-valid-path/-/is-valid-path-0.1.0.tgz",
|
||||
"integrity": "sha512-2ontWtpN8O2nf5S7EjDDJ0DwrRa2t7wmS3Wmo322yWYG6yFBYC1QCaLhz4Iz+mzJy8Kf4zP5yVyEd1ANPDmOFQ=="
|
||||
},
|
||||
"@types/knex": {
|
||||
"version": "0.16.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/knex/-/knex-0.16.1.tgz",
|
||||
"integrity": "sha512-54gWD1HWwdVx5iLHaJ1qxH3I6KyBsj5fFqzRpXFn7REWiEB2jwspeVCombNsocSrqPd7IRPqKrsIME7/cD+TFQ==",
|
||||
"requires": {
|
||||
"knex": "*"
|
||||
}
|
||||
},
|
||||
"@types/lodash": {
|
||||
"version": "4.14.137",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.137.tgz",
|
||||
"integrity": "sha512-g4rNK5SRKloO+sUGbuO7aPtwbwzMgjK+bm9BBhLD7jGUiGR7zhwYEhSln/ihgYQBeIJ5j7xjyaYzrWTcu3UotQ=="
|
||||
"version": "4.14.138",
|
||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.138.tgz",
|
||||
"integrity": "sha512-A4uJgHz4hakwNBdHNPdxOTkYmXNgmUAKLbXZ7PKGslgeV0Mb8P3BlbYfPovExek1qnod4pDfRbxuzcVs3dlFLg=="
|
||||
},
|
||||
"@types/lowdb": {
|
||||
"version": "1.0.9",
|
||||
@@ -696,11 +688,6 @@
|
||||
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
|
||||
"dev": true
|
||||
},
|
||||
"bignumber.js": {
|
||||
"version": "7.2.1",
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz",
|
||||
"integrity": "sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ=="
|
||||
},
|
||||
"binary-extensions": {
|
||||
"version": "1.13.1",
|
||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
|
||||
@@ -893,11 +880,6 @@
|
||||
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
|
||||
"dev": true
|
||||
},
|
||||
"buffer-writer": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz",
|
||||
"integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw=="
|
||||
},
|
||||
"buffer-xor": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz",
|
||||
@@ -2070,9 +2052,9 @@
|
||||
}
|
||||
},
|
||||
"frontblock": {
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmjs.org/frontblock/-/frontblock-0.14.0.tgz",
|
||||
"integrity": "sha512-USXiIb3T+WiS8LtiTUE+UkisFJJfMplxFmG5nQ8dCeRfknYSDQGafXPoH7mWCNkhSDoJHUMWGfVHmYH6LLRB0A==",
|
||||
"version": "0.14.2",
|
||||
"resolved": "https://registry.npmjs.org/frontblock/-/frontblock-0.14.2.tgz",
|
||||
"integrity": "sha512-M4/Kadf1i/g4pkSrkITtPdrwP4/SCQL/qA+22n41F+c/oxQVsEIpdTZQXK9iLlhMzx6ijIxokGoYh6uPY9yrlw==",
|
||||
"requires": {
|
||||
"@angular/common": "^8.2.1",
|
||||
"@angular/core": "^8.2.1",
|
||||
@@ -2080,52 +2062,21 @@
|
||||
"@angular/platform-browser": "^8.2.1",
|
||||
"@angular/router": "^8.2.1",
|
||||
"@clr/angular": "^2.1.1",
|
||||
"@types/knex": "^0.16.1",
|
||||
"@types/node": "^11.13.10",
|
||||
"frontblock-generic": "^0.26.1",
|
||||
"frontblock-generic": "^0.32.3",
|
||||
"fs": "0.0.1-security",
|
||||
"knex": "^0.19.2",
|
||||
"log4js": "^4.3.1",
|
||||
"mysql": "^2.17.1",
|
||||
"node-fetch": "^2.5.0",
|
||||
"path": "^0.12.7",
|
||||
"pg": "^7.12.1",
|
||||
"pg-query-stream": "^2.0.0",
|
||||
"rxjs": "^6.5.2",
|
||||
"rxjs-compat": "^6.5.2",
|
||||
"sqlite3": "^4.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"frontblock-generic": {
|
||||
"version": "0.26.1",
|
||||
"resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.26.1.tgz",
|
||||
"integrity": "sha512-o7TSiTUg/VJbL+btzWN+FWtg+t/97hhNwbtcJwW+QVNRpD9oLSP1jQyC7YPMVi4SVGRP8tq/PYlQRQHlhGUG+A==",
|
||||
"requires": {
|
||||
"@types/lowdb": "^1.0.9",
|
||||
"@types/node": "^12.7.1",
|
||||
"bsock": "^0.1.9",
|
||||
"fs": "0.0.1-security",
|
||||
"http": "0.0.0",
|
||||
"key-file-storage": "^2.2.4",
|
||||
"log4js": "^4.2.0",
|
||||
"lowdb": "^1.0.0",
|
||||
"minimist": "^1.2.0",
|
||||
"path": "^0.12.7",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "12.7.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.2.tgz",
|
||||
"integrity": "sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
"rxjs-compat": "^6.5.2"
|
||||
}
|
||||
},
|
||||
"frontblock-generic": {
|
||||
"version": "0.30.6",
|
||||
"resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.30.6.tgz",
|
||||
"integrity": "sha512-ecOwcLpzPuAOThKhIdbdXQm7M7HnF6dtNf1dOr7pxFfkBq5T5h/wxT2mdlC3rUd1HqdKxwrUjqG+1XqKjwVY4g==",
|
||||
"version": "0.32.3",
|
||||
"resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.32.3.tgz",
|
||||
"integrity": "sha512-VcSP3EvV8Te78XOlyEL7WywxXawHSfgIPD/7g6ivZPWDSG8JzpgX1rq9fn4jnfpS167CMyGuKoHLwAY8tWkAng==",
|
||||
"requires": {
|
||||
"@types/lowdb": "^1.0.9",
|
||||
"@types/node": "^12.7.1",
|
||||
@@ -2143,9 +2094,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": {
|
||||
"version": "12.7.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.2.tgz",
|
||||
"integrity": "sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg=="
|
||||
"version": "12.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.5.tgz",
|
||||
"integrity": "sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -3093,9 +3044,9 @@
|
||||
"integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug=="
|
||||
},
|
||||
"ignore-walk": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz",
|
||||
"integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==",
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.2.tgz",
|
||||
"integrity": "sha512-EXyErtpHbn75ZTsOADsfx6J/FPo6/5cjev46PXrcTpd8z3BoRkXgYu9/JVqrI7tusjmwCZutGeRJeU0Wo1e4Cw==",
|
||||
"requires": {
|
||||
"minimatch": "^3.0.4"
|
||||
},
|
||||
@@ -3434,9 +3385,9 @@
|
||||
}
|
||||
},
|
||||
"key-file-storage": {
|
||||
"version": "2.2.5",
|
||||
"resolved": "https://registry.npmjs.org/key-file-storage/-/key-file-storage-2.2.5.tgz",
|
||||
"integrity": "sha512-e4MNwPqkKXTJZthmUE3KwOuDDzzoXUo+m4GWjIBiI47StphAEMvm1J4lfrG0V7t0tHxf/ikE/wNThwNvvYqJww==",
|
||||
"version": "2.2.6",
|
||||
"resolved": "https://registry.npmjs.org/key-file-storage/-/key-file-storage-2.2.6.tgz",
|
||||
"integrity": "sha512-7RBAWF2Mdz/EbNF1AruxxRQ8btYLNNbOptRIkJQDFK1nGvLIk4WwUuk/F4fd5Ebms7F2fPE0qhKyLC349Os24Q==",
|
||||
"requires": {
|
||||
"@types/fs-extra": "^8.0.0",
|
||||
"@types/is-valid-path": "^0.1.0",
|
||||
@@ -3545,21 +3496,6 @@
|
||||
"flatted": "^2.0.0",
|
||||
"rfdc": "^1.1.4",
|
||||
"streamroller": "^1.0.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
|
||||
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"lowdb": {
|
||||
@@ -3762,9 +3698,9 @@
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.4.0.tgz",
|
||||
"integrity": "sha512-6PmOuSP4NnZXzs2z6rbwzLJu/c5gdzYg1mRI/WIYdx45iiX7T+a4esOzavD6V/KmBzAaopFSTZPZcUx73bqKWA==",
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.6.0.tgz",
|
||||
"integrity": "sha512-OuNZ0OHrrI+jswzmgivYBZ+fAAGHZA4293d5q0z631/I9QSw3yumKB92njxHIHiB1eAdGRsE+3CcOPkoEyV5FQ==",
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
@@ -3778,9 +3714,9 @@
|
||||
}
|
||||
},
|
||||
"minizlib": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz",
|
||||
"integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==",
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.2.tgz",
|
||||
"integrity": "sha512-hR3At21uSrsjjDTWrbu0IMLTpnkpv8IIMFDFaoz43Tmu4LkmAXfH44vNNzpTnf+OAQQCHrb91y/wc2J4x5XgSQ==",
|
||||
"requires": {
|
||||
"minipass": "^2.2.1"
|
||||
}
|
||||
@@ -3914,17 +3850,6 @@
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"mysql": {
|
||||
"version": "2.17.1",
|
||||
"resolved": "https://registry.npmjs.org/mysql/-/mysql-2.17.1.tgz",
|
||||
"integrity": "sha512-7vMqHQ673SAk5C8fOzTG2LpPcf3bNt0oL3sFpxPEEFp1mdlDcrLK0On7z8ZYKaaHrHwNcQ/MTUz7/oobZ2OyyA==",
|
||||
"requires": {
|
||||
"bignumber.js": "7.2.1",
|
||||
"readable-stream": "2.3.6",
|
||||
"safe-buffer": "5.1.2",
|
||||
"sqlstring": "2.3.1"
|
||||
}
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.14.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
|
||||
@@ -4301,11 +4226,6 @@
|
||||
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
|
||||
},
|
||||
"packet-reader": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz",
|
||||
"integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ=="
|
||||
},
|
||||
"pako": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz",
|
||||
@@ -4453,80 +4373,11 @@
|
||||
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
|
||||
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
|
||||
},
|
||||
"pg": {
|
||||
"version": "7.12.1",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-7.12.1.tgz",
|
||||
"integrity": "sha512-l1UuyfEvoswYfcUe6k+JaxiN+5vkOgYcVSbSuw3FvdLqDbaoa2RJo1zfJKfPsSYPFVERd4GHvX3s2PjG1asSDA==",
|
||||
"requires": {
|
||||
"buffer-writer": "2.0.0",
|
||||
"packet-reader": "1.0.0",
|
||||
"pg-connection-string": "0.1.3",
|
||||
"pg-pool": "^2.0.4",
|
||||
"pg-types": "^2.1.0",
|
||||
"pgpass": "1.x",
|
||||
"semver": "4.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"pg-connection-string": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-0.1.3.tgz",
|
||||
"integrity": "sha1-2hhHsglA5C7hSSvq9l1J2RskXfc="
|
||||
},
|
||||
"semver": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-4.3.2.tgz",
|
||||
"integrity": "sha1-x6BxWKgL7dBSNVt3DYLWZA+AO+c="
|
||||
}
|
||||
}
|
||||
},
|
||||
"pg-connection-string": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.0.0.tgz",
|
||||
"integrity": "sha1-Pu/lmX4G2Ugh5NUC5CtqHHP434I="
|
||||
},
|
||||
"pg-cursor": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-cursor/-/pg-cursor-2.0.0.tgz",
|
||||
"integrity": "sha512-/gYHadqLurektHk6HXiL0hSrn+RZfowkLr+ftC0lLoLBlIm8JIdk9f9g71EEjK63XxqhFqcykHuxQLFzSeyzdQ=="
|
||||
},
|
||||
"pg-int8": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
|
||||
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="
|
||||
},
|
||||
"pg-pool": {
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-2.0.7.tgz",
|
||||
"integrity": "sha512-UiJyO5B9zZpu32GSlP0tXy8J2NsJ9EFGFfz5v6PSbdz/1hBLX1rNiiy5+mAm5iJJYwfCv4A0EBcQLGWwjbpzZw=="
|
||||
},
|
||||
"pg-query-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-query-stream/-/pg-query-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-EInD7AOhnJVFIgN8BSEbKA6MKyn20dDGPsJEuhxiNaWpmveNgnmn3W1BmYm9pa6LakioR/WTi7ecWA44GBRKig==",
|
||||
"requires": {
|
||||
"pg-cursor": "2.0.0"
|
||||
}
|
||||
},
|
||||
"pg-types": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
|
||||
"integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
|
||||
"requires": {
|
||||
"pg-int8": "1.0.1",
|
||||
"postgres-array": "~2.0.0",
|
||||
"postgres-bytea": "~1.0.0",
|
||||
"postgres-date": "~1.0.4",
|
||||
"postgres-interval": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"pgpass": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.2.tgz",
|
||||
"integrity": "sha1-Knu0G2BltnkH6R2hsHwYR8h3swY=",
|
||||
"requires": {
|
||||
"split": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"pify": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
|
||||
@@ -4559,29 +4410,6 @@
|
||||
"resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
|
||||
"integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs="
|
||||
},
|
||||
"postgres-array": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
|
||||
"integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA=="
|
||||
},
|
||||
"postgres-bytea": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz",
|
||||
"integrity": "sha1-AntTPAqokOJtFy1Hz5zOzFIazTU="
|
||||
},
|
||||
"postgres-date": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.4.tgz",
|
||||
"integrity": "sha512-bESRvKVuTrjoBluEcpv2346+6kgB7UlnqWZsnbnCccTNq/pqfj1j6oBaN5+b/NrDXepYUT/HKadqv3iS9lJuVA=="
|
||||
},
|
||||
"postgres-interval": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
|
||||
"integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
|
||||
"requires": {
|
||||
"xtend": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"process": {
|
||||
"version": "0.11.10",
|
||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||
@@ -4624,9 +4452,9 @@
|
||||
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM="
|
||||
},
|
||||
"psl": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.3.0.tgz",
|
||||
"integrity": "sha512-avHdspHO+9rQTLbv1RO+MPYeP/SzsCoxofjVnHanETfQhTJrmB0HlDoW+EiN/R+C0BZ+gERab9NY0lPN2TxNag=="
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz",
|
||||
"integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw=="
|
||||
},
|
||||
"public-encrypt": {
|
||||
"version": "4.0.3",
|
||||
@@ -4954,17 +4782,17 @@
|
||||
}
|
||||
},
|
||||
"rxjs": {
|
||||
"version": "6.5.2",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.2.tgz",
|
||||
"integrity": "sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg==",
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz",
|
||||
"integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
},
|
||||
"rxjs-compat": {
|
||||
"version": "6.5.2",
|
||||
"resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.5.2.tgz",
|
||||
"integrity": "sha512-TRMkTp4FgSxE2HtGvxmgRukh3JqdFM7ejAj1Ti/VdodbPGfWvZR5+KdLKRV9jVDFyu2SknM8RD+PR54KGnoLjg=="
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.5.3.tgz",
|
||||
"integrity": "sha512-BIJX2yovz3TBpjJoAZyls2QYuU6ZiCaZ+U96SmxQpuSP/qDUfiXPKOVLbThBB2WZijNHkdTTJXKRwvv5Y48H7g=="
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
@@ -5318,14 +5146,6 @@
|
||||
"resolved": "https://registry.npmjs.org/spawn-sync/-/spawn-sync-2.0.0.tgz",
|
||||
"integrity": "sha512-AGXIhH/XZVinFewojYTsG8uapHX2e7MjtFbmibvK9qqG4qGd9b6jelU1sTkCA0RVGHvN9exJYTBVbF1Ls2f69g=="
|
||||
},
|
||||
"split": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
|
||||
"integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
|
||||
"requires": {
|
||||
"through": "2"
|
||||
}
|
||||
},
|
||||
"split-string": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
|
||||
@@ -5344,11 +5164,6 @@
|
||||
"request": "^2.87.0"
|
||||
}
|
||||
},
|
||||
"sqlstring": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
|
||||
"integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A="
|
||||
},
|
||||
"sshpk": {
|
||||
"version": "1.16.1",
|
||||
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
|
||||
@@ -5474,11 +5289,6 @@
|
||||
"jsonfile": "^4.0.0",
|
||||
"universalify": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -5589,11 +5399,6 @@
|
||||
"worker-farm": "^1.7.0"
|
||||
}
|
||||
},
|
||||
"through": {
|
||||
"version": "2.3.8",
|
||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
||||
},
|
||||
"through2": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
|
||||
@@ -6155,7 +5960,8 @@
|
||||
"xtend": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
|
||||
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
|
||||
"dev": true
|
||||
},
|
||||
"y18n": {
|
||||
"version": "4.0.0",
|
||||
|
||||
+5
-5
@@ -9,8 +9,8 @@
|
||||
"build-backend": "tsc; npm run webpack",
|
||||
"build-frontend": "npm run build-dashboard; cp ./dist/FrontblockLib.js ./dist/static",
|
||||
"build-dashboard": "git submodule init && git submodule update --merge; cd src/frontend; npm i && npm run build; mkdir ../../dist/static; cp -r dist/* ../../dist/static",
|
||||
"clean": "rm -rf lib static plugins conf dist widget .rpt2_cache *.js *.ts src/frontend/dist",
|
||||
"update-frontblock": "rm -rf node_modules/frontblock*; npm install",
|
||||
"clean": "rm -rf lib static plugins conf dist widget .rpt2_cache *.js *.ts src/frontend/dist data",
|
||||
"update-frontblock": " npm install frontblock-generic@latest frontblock@latest",
|
||||
"webpack": "webpack --config src/backend/webpack.prod.js --progress --colors"
|
||||
},
|
||||
"repository": {
|
||||
@@ -25,13 +25,13 @@
|
||||
"child-process-promise": "^2.2.1",
|
||||
"debug": "^4.1.1",
|
||||
"express": "^4.16.4",
|
||||
"frontblock": "^0.14.0",
|
||||
"frontblock-generic": "^0.30.6",
|
||||
"frontblock": "^0.14.2",
|
||||
"frontblock-generic": "^0.32.3",
|
||||
"git-cherrypicker": "0.0.3",
|
||||
"git-describe": "^4.0.4",
|
||||
"http": "0.0.0",
|
||||
"knex": "^0.19.2",
|
||||
"log4js": "^4.4.0",
|
||||
"log4js": "^4.5.1",
|
||||
"lowdb": "^1.0.0",
|
||||
"node-fetch": "^2.6.0",
|
||||
"path": "^0.12.7",
|
||||
|
||||
+7
-19
@@ -1,26 +1,16 @@
|
||||
'use strict'
|
||||
|
||||
import * as Logger from 'log4js'
|
||||
import * as Knex from 'knex'
|
||||
import * as Path from 'path'
|
||||
import { FrontblockApiClient, FrontblockApiConf } from 'frontblock';
|
||||
import { getLogger } from 'frontblock-generic/Types';
|
||||
import { AdminBase } from 'frontblock-generic/Admin';
|
||||
import { FrontblockApi } from 'frontblock-generic/Api';
|
||||
import { IFrontblockApiClient } from 'frontblock-generic/Api';
|
||||
import { Plugin } from 'frontblock-generic/Plugin';
|
||||
import { socketioRPC } from 'frontblock-generic/RPC';
|
||||
import { GitUpdater, RepoFolderStatus } from './GitUpdater';
|
||||
|
||||
Logger.configure({
|
||||
appenders:
|
||||
{
|
||||
"admin": { type: 'stdout' },
|
||||
//app: { type: 'file', filename: 'application.log' }
|
||||
},
|
||||
categories:
|
||||
{
|
||||
default: { appenders: [ 'admin' ], level: 'debug' }
|
||||
}
|
||||
})
|
||||
const logger = Logger.getLogger("admin")
|
||||
const logger:Logger.Logger = getLogger("admin", 'debug')
|
||||
|
||||
|
||||
export type AdminConf = { httpPort: number}
|
||||
@@ -31,6 +21,7 @@ export class FrontblockAdmin extends AdminBase<AdminConf>{
|
||||
|
||||
constructor(runningPlugins: Plugin[] = []){
|
||||
super(runningPlugins)
|
||||
this.initialize().then(() => this.makeKnex(this.getConfigKey('dbConf'))).then(() => logger.debug("Admin initialization finished"))
|
||||
}
|
||||
|
||||
getDefaultConfig(): { apiConf: FrontblockApiConf; } & AdminConf & { dbConf:Knex.Config; } {
|
||||
@@ -45,19 +36,16 @@ export class FrontblockAdmin extends AdminBase<AdminConf>{
|
||||
dbConf: {
|
||||
client: 'sqlite3',
|
||||
connection: {
|
||||
filename: "./data/ApiClient.sqlite"
|
||||
filename: Path.join(__dirname, "data/Admin.sqlite")
|
||||
},
|
||||
useNullAsDefault: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected makeApiClient(conf: FrontblockApiConf): FrontblockApi {
|
||||
// @ts-ignore
|
||||
protected makeApiClient(conf: FrontblockApiConf): IFrontblockApiClient {
|
||||
if(this.apiClient) this.apiClient.disconnect()
|
||||
this.apiClient = new FrontblockApiClient(conf)
|
||||
|
||||
// @ts-ignore
|
||||
this.apiClient.connect()
|
||||
return this.apiClient
|
||||
}
|
||||
|
||||
@@ -1,20 +1,8 @@
|
||||
import * as Logger from 'log4js'
|
||||
import { Plugin } from "frontblock-generic/Plugin"
|
||||
|
||||
import { getLogger } from "frontblock-generic/Types"
|
||||
var exec = require('child-process-promise').exec;
|
||||
|
||||
Logger.configure({
|
||||
appenders:
|
||||
{
|
||||
"installer": { type: 'stdout' },
|
||||
//app: { type: 'file', filename: 'application.log' }
|
||||
},
|
||||
categories:
|
||||
{
|
||||
default: { appenders: [ 'installer' ], level: 'debug' }
|
||||
}
|
||||
})
|
||||
const logger = Logger.getLogger("installer")
|
||||
const logger = getLogger("installer", 'info')
|
||||
|
||||
export type NPMPkgName = string
|
||||
export type NPMVersion = string
|
||||
@@ -25,11 +13,10 @@ export const installAdmin = (plugins: Plugin[] = []) => {
|
||||
const deps = npmPkgs.map(tuple => tuple.join('@') ).join(" ")
|
||||
logger.info("Installing plaform dependencies: "+deps)
|
||||
|
||||
exec("npm i --prefix ./plugins " + deps).then(process => {
|
||||
|
||||
exec("npm i " + deps).then(async process => {
|
||||
logger.debug(process.stdout)
|
||||
const Admin = require("./Admin").FrontblockAdmin
|
||||
new Admin(plugins)
|
||||
const fbAdmin = new Admin(plugins)
|
||||
})
|
||||
|
||||
}
|
||||
@@ -5,9 +5,13 @@ module.exports = [{
|
||||
target: "web",
|
||||
|
||||
entry: path.resolve(__dirname, '../../lib/FrontblockLib.js'),
|
||||
externals: ['log4js'],
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../../dist'),
|
||||
filename: 'FrontblockLib.js',
|
||||
},
|
||||
optimization: {
|
||||
minimize: false, // <---- disables uglify.
|
||||
}
|
||||
},{
|
||||
mode: 'production',
|
||||
@@ -19,7 +23,6 @@ module.exports = [{
|
||||
__dirname: false,
|
||||
Buffer: true,
|
||||
},
|
||||
|
||||
|
||||
resolve: {
|
||||
// Add `.ts` and `.tsx` as a resolvable extension.
|
||||
@@ -32,9 +35,7 @@ module.exports = [{
|
||||
]
|
||||
},
|
||||
|
||||
externals:{
|
||||
knex: "../plugins/node_modules/knex"
|
||||
},
|
||||
externals: ['knex'],
|
||||
optimization: {
|
||||
minimize: false
|
||||
},
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: restore cache
|
||||
image: drillster/drone-volume-cache
|
||||
settings:
|
||||
restore: true
|
||||
mount:
|
||||
- ./node_modules
|
||||
volumes:
|
||||
- name: cache
|
||||
path: /cache
|
||||
|
||||
- name: npm install
|
||||
image: node:12
|
||||
commands:
|
||||
- npm install
|
||||
|
||||
- name: npm run build
|
||||
image: node:12
|
||||
commands:
|
||||
- npm run build
|
||||
|
||||
- name: rebuild cache
|
||||
image: drillster/drone-volume-cache
|
||||
settings:
|
||||
rebuild: true
|
||||
mount:
|
||||
- ./node_modules
|
||||
volumes:
|
||||
- name: cache
|
||||
path: /cache
|
||||
|
||||
- name: npm publish
|
||||
image: plugins/npm
|
||||
settings:
|
||||
username: frontblock
|
||||
password:
|
||||
from_secret: npm_password
|
||||
email: frontblock.me@gmail.com
|
||||
event:
|
||||
- tag
|
||||
|
||||
- name: deploy plugin
|
||||
image: node:12
|
||||
commands:
|
||||
- git config --global user.email "${DRONE_COMMIT_AUTHOR_EMAIL}"
|
||||
- git config --global user.name "${DRONE_COMMIT_AUTHOR}"
|
||||
- git clone https://gitea.frontblock.me/fb-dist/${DRONE_REPO_NAME}.git
|
||||
- cp -r ./dist/* ./${DRONE_REPO_NAME}
|
||||
- cd ./${DRONE_REPO_NAME}
|
||||
- git add -A
|
||||
- git commit --allow-empty -m "drone tagged as version ${DRONE_TAG}"
|
||||
- git tag ${DRONE_TAG}
|
||||
- git push https://$GIT_USER:$GIT_PASSWORD@gitea.frontblock.me/fb-dist/${DRONE_REPO_NAME}.git master ${DRONE_TAG}
|
||||
environment:
|
||||
GIT_USER:
|
||||
from_secret: git_user
|
||||
GIT_PASSWORD:
|
||||
from_secret: git_password
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
|
||||
volumes:
|
||||
- name: cache
|
||||
host:
|
||||
path: /tmp
|
||||
@@ -1,10 +0,0 @@
|
||||
dist
|
||||
.rpt2_cache
|
||||
node_modules
|
||||
lib
|
||||
|
||||
*.d.ts
|
||||
*.js
|
||||
*.ts
|
||||
|
||||
!src/**/*
|
||||
@@ -1,2 +0,0 @@
|
||||
**/*
|
||||
!FrontblockApiClient.*
|
||||
+3
-6
@@ -1,16 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FrontblockApiConf } from '../backend/FrontblockApiClient';
|
||||
import { isDevMode } from '@angular/core';
|
||||
|
||||
declare const fb
|
||||
|
||||
@Component({
|
||||
selector: 'settings',
|
||||
selector: '[apiclientconfig]',
|
||||
template: `
|
||||
<div class="clr-row">
|
||||
<div class="card clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-auto clr-col-xl-auto">
|
||||
<div class="card-header">
|
||||
Settings
|
||||
Frontblock API Client
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-text">
|
||||
@@ -61,15 +60,13 @@ declare const fb
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<knex-config fbPlugin="ApiClient"></knex-config>
|
||||
`
|
||||
})
|
||||
export class ApiclientFormComponent implements OnInit {
|
||||
testnet: boolean = true
|
||||
saving: boolean = false
|
||||
advanced: boolean = false
|
||||
data: FrontblockApiConf = {
|
||||
data: any = {
|
||||
apiHost: "api.testnet.frontblock.me",
|
||||
apiPort: 10001,
|
||||
tls: false,
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"apiConf": {
|
||||
"apiHost": "api.testnet.frontblock.me",
|
||||
"apiKey": "",
|
||||
"apiPort": 10001,
|
||||
"tls": false
|
||||
},
|
||||
"dbConf": {
|
||||
"type": "sqlite",
|
||||
"database": "./data/ApiClient.sqlite",
|
||||
"synchronize": true,
|
||||
"entities": [
|
||||
null,
|
||||
null
|
||||
]
|
||||
}
|
||||
}
|
||||
+20
-16
@@ -6,47 +6,51 @@ import { ApiclientFormComponent } from './apiclient-settings-form.component';
|
||||
import { ApiclientConsumptionComponent } from './apiclient-consumptions.component';
|
||||
import { ApiclientSubscriptionComponent } from './apiclient-subscriptions.component';
|
||||
|
||||
import { FrontendPlugin, SidebarEntries } from 'frontblock-generic/Plugin';
|
||||
import { ClarityModule } from '@clr/angular';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
// @ts-ignore
|
||||
import { KnexConfigModule } from "../../../knex-config/knex-config.module";
|
||||
|
||||
import {FrontendPlugin, SidebarEntries, SidebarEntry} from 'frontblock-generic/Plugin'
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
FormsModule,
|
||||
ClarityModule,
|
||||
KnexConfigModule,
|
||||
|
||||
CommonModule,
|
||||
RouterModule.forChild([
|
||||
{path: "settings", component: ApiclientFormComponent},
|
||||
{path: "subscriptions", component: ApiclientSubscriptionComponent},
|
||||
{path: "consumers", component: ApiclientConsumptionComponent},
|
||||
]),
|
||||
],
|
||||
exports: [RouterModule],
|
||||
exports: [RouterModule, ApiclientFormComponent],
|
||||
declarations: [
|
||||
ApiclientFormComponent,
|
||||
ApiclientConsumptionComponent,
|
||||
ApiclientSubscriptionComponent
|
||||
ApiclientSubscriptionComponent,
|
||||
ApiclientFormComponent,
|
||||
|
||||
],
|
||||
entryComponents: [
|
||||
ApiclientFormComponent,
|
||||
|
||||
]
|
||||
})
|
||||
export class PluginModule implements FrontendPlugin{
|
||||
getSidebarEntry(): SidebarEntries {
|
||||
export class ApiclientModule implements FrontendPlugin{
|
||||
getSidebarEntry(): SidebarEntry | SidebarEntries {
|
||||
return {
|
||||
icon: "terminal",
|
||||
parentRoute: "apiclient",
|
||||
text: "Api client",
|
||||
links: [{
|
||||
route: "settings",
|
||||
text: "Settings"
|
||||
},{
|
||||
route: "consumers",
|
||||
route: "apiclient/consumers",
|
||||
text: "Consumers"
|
||||
},{
|
||||
route: "subscriptions",
|
||||
route: "apiclient/subscriptions",
|
||||
text: "Subscriptions"
|
||||
},]
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
getSettingsComponentClassName(): any{
|
||||
return ApiclientFormComponent
|
||||
}
|
||||
}
|
||||
-4652
File diff suppressed because it is too large
Load Diff
@@ -1,45 +0,0 @@
|
||||
{
|
||||
"name": "frontblock",
|
||||
"version": "0.14.0",
|
||||
"description": "frontblock shop-side library ",
|
||||
"main": "FrontblockApiClient.js",
|
||||
"scripts": {
|
||||
"tsc": "tsc",
|
||||
"build-backend": "webpack --config src/backend/webpack.prod.js --progress --colors",
|
||||
"build-frontend": "webpack --config src/frontend/webpack.prod.js --progress --colors",
|
||||
"build": "npm run clean; npm run tsc; npm run build-backend; npm run build-frontend",
|
||||
"clean": "rm -rf *.js *.ts backend frontend .rpt2_cache dist lib",
|
||||
"update-frontblock": "rm -rf node_modules/frontblock*; npm install"
|
||||
},
|
||||
"keywords": [
|
||||
"api",
|
||||
"client",
|
||||
"frontblock"
|
||||
],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@angular/common": "^8.2.1",
|
||||
"@angular/core": "^8.2.1",
|
||||
"@angular/forms": "^8.2.1",
|
||||
"@angular/platform-browser": "^8.2.1",
|
||||
"@angular/router": "^8.2.1",
|
||||
"@clr/angular": "^2.1.1",
|
||||
"@types/node": "^11.13.10",
|
||||
"frontblock-generic": "^0.28.4",
|
||||
"fs": "0.0.1-security",
|
||||
"knex": "^0.19.2",
|
||||
"log4js": "^4.3.1",
|
||||
"node-fetch": "^2.5.0",
|
||||
"path": "^0.12.7",
|
||||
"rxjs": "^6.5.2",
|
||||
"rxjs-compat": "^6.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ts-loader": "^6.0.4",
|
||||
"typescript": "^3.4.5",
|
||||
"webpack": "^4.39.1",
|
||||
"webpack-cli": "^3.3.6",
|
||||
"webpack-node-externals": "^1.7.2"
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
import { Coin, AccountMap, TransactionMap, SubscriptionResponse, ErrorResponse, SuccessResponse, parseResponse, parseSubResponse } from "frontblock-generic/Types";
|
||||
import { FrontblockApi as FrontblockApi } from "frontblock-generic/Api";
|
||||
import * as Logger from 'log4js'
|
||||
|
||||
Logger.configure({
|
||||
appenders: {
|
||||
"frontblock-api-client": { type: 'stdout' },
|
||||
//app: { type: 'file', filename: 'application.log' }
|
||||
},
|
||||
categories: {
|
||||
default: { appenders: ['frontblock-api-client'], level: 'debug' }
|
||||
}
|
||||
})
|
||||
const logger = Logger.getLogger("frontblock-api-client")
|
||||
const bsock = require('bsock')
|
||||
|
||||
export type FrontblockApiConf = {
|
||||
apiHost: string
|
||||
apiPort: number
|
||||
tls?: boolean
|
||||
apiKey?: string
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Frontblock api connection lib
|
||||
*/
|
||||
export class FrontblockApiClient implements FrontblockApi {
|
||||
protected started: boolean = false
|
||||
protected apikey: string = ""
|
||||
protected socket
|
||||
|
||||
constructor(private conf: FrontblockApiConf){
|
||||
|
||||
}
|
||||
|
||||
async consume<C extends Coin>(apikey: string, uid: string, callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse> {
|
||||
const r = await this.socket.call("consume", apikey, uid)
|
||||
const res = parseSubResponse(r)
|
||||
if (res instanceof SubscriptionResponse) {
|
||||
this.socket.hook(res.uid, (tx) => {
|
||||
const deserialized = <TransactionMap[C]>JSON.parse(tx)
|
||||
callback(deserialized)
|
||||
})
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
async quit(apikey: string, consumerUid: string): Promise<ErrorResponse | SuccessResponse> {
|
||||
|
||||
const r = await this.socket.call("quit", apikey, consumerUid)
|
||||
const res = parseResponse(r)
|
||||
return res
|
||||
}
|
||||
|
||||
async subscribe<C extends Coin>(apikey: string, coin: C, account: AccountMap[C]): Promise<SubscriptionResponse | ErrorResponse> {
|
||||
const r = await this.socket.call("subscribe", apikey, coin, account)
|
||||
const res = parseSubResponse(r)
|
||||
return res
|
||||
}
|
||||
|
||||
async subsume<C extends Coin>(apikey: string, coin: C, account: AccountMap[C], callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse> {
|
||||
const r = await this.socket.call("subsume", apikey, coin, account)
|
||||
const res = parseSubResponse(r)
|
||||
if (res instanceof SubscriptionResponse) {
|
||||
this.socket.hook(res.uid, (tx) => {
|
||||
const deserialized = <TransactionMap[C]>JSON.parse(tx)
|
||||
callback(deserialized)
|
||||
})
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
async unsubscribe(apikey: string, uid: string): Promise<ErrorResponse | SuccessResponse> {
|
||||
const r = await this.socket.call('unsubscribe', apikey, uid)
|
||||
const res = parseResponse(r)
|
||||
if (res instanceof SuccessResponse)
|
||||
this.socket.unhook(uid)
|
||||
return res
|
||||
}
|
||||
|
||||
async getPluginList(): Promise<string[]> {
|
||||
return await this.socket.call('getPluginList')
|
||||
}
|
||||
|
||||
|
||||
connect(): void {
|
||||
if (this.started) {
|
||||
logger.warn("FrontblockApiClient has already been started. Ignoring")
|
||||
return
|
||||
}
|
||||
logger.info("Starting apiClient with ", this.conf)
|
||||
this.socket = bsock.connect(this.conf.apiPort, this.conf.apiHost, this.conf.tls != null ? this.conf.tls : false)
|
||||
this.started = true
|
||||
}
|
||||
|
||||
disconnect(): void {
|
||||
if (!this.started) {
|
||||
logger.warn("FrontblockApiClient has not been started. Ignoring")
|
||||
return
|
||||
}
|
||||
this.socket.close()
|
||||
}
|
||||
}
|
||||
@@ -1,201 +0,0 @@
|
||||
import { FrontblockApiClient, FrontblockApiConf } from "./FrontblockApiClient";
|
||||
import { socketioRPC } from "frontblock-generic/RPC"
|
||||
import { DatabasePlugin, TableDefiniton } from "frontblock-generic/DatabasePlugin"
|
||||
|
||||
import { Coin, AccountMap, TransactionMap, SubscriptionResponse } from "frontblock-generic/Types";
|
||||
import * as knex from 'knex';
|
||||
import * as Logger from 'log4js'
|
||||
Logger.configure({
|
||||
appenders: {
|
||||
"frontblock-api-client": { type: 'stdout' },
|
||||
//app: { type: 'file', filename: 'application.log' }
|
||||
},
|
||||
categories: {
|
||||
default: { appenders: [ 'frontblock-api-client' ], level: 'debug' }
|
||||
}
|
||||
})
|
||||
const logger = Logger.getLogger("frontblock-api-client")
|
||||
|
||||
/**
|
||||
* Frontblock admin Plugin for FrontblockApiClient
|
||||
*/
|
||||
|
||||
type ApiClientPluginConf = {
|
||||
apiConf: FrontblockApiConf,
|
||||
}
|
||||
|
||||
export default class FrontblockApiClientPlugin extends DatabasePlugin<ApiClientPluginConf>{
|
||||
|
||||
private apiClient : FrontblockApiClient
|
||||
constructor(){
|
||||
super("ApiClient")
|
||||
}
|
||||
|
||||
getDefaultConfig(): ApiClientPluginConf & { dbConf: knex.Config; } {
|
||||
return {
|
||||
apiConf: {
|
||||
apiHost: "api.testnet.frontblock.me",
|
||||
apiKey: "",
|
||||
apiPort: 10001,
|
||||
tls: false
|
||||
},
|
||||
dbConf: {
|
||||
client: 'sqlite3',
|
||||
connection: {
|
||||
filename: "./data/ApiClient.sqlite"
|
||||
},
|
||||
useNullAsDefault: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getConsumers(): Promise<SubscriptionResponse[]> {
|
||||
const records = await this.knex.select('*').from('consumers')
|
||||
return records.map(r => JSON.parse(r.JSON))
|
||||
}
|
||||
|
||||
async getSubscriptions(): Promise<SubscriptionResponse[]> {
|
||||
const records = await this.knex.select('*').from('subscriptions')
|
||||
return records.map(r => JSON.parse(r.JSON))
|
||||
}
|
||||
|
||||
exportExtraRPCs(): socketioRPC[] {
|
||||
const quit = async(uid:string) => {return await this.quit(this.getConfigKey('apiConf').apiKey, uid) }
|
||||
return [
|
||||
{
|
||||
name: "subscribe",
|
||||
func: async <C extends Coin>(coin: C, account: AccountMap[C]) => { return await this.subscribe(this.getConfigKey('apiConf').apiKey, coin, account)},
|
||||
type: 'call',
|
||||
visibility: 'private'
|
||||
},{
|
||||
name: "subsume",
|
||||
func: async <C extends Coin>(coin: C, account: AccountMap[C], callback: (tx: TransactionMap[C]) => void) => { return await this.subsume(this.getConfigKey('apiConf').apiKey, coin, account, callback)},
|
||||
type: 'hook',
|
||||
unhook: quit,
|
||||
visibility: 'private'
|
||||
},{
|
||||
name: 'unsubscribe',
|
||||
func: async(uid:string) => { return await this.unsubscribe(this.getConfigKey('apiConf').apiKey, uid) },
|
||||
type: 'call',
|
||||
visibility: 'private'
|
||||
},{
|
||||
name: 'consume',
|
||||
func: async<C extends Coin>(uid: string, callback: (tx: TransactionMap[C]) => void) => {return await this.consume(this.getConfigKey('apiConf').apiKey, uid, callback)},
|
||||
type: 'hook',
|
||||
unhook: quit,
|
||||
visibility: 'private'
|
||||
},{
|
||||
name: 'quit',
|
||||
func: quit,
|
||||
type: 'call',
|
||||
visibility: 'private'
|
||||
},{
|
||||
name: "getSubscriptions",
|
||||
func: async() => { return await this.getSubscriptions() },
|
||||
type: "call",
|
||||
visibility: "private"
|
||||
},{
|
||||
name: "getConsumers",
|
||||
func: async() => { return await this.getConsumers() },
|
||||
type: "call",
|
||||
visibility: "private"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
private subscribe:FrontblockApiClient['subscribe'] = async (apiKey, coin, account) => {
|
||||
const res = await this.apiClient.subscribe(apiKey, coin, account)
|
||||
if(res instanceof SubscriptionResponse){
|
||||
await this.knex('subscriptions').insert([{uuid: res.uid, JSON: JSON.stringify(res)}])
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
private consume:FrontblockApiClient['consume'] = async (apikey, uuid, callback) => {
|
||||
const res = await this.apiClient.consume(apikey, uuid, callback)
|
||||
if(res instanceof SubscriptionResponse){
|
||||
await this.knex('consumers').insert([{uuid: res.uid, JSON: JSON.stringify(res)}])
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
private unsubscribe:FrontblockApiClient['unsubscribe'] = async (apikey, uuid) => {
|
||||
const res = await this.apiClient.unsubscribe(apikey, uuid)
|
||||
await this.knex('subscriptions')
|
||||
.where('uuid', uuid)
|
||||
.del()
|
||||
return res
|
||||
}
|
||||
|
||||
private quit:FrontblockApiClient['quit'] = async (apikey, uuid) => {
|
||||
const res = await this.apiClient.quit(apikey, uuid)
|
||||
await this.knex('consumers')
|
||||
.where('uuid', uuid)
|
||||
.del()
|
||||
return res
|
||||
}
|
||||
|
||||
private subsume:FrontblockApiClient['subsume'] = async (apikey, coin, account, callback) => {
|
||||
const res = await this.apiClient.subsume(apikey, coin, account, callback)
|
||||
if(res instanceof SubscriptionResponse){
|
||||
await Promise.all([
|
||||
this.knex('consumers')
|
||||
.insert([{uuid: res.uid, JSON: JSON.stringify(res)}]),
|
||||
|
||||
this.knex('subscriptions')
|
||||
.insert([{uuid: res.uid, JSON: JSON.stringify(new SubscriptionResponse(res.message))}])
|
||||
])
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
private makeApiClient(conf: FrontblockApiConf):FrontblockApiClient{
|
||||
if(this.apiClient)
|
||||
this.apiClient.disconnect()
|
||||
this.apiClient = new FrontblockApiClient(conf)
|
||||
this.apiClient.connect()
|
||||
return this.apiClient
|
||||
}
|
||||
|
||||
setConfig(conf:ApiClientPluginConf & { dbConf: knex.Config }):ApiClientPluginConf & { dbConf: knex.Config }{
|
||||
const currConf = this.getConfig()
|
||||
if(JSON.stringify(currConf.apiConf) !== JSON.stringify(conf.apiConf)){
|
||||
this.makeApiClient(conf.apiConf)
|
||||
}
|
||||
return super.setConfig(conf)
|
||||
}
|
||||
|
||||
setConfigKey(key:keyof ApiClientPluginConf, value: any):ApiClientPluginConf & { dbConf: knex.Config; }{
|
||||
if(key === 'apiConf'){
|
||||
this.makeApiClient(value)
|
||||
}
|
||||
return super.setConfigKey(key, value)
|
||||
}
|
||||
|
||||
|
||||
async start(): Promise<void> {
|
||||
this.makeApiClient(this.getConfig().apiConf)
|
||||
super.start()
|
||||
}
|
||||
|
||||
stop(): void {
|
||||
this.apiClient.disconnect()
|
||||
super.stop()
|
||||
}
|
||||
|
||||
protected getTableDefinitions(): TableDefiniton[] {
|
||||
return [{
|
||||
name: 'subscriptions',
|
||||
tableBuilder: function (table) {
|
||||
table.string('uuid').primary();
|
||||
table.string('JSON');
|
||||
}
|
||||
},{
|
||||
name: 'consumers',
|
||||
tableBuilder: function (table) {
|
||||
table.string('uuid').primary();
|
||||
table.string('JSON');
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
const nodeExternals = require('webpack-node-externals');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
var webpack = require('webpack');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
target: "node",
|
||||
entry: path.resolve(__dirname, 'Plugin.ts'),
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../../dist'),
|
||||
filename: 'Plugin.js',
|
||||
libraryTarget: 'commonjs',
|
||||
},
|
||||
resolve: {
|
||||
// Add `.ts` and `.tsx` as a resolvable extension.
|
||||
|
||||
extensions: [".ts", ".tsx", ".js"]
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{ test: /\.ts?$/, loader: "ts-loader" }
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
minimize: false
|
||||
},
|
||||
node: {
|
||||
global: true,
|
||||
process: true,
|
||||
__filename: false,
|
||||
__dirname: false,
|
||||
Buffer: true,
|
||||
},
|
||||
externals:{
|
||||
knex: "../node_modules/knex"
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
const path = require('path');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
target: "web",
|
||||
entry: path.resolve(__dirname, 'module.ts'),
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../../dist'),
|
||||
filename: 'FrontendPlugin.js',
|
||||
libraryTarget: 'commonjs',
|
||||
},
|
||||
resolve: {
|
||||
// Add `.ts` and `.tsx` as a resolvable extension.
|
||||
extensions: [".ts", ".tsx", ".js"]
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{ test: /\.ts?$/, loader: "ts-loader" }
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
exclude: [
|
||||
/\.\/(.*)\/.ts/,
|
||||
/\.\/(.*).ts/,
|
||||
],
|
||||
}),
|
||||
],
|
||||
},
|
||||
externals: {
|
||||
'@angular/core': '@angular/core',
|
||||
'@angular/common': '@angular/common',
|
||||
'@angular/router': '@angular/router',
|
||||
'@angular/animations': '@angular/animations',
|
||||
'@angular/forms': '@angular/forms',
|
||||
'@clr/angular': '@clr/angular',
|
||||
'../../../knex-config/knex-config.module': 'knexconfig'
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["src/frontend"],
|
||||
"exclude": [
|
||||
"src/backend"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"sourceMap": true
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"alwaysStrict": false,
|
||||
"noImplicitAny": false,
|
||||
"target": "ES2015",
|
||||
"module": "commonjs",
|
||||
"declaration": true,
|
||||
"strict": true,
|
||||
"outDir": ".",
|
||||
"experimentalDecorators": true,
|
||||
"strictPropertyInitialization": false,
|
||||
"importHelpers": true,
|
||||
"strictNullChecks": false,
|
||||
},
|
||||
"include": ["src/backend"],
|
||||
"exclude": []
|
||||
}
|
||||
@@ -2,13 +2,21 @@ import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { HomeComponent } from './home/home.component';
|
||||
import { ErrorDisplayComponent } from './error-display/error-display.component';
|
||||
import { SettingsComponent } from './settings/settings.component';
|
||||
|
||||
const routes: Routes = [{
|
||||
path: "pluginmanager",
|
||||
loadChildren: () => import('./pluginmanager/module').then(mod => mod.PluginModule)
|
||||
loadChildren: () => import('./pluginmanager/module').then(mod => mod.PluginmanagerModule)
|
||||
},{
|
||||
path: "settings",
|
||||
component: SettingsComponent
|
||||
},{
|
||||
path: "home",
|
||||
component: HomeComponent
|
||||
},{
|
||||
path: "",
|
||||
component: HomeComponent
|
||||
pathMatch: "full",
|
||||
redirectTo: "home",
|
||||
},{
|
||||
path: "**",
|
||||
component: ErrorDisplayComponent
|
||||
|
||||
@@ -20,13 +20,16 @@ export class AppComponent implements AfterContentInit {
|
||||
}
|
||||
|
||||
ngAfterContentInit(){
|
||||
const _this = this;
|
||||
(function awaitSidebar(){
|
||||
if(_this.sidebar != null){
|
||||
_this.sidebarService.setSidebar(_this.sidebar)
|
||||
let awaitSidebar: { (): void; (...args: any[]): void; }
|
||||
(awaitSidebar = () => {
|
||||
if(this.sidebar != null){
|
||||
this.sidebarService.setSidebar(this.sidebar)
|
||||
return
|
||||
}
|
||||
setTimeout(awaitSidebar,25)
|
||||
})()
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,11 @@ import { HomeComponent } from './home/home.component';
|
||||
import { ErrorDisplayComponent } from './error-display/error-display.component';
|
||||
import { HeaderBarComponent } from './header-bar/header-bar.component';
|
||||
import { SubnavComponent } from './subnav/subnav.component';
|
||||
import { KnexConfigComponent } from './knex-config/knex-config.component';
|
||||
import { ApiclientFormComponent } from './apiclient/apiclient-settings-form.component';
|
||||
import { SettingsComponent } from './settings/settings.component';
|
||||
import { ApiclientModule } from './apiclient/module';
|
||||
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
export function createCompiler(fn: CompilerFactory): Compiler {
|
||||
return fn.createCompiler();
|
||||
@@ -34,6 +37,8 @@ const declarations = [
|
||||
HeaderBarComponent,
|
||||
ErrorDisplayComponent,
|
||||
SubnavComponent,
|
||||
KnexConfigComponent,
|
||||
SettingsComponent
|
||||
]
|
||||
|
||||
@NgModule({
|
||||
@@ -44,6 +49,7 @@ const declarations = [
|
||||
BrowserAnimationsModule,
|
||||
ClarityModule,
|
||||
AppRoutingModule,
|
||||
ApiclientModule
|
||||
],
|
||||
entryComponents: [],
|
||||
providers: [
|
||||
|
||||
@@ -22,7 +22,6 @@ import * as btcHdkey from "btc-hdkey"
|
||||
import * as bitcoinjslib from "bitcoinjs-lib"
|
||||
import * as fetch from "node-fetch"
|
||||
import * as coinselect from "coinselect/accumulative"
|
||||
import * as KnexModule from '../knex-config/knex-config.module'
|
||||
|
||||
SystemJS.set('@clr/angular', SystemJS.newModule(clarityModule));
|
||||
SystemJS.set('@angular/router', SystemJS.newModule(angularRouter));
|
||||
@@ -40,7 +39,6 @@ SystemJS.set('btc-hdkey', SystemJS.newModule(btcHdkey))
|
||||
SystemJS.set('bitcoinjs-lib', SystemJS.newModule(bitcoinjslib))
|
||||
SystemJS.set('node-fetch', SystemJS.newModule(fetch))
|
||||
SystemJS.set('coinselect/accumulative', SystemJS.newModule(coinselect))
|
||||
SystemJS.set('knexconfig', SystemJS.newModule(KnexModule))
|
||||
|
||||
SystemJS.config({ meta: { '*': { authorization: true } } });
|
||||
/** --------- */
|
||||
@@ -53,7 +51,7 @@ import { environment } from "../../environments/environment"
|
||||
|
||||
const fb = environment.production ? window["fb"] : {
|
||||
Admin: {
|
||||
getLoadedPluginNames: () => ["ApiClient", "Wallet"]
|
||||
getLoadedPluginNames: () => []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +98,15 @@ export class DynamicLoaderComponent implements AfterViewInit {
|
||||
}
|
||||
|
||||
const plugin:FrontendPlugin = new module['PluginModule']()
|
||||
this.injectPlugin(plugin)
|
||||
this.compileModule(plugin)
|
||||
}
|
||||
|
||||
compileModule(module:any){
|
||||
|
||||
}
|
||||
|
||||
injectPlugin(plugin:FrontendPlugin):void{
|
||||
const entry: SidebarEntries | SidebarEntry = plugin.getSidebarEntry()
|
||||
const rc = this.router.config
|
||||
|
||||
|
||||
@@ -9,4 +9,9 @@
|
||||
<span class="nav-text">ALPHA {{devmode}}</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<a [routerLink]="'settings'" class="nav-link nav-icon" aria-label="settings">
|
||||
<clr-icon shape="cog"></clr-icon>
|
||||
</a>
|
||||
</div>
|
||||
</clr-header>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<p>knex-config works!</p>
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
|
||||
declare const fb
|
||||
declare const fb : { Admin: { getConfig:()=>any , setConfigKey:(knex:"dbConf", conf:KnexConfig)=>any } }
|
||||
|
||||
@Component({
|
||||
selector: 'knex-config',
|
||||
@@ -78,7 +78,7 @@ declare const fb
|
||||
<form clrForm clrLayout="horizontal">
|
||||
<clr-input-container >
|
||||
<label class="clr-col-12 clr-col-md-4">file</label>
|
||||
<input class="clr-col-12 clr-col-md-8" clrInput type="text" name="sqlite-file" [(ngModel)]="sqlite3['connection']['filename']" placeholder="./data/benis.sqlite" required />
|
||||
<input class="clr-col-12 clr-col-md-8" clrInput type="text" name="sqlite-file" [(ngModel)]="sqlite3['connection']['filename']" placeholder="./data/db.sqlite" required />
|
||||
</clr-input-container>
|
||||
</form>
|
||||
</clr-tab-content>
|
||||
@@ -98,8 +98,6 @@ declare const fb
|
||||
})
|
||||
export class KnexConfigComponent implements OnInit{
|
||||
|
||||
@Input("fbPlugin")
|
||||
fbPlugin:string
|
||||
conf: KnexConfig
|
||||
|
||||
pg:PgConfig = {
|
||||
@@ -138,10 +136,7 @@ export class KnexConfigComponent implements OnInit{
|
||||
}
|
||||
|
||||
async ngOnInit(){
|
||||
if(!fb[this.fbPlugin]){
|
||||
throw new Error("Knex config component doesn't have fb."+this.fbPlugin)
|
||||
}
|
||||
const c = await fb[this.fbPlugin].getConfig()
|
||||
const c = await fb.Admin.getConfig()
|
||||
this.conf = c.dbConf
|
||||
|
||||
Object.keys(this.mode).forEach(knexType => {
|
||||
@@ -155,9 +150,13 @@ export class KnexConfigComponent implements OnInit{
|
||||
window['knex'] = this
|
||||
}
|
||||
|
||||
getSettingsComponentClassName(){
|
||||
return KnexConfigComponent
|
||||
}
|
||||
|
||||
save(){
|
||||
const modeName = Object.entries(this.mode).find(([key, active]) => active)[0]
|
||||
fb[this.fbPlugin].setConfigKey('dbConf', this[modeName]).then(console.log)
|
||||
fb.Admin.setConfigKey('dbConf', this[modeName]).then(console.log)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { KnexConfigComponent } from './knex-config.component';
|
||||
import { ClarityModule } from '@clr/angular';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
ClarityModule,
|
||||
],
|
||||
exports: [
|
||||
KnexConfigComponent
|
||||
],
|
||||
declarations: [
|
||||
KnexConfigComponent
|
||||
],
|
||||
entryComponents: [],
|
||||
providers: []
|
||||
})
|
||||
export class KnexConfigModule{}
|
||||
@@ -27,5 +27,5 @@ import { FormsModule } from '@angular/forms';
|
||||
PluginsComponent
|
||||
]
|
||||
})
|
||||
export class PluginModule{
|
||||
export class PluginmanagerModule{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<knex-config></knex-config>
|
||||
|
||||
|
||||
<ng-container #dynamicSettings></ng-container>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SettingsComponent } from './settings.component';
|
||||
|
||||
describe('SettingsComponent', () => {
|
||||
let component: SettingsComponent;
|
||||
let fixture: ComponentFixture<SettingsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SettingsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SettingsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
import { Component, ViewChild, ViewContainerRef, ComponentFactoryResolver, Injector, AfterViewInit } from '@angular/core';
|
||||
import { ApiclientModule } from '../apiclient/module'
|
||||
|
||||
@Component({
|
||||
selector: 'app-settings',
|
||||
templateUrl: './settings.component.html',
|
||||
styleUrls: ['./settings.component.scss']
|
||||
})
|
||||
export class SettingsComponent implements AfterViewInit {
|
||||
ngAfterViewInit(): void {
|
||||
this.injectModule(new ApiclientModule())
|
||||
this.injectModule(new ApiclientModule())
|
||||
}
|
||||
|
||||
@ViewChild('dynamicSettings', {read: ViewContainerRef, static: false})
|
||||
settingsContainer: ViewContainerRef
|
||||
|
||||
constructor(
|
||||
private componentFactoryResolver: ComponentFactoryResolver,
|
||||
private injector: Injector
|
||||
) {
|
||||
}
|
||||
|
||||
injectModule(module:any) {
|
||||
const factory = this.componentFactoryResolver.resolveComponentFactory(module.getSettingsComponentClassName())
|
||||
const component = factory.create(this.injector)
|
||||
setTimeout(() => this.settingsContainer.insert(component.hostView), 1)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,26 @@
|
||||
<!--
|
||||
|
||||
<nav class="sidenav">
|
||||
<section class="sidenav-content">
|
||||
<a *ngFor="let entry of entries" routerLinkActive="active" [routerLink]="entry.route" class="nav-link">
|
||||
<clr-icon [attr.shape]="entry.icon" class="is-solid" clrVerticalNavIcon></clr-icon>{{entry.text}}
|
||||
</a>
|
||||
|
||||
|
||||
<section class="nav-group" *ngFor="let e of multientires" >
|
||||
<label>
|
||||
<clr-icon [attr.shape]="e.icon" class="is-solid"></clr-icon>
|
||||
{{e.text}}
|
||||
</label>
|
||||
<ul class="nav-list">
|
||||
<li *ngFor="let l of e.links"><a class="nav-link" routerLinkActive="active" [routerLink]="l.route" >{{l.text}}</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
</section>
|
||||
</nav>
|
||||
|
||||
-->
|
||||
|
||||
<clr-vertical-nav [clr-nav-level]="1" class="nav-trigger--bottom" style="height: 100%;" [clrVerticalNavCollapsible]="true" [(clrVerticalNavCollapsed)]="collapsed" >
|
||||
<clr-vertical-nav-group *ngFor="let e of multientires" routerLinkActive="active">
|
||||
<clr-icon [attr.shape]="e.icon" class="is-solid" clrVerticalNavIcon></clr-icon>
|
||||
|
||||
@@ -10,24 +10,23 @@ export class SidebarComponent implements OnInit {
|
||||
|
||||
collapsed = true
|
||||
|
||||
entries:SidebarEntry[] = [
|
||||
]
|
||||
entries:SidebarEntry[] = []
|
||||
|
||||
multientires:SidebarEntries[] = [{
|
||||
icon: "bundle",
|
||||
text: "Update Manager",
|
||||
parentRoute: "pluginmanager",
|
||||
links: [{
|
||||
route: "pluginmanager/debug",
|
||||
text: "DEBUG"
|
||||
},{
|
||||
route: "pluginmanager/admin",
|
||||
text: "Dashboard"
|
||||
},{
|
||||
route: "pluginmanager/plugins",
|
||||
text: "Plugins"
|
||||
}]
|
||||
}]
|
||||
icon: "bundle",
|
||||
text: "Update Manager",
|
||||
parentRoute: "pluginmanager",
|
||||
links: [{
|
||||
route: "pluginmanager/debug",
|
||||
text: "DEBUG"
|
||||
},{
|
||||
route: "pluginmanager/admin",
|
||||
text: "Dashboard"
|
||||
},{
|
||||
route: "pluginmanager/plugins",
|
||||
text: "Plugins"
|
||||
}]
|
||||
},]
|
||||
|
||||
constructor() { }
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<nav class="subnav">
|
||||
<ul class="nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" href="#">Dashboard</a>
|
||||
<a class="nav-link" routerLinkActive="active" [routerLink]="'home'">Dashboard</a>
|
||||
|
||||
<a class="nav-link" routerLinkActive="active" [routerLink]="'notifications'">Notifications</a>
|
||||
|
||||
<a class="nav-link" routerLinkActive="active" [routerLink]="'settings'">Settings</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
@@ -1,59 +0,0 @@
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: restore cache
|
||||
image: drillster/drone-volume-cache
|
||||
settings:
|
||||
restore: true
|
||||
mount:
|
||||
- ./node_modules
|
||||
volumes:
|
||||
- name: cache
|
||||
path: /cache
|
||||
|
||||
- name: npm install
|
||||
image: node:12
|
||||
commands:
|
||||
- npm install
|
||||
|
||||
- name: npm run build
|
||||
image: node:12
|
||||
commands:
|
||||
- npm run build
|
||||
|
||||
- name: rebuild cache
|
||||
image: drillster/drone-volume-cache
|
||||
settings:
|
||||
rebuild: true
|
||||
mount:
|
||||
- ./node_modules
|
||||
volumes:
|
||||
- name: cache
|
||||
path: /cache
|
||||
|
||||
- name: deploy plugin
|
||||
image: node:12
|
||||
commands:
|
||||
- git config --global user.email "${DRONE_COMMIT_AUTHOR_EMAIL}"
|
||||
- git config --global user.name "${DRONE_COMMIT_AUTHOR}"
|
||||
- git clone https://gitea.frontblock.me/fb-dist/${DRONE_REPO_NAME}.git
|
||||
- cp -r ./dist/* ./${DRONE_REPO_NAME}
|
||||
- cd ./${DRONE_REPO_NAME}
|
||||
- git add -A
|
||||
- git commit --allow-empty -m "drone tagged as version ${DRONE_TAG}"
|
||||
- git tag ${DRONE_TAG}
|
||||
- git push https://$GIT_USER:$GIT_PASSWORD@gitea.frontblock.me/fb-dist/${DRONE_REPO_NAME}.git master ${DRONE_TAG}
|
||||
environment:
|
||||
GIT_USER:
|
||||
from_secret: git_user
|
||||
GIT_PASSWORD:
|
||||
from_secret: git_password
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
|
||||
volumes:
|
||||
- name: cache
|
||||
host:
|
||||
path: /tmp
|
||||
@@ -1,11 +0,0 @@
|
||||
dist
|
||||
kfs
|
||||
.rpt2_cache
|
||||
node_modules
|
||||
lib
|
||||
|
||||
*.d.ts
|
||||
*.js
|
||||
*.ts
|
||||
|
||||
!src/**/*
|
||||
-5477
File diff suppressed because it is too large
Load Diff
@@ -1,57 +0,0 @@
|
||||
{
|
||||
"name": "frontblock",
|
||||
"version": "0.9.10",
|
||||
"description": "frontblock shop-side library ",
|
||||
"main": "FrontblockApiClient.js",
|
||||
"scripts": {
|
||||
"build-backend": "webpack --config src/backend/webpack.prod.js --progress --colors",
|
||||
"build-frontend": "webpack --config src/frontend/webpack.prod.js --progress --colors",
|
||||
"build": "npm run clean; npm run build-backend; npm run build-frontend",
|
||||
"clean": "rm -rf *.js *.ts backend frontend .rpt2_cache lib dist",
|
||||
"update-frontblock": "rm -rf node_modules/frontblock*; npm install"
|
||||
},
|
||||
"keywords": [
|
||||
"api",
|
||||
"client",
|
||||
"frontblock"
|
||||
],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@angular/common": "^8.2.1",
|
||||
"@angular/core": "^8.2.1",
|
||||
"@angular/forms": "^8.2.1",
|
||||
"@angular/platform-browser": "^8.2.1",
|
||||
"@angular/router": "^8.2.1",
|
||||
"@clr/angular": "^2.1.1",
|
||||
"@types/node": "^11.13.10",
|
||||
"adm-zip": "^0.4.13",
|
||||
"angular": "^1.7.8",
|
||||
"bip39": "^3.0.2",
|
||||
"bitcoinjs-lib": "^5.0.4",
|
||||
"bsock": "^0.1.9",
|
||||
"btc-hdkey": "0.0.17",
|
||||
"coinselect": "^3.1.11",
|
||||
"easy-unzip": "^1.1.0",
|
||||
"express": "^4.16.4",
|
||||
"frontblock-generic": "^0.28.4",
|
||||
"hdkey": "^1.1.1",
|
||||
"key-file-storage": "^2.2.1",
|
||||
"knex": "^0.19.2",
|
||||
"log4js": "^4.3.1",
|
||||
"minimist": "^1.2.0",
|
||||
"node-fetch": "^2.5.0",
|
||||
"original-fs": "^1.1.0",
|
||||
"rxjs": "^6.5.2",
|
||||
"rxjs-compat": "^6.5.2",
|
||||
"unzip": "^0.1.11",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ts-loader": "^6.0.4",
|
||||
"typescript": "^3.4.5",
|
||||
"webpack": "^4.39.2",
|
||||
"webpack-cli": "^3.3.6",
|
||||
"webpack-node-externals": "^1.7.2"
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
import { socketioRPC } from "frontblock-generic/RPC";
|
||||
import { DatabasePlugin, TableDefiniton } from "frontblock-generic/DatabasePlugin"
|
||||
import { Coin } from "frontblock-generic/Types";
|
||||
import * as knex from 'knex';
|
||||
import * as Logger from 'log4js'
|
||||
Logger.configure({
|
||||
appenders: {
|
||||
"frontblock-wallet": { type: 'stdout' },
|
||||
//app: { type: 'file', filename: 'application.log' }
|
||||
},
|
||||
categories: {
|
||||
default: { appenders: [ 'frontblock-wallet' ], level: 'debug' }
|
||||
}
|
||||
})
|
||||
const logger = Logger.getLogger("frontblock-wallet")
|
||||
|
||||
export type PublicNode = {
|
||||
coin: Coin
|
||||
net: 'testnet' | 'mainnet'
|
||||
url: URL
|
||||
}
|
||||
|
||||
export type WalletPluginConf = {
|
||||
btcConf: {
|
||||
publicNodes: PublicNode[]
|
||||
}
|
||||
}
|
||||
|
||||
export type Key = {
|
||||
name: string
|
||||
type: 'plain' | 'encrypted'
|
||||
value: string
|
||||
coin: Coin
|
||||
}
|
||||
|
||||
export default class WalletPlugin extends DatabasePlugin<WalletPluginConf>{
|
||||
constructor(){
|
||||
super("Wallet")
|
||||
}
|
||||
|
||||
getDefaultConfig(): WalletPluginConf & { dbConf: knex.Config; } {
|
||||
return {
|
||||
btcConf: {
|
||||
publicNodes: [
|
||||
{coin: 'BTC', net: 'testnet', url: new URL('https://testnet-api.smartbit.com.au/v1/blockchain')},
|
||||
{coin: 'BTC', net: 'mainnet', url: new URL('https://api.smartbit.com.au/v1/blockchain')}
|
||||
]
|
||||
},
|
||||
dbConf: {
|
||||
client: 'sqlite3',
|
||||
connection: {
|
||||
filename: "./data/Wallet.sqlite"
|
||||
},
|
||||
useNullAsDefault: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected exportExtraRPCs(): socketioRPC[] {
|
||||
return [
|
||||
{
|
||||
name: "putKey",
|
||||
func: async(
|
||||
name: string,
|
||||
type: 'plain' | 'encrypted',
|
||||
value: string,
|
||||
coin: Coin
|
||||
) => {
|
||||
return await this.putKey({
|
||||
name: name,
|
||||
type:type,
|
||||
value:value,
|
||||
coin:coin
|
||||
})
|
||||
},
|
||||
type: 'call',
|
||||
visibility: 'private'
|
||||
},{
|
||||
name: "delKey",
|
||||
func: async(name: string) => { return await this.delKey(name) },
|
||||
type: 'call',
|
||||
visibility: 'private'
|
||||
},{
|
||||
name: "getKeys",
|
||||
func: async() => { return await this.getKeys() },
|
||||
type: 'call',
|
||||
visibility: 'private'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
public async putKey(key: Key){
|
||||
return await this.knex('keys').insert([key])
|
||||
}
|
||||
|
||||
public async delKey(name: string){
|
||||
return await this.knex('keys')
|
||||
.where('name', name)
|
||||
.del()
|
||||
}
|
||||
|
||||
public async getKeys(): Promise<Key[]>{
|
||||
return await this.knex.select('*').from('keys')
|
||||
}
|
||||
|
||||
protected getTableDefinitions(): TableDefiniton[] {
|
||||
return [{
|
||||
name: 'keys',
|
||||
tableBuilder: function (table) {
|
||||
table.string('name').primary();
|
||||
table.string('type');
|
||||
table.string('value');
|
||||
table.string('coin');
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
const nodeExternals = require('webpack-node-externals');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
target: "node",
|
||||
entry: path.resolve(__dirname, 'Plugin.ts'),
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../../dist'),
|
||||
filename: 'Plugin.js',
|
||||
libraryTarget: 'commonjs',
|
||||
},
|
||||
resolve: {
|
||||
// Add `.ts` and `.tsx` as a resolvable extension.
|
||||
extensions: [".ts", ".tsx", ".js"]
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{ test: /\.ts?$/, loader: "ts-loader" }
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
minimize: false
|
||||
},
|
||||
node: {
|
||||
global: true,
|
||||
process: true,
|
||||
__filename: false,
|
||||
__dirname: false,
|
||||
Buffer: true,
|
||||
},
|
||||
externals:{
|
||||
knex: "../node_modules/knex"
|
||||
}
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
|
||||
|
||||
import { Component, OnInit, isDevMode } from '@angular/core';
|
||||
import { PluginsComponent } from './btc.component';
|
||||
import { ClrDatagridStringFilterInterface, ClrDatagridNumericFilterInterface, ClrDropdownModule } from '@clr/angular';
|
||||
declare const fb
|
||||
@Component({
|
||||
selector: 'address-viewer', //!!!!
|
||||
template: `
|
||||
<div class="clr-row">
|
||||
<div *ngIf="regularAddresses.length != 0" class="clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-12 clr-col-xl-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Addresses
|
||||
</div>
|
||||
<clr-alert *ngFor="let entry of alerts" [clrAlertType]="line.severity">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{line.message}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
|
||||
<clr-datagrid class="datagrid-compact ">
|
||||
<clr-dg-column>Address</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
Balance
|
||||
</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
Pending
|
||||
</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
Estimate total
|
||||
<clr-dg-numeric-filter [clrDgNumericFilter]="otherBalanceFilter" [clrFilterValue]="[0, null]"></clr-dg-numeric-filter>
|
||||
</clr-dg-column>
|
||||
|
||||
<clr-dg-row *clrDgItems="let line of regularAddresses">
|
||||
<clr-dg-cell class="monospace" style="word-break: break-all">{{line.address}}</clr-dg-cell>
|
||||
<clr-dg-cell class="monospace">{{line.confirmed.balance | number: '1.8-18'}}</clr-dg-cell>
|
||||
<clr-dg-cell class="monospace">
|
||||
<span *ngIf="line.unconfirmed.balance != 0">
|
||||
{{line.unconfirmed.balance | number: '1.8-18'}}
|
||||
</span>
|
||||
</clr-dg-cell>
|
||||
<clr-dg-cell class="monospace">{{line.total.balance | number: '1.8-18'}}</clr-dg-cell>
|
||||
|
||||
<clr-dg-row-detail *clrIfExpanded >
|
||||
<div class="clr-row">
|
||||
<div class="clr-col-3">
|
||||
<button class="btn btn-info-outline" (click)="parent.addrExplorer(line.address)">Explorer</button>
|
||||
</div>
|
||||
|
||||
<div *ngIf="parent.keys[line.address] != null" class="clr-col-9" style="word-break:break-all">
|
||||
<h6 style="margin-top: 0">Derivation </h6>
|
||||
{{parent.keys[line.address].derivation}}
|
||||
<h6> Public key </h6>
|
||||
{{parent.keys[line.address].publicExtendedKey}}
|
||||
<h6> Private key </h6>
|
||||
{{parent.keys[line.address].privateExtendedKey}}
|
||||
</div>
|
||||
</div>
|
||||
</clr-dg-row-detail>
|
||||
</clr-dg-row>
|
||||
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination2 [clrDgPageSize]="10">
|
||||
<clr-dg-page-size [clrPageSizeOptions]="[5,10,20,50,100]">per page</clr-dg-page-size>
|
||||
{{pagination2.firstItem + 1}} - {{pagination2.lastItem + 1}}
|
||||
of {{pagination2.totalItems}}
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="changeAddresses.length != 0" class="clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-12 clr-col-xl-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Change Addresses
|
||||
</div>
|
||||
<clr-alert *ngFor="let entry of alerts" [clrAlertType]="line.severity">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{line.message}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
|
||||
<clr-datagrid class="datagrid-compact">
|
||||
<clr-dg-column>Address</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
Balance
|
||||
</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
Pending
|
||||
</clr-dg-column>
|
||||
<clr-dg-column>
|
||||
Estimate total
|
||||
<clr-dg-numeric-filter [clrDgNumericFilter]="balanceFilter" [clrFilterValue]="[0.00000001, null]"></clr-dg-numeric-filter>
|
||||
</clr-dg-column>
|
||||
|
||||
<clr-dg-row *clrDgItems="let line of changeAddresses">
|
||||
<clr-dg-cell class="monospace" style="word-break: break-all">{{line.address}}</clr-dg-cell>
|
||||
<clr-dg-cell class="monospace">{{line.confirmed.balance | number: '1.8-18'}}</clr-dg-cell>
|
||||
<clr-dg-cell class="monospace">
|
||||
<span *ngIf="line.unconfirmed.balance != 0">
|
||||
{{line.unconfirmed.balance | number: '1.8-18'}}
|
||||
</span>
|
||||
</clr-dg-cell>
|
||||
<clr-dg-cell class="monospace">{{line.total.balance | number: '1.8-18'}}</clr-dg-cell>
|
||||
|
||||
<clr-dg-row-detail *clrIfExpanded >
|
||||
<div class="clr-row">
|
||||
<div class="clr-col-3">
|
||||
<button class="btn btn-info-outline" (click)="parent.addrExplorer(line.address)">Explorer</button>
|
||||
<p>
|
||||
</div>
|
||||
|
||||
<div *ngIf="parent.keys[line.address] != null" class="clr-col-9" style="word-break:break-all">
|
||||
<h6 style="margin-top: 0">Derivation </h6>
|
||||
{{parent.keys[line.address].derivation}}
|
||||
<h6> Public key </h6>
|
||||
{{parent.keys[line.address].publicExtendedKey}}
|
||||
<h6> Private key </h6>
|
||||
{{parent.keys[line.address].privateExtendedKey}}
|
||||
</div>
|
||||
</div>
|
||||
</clr-dg-row-detail>
|
||||
</clr-dg-row>
|
||||
|
||||
<clr-dg-footer>
|
||||
<clr-dg-pagination #pagination [clrDgPageSize]="10">
|
||||
<clr-dg-page-size [clrPageSizeOptions]="[5,10,20,50,100]">per page</clr-dg-page-size>
|
||||
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
|
||||
of {{pagination.totalItems}}
|
||||
</clr-dg-pagination>
|
||||
</clr-dg-footer>
|
||||
</clr-datagrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class AddressViewerComponent implements OnInit{
|
||||
balanceFilter = new BalanceFilter()
|
||||
otherBalanceFilter = new BalanceFilter()
|
||||
regularAddresses = []
|
||||
changeAddresses = []
|
||||
keys = {}
|
||||
parent:PluginsComponent
|
||||
ngOnInit() { }
|
||||
|
||||
setParent(parent:PluginsComponent){
|
||||
this.parent = parent
|
||||
}
|
||||
|
||||
setRegularAddresses(addresses){
|
||||
this.regularAddresses = addresses
|
||||
}
|
||||
|
||||
setChangeAddresses(addresses){
|
||||
this.changeAddresses = addresses
|
||||
}
|
||||
}
|
||||
|
||||
class BalanceFilter implements ClrDatagridNumericFilterInterface<any>{
|
||||
accepts(item: any, low: number, high: number): boolean {
|
||||
high = parseFloat(""+high)
|
||||
low = parseFloat(""+low)
|
||||
const balance = (parseFloat(item.unconfirmed.balance) + parseFloat(item.confirmed.balance))
|
||||
return (Number.isNaN(low) || balance >= low)
|
||||
&& (Number.isNaN(high) || balance <= high)
|
||||
}
|
||||
}
|
||||
@@ -1,702 +0,0 @@
|
||||
import { Component, OnInit, isDevMode, ViewChild, AfterViewInit, OnDestroy, HostListener } from '@angular/core';
|
||||
import { WalletGeneratorComponent } from './wallet-generator.component';
|
||||
import { WalletPickerComponent } from './wallet-picker.component';
|
||||
import { HDKey } from "btc-hdkey"
|
||||
import { AddressViewerComponent } from './address-viewer.component';
|
||||
const coinselect = require('coinselect/accumulative')
|
||||
const fetch = require("node-fetch")
|
||||
import { TransactionBuilder, Signer } from 'bitcoinjs-lib'
|
||||
import { networks } from 'bitcoinjs-lib'
|
||||
import { SubscriptionResponse, ErrorResponse } from 'frontblock-generic/Types';
|
||||
let feeRate = 5 // satoshis per byte
|
||||
|
||||
const hdkey = new HDKey()
|
||||
declare const fb
|
||||
@Component({
|
||||
|
||||
selector: 'plugins', //!!!!
|
||||
template: `
|
||||
|
||||
<wallet-generator></wallet-generator>
|
||||
|
||||
<!-- loading -->
|
||||
<clr-modal [clrModalSize]="'md'" [(clrModalOpen)]="loading">
|
||||
|
||||
<div class="modal-body ">
|
||||
<span class="spinner spinner-inverse spinner-md">
|
||||
Loading...
|
||||
</span>
|
||||
<h3>Checking addresses</h3> <br>
|
||||
Checking the first {{loadingN*115}} addresses. <br>
|
||||
Found addresses containing balance: {{regaddresses.length + changeaddresses.length}}
|
||||
</div>
|
||||
</clr-modal>
|
||||
<!-- / loading -->
|
||||
|
||||
<!-- faucets -->
|
||||
<div *ngIf="mode.net == 'testnet'" class="clr-all-12">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-header">
|
||||
Faucet
|
||||
</div>
|
||||
<div class="card-block" >
|
||||
<button class="btn btn-icon btn-info-outline" onclick="window.open('https://testnet-faucet.mempool.co/', '_blank')"><clr-icon shape="fuel"></clr-icon></button>
|
||||
<button class="btn btn-icon btn-info-outline" onclick="window.open('https://bitcoinfaucet.uo1.net/', '_blank')"><clr-icon shape="fuel"></clr-icon></button>
|
||||
<button class="btn btn-icon btn-info-outline" onclick="window.open('https://coinfaucet.eu/en/btc-testnet/', '_blank')"><clr-icon shape="fuel"></clr-icon></button>
|
||||
<button class="btn btn-icon btn-success-outline" onclick="window.open('https://www.google.com/search?q=btc+testnet+faucet&oq=btc+testnet+faucet', '_blank')"><clr-icon shape="plus"></clr-icon> more</button>
|
||||
</div>
|
||||
<div class="card-footer" >
|
||||
Get free test-BTC
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /faucets -->
|
||||
|
||||
<!-- row 1 -->
|
||||
<div class="clr-all-12">
|
||||
|
||||
<!-- wallet picker + send box + balance box -->
|
||||
<div class="clr-row">
|
||||
|
||||
<!-- left column -->
|
||||
<div class="clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-5 clr-col-xl-5">
|
||||
|
||||
<!-- Wallet picker -->
|
||||
<div class="clr-row">
|
||||
<walletpicker class="clr-all-12"></walletpicker>
|
||||
</div>
|
||||
<!-- /Wallet picker -->
|
||||
|
||||
<!-- Send box -->
|
||||
<div *ngIf="mode.type=='private'" class="clr-row">
|
||||
|
||||
<div class="clr-all-12">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-header">
|
||||
Send
|
||||
</div>
|
||||
<clr-alert *ngFor="let error of errors" [clrAlertType]="'danger'">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{error}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
<clr-alert *ngFor="let success of successes" [clrAlertType]="'success'">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{success}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
<div class="card-block" >
|
||||
|
||||
<div class="clr-row" style="padding-left:12px; padding-right:12px">
|
||||
<input [(ngModel)]="sendTo" type="text" placeholder="To address" class="clr-input clr-col-12" />
|
||||
<input [(ngModel)]="sendAmount" type="text" min="0" placeholder="Amount" class="clr-input clr-col-12" style="margin-top:12px; margin-borrom:12px" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer" *ngIf="!sending" >
|
||||
<button class="btn btn-success-outline" (click)="createAndSendTx(sendTo, sendAmount)">send</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /Send Box -->
|
||||
|
||||
</div>
|
||||
<!-- /left column -->
|
||||
|
||||
<!-- right column -->
|
||||
<div class="clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-7 clr-col-xl-7" >
|
||||
|
||||
<!-- Balance box -->
|
||||
<div *ngIf="rootkey.publicExtendedKey != ''" class="card">
|
||||
<div class="card-header" style="word-break: break-all">
|
||||
<span *ngIf="mode.net=='testnet'" class="label label-danger">Testnet</span>{{rootkey.publicExtendedKey}}
|
||||
</div>
|
||||
<clr-alert *ngFor="let entry of alerts" [clrAlertType]="line.severity">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{line.message}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
|
||||
<div class="card-block">
|
||||
<h3 style="margin-top:12px">{{balanceDisplay.total | number: '1.8-18'}} BTC </h3>
|
||||
<p class="monospace">
|
||||
<span *ngIf="balanceDisplay.unconfirmed < 0"> </span>{{balanceDisplay.confirmed | number: '1.18'}} BTC confirmed<br />
|
||||
{{balanceDisplay.unconfirmed | number: '1.18'}} BTC pending
|
||||
</p>
|
||||
<p *ngIf="mode.type=='private'">
|
||||
<clr-icon shape="key"></clr-icon> Private key available
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="card-footer clr-row" style="margin-left: 2px" >
|
||||
<button *ngIf="!autorefresh" class="btn btn-icon clr-col-4" (click)="reload()"> <clr-icon shape="refresh"></clr-icon> Reload </button>
|
||||
<clr-toggle-wrapper class="clr-col-auto clr-align-self-center">
|
||||
<input type="checkbox" clrToggle [(ngModel)]="autorefresh" />
|
||||
<label>Autorefresh</label>
|
||||
</clr-toggle-wrapper>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Balance box-->
|
||||
|
||||
</div>
|
||||
<!-- right column -->
|
||||
|
||||
</div>
|
||||
<!-- /row wallet picker + send box + balance box -->
|
||||
|
||||
|
||||
|
||||
<!-- live-tx -->
|
||||
<div class="clr-row" *ngIf="apiClientPlugin && transactions.length != 0" >
|
||||
<div class="clr-col-12">
|
||||
<div class="clr-all-12" style="padding-left:0px; padding-right: 0px">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-header">
|
||||
Live Transactions
|
||||
</div>
|
||||
<div class="card-block" >
|
||||
<table class="table table-compact">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Hash</th>
|
||||
<th>Amount</th>
|
||||
<th>Status</th>
|
||||
<th>To</th>
|
||||
<th>From</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let line of transactions">
|
||||
<td style="word-break:break-all">{{line.hash}}</td>
|
||||
<td>{{line.amount}}</td>
|
||||
<td>{{line.status}}</td>
|
||||
<td style="word-break:break-all">{{line.to}}</td>
|
||||
<td style="word-break:break-all">{{line.from.join(', ')}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /live-tx -->
|
||||
|
||||
<!-- address-viewer -->
|
||||
<div class="clr-all-12" style="padding-left:0px; padding-right: 0px">
|
||||
<address-viewer></address-viewer>
|
||||
</div>
|
||||
<!-- address-viewer -->
|
||||
</div>
|
||||
<!-- /row 1 -->
|
||||
`
|
||||
})
|
||||
export class PluginsComponent implements AfterViewInit, OnDestroy {
|
||||
timerRefresh: NodeJS.Timeout
|
||||
errors: string[] = []
|
||||
successes: string[] = []
|
||||
wallets: WalletStore = {}
|
||||
rootkey: bip32Keypair = { publicExtendedKey: "", privateExtendedKey: "" }
|
||||
keys: KeyStore = {}
|
||||
regaddresses: AddressLine[] = []
|
||||
changeaddresses: AddressLine[] = []
|
||||
balanceDisplay = {
|
||||
confirmed: 0,
|
||||
total: 0,
|
||||
unconfirmed: 0
|
||||
}
|
||||
mode: {
|
||||
type: keyType,
|
||||
net: networkType
|
||||
} = {
|
||||
net: "testnet",
|
||||
type: "public"
|
||||
}
|
||||
sendTo: string
|
||||
sendAmount: number
|
||||
sending = false
|
||||
loading = false
|
||||
loadingN = 1
|
||||
autorefresh = false
|
||||
refreshing = false
|
||||
apiClientPlugin = false
|
||||
subscriptions = []
|
||||
transactions = []
|
||||
|
||||
|
||||
@ViewChild(AddressViewerComponent, { static: false })
|
||||
AddressViewerComponent: AddressViewerComponent
|
||||
|
||||
@ViewChild(WalletGeneratorComponent, { static: false })
|
||||
WalletGeneratorComponent: WalletGeneratorComponent
|
||||
|
||||
@ViewChild(WalletPickerComponent, { static: false })
|
||||
WalletPickerComponent: WalletPickerComponent
|
||||
|
||||
@HostListener('window:beforeunload', ['$event'])
|
||||
unloadNotification($event: any) {
|
||||
this.unsubscribe()
|
||||
return true
|
||||
}
|
||||
|
||||
async ngAfterViewInit(): Promise<void> {
|
||||
this.WalletGeneratorComponent.setParent(this)
|
||||
this.WalletPickerComponent.setParent(this)
|
||||
this.AddressViewerComponent.setParent(this)
|
||||
this.apiClientPlugin = fb.ApiClient != null
|
||||
window['btc'] = this
|
||||
const keys: any[] = await fb.Wallet.getKeys()
|
||||
|
||||
keys.filter(key => key.coin === "BTC").forEach(key => {
|
||||
this.wallets[key.name] = {key: key.value, name: key.name}
|
||||
})
|
||||
this.WalletPickerComponent.setWallets(this.wallets)
|
||||
|
||||
this.timerRefresh = setInterval(async () => { if (this.autorefresh && !this.refreshing && !this.loading) this.refresh() }, 30000)
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.unsubscribe()
|
||||
clearInterval(this.timerRefresh)
|
||||
}
|
||||
|
||||
unsubscribe(){
|
||||
this.subscriptions.map(s => {
|
||||
fb.ApiClient.unsubscribe(s)
|
||||
})
|
||||
}
|
||||
|
||||
addWallet(wallet: {key:string, name:string}) {
|
||||
fb.Wallet.putKey(wallet.name, "plain", wallet.key, "BTC")
|
||||
|
||||
this.wallets[wallet.name] = wallet
|
||||
this.WalletPickerComponent.setWallets(this.wallets)
|
||||
}
|
||||
|
||||
showWizard() {
|
||||
this.WalletGeneratorComponent.open()
|
||||
}
|
||||
|
||||
loadKey(key: string) {
|
||||
this.wallets = {}
|
||||
this.regaddresses = []
|
||||
|
||||
const t = hdkey.checkHDKey(key)
|
||||
if (t) {
|
||||
this.mode = t
|
||||
}
|
||||
|
||||
this.rootkey = hdkey.HDKeyFromExtendedKey(key)
|
||||
this.reload()
|
||||
}
|
||||
|
||||
async reload(): Promise<void> {
|
||||
if (this.loading)
|
||||
return
|
||||
this.loading = true
|
||||
this.loadingN = 1
|
||||
|
||||
await this.refresh()
|
||||
if (fb.ApiClient) {
|
||||
const res: (SubscriptionResponse | ErrorResponse)[] = await Promise.all([
|
||||
...this.regaddresses,
|
||||
...this.changeaddresses
|
||||
].map(async a => await fb.ApiClient.subsume("BTC", { address: a.address }, tx => { this.transactions.unshift(tx) })))
|
||||
this.subscriptions = this.subscriptions.concat(res.map(r => {
|
||||
if (r.result = "Success") {
|
||||
return r.message
|
||||
} else {
|
||||
return
|
||||
}
|
||||
})).filter(s => !(!s))
|
||||
}
|
||||
this.loading = false
|
||||
}
|
||||
|
||||
async refresh(): Promise<void> {
|
||||
if (this.refreshing)
|
||||
return
|
||||
|
||||
this.refreshing = true
|
||||
this.keys = {}
|
||||
|
||||
let p1 = this.updateChange()
|
||||
let p2 = this.updateBalance()
|
||||
|
||||
let balances: GrandTotal[] = await Promise.all([p1, p2])
|
||||
|
||||
this.balanceDisplay = balances.reduce((a, o) => {
|
||||
a.confirmed += o.confirmed
|
||||
a.total += o.total
|
||||
a.unconfirmed += o.unconfirmed
|
||||
|
||||
return a
|
||||
}, {
|
||||
confirmed: 0,
|
||||
unconfirmed: 0,
|
||||
total: 0
|
||||
})
|
||||
|
||||
this.AddressViewerComponent.setChangeAddresses(this.changeaddresses)
|
||||
this.AddressViewerComponent.setRegularAddresses(this.regaddresses)
|
||||
this.refreshing = false
|
||||
|
||||
}
|
||||
|
||||
getAddresses(rootAddr: string, n = 10, skip = 0, changeAddresses = false): string[] | null {
|
||||
let addresses: string[] = []
|
||||
for (let i = skip; i < skip + n; i++) {
|
||||
let addr
|
||||
if (changeAddresses) {
|
||||
addr = hdkey.deriveAddress(rootAddr, i, 'm/1/')
|
||||
} else {
|
||||
addr = hdkey.deriveAddress(rootAddr, i)
|
||||
}
|
||||
if (!addr) {
|
||||
return
|
||||
}
|
||||
addresses.push(addr)
|
||||
}
|
||||
return addresses
|
||||
}
|
||||
|
||||
async fetchAddresses(addresses: string[], network: networkType): Promise<{ success: boolean, address?: any, addresses?: any }> {
|
||||
let lookupstr = addresses.join(',')
|
||||
try {
|
||||
let r = await fetch(api[network] + '/address/' + lookupstr, {
|
||||
'method': 'GET',
|
||||
'mode': 'cors',
|
||||
'data': { limit: 200 }
|
||||
})
|
||||
if (r.status !== 200) {
|
||||
return { success: false }
|
||||
}
|
||||
|
||||
let json = (await r).json()
|
||||
return json
|
||||
} catch (e) {
|
||||
return { success: false }
|
||||
}
|
||||
}
|
||||
|
||||
async getAddressInfos(rootAddr: string, n = 10, skip = 0, changeAddresses = false): Promise<any> {
|
||||
const t = hdkey.checkHDKey(rootAddr)
|
||||
if (!t) {
|
||||
return false
|
||||
}
|
||||
const addresses = this.getAddresses(rootAddr, n, skip, changeAddresses)
|
||||
return await this.fetchAddresses(addresses, t.net)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
async getTxs(address: string, type:networkType){
|
||||
try{
|
||||
let r = await fetch(api[type]+'/address/'+address, {
|
||||
'method':'GET',
|
||||
'mode':'cors'
|
||||
})
|
||||
if(r.status !== 200){
|
||||
return {success: false}
|
||||
}
|
||||
|
||||
return (await r).json()
|
||||
}catch(e){
|
||||
console.warn ("getTxs", e)
|
||||
}
|
||||
}
|
||||
*/
|
||||
async getUnspentTxs(addresses: string[], type: networkType): Promise<getUnspentTxsApiResponse> {
|
||||
let lookupstr = addresses.join(',')
|
||||
let url = api[type] + '/address/' + lookupstr + '/unspent'
|
||||
let txs:getUnspentTxsApiResponse['unspent'] = []
|
||||
while (true) {
|
||||
try {
|
||||
|
||||
let resp = await fetch(url, {
|
||||
'method': 'GET',
|
||||
'mode': 'cors'
|
||||
})
|
||||
if (resp.status !== 200) {
|
||||
return { success: false }
|
||||
}
|
||||
const json: getUnspentTxsApiResponse = await resp.json()
|
||||
if (!json.success)
|
||||
break;
|
||||
|
||||
txs = [...txs, ...(json.unspent?json.unspent.filter(u => u.confirmations > 0):[])]
|
||||
if(!json.paging.next_link)
|
||||
break;
|
||||
|
||||
url = json.paging.next_link
|
||||
} catch (e) {
|
||||
console.warn("getUnspentTxs", e)
|
||||
return { success: false }
|
||||
}
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
unspent: txs
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
getKeyForAddress(keyName) {
|
||||
return this.keys[keyName]
|
||||
}
|
||||
|
||||
calculateTotal(addresses: AddressLine[]): GrandTotal {
|
||||
const resMap: any = addresses.reduce((o1:any, o2:any) => { o1[o2.address] = o2; return o1 }, {})
|
||||
const total: GrandTotal = Object.values<AddressLine>(resMap).reduce((accum: GrandTotal, obj: AddressLine) => {
|
||||
accum.confirmed += parseFloat(<any>obj.confirmed.balance)
|
||||
accum.unconfirmed += parseFloat(<any>obj.unconfirmed.balance)
|
||||
accum.total += parseFloat(<any>obj.confirmed.balance) + parseFloat(<any>obj.unconfirmed.balance)
|
||||
return accum
|
||||
}, {
|
||||
confirmed: 0,
|
||||
unconfirmed: 0,
|
||||
total: 0
|
||||
})
|
||||
|
||||
return total
|
||||
}
|
||||
|
||||
async updateBalance(): Promise<GrandTotal> {
|
||||
let n = 1
|
||||
let res: { success: boolean; addresses: any; address: any; }
|
||||
this.regaddresses = []
|
||||
while (true) {
|
||||
this.loadingN = n
|
||||
try {
|
||||
res = await this.getAddressInfos(this.rootkey.publicExtendedKey, 115 * n, 115 * (n - 1))
|
||||
} catch (e) {
|
||||
break
|
||||
}
|
||||
if (res.success === true) {
|
||||
if ('addresses' in res) { // multiple
|
||||
this.regaddresses = [...this.regaddresses, ...res.addresses]
|
||||
}
|
||||
if ('address' in res) {
|
||||
this.regaddresses.push(res.address)
|
||||
}
|
||||
n++
|
||||
} else {
|
||||
console.warn(`This error is a result of a failed fetch request.
|
||||
These are always shown by the browser and cannot be hidden (a design decision)
|
||||
They are completely safe and mean no more addresses were found`)
|
||||
console.log('No more balance found after attempting ', 115 * n, 'addresses')
|
||||
if (this.mode.type == "private") {
|
||||
for (let i = 0; i < 115 * n + 1; i++) {
|
||||
const keyN = hdkey.deriveKey(this.rootkey.privateExtendedKey, i)
|
||||
const addrN = hdkey.addressFromHDKey(keyN._publicKey, this.mode.net)
|
||||
keyN.derivation = i
|
||||
this.keys[addrN] = keyN
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
//add an extra empty address at the end
|
||||
const extraAddr = hdkey.deriveAddress(this.rootkey.publicExtendedKey, this.regaddresses.length)
|
||||
this.regaddresses.push({
|
||||
address: <string>extraAddr,
|
||||
confirmed: { balance: 0 },
|
||||
unconfirmed: { balance: 0 },
|
||||
total: { balance: 0 },
|
||||
})
|
||||
|
||||
return this.calculateTotal(this.regaddresses)
|
||||
}
|
||||
|
||||
async updateChange(): Promise<GrandTotal> {
|
||||
let n = 1
|
||||
this.changeaddresses = []
|
||||
while (true) {
|
||||
let res
|
||||
try {
|
||||
res = await this.getAddressInfos(this.rootkey.publicExtendedKey, 115 * n, 115 * (n - 1), true)
|
||||
} catch (e) {
|
||||
break
|
||||
}
|
||||
if (res.success === true) {
|
||||
if ('addresses' in res) { // multiple
|
||||
this.changeaddresses = [...this.changeaddresses, ...res.addresses]
|
||||
}
|
||||
if ('address' in res) {
|
||||
this.changeaddresses.push(res.address)
|
||||
}
|
||||
n++
|
||||
} else {
|
||||
console.warn(`This error is a result of a failed fetch request.
|
||||
These are always shown by the browser and cannot be hidden (a design decision)
|
||||
They are completely safe and mean no more addresses were found`)
|
||||
console.log('No more change balance found after attempting ', 115 * n, 'addresses')
|
||||
if (this.mode.type == "private") {
|
||||
//make keypairs for addresses
|
||||
for (let i = 0; i < 115 * n; i++) {
|
||||
const keyN = hdkey.deriveKey(this.rootkey.privateExtendedKey, i, 'm/1/')
|
||||
const addrN = hdkey.addressFromHDKey(keyN._publicKey, this.mode.net)
|
||||
keyN.derivation = i
|
||||
this.keys[addrN] = keyN
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return this.calculateTotal(this.changeaddresses)
|
||||
}
|
||||
|
||||
async createAndSendTx(target: string, value: number) {
|
||||
this.sending = true
|
||||
if (target == null || typeof target !== 'string' || target === '' || value == null || value <= 0) {
|
||||
this.errors.push('Bad inputs. Expected bitcoin address and number')
|
||||
this.sending = false
|
||||
return
|
||||
}
|
||||
|
||||
if (value > this.balanceDisplay.confirmed) {
|
||||
this.errors.push('Insufficient funds')
|
||||
this.sending = false
|
||||
return
|
||||
}
|
||||
|
||||
let addresses: string[] = [...this.regaddresses.map(a => a.address), ...this.changeaddresses.map(a => a.address)]
|
||||
const txs = await this.getUnspentTxs(addresses, this.mode.net)
|
||||
|
||||
if (txs == null || txs.success !== true || txs.unspent.length === 0) {
|
||||
this.errors.push('No UTXOs found')
|
||||
this.sending = false
|
||||
return
|
||||
}
|
||||
|
||||
const utxos = txs.unspent.map(t => {
|
||||
return {
|
||||
address: t.addresses[0],
|
||||
txId: t.txid,
|
||||
vout: t.n,
|
||||
value: Math.floor(parseFloat(t.value) * 100000000)
|
||||
}
|
||||
}).filter(utx => utx.value > 0 && utx.address != target)
|
||||
|
||||
let { inputs, outputs, fee } = coinselect(utxos, [{ address: target, value: Math.floor(parseFloat(<any>value) * 100000000) }], feeRate)
|
||||
|
||||
// .inputs and .outputs will be undefined if no solution was found
|
||||
if (!inputs || !outputs) {
|
||||
console.log(fee)
|
||||
this.errors.push('Could not build a valid transaction')
|
||||
this.sending = false
|
||||
return
|
||||
}
|
||||
|
||||
const txb = new TransactionBuilder(networks[this.mode.net])
|
||||
txb.setVersion(1)
|
||||
inputs.forEach((input) => {
|
||||
txb.addInput(input.txId, input.vout)
|
||||
})
|
||||
outputs.forEach((output) => {
|
||||
if (!output.address) {
|
||||
output.address = hdkey.deriveAddress(this.rootkey.publicExtendedKey, this.changeaddresses.length, 'm/1/')
|
||||
}
|
||||
txb.addOutput(output.address, output.value)
|
||||
})
|
||||
inputs.forEach((input, i) => {
|
||||
txb.sign(i, <Signer>this.keys[input.address])
|
||||
})
|
||||
|
||||
await this.sendTx(txb.build())
|
||||
}
|
||||
|
||||
private async sendTx(tx) {
|
||||
if (tx == null) {
|
||||
this.errors.push('No transaction to send!')
|
||||
return
|
||||
}
|
||||
|
||||
let url = api[this.mode.net] + "/pushtx"
|
||||
let r
|
||||
try {
|
||||
r = await fetch(url, {
|
||||
'method': 'POST',
|
||||
'body': JSON.stringify({ 'hex': tx.toHex() })
|
||||
})
|
||||
} catch (e) {
|
||||
console.warn("sendTx", e)
|
||||
return
|
||||
}
|
||||
if (r.status === 200) {
|
||||
this.successes.push("Sent " + this.sendAmount + " to " + this.sendTo)
|
||||
this.sending = false
|
||||
this.errors = []
|
||||
this.sendTo = ""
|
||||
this.sendAmount = null
|
||||
} else {
|
||||
this.errors.push('The API ' + url + ' returned a non-200 error code ' + r.status + ' ' + r.statusText)
|
||||
}
|
||||
}
|
||||
|
||||
addrExplorer(address) {
|
||||
const url = this.mode.net === 'testnet' ? 'https://live.blockcypher.com/btc-testnet/address/' : 'https://live.blockcypher.com/btc/address/'
|
||||
window.open(url + address, '_blank')
|
||||
}
|
||||
}
|
||||
|
||||
export type KeyStore = { [keyname in string]: bip32Keypair & Signer }
|
||||
|
||||
export type AddressLine = {
|
||||
address: string,
|
||||
confirmed: { balance: number },
|
||||
unconfirmed: { balance: number },
|
||||
total: { balance: number },
|
||||
}
|
||||
|
||||
type networkType = 'testnet' | 'mainnet'
|
||||
type keyType = 'public' | 'private'
|
||||
type WalletStore = {
|
||||
[address in string]: {
|
||||
key: string
|
||||
name: string
|
||||
}
|
||||
}
|
||||
type GrandTotal = {
|
||||
confirmed: number,
|
||||
unconfirmed: number,
|
||||
total: number
|
||||
}
|
||||
type bip32Keypair = { publicExtendedKey: string, privateExtendedKey: string }
|
||||
type getUnspentTxsApiResponse = {
|
||||
success: boolean,
|
||||
paging?: {
|
||||
next_link: string | null
|
||||
}
|
||||
unspent?: {
|
||||
addresses: string[],
|
||||
confirmations: number,
|
||||
id: number, n: number,
|
||||
req_sigs: number,
|
||||
script_pub_key: any,
|
||||
txid: string,
|
||||
type: string,
|
||||
value: string,
|
||||
value_int: number
|
||||
}[]
|
||||
}
|
||||
const api = {
|
||||
testnet: 'https://testnet-api.smartbit.com.au/v1/blockchain',
|
||||
mainnet: 'https://api.smartbit.com.au/v1/blockchain'
|
||||
}
|
||||
@@ -1,266 +0,0 @@
|
||||
import { Component, OnInit, isDevMode, ViewChild } from '@angular/core';
|
||||
import { ClrWizard } from '@clr/angular';
|
||||
import { HDKey } from "btc-hdkey"
|
||||
import { PluginsComponent } from './btc.component';
|
||||
|
||||
declare const fb
|
||||
@Component({
|
||||
selector: 'wallet-generator', //!!!!
|
||||
template: `
|
||||
<clr-wizard #wizard [(clrWizardOpen)]="mdOpen" [clrWizardForceForwardNavigation]="true" clrWizardSize="lg">
|
||||
<clr-wizard-title>Bitcoin wallet generator and importer</clr-wizard-title>
|
||||
|
||||
<clr-wizard-button [type]="'cancel'">Cancel</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'previous'">Back</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'next'">Next</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'finish'">Finish</clr-wizard-button>
|
||||
|
||||
<clr-wizard-page (clrWizardPageCustomButton)="doCustomClick($event)">
|
||||
<ng-template clrPageTitle>Menemonic/BIP39 (optional)</ng-template>
|
||||
<ng-template clrPageNavTitle>
|
||||
Menemonic/BIP39
|
||||
</ng-template>
|
||||
<p>
|
||||
A menemonic is a collection of words that is supposed to be easier to remember than a complex seed. It may be used to reconstruct the private key.
|
||||
</p>
|
||||
<p>
|
||||
Enter your menemonic below or generate a new one.
|
||||
</p>
|
||||
<textarea [(ngModel)]="menemonic" class="clr-textarea" style="margin-top: 24px; width: 100%; height: 200px">{{menemonic}}</textarea>
|
||||
<div class="clr-row">
|
||||
<clr-checkbox-wrapper class="clr-col">
|
||||
<input type="checkbox" clrCheckbox value="testnet" name="testnet1" [(ngModel)]="testnet" />
|
||||
<label>testnet</label>
|
||||
</clr-checkbox-wrapper>
|
||||
<button class="btn btn-outline-success clr-col" (click)="generateMenemonic()">{{"Generate"}}</button>
|
||||
</div>
|
||||
<ng-template clrPageButtons>
|
||||
<clr-wizard-button [type]="'cancel'">Cancel</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'menemonic-next'">{{menemonic.length==0?"Skip":"Next"}}</clr-wizard-button>
|
||||
</ng-template>
|
||||
</clr-wizard-page>
|
||||
|
||||
<clr-wizard-page (clrWizardPageCustomButton)="doCustomClick($event)">
|
||||
<ng-template clrPageTitle>Seed phrase (optional)</ng-template>
|
||||
<ng-template clrPageNavTitle>
|
||||
Seed phrase
|
||||
</ng-template>
|
||||
<p>
|
||||
If you entered a menemonic in the previous step, a seed was generated from it.
|
||||
</p>
|
||||
<p>
|
||||
If you would like to use your own seed enter it below. Use something sufficiently hard to guess.
|
||||
</p>
|
||||
<textarea class="clr-textarea" (ngModelChange)="updateSeed()" [(ngModel)]="seed" style="margin-top: 24px; width: 100%; height: 200px">{{seed}}</textarea>
|
||||
<clr-checkbox-wrapper>
|
||||
<input type="checkbox" clrCheckbox value="testnet" name="testnet2" [(ngModel)]="testnet" />
|
||||
<label>testnet</label>
|
||||
</clr-checkbox-wrapper>
|
||||
<ng-template clrPageButtons>
|
||||
<clr-wizard-button [type]="'cancel'">Cancel</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'back'">Back</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'seed-next'">{{seed.length==0?"Skip":"Next"}}</clr-wizard-button>
|
||||
</ng-template>
|
||||
</clr-wizard-page>
|
||||
|
||||
<clr-wizard-page [clrWizardPageNextDisabled]="keyInvalid" (clrWizardPageCustomButton)="doCustomClick($event)">
|
||||
<ng-template clrPageTitle>Extended Key/BIP32</ng-template>
|
||||
<p>
|
||||
Accepts keys in the xpub and xprv (BIP32) format
|
||||
</p>
|
||||
<textarea [(ngModel)]="key" (ngModelChange)="updateKey()"class="clr-textarea" style="margin-top: 24px; width: 100%; height: 200px"></textarea>
|
||||
</clr-wizard-page>
|
||||
|
||||
<clr-wizard-page class="break-word" (clrWizardPageCustomButton)="doCustomClick($event)">
|
||||
<ng-template clrPageTitle>Confirm</ng-template>
|
||||
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<div class="alert-items">
|
||||
<div class="alert-item static">
|
||||
<div class="alert-icon-wrapper">
|
||||
<clr-icon class="alert-icon" shape="exclamation-circle"></clr-icon>
|
||||
</div>
|
||||
<span class="alert-text">
|
||||
Do not give any of this information to other people! Even your public key holds the power to correlate all your addresses back to you!
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="keypair.privateExtendedKey != null && keypair.privateExtendedKey.length != 0" class="alert alert-warning" role="alert">
|
||||
<div class="alert-items">
|
||||
<div class="alert-item static">
|
||||
<div class="alert-icon-wrapper">
|
||||
<clr-icon class="alert-icon" shape="exclamation-circle"></clr-icon>
|
||||
</div>
|
||||
<span class="alert-text">
|
||||
WARNING: A private key is not required for operating frontblock
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="keypair.privateExtendedKey != null && keypair.privateExtendedKey.length != 0" class="alert alert-info" role="alert">
|
||||
<div class="alert-items">
|
||||
<div class="alert-item static">
|
||||
<div class="alert-icon-wrapper">
|
||||
<clr-icon class="alert-icon" shape="exclamation-circle"></clr-icon>
|
||||
</div>
|
||||
<span class="alert-text">
|
||||
HINT: You can exclusively store the public key by going back one step and importing the xpub you just created
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="left">Type</th>
|
||||
<th class="left">Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngIf="menemonic.length != 0">
|
||||
<td class="left"> menemonic</td>
|
||||
<td class="left">{{menemonic}}</td>
|
||||
</tr>
|
||||
<tr *ngIf="seed.length != 0">
|
||||
<td class="left"> seed</td>
|
||||
<textarea rows="3" class="clr-textarea left" [ngModel]="seed" style="width: 100%"></textarea>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left"> xpub</td>
|
||||
<textarea rows="3" class="clr-textarea left" [ngModel]="keypair.publicExtendedKey" style="width: 100%"></textarea>
|
||||
</tr>
|
||||
<tr *ngIf="keypair.privateExtendedKey != null && keypair.privateExtendedKey.length != 0">
|
||||
<td class="left"> xprv</td>
|
||||
<textarea rows="3" class="clr-textarea left" [ngModel]="keypair.privateExtendedKey" style="width: 100%"></textarea>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<clr-checkbox-wrapper>
|
||||
<input type="checkbox" clrCheckbox value="option1" name="options" />
|
||||
<label>I understand this is important</label>
|
||||
</clr-checkbox-wrapper>
|
||||
<ng-template clrPageButtons>
|
||||
<clr-wizard-button [type]="'cancel'">Cancel</clr-wizard-button>
|
||||
<clr-wizard-button [type]="'back'">Back</clr-wizard-button>
|
||||
<clr-wizard-button class="btn btn-success" [type]="'myfinish'">Finish</clr-wizard-button>
|
||||
</ng-template>
|
||||
</clr-wizard-page>
|
||||
</clr-wizard>
|
||||
|
||||
`
|
||||
})
|
||||
export class WalletGeneratorComponent implements OnInit {
|
||||
@ViewChild("wizard", {static: false}) wizard: ClrWizard;
|
||||
key:string = ""
|
||||
keyInvalid = true
|
||||
accept = false
|
||||
seed:string = ""
|
||||
mdOpen: boolean = false
|
||||
checkKey: boolean = true
|
||||
menemonic:string = ""
|
||||
keypair: any = {}
|
||||
testnet: boolean = false
|
||||
profileName
|
||||
private hdKey = new HDKey()
|
||||
private parent:PluginsComponent
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
open(){
|
||||
this.key = ""
|
||||
this.keyInvalid = true
|
||||
this.seed = ""
|
||||
this.checkKey = true
|
||||
this.menemonic = ""
|
||||
this.keypair = {}
|
||||
this.testnet = false
|
||||
this.wizard.reset()
|
||||
this.mdOpen = true
|
||||
}
|
||||
|
||||
setParent(parent:PluginsComponent){
|
||||
this.parent = parent
|
||||
}
|
||||
|
||||
async generateMenemonic(){
|
||||
this.menemonic = this.hdKey.randomMenemonic()
|
||||
}
|
||||
|
||||
async seedFromMenemonic(){
|
||||
try{
|
||||
this.seed = this.hdKey.seedFromMenemonic(this.menemonic)
|
||||
}catch(e){
|
||||
/* invalid menemonic */
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
async accountFromSeed(){
|
||||
this.keypair = this.hdKey.deriveAccount(this.seed, this.testnet?"testnet":"mainnet", 0)
|
||||
console.log(this.keypair)
|
||||
this.key = this.keypair.privateExtendedKey != null?this.keypair.privateExtendedKey:this.keypair.publicExtendedKey
|
||||
this.keyInvalid = false
|
||||
}
|
||||
|
||||
async importKey(){
|
||||
this.hdKey.HDKeyFromExtendedKey(this.key)
|
||||
}
|
||||
|
||||
checkBip32(){
|
||||
return this.hdKey.checkHDKey(this.keypair.privateExtendedKey != null?this.keypair.privateExtendedKey:this.keypair.publicExtendedKey)
|
||||
}
|
||||
|
||||
finish(){
|
||||
this.parent.addWallet({
|
||||
name: this.key.substr(4,15),
|
||||
key: this.key
|
||||
})
|
||||
}
|
||||
|
||||
public doCustomClick(buttonType: string): void {
|
||||
if ("menemonic-next" === buttonType) {
|
||||
if(this.menemonic.length != 0){
|
||||
this.seedFromMenemonic()
|
||||
}
|
||||
this.wizard.next();
|
||||
}
|
||||
|
||||
if ("myfinish" === buttonType) {
|
||||
this.finish()
|
||||
this.wizard.close()
|
||||
}
|
||||
|
||||
if ("seed-next" === buttonType) {
|
||||
if(this.seed.length != 0){
|
||||
this.accountFromSeed()
|
||||
}
|
||||
this.wizard.next();
|
||||
}
|
||||
|
||||
if ("back" === buttonType) {
|
||||
this.wizard.previous();
|
||||
}
|
||||
}
|
||||
|
||||
updateSeed(){
|
||||
this.menemonic = ""
|
||||
}
|
||||
|
||||
updateKey(){
|
||||
this.keyInvalid = true
|
||||
this.menemonic = ""
|
||||
this.seed = ""
|
||||
let key
|
||||
try{
|
||||
key = this.hdKey.HDKeyFromExtendedKey(this.key)
|
||||
}catch(e){
|
||||
/* invalid key */
|
||||
console.log("bad key")
|
||||
}
|
||||
if(key){
|
||||
this.keypair = key
|
||||
this.keyInvalid = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
|
||||
|
||||
import { Component, OnInit, isDevMode } from '@angular/core';
|
||||
import { PluginsComponent } from './btc.component';
|
||||
declare const fb
|
||||
@Component({
|
||||
selector: 'walletpicker', //!!!!
|
||||
|
||||
template: `
|
||||
<div class="card" style="overflow:hidden; padding-bottom:12px">
|
||||
<div class="card-header">
|
||||
Wallets
|
||||
</div>
|
||||
<clr-alert *ngFor="let entry of alerts" [clrAlertType]="line.severity">
|
||||
<clr-alert-item>
|
||||
<span class="alert-text">
|
||||
{{line.message}}
|
||||
</span>
|
||||
</clr-alert-item>
|
||||
</clr-alert>
|
||||
|
||||
<clr-tree-node style="margin-top:12px; margin-bottom:12px">
|
||||
<a style="cursor:pointer" (click)="parent.showWizard()"><clr-icon shape="download" class="is-solid"></clr-icon> New / Import</a>
|
||||
</clr-tree-node>
|
||||
<clr-tree-node *ngFor="let line of wallets">
|
||||
<a style="cursor:pointer" (click)="parent.loadKey(line.key)">
|
||||
<clr-icon *ngIf="line.key.startsWith('xpub') || line.key.startsWith('tpub')" shape="lock" class="is-solid"></clr-icon>
|
||||
<clr-icon *ngIf="line.key.startsWith('xprv') || line.key.startsWith('tprv')" shape="key" class="is-solid"></clr-icon>
|
||||
{{line.name}}
|
||||
</a>
|
||||
</clr-tree-node>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class WalletPickerComponent implements OnInit {
|
||||
private parent:PluginsComponent
|
||||
wallets = []
|
||||
|
||||
setWallets(wallets){
|
||||
this.wallets = Object.values(wallets)
|
||||
}
|
||||
|
||||
setParent(parent:PluginsComponent){
|
||||
this.parent = parent
|
||||
}
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { PluginsComponent } from './btc/btc.component';
|
||||
import { WalletPickerComponent } from './btc/wallet-picker.component';
|
||||
import { AddressViewerComponent } from './btc/address-viewer.component';
|
||||
|
||||
import { FrontendPlugin, SidebarEntries } from 'frontblock-generic/Plugin';
|
||||
import { ClarityModule } from '@clr/angular';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { WalletGeneratorComponent } from './btc/wallet-generator.component';
|
||||
import { WalletSettingsComponent } from './settings.component';
|
||||
|
||||
// @ts-ignore
|
||||
import { KnexConfigModule } from "../../../knex-config/knex-config.module";
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
FormsModule,
|
||||
ClarityModule,
|
||||
KnexConfigModule,
|
||||
CommonModule,
|
||||
RouterModule.forChild([
|
||||
{path: "btc", component: PluginsComponent},
|
||||
{path: "settings", component: WalletSettingsComponent},
|
||||
|
||||
]),
|
||||
],
|
||||
exports: [RouterModule],
|
||||
declarations: [
|
||||
WalletSettingsComponent,
|
||||
PluginsComponent,
|
||||
WalletPickerComponent,
|
||||
AddressViewerComponent,
|
||||
WalletGeneratorComponent
|
||||
]
|
||||
})
|
||||
export class PluginModule implements FrontendPlugin{
|
||||
getSidebarEntry(): SidebarEntries {
|
||||
return {
|
||||
icon: "wallet",
|
||||
text: "Wallets",
|
||||
parentRoute: "wallet",
|
||||
links: [{
|
||||
route: "btc",
|
||||
text: "BTC Wallet"
|
||||
},{
|
||||
route: "ltc",
|
||||
text: "LTC Wallet"
|
||||
},{
|
||||
route: "eth",
|
||||
text: "ETH Wallet"
|
||||
},{
|
||||
route: "xrp",
|
||||
text: "XRP Wallet"
|
||||
},{
|
||||
route: "xlm",
|
||||
text: "XLM Wallet"
|
||||
},{
|
||||
route: "settings",
|
||||
text: "Settings"
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
|
||||
import { Component, OnInit, isDevMode } from '@angular/core';
|
||||
declare const fb
|
||||
@Component({
|
||||
selector: 'wallet-settings', //!!!!
|
||||
|
||||
template:
|
||||
`
|
||||
<knex-config fbPlugin="Wallet"></knex-config>
|
||||
`
|
||||
})
|
||||
export class WalletSettingsComponent implements OnInit {
|
||||
ngOnInit() { }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
const path = require('path');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
target: "web",
|
||||
entry: path.resolve(__dirname, 'module.ts'),
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../../dist'),
|
||||
filename: 'FrontendPlugin.js',
|
||||
libraryTarget: 'commonjs',
|
||||
},
|
||||
resolve: {
|
||||
// Add `.ts` and `.tsx` as a resolvable extension.
|
||||
extensions: [".ts", ".tsx", ".js"]
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{ test: /\.ts?$/, loader: "ts-loader" }
|
||||
]
|
||||
},
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
exclude: [
|
||||
/\.\/(.*)\/.ts/,
|
||||
/\.\/(.*).ts/,
|
||||
],
|
||||
}),
|
||||
],
|
||||
},
|
||||
externals: {
|
||||
'@angular/core': '@angular/core',
|
||||
'@angular/common': '@angular/common',
|
||||
'@angular/router': '@angular/router',
|
||||
'@angular/animations': '@angular/animations',
|
||||
'@angular/forms': '@angular/forms',
|
||||
'@clr/angular': '@clr/angular',
|
||||
'../../../knex-config/knex-config.module': 'knexconfig'
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["src/frontend"],
|
||||
"exclude": [
|
||||
"src/backend"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"sourceMap": true
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"alwaysStrict": false,
|
||||
"noImplicitAny": false,
|
||||
"target": "ES2015",
|
||||
"module": "commonjs",
|
||||
"declaration": false,
|
||||
"strict": true,
|
||||
"outDir": "./lib",
|
||||
"experimentalDecorators": true,
|
||||
"strictPropertyInitialization": false,
|
||||
"importHelpers": true,
|
||||
"strictNullChecks": false,
|
||||
|
||||
},
|
||||
"include": ["src/backend"],
|
||||
"exclude": []
|
||||
}
|
||||
@@ -10,8 +10,7 @@
|
||||
"src/app/**/*/node_modules/**/*",
|
||||
"src/app/**/*/dist/**/*",
|
||||
"src/app/**/*/backend/**/*",
|
||||
"src/app/**/*/frontend/**/*",
|
||||
"src/app/apiclient/**/*",
|
||||
"src/app/**/*/frontend/**/*"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user