Skip to content

Commit 86f8d53

Browse files
committed
Merge pull request DefinitelyTyped#8459 from stefanhuber/master
added bip21 typedefinition
2 parents 0352d98 + 3ea8a62 commit 86f8d53

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

bip21/bip21-tests.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference path='bip21.d.ts' />
2+
3+
let decoded:any = bip21.decode('bitcoin:1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH?amount=20.3&label=Foobar');
4+
5+
let encoded:string = bip21.encode('1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH', {
6+
amount: 20.3,
7+
label: 'Foobar'
8+
});
9+

bip21/bip21.d.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Type definitions for bip21 v1.1.2
2+
// Project: https://github.com/bitcoinjs/bip21
3+
// Definitions by: Stefan Huber <https://github.com/stefanhuber/>
4+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5+
6+
declare module bip21 {
7+
export function decode(uri:string) : {address:string,amount?:number};
8+
export function encode(address:string,options?:any) : string;
9+
}
10+
11+
declare module "bip21" {
12+
export = bip21;
13+
}

0 commit comments

Comments
 (0)