import { Platform } from './Platform'; /** * * @param {Platform} platform * @param {AbstractStateTransition} stateTransition * @param {Identity} identity * @param {number} [keyIndex] * @return {AbstractStateTransition} */ export async function signStateTransition( platform: Platform, stateTransition: any, identity: any, keyIndex: number = 0, ): Promise { const { client } = platform; const account = await client.getWalletAccount(); const { privateKey } = account.identities.getIdentityHDKeyById( identity.getId().toString(), keyIndex, ); await stateTransition.sign( identity.getPublicKeyById(keyIndex), privateKey.toBuffer(), ); return stateTransition; }