Skip to content

Commit b1173f7

Browse files
author
Daniel Sanchez
authored
fix: TokenType for balances (#62)
* fix: TokenType for balances use NATIVE_TOKEN and Transaction type uses NATIVE_COIN to define native chain token
1 parent ac50cab commit b1173f7

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

src/types/common.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { AddressEx, TokenInfo } from './transactions'
1+
export type AddressEx = {
2+
value: string
3+
name: string | null
4+
logoUri: string | null
5+
}
26

37
export type SafeInfo = {
48
address: AddressEx
@@ -20,6 +24,21 @@ export type FiatCurrencies = string[]
2024

2125
export type OwnedSafes = { safes: string[] }
2226

27+
export enum TokenType {
28+
ERC20 = 'ERC20',
29+
ERC721 = 'ERC721',
30+
NATIVE_TOKEN = 'NATIVE_TOKEN',
31+
}
32+
33+
export type TokenInfo = {
34+
type: TokenType
35+
address: string
36+
decimals: number
37+
symbol: string
38+
name: string
39+
logoUri: string | null
40+
}
41+
2342
export type SafeBalanceResponse = {
2443
fiatTotal: string
2544
items: Array<{

src/types/transactions.ts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { AddressEx, TokenInfo } from './common'
2+
13
export type ParamValue = string | ParamValue[]
24

35
export enum Operation {
@@ -27,12 +29,6 @@ export type DataDecoded = {
2729
parameters: Parameter[] | null
2830
}
2931

30-
export type AddressEx = {
31-
value: string
32-
name: string | null
33-
logoUri: string | null
34-
}
35-
3632
export enum TransactionStatus {
3733
AWAITING_CONFIRMATIONS = 'AWAITING_CONFIRMATIONS',
3834
AWAITING_EXECUTION = 'AWAITING_EXECUTION',
@@ -49,14 +45,14 @@ export enum TransferDirection {
4945
UNKNOWN = 'UNKNOWN',
5046
}
5147

52-
export enum TokenType {
48+
export enum TransactionTokenType {
5349
ERC20 = 'ERC20',
5450
ERC721 = 'ERC721',
5551
NATIVE_COIN = 'NATIVE_COIN',
5652
}
5753

5854
export type Erc20Transfer = {
59-
type: TokenType.ERC20
55+
type: TransactionTokenType.ERC20
6056
tokenAddress: string
6157
tokenName: string | null
6258
tokenSymbol: string | null
@@ -66,7 +62,7 @@ export type Erc20Transfer = {
6662
}
6763

6864
export type Erc721Transfer = {
69-
type: TokenType.ERC721
65+
type: TransactionTokenType.ERC721
7066
tokenAddress: string
7167
tokenId: string
7268
tokenName: string | null
@@ -75,7 +71,7 @@ export type Erc721Transfer = {
7571
}
7672

7773
export type NativeCoinTransfer = {
78-
type: TokenType.NATIVE_COIN
74+
type: TransactionTokenType.NATIVE_COIN
7975
value: string
8076
}
8177

@@ -278,15 +274,6 @@ export type MultisigConfirmation = {
278274
submittedAt: number
279275
}
280276

281-
export type TokenInfo = {
282-
type: TokenType
283-
address: string
284-
decimals: number
285-
symbol: string
286-
name: string
287-
logoUri: string | null
288-
}
289-
290277
export type MultisigExecutionDetails = {
291278
type: 'MULTISIG'
292279
submittedAt: number

0 commit comments

Comments
 (0)