From d7993e1884762db7cdb4ddf0067c2b61d25019c2 Mon Sep 17 00:00:00 2001 From: Yilun Date: Wed, 19 Jan 2022 03:37:16 -0800 Subject: [PATCH] Fix incorrection type definition in index.d.ts Signed-off-by: Yilun --- index.d.ts | 36 ++++++++++++++++++------------------ package.json | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/index.d.ts b/index.d.ts index 0177d66..17c3f09 100644 --- a/index.d.ts +++ b/index.d.ts @@ -55,13 +55,13 @@ declare namespace nkn { expiresAt: number }> - listen(addrs: (RegExp | Array | string | Array | null | void)) + listen(addrs: (RegExp | Array | string | Array | null | void)): void - onConnect(f: ConnectHandler) + onConnect(f: ConnectHandler): void - onMessage(func: MessageHandler) + onMessage(func: MessageHandler): void - onSession(func: SessionHandler) + onSession(func: SessionHandler): void publish(topic: string, data: MessageData, options?: PublishOptions): Promise @@ -128,9 +128,9 @@ declare namespace nkn { expiresAt: number }> - onConnect(func: ConnectHandler) + onConnect(func: ConnectHandler): void - onMessage(func: MessageHandler) + onMessage(func: MessageHandler): void publish(topic: string, data: MessageData, options?: PublishOptions): Promise @@ -285,7 +285,7 @@ declare namespace nkn { verifyPassword(password: string, options?: { async: boolean - }) + }): boolean | Promise } export class Amount extends Decimal { @@ -296,11 +296,9 @@ declare namespace nkn { publicKey: string privateKey: Uint8Array curvePrivateKey: Uint8Array - sharedKeyCache: Map useWorker: boolean worker: Worker | null workerMsgID: number - workerMsgCache: Map constructor(seed: string, options?: { worker?: boolean | (() => Worker | Promise) @@ -322,7 +320,7 @@ declare namespace nkn { sign(message: string): string } - export type ConnectHandler = ({addr: string}) => void + export type ConnectHandler = (params: {addr: string}) => void export type CreateTransactionOptions = { fee: number | string | Amount | null | void @@ -413,18 +411,20 @@ declare namespace nkn { type Transaction = Object // TODO + export type ScryptParams = { + salt: string, + N: number, + r: number, + p: number, + }; + type WalletJson = { Version: number MasterKey: string IV: string SeedEncrypted: string Address: string - Scrypt?: { - Salt: string - N: number - R: number - P: number - } + Scrypt?: ScryptParams } export namespace aes { @@ -530,7 +530,7 @@ declare namespace nkn { export function setPRNG(fn: (x: Uint8Array, n: number) => void): void - export function randomBytesHex(len: num): string + export function randomBytesHex(len: number): string export function randomInt32(): number @@ -538,7 +538,7 @@ declare namespace nkn { export function mergeTypedArrays(a: TypedArray, b: TypedArray): TypedArray - export function assignDefined(target: Object, ...sources: Object[]) + export function assignDefined(target: Object, ...sources: Object[]): void export function utf8ToBytes(s: string): Uint8Array diff --git a/package.json b/package.json index defaa0c..fc46c40 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nkn-sdk", - "version": "1.2.2", + "version": "1.2.3", "description": "NKN client and wallet SDK", "main": "lib/index.js", "exports": {