@aptos-labs/ts-sdk
Version:
Aptos TypeScript SDK
70 lines • 3.2 kB
JavaScript
// Copyright © Aptos Foundation
// SPDX-License-Identifier: Apache-2.0
import { Serializable } from "../../bcs/serializer.js";
import { AccountAddress } from "../../core/accountAddress.js";
import { MoveString, MoveVector, U64 } from "../../bcs/index.js";
/**
* Represents a challenge required for the account owner to sign in order to rotate the authentication key.
* @group Implementation
* @category Transactions
*/
export class RotationProofChallenge extends Serializable {
// Resource account address
accountAddress = AccountAddress.ONE;
// Module name, i.e: 0x1::account
moduleName = new MoveString("account");
// The rotation proof challenge struct name that live under the module
structName = new MoveString("RotationProofChallenge");
// Signer's address
originator;
// Signer's current authentication key
currentAuthKey;
// New public key to rotate to
newPublicKey;
// Sequence number of the account
sequenceNumber;
/**
* Initializes a new instance of the class with the specified parameters.
* This constructor sets up the necessary attributes for managing account keys.
*
* @param args - The parameters required to create the instance.
* @param args.sequenceNumber - The sequence number associated with the transaction.
* @param args.originator - The account address of the originator.
* @param args.currentAuthKey - The current authentication key of the account.
* @param args.newPublicKey - The new public key to be set for the account.
* @group Implementation
* @category Transactions
*/
constructor(args) {
super();
this.sequenceNumber = new U64(args.sequenceNumber);
this.originator = args.originator;
this.currentAuthKey = args.currentAuthKey;
this.newPublicKey = MoveVector.U8(args.newPublicKey.toUint8Array());
}
/**
* Serializes the properties of the current instance for transmission or storage.
* This function helps in converting the instance data into a format suitable for serialization.
*
* @param serializer - The serializer used to serialize the instance properties.
* @param serializer.accountAddress - The account address to serialize.
* @param serializer.moduleName - The module name to serialize.
* @param serializer.structName - The struct name to serialize.
* @param serializer.sequenceNumber - The sequence number to serialize.
* @param serializer.originator - The originator to serialize.
* @param serializer.currentAuthKey - The current authentication key to serialize.
* @param serializer.newPublicKey - The new public key to serialize.
* @group Implementation
* @category Transactions
*/
serialize(serializer) {
serializer.serialize(this.accountAddress);
serializer.serialize(this.moduleName);
serializer.serialize(this.structName);
serializer.serialize(this.sequenceNumber);
serializer.serialize(this.originator);
serializer.serialize(this.currentAuthKey);
serializer.serialize(this.newPublicKey);
}
}
//# sourceMappingURL=rotationProofChallenge.js.map