add payto type
This commit is contained in:
parent
1c3e9473fd
commit
241a37c889
@ -69,10 +69,10 @@ export function generateFakeSegwitAddress(
|
|||||||
addr[0] === "t" && addr[1] == "b"
|
addr[0] === "t" && addr[1] == "b"
|
||||||
? "tb"
|
? "tb"
|
||||||
: addr[0] === "b" && addr[1] == "c" && addr[2] === "r" && addr[3] == "t"
|
: addr[0] === "b" && addr[1] == "c" && addr[2] === "r" && addr[3] == "t"
|
||||||
? "bcrt"
|
? "bcrt"
|
||||||
: addr[0] === "b" && addr[1] == "c"
|
: addr[0] === "b" && addr[1] == "c"
|
||||||
? "bc"
|
? "bc"
|
||||||
: undefined;
|
: undefined;
|
||||||
if (prefix === undefined) throw new Error("unknown bitcoin net");
|
if (prefix === undefined) throw new Error("unknown bitcoin net");
|
||||||
|
|
||||||
const addr1 = segwit.default.encode(prefix, 0, first_part);
|
const addr1 = segwit.default.encode(prefix, 0, first_part);
|
||||||
|
@ -24,7 +24,7 @@ export type PaytoUri =
|
|||||||
| PaytoUriBitcoin;
|
| PaytoUriBitcoin;
|
||||||
|
|
||||||
export interface PaytoUriGeneric {
|
export interface PaytoUriGeneric {
|
||||||
targetType: string;
|
targetType: PaytoType | string;
|
||||||
targetPath: string;
|
targetPath: string;
|
||||||
params: { [name: string]: string };
|
params: { [name: string]: string };
|
||||||
}
|
}
|
||||||
@ -55,6 +55,8 @@ export interface PaytoUriBitcoin extends PaytoUriGeneric {
|
|||||||
|
|
||||||
const paytoPfx = "payto://";
|
const paytoPfx = "payto://";
|
||||||
|
|
||||||
|
export type PaytoType = "iban" | "bitcoin" | "x-taler-bank"
|
||||||
|
|
||||||
export function buildPayto(
|
export function buildPayto(
|
||||||
type: "iban",
|
type: "iban",
|
||||||
iban: string,
|
iban: string,
|
||||||
@ -71,7 +73,7 @@ export function buildPayto(
|
|||||||
account: string,
|
account: string,
|
||||||
): PaytoUriTalerBank;
|
): PaytoUriTalerBank;
|
||||||
export function buildPayto(
|
export function buildPayto(
|
||||||
type: "iban" | "bitcoin" | "x-taler-bank",
|
type: PaytoType,
|
||||||
first: string,
|
first: string,
|
||||||
second?: string,
|
second?: string,
|
||||||
): PaytoUriGeneric {
|
): PaytoUriGeneric {
|
||||||
|
Loading…
Reference in New Issue
Block a user