Skip to content

Commit

Permalink
Temporarily omit FIO tpid
Browse files Browse the repository at this point in the history
Per a known bug on their chain where bundled tx's don't work without a FIO balance, this is a temporary workaround
  • Loading branch information
Jon-edge committed Jul 16, 2024
1 parent 3becfe6 commit 46d8185
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- fixed: FIO payment wallet connection error, using a temporary workaround while FIO resolves the issue with their network
- fixed: Fix incorrect QR code parsing for PIX addresses

## 4.12.0 (2024-07-09)
Expand Down
14 changes: 12 additions & 2 deletions src/fio/FioEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@fioprotocol/fiosdk/lib/transactions/queries'
import { Query } from '@fioprotocol/fiosdk/lib/transactions/queries/Query'
import { Transactions } from '@fioprotocol/fiosdk/lib/transactions/Transactions'
import { add, div, gt, lt, max, mul, sub } from 'biggystring'
import { add, div, gt, lt, lte, max, mul, sub } from 'biggystring'
import { asMaybe, asString, asTuple } from 'cleaners'
import {
EdgeCurrencyEngine,
Expand Down Expand Up @@ -1697,10 +1697,20 @@ export class FioEngine extends CurrencyEngine<FioTools, SafeFioWalletInfo> {
}
}

// Remove tpid as a temporary fix for bundled tx's not working when the user
// has no FIO balance or txs, until FIO fixes their chain
// TODO: Remove once FIO fixes their chain
const balance = await this.getBalance({ tokenId: null })
const tpid =
lte(balance, '0') &&
!this.transactionList.FIO.some(tx => gt(tx.nativeAmount, '0'))
? undefined
: this.tpid

const rawTx = await transactions.createRawTransaction({
action: txParams.action,
account: txParams.account,
data: { ...txParams.data, tpid: this.tpid },
data: { ...txParams.data, tpid },
publicKey: this.walletInfo.keys.publicKey,
chainData: this.refBlock
})
Expand Down

0 comments on commit 46d8185

Please sign in to comment.