@paybutton/react 2.1.2 → 3.0.0

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.
Files changed (66) hide show
  1. package/README.md +12 -1
  2. package/dist/index.d.ts +5 -13
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.modern.js +1 -1
  6. package/dist/index.modern.js.map +1 -1
  7. package/dist/{react/src → src}/components/BarChart/BarChart.stories.d.ts +1 -1
  8. package/dist/{components → src/components}/Button/Button.d.ts +2 -7
  9. package/dist/{components → src/components}/Button/Button.stories.d.ts +2 -7
  10. package/dist/{react/src → src}/components/PayButton/PayButton.d.ts +9 -16
  11. package/dist/{react/src → src}/components/PayButton/PayButton.stories.d.ts +2 -10
  12. package/dist/{react/src → src}/components/PaymentDialog/PaymentDialog.d.ts +9 -5
  13. package/dist/{components → src/components}/PaymentDialog/PaymentDialog.stories.d.ts +1 -1
  14. package/dist/{react/src → src}/components/Widget/Widget.d.ts +5 -2
  15. package/dist/{react/src → src}/components/Widget/Widget.stories.d.ts +1 -1
  16. package/dist/{react/src → src}/components/Widget/WidgetContainer.d.ts +9 -5
  17. package/dist/src/tests/opReturn.test.d.ts +1 -0
  18. package/dist/{react/src → src}/util/api-client.d.ts +7 -31
  19. package/dist/src/util/opReturn.d.ts +23 -0
  20. package/dist/{react/src → src}/util/satoshis.d.ts +2 -2
  21. package/package.json +25 -16
  22. package/dist/components/BarChart/BarChart.stories.d.ts +0 -25
  23. package/dist/components/PayButton/PayButton.d.ts +0 -39
  24. package/dist/components/PayButton/PayButton.stories.d.ts +0 -58
  25. package/dist/components/PaymentDialog/PaymentDialog.d.ts +0 -44
  26. package/dist/components/Widget/Widget.d.ts +0 -31
  27. package/dist/components/Widget/Widget.stories.d.ts +0 -34
  28. package/dist/components/Widget/WidgetContainer.d.ts +0 -33
  29. package/dist/react/src/assets/edit-pencil.d.ts +0 -3
  30. package/dist/react/src/components/BarChart/BarChart.d.ts +0 -13
  31. package/dist/react/src/components/BarChart/index.d.ts +0 -1
  32. package/dist/react/src/components/Button/Button.d.ts +0 -21
  33. package/dist/react/src/components/Button/Button.stories.d.ts +0 -28
  34. package/dist/react/src/components/Button/index.d.ts +0 -1
  35. package/dist/react/src/components/PayButton/index.d.ts +0 -1
  36. package/dist/react/src/components/PaymentDialog/PaymentDialog.stories.d.ts +0 -49
  37. package/dist/react/src/components/PaymentDialog/index.d.ts +0 -1
  38. package/dist/react/src/components/Widget/index.d.ts +0 -1
  39. package/dist/react/src/components/index.d.ts +0 -8
  40. package/dist/react/src/index.d.ts +0 -31
  41. package/dist/themes/Theme.d.ts +0 -9
  42. package/dist/themes/index.d.ts +0 -13
  43. package/dist/themes/themes/orange.d.ts +0 -3
  44. package/dist/themes/themes/paybutton.d.ts +0 -3
  45. package/dist/themes/themes/xec.d.ts +0 -3
  46. package/dist/util/address.d.ts +0 -10
  47. package/dist/util/api-client.d.ts +0 -173
  48. package/dist/util/format.d.ts +0 -19
  49. package/dist/util/randomizeSats.d.ts +0 -4
  50. package/dist/util/satoshis.d.ts +0 -11
  51. /package/dist/{assets → src/assets}/edit-pencil.d.ts +0 -0
  52. /package/dist/{components → src/components}/BarChart/BarChart.d.ts +0 -0
  53. /package/dist/{components → src/components}/BarChart/index.d.ts +0 -0
  54. /package/dist/{components → src/components}/Button/index.d.ts +0 -0
  55. /package/dist/{components → src/components}/PayButton/index.d.ts +0 -0
  56. /package/dist/{components → src/components}/PaymentDialog/index.d.ts +0 -0
  57. /package/dist/{components → src/components}/Widget/index.d.ts +0 -0
  58. /package/dist/{components → src/components}/index.d.ts +0 -0
  59. /package/dist/{react/src → src}/themes/Theme.d.ts +0 -0
  60. /package/dist/{react/src → src}/themes/index.d.ts +0 -0
  61. /package/dist/{react/src → src}/themes/themes/orange.d.ts +0 -0
  62. /package/dist/{react/src → src}/themes/themes/paybutton.d.ts +0 -0
  63. /package/dist/{react/src → src}/themes/themes/xec.d.ts +0 -0
  64. /package/dist/{react/src → src}/util/address.d.ts +0 -0
  65. /package/dist/{react/src → src}/util/format.d.ts +0 -0
  66. /package/dist/{react/src → src}/util/randomizeSats.d.ts +0 -0
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import { WidgetProps } from './Widget';
3
- declare const _default: {
4
- title: string;
5
- component: React.FC<WidgetProps>;
6
- decorators: ((Story: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("@storybook/react").Args>) => React.ReactNode)[];
7
- argTypes: {
8
- success: {
9
- control: string;
10
- };
11
- ButtonComponent: {
12
- table: {
13
- disable: boolean;
14
- };
15
- };
16
- foot: {
17
- table: {
18
- disable: boolean;
19
- };
20
- };
21
- };
22
- args: {
23
- to: string;
24
- loading: boolean;
25
- success: boolean;
26
- };
27
- };
28
- export default _default;
29
- export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, WidgetProps>;
30
- export declare const Success: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, WidgetProps>;
31
- export declare const Loading: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, WidgetProps>;
32
- export declare const OrangeTheme: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, WidgetProps>;
33
- export declare const CustomTheme: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, WidgetProps>;
34
- export declare const WithGoal: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, WidgetProps>;
@@ -1,33 +0,0 @@
1
- import React from 'react';
2
- import { currency } from '../../util/api-client';
3
- import { currencyObject } from '../../util/satoshis';
4
- import { WidgetProps } from './Widget';
5
- import BigNumber from 'bignumber.js';
6
- export interface WidgetContainerProps extends Omit<WidgetProps, 'success' | 'setNewTxs' | 'setCurrencyObject'> {
7
- active?: boolean;
8
- amount?: number;
9
- currency?: currency;
10
- currencyObj?: currencyObject;
11
- setCurrencyObj: Function;
12
- randomSatoshis?: boolean | number;
13
- hideToasts?: boolean;
14
- onSuccess?: (txid: string, amount: BigNumber) => void;
15
- onTransaction?: (txid: string, amount: BigNumber) => void;
16
- sound?: boolean;
17
- goalAmount?: number | string;
18
- disabled: boolean;
19
- editable: boolean;
20
- wsBaseUrl?: string;
21
- apiBaseUrl?: string;
22
- successText?: string;
23
- }
24
- export interface Output {
25
- index: number;
26
- value: number;
27
- pubkeyScript: string;
28
- address: string;
29
- scriptClass: string;
30
- disassembledScript: string;
31
- }
32
- export declare const WidgetContainer: React.FC<WidgetContainerProps>;
33
- export default WidgetContainer;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const PencilIcon: (props: any) => React.ReactElement;
3
- export default PencilIcon;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- export interface BarChartProps {
3
- value: number;
4
- color: string;
5
- }
6
- export declare const BarChart: {
7
- (props: BarChartProps): React.ReactElement;
8
- defaultProps: {
9
- value: number;
10
- color: string;
11
- };
12
- };
13
- export default BarChart;
@@ -1 +0,0 @@
1
- export * from './BarChart';
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { Theme, ThemeName } from '../../themes';
3
- export declare type animation = 'slide' | 'invert' | 'none';
4
- export interface ButtonProps {
5
- animation?: animation;
6
- text?: string;
7
- hoverText?: string;
8
- theme?: ThemeName | Theme;
9
- disabled?: boolean;
10
- onClick?: () => void;
11
- }
12
- export declare const Button: {
13
- (props: ButtonProps): React.ReactElement;
14
- defaultProps: {
15
- animation: string;
16
- text: string;
17
- hoverText: string;
18
- disabled: boolean;
19
- };
20
- };
21
- export default Button;
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
- import { ButtonProps } from './Button';
3
- declare const _default: {
4
- title: string;
5
- component: {
6
- (props: ButtonProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
7
- defaultProps: {
8
- animation: string;
9
- text: string;
10
- hoverText: string;
11
- disabled: boolean;
12
- };
13
- };
14
- decorators: ((Story: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("@storybook/react").Args>) => React.ReactNode)[];
15
- argTypes: {
16
- onClick: {
17
- table: {
18
- disable: boolean;
19
- };
20
- };
21
- };
22
- parameters: {
23
- jest: string[];
24
- };
25
- };
26
- export default _default;
27
- export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ButtonProps>;
28
- export declare const OrangeTheme: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ButtonProps>;
@@ -1 +0,0 @@
1
- export * from './Button';
@@ -1 +0,0 @@
1
- export * from './PayButton';
@@ -1,49 +0,0 @@
1
- import React from 'react';
2
- import { PaymentDialogProps } from './PaymentDialog';
3
- declare const _default: {
4
- title: string;
5
- component: {
6
- (props: PaymentDialogProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)>;
7
- defaultProps: {
8
- animation: string;
9
- hideToasts: boolean;
10
- randomSatoshis: boolean;
11
- successText: string;
12
- disableEnforceFocus: boolean;
13
- disabled: boolean;
14
- editable: boolean;
15
- dialogOpen: boolean;
16
- };
17
- };
18
- decorators: ((Story: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("@storybook/react").Args>) => JSX.Element)[];
19
- argTypes: {
20
- onClick: {
21
- table: {
22
- disable: boolean;
23
- };
24
- };
25
- onSuccess: {
26
- table: {
27
- disable: boolean;
28
- };
29
- };
30
- onTransaction: {
31
- table: {
32
- disable: boolean;
33
- };
34
- };
35
- };
36
- args: {
37
- to: string;
38
- };
39
- parameters: {
40
- jest: string[];
41
- };
42
- };
43
- export default _default;
44
- export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PaymentDialogProps>;
45
- export declare const OrangeTheme: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PaymentDialogProps>;
46
- export declare const UsdAmount: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PaymentDialogProps>;
47
- export declare const withGoal: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PaymentDialogProps>;
48
- export declare const withUSDGoalCurrency: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PaymentDialogProps>;
49
- export declare const withEURGoalCurrency: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, PaymentDialogProps>;
@@ -1 +0,0 @@
1
- export * from './PaymentDialog';
@@ -1 +0,0 @@
1
- export * from './Widget';
@@ -1,8 +0,0 @@
1
- export { Button } from './Button/Button';
2
- export type { ButtonProps } from './Button/Button';
3
- export { PayButton } from './PayButton/PayButton';
4
- export type { PayButtonProps } from './PayButton/PayButton';
5
- export { PaymentDialog } from './PaymentDialog/PaymentDialog';
6
- export type { PaymentDialogProps } from './PaymentDialog/PaymentDialog';
7
- export { WidgetContainer as Widget } from './Widget/WidgetContainer';
8
- export type { WidgetContainerProps as WidgetProps } from './Widget/WidgetContainer';
@@ -1,31 +0,0 @@
1
- /// <reference types="react" />
2
- import * as Components from './components';
3
- export declare const PayButton: {
4
- (props: Components.PayButtonProps): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
5
- defaultProps: {
6
- animation: string;
7
- hideToasts: boolean;
8
- randomSatoshis: boolean;
9
- successText: string;
10
- disableEnforceFocus: boolean;
11
- disabled: boolean;
12
- editable: boolean;
13
- };
14
- };
15
- export declare type PayButtonProps = Components.PayButtonProps;
16
- export declare const PaymentDialog: {
17
- (props: Components.PaymentDialogProps): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
18
- defaultProps: {
19
- animation: string;
20
- hideToasts: boolean;
21
- randomSatoshis: boolean;
22
- successText: string;
23
- disableEnforceFocus: boolean;
24
- disabled: boolean;
25
- editable: boolean;
26
- dialogOpen: boolean;
27
- };
28
- };
29
- export declare type PaymentDialogProps = Components.PaymentDialogProps;
30
- export declare const Widget: import("react").FC<Components.WidgetProps>;
31
- export declare type WidgetProps = Components.WidgetProps;
@@ -1,9 +0,0 @@
1
- export interface Theme {
2
- palette: {
3
- primary: string;
4
- secondary: string;
5
- tertiary: string;
6
- logo: string;
7
- };
8
- }
9
- export default Theme;
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import { Theme } from './Theme';
3
- export declare const themes: Record<ThemeName, Theme>;
4
- export * from './Theme';
5
- export default themes;
6
- export declare enum ThemeName {
7
- ORANGE = "orange",
8
- PAYBUTTON = "paybutton",
9
- XEC = "xec"
10
- }
11
- export declare const getTheme: (name?: ThemeName) => Theme;
12
- export declare const ThemeProvider: React.Provider<Theme | undefined>;
13
- export declare const useTheme: (defaultTheme?: ThemeName | Theme | undefined, isXec?: boolean | undefined) => Theme;
@@ -1,3 +0,0 @@
1
- import Theme from '../Theme';
2
- declare const theme: Theme;
3
- export default theme;
@@ -1,3 +0,0 @@
1
- import Theme from '../Theme';
2
- declare const theme: Theme;
3
- export default theme;
@@ -1,3 +0,0 @@
1
- import Theme from '../Theme';
2
- declare const theme: Theme;
3
- export default theme;
@@ -1,10 +0,0 @@
1
- import { cryptoCurrency } 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) => cryptoCurrency;
5
- declare const _default: {
6
- isValidCashAddress: (address: string) => boolean;
7
- isValidXecAddress: (address: string) => boolean;
8
- getCurrencyTypeFromAddress: (address: string) => "BCH" | "XEC";
9
- };
10
- export default _default;
@@ -1,173 +0,0 @@
1
- import { Socket } from 'socket.io-client';
2
- export declare const getAddressDetails: (address: string, rootUrl?: string) => Promise<Transaction[]>;
3
- declare type TxBroadcast = 'NewTx' | 'OldTx';
4
- export interface BroadcastTxData {
5
- address: string;
6
- txs: Transaction[];
7
- messageType: TxBroadcast;
8
- }
9
- export declare const setListener: (socket: Socket, setNewTxs: Function) => void;
10
- export declare const getAddressBalance: (address: string, rootUrl?: string) => Promise<number>;
11
- export declare const getUTXOs: (address: string, rootUrl?: string) => Promise<UtxoDetails>;
12
- export declare const getBchFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
13
- export declare const getXecFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
14
- export declare const getFiatPrice: (fiat: fiatCurrency, crypto: cryptoCurrency, rootUrl?: string) => Promise<PriceData>;
15
- export declare const getTransactionDetails: (txid: string, rootUrl?: string) => Promise<TransactionDetails>;
16
- declare const _default: {
17
- getAddressDetails: (address: string, rootUrl?: string) => Promise<Transaction[]>;
18
- getTransactionDetails: (txid: string, rootUrl?: string) => Promise<TransactionDetails>;
19
- getBchFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
20
- getXecFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
21
- getAddressBalance: (address: string, rootUrl?: string) => Promise<number>;
22
- };
23
- export default _default;
24
- export declare const fiatCurrencies: readonly ["USD", "CAD", "EUR", "GBP", "AUD"];
25
- declare type fiatCurrenciesTuple = typeof fiatCurrencies;
26
- export declare type fiatCurrency = fiatCurrenciesTuple[number];
27
- export declare const cryptoCurrencies: readonly ["BCH", "XEC"];
28
- declare type cryptoCurrenciesTuple = typeof cryptoCurrencies;
29
- export declare type cryptoCurrency = cryptoCurrenciesTuple[number];
30
- export declare type currency = cryptoCurrency | fiatCurrency;
31
- export declare function isFiat(unknownString: string): unknownString is fiatCurrency;
32
- export declare function isCrypto(unknownString: string): unknownString is cryptoCurrency;
33
- export declare function isValidCurrency(unknownString: string): unknownString is cryptoCurrency;
34
- export declare const getCashtabProviderStatus: () => boolean;
35
- export interface Transaction {
36
- id: string;
37
- hash: string;
38
- amount: string;
39
- confirmed: boolean;
40
- timestamp: number;
41
- addressId: string;
42
- createdAt: string;
43
- updatedAt: string;
44
- address: {
45
- id: string;
46
- address: string;
47
- createdAt: string;
48
- updatedAt: string;
49
- networkId: number;
50
- lastSynced: string;
51
- };
52
- prices: [{
53
- priceId: number;
54
- transactionId: string;
55
- createdAt: string;
56
- updatedAt: string;
57
- price: {
58
- id: number;
59
- value: string;
60
- createdAt: string;
61
- updatedAt: string;
62
- timestamp: number;
63
- networkId: 1;
64
- quoteId: 1;
65
- };
66
- }];
67
- }
68
- export interface UtxoDetails {
69
- outputsList: [Output];
70
- tokenMetadataList: [TokenMetaData];
71
- }
72
- export interface Output {
73
- outpoint: {
74
- hash: string;
75
- index: number;
76
- };
77
- pubkeyScript: string;
78
- value: number;
79
- isCoinbase: boolean;
80
- blockHeight: number;
81
- }
82
- export interface TokenMetaData {
83
- tokenId: string;
84
- tokenType: number;
85
- v1Fungible: {
86
- tokenTicker: string;
87
- tokenName: string;
88
- tokenDocumentUrl: string;
89
- tokenDocumentHash: string;
90
- decimals: number;
91
- mintBatonHash: string;
92
- mintBatonVout: number;
93
- };
94
- }
95
- export interface PriceData {
96
- price: number;
97
- }
98
- export interface TransactionDetails {
99
- transaction: {
100
- hash: string;
101
- version: number;
102
- inputsList: {
103
- index: number;
104
- outpoint: {
105
- hash: string;
106
- index: number;
107
- };
108
- signatureScript: string;
109
- sequence: number;
110
- value: number;
111
- previousScript: string;
112
- address: string;
113
- slpToken: {
114
- tokenId: string;
115
- amount: string;
116
- isMintBaton: boolean;
117
- address: string;
118
- decimals: number;
119
- slpAction: number;
120
- tokenType: number;
121
- };
122
- }[];
123
- outputsList: {
124
- index: number;
125
- value: number;
126
- pubkeyScript: string;
127
- address: string;
128
- scriptClass: string;
129
- disassembledScript: string;
130
- slpToken?: {
131
- tokenId: string;
132
- amount: string;
133
- isMintBaton: boolean;
134
- address: string;
135
- decimals: number;
136
- slpAction: number;
137
- tokenType: number;
138
- };
139
- }[];
140
- lockTime: number;
141
- size: number;
142
- timestamp: number;
143
- confirmations: number;
144
- blockHeight: number;
145
- blockHash: string;
146
- slpTransactionInfo: {
147
- slpAction: number;
148
- validityJudgement: number;
149
- parseError: string;
150
- tokenId: string;
151
- burnFlagsList: [number];
152
- v1Nft1ChildGenesis: {
153
- name: string;
154
- ticker: string;
155
- documentUrl: string;
156
- documentHash: string;
157
- decimals: number;
158
- groupTokenId: string;
159
- };
160
- };
161
- };
162
- tokenMetadata: {
163
- tokenId: string;
164
- tokenType: number;
165
- v1Nft1Child: {
166
- tokenTicker: string;
167
- tokenName: string;
168
- tokenDocumentUrl: string;
169
- tokenDocumentHash: string;
170
- groupId: string;
171
- };
172
- };
173
- }
@@ -1,19 +0,0 @@
1
- import { currency } from './api-client';
2
- export declare const DECIMALS: {
3
- BCH: number;
4
- XEC: number;
5
- FIAT: number;
6
- };
7
- export declare const amount: (x?: number | null | undefined) => string | undefined;
8
- export declare const formatPrice: (price: number, currencyType: currency, precision?: number) => string;
9
- export declare const formatComma: (number: number) => string;
10
- export declare const formatBCH: (bch: string) => string;
11
- export declare const formatXEC: (xec: string) => string;
12
- declare const _default: {
13
- amount: (x?: number | null | undefined) => string | undefined;
14
- formatPrice: (price: number, currencyType: currency, precision?: number) => string;
15
- formatComma: (number: number) => string;
16
- formatBCH: (bch: string) => string;
17
- formatXEC: (xec: string) => string;
18
- };
19
- export default _default;
@@ -1,4 +0,0 @@
1
- import { cryptoCurrency } from './api-client';
2
- export declare const getNSatoshis: (amount: number, randomSatoshis: boolean | number, satsPrecision: number) => number;
3
- export declare const randomizeSatoshis: (amount: number, addressType: cryptoCurrency, randomSatoshis: boolean | number) => number;
4
- export default randomizeSatoshis;
@@ -1,11 +0,0 @@
1
- import { currency } from './api-client';
2
- export declare type currencyObject = {
3
- float: number;
4
- string: string;
5
- currency: string;
6
- };
7
- export declare const getCurrencyObject: (amount: number, currencyType: currency, randomSatoshis: boolean | number) => currencyObject;
8
- declare const _default: {
9
- getCurrencyObject: (amount: number, currencyType: currency, randomSatoshis: number | boolean) => currencyObject;
10
- };
11
- export default _default;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes