Add stricter Signer interface check
This commit is contained in:
parent
969b3a5e18
commit
053d282e9d
5 changed files with 19 additions and 2 deletions
ts_src
|
@ -12,6 +12,14 @@ BIP32Path.toJSON = (): string => {
|
|||
return 'BIP32 derivation path';
|
||||
};
|
||||
|
||||
export function Signer(obj: any): boolean {
|
||||
return (
|
||||
(typeforce.Buffer(obj.publicKey) ||
|
||||
typeof obj.getPublicKey === 'function') &&
|
||||
typeof obj.sign === 'function'
|
||||
);
|
||||
}
|
||||
|
||||
const SATOSHI_MAX: number = 21 * 1e14;
|
||||
export function Satoshi(value: number): boolean {
|
||||
return typeforce.UInt53(value) && value <= SATOSHI_MAX;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue