parse_pczt
Parse a PCZT from bytes.- TypeScript
- Go
- Kotlin
serialize_pczt
Serialize a PCZT to bytes.- TypeScript
- Go
- Kotlin
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Convert PCZTs to and from bytes for transmission
function parse_pczt(bytes: Uint8Array): WasmPczt
// Or from hex
const pczt = WasmPczt.from_hex(hexString);
func ParsePczt(bytes []byte) (*Pczt, error)
fun parsePczt(bytes: ByteArray): Pczt
function serialize_pczt(pczt: WasmPczt): Uint8Array
// Or to hex
const hex = pczt.to_hex();
func SerializePczt(pczt *Pczt) []byte
fun serializePczt(pczt: Pczt): ByteArray
// Serialize for transmission
const pcztBytes = t2z.serialize_pczt(pczt);
const pcztBase64 = btoa(String.fromCharCode(...pcztBytes));
// Send to signer...
const signedBase64 = await sendToSigner(pcztBase64);
// Parse signed PCZT
const signedBytes = Uint8Array.from(atob(signedBase64), c => c.charCodeAt(0));
const signedPczt = t2z.parse_pczt(signedBytes);
// Save to storage
localStorage.setItem('pczt', pczt.to_hex());
// Later, resume
const pczt = WasmPczt.from_hex(localStorage.getItem('pczt'));
Was this page helpful?
