Skip to content

Commit

Permalink
Update to use signAndSubmitTransaction().
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharydenton authored and aptos-bot committed May 10, 2022
1 parent 4bdbaa7 commit 544f3a1
Showing 1 changed file with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { AptosClient, AptosAccount } from "aptos";
import { AptosClient } from "aptos";

type Props = {
userAddress: string | null;
Expand Down Expand Up @@ -33,23 +33,13 @@ aptos move publish --package-dir /path/to/aptos-core/aptos-move/move-examples/he

async function submitContent(address: string, content: string) {
const hexEncoded = textToHex(content);
let payload: {
function: string;
arguments: any[];
type: string;
type_arguments: any[];
};
payload = {
const transaction = {
type: "script_function_payload",
function: `${address}::Message::set_message`,
type_arguments: [],
arguments: [hexEncoded],
};

const txnRequest = await client.generateTransaction(address, payload);
const result = await (window as any).aptos.signTransaction(txnRequest);
const randomAcc = new AptosAccount();
return client.submitTransaction(randomAcc, result);
return (window as any).aptos.signAndSubmitTransaction(transaction);
}

export function DappSite({ userAddress, address }: Props) {
Expand Down

0 comments on commit 544f3a1

Please sign in to comment.