-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
US-322: Can now decode scilla logs. (#16)
* (feat) Scilla log decodes now work. * (fix) US-322: Fix package-lock.json
- Loading branch information
1 parent
8bb404d
commit bf8b0c9
Showing
5 changed files
with
142 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
21 changes: 21 additions & 0 deletions
21
src/execution/transaction/decoder/DecodedScillaLogSignature.tsx
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,21 @@ | ||
import { EventFragment } from "ethers"; | ||
import { FC, memo } from "react"; | ||
|
||
type DecodedScillaLogSignatureProps = { | ||
name: string; | ||
address: string; | ||
}; | ||
|
||
const DecodedScillaLogSignature: FC<DecodedScillaLogSignatureProps> = ({ event }) => { | ||
if (event) { | ||
return ( | ||
<span className="font-mono"> | ||
<span className="font-italic">_eventName:</span> <span className="font-bold text-blue-900">{event.name}</span><br/> | ||
<span className="font-italic">address:</span> <span className="font-bold text-blue-500">{event.address}</span><br/> | ||
</span>) | ||
} else { | ||
return ( <div /> ) | ||
} | ||
} | ||
|
||
export default memo(DecodedScillaLogSignature); |
58 changes: 58 additions & 0 deletions
58
src/execution/transaction/decoder/DecodedScillaParamsTable.tsx
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,58 @@ | ||
import { ParamType, Result } from "ethers"; | ||
import { FC, memo } from "react"; | ||
import { DevMethod, UserMethod } from "../../../sourcify/useSourcify"; | ||
import DecodedParamRow from "./DecodedParamRow"; | ||
|
||
type DecodedScillaParamsTableProps = { | ||
params: object; | ||
}; | ||
|
||
type DecodedScillaParamRowProps = { | ||
name: string; | ||
valueType: string; | ||
value: string; | ||
}; | ||
|
||
const DecodedScillaParamRow: FC<DecodedScillaParamRowProps> = ({ | ||
name, | ||
valueType, | ||
value }) => { | ||
return ( | ||
<> | ||
<tr className="grid grid-cols-12 gap-x-2 py-2 hover:bg-gray-100"> | ||
<td className="col-span-3 pl-1"> | ||
<span className="text-gray-600">{name}</span> | ||
</td> | ||
<td className="col-span-1 text-gray-500">{valueType}</td> | ||
<td className="col-span-8 text-gray-500">{value}</td> | ||
</tr> | ||
</> | ||
)}; | ||
|
||
|
||
const DecodedScillaParamsTable: FC<DecodedScillaParamsTableProps> = ({ | ||
params } ) => { | ||
// params.map((val) => { alert(`X ${JSON.stringify(val)}`) }); | ||
return ( | ||
<table className="w-full border"> | ||
<thead> | ||
<tr className="grid grid-cols-12 gap-x-2 bg-gray-100 py-2 text-left"> | ||
<th className="col-span-3 pl-1"> | ||
name | ||
</th> | ||
<th className="col-span-1 pl-1"> | ||
type | ||
</th> | ||
<th className="col-span-8 pr-1">value</th> | ||
</tr> | ||
</thead> | ||
<tbody className="divide-y"> | ||
{params.map((val) => ( | ||
<DecodedScillaParamRow name={val["vname"]} valueType={val["type"]} value={val["value"]} /> | ||
))} | ||
</tbody> | ||
</table> | ||
); | ||
} | ||
|
||
export default memo(DecodedScillaParamsTable); |