@@ -62,7 +62,7 @@ pub struct InitInputsTransition(
6262 Option <
6363 payjoin:: persist:: MaybeBadInitInputsTransition <
6464 payjoin:: receive:: v2:: SessionEvent ,
65- payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: WithContext > ,
65+ payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: Initialized > ,
6666 payjoin:: IntoUrlError ,
6767 > ,
6868 > ,
@@ -71,7 +71,7 @@ pub struct InitInputsTransition(
7171) ;
7272
7373impl InitInputsTransition {
74- pub fn save < P > ( & self , persister : & P ) -> Result < WithContext , ReceiverPersistedError >
74+ pub fn save < P > ( & self , persister : & P ) -> Result < Initialized , ReceiverPersistedError >
7575 where
7676 P : SessionPersister < SessionEvent = payjoin:: receive:: v2:: SessionEvent > ,
7777 {
@@ -98,7 +98,7 @@ impl From<UninitializedReceiver>
9898}
9999
100100impl UninitializedReceiver {
101- /// Creates a new [`WithContext `] with the provided parameters.
101+ /// Creates a new [`Initialized `] with the provided parameters.
102102 ///
103103 /// # Parameters
104104 /// - `address`: The Bitcoin address for the payjoin session.
@@ -107,7 +107,7 @@ impl UninitializedReceiver {
107107 /// - `expire_after`: The duration after which the session expires.
108108 ///
109109 /// # Returns
110- /// A new instance of [`WithContext `].
110+ /// A new instance of [`Initialized `].
111111 ///
112112 /// # References
113113 /// - [BIP 77: Payjoin Version 2: Serverless Payjoin](https://github.com/bitcoin/bips/blob/master/bip-0077.md)
@@ -129,35 +129,35 @@ impl UninitializedReceiver {
129129}
130130
131131#[ derive( Clone , Debug , serde:: Serialize , serde:: Deserialize ) ]
132- pub struct WithContext ( payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: WithContext > ) ;
132+ pub struct Initialized ( payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: Initialized > ) ;
133133
134- impl From < WithContext > for payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: WithContext > {
135- fn from ( value : WithContext ) -> Self { value. 0 }
134+ impl From < Initialized > for payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: Initialized > {
135+ fn from ( value : Initialized ) -> Self { value. 0 }
136136}
137137
138- impl From < payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: WithContext > > for WithContext {
139- fn from ( value : payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: WithContext > ) -> Self {
138+ impl From < payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: Initialized > > for Initialized {
139+ fn from ( value : payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: Initialized > ) -> Self {
140140 Self ( value)
141141 }
142142}
143143
144- pub struct WithContextTransition (
144+ pub struct InitializedTransition (
145145 Arc <
146146 RwLock <
147147 Option <
148148 payjoin:: persist:: MaybeFatalTransitionWithNoResults <
149149 payjoin:: receive:: v2:: SessionEvent ,
150150 payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: UncheckedProposal > ,
151- payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: WithContext > ,
151+ payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: Initialized > ,
152152 payjoin:: receive:: Error ,
153153 > ,
154154 > ,
155155 > ,
156156 > ,
157157) ;
158158
159- impl WithContextTransition {
160- pub fn save < P > ( & self , persister : & P ) -> Result < WithContextTransitionOutcome , ReceiverPersistedError >
159+ impl InitializedTransition {
160+ pub fn save < P > ( & self , persister : & P ) -> Result < InitializedTransitionOutcome , ReceiverPersistedError >
161161 where
162162 P : SessionPersister < SessionEvent = payjoin:: receive:: v2:: SessionEvent > ,
163163 {
@@ -173,14 +173,14 @@ impl WithContextTransition {
173173 }
174174}
175175
176- pub struct WithContextTransitionOutcome (
176+ pub struct InitializedTransitionOutcome (
177177 payjoin:: persist:: OptionalTransitionOutcome <
178178 payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: UncheckedProposal > ,
179- payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: WithContext > ,
179+ payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: Initialized > ,
180180 > ,
181181) ;
182182
183- impl WithContextTransitionOutcome {
183+ impl InitializedTransitionOutcome {
184184 pub fn is_none ( & self ) -> bool { self . 0 . is_none ( ) }
185185
186186 pub fn is_success ( & self ) -> bool { self . 0 . is_success ( ) }
@@ -194,21 +194,21 @@ impl
194194 From <
195195 payjoin:: persist:: OptionalTransitionOutcome <
196196 payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: UncheckedProposal > ,
197- payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: WithContext > ,
197+ payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: Initialized > ,
198198 > ,
199- > for WithContextTransitionOutcome
199+ > for InitializedTransitionOutcome
200200{
201201 fn from (
202202 value : payjoin:: persist:: OptionalTransitionOutcome <
203203 payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: UncheckedProposal > ,
204- payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: WithContext > ,
204+ payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: Initialized > ,
205205 > ,
206206 ) -> Self {
207207 Self ( value)
208208 }
209209}
210210
211- impl WithContext {
211+ impl Initialized {
212212 pub fn extract_req ( & self , ohttp_relay : String ) -> Result < ( Request , ClientResponse ) , Error > {
213213 self . 0
214214 . clone ( )
@@ -218,15 +218,15 @@ impl WithContext {
218218 }
219219
220220 ///The response can either be an UncheckedProposal or an ACCEPTED message indicating no UncheckedProposal is available yet.
221- pub fn process_res ( & self , body : & [ u8 ] , ctx : & ClientResponse ) -> WithContextTransition {
222- WithContextTransition ( Arc :: new ( RwLock :: new ( Some (
221+ pub fn process_res ( & self , body : & [ u8 ] , ctx : & ClientResponse ) -> InitializedTransition {
222+ InitializedTransition ( Arc :: new ( RwLock :: new ( Some (
223223 self . 0 . clone ( ) . process_res ( body, ctx. into ( ) ) ,
224224 ) ) ) )
225225 }
226226
227227 /// Build a V2 Payjoin URI from the receiver's context
228228 pub fn pj_uri ( & self ) -> crate :: PjUri {
229- <Self as Into < payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: WithContext > > >:: into (
229+ <Self as Into < payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: Initialized > > >:: into (
230230 self . clone ( ) ,
231231 )
232232 . pj_uri ( )
@@ -238,7 +238,7 @@ impl WithContext {
238238 }
239239
240240 pub fn from_json ( json : & str ) -> Result < Self , SerdeJsonError > {
241- serde_json:: from_str :: < payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: WithContext > > (
241+ serde_json:: from_str :: < payjoin:: receive:: v2:: Receiver < payjoin:: receive:: v2:: Initialized > > (
242242 json,
243243 )
244244 . map_err ( Into :: into)
0 commit comments