Skip to main content

@hypercerts-org/sdk

Classes

Interfaces

Type Aliases

AllowlistEntry

Ƭ AllowlistEntry: Object

Represents an entry in an allowlist.

Type declaration

NameType
addressstring
unitsbigint

Defined in

sdk/src/types/hypercerts.ts:24


Claim

Ƭ Claim: Object

Type declaration

NameType
__typename?"Claim"
allowlist?Maybe<Allowlist>
contractScalars["String"]["output"]
creationScalars["BigInt"]["output"]
creator?Maybe<Scalars["Bytes"]["output"]>
idScalars["String"]["output"]
owner?Maybe<Scalars["Bytes"]["output"]>
tokenIDScalars["BigInt"]["output"]
totalUnits?Maybe<Scalars["BigInt"]["output"]>
uri?Maybe<Scalars["String"]["output"]>

Defined in

sdk/src/indexer/gql/graphql.ts:205


ClaimByIdQuery

Ƭ ClaimByIdQuery: Object

Type declaration

NameType
__typename?"Query"
claim?{ __typename?: "Claim" ; contract: string ; creator?: any | null ; id: string ; owner?: any | null ; tokenID: any ; totalUnits?: any | null ; uri?: string | null } | null

Defined in

sdk/src/indexer/gql/graphql.ts:1168


ClaimToken

Ƭ ClaimToken: Object

Type declaration

NameType
__typename?"ClaimToken"
claimClaim
idScalars["String"]["output"]
offers?Maybe<Offer[]>
ownerScalars["Bytes"]["output"]
tokenIDScalars["BigInt"]["output"]
unitsScalars["BigInt"]["output"]

Defined in

sdk/src/indexer/gql/graphql.ts:218


ClaimTokenByIdQuery

Ƭ ClaimTokenByIdQuery: Object

Type declaration

NameType
__typename?"Query"
claimToken?{ __typename?: "ClaimToken" ; claim: { __typename?: "Claim" ; creation: any ; id: string ; totalUnits?: any | null ; uri?: string | null } ; id: string ; owner: any ; tokenID: any ; units: any } | null

Defined in

sdk/src/indexer/gql/graphql.ts:1217


ClaimTokensByClaimQuery

Ƭ ClaimTokensByClaimQuery: Object

Type declaration

NameType
__typename?"Query"
claimTokens{ __typename?: "ClaimToken" ; id: string ; owner: any ; tokenID: any ; units: any }[]

Defined in

sdk/src/indexer/gql/graphql.ts:1208


ClaimTokensByOwnerQuery

Ƭ ClaimTokensByOwnerQuery: Object

Type declaration

NameType
__typename?"Query"
claimTokens{ __typename?: "ClaimToken" ; claim: { __typename?: "Claim" ; creation: any ; id: string ; totalUnits?: any | null ; uri?: string | null } ; id: string ; owner: any ; tokenID: any ; units: any }[]

Defined in

sdk/src/indexer/gql/graphql.ts:1189


ClaimsByOwnerQuery

Ƭ ClaimsByOwnerQuery: Object

Type declaration

NameType
__typename?"Query"
claims{ __typename?: "Claim" ; contract: string ; creator?: any | null ; id: string ; owner?: any | null ; tokenID: any ; totalUnits?: any | null ; uri?: string | null }[]

Defined in

sdk/src/indexer/gql/graphql.ts:1130


ContractOverrides

Ƭ ContractOverrides: Object

Configuration options for the contract interactions.

Param

The value to send with the transaction (in wei).

Param

The gas price to use for the transaction (in wei).

Param

The gas limit to use for the transaction (in wei).

Type declaration

NameType
gasLimit?bigint
gasPrice?bigint
value?bigint

Defined in

sdk/src/types/client.ts:25


Contracts

Ƭ Contracts: "HypercertMinterUUPS" | "TransferManager" | "ProtocolFeeRecipient" | "HypercertExchange" | "RoyaltyFeeRegistry" | "OrderValidator" | "CreatorFeeManager" | "StrategyCollectionOffer" | "StrategyDutchAuction" | "StrategyItemIdsRange" | "StrategyHypercertCollectionOffer" | "StrategyHypercertDutchAuction" | "StrategyHypercertFractionOffer"

Defined in

sdk/src/types/client.ts:40


Deployment

Ƭ Deployment: Object

Represents a deployment of a contract on a specific network.

Type declaration

NameTypeDescription
addressesPartial<Record<Contracts, `0x${string}`>>The address of the deployed contract.
chainPartial<Chain>-
graphNamestring-
graphUrlstringThe url to the subgraph that indexes the contract events. Override for localized testing

Defined in

sdk/src/types/client.ts:58


DocumentType

Ƭ DocumentType<TDocumentNode>: TDocumentNode extends DocumentNode<infer TType, any> ? TType : never

Type parameters

NameType
TDocumentNodeextends DocumentNode<any, any>

Defined in

sdk/src/indexer/gql/gql.ts:53


EvaluationData

Ƭ EvaluationData: DuplicateEvaluation | SimpleTextEvaluation

This file was automatically generated by json-schema-to-typescript. DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, and run json-schema-to-typescript to regenerate this file.

Defined in

sdk/src/types/evaluation.d.ts:8


EvaluationSource

Ƭ EvaluationSource: EASEvaluation | IPFSEvaluation

Defined in

sdk/src/types/evaluation.d.ts:9


FragmentType

Ƭ FragmentType<TDocumentType>: TDocumentType extends DocumentTypeDecoration<infer TType, any> ? [TType] extends [{ $fragmentName?: infer TKey }] ? TKey extends string ? { $fragmentRefs?: { [key in TKey]: TType } } : never : never : never

Type parameters

NameType
TDocumentTypeextends DocumentTypeDecoration<any, any>

Defined in

sdk/src/indexer/gql/fragment-masking.ts:5


HypercertClientConfig

Ƭ HypercertClientConfig: Deployment & HypercertStorageConfig & HypercertEvaluatorConfig & { publicClient: PublicClient ; readOnly: boolean ; readOnlyReason?: string ; unsafeForceOverrideConfig?: boolean ; walletClient: WalletClient }

Configuration options for the Hypercert client.

Defined in

sdk/src/types/client.ts:70


HypercertClientProps

Ƭ HypercertClientProps: Object

The props for the Hypercert client.

Type declaration

NameTypeDescription
config?Partial<HypercertClientConfig>The configuration options for the Hypercert client.

Defined in

sdk/src/types/client.ts:143


HypercertEvaluatorConfig

Ƭ HypercertEvaluatorConfig: Omit<PartialTypedDataConfig, "address"> & { easContractAddress: string }

Configuration options for the Hypercert evaluator.

Note

The signer is required for submitting evaluations.

Defined in

sdk/src/types/client.ts:99


HypercertStorageConfig

Ƭ HypercertStorageConfig: Object

Configuration options for the Hypercert storage layer.

Note

The API tokens are optional, but required for storing data on NFT.storage and Web3.storage.

Deprecated

nft.storage and web3.storage are no longer used

Type declaration

NameTypeDescription
nftStorageToken?stringThe API token for NFT.storage.

Defined in

sdk/src/types/client.ts:90


HypercertsSdkError

Ƭ HypercertsSdkError: ConfigurationError | FetchError | InvalidOrMissingError | MalformedDataError | MintingError | StorageError | UnsupportedChainError | UnknownSchemaError

Defined in

sdk/src/types/errors.ts:195


QueryParams

Ƭ QueryParams: Object

Index signature

▪ [key: string]: string | number | undefined

Type declaration

NameType
firstnumber
orderDirections"asc" | "desc"
skipnumber

Defined in

sdk/src/types/indexer.ts:10


RecentClaimsQuery

Ƭ RecentClaimsQuery: Object

Type declaration

NameType
__typename?"Query"
claims{ __typename?: "Claim" ; contract: string ; creator?: any | null ; id: string ; owner?: any | null ; tokenID: any ; totalUnits?: any | null ; uri?: string | null }[]

Defined in

sdk/src/indexer/gql/graphql.ts:1150


StorageConfigOverrides

Ƭ StorageConfigOverrides: Object

Configuration options for the Hypercert storage layer.

Param

The timeout (im ms) for the HTTP request; for example for uploading metadata or fetching allowlists.

Type declaration

NameType
timeout?number

Defined in

sdk/src/types/client.ts:35


SupportedChainIds

Ƭ SupportedChainIds: 10 | 42220 | 11155111 | 84532 | 8453

Enum to verify the supported chainIds

Note

10 = Optimism, 42220 = Celo, 11155111 = Sepolia, 84532 = Base Sepolia, 8453 = Base Mainnet

Defined in

sdk/src/types/client.ts:14


SupportedOverrides

Ƭ SupportedOverrides: ContractOverrides & StorageConfigOverrides

Defined in

sdk/src/types/client.ts:16


TransferRestrictions

Ƭ TransferRestrictions: typeof TransferRestrictions[keyof typeof TransferRestrictions]

Defined in

sdk/src/types/hypercerts.ts:9

sdk/src/types/hypercerts.ts:15

Variables

CreatorFeeManagerWithRoyaltiesAbi

CreatorFeeManagerWithRoyaltiesAbi: ({ inputs: { internalType: string = "address"; name: string = "_royaltyFeeRegistry"; type: string = "address" }[] ; name?: undefined = "balanceOf"; outputs?: undefined ; stateMutability: string = "nonpayable"; type: string = "constructor" } | { inputs: { internalType: string = "address"; name: string = "collection"; type: string = "address" }[] ; name: string = "BundleEIP2981NotAllowed"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "error" } | { inputs: { internalType: string = "address"; name: string = "collection"; type: string = "address" }[] ; name: string = "viewCreatorFeeInfo"; outputs: { internalType: string = "address"; name: string = "creator"; type: string = "address" }[] ; stateMutability: string = "view"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:5790


ExecutionManagerAbi

ExecutionManagerAbi: ({ anonymous?: undefined = false; inputs: { internalType: string = "address"; name: string = "_owner"; type: string = "address" }[] ; name?: undefined = "balanceOf"; outputs?: undefined ; stateMutability: string = "nonpayable"; type: string = "constructor" } | { anonymous?: undefined = false; inputs: { internalType: string = "uint256"; name: string = "strategyId"; type: string = "uint256" }[] ; name: string = "StrategyNotAvailable"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "error" } | { anonymous: boolean = false; inputs: { indexed: boolean = false; internalType: string = "address"; name: string = "currency"; type: string = "address" }[] ; name: string = "CurrencyStatusUpdated"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "event" } | { anonymous?: undefined = false; inputs: { internalType: string = "address"; name: string = ""; type: string = "address" }[] ; name: string = "isCurrencyAllowed"; outputs: { internalType: string = "bool"; name: string = ""; type: string = "bool" }[] ; stateMutability: string = "view"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:6914


HypercertExchangeAbi

HypercertExchangeAbi: ({ anonymous?: undefined = false; inputs: { internalType: string = "address"; name: string = "_owner"; type: string = "address" }[] ; name?: undefined = "balanceOf"; outputs?: undefined ; stateMutability: string = "nonpayable"; type: string = "constructor" } | { anonymous?: undefined = false; inputs: { internalType: string = "uint256"; name: string = "length"; type: string = "uint256" }[] ; name: string = "MerkleProofTooLarge"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "error" } | { anonymous: boolean = false; inputs: ({ components: { internalType: string = "bytes32"; name: string = "orderHash"; type: string = "bytes32" }[] ; indexed: boolean = false; internalType: string = "struct ILooksRareProtocol.NonceInvalidationParameters"; name: string = "nonceInvalidationParameters"; type: string = "tuple" } | { components?: undefined ; indexed: boolean = false; internalType: string = "address"; name: string = "askUser"; type: string = "address" })[] ; name: string = "TakerAsk"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "event" } | { anonymous?: undefined = false; inputs: ({ components?: undefined ; internalType: string = "bytes[]"; name: string = "makerSignatures"; type: string = "bytes[]" } | { components: ({ components?: undefined ; internalType: string = "bytes32"; name: string = "root"; type: string = "bytes32" } | { components: { internalType: string = "bytes32"; name: string = "value"; type: string = "bytes32" }[] ; internalType: string = "struct OrderStructs.MerkleTreeNode[]"; name: string = "proof"; type: string = "tuple[]" })[] ; internalType: string = "struct OrderStructs.MerkleTree[]"; name: string = "merkleTrees"; type: string = "tuple[]" })[] ; name: string = "executeMultipleTakerBids"; outputs: never[] = []; stateMutability: string = "payable"; type: string = "function" } | { anonymous?: undefined = false; inputs: ({ components: { internalType: string = "address"; name: string = "recipient"; type: string = "address" }[] ; internalType: string = "struct OrderStructs.Taker"; name: string = "takerBid"; type: string = "tuple" } | { components?: undefined ; internalType: string = "address"; name: string = "sender"; type: string = "address" })[] ; name: string = "restrictedExecuteTakerBid"; outputs: { internalType: string = "uint256"; name: string = "protocolFeeAmount"; type: string = "uint256" }[] ; stateMutability: string = "nonpayable"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:1234


HypercertMinterAbi

HypercertMinterAbi: ({ anonymous?: undefined = false; inputs: never[] = []; name?: undefined = "balanceOf"; outputs?: undefined ; stateMutability: string = "nonpayable"; type: string = "constructor" } | { anonymous?: undefined = false; inputs: never[] = []; name: string = "AlreadyClaimed"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "error" } | { anonymous: boolean = false; inputs: { indexed: boolean = false; internalType: string = "address"; name: string = "previousAdmin"; type: string = "address" }[] ; name: string = "AdminChanged"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "event" } | { anonymous?: undefined = false; inputs: { internalType: string = "address"; name: string = "account"; type: string = "address" }[] ; name: string = "balanceOf"; outputs: { internalType: string = "uint256"; name: string = ""; type: string = "uint256" }[] ; stateMutability: string = "view"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:43


OrderValidatorV2AAbi

OrderValidatorV2AAbi: ({ inputs: { internalType: string = "address"; name: string = "_looksRareProtocol"; type: string = "address" }[] ; name?: undefined = "balanceOf"; outputs?: undefined ; stateMutability: string = "nonpayable"; type: string = "constructor" } | { inputs: ({ components?: undefined ; internalType: string = "bytes"; name: string = "signature"; type: string = "bytes" } | { components: ({ components?: undefined ; internalType: string = "bytes32"; name: string = "root"; type: string = "bytes32" } | { components: { internalType: string = "bytes32"; name: string = "value"; type: string = "bytes32" }[] ; internalType: string = "struct OrderStructs.MerkleTreeNode[]"; name: string = "proof"; type: string = "tuple[]" })[] ; internalType: string = "struct OrderStructs.MerkleTree"; name: string = "merkleTree"; type: string = "tuple" })[] ; name: string = "checkMakerOrderValidity"; outputs: { internalType: string = "uint256[9]"; name: string = "validationCodes"; type: string = "uint256[9]" }[] ; stateMutability: string = "view"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:3079


StrategyCollectionOfferAbi

StrategyCollectionOfferAbi: ({ inputs: never[] = []; name: string = "CollectionTypeInvalid"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "error" } | { inputs: ({ components: { internalType: string = "enum QuoteType"; name: string = "quoteType"; type: string = "uint8" }[] ; internalType: string = "struct OrderStructs.Maker"; name: string = "makerBid"; type: string = "tuple" } | { components?: undefined ; internalType: string = "bytes4"; name: string = "functionSelector"; type: string = "bytes4" })[] ; name: string = "isMakerOrderValid"; outputs: { internalType: string = "bool"; name: string = "isValid"; type: string = "bool" }[] ; stateMutability: string = "pure"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:4593


StrategyDutchAuctionAbi

StrategyDutchAuctionAbi: ({ inputs: never[] = []; name: string = "BidTooLow"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "error" } | { inputs: ({ components: { internalType: string = "enum QuoteType"; name: string = "quoteType"; type: string = "uint8" }[] ; internalType: string = "struct OrderStructs.Maker"; name: string = "makerAsk"; type: string = "tuple" } | { components?: undefined ; internalType: string = "bytes4"; name: string = "functionSelector"; type: string = "bytes4" })[] ; name: string = "isMakerOrderValid"; outputs: { internalType: string = "bool"; name: string = "isValid"; type: string = "bool" }[] ; stateMutability: string = "pure"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:5118


StrategyHypercertCollectionOfferAbi

StrategyHypercertCollectionOfferAbi: ({ inputs: never[] = []; name: string = "CollectionTypeInvalid"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "error" } | { inputs: ({ components: { internalType: string = "enum QuoteType"; name: string = "quoteType"; type: string = "uint8" }[] ; internalType: string = "struct OrderStructs.Maker"; name: string = "makerBid"; type: string = "tuple" } | { components?: undefined ; internalType: string = "bytes4"; name: string = "functionSelector"; type: string = "bytes4" })[] ; name: string = "isMakerOrderValid"; outputs: { internalType: string = "bool"; name: string = "isValid"; type: string = "bool" }[] ; stateMutability: string = "pure"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:5863


StrategyHypercertDutchAuctionAbi

StrategyHypercertDutchAuctionAbi: ({ inputs: never[] = []; name: string = "BidTooLow"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "error" } | { inputs: ({ components: { internalType: string = "enum QuoteType"; name: string = "quoteType"; type: string = "uint8" }[] ; internalType: string = "struct OrderStructs.Maker"; name: string = "makerAsk"; type: string = "tuple" } | { components?: undefined ; internalType: string = "bytes4"; name: string = "functionSelector"; type: string = "bytes4" })[] ; name: string = "isMakerOrderValid"; outputs: { internalType: string = "bool"; name: string = "isValid"; type: string = "bool" }[] ; stateMutability: string = "view"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:6388


StrategyHypercertFractionOfferAbi

StrategyHypercertFractionOfferAbi: ({ inputs: never[] = []; name: string = "AmountInvalid"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "error" } | { inputs: ({ components: { internalType: string = "enum QuoteType"; name: string = "quoteType"; type: string = "uint8" }[] ; internalType: string = "struct OrderStructs.Maker"; name: string = "makerAsk"; type: string = "tuple" } | { components?: undefined ; internalType: string = "bytes4"; name: string = "functionSelector"; type: string = "bytes4" })[] ; name: string = "isMakerOrderValid"; outputs: { internalType: string = "bool"; name: string = "isValid"; type: string = "bool" }[] ; stateMutability: string = "view"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:5387


StrategyItemIdsRangeAbi

StrategyItemIdsRangeAbi: ({ inputs: never[] = []; name: string = "OrderInvalid"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "error" } | { inputs: ({ components: { internalType: string = "enum QuoteType"; name: string = "quoteType"; type: string = "uint8" }[] ; internalType: string = "struct OrderStructs.Maker"; name: string = "makerBid"; type: string = "tuple" } | { components?: undefined ; internalType: string = "bytes4"; name: string = "functionSelector"; type: string = "bytes4" })[] ; name: string = "isMakerOrderValid"; outputs: { internalType: string = "bool"; name: string = "isValid"; type: string = "bool" }[] ; stateMutability: string = "pure"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:6657


StrategyManagerAbi

StrategyManagerAbi: ({ anonymous?: undefined = false; inputs: { internalType: string = "address"; name: string = "_owner"; type: string = "address" }[] ; name?: undefined = "balanceOf"; outputs?: undefined ; stateMutability: string = "nonpayable"; type: string = "constructor" } | { anonymous?: undefined = false; inputs: never[] = []; name: string = "NoOngoingTransferInProgress"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "error" } | { anonymous: boolean = false; inputs: { indexed: boolean = false; internalType: string = "address"; name: string = "currency"; type: string = "address" }[] ; name: string = "CurrencyStatusUpdated"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "event" } | { anonymous?: undefined = false; inputs: { internalType: string = "address"; name: string = ""; type: string = "address" }[] ; name: string = "isCurrencyAllowed"; outputs: { internalType: string = "bool"; name: string = ""; type: string = "bool" }[] ; stateMutability: string = "view"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:3516


TransferManagerAbi

TransferManagerAbi: ({ anonymous?: undefined = false; inputs: { internalType: string = "address"; name: string = "_owner"; type: string = "address" }[] ; name?: undefined = "balanceOf"; outputs?: undefined ; stateMutability: string = "nonpayable"; type: string = "constructor" } | { anonymous?: undefined = false; inputs: never[] = []; name: string = "AmountInvalid"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "error" } | { anonymous: boolean = false; inputs: { indexed: boolean = false; internalType: string = "address"; name: string = "user"; type: string = "address" }[] ; name: string = "ApprovalsGranted"; outputs?: undefined ; stateMutability?: undefined = "view"; type: string = "event" } | { anonymous?: undefined = false; inputs: { internalType: string = "address"; name: string = ""; type: string = "address" }[] ; name: string = "hasUserApprovedOperator"; outputs: { internalType: string = "bool"; name: string = ""; type: string = "bool" }[] ; stateMutability: string = "view"; type: string = "function" } | { anonymous?: undefined = false; inputs: ({ components: { internalType: string = "address"; name: string = "collection"; type: string = "address" }[] ; internalType: string = "struct ITransferManager.BatchTransferItem[]"; name: string = "items"; type: string = "tuple[]" } | { components?: undefined ; internalType: string = "address"; name: string = "from"; type: string = "address" })[] ; name: string = "transferBatchItemsAcrossCollections"; outputs: never[] = []; stateMutability: string = "nonpayable"; type: string = "function" })[]

Defined in

node_modules/.pnpm/@hypercerts-org+contracts@1.1.2_ts-node@10.9.1_typescript@5.3.2/node_modules/@hypercerts-org/contracts/dist/index.d.ts:3982


TransferRestrictions

Const TransferRestrictions: Object

Represents the possible transfer restrictions of a claim matching the hypercerts protocol.

Type declaration

NameType
AllowAll0
DisallowAll1
FromCreatorOnly2

Defined in

sdk/src/types/hypercerts.ts:9

sdk/src/types/hypercerts.ts:15


apis

Const apis: Object

Index signature

▪ [key: string]: string

Defined in

sdk/src/constants.ts:12


deployments

Const deployments: { [key in SupportedChainIds]: Partial<Deployment> }

Defined in

sdk/src/constants.ts:18


logger

Const logger: Object

Type declaration

NameType
debug(message: string, label?: string, ...data: unknown[]) => void
error(error: Error, label?: string) => void
info(message: string, label?: string, ...data: unknown[]) => void
warn(message: string, label?: string, ...data: unknown[]) => void

Defined in

sdk/src/utils/logger.ts:24

Functions

formatHypercertData

formatHypercertData(«destructured»): FormatResult

Formats input data to an object containing HypercertMetadata including appropriate labels

Parameters

NameType
«destructured»Object
› contributorsstring[]
› descriptionstring
› excludedImpactScopestring[]
› excludedRightsstring[]
› excludedWorkScopestring[]
› external_url?string
› imagestring
› impactScopestring[]
› impactTimeframeEndnumber
› impactTimeframeStartnumber
› namestring
› properties?{ trait_type: string ; value: string }[]
› rightsstring[]
› versionstring
› workScopestring[]
› workTimeframeEndnumber
› workTimeframeStartnumber

Returns

FormatResult

Defined in

sdk/src/utils/formatter.ts:27


getClaimStoredDataFromTxHash

getClaimStoredDataFromTxHash(client, hash): Promise<ParserReturnType>

Utility method to parse a hypercert mint transaction (createAllowlist, mintClaim) and get the ID of the minted claim

Parameters

NameTypeDescription
clientObjectpublic client provided by viem
client.accountundefinedThe Account of the Client.
client.batch?ObjectFlags for batch settings.
client.batch.multicall?boolean | { batchSize?: number | undefined; wait?: number | undefined; }Toggle to enable eth_call multicall aggregation.
client.cacheTimenumberTime (in ms) that cached data will remain in memory.
client.call(parameters: CallParameters<undefined | Chain>) => Promise<CallReturnType>Executes a new message call immediately without submitting a transaction to the network. - Docs: https://viem.sh/docs/actions/public/call - JSON-RPC Methods: eth_call Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const data = await client.call({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', })
client.ccipRead?false | { request?: (parameters: CcipRequestParameters) => Promise<`0x${string}`> }CCIP Read configuration.
client.chainundefined | ChainChain for the client.
client.createBlockFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "block" }>Creates a Filter to listen for new block hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createBlockFilter - JSON-RPC Methods: eth_newBlockFilter Example ts import { createPublicClient, createBlockFilter, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await createBlockFilter(client) // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }
client.createContractEventFilter<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>(args: CreateContractEventFilterParameters<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>>Creates a Filter to retrieve event logs that can be used with getFilterChanges or getFilterLogs. - Docs: https://viem.sh/docs/contract/createContractEventFilter Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), })
client.createEventFilter<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>(args?: CreateEventFilterParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>) => Promise<{ [K in keyof Filter<"event", TAbiEvents, _EventName, _Args, TStrict, TFromBlock, TToBlock>]: Filter<"event", TAbiEvents, ... 4 more ..., TToBlock>[K]; }>Creates a Filter to listen for new events that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createEventFilter - JSON-RPC Methods: eth_newFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2', })
client.createPendingTransactionFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "transaction" }>Creates a Filter to listen for new pending transaction hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter - JSON-RPC Methods: eth_newPendingTransactionFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }
client.estimateContractGas<TChain, abi, functionName, args>(args: EstimateContractGasParameters<abi, functionName, args, TChain>) => Promise<bigint>Estimates the gas required to successfully execute a contract write function call. - Docs: https://viem.sh/docs/contract/estimateContractGas Remarks Internally, uses a Public Client to call the estimateGas action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gas = await client.estimateContractGas({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint() public']), functionName: 'mint', account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', })
client.estimateFeesPerGas<TChainOverride, TType>(args?: EstimateFeesPerGasParameters<undefined | Chain, TChainOverride, TType>) => Promise<EstimateFeesPerGasReturnType>Returns an estimate for the fees per gas for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateFeesPerGas() // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }
client.estimateGas(args: EstimateGasParameters<undefined | Chain>) => Promise<bigint>Estimates the gas necessary to complete a transaction without submitting it to the network. - Docs: https://viem.sh/docs/actions/public/estimateGas - JSON-RPC Methods: eth_estimateGas Example ts import { createPublicClient, http, parseEther } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasEstimate = await client.estimateGas({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })
client.estimateMaxPriorityFeePerGas<TChainOverride>(args?: { chain: null | TChainOverride }) => Promise<bigint>Returns an estimate for the max priority fee per gas (in wei) for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas() // 10000000n
client.extend<client>(fn: (client: Client<Transport, undefined | Chain, undefined, PublicRpcSchema, PublicActions<Transport, undefined | Chain>>) => client) => Client<Transport, undefined | Chain, undefined, PublicRpcSchema, { [K in keyof client]: client[K]; } & PublicActions<Transport, undefined | Chain>>-
client.getBalance(args: GetBalanceParameters) => Promise<bigint>Returns the balance of an address in wei. - Docs: https://viem.sh/docs/actions/public/getBalance - JSON-RPC Methods: eth_getBalance Remarks You can convert the balance to ether units with formatEther. ts const balance = await getBalance(client, { address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', blockTag: 'safe' }) const balanceAsEther = formatEther(balance) // "6.942" Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const balance = await client.getBalance({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', }) // 10000000000000000000000n (wei)
client.getBlobBaseFee() => Promise<bigint>Returns the base fee per blob gas in wei. - Docs: https://viem.sh/docs/actions/public/getBlobBaseFee - JSON-RPC Methods: eth_blobBaseFee Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getBlobBaseFee } from 'viem/public' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blobBaseFee = await client.getBlobBaseFee()
client.getBlock<TIncludeTransactions, TBlockTag>(args?: GetBlockParameters<TIncludeTransactions, TBlockTag>) => Promise<{ number: TBlockTag extends "pending" ? null : bigint; nonce: TBlockTag extends "pending" ? null : `0x${string}`; hash: TBlockTag extends "pending" ? null : `0x${string}`; ... 22 more ...; transactions: TIncludeTransactions extends true ? ({ ...; } | ... 2 more ... | { ...; })[] : `0x${string}`[]; }>Returns information about a block at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlock - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: - Calls eth_getBlockByNumber for blockNumber & blockTag. - Calls eth_getBlockByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getBlock()
client.getBlockNumber(args?: GetBlockNumberParameters) => Promise<bigint>Returns the number of the most recent block seen. - Docs: https://viem.sh/docs/actions/public/getBlockNumber - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: eth_blockNumber Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blockNumber = await client.getBlockNumber() // 69420n
client.getBlockTransactionCount(args?: GetBlockTransactionCountParameters) => Promise<number>Returns the number of Transactions at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount - JSON-RPC Methods: - Calls eth_getBlockTransactionCountByNumber for blockNumber & blockTag. - Calls eth_getBlockTransactionCountByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const count = await client.getBlockTransactionCount()
client.getBytecode(args: GetBytecodeParameters) => Promise<GetBytecodeReturnType>Retrieves the bytecode at an address. - Docs: https://viem.sh/docs/contract/getBytecode - JSON-RPC Methods: eth_getCode Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', })
client.getChainId() => Promise<number>Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId - JSON-RPC Methods: eth_chainId Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const chainId = await client.getChainId() // 1
client.getContractEvents<abi, eventName, strict, fromBlock, toBlock>(args: GetContractEventsParameters<abi, eventName, strict, fromBlock, toBlock>) => Promise<GetContractEventsReturnType<abi, eventName, strict, fromBlock, toBlock>>Returns a list of event logs emitted by a contract. - Docs: https://viem.sh/docs/actions/public/getContractEvents - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { wagmiAbi } from './abi' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getContractEvents(client, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: wagmiAbi, eventName: 'Transfer' })
client.getEnsAddress(args: { blockNumber?: bigint | undefined; blockTag?: BlockTag | undefined; coinType?: number | undefined; gatewayUrls?: string[] | undefined; name: string; strict?: boolean | undefined; universalResolverAddress?: `0x${string}` | undefined; }) => Promise<GetEnsAddressReturnType>Gets address for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAddress - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAddress = await client.getEnsAddress({ name: normalize('wevm.eth'), }) // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
client.getEnsAvatar(args: { name: string; blockNumber?: bigint | undefined; blockTag?: BlockTag | undefined; gatewayUrls?: string[] | undefined; strict?: boolean | undefined; universalResolverAddress?: `0x${string}` | undefined; assetGatewayUrls?: AssetGatewayUrls | undefined; }) => Promise<GetEnsAvatarReturnType>Gets the avatar of an ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens Remarks Calls getEnsText with key set to 'avatar'. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAvatar = await client.getEnsAvatar({ name: normalize('wevm.eth'), }) // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
client.getEnsName(args: { blockNumber?: bigint | undefined; blockTag?: BlockTag | undefined; address: `0x${string}`; gatewayUrls?: string[] | undefined; strict?: boolean | undefined; universalResolverAddress?: `0x${string}` | undefined; }) => Promise<GetEnsNameReturnType>Gets primary name for specified address. - Docs: https://viem.sh/docs/ens/actions/getEnsName - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens Remarks Calls reverse(bytes) on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensName = await client.getEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', }) // 'wevm.eth'
client.getEnsResolver(args: { blockNumber?: bigint | undefined; blockTag?: BlockTag | undefined; name: string; universalResolverAddress?: `0x${string}` | undefined; }) => Promise<`0x${string}`>Gets resolver for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens Remarks Calls findResolver(bytes) on ENS Universal Resolver Contract to retrieve the resolver of an ENS name. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const resolverAddress = await client.getEnsResolver({ name: normalize('wevm.eth'), }) // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
client.getEnsText(args: { blockNumber?: bigint | undefined; blockTag?: BlockTag | undefined; name: string; gatewayUrls?: string[] | undefined; key: string; strict?: boolean | undefined; universalResolverAddress?: `0x${string}` | undefined; }) => Promise<GetEnsTextReturnType>Gets a text record for specified ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const twitterRecord = await client.getEnsText({ name: normalize('wevm.eth'), key: 'com.twitter', }) // 'wagmi_sh'
client.getFeeHistory(args: GetFeeHistoryParameters) => Promise<GetFeeHistoryReturnType>Returns a collection of historical gas information. - Docs: https://viem.sh/docs/actions/public/getFeeHistory - JSON-RPC Methods: eth_feeHistory Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const feeHistory = await client.getFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75], })
client.getFilterChanges<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterChangesParameters<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterChangesReturnType<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of logs or hashes based on a Filter since the last time it was called. - Docs: https://viem.sh/docs/actions/public/getFilterChanges - JSON-RPC Methods: eth_getFilterChanges Remarks A Filter can be created from the following actions: - createBlockFilter - createContractEventFilter - createEventFilter - createPendingTransactionFilter Depending on the type of filter, the return value will be different: - If the filter was created with createContractEventFilter or createEventFilter, it returns a list of logs. - If the filter was created with createPendingTransactionFilter, it returns a list of transaction hashes. - If the filter was created with createBlockFilter, it returns a list of block hashes. Example ts // Blocks import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createBlockFilter() const hashes = await client.getFilterChanges({ filter }) Example ts // Contract Events import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), eventName: 'Transfer', }) const logs = await client.getFilterChanges({ filter }) Example ts // Raw Events import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterChanges({ filter }) Example ts // Transactions import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() const hashes = await client.getFilterChanges({ filter })
client.getFilterLogs<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterLogsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterLogsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs since the filter was created. - Docs: https://viem.sh/docs/actions/public/getFilterLogs - JSON-RPC Methods: eth_getFilterLogs Remarks getFilterLogs is only compatible with event filters. Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterLogs({ filter })
client.getGasPrice() => Promise<bigint>Returns the current price of gas (in wei). - Docs: https://viem.sh/docs/actions/public/getGasPrice - JSON-RPC Methods: eth_gasPrice Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice()
client.getLogs<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>(args?: GetLogsParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>) => Promise<GetLogsReturnType<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>>Returns a list of event logs matching the provided parameters. - Docs: https://viem.sh/docs/actions/public/getLogs - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/filters-and-logs/event-logs - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getLogs()
client.getProof(args: GetProofParameters) => Promise<GetProofReturnType>Returns the account and storage values of the specified account including the Merkle-proof. - Docs: https://viem.sh/docs/actions/public/getProof - JSON-RPC Methods: - Calls eth_getProof Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getProof({ address: '0x...', storageKeys: ['0x...'], })
client.getStorageAt(args: GetStorageAtParameters) => Promise<GetStorageAtReturnType>Returns the value from a storage slot at a given address. - Docs: https://viem.sh/docs/contract/getStorageAt - JSON-RPC Methods: eth_getStorageAt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getStorageAt } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: toHex(0), })
client.getTransaction<TBlockTag>(args: GetTransactionParameters<TBlockTag>) => Promise<{ type: "legacy"; to: `0x${string}` | null; from: `0x${string}`; gas: bigint; nonce: number; value: bigint; gasPrice: bigint; maxFeePerBlobGas?: undefined; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; ... 12 more ...; transactionIndex: (TBlockTag extends "pending" ? true : false) extends true ? null :... | { type: "eip2930"; to: `0x${string}` | null; from: `0x${string}`; gas: bigint; nonce: number; value: bigint; gasPrice: bigint; maxFeePerBlobGas?: undefined; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; ... 12 more ...; transactionIndex: (TBlockTag extends "pending" ? true : false) extends true ? null ... | { type: "eip1559"; to: `0x${string}` | null; from: `0x${string}`; gas: bigint; nonce: number; value: bigint; gasPrice?: undefined; maxFeePerBlobGas?: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; ... 12 more ...; transactionIndex: (TBlockTag extends "pending" ? true : false) extends true ? null : nu... | { type: "eip4844"; to: `0x${string}` | null; from: `0x${string}`; gas: bigint; nonce: number; value: bigint; gasPrice?: undefined; maxFeePerBlobGas: bigint; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; ... 12 more ...; transactionIndex: (TBlockTag extends "pending" ? true : false) extends true ? null : number...>Returns information about a Transaction given a hash or block identifier. - Docs: https://viem.sh/docs/actions/public/getTransaction - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionByHash Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transaction = await client.getTransaction({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionConfirmations(args: GetTransactionConfirmationsParameters<undefined | Chain>) => Promise<bigint>Returns the number of blocks passed (confirmations) since the transaction was processed on a block. - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionConfirmations Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const confirmations = await client.getTransactionConfirmations({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.getTransactionCount(args: GetTransactionCountParameters) => Promise<number>Returns the number of Transactions an Account has broadcast / sent. - Docs: https://viem.sh/docs/actions/public/getTransactionCount - JSON-RPC Methods: eth_getTransactionCount Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionCount = await client.getTransactionCount({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.getTransactionReceipt(args: GetTransactionReceiptParameters) => Promise<TransactionReceipt>Returns the Transaction Receipt given a Transaction hash. - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionReceipt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.getTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.keystringA key for the client.
client.multicall<contracts, allowFailure>(args: MulticallParameters<contracts, allowFailure>) => Promise<MulticallReturnType<contracts, allowFailure>>Similar to readContract, but batches up multiple functions on a contract in a single RPC call via the multicall3 contract. - Docs: https://viem.sh/docs/contract/multicall Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const abi = parseAbi([ 'function balanceOf(address) view returns (uint256)', 'function totalSupply() view returns (uint256)', ]) const result = await client.multicall({ contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'totalSupply', }, ], }) // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]
client.namestringA name for the client.
client.pollingIntervalnumberFrequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
client.prepareTransactionRequest<TRequest, TChainOverride, TAccountOverride>(args: PrepareTransactionRequestParameters<undefined | Chain, undefined | Account, TChainOverride, TAccountOverride, TRequest>) => Promise<{ [K in keyof (UnionRequiredBy<Extract<UnionOmit<ExtractChainFormatterParameters<DeriveChain<Chain, TChainOverride>, "transactionRequest", TransactionRequest>, "from"> & (DeriveChain<...> extends Chain ? { ...; } : { ...; }) & (DeriveAccount<...> extends Account ? { ...; } : { ...; }), IsNever<...> extends true ? un...>Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })
client.readContract<abi, functionName, args>(args: ReadContractParameters<abi, functionName, args>) => Promise<ReadContractReturnType<abi, functionName, args>>Calls a read-only function on a contract, and returns the response. - Docs: https://viem.sh/docs/contract/readContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/reading-contracts Remarks A "read-only" function (constant function) on a Solidity contract is denoted by a view or pure keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' import { readContract } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.readContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function balanceOf(address) view returns (uint256)']), functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) // 424122n
client.requestEIP1193RequestFn<PublicRpcSchema>Request function wrapped with friendly error handling
client.sendRawTransaction(args: SendRawTransactionParameters) => Promise<`0x${string}`>Sends a signed transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction - JSON-RPC Method: eth_sendRawTransaction Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })
client.simulateContract<abi, functionName, args, chainOverride, accountOverride>(args: SimulateContractParameters<abi, functionName, args, undefined | Chain, chainOverride, accountOverride>) => Promise<SimulateContractReturnType<abi, functionName, args, undefined | Chain, undefined | Account, chainOverride, accountOverride>>Simulates/validates a contract interaction. This is useful for retrieving return data and revert reasons of contract write functions. - Docs: https://viem.sh/docs/contract/simulateContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts Remarks This function does not require gas to execute and does not change the state of the blockchain. It is almost identical to readContract, but also supports contract write functions. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32) view returns (uint32)']), functionName: 'mint', args: ['69420'], account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
client.transportTransportConfig<string, EIP1193RequestFn> & Record<string, any>The RPC transport
client.typestringThe type of client.
client.uidstringA unique ID for the client.
client.uninstallFilter(args: UninstallFilterParameters) => Promise<boolean>Destroys a Filter that was created from one of the following Actions: - createBlockFilter - createEventFilter - createPendingTransactionFilter - Docs: https://viem.sh/docs/actions/public/uninstallFilter - JSON-RPC Methods: eth_uninstallFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { createPendingTransactionFilter, uninstallFilter } from 'viem/public' const filter = await client.createPendingTransactionFilter() const uninstalled = await client.uninstallFilter({ filter }) // true
client.verifyMessage(args: VerifyMessageParameters) => Promise<boolean>-
client.verifyTypedData(args: VerifyTypedDataParameters) => Promise<boolean>-
client.waitForTransactionReceipt(args: WaitForTransactionReceiptParameters<undefined | Chain>) => Promise<TransactionReceipt>Waits for the Transaction to be included on a Block (one confirmation), and then returns the Transaction Receipt. If the Transaction reverts, then the action will throw an error. - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions - JSON-RPC Methods: - Polls eth_getTransactionReceipt on each block until it has been processed. - If a Transaction has been replaced: - Calls eth_getBlockByNumber and extracts the transactions - Checks if one of the Transactions is a replacement - If so, calls eth_getTransactionReceipt. Remarks The waitForTransactionReceipt action additionally supports Replacement detection (e.g. sped up Transactions). Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce. There are 3 types of Transaction Replacement reasons: - repriced: The gas price has been modified (e.g. different maxFeePerGas) - cancelled: The Transaction has been cancelled (e.g. value === 0n) - replaced: The Transaction has been replaced (e.g. different value or data) Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.waitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
client.watchBlockNumber(args: WatchBlockNumberParameters) => WatchBlockNumberReturnTypeWatches and returns incoming block numbers. - Docs: https://viem.sh/docs/actions/public/watchBlockNumber - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_blockNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlockNumber({ onBlockNumber: (blockNumber) => console.log(blockNumber), })
client.watchBlocks<TIncludeTransactions, TBlockTag>(args: WatchBlocksParameters<Transport, undefined | Chain, TIncludeTransactions, TBlockTag>) => WatchBlocksReturnTypeWatches and returns information for incoming blocks. - Docs: https://viem.sh/docs/actions/public/watchBlocks - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_getBlockByNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlocks({ onBlock: (block) => console.log(block), })
client.watchContractEvent<TAbi, TEventName, TStrict>(args: WatchContractEventParameters<TAbi, TEventName, TStrict, Transport>) => WatchContractEventReturnTypeWatches and returns emitted contract event logs. - Docs: https://viem.sh/docs/contract/watchContractEvent Remarks This Action will batch up all the event logs found within the pollingInterval, and invoke them via onLogs. watchContractEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchContractEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchContractEvent({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']), eventName: 'Transfer', args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' }, onLogs: (logs) => console.log(logs), })
client.watchEvent<TAbiEvent, TAbiEvents, TStrict>(args: WatchEventParameters<TAbiEvent, TAbiEvents, TStrict, Transport>) => WatchEventReturnTypeWatches and returns emitted Event Logs. - Docs: https://viem.sh/docs/actions/public/watchEvent - JSON-RPC Methods: - RPC Provider supports eth_newFilter: - Calls eth_newFilter to create a filter (called on initialize). - On a polling interval, it will call eth_getFilterChanges. - RPC Provider does not support eth_newFilter: - Calls eth_getLogs for each block between the polling interval. Remarks This Action will batch up all the Event Logs found within the pollingInterval, and invoke them via onLogs. watchEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchEvent({ onLogs: (logs) => console.log(logs), })
client.watchPendingTransactions(args: WatchPendingTransactionsParameters<Transport>) => WatchPendingTransactionsReturnTypeWatches and returns pending transaction hashes. - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions - JSON-RPC Methods: - When poll: true - Calls eth_newPendingTransactionFilter to initialize the filter. - Calls eth_getFilterChanges on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newPendingTransactions" event. Remarks This Action will batch up all the pending transactions found within the pollingInterval, and invoke them via onTransactions. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchPendingTransactions({ onTransactions: (hashes) => console.log(hashes), })
hash`0x${string}`transaction hash returned from the transaction

Returns

Promise<ParserReturnType>

returns a promise with the parsed data or errors

Notice

This method is a wrapper around basic viem utilties to parse ClaimStored(uint256 indexed claimID, string uri, uint256 totalUnits).

Defined in

sdk/src/utils/txParser.ts:26


getFromIPFS

getFromIPFS(cidOrIpfsUri, timeout?): Promise<unknown>

Fetches data from IPFS using either the DWeb IPFS, NFT Storage, or the Web3Up gateway.

This function attempts to fetch data from all gateways at the same time and returns on the first on to resolve. If the data cannot be fetched from any gateway, it throws a StorageError.

Parameters

NameTypeDefault valueDescription
cidOrIpfsUristringundefinedThe CID or IPFS URI of the data to fetch.
timeoutnumber10000-

Returns

Promise<unknown>

The data fetched from IPFS.

Throws

Will throw a StoragjeError if the data cannot be fetched from either gateway.

Async

Defined in

sdk/src/utils/fetchers.ts:17


getProofsFromAllowlist

getProofsFromAllowlist(cidOrIpfsUri, account): Promise<undefined | { proof: string[] ; root: string = tree.root }>

This function retrieves proofs from an allowlist.

It fetches a Merkle tree from IPFS using a given CID or IPFS URI, then iterates over the tree to find an account. When the account is found, it generates a proof for that account and logs the account, index, and proof as debug. It returns the proof and the root of the Merkle tree.

Parameters

NameTypeDescription
cidOrIpfsUristringThe CID or IPFS URI to fetch the Merkle tree from.
account`0x${string}`The account to find in the Merkle tree.

Returns

Promise<undefined | { proof: string[] ; root: string = tree.root }>

An object containing the proof for the account and the root of the Merkle tree.

Throws

Will throw an error if the Merkle tree cannot be fetched.

Async

Defined in

sdk/src/utils/allowlist.ts:43


graphql

graphql(source): unknown

The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.

Parameters

NameType
sourcestring

Returns

unknown

Example

const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);

The query argument is unknown! Please regenerate the types.

Defined in

sdk/src/indexer/gql/gql.ts:34

graphql(source): typeof documents["query ClaimsByOwner($owner: Bytes = \"\", $orderDirection: OrderDirection, $first: Int, $skip: Int) {\n claims(\n where: {owner: $owner}\n skip: $skip\n first: $first\n orderDirection: $orderDirection\n ) {\n contract\n tokenID\n creator\n id\n owner\n totalUnits\n uri\n }\n}\n\nquery RecentClaims($orderDirection: OrderDirection, $first: Int, $skip: Int) {\n claims(orderDirection: $orderDirection, orderBy: creation, first: $first) {\n contract\n tokenID\n creator\n id\n owner\n totalUnits\n uri\n }\n}\n\nquery ClaimById($id: ID!) {\n claim(id: $id) {\n contract\n tokenID\n creator\n id\n owner\n totalUnits\n uri\n }\n}"]

The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.

Parameters

NameType
source"query ClaimsByOwner($owner: Bytes = \"\", $orderDirection: OrderDirection, $first: Int, $skip: Int) {\n claims(\n where: {owner: $owner}\n skip: $skip\n first: $first\n orderDirection: $orderDirection\n ) {\n contract\n tokenID\n creator\n id\n owner\n totalUnits\n uri\n }\n}\n\nquery RecentClaims($orderDirection: OrderDirection, $first: Int, $skip: Int) {\n claims(orderDirection: $orderDirection, orderBy: creation, first: $first) {\n contract\n tokenID\n creator\n id\n owner\n totalUnits\n uri\n }\n}\n\nquery ClaimById($id: ID!) {\n claim(id: $id) {\n contract\n tokenID\n creator\n id\n owner\n totalUnits\n uri\n }\n}"

Returns

typeof documents["query ClaimsByOwner($owner: Bytes = \"\", $orderDirection: OrderDirection, $first: Int, $skip: Int) {\n claims(\n where: {owner: $owner}\n skip: $skip\n first: $first\n orderDirection: $orderDirection\n ) {\n contract\n tokenID\n creator\n id\n owner\n totalUnits\n uri\n }\n}\n\nquery RecentClaims($orderDirection: OrderDirection, $first: Int, $skip: Int) {\n claims(orderDirection: $orderDirection, orderBy: creation, first: $first) {\n contract\n tokenID\n creator\n id\n owner\n totalUnits\n uri\n }\n}\n\nquery ClaimById($id: ID!) {\n claim(id: $id) {\n contract\n tokenID\n creator\n id\n owner\n totalUnits\n uri\n }\n}"]

Defined in

sdk/src/indexer/gql/gql.ts:39

graphql(source): typeof documents["query ClaimTokensByOwner($owner: Bytes = \"\", $orderDirection: OrderDirection, $first: Int, $skip: Int) {\n claimTokens(\n where: {owner: $owner}\n skip: $skip\n first: $first\n orderDirection: $orderDirection\n ) {\n id\n owner\n tokenID\n units\n claim {\n id\n creation\n uri\n totalUnits\n }\n }\n}\n\nquery ClaimTokensByClaim($claimId: String!, $orderDirection: OrderDirection, $first: Int, $skip: Int) {\n claimTokens(\n where: {claim: $claimId}\n skip: $skip\n first: $first\n orderDirection: $orderDirection\n ) {\n id\n owner\n tokenID\n units\n }\n}\n\nquery ClaimTokenById($claimTokenId: ID!) {\n claimToken(id: $claimTokenId) {\n id\n owner\n tokenID\n units\n claim {\n id\n creation\n uri\n totalUnits\n }\n }\n}"]

The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.

Parameters

NameType
source"query ClaimTokensByOwner($owner: Bytes = \"\", $orderDirection: OrderDirection, $first: Int, $skip: Int) {\n claimTokens(\n where: {owner: $owner}\n skip: $skip\n first: $first\n orderDirection: $orderDirection\n ) {\n id\n owner\n tokenID\n units\n claim {\n id\n creation\n uri\n totalUnits\n }\n }\n}\n\nquery ClaimTokensByClaim($claimId: String!, $orderDirection: OrderDirection, $first: Int, $skip: Int) {\n claimTokens(\n where: {claim: $claimId}\n skip: $skip\n first: $first\n orderDirection: $orderDirection\n ) {\n id\n owner\n tokenID\n units\n }\n}\n\nquery ClaimTokenById($claimTokenId: ID!) {\n claimToken(id: $claimTokenId) {\n id\n owner\n tokenID\n units\n claim {\n id\n creation\n uri\n totalUnits\n }\n }\n}"

Returns

typeof documents["query ClaimTokensByOwner($owner: Bytes = \"\", $orderDirection: OrderDirection, $first: Int, $skip: Int) {\n claimTokens(\n where: {owner: $owner}\n skip: $skip\n first: $first\n orderDirection: $orderDirection\n ) {\n id\n owner\n tokenID\n units\n claim {\n id\n creation\n uri\n totalUnits\n }\n }\n}\n\nquery ClaimTokensByClaim($claimId: String!, $orderDirection: OrderDirection, $first: Int, $skip: Int) {\n claimTokens(\n where: {claim: $claimId}\n skip: $skip\n first: $first\n orderDirection: $orderDirection\n ) {\n id\n owner\n tokenID\n units\n }\n}\n\nquery ClaimTokenById($claimTokenId: ID!) {\n claimToken(id: $claimTokenId) {\n id\n owner\n tokenID\n units\n claim {\n id\n creation\n uri\n totalUnits\n }\n }\n}"]

Defined in

sdk/src/indexer/gql/gql.ts:45


handleContractError

handleContractError(data): ContractError

Parameters

NameType
data`0x${string}`

Returns

ContractError

Defined in

sdk/src/utils/errors.ts:39


handleSdkError

handleSdkError(err): void

Method to catch errors and log them

Parameters

NameTypeDescription
errHypercertsSdkErrorError to handle defined in HypercertsSdkError

Returns

void

Defined in

sdk/src/utils/errors.ts:22


isFragmentReady

isFragmentReady<TQuery, TFrag>(queryNode, fragmentNode, data): data is [TFrag] extends [Object] ? TKey extends string ? Object : never : never

Type parameters

Name
TQuery
TFrag

Parameters

NameType
queryNodeDocumentTypeDecoration<TQuery, any>
fragmentNodeTypedDocumentNode<TFrag, { [key: string]: any; }>
dataundefined | null | [Incremental<TFrag>] extends [{ $fragmentName?: TKey }] ? TKey extends string ? { $fragmentRefs?: { [key in string]: Object } } : never : never

Returns

data is [TFrag] extends [Object] ? TKey extends string ? Object : never : never

Defined in

sdk/src/indexer/gql/fragment-masking.ts:51


makeFragmentData

makeFragmentData<F, FT>(data, _fragment): FragmentType<F>

Type parameters

NameType
Fextends DocumentTypeDecoration<any, any>
FTextends any

Parameters

NameType
dataFT
_fragmentF

Returns

FragmentType<F>

Defined in

sdk/src/indexer/gql/fragment-masking.ts:45


parseAllowListEntriesToMerkleTree

parseAllowListEntriesToMerkleTree(allowList): StandardMerkleTree<string[]>

Parameters

NameType
allowListAllowlistEntry[]

Returns

StandardMerkleTree<string[]>

Defined in

sdk/src/utils/allowlist.ts:6


publicClientToProvider

publicClientToProvider(publicClient): undefined | FallbackProvider | JsonRpcProvider

This function converts a PublicClient instance to an ethers.js Provider to faciliate compatibility between ethers and viem.

It extracts the chain and transport from the PublicClient and creates a network object. If no chain is found in the PublicClient, it logs a warning and stops the signature request. If the transport type is "fallback", it creates a FallbackProvider with multiple transports. Otherwise, it creates a JsonRpcProvider with a single transport.

Ref: https://viem.sh/docs/ethers-migration.html

Parameters

NameTypeDescription
publicClientObjectThe PublicClient instance to convert.
publicClient.accountundefinedThe Account of the Client.
publicClient.batch?ObjectFlags for batch settings.
publicClient.batch.multicall?boolean | { batchSize?: number | undefined; wait?: number | undefined; }Toggle to enable eth_call multicall aggregation.
publicClient.cacheTimenumberTime (in ms) that cached data will remain in memory.
publicClient.call(parameters: CallParameters<undefined | Chain>) => Promise<CallReturnType>Executes a new message call immediately without submitting a transaction to the network. - Docs: https://viem.sh/docs/actions/public/call - JSON-RPC Methods: eth_call Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const data = await client.call({ account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', })
publicClient.ccipRead?false | { request?: (parameters: CcipRequestParameters) => Promise<`0x${string}`> }CCIP Read configuration.
publicClient.chainundefined | ChainChain for the client.
publicClient.createBlockFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "block" }>Creates a Filter to listen for new block hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createBlockFilter - JSON-RPC Methods: eth_newBlockFilter Example ts import { createPublicClient, createBlockFilter, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await createBlockFilter(client) // { id: "0x345a6572337856574a76364e457a4366", type: 'block' }
publicClient.createContractEventFilter<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>(args: CreateContractEventFilterParameters<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>) => Promise<CreateContractEventFilterReturnType<TAbi, TEventName, TArgs, TStrict, TFromBlock, TToBlock>>Creates a Filter to retrieve event logs that can be used with getFilterChanges or getFilterLogs. - Docs: https://viem.sh/docs/contract/createContractEventFilter Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), })
publicClient.createEventFilter<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>(args?: CreateEventFilterParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock, _EventName, _Args>) => Promise<{ [K in keyof Filter<"event", TAbiEvents, _EventName, _Args, TStrict, TFromBlock, TToBlock>]: Filter<"event", TAbiEvents, ... 4 more ..., TToBlock>[K]; }>Creates a Filter to listen for new events that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createEventFilter - JSON-RPC Methods: eth_newFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xfba3912ca04dd458c843e2ee08967fc04f3579c2', })
publicClient.createPendingTransactionFilter() => Promise<{ id: `0x${string}` ; request: EIP1193RequestFn<readonly [{ Method: "eth_getFilterChanges" ; Parameters: [filterId: `0x${string}`] ; ReturnType: `0x${string}`[] | RpcLog[] }, { Method: "eth_getFilterLogs" ; Parameters: [filterId: `0x${string}`] ; ReturnType: RpcLog[] }, { Method: "eth_uninstallFilter" ; Parameters: [filterId: `0x${string}`] ; ReturnType: boolean }]> ; type: "transaction" }>Creates a Filter to listen for new pending transaction hashes that can be used with getFilterChanges. - Docs: https://viem.sh/docs/actions/public/createPendingTransactionFilter - JSON-RPC Methods: eth_newPendingTransactionFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() // { id: "0x345a6572337856574a76364e457a4366", type: 'transaction' }
publicClient.estimateContractGas<TChain, abi, functionName, args>(args: EstimateContractGasParameters<abi, functionName, args, TChain>) => Promise<bigint>Estimates the gas required to successfully execute a contract write function call. - Docs: https://viem.sh/docs/contract/estimateContractGas Remarks Internally, uses a Public Client to call the estimateGas action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gas = await client.estimateContractGas({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint() public']), functionName: 'mint', account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', })
publicClient.estimateFeesPerGas<TChainOverride, TType>(args?: EstimateFeesPerGasParameters<undefined | Chain, TChainOverride, TType>) => Promise<EstimateFeesPerGasReturnType>Returns an estimate for the fees per gas for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateFeesPerGas Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateFeesPerGas() // { maxFeePerGas: ..., maxPriorityFeePerGas: ... }
publicClient.estimateGas(args: EstimateGasParameters<undefined | Chain>) => Promise<bigint>Estimates the gas necessary to complete a transaction without submitting it to the network. - Docs: https://viem.sh/docs/actions/public/estimateGas - JSON-RPC Methods: eth_estimateGas Example ts import { createPublicClient, http, parseEther } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasEstimate = await client.estimateGas({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: parseEther('1'), })
publicClient.estimateMaxPriorityFeePerGas<TChainOverride>(args?: { chain: null | TChainOverride }) => Promise<bigint>Returns an estimate for the max priority fee per gas (in wei) for a transaction to be included in the next block. - Docs: https://viem.sh/docs/actions/public/estimateMaxPriorityFeePerGas Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const maxPriorityFeePerGas = await client.estimateMaxPriorityFeePerGas() // 10000000n
publicClient.extend<client>(fn: (client: Client<Transport, undefined | Chain, undefined, PublicRpcSchema, PublicActions<Transport, undefined | Chain>>) => client) => Client<Transport, undefined | Chain, undefined, PublicRpcSchema, { [K in keyof client]: client[K]; } & PublicActions<Transport, undefined | Chain>>-
publicClient.getBalance(args: GetBalanceParameters) => Promise<bigint>Returns the balance of an address in wei. - Docs: https://viem.sh/docs/actions/public/getBalance - JSON-RPC Methods: eth_getBalance Remarks You can convert the balance to ether units with formatEther. ts const balance = await getBalance(client, { address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', blockTag: 'safe' }) const balanceAsEther = formatEther(balance) // "6.942" Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const balance = await client.getBalance({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', }) // 10000000000000000000000n (wei)
publicClient.getBlobBaseFee() => Promise<bigint>Returns the base fee per blob gas in wei. - Docs: https://viem.sh/docs/actions/public/getBlobBaseFee - JSON-RPC Methods: eth_blobBaseFee Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getBlobBaseFee } from 'viem/public' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blobBaseFee = await client.getBlobBaseFee()
publicClient.getBlock<TIncludeTransactions, TBlockTag>(args?: GetBlockParameters<TIncludeTransactions, TBlockTag>) => Promise<{ number: TBlockTag extends "pending" ? null : bigint; nonce: TBlockTag extends "pending" ? null : `0x${string}`; hash: TBlockTag extends "pending" ? null : `0x${string}`; ... 22 more ...; transactions: TIncludeTransactions extends true ? ({ ...; } | ... 2 more ... | { ...; })[] : `0x${string}`[]; }>Returns information about a block at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlock - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: - Calls eth_getBlockByNumber for blockNumber & blockTag. - Calls eth_getBlockByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getBlock()
publicClient.getBlockNumber(args?: GetBlockNumberParameters) => Promise<bigint>Returns the number of the most recent block seen. - Docs: https://viem.sh/docs/actions/public/getBlockNumber - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/fetching-blocks - JSON-RPC Methods: eth_blockNumber Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const blockNumber = await client.getBlockNumber() // 69420n
publicClient.getBlockTransactionCount(args?: GetBlockTransactionCountParameters) => Promise<number>Returns the number of Transactions at a block number, hash, or tag. - Docs: https://viem.sh/docs/actions/public/getBlockTransactionCount - JSON-RPC Methods: - Calls eth_getBlockTransactionCountByNumber for blockNumber & blockTag. - Calls eth_getBlockTransactionCountByHash for blockHash. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const count = await client.getBlockTransactionCount()
publicClient.getBytecode(args: GetBytecodeParameters) => Promise<GetBytecodeReturnType>Retrieves the bytecode at an address. - Docs: https://viem.sh/docs/contract/getBytecode - JSON-RPC Methods: eth_getCode Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getBytecode({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', })
publicClient.getChainId() => Promise<number>Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId - JSON-RPC Methods: eth_chainId Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const chainId = await client.getChainId() // 1
publicClient.getContractEvents<abi, eventName, strict, fromBlock, toBlock>(args: GetContractEventsParameters<abi, eventName, strict, fromBlock, toBlock>) => Promise<GetContractEventsReturnType<abi, eventName, strict, fromBlock, toBlock>>Returns a list of event logs emitted by a contract. - Docs: https://viem.sh/docs/actions/public/getContractEvents - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { wagmiAbi } from './abi' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getContractEvents(client, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: wagmiAbi, eventName: 'Transfer' })
publicClient.getEnsAddress(args: { blockNumber?: bigint | undefined; blockTag?: BlockTag | undefined; coinType?: number | undefined; gatewayUrls?: string[] | undefined; name: string; strict?: boolean | undefined; universalResolverAddress?: `0x${string}` | undefined; }) => Promise<GetEnsAddressReturnType>Gets address for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAddress - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAddress = await client.getEnsAddress({ name: normalize('wevm.eth'), }) // '0xd2135CfB216b74109775236E36d4b433F1DF507B'
publicClient.getEnsAvatar(args: { name: string; blockNumber?: bigint | undefined; blockTag?: BlockTag | undefined; gatewayUrls?: string[] | undefined; strict?: boolean | undefined; universalResolverAddress?: `0x${string}` | undefined; assetGatewayUrls?: AssetGatewayUrls | undefined; }) => Promise<GetEnsAvatarReturnType>Gets the avatar of an ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsAvatar - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens Remarks Calls getEnsText with key set to 'avatar'. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensAvatar = await client.getEnsAvatar({ name: normalize('wevm.eth'), }) // 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'
publicClient.getEnsName(args: { blockNumber?: bigint | undefined; blockTag?: BlockTag | undefined; address: `0x${string}`; gatewayUrls?: string[] | undefined; strict?: boolean | undefined; universalResolverAddress?: `0x${string}` | undefined; }) => Promise<GetEnsNameReturnType>Gets primary name for specified address. - Docs: https://viem.sh/docs/ens/actions/getEnsName - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens Remarks Calls reverse(bytes) on ENS Universal Resolver Contract to "reverse resolve" the address to the primary ENS name. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const ensName = await client.getEnsName({ address: '0xd2135CfB216b74109775236E36d4b433F1DF507B', }) // 'wevm.eth'
publicClient.getEnsResolver(args: { blockNumber?: bigint | undefined; blockTag?: BlockTag | undefined; name: string; universalResolverAddress?: `0x${string}` | undefined; }) => Promise<`0x${string}`>Gets resolver for ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens Remarks Calls findResolver(bytes) on ENS Universal Resolver Contract to retrieve the resolver of an ENS name. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const resolverAddress = await client.getEnsResolver({ name: normalize('wevm.eth'), }) // '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41'
publicClient.getEnsText(args: { blockNumber?: bigint | undefined; blockTag?: BlockTag | undefined; name: string; gatewayUrls?: string[] | undefined; key: string; strict?: boolean | undefined; universalResolverAddress?: `0x${string}` | undefined; }) => Promise<GetEnsTextReturnType>Gets a text record for specified ENS name. - Docs: https://viem.sh/docs/ens/actions/getEnsResolver - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/ens Remarks Calls resolve(bytes, bytes) on ENS Universal Resolver Contract. Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { normalize } from 'viem/ens' const client = createPublicClient({ chain: mainnet, transport: http(), }) const twitterRecord = await client.getEnsText({ name: normalize('wevm.eth'), key: 'com.twitter', }) // 'wagmi_sh'
publicClient.getFeeHistory(args: GetFeeHistoryParameters) => Promise<GetFeeHistoryReturnType>Returns a collection of historical gas information. - Docs: https://viem.sh/docs/actions/public/getFeeHistory - JSON-RPC Methods: eth_feeHistory Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const feeHistory = await client.getFeeHistory({ blockCount: 4, rewardPercentiles: [25, 75], })
publicClient.getFilterChanges<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterChangesParameters<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterChangesReturnType<TFilterType, TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of logs or hashes based on a Filter since the last time it was called. - Docs: https://viem.sh/docs/actions/public/getFilterChanges - JSON-RPC Methods: eth_getFilterChanges Remarks A Filter can be created from the following actions: - createBlockFilter - createContractEventFilter - createEventFilter - createPendingTransactionFilter Depending on the type of filter, the return value will be different: - If the filter was created with createContractEventFilter or createEventFilter, it returns a list of logs. - If the filter was created with createPendingTransactionFilter, it returns a list of transaction hashes. - If the filter was created with createBlockFilter, it returns a list of block hashes. Example ts // Blocks import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createBlockFilter() const hashes = await client.getFilterChanges({ filter }) Example ts // Contract Events import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createContractEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', abi: parseAbi(['event Transfer(address indexed, address indexed, uint256)']), eventName: 'Transfer', }) const logs = await client.getFilterChanges({ filter }) Example ts // Raw Events import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterChanges({ filter }) Example ts // Transactions import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createPendingTransactionFilter() const hashes = await client.getFilterChanges({ filter })
publicClient.getFilterLogs<TAbi, TEventName, TStrict, TFromBlock, TToBlock>(args: GetFilterLogsParameters<TAbi, TEventName, TStrict, TFromBlock, TToBlock>) => Promise<GetFilterLogsReturnType<TAbi, TEventName, TStrict, TFromBlock, TToBlock>>Returns a list of event logs since the filter was created. - Docs: https://viem.sh/docs/actions/public/getFilterLogs - JSON-RPC Methods: eth_getFilterLogs Remarks getFilterLogs is only compatible with event filters. Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const filter = await client.createEventFilter({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', event: parseAbiItem('event Transfer(address indexed, address indexed, uint256)'), }) const logs = await client.getFilterLogs({ filter })
publicClient.getGasPrice() => Promise<bigint>Returns the current price of gas (in wei). - Docs: https://viem.sh/docs/actions/public/getGasPrice - JSON-RPC Methods: eth_gasPrice Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const gasPrice = await client.getGasPrice()
publicClient.getLogs<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>(args?: GetLogsParameters<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>) => Promise<GetLogsReturnType<TAbiEvent, TAbiEvents, TStrict, TFromBlock, TToBlock>>Returns a list of event logs matching the provided parameters. - Docs: https://viem.sh/docs/actions/public/getLogs - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/filters-and-logs/event-logs - JSON-RPC Methods: eth_getLogs Example ts import { createPublicClient, http, parseAbiItem } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const logs = await client.getLogs()
publicClient.getProof(args: GetProofParameters) => Promise<GetProofReturnType>Returns the account and storage values of the specified account including the Merkle-proof. - Docs: https://viem.sh/docs/actions/public/getProof - JSON-RPC Methods: - Calls eth_getProof Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const block = await client.getProof({ address: '0x...', storageKeys: ['0x...'], })
publicClient.getStorageAt(args: GetStorageAtParameters) => Promise<GetStorageAtReturnType>Returns the value from a storage slot at a given address. - Docs: https://viem.sh/docs/contract/getStorageAt - JSON-RPC Methods: eth_getStorageAt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { getStorageAt } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const code = await client.getStorageAt({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', slot: toHex(0), })
publicClient.getTransaction<TBlockTag>(args: GetTransactionParameters<TBlockTag>) => Promise<{ type: "legacy"; to: `0x${string}` | null; from: `0x${string}`; gas: bigint; nonce: number; value: bigint; gasPrice: bigint; maxFeePerBlobGas?: undefined; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; ... 12 more ...; transactionIndex: (TBlockTag extends "pending" ? true : false) extends true ? null :... | { type: "eip2930"; to: `0x${string}` | null; from: `0x${string}`; gas: bigint; nonce: number; value: bigint; gasPrice: bigint; maxFeePerBlobGas?: undefined; maxFeePerGas?: undefined; maxPriorityFeePerGas?: undefined; ... 12 more ...; transactionIndex: (TBlockTag extends "pending" ? true : false) extends true ? null ... | { type: "eip1559"; to: `0x${string}` | null; from: `0x${string}`; gas: bigint; nonce: number; value: bigint; gasPrice?: undefined; maxFeePerBlobGas?: undefined; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; ... 12 more ...; transactionIndex: (TBlockTag extends "pending" ? true : false) extends true ? null : nu... | { type: "eip4844"; to: `0x${string}` | null; from: `0x${string}`; gas: bigint; nonce: number; value: bigint; gasPrice?: undefined; maxFeePerBlobGas: bigint; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; ... 12 more ...; transactionIndex: (TBlockTag extends "pending" ? true : false) extends true ? null : number...>Returns information about a Transaction given a hash or block identifier. - Docs: https://viem.sh/docs/actions/public/getTransaction - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionByHash Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transaction = await client.getTransaction({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
publicClient.getTransactionConfirmations(args: GetTransactionConfirmationsParameters<undefined | Chain>) => Promise<bigint>Returns the number of blocks passed (confirmations) since the transaction was processed on a block. - Docs: https://viem.sh/docs/actions/public/getTransactionConfirmations - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionConfirmations Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const confirmations = await client.getTransactionConfirmations({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
publicClient.getTransactionCount(args: GetTransactionCountParameters) => Promise<number>Returns the number of Transactions an Account has broadcast / sent. - Docs: https://viem.sh/docs/actions/public/getTransactionCount - JSON-RPC Methods: eth_getTransactionCount Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionCount = await client.getTransactionCount({ address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
publicClient.getTransactionReceipt(args: GetTransactionReceiptParameters) => Promise<TransactionReceipt>Returns the Transaction Receipt given a Transaction hash. - Docs: https://viem.sh/docs/actions/public/getTransactionReceipt - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/fetching-transactions - JSON-RPC Methods: eth_getTransactionReceipt Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.getTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
publicClient.keystringA key for the client.
publicClient.multicall<contracts, allowFailure>(args: MulticallParameters<contracts, allowFailure>) => Promise<MulticallReturnType<contracts, allowFailure>>Similar to readContract, but batches up multiple functions on a contract in a single RPC call via the multicall3 contract. - Docs: https://viem.sh/docs/contract/multicall Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const abi = parseAbi([ 'function balanceOf(address) view returns (uint256)', 'function totalSupply() view returns (uint256)', ]) const result = await client.multicall({ contracts: [ { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }, { address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi, functionName: 'totalSupply', }, ], }) // [{ result: 424122n, status: 'success' }, { result: 1000000n, status: 'success' }]
publicClient.namestringA name for the client.
publicClient.pollingIntervalnumberFrequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
publicClient.prepareTransactionRequest<TRequest, TChainOverride, TAccountOverride>(args: PrepareTransactionRequestParameters<undefined | Chain, undefined | Account, TChainOverride, TAccountOverride, TRequest>) => Promise<{ [K in keyof (UnionRequiredBy<Extract<UnionOmit<ExtractChainFormatterParameters<DeriveChain<Chain, TChainOverride>, "transactionRequest", TransactionRequest>, "from"> & (DeriveChain<...> extends Chain ? { ...; } : { ...; }) & (DeriveAccount<...> extends Account ? { ...; } : { ...; }), IsNever<...> extends true ? un...>Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })
publicClient.readContract<abi, functionName, args>(args: ReadContractParameters<abi, functionName, args>) => Promise<ReadContractReturnType<abi, functionName, args>>Calls a read-only function on a contract, and returns the response. - Docs: https://viem.sh/docs/contract/readContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/reading-contracts Remarks A "read-only" function (constant function) on a Solidity contract is denoted by a view or pure keyword. They can only read the state of the contract, and cannot make any changes to it. Since read-only methods do not change the state of the contract, they do not require any gas to be executed, and can be called by any user without the need to pay for gas. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' import { readContract } from 'viem/contract' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.readContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function balanceOf(address) view returns (uint256)']), functionName: 'balanceOf', args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'], }) // 424122n
publicClient.requestEIP1193RequestFn<PublicRpcSchema>Request function wrapped with friendly error handling
publicClient.sendRawTransaction(args: SendRawTransactionParameters) => Promise<`0x${string}`>Sends a signed transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction - JSON-RPC Method: eth_sendRawTransaction Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })
publicClient.simulateContract<abi, functionName, args, chainOverride, accountOverride>(args: SimulateContractParameters<abi, functionName, args, undefined | Chain, chainOverride, accountOverride>) => Promise<SimulateContractReturnType<abi, functionName, args, undefined | Chain, undefined | Account, chainOverride, accountOverride>>Simulates/validates a contract interaction. This is useful for retrieving return data and revert reasons of contract write functions. - Docs: https://viem.sh/docs/contract/simulateContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts Remarks This function does not require gas to execute and does not change the state of the blockchain. It is almost identical to readContract, but also supports contract write functions. Internally, uses a Public Client to call the call action with ABI-encoded data. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const result = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32) view returns (uint32)']), functionName: 'mint', args: ['69420'], account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', })
publicClient.transportTransportConfig<string, EIP1193RequestFn> & Record<string, any>The RPC transport
publicClient.typestringThe type of client.
publicClient.uidstringA unique ID for the client.
publicClient.uninstallFilter(args: UninstallFilterParameters) => Promise<boolean>Destroys a Filter that was created from one of the following Actions: - createBlockFilter - createEventFilter - createPendingTransactionFilter - Docs: https://viem.sh/docs/actions/public/uninstallFilter - JSON-RPC Methods: eth_uninstallFilter Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' import { createPendingTransactionFilter, uninstallFilter } from 'viem/public' const filter = await client.createPendingTransactionFilter() const uninstalled = await client.uninstallFilter({ filter }) // true
publicClient.verifyMessage(args: VerifyMessageParameters) => Promise<boolean>-
publicClient.verifyTypedData(args: VerifyTypedDataParameters) => Promise<boolean>-
publicClient.waitForTransactionReceipt(args: WaitForTransactionReceiptParameters<undefined | Chain>) => Promise<TransactionReceipt>Waits for the Transaction to be included on a Block (one confirmation), and then returns the Transaction Receipt. If the Transaction reverts, then the action will throw an error. - Docs: https://viem.sh/docs/actions/public/waitForTransactionReceipt - Example: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions - JSON-RPC Methods: - Polls eth_getTransactionReceipt on each block until it has been processed. - If a Transaction has been replaced: - Calls eth_getBlockByNumber and extracts the transactions - Checks if one of the Transactions is a replacement - If so, calls eth_getTransactionReceipt. Remarks The waitForTransactionReceipt action additionally supports Replacement detection (e.g. sped up Transactions). Transactions can be replaced when a user modifies their transaction in their wallet (to speed up or cancel). Transactions are replaced when they are sent from the same nonce. There are 3 types of Transaction Replacement reasons: - repriced: The gas price has been modified (e.g. different maxFeePerGas) - cancelled: The Transaction has been cancelled (e.g. value === 0n) - replaced: The Transaction has been replaced (e.g. different value or data) Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const transactionReceipt = await client.waitForTransactionReceipt({ hash: '0x4ca7ee652d57678f26e887c149ab0735f41de37bcad58c9f6d3ed5824f15b74d', })
publicClient.watchBlockNumber(args: WatchBlockNumberParameters) => WatchBlockNumberReturnTypeWatches and returns incoming block numbers. - Docs: https://viem.sh/docs/actions/public/watchBlockNumber - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_blockNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlockNumber({ onBlockNumber: (blockNumber) => console.log(blockNumber), })
publicClient.watchBlocks<TIncludeTransactions, TBlockTag>(args: WatchBlocksParameters<Transport, undefined | Chain, TIncludeTransactions, TBlockTag>) => WatchBlocksReturnTypeWatches and returns information for incoming blocks. - Docs: https://viem.sh/docs/actions/public/watchBlocks - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/blocks/watching-blocks - JSON-RPC Methods: - When poll: true, calls eth_getBlockByNumber on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newHeads" event. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchBlocks({ onBlock: (block) => console.log(block), })
publicClient.watchContractEvent<TAbi, TEventName, TStrict>(args: WatchContractEventParameters<TAbi, TEventName, TStrict, Transport>) => WatchContractEventReturnTypeWatches and returns emitted contract event logs. - Docs: https://viem.sh/docs/contract/watchContractEvent Remarks This Action will batch up all the event logs found within the pollingInterval, and invoke them via onLogs. watchContractEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchContractEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchContractEvent({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['event Transfer(address indexed from, address indexed to, uint256 value)']), eventName: 'Transfer', args: { from: '0xc961145a54C96E3aE9bAA048c4F4D6b04C13916b' }, onLogs: (logs) => console.log(logs), })
publicClient.watchEvent<TAbiEvent, TAbiEvents, TStrict>(args: WatchEventParameters<TAbiEvent, TAbiEvents, TStrict, Transport>) => WatchEventReturnTypeWatches and returns emitted Event Logs. - Docs: https://viem.sh/docs/actions/public/watchEvent - JSON-RPC Methods: - RPC Provider supports eth_newFilter: - Calls eth_newFilter to create a filter (called on initialize). - On a polling interval, it will call eth_getFilterChanges. - RPC Provider does not support eth_newFilter: - Calls eth_getLogs for each block between the polling interval. Remarks This Action will batch up all the Event Logs found within the pollingInterval, and invoke them via onLogs. watchEvent will attempt to create an Event Filter and listen to changes to the Filter per polling interval, however, if the RPC Provider does not support Filters (e.g. eth_newFilter), then watchEvent will fall back to using getLogs instead. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = client.watchEvent({ onLogs: (logs) => console.log(logs), })
publicClient.watchPendingTransactions(args: WatchPendingTransactionsParameters<Transport>) => WatchPendingTransactionsReturnTypeWatches and returns pending transaction hashes. - Docs: https://viem.sh/docs/actions/public/watchPendingTransactions - JSON-RPC Methods: - When poll: true - Calls eth_newPendingTransactionFilter to initialize the filter. - Calls eth_getFilterChanges on a polling interval. - When poll: false & WebSocket Transport, uses a WebSocket subscription via eth_subscribe and the "newPendingTransactions" event. Remarks This Action will batch up all the pending transactions found within the pollingInterval, and invoke them via onTransactions. Example ts import { createPublicClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createPublicClient({ chain: mainnet, transport: http(), }) const unwatch = await client.watchPendingTransactions({ onTransactions: (hashes) => console.log(hashes), })

Returns

undefined | FallbackProvider | JsonRpcProvider

An ethers.js Provider instance, or undefined if no chain is found in the PublicClient.

Defined in

sdk/src/utils/adapters.ts:19


uploadAllowlist

uploadAllowlist(req, config?): Promise<ResponseData<{ cid: string }>>

Uploads an allowlist to the API.

Parameters

NameTypeDescription
reqAllowListPostRequestThe request body containing the allowlist and total units. The allowList should be a stringified Merkle tree dump.
config?StorageConfigOverridesAn optional configuration object.

Returns

Promise<ResponseData<{ cid: string }>>

The response data from the API.

Defined in

sdk/src/utils/apis.ts:52


uploadMetadata

uploadMetadata(metadata, config?): Promise<ResponseData<{ cid: string }>>

Uploads metadata to the API.

Parameters

NameTypeDescription
metadataHypercertMetadataThe metadata to upload. Should be an object that conforms to the HypercertMetadata type.
config?StorageConfigOverridesAn optional configuration object.

Returns

Promise<ResponseData<{ cid: string }>>

The response data from the API.

Defined in

sdk/src/utils/apis.ts:34


useFragment

useFragment<TType>(_documentNode, fragmentType): TType

Type parameters

Name
TType

Parameters

NameType
_documentNodeDocumentTypeDecoration<TType, any>
fragmentType[TType] extends [{ $fragmentName?: TKey }] ? TKey extends string ? { $fragmentRefs?: { [key in string]: TType } } : never : never

Returns

TType

Defined in

sdk/src/indexer/gql/fragment-masking.ts:15

useFragment<TType>(_documentNode, fragmentType): TType | null | undefined

Type parameters

Name
TType

Parameters

NameType
_documentNodeDocumentTypeDecoration<TType, any>
fragmentTypeundefined | null | [TType] extends [{ $fragmentName?: TKey }] ? TKey extends string ? { $fragmentRefs?: { [key in string]: TType } } : never : never

Returns

TType | null | undefined

Defined in

sdk/src/indexer/gql/fragment-masking.ts:20

useFragment<TType>(_documentNode, fragmentType): ReadonlyArray<TType>

Type parameters

Name
TType

Parameters

NameType
_documentNodeDocumentTypeDecoration<TType, any>
fragmentTypereadonly [TType] extends [{ $fragmentName?: TKey }] ? TKey extends string ? { $fragmentRefs?: { [key in string]: TType } } : never : never[]

Returns

ReadonlyArray<TType>

Defined in

sdk/src/indexer/gql/fragment-masking.ts:25

useFragment<TType>(_documentNode, fragmentType): ReadonlyArray<TType> | null | undefined

Type parameters

Name
TType

Parameters

NameType
_documentNodeDocumentTypeDecoration<TType, any>
fragmentTypeundefined | null | readonly [TType] extends [{ $fragmentName?: TKey }] ? TKey extends string ? { $fragmentRefs?: { [key in string]: TType } } : never : never[]

Returns

ReadonlyArray<TType> | null | undefined

Defined in

sdk/src/indexer/gql/fragment-masking.ts:30


validateAllowlist

validateAllowlist(data, units): ValidationResult

Validates an array of allowlist entries.

This function checks that the total units in the allowlist match the expected total units, that the total units are greater than 0, and that all addresses in the allowlist are valid Ethereum addresses. It returns an object that includes a validity flag and any errors that occurred during validation.

Parameters

NameTypeDescription
dataAllowlistEntry[]The allowlist entries to validate. Each entry should be an object that includes an address and a number of units.
unitsbigintThe expected total units in the allowlist.

Returns

ValidationResult

An object that includes a validity flag and any errors that occurred during validation. The keys in the errors object are the names of the invalid properties, and the values are the error messages.

Defined in

sdk/src/validator/index.ts:108


validateClaimData

validateClaimData(data): ValidationResult

Validates Hypercert claim data.

This function uses the AJV library to validate the claim data. It first retrieves the schema for the claim data, then validates the data against the schema. If the schema is not found, it returns an error. If the data does not conform to the schema, it returns the validation errors. If the data is valid, it returns a success message.

Parameters

NameTypeDescription
dataunknownThe claim data to validate. This should be an object that conforms to the HypercertClaimdata type.

Returns

ValidationResult

An object that includes a validity flag and any errors that occurred during validation.

Defined in

sdk/src/validator/index.ts:77


validateDuplicateEvaluationData

validateDuplicateEvaluationData(data): ValidationResult

Validates duplicate evaluation data.

This function uses the AJV library to validate the duplicate evaluation data. It first retrieves the schema for the duplicate evaluation data, then validates the data against the schema. If the schema is not found, it returns an error. If the data does not conform to the schema, it returns the validation errors. If the data is valid, it returns a success message.

Parameters

NameTypeDescription
dataDuplicateEvaluationThe duplicate evaluation data to validate. This should be an object that conforms to the DuplicateEvaluation type.

Returns

ValidationResult

An object that includes a validity flag and any errors that occurred during validation.

Defined in

sdk/src/validator/index.ts:143


validateMetaData

validateMetaData(data): ValidationResult

Validates Hypercert metadata.

This function uses the AJV library to validate the metadata. It first retrieves the schema for the metadata, then validates the data against the schema. If the schema is not found, it returns an error. If the data does not conform to the schema, it returns the validation errors. If the data is valid, it returns a success message.

Parameters

NameTypeDescription
dataunknownThe metadata to validate. This should be an object that conforms to the HypercertMetadata type.

Returns

ValidationResult

An object that includes a validity flag and any errors that occurred during validation.

Defined in

sdk/src/validator/index.ts:46


validateSimpleTextEvaluationData

validateSimpleTextEvaluationData(data): ValidationResult

Validates simple text evaluation data against a predefined schema.

This function uses the AJV library to validate the simple text evaluation data. It first retrieves the schema for the simple text evaluation data, then validates the data against the schema. If the schema is not found, it returns an error. If the data does not conform to the schema, it returns the validation errors. If the data is valid, it returns a success message.

Parameters

NameTypeDescription
dataSimpleTextEvaluationThe simple text evaluation data to validate. This should be an object that conforms to the SimpleTextEvaluation type.

Returns

ValidationResult

An object that includes a validity flag and any errors that occurred during validation.

Defined in

sdk/src/validator/index.ts:173


verifyMerkleProof

verifyMerkleProof(root, signerAddress, units, proof): void

Verifies a Merkle proof for a given root, signer address, units, and proof.

This function first checks if the signer address is a valid Ethereum address. If it's not, it throws a MintingError. It then verifies the Merkle proof using the StandardMerkleTree.verify method. If the verification fails, it throws a MintingError.

Parameters

NameTypeDescription
rootstringThe root of the Merkle tree.
signerAddressstringThe signer's Ethereum address.
unitsbigintThe number of units.
proofstring[]The Merkle proof to verify.

Returns

void

Throws

Will throw a MintingError if the signer address is invalid or if the Merkle proof verification fails.

Defined in

sdk/src/validator/index.ts:205


verifyMerkleProofs

verifyMerkleProofs(roots, signerAddress, units, proofs): void

Verifies multiple Merkle proofs for given roots, a signer address, units, and proofs.

This function first checks if the lengths of the roots, units, and proofs arrays are equal. If they're not, it throws a MintingError. It then iterates over the arrays and verifies each Merkle proof using the verifyMerkleProof function. If any verification fails, it throws a MintingError.

Parameters

NameTypeDescription
rootsstring[]The roots of the Merkle trees.
signerAddressstringThe signer's Ethereum address.
unitsbigint[]The numbers of units.
proofsstring[][]The Merkle proofs to verify.

Returns

void

Throws

Will throw a MintingError if the lengths of the input arrays are not equal or if any Merkle proof verification fails.

Defined in

sdk/src/validator/index.ts:228


walletClientToSigner

walletClientToSigner(walletClient): undefined | Signer & TypedDataSigner

This function converts a WalletClient instance to an ethers.js Signer to faciliate compatibility between ethers and viem.

It extracts the account, chain, and transport from the WalletClient and creates a network object. If no chain is found in the WalletClient, it logs a warning and stops the signature request. It then creates a Web3Provider with the transport and network, and gets a Signer from the provider using the account's address.

Ref: https://viem.sh/docs/ethers-migration.html

Parameters

NameTypeDescription
walletClientObjectThe WalletClient instance to convert.
walletClient.accountundefined | AccountThe Account of the Client.
walletClient.addChain(args: AddChainParameters) => Promise<void>Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/addChain - JSON-RPC Methods: eth_addEthereumChain Example ts import { createWalletClient, custom } from 'viem' import { optimism } from 'viem/chains' const client = createWalletClient({ transport: custom(window.ethereum), }) await client.addChain({ chain: optimism })
walletClient.batch?ObjectFlags for batch settings.
walletClient.batch.multicall?boolean | { batchSize?: number | undefined; wait?: number | undefined; }Toggle to enable eth_call multicall aggregation.
walletClient.cacheTimenumberTime (in ms) that cached data will remain in memory.
walletClient.ccipRead?false | { request?: (parameters: CcipRequestParameters) => Promise<`0x${string}`> }CCIP Read configuration.
walletClient.chainundefined | ChainChain for the client.
walletClient.deployContract<abi, chainOverride>(args: DeployContractParameters<abi, undefined | Chain, undefined | Account, chainOverride>) => Promise<`0x${string}`>Deploys a contract to the network, given bytecode and constructor arguments. - Docs: https://viem.sh/docs/contract/deployContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/deploying-contracts Example ts import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.deployContract({ abi: [], account: '0x…, bytecode: '0x608060405260405161083e38038061083e833981016040819052610...', })
walletClient.extend<client>(fn: (client: Client<Transport, undefined | Chain, undefined | Account, WalletRpcSchema, WalletActions<undefined | Chain, undefined | Account>>) => client) => Client<Transport, undefined | Chain, undefined | Account, WalletRpcSchema, { [K in keyof client]: client[K]; } & WalletActions<undefined | Chain, undefined | Account>>-
walletClient.getAddresses() => Promise<GetAddressesReturnType>Returns a list of account addresses owned by the wallet or client. - Docs: https://viem.sh/docs/actions/wallet/getAddresses - JSON-RPC Methods: eth_accounts Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.getAddresses()
walletClient.getChainId() => Promise<number>Returns the chain ID associated with the current network. - Docs: https://viem.sh/docs/actions/public/getChainId - JSON-RPC Methods: eth_chainId Example ts import { createWalletClient, http } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const chainId = await client.getChainId() // 1
walletClient.getPermissions() => Promise<GetPermissionsReturnType>Gets the wallets current permissions. - Docs: https://viem.sh/docs/actions/wallet/getPermissions - JSON-RPC Methods: wallet_getPermissions Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.getPermissions()
walletClient.keystringA key for the client.
walletClient.namestringA name for the client.
walletClient.pollingIntervalnumberFrequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds.
walletClient.prepareTransactionRequest<TRequest, TChainOverride, TAccountOverride>(args: PrepareTransactionRequestParameters<undefined | Chain, undefined | Account, TChainOverride, TAccountOverride, TRequest>) => Promise<{ [K in keyof (UnionRequiredBy<Extract<UnionOmit<ExtractChainFormatterParameters<DeriveChain<Chain, TChainOverride>, "transactionRequest", TransactionRequest>, "from"> & (DeriveChain<...> extends Chain ? { ...; } : { ...; }) & (DeriveAccount<...> extends Account ? { ...; } : { ...; }), IsNever<...> extends true ? un...>Prepares a transaction request for signing. - Docs: https://viem.sh/docs/actions/wallet/prepareTransactionRequest Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, })
walletClient.requestEIP1193RequestFn<WalletRpcSchema>Request function wrapped with friendly error handling
walletClient.requestAddresses() => Promise<RequestAddressesReturnType>Requests a list of accounts managed by a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestAddresses - JSON-RPC Methods: eth_requestAccounts Sends a request to the wallet, asking for permission to access the user's accounts. After the user accepts the request, it will return a list of accounts (addresses). This API can be useful for dapps that need to access the user's accounts in order to execute transactions or interact with smart contracts. Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const accounts = await client.requestAddresses()
walletClient.requestPermissions(args: { [x: string]: Record<string, any>; eth_accounts: Record<string, any>; }) => Promise<RequestPermissionsReturnType>Requests permissions for a wallet. - Docs: https://viem.sh/docs/actions/wallet/requestPermissions - JSON-RPC Methods: wallet_requestPermissions Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const permissions = await client.requestPermissions({ eth_accounts: {} })
walletClient.sendRawTransaction(args: SendRawTransactionParameters) => Promise<`0x${string}`>Sends a signed transaction to the network - Docs: https://viem.sh/docs/actions/wallet/sendRawTransaction - JSON-RPC Method: eth_sendRawTransaction Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' import { sendRawTransaction } from 'viem/wallet' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendRawTransaction({ serializedTransaction: '0x02f850018203118080825208808080c080a04012522854168b27e5dc3d5839bab5e6b39e1a0ffd343901ce1622e3d64b48f1a04e00902ae0502c4728cbf12156290df99c3ed7de85b1dbfe20b5c36931733a33' })
walletClient.sendTransaction<TRequest, TChainOverride>(args: SendTransactionParameters<undefined | Chain, undefined | Account, TChainOverride, TRequest>) => Promise<`0x${string}`>Creates, signs, and sends a new transaction to the network. - Docs: https://viem.sh/docs/actions/wallet/sendTransaction - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/transactions/sending-transactions - JSON-RPC Methods: - JSON-RPC Accounts: eth_sendTransaction - Local Accounts: eth_sendRawTransaction Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.sendTransaction({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const hash = await client.sendTransaction({ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', value: 1000000000000000000n, })
walletClient.signMessage(args: SignMessageParameters<undefined | Account>) => Promise<`0x${string}`>Calculates an Ethereum-specific signature in EIP-191 format: keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)). - Docs: https://viem.sh/docs/actions/wallet/signMessage - JSON-RPC Methods: - JSON-RPC Accounts: personal_sign - Local Accounts: Signs locally. No JSON-RPC request. With the calculated signature, you can: - use verifyMessage to verify the signature, - use recoverMessageAddress to recover the signing address from a signature. Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signMessage({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', message: 'hello world', }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signMessage({ message: 'hello world', })
walletClient.signTransaction<TChainOverride>(args: SignTransactionParameters<undefined | Chain, undefined | Account, TChainOverride>) => Promise<`0x02${string}` | `0x01${string}` | `0x03${string}` | TransactionSerializedLegacy>Signs a transaction. - Docs: https://viem.sh/docs/actions/wallet/signTransaction - JSON-RPC Methods: - JSON-RPC Accounts: eth_signTransaction - Local Accounts: Signs locally. No JSON-RPC request. Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: custom(window.ethereum), }) const request = await client.prepareTransactionRequest({ to: '0x0000000000000000000000000000000000000000', value: 1n, }) const signature = await client.signTransaction(request)
walletClient.signTypedData<TTypedData, TPrimaryType>(args: SignTypedDataParameters<TTypedData, TPrimaryType, undefined | Account>) => Promise<`0x${string}`>Signs typed data and calculates an Ethereum-specific signature in EIP-191 format: keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)). - Docs: https://viem.sh/docs/actions/wallet/signTypedData - JSON-RPC Methods: - JSON-RPC Accounts: eth_signTypedData_v4 - Local Accounts: Signs locally. No JSON-RPC request. Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const signature = await client.signTypedData({ account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e', domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, }) Example ts // Account Hoisting import { createWalletClient, http } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { mainnet } from 'viem/chains' const client = createWalletClient({ account: privateKeyToAccount('0x…'), chain: mainnet, transport: http(), }) const signature = await client.signTypedData({ domain: { name: 'Ether Mail', version: '1', chainId: 1, verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', }, types: { Person: [ { name: 'name', type: 'string' }, { name: 'wallet', type: 'address' }, ], Mail: [ { name: 'from', type: 'Person' }, { name: 'to', type: 'Person' }, { name: 'contents', type: 'string' }, ], }, primaryType: 'Mail', message: { from: { name: 'Cow', wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, to: { name: 'Bob', wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, contents: 'Hello, Bob!', }, })
walletClient.switchChain(args: SwitchChainParameters) => Promise<void>Switch the target chain in a wallet. - Docs: https://viem.sh/docs/actions/wallet/switchChain - JSON-RPC Methods: eth_switchEthereumChain Example ts import { createWalletClient, custom } from 'viem' import { mainnet, optimism } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) await client.switchChain({ id: optimism.id })
walletClient.transportTransportConfig<string, EIP1193RequestFn> & Record<string, any>The RPC transport
walletClient.typestringThe type of client.
walletClient.uidstringA unique ID for the client.
walletClient.watchAsset(args: WatchAssetParams) => Promise<boolean>Adds an EVM chain to the wallet. - Docs: https://viem.sh/docs/actions/wallet/watchAsset - JSON-RPC Methods: eth_switchEthereumChain Example ts import { createWalletClient, custom } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const success = await client.watchAsset({ type: 'ERC20', options: { address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', decimals: 18, symbol: 'WETH', }, })
walletClient.writeContract<abi, functionName, args, TChainOverride>(args: WriteContractParameters<abi, functionName, args, undefined | Chain, undefined | Account, TChainOverride>) => Promise<`0x${string}`>Executes a write function on a contract. - Docs: https://viem.sh/docs/contract/writeContract - Examples: https://stackblitz.com/github/wevm/viem/tree/main/examples/contracts/writing-to-contracts A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a Transaction is needed to be broadcast in order to change the state. Internally, uses a Wallet Client to call the sendTransaction action with ABI-encoded data. Warning: The write internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to simulate the contract write with contract.simulate before you execute it. Example ts import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const hash = await client.writeContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], }) Example ts // With Validation import { createWalletClient, custom, parseAbi } from 'viem' import { mainnet } from 'viem/chains' const client = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }) const { request } = await client.simulateContract({ address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', abi: parseAbi(['function mint(uint32 tokenId) nonpayable']), functionName: 'mint', args: [69420], } const hash = await client.writeContract(request)

Returns

undefined | Signer & TypedDataSigner

An ethers.js Signer instance, or undefined if no chain is found in the WalletClient.

Defined in

sdk/src/utils/adapters.ts:51