mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-04-19 01:25:55 +00:00
version 2 api transaction for q-app
This commit is contained in:
parent
f08fb36fdc
commit
8f9498b4c9
@ -22,6 +22,7 @@ import framePasteMenu from '../functional-components/frame-paste-menu.js';
|
||||
|
||||
const createTransaction = api.createTransaction;
|
||||
const processTransaction = api.processTransaction;
|
||||
const processTransactionVersion2 = api.processTransactionVersion2;
|
||||
const signChatTransaction = api.signChatTransaction;
|
||||
const signArbitraryTransaction = api.signArbitraryTransaction;
|
||||
const tradeBotCreateRequest = api.tradeBotCreateRequest;
|
||||
@ -145,7 +146,15 @@ export const routes = {
|
||||
await requestTransactionDialog.requestTransaction(tx);
|
||||
}
|
||||
|
||||
const res = await processTransaction(tx.signedBytes);
|
||||
let res
|
||||
|
||||
if(req.data.apiVersion && req.data.apiVersion === 2){
|
||||
res = await processTransactionVersion2(tx.signedBytes)
|
||||
}
|
||||
if(!req.data.apiVersion){
|
||||
res = await processTransaction(tx.signedBytes);
|
||||
}
|
||||
|
||||
let extraData = {}
|
||||
if(req.data.type === 38 && tx && tx._rewardShareKeyPair && tx._rewardShareKeyPair.secretKey){
|
||||
extraData.rewardSharePrivateKey = Base58.encode(tx._rewardShareKeyPair.secretKey)
|
||||
@ -191,7 +200,16 @@ export const routes = {
|
||||
_keyPair,
|
||||
req.data.params
|
||||
);
|
||||
const res = await processTransaction(tx.signedBytes);
|
||||
let res
|
||||
|
||||
if(req.data.apiVersion && req.data.apiVersion === 2){
|
||||
res = await processTransactionVersion2(tx.signedBytes)
|
||||
}
|
||||
if(!req.data.apiVersion){
|
||||
res = await processTransaction(tx.signedBytes);
|
||||
}
|
||||
|
||||
|
||||
response = {
|
||||
success: true,
|
||||
data: res,
|
||||
@ -243,7 +261,15 @@ export const routes = {
|
||||
store.getState().app.wallet._addresses[req.data.nonce].keyPair
|
||||
);
|
||||
|
||||
const res = await processTransaction(signedChatBytes);
|
||||
let res
|
||||
|
||||
if(req.data.apiVersion && req.data.apiVersion === 2){
|
||||
res = await processTransactionVersion2(signedChatBytes)
|
||||
}
|
||||
if(!req.data.apiVersion){
|
||||
res = await processTransaction(signedChatBytes);
|
||||
}
|
||||
|
||||
response = res;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@ -262,8 +288,15 @@ export const routes = {
|
||||
req.data.arbitraryNonce,
|
||||
store.getState().app.wallet._addresses[req.data.nonce].keyPair
|
||||
);
|
||||
let res
|
||||
|
||||
if(req.data.apiVersion && req.data.apiVersion === 2){
|
||||
res = await processTransactionVersion2(signedArbitraryBytes)
|
||||
}
|
||||
if(!req.data.apiVersion){
|
||||
res = await processTransaction(signedArbitraryBytes);
|
||||
}
|
||||
|
||||
const res = await processTransaction(signedArbitraryBytes);
|
||||
response = res;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@ -293,8 +326,14 @@ export const routes = {
|
||||
unsignedTxn,
|
||||
store.getState().app.selectedAddress.keyPair
|
||||
);
|
||||
let res
|
||||
|
||||
const res = await processTransaction(signedTxnBytes);
|
||||
if(req.data.apiVersion && req.data.apiVersion === 2){
|
||||
res = await processTransactionVersion2(signedTxnBytes)
|
||||
}
|
||||
if(!req.data.apiVersion){
|
||||
res = await processTransaction(signedTxnBytes);
|
||||
}
|
||||
response = res;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@ -328,7 +367,14 @@ export const routes = {
|
||||
store.getState().app.selectedAddress.keyPair
|
||||
);
|
||||
|
||||
const res = await processTransaction(signedTxnBytes);
|
||||
let res
|
||||
|
||||
if(req.data.apiVersion && req.data.apiVersion === 2){
|
||||
res = await processTransactionVersion2(signedTxnBytes)
|
||||
}
|
||||
if(!req.data.apiVersion){
|
||||
res = await processTransaction(signedTxnBytes);
|
||||
}
|
||||
|
||||
response = res;
|
||||
} catch (e) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
export { request } from './fetch-request.js'
|
||||
export { transactionTypes as transactions } from './transactions/transactions.js'
|
||||
export { processTransaction, createTransaction, computeChatNonce, signChatTransaction, signArbitraryTransaction } from './createTransaction.js'
|
||||
export { processTransaction, processTransactionVersion2, createTransaction, computeChatNonce, signChatTransaction, signArbitraryTransaction } from './createTransaction.js'
|
||||
export { tradeBotCreateRequest, tradeBotRespondRequest, signTradeBotTxn, deleteTradeOffer, sendBtc, sendLtc, sendDoge, sendDgb, sendRvn, sendArrr } from './tradeRequest.js'
|
||||
export { cancelAllOffers } from './transactions/trade-portal/tradeoffer/cancelAllOffers.js'
|
||||
|
@ -36,3 +36,9 @@ export const processTransaction = bytes => request('/transactions/process', {
|
||||
method: 'POST',
|
||||
body: Base58.encode(bytes)
|
||||
})
|
||||
|
||||
export const processTransactionVersion2 = bytes => request('/transactions/process?apiVersion=2', {
|
||||
method: 'POST',
|
||||
body: Base58.encode(bytes)
|
||||
})
|
||||
|
||||
|
@ -342,7 +342,8 @@ class WebBrowser extends LitElement {
|
||||
lastReference: lastRef,
|
||||
groupdialog1: groupdialog1,
|
||||
groupdialog2: groupdialog2
|
||||
}
|
||||
},
|
||||
apiVersion: 2
|
||||
})
|
||||
return myTxnrequest
|
||||
}
|
||||
@ -398,7 +399,8 @@ class WebBrowser extends LitElement {
|
||||
lastReference: lastRef,
|
||||
atDeployDialog1: groupdialog1,
|
||||
atDeployDialog2: groupdialog2
|
||||
}
|
||||
},
|
||||
apiVersion: 2
|
||||
})
|
||||
return myTxnrequest
|
||||
}
|
||||
@ -550,6 +552,7 @@ class WebBrowser extends LitElement {
|
||||
selectedAddress: this.selectedAddress,
|
||||
worker: worker,
|
||||
isBase64: true,
|
||||
apiVersion: 2
|
||||
});
|
||||
|
||||
response = JSON.stringify(resPublish);
|
||||
@ -624,7 +627,8 @@ class WebBrowser extends LitElement {
|
||||
let _response = await parentEpml.request('sign_chat', {
|
||||
nonce: this.selectedAddress.nonce,
|
||||
chatBytesArray: chatBytesArray,
|
||||
chatNonce: nonce
|
||||
chatNonce: nonce,
|
||||
apiVersion: 2
|
||||
});
|
||||
|
||||
const chatResponse = getSendChatResponse(_response);
|
||||
@ -1106,6 +1110,7 @@ class WebBrowser extends LitElement {
|
||||
dialogAddress,
|
||||
dialogName
|
||||
},
|
||||
apiVersion: 2
|
||||
})
|
||||
return myTxnrequest;
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ export const publishData = async ({
|
||||
selectedAddress,
|
||||
worker,
|
||||
isBase64,
|
||||
metaData
|
||||
metaData,
|
||||
apiVersion
|
||||
}) => {
|
||||
const validateName = async (receiverName) => {
|
||||
let nameRes = await parentEpml.request("apiCall", {
|
||||
@ -71,6 +72,7 @@ export const publishData = async ({
|
||||
arbitraryBytesBase58: transactionBytesBase58,
|
||||
arbitraryBytesForSigningBase58: convertedBytesBase58,
|
||||
arbitraryNonce: nonce,
|
||||
apiVersion: apiVersion ? apiVersion : null
|
||||
})
|
||||
let myResponse = { error: "" }
|
||||
if (response === false) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user