@paybutton/react 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/PayButton/PayButton.d.ts +6 -3
- package/dist/components/PaymentDialog/PaymentDialog.d.ts +6 -3
- package/dist/components/Widget/Widget.d.ts +7 -4
- package/dist/components/Widget/WidgetContainer.d.ts +7 -6
- package/dist/hooks/useAddressDetails.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/themes/index.d.ts +3 -2
- package/dist/themes/themes/xec.d.ts +3 -0
- package/dist/util/address.d.ts +7 -2
- package/dist/util/api-client.d.ts +58 -93
- package/dist/util/format.d.ts +7 -2
- package/dist/util/satoshis.d.ts +1 -9
- package/package.json +1 -1
package/dist/themes/index.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ export * from './Theme';
|
|
|
5
5
|
export default themes;
|
|
6
6
|
export declare enum ThemeName {
|
|
7
7
|
ORANGE = "orange",
|
|
8
|
-
PAYBUTTON = "paybutton"
|
|
8
|
+
PAYBUTTON = "paybutton",
|
|
9
|
+
XEC = "xec"
|
|
9
10
|
}
|
|
10
11
|
export declare const getTheme: (name?: ThemeName) => Theme;
|
|
11
12
|
export declare const ThemeProvider: React.Provider<Theme | undefined>;
|
|
12
|
-
export declare const useTheme: (defaultTheme?: ThemeName | Theme | undefined) => Theme;
|
|
13
|
+
export declare const useTheme: (defaultTheme?: ThemeName | Theme | undefined, isXec?: boolean | undefined) => Theme;
|
package/dist/util/address.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { currency } from '../util/api-client';
|
|
2
|
+
export declare const isValidCashAddress: (address: string) => boolean;
|
|
3
|
+
export declare const isValidXecAddress: (address: string) => boolean;
|
|
4
|
+
export declare const getCurrencyTypeFromAddress: (address: string) => currency;
|
|
2
5
|
declare const _default: {
|
|
3
|
-
|
|
6
|
+
isValidCashAddress: (address: string) => boolean;
|
|
7
|
+
isValidXecAddress: (address: string) => boolean;
|
|
8
|
+
getCurrencyTypeFromAddress: (address: string) => currency;
|
|
4
9
|
};
|
|
5
10
|
export default _default;
|
|
@@ -1,106 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
1
|
+
import { Socket } from 'socket.io-client';
|
|
2
|
+
export declare const DEFAULT_WS_URL = "https://socket.paybutton.org";
|
|
3
|
+
export declare const DEFAULT_API_URL = "https://api.paybutton.org";
|
|
4
|
+
export declare const getAddressDetails: (address: string, rootUrl?: string) => Promise<Transaction[]>;
|
|
5
|
+
declare type TxBroadcast = 'NewTx' | 'OldTx';
|
|
6
|
+
export interface BroadcastTxData {
|
|
7
|
+
address: string;
|
|
8
|
+
txs: Transaction[];
|
|
9
|
+
messageType: TxBroadcast;
|
|
10
|
+
}
|
|
11
|
+
export declare const setListener: (socket: Socket, setNewTxs: Function) => void;
|
|
12
|
+
export declare const getAddressBalance: (address: string, rootUrl?: string) => Promise<number>;
|
|
13
|
+
export declare const getUTXOs: (address: string, rootUrl?: string) => Promise<UtxoDetails>;
|
|
14
|
+
export declare const getBchFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
|
|
15
|
+
export declare const getXecFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
|
|
16
|
+
export declare const getFiatPrice: (fiat: fiatCurrency, crypto: cryptoCurrency, rootUrl?: string) => Promise<PriceData>;
|
|
7
17
|
export declare const getTransactionDetails: (txid: string, rootUrl?: string) => Promise<TransactionDetails>;
|
|
8
18
|
declare const _default: {
|
|
9
|
-
getAddressDetails: (address: string, rootUrl?: string
|
|
19
|
+
getAddressDetails: (address: string, rootUrl?: string) => Promise<Transaction[]>;
|
|
10
20
|
getTransactionDetails: (txid: string, rootUrl?: string) => Promise<TransactionDetails>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}>;
|
|
21
|
+
getBchFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
|
|
22
|
+
getXecFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
|
|
23
|
+
getAddressBalance: (address: string, rootUrl?: string) => Promise<number>;
|
|
15
24
|
};
|
|
16
25
|
export default _default;
|
|
17
|
-
export declare
|
|
18
|
-
|
|
26
|
+
export declare const fiatCurrencies: readonly ["USD", "CAD", "EUR", "GBP", "AUD"];
|
|
27
|
+
declare type fiatCurrenciesTuple = typeof fiatCurrencies;
|
|
28
|
+
export declare type fiatCurrency = fiatCurrenciesTuple[number];
|
|
29
|
+
export declare const cryptoCurrencies: readonly ["BCH", "XEC"];
|
|
30
|
+
declare type cryptoCurrenciesTuple = typeof cryptoCurrencies;
|
|
31
|
+
export declare type cryptoCurrency = cryptoCurrenciesTuple[number];
|
|
19
32
|
export declare type currency = cryptoCurrency | fiatCurrency;
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export interface
|
|
33
|
+
export declare function isFiat(unknownString: string): unknownString is fiatCurrency;
|
|
34
|
+
export declare function isCrypto(unknownString: string): unknownString is cryptoCurrency;
|
|
35
|
+
export declare function isValidCurrency(unknownString: string): unknownString is cryptoCurrency;
|
|
36
|
+
export declare const getCashtabProviderStatus: () => boolean;
|
|
37
|
+
export interface Transaction {
|
|
38
|
+
id: string;
|
|
25
39
|
hash: string;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
index: number;
|
|
29
|
-
outpoint: {
|
|
30
|
-
hash: string;
|
|
31
|
-
index: number;
|
|
32
|
-
};
|
|
33
|
-
signatureScript: string;
|
|
34
|
-
sequence: number;
|
|
35
|
-
value: number;
|
|
36
|
-
previousScript: string;
|
|
37
|
-
address: string;
|
|
38
|
-
}[];
|
|
39
|
-
outputsList: {
|
|
40
|
-
index: number;
|
|
41
|
-
value: number;
|
|
42
|
-
pubkeyScript: string;
|
|
43
|
-
address: string;
|
|
44
|
-
scriptClass: string;
|
|
45
|
-
disassembledScript: string;
|
|
46
|
-
}[];
|
|
47
|
-
lockTime: number;
|
|
48
|
-
size: number;
|
|
40
|
+
amount: string;
|
|
41
|
+
confirmed: boolean;
|
|
49
42
|
timestamp: number;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
43
|
+
addressId: string;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
updatedAt: string;
|
|
46
|
+
address: {
|
|
47
|
+
id: string;
|
|
48
|
+
address: string;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
updatedAt: string;
|
|
51
|
+
networkId: number;
|
|
52
|
+
lastSynced: string;
|
|
59
53
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
value: number;
|
|
74
|
-
previousScript: string;
|
|
75
|
-
address: string;
|
|
76
|
-
}[];
|
|
77
|
-
outputsList: {
|
|
78
|
-
index: number;
|
|
79
|
-
value: number;
|
|
80
|
-
pubkeyScript: string;
|
|
81
|
-
address: string;
|
|
82
|
-
scriptClass: string;
|
|
83
|
-
disassembledScript: string;
|
|
84
|
-
}[];
|
|
85
|
-
lockTime: number;
|
|
86
|
-
size: number;
|
|
87
|
-
timestamp: number;
|
|
88
|
-
confirmations: number;
|
|
89
|
-
blockHeight: number;
|
|
90
|
-
blockHash: string;
|
|
91
|
-
slpTransactionInfo: {
|
|
92
|
-
slpAction: number;
|
|
93
|
-
validityJudgement: number;
|
|
94
|
-
parseError: string;
|
|
95
|
-
tokenId: string;
|
|
96
|
-
burnFlagsList: [];
|
|
54
|
+
prices: [{
|
|
55
|
+
priceId: number;
|
|
56
|
+
transactionId: string;
|
|
57
|
+
createdAt: string;
|
|
58
|
+
updatedAt: string;
|
|
59
|
+
price: {
|
|
60
|
+
id: number;
|
|
61
|
+
value: string;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
timestamp: number;
|
|
65
|
+
networkId: 1;
|
|
66
|
+
quoteId: 1;
|
|
97
67
|
};
|
|
98
|
-
};
|
|
99
|
-
addedTime: number;
|
|
100
|
-
addedHeight: number;
|
|
101
|
-
fee: number;
|
|
102
|
-
feePerKb: number;
|
|
103
|
-
startingPriority: number;
|
|
68
|
+
}];
|
|
104
69
|
}
|
|
105
70
|
export interface UtxoDetails {
|
|
106
71
|
outputsList: [Output];
|
package/dist/util/format.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { currency } from './api-client';
|
|
2
|
+
export declare const DECIMALS: {
|
|
3
|
+
BCH: number;
|
|
4
|
+
XEC: number;
|
|
5
|
+
FIAT: number;
|
|
6
|
+
};
|
|
2
7
|
export declare const amount: (x?: number | null | undefined) => string | undefined;
|
|
3
8
|
export declare const formatPrice: (price: number, currencyType: currency, precision?: number) => string;
|
|
4
9
|
export declare const formatComma: (number: number) => string;
|
|
5
10
|
export declare const formatBCH: (bch: string) => string;
|
|
6
|
-
export declare const
|
|
11
|
+
export declare const formatXEC: (xec: string) => string;
|
|
7
12
|
declare const _default: {
|
|
8
13
|
amount: (x?: number | null | undefined) => string | undefined;
|
|
9
14
|
formatPrice: (price: number, currencyType: currency, precision?: number) => string;
|
|
10
15
|
formatComma: (number: number) => string;
|
|
11
16
|
formatBCH: (bch: string) => string;
|
|
12
|
-
|
|
17
|
+
formatXEC: (xec: string) => string;
|
|
13
18
|
};
|
|
14
19
|
export default _default;
|
package/dist/util/satoshis.d.ts
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare type cryptoCurrency = 'BCH' | 'SAT' | 'bits';
|
|
3
|
-
export declare type currency = cryptoCurrency | fiatCurrency;
|
|
4
|
-
export declare const satoshisToBch: (satoshis: number) => number;
|
|
5
|
-
export declare const bchToSatoshis: (bch: number) => number;
|
|
1
|
+
import { currency } from './api-client';
|
|
6
2
|
export declare type currencyObject = {
|
|
7
3
|
float: number;
|
|
8
4
|
string: string;
|
|
9
5
|
currency: string;
|
|
10
|
-
BCHstring?: string | undefined;
|
|
11
|
-
satoshis?: number | undefined;
|
|
12
6
|
};
|
|
13
7
|
export declare const getCurrencyObject: (amount: number, currencyType: currency) => currencyObject;
|
|
14
8
|
declare const _default: {
|
|
15
|
-
satoshisToBch: (satoshis: number) => number;
|
|
16
|
-
bchToSatoshis: (bch: number) => number;
|
|
17
9
|
getCurrencyObject: (amount: number, currencyType: currency) => currencyObject;
|
|
18
10
|
};
|
|
19
11
|
export default _default;
|