@centrifuge/sdk 1.9.1 → 1.12.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.
Files changed (112) hide show
  1. package/dist/Centrifuge.d.ts +1388 -5229
  2. package/dist/Centrifuge.d.ts.map +1 -1
  3. package/dist/Centrifuge.js +163 -0
  4. package/dist/Centrifuge.js.map +1 -1
  5. package/dist/Centrifuge.test.js +219 -0
  6. package/dist/Centrifuge.test.js.map +1 -1
  7. package/dist/abi/MultiAdapter.abi.d.ts +1 -1
  8. package/dist/abi/MultiAdapter.abi.js +1 -1
  9. package/dist/abi/MultiAdapter.abi.js.map +1 -1
  10. package/dist/abi/OnchainPM.abi.d.ts +3 -0
  11. package/dist/abi/OnchainPM.abi.d.ts.map +1 -0
  12. package/dist/abi/OnchainPM.abi.js +14 -0
  13. package/dist/abi/OnchainPM.abi.js.map +1 -0
  14. package/dist/abi/OnchainPMFactory.abi.d.ts +3 -0
  15. package/dist/abi/OnchainPMFactory.abi.d.ts.map +1 -0
  16. package/dist/abi/OnchainPMFactory.abi.js +6 -0
  17. package/dist/abi/OnchainPMFactory.abi.js.map +1 -0
  18. package/dist/abi/OracleValuation.abi.d.ts +3 -0
  19. package/dist/abi/OracleValuation.abi.d.ts.map +1 -0
  20. package/dist/abi/OracleValuation.abi.js +9 -0
  21. package/dist/abi/OracleValuation.abi.js.map +1 -0
  22. package/dist/abi/ScriptHelpers.abi.d.ts +3 -0
  23. package/dist/abi/ScriptHelpers.abi.d.ts.map +1 -0
  24. package/dist/abi/ScriptHelpers.abi.js +5 -0
  25. package/dist/abi/ScriptHelpers.abi.js.map +1 -0
  26. package/dist/abi/index.d.ts +281 -0
  27. package/dist/abi/index.d.ts.map +1 -1
  28. package/dist/abi/index.js +8 -0
  29. package/dist/abi/index.js.map +1 -1
  30. package/dist/config/chains.d.ts +38 -9
  31. package/dist/config/chains.d.ts.map +1 -1
  32. package/dist/entities/OnchainPM.d.ts +203 -0
  33. package/dist/entities/OnchainPM.d.ts.map +1 -0
  34. package/dist/entities/OnchainPM.js +315 -0
  35. package/dist/entities/OnchainPM.js.map +1 -0
  36. package/dist/entities/OnchainPM.test.d.ts +2 -0
  37. package/dist/entities/OnchainPM.test.d.ts.map +1 -0
  38. package/dist/entities/OnchainPM.test.js +155 -0
  39. package/dist/entities/OnchainPM.test.js.map +1 -0
  40. package/dist/entities/Pool.d.ts +81 -3
  41. package/dist/entities/Pool.d.ts.map +1 -1
  42. package/dist/entities/Pool.js +207 -18
  43. package/dist/entities/Pool.js.map +1 -1
  44. package/dist/entities/PoolNetwork.d.ts +37 -0
  45. package/dist/entities/PoolNetwork.d.ts.map +1 -1
  46. package/dist/entities/PoolNetwork.js +136 -12
  47. package/dist/entities/PoolNetwork.js.map +1 -1
  48. package/dist/entities/PoolNetwork.test.js +134 -1
  49. package/dist/entities/PoolNetwork.test.js.map +1 -1
  50. package/dist/entities/ShareClass.d.ts.map +1 -1
  51. package/dist/entities/ShareClass.js +68 -74
  52. package/dist/entities/ShareClass.js.map +1 -1
  53. package/dist/entities/crosschainMessages.d.ts +127 -0
  54. package/dist/entities/crosschainMessages.d.ts.map +1 -0
  55. package/dist/entities/crosschainMessages.js +204 -0
  56. package/dist/entities/crosschainMessages.js.map +1 -0
  57. package/dist/index.d.ts +16 -1
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +8 -0
  60. package/dist/index.js.map +1 -1
  61. package/dist/types/index.d.ts +3 -0
  62. package/dist/types/index.d.ts.map +1 -1
  63. package/dist/types/poolMetadata.d.ts +28 -0
  64. package/dist/types/poolMetadata.d.ts.map +1 -1
  65. package/dist/types/transaction.d.ts +5 -1
  66. package/dist/types/transaction.d.ts.map +1 -1
  67. package/dist/types/transaction.js.map +1 -1
  68. package/dist/types/workflow.d.ts +151 -0
  69. package/dist/types/workflow.d.ts.map +1 -0
  70. package/dist/types/workflow.js +5 -0
  71. package/dist/types/workflow.js.map +1 -0
  72. package/dist/utils/catalog.d.ts +29 -0
  73. package/dist/utils/catalog.d.ts.map +1 -0
  74. package/dist/utils/catalog.js +396 -0
  75. package/dist/utils/catalog.js.map +1 -0
  76. package/dist/utils/catalog.test.d.ts +2 -0
  77. package/dist/utils/catalog.test.d.ts.map +1 -0
  78. package/dist/utils/catalog.test.js +291 -0
  79. package/dist/utils/catalog.test.js.map +1 -0
  80. package/dist/utils/scriptHash.d.ts +32 -0
  81. package/dist/utils/scriptHash.d.ts.map +1 -0
  82. package/dist/utils/scriptHash.js +67 -0
  83. package/dist/utils/scriptHash.js.map +1 -0
  84. package/dist/utils/scriptHash.test.d.ts +2 -0
  85. package/dist/utils/scriptHash.test.d.ts.map +1 -0
  86. package/dist/utils/scriptHash.test.js +97 -0
  87. package/dist/utils/scriptHash.test.js.map +1 -0
  88. package/dist/utils/variables.d.ts +78 -0
  89. package/dist/utils/variables.d.ts.map +1 -0
  90. package/dist/utils/variables.js +105 -0
  91. package/dist/utils/variables.js.map +1 -0
  92. package/dist/utils/variables.test.d.ts +2 -0
  93. package/dist/utils/variables.test.d.ts.map +1 -0
  94. package/dist/utils/variables.test.js +110 -0
  95. package/dist/utils/variables.test.js.map +1 -0
  96. package/dist/utils/weiroll.d.ts +176 -0
  97. package/dist/utils/weiroll.d.ts.map +1 -0
  98. package/dist/utils/weiroll.js +341 -0
  99. package/dist/utils/weiroll.js.map +1 -0
  100. package/dist/utils/weiroll.test.d.ts +2 -0
  101. package/dist/utils/weiroll.test.d.ts.map +1 -0
  102. package/dist/utils/weiroll.test.js +430 -0
  103. package/dist/utils/weiroll.test.js.map +1 -0
  104. package/dist/utils/workflowExecute.d.ts +121 -0
  105. package/dist/utils/workflowExecute.d.ts.map +1 -0
  106. package/dist/utils/workflowExecute.js +577 -0
  107. package/dist/utils/workflowExecute.js.map +1 -0
  108. package/dist/utils/workflowExecute.test.d.ts +2 -0
  109. package/dist/utils/workflowExecute.test.d.ts.map +1 -0
  110. package/dist/utils/workflowExecute.test.js +117 -0
  111. package/dist/utils/workflowExecute.test.js.map +1 -0
  112. package/package.json +3 -3
@@ -0,0 +1,151 @@
1
+ import type { HexString } from './index.js';
2
+ /**
3
+ * A single contract call step in the workflow.
4
+ * Maps 1:1 to WeirollAction used by buildScript().
5
+ */
6
+ export interface ActionDefinition {
7
+ /** 20-byte target contract address. */
8
+ target: HexString;
9
+ /** 4-byte function selector (e.g. `0x12345678`). */
10
+ selector: HexString;
11
+ /** Call type: 1 = CALL, 2 = STATICCALL, 3 = VALUECALL. */
12
+ callType: 1 | 2 | 3;
13
+ /** Up to 6 state-slot indices for the call's inputs. */
14
+ inputs: number[];
15
+ /** State slot to write the return value into, or 0xFF to discard. */
16
+ output: number;
17
+ /** When true, sets FLAG_RAW — use for manually ABI-encoded calldata. */
18
+ rawMode?: boolean;
19
+ /**
20
+ * When true, pool managers may exclude this action when adding the workflow
21
+ * to a group. The action must have output = 0xFF (no downstream dependency).
22
+ */
23
+ optional?: boolean;
24
+ }
25
+ /**
26
+ * Describes a single state slot in the workflow's initial state.
27
+ *
28
+ * - `literal` — fixed value, pinned at whitelist time
29
+ * - `magic` — resolved from PoolContext by key (e.g. `poolId`, `hubAddress`)
30
+ * - `configurable` — value supplied by the pool manager at configuration time
31
+ * - `runtime` — placeholder filled at execution time (not pinned in hash)
32
+ *
33
+ * The `configurable` flag marks inputs that pool managers can adjust (e.g.
34
+ * slippage tolerance). It is orthogonal to `type` and present on any slot
35
+ * that should be surfaced in configuration UIs.
36
+ */
37
+ export interface InputDefinition {
38
+ /** Stable identifier for this slot (referenced by key in magic/configurable/runtime slots). */
39
+ key: string;
40
+ type: 'literal' | 'magic' | 'configurable' | 'runtime';
41
+ /** ABI-encoded initial value. Required when type = 'literal'. */
42
+ value?: HexString;
43
+ /** Human-readable label shown in configuration UIs. */
44
+ label?: string;
45
+ /** Whether this input is surfaced as a user-configurable parameter. */
46
+ configurable?: boolean;
47
+ }
48
+ /** A single input descriptor on a catalog action (human-readable form). */
49
+ export interface CatalogActionInput {
50
+ parameter: string;
51
+ label?: string;
52
+ /** Each element is a `$variable` reference or an inline literal. Empty only with useTemplate. */
53
+ input: string[];
54
+ useTemplate?: {
55
+ template: string;
56
+ map?: Record<string, string>;
57
+ };
58
+ }
59
+ /** A contract call step as represented in the IPFS catalog (human-readable form). */
60
+ export interface CatalogAction {
61
+ target: string;
62
+ targetName?: string;
63
+ name?: string;
64
+ selector: string;
65
+ valueNonZero?: boolean;
66
+ rawMode?: boolean;
67
+ optional?: boolean;
68
+ inputs: CatalogActionInput[];
69
+ returns?: string;
70
+ }
71
+ /**
72
+ * A runtime input declaration. The legacy form is a bare variable name; the
73
+ * object form (centrifuge/workflows #84) additionally links an amount input to
74
+ * its denominating `token` (for decimals/symbol) and the `source` holder address
75
+ * whose balance bounds the max. `token`/`source` are `$`-references to declared,
76
+ * magic, or runtime variables.
77
+ */
78
+ export type RuntimeVariable = string | {
79
+ name: string;
80
+ token?: string;
81
+ source?: string;
82
+ };
83
+ /** Normalize a {@link RuntimeVariable} to its bare-or-`$`-prefixed name. */
84
+ export declare function runtimeVariableName(variable: RuntimeVariable): string;
85
+ /**
86
+ * A declared template variable (explicit-input-kinds tagged format). Every action input
87
+ * references a `$variable` (or inline literal); the variable carries its trust `kind`:
88
+ * - `pinned` — value fixed at generation time, provided per-workflow (addresses, ids)
89
+ * - `configurable` — value set by the hub manager at policy creation, immutable after
90
+ * - `param` — bound by a caller's use.map (use-only templates; resolved away when inlined)
91
+ * - `runtime` — supplied by the strategist per execution (adversarial)
92
+ * `token`/`source` are runtime-only UI hints. Magic ($onchainPM, $poolId, …) and `returns`
93
+ * names are implicit and not declared here.
94
+ */
95
+ export interface CatalogVariable {
96
+ name: string;
97
+ kind: 'pinned' | 'configurable' | 'param' | 'runtime';
98
+ token?: string;
99
+ source?: string;
100
+ }
101
+ /** A reusable action template from the marketplace catalog. */
102
+ export interface CatalogTemplate {
103
+ actions: CatalogAction[];
104
+ variables?: CatalogVariable[];
105
+ id?: string;
106
+ }
107
+ /**
108
+ * A workflow entry returned by `centrifuge.workflowMarketplace()`.
109
+ * Parsed from the IPFS catalog envelope `{ templates, workflows, ... }`.
110
+ * Template actions are resolved and attached under `actions`.
111
+ *
112
+ * `useTemplate` entries (callback scripts) are filtered out automatically.
113
+ */
114
+ export interface MarketplaceWorkflow {
115
+ /** Stable identifier for the workflow (catalog `id` field). */
116
+ workflowRef: string;
117
+ /** Display name shown in the UI. */
118
+ name: string;
119
+ /** Name of the template this workflow uses (e.g. `"erc7540_account"`). */
120
+ template: string;
121
+ /** UI grouping category (e.g. `"Centrifuge"`). */
122
+ category?: string;
123
+ /** Logical group within the template (e.g. `"account"`). */
124
+ group?: string;
125
+ /** EVM chain ID this workflow is deployed on. */
126
+ chainId: number;
127
+ /** URL of the workflow icon image. */
128
+ iconUrl?: string;
129
+ /** Pre-set contract address variables for this workflow instance. */
130
+ variables: Record<string, string>;
131
+ /** Pre-computed keccak256 script hash for this workflow configuration. */
132
+ workflowId: string;
133
+ /** Catalog version number. */
134
+ version: number;
135
+ /** Deployment environment (e.g. `"testnet"`). */
136
+ workspace?: string;
137
+ /** When present, this is a callback script — filtered out by the SDK. */
138
+ useTemplate?: string;
139
+ /** Template registry from the source catalog, used for nested callback compilation. */
140
+ templates?: Record<string, CatalogTemplate>;
141
+ /** Human-readable contract call steps resolved from the template. */
142
+ actions: CatalogAction[];
143
+ /** Runtime inputs supplied by the executor when the workflow runs (names only). */
144
+ runtimeVariables?: string[];
145
+ /**
146
+ * Full runtime input declarations, preserving the optional `token`/`source`
147
+ * links from the object form. Aligned 1:1 with `runtimeVariables` by name.
148
+ */
149
+ runtimeVariableEntries?: RuntimeVariable[];
150
+ }
151
+ //# sourceMappingURL=workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/types/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAS3C;;;GAGG;AACH,MAAM,WAAW,g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AAA;IAClB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC3C,qEAAqE;IACrE,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,mFAAmF;IACnF,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B;;;OAGG;IACH,sBAAsB,CAAC,EAAE,eAAe,EAAE,CAAA;CAC3C"}
@@ -0,0 +1,5 @@
1
+ /** Normalize a {@link RuntimeVariable} to its bare-or-`$`-prefixed name. */
2
+ export function runtimeVariableName(variable) {
3
+ return typeof variable === 'string' ? variable : variable.name;
4
+ }
5
+ //# sourceMappingURL=workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../src/types/workflow.ts"],"names":[],"mappings":"AA2FA,4EAA4E;AAC5E,MAAM,UAAU,mBAAmB,CAAC,QAAyB;IAC3D,OAAO,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAA;AAChE,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { CatalogTemplate, MarketplaceWorkflow } from '../types/workflow.js';
2
+ import type { WorkflowDefinition } from './weiroll.js';
3
+ export interface BuildWorkflowDefinitionFromCatalogOptions {
4
+ templates?: Record<string, CatalogTemplate>;
5
+ }
6
+ /**
7
+ * Converts a MarketplaceWorkflow (from the IPFS catalog) into a WorkflowDefinition
8
+ * that can be passed to buildScript().
9
+ *
10
+ * Slot classification for each $variable:
11
+ * - in workflow.variables (strip $) → literal (resolved, pinned in bitmap)
12
+ * - in MAGIC_VARIABLE_KEYS → magic (resolved from poolContext)
13
+ * - appears as action.returns → runtime (computed by weiroll during execution)
14
+ * - anything else → runtime (filled by user before execution)
15
+ *
16
+ * Bare `input: []` values are treated as runtime inputs too:
17
+ * - use catalog `runtimeVariables` when the mapping is unambiguous
18
+ * - otherwise synthesize a per-input runtime key so the FE can ask the user
19
+ * for the missing values explicitly
20
+ *
21
+ * Only the last category is included in runtimeVariables — the UI shows an
22
+ * input field for each of those. Computed slots start as empty bytes and are written
23
+ * by the weiroll VM when the producing action runs.
24
+ *
25
+ * Action outputs are set to the corresponding slot index when action.returns is
26
+ * present, and UNUSED_SLOT otherwise.
27
+ */
28
+ export declare function buildWorkflowDefinitionFromCatalog(workflow: MarketplaceWorkflow, options?: BuildWorkflowDefinitionFromCatalogOptions): WorkflowDefinition;
29
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/utils/catalog.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,eAAe,EAEf,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAG7B,OAAO,KAAK,EAAiB,kBAAkB,EAAqB,MAAM,cAAc,CAAA;AA8DxF,MAAM,WAAW,yCAAyC;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CAC5C;AA4FD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kCAAkC,CAChD,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,GAAE,yCAA8C,GACtD,kBAAkB,CAmTpB"}
@@ -0,0 +1,396 @@
1
+ import { toFunctionSelector } from 'viem';
2
+ import { MAGIC_VARIABLE_KEYS } from './variables.js';
3
+ import { CALL, UNUSED_SLOT, VALUECALL } from './weiroll.js';
4
+ const MAGIC_KEY_SET = new Set(MAGIC_VARIABLE_KEYS);
5
+ /**
6
+ * Encodes a catalog literal value for weiroll state.
7
+ *
8
+ * The catalog stores values in human-readable form:
9
+ * - Decimal integers: "0", "100", "5192296858534827628530496329220097"
10
+ * - Booleans: "true", "false"
11
+ * - Hex addresses (20 bytes): "0x5ba3f068..."
12
+ * - Hex values (any length ≤ 32 bytes): "0x00010000..."
13
+ * - Dynamic bytes: "0x63637470..."
14
+ *
15
+ * Static values are normalised to 0x-prefixed 32-byte values by left-padding with zeros,
16
+ * matching Solidity ABI encoding for uint and address types. Dynamic bytes are preserved as
17
+ * raw bytes because weiroll stores state as `bytes[]`.
18
+ */
19
+ function encodeLiteralValue(raw, parameter = '') {
20
+ if (parameter === 'bytes') {
21
+ if (/^0x(?:[0-9a-fA-F]{2})*$/.test(raw)) {
22
+ // A `bytes` state slot consumed via the weiroll 0x80 variable-length input specifier must
23
+ // hold the INNER ABI encoding of the value — a 32-byte length word followed by the data
24
+ // padded to a multiple of 32 bytes — because the VM copies the slot verbatim into the
25
+ // calldata tail (it does NOT prepend the length). Storing the raw bytes left the length
26
+ // word out, so a non-empty literal (e.g. CCTP's forwarding hook data) decoded as a garbage
27
+ // length and reverted. Empty bytes naturally encode to a single 32-byte zero word
28
+ // (length 0), which also satisfies weiroll's "non-zero multiple of 32 bytes" requirement.
29
+ const dataHex = raw.slice(2);
30
+ const lengthWord = (dataHex.length / 2).toString(16).padStart(64, '0');
31
+ const paddedData = dataHex.length === 0 ? '' : dataHex.padEnd(Math.ceil(dataHex.length / 64) * 64, '0');
32
+ return `0x${lengthWord}${paddedData}`;
33
+ }
34
+ throw new Error(`buildWorkflowDefinitionFromCatalog: unsupported bytes literal "${raw}"`);
35
+ }
36
+ if (raw === 'true')
37
+ return `0x${'0'.repeat(63)}1`;
38
+ if (raw === 'false')
39
+ return `0x${'0'.repeat(64)}`;
40
+ if (/^\d+$/.test(raw))
41
+ return `0x${BigInt(raw).toString(16).padStart(64, '0')}`;
42
+ if (/^0x[0-9a-fA-F]+$/.test(raw)) {
43
+ const body = raw.slice(2);
44
+ if (body.length > 64) {
45
+ throw new Error(`buildWorkflowDefinitionFromCatalog: hex literal "${raw}" exceeds 32 bytes`);
46
+ }
47
+ return `0x${body.padStart(64, '0')}`;
48
+ }
49
+ throw new Error(`buildWorkflowDefinitionFromCatalog: unsupported literal "${raw}"`);
50
+ }
51
+ function stripVariablePrefix(raw) {
52
+ return raw.startsWith('$') ? raw.slice(1) : raw;
53
+ }
54
+ function fallbackLabel(label, key, parameter) {
55
+ return label?.trim() || key || parameter;
56
+ }
57
+ const RAW_CALLDATA_PARAMETER_SET = new Set(['(address,uint256)[]', '(address,address)[]']);
58
+ const VARIABLE_LENGTH_PARAMETER_SET = new Set(['bytes']);
59
+ const PAYABLE_VALUE_RUNTIME_KEY_PREFIX = '__sdk_payable_value:';
60
+ function buildPayableValueRuntimeKey(actionIndex) {
61
+ return `${PAYABLE_VALUE_RUNTIME_KEY_PREFIX}${actionIndex}`;
62
+ }
63
+ function isVariableLengthParameter(parameter) {
64
+ return VARIABLE_LENGTH_PARAMETER_SET.has(parameter);
65
+ }
66
+ function isDynamicArrayParameter(parameter) {
67
+ return /\[\]/.test(parameter);
68
+ }
69
+ function isDynamicAbiParameter(parameter) {
70
+ return (parameter === 'bytes' ||
71
+ parameter === 'string' ||
72
+ isDynamicArrayParameter(parameter) ||
73
+ RAW_CALLDATA_PARAMETER_SET.has(parameter));
74
+ }
75
+ function requiresRawCalldataParameter(parameter) {
76
+ return isDynamicAbiParameter(parameter) && !isVariableLengthParameter(parameter);
77
+ }
78
+ function mapTemplateReference(value, variableMap) {
79
+ if (!value.startsWith('$'))
80
+ return value;
81
+ return variableMap[value.slice(1)] ?? value;
82
+ }
83
+ function applyUseTemplateMap(actions, variableMap) {
84
+ return actions.map((action) => ({
85
+ ...action,
86
+ target: mapTemplateReference(action.target, variableMap),
87
+ inputs: action.inputs.map((input) => ({
88
+ ...input,
89
+ input: (input.input ?? []).map((value) => mapTemplateReference(value, variableMap)),
90
+ })),
91
+ }));
92
+ }
93
+ function encodeInputSpecifier(parameter, slotIndex) {
94
+ if (slotIndex < 0 || slotIndex > 0x7f) {
95
+ throw new Error(`buildWorkflowDefinitionFromCatalog: slot index ${slotIndex} exceeds weiroll limit 127`);
96
+ }
97
+ return isVariableLengthParameter(parameter) ? 0x80 | slotIndex : slotIndex;
98
+ }
99
+ function inferReturnValueModes(workflow) {
100
+ const returnModes = new Map();
101
+ for (const action of workflow.actions) {
102
+ if (!action.returns)
103
+ continue;
104
+ const observedModes = new Set();
105
+ for (const downstreamAction of workflow.actions) {
106
+ if (downstreamAction.target === action.returns) {
107
+ observedModes.add('static');
108
+ }
109
+ for (const input of downstreamAction.inputs) {
110
+ if ((input.input ?? []).includes(action.returns)) {
111
+ observedModes.add(isVariableLengthParameter(input.parameter) ? 'dynamic' : 'static');
112
+ }
113
+ }
114
+ }
115
+ if (observedModes.size === 0) {
116
+ const selector = action.selector.trim();
117
+ if (selector.startsWith('function encode') || selector === 'function bytesConcat(bytes,bytes)') {
118
+ observedModes.add('dynamic');
119
+ }
120
+ else {
121
+ observedModes.add('static');
122
+ }
123
+ }
124
+ if (observedModes.size > 1) {
125
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" return "${action.returns}" is used as both a static and dynamic value`);
126
+ }
127
+ returnModes.set(action.returns, [...observedModes][0]);
128
+ }
129
+ return returnModes;
130
+ }
131
+ /**
132
+ * Converts a MarketplaceWorkflow (from the IPFS catalog) into a WorkflowDefinition
133
+ * that can be passed to buildScript().
134
+ *
135
+ * Slot classification for each $variable:
136
+ * - in workflow.variables (strip $) → literal (resolved, pinned in bitmap)
137
+ * - in MAGIC_VARIABLE_KEYS → magic (resolved from poolContext)
138
+ * - appears as action.returns → runtime (computed by weiroll during execution)
139
+ * - anything else → runtime (filled by user before execution)
140
+ *
141
+ * Bare `input: []` values are treated as runtime inputs too:
142
+ * - use catalog `runtimeVariables` when the mapping is unambiguous
143
+ * - otherwise synthesize a per-input runtime key so the FE can ask the user
144
+ * for the missing values explicitly
145
+ *
146
+ * Only the last category is included in runtimeVariables — the UI shows an
147
+ * input field for each of those. Computed slots start as empty bytes and are written
148
+ * by the weiroll VM when the producing action runs.
149
+ *
150
+ * Action outputs are set to the corresponding slot index when action.returns is
151
+ * present, and UNUSED_SLOT otherwise.
152
+ */
153
+ export function buildWorkflowDefinitionFromCatalog(workflow, options = {}) {
154
+ const templates = options.templates ?? workflow.templates ?? {};
155
+ // Pre-scan: variables that are return values of some action are computed by
156
+ // the weiroll VM — they must NOT appear as user-filled inputs.
157
+ const computedVarSet = new Set();
158
+ const returnValueModes = inferReturnValueModes(workflow);
159
+ for (const [index, action] of workflow.actions.entries()) {
160
+ if (action.returns == null)
161
+ continue;
162
+ if (!action.returns.startsWith('$')) {
163
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${index} return "${action.returns}" must start with "$"`);
164
+ }
165
+ if (computedVarSet.has(action.returns)) {
166
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${index} duplicates return "${action.returns}"`);
167
+ }
168
+ if (MAGIC_KEY_SET.has(action.returns)) {
169
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${index} return "${action.returns}" collides with a magic variable`);
170
+ }
171
+ if (workflow.variables[stripVariablePrefix(action.returns)] !== undefined) {
172
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${index} return "${action.returns}" collides with a workflow variable`);
173
+ }
174
+ computedVarSet.add(action.returns);
175
+ }
176
+ const computedRuntimeKeys = new Set([...computedVarSet].map(stripVariablePrefix));
177
+ // Tagged variable kinds (explicit-input-kinds format): every $variable an input references
178
+ // is declared with a kind. pinned values come in via workflow.variables; configurable/runtime
179
+ // are classified from the kind here. Magic and `returns` names are implicit (not declared).
180
+ const kindByName = new Map();
181
+ for (const v of templates[workflow.template]?.variables ?? [])
182
+ kindByName.set(v.name, v.kind);
183
+ const slotMap = new Map();
184
+ const stateSlots = [];
185
+ function getOrAddSlot(canonical, slot) {
186
+ const existing = slotMap.get(canonical);
187
+ if (existing !== undefined) {
188
+ const current = stateSlots[existing];
189
+ if (current && 'label' in current && current.label == null && 'label' in slot && slot.label != null) {
190
+ stateSlots[existing] = { ...current, label: slot.label };
191
+ }
192
+ return existing;
193
+ }
194
+ const idx = stateSlots.length;
195
+ slotMap.set(canonical, idx);
196
+ stateSlots.push(slot);
197
+ return idx;
198
+ }
199
+ function getOrAddVariableSlot(raw, label, parameter = '', metadata) {
200
+ let canonical;
201
+ let slot;
202
+ if (raw.startsWith('$')) {
203
+ const key = stripVariablePrefix(raw);
204
+ const kind = kindByName.get(key);
205
+ if (MAGIC_KEY_SET.has(raw)) {
206
+ canonical = `magic:${raw}`;
207
+ slot = { type: 'magic', key: raw };
208
+ }
209
+ else if (workflow.variables[key] !== undefined) {
210
+ // pinned: value provided per-workflow, baked in at whitelist time.
211
+ const encoded = encodeLiteralValue(workflow.variables[key], parameter);
212
+ canonical = `literal:${encoded}`;
213
+ slot = { type: 'literal', value: encoded };
214
+ }
215
+ else if (kind === 'pinned') {
216
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" pinned variable "${key}" has no value in workflow.variables`);
217
+ }
218
+ else if (kind === 'configurable') {
219
+ // hub-manager-set at policy creation; one slot per configurable variable (keyed by name).
220
+ canonical = `configurable:${key}`;
221
+ slot = { type: 'configurable', key, label: fallbackLabel(label, key, parameter), parameter, ...metadata };
222
+ }
223
+ else {
224
+ // kind === 'runtime' (strategist) or a computed `returns` (written by the VM). Both are
225
+ // runtime slots; computed ones are excluded from the user-facing runtimeVariables below.
226
+ canonical = `runtime:${key}`;
227
+ slot = {
228
+ type: 'runtime',
229
+ key,
230
+ label: fallbackLabel(label, key, parameter),
231
+ parameter,
232
+ ...metadata,
233
+ };
234
+ }
235
+ }
236
+ else {
237
+ const encoded = encodeLiteralValue(raw, parameter);
238
+ canonical = `literal:${encoded}`;
239
+ slot = { type: 'literal', value: encoded };
240
+ }
241
+ return getOrAddSlot(canonical, slot);
242
+ }
243
+ const actions = workflow.actions.map((action, actionIndex) => {
244
+ if (action.optional && action.returns != null) {
245
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${actionIndex} is optional but also returns "${action.returns}"`);
246
+ }
247
+ const selector = /^0x[0-9a-fA-F]{8}$/.test(action.selector)
248
+ ? action.selector
249
+ : toFunctionSelector(action.selector);
250
+ // An input needs raw calldata assembly if it is dynamic AND its value is not
251
+ // already pinned in its own state slot at build time. For `bytes`/`string`
252
+ // parameters, the weiroll VM's 0x80 input-specifier handles dynamic length
253
+ // correctly without FLAG_RAW, so we only require raw calldata when the value
254
+ // is NOT known at build time (i.e. not a declared variable or configurable).
255
+ const hasDynamicInput = action.inputs.some((input) => {
256
+ if (!isDynamicAbiParameter(input.parameter))
257
+ return false;
258
+ if (input.useTemplate)
259
+ return false;
260
+ // Variable-length parameters (`bytes`/`string`) are ALWAYS encoded via the weiroll VM's
261
+ // 0x80 variable-length input specifier — for every source (literal, configurable, computed
262
+ // return, AND runtime). That path keeps the call's 4-byte selector in the (hashed) command
263
+ // word, so the strategist can vary only the argument value, never the function. Only
264
+ // non-variable-length dynamic types (e.g. tuple arrays) can't be spliced per-input and need
265
+ // FLAG_RAW assembly. Routing runtime `bytes` to FLAG_RAW (as before) handed the strategist
266
+ // the whole calldata blob including the selector — see audit #18 / SECURITY.md §11.
267
+ return !isVariableLengthParameter(input.parameter);
268
+ });
269
+ const hasComputedDynamicInput = action.inputs.some((input) => isDynamicAbiParameter(input.parameter) && (input.input ?? []).some((value) => computedVarSet.has(value)));
270
+ const hasRawCalldataOnlyInput = action.inputs.some((input) => requiresRawCalldataParameter(input.parameter));
271
+ const rawCalldataAction = action.rawMode === true || (action.returns == null && hasDynamicInput && !hasComputedDynamicInput);
272
+ if (rawCalldataAction && action.returns != null) {
273
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${actionIndex} uses raw calldata assembly and cannot return a value`);
274
+ }
275
+ if (action.returns != null && hasRawCalldataOnlyInput) {
276
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${actionIndex} uses dynamic calldata input that cannot return a value`);
277
+ }
278
+ if (hasRawCalldataOnlyInput && hasComputedDynamicInput) {
279
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${actionIndex} uses dynamic calldata input from a computed value, which cannot be assembled off-chain`);
280
+ }
281
+ const inputSlots = action.inputs.map((inp, inputIndex) => {
282
+ const values = inp.input ?? [];
283
+ const slotMetadata = {
284
+ actionName: action.name ?? action.selector,
285
+ actionIndex,
286
+ inputIndex,
287
+ };
288
+ if (inp.useTemplate) {
289
+ if (inp.parameter !== 'bytes') {
290
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${actionIndex} input ${inputIndex} uses useTemplate on non-bytes parameter "${inp.parameter}"`);
291
+ }
292
+ if (values.length !== 0) {
293
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${actionIndex} input ${inputIndex} uses useTemplate and must use an empty input array`);
294
+ }
295
+ const templateName = inp.useTemplate.template;
296
+ const template = templates[templateName];
297
+ if (!template) {
298
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${actionIndex} input ${inputIndex} references missing template "${templateName}"`);
299
+ }
300
+ const templateWorkflow = {
301
+ ...workflow,
302
+ workflowRef: `${workflow.workflowRef}:${templateName}:${actionIndex}:${inputIndex}`,
303
+ name: `${workflow.name} callback`,
304
+ template: templateName,
305
+ workflowId: '',
306
+ templates,
307
+ actions: applyUseTemplateMap(template.actions, inp.useTemplate.map ?? {}),
308
+ runtimeVariables: (template.variables ?? []).filter((v) => v.kind === 'runtime').map((v) => v.name),
309
+ };
310
+ const templateDefinition = buildWorkflowDefinitionFromCatalog(templateWorkflow, { templates });
311
+ return getOrAddSlot(`template:${actionIndex}:${inputIndex}:${templateName}`, {
312
+ type: 'template',
313
+ workflow: templateDefinition,
314
+ label: fallbackLabel(inp.label, templateName, inp.parameter),
315
+ ...slotMetadata,
316
+ });
317
+ }
318
+ if (values.length === 0) {
319
+ // No anonymous/empty slots in the tagged format — a value is a $variable or a literal,
320
+ // and a strategist value is a declared `runtime` variable. Empty is only for useTemplate.
321
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${actionIndex} input ${inputIndex} has an empty input — reference a $variable or literal (useTemplate is the only empty case)`);
322
+ }
323
+ if (values.length > 1) {
324
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${actionIndex} input ${inputIndex} uses ${values.length} values — multi-value inputs are not supported`);
325
+ }
326
+ return getOrAddVariableSlot(values[0], inp.label, inp.parameter, slotMetadata);
327
+ });
328
+ // Claim the output slot now so downstream actions referencing action.returns
329
+ // find the same slot index when they call getOrAddSlot.
330
+ const output = action.returns != null
331
+ ? (() => {
332
+ const outputSlot = getOrAddVariableSlot(action.returns);
333
+ return returnValueModes.get(action.returns) === 'dynamic' ? 0x80 | outputSlot : outputSlot;
334
+ })()
335
+ : UNUSED_SLOT;
336
+ const rawTarget = action.target;
337
+ const target = rawTarget.startsWith('$')
338
+ ? MAGIC_KEY_SET.has(rawTarget)
339
+ ? { type: 'magic', key: rawTarget }
340
+ : (() => {
341
+ const resolved = workflow.variables[rawTarget.slice(1)];
342
+ if (resolved === undefined) {
343
+ throw new Error(`buildWorkflowDefinitionFromCatalog: workflow "${workflow.workflowRef}" action ${actionIndex} target "${rawTarget}" is not a workflow variable or magic variable`);
344
+ }
345
+ return resolved;
346
+ })()
347
+ : rawTarget;
348
+ const payableValueSlot = action.valueNonZero === true
349
+ ? getOrAddSlot(`runtime:${buildPayableValueRuntimeKey(actionIndex)}`, {
350
+ type: 'runtime',
351
+ key: buildPayableValueRuntimeKey(actionIndex),
352
+ parameter: 'uint256',
353
+ actionName: action.name ?? action.selector,
354
+ actionIndex,
355
+ inputIndex: -1,
356
+ system: 'payableValue',
357
+ })
358
+ : null;
359
+ const inputs = rawCalldataAction
360
+ ? [
361
+ ...(payableValueSlot != null ? [payableValueSlot] : []),
362
+ getOrAddSlot(`rawcalldata:${actionIndex}`, {
363
+ type: 'rawcalldata',
364
+ selector,
365
+ parameterTypes: action.inputs.map((input) => input.parameter),
366
+ sourceSlots: inputSlots,
367
+ actionName: action.name ?? action.selector,
368
+ actionIndex,
369
+ }),
370
+ ]
371
+ : [
372
+ ...(payableValueSlot != null ? [payableValueSlot] : []),
373
+ ...action.inputs.map((input, index) => encodeInputSpecifier(input.parameter, inputSlots[index])),
374
+ ];
375
+ return {
376
+ target,
377
+ selector,
378
+ callType: action.valueNonZero ? VALUECALL : CALL,
379
+ inputs,
380
+ output: rawCalldataAction ? UNUSED_SLOT : output,
381
+ rawMode: rawCalldataAction || action.rawMode,
382
+ };
383
+ });
384
+ // Only variables that are NOT computed by a previous action belong in runtimeVariables.
385
+ // Those are the ones the user must supply before calling execute().
386
+ const runtimeVariables = stateSlots
387
+ .filter((s) => s.type === 'runtime' && !computedRuntimeKeys.has(s.key) && s.system !== 'payableValue')
388
+ .map((s) => s.key);
389
+ return {
390
+ workflowRef: workflow.workflowRef,
391
+ actions,
392
+ state: stateSlots,
393
+ runtimeVariables,
394
+ };
395
+ }
396
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/utils/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAA;AASzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAG3D,MAAM,aAAa,GAAG,IAAI,GAAG,CAAS,mBAAmB,CAAC,CAAA;AAE1D;;;;;;;;;;;;;GAaG;AACH,SAAS,kBAAkB,CAAC,GAAW,EAAE,SAAS,GAAG,EAAE;IACrD,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I,IAAI,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvD,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,KAAK,CAAE,CAAC,CAAC;aAClG,CAAA;QAEL,OAAO;YACL,MAAM;YACN,QAAQ;YACR,QAAQ,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI;YAChD,MAAM;YACN,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM;YAChD,OAAO,EAAE,iBAAiB,IAAI,MAAM,CAAC,OAAO;SAC7C,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,wFAAwF;IACxF,oEAAoE;IACpE,MAAM,gBAAgB,GAAG,UAAU;SAChC,MAAM,CACL,CAAC,CAAC,EAAwD,EAAE,CAC1D,CAAC,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,cAAc,CACzF;SACA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IAEpB,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,OAAO;QACP,KAAK,EAAE,UAAU;QACjB,gBAAgB;KACjB,CAAA;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=catalog.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.test.d.ts","sourceRoot":"","sources":["../../src/utils/catalog.test.ts"],"names":[],"mappings":""}