added bip21 typedefinition

This commit is contained in:
Stefan Huber
2016-03-09 08:24:23 +01:00
parent 3a86e056dc
commit 3ea8a6280f
2 changed files with 22 additions and 0 deletions

9
bip21/bip21-tests.ts Normal file
View File

@@ -0,0 +1,9 @@
/// <reference path='bip21.d.ts' />
let decoded:any = bip21.decode('bitcoin:1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH?amount=20.3&label=Foobar');
let encoded:string = bip21.encode('1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH', {
amount: 20.3,
label: 'Foobar'
});

13
bip21/bip21.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
// Type definitions for bip21 v1.1.2
// Project: https://github.com/bitcoinjs/bip21
// Definitions by: Stefan Huber <https://github.com/stefanhuber/>
// 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;
}