pickGrant
pickGrant<
T>(grants,target,options):T|undefined
Defined in: claims.ts:412
The narrowest held grant that reaches target: a piece grant before a group grant, a deeper group before a
shallower one, the group key last; on a tie, the one that expires last. Grants for another network or group key,
or expired ones, or whose node does not parse, are skipped. Undefined when none reaches it: ask for a grant to that group or piece.
Takes anything carrying a verified claim, such as what openDelivery returns.
Grants are matched to one owner, never to any owner: a grant’s owner and group key id are public, so
anyone can root a grant under another wallet’s group key id. A group target names its owner. A piece
target takes it from the piece’s foc/own; a piece without one (not gated) needs options.owner. When
both are present they must match.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends object |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
grants |
readonly T[] |
target |
GrantTarget |
options |
{ chainId: bigint; now?: number; owner?: `0x${string}`; } |
options.chainId |
bigint |
options.now? |
number |
options.owner? |
`0x${string}` |
Returns
Section titled “Returns”T | undefined
Throws
Section titled “Throws”If no owner can be fixed, options.owner contradicts the piece’s foc/own, or a label is malformed.