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
2 changes: 1 addition & 1 deletion scripts/make-cgw-types.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

mkdir -p openapi
curl 'https://safe-client.safe.global/openapi.json' > openapi/cgw.json
curl 'https://safe-client.safe.global/api-json' > openapi/cgw.json
npx openapi-typescript openapi/cgw.json --output openapi/cgw.ts
33 changes: 32 additions & 1 deletion src/types/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export enum TransactionInfoType {
SETTINGS_CHANGE = 'SettingsChange',
CUSTOM = 'Custom',
CREATION = 'Creation',
SWAP_ORDER = 'SwapOrder',
}

export enum ConflictType {
Expand Down Expand Up @@ -235,7 +236,37 @@ export type Creation = {
richDecodedInfo?: RichDecodedInfo
}

export type TransactionInfo = Transfer | SettingsChange | Custom | MultiSend | Cancellation | Creation
export type OrderStatuses = 'presignaturePending' | 'open' | 'fulfilled' | 'cancelled' | 'expired'
export type OrderKind = 'sell' | 'buy'
export type OrderToken = {
logo?: string | null
symbol: string
amount: string
}
export type SwapOrder = {
type: TransactionInfoType.SWAP_ORDER
humanDescription?: string | null
richDecodedInfo?: null | RichDecodedInfo
orderUid: string
status: OrderStatuses
orderKind: OrderKind
sellToken: OrderToken
buyToken: OrderToken
expiresTimestamp: number
filledPercentage: string
explorerUrl: string
surplusLabel?: string
executionPriceLabel?: string
limitPriceLabel?: string
}

export type FulfilledSwapOrder = SwapOrder & {
status: 'fulfilled'
surplusLabel: string
executionPriceLabel: string
}

export type TransactionInfo = Transfer | SettingsChange | Custom | MultiSend | Cancellation | Creation | SwapOrder

export type ModuleExecutionInfo = {
type: DetailedExecutionInfoType.MODULE
Expand Down