@paybutton/react 2.0.0 → 2.0.2

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.
@@ -6,6 +6,7 @@ import { currency, Transaction } from '../../util/api-client';
6
6
  export interface WidgetProps {
7
7
  to: string;
8
8
  amount?: number | null | string;
9
+ setAmount: Function;
9
10
  text?: string;
10
11
  ButtonComponent?: React.ComponentType;
11
12
  loading: boolean;
@@ -18,6 +19,7 @@ export interface WidgetProps {
18
19
  currency?: currency;
19
20
  animation?: animation;
20
21
  currencyObject?: currencyObject | undefined;
22
+ setCurrencyObject: Function;
21
23
  randomSatoshis?: boolean;
22
24
  price?: number;
23
25
  editable?: boolean;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { cryptoCurrency, currency } from '../../util/api-client';
3
3
  import { WidgetProps } from './Widget';
4
4
  import BigNumber from 'bignumber.js';
5
- export interface WidgetContainerProps extends Omit<WidgetProps, 'loading' | 'success' | 'setNewTxs'> {
5
+ export interface WidgetContainerProps extends Omit<WidgetProps, 'loading' | 'success' | 'setNewTxs' | 'setCurrencyObject' | 'setAmount'> {
6
6
  active?: boolean;
7
7
  amount?: number;
8
8
  currency?: currency;
@@ -17,6 +17,7 @@ export interface WidgetContainerProps extends Omit<WidgetProps, 'loading' | 'suc
17
17
  editable: boolean;
18
18
  wsBaseUrl?: string;
19
19
  apiBaseUrl?: string;
20
+ successText?: string;
20
21
  }
21
22
  export interface Output {
22
23
  index: number;
@@ -5,9 +5,8 @@ export * from './Theme';
5
5
  export default themes;
6
6
  export declare enum ThemeName {
7
7
  ORANGE = "orange",
8
- PAYBUTTON = "paybutton",
9
- XEC = "xec"
8
+ PAYBUTTON = "paybutton"
10
9
  }
11
10
  export declare const getTheme: (name?: ThemeName) => Theme;
12
11
  export declare const ThemeProvider: React.Provider<Theme | undefined>;
13
- export declare const useTheme: (defaultTheme?: ThemeName | Theme | undefined, isXec?: boolean | undefined) => Theme;
12
+ export declare const useTheme: (defaultTheme?: ThemeName | Theme | undefined) => Theme;
@@ -1,10 +1,5 @@
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;
1
+ export declare const validateCashAddress: (to: string) => boolean;
5
2
  declare const _default: {
6
- isValidCashAddress: (address: string) => boolean;
7
- isValidXecAddress: (address: string) => boolean;
8
- getCurrencyTypeFromAddress: (address: string) => currency;
3
+ validateCashAddress: (to: string) => boolean;
9
4
  };
10
5
  export default _default;
@@ -1,71 +1,106 @@
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>;
1
+ export declare const getAddressDetails: (address: string, rootUrl?: string | undefined) => Promise<AddressDetails>;
2
+ export declare const getSatoshiBalance: (address: string, rootUrl?: string | undefined) => Promise<{
3
+ satoshis: number;
4
+ }>;
5
+ export declare const getUTXOs: (address: string, rootUrl?: string | undefined) => Promise<UtxoDetails>;
6
+ export declare const getFiatPrice: (currency: currency) => Promise<PriceData>;
17
7
  export declare const getTransactionDetails: (txid: string, rootUrl?: string) => Promise<TransactionDetails>;
18
8
  declare const _default: {
19
- getAddressDetails: (address: string, rootUrl?: string) => Promise<Transaction[]>;
9
+ getAddressDetails: (address: string, rootUrl?: string | undefined) => Promise<AddressDetails>;
20
10
  getTransactionDetails: (txid: string, rootUrl?: string) => Promise<TransactionDetails>;
21
- getBchFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
22
- getXecFiatPrice: (currency: currency, rootUrl?: string) => Promise<PriceData>;
23
- getAddressBalance: (address: string, rootUrl?: string) => Promise<number>;
11
+ getFiatPrice: (currency: currency) => Promise<PriceData>;
12
+ getSatoshiBalance: (address: string, rootUrl?: string | undefined) => Promise<{
13
+ satoshis: number;
14
+ }>;
24
15
  };
25
16
  export default _default;
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];
17
+ export declare type fiatCurrency = 'USD' | 'CAD' | 'EUR' | 'GBP' | 'AUD';
18
+ export declare type cryptoCurrency = 'BCH' | 'SAT' | 'bits';
32
19
  export declare type currency = cryptoCurrency | fiatCurrency;
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;
20
+ export interface AddressDetails {
21
+ confirmedTransactionsList: [ConfirmedTransaction];
22
+ unconfirmedTransactionsList: [UnconfirmedTransaction];
23
+ }
24
+ export interface ConfirmedTransaction {
39
25
  hash: string;
40
- amount: string;
41
- confirmed: boolean;
42
- timestamp: number;
43
- addressId: string;
44
- createdAt: string;
45
- updatedAt: string;
46
- address: {
47
- id: string;
26
+ version: number;
27
+ inputsList: {
28
+ index: number;
29
+ outpoint: {
30
+ hash: string;
31
+ index: number;
32
+ };
33
+ signatureScript: string;
34
+ sequence: number;
35
+ value: number;
36
+ previousScript: string;
48
37
  address: string;
49
- createdAt: string;
50
- updatedAt: string;
51
- networkId: number;
52
- lastSynced: 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;
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: [];
53
59
  };
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;
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: [];
67
97
  };
68
- }];
98
+ };
99
+ addedTime: number;
100
+ addedHeight: number;
101
+ fee: number;
102
+ feePerKb: number;
103
+ startingPriority: number;
69
104
  }
70
105
  export interface UtxoDetails {
71
106
  outputsList: [Output];
@@ -1,19 +1,14 @@
1
1
  import { currency } from './api-client';
2
- export declare const DECIMALS: {
3
- BCH: number;
4
- XEC: number;
5
- FIAT: number;
6
- };
7
2
  export declare const amount: (x?: number | null | undefined) => string | undefined;
8
3
  export declare const formatPrice: (price: number, currencyType: currency, precision?: number) => string;
9
4
  export declare const formatComma: (number: number) => string;
10
5
  export declare const formatBCH: (bch: string) => string;
11
- export declare const formatXEC: (xec: string) => string;
6
+ export declare const formatBits: (bits: string | number) => string;
12
7
  declare const _default: {
13
8
  amount: (x?: number | null | undefined) => string | undefined;
14
9
  formatPrice: (price: number, currencyType: currency, precision?: number) => string;
15
10
  formatComma: (number: number) => string;
16
11
  formatBCH: (bch: string) => string;
17
- formatXEC: (xec: string) => string;
12
+ formatBits: (bits: string | number) => string;
18
13
  };
19
14
  export default _default;
@@ -1,11 +1,19 @@
1
- import { currency } from './api-client';
1
+ import { fiatCurrency } from './api-client';
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;
2
6
  export declare type currencyObject = {
3
7
  float: number;
4
8
  string: string;
5
9
  currency: string;
10
+ BCHstring?: string | undefined;
11
+ satoshis?: number | undefined;
6
12
  };
7
13
  export declare const getCurrencyObject: (amount: number, currencyType: currency) => currencyObject;
8
14
  declare const _default: {
15
+ satoshisToBch: (satoshis: number) => number;
16
+ bchToSatoshis: (bch: number) => number;
9
17
  getCurrencyObject: (amount: number, currencyType: currency) => currencyObject;
10
18
  };
11
19
  export default _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@paybutton/react",
3
- "version": "2.0.0",
4
- "description": "The easiest way to accept Bitcoin Cash online",
3
+ "version": "2.0.2",
4
+ "description": "The easiest way to accept eCash online",
5
5
  "author": "poldridge",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -1,3 +0,0 @@
1
- import Theme from '../Theme';
2
- declare const theme: Theme;
3
- export default theme;