Skip to content

Instantly share code, notes, and snippets.

@zh
Created February 20, 2021 15:25
Show Gist options
  • Save zh/a9e7fd1093b0a0c38f2f77ea06a8e210 to your computer and use it in GitHub Desktop.
Save zh/a9e7fd1093b0a0c38f2f77ea06a8e210 to your computer and use it in GitHub Desktop.
diff --git a/lib/tokens.js b/lib/tokens.js
index 1a76a8a..6fd3fc1 100644
--- a/lib/tokens.js
+++ b/lib/tokens.js
@@ -61,7 +61,7 @@ class Tokens {
utxos.forEach(utxo => {
// Skip if this is not a valid token UTXO.
- if (!utxo.isValid) return
+ if (!utxo.isValid || utxo.utxoType !== 'token') return
// Check if the current UTXO represents a token that is already in the
// tokenInfo array.
@@ -162,7 +162,7 @@ class Tokens {
const tokenId = output.tokenId
// Filter out the token UTXOs that match the selected token ID.
- tokenUtxos = tokenUtxos.filter(e => e.tokenId === tokenId)
+ tokenUtxos = tokenUtxos.filter(e => e.tokenId === tokenId && e.utxoType === 'token')
// console.log(`tokenUtxos: ${JSON.stringify(tokenUtxos, null, 2)}`)
// console.log(`tokenUtxos[0].tokenType: ${tokenUtxos[0].tokenType}`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment