From 33d401e8a66abac384a17f895b5c535c8dcaf4cb Mon Sep 17 00:00:00 2001 From: lukachi Date: Tue, 19 Mar 2024 18:34:21 +0200 Subject: [PATCH 1/4] add back slash for plus symbol --- src/callers/tx.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/callers/tx.ts b/src/callers/tx.ts index 8957ee0..bc0e682 100644 --- a/src/callers/tx.ts +++ b/src/callers/tx.ts @@ -20,11 +20,15 @@ import { const createWhereFilter = (sender: PublicKey | null, operator?: string) => { const exp = { signer_infos: {}, block: {} } + const escapedString = sender?.key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + const regex = new RegExp(escapedString!) + const regexString = regex.toString().replace('/', '').slice(0, -1) + if (sender) { exp.signer_infos = { _cast: { String: { - _regex: sender?.key, + _regex: regexString, }, }, } From cb71252297df1d95d922c1dfbcacc3313f6ecbbf Mon Sep 17 00:00:00 2001 From: lukachi Date: Wed, 20 Mar 2024 12:35:12 +0200 Subject: [PATCH 2/4] remove / at the start & end of the regex --- CHANGELOG.md | 4 ++++ src/callers/tx.ts | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3284ed9..8f5de7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/callers/tx.ts b/src/callers/tx.ts index bc0e682..59bab95 100644 --- a/src/callers/tx.ts +++ b/src/callers/tx.ts @@ -21,8 +21,11 @@ const createWhereFilter = (sender: PublicKey | null, operator?: string) => { const exp = { signer_infos: {}, block: {} } const escapedString = sender?.key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + const regex = new RegExp(escapedString!) - const regexString = regex.toString().replace('/', '').slice(0, -1) + + // Remove the first and last character of the regex string to remove the / at the start and end + const regexString = regex.toString().substring(1, regex.toString().length - 1) if (sender) { exp.signer_infos = { From 8c45d6184cf37275393a37b8d5cc9bd6137506cd Mon Sep 17 00:00:00 2001 From: Phat <39623143+lukachi@users.noreply.github.com> Date: Wed, 20 Mar 2024 12:53:58 +0200 Subject: [PATCH 3/4] Update src/callers/tx.ts Co-authored-by: Semen Loktionov <47495186+napalmpapalam@users.noreply.github.com> --- src/callers/tx.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/callers/tx.ts b/src/callers/tx.ts index 59bab95..b08d1e2 100644 --- a/src/callers/tx.ts +++ b/src/callers/tx.ts @@ -20,12 +20,11 @@ import { const createWhereFilter = (sender: PublicKey | null, operator?: string) => { const exp = { signer_infos: {}, block: {} } - const escapedString = sender?.key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') - - const regex = new RegExp(escapedString!) - + 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.toString().substring(1, regex.toString().length - 1) + const regexString = regex.substring(1, regex.length - 1) if (sender) { exp.signer_infos = { From 73008f90ff4236cc3899fe48cbe65e7ab4143590 Mon Sep 17 00:00:00 2001 From: lukachi Date: Wed, 20 Mar 2024 13:07:29 +0200 Subject: [PATCH 4/4] hotfix --- src/callers/tx.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/callers/tx.ts b/src/callers/tx.ts index b08d1e2..225f0d6 100644 --- a/src/callers/tx.ts +++ b/src/callers/tx.ts @@ -20,9 +20,9 @@ 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() - + 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)