-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #1376
- Loading branch information
Showing
29 changed files
with
518 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { Feature } from './types'; | ||
|
||
import { getEnvValue } from '../utils'; | ||
|
||
const title = 'Transaction interpretation'; | ||
|
||
const provider = getEnvValue('NEXT_PUBLIC_TRANSACTION_INTERPRETATION_PROVIDER') || 'none'; | ||
|
||
const config: Feature<{ provider: string }> = (() => { | ||
if (provider !== 'none') { | ||
return Object.freeze({ | ||
title, | ||
provider, | ||
isEnabled: true, | ||
}); | ||
} | ||
|
||
return Object.freeze({ | ||
title, | ||
isEnabled: false, | ||
}); | ||
})(); | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import type { TxInterpretationResponse } from 'types/api/txInterpretation'; | ||
|
||
export const txInterpretation: TxInterpretationResponse = { | ||
data: { | ||
summaries: [ { | ||
summary_template: `{action_type} {amount} {token} to {to_address} on {timestamp}`, | ||
summary_template_variables: { | ||
action_type: { type: 'string', value: 'Transfer' }, | ||
amount: { type: 'currency', value: '100' }, | ||
token: { | ||
type: 'token', | ||
value: { | ||
name: 'Duck', | ||
type: 'ERC-20', | ||
symbol: 'DUCK', | ||
address: '0x486a3c5f34cDc4EF133f248f1C81168D78da52e8', | ||
holders: '1152', | ||
decimals: '18', | ||
icon_url: null, | ||
total_supply: '210000000000000000000000000', | ||
exchange_rate: null, | ||
circulating_market_cap: null, | ||
}, | ||
}, | ||
to_address: { | ||
type: 'address', | ||
value: { | ||
hash: '0x48c04ed5691981C42154C6167398f95e8f38a7fF', | ||
implementation_name: null, | ||
is_contract: false, | ||
is_verified: false, | ||
name: null, | ||
private_tags: [], | ||
public_tags: [], | ||
watchlist_names: [], | ||
ens_domain_name: null, | ||
}, | ||
}, | ||
timestamp: { | ||
type: 'timestamp', | ||
value: '1687005431', | ||
}, | ||
}, | ||
} ], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ | |
| "graphQL" | ||
| "info" | ||
| "key" | ||
| "lightning" | ||
| "link" | ||
| "lock" | ||
| "minus" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type { TxInterpretationResponse } from 'types/api/txInterpretation'; | ||
|
||
import { TOKEN_INFO_ERC_20 } from './token'; | ||
|
||
export const TX_INTERPRETATION: TxInterpretationResponse = { | ||
data: { | ||
summaries: [ | ||
{ | ||
summary_template: '{action_type} {source_amount} Ether into {destination_amount} {destination_token}', | ||
summary_template_variables: { | ||
action_type: { type: 'string', value: 'Wrap' }, | ||
source_amount: { type: 'currency', value: '0.7' }, | ||
destination_amount: { type: 'currency', value: '0.7' }, | ||
destination_token: { | ||
type: 'token', | ||
value: TOKEN_INFO_ERC_20, | ||
}, | ||
}, | ||
}, | ||
{ | ||
summary_template: '{action_type} {source_amount} Ether into {destination_amount} {destination_token}', | ||
summary_template_variables: { | ||
action_type: { type: 'string', value: 'Wrap' }, | ||
source_amount: { type: 'currency', value: '0.7' }, | ||
destination_amount: { type: 'currency', value: '0.7' }, | ||
destination_token: { | ||
type: 'token', | ||
value: TOKEN_INFO_ERC_20, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { AddressParam } from 'types/api/addressParams'; | ||
import type { TokenInfo } from 'types/api/token'; | ||
|
||
export interface TxInterpretationResponse { | ||
data: { | ||
summaries: Array<TxInterpretationSummary>; | ||
}; | ||
} | ||
|
||
export type TxInterpretationSummary = { | ||
summary_template: string; | ||
summary_template_variables: Record<string, TxInterpretationVariable>; | ||
} | ||
|
||
export type TxInterpretationVariable = | ||
TxInterpretationVariableString | | ||
TxInterpretationVariableCurrency | | ||
TxInterpretationVariableTimestamp | | ||
TxInterpretationVariableToken | | ||
TxInterpretationVariableAddress; | ||
|
||
export type TxInterpretationVariableType = 'string' | 'currency' | 'timestamp' | 'token' | 'address'; | ||
|
||
export type TxInterpretationVariableString = { | ||
type: 'string'; | ||
value: string; | ||
} | ||
|
||
export type TxInterpretationVariableCurrency = { | ||
type: 'currency'; | ||
value: string; | ||
} | ||
|
||
export type TxInterpretationVariableTimestamp = { | ||
type: 'timestamp'; | ||
value: string; | ||
} | ||
|
||
export type TxInterpretationVariableToken = { | ||
type: 'token'; | ||
value: TokenInfo; | ||
} | ||
|
||
export type TxInterpretationVariableAddress = { | ||
type: 'address'; | ||
value: AddressParam; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.