-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1374 from gabrielbazan7/ref/walletconnect
[REF] WC: display decoded transaction parameters in detail view
- Loading branch information
Showing
28 changed files
with
3,042 additions
and
444 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
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 @@ | ||
export const ETHERSCAN_API_URL = 'https://api.etherscan.io/v2/api'; |
Empty file.
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,54 @@ | ||
import axios from 'axios'; | ||
import {ETHERSCAN_API_URL} from './etherscan.constants'; | ||
import {ETHERSCAN_API_KEY} from '@env'; | ||
import {Effect} from '../../store'; | ||
import {updateContractAbi} from '../../store/wallet-connect-v2/wallet-connect-v2.actions'; | ||
|
||
const getContractAbi = | ||
(chainId: string, contractAddress: string): Effect<Promise<string>> => | ||
async (dispatch, getState) => { | ||
const {WALLET_CONNECT_V2} = getState(); | ||
const ABI = WALLET_CONNECT_V2.contractAbi[contractAddress]; | ||
if (ABI) { | ||
return ABI; | ||
} | ||
const url = `${ETHERSCAN_API_URL}?chainid=${chainId}&module=contract&action=getabi&address=${contractAddress}&apikey=${ETHERSCAN_API_KEY}`; | ||
const headers = { | ||
'Content-Type': 'application/json', | ||
}; | ||
try { | ||
const {data} = await axios.get(url, {headers}); | ||
const {result} = data; | ||
if (result) { | ||
dispatch(updateContractAbi(result, contractAddress)); | ||
} | ||
return result; | ||
} catch (error: any) { | ||
throw error.message; | ||
} | ||
}; | ||
|
||
const getStorageAt = async ( | ||
chainId: string, | ||
proxyAddress: string, | ||
implementationSlot: string, | ||
): Promise<string> => { | ||
const url = `${ETHERSCAN_API_URL}?chainid=${chainId}&module=proxy&action=eth_getStorageAt&address=${proxyAddress}&position=${implementationSlot}&tag=latest&apikey=${ETHERSCAN_API_KEY}`; | ||
const headers = { | ||
'Content-Type': 'application/json', | ||
}; | ||
try { | ||
const {data} = await axios.get(url, {headers}); | ||
const {result} = data; | ||
return result; | ||
} catch (error: any) { | ||
throw error.message; | ||
} | ||
}; | ||
|
||
const EtherscanAPI = { | ||
getContractAbi, | ||
getStorageAt, | ||
}; | ||
|
||
export default EtherscanAPI; |
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
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.