-
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.
Add CallSc component for smart contract calls and update confirmation…
… dialog
- Loading branch information
Showing
3 changed files
with
64 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { toMAS } from '@massalabs/massa-web3'; | ||
import { | ||
SnapComponent, | ||
Container, | ||
Box, | ||
Heading, | ||
Text, | ||
Section, | ||
Bold, | ||
Copyable, | ||
} from '@metamask/snaps-sdk/jsx'; | ||
|
||
type CallScProps = { | ||
fee: string; | ||
functionName: string; | ||
at: string; | ||
args: number[]; | ||
coins: string; | ||
}; | ||
|
||
export const CallSc: SnapComponent<CallScProps> = (params: CallScProps) => { | ||
return ( | ||
<Container> | ||
<Box> | ||
<Heading>Do you want to call the following smart contract?</Heading> | ||
<Section> | ||
<Text> | ||
<Bold>Contract: </Bold> | ||
</Text> | ||
<Copyable value={params.at} /> | ||
</Section> | ||
<Section> | ||
<Text> | ||
<Bold>Function: </Bold> | ||
{params.functionName} | ||
</Text> | ||
<Text> | ||
<Bold>Coins: </Bold> | ||
{toMAS(params.coins).toString()} MAS | ||
</Text> | ||
<Text> | ||
<Bold>Fee: </Bold> | ||
{toMAS(params.fee).toString()} MAS | ||
</Text> | ||
<Text> | ||
<Bold>Arguments: </Bold> | ||
{params.args.toString()} | ||
</Text> | ||
</Section> | ||
</Box> | ||
</Container> | ||
); | ||
}; |
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