1#![allow(clippy::too_many_arguments)]
4
5use jsonrpsee::proc_macros::rpc;
6use sui_sdk_types::Address;
7
8use crate::msgs::{
9 RPCTransactionRequestParams,
10 SuiTransactionBlockBuilderMode,
11 SuiTypeTag,
12 TransactionBlockBytes,
13};
14use crate::serde::BigInt;
15
16#[rpc(client, namespace = "unsafe")]
17pub trait TransactionBuilder {
18 #[method(name = "transferObject")]
21 async fn transfer_object(
22 &self,
23 signer: Address,
24 object_id: Address,
25 gas: Option<Address>,
26 gas_budget: BigInt<u64>,
27 recipient: Address,
28 ) -> RpcResult<TransactionBlockBytes>;
29
30 #[method(name = "transferSui")]
32 async fn transfer_sui(
33 &self,
34 signer: Address,
35 sui_object_id: Address,
36 gas_budget: BigInt<u64>,
37 recipient: Address,
38 amount: Option<BigInt<u64>>,
39 ) -> RpcResult<TransactionBlockBytes>;
40
41 #[method(name = "pay")]
46 async fn pay(
47 &self,
48 signer: Address,
49 input_coins: Vec<Address>,
50 recipients: Vec<Address>,
51 amounts: Vec<BigInt<u64>>,
52 gas: Option<Address>,
53 gas_budget: BigInt<u64>,
54 ) -> RpcResult<TransactionBlockBytes>;
55
56 #[method(name = "paySui")]
66 async fn pay_sui(
67 &self,
68 signer: Address,
69 input_coins: Vec<Address>,
70 recipients: Vec<Address>,
71 amounts: Vec<BigInt<u64>>,
72 gas_budget: BigInt<u64>,
73 ) -> RpcResult<TransactionBlockBytes>;
74
75 #[method(name = "payAllSui")]
83 async fn pay_all_sui(
84 &self,
85 signer: Address,
86 input_coins: Vec<Address>,
87 recipient: Address,
88 gas_budget: BigInt<u64>,
89 ) -> RpcResult<TransactionBlockBytes>;
90
91 #[method(name = "moveCall")]
93 async fn move_call(
94 &self,
95 signer: Address,
96 package_object_id: Address,
97 module: String,
98 function: String,
99 type_arguments: Vec<SuiTypeTag>,
100 arguments: Vec<serde_json::Value>,
101 gas: Option<Address>,
102 gas_budget: BigInt<u64>,
103 execution_mode: Option<SuiTransactionBlockBuilderMode>,
104 ) -> RpcResult<TransactionBlockBytes>;
105
106 #[method(name = "publish")]
108 async fn publish(
109 &self,
110 sender: Address,
111 compiled_modules: Vec<String>,
112 dependencies: Vec<Address>,
113 gas: Option<Address>,
114 gas_budget: BigInt<u64>,
115 ) -> RpcResult<TransactionBlockBytes>;
116
117 #[method(name = "splitCoin")]
119 async fn split_coin(
120 &self,
121 signer: Address,
122 coin_object_id: Address,
123 split_amounts: Vec<BigInt<u64>>,
124 gas: Option<Address>,
125 gas_budget: BigInt<u64>,
126 ) -> RpcResult<TransactionBlockBytes>;
127
128 #[method(name = "splitCoinEqual")]
130 async fn split_coin_equal(
131 &self,
132 signer: Address,
133 coin_object_id: Address,
134 split_count: BigInt<u64>,
135 gas: Option<Address>,
136 gas_budget: BigInt<u64>,
137 ) -> RpcResult<TransactionBlockBytes>;
138
139 #[method(name = "mergeCoins")]
141 async fn merge_coin(
142 &self,
143 signer: Address,
144 primary_coin: Address,
145 coin_to_merge: Address,
146 gas: Option<Address>,
147 gas_budget: BigInt<u64>,
148 ) -> RpcResult<TransactionBlockBytes>;
149
150 #[method(name = "batchTransaction")]
152 async fn batch_transaction(
153 &self,
154 signer: Address,
155 single_transaction_params: Vec<RPCTransactionRequestParams>,
156 gas: Option<Address>,
157 gas_budget: BigInt<u64>,
158 txn_builder_mode: Option<SuiTransactionBlockBuilderMode>,
159 ) -> RpcResult<TransactionBlockBytes>;
160
161 #[method(name = "requestAddStake")]
163 async fn request_add_stake(
164 &self,
165 signer: Address,
166 coins: Vec<Address>,
167 amount: Option<BigInt<u64>>,
168 validator: Address,
169 gas: Option<Address>,
170 gas_budget: BigInt<u64>,
171 ) -> RpcResult<TransactionBlockBytes>;
172
173 #[method(name = "requestWithdrawStake")]
175 async fn request_withdraw_stake(
176 &self,
177 signer: Address,
178 staked_sui: Address,
179 gas: Option<Address>,
180 gas_budget: BigInt<u64>,
181 ) -> RpcResult<TransactionBlockBytes>;
182}