How to use the stellar-base.Keypair.fromPublicKey function in stellar-base

To help you get started, we’ve selected a few stellar-base examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stellar / js-stellar-sdk / src / utils.ts View on Github external
export function verifyTxSignedBy(
    transaction: Transaction,
    accountId: string,
  ): boolean {
    const hashedSignatureBase = transaction.hash();

    const keypair = Keypair.fromPublicKey(accountId);

    return !!transaction.signatures.find((sig) => {
      return keypair.verify(hashedSignatureBase, sig.signature());
    });
  }
github nguyenkha / forest.network / lib / tx / v1.js View on Github external
throw Error('Wrong version');
  }
  let operation, params;
  switch (tx.operation) {
    case 1:
      operation = 'create_account';
      params = CreateAccountParams.decode(tx.params);
      params.address = base32.encode(params.address);
      Keypair.fromPublicKey(params.address);
      break;

    case 2:
      operation = 'payment';
      params = PaymentParams.decode(tx.params);
      params.address = base32.encode(params.address);
      Keypair.fromPublicKey(params.address);
      break;
    
    case 3:
      operation = 'post';
      params = PostParams.decode(tx.params);
      break;

    case 4:
      operation = 'update_account';
      params = UpdateAccountParams.decode(tx.params);
      break;
    
    case 5:
      operation = 'interact';
      params = InteractParams.decode(tx.params);
      params.object = params.object.toString('hex').toUpperCase();
github nguyenkha / forest.network / lib / tx / index.js View on Github external
function verify(tx) {
  const key = Keypair.fromPublicKey(tx.account);
  return key.verify(getUnsignedHash(tx), tx.signature);
}