From 3ea8a6280f82118bd942cae312bc857ebeb56c1b Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Wed, 9 Mar 2016 08:24:23 +0100 Subject: [PATCH] added bip21 typedefinition --- bip21/bip21-tests.ts | 9 +++++++++ bip21/bip21.d.ts | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 bip21/bip21-tests.ts create mode 100644 bip21/bip21.d.ts diff --git a/bip21/bip21-tests.ts b/bip21/bip21-tests.ts new file mode 100644 index 000000000..e685eca10 --- /dev/null +++ b/bip21/bip21-tests.ts @@ -0,0 +1,9 @@ +/// + +let decoded:any = bip21.decode('bitcoin:1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH?amount=20.3&label=Foobar'); + +let encoded:string = bip21.encode('1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH', { + amount: 20.3, + label: 'Foobar' +}); + \ No newline at end of file diff --git a/bip21/bip21.d.ts b/bip21/bip21.d.ts new file mode 100644 index 000000000..562fb7e34 --- /dev/null +++ b/bip21/bip21.d.ts @@ -0,0 +1,13 @@ +// Type definitions for bip21 v1.1.2 +// Project: https://github.com/bitcoinjs/bip21 +// Definitions by: Stefan Huber +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module bip21 { + export function decode(uri:string) : {address:string,amount?:number}; + export function encode(address:string,options?:any) : string; +} + +declare module "bip21" { + export = bip21; +}