@artblocks/abx-cli 0.1.0-alpha.9 → 0.2.0
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 +429 -0
- package/assets/renderer-scaffold/README.md +44 -13
- package/assets/renderer-scaffold/foundry.toml +5 -0
- package/assets/renderer-scaffold/remappings.txt +1 -1
- package/assets/renderer-scaffold/script/DeployHooks.s.sol +24 -0
- package/assets/renderer-scaffold/script/Preview.s.sol +99 -0
- package/assets/renderer-scaffold/src/MyHooks.sol +20 -0
- package/assets/renderer-scaffold/src/MyRenderer.sol +4 -4
- package/assets/renderer-scaffold/src/MyTraits.sol +2 -2
- package/assets/renderer-scaffold/test/MyRenderer.t.sol +60 -3
- package/dist/bin.d.ts +26 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +63 -0
- package/dist/bin.js.map +1 -0
- package/dist/capabilities.d.ts +132 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +175 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/commands/auth.d.ts +54 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +483 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/contract.d.ts +19 -0
- package/dist/commands/contract.d.ts.map +1 -0
- package/dist/commands/contract.js +171 -0
- package/dist/commands/contract.js.map +1 -0
- package/dist/commands/deploy.d.ts +296 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +5756 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/feedback.d.ts +7 -0
- package/dist/commands/feedback.d.ts.map +1 -0
- package/dist/commands/feedback.js +154 -0
- package/dist/commands/feedback.js.map +1 -0
- package/dist/commands/maintenance.d.ts +4 -0
- package/dist/commands/maintenance.d.ts.map +1 -0
- package/dist/commands/maintenance.js +114 -0
- package/dist/commands/maintenance.js.map +1 -0
- package/dist/commands/project.d.ts +458 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +1837 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/reads.d.ts +85 -0
- package/dist/commands/reads.d.ts.map +1 -0
- package/dist/commands/reads.js +881 -0
- package/dist/commands/reads.js.map +1 -0
- package/dist/commands/scaffold.d.ts +89 -0
- package/dist/commands/scaffold.d.ts.map +1 -0
- package/dist/commands/scaffold.js +741 -0
- package/dist/commands/scaffold.js.map +1 -0
- package/dist/commands/service.d.ts +67 -0
- package/dist/commands/service.d.ts.map +1 -0
- package/dist/commands/service.js +761 -0
- package/dist/commands/service.js.map +1 -0
- package/dist/commands/storage.d.ts +51 -0
- package/dist/commands/storage.d.ts.map +1 -0
- package/dist/commands/storage.js +399 -0
- package/dist/commands/storage.js.map +1 -0
- package/dist/commands/submit-app.d.ts +102 -0
- package/dist/commands/submit-app.d.ts.map +1 -0
- package/dist/commands/submit-app.js +638 -0
- package/dist/commands/submit-app.js.map +1 -0
- package/dist/config.d.ts +94 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +332 -12
- package/dist/config.js.map +1 -1
- package/dist/conformance.d.ts +31 -0
- package/dist/conformance.d.ts.map +1 -0
- package/dist/conformance.js +400 -0
- package/dist/conformance.js.map +1 -0
- package/dist/contract-read-error.d.ts +5 -0
- package/dist/contract-read-error.d.ts.map +1 -0
- package/dist/contract-read-error.js +37 -0
- package/dist/contract-read-error.js.map +1 -0
- package/dist/creator-agent.d.ts +49 -0
- package/dist/creator-agent.d.ts.map +1 -0
- package/dist/creator-agent.js +363 -0
- package/dist/creator-agent.js.map +1 -0
- package/dist/creator-keyring.d.ts +26 -0
- package/dist/creator-keyring.d.ts.map +1 -0
- package/dist/creator-keyring.js +57 -0
- package/dist/creator-keyring.js.map +1 -0
- package/dist/creator-signer.d.ts +52 -0
- package/dist/creator-signer.d.ts.map +1 -0
- package/dist/creator-signer.js +267 -0
- package/dist/creator-signer.js.map +1 -0
- package/dist/deploy-plan.d.ts +218 -0
- package/dist/deploy-plan.d.ts.map +1 -0
- package/dist/deploy-plan.js +20 -0
- package/dist/deploy-plan.js.map +1 -0
- package/dist/deps.d.ts +6 -39
- package/dist/deps.d.ts.map +1 -1
- package/dist/deps.js +4 -68
- package/dist/deps.js.map +1 -1
- package/dist/errors.d.ts +22 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +32 -0
- package/dist/errors.js.map +1 -0
- package/dist/flag-allowlists.d.ts +53 -0
- package/dist/flag-allowlists.d.ts.map +1 -0
- package/dist/flag-allowlists.js +188 -0
- package/dist/flag-allowlists.js.map +1 -0
- package/dist/flags.d.ts +53 -0
- package/dist/flags.d.ts.map +1 -1
- package/dist/flags.js +151 -1
- package/dist/flags.js.map +1 -1
- package/dist/jsonout.d.ts +37 -0
- package/dist/jsonout.d.ts.map +1 -0
- package/dist/jsonout.js +79 -0
- package/dist/jsonout.js.map +1 -0
- package/dist/kind.d.ts +57 -0
- package/dist/kind.d.ts.map +1 -0
- package/dist/kind.js +122 -0
- package/dist/kind.js.map +1 -0
- package/dist/main.js +859 -5374
- package/dist/main.js.map +1 -1
- package/dist/mintpage.d.ts +17 -2
- package/dist/mintpage.d.ts.map +1 -1
- package/dist/mintpage.js +241 -54
- package/dist/mintpage.js.map +1 -1
- package/dist/output.d.ts +184 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +774 -0
- package/dist/output.js.map +1 -0
- package/dist/ownerops.d.ts +463 -59
- package/dist/ownerops.d.ts.map +1 -1
- package/dist/ownerops.js +2329 -366
- package/dist/ownerops.js.map +1 -1
- package/dist/preview.d.ts +23 -5
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +95 -43
- package/dist/preview.js.map +1 -1
- package/dist/provision.d.ts +3 -13
- package/dist/provision.d.ts.map +1 -1
- package/dist/provision.js +19 -21
- package/dist/provision.js.map +1 -1
- package/dist/remote.d.ts +116 -9
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +371 -14
- package/dist/remote.js.map +1 -1
- package/dist/riskgate.d.ts +101 -0
- package/dist/riskgate.d.ts.map +1 -0
- package/dist/riskgate.js +343 -0
- package/dist/riskgate.js.map +1 -0
- package/dist/scaffold.d.ts +12 -0
- package/dist/scaffold.d.ts.map +1 -0
- package/dist/scaffold.js +56 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/schema.d.ts +36 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +121 -26
- package/dist/schema.js.map +1 -1
- package/dist/script-chunks.d.ts +8 -0
- package/dist/script-chunks.d.ts.map +1 -0
- package/dist/script-chunks.js +35 -0
- package/dist/script-chunks.js.map +1 -0
- package/dist/served.d.ts +30 -0
- package/dist/served.d.ts.map +1 -0
- package/dist/served.js +112 -0
- package/dist/served.js.map +1 -0
- package/dist/signer.d.ts +20 -1
- package/dist/signer.d.ts.map +1 -1
- package/dist/signer.js +110 -18
- package/dist/signer.js.map +1 -1
- package/dist/update-check.d.ts +60 -9
- package/dist/update-check.d.ts.map +1 -1
- package/dist/update-check.js +105 -18
- package/dist/update-check.js.map +1 -1
- package/package.json +17 -12
- package/skill/SKILL.md +213 -354
- package/skill/agents/openai.yaml +4 -0
- package/skill/reference/capabilities.md +195 -0
- package/skill/reference/code.md +236 -0
- package/skill/reference/creator-token.md +94 -0
- package/skill/reference/deploy.md +191 -0
- package/skill/reference/diagnose.md +178 -0
- package/skill/reference/hosting.md +191 -102
- package/skill/reference/operate.md +237 -0
- package/skill/reference/services.md +173 -0
- package/skill/reference/setup.md +221 -42
- package/assets/renderer-scaffold/src/interfaces/IAbxFieldRenderer.sol +0 -32
- package/assets/renderer-scaffold/src/interfaces/IAbxParams.sol +0 -26
- package/dist/inspect.d.ts +0 -48
- package/dist/inspect.d.ts.map +0 -1
- package/dist/inspect.js +0 -184
- package/dist/inspect.js.map +0 -1
- package/dist/migrate.d.ts +0 -65
- package/dist/migrate.d.ts.map +0 -1
- package/dist/migrate.js +0 -180
- package/dist/migrate.js.map +0 -1
- package/dist/onchain-uri.d.ts +0 -97
- package/dist/onchain-uri.d.ts.map +0 -1
- package/dist/onchain-uri.js +0 -243
- package/dist/onchain-uri.js.map +0 -1
- package/dist/upload.d.ts +0 -28
- package/dist/upload.d.ts.map +0 -1
- package/dist/upload.js +0 -41
- package/dist/upload.js.map +0 -1
- package/skill/reference/code-projects.md +0 -246
- package/skill/reference/operating.md +0 -118
- package/skill/reference/troubleshooting.md +0 -28
package/dist/schema.js
CHANGED
|
@@ -19,10 +19,40 @@
|
|
|
19
19
|
* outer delimiters appear there. Omit the bracket on a Range → unbounded (min=max=0, the prior
|
|
20
20
|
* behavior). A Select with no bracket, or a bracket on a type that takes none, is a clear error.
|
|
21
21
|
*/
|
|
22
|
-
import { PARAM_TYPES, AUTH_OPTIONS, encodeScalarParam } from '@artblocks/abx-sdk';
|
|
22
|
+
import { PARAM_TYPES, AUTH_OPTIONS, decodeScalarParam, encodeScalarParam } from '@artblocks/abx-sdk';
|
|
23
23
|
const ZERO32 = `0x${'0'.repeat(64)}`;
|
|
24
|
+
/** The `--schema` type/auth/format catalog, shown wherever the CLI nudges `--schema`. Kept accurate
|
|
25
|
+
* to the on-chain enums (PARAM_TYPES / AUTH_OPTIONS) + the Select-options / Range-bounds format —
|
|
26
|
+
* the old hint advertised non-existent `Anyone`/`Admin` auth legs. Used by both `deploy-code`
|
|
27
|
+
* (commands/deploy.ts) and `inspect` (commands/reads.ts), so it lives here beside the rest of the
|
|
28
|
+
* `--schema` machinery rather than in either command module. */
|
|
29
|
+
export const SCHEMA_CATALOG = 'Types: Bool·Select·Uint256Range·Int256Range·DecimalRange·HexColor·Timestamp·String·Bytes; ' +
|
|
30
|
+
'Auth: Creator·TokenOwner·Address (or the Or-combos, e.g. CreatorOrTokenOwner). ' +
|
|
31
|
+
"Select needs options — quote the whole spec: 'key:Select[A|B|C]:Auth'; a Range takes bounds — 'key:Uint256Range[0..100]:Auth'. " +
|
|
32
|
+
'A palette collectors set = palette:HexColor:TokenOwner';
|
|
24
33
|
/** The types that accept a `[min..max]` bound (the contract's min/max fields are meaningful here). */
|
|
25
34
|
const BOUNDED_TYPES = new Set(['Uint256Range', 'Int256Range', 'DecimalRange', 'Timestamp']);
|
|
35
|
+
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
|
|
36
|
+
/**
|
|
37
|
+
* A point in time for `lock=`: unix seconds, an ISO date, or `now` (which means "immediately and
|
|
38
|
+
* forever" — the retire idiom). Reuses the Timestamp encoder so `lock=2026-12-31` parses exactly
|
|
39
|
+
* like a `Timestamp[..]` bound does; one date grammar for the whole flag.
|
|
40
|
+
*/
|
|
41
|
+
export function parseWhen(raw) {
|
|
42
|
+
const t = raw.trim();
|
|
43
|
+
if (t === '')
|
|
44
|
+
throw new Error('lock= needs a value (unix seconds, an ISO date, or `now`)');
|
|
45
|
+
// `now` locks on the next block. Anything already past is equally permanent — the contract's test
|
|
46
|
+
// is `block.timestamp > lockAfter`.
|
|
47
|
+
if (t.toLowerCase() === 'now')
|
|
48
|
+
return Math.floor(Date.now() / 1000) - 1;
|
|
49
|
+
const secs = Number(BigInt(encodeScalarParam('Timestamp', t, []).value));
|
|
50
|
+
if (!Number.isSafeInteger(secs) || secs < 0)
|
|
51
|
+
throw new Error(`bad time "${raw}"`);
|
|
52
|
+
if (secs > 0xffffffffffff)
|
|
53
|
+
throw new Error(`"${raw}" exceeds the uint48 lock field`);
|
|
54
|
+
return secs;
|
|
55
|
+
}
|
|
26
56
|
/** min ≤ max in the type's own ordering (mirrors AbxParamsLib's on-chain check, but earlier + clearer). */
|
|
27
57
|
function orderedBounds(typeName, min, max) {
|
|
28
58
|
if (typeName === 'Int256Range')
|
|
@@ -31,33 +61,65 @@ function orderedBounds(typeName, min, max) {
|
|
|
31
61
|
}
|
|
32
62
|
export function parseSchemaSpec(spec) {
|
|
33
63
|
const parts = spec.split(':');
|
|
34
|
-
if (parts.length !== 3) {
|
|
35
|
-
throw new Error(`--schema "${spec}" — expected key:Type:Auth (a Select adds options: key:Select[A|B|C]:Auth; a Range adds bounds: key:Uint256Range[0..100]:Auth).`);
|
|
64
|
+
if (parts.length !== 3 && parts.length !== 4) {
|
|
65
|
+
throw new Error(`--schema "${spec}" — expected key:Type:Auth (a Select adds options: key:Select[A|B|C]:Auth; a Range adds bounds: key:Uint256Range[0..100]:Auth; add :lock=<when> to freeze the value after a date).`);
|
|
66
|
+
}
|
|
67
|
+
const [key, typeToken, authToken, lockToken] = parts;
|
|
68
|
+
// A 4th field is ONLY ever `lock=…`. Anything else there means a colon leaked out of a label or
|
|
69
|
+
// bound and split the spec wrong — report that as the shape error it is, rather than letting the
|
|
70
|
+
// mangled fragments fail later with a confusing "malformed type".
|
|
71
|
+
if (lockToken !== undefined && !/^lock=/.test(lockToken)) {
|
|
72
|
+
throw new Error(`--schema "${spec}" — expected key:Type:Auth (with an optional 4th field, lock=<when>). ` +
|
|
73
|
+
`Got ${parts.length} colon-separated fields: a ':' inside a Select option or a bound splits the spec — use simpler labels.`);
|
|
36
74
|
}
|
|
37
|
-
const [key, typeToken, authName] = parts;
|
|
38
75
|
const m = typeToken.match(/^([A-Za-z0-9]+)(?:\[(.*)\])?$/);
|
|
39
76
|
if (!key || !m)
|
|
40
77
|
throw new Error(`--schema "${spec}" — malformed type "${typeToken}".`);
|
|
41
78
|
const typeName = m[1];
|
|
42
79
|
const bracket = m[2]; // undefined when there is no [...]
|
|
43
80
|
const paramType = PARAM_TYPES.indexOf(typeName);
|
|
81
|
+
// An Address-bearing leg names its holder inline: `Address(0x…)`, `CreatorOrAddress(0x…)`. The
|
|
82
|
+
// contract pairs auth and authAddress strictly (one without the other reverts InvalidParamSchema),
|
|
83
|
+
// so they belong in one token rather than a second flag that could be forgotten.
|
|
84
|
+
const am = authToken.match(/^([A-Za-z]+)(?:\((0x[0-9a-fA-F]{40})\))?$/);
|
|
85
|
+
if (!am)
|
|
86
|
+
throw new Error(`--schema "${spec}" — malformed auth "${authToken}" (an Address leg looks like Address(0x…)).`);
|
|
87
|
+
const authName = am[1];
|
|
44
88
|
const auth = AUTH_OPTIONS.indexOf(authName);
|
|
45
89
|
if (paramType < 0 || auth < 0) {
|
|
46
90
|
throw new Error(`--schema "${spec}" — Type ∈ {${PARAM_TYPES.join('|')}}, Auth ∈ {${AUTH_OPTIONS.join('|')}}.`);
|
|
47
91
|
}
|
|
48
|
-
|
|
49
|
-
|
|
92
|
+
const wantsAddress = AUTH_OPTIONS[auth].includes('Address');
|
|
93
|
+
const authAddress = (am[2] ?? ZERO_ADDR);
|
|
94
|
+
if (wantsAddress && authAddress === ZERO_ADDR) {
|
|
95
|
+
throw new Error(`--schema "${spec}" — ${authName} names a specific writer, so it needs one: ${key}:${typeToken}:${authName}(0xYourAddress). ` +
|
|
96
|
+
`A CONTRACT may hold this leg — that is how open/multi-party participation is built (a controller applies its own rules and forwards the write).`);
|
|
97
|
+
}
|
|
98
|
+
if (!wantsAddress && am[2]) {
|
|
99
|
+
throw new Error(`--schema "${spec}" — ${authName} takes no address; only an Address-bearing leg does.`);
|
|
100
|
+
}
|
|
101
|
+
let lockAfter = 0;
|
|
102
|
+
if (lockToken !== undefined) {
|
|
103
|
+
const lm = lockToken.match(/^lock=(.*)$/);
|
|
104
|
+
if (!lm)
|
|
105
|
+
throw new Error(`--schema "${spec}" — the 4th field must be lock=<when> (unix seconds, an ISO date, or "now").`);
|
|
106
|
+
try {
|
|
107
|
+
lockAfter = parseWhen(lm[1]);
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
throw new Error(`--schema "${spec}" — ${e.message}`);
|
|
111
|
+
}
|
|
50
112
|
}
|
|
51
113
|
let min = ZERO32;
|
|
52
114
|
let max = ZERO32;
|
|
53
115
|
let selectOptions = [];
|
|
54
116
|
if (typeName === 'Select') {
|
|
55
117
|
if (bracket === undefined) {
|
|
56
|
-
throw new Error(`--schema "${spec}" — a Select needs its options: ${key}:Select[Option A|Option B|Option C]:${authName}.`);
|
|
118
|
+
throw new Error(`--schema "${spec}" — a Select needs its options: '${key}:Select[Option A|Option B|Option C]:${authName}' (quote the whole value in the shell).`);
|
|
57
119
|
}
|
|
58
120
|
selectOptions = bracket.split('|').map((o) => o.trim());
|
|
59
121
|
if (selectOptions.length === 0 || selectOptions.some((o) => o === '')) {
|
|
60
|
-
throw new Error(`--schema "${spec}" — Select options must be non-empty, e.g. ${key}:Select[A|B|C]:${authName}.`);
|
|
122
|
+
throw new Error(`--schema "${spec}" — Select options must be non-empty, e.g. '${key}:Select[A|B|C]:${authName}'.`);
|
|
61
123
|
}
|
|
62
124
|
if (new Set(selectOptions).size !== selectOptions.length) {
|
|
63
125
|
throw new Error(`--schema "${spec}" — duplicate Select option in [${selectOptions.join('|')}].`);
|
|
@@ -73,7 +135,7 @@ export function parseSchemaSpec(spec) {
|
|
|
73
135
|
}
|
|
74
136
|
const mm = bracket.split('..');
|
|
75
137
|
if (mm.length !== 2)
|
|
76
|
-
throw new Error(`--schema "${spec}" — bounds are [min..max], e.g. ${key}:${typeName}[0..100]:${authName}.`);
|
|
138
|
+
throw new Error(`--schema "${spec}" — bounds are [min..max], e.g. '${key}:${typeName}[0..100]:${authName}'.`);
|
|
77
139
|
try {
|
|
78
140
|
min = encodeScalarParam(typeName, mm[0].trim(), []).value;
|
|
79
141
|
max = encodeScalarParam(typeName, mm[1].trim(), []).value;
|
|
@@ -85,7 +147,7 @@ export function parseSchemaSpec(spec) {
|
|
|
85
147
|
throw new Error(`--schema "${spec}" — min must be ≤ max (got ${mm[0].trim()}..${mm[1].trim()}).`);
|
|
86
148
|
}
|
|
87
149
|
}
|
|
88
|
-
return { key, paramType, auth, min, max, selectOptions };
|
|
150
|
+
return { key, paramType, auth, authAddress, lockAfter, min, max, selectOptions };
|
|
89
151
|
}
|
|
90
152
|
/** Parse a full `--schema` value: comma-separated specs. */
|
|
91
153
|
export function parseSchemaSpecs(raw) {
|
|
@@ -95,6 +157,50 @@ export function parseSchemaSpecs(raw) {
|
|
|
95
157
|
.filter(Boolean)
|
|
96
158
|
.map(parseSchemaSpec);
|
|
97
159
|
}
|
|
160
|
+
/** The advisory an EDITION deploy needs before it commits to a schema, or `null` when there is
|
|
161
|
+
* nothing to say. Returned rather than printed so the deploy lane decides where it lands.
|
|
162
|
+
*
|
|
163
|
+
* Two things are true on an ERC-1155 edition and on nothing else, and a creator setting up their
|
|
164
|
+
* first collector-configurable drop will not have thought about either:
|
|
165
|
+
*
|
|
166
|
+
* 1. **Params are per id, so every holder of that id shares one value.** `TokenOwner` means ANY
|
|
167
|
+
* holder, and it is last-writer-wins. A "name your copy" schema does not name a copy — it
|
|
168
|
+
* renames the work for all 1,000 holders.
|
|
169
|
+
* 2. **A data param has no on-chain size budget.** One holder can store a large valid value under
|
|
170
|
+
* every declared key and make the shared id's `tokenURI` too expensive for common RPC limits —
|
|
171
|
+
* for every co-holder, permanently if a `lockAfter` then bites. That is a deliberate protocol
|
|
172
|
+
* choice (byte accounting on chain would cost every project to police a configuration almost
|
|
173
|
+
* nobody should use), which makes saying it here the actual mitigation.
|
|
174
|
+
*
|
|
175
|
+
* Both are fine when intended: a 1-of-1 edition behaves like a 721, and aggregate state (a counter,
|
|
176
|
+
* a shared mood) is exactly what shared params are good at. */
|
|
177
|
+
export function editionSchemaAdvisory(schemas) {
|
|
178
|
+
const holderWritable = schemas.filter((s) => {
|
|
179
|
+
const auth = AUTH_OPTIONS[s.auth];
|
|
180
|
+
return auth === 'TokenOwner' || auth === 'CreatorOrTokenOwner' || auth === 'TokenOwnerOrAddress'
|
|
181
|
+
|| auth === 'CreatorOrTokenOwnerOrAddress';
|
|
182
|
+
});
|
|
183
|
+
if (holderWritable.length === 0)
|
|
184
|
+
return null;
|
|
185
|
+
const keys = holderWritable.map((s) => s.key).join(', ');
|
|
186
|
+
const data = holderWritable.filter((s) => {
|
|
187
|
+
const t = PARAM_TYPES[s.paramType];
|
|
188
|
+
return t === 'String' || t === 'Bytes';
|
|
189
|
+
});
|
|
190
|
+
const sizeNote = data.length
|
|
191
|
+
? ` ${data.map((s) => s.key).join(', ')} ${data.length === 1 ? 'is' : 'are'} a DATA type with no on-chain size cap, so one holder can also make this id's metadata too large for many RPCs to read — for everyone, and permanently if you later lock it.`
|
|
192
|
+
: '';
|
|
193
|
+
// `seed` is the sharpest case of the shared-state rule and worth calling out by name: it is normally
|
|
194
|
+
// settled-once and immutable, but a holder-writable `seed` schema re-opens it — so any holder of the
|
|
195
|
+
// id can re-roll the GENERATIVE seed, changing the rendered artwork for every co-holder of the work.
|
|
196
|
+
// "Each collector picks their own seed" is a 721 idea; on an edition it is "any holder re-rolls
|
|
197
|
+
// everyone's". Almost never intended; a controller contract on the Address leg is the safe shape.
|
|
198
|
+
const hasSeed = holderWritable.some((s) => s.key === 'seed');
|
|
199
|
+
const seedNote = hasSeed
|
|
200
|
+
? ' seed is holder-writable here: the generative seed is normally immutable, but this lets ANY holder of the id re-roll it and change the artwork for every co-holder. If you want per-collector seeds, that is one id per copy; if you want it governed, put a controller contract on an Address leg.'
|
|
201
|
+
: '';
|
|
202
|
+
return `holder-writable on an edition: ${keys} — params belong to the ID, so every holder of that id shares one value and the last writer wins. If you meant "each collector configures their own", that needs one id per copy.${sizeNote}${seedNote}`;
|
|
203
|
+
}
|
|
98
204
|
/** A human one-line rendering of a parsed schema (for the confirm readout). */
|
|
99
205
|
export function describeSchema(s) {
|
|
100
206
|
const type = PARAM_TYPES[s.paramType];
|
|
@@ -103,23 +209,12 @@ export function describeSchema(s) {
|
|
|
103
209
|
if (type === 'Select')
|
|
104
210
|
detail = `[${s.selectOptions.join(' | ')}]`;
|
|
105
211
|
else if (s.min !== ZERO32 || s.max !== ZERO32) {
|
|
106
|
-
const lo =
|
|
107
|
-
const hi =
|
|
212
|
+
const lo = decodeScalarParam(type, s.min);
|
|
213
|
+
const hi = decodeScalarParam(type, s.max);
|
|
108
214
|
detail = `[${lo}..${hi}]`;
|
|
109
215
|
}
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Cheap display-only decode (the SDK's decodeScalarParam is the canonical one, but this keeps the
|
|
114
|
-
// readout dependency-light for the two Range cases that matter in a bound).
|
|
115
|
-
if (typeName === 'Int256Range')
|
|
116
|
-
return BigInt.asIntN(256, BigInt(v)).toString();
|
|
117
|
-
if (typeName === 'DecimalRange') {
|
|
118
|
-
const scaled = BigInt(v);
|
|
119
|
-
const whole = scaled / 10000000000n;
|
|
120
|
-
const frac = (scaled % 10000000000n).toString().padStart(10, '0').replace(/0+$/, '');
|
|
121
|
-
return frac ? `${whole}.${frac}` : `${whole}`;
|
|
122
|
-
}
|
|
123
|
-
return BigInt(v).toString();
|
|
216
|
+
const who = s.authAddress && s.authAddress !== ZERO_ADDR ? `(${s.authAddress})` : '';
|
|
217
|
+
const lock = s.lockAfter ? `:lock=${new Date(s.lockAfter * 1000).toISOString().slice(0, 19)}Z` : '';
|
|
218
|
+
return `${s.key}:${type}${detail}:${auth}${who}${lock}`;
|
|
124
219
|
}
|
|
125
220
|
//# sourceMappingURL=schema.js.map
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAC,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAqB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAC,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAqB,MAAM,oBAAoB,CAAC;AAGvH,MAAM,MAAM,GAAG,KAAK,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAS,CAAC;AAE5C;;;;iEAIiE;AACjE,MAAM,CAAC,MAAM,cAAc,GACzB,4FAA4F;IAC5F,iFAAiF;IACjF,iIAAiI;IACjI,wDAAwD,CAAC;AAE3D,sGAAsG;AACtG,MAAM,aAA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AAC,CAAC,CAAC,EAAE,CAAC;IACrF,MAAM,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACpG,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,IAAI,GAAG,MAAM,IAAI,IAAI,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* Plan the on-chain script chunks for a template-mode deploy. The generator joins with `'\n'`;
|
|
4
|
+
* {@link splitScriptChunks} splits so that join is byte-identical to `source`. A program that does
|
|
5
|
+
* not parse — before OR after that join — is refused here, because `abx verify` does not parse it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function planOnChainScript(source: string, chunkSize?: number): Hex[];
|
|
8
|
+
//# sourceMappingURL=script-chunks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-chunks.d.ts","sourceRoot":"","sources":["../src/script-chunks.ts"],"names":[],"mappings":"AAKA,OAAO,EAAQ,KAAK,GAAG,EAAC,MAAM,MAAM,CAAC;AAGrC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,GAAG,EAAE,CAW3E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI wrapper around the SDK's newline-aware script splitter. Parses the program (so a SyntaxError
|
|
3
|
+
* cannot ship under a green verify) and encodes chunks for `setScriptChunk`.
|
|
4
|
+
*/
|
|
5
|
+
import vm from 'node:vm';
|
|
6
|
+
import { toHex } from 'viem';
|
|
7
|
+
import { joinScriptChunks, splitScriptChunks } from '@artblocks/abx-sdk';
|
|
8
|
+
/**
|
|
9
|
+
* Plan the on-chain script chunks for a template-mode deploy. The generator joins with `'\n'`;
|
|
10
|
+
* {@link splitScriptChunks} splits so that join is byte-identical to `source`. A program that does
|
|
11
|
+
* not parse — before OR after that join — is refused here, because `abx verify` does not parse it.
|
|
12
|
+
*/
|
|
13
|
+
export function planOnChainScript(source, chunkSize) {
|
|
14
|
+
assertScriptParses(source, 'the script on disk');
|
|
15
|
+
const parts = chunkSize === undefined ? splitScriptChunks(source) : splitScriptChunks(source, chunkSize);
|
|
16
|
+
const joined = joinScriptChunks(parts);
|
|
17
|
+
if (joined !== source) {
|
|
18
|
+
throw new Error('internal: script chunks do not reassemble to the source. The on-chain generator joins ' +
|
|
19
|
+
'chunks with a newline; this is a toolkit bug, not something to work around.');
|
|
20
|
+
}
|
|
21
|
+
return parts.map((b) => toHex(b));
|
|
22
|
+
}
|
|
23
|
+
function assertScriptParses(source, what) {
|
|
24
|
+
try {
|
|
25
|
+
// Classic script (not a module). On-chain programs do not `import`; deps ride as <script> tags.
|
|
26
|
+
new vm.Script(source, { filename: 'script.js' });
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
30
|
+
throw new Error(`${what} does not parse as JavaScript (${msg}). The generator joins chunks with a newline — ` +
|
|
31
|
+
'a split mid-token becomes a syntax error on chain, and verify would still go green. ' +
|
|
32
|
+
'Fix the script (or break long lines) before deploying.');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=script-chunks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-chunks.js","sourceRoot":"","sources":["../src/script-chunks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAC,KAAK,EAAW,MAAM,MAAM,CAAC;AACrC,OAAO,EAAC,gBAAgB,EAAE,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAEvE;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc,EAAE,SAAkB;IAClE,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACzG,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACvC,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,wFAAwF;YACtF,6EAA6E,CAChF,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAc,EAAE,IAAY;IACtD,IAAI,CAAC;QACH,gGAAgG;QAChG,IAAI,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,WAAW,EAAC,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACvD,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,kCAAkC,GAAG,iDAAiD;YAC3F,sFAAsF;YACtF,wDAAwD,CAC3D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/served.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface ServedTokenUri {
|
|
2
|
+
/** The URL followed, verbatim from the contract. `null` when the tokenURI isn't fetchable. */
|
|
3
|
+
url: string | null;
|
|
4
|
+
/** Why there was nothing to fetch, when there was nothing to fetch. */
|
|
5
|
+
skipped: string | null;
|
|
6
|
+
status: number | null;
|
|
7
|
+
contentType: string | null;
|
|
8
|
+
/** The response body as text, untruncated. `null` when the request never completed. */
|
|
9
|
+
body: string | null;
|
|
10
|
+
/** Transport-level failure (DNS, refused, timeout) — distinct from a served error status. */
|
|
11
|
+
error?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface FetchServedOptions {
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
fetchFn?: typeof fetch;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Follow a `tokenURI` and return what came back.
|
|
19
|
+
*
|
|
20
|
+
* A `data:` URI is **not** an error here — it IS the document, and a fully-on-chain project's whole
|
|
21
|
+
* point is that there is no server to ask. Saying so plainly is the honest answer; reporting it as a
|
|
22
|
+
* failure would punish the strongest configuration the protocol offers.
|
|
23
|
+
*/
|
|
24
|
+
export declare function fetchServedTokenUri(uri: string, opts?: FetchServedOptions): Promise<ServedTokenUri>;
|
|
25
|
+
/** Whether the served answer is one a marketplace could actually use. */
|
|
26
|
+
export declare function servedOk(served: ServedTokenUri): boolean;
|
|
27
|
+
/** Pretty-print a served body when it is JSON, else return it unchanged. Never throws. */
|
|
28
|
+
export declare function prettyBody(body: string | null): string;
|
|
29
|
+
export declare function decodeOnChainJson(uri: string, verbatim?: boolean): string | null;
|
|
30
|
+
//# sourceMappingURL=served.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"served.d.ts","sourceRoot":"","sources":["../src/served.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,cAAc;IAC7B,8FAA8F;IAC9F,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,uEAAuE;IACvE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,uFAAuF;IACvF,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,6FAA6F;IAC7F,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;CACxB;AAID;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,kBAAuB,GAAG,OAAO,CAAC,cAAc,CAAC,CAsC7G;AAED,yEAAyE;AACzE,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAExD;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAOtD;AAKD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,MAAM,GAAG,IAAI,CAqB9E"}
|
package/dist/served.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a URL-valued `tokenURI` **actually returns** — the served answer, not the pointer.
|
|
3
|
+
*
|
|
4
|
+
* `abx tokenuri` reads the chain, `abx verify` re-hashes bytes, and `abx status` reports the
|
|
5
|
+
* indexing lifecycle — each a different slice, none of them the served JSON body. Fetching the
|
|
6
|
+
* served JSON requires an explicit path.
|
|
7
|
+
*
|
|
8
|
+
* It also answers the question a *warning* couldn't. "Nothing tells you the provider you registered
|
|
9
|
+
* with isn't the base baked on-chain" is real, but the obvious check — compare the remote's base URL
|
|
10
|
+
* to the on-chain one — false-positives on the common custom-domain case (a baked `meta.creator.xyz`
|
|
11
|
+
* fronting `api.provider.xyz`), and a warning that cries wolf on the correct setup is worse than none.
|
|
12
|
+
* Fetching what the **baked** base serves makes the mismatch self-evident instead: you see the other
|
|
13
|
+
* provider's 404, or another project's document.
|
|
14
|
+
*
|
|
15
|
+
* Lives in its own module because `main.ts` exports nothing (it runs `main()` unconditionally), so
|
|
16
|
+
* anything that needs a test seam has to be extracted — the same reason `scaffold.ts` exists.
|
|
17
|
+
*/
|
|
18
|
+
import { parseDataUri } from '@artblocks/abx-sdk';
|
|
19
|
+
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
20
|
+
/**
|
|
21
|
+
* Follow a `tokenURI` and return what came back.
|
|
22
|
+
*
|
|
23
|
+
* A `data:` URI is **not** an error here — it IS the document, and a fully-on-chain project's whole
|
|
24
|
+
* point is that there is no server to ask. Saying so plainly is the honest answer; reporting it as a
|
|
25
|
+
* failure would punish the strongest configuration the protocol offers.
|
|
26
|
+
*/
|
|
27
|
+
export async function fetchServedTokenUri(uri, opts = {}) {
|
|
28
|
+
if (!/^https?:\/\//i.test(uri)) {
|
|
29
|
+
return {
|
|
30
|
+
url: null,
|
|
31
|
+
skipped: uri.startsWith('data:')
|
|
32
|
+
? 'the tokenURI IS the document (a data: URI) — it resolves on-chain, so there is no server to ask'
|
|
33
|
+
: `the tokenURI is not an http(s) URL (${uri.slice(0, 40)}…) — nothing to fetch`,
|
|
34
|
+
status: null,
|
|
35
|
+
contentType: null,
|
|
36
|
+
body: null,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const doFetch = opts.fetchFn ?? fetch;
|
|
40
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
41
|
+
const ctrl = new AbortController();
|
|
42
|
+
const timer = setTimeout(() => ctrl.abort(), timeoutMs);
|
|
43
|
+
try {
|
|
44
|
+
const res = await doFetch(uri, { signal: ctrl.signal, redirect: 'follow' });
|
|
45
|
+
return {
|
|
46
|
+
url: uri,
|
|
47
|
+
skipped: null,
|
|
48
|
+
status: res.status,
|
|
49
|
+
contentType: res.headers.get('content-type'),
|
|
50
|
+
body: await res.text(),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
const aborted = err.name === 'AbortError' || ctrl.signal.aborted;
|
|
55
|
+
return {
|
|
56
|
+
url: uri,
|
|
57
|
+
skipped: null,
|
|
58
|
+
status: null,
|
|
59
|
+
contentType: null,
|
|
60
|
+
body: null,
|
|
61
|
+
error: aborted ? `no response in ${timeoutMs}ms` : err.message,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
clearTimeout(timer);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Whether the served answer is one a marketplace could actually use. */
|
|
69
|
+
export function servedOk(served) {
|
|
70
|
+
return served.status !== null && served.status >= 200 && served.status < 300;
|
|
71
|
+
}
|
|
72
|
+
/** Pretty-print a served body when it is JSON, else return it unchanged. Never throws. */
|
|
73
|
+
export function prettyBody(body) {
|
|
74
|
+
if (!body)
|
|
75
|
+
return '';
|
|
76
|
+
try {
|
|
77
|
+
return JSON.stringify(JSON.parse(body), null, 2);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return body; // not JSON — a provider's HTML error page is still worth seeing verbatim
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// Read tokenURI(id) STRAIGHT FROM THE CONTRACT on-chain (no server, no node) and decode
|
|
84
|
+
// the data: URI. For a fully on-chain token (`--onchain-uri`), this is the proof it
|
|
85
|
+
// self-resolves: the renderer assembles the JSON on-chain; any RPC returns it.
|
|
86
|
+
export function decodeOnChainJson(uri, verbatim = false) {
|
|
87
|
+
const parsed = parseDataUri(uri);
|
|
88
|
+
if (!parsed || parsed.mime !== 'application/json')
|
|
89
|
+
return null;
|
|
90
|
+
const raw = parsed.base64 ? Buffer.from(parsed.body, 'base64').toString('utf8') : decodeURIComponent(parsed.body);
|
|
91
|
+
try {
|
|
92
|
+
const obj = JSON.parse(raw);
|
|
93
|
+
// `verbatim` (--json) returns the document EXACTLY as the chain assembled it. Everything below is
|
|
94
|
+
// a courtesy for human eyes, and abbreviating for eyes is fine — abbreviating for a PROGRAM is
|
|
95
|
+
// not. An integrator scraped this output, got a `data:` URI cut to 96 chars that still looked
|
|
96
|
+
// valid, and stored it; the only way to read their own token was to reimplement `eth_call`.
|
|
97
|
+
if (verbatim)
|
|
98
|
+
return JSON.stringify(obj, null, 2);
|
|
99
|
+
for (const k of Object.keys(obj)) {
|
|
100
|
+
const v = obj[k];
|
|
101
|
+
// Truncate only huge inline `data:` blobs (base64 SVGs/images); show plain locator URLs
|
|
102
|
+
// (http/ipfs/ar) IN FULL so the creator can verify where the image actually resolves.
|
|
103
|
+
if (typeof v === 'string' && v.startsWith('data:') && v.length > 96)
|
|
104
|
+
obj[k] = `${v.slice(0, 96)}… (${v.length} chars) [--json for the full value]`;
|
|
105
|
+
}
|
|
106
|
+
return JSON.stringify(obj, null, 2);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return verbatim ? raw : raw.slice(0, 600);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=served.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"served.js","sourceRoot":"","sources":["../src/served.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAoBhD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,GAAW,EAAE,OAA2B,EAAE;IAClF,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO;YACL,GAAG,EAAE,IAAI;YACT,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;gBAC9B,CAAC,CAAC,iGAAiG;gBACnG,CAAC,CAAC,uCAAuC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,uBAAuB;YAClF,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,IAAI;YACjB,IAAI,EAAE,IAAI;SACX,CAAC;IACJ,CAAC;IACD,M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FAAsF;YACtF,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,EAAE;gBAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,MAAM,sCAAsC,CAAC;QACtJ,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC"}
|
package/dist/signer.d.ts
CHANGED
|
@@ -8,13 +8,14 @@ import type { TransactionReceipt } from 'viem';
|
|
|
8
8
|
* • send (hot) — sign with the env key and broadcast. Autonomous agents, testnet, low stakes.
|
|
9
9
|
* • sign (wallet) — serve a one-shot, operation-aware localhost page; a human approves in their
|
|
10
10
|
* own wallet (the key never touches this process). Real value, mainnet.
|
|
11
|
+
* • sponsor — one ephemeral Privy authorization; ABX Services relays an eligible Base-network tx.
|
|
11
12
|
* • unsigned (cold)— print the tx data to sign elsewhere (a multisig / offline signer).
|
|
12
13
|
*
|
|
13
14
|
* The agent picks the lane; the CLI owns the mechanics. Signing is the only step
|
|
14
15
|
* that ever differs — everything up to the prepared tx, and the re-index after,
|
|
15
16
|
* is identical across lanes.
|
|
16
17
|
*/
|
|
17
|
-
export type Lane = 'send' | 'sign' | 'unsigned';
|
|
18
|
+
export type Lane = 'send' | 'sign' | 'sponsor' | 'unsigned';
|
|
18
19
|
/** A prepared tx, or — when the signer's address is needed to build it (deploy) — a builder of one. */
|
|
19
20
|
export type TxProvider = PreparedTx | ((signer: Address) => PreparedTx | Promise<PreparedTx>);
|
|
20
21
|
export interface SignOptions {
|
|
@@ -34,13 +35,31 @@ export interface SignResult {
|
|
|
34
35
|
txHash: Hex;
|
|
35
36
|
prepared: PreparedTx;
|
|
36
37
|
blockNumber: bigint;
|
|
38
|
+
/** Present only for a successful direct EVM contract-creation transaction. */
|
|
39
|
+
contractAddress: Address | null;
|
|
37
40
|
}
|
|
41
|
+
/** Unknown chains stay on the conservative side. Known testnets come from the shared registry so
|
|
42
|
+
* adding a network cannot silently leave autonomous test workflows behind. */
|
|
43
|
+
export declare function envKeyRequiresYes(chainKey: string): boolean;
|
|
38
44
|
/**
|
|
39
45
|
* Sign and (for hot/wallet) broadcast a prepared tx via the chosen lane. Returns
|
|
40
46
|
* the broadcast tx hash, or `null` for the cold lane (nothing is sent — the
|
|
41
47
|
* caller hands the printed tx to an external signer).
|
|
42
48
|
*/
|
|
43
49
|
export declare function signTx(provider: TxProvider, opts: SignOptions): Promise<SignResult | null>;
|
|
50
|
+
/**
|
|
51
|
+
* Sign + broadcast a SEQUENCE of prepared txs on the hot lane, in order — the hot-lane sibling of
|
|
52
|
+
* the wallet lane's `openWalletSession({total: N})` (one session, N approvals) and the cold lane's
|
|
53
|
+
* per-tx `signTx` loop (see e.g. `deploy-code`'s cold-lane branch in main.ts). One
|
|
54
|
+
* {@link makeHotSender} for the whole sequence, so the nonce is pinned once and gas is re-checked
|
|
55
|
+
* per tx against the target a PRIOR tx in this same sequence may just have created (a multi-tx code
|
|
56
|
+
* deploy: the setup multicall targets the clone the deploy tx just made). Replaces what used to be
|
|
57
|
+
* a hand-rolled nonce/gas loop at the one call site that needed it.
|
|
58
|
+
*/
|
|
59
|
+
export declare function signHotSequence(txs: PreparedTx[], opts: {
|
|
60
|
+
chainKey: string;
|
|
61
|
+
yes?: boolean;
|
|
62
|
+
}): Promise<SignResult[]>;
|
|
44
63
|
/**
|
|
45
64
|
* The one sign-page implementation behind the whole wallet lane — single owner ops AND
|
|
46
65
|
* multi-tx staged deploys both run through it ({@link signWallet} just opens one with
|
package/dist/signer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAGA,OAAO,EAUL,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,MAAM,CAAC;AAI7C;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;AAE5D,uGAAuG;AACvG,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AAE9F,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,sGAAsG;IACtG,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8EAA8E;IAC9E,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;gGAC4F;IAC5F,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAiBD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,GAAG,CAAC;IACZ,QAAQ,EAAE,UAAU,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,eAAe,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC;AAGD;8EAC8E;AAC9E,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE3D;AAgED;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,W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