Skip to content

Commit

Permalink
feat: add validatepubkey
Browse files Browse the repository at this point in the history
  • Loading branch information
gridcat committed Jun 30, 2021
1 parent 25a9147 commit c5beabc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/RPC/Wallet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AddressValidation } from '../contracts/addressValidation';
import { AddressValidation, PubKeyValidation } from '../contracts/validation';
import { BackupPrivateKeys } from '../contracts/backupPrivateKeys';
import { BackupWallet } from '../contracts/backupWallet';
import { BalanceDetail } from '../contracts/balanceDetail';
Expand Down Expand Up @@ -822,4 +822,15 @@ export class Wallet extends RPCBase {
public async validateAddress(gridcoinAddress: Address): Promise<AddressValidation> {
return this.call<AddressValidation>('validateaddress', gridcoinAddress);
}

/**
* Return information about <gridcoinpubkey>.
*
* @param {PublicKey} gridcoinPubkey
* @returns {Promise<IAddress>}
* @memberof GridcoinRPC
*/
public validatePubkey(gridcoinPubkey: PublicKey): Promise<PubKeyValidation> {
return this.call<PubKeyValidation>('validatepubkey', gridcoinPubkey);
}
}
10 changes: 10 additions & 0 deletions src/contracts/addressValidation.ts → src/contracts/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,13 @@ export interface AddressValidation {
*/
account?: string;
}

export interface PubKeyValidation extends AddressValidation {
/**
* if the public key is it’s compressed form
*
* @type {boolean}
* @memberof PubKeyValidation
*/
iscompressed: boolean;
}

0 comments on commit c5beabc

Please sign in to comment.