Skip to content

Commit

Permalink
wails: fix FT transfer info (#950)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thykof authored May 28, 2024
1 parent 4f9b8d3 commit 9b01c00
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export function CallSc(props: SignBodyProps) {
</div>
</div>

<FTTransferInfo asset={asset} parameters={Parameters} />
<FTTransferInfo
targetFunction={CalledFunction}
asset={asset}
parameters={Parameters}
/>

<hr className="h-0.25 bg-neutral opacity-40 w-full" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
import { Args } from '@massalabs/massa-web3';
import { formatFTAmount } from '@massalabs/react-ui-kit';
import { maskAddress } from '@massalabs/react-ui-kit/src/lib/massa-react/utils';
import { LogPrint } from '@wailsjs/runtime/runtime';

import Intl from '@/i18n/i18n';
import { AmountBox } from '@/pages/PasswordPromptHandler/AmountBox';
import { AssetInfo } from '@/pages/PasswordPromptHandler/Sign';
import { base64ToArray } from '@/utils/parameters';

interface FTTransferInfoProps {
targetFunction: string;
asset?: AssetInfo;
parameters?: string;
}

export function FTTransferInfo(props: FTTransferInfoProps) {
const { asset, parameters } = props;
const { targetFunction, asset, parameters } = props;

if (!asset || !parameters) {
if (targetFunction !== 'transfer' || !asset || !parameters) {
return null;
}

const args = new Args(base64ToArray(parameters));
const recipient = args.nextString();
const amount = args.nextU256();
let amount = 0n;
let recipient = '';
try {
const args = new Args(base64ToArray(parameters));
recipient = args.nextString();
amount = args.nextU256();
} catch (error) {
LogPrint(`error FTTransferInfo: ${error}`);
}

return (
<>
Expand Down

0 comments on commit 9b01c00

Please sign in to comment.