{"Mainnet only, do not sign!"}
{chain === ChainType.TestNet &&
{"Switch to MainNet to see txns"}}
@@ -77,7 +84,7 @@ function SignTxn({
)}
-
+ {/*
-
+
*/}
>
);
- async function signSingleArbitraryData() {
- const unsignedData = [
- {
- data: new Uint8Array(Buffer.from(`timestamp//${Date.now()}`)),
- message: "Timestamp confirmation"
- }];
-
- await signArbitraryData(unsignedData);
- }
-
- async function signMultipleArbitraryData() {
- const unsignedData = [
- {
- data: new Uint8Array(Buffer.from(`timestamp//${Date.now()}`)),
- message: "Timestamp confirmation"
- },
- {
- data: new Uint8Array(Buffer.from(`agent//${navigator.userAgent}`)),
- message: "User agent confirmation"
- }
- ];
-
- await signArbitraryData(unsignedData);
- }
-
- async function signArbitraryData(arbitraryData: PeraWalletArbitraryData[]) {
- try {
- const signedData: Uint8Array[] = await peraWallet.signData(
- arbitraryData,
- accountAddress
- );
-
- arbitraryData.forEach((data, index) => {
- const isVerified = algosdk.verifyBytes(data.data, signedData[index], accountAddress)
-
- console.log({data, signedData: signedData[index], isVerified});
-
- if (!isVerified) {
- handleSetLog(`Arbitrary data did not match with signed data!`);
- }
- });
-
- console.log({signedData});
- handleSetLog("Data signed successfully");
- } catch (error) {
- console.log(error)
- handleSetLog(`${error}`);
- }
- }
+ // function signArbitraryData() {
+ // try {
+ // const unsignedData = [
+ // {
+ // data: new Uint8Array(Buffer.from(`timestamp//${Date.now()}`)),
+ // message: "Timestamp confirmation"
+ // },
+ // {
+ // data: new Uint8Array(Buffer.from(`agent//${navigator.userAgent}`)),
+ // message: "User agent confirmation"
+ // }
+ // ];
+ // const signedData: Uint8Array[] = await peraWallet.signData(
+ // unsignedData,
+ // accountAddress
+ // );
+
+ // unsignedData.forEach((data, index) => {
+ // const isVerified = algosdk.verifyBytes(data.data, signedData[index], accountAddress)
+
+ // console.log({data, signedData: signedData[index], isVerified});
+
+ // if (!isVerified) {
+ // handleSetLog(`Arbitrary data did not match with signed data!`);
+ // }
+ // });
+
+ // console.log({signedData});
+ // handleSetLog("Data signed successfully");
+ // } catch (error) {
+ // console.log(error)
+ // handleSetLog(`${error}`);
+ // }
+ // }
async function signTransaction(scenario: Scenario, name: string) {
setIsRequestPending(true);