@pushchain/core 6.0.27-alpha.3 → 6.0.27-alpha.4

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 (90) hide show
  1. package/AGW.md +27 -6
  2. package/CHANGELOG.md +7 -0
  3. package/MARKETPLACE.md +206 -0
  4. package/package.json +2 -1
  5. package/src/lib/agentic/codec/rules.js +74 -69
  6. package/src/lib/agentic/codec/universal.js +15 -3
  7. package/src/lib/agentic/constants.d.ts +36 -1
  8. package/src/lib/agentic/constants.js +14 -1
  9. package/src/lib/agentic/contracts/reader.d.ts +21 -0
  10. package/src/lib/agentic/contracts/reader.js +3 -0
  11. package/src/lib/agentic/error-messages.d.ts +3 -0
  12. package/src/lib/agentic/error-messages.js +125 -0
  13. package/src/lib/agentic/errors.d.ts +12 -3
  14. package/src/lib/agentic/errors.js +76 -0
  15. package/src/lib/agentic/management/common.js +6 -0
  16. package/src/lib/agentic/management/destination.d.ts +5 -0
  17. package/src/lib/agentic/management/destination.js +32 -0
  18. package/src/lib/agentic/management/prepare.js +80 -55
  19. package/src/lib/agentic/management/svm-public.js +13 -4
  20. package/src/lib/agentic/presets/index.js +7 -8
  21. package/src/lib/agentic/presets/routes.d.ts +1 -1
  22. package/src/lib/agentic/presets/routes.js +6 -7
  23. package/src/lib/agentic/presets/types.d.ts +1 -6
  24. package/src/lib/agentic/public-rule.js +13 -2
  25. package/src/lib/constants/index.d.ts +35 -0
  26. package/src/lib/index.d.ts +4 -0
  27. package/src/lib/index.js +6 -2
  28. package/src/lib/job/job.d.ts +35 -0
  29. package/src/lib/job/job.js +382 -0
  30. package/src/lib/job/types.d.ts +94 -0
  31. package/src/lib/job/types.js +3 -0
  32. package/src/lib/job/watch.d.ts +3 -0
  33. package/src/lib/job/watch.js +169 -0
  34. package/src/lib/job-spec/codec.d.ts +18 -0
  35. package/src/lib/job-spec/codec.js +348 -0
  36. package/src/lib/job-spec/constants.d.ts +32 -0
  37. package/src/lib/job-spec/constants.js +36 -0
  38. package/src/lib/job-spec/helpers.d.ts +19 -0
  39. package/src/lib/job-spec/helpers.js +138 -0
  40. package/src/lib/job-spec/index.d.ts +14 -0
  41. package/src/lib/job-spec/index.js +17 -0
  42. package/src/lib/job-spec/preview.d.ts +8 -0
  43. package/src/lib/job-spec/preview.js +298 -0
  44. package/src/lib/job-spec/read.d.ts +20 -0
  45. package/src/lib/job-spec/read.js +224 -0
  46. package/src/lib/job-spec/schema.d.ts +290 -0
  47. package/src/lib/job-spec/schema.js +70 -0
  48. package/src/lib/job-spec/types.d.ts +139 -0
  49. package/src/lib/job-spec/types.js +3 -0
  50. package/src/lib/market/contracts/AgenticCommerce.d.ts +1026 -0
  51. package/src/lib/market/contracts/AgenticCommerce.js +1317 -0
  52. package/src/lib/market/contracts/RulesBindingHook.d.ts +235 -0
  53. package/src/lib/market/contracts/RulesBindingHook.js +314 -0
  54. package/src/lib/market/contracts/UniversalMarketplace.d.ts +1770 -0
  55. package/src/lib/market/contracts/UniversalMarketplace.js +2295 -0
  56. package/src/lib/market/contracts/UniversalMarketplaceErrors.d.ts +309 -0
  57. package/src/lib/market/contracts/UniversalMarketplaceErrors.js +416 -0
  58. package/src/lib/market/contracts/UniversalMarketplaceRules.d.ts +241 -0
  59. package/src/lib/market/contracts/UniversalMarketplaceRules.js +323 -0
  60. package/src/lib/market/data.d.ts +8 -0
  61. package/src/lib/market/data.js +60 -0
  62. package/src/lib/market/deployment.d.ts +14 -0
  63. package/src/lib/market/deployment.js +23 -0
  64. package/src/lib/market/deposit.d.ts +24 -0
  65. package/src/lib/market/deposit.js +271 -0
  66. package/src/lib/market/errors.d.ts +13 -0
  67. package/src/lib/market/errors.js +81 -0
  68. package/src/lib/market/history.d.ts +6 -0
  69. package/src/lib/market/history.js +83 -0
  70. package/src/lib/market/index.d.ts +4 -0
  71. package/src/lib/market/index.js +12 -0
  72. package/src/lib/market/kernel-wire.d.ts +15 -0
  73. package/src/lib/market/kernel-wire.js +41 -0
  74. package/src/lib/market/market.d.ts +55 -0
  75. package/src/lib/market/market.js +635 -0
  76. package/src/lib/market/rules.d.ts +106 -0
  77. package/src/lib/market/rules.js +293 -0
  78. package/src/lib/market/runtime.d.ts +35 -0
  79. package/src/lib/market/runtime.js +130 -0
  80. package/src/lib/market/types.d.ts +180 -0
  81. package/src/lib/market/types.js +3 -0
  82. package/src/lib/orchestrator/internals/errors.d.ts +9 -2
  83. package/src/lib/orchestrator/internals/errors.js +9 -2
  84. package/src/lib/orchestrator/internals/push-chain-tx.js +17 -3
  85. package/src/lib/push-chain/push-chain.d.ts +44 -1
  86. package/src/lib/push-chain/push-chain.js +23 -3
  87. package/src/lib/read-state/read-params.d.ts +9 -0
  88. package/src/lib/read-state/read-params.js +5 -1
  89. package/src/lib/utils.d.ts +15 -0
  90. package/src/lib/utils.js +4 -0
@@ -0,0 +1,241 @@
1
+ export declare const MARKET_RULES_ABI: readonly [{
2
+ readonly type: "function";
3
+ readonly name: "checkRulesMatchCard";
4
+ readonly inputs: readonly [{
5
+ readonly name: "cardRules";
6
+ readonly type: "bytes";
7
+ readonly internalType: "bytes";
8
+ }, {
9
+ readonly name: "session";
10
+ readonly type: "tuple";
11
+ readonly internalType: "struct Session";
12
+ readonly components: readonly [{
13
+ readonly name: "sessionValidator";
14
+ readonly type: "address";
15
+ readonly internalType: "address";
16
+ }, {
17
+ readonly name: "sessionValidatorInitData";
18
+ readonly type: "bytes";
19
+ readonly internalType: "bytes";
20
+ }, {
21
+ readonly name: "salt";
22
+ readonly type: "bytes32";
23
+ readonly internalType: "bytes32";
24
+ }, {
25
+ readonly name: "userOpPolicies";
26
+ readonly type: "tuple[]";
27
+ readonly internalType: "struct PolicyData[]";
28
+ readonly components: readonly [{
29
+ readonly name: "policy";
30
+ readonly type: "address";
31
+ readonly internalType: "address";
32
+ }, {
33
+ readonly name: "initData";
34
+ readonly type: "bytes";
35
+ readonly internalType: "bytes";
36
+ }];
37
+ }, {
38
+ readonly name: "erc7739Policies";
39
+ readonly type: "tuple";
40
+ readonly internalType: "struct ERC7739Data";
41
+ readonly components: readonly [{
42
+ readonly name: "allowedERC7739Content";
43
+ readonly type: "tuple[]";
44
+ readonly internalType: "struct ERC7739Context[]";
45
+ readonly components: readonly [{
46
+ readonly name: "appDomainSeparator";
47
+ readonly type: "bytes32";
48
+ readonly internalType: "bytes32";
49
+ }, {
50
+ readonly name: "contentNames";
51
+ readonly type: "string[]";
52
+ readonly internalType: "string[]";
53
+ }];
54
+ }, {
55
+ readonly name: "erc1271Policies";
56
+ readonly type: "tuple[]";
57
+ readonly internalType: "struct PolicyData[]";
58
+ readonly components: readonly [{
59
+ readonly name: "policy";
60
+ readonly type: "address";
61
+ readonly internalType: "address";
62
+ }, {
63
+ readonly name: "initData";
64
+ readonly type: "bytes";
65
+ readonly internalType: "bytes";
66
+ }];
67
+ }];
68
+ }, {
69
+ readonly name: "actions";
70
+ readonly type: "tuple[]";
71
+ readonly internalType: "struct ActionData[]";
72
+ readonly components: readonly [{
73
+ readonly name: "actionTargetSelector";
74
+ readonly type: "bytes4";
75
+ readonly internalType: "bytes4";
76
+ }, {
77
+ readonly name: "actionTarget";
78
+ readonly type: "address";
79
+ readonly internalType: "address";
80
+ }, {
81
+ readonly name: "actionPolicies";
82
+ readonly type: "tuple[]";
83
+ readonly internalType: "struct PolicyData[]";
84
+ readonly components: readonly [{
85
+ readonly name: "policy";
86
+ readonly type: "address";
87
+ readonly internalType: "address";
88
+ }, {
89
+ readonly name: "initData";
90
+ readonly type: "bytes";
91
+ readonly internalType: "bytes";
92
+ }];
93
+ }];
94
+ }, {
95
+ readonly name: "permitERC4337Paymaster";
96
+ readonly type: "bool";
97
+ readonly internalType: "bool";
98
+ }];
99
+ }, {
100
+ readonly name: "ctx";
101
+ readonly type: "tuple";
102
+ readonly internalType: "struct SessionContext";
103
+ readonly components: readonly [{
104
+ readonly name: "agent";
105
+ readonly type: "address";
106
+ readonly internalType: "address";
107
+ }, {
108
+ readonly name: "chainHash";
109
+ readonly type: "bytes32";
110
+ readonly internalType: "bytes32";
111
+ }, {
112
+ readonly name: "principal";
113
+ readonly type: "uint256";
114
+ readonly internalType: "uint256";
115
+ }, {
116
+ readonly name: "expiredAt";
117
+ readonly type: "uint48";
118
+ readonly internalType: "uint48";
119
+ }, {
120
+ readonly name: "expectedCEA";
121
+ readonly type: "address";
122
+ readonly internalType: "address";
123
+ }];
124
+ }];
125
+ readonly outputs: readonly [];
126
+ readonly stateMutability: "pure";
127
+ }, {
128
+ readonly type: "function";
129
+ readonly name: "validateAgentCardRules";
130
+ readonly inputs: readonly [{
131
+ readonly name: "rules";
132
+ readonly type: "bytes";
133
+ readonly internalType: "bytes";
134
+ }];
135
+ readonly outputs: readonly [{
136
+ readonly name: "tokens";
137
+ readonly type: "address[]";
138
+ readonly internalType: "address[]";
139
+ }];
140
+ readonly stateMutability: "pure";
141
+ }, {
142
+ readonly type: "error";
143
+ readonly name: "ActionCount";
144
+ readonly inputs: readonly [];
145
+ }, {
146
+ readonly type: "error";
147
+ readonly name: "ActionsMismatch";
148
+ readonly inputs: readonly [];
149
+ }, {
150
+ readonly type: "error";
151
+ readonly name: "AgentMismatch";
152
+ readonly inputs: readonly [];
153
+ }, {
154
+ readonly type: "error";
155
+ readonly name: "AssetCountMismatch";
156
+ readonly inputs: readonly [{
157
+ readonly name: "expected";
158
+ readonly type: "uint256";
159
+ readonly internalType: "uint256";
160
+ }, {
161
+ readonly name: "actual";
162
+ readonly type: "uint256";
163
+ readonly internalType: "uint256";
164
+ }];
165
+ }, {
166
+ readonly type: "error";
167
+ readonly name: "AssetMismatch";
168
+ readonly inputs: readonly [{
169
+ readonly name: "index";
170
+ readonly type: "uint256";
171
+ readonly internalType: "uint256";
172
+ }];
173
+ }, {
174
+ readonly type: "error";
175
+ readonly name: "ChainMismatch";
176
+ readonly inputs: readonly [{
177
+ readonly name: "i";
178
+ readonly type: "uint256";
179
+ readonly internalType: "uint256";
180
+ }];
181
+ }, {
182
+ readonly type: "error";
183
+ readonly name: "EnvelopeVersionMismatch";
184
+ readonly inputs: readonly [{
185
+ readonly name: "actual";
186
+ readonly type: "uint256";
187
+ readonly internalType: "uint256";
188
+ }];
189
+ }, {
190
+ readonly type: "error";
191
+ readonly name: "ExpectedCEAMismatch";
192
+ readonly inputs: readonly [{
193
+ readonly name: "expected";
194
+ readonly type: "address";
195
+ readonly internalType: "address";
196
+ }, {
197
+ readonly name: "actual";
198
+ readonly type: "address";
199
+ readonly internalType: "address";
200
+ }];
201
+ }, {
202
+ readonly type: "error";
203
+ readonly name: "ExpiryMismatch";
204
+ readonly inputs: readonly [];
205
+ }, {
206
+ readonly type: "error";
207
+ readonly name: "GasCapMismatch";
208
+ readonly inputs: readonly [];
209
+ }, {
210
+ readonly type: "error";
211
+ readonly name: "InvalidAgentCard";
212
+ readonly inputs: readonly [{
213
+ readonly name: "reason";
214
+ readonly type: "string";
215
+ readonly internalType: "string";
216
+ }];
217
+ }, {
218
+ readonly type: "error";
219
+ readonly name: "PinMismatch";
220
+ readonly inputs: readonly [{
221
+ readonly name: "call";
222
+ readonly type: "uint256";
223
+ readonly internalType: "uint256";
224
+ }, {
225
+ readonly name: "pin";
226
+ readonly type: "uint256";
227
+ readonly internalType: "uint256";
228
+ }];
229
+ }, {
230
+ readonly type: "error";
231
+ readonly name: "PolicyShape";
232
+ readonly inputs: readonly [{
233
+ readonly name: "i";
234
+ readonly type: "uint256";
235
+ readonly internalType: "uint256";
236
+ }];
237
+ }, {
238
+ readonly type: "error";
239
+ readonly name: "PrincipalCapMismatch";
240
+ readonly inputs: readonly [];
241
+ }];
@@ -0,0 +1,323 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MARKET_RULES_ABI = void 0;
4
+ // Generated from sdk-iteration-v1@443b4e2; Donut marketplace v2.
5
+ exports.MARKET_RULES_ABI = [
6
+ {
7
+ type: 'function',
8
+ name: 'checkRulesMatchCard',
9
+ inputs: [
10
+ {
11
+ name: 'cardRules',
12
+ type: 'bytes',
13
+ internalType: 'bytes',
14
+ },
15
+ {
16
+ name: 'session',
17
+ type: 'tuple',
18
+ internalType: 'struct Session',
19
+ components: [
20
+ {
21
+ name: 'sessionValidator',
22
+ type: 'address',
23
+ internalType: 'address',
24
+ },
25
+ {
26
+ name: 'sessionValidatorInitData',
27
+ type: 'bytes',
28
+ internalType: 'bytes',
29
+ },
30
+ {
31
+ name: 'salt',
32
+ type: 'bytes32',
33
+ internalType: 'bytes32',
34
+ },
35
+ {
36
+ name: 'userOpPolicies',
37
+ type: 'tuple[]',
38
+ internalType: 'struct PolicyData[]',
39
+ components: [
40
+ {
41
+ name: 'policy',
42
+ type: 'address',
43
+ internalType: 'address',
44
+ },
45
+ {
46
+ name: 'initData',
47
+ type: 'bytes',
48
+ internalType: 'bytes',
49
+ },
50
+ ],
51
+ },
52
+ {
53
+ name: 'erc7739Policies',
54
+ type: 'tuple',
55
+ internalType: 'struct ERC7739Data',
56
+ components: [
57
+ {
58
+ name: 'allowedERC7739Content',
59
+ type: 'tuple[]',
60
+ internalType: 'struct ERC7739Context[]',
61
+ components: [
62
+ {
63
+ name: 'appDomainSeparator',
64
+ type: 'bytes32',
65
+ internalType: 'bytes32',
66
+ },
67
+ {
68
+ name: 'contentNames',
69
+ type: 'string[]',
70
+ internalType: 'string[]',
71
+ },
72
+ ],
73
+ },
74
+ {
75
+ name: 'erc1271Policies',
76
+ type: 'tuple[]',
77
+ internalType: 'struct PolicyData[]',
78
+ components: [
79
+ {
80
+ name: 'policy',
81
+ type: 'address',
82
+ internalType: 'address',
83
+ },
84
+ {
85
+ name: 'initData',
86
+ type: 'bytes',
87
+ internalType: 'bytes',
88
+ },
89
+ ],
90
+ },
91
+ ],
92
+ },
93
+ {
94
+ name: 'actions',
95
+ type: 'tuple[]',
96
+ internalType: 'struct ActionData[]',
97
+ components: [
98
+ {
99
+ name: 'actionTargetSelector',
100
+ type: 'bytes4',
101
+ internalType: 'bytes4',
102
+ },
103
+ {
104
+ name: 'actionTarget',
105
+ type: 'address',
106
+ internalType: 'address',
107
+ },
108
+ {
109
+ name: 'actionPolicies',
110
+ type: 'tuple[]',
111
+ internalType: 'struct PolicyData[]',
112
+ components: [
113
+ {
114
+ name: 'policy',
115
+ type: 'address',
116
+ internalType: 'address',
117
+ },
118
+ {
119
+ name: 'initData',
120
+ type: 'bytes',
121
+ internalType: 'bytes',
122
+ },
123
+ ],
124
+ },
125
+ ],
126
+ },
127
+ {
128
+ name: 'permitERC4337Paymaster',
129
+ type: 'bool',
130
+ internalType: 'bool',
131
+ },
132
+ ],
133
+ },
134
+ {
135
+ name: 'ctx',
136
+ type: 'tuple',
137
+ internalType: 'struct SessionContext',
138
+ components: [
139
+ {
140
+ name: 'agent',
141
+ type: 'address',
142
+ internalType: 'address',
143
+ },
144
+ {
145
+ name: 'chainHash',
146
+ type: 'bytes32',
147
+ internalType: 'bytes32',
148
+ },
149
+ {
150
+ name: 'principal',
151
+ type: 'uint256',
152
+ internalType: 'uint256',
153
+ },
154
+ {
155
+ name: 'expiredAt',
156
+ type: 'uint48',
157
+ internalType: 'uint48',
158
+ },
159
+ {
160
+ name: 'expectedCEA',
161
+ type: 'address',
162
+ internalType: 'address',
163
+ },
164
+ ],
165
+ },
166
+ ],
167
+ outputs: [],
168
+ stateMutability: 'pure',
169
+ },
170
+ {
171
+ type: 'function',
172
+ name: 'validateAgentCardRules',
173
+ inputs: [
174
+ {
175
+ name: 'rules',
176
+ type: 'bytes',
177
+ internalType: 'bytes',
178
+ },
179
+ ],
180
+ outputs: [
181
+ {
182
+ name: 'tokens',
183
+ type: 'address[]',
184
+ internalType: 'address[]',
185
+ },
186
+ ],
187
+ stateMutability: 'pure',
188
+ },
189
+ {
190
+ type: 'error',
191
+ name: 'ActionCount',
192
+ inputs: [],
193
+ },
194
+ {
195
+ type: 'error',
196
+ name: 'ActionsMismatch',
197
+ inputs: [],
198
+ },
199
+ {
200
+ type: 'error',
201
+ name: 'AgentMismatch',
202
+ inputs: [],
203
+ },
204
+ {
205
+ type: 'error',
206
+ name: 'AssetCountMismatch',
207
+ inputs: [
208
+ {
209
+ name: 'expected',
210
+ type: 'uint256',
211
+ internalType: 'uint256',
212
+ },
213
+ {
214
+ name: 'actual',
215
+ type: 'uint256',
216
+ internalType: 'uint256',
217
+ },
218
+ ],
219
+ },
220
+ {
221
+ type: 'error',
222
+ name: 'AssetMismatch',
223
+ inputs: [
224
+ {
225
+ name: 'index',
226
+ type: 'uint256',
227
+ internalType: 'uint256',
228
+ },
229
+ ],
230
+ },
231
+ {
232
+ type: 'error',
233
+ name: 'ChainMismatch',
234
+ inputs: [
235
+ {
236
+ name: 'i',
237
+ type: 'uint256',
238
+ internalType: 'uint256',
239
+ },
240
+ ],
241
+ },
242
+ {
243
+ type: 'error',
244
+ name: 'EnvelopeVersionMismatch',
245
+ inputs: [
246
+ {
247
+ name: 'actual',
248
+ type: 'uint256',
249
+ internalType: 'uint256',
250
+ },
251
+ ],
252
+ },
253
+ {
254
+ type: 'error',
255
+ name: 'ExpectedCEAMismatch',
256
+ inputs: [
257
+ {
258
+ name: 'expected',
259
+ type: 'address',
260
+ internalType: 'address',
261
+ },
262
+ {
263
+ name: 'actual',
264
+ type: 'address',
265
+ internalType: 'address',
266
+ },
267
+ ],
268
+ },
269
+ {
270
+ type: 'error',
271
+ name: 'ExpiryMismatch',
272
+ inputs: [],
273
+ },
274
+ {
275
+ type: 'error',
276
+ name: 'GasCapMismatch',
277
+ inputs: [],
278
+ },
279
+ {
280
+ type: 'error',
281
+ name: 'InvalidAgentCard',
282
+ inputs: [
283
+ {
284
+ name: 'reason',
285
+ type: 'string',
286
+ internalType: 'string',
287
+ },
288
+ ],
289
+ },
290
+ {
291
+ type: 'error',
292
+ name: 'PinMismatch',
293
+ inputs: [
294
+ {
295
+ name: 'call',
296
+ type: 'uint256',
297
+ internalType: 'uint256',
298
+ },
299
+ {
300
+ name: 'pin',
301
+ type: 'uint256',
302
+ internalType: 'uint256',
303
+ },
304
+ ],
305
+ },
306
+ {
307
+ type: 'error',
308
+ name: 'PolicyShape',
309
+ inputs: [
310
+ {
311
+ name: 'i',
312
+ type: 'uint256',
313
+ internalType: 'uint256',
314
+ },
315
+ ],
316
+ },
317
+ {
318
+ type: 'error',
319
+ name: 'PrincipalCapMismatch',
320
+ inputs: [],
321
+ },
322
+ ];
323
+ //# sourceMappingURL=UniversalMarketplaceRules.js.map
@@ -0,0 +1,8 @@
1
+ import { type Abi, type Hex } from 'viem';
2
+ /** Copy public data before awaiting RPCs or a wallet; BigInts and array order are retained. */
3
+ export declare function copyData<T>(value: T): T;
4
+ export declare function fingerprint(value: unknown): string;
5
+ /** Locate canonical ABI calls inside ordinary, UEA, AGW or multisig transaction inputs.
6
+ * Candidates are data, not proof of execution: callers must bind them to authenticated receipt events.
7
+ */
8
+ export declare function embeddedCalls(input: Hex, abi: Abi, name: string): readonly unknown[][];
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.copyData = copyData;
4
+ exports.fingerprint = fingerprint;
5
+ exports.embeddedCalls = embeddedCalls;
6
+ const viem_1 = require("viem");
7
+ /** Copy public data before awaiting RPCs or a wallet; BigInts and array order are retained. */
8
+ function copyData(value) {
9
+ if (Array.isArray(value))
10
+ return value.map(copyData);
11
+ if (value && typeof value === 'object')
12
+ return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, copyData(v)]));
13
+ return value;
14
+ }
15
+ function fingerprint(value) {
16
+ const sorted = (v) => Array.isArray(v)
17
+ ? v.map(sorted)
18
+ : v && typeof v === 'object'
19
+ ? Object.fromEntries(Object.entries(v)
20
+ .sort(([a], [b]) => a.localeCompare(b))
21
+ .map(([k, x]) => [k, sorted(x)]))
22
+ : typeof v === 'bigint'
23
+ ? `${v}n`
24
+ : v;
25
+ return JSON.stringify(sorted(value));
26
+ }
27
+ /** Locate canonical ABI calls inside ordinary, UEA, AGW or multisig transaction inputs.
28
+ * Candidates are data, not proof of execution: callers must bind them to authenticated receipt events.
29
+ */
30
+ function embeddedCalls(input, abi, name) {
31
+ const item = (0, viem_1.getAbiItem)({ abi, name });
32
+ if (!item || item.type !== 'function')
33
+ return [];
34
+ const selector = (0, viem_1.toFunctionSelector)(item).slice(2).toLowerCase();
35
+ const hex = input.toLowerCase();
36
+ const calls = [];
37
+ let offset = 2;
38
+ while ((offset = hex.indexOf(selector, offset)) !== -1) {
39
+ const at = offset;
40
+ offset += 2;
41
+ if (at % 2 !== 0)
42
+ continue;
43
+ try {
44
+ const data = ('0x' + input.slice(at));
45
+ const decoded = (0, viem_1.decodeFunctionData)({ abi: [item], data });
46
+ const encoded = (0, viem_1.encodeFunctionData)({
47
+ abi: [item],
48
+ functionName: name,
49
+ args: decoded.args,
50
+ });
51
+ if (data.slice(0, encoded.length).toLowerCase() === encoded.toLowerCase())
52
+ calls.push([...(decoded.args ?? [])]);
53
+ }
54
+ catch {
55
+ /* A selector-shaped value inside unrelated calldata is not a candidate. */
56
+ }
57
+ }
58
+ return calls;
59
+ }
60
+ //# sourceMappingURL=data.js.map
@@ -0,0 +1,14 @@
1
+ import { PUSH_NETWORK } from '../constants/enums';
2
+ export declare const DONUT_MARKETPLACE: Readonly<{
3
+ readonly sourceCommit: "443b4e2dd9ca5dd9ffc8efebdfcecd619dd66c47";
4
+ readonly version: "2.0.0";
5
+ readonly startBlock: bigint;
6
+ readonly marketplace: "0x9071ebE01B75123A91e88eB6ec4BF163F3fE9BF4";
7
+ readonly kernel: "0x977cf1AC973E9eC4332791d531507575006157Ed";
8
+ readonly hook: "0xDe7A94e510b6C571DE7880d441349689F73A32b3";
9
+ readonly rules: "0x5b98A8E0df5b918DF76cD2BE84bA7995B39dfd44";
10
+ readonly evaluator: "0x1afC81396f1bb36F91f74506284952b81e4bd47c";
11
+ readonly paymentToken: "0x7A58048036206bB898008b5bBDA85697DB1e5d66";
12
+ }>;
13
+ export type MarketDeployment = Omit<typeof DONUT_MARKETPLACE, 'marketplace' | 'kernel' | 'hook' | 'rules' | 'evaluator' | 'paymentToken'> & Record<'marketplace' | 'kernel' | 'hook' | 'rules' | 'evaluator' | 'paymentToken', `0x${string}`>;
14
+ export declare function marketplaceDeployment(network: PUSH_NETWORK): MarketDeployment;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DONUT_MARKETPLACE = void 0;
4
+ exports.marketplaceDeployment = marketplaceDeployment;
5
+ const enums_1 = require("../constants/enums");
6
+ const errors_1 = require("./errors");
7
+ exports.DONUT_MARKETPLACE = Object.freeze({
8
+ sourceCommit: '443b4e2dd9ca5dd9ffc8efebdfcecd619dd66c47',
9
+ version: '2.0.0',
10
+ startBlock: BigInt(24443653),
11
+ marketplace: '0x9071ebE01B75123A91e88eB6ec4BF163F3fE9BF4',
12
+ kernel: '0x977cf1AC973E9eC4332791d531507575006157Ed',
13
+ hook: '0xDe7A94e510b6C571DE7880d441349689F73A32b3',
14
+ rules: '0x5b98A8E0df5b918DF76cD2BE84bA7995B39dfd44',
15
+ evaluator: '0x1afC81396f1bb36F91f74506284952b81e4bd47c',
16
+ paymentToken: '0x7A58048036206bB898008b5bBDA85697DB1e5d66',
17
+ });
18
+ function marketplaceDeployment(network) {
19
+ if (network !== enums_1.PUSH_NETWORK.TESTNET_DONUT)
20
+ (0, errors_1.unavailable)('Marketplace on this Push network');
21
+ return exports.DONUT_MARKETPLACE;
22
+ }
23
+ //# sourceMappingURL=deployment.js.map