Added NANO currency

This commit is contained in:
Joohansson
2020-08-26 11:57:58 +02:00
parent 863eee8ed7
commit e086305895
10 changed files with 4258 additions and 11 deletions

View File

@@ -80,6 +80,23 @@ module.exports.stellarUtil = {
},
}
/* nano-util */
let NanoBase = require('nanocurrency-web');
module.exports.nanoUtil = {
getKeypair: function (index, seed) {
const accounts = NanoBase.wallet.accounts(seed, index, index)
return {privKey: accounts[0].privateKey, pubKey: accounts[0].publicKey, address: accounts[0].address};
},
dummyNetwork: {
bip32: {public: 0, private: 0},
messagePrefix: '',
pubKeyHash: 0,
scriptHash: 0,
wif: 0,
},
}
/* unorm */
module.exports.unorm = require('unorm')

File diff suppressed because it is too large Load Diff

View File

@@ -12,17 +12,18 @@
"bip38grs": "git://github.com/Groestlcoin/bip38grs.git#091975b01679b74dc0a4136bb743fe17791b0151",
"bitcoinjs-lib": "git://github.com/iancoleman/bitcoinjs-lib.git#v3.3.2_16bit",
"bs58": "^4.0.1",
"buffer": "5.4.3",
"buffer": "^5.4.3",
"create-hash": "^1.2.0",
"ed25519-hd-key": "^1.0.0",
"elastos-wallet-js": "git://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript.git#491dc51b64efaf0a8aae62028b68e2c8e38fde06",
"ethereumjs-util": "6.0.0",
"handshake-util": "1.2.0",
"fast-levenshtein": "2.0.6",
"groestlcoinjs-lib": "git://github.com/Groestlcoin/groestlcoinjs-lib.git#3.3.2",
"handshake-util": "1.2.0",
"javascript-biginteger": "0.9.2",
"jsrsasign": "^8.0.15",
"kjua": "0.6.0",
"nanocurrency-web": "^1.2.2",
"nebulas": "0.5.6",
"stellar-base": "^0.10.0",
"unorm": "1.6.0",

View File

@@ -0,0 +1,15 @@
const NanoBase = require('nanocurrency-web');
window.nanoUtil = {
getKeypair: function (index, seed) {
const accounts = NanoBase.wallet.accounts(seed, index, index)
return {privKey: accounts[0].privateKey, pubKey: accounts[0].publicKey, address: accounts[0].address};
},
dummyNetwork: {
bip32: {public: 0, private: 0},
messagePrefix: '',
pubKeyHash: 0,
scriptHash: 0,
wif: 0,
},
}

1614
libs/nanocurrency-web/package-lock.json generated Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
{
"name": "nano-util",
"version": "0.0.1",
"scripts": {
"build": "browserify nano-util.js > /tmp/nano-util.js"
},
"dependencies": {
"nanocurrency-web": "^1.2.2"
},
"devDependencies": {
"browserify": "^16.2.3",
"uglify-es": "^3.3.9"
}
}

View File

@@ -0,0 +1,4 @@
Build (will create a bundle and copy it to /tmp/nano-util.js):
npm install
npm run build

2
src/js/bip39-libs.js Normal file → Executable file

File diff suppressed because one or more lines are too long

View File

@@ -1186,6 +1186,15 @@
privkey = keypair.secret();
pubkey = address = keypair.publicKey();
}
// Nano currency
if (networks[DOM.network.val()].name == "NANO - Nano") {
var nanoKeypair = libs.nanoUtil.getKeypair(index, seed);
privkey = nanoKeypair.privKey;
pubkey = nanoKeypair.pubKey;
address = nanoKeypair.address;
}
if ((networks[DOM.network.val()].name == "NAS - Nebulas")) {
var privKeyBuffer = keyPair.d.toBuffer(32);
var nebulasAccount = libs.nebulas.Account.NewAccount();
@@ -2834,6 +2843,13 @@
setHdCoin(184);
},
},
{
name: "NANO - Nano",
onSelect: function() {
network = network = libs.nanoUtil.dummyNetwork;
setHdCoin(165);
},
},
{
name: "NAV - Navcoin",
onSelect: function() {

View File

@@ -2155,6 +2155,16 @@ it('Allows selection of Stellar', function(done) {
};
testNetwork(done, params);
});
it('Allows selection of Nano', function(done) {
var params = {
selectText: "NANO - Nano",
phrase: "deal wedding panda forum property artist whip total word student sea middle",
firstAddress: "nano_15fum9n68681dz73qyu37fuc9tro84gqm86eptdqpm9jutkfnt34agkoqpw5",
firstPubKey: "0DBB99E84310C05FCA1BFB612B76A3EB15309D79988CB6977B4CF1DEA4DA6822",
firstPrivKey: "30633C8497CC47E0AEFD52C7971FFD45E6C5D166274C7978FECA3482A859C0AF",
};
testNetwork(done, params);
});
it('Allows selection of Wagerr', function(done) {
var params = {
selectText: "WGR - Wagerr",