Skip to content

Commit

Permalink
[API-3284] add SmartRelayFeeQuote type (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhfang authored Aug 29, 2024
1 parent 8beda36 commit cb957b5
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
28 changes: 28 additions & 0 deletions packages/client/src/types/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ import {
SwapExactCoinInJSON,
SwapExactCoinOut,
SwapExactCoinOutJSON,
SmartRelayFeeQuote,
SmartRelayFeeQuoteJSON,
SmartSwapExactCoinIn,
SmartSwapExactCoinInJSON,
SwapJSON,
Expand Down Expand Up @@ -1520,6 +1522,30 @@ export function bankSendToJSON(value: BankSend): BankSendJSON {
};
}

export function smartRelayFeeQuoteFromJSON(
value: SmartRelayFeeQuoteJSON
): SmartRelayFeeQuote {
return {
feeAmount: value.fee_amount,
feeAddress: value.fee_address,
paymentContractAddress: value.payment_contract_address,
relayerAddress: value.relayer_address,
expiration: value.expiration,
};
}

export function smartRelayFeeQuoteToJSON(
value: SmartRelayFeeQuote
): SmartRelayFeeQuoteJSON {
return {
fee_amount: value.feeAmount,
fee_address: value.feeAddress,
payment_contract_address: value.paymentContractAddress,
relayer_address: value.relayerAddress,
expiration: value.expiration,
};
}

export function cctpTransferFromJSON(value: CCTPTransferJSON): CCTPTransfer {
return {
fromChainID: value.from_chain_id,
Expand All @@ -1529,6 +1555,7 @@ export function cctpTransferFromJSON(value: CCTPTransferJSON): CCTPTransfer {
denomIn: value.denom_in,
denomOut: value.denom_out,
smartRelay: value.smart_relay,
smartRelayFeeQuote: smartRelayFeeQuoteFromJSON(value.smart_relay_fee_quote),
};
}

Expand All @@ -1541,6 +1568,7 @@ export function cctpTransferToJSON(value: CCTPTransfer): CCTPTransferJSON {
denom_in: value.denomIn,
denom_out: value.denomOut,
smart_relay: value.smartRelay,
smart_relay_fee_quote: smartRelayFeeQuoteToJSON(value.smartRelayFeeQuote),
};
}

Expand Down
24 changes: 21 additions & 3 deletions packages/client/src/types/shared.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BridgeType } from "./unified";
import { BridgeType } from './unified';

export type IBCAddressJSON = {
address: string;
Expand Down Expand Up @@ -211,6 +211,7 @@ export type CCTPTransferJSON = {
denom_in: string;
denom_out: string;
smart_relay: boolean;
smart_relay_fee_quote: SmartRelayFeeQuoteJSON;
};

export type CCTPTransfer = {
Expand All @@ -221,6 +222,7 @@ export type CCTPTransfer = {
denomIn: string;
denomOut: string;
smartRelay: boolean;
smartRelayFeeQuote: SmartRelayFeeQuote;
};

export type HyperlaneTransferJSON = {
Expand Down Expand Up @@ -269,6 +271,22 @@ export type OPInitTransfer = {
smartRelay: boolean;
};

export type SmartRelayFeeQuoteJSON = {
fee_amount: string;
fee_address?: string;
payment_contract_address?: string;
relayer_address: string;
expiration: Date;
};

export type SmartRelayFeeQuote = {
feeAmount: string;
feeAddress?: string;
paymentContractAddress?: string;
relayerAddress: string;
expiration: Date;
};

export type SwapVenueJSON = {
name: string;
chain_id: string;
Expand Down Expand Up @@ -421,7 +439,7 @@ export type ChainAffiliates = {
affiliates: Affiliate[];
};

export type Reason = "UNKNOWN" | "BASE_TOKEN" | "MOST_LIQUID" | "DIRECT";
export type Reason = 'UNKNOWN' | 'BASE_TOKEN' | 'MOST_LIQUID' | 'DIRECT';

export type CosmWasmContractMsgJSON = {
contract_address: string;
Expand All @@ -433,7 +451,7 @@ export type CosmWasmContractMsg = {
msg: string;
};

export type AutopilotAction = "LIQUID_STAKE" | "CLAIM";
export type AutopilotAction = 'LIQUID_STAKE' | 'CLAIM';

export type AutopilotMsg = {
receiver: string;
Expand Down

0 comments on commit cb957b5

Please sign in to comment.