Skip to content

Commit

Permalink
Add partially verified smart contract alert
Browse files Browse the repository at this point in the history
  • Loading branch information
nicole-obrien committed May 23, 2024
1 parent 534aefb commit 4381826
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,36 @@
export let parsedSmartContract: IParsedSmartContractData
export let networkId: EvmNetworkId
function getMethodSignature(parsedMethod) {
const parameterSignatures = parsedMethod.inputs.map((input) => `${input.name} ${input.type}`)
return `${parsedMethod.name}(${parameterSignatures.join(', ')})`
}
</script>

<EvmTransactionAlert
variant="warning"
message={localize('popups.smartContractCall.unableToVerify')}
{networkId}
contractAddress={parsedSmartContract.recipientAddress}
>
{#if parsedSmartContract.parsedMethod}
{#if parsedSmartContract.parsedMethod}
<EvmTransactionAlert
variant="warning"
message={localize('popups.smartContractCall.partiallyVerified')}
{networkId}
contractAddress={parsedSmartContract.recipientAddress}
>
<Table
collapsible
collapsibleTitle={parsedSmartContract.parsedMethod.name}
collapsibleTitle={getMethodSignature(parsedSmartContract.parsedMethod)}
items={parsedSmartContract?.parsedMethod.inputs.map((input) => ({
key: input.name,
value: String(input.value) ?? localize('general.unknown'),
}))}
/>
{:else}
</EvmTransactionAlert>
{:else}
<EvmTransactionAlert
variant="danger"
message={localize('popups.smartContractCall.unableToVerify')}
{networkId}
contractAddress={parsedSmartContract.recipientAddress}
>
<Table
items={[
{
Expand All @@ -34,5 +46,5 @@
},
]}
/>
{/if}
</EvmTransactionAlert>
</EvmTransactionAlert>
{/if}
3 changes: 2 additions & 1 deletion packages/shared/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,8 @@
"smartContractCall": {
"title": "Smart contract call to {contractAddress}",
"unableToVerify": "Bloom is unable to verify the smart contract call. Only proceed with apps you trust.",
"viewSmartContract": "View Smart Contract",
"partiallyVerified": "Bloom has partially verified the smart contract call, proceed with apps you trust.",
"viewSmartContract": "View Contract",
"action": "Confirm",
"success": "Smart contract call to {recipient}"
},
Expand Down

0 comments on commit 4381826

Please sign in to comment.