diff --git a/.env.devnet b/.env.devnet index 6f114da..2060715 100644 --- a/.env.devnet +++ b/.env.devnet @@ -3,7 +3,7 @@ REACT_APP_RPC_URL_SHARD1=https://api.s1.ps.hmny.io/ REACT_APP_RPC_URL_SHARD2= REACT_APP_RPC_URL_SHARD3= REACT_APP_AVAILABLE_SHARDS=0,1 -REACT_APP_EXPLORER_V1_API_URL=https://ctrver.t.hmny.io/ +REACT_APP_VERIFICATION_SERVICE_URL=https://ctrver.t.hmny.io/ REACT_APP_INDEXER_IPFS_GATEWAY=https://ipfs.io/ipfs/ REACT_APP_PROD_ADDRESS=https://explorer-v2-api.ps.hmny.io REACT_APP_CONTRACT_SHARD=0 diff --git a/.env.example b/.env.example index cb0f159..0d11b7a 100644 --- a/.env.example +++ b/.env.example @@ -6,7 +6,7 @@ REACT_APP_RPC_URL_SHARD3=https://api.s3.t.hmny.io/ # supported shards, comma separated 0,1,2,3 REACT_APP_AVAILABLE_SHARDS=0,1,2,3 # api for contract verification -REACT_APP_EXPLORER_V1_API_URL=https://ctrver.t.hmny.io/ +REACT_APP_VERIFICATION_SERVICE_URL=https://ctrver.t.hmny.io/ # IPFS gateway for tokens assets REACT_APP_INDEXER_IPFS_GATEWAY=https://ipfs.io/ipfs/ # backend websocket API url diff --git a/.env.testnet b/.env.testnet index 0e8e9cd..2ecbd4b 100644 --- a/.env.testnet +++ b/.env.testnet @@ -3,7 +3,7 @@ REACT_APP_RPC_URL_SHARD1=https://api.s1.b.hmny.io/ REACT_APP_RPC_URL_SHARD2= REACT_APP_RPC_URL_SHARD3= REACT_APP_AVAILABLE_SHARDS=0,1 -REACT_APP_EXPLORER_V1_API_URL=https://ctrver.t.hmny.io/ +REACT_APP_VERIFICATION_SERVICE_URL=https://ctrver.b.hmny.io/ REACT_APP_INDEXER_IPFS_GATEWAY=https://ipfs.io/ipfs/ REACT_APP_PROD_ADDRESS=https://api.explorer.pops.one/ REACT_APP_CONTRACT_SHARD=0 diff --git a/src/api/explorerV1.ts b/src/api/explorerV1.ts index 9d6e153..a7ad61c 100644 --- a/src/api/explorerV1.ts +++ b/src/api/explorerV1.ts @@ -1,6 +1,6 @@ import { ShardID } from "src/types"; import { AbiItem } from "web3-utils"; -import { getContractsByField } from "./client"; +import { config } from '../config' export interface IVerifyContractData { contractAddress: string; @@ -65,7 +65,7 @@ export const verifyContractCode = async (data: IVerifyContractDataSendData) => { } const response = await fetch( - `${process.env.REACT_APP_EXPLORER_V1_API_URL}codeVerification`, + `${config.verificationServiceUrl}/codeVerification`, { method: "POST", mode: "cors", @@ -86,7 +86,7 @@ export const verifyContractCode = async (data: IVerifyContractDataSendData) => { } else { const response = await fetch( - `${process.env.REACT_APP_EXPLORER_V1_API_URL}codeVerification`, + `${config.verificationServiceUrl}/codeVerification`, { method: "POST", mode: "cors", @@ -113,7 +113,7 @@ export const verifyContractCode = async (data: IVerifyContractDataSendData) => { export const loadSourceCode = async (address: string, shard: ShardID): Promise => { const response = await fetch( - `${process.env.REACT_APP_EXPLORER_V1_API_URL}fetchContractCode?contractAddress=${address}&shard=${shard}`, + `${config.verificationServiceUrl}/fetchContractCode?contractAddress=${address}&shard=${shard}`, { mode: "cors", cache: "no-cache", diff --git a/src/config/index.ts b/src/config/index.ts index 84d5248..a5123e1 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -31,6 +31,7 @@ const contractShardId = +(process.env.REACT_APP_CONTRACT_SHARD || '0') as ShardI const oneCountryContractAddress = process.env.REACT_APP_ONE_COUNTRY_CONTRACT_ADDRESS || '' const oneCountryNFTContractAddress = process.env.REACT_APP_ONE_COUNTRY_NFT_CONTRACT_ADDRESS || '' const ipfsGateway = process.env.REACT_APP_INDEXER_IPFS_GATEWAY || '' +const verificationServiceUrl = process.env.REACT_APP_VERIFICATION_SERVICE_URL || 'https://ctrver.t.hmny.io' export const config = { availableShards, @@ -38,5 +39,6 @@ export const config = { contractShardId, oneCountryContractAddress, oneCountryNFTContractAddress, - ipfsGateway + ipfsGateway, + verificationServiceUrl } diff --git a/src/pages/AddressPage/tabs/transactions/Transactions.tsx b/src/pages/AddressPage/tabs/transactions/Transactions.tsx index b1b69ab..cedd971 100644 --- a/src/pages/AddressPage/tabs/transactions/Transactions.tsx +++ b/src/pages/AddressPage/tabs/transactions/Transactions.tsx @@ -130,18 +130,27 @@ export function Transactions(props: { // for transactions we display call method if any if (props.type === "transaction") { - const methodSignatures = await Promise.all( - txs.map((tx: any) => { - return tx.input && tx.input.length > 10 - ? getByteCodeSignatureByHash([tx.input.slice(0, 10)]) - : Promise.resolve([]); + const txInputsMap: Record = {} + txs.forEach((tx) => { + if(tx.input && tx.input.length > 10) { + txInputsMap[tx.input.slice(0, 10)] = '' + } + }) + + await Promise.all( + Object.keys(txInputsMap).map(async (txInput: string) => { + txInputsMap[txInput] = await getByteCodeSignatureByHash([txInput]); }) ); - txs = txs.map((l, i) => ({ - ...l, - signatures: methodSignatures[i], - })); + txs = txs.map((tx, i) => { + return { + ...tx, + signatures: tx.input + ? txInputsMap[tx.input.slice(0, 10)] || [] + : [], + } + }); } txs = txs.map((tx: any) => {