1- use candid:: { Nat , Principal } ;
1+ use candid:: Principal ;
22use did:: build:: BuildData ;
33use did:: H160 ;
44use ic_canister_client:: { CanisterClient , CanisterClientResult } ;
55use minter_did:: error:: Result as McResult ;
66use minter_did:: id256:: Id256 ;
7- use minter_did:: init:: OperationPricing ;
87use minter_did:: order:: SignedMintOrder ;
98use minter_did:: reason:: Icrc2Burn ;
109
@@ -84,40 +83,12 @@ impl<C: CanisterClient> MinterCanisterClient<C> {
8483 . await
8584 }
8685
87- /// Returns operation points number of the user.
88- pub async fn get_user_operation_points (
89- & self ,
90- user : Option < Principal > ,
91- ) -> CanisterClientResult < u32 > {
92- self . client
93- . query ( "get_user_operation_points" , ( user, ) )
94- . await
95- }
96-
97- /// Returns operations pricing.
98- /// This method is available for canister owner only.
99- pub async fn set_operation_pricing (
100- & mut self ,
101- pricing : OperationPricing ,
102- ) -> CanisterClientResult < McResult < ( ) > > {
103- self . client
104- . update ( "set_operation_pricing" , ( pricing, ) )
105- . await
106- }
107-
108- /// Returns operation pricing.
109- pub async fn get_operation_pricing ( & self ) -> CanisterClientResult < OperationPricing > {
110- self . client . query ( "get_operation_pricing" , ( ) ) . await
111- }
112-
11386 /// Creates ERC-20 mint order for ICRC-2 tokens burning.
114- pub async fn create_erc_20_mint_order (
87+ pub async fn burn_icrc2 (
11588 & self ,
11689 reason : Icrc2Burn ,
11790 ) -> CanisterClientResult < McResult < SignedMintOrder > > {
118- self . client
119- . update ( "create_erc_20_mint_order" , ( reason, ) )
120- . await
91+ self . client . update ( "burn_icrc2" , ( reason, ) ) . await
12192 }
12293
12394 /// Returns `(nonce, mint_order)` pairs for the given sender id.
@@ -131,39 +102,15 @@ impl<C: CanisterClient> MinterCanisterClient<C> {
131102 . await
132103 }
133104
134- /// Approves ICRC-2 token transfer from minter canister to recepient.
135- /// Returns approved amount.
136- ///
137- /// # Arguments
138- /// - `user` is an address of wallet which has been used for Wrapped token burning.
139- /// - `operation_id` is an ID retuned by `BFTBridge::burn()` operation.
140- pub async fn start_icrc2_mint (
141- & self ,
142- user : & H160 ,
143- operation_id : u32 ,
144- ) -> CanisterClientResult < McResult < Nat > > {
145- self . client
146- . update ( "start_icrc2_mint" , ( user, operation_id) )
147- . await
148- }
149-
150- /// Transfers ICRC-2 tokens from minter canister to recepient.
151- ///
152- /// Before it can be used, ICRC-2 token must be approved by `start_icrc2_mint` which approves the transfer.
153- /// After the approval, user should finalize Wrapped token burning, using `BFTBridge::finish_burn()`.
154- pub async fn finish_icrc2_mint (
105+ /// Returns mint order for the given parameters.
106+ pub async fn get_mint_order (
155107 & self ,
108+ sender : Id256 ,
109+ src_token : Id256 ,
156110 operation_id : u32 ,
157- address : & H160 ,
158- icrc2_token : Principal ,
159- recipient : Principal ,
160- amount : Nat ,
161- ) -> CanisterClientResult < McResult < Nat > > {
111+ ) -> CanisterClientResult < Option < SignedMintOrder > > {
162112 self . client
163- . update (
164- "finish_icrc2_mint" ,
165- ( operation_id, address, icrc2_token, recipient, amount) ,
166- )
113+ . query ( "get_mint_order" , ( sender, src_token, operation_id) )
167114 . await
168115 }
169116
0 commit comments