mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-07-31 14:11:45 +00:00
Inline variables ( reduce redudancy )
This commit is contained in:
@@ -309,8 +309,7 @@ export default class AltcoinHDWallet {
|
||||
|
||||
// PublicKey Hash
|
||||
const publicKeySHA256 = new Sha256().process(new Uint8Array(this.publicKey)).finish().result
|
||||
const _publicKeyHash = new RIPEMD160().update(Buffer.from(publicKeySHA256)).digest('hex')
|
||||
this.publicKeyHash = _publicKeyHash
|
||||
this.publicKeyHash = new RIPEMD160().update(Buffer.from(publicKeySHA256)).digest('hex')
|
||||
}
|
||||
|
||||
generateMainnetMasterPrivateKey() {
|
||||
@@ -505,8 +504,7 @@ export default class AltcoinHDWallet {
|
||||
|
||||
// PublicKey Hash
|
||||
const childPublicKeySHA256 = new Sha256().process(new Uint8Array(this.childPublicKey)).finish().result
|
||||
const _childPublicKeyHash = new RIPEMD160().update(Buffer.from(childPublicKeySHA256)).digest('hex')
|
||||
this.childPublicKeyHash = _childPublicKeyHash
|
||||
this.childPublicKeyHash = new RIPEMD160().update(Buffer.from(childPublicKeySHA256)).digest('hex')
|
||||
|
||||
|
||||
// Call deriveExtendedPublicChildKey // WIll be hardcoding the values...
|
||||
@@ -658,8 +656,7 @@ export default class AltcoinHDWallet {
|
||||
|
||||
// PublicKey Hash
|
||||
const grandChildPublicKeySHA256 = new Sha256().process(new Uint8Array(this.grandChildPublicKey)).finish().result
|
||||
const _grandChildPublicKeyHash = new RIPEMD160().update(Buffer.from(grandChildPublicKeySHA256)).digest('hex')
|
||||
this.grandChildPublicKeyHash = _grandChildPublicKeyHash
|
||||
this.grandChildPublicKeyHash = new RIPEMD160().update(Buffer.from(grandChildPublicKeySHA256)).digest('hex')
|
||||
|
||||
|
||||
// Call deriveExtendedPublicChildKey // WIll be hardcoding the values...
|
||||
|
@@ -24,6 +24,5 @@ export const createWallet = async (sourceType, source, statusUpdateFn) => {
|
||||
throw 'sourceType ' + sourceType + ' not recognized'
|
||||
}
|
||||
|
||||
const wallet = new PhraseWallet(seed, version)
|
||||
return wallet
|
||||
return new PhraseWallet(seed, version)
|
||||
}
|
||||
|
@@ -27,6 +27,5 @@ export const decryptStoredWallet = async (password, wallet, statusFn = () => { }
|
||||
}
|
||||
const sfn5 = get("login.lp16")
|
||||
statusFn(sfn5)
|
||||
const decryptedBytes = AES_CBC.decrypt(encryptedSeedBytes, encryptionKey, false, iv)
|
||||
return decryptedBytes
|
||||
return AES_CBC.decrypt(encryptedSeedBytes, encryptionKey, false, iv)
|
||||
}
|
||||
|
@@ -14,11 +14,10 @@ Base64.decode = function (string) {
|
||||
}
|
||||
|
||||
const decoder = new TextDecoder();
|
||||
const decodedString = decoder.decode(bytes);
|
||||
return decodedString;
|
||||
return decoder.decode(bytes);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
export default Base64;
|
||||
export default Base64;
|
||||
|
@@ -593,7 +593,7 @@
|
||||
}
|
||||
dst(c1);
|
||||
}
|
||||
if (c2 !== null) dst(c2);
|
||||
if (false) dst(c2);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -2378,7 +2378,7 @@ nacl.verify = function(x, y) {
|
||||
// Zero length arguments are considered not equal.
|
||||
if (x.length === 0 || y.length === 0) return false;
|
||||
if (x.length !== y.length) return false;
|
||||
return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
|
||||
return (vn(x, 0, y, 0, x.length) === 0);
|
||||
};
|
||||
|
||||
nacl.setPRNG = function(fn) {
|
||||
@@ -2419,4 +2419,4 @@ nacl.setPRNG = function(fn) {
|
||||
|
||||
// == CHANGE TO ES6 EXPORT == //
|
||||
//})(typeof module !== 'undefined' && module.exports ? module.exports : (window.nacl = window.nacl || {}));
|
||||
export default nacl
|
||||
export default nacl
|
||||
|
@@ -21,8 +21,7 @@ export async function request(url, options) {
|
||||
body,
|
||||
}).then(async (response) => {
|
||||
try {
|
||||
const json = await response.clone().json()
|
||||
return json
|
||||
return await response.clone().json()
|
||||
} catch (e) {
|
||||
return await response.text()
|
||||
}
|
||||
|
@@ -30,9 +30,7 @@ const signArbitrary = (arbitraryBytesBase58, arbitraryBytesForSigningBase58, non
|
||||
|
||||
const signature = nacl.sign.detached(arbitraryBytesForSigningBuffer, keyPair.privateKey)
|
||||
|
||||
const signedBytes = utils.appendBuffer(arbitraryBytesBuffer, signature)
|
||||
|
||||
return signedBytes
|
||||
return utils.appendBuffer(arbitraryBytesBuffer, signature)
|
||||
}
|
||||
|
||||
export default signArbitrary
|
||||
|
@@ -21,13 +21,11 @@ const signArbitraryWithFee = (arbitraryBytesBase58, arbitraryBytesForSigningBase
|
||||
const _arbitraryBytesForSigningBuffer = Object.keys(arbitraryBytesForSigning).map(function (key) { return arbitraryBytesForSigning[key]; })
|
||||
const arbitraryBytesForSigningBuffer = new Uint8Array(_arbitraryBytesForSigningBuffer)
|
||||
|
||||
|
||||
|
||||
|
||||
const signature = nacl.sign.detached(arbitraryBytesForSigningBuffer, keyPair.privateKey)
|
||||
|
||||
const signedBytes = utils.appendBuffer(arbitraryBytesBuffer, signature)
|
||||
|
||||
return signedBytes
|
||||
return utils.appendBuffer(arbitraryBytesBuffer, signature)
|
||||
}
|
||||
|
||||
export default signArbitraryWithFee
|
||||
|
@@ -25,18 +25,14 @@ const signChat = (chatBytes, nonce, keyPair) => {
|
||||
|
||||
const signature = nacl.sign.detached(chatBytesBuffer, keyPair.privateKey)
|
||||
|
||||
const signedBytes = utils.appendBuffer(chatBytesBuffer, signature)
|
||||
|
||||
return signedBytes
|
||||
return utils.appendBuffer(chatBytesBuffer, signature)
|
||||
} else {
|
||||
const chatBytesBuffer = new Uint8Array(chatBytes)
|
||||
chatBytesBuffer.set(_nonce, 112)
|
||||
|
||||
const signature = nacl.sign.detached(chatBytesBuffer, keyPair.privateKey)
|
||||
|
||||
const signedBytes = utils.appendBuffer(chatBytesBuffer, signature)
|
||||
|
||||
return signedBytes
|
||||
return utils.appendBuffer(chatBytesBuffer, signature)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,14 +17,10 @@ const signTradeBotTransaction = (unsignedTxn, keyPair) => {
|
||||
const _privateKey = Object.keys(keyPair.privateKey).map(function (key) { return keyPair.privateKey[key]; })
|
||||
const privateKey = new Uint8Array(_privateKey)
|
||||
const signature = nacl.sign.detached(txnBuffer, privateKey)
|
||||
const signedBytes = utils.appendBuffer(txnBuffer, signature)
|
||||
|
||||
return signedBytes
|
||||
return utils.appendBuffer(txnBuffer, signature)
|
||||
} else {
|
||||
const signature = nacl.sign.detached(txnBuffer, keyPair.privateKey)
|
||||
const signedBytes = utils.appendBuffer(txnBuffer, signature)
|
||||
|
||||
return signedBytes
|
||||
return utils.appendBuffer(txnBuffer, signature)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -9,8 +9,7 @@ export const cancelAllOffers = async (requestObject) => {
|
||||
|
||||
const getMyOpenOffers = async () => {
|
||||
const res = await request('/crosschain/tradeoffers')
|
||||
const myOpenTradeOrders = await res.filter(order => order.mode === "OFFERING" && order.qortalCreator === address)
|
||||
return myOpenTradeOrders
|
||||
return await res.filter(order => order.mode === "OFFERING" && order.qortalCreator === address)
|
||||
}
|
||||
|
||||
const myOpenOffers = await getMyOpenOffers()
|
||||
|
@@ -3,6 +3,5 @@ import Base58 from '../deps/Base58.js'
|
||||
|
||||
export const base58PublicKeyToAddress = (base58pubkey, qora = false) => {
|
||||
const decodePubKey = Base58.decode(base58pubkey)
|
||||
const address = publicKeyToAddress(decodePubKey, qora)
|
||||
return address
|
||||
return publicKeyToAddress(decodePubKey, qora)
|
||||
}
|
||||
|
Reference in New Issue
Block a user