Skip to content

Commit

Permalink
fix: add proper types (#4401)
Browse files Browse the repository at this point in the history
* fix: add proper types

* fix: add extra params

* fix: build
  • Loading branch information
Rahul Sethuram authored Jun 5, 2023
1 parent 751e12d commit e9a35a0
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 5 deletions.
64 changes: 64 additions & 0 deletions packages/agents/sdk/src/lib/helpers/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
getHardcodedGasLimits as _getHardcodedGasLimits,
calculateRelayerFee as _calculateRelayerFee,
axiosGet,
XTransferStatus,
} from "@connext/nxtp-utils";
import { providers } from "ethers";

Expand Down Expand Up @@ -55,3 +56,66 @@ export const parseConnextLog = (log: providers.Log): any => {
throw new ParseConnextLogFailed({ log });
}
};

export type Transfer = {
transfer_id: string;
nonce: number;
to: string;
call_data: string;
origin_domain: string;
destination_domain: string;
receive_local: boolean;
origin_chain: string;
origin_transacting_asset: string;
origin_transacting_amount: string;
origin_bridged_asset: string;
origin_bridged_amount: string;
xcall_caller: string;
xcall_transaction_hash: string;
xcall_timestamp: string;
xcall_gas_price: string;
xcall_gas_limit: string;
xcall_block_number: string;
destination_chain: string;
status: XTransferStatus;
routers: string[];
destination_transacting_asset: string;
destination_transacting_amount: string;
destination_local_asset: string;
destination_local_amount: string;
execute_caller: string;
execute_transaction_hash: string;
execute_timestamp: number;
execute_gas_price: string;
execute_gas_limit: string;
execute_block_number: number;
execute_origin_sender: string;
reconcile_caller: string;
reconcile_transaction_hash: string;
reconcile_timestamp: string;
reconcile_gas_price: string;
reconcile_gas_limit: string;
reconcile_block_number: number;
update_time: string;
delegate: string;
message_hash: string;
canonical_domain: string;
slippage: number;
origin_sender: string;
bridged_amt: string;
normalized_in: string;
canonical_id: string;
router_fee?: string;
xcall_tx_origin: string;
execute_tx_origin: string;
reconcile_tx_origin: string;
relayer_fee: string;
error_status?: string;
execute_simulation_input?: string;
execute_simulation_from?: string;
execute_simulation_to?: string;
execute_simulation_network?: string;
error_message?: string;
message_status?: string;
relayer_fees?: string[];
};
2 changes: 1 addition & 1 deletion packages/agents/sdk/src/sdkBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ export class SdkBase extends SdkShared {
throw new ParamsInvalid({
paramsError: "Must update slippage on destination domain",
domain: domainId,
destination: transfer.destionation_domain,
destination: transfer.destination_domain,
transferId,
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/agents/sdk/src/sdkUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "@connext/nxtp-utils";
import { contractDeployments } from "@connext/nxtp-txservice";

import { validateUri, axiosGetRequest } from "./lib/helpers";
import { validateUri, axiosGetRequest, Transfer } from "./lib/helpers";
import { SdkConfig, getConfig } from "./config";
import { SdkShared } from "./sdkShared";
import { RouterBalance } from "./interfaces";
Expand Down Expand Up @@ -216,7 +216,7 @@ export class SdkUtils extends SdkShared {
transactionHash?: string;
xcallCaller?: string;
range?: { limit?: number; offset?: number };
}): Promise<any> {
}): Promise<Transfer[]> {
const { userAddress, routerAddress, status, transferId, transactionHash, range, xcallCaller, errorStatus } =
params ?? {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export const TransferButton = ({
} catch (error: unknown) {}
if (
[XTransferStatus.Executed, XTransferStatus.CompletedFast, XTransferStatus.CompletedSlow].includes(
transfer?.status,
transfer?.status as any,
)
) {
reset();
Expand All @@ -261,7 +261,7 @@ export const TransferButton = ({

if (
[XTransferStatus.Executed, XTransferStatus.CompletedFast, XTransferStatus.CompletedSlow].includes(
transfer?.status,
transfer?.status as any,
)
) {
reset();
Expand Down

0 comments on commit e9a35a0

Please sign in to comment.