Skip to content

Commit

Permalink
Fix incorrection type definition in index.d.ts
Browse files Browse the repository at this point in the history
Signed-off-by: Yilun <[email protected]>
  • Loading branch information
yilunzhang committed Jan 19, 2022
1 parent 659bf28 commit d7993e1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ declare namespace nkn {
expiresAt: number
}>

listen(addrs: (RegExp | Array<RegExp> | string | Array<string> | null | void))
listen(addrs: (RegExp | Array<RegExp> | string | Array<string> | 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<null>

Expand Down Expand Up @@ -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<null>

Expand Down Expand Up @@ -285,7 +285,7 @@ declare namespace nkn {

verifyPassword(password: string, options?: {
async: boolean
})
}): boolean | Promise<boolean>
}

export class Amount extends Decimal {
Expand All @@ -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<Worker>)
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -530,15 +530,15 @@ 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

export function randomUint64(): number

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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit d7993e1

Please sign in to comment.