Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const opts_testnet = {
}
}

async function buildTransaction(actions, isTestnet = false) {
async function buildTransaction({actions, transaction = false, isTestnet = false}) {
const rpc_active = isTestnet ? rpc_testnet : rpc
const opts_active = isTestnet ? opts_testnet : opts
const info = await rpc_active.get_info();
Expand Down
2 changes: 1 addition & 1 deletion buildTransaction.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('buildTransaction', async assert => {
assert({
given: 'conversation',
should: 'build transaction',
actual: typeof (await buildTransaction(actions)),
actual: typeof (await buildTransaction({actions})),
expected: 'string'
})
})
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fastify.get('/buy-seeds', async (request, reply) => {
quantity: quantity
})]

const esr = await buildTransaction(actions)
const esr = await buildTransaction({actions})

const qrPath = await buildQrCode(esr)

Expand All @@ -54,7 +54,7 @@ fastify.get('/buyseeds', async (request, reply) => {
memo: request.query.memo
})]

const esr = await buildTransaction(actions)
const esr = await buildTransaction({actions})

const qrPath = await buildQrCode(esr)

Expand All @@ -67,8 +67,9 @@ fastify.get('/buyseeds', async (request, reply) => {

fastify.post('/qr', async (request, reply) => {
const actions = request.body.actions
const transaction = request.body.transaction ?? false

const esr = await buildTransaction(actions)
const esr = await buildTransaction({actions, transaction})

const qrPath = await buildQrCode(esr)

Expand All @@ -82,7 +83,7 @@ fastify.post('/qr', async (request, reply) => {
fastify.post('/qr-testnet', async (request, reply) => {
const actions = request.body.actions

const esr = await buildTransaction(actions, true)
const esr = await buildTransaction({actions, isTestnet: true})

const qrPath = await buildQrCode(esr)

Expand Down Expand Up @@ -126,7 +127,7 @@ fastify.get('/invoice', async (request, reply) => {
}
}]

const esr = await buildTransaction(actions)
const esr = await buildTransaction({actions})

const qrPath = await buildQrCode(esr)

Expand Down