Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filecoin network query fixes #619

Merged
merged 6 commits into from
Sep 8, 2023
Merged

Filecoin network query fixes #619

merged 6 commits into from
Sep 8, 2023

Conversation

samholmes
Copy link
Collaborator

@samholmes samholmes commented Sep 7, 2023

Heads up. This disables Filscan because I haven't found a convenient way to calculate fees from Filscan's API. I haven't quit wrapped my head around how Filecoin fees are calculated, so rather than calculating the fee from the message fields, I use a hack to peer into the "transfer" data returned by Filfox.

CHANGELOG

  • fixed: Filecoin network fee query issue
  • changed: Use Filfox exclusively for Filecoin transaction querying

Dependencies

none

Description

none

@@ -331,6 +331,8 @@ export class FilecoinEngine extends CurrencyEngine<
}): void => {
this.addTransaction(this.currencyInfo.currencyCode, tx)
this.onUpdateTransactions()
this.otherData.knownTxids[tx.txid] = true
Copy link
Member

Choose a reason for hiding this comment

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

There is already an engine.txIdMap you should use. It's automatically kept up to date by addTransaction

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is it available after loading the engine? If so, I'll use that instead of the otherData which does get loaded.

}
// Exit early because we reached transaction history from previous
// check
if (this.otherData.knownTxids[txid]) return
Copy link
Member

Choose a reason for hiding this comment

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

Use

if (this.findTransaction('FIL', normalizeAddress(txid)) !== -1) return

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I cannot use this because it's not available after loading the engine.

The transaction list data doesn't load until `getTransactions` is called
or a new transaction is saved. This means it's not suitable for checking
the known txid from prior syncs.
Filfox has a convenient API for retrieving fee info on a message.
Filscan doesn't have an known API for getting the fee amounts without
figuring out how to calculate the fee amounts from four or five fee
related fields on a Filecoin message.
@samholmes samholmes merged commit 2367cfb into master Sep 8, 2023
3 checks passed
@samholmes samholmes deleted the sam/fil-network-query branch September 8, 2023 23:05
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