Skip to content

Commit

Permalink
Allow null for bytes decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
navFooh committed Jul 30, 2024
1 parent 81e3762 commit a6a0fa4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/filecoin-actor-utils/src/utils/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit a6a0fa4

Please sign in to comment.