Conversation
| input: TradeQuoteInput | ||
| ): Promise<TradeQuoteResult> { | ||
| const [invoice, error] = await toWithError( | ||
| this.tapdNodeService.addAssetInvoice({ |
There was a problem hiding this comment.
Why do you use addAssetSellOrder when getting a sell quote but not addAssetBuyOrder?
| // 2. Send assets via tapd — it handles RFQ negotiation with the peer, | ||
| // routes assets out and sats back to our invoice (circular self-payment) | ||
| const [payResult, payError] = await toWithError( | ||
| this.tapdNodeService.sendAssetPayment({ |
There was a problem hiding this comment.
You need to send the original rfqid that you got from addAssetSellOrder into this function and then on to tapd.channels.sendPayment.
Otherwise, the swap node is not bound to the RFQ quote that was returned earlier and a new rate is calculated.
For asset sales, this can mean that you don't actually sell the right amount of asset you intended, because you're specifying your invoice in sats and with a new exchange rate that might be more or less than what you originally specified.
So we want that original quote to be binding.
Also, the quote has a timeout and we should show a timer in the UI that counts down and when it expires, a new quote needs to be fetched.
We should be doing the same with buy orders as well.
| export type ExecuteTradeInput = { | ||
| assetAmount: Scalars['String']['input']; | ||
| peerPubkey: Scalars['String']['input']; | ||
| satsAmount: Scalars['String']['input']; | ||
| tapdAssetId: Scalars['String']['input']; | ||
| tapdGroupKey?: InputMaybe<Scalars['String']['input']>; | ||
| transactionType: TapTransactionType; | ||
| }; | ||
|
|
||
| export type ExecuteTradeResult = { | ||
| __typename?: 'ExecuteTradeResult'; | ||
| amountSats?: Maybe<Scalars['String']['output']>; | ||
| feeSats?: Maybe<Scalars['String']['output']>; | ||
| paymentPreimage?: Maybe<Scalars['String']['output']>; | ||
| success: Scalars['Boolean']['output']; | ||
| }; |
There was a problem hiding this comment.
I can see these types also from line 1207 to 1220. They're duplicated
No description provided.