Skip to content

Commit 8f04242

Browse files
authored
Feat: Add richDecodedInfo type to txInfo (#136)
* fix: Add richDecodedInfo type to txInfo * fix: Remove interface and use union type instead
1 parent f87bf9a commit 8f04242

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/types/human-description.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export enum RichFragmentType {
2+
Text = 'text',
3+
TokenValue = 'tokenValue',
4+
Address = 'address',
5+
}
6+
7+
export type RichTokenValueFragment = {
8+
type: RichFragmentType.TokenValue
9+
value: string
10+
symbol: string | null
11+
logoUri: string | null
12+
}
13+
14+
export type RichTextFragment = {
15+
type: RichFragmentType.Text
16+
value: string
17+
}
18+
19+
export type RichAddressFragment = {
20+
type: RichFragmentType.Address
21+
value: string
22+
}
23+
24+
export type RichDecodedInfoFragment = RichTokenValueFragment | RichTextFragment | RichAddressFragment
25+
26+
export type RichDecodedInfo = {
27+
fragments: Array<RichDecodedInfoFragment>
28+
}

src/types/transactions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { AddressEx, Page, TokenInfo } from './common'
2+
import type { RichDecodedInfo } from './human-description'
23

34
export type ParamValue = string | ParamValue[]
45

@@ -120,6 +121,7 @@ export type Transfer = {
120121
direction: TransferDirection
121122
transferInfo: TransferInfo
122123
humanDescription?: string
124+
richDecodedInfo?: RichDecodedInfo
123125
}
124126

125127
export type SetFallbackHandler = {
@@ -191,6 +193,7 @@ export type SettingsChange = {
191193
dataDecoded: DataDecoded
192194
settingsInfo?: SettingsInfo
193195
humanDescription?: string
196+
richDecodedInfo?: RichDecodedInfo
194197
}
195198

196199
export type Custom = {
@@ -202,6 +205,7 @@ export type Custom = {
202205
actionCount?: number
203206
isCancellation: boolean
204207
humanDescription?: string
208+
richDecodedInfo?: RichDecodedInfo
205209
}
206210

207211
export type MultiSend = {
@@ -213,6 +217,7 @@ export type MultiSend = {
213217
actionCount: number
214218
isCancellation: boolean
215219
humanDescription?: string
220+
richDecodedInfo?: RichDecodedInfo
216221
}
217222

218223
export type Cancellation = Custom & {
@@ -226,6 +231,7 @@ export type Creation = {
226231
implementation?: AddressEx
227232
factory?: AddressEx
228233
humanDescription?: string
234+
richDecodedInfo?: RichDecodedInfo
229235
}
230236

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

0 commit comments

Comments
 (0)