Skip to content

Commit f05bbdc

Browse files
authored
Merge pull request #376 from Concordium/fix-decode-cbor-rbac
fix: update base reference, update to decode cbor for token authoriza…
2 parents 2006eba + e86da0c commit f05bbdc

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ readme = "README.md"
99
include = ["src/", "examples/", "CHANGELOG.md"]
1010
description = "An SDK to use the Concordium blockchain."
1111
repository = "https://github.com/Concordium/concordium-rust-sdk"
12+
resolver = "3"
1213

1314
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1415

src/protocol_level_tokens/token_client.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,6 @@ mod tests {
10281028
mintable: None,
10291029
burnable: None,
10301030
paused,
1031-
additional: HashMap::new(),
10321031
}
10331032
}
10341033

@@ -1042,7 +1041,6 @@ mod tests {
10421041
.then_some(TokenModuleAccountState {
10431042
allow_list,
10441043
deny_list,
1045-
additional: HashMap::new(),
10461044
})
10471045
.map(|s| cbor::cbor_encode(&s).into());
10481046

src/v2/mod.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,21 @@ use crate::{
1818
CredentialRegistrationID, Energy, Memo, Nonce, RegisteredData, SpecialTransactionOutcome,
1919
TransactionStatus, UpdateSequenceNumber,
2020
},
21-
v2::generated::plt::TokenAuthorizations,
2221
};
2322
use anyhow::Context;
2423
use concordium_base::{
2524
base::{AccountIndex, BlockHeight, Epoch, GenesisIndex},
2625
common::{
2726
self,
27+
cbor::cbor_decode,
2828
types::{TransactionSignature, TransactionSignaturesV1, TransactionTime},
2929
},
3030
contracts_common::{
3131
AccountAddress, AccountAddressParseError, Amount, ContractAddress, OwnedContractName,
3232
OwnedParameter, OwnedReceiveName, ReceiveName,
3333
},
3434
hashes::HashFromStrError,
35+
protocol_level_tokens::TokenAuthorizations,
3536
transactions::{BlockItem, EncodedPayload, PayloadLike},
3637
};
3738
pub use endpoints::{QueryError, QueryResult, RPCError, RPCResult};
@@ -2042,7 +2043,16 @@ impl Client {
20422043

20432044
let response = self.client.get_token_authorizations(request).await?;
20442045

2045-
Ok(response.into_inner())
2046+
let cbor_enc_token_authorizations = response.into_inner();
2047+
2048+
let details = cbor_enc_token_authorizations
2049+
.details
2050+
.ok_or_else(|| tonic::Status::internal("missing CBOR details"))?;
2051+
2052+
let decoded_token_authorizations = cbor_decode::<TokenAuthorizations>(&details.value)
2053+
.map_err(|e| RPCError::ParseError(e.into()))?;
2054+
2055+
Ok(decoded_token_authorizations)
20462056
}
20472057

20482058
/// Get the block items included in a given block.

0 commit comments

Comments
 (0)