-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
93 lines (83 loc) · 1.77 KB
/
types.ts
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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 | null
bitcoincash: CryptoMoney | null
ethereum: CryptoMoney | null
litecoin: CryptoMoney | null
dogecoin: CryptoMoney | null
}
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: any
context: any
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_confirmed'
| 'charge_failed'
| 'payment_detected'
| 'error_not_found'
| 'checkout_modal_closed'
| 'checkout_modal_loaded'
| 'charge_created'
charge: Charge
}
export type SrcParams = {
origin: string
version: string
buttonId: string
custom?: string
cacheDisabled: boolean
}