@paybutton/react 4.1.0 → 5.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.
- package/dist/{react/index.d.ts → index.d.ts} +1 -0
- 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/{react/lib → lib}/altpayment/index.d.ts +1 -0
- package/dist/{react/lib → lib}/components/BarChart/BarChart.stories.d.ts +2 -2
- package/dist/{react/lib → lib}/components/Button/Button.d.ts +3 -0
- package/dist/lib/components/Button/Button.stories.d.ts +7 -0
- package/dist/{react/lib → lib}/components/PayButton/PayButton.d.ts +6 -1
- package/dist/{react/lib → lib}/components/PayButton/PayButton.stories.d.ts +6 -6
- package/dist/{react/lib → lib}/components/PaymentDialog/PaymentDialog.d.ts +29 -0
- package/dist/{react/lib → lib}/components/PaymentDialog/PaymentDialog.stories.d.ts +7 -6
- package/dist/{react/lib → lib}/components/Widget/Widget.d.ts +27 -7
- package/dist/lib/components/Widget/Widget.stories.d.ts +34 -0
- package/dist/{react/lib → lib}/components/Widget/WidgetContainer.d.ts +4 -1
- package/dist/{react/lib → lib}/util/address.d.ts +3 -0
- package/dist/{react/lib → lib}/util/api-client.d.ts +0 -1
- package/dist/lib/util/cashtab.d.ts +29 -0
- package/dist/lib/util/chronik.d.ts +17 -0
- package/dist/{react/lib → lib}/util/constants.d.ts +1 -0
- package/dist/{react/lib → lib}/util/index.d.ts +1 -0
- package/dist/{react/lib → lib}/util/opReturn.d.ts +2 -0
- package/dist/lib/util/socket.d.ts +40 -0
- package/dist/{react/lib → lib}/util/types.d.ts +12 -0
- package/dist/lib/util/validate.d.ts +3 -0
- package/package.json +28 -16
- package/dist/react/lib/components/Button/Button.stories.d.ts +0 -23
- package/dist/react/lib/components/Widget/Widget.stories.d.ts +0 -34
- package/dist/react/lib/util/socket.d.ts +0 -14
- package/dist/react/lib/util/validate.d.ts +0 -3
- /package/dist/{react/lib → lib}/altpayment/mocked.d.ts +0 -0
- /package/dist/{react/lib → lib}/altpayment/sideshift.d.ts +0 -0
- /package/dist/{react/lib → lib}/assets/edit-pencil.d.ts +0 -0
- /package/dist/{react/lib → lib}/components/BarChart/BarChart.d.ts +0 -0
- /package/dist/{react/lib → lib}/components/BarChart/index.d.ts +0 -0
- /package/dist/{react/lib → lib}/components/Button/index.d.ts +0 -0
- /package/dist/{react/lib → lib}/components/PayButton/index.d.ts +0 -0
- /package/dist/{react/lib → lib}/components/PaymentDialog/index.d.ts +0 -0
- /package/dist/{react/lib → lib}/components/Widget/AltpaymentWidget.d.ts +0 -0
- /package/dist/{react/lib → lib}/components/Widget/SideShiftLogo.d.ts +0 -0
- /package/dist/{react/lib → lib}/components/Widget/index.d.ts +0 -0
- /package/dist/{react/lib → lib}/components/index.d.ts +0 -0
- /package/dist/{react/lib → lib}/tests/util/currency.test.d.ts +0 -0
- /package/dist/{react/lib → lib}/tests/util/format.test.d.ts +0 -0
- /package/dist/{react/lib → lib}/tests/util/number.test.d.ts +0 -0
- /package/dist/{react/lib → lib}/tests/util/opReturn.test.d.ts +0 -0
- /package/dist/{react/lib → lib}/tests/util/validate.test.d.ts +0 -0
- /package/dist/{react/lib → lib}/themes/Theme.d.ts +0 -0
- /package/dist/{react/lib → lib}/themes/index.d.ts +0 -0
- /package/dist/{react/lib → lib}/themes/themes/orange.d.ts +0 -0
- /package/dist/{react/lib → lib}/themes/themes/paybutton.d.ts +0 -0
- /package/dist/{react/lib → lib}/themes/themes/xec.d.ts +0 -0
- /package/dist/{react/lib → lib}/util/currency.d.ts +0 -0
- /package/dist/{react/lib → lib}/util/format.d.ts +0 -0
- /package/dist/{react/lib → lib}/util/number.d.ts +0 -0
- /package/dist/{react/lib → lib}/util/randomizeSats.d.ts +0 -0
- /package/dist/{react/lib → lib}/util/satoshis.d.ts +0 -0
- /package/dist/{react/src → src}/App.d.ts +0 -0
- /package/dist/{react/src → src}/main.d.ts +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SideshiftCoin, SideshiftError, SideshiftPair, SideshiftQuote, SideshiftShift } from "./sideshift";
|
|
2
2
|
export declare const MINIMUM_ALTPAYMENT_DOLLAR_AMOUNT = 10;
|
|
3
|
+
export declare const MINIMUM_ALTPAYMENT_CAD_AMOUNT = 15;
|
|
3
4
|
export declare const SOCKET_MESSAGES: {
|
|
4
5
|
GET_ALTPAYMENT_RATE: string;
|
|
5
6
|
SEND_ALTPAYMENT_RATE: string;
|
|
@@ -9,7 +9,7 @@ declare const _default: {
|
|
|
9
9
|
color: string;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
decorators: ((Story: import("@storybook/
|
|
12
|
+
decorators: ((Story: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("@storybook/types").Args>) => React.ReactNode)[];
|
|
13
13
|
argTypes: {
|
|
14
14
|
onClick: {
|
|
15
15
|
table: {
|
|
@@ -22,4 +22,4 @@ declare const _default: {
|
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
export default _default;
|
|
25
|
-
export declare const Default: import("@storybook/
|
|
25
|
+
export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, BarChartProps>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Theme, ThemeName } from '../../themes';
|
|
3
|
+
import { ButtonSize } from '../../util';
|
|
3
4
|
export declare type animation = 'slide' | 'invert' | 'none' | undefined;
|
|
4
5
|
export interface ButtonProps {
|
|
5
6
|
animation?: animation;
|
|
@@ -8,6 +9,8 @@ export interface ButtonProps {
|
|
|
8
9
|
theme?: ThemeName | Theme;
|
|
9
10
|
disabled?: boolean;
|
|
10
11
|
onClick?: () => void;
|
|
12
|
+
size?: ButtonSize;
|
|
13
|
+
sizeScaleAlreadyApplied?: boolean;
|
|
11
14
|
}
|
|
12
15
|
export declare const Button: {
|
|
13
16
|
(props: ButtonProps): React.ReactElement;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Button from './Button';
|
|
3
|
+
declare const meta: Meta<typeof Button>;
|
|
4
|
+
export default meta;
|
|
5
|
+
declare type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const OrangeTheme: Story;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Theme, ThemeName } from '../../themes';
|
|
3
3
|
import { ButtonProps } from '../Button/Button';
|
|
4
|
-
import { Transaction, Currency } from '../../util';
|
|
4
|
+
import { Transaction, Currency, ButtonSize } from '../../util';
|
|
5
5
|
export interface PayButtonProps extends ButtonProps {
|
|
6
6
|
to: string;
|
|
7
7
|
amount?: number | string;
|
|
@@ -24,8 +24,13 @@ export interface PayButtonProps extends ButtonProps {
|
|
|
24
24
|
onClose?: (success?: boolean, paymentId?: string) => void;
|
|
25
25
|
wsBaseUrl?: string;
|
|
26
26
|
apiBaseUrl?: string;
|
|
27
|
+
transactionText?: string;
|
|
28
|
+
disableSound?: boolean;
|
|
29
|
+
autoClose?: boolean;
|
|
27
30
|
disableAltpayment?: boolean;
|
|
28
31
|
contributionOffset?: number;
|
|
32
|
+
size: ButtonSize;
|
|
33
|
+
sizeScaleAlreadyApplied: boolean;
|
|
29
34
|
}
|
|
30
35
|
export declare const PayButton: {
|
|
31
36
|
(props: PayButtonProps): React.ReactElement;
|
|
@@ -6,7 +6,7 @@ declare const _default: {
|
|
|
6
6
|
(props: PayButtonProps): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
|
7
7
|
defaultProps: PayButtonProps;
|
|
8
8
|
};
|
|
9
|
-
decorators: ((Story: import("@storybook/
|
|
9
|
+
decorators: ((Story: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("@storybook/types").Args>) => JSX.Element)[];
|
|
10
10
|
argTypes: {
|
|
11
11
|
onClick: {
|
|
12
12
|
table: {
|
|
@@ -42,8 +42,8 @@ declare const _default: {
|
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
44
|
export default _default;
|
|
45
|
-
export declare const Default: import("@storybook/
|
|
46
|
-
export declare const OrangeTheme: import("@storybook/
|
|
47
|
-
export declare const UsdAmount: import("@storybook/
|
|
48
|
-
export declare const withGoal: import("@storybook/
|
|
49
|
-
export declare const withUSDGoalCurrency: import("@storybook/
|
|
45
|
+
export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, PayButtonProps>;
|
|
46
|
+
export declare const OrangeTheme: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, PayButtonProps>;
|
|
47
|
+
export declare const UsdAmount: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, PayButtonProps>;
|
|
48
|
+
export declare const withGoal: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, PayButtonProps>;
|
|
49
|
+
export declare const withUSDGoalCurrency: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, PayButtonProps>;
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { Theme, ThemeName } from '../../themes';
|
|
3
3
|
import { ButtonProps } from '../Button/Button';
|
|
4
4
|
import { Currency, CurrencyObject, Transaction } from '../../util';
|
|
5
|
+
import { Socket } from 'socket.io-client';
|
|
6
|
+
import { AltpaymentCoin, AltpaymentPair, AltpaymentShift, AltpaymentError } from '../../altpayment';
|
|
5
7
|
export interface PaymentDialogProps extends ButtonProps {
|
|
6
8
|
to: string;
|
|
7
9
|
amount?: number | string;
|
|
@@ -23,6 +25,7 @@ export interface PaymentDialogProps extends ButtonProps {
|
|
|
23
25
|
disableEnforceFocus?: boolean;
|
|
24
26
|
editable?: boolean;
|
|
25
27
|
dialogOpen: boolean;
|
|
28
|
+
setDialogOpen: Function;
|
|
26
29
|
disableScrollLock?: boolean;
|
|
27
30
|
active?: boolean;
|
|
28
31
|
container?: HTMLElement;
|
|
@@ -33,6 +36,31 @@ export interface PaymentDialogProps extends ButtonProps {
|
|
|
33
36
|
apiBaseUrl?: string;
|
|
34
37
|
disableAltpayment?: boolean;
|
|
35
38
|
contributionOffset?: number;
|
|
39
|
+
useAltpayment: boolean;
|
|
40
|
+
setUseAltpayment: Function;
|
|
41
|
+
txsSocket?: Socket;
|
|
42
|
+
setTxsSocket: Function;
|
|
43
|
+
altpaymentSocket?: Socket;
|
|
44
|
+
setAltpaymentSocket: Function;
|
|
45
|
+
setCoins: Function;
|
|
46
|
+
coins: AltpaymentCoin[];
|
|
47
|
+
setCoinPair: Function;
|
|
48
|
+
coinPair?: AltpaymentPair;
|
|
49
|
+
setLoadingPair: Function;
|
|
50
|
+
loadingPair: boolean;
|
|
51
|
+
setAltpaymentShift: Function;
|
|
52
|
+
altpaymentShift?: AltpaymentShift;
|
|
53
|
+
setLoadingShift: Function;
|
|
54
|
+
loadingShift: boolean;
|
|
55
|
+
setAltpaymentError: Function;
|
|
56
|
+
altpaymentError?: AltpaymentError;
|
|
57
|
+
addressType: Currency;
|
|
58
|
+
setAddressType: Function;
|
|
59
|
+
setNewTxs: Function;
|
|
60
|
+
newTxs?: Transaction[];
|
|
61
|
+
autoClose?: boolean;
|
|
62
|
+
disableSound?: boolean;
|
|
63
|
+
transactionText?: string;
|
|
36
64
|
}
|
|
37
65
|
export declare const PaymentDialog: {
|
|
38
66
|
(props: PaymentDialogProps): React.ReactElement;
|
|
@@ -45,6 +73,7 @@ export declare const PaymentDialog: {
|
|
|
45
73
|
disabled: boolean;
|
|
46
74
|
editable: boolean;
|
|
47
75
|
dialogOpen: boolean;
|
|
76
|
+
autoClose: boolean;
|
|
48
77
|
};
|
|
49
78
|
};
|
|
50
79
|
export default PaymentDialog;
|
|
@@ -13,9 +13,10 @@ declare const _default: {
|
|
|
13
13
|
disabled: boolean;
|
|
14
14
|
editable: boolean;
|
|
15
15
|
dialogOpen: boolean;
|
|
16
|
+
autoClose: boolean;
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
|
-
decorators: ((Story: import("@storybook/
|
|
19
|
+
decorators: ((Story: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("@storybook/types").Args>) => JSX.Element)[];
|
|
19
20
|
argTypes: {
|
|
20
21
|
onClick: {
|
|
21
22
|
table: {
|
|
@@ -41,8 +42,8 @@ declare const _default: {
|
|
|
41
42
|
};
|
|
42
43
|
};
|
|
43
44
|
export default _default;
|
|
44
|
-
export declare const Default: import("@storybook/
|
|
45
|
-
export declare const OrangeTheme: import("@storybook/
|
|
46
|
-
export declare const UsdAmount: import("@storybook/
|
|
47
|
-
export declare const withGoal: import("@storybook/
|
|
48
|
-
export declare const withUSDGoalCurrency: import("@storybook/
|
|
45
|
+
export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, PaymentDialogProps>;
|
|
46
|
+
export declare const OrangeTheme: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, PaymentDialogProps>;
|
|
47
|
+
export declare const UsdAmount: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, PaymentDialogProps>;
|
|
48
|
+
export declare const withGoal: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, PaymentDialogProps>;
|
|
49
|
+
export declare const withUSDGoalCurrency: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, PaymentDialogProps>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Socket } from 'socket.io-client';
|
|
2
3
|
import { Theme, ThemeName } from '../../themes';
|
|
3
4
|
import { animation } from '../Button/Button';
|
|
4
5
|
import { Currency, Transaction, CurrencyObject } from '../../util';
|
|
5
|
-
import { AltpaymentShift } from '../../altpayment';
|
|
6
|
+
import { AltpaymentPair, AltpaymentShift, AltpaymentError, AltpaymentCoin } from '../../altpayment';
|
|
6
7
|
export interface WidgetProps {
|
|
7
8
|
to: string;
|
|
9
|
+
isChild?: boolean;
|
|
8
10
|
amount?: number | null | string;
|
|
9
11
|
setAmount?: Function;
|
|
10
12
|
opReturn?: string;
|
|
@@ -32,14 +34,32 @@ export interface WidgetProps {
|
|
|
32
34
|
apiBaseUrl?: string;
|
|
33
35
|
loading?: boolean;
|
|
34
36
|
hoverText?: string;
|
|
35
|
-
setAltpaymentShift: Function;
|
|
36
|
-
altpaymentShift?: AltpaymentShift | undefined;
|
|
37
|
-
useAltpayment: boolean;
|
|
38
|
-
setUseAltpayment: Function;
|
|
39
|
-
shiftCompleted: boolean;
|
|
40
|
-
setShiftCompleted: Function;
|
|
41
37
|
disableAltpayment?: boolean;
|
|
42
38
|
contributionOffset?: number;
|
|
39
|
+
setAltpaymentShift?: Function;
|
|
40
|
+
altpaymentShift?: AltpaymentShift | undefined;
|
|
41
|
+
useAltpayment?: boolean;
|
|
42
|
+
setUseAltpayment?: Function;
|
|
43
|
+
txsSocket?: Socket;
|
|
44
|
+
setTxsSocket?: Function;
|
|
45
|
+
altpaymentSocket?: Socket;
|
|
46
|
+
setAltpaymentSocket?: Function;
|
|
47
|
+
shiftCompleted?: boolean;
|
|
48
|
+
setShiftCompleted?: Function;
|
|
49
|
+
setCoins?: Function;
|
|
50
|
+
coins?: AltpaymentCoin[];
|
|
51
|
+
setCoinPair?: Function;
|
|
52
|
+
coinPair?: AltpaymentPair;
|
|
53
|
+
setLoadingPair?: Function;
|
|
54
|
+
loadingPair?: boolean;
|
|
55
|
+
setLoadingShift?: Function;
|
|
56
|
+
loadingShift?: boolean;
|
|
57
|
+
setAltpaymentError?: Function;
|
|
58
|
+
altpaymentError?: AltpaymentError;
|
|
59
|
+
addressType?: Currency;
|
|
60
|
+
setAddressType?: Function;
|
|
61
|
+
newTxText?: string;
|
|
62
|
+
transactionText?: string;
|
|
43
63
|
}
|
|
44
64
|
export declare const Widget: React.FunctionComponent<WidgetProps>;
|
|
45
65
|
export default Widget;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WidgetProps } from './Widget';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.FunctionComponent<WidgetProps>;
|
|
6
|
+
decorators: ((Story: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, import("@storybook/types").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/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, WidgetProps>;
|
|
30
|
+
export declare const Success: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, WidgetProps>;
|
|
31
|
+
export declare const Loading: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, WidgetProps>;
|
|
32
|
+
export declare const OrangeTheme: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, WidgetProps>;
|
|
33
|
+
export declare const CustomTheme: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, WidgetProps>;
|
|
34
|
+
export declare const WithGoal: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0fc72a6d").R, WidgetProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Currency, CurrencyObject, Transaction } from '../../util';
|
|
3
3
|
import { WidgetProps } from './Widget';
|
|
4
|
-
export interface WidgetContainerProps extends Omit<WidgetProps, 'success' | '
|
|
4
|
+
export interface WidgetContainerProps extends Omit<WidgetProps, 'success' | 'setCurrencyObject' | 'shiftCompleted' | 'setShiftCompleted'> {
|
|
5
5
|
active?: boolean;
|
|
6
6
|
amount?: number;
|
|
7
7
|
opReturn?: string;
|
|
@@ -25,6 +25,9 @@ export interface WidgetContainerProps extends Omit<WidgetProps, 'success' | 'set
|
|
|
25
25
|
successText?: string;
|
|
26
26
|
disableAltpayment?: boolean;
|
|
27
27
|
contributionOffset?: number;
|
|
28
|
+
setNewTxs: Function;
|
|
29
|
+
disableSound?: boolean;
|
|
30
|
+
transactionText?: string;
|
|
28
31
|
}
|
|
29
32
|
export interface Output {
|
|
30
33
|
index: number;
|
|
@@ -8,3 +8,6 @@ declare const _default: {
|
|
|
8
8
|
getCurrencyTypeFromAddress: (address: string) => string;
|
|
9
9
|
};
|
|
10
10
|
export default _default;
|
|
11
|
+
declare type NetworkSlugsType = 'ecash' | 'bitcoincash';
|
|
12
|
+
export declare const getAddressPrefix: (addressString: string) => NetworkSlugsType;
|
|
13
|
+
export declare const getAddressPrefixed: (addressString: string) => string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CashtabExtensionUnavailableError, CashtabAddressDeniedError, CashtabTimeoutError } from 'cashtab-connect';
|
|
2
|
+
/**
|
|
3
|
+
* Check if the Cashtab extension is available (with caching)
|
|
4
|
+
* This function caches the result to avoid multiple extension checks per page load
|
|
5
|
+
* @returns Promise<boolean> - true if extension is available, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare const getCashtabProviderStatus: () => Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Clear the cached extension status (useful for testing or if extension state changes)
|
|
10
|
+
*/
|
|
11
|
+
export declare const clearCashtabStatusCache: () => void;
|
|
12
|
+
export declare const initializeCashtabStatus: () => Promise<boolean>;
|
|
13
|
+
export declare const waitForCashtabExtension: (timeout?: number | undefined) => Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Request the user's eCash address from their Cashtab wallet
|
|
16
|
+
* @returns Promise<string> - The user's address
|
|
17
|
+
* @throws {CashtabExtensionUnavailableError} When the Cashtab extension is not available
|
|
18
|
+
* @throws {CashtabAddressDeniedError} When the user denies the address request
|
|
19
|
+
* @throws {CashtabTimeoutError} When the request times out
|
|
20
|
+
*/
|
|
21
|
+
export declare const requestCashtabAddress: () => Promise<string>;
|
|
22
|
+
export declare const sendXecWithCashtab: (address: string, amount: string | number) => Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Open Cashtab with a BIP21 payment URL
|
|
25
|
+
* @param bip21Url - The BIP21 formatted payment URL
|
|
26
|
+
* @param fallbackUrl - Optional fallback URL if extension is not available
|
|
27
|
+
*/
|
|
28
|
+
export declare const openCashtabPayment: (bip21Url: string, fallbackUrl?: string | undefined) => Promise<void>;
|
|
29
|
+
export { CashtabExtensionUnavailableError, CashtabAddressDeniedError, CashtabTimeoutError };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChronikClient, WsEndpoint } from 'chronik-client-cashtokens';
|
|
2
|
+
import { AddressType } from 'ecashaddrjs/dist/types';
|
|
3
|
+
export interface OpReturnData {
|
|
4
|
+
rawMessage: string;
|
|
5
|
+
message: string;
|
|
6
|
+
paymentId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function getNullDataScriptData(outputScript: string): OpReturnData | null;
|
|
9
|
+
export declare function toHash160(address: string): {
|
|
10
|
+
type: AddressType;
|
|
11
|
+
hash160: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function satoshisToUnit(satoshis: bigint, networkFormat: string): Promise<string>;
|
|
14
|
+
export declare const fromHash160: (networkSlug: string, type: AddressType, hash160: string) => string;
|
|
15
|
+
export declare function outputScriptToAddress(networkSlug: string, outputScript: string | undefined): string | undefined;
|
|
16
|
+
export declare const parseWebsocketMessage: (wsMsg: any, setNewTx: Function, chronik: ChronikClient, address: string) => Promise<void>;
|
|
17
|
+
export declare const initializeChronikWebsocket: (address: string, setNewTx: Function) => Promise<WsEndpoint>;
|
|
@@ -4,3 +4,4 @@ export declare const DECIMALS: {
|
|
|
4
4
|
[key: string]: number;
|
|
5
5
|
};
|
|
6
6
|
export declare const CURRENCY_PREFIXES_MAP: Record<typeof CRYPTO_CURRENCIES[number], string>;
|
|
7
|
+
export declare type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | "extrasmall" | "small" | "medium" | "large" | "extralarge" | undefined;
|
|
@@ -13,6 +13,8 @@ export interface EncodeOpReturnParams {
|
|
|
13
13
|
paymentId?: string;
|
|
14
14
|
}
|
|
15
15
|
export declare function encodeOpReturnProps({ opReturn, disablePaymentId, paymentId }: EncodeOpReturnParams): string;
|
|
16
|
+
export declare function parseStringToArray(str: string): string | string[];
|
|
17
|
+
export declare function parseOpReturnData(opReturnData: string): any;
|
|
16
18
|
export declare const exportedForTesting: {
|
|
17
19
|
prependPaymentIdWithPushdata: typeof prependPaymentIdWithPushdata;
|
|
18
20
|
generatePaymentId: typeof generatePaymentId;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Socket } from 'socket.io-client';
|
|
2
|
+
import { CheckSuccessInfo, Transaction } from './types';
|
|
3
|
+
interface AltpaymentListenerParams {
|
|
4
|
+
addressType: string;
|
|
5
|
+
altpaymentSocket: Socket;
|
|
6
|
+
setCoins: Function;
|
|
7
|
+
setCoinPair: Function;
|
|
8
|
+
setLoadingPair: Function;
|
|
9
|
+
setAltpaymentShift: Function;
|
|
10
|
+
setLoadingShift: Function;
|
|
11
|
+
setAltpaymentError: Function;
|
|
12
|
+
}
|
|
13
|
+
export declare const altpaymentListener: (params: AltpaymentListenerParams) => void;
|
|
14
|
+
interface SetupAltpaymentSocketParams {
|
|
15
|
+
addressType: string;
|
|
16
|
+
altpaymentSocket?: Socket;
|
|
17
|
+
wsBaseUrl?: string;
|
|
18
|
+
setAltpaymentSocket: Function;
|
|
19
|
+
setCoins: Function;
|
|
20
|
+
setCoinPair: Function;
|
|
21
|
+
setLoadingPair: Function;
|
|
22
|
+
setAltpaymentShift: Function;
|
|
23
|
+
setLoadingShift: Function;
|
|
24
|
+
setAltpaymentError: Function;
|
|
25
|
+
}
|
|
26
|
+
export declare const setupAltpaymentSocket: (params: SetupAltpaymentSocketParams) => Promise<void>;
|
|
27
|
+
interface SetupTxsSocketParams {
|
|
28
|
+
address: string;
|
|
29
|
+
txsSocket?: Socket;
|
|
30
|
+
apiBaseUrl?: string;
|
|
31
|
+
wsBaseUrl?: string;
|
|
32
|
+
setTxsSocket: Function;
|
|
33
|
+
setNewTxs: Function;
|
|
34
|
+
setDialogOpen?: Function;
|
|
35
|
+
checkSuccessInfo?: CheckSuccessInfo;
|
|
36
|
+
}
|
|
37
|
+
export declare const setupTxsSocket: (params: SetupTxsSocketParams) => Promise<void>;
|
|
38
|
+
export declare const setupChronikWebSocket: (params: SetupTxsSocketParams) => Promise<void>;
|
|
39
|
+
export declare const onMessage: (transactions: Transaction[], setNewTxs: Function, setDialogOpen?: Function | undefined, checkSuccessInfo?: CheckSuccessInfo | undefined) => void;
|
|
40
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
1
2
|
import { CRYPTO_CURRENCIES, FIAT_CURRENCIES } from "./constants";
|
|
2
3
|
export declare type CurrencyObject = {
|
|
3
4
|
float: number;
|
|
@@ -14,6 +15,7 @@ export interface Transaction {
|
|
|
14
15
|
address: string;
|
|
15
16
|
rawMessage?: string;
|
|
16
17
|
inputAddresses?: string[];
|
|
18
|
+
opReturn?: string;
|
|
17
19
|
}
|
|
18
20
|
export interface UtxoDetails {
|
|
19
21
|
outputsList: [Output];
|
|
@@ -132,4 +134,14 @@ export interface BroadcastTxData {
|
|
|
132
134
|
txs: Transaction[];
|
|
133
135
|
messageType: TxBroadcast;
|
|
134
136
|
}
|
|
137
|
+
export interface CheckSuccessInfo {
|
|
138
|
+
currency: Currency;
|
|
139
|
+
price: number;
|
|
140
|
+
randomSatoshis: number | boolean;
|
|
141
|
+
disablePaymentId?: boolean;
|
|
142
|
+
expectedPaymentId?: string;
|
|
143
|
+
expectedAmount?: BigNumber | number;
|
|
144
|
+
expectedOpReturn?: string;
|
|
145
|
+
currencyObj?: CurrencyObject;
|
|
146
|
+
}
|
|
135
147
|
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
2
|
+
import { CurrencyObject, Transaction } from "./types";
|
|
3
|
+
export declare const shouldTriggerOnSuccess: (transaction: Transaction, currency: string, price: number, randomSatoshis: number | boolean, disablePaymentId?: boolean | undefined, expectedPaymentId?: string | undefined, expectedAmount?: number | BigNumber | undefined, expectedOpReturn?: string | undefined, currencyObject?: CurrencyObject | undefined) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paybutton/react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "The easiest way to accept eCash online",
|
|
5
5
|
"author": "Blockchain Ventures Corp.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,39 +22,42 @@
|
|
|
22
22
|
"lint": "eslint 'lib/**/*.{ts,tsx}' --fix",
|
|
23
23
|
"prettier": "prettier --write 'lib/**/*.ts'",
|
|
24
24
|
"dev": "concurrently yarn:watch yarn:storybook",
|
|
25
|
-
"storybook": "
|
|
25
|
+
"storybook": "storybook dev -p 6006",
|
|
26
26
|
"watch": "microbundle watch --jsx React.createElement --no-compress --format modern,cjs",
|
|
27
27
|
"test": "jest",
|
|
28
28
|
"test:coverage": "jest --coverage"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"react": "17.0.0",
|
|
32
|
-
"react-dom": "17.0.0"
|
|
31
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
32
|
+
"react-dom": "^17.0.0 || ^18.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@babel/core": "7.18.9",
|
|
36
36
|
"@popperjs/core": "2.11.5",
|
|
37
|
-
"@storybook/addon-a11y": "6.
|
|
38
|
-
"@storybook/addon-actions": "6.
|
|
39
|
-
"@storybook/addon-essentials": "6.
|
|
40
|
-
"@storybook/addon-links": "6.
|
|
41
|
-
"@storybook/
|
|
42
|
-
"@storybook/
|
|
43
|
-
"@storybook/react": "6.
|
|
37
|
+
"@storybook/addon-a11y": "^7.6.17",
|
|
38
|
+
"@storybook/addon-actions": "^7.6.17",
|
|
39
|
+
"@storybook/addon-essentials": "^7.6.17",
|
|
40
|
+
"@storybook/addon-links": "^7.6.17",
|
|
41
|
+
"@storybook/cli": "^7.6.17",
|
|
42
|
+
"@storybook/react": "^7.6.17",
|
|
43
|
+
"@storybook/react-vite": "^7.6.17",
|
|
44
44
|
"@types/currency-formatter": "1.5.1",
|
|
45
|
+
"@types/decimal.js": "^7.4.3",
|
|
45
46
|
"@types/lodash": "4.14.182",
|
|
47
|
+
"@types/minimatch": "^6.0.0",
|
|
46
48
|
"@types/node": "17.0.41",
|
|
47
49
|
"@types/qrcode.react": "1.0.2",
|
|
48
50
|
"@types/react": "17.0.0",
|
|
49
51
|
"@types/react-dom": "17.0.0",
|
|
50
|
-
"@typescript-eslint/eslint-plugin": "
|
|
51
|
-
"@typescript-eslint/parser": "
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "8.39.1",
|
|
53
|
+
"@typescript-eslint/parser": "8.39.1",
|
|
54
|
+
"@vitejs/plugin-react": "^4.6.0",
|
|
52
55
|
"babel-eslint": "10.1.0",
|
|
53
56
|
"babel-loader": "8.2.5",
|
|
54
57
|
"concurrently": "5.3.0",
|
|
55
58
|
"cross-env": "7.0.3",
|
|
56
59
|
"currency-formatter": "1.5.9",
|
|
57
|
-
"eslint": "
|
|
60
|
+
"eslint": "9.33.0",
|
|
58
61
|
"eslint-config-prettier": "6.15.0",
|
|
59
62
|
"eslint-config-standard": "14.1.1",
|
|
60
63
|
"eslint-config-standard-react": "9.2.0",
|
|
@@ -70,9 +73,13 @@
|
|
|
70
73
|
"lint-staged": "10.5.4",
|
|
71
74
|
"microbundle": "0.12.4",
|
|
72
75
|
"prettier": "2.7.1",
|
|
76
|
+
"react": "^17.0.0",
|
|
77
|
+
"react-dom": "^17.0.0",
|
|
73
78
|
"react-is": "16.13.1",
|
|
74
|
-
"react-scripts": "
|
|
79
|
+
"react-scripts": "5.0.1",
|
|
80
|
+
"storybook": "^7.6.17",
|
|
75
81
|
"typescript": "^4.8.2",
|
|
82
|
+
"vite": "^4.4.5",
|
|
76
83
|
"yarn-run-all": "^3.1.1"
|
|
77
84
|
},
|
|
78
85
|
"dependencies": {
|
|
@@ -83,8 +90,12 @@
|
|
|
83
90
|
"@types/jest": "^29.5.11",
|
|
84
91
|
"axios": "1.6.5",
|
|
85
92
|
"bignumber.js": "9.0.2",
|
|
93
|
+
"cashtab-connect": "^1.1.0",
|
|
94
|
+
"chronik-client-cashtokens": "^3.1.1-rc0",
|
|
86
95
|
"copy-to-clipboard": "3.3.3",
|
|
87
96
|
"crypto-js": "^4.2.0",
|
|
97
|
+
"decimal.js": "^10.6.0",
|
|
98
|
+
"ecashaddrjs": "^2.0.0",
|
|
88
99
|
"jest": "^29.7.0",
|
|
89
100
|
"lodash": "4.17.21",
|
|
90
101
|
"notistack": "1.0.10",
|
|
@@ -102,6 +113,7 @@
|
|
|
102
113
|
},
|
|
103
114
|
"resolutions": {
|
|
104
115
|
"@types/react": "17.0.0",
|
|
105
|
-
"@types/react-dom": "17.0.0"
|
|
116
|
+
"@types/react-dom": "17.0.0",
|
|
117
|
+
"chronik-client-cashtokens/ecashaddrjs": "^2.0.0"
|
|
106
118
|
}
|
|
107
119
|
}
|
|
@@ -1,23 +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, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
|
7
|
-
defaultProps: ButtonProps;
|
|
8
|
-
};
|
|
9
|
-
decorators: ((Story: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, import("@storybook/react").Args>) => React.ReactNode)[];
|
|
10
|
-
argTypes: {
|
|
11
|
-
onClick: {
|
|
12
|
-
table: {
|
|
13
|
-
disable: boolean;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
parameters: {
|
|
18
|
-
jest: string[];
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export default _default;
|
|
22
|
-
export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ButtonProps>;
|
|
23
|
-
export declare const OrangeTheme: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ButtonProps>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { WidgetProps } from './Widget';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: React.FunctionComponent<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,14 +0,0 @@
|
|
|
1
|
-
import { Socket } from 'socket.io-client';
|
|
2
|
-
export declare const txsListener: (socket: Socket, setNewTxs: Function) => void;
|
|
3
|
-
interface AltpaymentListenerParams {
|
|
4
|
-
addressType: string;
|
|
5
|
-
socket: Socket;
|
|
6
|
-
setCoins: Function;
|
|
7
|
-
setCoinPair: Function;
|
|
8
|
-
setLoadingPair: Function;
|
|
9
|
-
setAltpaymentShift: Function;
|
|
10
|
-
setLoadingShift: Function;
|
|
11
|
-
setAltpaymentError: Function;
|
|
12
|
-
}
|
|
13
|
-
export declare const altpaymentListener: (params: AltpaymentListenerParams) => void;
|
|
14
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import BigNumber from "bignumber.js";
|
|
2
|
-
import { CurrencyObject, Transaction } from "./types";
|
|
3
|
-
export declare const shouldTriggerOnSuccess: (transaction: Transaction, currency: string, price: number, disablePaymentId?: boolean | undefined, expectedPaymentId?: string | undefined, expectedAmount?: BigNumber | undefined, expectedOpReturn?: string | undefined, currencyObject?: CurrencyObject | undefined) => Promise<boolean>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|