Skip to content
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

Fix where filter for tx list query #7

Merged
merged 4 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning].

## [Unreleased]
### Fixed
- `tx` caller `where` filter

## [1.2.0] - 2024-03-19
### Added
- `Text` Proposal type
Expand Down
8 changes: 7 additions & 1 deletion src/callers/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ import {
const createWhereFilter = (sender: PublicKey | null, operator?: string) => {
const exp = { signer_infos: {}, block: {} }

const escapedString = sender?.key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
const regex = new RegExp(escapedString!).toString()

// Remove the first and last character of the regex string to remove the / at the start and end
const regexString = regex.substring(1, regex.length - 1)

if (sender) {
exp.signer_infos = {
_cast: {
String: {
_regex: sender?.key,
_regex: regexString,
},
},
}
Expand Down
Loading