style: apply prettier
This commit is contained in:
parent
c74ab67ccf
commit
03632f1507
24 changed files with 2321 additions and 1958 deletions
ts_src
|
@ -1,49 +1,51 @@
|
|||
const typeforce = require('typeforce')
|
||||
const typeforce = require('typeforce');
|
||||
|
||||
const UINT31_MAX: number = Math.pow(2, 31) - 1
|
||||
export function UInt31 (value: number): boolean {
|
||||
return typeforce.UInt32(value) && value <= UINT31_MAX
|
||||
const UINT31_MAX: number = Math.pow(2, 31) - 1;
|
||||
export function UInt31(value: number): boolean {
|
||||
return typeforce.UInt32(value) && value <= UINT31_MAX;
|
||||
}
|
||||
|
||||
export function BIP32Path (value: string): boolean {
|
||||
return typeforce.String(value) && !!value.match(/^(m\/)?(\d+'?\/)*\d+'?$/)
|
||||
export function BIP32Path(value: string): boolean {
|
||||
return typeforce.String(value) && !!value.match(/^(m\/)?(\d+'?\/)*\d+'?$/);
|
||||
}
|
||||
BIP32Path.toJSON = function () { return 'BIP32 derivation path' }
|
||||
BIP32Path.toJSON = function() {
|
||||
return 'BIP32 derivation path';
|
||||
};
|
||||
|
||||
const SATOSHI_MAX: number = 21 * 1e14
|
||||
export function Satoshi (value: number): boolean {
|
||||
return typeforce.UInt53(value) && value <= SATOSHI_MAX
|
||||
const SATOSHI_MAX: number = 21 * 1e14;
|
||||
export function Satoshi(value: number): boolean {
|
||||
return typeforce.UInt53(value) && value <= SATOSHI_MAX;
|
||||
}
|
||||
|
||||
// external dependent types
|
||||
export const ECPoint = typeforce.quacksLike('Point')
|
||||
export const ECPoint = typeforce.quacksLike('Point');
|
||||
|
||||
// exposed, external API
|
||||
export const Network = typeforce.compile({
|
||||
messagePrefix: typeforce.oneOf(typeforce.Buffer, typeforce.String),
|
||||
bip32: {
|
||||
public: typeforce.UInt32,
|
||||
private: typeforce.UInt32
|
||||
private: typeforce.UInt32,
|
||||
},
|
||||
pubKeyHash: typeforce.UInt8,
|
||||
scriptHash: typeforce.UInt8,
|
||||
wif: typeforce.UInt8
|
||||
})
|
||||
wif: typeforce.UInt8,
|
||||
});
|
||||
|
||||
export const Buffer256bit = typeforce.BufferN(32)
|
||||
export const Hash160bit = typeforce.BufferN(20)
|
||||
export const Hash256bit = typeforce.BufferN(32)
|
||||
export const Number = typeforce.Number
|
||||
export const Array = typeforce.Array
|
||||
export const Boolean = typeforce.Boolean
|
||||
export const String = typeforce.String
|
||||
export const Buffer = typeforce.Buffer
|
||||
export const Hex = typeforce.Hex
|
||||
export const maybe = typeforce.maybe
|
||||
export const tuple = typeforce.tuple
|
||||
export const UInt8 = typeforce.UInt8
|
||||
export const UInt32 = typeforce.UInt32
|
||||
export const Function = typeforce.Function
|
||||
export const BufferN = typeforce.BufferN
|
||||
export const Null = typeforce.Null
|
||||
export const oneOf = typeforce.oneOf
|
||||
export const Buffer256bit = typeforce.BufferN(32);
|
||||
export const Hash160bit = typeforce.BufferN(20);
|
||||
export const Hash256bit = typeforce.BufferN(32);
|
||||
export const Number = typeforce.Number;
|
||||
export const Array = typeforce.Array;
|
||||
export const Boolean = typeforce.Boolean;
|
||||
export const String = typeforce.String;
|
||||
export const Buffer = typeforce.Buffer;
|
||||
export const Hex = typeforce.Hex;
|
||||
export const maybe = typeforce.maybe;
|
||||
export const tuple = typeforce.tuple;
|
||||
export const UInt8 = typeforce.UInt8;
|
||||
export const UInt32 = typeforce.UInt32;
|
||||
export const Function = typeforce.Function;
|
||||
export const BufferN = typeforce.BufferN;
|
||||
export const Null = typeforce.Null;
|
||||
export const oneOf = typeforce.oneOf;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue