Commit f80f90d6 authored by Will Cory's avatar Will Cory

move DEFAULT_DATA_TYPE based on comment suggestion

parent 37a5b686
/**
* @internal
* Default data type for attestations
*/
export const DEFAULT_DATA_TYPE = 'string' as const
import type { Address } from '@wagmi/core' import type { Address } from '@wagmi/core'
import { DEFAULT_DATA_TYPE } from '../constants/defaultDataType' import { DataTypeOption, DEFAULT_DATA_TYPE } from '../types/DataTypeOption'
import type { DataTypeOption } from '../types/DataTypeOption'
import { readAttestations } from './readAttestations' import { readAttestations } from './readAttestations'
/** /**
......
...@@ -3,6 +3,7 @@ import { formatBytes32String } from 'ethers/lib/utils.js' ...@@ -3,6 +3,7 @@ import { formatBytes32String } from 'ethers/lib/utils.js'
import { ATTESTATION_STATION_ADDRESS } from '../constants/attestationStationAddress' import { ATTESTATION_STATION_ADDRESS } from '../constants/attestationStationAddress'
import type { AttestationReadParams } from '../types/AttestationReadParams' import type { AttestationReadParams } from '../types/AttestationReadParams'
import { DEFAULT_DATA_TYPE } from '../types/DataTypeOption'
import type { WagmiBytes } from '../types/WagmiBytes' import type { WagmiBytes } from '../types/WagmiBytes'
import { abi } from './abi' import { abi } from './abi'
import { parseAttestationBytes } from './parseAttestationBytes' import { parseAttestationBytes } from './parseAttestationBytes'
...@@ -60,7 +61,7 @@ export const readAttestations = async ( ...@@ -60,7 +61,7 @@ export const readAttestations = async (
}) })
return results.map((dataBytes, i) => { return results.map((dataBytes, i) => {
const dataType = attestationReads[i].dataType ?? 'string' const dataType = attestationReads[i].dataType ?? DEFAULT_DATA_TYPE
return parseAttestationBytes(dataBytes, dataType) return parseAttestationBytes(dataBytes, dataType)
}) })
} }
import { z } from 'zod' import { z } from 'zod'
/**
* @internal
* Default data type for attestations
*/
export const DEFAULT_DATA_TYPE = 'string' as const
/** /**
* Zod validator for the DataType type * Zod validator for the DataType type
* string | bytes | number | bool | address * string | bytes | number | bool | address
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment