4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-11 09:45:52 +00:00

Added support for NMC, DASH, & FIRO

This allows for sending and creating wallets.
This commit is contained in:
QuickMythril 2022-05-07 01:24:54 -04:00
parent b66f5d1e1f
commit 6f59c7c583
4 changed files with 132 additions and 1 deletions

View File

@ -22,6 +22,9 @@ const sendLtc = api.sendLtc
const sendDoge = api.sendDoge
const sendDgb = api.sendDgb
const sendRvn = api.sendRvn
const sendNmc = api.sendNmc
const sendDash = api.sendDash
const sendFiro = api.sendFiro
export const routes = {
hello: async (req) => {
@ -361,4 +364,43 @@ export const routes = {
}
return response
},
sendNmc: async (req) => {
let response
try {
const res = await sendNmc(req.data)
response = res
} catch (e) {
console.error(e)
console.error(e.message)
response = e.message
}
return response
},
sendDash: async (req) => {
let response
try {
const res = await sendDash(req.data)
response = res
} catch (e) {
console.error(e)
console.error(e.message)
response = e.message
}
return response
},
sendFiro: async (req) => {
let response
try {
const res = await sendFiro(req.data)
response = res
} catch (e) {
console.error(e)
console.error(e.message)
response = e.message
}
return response
},
}

View File

@ -168,6 +168,51 @@ export default class PhraseWallet {
}
}).createWallet(new Uint8Array(rvnSeed), false, 'RVN');
// Create Namecoin HD Wallet
const nmcSeed = [...addrSeed];
const nmcWallet = new AltcoinHDWallet({
mainnet: {
private: 0x0488ADE4,
public: 0x0488B21E,
prefix: 0x34
},
testnet: {
private: 0x04358394,
public: 0x043587CF,
prefix: 0x6F
}
}).createWallet(new Uint8Array(nmcSeed), false, 'NMC');
// Create Dash HD Wallet
const dashSeed = [...addrSeed];
const dashWallet = new AltcoinHDWallet({
mainnet: {
private: 0x0488ADE4,
public: 0x0488B21E,
prefix: 0x4C
},
testnet: {
private: 0x04358394,
public: 0x043587CF,
prefix: 0x8C
}
}).createWallet(new Uint8Array(dashSeed), false, 'DASH');
// Create Firo HD Wallet
const firoSeed = [...addrSeed];
const firoWallet = new AltcoinHDWallet({
mainnet: {
private: 0x0488ADE4,
public: 0x0488B21E,
prefix: 0x52
},
testnet: {
private: 0x04358394,
public: 0x043587CF,
prefix: 0x41
}
}).createWallet(new Uint8Array(firoSeed), false, 'FIRO');
this._addresses[nonce] = {
address,
btcWallet,
@ -175,6 +220,9 @@ export default class PhraseWallet {
dogeWallet,
dgbWallet,
rvnWallet,
nmcWallet,
dashWallet,
firoWallet,
qoraAddress,
keyPair: {
publicKey: addrKeyPair.publicKey,

View File

@ -4,6 +4,6 @@ export { transactionTypes as transactions } from './transactions/transactions.js
export { processTransaction, createTransaction, computeChatNonce, signChatTransaction, signArbitraryTransaction } from './createTransaction.js'
export { tradeBotCreateRequest, tradeBotRespondRequest, signTradeBotTxn, deleteTradeOffer, sendBtc, sendLtc, sendDoge, sendDgb, sendRvn } from './tradeRequest.js'
export { tradeBotCreateRequest, tradeBotRespondRequest, signTradeBotTxn, deleteTradeOffer, sendBtc, sendLtc, sendDoge, sendDgb, sendRvn, sendNmc, sendDash, sendFiro } from './tradeRequest.js'
export { cancelAllOffers } from './transactions/trade-portal/tradeoffer/cancelAllOffers.js'

View File

@ -130,3 +130,44 @@ export const sendRvn = (requestObject) => {
})
}
// Send NMC
export const sendNmc = (requestObject) => {
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
return request(`/crosschain/nmc/send?apiKey=${myNode.apiKey}`, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(requestObject)
})
}
// Send DASH
export const sendDash = (requestObject) => {
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
return request(`/crosschain/dash/send?apiKey=${myNode.apiKey}`, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(requestObject)
})
}
// Send FIRO
export const sendFiro = (requestObject) => {
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
return request(`/crosschain/firo/send?apiKey=${myNode.apiKey}`, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(requestObject)
})
}