notePrefix does not search for full prefix
See original GitHub issueSubject of the issue
searchForTransactions()
with notePrefix()
does not seem to perform a search of the full prefix provided in order to narrow down the number of results.
Steps to reproduce
- I have made 3 transactions with 3 different prefixes:
MydApp:MD01:0.0.1:
MydApp:MD02:0.0.1:
MydApp:MD03:0.0.1:
Expected behaviour
The Indexer API should return only transactions whose prefix matches the search (in base64: TXlkQXBwOk1EMDM6MC4wLjE6
), instead it returns all transactions for my address, including one with a completely different notes prefix.
const enc = new TextEncoder();
const prefix = enc.encode("MydApp:MD03:0.0.1:"); // TXlkQXBwOk1EMDM6MC4wLjE6
const s = Buffer.from(prefix).toString("base64");
const address = "NLOMMDJQCRKOBMFNWVCHDEFD3ZXKBI24MHXEBMEVALPMMZNMOHMTCOYNJA";
const response = await algoIndexer.searchForTransactions()
.txType("pay").address(address).notePrefix(s).do();
Actual behaviour
Only txID I2TRV4AVORWXJ2ZU2N77F5VDV35YHTWHVOV3PJJCYTHY7NNGG2QA
should be returned, instead I get:
{
"current-round": 21193149,
"next-token": "9mBDAQAAAAAHAAAA",
"transactions": [
{
"close-rewards": 0,
"closing-amount": 0,
"confirmed-round": 21192991,
"fee": 1000,
"first-valid": 21192989,
"genesis-hash": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
"genesis-id": "testnet-v1.0",
"id": "I2TRV4AVORWXJ2ZU2N77F5VDV35YHTWHVOV3PJJCYTHY7NNGG2QA",
"intra-round-offset": 7,
"last-valid": 21193989,
"note": "TXlkQXBwOk1EMDM6MC4wLjE6+KIyecddiC3Gzy6q1lp56VzaVpZcWtmGgt5uBr08uXksELPnZG0lzcN7kY/Dm4j25K69",
"payment-transaction": {
"amount": 0,
"close-amount": 0,
"receiver": "HZ57J3K46JIJXILONBBZOHX6BKPXEM2VVXNRFSUED6DKFD5ZD24PMJ3MVA"
},
"receiver-rewards": 0,
"round-time": 1650885756,
"sender": "NLOMMDJQCRKOBMFNWVCHDEFD3ZXKBI24MHXEBMEVALPMMZNMOHMTCOYNJA",
"sender-rewards": 0,
"signature": {
"sig": "gtAiALhsSDTY30/8N02KJI/UCte4cjT3p4LxRLOx3nBRg9niu5Co7tDvJ1U7G7SkTcS1Av3afJrVzpwWvIFfAA=="
},
"tx-type": "pay"
},
{
"close-rewards": 0,
"closing-amount": 0,
"confirmed-round": 21192986,
"fee": 1000,
"first-valid": 21192983,
"genesis-hash": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
"genesis-id": "testnet-v1.0",
"id": "YOFQWNGIJA2CHMPTWLXI5SD7SKXZZ2M7UY5E3JJEBN64JDRB42VQ",
"intra-round-offset": 1,
"last-valid": 21193983,
"note": "TXlkQXBwOk1EMDI6MC4wLjE67Pop8c7P5+lH23h13uopy/I9EBEg9YNEN6bYCeG8cYhabd9y3n9dlsldwXhZtx5gKucq",
"payment-transaction": {
"amount": 0,
"close-amount": 0,
"receiver": "HZ57J3K46JIJXILONBBZOHX6BKPXEM2VVXNRFSUED6DKFD5ZD24PMJ3MVA"
},
"receiver-rewards": 0,
"round-time": 1650885734,
"sender": "NLOMMDJQCRKOBMFNWVCHDEFD3ZXKBI24MHXEBMEVALPMMZNMOHMTCOYNJA",
"sender-rewards": 0,
"signature": {
"sig": "X5OhTSFEvOY5+Kzp1/5qLPkT6ouhVSaLJZajLA/DGG8kz6Pa6kNKOKrvI479j6Xa60YTUlaHbIt6w2RQAHE+AQ=="
},
"tx-type": "pay"
},
{
"close-rewards": 0,
"closing-amount": 0,
"confirmed-round": 21192977,
"fee": 1000,
"first-valid": 21192974,
"genesis-hash": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
"genesis-id": "testnet-v1.0",
"id": "QYQQ3WXHREQZEFF2MEOORHMZ6W6YO56NXAJKEBBXD3GJETKG5ZFQ",
"intra-round-offset": 13,
"last-valid": 21193974,
"note": "TXlkQXBwOk1EMDE6MC4wLjE6M0UsLpNuiadTK2veUEzfN40OtehRb4uKNaBnYdwLxXpS8vLOLurymnt1oAlLIiBZ9wV9",
"payment-transaction": {
"amount": 0,
"close-amount": 0,
"receiver": "HZ57J3K46JIJXILONBBZOHX6BKPXEM2VVXNRFSUED6DKFD5ZD24PMJ3MVA"
},
"receiver-rewards": 0,
"round-time": 1650885697,
"sender": "NLOMMDJQCRKOBMFNWVCHDEFD3ZXKBI24MHXEBMEVALPMMZNMOHMTCOYNJA",
"sender-rewards": 0,
"signature": {
"sig": "BlKxUxR+gaDkvVoo1/IIJUSgMkBq0SP2+mOZgK8MdNQDvSGue+NQ14b6PiXUNyjM5DmWli45a2WBsGDMlQ9xAQ=="
},
"tx-type": "pay"
},
{
"close-rewards": 0,
"closing-amount": 0,
"confirmed-round": 21192950,
"fee": 1000,
"first-valid": 21192948,
"genesis-hash": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
"genesis-id": "testnet-v1.0",
"id": "V3YH7DCSQHHUEOGA6JVOU6MBVZQ4BYO7SHKU5S7JJF4XNAR4GAGA",
"intra-round-offset": 7,
"last-valid": 21193948,
"note": "rGRpc3BlbnNlciB2Mg==",
"payment-transaction": {
"amount": 5000000,
"close-amount": 0,
"receiver": "NLOMMDJQCRKOBMFNWVCHDEFD3ZXKBI24MHXEBMEVALPMMZNMOHMTCOYNJA"
},
"receiver-rewards": 0,
"round-time": 1650885582,
"sender": "HZ57J3K46JIJXILONBBZOHX6BKPXEM2VVXNRFSUED6DKFD5ZD24PMJ3MVA",
"sender-rewards": 0,
"signature": {
"sig": "l6pa+kTwsJQOKsBkk3rJ1u7PgheEght6X+uEkxWm11qGccecL80U/aD38iK40agnrQp4G6neXKPLYvVV0hihAg=="
},
"tx-type": "pay"
}
]
}
According to this tutorial searchForTransactions()
can combine multiple search parameters so, unless I misunderstood its usage, I should be using it correctly. Is this the intended behavior? Otherwise, what am I missing?
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Error Note Chronicles: Mismatched Prefix Error | PMG
In Error Note Chronicles, we take an in-depth look at different errors. This month's topic is the Mismatched Prefix Error.
Read more >Prefix searching - Algolia
In this mode, all query words except the last one are considered complete; prefix search isn't performed on them.
Read more >Longest prefix which is also suffix - GeeksforGeeks
Given a string s, find the length of the longest prefix, which is also a suffix. The prefix and suffix should not overlap....
Read more >Prefixes for English Language Learners - Yuba College
Some words using prefixes are hyphenated and some are not, and some that used to be hyphenated no longer are. Check a dictionary...
Read more >Prefixes | Vocabulary - EnglishClub
prefix prefix meaning
a‑ also an‑ not, without
a‑ a‑ to, towards
a‑ a‑ in the process of, in a particular state
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@barnjamin I believe you’re right, I’m using PureStake and in the documentation I see no mention of the
noteprefix
field.Closing this issue as both you and @AlgoDoggo have confirmed that it works as expected. Thank you both.
1.15.0. I tried algonode and algoexplorer, both worked OK