Skip to content

Commit

Permalink
update verification txn
Browse files Browse the repository at this point in the history
  • Loading branch information
heliuchuan committed Feb 21, 2025
1 parent 9066108 commit b4a551d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/internal/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import { signAndSubmitTransaction, generateTransaction } from "./transactionSubm
import { EntryFunctionABI, RotationProofChallenge, TypeTagU8, TypeTagVector } from "../transactions";
import { U8, MoveVector } from "../bcs";
import { waitForTransaction } from "./transaction";
import { transferCoinTransaction } from "./coin";

/**
* Retrieves account information for a specified account address.
Expand Down Expand Up @@ -858,12 +857,15 @@ export async function rotateAuthKey(
throw new Error(`Failed to rotate authentication key - ${rotateAuthKeyTxnResponse}`);
}

// Verify the rotation by transferring a small amount to yourself.
const verificationTxn = await transferCoinTransaction({
// Verify the rotation by setting the originating address to the new account.
// This verifies the rotation even if the transaction payload fails to execute successfully.
const verificationTxn = await generateTransaction({
aptosConfig,
sender: args.fromAccount.accountAddress,
recipient: args.fromAccount.accountAddress,
amount: 1,
sender: fromAccount.accountAddress,
data: {
function: "0x1::account::set_originating_address",
functionArguments: [],
},
});

return signAndSubmitTransaction({
Expand Down

0 comments on commit b4a551d

Please sign in to comment.