PHP WebShell
Текущая директория: /opt/BitGoJS/modules/sdk-coin-atom/src/lib
Просмотр файла: keyPair.ts
import { KeyPairOptions } from '@bitgo/sdk-core';
import { pubkeyToAddress } from '@cosmjs/amino';
import { CosmosKeyPair, PubKeyType } from '@bitgo/abstract-cosmos';
/**
* Cosmos keys and address management.
*/
export class KeyPair extends CosmosKeyPair {
constructor(source?: KeyPairOptions) {
super(source);
}
/** @inheritdoc */
getAddress(): string {
const base64String = Buffer.from(this.getKeys().pub.slice(0, 66), 'hex').toString('base64');
return pubkeyToAddress(
{
type: PubKeyType.secp256k1,
value: base64String,
},
'cosmos'
);
}
}
Выполнить команду
Для локальной разработки. Не используйте в интернете!