@artblocks/abx-sdk 0.1.0-alpha.3 → 0.1.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +130 -0
- package/dist/abi/generated.d.ts +8502 -129
- package/dist/abi/generated.d.ts.map +1 -1
- package/dist/abi/generated.js +40 -22
- package/dist/abi/generated.js.map +1 -1
- package/dist/abi/index.d.ts +2645 -168
- package/dist/abi/index.d.ts.map +1 -1
- package/dist/abi/index.js +34 -7
- package/dist/abi/index.js.map +1 -1
- package/dist/anchors.d.ts +318 -0
- package/dist/anchors.d.ts.map +1 -0
- package/dist/anchors.js +701 -0
- package/dist/anchors.js.map +1 -0
- package/dist/chains.d.ts +19 -9
- package/dist/chains.d.ts.map +1 -1
- package/dist/chains.js +31 -15
- package/dist/chains.js.map +1 -1
- package/dist/chunks.d.ts +67 -26
- package/dist/chunks.d.ts.map +1 -1
- package/dist/chunks.js +82 -9
- package/dist/chunks.js.map +1 -1
- package/dist/clients.d.ts +23 -11
- package/dist/clients.d.ts.map +1 -1
- package/dist/clients.js +17 -18
- package/dist/clients.js.map +1 -1
- package/dist/create2.d.ts +84 -1
- package/dist/create2.d.ts.map +1 -1
- package/dist/create2.js +158 -2
- package/dist/create2.js.map +1 -1
- package/dist/creator-token.d.ts +132 -0
- package/dist/creator-token.d.ts.map +1 -0
- package/dist/creator-token.js +183 -0
- package/dist/creator-token.js.map +1 -0
- package/dist/deploy.d.ts +234 -14
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +289 -111
- package/dist/deploy.js.map +1 -1
- package/dist/deployments.d.ts +70 -5
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +139 -30
- package/dist/deployments.js.map +1 -1
- package/dist/deps.d.ts +123 -6
- package/dist/deps.d.ts.map +1 -1
- package/dist/deps.js +249 -7
- package/dist/deps.js.map +1 -1
- package/dist/env.d.ts +5 -4
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +20 -5
- package/dist/env.js.map +1 -1
- package/dist/errors.d.ts +94 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +126 -0
- package/dist/errors.js.map +1 -0
- package/dist/execute.d.ts +118 -0
- package/dist/execute.d.ts.map +1 -0
- package/dist/execute.js +159 -0
- package/dist/execute.js.map +1 -0
- package/dist/gateways.d.ts +79 -0
- package/dist/gateways.d.ts.map +1 -0
- package/dist/gateways.js +156 -0
- package/dist/gateways.js.map +1 -0
- package/dist/generator-document.d.ts +57 -0
- package/dist/generator-document.d.ts.map +1 -0
- package/dist/generator-document.js +123 -0
- package/dist/generator-document.js.map +1 -0
- package/dist/generator.d.ts +44 -2
- package/dist/generator.d.ts.map +1 -1
- package/dist/generator.js +29 -0
- package/dist/generator.js.map +1 -1
- package/dist/index.d.ts +18 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +48 -0
- package/dist/inspect.d.ts.map +1 -0
- package/dist/inspect.js +295 -0
- package/dist/inspect.js.map +1 -0
- package/dist/migrate.d.ts +41 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +142 -0
- package/dist/migrate.js.map +1 -0
- package/dist/mime.d.ts +11 -0
- package/dist/mime.d.ts.map +1 -0
- package/dist/mime.js +40 -0
- package/dist/mime.js.map +1 -0
- package/dist/node.d.ts +10 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +24 -0
- package/dist/node.js.map +1 -0
- package/dist/onchain-uri.d.ts +110 -0
- package/dist/onchain-uri.d.ts.map +1 -0
- package/dist/onchain-uri.js +276 -0
- package/dist/onchain-uri.js.map +1 -0
- package/dist/ops.d.ts +507 -14
- package/dist/ops.d.ts.map +1 -1
- package/dist/ops.js +850 -34
- package/dist/ops.js.map +1 -1
- package/dist/policy.d.ts +57 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +35 -0
- package/dist/policy.js.map +1 -0
- package/dist/probe.d.ts +58 -0
- package/dist/probe.d.ts.map +1 -1
- package/dist/probe.js +190 -9
- package/dist/probe.js.map +1 -1
- package/dist/reconstruct.d.ts +114 -2
- package/dist/reconstruct.d.ts.map +1 -1
- package/dist/reconstruct.js +443 -98
- package/dist/reconstruct.js.map +1 -1
- package/dist/resume.d.ts +96 -0
- package/dist/resume.d.ts.map +1 -0
- package/dist/resume.js +95 -0
- package/dist/resume.js.map +1 -0
- package/dist/script-chunks.d.ts +24 -0
- package/dist/script-chunks.d.ts.map +1 -0
- package/dist/script-chunks.js +63 -0
- package/dist/script-chunks.js.map +1 -0
- package/dist/service.d.ts +151 -9
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +103 -11
- package/dist/service.js.map +1 -1
- package/dist/spine.d.ts +47 -4
- package/dist/spine.d.ts.map +1 -1
- package/dist/spine.js +0 -0
- package/dist/spine.js.map +1 -1
- package/dist/staging.d.ts +139 -0
- package/dist/staging.d.ts.map +1 -0
- package/dist/staging.js +139 -0
- package/dist/staging.js.map +1 -0
- package/dist/token.d.ts +1 -1
- package/dist/token.js +1 -1
- package/dist/tokendata.d.ts +63 -3
- package/dist/tokendata.d.ts.map +1 -1
- package/dist/tokendata.js +81 -19
- package/dist/tokendata.js.map +1 -1
- package/dist/tokens.d.ts +119 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +317 -0
- package/dist/tokens.js.map +1 -0
- package/dist/types.d.ts +107 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/util.d.ts +74 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +106 -0
- package/dist/util.js.map +1 -0
- package/package.json +15 -6
package/dist/tokens.d.ts
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { type Address, type Hex, type PublicClient } from 'viem';
|
|
2
|
+
export interface TokenRow {
|
|
3
|
+
tokenId: string;
|
|
4
|
+
/** `null` when `ownerOf` reverts — see {@link lifecycle}, which says WHY it reverted whenever the
|
|
5
|
+
* chain gives enough evidence to tell. Always `null` on an ERC-1155 edition: an id can have many
|
|
6
|
+
* concurrent holders, and *which* holders is not chain-enumerable outside the event log (that's
|
|
7
|
+
* the indexer's job, not a head read). */
|
|
8
|
+
owner: Address | null;
|
|
9
|
+
/**
|
|
10
|
+
* Does a token exist at this id right now — from head reads alone, no event log. The same words the
|
|
11
|
+
* fold uses ({@link TokenState.lifecycle}), plus `'unknown'` for the one case where a head read
|
|
12
|
+
* genuinely cannot say and the log can:
|
|
13
|
+
*
|
|
14
|
+
* - `'live'` — `ownerOf` answered (721), or `totalSupply(id) > 0` (edition).
|
|
15
|
+
* - `'burned'` — 721 only, terminal, and *decidable at head*: `nextTokenId` is a mint frontier that
|
|
16
|
+
* only ever rises, so an id BELOW it whose `ownerOf` reverts was minted and destroyed. A listing
|
|
17
|
+
* enumerates `0 … nextTokenId - 1`, so inside that range a revert IS a burn.
|
|
18
|
+
* - `'unminted'` — 721: at or past the frontier, never issued.
|
|
19
|
+
* - `'no-live-copies'` — editions: `totalSupply(id) == 0`. **The same word the fold uses for the
|
|
20
|
+
* same id**, deliberately: the fold could distinguish never-minted from fully-burned and does not,
|
|
21
|
+
* because the distinction has no consumer (the id can mint again either way). One field name, one
|
|
22
|
+
* value per id, whichever lane produced it.
|
|
23
|
+
* - `'unknown'` — a 1/1 exposes no `nextTokenId`, so a reverting `ownerOf` there is evidence of
|
|
24
|
+
* nothing: it is equally consistent with never-minted and with burned. The log settles it; a head
|
|
25
|
+
* read must not guess. This is the *only* remaining case, and it is why the word exists.
|
|
26
|
+
*
|
|
27
|
+
* The first draft had this lane answer `'unknown'` for an edition at zero while the fold answered
|
|
28
|
+
* `'burned'` for the same id — two values under one field name, which is the sibling-drift class
|
|
29
|
+
* this repo treats as a bug (see {@link TokenState.maxSupply}'s note). Splitting `'burned'` from
|
|
30
|
+
* `'no-live-copies'` is what makes the claim true instead of aspirational.
|
|
31
|
+
*/
|
|
32
|
+
lifecycle: 'live' | 'burned' | 'unminted' | 'no-live-copies' | 'unknown';
|
|
33
|
+
/**
|
|
34
|
+
* The mint-time seed as the raw `bytes32` — exactly what `tokenData` carries. A schema is what
|
|
35
|
+
* buys a human decode and `seed` deliberately has none, so raw hex IS its canonical form.
|
|
36
|
+
* `null` ⇒ no seed set for this token (no seed source, or not minted).
|
|
37
|
+
*/
|
|
38
|
+
seed: Hex | null;
|
|
39
|
+
/**
|
|
40
|
+
* Token-scope params, decoded to their canonical strings. Contract-scope params are listed once
|
|
41
|
+
* on {@link TokenListing.contractParams} rather than repeated per row; the work sees
|
|
42
|
+
* contract ∪ token with **token winning** (see `buildTokenData`, the canonical assembly).
|
|
43
|
+
*/
|
|
44
|
+
params: Record<string, string>;
|
|
45
|
+
/** ERC-1155 editions only — this id's live supply (`totalSupply(id)`), as a decimal string.
|
|
46
|
+
* Absent on a 721 token. */
|
|
47
|
+
supply?: string;
|
|
48
|
+
/** ERC-1155 editions only — this id's current supply cap (`maxSupply(id)`; `"0"` reads as
|
|
49
|
+
* open/uncapped exactly like the contract's own convention). Absent on a 721 token. */
|
|
50
|
+
maxSupply?: string;
|
|
51
|
+
}
|
|
52
|
+
/** What an edition id's cap actually means. `closed` is the state the on-chain getter cannot express
|
|
53
|
+
* (`maxSupply(id)` returns `0` for both "never capped" and "deliberately closed") — see
|
|
54
|
+
* {@link editionCapOf}. */
|
|
55
|
+
export type EditionCap = {
|
|
56
|
+
kind: 'open';
|
|
57
|
+
} | {
|
|
58
|
+
kind: 'capped';
|
|
59
|
+
cap: string;
|
|
60
|
+
} | {
|
|
61
|
+
kind: 'closed';
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Read an edition id's cap without re-deriving the rule at each call site — the derivation this
|
|
65
|
+
* protocol got wrong twice, in opposite directions: the on-chain getter overloads `0`, and the
|
|
66
|
+
* event fold used to miss the collection default entirely.
|
|
67
|
+
*
|
|
68
|
+
* Pass a folded {@link TokenState} (from `reconstructProject`) to get all three states. Pass a
|
|
69
|
+
* head-read {@link TokenRow}, which has no `maxSupplyOverridden` because a state read cannot know
|
|
70
|
+
* it, and a `'0'` cap reads `open` — the documented on-chain convention, and the reason
|
|
71
|
+
* `IAbxEditionSupply` tells an integrator rendering a buy button to consult the log.
|
|
72
|
+
*
|
|
73
|
+
* `null` ⇒ no cap information at all (a 721 token, or a row from a projection written before
|
|
74
|
+
* `DefaultMaxSupplySet` was folded).
|
|
75
|
+
*/
|
|
76
|
+
export declare function editionCapOf(token: {
|
|
77
|
+
maxSupply?: string;
|
|
78
|
+
maxSupplyOverridden?: boolean;
|
|
79
|
+
}): EditionCap | null;
|
|
80
|
+
export interface TokenListing {
|
|
81
|
+
chainId: number;
|
|
82
|
+
address: Address;
|
|
83
|
+
/** Ids `0 … nextTokenId - 1` have been minted at some point. `null` on a token type with no
|
|
84
|
+
* sequential mint frontier — a 1/1 (always just token 0), or an ERC-1155 edition (ids are
|
|
85
|
+
* caller-named, not a cursor; see each row's own `supply`/`maxSupply` instead). */
|
|
86
|
+
nextTokenId: number | null;
|
|
87
|
+
/** Live supply (mints − burns) — differs from `nextTokenId` only if tokens were burned. `null`
|
|
88
|
+
* on an edition: there's no unconditional whole-contract total, only a per-id one (each row's
|
|
89
|
+
* `supply`). */
|
|
90
|
+
totalSupply: number | null;
|
|
91
|
+
/** How many tokens have been destroyed: `nextTokenId − totalSupply`, both of which the contract
|
|
92
|
+
* keeps (the frontier counts mints and never falls; the total counts live tokens). `null` when
|
|
93
|
+
* either is absent — a 1/1, or an edition, where burns are per id (each row's `supply`). */
|
|
94
|
+
burnedCount: number | null;
|
|
95
|
+
maxInvocations: number | null;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the contract exposes the params surface at all. `false` for the image token types
|
|
98
|
+
* (they have no Params extension), in which case every row's `seed` is `null` and `params` is
|
|
99
|
+
* empty — correct, not a failed read.
|
|
100
|
+
*/
|
|
101
|
+
hasParams: boolean;
|
|
102
|
+
/** Whether the contract exposes on-chain param *enumeration*. `false` on a project deployed
|
|
103
|
+
* before enumeration shipped: seeds still read (by name), but params can't be listed. */
|
|
104
|
+
hasParamEnumeration: boolean;
|
|
105
|
+
contractParams: Record<string, string>;
|
|
106
|
+
tokens: TokenRow[];
|
|
107
|
+
}
|
|
108
|
+
export interface ListTokensOptions {
|
|
109
|
+
/** Read only this many ids from `from` (default: all). */
|
|
110
|
+
limit?: number;
|
|
111
|
+
/** First token id to read (default 0). */
|
|
112
|
+
from?: number;
|
|
113
|
+
concurrency?: number;
|
|
114
|
+
/** Called after each token resolves — for a progress line on a large collection. */
|
|
115
|
+
onProgress?: (done: number, total: number) => void;
|
|
116
|
+
}
|
|
117
|
+
/** Every token's owner, seed, and params, straight from the contract. */
|
|
118
|
+
export declare function listTokens(client: PublicClient, address: Address, opts?: ListTokensOptions): Promise<TokenListing>;
|
|
119
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,YAAY,EAAC,MAAM,MAAM,CAAC;AA+B5E,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB;;;+CAG2C;IAC3C,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACrB;;;;;;;;;;;;;;;;;;;;;;MAsBE;IACH,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,gBAAgB,GAAG,SAAS,CAAC;IACzE;;;;OAIG;IACH,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;IACjB;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B;iCAC6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;4FACwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;4BAE4B;AAC5B,MAAM,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iBAAsB,GAC3B,OAAO,CAAC,YAAY,CAAC,CAwGvB"}
|
package/dist/tokens.js
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { zeroAddress } from 'viem';
|
|
2
|
+
import { editionCodeAbi, seriesCodeAbi } from './abi/index.js';
|
|
3
|
+
import { readParamSchema } from './ops.js';
|
|
4
|
+
import { AUTH_OPTIONS, decodeTag, encodeTag, PARAM_TYPES } from './spine.js';
|
|
5
|
+
import { decodeParam } from './tokendata.js';
|
|
6
|
+
/**
|
|
7
|
+
* The whole collection's tokens — seeds, owners, and params — read **from chain alone**.
|
|
8
|
+
*
|
|
9
|
+
* No indexer projection, no event scan, no running resolver: every input is a plain `eth_call`
|
|
10
|
+
* against the token contract, because the params store maintains its own key lists inside its
|
|
11
|
+
* write paths (`tokenParamKeys` / `contractParamKeys`) and the seed is just a reserved param.
|
|
12
|
+
* That matters for the question this answers — *for a generative collection the seed list IS the
|
|
13
|
+
* collection* — since it means the answer is available to anyone with an RPC URL, including
|
|
14
|
+
* before any indexing has happened, and it can never disagree with the chain.
|
|
15
|
+
*
|
|
16
|
+
* Deliberately not built on {@link reconstructProject}: that folds the event spine (a `getLogs`
|
|
17
|
+
* range scan, which a range-capped RPC can refuse) to recover *structure*. Here every value
|
|
18
|
+
* wanted is a head read, so a scan would be strictly more fragile for strictly less.
|
|
19
|
+
*/
|
|
20
|
+
/** The reserved param the seed source writes at mint. Never in the enumerable key lists (every
|
|
21
|
+
* consumer reads it as a tokenData coordinate), so it is read by name. */
|
|
22
|
+
const SEED_KEY = 'seed';
|
|
23
|
+
/** How many tokens to read concurrently. Each token costs ~2 + (params) `eth_call`s, so a
|
|
24
|
+
* 1000-token collection is a few thousand reads — wide enough to be quick, narrow enough that a
|
|
25
|
+
* free-tier RPC doesn't rate-limit. */
|
|
26
|
+
const DEFAULT_CONCURRENCY = 8;
|
|
27
|
+
/**
|
|
28
|
+
* Read an edition id's cap without re-deriving the rule at each call site — the derivation this
|
|
29
|
+
* protocol got wrong twice, in opposite directions: the on-chain getter overloads `0`, and the
|
|
30
|
+
* event fold used to miss the collection default entirely.
|
|
31
|
+
*
|
|
32
|
+
* Pass a folded {@link TokenState} (from `reconstructProject`) to get all three states. Pass a
|
|
33
|
+
* head-read {@link TokenRow}, which has no `maxSupplyOverridden` because a state read cannot know
|
|
34
|
+
* it, and a `'0'` cap reads `open` — the documented on-chain convention, and the reason
|
|
35
|
+
* `IAbxEditionSupply` tells an integrator rendering a buy button to consult the log.
|
|
36
|
+
*
|
|
37
|
+
* `null` ⇒ no cap information at all (a 721 token, or a row from a projection written before
|
|
38
|
+
* `DefaultMaxSupplySet` was folded).
|
|
39
|
+
*/
|
|
40
|
+
export function editionCapOf(token) {
|
|
41
|
+
if (token.maxSupply === undefined)
|
|
42
|
+
return null;
|
|
43
|
+
if (token.maxSupply !== '0')
|
|
44
|
+
return { kind: 'capped', cap: token.maxSupply };
|
|
45
|
+
return token.maxSupplyOverridden ? { kind: 'closed' } : { kind: 'open' };
|
|
46
|
+
}
|
|
47
|
+
/** Minimal ERC-165 fragment — shared by any capability check that only needs `supportsInterface`
|
|
48
|
+
* (no need to pull in a whole token ABI just for this one function). */
|
|
49
|
+
const ERC165_PROBE_ABI = [
|
|
50
|
+
{
|
|
51
|
+
type: 'function',
|
|
52
|
+
name: 'supportsInterface',
|
|
53
|
+
stateMutability: 'view',
|
|
54
|
+
inputs: [{ name: 'interfaceId', type: 'bytes4' }],
|
|
55
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
/** The standard's own ERC-165 id — the cheapest capability check that can never collide with a
|
|
59
|
+
* 721 token (which doesn't implement ERC-1155 at all, so this reverts/returns false there). */
|
|
60
|
+
const ERC1155_INTERFACE_ID = '0xd9b67a26';
|
|
61
|
+
/** Whether `address` is an ERC-1155 edition (vs. the 721 family) — the probe {@link listTokens}
|
|
62
|
+
* branches on before choosing its read path. */
|
|
63
|
+
async function probeIsEdition(client, address) {
|
|
64
|
+
try {
|
|
65
|
+
return (await client.readContract({
|
|
66
|
+
address,
|
|
67
|
+
abi: ERC165_PROBE_ABI,
|
|
68
|
+
functionName: 'supportsInterface',
|
|
69
|
+
args: [ERC1155_INTERFACE_ID],
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/** Every token's owner, seed, and params, straight from the contract. */
|
|
77
|
+
export async function listTokens(client, address, opts = {}) {
|
|
78
|
+
if (await probeIsEdition(client, address))
|
|
79
|
+
return listEditionTokens(client, address, opts);
|
|
80
|
+
const read = async (functionName, args = []) => {
|
|
81
|
+
try {
|
|
82
|
+
// dynamic dispatch over the superset ABI — cast past viem's literal-name inference. Every
|
|
83
|
+
// getter here is absent on at least one token type, so the try/catch IS the capability probe.
|
|
84
|
+
return (await client.readContract({ address, abi: seriesCodeAbi, functionName, args }));
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return null; // absent on this token type, or an unminted id — the caller decides what that means
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const [chainId, nextTokenId, totalSupply, maxInvocations, contractKeys] = await Promise.all([
|
|
91
|
+
client.getChainId(),
|
|
92
|
+
read('nextTokenId'),
|
|
93
|
+
read('totalSupply'),
|
|
94
|
+
read('maxInvocations'),
|
|
95
|
+
read('contractParamKeys'),
|
|
96
|
+
]);
|
|
97
|
+
// The params surface is probed by a read that only a params-bearing token answers. `seed` is the
|
|
98
|
+
// cheapest such probe that works on a LEGACY project too (deployed before enumeration shipped),
|
|
99
|
+
// so the two capabilities are detected separately rather than collapsed.
|
|
100
|
+
const seedProbe = await read('tokenParam', [0n, encodeTag(SEED_KEY)]);
|
|
101
|
+
const hasParams = seedProbe !== null || contractKeys !== null;
|
|
102
|
+
const hasParamEnumeration = contractKeys !== null;
|
|
103
|
+
// Schemas are read once per key and shared across every token — on a 1000-token collection this
|
|
104
|
+
// is the difference between one read per key and one per key PER TOKEN.
|
|
105
|
+
const schemaCache = new Map();
|
|
106
|
+
const schemaOf = (key) => {
|
|
107
|
+
let hit = schemaCache.get(key);
|
|
108
|
+
if (!hit) {
|
|
109
|
+
hit = schemaFor(client, address, key);
|
|
110
|
+
schemaCache.set(key, hit);
|
|
111
|
+
}
|
|
112
|
+
return hit;
|
|
113
|
+
};
|
|
114
|
+
const contractParams = {};
|
|
115
|
+
for (const raw of contractKeys ?? []) {
|
|
116
|
+
const key = decodeTag(raw);
|
|
117
|
+
const slot = await read('contractParam', [raw]);
|
|
118
|
+
if (!slot?.[2])
|
|
119
|
+
continue; // not set
|
|
120
|
+
const p = { key, value: slot[0], valueIsHash: slot[1], updatedBy: address };
|
|
121
|
+
contractParams[key] = (await decodeParam(client, address, '0', p, false, await schemaOf(key))).value;
|
|
122
|
+
}
|
|
123
|
+
// The id range — an ID SPACE, never a live count. `nextTokenId` is the mint frontier; a token type
|
|
124
|
+
// without one is a 1/1, whose id space is token 0 alone and stays that way forever.
|
|
125
|
+
//
|
|
126
|
+
// This used to fall back to `totalSupply`, which is live (mints − burns): burn a 1/1's only token
|
|
127
|
+
// and the listing enumerated ZERO ids, so `abx tokens` on a burned 1/1 printed nothing at all —
|
|
128
|
+
// indistinguishable from a collection with no tokens, when the honest answer is one id whose state
|
|
129
|
+
// the chain cannot pin down (see {@link TokenRow.lifecycle}'s `'unknown'`). Found by burning a real
|
|
130
|
+
// token on Sepolia rather than by a fixture, which is the only way this one shows up.
|
|
131
|
+
const count = nextTokenId !== null ? Number(nextTokenId) : 1;
|
|
132
|
+
const from = Math.max(0, opts.from ?? 0);
|
|
133
|
+
const end = opts.limit === undefined ? count : Math.min(count, from + Math.max(0, opts.limit));
|
|
134
|
+
const ids = Array.from({ length: Math.max(0, end - from) }, (_, i) => from + i);
|
|
135
|
+
let done = 0;
|
|
136
|
+
const tokens = await pool(ids, opts.concurrency ?? DEFAULT_CONCURRENCY, async (id) => {
|
|
137
|
+
const tokenId = String(id);
|
|
138
|
+
const [owner, seedSlot, keys] = await Promise.all([
|
|
139
|
+
read('ownerOf', [BigInt(id)]),
|
|
140
|
+
hasParams ? read('tokenParam', [BigInt(id), encodeTag(SEED_KEY)]) : null,
|
|
141
|
+
hasParamEnumeration ? read('tokenParamKeys', [BigInt(id)]) : null,
|
|
142
|
+
]);
|
|
143
|
+
const params = {};
|
|
144
|
+
for (const raw of keys ?? []) {
|
|
145
|
+
const key = decodeTag(raw);
|
|
146
|
+
const slot = await read('tokenParam', [BigInt(id), raw]);
|
|
147
|
+
if (!slot?.[2])
|
|
148
|
+
continue;
|
|
149
|
+
const p = { key, value: slot[0], valueIsHash: slot[1], updatedBy: address };
|
|
150
|
+
params[key] = (await decodeParam(client, address, tokenId, p, true, await schemaOf(key))).value;
|
|
151
|
+
}
|
|
152
|
+
opts.onProgress?.(++done, ids.length);
|
|
153
|
+
// With a frontier, a missing owner below it is a burn — without one (a 1/1), it is not evidence.
|
|
154
|
+
const lifecycle = owner
|
|
155
|
+
? 'live'
|
|
156
|
+
: nextTokenId === null
|
|
157
|
+
? 'unknown'
|
|
158
|
+
: BigInt(id) < nextTokenId
|
|
159
|
+
? 'burned'
|
|
160
|
+
: 'unminted';
|
|
161
|
+
return { tokenId, owner, lifecycle, seed: seedSlot?.[2] ? seedSlot[0] : null, params };
|
|
162
|
+
});
|
|
163
|
+
return {
|
|
164
|
+
chainId,
|
|
165
|
+
address,
|
|
166
|
+
nextTokenId: nextTokenId === null ? null : Number(nextTokenId),
|
|
167
|
+
totalSupply: totalSupply === null ? null : Number(totalSupply),
|
|
168
|
+
burnedCount: nextTokenId === null || totalSupply === null ? null : Number(nextTokenId - totalSupply),
|
|
169
|
+
maxInvocations: maxInvocations === null ? null : Number(maxInvocations),
|
|
170
|
+
hasParams,
|
|
171
|
+
hasParamEnumeration,
|
|
172
|
+
contractParams,
|
|
173
|
+
tokens,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* The edition (ERC-1155) path {@link listTokens} delegates to once {@link probeIsEdition} says
|
|
178
|
+
* yes — a parallel implementation, not a set of `if (isEdition)` branches threaded through the
|
|
179
|
+
* 721 path above, so that path stays byte-identical. Reads against `editionCodeAbi` (the
|
|
180
|
+
* narrowest-common-superset ABI for the family, same role `seriesCodeAbi` plays on the 721
|
|
181
|
+
* side): per id, `totalSupply(id)`/`maxSupply(id)` instead of `ownerOf` — `owner` is always
|
|
182
|
+
* `null` here (a multi-holder id has no single owner, and *which* holders isn't chain-enumerable
|
|
183
|
+
* outside the event log). `params`/`seed` still apply — EditionCode composes the same Params/
|
|
184
|
+
* ConfigurableParams extensions as SeriesCode, unchanged — but are absent (every read reverts,
|
|
185
|
+
* same honest "absent" answer as a 1/1 image) on `OneOfOneEdition`/`EditionImage`.
|
|
186
|
+
*/
|
|
187
|
+
async function listEditionTokens(client, address, opts) {
|
|
188
|
+
const read = async (functionName, args = []) => {
|
|
189
|
+
try {
|
|
190
|
+
return (await client.readContract({ address, abi: editionCodeAbi, functionName, args }));
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
const [chainId, maxInvocations, contractKeys] = await Promise.all([
|
|
197
|
+
client.getChainId(),
|
|
198
|
+
read('maxInvocations'), // absent on OneOfOneEdition — its id space is fixed to {0}
|
|
199
|
+
read('contractParamKeys'),
|
|
200
|
+
]);
|
|
201
|
+
const seedProbe = await read('tokenParam', [0n, encodeTag(SEED_KEY)]);
|
|
202
|
+
const hasParams = seedProbe !== null || contractKeys !== null;
|
|
203
|
+
const hasParamEnumeration = contractKeys !== null;
|
|
204
|
+
const schemaCache = new Map();
|
|
205
|
+
const schemaOf = (key) => {
|
|
206
|
+
let hit = schemaCache.get(key);
|
|
207
|
+
if (!hit) {
|
|
208
|
+
hit = schemaFor(client, address, key);
|
|
209
|
+
schemaCache.set(key, hit);
|
|
210
|
+
}
|
|
211
|
+
return hit;
|
|
212
|
+
};
|
|
213
|
+
const contractParams = {};
|
|
214
|
+
for (const raw of contractKeys ?? []) {
|
|
215
|
+
const key = decodeTag(raw);
|
|
216
|
+
const slot = await read('contractParam', [raw]);
|
|
217
|
+
if (!slot?.[2])
|
|
218
|
+
continue;
|
|
219
|
+
const p = { key, value: slot[0], valueIsHash: slot[1], updatedBy: address };
|
|
220
|
+
contractParams[key] = (await decodeParam(client, address, '0', p, false, await schemaOf(key))).value;
|
|
221
|
+
}
|
|
222
|
+
// The id space: the id-space cap (`maxInvocations`) when the token has one (EditionImage/
|
|
223
|
+
// EditionCode); `OneOfOneEdition` has no id-space extension at all — its id space is the
|
|
224
|
+
// single work, id 0 alone (mirrors the 1/1 count fallback on the 721 path above).
|
|
225
|
+
const count = maxInvocations !== null ? Number(maxInvocations) : 1;
|
|
226
|
+
const from = Math.max(0, opts.from ?? 0);
|
|
227
|
+
const end = opts.limit === undefined ? count : Math.min(count, from + Math.max(0, opts.limit));
|
|
228
|
+
const ids = Array.from({ length: Math.max(0, end - from) }, (_, i) => from + i);
|
|
229
|
+
let done = 0;
|
|
230
|
+
const tokens = await pool(ids, opts.concurrency ?? DEFAULT_CONCURRENCY, async (id) => {
|
|
231
|
+
const tokenId = String(id);
|
|
232
|
+
const [supply, maxSupply, seedSlot, keys] = await Promise.all([
|
|
233
|
+
read('totalSupply', [BigInt(id)]),
|
|
234
|
+
read('maxSupply', [BigInt(id)]),
|
|
235
|
+
hasParams ? read('tokenParam', [BigInt(id), encodeTag(SEED_KEY)]) : null,
|
|
236
|
+
hasParamEnumeration ? read('tokenParamKeys', [BigInt(id)]) : null,
|
|
237
|
+
]);
|
|
238
|
+
const params = {};
|
|
239
|
+
for (const raw of keys ?? []) {
|
|
240
|
+
const key = decodeTag(raw);
|
|
241
|
+
const slot = await read('tokenParam', [BigInt(id), raw]);
|
|
242
|
+
if (!slot?.[2])
|
|
243
|
+
continue;
|
|
244
|
+
const p = { key, value: slot[0], valueIsHash: slot[1], updatedBy: address };
|
|
245
|
+
params[key] = (await decodeParam(client, address, tokenId, p, true, await schemaOf(key))).value;
|
|
246
|
+
}
|
|
247
|
+
opts.onProgress?.(++done, ids.length);
|
|
248
|
+
return {
|
|
249
|
+
tokenId,
|
|
250
|
+
owner: null, // not chain-enumerable for a multi-holder id — indexer territory
|
|
251
|
+
// Zero live copies. The fold says exactly this for the same id (it declines to spend its extra
|
|
252
|
+
// history knowledge on a distinction with no consumer), so the two lanes agree by construction
|
|
253
|
+
// rather than by a docstring promising they do.
|
|
254
|
+
lifecycle: (supply ?? 0n) > 0n ? 'live' : 'no-live-copies',
|
|
255
|
+
seed: seedSlot?.[2] ? seedSlot[0] : null,
|
|
256
|
+
params,
|
|
257
|
+
supply: supply === null ? undefined : supply.toString(),
|
|
258
|
+
maxSupply: maxSupply === null ? undefined : maxSupply.toString(),
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
return {
|
|
262
|
+
chainId,
|
|
263
|
+
address,
|
|
264
|
+
nextTokenId: null, // editions have no sequential mint cursor — ids are caller-named
|
|
265
|
+
totalSupply: null, // no unconditional whole-contract total; supply is per id (see each row)
|
|
266
|
+
burnedCount: null, // per id, not per contract — and undecidable at head anyway (see each row)
|
|
267
|
+
maxInvocations: maxInvocations === null ? null : Number(maxInvocations),
|
|
268
|
+
hasParams,
|
|
269
|
+
hasParamEnumeration,
|
|
270
|
+
contractParams,
|
|
271
|
+
tokens,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* One key's declared schema in the shape {@link decodeParam} wants, or `undefined` when the key is
|
|
276
|
+
* un-governed or the contract has no schema surface. A schema-less param is a normal, supported
|
|
277
|
+
* state — its value simply stays raw, which is exactly what `seed` relies on.
|
|
278
|
+
*
|
|
279
|
+
* Delegates the read to {@link readParamSchema} (the one implementation, which also backs the
|
|
280
|
+
* read-modify-write in `set-schema`) and only maps its numeric enums onto their canonical names.
|
|
281
|
+
*/
|
|
282
|
+
async function schemaFor(client, address, key) {
|
|
283
|
+
try {
|
|
284
|
+
const s = await readParamSchema(client, address, key);
|
|
285
|
+
if (!s.exists)
|
|
286
|
+
return undefined;
|
|
287
|
+
return {
|
|
288
|
+
key,
|
|
289
|
+
paramType: PARAM_TYPES[s.paramType] ?? String(s.paramType),
|
|
290
|
+
auth: AUTH_OPTIONS[s.auth] ?? String(s.auth),
|
|
291
|
+
authAddress: s.authAddress === zeroAddress ? null : s.authAddress,
|
|
292
|
+
lockAfter: String(s.lockAfter),
|
|
293
|
+
min: s.min,
|
|
294
|
+
max: s.max,
|
|
295
|
+
selectOptions: s.selectOptions,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
return undefined; // no schema surface on this token type
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/** Bounded-concurrency map, order-preserving. */
|
|
303
|
+
async function pool(items, width, fn) {
|
|
304
|
+
const out = new Array(items.length);
|
|
305
|
+
let next = 0;
|
|
306
|
+
const workers = Array.from({ length: Math.max(1, Math.min(width, items.length)) }, async () => {
|
|
307
|
+
for (;;) {
|
|
308
|
+
const i = next++;
|
|
309
|
+
if (i >= items.length)
|
|
310
|
+
return;
|
|
311
|
+
out[i] = await fn(items[i]);
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
await Promise.all(workers);
|
|
315
|
+
return out;
|
|
316
|
+
}
|
|
317
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAA4C,MAAM,MAAM,CAAC;AAC5E,OAAO,EAAC,cAAc,EAAE,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AACzC,OAAO,EAAC,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AAC3E,OAAO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,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;YAC9B,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,aAAa,EAAE,CAAC,CAAC,aAAa;SAC/B,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC,CAAC,uCAAuC;IAC3D,CAAC;AACH,CAAC;AAED,iDAAiD;AACjD,KAAK,UAAU,IAAI,CAAO,KAAU,EAAE,KAAa,EAAE,EAA2B;IAC9E,MAAM,GAAG,GAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAC,EAAE,KAAK,IAAI,EAAE;QAC1F,SAAS,CAAC;YACR,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;YACjB,IAAI,CAAC,IAAI,KAAK,CAAC,MAAM;gBAAE,OAAO;YAC9B,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface ExtensionInfo {
|
|
|
8
8
|
/**
|
|
9
9
|
* One on-chain metadata value, decoded from the spine: a `field` (the *what*, e.g.
|
|
10
10
|
* "image") carried in a `representation` (the *how*, e.g. "inline" / "keccak256" /
|
|
11
|
-
* "arweave"). See the protocol registry (
|
|
11
|
+
* "arweave"). See the protocol registry (site/content/docs/protocol/metadata.mdx).
|
|
12
12
|
*/
|
|
13
13
|
export interface MetadataField {
|
|
14
14
|
field: string;
|
|
@@ -33,11 +33,18 @@ export interface ParamSchema {
|
|
|
33
33
|
max: Hex;
|
|
34
34
|
selectOptions: string[];
|
|
35
35
|
}
|
|
36
|
-
/** The three param lifecycle hooks (any may be null = none). */
|
|
36
|
+
/** The three param lifecycle hooks (any may be null = none), plus whether the set is frozen. */
|
|
37
37
|
export interface ParamHooks {
|
|
38
38
|
configureHook: Address | null;
|
|
39
39
|
augmentHook: Address | null;
|
|
40
|
+
/** Ownership-change lifecycle — a **VETO**: its revert fails the transfer, and a mint is a
|
|
41
|
+
* transfer from `0x0`, so a reverting hook also stops minting. Read `locked` next to it. */
|
|
40
42
|
transferHook: Address | null;
|
|
43
|
+
/** `lockParamHooks()` was sent: the three addresses above can never change again. The read that
|
|
44
|
+
* turns "the hooks are whatever the owner currently says" into something a buyer can verify —
|
|
45
|
+
* it matters most for `transferHook`, an unlocked one being a standing power over a collector's
|
|
46
|
+
* ability to sell. Folded from `ParamHooksFrozen`. */
|
|
47
|
+
locked: boolean;
|
|
41
48
|
}
|
|
42
49
|
/** One declared code dependency (Dependencies extension); index 0 = the runtime. */
|
|
43
50
|
export interface DependencyInfo {
|
|
@@ -71,13 +78,76 @@ export interface SpineEvent {
|
|
|
71
78
|
}
|
|
72
79
|
export interface TokenState {
|
|
73
80
|
tokenId: string;
|
|
74
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Does a token exist at this id **right now** — the one question a consumer is actually asking.
|
|
83
|
+
*
|
|
84
|
+
* - `'unminted'` — ERC-721: a valid id never issued (the deployed-but-unminted state a resolver
|
|
85
|
+
* serves warming metadata for). Valid state, not a gap.
|
|
86
|
+
* - `'live'` — a token exists: a 721 with a holder, or an edition id with `supply > 0`.
|
|
87
|
+
* - `'burned'` — **terminal, and ERC-721 only.** The id was issued and destroyed, the contract
|
|
88
|
+
* disowns it (`tokenURI` reverts `NonexistentToken`), and it can never come back: ABX mints from
|
|
89
|
+
* a monotonic `nextTokenId`, so no mint path can reissue that id. This is the word a consumer
|
|
90
|
+
* may act on irreversibly — drop it from a gallery, answer `410 Gone`.
|
|
91
|
+
* - `'no-live-copies'` — **ERC-1155 editions only, and never terminal.** Zero live copies of this
|
|
92
|
+
* id right now: never minted, or every copy burned, or minted and fully burned twice over. It
|
|
93
|
+
* makes no claim about history *because the two have no different consequence* — the id can mint
|
|
94
|
+
* again either way, so anything that treats it as gone forever is wrong. `supply`/`holders`
|
|
95
|
+
* carry the numbers; the event log carries the history.
|
|
96
|
+
*
|
|
97
|
+
* **Why `'burned'` is not shared across the standards**, though the first draft of this enum shared
|
|
98
|
+
* it: the correct response to destruction differs by standard, so one word covering both put every
|
|
99
|
+
* consumer one forgotten branch away from serving `410 Gone` for an edition id that can mint again.
|
|
100
|
+
* Splitting the word moves the rule out of prose that must be
|
|
101
|
+
* remembered and into the type: **`lifecycle === 'burned'` is safe to treat as permanent on either
|
|
102
|
+
* standard, with no carve-out**, which is the only version of this rule that survives a refactor.
|
|
103
|
+
*
|
|
104
|
+
* It replaced a `minted: boolean` that latched `true` at mint and was never recomputed on the 721
|
|
105
|
+
* lane, so a burned token reconstructed as live, held by `0x0`. "Was it ever issued" is
|
|
106
|
+
* `lifecycle !== 'unminted'` on a 721; on an edition, ask the log.
|
|
107
|
+
*/
|
|
108
|
+
lifecycle: 'unminted' | 'live' | 'burned' | 'no-live-copies';
|
|
109
|
+
/** 721 only — the current holder; `null` when `'unminted'` or `'burned'` (a destroyed token has
|
|
110
|
+
* no holder — the zero address is never written here, so this field never has to be read as a
|
|
111
|
+
* sentinel). Always `null` for an edition (an id can have many concurrent holders; see
|
|
112
|
+
* {@link holders}). */
|
|
75
113
|
owner: Address | null;
|
|
76
114
|
tokenURI: string | null;
|
|
77
115
|
fields: MetadataField[];
|
|
78
116
|
lockedFields: string[];
|
|
79
117
|
/** Token-scope params (Params extension) — `seed`, PostParam values, … Absent/empty ⇒ none. */
|
|
80
118
|
params?: ParamValue[];
|
|
119
|
+
/** ERC-1155 editions only — total live copies of this id (minted − burned), folded from
|
|
120
|
+
* `TransferSingle`/`TransferBatch`. Absent for a 721 token. */
|
|
121
|
+
supply?: string;
|
|
122
|
+
/**
|
|
123
|
+
* ERC-1155 editions only — this id's **effective** supply cap: its own override when one exists,
|
|
124
|
+
* otherwise the collection default ({@link ProjectState.defaultMaxSupply}). Absent for a 721
|
|
125
|
+
* token. Equals the on-chain `maxSupply(id)` view, and therefore its head-read twin
|
|
126
|
+
* (`TokenRow.maxSupply` in `tokens.ts`) — one field name, one meaning, whichever lane produced it.
|
|
127
|
+
*
|
|
128
|
+
* It used to fold `MaxSupplyUpdated` alone, which made the two lanes disagree on the DEFAULT
|
|
129
|
+
* shape: `--copies 10` sets the cap at `initialize` and never calls `setMaxSupply`, so no id had
|
|
130
|
+
* an event of its own and this read *absent* — "open, uncapped" — for every capped edition ever
|
|
131
|
+
* deployed. The head read said `10`. That is the sibling-drift class, on the field that decides
|
|
132
|
+
* whether a buy button renders.
|
|
133
|
+
*
|
|
134
|
+
* `'0'` carries the on-chain overload deliberately: **open** when {@link maxSupplyOverridden} is
|
|
135
|
+
* false, **closed forever** when it is true.
|
|
136
|
+
*/
|
|
137
|
+
maxSupply?: string;
|
|
138
|
+
/** ERC-1155 editions only — has this id ever been explicitly overridden (`setMaxSupply`)? The
|
|
139
|
+
* distinction the on-chain getter cannot make and the log can, now that `DefaultMaxSupplySet`
|
|
140
|
+
* completes the log: it disambiguates a `'0'` cap (open vs deliberately closed) and tells you
|
|
141
|
+
* whether the monotonic never-increase rule is already in force for this id. Absent ⇒ false. */
|
|
142
|
+
maxSupplyOverridden?: boolean;
|
|
143
|
+
/** ERC-1155 editions only — current balances by holder address, folded from
|
|
144
|
+
* `TransferSingle`/`TransferBatch`. Zero balances are deleted, so a key's presence IS "holds
|
|
145
|
+
* at least one copy." Omitted/empty when unknown (a 721 token, or an edition with no folded
|
|
146
|
+
* history). Not chain-enumerable outside the event log — this is why {@link owner} can't
|
|
147
|
+
* simply generalize to "the current holders": a chain-only head read (no event scan) has no
|
|
148
|
+
* way to list them (see `tokens.ts`'s `listTokens`, which is exactly that head-read-only path
|
|
149
|
+
* and therefore never populates this field). */
|
|
150
|
+
holders?: Record<Address, string>;
|
|
81
151
|
}
|
|
82
152
|
/**
|
|
83
153
|
* The full reconstructed state of an ABX project — rebuilt from the event log
|
|
@@ -102,16 +172,48 @@ export interface ProjectState {
|
|
|
102
172
|
receiver: Address;
|
|
103
173
|
bps: number;
|
|
104
174
|
} | null;
|
|
175
|
+
/**
|
|
176
|
+
* The royalty **ceiling** — owner-set at deploy, reduce-only forever after, folded from
|
|
177
|
+
* `MaxRoyaltyBpsUpdated` (last-writer-wins, so a later `reduceMaxRoyaltyBps` beats the deploy-time
|
|
178
|
+
* value). Tri-state, and the third state carries weight: `null` means **the spine never stated
|
|
179
|
+
* one** — an implementation with no `maxRoyaltyBps()` at all — which is a different fact from a
|
|
180
|
+
* collection that published a ceiling of 1000. Never report a default for a ceiling the contract
|
|
181
|
+
* never published.
|
|
182
|
+
*
|
|
183
|
+
* Deliberately NOT nested inside {@link royalty}: clearing the royalty to `(0x0, 0)` sets that
|
|
184
|
+
* field to `null`, and the ceiling survives that on chain — nesting would drop a still-binding
|
|
185
|
+
* fact. Present them together in any readout, though: a rate without its ceiling is half the fact
|
|
186
|
+
* (a ceiling above the live rate means the owner can raise the rate unilaterally, and a buyer
|
|
187
|
+
* cannot see that from a listing — so reducing the cap to the current rate is what turns "5%
|
|
188
|
+
* today" into a promise).
|
|
189
|
+
*/
|
|
190
|
+
maxRoyaltyBps?: number | null;
|
|
191
|
+
/**
|
|
192
|
+
* Did this collection opt into burning (`BurnConfigured`, emitted once at deploy and fixed
|
|
193
|
+
* thereafter)? Tri-state on the same rule as {@link maxRoyaltyBps}: `null` = the spine never
|
|
194
|
+
* stated it, which is not `false`. An implementation predating the opt-in has no `burn`
|
|
195
|
+
* entrypoint at all; a collection with `burnable: false` has one that refuses.
|
|
196
|
+
*/
|
|
197
|
+
burnable?: boolean | null;
|
|
105
198
|
tokenURIRenderer: Address | null;
|
|
106
199
|
tokenURILocked: boolean | null;
|
|
107
200
|
contractURIRenderer: Address | null;
|
|
108
201
|
contractURILocked: boolean | null;
|
|
109
202
|
collectionFields: MetadataField[];
|
|
110
203
|
lockedCollectionFields: string[];
|
|
111
|
-
/** Which concrete token type this is, inferred from the enabled extensions.
|
|
112
|
-
|
|
204
|
+
/** Which concrete token type this is, inferred from the enabled extensions. The `-edition`
|
|
205
|
+
* suffix is the ERC-1155 family (detected via the Edition Supply extension), a parallel
|
|
206
|
+
* ladder to the ERC-721 one: `1of1-edition` ↔ `1of1`, `edition` ↔ `series`,
|
|
207
|
+
* `edition-code` ↔ `code`. */
|
|
208
|
+
contractType?: '1of1' | 'series' | 'code' | '1of1-edition' | 'edition' | 'edition-code';
|
|
113
209
|
/** Supply cap "X of Y" (Max Invocations extension); null/absent ⇒ uncapped 1/1. */
|
|
114
210
|
maxInvocations?: string | null;
|
|
211
|
+
/** ERC-1155 editions only — the collection-wide DEFAULT per-id cap (`editionSize` at
|
|
212
|
+
* `initialize`), folded from `DefaultMaxSupplySet`. `'0'` ⇒ open by default; null ⇒ not an
|
|
213
|
+
* edition. The 1155 analogue of {@link maxInvocations}: it is the project-level ceiling, while
|
|
214
|
+
* {@link TokenState.maxSupply} is a single id's. Every id that has never been overridden carries
|
|
215
|
+
* this, which is why the event exists — see `IAbxEditionSupply`. */
|
|
216
|
+
defaultMaxSupply?: string | null;
|
|
115
217
|
/** The single authorized minter (External Minter extension); null ⇒ owner-only. */
|
|
116
218
|
minter?: Address | null;
|
|
117
219
|
/** Whether minting is paused (Paused extension) — true ⇒ owner-only. Absent/false ⇒ open. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAA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