@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
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { Address, Hex, PublicClient } from 'viem';
|
|
2
|
+
import { type ChunkStoreEvent, type ContentTxPlan } from './chunks.js';
|
|
3
|
+
import type { SendTx } from './execute.js';
|
|
4
|
+
/**
|
|
5
|
+
* Content staging — putting a field's bytes on-chain behind the shared multi-chunk store/reader
|
|
6
|
+
* (`AbxChunkStore`), the SDK-native counterpart of {@link ChunkStoreEvent}'s bootstrap: this module
|
|
7
|
+
* layers the *content* side (plan → resolve a store → write chunks → encode the `reader` value) on
|
|
8
|
+
* top of `chunks.ts`'s primitives (`planChunks`/`planContentTxs`/`stageContent`/`ensureChunkStore`)
|
|
9
|
+
* and `token.ts`'s `encodeReader`, so an integrator gets ONE call instead of hand-wiring all four —
|
|
10
|
+
* the same reasoning `ensureChunkStore`'s own doc comment gives for the store half.
|
|
11
|
+
*
|
|
12
|
+
* `gzip` is deliberately NOT performed here: it's a Node-only transform (`node:zlib`), and this
|
|
13
|
+
* module is reachable from the browser bundle (browser-bundle.test.ts) like the rest of the SDK
|
|
14
|
+
* core. Callers that support `compress: 'gzip'` (the CLI) gzip the bytes themselves and hand the
|
|
15
|
+
* already-compressed result in as `content` — see {@link planStagedContent}.
|
|
16
|
+
*/
|
|
17
|
+
/** How staged content is compressed before chunking. `fastlz` is per-chunk and pure-JS
|
|
18
|
+
* ({@link planChunks} does it right here); `gzip` compresses the WHOLE content off-chain (the
|
|
19
|
+
* caller's job — see the module doc) and decodes off-chain too, hence the `reader-gzip`
|
|
20
|
+
* representation rather than `reader`. */
|
|
21
|
+
export type Compress = 'none' | 'fastlz' | 'gzip';
|
|
22
|
+
export declare const ONCHAIN_IMAGE_SOFT_LIMIT: number;
|
|
23
|
+
export declare const ONCHAIN_PROJECT_SOFT_LIMIT: number;
|
|
24
|
+
/** Whether `bytesLen` is past the point where on-chain storage stops being the cost-sane choice to
|
|
25
|
+
* WRITE. Says nothing about readability — that's {@link classifyOnchainReadSize}. */
|
|
26
|
+
export declare function exceedsOnchainSoftLimit(bytesLen: number): boolean;
|
|
27
|
+
/** Measured `tokenURI` gas per KB at the BOTTOM of the readable range (10 KB). The rate is not
|
|
28
|
+
* flat — see the note above, and use {@link tokenUriGasEstimate} for a figure at a given size. */
|
|
29
|
+
export declare const TOKEN_URI_GAS_PER_KB_LOW = 360000;
|
|
30
|
+
/** Measured `tokenURI` gas per KB at the TOP of the readable range (100 KB). Past that the rate
|
|
31
|
+
* keeps climbing (~460,000/KB at 187 KB), so this is a range endpoint, not a ceiling. */
|
|
32
|
+
export declare const TOKEN_URI_GAS_PER_KB_HIGH = 405000;
|
|
33
|
+
/** From here up, the read is worth NAMING a number for (~15M gas at 40 KB) — a note about cost, not
|
|
34
|
+
* a statement about whether the token can be read. Every endpoint measured serves well past this. */
|
|
35
|
+
export declare const ONCHAIN_READ_WARN_BYTES: number;
|
|
36
|
+
/**
|
|
37
|
+
* Conservative `eth_call` reference based on geth's default `--rpc.gascap`. It is a floor, not a
|
|
38
|
+
* ceiling. Use {@link probeEthCallGasCap} to learn what the configured endpoint actually serves.
|
|
39
|
+
*/
|
|
40
|
+
export declare const ETH_CALL_GAS_FLOOR = 50000000;
|
|
41
|
+
/**
|
|
42
|
+
* Rough `tokenURI` gas for `bytesLen` of on-chain content — orientation, not a quote.
|
|
43
|
+
*
|
|
44
|
+
* Fitted to the measurements above as `350,000·KB + 650·KB²`: within ~3% of measured from 10 KB to
|
|
45
|
+
* 256 KB, and slightly high rather than low, which is the right direction for a number a creator
|
|
46
|
+
* plans against. A flat per-KB rate was wrong at both ends — it overstated a 10 KB read by ~30% and
|
|
47
|
+
* understated a 256 KB one by ~10%.
|
|
48
|
+
*/
|
|
49
|
+
export declare function tokenUriGasEstimate(bytesLen: number): number;
|
|
50
|
+
/** How much on-chain content a node with `gasCap` can serve in one `tokenURI` — the inverse of
|
|
51
|
+
* {@link tokenUriGasEstimate}, solved for bytes. Orientation, same ~3% fit. */
|
|
52
|
+
export declare function readableBytesAtGas(gasCap: number): number;
|
|
53
|
+
/**
|
|
54
|
+
* `ok` = every endpoint measured serves this read · `endpoint-dependent` = your RPC serves it but a
|
|
55
|
+
* 50M-capped one does not, so some marketplaces and indexers will see a revert · `beyond-local-rpc`
|
|
56
|
+
* = past what even your own measured endpoint allows.
|
|
57
|
+
*
|
|
58
|
+
* None of these is a refusal. Reads happen off-chain and a read that is too large for one node is an
|
|
59
|
+
* RPC-capability problem, not a reason to stop a creator writing bytes they want permanent — and any
|
|
60
|
+
* fixed byte threshold is a guess about third-party infrastructure that will be wrong in both
|
|
61
|
+
* directions (ours was: it blocked 100 KB while the default chain's own endpoint served 729 KB).
|
|
62
|
+
*/
|
|
63
|
+
export type OnchainReadVerdict = 'ok' | 'endpoint-dependent' | 'beyond-local-rpc';
|
|
64
|
+
/**
|
|
65
|
+
* Classify `bytesLen` of on-chain content by who can READ the token carrying it.
|
|
66
|
+
*
|
|
67
|
+
* `capGas` is the caller's measured `eth_call` allowance ({@link probeEthCallGasCap}); pass `null`
|
|
68
|
+
* or omit it when it could not be measured, and the verdict degrades to the two bands that do not
|
|
69
|
+
* need it. Kept in the SDK so the SDK and the CLI cannot disagree about the boundary.
|
|
70
|
+
*/
|
|
71
|
+
export declare function classifyOnchainReadSize(bytesLen: number, capGas?: number | null): OnchainReadVerdict;
|
|
72
|
+
/** The plan for staging one piece of content: how it chunks, how it compresses, and the
|
|
73
|
+
* transaction shape ({@link planContentTxs}) that staging it will take. */
|
|
74
|
+
export interface ContentPlan {
|
|
75
|
+
content: Uint8Array;
|
|
76
|
+
fastlz: boolean;
|
|
77
|
+
chunks: number;
|
|
78
|
+
stagedBytes: number;
|
|
79
|
+
plan: ContentTxPlan;
|
|
80
|
+
representation: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Pure staging plan for a piece of content — chunk count + transaction shape — with NO chain
|
|
84
|
+
* writes, no signer, no `ensureChunkStore`. Shared by {@link stageFieldContent} (which then
|
|
85
|
+
* actually stages) and a dry-run preview, so the count a human is told up front is the same one
|
|
86
|
+
* real staging produces. `content` must already be in its final pre-chunking form — gzipped when
|
|
87
|
+
* `compress === 'gzip'` (see the module doc for why that step isn't here). `chunkSize` defaults to
|
|
88
|
+
* {@link planChunks}'s default (currently 22 KB), so e.g. a 2.8 KB SVG is 1 chunk.
|
|
89
|
+
*/
|
|
90
|
+
export declare function planStagedContent(content: Uint8Array, compress: Compress): ContentPlan;
|
|
91
|
+
/** Progress from {@link stageFieldContent}, so a caller can narrate without the SDK printing
|
|
92
|
+
* anything itself (mirrors {@link ChunkStoreEvent} / `AnchorEvent`'s vocabulary). `chunk-store`
|
|
93
|
+
* simply forwards `ensureChunkStore`'s own event — staging always resolves one. */
|
|
94
|
+
export type StagingEvent = {
|
|
95
|
+
kind: 'chunk-store';
|
|
96
|
+
event: ChunkStoreEvent;
|
|
97
|
+
} | {
|
|
98
|
+
kind: 'planned';
|
|
99
|
+
field: string;
|
|
100
|
+
store: Address;
|
|
101
|
+
contentPlan: ContentPlan;
|
|
102
|
+
} | {
|
|
103
|
+
kind: 'staged';
|
|
104
|
+
field: string;
|
|
105
|
+
manifest: Address;
|
|
106
|
+
txHashes: Hex[];
|
|
107
|
+
};
|
|
108
|
+
export interface StageFieldContentArgs {
|
|
109
|
+
/** Content bytes, already in their final pre-chunking form (gzipped by the caller when
|
|
110
|
+
* `compress === 'gzip'` — see the module doc). */
|
|
111
|
+
content: Uint8Array;
|
|
112
|
+
compress: Compress;
|
|
113
|
+
/** The metadata field this content is destined for — narration only (e.g. `'image'`). */
|
|
114
|
+
field: string;
|
|
115
|
+
send: SendTx;
|
|
116
|
+
publicClient: PublicClient;
|
|
117
|
+
chainId: number;
|
|
118
|
+
/** Pre-resolved store (batch staging reuses one across files); else resolve/deploy via
|
|
119
|
+
* {@link ensureChunkStore}. */
|
|
120
|
+
store?: Address;
|
|
121
|
+
onEvent?: (e: StagingEvent) => void;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Put `content` on-chain as SSTORE2 chunks behind the shared reader, and return the field's
|
|
125
|
+
* `(representation, value)`. `fastlz` compresses per chunk (reader decodes on read → stays
|
|
126
|
+
* on-chain renderable); `gzip` compresses the whole content (off-chain decode → the
|
|
127
|
+
* `reader-gzip` representation, not on-chain renderable).
|
|
128
|
+
*
|
|
129
|
+
* Staging is one atomic `writeContent` (content fits a single tx's gas) or gas-bounded chunk-write
|
|
130
|
+
* `multicall`s plus a final manifest write — {@link stageContent} picks. These store writes use
|
|
131
|
+
* `send` (typically the env key on the hot lane, or the connected wallet on the wallet lane) — the
|
|
132
|
+
* data contracts are ownerless, so any funded signer may write them; the caller signs the field-set
|
|
133
|
+
* that references the manifest separately.
|
|
134
|
+
*/
|
|
135
|
+
export declare function stageFieldContent(args: StageFieldContentArgs): Promise<{
|
|
136
|
+
value: Hex;
|
|
137
|
+
representation: string;
|
|
138
|
+
}>;
|
|
139
|
+
//# sourceMappingURL=staging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staging.d.ts","sourceRoot":"","sources":["../src/staging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAE,GAAG,EAAE,YAAY,EAAC,MAAM,MAAM,CAAC;AACrD,OAAO,EAA6D,KAAK,eAAe,EAAE,KAAK,aAAa,EAAC,MAAM,aAAa,CAAC;AAGjI,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEzC;;;;;;;;;;;;GAYG;AAEH;;;2CAG2C;AAC3C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AASlD,eAAO,MAAM,wBAAwB,QAAY,CAAC;AAClD,eAAO,MAAM,0BAA0B,QAAa,CAAC;AAErD;sFACsF;AACtF,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEjE;AAkCD;mGACmG;AACnG,eAAO,MAAM,wBAAwB,SAAU,CAAC;AAChD;0FAC0F;AAC1F,eAAO,MAAM,yBAAyB,SAAU,CAAC;AACjD;sGACsG;AACtG,eAAO,MAAM,uBAAuB,QAAY,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,WAAa,CAAC;AAE7C;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAA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b,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB;oCACgC;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;CACrC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC;IAAC,KAAK,EAAE,GAAG,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAC,CAAC,CAalH"}
|
package/dist/staging.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { ensureChunkStore, planChunks, planContentTxs, stageContent } from './chunks.js';
|
|
2
|
+
import { encodeReader } from './token.js';
|
|
3
|
+
import { METADATA_REPRESENTATION as R } from './spine.js';
|
|
4
|
+
// ── Two independent costs, and the one that binds is the READ ────────────────
|
|
5
|
+
//
|
|
6
|
+
// WRITE cost is ~200 gas/byte (SSTORE2 code deposit) + per-chunk tx overhead, paid once by the
|
|
7
|
+
// creator. Past these soft limits, off-chain (Arweave pay-once, or a hosted resolver + IPFS) is FAR
|
|
8
|
+
// cheaper — on-chain's remaining edge is self-resolution, not cost. Per-file limit ≈ one 22 KB
|
|
9
|
+
// storage chunk; project limit caps the whole collection's write gas. Neither says anything about
|
|
10
|
+
// whether the result can be READ.
|
|
11
|
+
export const ONCHAIN_IMAGE_SOFT_LIMIT = 24 * 1024; // per file
|
|
12
|
+
export const ONCHAIN_PROJECT_SOFT_LIMIT = 256 * 1024; // whole collection, WRITE cost only
|
|
13
|
+
/** Whether `bytesLen` is past the point where on-chain storage stops being the cost-sane choice to
|
|
14
|
+
* WRITE. Says nothing about readability — that's {@link classifyOnchainReadSize}. */
|
|
15
|
+
export function exceedsOnchainSoftLimit(bytesLen) {
|
|
16
|
+
return bytesLen > ONCHAIN_IMAGE_SOFT_LIMIT;
|
|
17
|
+
}
|
|
18
|
+
// READ cost is the constraint nobody sees coming, and it is the one that decides whether a
|
|
19
|
+
// marketplace, an indexer, or another contract can see the token at all. The renderer assembles the
|
|
20
|
+
// whole document on every `tokenURI` call, and that cost is **superlinear**: EVM memory expansion
|
|
21
|
+
// carries a quadratic term, and the chunk store's `read()` concatenates chunk by chunk. So there is
|
|
22
|
+
// no honest flat "gas per KB" — the rate itself climbs with size.
|
|
23
|
+
//
|
|
24
|
+
// Measured (`forge`, `OneOfOneImage` + `AbxMetadataRenderer`, callee execution gas for one
|
|
25
|
+
// `tokenURI` call — no caller-side returndata copy, which a node serving `eth_call` doesn't pay
|
|
26
|
+
// either; `reader` = the representation `--onchain-image` produces, 22,000-byte chunks):
|
|
27
|
+
//
|
|
28
|
+
// content tokenURI gas per KB content tokenURI gas per KB
|
|
29
|
+
// 3 KB 1,123,327 374,000 100 KB 40,254,159 403,000
|
|
30
|
+
// 10 KB 3,588,993 359,000 128 KB 53,559,735 418,000
|
|
31
|
+
// 23 KB 8,346,220 363,000 187 KB 86,021,071 460,000
|
|
32
|
+
// 40 KB 14,740,366 369,000 256 KB 131,269,134 513,000
|
|
33
|
+
// 50 KB 18,759,333 375,000
|
|
34
|
+
// 75 KB 29,137,215 388,000
|
|
35
|
+
// 90 KB 35,868,124 399,000
|
|
36
|
+
//
|
|
37
|
+
// So: **~360,000–405,000 gas per KB across the 10–100 KB range that matters, climbing past that**
|
|
38
|
+
// (~460,000/KB at 187 KB, ~510,000/KB at 256 KB). The 3 KB row is higher per KB because the JSON
|
|
39
|
+
// wrapper is a fixed cost the content hasn't yet dwarfed.
|
|
40
|
+
//
|
|
41
|
+
// `inline` and `reader` agree within ~1% up to 75 KB — the cost is the renderer's own string
|
|
42
|
+
// building, not the storage mechanism, which is why `--compress fastlz` makes a field cheaper to
|
|
43
|
+
// WRITE and not one gas cheaper to read. They diverge above that (reader 1.8% dearer at 90 KB, 2.4%
|
|
44
|
+
// at 128 KB, 5.5% at 187 KB, 9.6% at 256 KB) because the store's read loop is quadratic in chunk
|
|
45
|
+
// count.
|
|
46
|
+
//
|
|
47
|
+
// Readability is a property of the endpoint, not the chain, so `probeEthCallGasCap` measures it.
|
|
48
|
+
// Do not conflate the `eth_call` cap with either the block gas limit or `eth_estimateGas` allowance.
|
|
49
|
+
// There is no fixed-size refusal: the toolkit reports the estimated cost and measured endpoint cap.
|
|
50
|
+
/** Measured `tokenURI` gas per KB at the BOTTOM of the readable range (10 KB). The rate is not
|
|
51
|
+
* flat — see the note above, and use {@link tokenUriGasEstimate} for a figure at a given size. */
|
|
52
|
+
export const TOKEN_URI_GAS_PER_KB_LOW = 360_000;
|
|
53
|
+
/** Measured `tokenURI` gas per KB at the TOP of the readable range (100 KB). Past that the rate
|
|
54
|
+
* keeps climbing (~460,000/KB at 187 KB), so this is a range endpoint, not a ceiling. */
|
|
55
|
+
export const TOKEN_URI_GAS_PER_KB_HIGH = 405_000;
|
|
56
|
+
/** From here up, the read is worth NAMING a number for (~15M gas at 40 KB) — a note about cost, not
|
|
57
|
+
* a statement about whether the token can be read. Every endpoint measured serves well past this. */
|
|
58
|
+
export const ONCHAIN_READ_WARN_BYTES = 40 * 1024;
|
|
59
|
+
/**
|
|
60
|
+
* Conservative `eth_call` reference based on geth's default `--rpc.gascap`. It is a floor, not a
|
|
61
|
+
* ceiling. Use {@link probeEthCallGasCap} to learn what the configured endpoint actually serves.
|
|
62
|
+
*/
|
|
63
|
+
export const ETH_CALL_GAS_FLOOR = 50_000_000;
|
|
64
|
+
/**
|
|
65
|
+
* Rough `tokenURI` gas for `bytesLen` of on-chain content — orientation, not a quote.
|
|
66
|
+
*
|
|
67
|
+
* Fitted to the measurements above as `350,000·KB + 650·KB²`: within ~3% of measured from 10 KB to
|
|
68
|
+
* 256 KB, and slightly high rather than low, which is the right direction for a number a creator
|
|
69
|
+
* plans against. A flat per-KB rate was wrong at both ends — it overstated a 10 KB read by ~30% and
|
|
70
|
+
* understated a 256 KB one by ~10%.
|
|
71
|
+
*/
|
|
72
|
+
export function tokenUriGasEstimate(bytesLen) {
|
|
73
|
+
const kb = bytesLen / 1024;
|
|
74
|
+
return Math.round(kb * 350_000 + kb * kb * 650);
|
|
75
|
+
}
|
|
76
|
+
/** How much on-chain content a node with `gasCap` can serve in one `tokenURI` — the inverse of
|
|
77
|
+
* {@link tokenUriGasEstimate}, solved for bytes. Orientation, same ~3% fit. */
|
|
78
|
+
export function readableBytesAtGas(gasCap) {
|
|
79
|
+
// 650·KB² + 350,000·KB − gasCap = 0
|
|
80
|
+
const kb = (-350_000 + Math.sqrt(350_000 ** 2 + 4 * 650 * gasCap)) / (2 * 650);
|
|
81
|
+
return Math.max(0, Math.round(kb * 1024));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Classify `bytesLen` of on-chain content by who can READ the token carrying it.
|
|
85
|
+
*
|
|
86
|
+
* `capGas` is the caller's measured `eth_call` allowance ({@link probeEthCallGasCap}); pass `null`
|
|
87
|
+
* or omit it when it could not be measured, and the verdict degrades to the two bands that do not
|
|
88
|
+
* need it. Kept in the SDK so the SDK and the CLI cannot disagree about the boundary.
|
|
89
|
+
*/
|
|
90
|
+
export function classifyOnchainReadSize(bytesLen, capGas) {
|
|
91
|
+
const gas = tokenUriGasEstimate(bytesLen);
|
|
92
|
+
if (gas <= ETH_CALL_GAS_FLOOR)
|
|
93
|
+
return 'ok';
|
|
94
|
+
if (capGas != null && gas > capGas)
|
|
95
|
+
return 'beyond-local-rpc';
|
|
96
|
+
return 'endpoint-dependent';
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Pure staging plan for a piece of content — chunk count + transaction shape — with NO chain
|
|
100
|
+
* writes, no signer, no `ensureChunkStore`. Shared by {@link stageFieldContent} (which then
|
|
101
|
+
* actually stages) and a dry-run preview, so the count a human is told up front is the same one
|
|
102
|
+
* real staging produces. `content` must already be in its final pre-chunking form — gzipped when
|
|
103
|
+
* `compress === 'gzip'` (see the module doc for why that step isn't here). `chunkSize` defaults to
|
|
104
|
+
* {@link planChunks}'s default (currently 22 KB), so e.g. a 2.8 KB SVG is 1 chunk.
|
|
105
|
+
*/
|
|
106
|
+
export function planStagedContent(content, compress) {
|
|
107
|
+
const fastlz = compress === 'fastlz';
|
|
108
|
+
const planned = planChunks(content, { fastlz });
|
|
109
|
+
const plan = planContentTxs(planned);
|
|
110
|
+
const representation = compress === 'gzip' ? R.readerGzip : R.reader;
|
|
111
|
+
const stagedBytes = planned.reduce((n, c) => n + c.data.length, 0);
|
|
112
|
+
return { content, fastlz, chunks: planned.length, stagedBytes, plan, representation };
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Put `content` on-chain as SSTORE2 chunks behind the shared reader, and return the field's
|
|
116
|
+
* `(representation, value)`. `fastlz` compresses per chunk (reader decodes on read → stays
|
|
117
|
+
* on-chain renderable); `gzip` compresses the whole content (off-chain decode → the
|
|
118
|
+
* `reader-gzip` representation, not on-chain renderable).
|
|
119
|
+
*
|
|
120
|
+
* Staging is one atomic `writeContent` (content fits a single tx's gas) or gas-bounded chunk-write
|
|
121
|
+
* `multicall`s plus a final manifest write — {@link stageContent} picks. These store writes use
|
|
122
|
+
* `send` (typically the env key on the hot lane, or the connected wallet on the wallet lane) — the
|
|
123
|
+
* data contracts are ownerless, so any funded signer may write them; the caller signs the field-set
|
|
124
|
+
* that references the manifest separately.
|
|
125
|
+
*/
|
|
126
|
+
export async function stageFieldContent(args) {
|
|
127
|
+
const notify = args.onEvent ?? (() => { });
|
|
128
|
+
const p = planStagedContent(args.content, args.compress);
|
|
129
|
+
const resolvedStore = args.store ??
|
|
130
|
+
(await ensureChunkStore(args.publicClient, args.send, {
|
|
131
|
+
chainId: args.chainId,
|
|
132
|
+
onEvent: (e) => notify({ kind: 'chunk-store', event: e }),
|
|
133
|
+
}));
|
|
134
|
+
notify({ kind: 'planned', field: args.field, store: resolvedStore, contentPlan: p });
|
|
135
|
+
const { manifest, txHashes } = await stageContent(args.send, { store: resolvedStore, content: p.content, fastlz: p.fastlz, chainId: args.chainId });
|
|
136
|
+
notify({ kind: 'staged', field: args.field, manifest, txHashes });
|
|
137
|
+
return { value: encodeReader(resolvedStore, manifest), representation: p.representation };
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=staging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staging.js","sourceRoot":"","sources":["../src/staging.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAA2C,MAAM,aAAa,CAAC;AACjI,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,uBAAuB,IAAI,CAAC,EAAC,MAAM,YAAY,CAAC;AAuBxD,gFAAgF;AAChF,EAAE;AACF,+FAA+F;AAC/F,oGAAoG;AACpG,+FAA+F;AAC/F,kGAAkG;AAClG,kCAAkC;AAClC,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;AAC9D,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,oCAAoC;AAE1F;sFACsF;AACtF,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,OAAO,QAAQ,GAAG,wBAAwB,CAAC;AAC7C,CAAC;AAED,2FAA2F;AAC3F,oGAAoG;AACpG,kGAAkG;AAClG,oGAAoG;AACpG,kEAAkE;AAClE,EAAE;AACF,2FAA2F;AAC3F,gGAAgG;AAChG,yFAAyF;AACzF,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,wCAAwC;AACxC,wCAAwC;AACxC,wCAAwC;AACxC,EAAE;AACF,kGAAkG;AAClG,iGAAiG;AACjG,0DAA0D;AAC1D,EAAE;AACF,6FAA6F;AAC7F,iGAAiG;AACjG,oGAAoG;AACpG,iGAAiG;AACjG,SAAS;AACT,EAAE;AACF,iGAAiG;AACjG,qGAAqG;AACrG,oGAA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IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC,EAAC,CAAC,CAAC;IACnF,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAC,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,EAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAC,CAAC,CAAC;IAChJ,MAAM,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAC,CAAC,CAAC;IAChE,OAAO,EAAC,KAAK,EAAE,YAAY,CAAC,aAAa,EAAE,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,cAAc,EAAC,CAAC;AAC1F,CAAC"}
|
package/dist/token.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare function decodeReader(value: Hex): {
|
|
|
24
24
|
export declare function encodeReader(reader: Address, pointer: Address): Hex;
|
|
25
25
|
/**
|
|
26
26
|
* Encode a `renderer` field value — `abi.encode(address fieldRenderer)` (the representations
|
|
27
|
-
* table,
|
|
27
|
+
* table, site/content/docs/protocol/metadata.mdx). Content is COMPUTED at read: the metadata
|
|
28
28
|
* renderer (and the off-chain resolver) staticcall `render(token, tokenId, field)` on it.
|
|
29
29
|
*/
|
|
30
30
|
export declare function encodeFieldRenderer(fieldRenderer: Address): Hex;
|
package/dist/token.js
CHANGED
|
@@ -52,7 +52,7 @@ export function encodeReader(reader, pointer) {
|
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Encode a `renderer` field value — `abi.encode(address fieldRenderer)` (the representations
|
|
55
|
-
* table,
|
|
55
|
+
* table, site/content/docs/protocol/metadata.mdx). Content is COMPUTED at read: the metadata
|
|
56
56
|
* renderer (and the off-chain resolver) staticcall `render(token, tokenId, field)` on it.
|
|
57
57
|
*/
|
|
58
58
|
export function encodeFieldRenderer(fieldRenderer) {
|
package/dist/tokendata.d.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
|
-
import { type Hex, type PublicClient } from 'viem';
|
|
2
|
-
import type { MetadataField, ProjectState, TokenState } from './types.js';
|
|
1
|
+
import { type Address, type Hex, type PublicClient } from 'viem';
|
|
2
|
+
import type { MetadataField, ParamSchema, ParamValue, ProjectState, TokenState } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The canonical `tokenData` assembly — the off-chain serializer the spec names as
|
|
5
|
+
* authoritative (`site/content/docs/protocol/code-projects.mdx`). One flat object: the reserved
|
|
6
|
+
* coordinates + every param (contract ∪ token scope, token wins) + the augment hook's
|
|
7
|
+
* entries (augment wins per key), every value its canonical string (`chainId` alone is
|
|
8
|
+
* a number). The serialization is canonical because it is *hashed*: an effect's
|
|
9
|
+
* `inputsHash` commits to it, so this exact byte shape is what makes render outputs
|
|
10
|
+
* addressable and self-invalidating.
|
|
11
|
+
*
|
|
12
|
+
* Decode rules: a schema'd param decodes per its type (`Select` → the option string,
|
|
13
|
+
* `DecimalRange` ÷ 1e10, …); a schema-less literal stays the raw `bytes32` hex (a
|
|
14
|
+
* schema is what buys a human decode — `seed` is the canonical example); a data-backed
|
|
15
|
+
* value reads its blob (`String` → UTF-8, `Bytes`/schema-less → base64).
|
|
16
|
+
*/
|
|
17
|
+
/** The tokenData coordinates — never enumerable as params (the on-chain params store excludes
|
|
18
|
+
* `seed` from its key lists, and the generator/renderer skip the other three defensively).
|
|
19
|
+
* Exported because every off-chain surface that enumerates params must exclude exactly this
|
|
20
|
+
* set: two lists that have to agree are one list. */
|
|
21
|
+
export declare const RESERVED_TOKEN_DATA_KEYS: ReadonlySet<string>;
|
|
3
22
|
export interface TokenDataResult {
|
|
4
23
|
/** The flat object (values are canonical strings; `chainId` is a number). */
|
|
5
24
|
data: Record<string, string | number>;
|
|
@@ -30,7 +49,7 @@ export declare function buildTokenData(client: PublicClient | null, state: Proje
|
|
|
30
49
|
/** The canonical serialization: lexicographically sorted keys, compact JSON, UTF-8. */
|
|
31
50
|
export declare function canonicalTokenDataJson(data: Record<string, string | number>): string;
|
|
32
51
|
/**
|
|
33
|
-
* The effect run identity (`
|
|
52
|
+
* The effect run identity (`site/content/docs/protocol/effects.mdx`):
|
|
34
53
|
* `keccak256(contentDigest ‖ canonical tokenData ‖ environmentId)`. Deterministic across
|
|
35
54
|
* producers and consumers — the resolver computes the CURRENT hash and looks up exactly
|
|
36
55
|
* that artifact, so a param change re-addresses output and stale renders are never served.
|
|
@@ -47,4 +66,45 @@ export declare function contentDigestOf(state: ProjectState): Hex | null;
|
|
|
47
66
|
* resolver) agree on where a run's artifacts live, over any storage backend.
|
|
48
67
|
*/
|
|
49
68
|
export declare function renderArtifactKey(chainId: number, address: string, tokenId: string, hash: Hex, outputKey?: string, effectKey?: string): Hex;
|
|
69
|
+
/**
|
|
70
|
+
* The **bound** effect outputs — `site/content/docs/protocol/effects.mdx → Bound vs referenced`. An output is
|
|
71
|
+
* bound iff a binding stitches its *content* into the metadata JSON, which is what decides who holds
|
|
72
|
+
* its bytes:
|
|
73
|
+
*
|
|
74
|
+
* - **bound** (`render/traits` → `attributes`): the serving node holds the content, capped at
|
|
75
|
+
* {@link BOUND_ARTIFACT_MAX_BYTES} and servable only at the current settled `inputsHash`. A
|
|
76
|
+
* locator here cannot work — the content is assembled into `tokenURI`, so a locator would put a
|
|
77
|
+
* third-party fetch on the hottest read the resolver serves.
|
|
78
|
+
* - **referenced** (everything else — `render/image` projects a *URL*, a `video`/`model` only
|
|
79
|
+
* appears in the manifest): the PRODUCER holds the bytes and the node stores a locator. Holding
|
|
80
|
+
* these bytes buys a node no capability (it redirects either way) and costs it an object store.
|
|
81
|
+
*
|
|
82
|
+
* This is the wire rule for `POST /v1/effect-artifacts` in both directions: bytes for a referenced
|
|
83
|
+
* output and a locator for a bound one are each a `400`. Growing this set is an interface change —
|
|
84
|
+
* every serving node must be able to stitch a bound output's content.
|
|
85
|
+
*/
|
|
86
|
+
export declare const BOUND_EFFECT_OUTPUTS: ReadonlySet<string>;
|
|
87
|
+
/** The cap a serving node MUST accept per bound output and MUST refuse above (~100× a real traits
|
|
88
|
+
* payload — generous for JSON, far too small to become blob storage). */
|
|
89
|
+
export declare const BOUND_ARTIFACT_MAX_BYTES: number;
|
|
90
|
+
/** Is `{effectKey}/{outputKey}` a bound output — content the serving node must hold and stitch?
|
|
91
|
+
* Unknown effects answer `false`: an output a node can't stitch is referenced by definition, since
|
|
92
|
+
* bytes it can't stitch are bytes it could only redirect to. */
|
|
93
|
+
export declare function isBoundOutput(effectKey: string, outputKey: string): boolean;
|
|
94
|
+
/** One param's canonical decode, with the blob's SIZE alongside. */
|
|
95
|
+
export interface DecodedParam {
|
|
96
|
+
/** The canonical string — what tokenData carries for this key. */
|
|
97
|
+
value: string;
|
|
98
|
+
/** A data-backed param's full content length in bytes; `null` for a literal, and for a blob
|
|
99
|
+
* that didn't read (the value degraded to the hash). Callers that bound inline content —
|
|
100
|
+
* the off-chain resolver's params handling (spec v8 removed the `abx_params` projection from both lanes), mirroring the renderer's former inline ceiling (removed with the projection) —
|
|
101
|
+
* measure THIS, the same length the chain measures. */
|
|
102
|
+
contentBytes: number | null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The canonical per-param decode — the one implementation every off-chain surface shares
|
|
106
|
+
* (tokenData assembly here, `abx_params` in the resolver), so a value reads the same
|
|
107
|
+
* everywhere and stays byte-parallel with the on-chain generator and renderer.
|
|
108
|
+
*/
|
|
109
|
+
export declare function decodeParam(client: PublicClient | null, token: Address, tokenId: string, p: ParamValue, tokenScope: boolean, schema: ParamSchema | undefined): Promise<DecodedParam>;
|
|
50
110
|
//# sourceMappingURL=tokendata.d.ts.map
|
package/dist/tokendata.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokendata.d.ts","sourceRoot":"","sources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viem';
|
|
1
|
+
import { bytesToHex, concat, hexToBytes, keccak256, parseAbi, stringToBytes, } from 'viem';
|
|
2
2
|
import { seriesCodeAbi } from './abi/index.js';
|
|
3
3
|
import { decodeScalarParam } from './spine.js';
|
|
4
|
+
import { bytesToBase64 } from './util.js';
|
|
4
5
|
/**
|
|
5
6
|
* The canonical `tokenData` assembly — the off-chain serializer the spec names as
|
|
6
|
-
* authoritative (`
|
|
7
|
+
* authoritative (`site/content/docs/protocol/code-projects.mdx`). One flat object: the reserved
|
|
7
8
|
* coordinates + every param (contract ∪ token scope, token wins) + the augment hook's
|
|
8
9
|
* entries (augment wins per key), every value its canonical string (`chainId` alone is
|
|
9
10
|
* a number). The serialization is canonical because it is *hashed*: an effect's
|
|
@@ -15,7 +16,16 @@ import { decodeScalarParam } from './spine.js';
|
|
|
15
16
|
* schema is what buys a human decode — `seed` is the canonical example); a data-backed
|
|
16
17
|
* value reads its blob (`String` → UTF-8, `Bytes`/schema-less → base64).
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
/** The tokenData coordinates — never enumerable as params (the on-chain params store excludes
|
|
20
|
+
* `seed` from its key lists, and the generator/renderer skip the other three defensively).
|
|
21
|
+
* Exported because every off-chain surface that enumerates params must exclude exactly this
|
|
22
|
+
* set: two lists that have to agree are one list. */
|
|
23
|
+
export const RESERVED_TOKEN_DATA_KEYS = new Set([
|
|
24
|
+
'chainId',
|
|
25
|
+
'contractAddress',
|
|
26
|
+
'tokenId',
|
|
27
|
+
'seed',
|
|
28
|
+
]);
|
|
19
29
|
const augmentHookAbi = parseAbi([
|
|
20
30
|
'function augmentTokenParams(address token, uint256 tokenId) view returns ((bytes32 key, string value)[])',
|
|
21
31
|
]);
|
|
@@ -60,9 +70,16 @@ export async function buildTokenData(client, state, token, opts = {}) {
|
|
|
60
70
|
for (const p of token.params ?? [])
|
|
61
71
|
merged.set(p.key, { p, tokenScope: true });
|
|
62
72
|
for (const [key, { p, tokenScope }] of merged) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
// Coordinates win. `seed` is the one reserved key allowed through — but only from TOKEN
|
|
74
|
+
// scope, matching the on-chain document exactly: `TokenDataLib.begin` reads
|
|
75
|
+
// `tokenParam(tokenId, "seed")` and never falls back to contract scope. Letting a
|
|
76
|
+
// contract-scope `seed` through here (the merged map holds both scopes) meant an unseeded
|
|
77
|
+
// token carried a seed off-chain that the on-chain generator did not have — the two lanes
|
|
78
|
+
// disagreeing about what a token's seed is, which is the one value they must agree on.
|
|
79
|
+
// Contract-scope `seed` remains settable on-chain by design; it simply is not a token's seed.
|
|
80
|
+
if (RESERVED_TOKEN_DATA_KEYS.has(key) && !(key === 'seed' && tokenScope))
|
|
81
|
+
continue;
|
|
82
|
+
data[key] = (await decodeParam(client, state.address, token.tokenId, p, tokenScope, schemas.get(key))).value;
|
|
66
83
|
}
|
|
67
84
|
// augment hook — last, wins per key (except the reserved coordinates). Skipped for the
|
|
68
85
|
// SETTLED form (opts.augment false): live data belongs in the live view, never in the
|
|
@@ -78,7 +95,7 @@ export async function buildTokenData(client, state, token, opts = {}) {
|
|
|
78
95
|
}));
|
|
79
96
|
for (const e of entries) {
|
|
80
97
|
const key = decodeBytes32Key(e.key);
|
|
81
|
-
if (
|
|
98
|
+
if (RESERVED_TOKEN_DATA_KEYS.has(key))
|
|
82
99
|
continue;
|
|
83
100
|
data[key] = e.value;
|
|
84
101
|
}
|
|
@@ -97,7 +114,7 @@ export function canonicalTokenDataJson(data) {
|
|
|
97
114
|
return JSON.stringify(sorted);
|
|
98
115
|
}
|
|
99
116
|
/**
|
|
100
|
-
* The effect run identity (`
|
|
117
|
+
* The effect run identity (`site/content/docs/protocol/effects.mdx`):
|
|
101
118
|
* `keccak256(contentDigest ‖ canonical tokenData ‖ environmentId)`. Deterministic across
|
|
102
119
|
* producers and consumers — the resolver computes the CURRENT hash and looks up exactly
|
|
103
120
|
* that artifact, so a param change re-addresses output and stale renders are never served.
|
|
@@ -127,20 +144,63 @@ export function contentDigestOf(state) {
|
|
|
127
144
|
export function renderArtifactKey(chainId, address, tokenId, hash, outputKey = 'image', effectKey = 'render') {
|
|
128
145
|
return keccak256(stringToBytes(`${chainId}/${address.toLowerCase()}/${tokenId}/${effectKey}/${hash}/${outputKey}`));
|
|
129
146
|
}
|
|
130
|
-
|
|
131
|
-
|
|
147
|
+
/**
|
|
148
|
+
* The **bound** effect outputs — `site/content/docs/protocol/effects.mdx → Bound vs referenced`. An output is
|
|
149
|
+
* bound iff a binding stitches its *content* into the metadata JSON, which is what decides who holds
|
|
150
|
+
* its bytes:
|
|
151
|
+
*
|
|
152
|
+
* - **bound** (`render/traits` → `attributes`): the serving node holds the content, capped at
|
|
153
|
+
* {@link BOUND_ARTIFACT_MAX_BYTES} and servable only at the current settled `inputsHash`. A
|
|
154
|
+
* locator here cannot work — the content is assembled into `tokenURI`, so a locator would put a
|
|
155
|
+
* third-party fetch on the hottest read the resolver serves.
|
|
156
|
+
* - **referenced** (everything else — `render/image` projects a *URL*, a `video`/`model` only
|
|
157
|
+
* appears in the manifest): the PRODUCER holds the bytes and the node stores a locator. Holding
|
|
158
|
+
* these bytes buys a node no capability (it redirects either way) and costs it an object store.
|
|
159
|
+
*
|
|
160
|
+
* This is the wire rule for `POST /v1/effect-artifacts` in both directions: bytes for a referenced
|
|
161
|
+
* output and a locator for a bound one are each a `400`. Growing this set is an interface change —
|
|
162
|
+
* every serving node must be able to stitch a bound output's content.
|
|
163
|
+
*/
|
|
164
|
+
export const BOUND_EFFECT_OUTPUTS = new Set(['render/traits']);
|
|
165
|
+
/** The cap a serving node MUST accept per bound output and MUST refuse above (~100× a real traits
|
|
166
|
+
* payload — generous for JSON, far too small to become blob storage). */
|
|
167
|
+
export const BOUND_ARTIFACT_MAX_BYTES = 64 * 1024;
|
|
168
|
+
/** Is `{effectKey}/{outputKey}` a bound output — content the serving node must hold and stitch?
|
|
169
|
+
* Unknown effects answer `false`: an output a node can't stitch is referenced by definition, since
|
|
170
|
+
* bytes it can't stitch are bytes it could only redirect to. */
|
|
171
|
+
export function isBoundOutput(effectKey, outputKey) {
|
|
172
|
+
return BOUND_EFFECT_OUTPUTS.has(`${effectKey}/${outputKey}`);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The canonical per-param decode — the one implementation every off-chain surface shares
|
|
176
|
+
* (tokenData assembly here, `abx_params` in the resolver), so a value reads the same
|
|
177
|
+
* everywhere and stays byte-parallel with the on-chain generator and renderer.
|
|
178
|
+
*/
|
|
179
|
+
export async function decodeParam(client, token, tokenId, p, tokenScope, schema) {
|
|
180
|
+
const literal = (value) => ({ value, contentBytes: null });
|
|
132
181
|
if (!p.valueIsHash) {
|
|
182
|
+
// `seed`'s wire format is INVARIANT: always the raw 32-byte hex, schema or no schema. The
|
|
183
|
+
// on-chain side (`TokenDataLib.begin`) emits `toHexString(seed, 32)` unconditionally and never
|
|
184
|
+
// consults a schema, so consulting one here would fork the work. Concretely: a project that
|
|
185
|
+
// lets an authorized party choose the seed value declares a `seed` schema (typically
|
|
186
|
+
// `Uint256Range` — note this is "pick the value", not a re-roll: the caller supplies it), and this
|
|
187
|
+
// decode would then hand the work `"777"` where the on-chain generator hands it
|
|
188
|
+
// `"0x00…0309"` — the same token rendering differently depending on which surface served it.
|
|
189
|
+
// A `seed` schema governs WHO may write it and within what bounds; it does not change how it
|
|
190
|
+
// reads. Checked before the schema branch for exactly that reason.
|
|
191
|
+
if (p.key === 'seed')
|
|
192
|
+
return literal(p.value);
|
|
133
193
|
if (!schema)
|
|
134
|
-
return
|
|
194
|
+
return literal(decodeTagLoose(p.value));
|
|
135
195
|
if (schema.paramType === 'Select') {
|
|
136
196
|
const idx = Number(BigInt(p.value));
|
|
137
|
-
return schema.selectOptions[idx] ?? String(idx);
|
|
197
|
+
return literal(schema.selectOptions[idx] ?? String(idx));
|
|
138
198
|
}
|
|
139
|
-
return decodeScalarParam(schema.paramType, p.value);
|
|
199
|
+
return literal(decodeScalarParam(schema.paramType, p.value));
|
|
140
200
|
}
|
|
141
201
|
// data-backed: read the blob (token scope falls back to contract scope by construction)
|
|
142
202
|
if (!client)
|
|
143
|
-
return p.value; // best-effort floor: the hash itself
|
|
203
|
+
return literal(p.value); // best-effort floor: the hash itself
|
|
144
204
|
try {
|
|
145
205
|
const blob = (await client.readContract({
|
|
146
206
|
address: token,
|
|
@@ -149,14 +209,16 @@ async function decodeParam(client, token, tokenId, p, tokenScope, schema) {
|
|
|
149
209
|
args: tokenScope ? [BigInt(tokenId), keyToBytes32(p.key)] : [keyToBytes32(p.key)],
|
|
150
210
|
}));
|
|
151
211
|
const bytes = hexToBytes(blob);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
212
|
+
const value = schema?.paramType === 'String'
|
|
213
|
+
? new TextDecoder().decode(bytes)
|
|
214
|
+
: bytesToBase64(bytes); // Bytes + schema-less: base64 at read
|
|
215
|
+
return { value, contentBytes: bytes.length };
|
|
155
216
|
}
|
|
156
217
|
catch {
|
|
157
|
-
return p.value;
|
|
218
|
+
return literal(p.value);
|
|
158
219
|
}
|
|
159
220
|
}
|
|
221
|
+
// ── internals ──────────────────────────────────────────────────────────────────
|
|
160
222
|
/** A readable-ASCII `bytes32` literal as its string (e.g. a `display.animation` value). */
|
|
161
223
|
function decodeTagLoose(value) {
|
|
162
224
|
const bytes = hexToBytes(value);
|
|
@@ -173,6 +235,6 @@ function decodeBytes32Key(key) {
|
|
|
173
235
|
function keyToBytes32(key) {
|
|
174
236
|
const bytes = new Uint8Array(32);
|
|
175
237
|
bytes.set(stringToBytes(key).slice(0, 32));
|
|
176
|
-
return
|
|
238
|
+
return bytesToHex(bytes);
|
|
177
239
|
}
|
|
178
240
|
//# sourceMappingURL=tokendata.js.map
|
package/dist/tokendata.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokendata.js","sourceRoot":"","sources":["../src/tokendata.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,SAAS,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