We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I tried to run the code below:
const transaction = await arweave.transactions.get(txid); const tags = transaction.get('tags', {'decode': true, 'string':true}) as Object as Tag[]
but I run into the error:
TypeError: b64UrlString.replace is not a function at b64UrlDecode (/Users/...../node_modules/arweave/node/lib/utils.js:81:33)
while this works, but gives me the tags encoded:
const transaction = await arweave.transactions.get(txid); const tags = transaction.get('tags') as Object as Tag[]
which is not what I want, so I had to do it this way:
import { b64UrlToString } from 'arweave/node/lib/utils.js' const transaction = await arweave.transactions.get(txid); const tags = (transaction.get('tags') as Object as Tag[]).map((tag: Tag) => { return {'name': b64UrlToString(tag.name), 'value': b64UrlToString(tag.value)} })
Edit: I npm installed version: "arweave": "^1.13.5"
"arweave": "^1.13.5"
The text was updated successfully, but these errors were encountered:
Yeah, it seems to have always been this way (I checked back through releases to 1.9 anyhow) Ref: https://github.com/ArweaveTeam/arweave-js#decode-tags-from-transactions So what you are doing above is sort of correct.
These need to be looked into though:
tags
Sorry, something went wrong.
Interesting. 1. above cannot be fixed without breaking compatibility badly.
After next patch get will throw an error if an array is detected, and decode or string are defined.
get
decode
string
FYI, i think the preferred usage should be:
const transaction = await arweave.transactions.get(txid); const tags = transaction['tags'] // correct type returned
this delivers type information correctly. i will update README.md to reflect this anyhow.
Successfully merging a pull request may close this issue.
Hi, I tried to run the code below:
but I run into the error:
while this works, but gives me the tags encoded:
which is not what I want, so I had to do it this way:
Edit: I npm installed version:
"arweave": "^1.13.5"
The text was updated successfully, but these errors were encountered: