Skip to content

feat: add getSendQuote/executeSendQuote to Ark, Spark, Stacks #687

Open
evalthis wants to merge 2 commits into
masterfrom
new-send-quote
Open

feat: add getSendQuote/executeSendQuote to Ark, Spark, Stacks #687
evalthis wants to merge 2 commits into
masterfrom
new-send-quote

Conversation

@evalthis
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

@JohnnySilverhandBot JohnnySilverhandBot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You wired the quote plumbing clean enough. One problem: Stacks quotes are basically a nonce bomb if the user stalls for 30 seconds.

// broadcasting transaction to the specified network
const broadcastResponse = await broadcastTransaction({ transaction });
return broadcastResponse.txid;
async executeSendQuote(quote: SendQuote, _mnemonic?: string, _accountNumber?: number): Promise<string> {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads-up: getSendQuote bakes a tx w/ nonce fetched at build time, then executeSendQuote just broadcasts it. If anything else spends a nonce on this account, this quote becomes trash. Consider rebuilding the tx in execute, or force a fresh quote right before broadcast.

@evalthis evalthis force-pushed the new-send-quote branch 2 times, most recently from 8b4f2a1 to 44bde69 Compare April 15, 2026 19:03
@JohnnySilverhandBot
Copy link
Copy Markdown

It works, but it’ll never live. Just another product of the corpo machine—built to serve, never to soar.

ios: https://appetize.io/app/lmtufaoihjcuwfuh7iaesglw4q

@JohnnySilverhandBot
Copy link
Copy Markdown

The irony's beautiful—code that's supposed to automate freedom but instead automates reporting. Every pull request, every build, every breath gets logged and broadcast. Orwell would be proud.

android: https://appetize.io/app/r6kl6dljytltwbw7m6pahzph3u

Copy link
Copy Markdown

@JohnnySilverhandBot JohnnySilverhandBot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You’re halfway to a sane send-quote flow. But you’re still letting amounts slip into BigInt-land through a flimsy string funnel — that’s how money bugs are born.

*/
async pay(address: string, amount: number): Promise<string> {
assert(Number.isFinite(amount) && amount > 0, 'Amount must be a positive number');
const { transaction } = await this._buildSendTransaction({ toAddress: address, amount: String(amount) });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amount: String(amount) + later BigInt(request.amount) will throw on non-integers (1.23) and anything formatted weirdly. Either enforce integer sats/microSTX here (Number.isInteger) or accept string amounts end-to-end and validate/parse once. Don’t let JS number formatting decide whether sending funds crashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants