4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-11 17:55:51 +00:00

Remove use strict make api full esm compatible

This commit is contained in:
AlphaX-Projects 2024-05-10 18:00:47 +02:00
parent 3cc5d544a2
commit 0b2bceb842
64 changed files with 9391 additions and 9472 deletions

View File

@ -15,8 +15,8 @@ window.validateAddress = validateAddress
window.decryptChatMessage = decryptChatMessage window.decryptChatMessage = decryptChatMessage
window.decryptChatMessageBase64 = decryptChatMessageBase64 window.decryptChatMessageBase64 = decryptChatMessageBase64
export { initApi, store } from './api_deps.js' export { initApi, store } from './api_deps'
export * from './api/deps/deps.js' export * from './api/deps/deps'
export * from './api/api.js' export * from './api/api'
export * from './api/registerUsername.js' export * from './api/registerUsername'
export { createWallet } from './api/createWallet.js' export { createWallet } from './api/createWallet'

View File

@ -1,15 +1,12 @@
/* /*
Copyright 2017-2018 @ irontiga and vbcs (original developer) Copyright 2017-2018 @ irontiga and vbcs (original developer)
*/ */
'use strict' import Base58 from './deps/Base58'
import Base58 from './deps/Base58.js'
import { Sha256, Sha512 } from 'asmcrypto.js' import { Sha256, Sha512 } from 'asmcrypto.js'
import nacl from './deps/nacl-fast.js' import nacl from './deps/nacl-fast'
import utils from './deps/utils.js' import utils from './deps/utils'
import { generateSaveWalletData } from './storeWallet'
import {generateSaveWalletData} from './storeWallet.js' import publicKeyToAddress from './wallet/publicKeyToAddress'
import publicKeyToAddress from './wallet/publicKeyToAddress.js'
import AltcoinHDWallet from "./bitcoin/AltcoinHDWallet" import AltcoinHDWallet from "./bitcoin/AltcoinHDWallet"
export default class PhraseWallet { export default class PhraseWallet {

View File

@ -1,5 +1,5 @@
export { request } from './fetch-request.js' export { request } from './fetch-request'
export { transactionTypes as transactions } from './transactions/transactions.js' export { transactionTypes as transactions } from './transactions/transactions'
export { processTransaction, processTransactionVersion2, createTransaction, computeChatNonce, signChatTransaction, signArbitraryTransaction, signArbitraryWithFeeTransaction } from './createTransaction.js' export { processTransaction, processTransactionVersion2, createTransaction, computeChatNonce, signChatTransaction, signArbitraryTransaction, signArbitraryWithFeeTransaction } from './createTransaction'
export { tradeBotCreateRequest, tradeBotRespondRequest, signTradeBotTxn, deleteTradeOffer, sendBtc, sendLtc, sendDoge, sendDgb, sendRvn, sendArrr } from './tradeRequest.js' export { tradeBotCreateRequest, tradeBotRespondRequest, signTradeBotTxn, deleteTradeOffer, sendBtc, sendLtc, sendDoge, sendDgb, sendRvn, sendArrr } from './tradeRequest'
export { cancelAllOffers } from './transactions/trade-portal/tradeoffer/cancelAllOffers.js' export { cancelAllOffers } from './transactions/trade-portal/tradeoffer/cancelAllOffers'

View File

@ -1,10 +1,9 @@
'use strict'; import Base58 from '../deps/Base58'
import Base58 from '../deps/Base58.js'
import { Sha256, Sha512 } from 'asmcrypto.js' import { Sha256, Sha512 } from 'asmcrypto.js'
import jsSHA from 'jssha' import jsSHA from 'jssha'
import RIPEMD160 from '../deps/ripemd160.js' import RIPEMD160 from '../deps/ripemd160'
import utils from '../deps/utils.js' import utils from '../deps/utils'
import {BigInteger, EllipticCurve} from './ecbn.js' import { BigInteger, EllipticCurve } from './ecbn'
export default class AltcoinHDWallet { export default class AltcoinHDWallet {
@ -250,8 +249,7 @@ export default class AltcoinHDWallet {
const indicatorString = utils.stringtoUTF8Array(indicator) const indicatorString = utils.stringtoUTF8Array(indicator)
buffer = utils.appendBuffer(seed.reverse(), indicatorString) buffer = utils.appendBuffer(seed.reverse(), indicatorString)
} }
else else {
{
buffer = seed.reverse() buffer = seed.reverse()
} }
} }
@ -506,7 +504,6 @@ export default class AltcoinHDWallet {
const childPublicKeySHA256 = new Sha256().process(new Uint8Array(this.childPublicKey)).finish().result const childPublicKeySHA256 = new Sha256().process(new Uint8Array(this.childPublicKey)).finish().result
this.childPublicKeyHash = new RIPEMD160().update(Buffer.from(childPublicKeySHA256)).digest('hex') this.childPublicKeyHash = new RIPEMD160().update(Buffer.from(childPublicKeySHA256)).digest('hex')
// Call deriveExtendedPublicChildKey // WIll be hardcoding the values... // Call deriveExtendedPublicChildKey // WIll be hardcoding the values...
deriveExtendedPublicChildKey(1, 0) deriveExtendedPublicChildKey(1, 0)
} }
@ -524,15 +521,12 @@ export default class AltcoinHDWallet {
const _hmacSha512 = new jsSHA("SHA-512", "UINT8ARRAY", { numRounds: 1, hmacKey: { value: this.chainCode, format: "UINT8ARRAY" } }) const _hmacSha512 = new jsSHA("SHA-512", "UINT8ARRAY", { numRounds: 1, hmacKey: { value: this.chainCode, format: "UINT8ARRAY" } })
_hmacSha512.update(new Uint8Array(s)) _hmacSha512.update(new Uint8Array(s))
const IL = BigInteger.fromByteArrayUnsigned([..._hmacSha512.getHMAC('UINT8ARRAY').slice(0, 32)]) const IL = BigInteger.fromByteArrayUnsigned([..._hmacSha512.getHMAC('UINT8ARRAY').slice(0, 32)])
this.childChainCode = _hmacSha512.getHMAC('UINT8ARRAY').slice(32, 64) // IR according to the SPEC this.childChainCode = _hmacSha512.getHMAC('UINT8ARRAY').slice(32, 64) // IR according to the SPEC
// SECP256k1 init // SECP256k1 init
const epCurve = EllipticCurve.getSECCurveByName("secp256k1") const epCurve = EllipticCurve.getSECCurveByName("secp256k1")
const ki = IL.add(BigInteger.fromByteArrayUnsigned(this.privateKey)).mod(epCurve.getN()) // parse256(IL) + kpar (mod n) ==> ki const ki = IL.add(BigInteger.fromByteArrayUnsigned(this.privateKey)).mod(epCurve.getN()) // parse256(IL) + kpar (mod n) ==> ki
this.childPrivateKey = ki.toByteArrayUnsigned() this.childPrivateKey = ki.toByteArrayUnsigned()
@ -653,7 +647,6 @@ export default class AltcoinHDWallet {
this.grandChildPublicKey.unshift(0x03) // append point indicator this.grandChildPublicKey.unshift(0x03) // append point indicator
} }
// PublicKey Hash // PublicKey Hash
const grandChildPublicKeySHA256 = new Sha256().process(new Uint8Array(this.grandChildPublicKey)).finish().result const grandChildPublicKeySHA256 = new Sha256().process(new Uint8Array(this.grandChildPublicKey)).finish().result
this.grandChildPublicKeyHash = new RIPEMD160().update(Buffer.from(grandChildPublicKeySHA256)).digest('hex') this.grandChildPublicKeyHash = new RIPEMD160().update(Buffer.from(grandChildPublicKeySHA256)).digest('hex')
@ -734,7 +727,6 @@ export default class AltcoinHDWallet {
deriveExtendedPrivateGrandChildKey(2, 0) deriveExtendedPrivateGrandChildKey(2, 0)
} }
const deriveExtendedPrivateGrandChildKey = (i, childIndex) => { const deriveExtendedPrivateGrandChildKey = (i, childIndex) => {
// Serialization Variable // Serialization Variable
@ -816,8 +808,6 @@ export default class AltcoinHDWallet {
this.xPublicGrandChildKey = Base58.encode(s) this.xPublicGrandChildKey = Base58.encode(s)
} }
// Hard Code value.. // Hard Code value..
let childIndex = 0 let childIndex = 0
@ -845,10 +835,6 @@ export default class AltcoinHDWallet {
_tDerivedMasterPrivateKey: this._tMasterPrivateKey, _tDerivedMasterPrivateKey: this._tMasterPrivateKey,
_tDerivedmasterPublicKey: this._tmasterPublicKey, _tDerivedmasterPublicKey: this._tmasterPublicKey,
seed58: this.seed58, seed58: this.seed58,
// derivedPrivateChildKey: this.xPrivateChildKey,
// derivedPublicChildKey: this.xPublicChildKey,
// derivedPrivateGrandChildKey: this.xPrivateGrandChildKey,
// derivedPublicGrandChildKey: this.xPublicGrandChildKey,
address: this.litecoinLegacyAddress, address: this.litecoinLegacyAddress,
_taddress: this._tlitecoinLegacyAddress _taddress: this._tlitecoinLegacyAddress
} }

View File

@ -6,8 +6,6 @@
*/ */
(function () { (function () {
// Copyright (c) 2005 Tom Wu // Copyright (c) 2005 Tom Wu
// All Rights Reserved. // All Rights Reserved.
// See "LICENSE" for details. // See "LICENSE" for details.
@ -1862,8 +1860,6 @@
} }
rng_pptr = 0; rng_pptr = 0;
rng_seed_time(); rng_seed_time();
//rng_seed_int(window.screenX);
//rng_seed_int(window.screenY);
} }
function rng_get_byte() { function rng_get_byte() {
@ -1874,7 +1870,6 @@
for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)
rng_pool[rng_pptr] = 0; rng_pool[rng_pptr] = 0;
rng_pptr = 0; rng_pptr = 0;
//rng_pool = null;
} }
// TODO: allow reseeding after first request // TODO: allow reseeding after first request
return rng_state.next(); return rng_state.next();
@ -1890,7 +1885,6 @@
SecureRandom.prototype.nextBytes = rng_get_bytes; SecureRandom.prototype.nextBytes = rng_get_bytes;
// prng4.js - uses Arcfour as a PRNG // prng4.js - uses Arcfour as a PRNG
function Arcfour() { function Arcfour() {
this.i = 0; this.i = 0;
this.j = 0; this.j = 0;
@ -1934,9 +1928,6 @@
// An array of bytes the size of the pool will be passed to init() // An array of bytes the size of the pool will be passed to init()
var rng_psize = 256; var rng_psize = 256;
/*! /*!
* Basic Javascript Elliptic Curve implementation * Basic Javascript Elliptic Curve implementation
* Ported loosely from BouncyCastle's Java EC code * Ported loosely from BouncyCastle's Java EC code
@ -1949,7 +1940,6 @@
// Constructor function of Global EllipticCurve object // Constructor function of Global EllipticCurve object
var ec = function () { }; var ec = function () { };
// ---------------- // ----------------
// ECFieldElementFp constructor // ECFieldElementFp constructor
// q instanceof BigInteger // q instanceof BigInteger
@ -2391,7 +2381,6 @@
return R; return R;
}; };
ec.PointFp.prototype.isOnCurve = function () { ec.PointFp.prototype.isOnCurve = function () {
var x = this.getX().toBigInteger(); var x = this.getX().toBigInteger();
var y = this.getY().toBigInteger(); var y = this.getY().toBigInteger();
@ -2444,9 +2433,6 @@
return true; return true;
}; };
// ---------------- // ----------------
// ECCurveFp constructor // ECCurveFp constructor
ec.CurveFp = function (q, a, b) { ec.CurveFp = function (q, a, b) {

View File

@ -1853,8 +1853,6 @@
} }
rng_pptr = 0; rng_pptr = 0;
rng_seed_time(); rng_seed_time();
//rng_seed_int(window.screenX);
//rng_seed_int(window.screenY);
} }
function rng_get_byte() { function rng_get_byte() {
@ -1865,7 +1863,6 @@
for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)
rng_pool[rng_pptr] = 0; rng_pool[rng_pptr] = 0;
rng_pptr = 0; rng_pptr = 0;
//rng_pool = null;
} }
// TODO: allow reseeding after first request // TODO: allow reseeding after first request
return rng_state.next(); return rng_state.next();

View File

@ -1,5 +1,3 @@
'use strict'
// Qortal TX types // Qortal TX types
const TX_TYPES = { const TX_TYPES = {
1: "Genesis", 1: "Genesis",

View File

@ -1,9 +1,9 @@
import {transactionTypes as transactions} from './transactions/transactions.js' import { transactionTypes as transactions } from './transactions/transactions'
import Base58 from './deps/Base58.js' import Base58 from './deps/Base58'
import { request } from './fetch-request' import { request } from './fetch-request'
import signChat from './transactions/chat/signChat.js' import signChat from './transactions/chat/signChat'
import signArbitrary from './transactions/arbitrary/signArbitrary.js' import signArbitrary from './transactions/arbitrary/signArbitrary'
import signArbitraryWithFee from './transactions/arbitrary/signArbitraryWithFee.js' import signArbitraryWithFee from './transactions/arbitrary/signArbitraryWithFee'
export const createTransaction = (type, keyPair, params) => { export const createTransaction = (type, keyPair, params) => {
const tx = new transactions[type]() const tx = new transactions[type]()

View File

@ -1,7 +1,7 @@
import {kdf} from './kdf.js' import { kdf } from './kdf'
import PhraseWallet from './PhraseWallet.js' import PhraseWallet from './PhraseWallet'
import Base58 from './deps/Base58.js' import Base58 from './deps/Base58'
import {decryptStoredWallet} from './decryptStoredWallet.js' import { decryptStoredWallet } from './decryptStoredWallet'
export const createWallet = async (sourceType, source, statusUpdateFn) => { export const createWallet = async (sourceType, source, statusUpdateFn) => {
let version, seed let version, seed

View File

@ -1,5 +1,5 @@
import Base58 from './deps/Base58.js' import Base58 from './deps/Base58'
import {kdf} from './kdf.js' import { kdf } from './kdf'
import { AES_CBC, HmacSha512 } from 'asmcrypto.js' import { AES_CBC, HmacSha512 } from 'asmcrypto.js'
import { get, registerTranslateConfig } from '../../core/translate' import { get, registerTranslateConfig } from '../../core/translate'

View File

@ -1,10 +1,6 @@
// Generated by CoffeeScript 1.8.0 // Generated by CoffeeScript 1.8.0
// == Changed for ES6 modules == // // == Changed for ES6 modules == //
//(function() {
//var ALPHABET, ALPHABET_MAP, Base58, i;
//const Base58 = (typeof module !== "undefined" && module !== null ? module.exports : void 0) || (window.Base58 = {});
const Base58 = {}; const Base58 = {};
const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
@ -101,8 +97,5 @@ while (string[i] === "1" && i < string.length - 1) {
return new (typeof Uint8Array !== "undefined" && Uint8Array !== null ? Uint8Array : Buffer)(bytes.reverse()); return new (typeof Uint8Array !== "undefined" && Uint8Array !== null ? Uint8Array : Buffer)(bytes.reverse());
}; };
// == Changed for ES6 modules == // // == Changed for ES6 modules == //
//}).call(this);
export default Base58; export default Base58;

View File

@ -1,8 +1,6 @@
const Base64 = {}; const Base64 = {};
Base64.decode = function (string) { Base64.decode = function (string) {
const binaryString = atob(string); const binaryString = atob(string);
@ -17,7 +15,4 @@ Base64.decode = function (string) {
return decoder.decode(bytes); return decoder.decode(bytes);
}; };
export default Base64; export default Base64;

View File

@ -41,7 +41,8 @@
(global["dcodeIO"] = global["dcodeIO"] || {})["bcrypt"] = factory(); (global["dcodeIO"] = global["dcodeIO"] || {})["bcrypt"] = factory();
}(this, function () { }(this, function () {
"use strict"; // == Changed for ESM support == //
// "use strict";
/** /**
* bcrypt namespace. * bcrypt namespace.
@ -492,7 +493,8 @@
* see: https://github.com/dcodeIO/utfx for details * see: https://github.com/dcodeIO/utfx for details
*/ */
var utfx = function () { var utfx = function () {
"use strict"; // == Changed for ESM support == //
// "use strict";
/** /**
* utfx namespace. * utfx namespace.

View File

@ -1,6 +1,5 @@
// "Generated from Java with JSweet 1.0.0 - http://www.jsweet.org"; // "Generated from Java with JSweet 1.0.0 - http://www.jsweet.org";
// BAD IMPLEMENTATION. BROKEN, BUT MUST KEEP CAUSE OF NETWORK // BAD IMPLEMENTATION. BROKEN, BUT MUST KEEP CAUSE OF NETWORK
//const RIPEMD160 = (function () {
// == Convert to ES6 module for export == // // == Convert to ES6 module for export == //
const RIPEMD160 = (function () { const RIPEMD160 = (function () {
function RIPEMD160() { function RIPEMD160() {

View File

@ -1,3 +1,2 @@
export { default as Base58 } from './Base58.js' export { default as Base58 } from './Base58'
export { default as utils } from './utils'
export { default as utils } from './utils.js'

View File

@ -10,15 +10,7 @@
Change to es6 import/export Change to es6 import/export
*/ */
import nacl from './nacl-fast.js' import nacl from './nacl-fast'
// (function(root, f) {
// 'use strict';
// if (typeof module !== 'undefined' && module.exports) module.exports = f(require('tweetnacl'));
// else root.ed2curve = f(root.nacl);
// }(this, function(nacl) {
// 'use strict';
// if (!nacl) throw new Error('tweetnacl not loaded');
// -- Operations copied from TweetNaCl.js. -- // -- Operations copied from TweetNaCl.js. --
@ -249,16 +241,8 @@ import nacl from './nacl-fast.js'
}; };
} }
// return {
// convertPublicKey: convertPublicKey,
// convertSecretKey: convertSecretKey,
// convertKeyPair: convertKeyPair,
// };
export default { export default {
convertPublicKey: convertPublicKey, convertPublicKey: convertPublicKey,
convertSecretKey: convertSecretKey, convertSecretKey: convertSecretKey,
convertKeyPair: convertKeyPair, convertKeyPair: convertKeyPair,
} }
// }));

View File

@ -1,7 +1,5 @@
// == CHANGE TO ES6 EXPORT == // // == CHANGE TO ES6 EXPORT == //
const nacl = {} const nacl = {}
//(function(nacl) {
'use strict';
// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
// Public domain. // Public domain.
@ -2418,5 +2416,4 @@ nacl.setPRNG = function(fn) {
})(); })();
// == CHANGE TO ES6 EXPORT == // // == CHANGE TO ES6 EXPORT == //
//})(typeof module !== 'undefined' && module.exports ? module.exports : (window.nacl = window.nacl || {}));
export default nacl export default nacl

View File

@ -26,8 +26,7 @@ const TYPES = {
MESSAGE_TRANSACTION: 17 MESSAGE_TRANSACTION: 17
}; };
function getKeyPairFromSeed(seed, returnBase58) function getKeyPairFromSeed(seed, returnBase58) {
{
if (typeof (seed) == "string") { if (typeof (seed) == "string") {
seed = new Uint8Array(Base58.decode(seed)); seed = new Uint8Array(Base58.decode(seed));
} }
@ -90,20 +89,17 @@ function appendBuffer (buffer1, buffer2) {
return tmp; return tmp;
} }
function equal (buf1, buf2) function equal(buf1, buf2) {
{
if (buf1.byteLength != buf2.byteLength) return false; if (buf1.byteLength != buf2.byteLength) return false;
var dv1 = new Uint8Array(buf1); var dv1 = new Uint8Array(buf1);
var dv2 = new Uint8Array(buf2); var dv2 = new Uint8Array(buf2);
for (var i = 0; i != buf1.byteLength; i++) for (var i = 0; i != buf1.byteLength; i++) {
{
if (dv1[i] != dv2[i]) return false; if (dv1[i] != dv2[i]) return false;
} }
return true; return true;
} }
function generateAccountSeed(seed, nonce, returnBase58) function generateAccountSeed(seed, nonce, returnBase58) {
{
if (typeof (seed) == "string") { if (typeof (seed) == "string") {
seed = Base58.decode(seed); seed = Base58.decode(seed);
} }
@ -124,8 +120,7 @@ function generateAccountSeed(seed, nonce, returnBase58)
} }
function getAccountAddressFromPublicKey(publicKey) function getAccountAddressFromPublicKey(publicKey) {
{
var ADDRESS_VERSION = 58; // Q var ADDRESS_VERSION = 58; // Q
if (typeof (publicKey) == "string") { if (typeof (publicKey) == "string") {
@ -150,8 +145,7 @@ function getAccountAddressFromPublicKey(publicKey)
return Base58.encode(addressArray); return Base58.encode(addressArray);
} }
function getAccountAddressType(address) function getAccountAddressType(address) {
{
try { try {
var ADDRESS_VERSION = 58; // Q var ADDRESS_VERSION = 58; // Q
var AT_ADDRESS_VERSION = 23; // A var AT_ADDRESS_VERSION = 23; // A
@ -166,14 +160,11 @@ function getAccountAddressType(address)
var checkSumTwo = SHA256.digest(SHA256.digest(addressWitoutChecksum)); var checkSumTwo = SHA256.digest(SHA256.digest(addressWitoutChecksum));
checkSumTwo = checkSumTwo.subarray(0, 4); checkSumTwo = checkSumTwo.subarray(0, 4);
if (equal(checkSum, checkSumTwo)) if (equal(checkSum, checkSumTwo)) {
{ if (address[0] == ADDRESS_VERSION) {
if(address[0] == ADDRESS_VERSION)
{
return "standard"; return "standard";
} }
if(address[0] == AT_ADDRESS_VERSION) if (address[0] == AT_ADDRESS_VERSION) {
{
return "at"; return "at";
} }
} }
@ -185,8 +176,7 @@ function getAccountAddressType(address)
} }
} }
function isValidAddress(address) function isValidAddress(address) {
{
return (getAccountAddressType(address) != "invalid"); return (getAccountAddressType(address) != "invalid");
} }

View File

@ -1,5 +1,7 @@
// Extracted from https://github.com/crypto-browserify/ripemd160 // Extracted from https://github.com/crypto-browserify/ripemd160
const ARRAY16 = new Array(16); const ARRAY16 = new Array(16);
const zl = initU8Array([ const zl = initU8Array([
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,

View File

@ -137,6 +137,5 @@ SHA256.hash = function(message) {
return hex; return hex;
} }
// == Convert to ES6 Module == // // == Convert to ES6 Module == //
export default SHA256; export default SHA256;

View File

@ -1,4 +1,3 @@
'use strict'
const utils = { const utils = {
int32ToBytes(word) { int32ToBytes(word) {
var byteArray = [] var byteArray = []

View File

@ -1,4 +1,4 @@
import {waitForConfig, watchConfig} from '../config.js' import { waitForConfig, watchConfig } from '../config'
let config = {} let config = {}

View File

@ -1,7 +1,7 @@
import {store} from '../api_deps.js' import { store } from '../api_deps'
import {stateAwait} from './utils/stateAwait.js' import { stateAwait } from './utils/stateAwait'
import { Sha512 } from 'asmcrypto.js' import { Sha512 } from 'asmcrypto.js'
import utils from '../api/deps/utils.js' import utils from '../api/deps/utils'
import { get, registerTranslateConfig } from '../../core/translate' import { get, registerTranslateConfig } from '../../core/translate'
registerTranslateConfig({ registerTranslateConfig({

View File

@ -1,7 +1,7 @@
/** /**
* Not to be confused with register name...this is a special use case * Not to be confused with register name...this is a special use case
*/ */
import {createTransaction, processTransaction, request} from './api.js' import { createTransaction, processTransaction, request } from './api'
const TX_TYPE = 3 // NAME_REGISTRATION const TX_TYPE = 3 // NAME_REGISTRATION
const CHECK_LAST_REF_INTERVAL = 30 * 1000 // err 30 seconds const CHECK_LAST_REF_INTERVAL = 30 * 1000 // err 30 seconds

View File

@ -1,6 +1,6 @@
import { AES_CBC, HmacSha512 } from 'asmcrypto.js' import { AES_CBC, HmacSha512 } from 'asmcrypto.js'
import {kdf} from './kdf.js' import { kdf } from './kdf'
import Base58 from './deps/Base58.js' import Base58 from './deps/Base58'
const getRandomValues = window.crypto ? window.crypto.getRandomValues.bind(window.crypto) : window.msCrypto.getRandomValues.bind(window.msCrypto) const getRandomValues = window.crypto ? window.crypto.getRandomValues.bind(window.crypto) : window.msCrypto.getRandomValues.bind(window.msCrypto)

View File

@ -1,8 +1,8 @@
// Trade Bot // Trade Bot
import TradeBotCreateRequest from './transactions/trade-portal/tradebot/TradeBotCreateRequest.js' import TradeBotCreateRequest from './transactions/trade-portal/tradebot/TradeBotCreateRequest'
import TradeBotRespondRequest from './transactions/trade-portal/tradebot/TradeBotRespondRequest.js' import TradeBotRespondRequest from './transactions/trade-portal/tradebot/TradeBotRespondRequest'
import signTradeBotTransaction from './transactions/trade-portal/tradebot/signTradeBotTransaction.js' import signTradeBotTransaction from './transactions/trade-portal/tradebot/signTradeBotTransaction'
import DeleteTradeOffer from './transactions/trade-portal/tradeoffer/DeleteTradeOffer.js' import DeleteTradeOffer from './transactions/trade-portal/tradeoffer/DeleteTradeOffer'
import { request } from './fetch-request' import { request } from './fetch-request'
// TradeBotCreateRequest // TradeBotCreateRequest

View File

@ -1,5 +1,3 @@
'use strict'
(function () { (function () {
function generateSignatureArbitraryTransactionV3(keyPair, lastReference, service, arbitraryData, fee, timestamp) => { function generateSignatureArbitraryTransactionV3(keyPair, lastReference, service, arbitraryData, fee, timestamp) => {
const data = generateArbitraryTransactionV3Base(keyPair.publicKey, lastReference, service, arbitraryData, fee, timestamp) const data = generateArbitraryTransactionV3Base(keyPair.publicKey, lastReference, service, arbitraryData, fee, timestamp)

View File

@ -106,7 +106,7 @@ export default class CreatePollTransaction extends TransactionBase {
params.push(this._options[i].length, this._options[i].bytes) params.push(this._options[i].length, this._options[i].bytes)
} }
params.push(this._feeBytes); params.push(this._feeBytes)
return params return params
} }

View File

@ -1,5 +1,3 @@
'use strict'
(function () { (function () {
function generateSignatureRegisterNameTransaction(keyPair, lastReference, owner, name, value, fee, timestamp) => { function generateSignatureRegisterNameTransaction(keyPair, lastReference, owner, name, value, fee, timestamp) => {
const data = generateRegisterNameTransactionBase(keyPair.publicKey, lastReference, owner, name, value, fee, timestamp) const data = generateRegisterNameTransactionBase(keyPair.publicKey, lastReference, owner, name, value, fee, timestamp)

View File

@ -1,4 +1,4 @@
import {store} from '../../api.js' import { store } from '../../api'
let subscriptions = [] let subscriptions = []

View File

@ -1,5 +1,5 @@
import publicKeyToAddress from './publicKeyToAddress' import publicKeyToAddress from './publicKeyToAddress'
import Base58 from '../deps/Base58.js' import Base58 from '../deps/Base58'
export const base58PublicKeyToAddress = (base58pubkey, qora = false) => { export const base58PublicKeyToAddress = (base58pubkey, qora = false) => {
const decodePubKey = Base58.decode(base58pubkey) const decodePubKey = Base58.decode(base58pubkey)

View File

@ -1,8 +1,8 @@
import Base58 from '../deps/Base58.js' import Base58 from '../deps/Base58'
import BROKEN_RIPEMD160 from '../deps/broken-ripemd160.js' import BROKEN_RIPEMD160 from '../deps/broken-ripemd160'
import RIPEMD160 from '../deps/ripemd160.js' import RIPEMD160 from '../deps/ripemd160'
import utils from '../deps/utils.js' import utils from '../deps/utils'
import {ADDRESS_VERSION} from '../constants.js' import { ADDRESS_VERSION } from '../constants'
import { Buffer } from 'buffer' import { Buffer } from 'buffer'
import { Sha256 } from 'asmcrypto.js' import { Sha256 } from 'asmcrypto.js'

View File

@ -1,8 +1,8 @@
import Base58 from '../deps/Base58.js' import Base58 from '../deps/Base58'
export const validateAddress = (address) => { export const validateAddress = (address) => {
const decodePubKey = Base58.decode(address) const decodePubKey = Base58.decode(address)
return decodePubKey instanceof Uint8Array && decodePubKey.length == 25; return decodePubKey instanceof Uint8Array && decodePubKey.length == 25
} }

View File

@ -1,4 +1,4 @@
import {store} from './api.js' import { store } from './api'
let config = false let config = false
let loaded = false let loaded = false