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

feat: add ability to search by execute and reconcile hash #4653

Merged
merged 1 commit into from
Jul 7, 2023
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
2 changes: 2 additions & 0 deletions packages/agents/sdk/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,8 @@ export const SdkGetTransfersParamsSchema = Type.Optional(
errorStatus: Type.Optional(XTransferErrorStatus),
transferId: Type.Optional(Type.String()),
transactionHash: Type.Optional(Type.String()),
executeTransactionHash: Type.Optional(Type.String()),
reconcileTransactionHash: Type.Optional(Type.String()),
xcallCaller: Type.Optional(Type.String()),
range: Type.Optional(TRange),
}),
Expand Down
14 changes: 13 additions & 1 deletion packages/agents/sdk/src/sdkUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ export class SdkUtils extends SdkShared {
errorStatus?: XTransferErrorStatus;
transferId?: string;
transactionHash?: string;
executeTransactionHash?: string;
reconcileTransactionHash?: string;
xcallCaller?: string;
originDomain?: string;
destinationDomain?: string;
Expand All @@ -230,6 +232,8 @@ export class SdkUtils extends SdkShared {
errorStatus,
originDomain,
destinationDomain,
executeTransactionHash,
reconcileTransactionHash,
} = params ?? {};

const userIdentifier = userAddress ? `xcall_tx_origin=eq.${userAddress.toLowerCase()}&` : "";
Expand All @@ -243,6 +247,12 @@ export class SdkUtils extends SdkShared {
const xcallCallerIdentifier = xcallCaller ? `xcall_caller=eq.${xcallCaller.toLowerCase()}&` : "";
const originDomainIdentifier = originDomain ? `origin_domain.in.(${originDomain})&` : "";
const destinationDomainIdentifier = destinationDomain ? `destination_domain.in.(${destinationDomain})&` : "";
const executeTransactionHashIdentifier = executeTransactionHash
? `execute_transaction_hash=eq.${executeTransactionHash.toLowerCase()}&`
: "";
const reconcileTransactionHashIdentifier = reconcileTransactionHash
? `reconcile_transaction_hash=eq.${reconcileTransactionHash.toLowerCase()}&`
: "";

const searchIdentifier =
userIdentifier +
Expand All @@ -253,7 +263,9 @@ export class SdkUtils extends SdkShared {
transactionHashIdentifier +
xcallCallerIdentifier +
originDomainIdentifier +
destinationDomainIdentifier;
destinationDomainIdentifier +
executeTransactionHashIdentifier +
reconcileTransactionHashIdentifier;

const limit = range?.limit ? range.limit : 10;
const offset = range?.offset ? range.offset : 0;
Expand Down