Qortal UI - Main Code Repository A User Interface for the Qortal Blockchain Project. Truly decentralized web hosting, application hosting, communications, data storage, and full infrastructure for the future global decentralized digital world.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

51 lines
1.6 KiB

import { transactionTypes as transactions } from './transactions/transactions.js'
import Base58 from './deps/Base58.js'
import { request } from './fetch-request'
import signChat from './transactions/chat/signChat.js'
import signArbitrary from './transactions/arbitrary/signArbitrary.js'
import signArbitraryWithFee from './transactions/arbitrary/signArbitraryWithFee.js'
export const createTransaction = (type, keyPair, params) => {
const tx = new transactions[type]()
tx.keyPair = keyPair
Object.keys(params).forEach(param => {
tx[param] = params[param]
})
return tx
}
// Compute Chat Nonce
export const computeChatNonce = bytes => request('/chat/compute', {
method: 'POST',
body: Base58.encode(bytes)
})
// Sign Chat Transactions
export const signChatTransaction = (chatBytes, nonce, keyPair) => {
return signChat(chatBytes, nonce, keyPair)
}
// Sign Arbitrary Transactions
export const signArbitraryTransaction = (arbitraryBytesBase58, arbitraryBytesForSigningBase58, nonce, keyPair) => {
return signArbitrary(arbitraryBytesBase58, arbitraryBytesForSigningBase58, nonce, keyPair)
}
export const signArbitraryWithFeeTransaction = (arbitraryBytesBase58, arbitraryBytesForSigningBase58, keyPair) => {
return signArbitraryWithFee(arbitraryBytesBase58, arbitraryBytesForSigningBase58, keyPair)
}
// Process Transactions
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)
})