-
Notifications
You must be signed in to change notification settings - Fork 30
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
Support extracting token deposit info from txs #481
Conversation
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.
LGTM
return isTransferTx(tx) && checkTokenOutput(tx) | ||
} | ||
|
||
export function getTokenDepositInfo(tx: Transaction): { |
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.
Does this generate information for ALPH if ALPH and tokens are sent in a single transaction?
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.
No, it only returns the token info.
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.
The latest commit will return the token and ALPH deposit information.
@@ -62,6 +62,7 @@ function getInputAddresses(tx: Transaction): Address[] { | |||
const inputAddresses: Address[] = [] | |||
for (const input of tx.unsigned.inputs) { | |||
try { | |||
if (input.unlockScript === '03') continue // SameAsPrevious |
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.
IIRC, we have a constant somewhere for 03
, should reuse that one.
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.
We didn't define encoded SameAsPrevious
before, so I added a constant for it in the codec
} | ||
|
||
export function getDepositInfo(tx: Transaction): DepositInfo { | ||
if (!isTransferTx) return { alph: [], tokens: [] } |
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.
It should be isTransferTx(tx)
No description provided.