layer_climb_core/signing/authz/
tx.rs

1use layer_climb_proto::authz::Grant;
2
3use crate::prelude::*;
4
5impl SigningClient {
6    pub async fn authz_grant_any(
7        &self,
8        granter: Option<Address>,
9        grantee: Address,
10        grant: Option<Grant>,
11        tx_builder: Option<TxBuilder<'_>>,
12    ) -> Result<layer_climb_proto::abci::TxResponse> {
13        let resp = tx_builder
14            .unwrap_or_else(|| self.tx_builder())
15            .broadcast([proto_into_any(
16                &self.authz_grant_any_msg(granter, grantee, grant)?,
17            )?])
18            .await?;
19
20        Ok(resp)
21    }
22
23    pub async fn authz_grant_send(
24        &self,
25        granter: Option<Address>,
26        grantee: Address,
27        spend_limit: Vec<layer_climb_proto::Coin>,
28        allow_list: Vec<Address>,
29        tx_builder: Option<TxBuilder<'_>>,
30    ) -> Result<layer_climb_proto::abci::TxResponse> {
31        let resp = tx_builder
32            .unwrap_or_else(|| self.tx_builder())
33            .broadcast([proto_into_any(&self.authz_grant_send_msg(
34                granter,
35                grantee,
36                spend_limit,
37                allow_list,
38            )?)?])
39            .await?;
40
41        Ok(resp)
42    }
43}