From a6a0fa456659b5ce0252197ede47b54df409d00c Mon Sep 17 00:00:00 2001 From: Thijs van Hoof Date: Tue, 30 Jul 2024 08:44:00 +0200 Subject: [PATCH] Allow null for bytes decoding --- packages/filecoin-actor-utils/src/utils/generic.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/filecoin-actor-utils/src/utils/generic.ts b/packages/filecoin-actor-utils/src/utils/generic.ts index 1d0298f1..c36560d6 100644 --- a/packages/filecoin-actor-utils/src/utils/generic.ts +++ b/packages/filecoin-actor-utils/src/utils/generic.ts @@ -100,11 +100,12 @@ export const describeAddress = ( */ export const describeBytes = ( dataType: DataType, - value: string | Uint8Array + value: string | Uint8Array | null ) => { // Convert bytes to base64 string const isBytes = value instanceof Uint8Array - const base64 = isBytes ? BytesToString(value, 'base64') : value + const isNull = value === null + const base64 = isBytes ? BytesToString(value, 'base64') : isNull ? '' : value // Check the value type and add to the descriptor checkValueType(dataType, base64, 'string')