@@ -17,27 +17,32 @@ import (
17
17
type ArcStatus string
18
18
19
19
const (
20
- RECEIVED ArcStatus = "2"
21
- STORED ArcStatus = "3"
22
- ANNOUNCED_TO_NETWORK ArcStatus = "4"
23
- REQUESTED_BY_NETWORK ArcStatus = "5"
24
- SENT_TO_NETWORK ArcStatus = "6"
25
- ACCEPTED_BY_NETWORK ArcStatus = "7"
26
- SEEN_ON_NETWORK ArcStatus = "8"
20
+ REJECTED ArcStatus = "REJECTED"
21
+ QUEUED ArcStatus = "QUEUED"
22
+ RECEIVED ArcStatus = "RECEIVED"
23
+ STORED ArcStatus = "STORED"
24
+ ANNOUNCED_TO_NETWORK ArcStatus = "ANNOUNCED_TO_NETWORK"
25
+ REQUESTED_BY_NETWORK ArcStatus = "REQUESTED_BY_NETWORK"
26
+ SENT_TO_NETWORK ArcStatus = "SENT_TO_NETWORK"
27
+ ACCEPTED_BY_NETWORK ArcStatus = "ACCEPTED_BY_NETWORK"
28
+ SEEN_ON_NETWORK ArcStatus = "SEEN_ON_NETWORK"
27
29
)
28
30
29
31
type Arc struct {
30
- ApiUrl string
31
- ApiKey string
32
- CallbackUrl * string
33
- CallbackToken * string
34
- FullStatusUpdates bool
35
- MaxTimeout * int
36
- SkipFeeValidation bool
37
- SkipScriptValidation bool
38
- SkipTxValidation bool
39
- WaitForStatus ArcStatus
40
- Client HTTPClient // Added for testing
32
+ ApiUrl string
33
+ ApiKey string
34
+ CallbackUrl * string
35
+ CallbackToken * string
36
+ CallbackBatch bool
37
+ FullStatusUpdates bool
38
+ MaxTimeout * int
39
+ SkipFeeValidation bool
40
+ SkipScriptValidation bool
41
+ SkipTxValidation bool
42
+ CumulativeFeeValidation bool
43
+ WaitForStatus string
44
+ WaitFor ArcStatus
45
+ Client HTTPClient // Added for testing
41
46
}
42
47
43
48
type ArcResponse struct {
@@ -109,6 +114,9 @@ func (a *Arc) Broadcast(t *transaction.Transaction) (*transaction.BroadcastSucce
109
114
if a .CallbackToken != nil {
110
115
req .Header .Set ("X-CallbackToken" , * a .CallbackToken )
111
116
}
117
+ if a .CallbackBatch {
118
+ req .Header .Set ("X-CallbackBatch" , "true" )
119
+ }
112
120
if a .FullStatusUpdates {
113
121
req .Header .Set ("X-FullStatusUpdates" , "true" )
114
122
}
@@ -124,8 +132,14 @@ func (a *Arc) Broadcast(t *transaction.Transaction) (*transaction.BroadcastSucce
124
132
if a .SkipTxValidation {
125
133
req .Header .Set ("X-SkipTxValidation" , "true" )
126
134
}
135
+ if a .CumulativeFeeValidation {
136
+ req .Header .Set ("X-CumulativeFeeValidation" , "true" )
137
+ }
127
138
if a .WaitForStatus != "" {
128
- req .Header .Set ("X-WaitForStatus" , string (a .WaitForStatus ))
139
+ req .Header .Set ("X-WaitForStatus" , a .WaitForStatus )
140
+ }
141
+ if a .WaitFor != "" {
142
+ req .Header .Set ("X-WaitFor" , string (a .WaitFor ))
129
143
}
130
144
131
145
resp , err := a .Client .Do (req )
@@ -159,6 +173,12 @@ func (a *Arc) Broadcast(t *transaction.Transaction) (*transaction.BroadcastSucce
159
173
}
160
174
}
161
175
176
+ if response .TxStatus != nil && * response .TxStatus == REJECTED {
177
+ return nil , & transaction.BroadcastFailure {
178
+ Code : "400" ,
179
+ Description : response .ExtraInfo ,
180
+ }
181
+ }
162
182
if response .Status == 200 {
163
183
return & transaction.BroadcastSuccess {
164
184
Txid : response .Txid ,
0 commit comments