PHP WebShell

Текущая директория: /usr/lib/node_modules/bitgo/node_modules/@bitgo-forks/avalanchejs/src/signer

Просмотр файла: addTxSignatures.ts

import type { UnsignedTx } from '../vms/common/unsignedTx';
import { secp256k1 } from '../crypto';

export const addTxSignatures = async ({
  unsignedTx,
  privateKeys,
}: {
  unsignedTx: UnsignedTx;
  privateKeys: Uint8Array[];
}) => {
  const unsignedBytes = unsignedTx.toBytes();

  await Promise.all(
    privateKeys.map(async (privateKey) => {
      const publicKey = secp256k1.getPublicKey(privateKey);

      if (unsignedTx.hasPubkey(publicKey)) {
        const signature = await secp256k1.sign(unsignedBytes, privateKey);
        unsignedTx.addSignature(signature);
      }
    }),
  );
};

Выполнить команду


Для локальной разработки. Не используйте в интернете!