Skip to content

Commit

Permalink
feat: smartSwapOptions values not required
Browse files Browse the repository at this point in the history
  • Loading branch information
codingki committed Jun 19, 2024
1 parent 05630c1 commit 76196d6
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 61 deletions.
10 changes: 5 additions & 5 deletions packages/core/src/types/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ export function operationToJSON(operation: Operation): OperationJSON {
}

if ("swap" in operation) {
return {
return {
swap: swapToJSON(operation.swap),
tx_index: operation.txIndex,
amount_in: operation.amountIn,
Expand Down Expand Up @@ -2276,17 +2276,17 @@ export function smartSwapOptionsFromJSON(
smartSwapOptionsJSON: SmartSwapOptionsJSON,
): SmartSwapOptions {
return {
splitRoutes: smartSwapOptionsJSON.split_routes,
evmSwaps: smartSwapOptionsJSON.evm_swaps,
splitRoutes: Boolean(smartSwapOptionsJSON.split_routes),
evmSwaps: Boolean(smartSwapOptionsJSON.evm_swaps),
};
}

export function smartSwapOptionsToJSON(
smartSwapOptions: SmartSwapOptions,
): SmartSwapOptionsJSON {
return {
split_routes: smartSwapOptions.splitRoutes,
evm_swaps: smartSwapOptions.evmSwaps,
split_routes: Boolean(smartSwapOptions.splitRoutes),
evm_swaps: Boolean(smartSwapOptions.evmSwaps),
};
}

Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/types/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export type EvmSwapJSON = {
denom_in: string;
denom_out: string;
swap_venues: SwapVenueJSON[];
}
};

export type EvmSwap = {
inputToken: string;
Expand All @@ -381,7 +381,7 @@ export type EvmSwap = {
denomIn: string;
denomOut: string;
swapVenues: SwapVenue[];
}
};

export type AffiliateJSON = {
basis_points_fee: string;
Expand Down Expand Up @@ -505,11 +505,11 @@ export type OriginAssetsResponse = {
};

export type SmartSwapOptionsJSON = {
split_routes: boolean;
evm_swaps: boolean;
split_routes?: boolean;
evm_swaps?: boolean;
};

export type SmartSwapOptions = {
splitRoutes: boolean;
evmSwaps: boolean;
splitRoutes?: boolean;
evmSwaps?: boolean;
};
100 changes: 50 additions & 50 deletions packages/core/src/types/unified.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,71 +233,71 @@ export type EstimatedFeeJSON = {

export type OperationJSON =
| {
transfer: TransferJSON;
tx_index: number;
amount_in: string;
amount_out: string;
}
transfer: TransferJSON;
tx_index: number;
amount_in: string;
amount_out: string;
}
| {
bank_send: BankSendJSON;
tx_index: number;
amount_in: string;
amount_out: string;
}
bank_send: BankSendJSON;
tx_index: number;
amount_in: string;
amount_out: string;
}
| { swap: SwapJSON; tx_index: number; amount_in: string; amount_out: string }
| {
axelar_transfer: AxelarTransferJSON;
tx_index: number;
amount_in: string;
amount_out: string;
}
axelar_transfer: AxelarTransferJSON;
tx_index: number;
amount_in: string;
amount_out: string;
}
| {
cctp_transfer: CCTPTransferJSON;
tx_index: number;
amount_in: string;
amount_out: string;
}
cctp_transfer: CCTPTransferJSON;
tx_index: number;
amount_in: string;
amount_out: string;
}
| {
hyperlane_transfer: HyperlaneTransferJSON;
tx_index: number;
amount_in: string;
amount_out: string;
}
hyperlane_transfer: HyperlaneTransferJSON;
tx_index: number;
amount_in: string;
amount_out: string;
}
| {
evm_swap: EvmSwapJSON;
tx_index: number;
amount_in: string;
amount_out: string;
};
evm_swap: EvmSwapJSON;
tx_index: number;
amount_in: string;
amount_out: string;
};

export type Operation =
| { transfer: Transfer; txIndex: number; amountIn: string; amountOut: string }
| { bankSend: BankSend; txIndex: number; amountIn: string; amountOut: string }
| { swap: Swap; txIndex: number; amountIn: string; amountOut: string }
| {
axelarTransfer: AxelarTransfer;
txIndex: number;
amountIn: string;
amountOut: string;
}
axelarTransfer: AxelarTransfer;
txIndex: number;
amountIn: string;
amountOut: string;
}
| {
cctpTransfer: CCTPTransfer;
txIndex: number;
amountIn: string;
amountOut: string;
}
cctpTransfer: CCTPTransfer;
txIndex: number;
amountIn: string;
amountOut: string;
}
| {
hyperlaneTransfer: HyperlaneTransfer;
txIndex: number;
amountIn: string;
amountOut: string;
}
hyperlaneTransfer: HyperlaneTransfer;
txIndex: number;
amountIn: string;
amountOut: string;
}
| {
evmSwap: EvmSwap;
txIndex: number;
amountIn: string;
amountOut: string;
};
evmSwap: EvmSwap;
txIndex: number;
amountIn: string;
amountOut: string;
};

export type RouteResponseJSON = {
source_asset_denom: string;
Expand Down

0 comments on commit 76196d6

Please sign in to comment.