@paybutton/react 1.0.6 → 1.2.1
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/assets/edit-pencil.d.ts +3 -0
- package/dist/components/BarChart/BarChart.d.ts +13 -0
- package/dist/components/BarChart/BarChart.stories.d.ts +25 -0
- package/dist/components/BarChart/index.d.ts +1 -0
- package/dist/components/Button/Button.d.ts +2 -0
- package/dist/components/Button/Button.stories.d.ts +5 -5
- package/dist/components/PayButton/PayButton.d.ts +9 -3
- package/dist/components/PayButton/PayButton.stories.d.ts +11 -6
- package/dist/components/PaymentDialog/PaymentDialog.d.ts +37 -0
- package/dist/components/PaymentDialog/PaymentDialog.stories.d.ts +49 -0
- package/dist/components/PaymentDialog/index.d.ts +1 -0
- package/dist/components/Widget/Widget.d.ts +13 -1
- package/dist/components/Widget/Widget.stories.d.ts +7 -7
- package/dist/components/Widget/WidgetContainer.d.ts +12 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/index.d.ts +18 -1
- 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/util/address.d.ts +5 -0
- package/dist/util/api-client.d.ts +198 -49
- package/dist/util/format.d.ts +9 -0
- package/dist/util/satoshis.d.ts +12 -0
- package/package.json +55 -49
|
@@ -1,61 +1,210 @@
|
|
|
1
|
-
export declare const getAddressDetails: (address: string) => Promise<AddressDetails>;
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
1
|
+
export declare const getAddressDetails: (address: string, rootUrl?: string) => Promise<AddressDetails>;
|
|
2
|
+
export declare const getSatoshiBalance: (address: string, rootUrl?: string) => Promise<{
|
|
3
|
+
satoshis: number;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const getUTXOs: (address: string, rootUrl?: string) => Promise<UtxoDetails>;
|
|
6
|
+
export declare const getFiatPrice: (currency: currency) => Promise<PriceData>;
|
|
7
|
+
export declare const getTransactionDetails: (txid: string, rootUrl?: string) => Promise<TransactionDetails>;
|
|
4
8
|
declare const _default: {
|
|
5
|
-
getAddressDetails: (address: string) => Promise<AddressDetails>;
|
|
6
|
-
getTransactionDetails: (txid: string) => Promise<TransactionDetails>;
|
|
7
|
-
getFiatPrice: (currency:
|
|
9
|
+
getAddressDetails: (address: string, rootUrl?: string) => Promise<AddressDetails>;
|
|
10
|
+
getTransactionDetails: (txid: string, rootUrl?: string) => Promise<TransactionDetails>;
|
|
11
|
+
getFiatPrice: (currency: currency) => Promise<PriceData>;
|
|
12
|
+
getSatoshiBalance: (address: string, rootUrl?: string) => Promise<{
|
|
13
|
+
satoshis: number;
|
|
14
|
+
}>;
|
|
8
15
|
};
|
|
9
16
|
export default _default;
|
|
10
17
|
export declare type fiatCurrency = 'USD' | 'CAD' | 'EUR' | 'GBP' | 'AUD';
|
|
18
|
+
export declare type cryptoCurrency = 'BCH' | 'SAT' | 'bits';
|
|
19
|
+
export declare type currency = cryptoCurrency | fiatCurrency;
|
|
11
20
|
export interface AddressDetails {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
totalReceived: number;
|
|
15
|
-
totalReceivedSat: number;
|
|
16
|
-
totalSent: number;
|
|
17
|
-
totalSentSat: number;
|
|
18
|
-
unconfirmedBalance: number;
|
|
19
|
-
unconfirmedBalanceSat: number;
|
|
20
|
-
unconfirmedTxAppearances: number;
|
|
21
|
-
txAppearances: number;
|
|
22
|
-
transactions: [string];
|
|
23
|
-
legacyAddress: string;
|
|
24
|
-
cashAddress: string;
|
|
21
|
+
confirmedTransactionsList: [ConfirmedTransaction];
|
|
22
|
+
unconfirmedTransactionsList: [UnconfirmedTransaction];
|
|
25
23
|
}
|
|
26
|
-
export interface
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
export interface TransactionDetails {
|
|
30
|
-
txid: string;
|
|
24
|
+
export interface ConfirmedTransaction {
|
|
25
|
+
hash: string;
|
|
31
26
|
version: number;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
inputsList: {
|
|
28
|
+
index: number;
|
|
29
|
+
outpoint: {
|
|
30
|
+
hash: string;
|
|
31
|
+
index: number;
|
|
32
|
+
};
|
|
33
|
+
signatureScript: string;
|
|
35
34
|
sequence: number;
|
|
36
|
-
|
|
35
|
+
value: number;
|
|
36
|
+
previousScript: string;
|
|
37
|
+
address: string;
|
|
37
38
|
}[];
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
type: string;
|
|
46
|
-
cashAddrs: string[];
|
|
47
|
-
};
|
|
48
|
-
spentTxId: string | null;
|
|
49
|
-
spentIndex: number | null;
|
|
50
|
-
spentHeight: number | null;
|
|
39
|
+
outputsList: {
|
|
40
|
+
index: number;
|
|
41
|
+
value: number;
|
|
42
|
+
pubkeyScript: string;
|
|
43
|
+
address: string;
|
|
44
|
+
scriptClass: string;
|
|
45
|
+
disassembledScript: string;
|
|
51
46
|
}[];
|
|
52
|
-
|
|
53
|
-
blockheight: number;
|
|
54
|
-
confirmations: number;
|
|
55
|
-
time: number;
|
|
56
|
-
blocktime: number;
|
|
57
|
-
firstSeenTime: number;
|
|
58
|
-
isCoinBase: boolean;
|
|
59
|
-
valueOut: number;
|
|
47
|
+
lockTime: number;
|
|
60
48
|
size: number;
|
|
49
|
+
timestamp: number;
|
|
50
|
+
confirmations: number;
|
|
51
|
+
blockHeight: number;
|
|
52
|
+
blockHash: string;
|
|
53
|
+
slpTransactionInfo: {
|
|
54
|
+
slpAction: number;
|
|
55
|
+
validityJudgement: number;
|
|
56
|
+
parseError: string;
|
|
57
|
+
tokenId: string;
|
|
58
|
+
burnFlagsList: [];
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface UnconfirmedTransaction {
|
|
62
|
+
transaction: {
|
|
63
|
+
hash: string;
|
|
64
|
+
version: number;
|
|
65
|
+
inputsList: {
|
|
66
|
+
index: number;
|
|
67
|
+
outpoint: {
|
|
68
|
+
hash: string;
|
|
69
|
+
index: number;
|
|
70
|
+
};
|
|
71
|
+
signatureScript: string;
|
|
72
|
+
sequence: number;
|
|
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: [];
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
addedTime: number;
|
|
100
|
+
addedHeight: number;
|
|
101
|
+
fee: number;
|
|
102
|
+
feePerKb: number;
|
|
103
|
+
startingPriority: number;
|
|
104
|
+
}
|
|
105
|
+
export interface UtxoDetails {
|
|
106
|
+
outputsList: [Output];
|
|
107
|
+
tokenMetadataList: [TokenMetaData];
|
|
108
|
+
}
|
|
109
|
+
export interface Output {
|
|
110
|
+
outpoint: {
|
|
111
|
+
hash: string;
|
|
112
|
+
index: number;
|
|
113
|
+
};
|
|
114
|
+
pubkeyScript: string;
|
|
115
|
+
value: number;
|
|
116
|
+
isCoinbase: boolean;
|
|
117
|
+
blockHeight: number;
|
|
118
|
+
}
|
|
119
|
+
export interface TokenMetaData {
|
|
120
|
+
tokenId: string;
|
|
121
|
+
tokenType: number;
|
|
122
|
+
v1Fungible: {
|
|
123
|
+
tokenTicker: string;
|
|
124
|
+
tokenName: string;
|
|
125
|
+
tokenDocumentUrl: string;
|
|
126
|
+
tokenDocumentHash: string;
|
|
127
|
+
decimals: number;
|
|
128
|
+
mintBatonHash: string;
|
|
129
|
+
mintBatonVout: number;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export interface PriceData {
|
|
133
|
+
price: number;
|
|
134
|
+
}
|
|
135
|
+
export interface TransactionDetails {
|
|
136
|
+
transaction: {
|
|
137
|
+
hash: string;
|
|
138
|
+
version: number;
|
|
139
|
+
inputsList: {
|
|
140
|
+
index: number;
|
|
141
|
+
outpoint: {
|
|
142
|
+
hash: string;
|
|
143
|
+
index: number;
|
|
144
|
+
};
|
|
145
|
+
signatureScript: string;
|
|
146
|
+
sequence: number;
|
|
147
|
+
value: number;
|
|
148
|
+
previousScript: string;
|
|
149
|
+
address: string;
|
|
150
|
+
slpToken: {
|
|
151
|
+
tokenId: string;
|
|
152
|
+
amount: string;
|
|
153
|
+
isMintBaton: boolean;
|
|
154
|
+
address: string;
|
|
155
|
+
decimals: number;
|
|
156
|
+
slpAction: number;
|
|
157
|
+
tokenType: number;
|
|
158
|
+
};
|
|
159
|
+
}[];
|
|
160
|
+
outputsList: {
|
|
161
|
+
index: number;
|
|
162
|
+
value: number;
|
|
163
|
+
pubkeyScript: string;
|
|
164
|
+
address: string;
|
|
165
|
+
scriptClass: string;
|
|
166
|
+
disassembledScript: string;
|
|
167
|
+
slpToken?: {
|
|
168
|
+
tokenId: string;
|
|
169
|
+
amount: string;
|
|
170
|
+
isMintBaton: boolean;
|
|
171
|
+
address: string;
|
|
172
|
+
decimals: number;
|
|
173
|
+
slpAction: number;
|
|
174
|
+
tokenType: number;
|
|
175
|
+
};
|
|
176
|
+
}[];
|
|
177
|
+
lockTime: number;
|
|
178
|
+
size: number;
|
|
179
|
+
timestamp: number;
|
|
180
|
+
confirmations: number;
|
|
181
|
+
blockHeight: number;
|
|
182
|
+
blockHash: string;
|
|
183
|
+
slpTransactionInfo: {
|
|
184
|
+
slpAction: number;
|
|
185
|
+
validityJudgement: number;
|
|
186
|
+
parseError: string;
|
|
187
|
+
tokenId: string;
|
|
188
|
+
burnFlagsList: [number];
|
|
189
|
+
v1Nft1ChildGenesis: {
|
|
190
|
+
name: string;
|
|
191
|
+
ticker: string;
|
|
192
|
+
documentUrl: string;
|
|
193
|
+
documentHash: string;
|
|
194
|
+
decimals: number;
|
|
195
|
+
groupTokenId: string;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
tokenMetadata: {
|
|
200
|
+
tokenId: string;
|
|
201
|
+
tokenType: number;
|
|
202
|
+
v1Nft1Child: {
|
|
203
|
+
tokenTicker: string;
|
|
204
|
+
tokenName: string;
|
|
205
|
+
tokenDocumentUrl: string;
|
|
206
|
+
tokenDocumentHash: string;
|
|
207
|
+
groupId: string;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
61
210
|
}
|
package/dist/util/format.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
import { currency } from './api-client';
|
|
1
2
|
export declare const amount: (x?: number | null | undefined) => string | undefined;
|
|
3
|
+
export declare const formatPrice: (price: number, currencyType: currency, precision?: number) => string;
|
|
4
|
+
export declare const formatComma: (number: number) => string;
|
|
5
|
+
export declare const formatBCH: (bch: string) => string;
|
|
6
|
+
export declare const formatBits: (bits: string | number) => string;
|
|
2
7
|
declare const _default: {
|
|
3
8
|
amount: (x?: number | null | undefined) => string | undefined;
|
|
9
|
+
formatPrice: (price: number, currencyType: currency, precision?: number) => string;
|
|
10
|
+
formatComma: (number: number) => string;
|
|
11
|
+
formatBCH: (bch: string) => string;
|
|
12
|
+
formatBits: (bits: string | number) => string;
|
|
4
13
|
};
|
|
5
14
|
export default _default;
|
package/dist/util/satoshis.d.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
import { fiatCurrency } from './api-client';
|
|
2
|
+
export declare type cryptoCurrency = 'BCH' | 'SAT' | 'bits';
|
|
3
|
+
export declare type currency = cryptoCurrency | fiatCurrency;
|
|
1
4
|
export declare const satoshisToBch: (satoshis: number) => number;
|
|
2
5
|
export declare const bchToSatoshis: (bch: number) => number;
|
|
6
|
+
export declare type currencyObject = {
|
|
7
|
+
float: number;
|
|
8
|
+
string: string;
|
|
9
|
+
currency: string;
|
|
10
|
+
BCHstring?: string | undefined;
|
|
11
|
+
satoshis?: number | undefined;
|
|
12
|
+
};
|
|
13
|
+
export declare const getCurrencyObject: (amount: number, currencyType: currency) => currencyObject;
|
|
3
14
|
declare const _default: {
|
|
4
15
|
satoshisToBch: (satoshis: number) => number;
|
|
5
16
|
bchToSatoshis: (bch: number) => number;
|
|
17
|
+
getCurrencyObject: (amount: number, currencyType: currency) => currencyObject;
|
|
6
18
|
};
|
|
7
19
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paybutton/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "The easiest way to accept Bitcoin Cash online",
|
|
5
5
|
"author": "poldridge",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,61 +23,67 @@
|
|
|
23
23
|
"watch": "microbundle watch --jsx React.createElement --no-compress --format modern,cjs"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"react": "
|
|
27
|
-
"react-dom": "
|
|
26
|
+
"react": "16.14.0",
|
|
27
|
+
"react-dom": "16.14.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@babel/core": "
|
|
31
|
-
"@
|
|
32
|
-
"@storybook/addon-
|
|
33
|
-
"@storybook/addon-
|
|
34
|
-
"@storybook/addon-
|
|
35
|
-
"@storybook/
|
|
36
|
-
"@storybook/
|
|
37
|
-
"@storybook/react": "
|
|
38
|
-
"@
|
|
39
|
-
"@types/
|
|
40
|
-
"@types/
|
|
41
|
-
"@types/
|
|
42
|
-
"@types/react
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"eslint
|
|
53
|
-
"eslint-
|
|
54
|
-
"eslint-
|
|
55
|
-
"eslint-
|
|
56
|
-
"eslint-plugin-
|
|
57
|
-
"eslint-plugin-
|
|
58
|
-
"eslint-plugin-
|
|
59
|
-
"eslint-plugin-
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
30
|
+
"@babel/core": "7.18.9",
|
|
31
|
+
"@popperjs/core": "2.11.5",
|
|
32
|
+
"@storybook/addon-a11y": "6.5.9",
|
|
33
|
+
"@storybook/addon-actions": "6.5.9",
|
|
34
|
+
"@storybook/addon-essentials": "6.5.9",
|
|
35
|
+
"@storybook/addon-links": "6.5.9",
|
|
36
|
+
"@storybook/node-logger": "6.5.9",
|
|
37
|
+
"@storybook/preset-create-react-app": "3.2.0",
|
|
38
|
+
"@storybook/react": "6.5.9",
|
|
39
|
+
"@types/currency-formatter": "1.5.1",
|
|
40
|
+
"@types/lodash": "4.14.182",
|
|
41
|
+
"@types/node": "12.20.55",
|
|
42
|
+
"@types/qrcode.react": "1.0.2",
|
|
43
|
+
"@types/react": "16.14.28",
|
|
44
|
+
"@types/react-dom": "16.9.16",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "2.34.0",
|
|
46
|
+
"@typescript-eslint/parser": "2.34.0",
|
|
47
|
+
"babel-eslint": "10.1.0",
|
|
48
|
+
"babel-loader": "8.2.5",
|
|
49
|
+
"concurrently": "5.3.0",
|
|
50
|
+
"cross-env": "7.0.3",
|
|
51
|
+
"currency-formatter": "1.5.9",
|
|
52
|
+
"eslint": "6.8.0",
|
|
53
|
+
"eslint-config-prettier": "6.15.0",
|
|
54
|
+
"eslint-config-standard": "14.1.1",
|
|
55
|
+
"eslint-config-standard-react": "9.2.0",
|
|
56
|
+
"eslint-plugin-import": "2.26.0",
|
|
57
|
+
"eslint-plugin-node": "11.1.0",
|
|
58
|
+
"eslint-plugin-prettier": "3.4.1",
|
|
59
|
+
"eslint-plugin-promise": "4.3.1",
|
|
60
|
+
"eslint-plugin-react": "7.30.1",
|
|
61
|
+
"eslint-plugin-react-hooks": "4.6.0",
|
|
62
|
+
"eslint-plugin-standard": "4.1.0",
|
|
63
|
+
"husky": "4.3.8",
|
|
64
|
+
"lint-staged": "10.5.4",
|
|
65
|
+
"microbundle": "0.12.4",
|
|
66
|
+
"npm-run-all": "4.1.5",
|
|
67
|
+
"prettier": "2.7.1",
|
|
68
|
+
"react-is": "16.13.1",
|
|
69
|
+
"react-scripts": "3.4.4",
|
|
70
|
+
"typescript": "3.9.10"
|
|
68
71
|
},
|
|
69
72
|
"files": [
|
|
70
73
|
"dist"
|
|
71
74
|
],
|
|
72
75
|
"dependencies": {
|
|
73
|
-
"@
|
|
74
|
-
"@material-ui/
|
|
75
|
-
"@material-ui/
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
76
|
+
"@bitauth/libauth": "1.19.1",
|
|
77
|
+
"@material-ui/core": "4.12.4",
|
|
78
|
+
"@material-ui/lab": "4.0.0-alpha.61",
|
|
79
|
+
"@material-ui/styles": "4.11.5",
|
|
80
|
+
"axios": "0.21.4",
|
|
81
|
+
"bignumber.js": "9.0.2",
|
|
82
|
+
"copy-to-clipboard": "3.3.1",
|
|
83
|
+
"lodash": "4.17.21",
|
|
84
|
+
"notistack": "1.0.10",
|
|
85
|
+
"qrcode.react": "1.0.1",
|
|
86
|
+
"react-jss": "10.9.0"
|
|
81
87
|
},
|
|
82
88
|
"husky": {
|
|
83
89
|
"hooks": {
|