Merge pull request #18 from sairajzero/master

testnet fixes
This commit is contained in:
Sai Raj 2023-02-24 18:51:13 +05:30 committed by GitHub
commit 948a58c901
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 12 deletions

View File

@ -1,4 +1,4 @@
(function (EXPORTS) { //floCrypto v2.3.5
(function (EXPORTS) { //floCrypto v2.3.5a
/* FLO Crypto Operators */
'use strict';
const floCrypto = EXPORTS;
@ -234,7 +234,7 @@
floCrypto.getMultisigAddress = function (publicKeyList, requiredSignatures) {
if (!Array.isArray(publicKeyList) || !publicKeyList.length)
return null;
if (!Number.isInteger(requiredSignatures) || requiredSignatures < 1)
if (!Number.isInteger(requiredSignatures) || requiredSignatures < 1 || requiredSignatures > publicKeyList.length)
return null;
try {
var multisig = bitjs.pubkeys2multisig(publicKeyList, requiredSignatures);

View File

@ -11,6 +11,21 @@
application: "TEST_MODE",
}
</script>
<script>
(function () {
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
if ('testnet' in params) {
floGlobals.blockchain = "FLO_TEST";
floGlobals.adminID = "oKKHdK5uYAJ52U91sYsWhnEaEAAhZP779B";
floGlobals.application = "TEST_MODE_testnet";
}
if ('quick' in params)
window.quick = true;
})();
</script>
<script src="lib.js"></script>
<script src="floCrypto.js"></script>
<script src="btcOperator.js"></script>
@ -21,7 +36,7 @@
<script src="floDapps.js"></script>
<script id="onLoadStartUp">
function onLoadStartUp() {
if (window.quick) return;
//floDapps.addStartUpFunction('Sample', Promised Function)
//floDapps.setAppObjectStores({sampleObs1:{}, sampleObs2:{options{autoIncrement:true, keyPath:'SampleKey'}, Indexes:{sampleIndex:{}}}})
//floDapps.setCustomPrivKeyInput( () => { FUNCTION BODY *must resolve private key* } )

23
lib.js
View File

@ -1,4 +1,4 @@
(function (GLOBAL) { //lib v1.4.2
(function (GLOBAL) { //lib v1.4.2a
'use strict';
/* Utility Libraries required for Standard operations
* All credits for these codes belong to their respective creators, moderators and owners.
@ -4355,6 +4355,12 @@
bitjs.multisig = 0x5e; //flochange - prefix for FLO Mainnet Multisig 0x5e
bitjs.compressed = false;
if (GLOBAL.cryptocoin == 'FLO_TEST') {
bitjs.pub = 0x73; // flochange - changed the prefix to FLO TestNet PublicKey Prefix 0x73
bitjs.priv = 0xa3; //flochange - changed the prefix to FLO TestNet Private key prefix 0xa3
bitjs.multisig = 0xc6; //flochange - prefix for FLO TestNet Multisig 0xc6
}
/* provide a privkey and return an WIF */
bitjs.privkey2wif = function (h) {
var r = Crypto.util.hexToBytes(h);
@ -5301,23 +5307,22 @@
if ("string" == typeof bytes) {
var d = Bitcoin.Address.decodeString(bytes);
bytes = d.hash;
if (GLOBAL.cryptocoin == "FLO" && (d.version == Bitcoin.Address.standardVersion || d.version == Bitcoin.Address.multisigVersion))
this.version = d.version;
else if (GLOBAL.cryptocoin == "FLO_TEST" && d.version == Bitcoin.Address.testnetVersion)
if (d.version == Bitcoin.Address.standardVersion || d.version == Bitcoin.Address.multisigVersion)
this.version = d.version;
else throw "Version (prefix) " + d.version + " not supported!";
} else {
if (GLOBAL.cryptocoin == "FLO")
this.version = Bitcoin.Address.standardVersion;
else if (GLOBAL.cryptocoin == "FLO_TEST")
this.version = Bitcoin.Address.testnetVersion; // FLO testnet public address
this.version = Bitcoin.Address.standardVersion;
}
this.hash = bytes;
};
Bitcoin.Address.standardVersion = 0x23; // (FLO mainnet 0x23, 35D), (Bitcoin Mainnet, 0x00, 0D)
Bitcoin.Address.multisigVersion = 0x5e; // (FLO multisig 0x5e, 94D)
Bitcoin.Address.testnetVersion = 0x73; // (FLO testnet 0x73, 115D)
if (GLOBAL.cryptocoin == "FLO_TEST") {
Bitcoin.Address.standardVersion = 0x73; // (FLO testnet 0x73, 115D), (Bitcoin Mainnet, 0x00, 0D)
Bitcoin.Address.multisigVersion = 0xc6; // (FLO testnet multisig 0xc6, 198D)
}
/**
* Serialize this object as a standard Bitcoin address.