From cb957b5a3d1d790c8374ed8976fef6f2f2b74958 Mon Sep 17 00:00:00 2001 From: dhfang Date: Wed, 28 Aug 2024 23:38:40 -0700 Subject: [PATCH] [API-3284] add SmartRelayFeeQuote type (#185) --- packages/client/src/types/converters.ts | 28 +++++++++++++++++++++++++ packages/client/src/types/shared.ts | 24 ++++++++++++++++++--- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/packages/client/src/types/converters.ts b/packages/client/src/types/converters.ts index fba8ebe1..b961f965 100644 --- a/packages/client/src/types/converters.ts +++ b/packages/client/src/types/converters.ts @@ -100,6 +100,8 @@ import { SwapExactCoinInJSON, SwapExactCoinOut, SwapExactCoinOutJSON, + SmartRelayFeeQuote, + SmartRelayFeeQuoteJSON, SmartSwapExactCoinIn, SmartSwapExactCoinInJSON, SwapJSON, @@ -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, @@ -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), }; } @@ -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), }; } diff --git a/packages/client/src/types/shared.ts b/packages/client/src/types/shared.ts index 9f5af012..e5315c79 100644 --- a/packages/client/src/types/shared.ts +++ b/packages/client/src/types/shared.ts @@ -1,4 +1,4 @@ -import { BridgeType } from "./unified"; +import { BridgeType } from './unified'; export type IBCAddressJSON = { address: string; @@ -211,6 +211,7 @@ export type CCTPTransferJSON = { denom_in: string; denom_out: string; smart_relay: boolean; + smart_relay_fee_quote: SmartRelayFeeQuoteJSON; }; export type CCTPTransfer = { @@ -221,6 +222,7 @@ export type CCTPTransfer = { denomIn: string; denomOut: string; smartRelay: boolean; + smartRelayFeeQuote: SmartRelayFeeQuote; }; export type HyperlaneTransferJSON = { @@ -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; @@ -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; @@ -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;