hashgraph / hashgraph/hedera-docs
Add example for how to deserialize a base64 encoded binary protobuf data.
- Dominant language
- MDX
- Stars
- 10
- Forks
- 49
- Avg merge
- 19h 49m
- Merged PRs (30d)
- 17
Description
### Problem
The mirror node API response for scheduled includes a transaction body that is in base64 encoded binary protobuf format. Devs should have an example for how to deserialize this data.
```
import { proto } from "@hashgraph/proto";
const encodedString =
"CIDh6xcSHlNlbnQgdmlhIEhhc2hQYWNrIFNlY3VyZSBUcmFkZUo3ChgKCgoDGLsKEP+Dr18KCgoDGO8LEICEr18SGwoFGPTl3gISCAoDGLsKEMcBEggKAxjvCxDIAQ==";
// Decode the Base64 string into a binary string
const binaryString = atob(encodedString);
// Convert the binary string to a byte array
const byteArray = new Uint8Array(binaryString.length);
for (let i = 0; i < binaryString.length; i++) {
byteArray[i] = binaryString.charCodeAt(i);
}
console.log(proto.SchedulableTransactionBody.decode(byteArray));
```
### Solution
Add example/tutorial
### Alternatives
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.