forked from coinbase/react-coinbase-commerce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.js
78 lines (67 loc) · 1.51 KB
/
types.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
opaque type OrderCode = string;
type Network = 'bitcoin' | 'bitcoincash' | 'ethereum' | 'litecoin' | 'dogecoin'
type PricingType = 'fixed_price' | 'no_price'
type PaymentStatus = 'NEW' | 'PENDING' | 'CONFIRMED' | 'FAILED'
type FiatCurrency = string
type CryptoCurrency = string
type CryptoMoney = {|
amount: string,
currency: CryptoCurrency
|}
type FiatMoney = {|
amount: string,
currency: FiatCurrency,
|}
type ChargePricing = {|
local: FiatMoney,
bitcoin: ?CryptoMoney,
bitcoincash: ?CryptoMoney,
ethereum: ?CryptoMoney,
litecoin: ?CryptoMoney,
dogecoin: ?CryptoMoney
|}
export type Payment = {|
network: Network,
transactionId: string,
status: PaymentStatus,
value: {
crypto: CryptoMoney,
local: FiatMoney
},
block: {
height?: number,
hash?: string,
confirmations: number,
confirmationsRequired: number
}
|}
type ChargeState = {|
status: ChargeStatus,
context: ?ChargeContext,
time: string,
payment?: {
network: Network,
transactionId: string
}
|}
export type Charge = {|
code: OrderCode,
createdAt: string,
confirmedAt?: string,
expiresAt: string,
addresses: { [Network]: string },
pricingType: PricingType,
pricing?: ChargePricing,
payments: Array<Payment>,
timeline: Array<ChargeState>,
name?: string,
description?: string,
logoUrl?: string,
checkout?: {| id: string |}, // shallow
redirectUrl?: string,
thirdPartyProvider?: string
|}
export type MessageData = {
event: 'charge:created' | 'charge:failed',
charge: Charge
}