Skip to content
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
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type { SafeInfo, SafeOverview } from './types/safe-info'
import type { ChainListResponse, ChainInfo } from './types/chains'
import type { SafeAppsResponse } from './types/safe-apps'
import type { MasterCopyReponse } from './types/master-copies'
import type { BaselineConfirmationView, CowSwapConfirmationView, DecodedDataResponse } from './types/decoded-data'
import type { BaselineConfirmationView, CowConfirmationView, DecodedDataResponse } from './types/decoded-data'
import type { SafeMessage, SafeMessageListPage } from './types/safe-messages'
import { DEFAULT_BASE_URL } from './config'
import type { DelegateResponse, DelegatesRequest } from './types/delegates'
Expand Down Expand Up @@ -303,7 +303,7 @@ export function getConfirmationView(
safeAddress: string,
encodedData: operations['data_decoder']['parameters']['body']['data'],
to?: operations['data_decoder']['parameters']['body']['to'],
): Promise<BaselineConfirmationView | CowSwapConfirmationView> {
): Promise<BaselineConfirmationView | CowConfirmationView> {
return postEndpoint(baseUrl, '/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation', {
path: { chainId: chainId, safe_address: safeAddress },
body: { data: encodedData, to },
Expand Down
4 changes: 2 additions & 2 deletions src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type { ChainListResponse, ChainInfo } from './chains'
import type { SafeAppsResponse } from './safe-apps'
import type {
BaselineConfirmationView,
CowSwapConfirmationView,
CowConfirmationView,
DecodedDataRequest,
DecodedDataResponse,
} from './decoded-data'
Expand Down Expand Up @@ -774,7 +774,7 @@ export interface operations {
}
responses: {
200: {
schema: BaselineConfirmationView | CowSwapConfirmationView
schema: BaselineConfirmationView | CowConfirmationView
}
}
}
Expand Down
18 changes: 16 additions & 2 deletions src/types/decoded-data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import type { SwapOrder } from './transactions'
import type { SwapOrder, TwapOrder } from './transactions'

export enum ConfirmationViewTypes {
COW_SWAP_ORDER = 'COW_SWAP_ORDER',
COW_SWAP_TWAP_ORDER = 'COW_SWAP_TWAP_ORDER',
}

export type DecodedDataRequest = {
data: string
Expand Down Expand Up @@ -37,5 +42,14 @@ export type BaselineConfirmationView = {
type: 'GENERIC'
} & DecodedDataResponse

export type CowSwapConfirmationView = { type: 'COW_SWAP_ORDER' } & DecodedDataResponse &
export type SwapConfirmationView = {
type: ConfirmationViewTypes.COW_SWAP_ORDER
} & DecodedDataResponse &
Omit<SwapOrder, 'type' | 'humanDescription' | 'richDecodedInfo'>

export type TwapConfirmationView = {
type: ConfirmationViewTypes.COW_SWAP_TWAP_ORDER
} & DecodedDataResponse &
Omit<TwapOrder, 'type' | 'humanDescription' | 'richDecodedInfo'>

export type CowConfirmationView = SwapConfirmationView | TwapConfirmationView
4 changes: 2 additions & 2 deletions src/types/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,13 @@ export type SwapOrder = BaseOrder & {
// Specific type for TwapOrder
export type TwapOrder = BaseOrder & {
type: TransactionInfoType.TWAP_ORDER
numberOfParts: number
numberOfParts: string
/** @description The amount of sellToken to sell in each part */
partSellAmount: string
/** @description The amount of buyToken that must be bought in each part */
minPartLimit: string
/** @description The duration of the TWAP interval */
timeBetweenParts: string
timeBetweenParts: number
/** @description Whether the TWAP is valid for the entire interval or not */
durationOfPart: DurationOfPart
/** @description The start time of the TWAP */
Expand Down