-
Notifications
You must be signed in to change notification settings - Fork 46
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
Better get balance #433
base: master
Are you sure you want to change the base?
Better get balance #433
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also see similar logic changes in at least 2-3 parts of utxo.ts
is there anyway to share logic?
f64df26
to
f216c46
Compare
* refactor: simplify wallet ord logic Signed-off-by: Gregory Hill <gregorydhill@outlook.com> * chore: run prettier format * chore: skip process utxo test * chore: uncomment test for find safe utxo --------- Signed-off-by: Gregory Hill <gregorydhill@outlook.com> Co-authored-by: Slava <slava@interlay.io>
limit: number = 3 | ||
): Promise<boolean> => { | ||
if (limit === 0) return false; | ||
const transaction = await esploraClient.getTransaction(txid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noting I think we can re-write this to use only the ordinalsClient
but I was too lazy to do that. Something to consider or leave a note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if it's possible. from the current schema there're no endpoints which might returns us inputs
for txid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I think it returns the hex encoded tx which can be decoded to a transaction object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately it's of another interface Transaction
. coincident that name is the same
if (cardinalOutputsSet.has(OutPoint.toString(vin))) return true; | ||
|
||
const output = await ordinalsClient.getInscriptionsFromOutPoint(vin); | ||
if (output.indexed) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we do this we should do parseInscriptions
to short-circuit if it is a mempool tx that is committing or revealing inscription data
cardinalOutputsSet: Set<string>, | ||
esploraClient: EsploraClient, | ||
ordinalsClient: OrdinalsClient, | ||
limit: number = 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this may happen if indexed = false
from Ord API
73c5823
to
3562476
Compare
3562476
to
c9555ce
Compare
c9555ce
to
ec35daf
Compare
bob/sdk/src/inscription.ts
Line 188 in 743d020
Explanation: build a tree structure
TreeNode
cardinal: false
).If output has all leaf nodes with
cardinal: true
-- confirmed (not containing ordinals) then output amount could be spent.