@meantjs/profile 0.1.0 → 0.3.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 +38 -0
- package/README.md +39 -2
- package/data/packs/dai-permit.profile.json +113 -0
- package/data/packs/erc20.profile.json +221 -0
- package/data/packs/erc2612.profile.json +196 -0
- package/data/packs/permit2.profile.json +436 -0
- package/data/profile-v0.schema.json +302 -8
- package/data/profile-v0.validate.mjs +13 -1
- package/package.json +8 -1
- package/src/abi-iface.mjs +154 -0
- package/src/abi-pack.mjs +117 -0
- package/src/abi.mjs +779 -0
- package/src/analyze.mjs +87 -31
- package/src/browser.d.mts +8 -4
- package/src/browser.mjs +8 -1
- package/src/checks.mjs +103 -10
- package/src/cli.mjs +12 -6
- package/src/evm.d.mts +101 -0
- package/src/evm.mjs +32 -0
- package/src/keccak.mjs +108 -0
- package/src/resolve.mjs +96 -5
- package/src/resolved.mjs +20 -4
- package/src/validate.mjs +24 -4
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"kind": {
|
|
25
25
|
"enum": [
|
|
26
26
|
"canister",
|
|
27
|
-
"pack"
|
|
27
|
+
"pack",
|
|
28
|
+
"contract"
|
|
28
29
|
]
|
|
29
30
|
},
|
|
30
31
|
"name": {
|
|
@@ -100,14 +101,36 @@
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"if": {
|
|
107
|
+
"properties": {
|
|
108
|
+
"kind": {
|
|
109
|
+
"const": "contract"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"then": {
|
|
114
|
+
"properties": {
|
|
115
|
+
"origin": {
|
|
116
|
+
"enum": [
|
|
117
|
+
"author",
|
|
118
|
+
"third_party",
|
|
119
|
+
"inferred"
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
"binds": {
|
|
123
|
+
"$ref": "#/$defs/contract_binds"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
103
127
|
}
|
|
104
128
|
],
|
|
105
129
|
"$defs": {
|
|
106
130
|
"pack_binds": {
|
|
107
131
|
"type": "object",
|
|
108
132
|
"required": [
|
|
109
|
-
"standard"
|
|
110
|
-
"requires"
|
|
133
|
+
"standard"
|
|
111
134
|
],
|
|
112
135
|
"additionalProperties": false,
|
|
113
136
|
"properties": {
|
|
@@ -123,7 +146,38 @@
|
|
|
123
146
|
"type": "string",
|
|
124
147
|
"minLength": 10,
|
|
125
148
|
"description": "A Candid service fragment. The pack applies to a canister whose service type is a subtype of this fragment."
|
|
149
|
+
},
|
|
150
|
+
"abi": {
|
|
151
|
+
"$ref": "#/$defs/evm_abi",
|
|
152
|
+
"description": "An EVM pack (spec section 15, experimental): the functions it applies to. The pack applies to a contract that has each of them, with the same selector, outputs and kind of call."
|
|
153
|
+
},
|
|
154
|
+
"eip712": {
|
|
155
|
+
"$ref": "#/$defs/eip712",
|
|
156
|
+
"description": "An EVM pack's EIP-712 messages (spec section 15.9), beside its binds.abi."
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"oneOf": [
|
|
160
|
+
{
|
|
161
|
+
"required": [
|
|
162
|
+
"requires"
|
|
163
|
+
],
|
|
164
|
+
"properties": {
|
|
165
|
+
"requires": true
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"required": [
|
|
170
|
+
"abi"
|
|
171
|
+
],
|
|
172
|
+
"properties": {
|
|
173
|
+
"abi": true
|
|
174
|
+
}
|
|
126
175
|
}
|
|
176
|
+
],
|
|
177
|
+
"dependentRequired": {
|
|
178
|
+
"eip712": [
|
|
179
|
+
"abi"
|
|
180
|
+
]
|
|
127
181
|
}
|
|
128
182
|
},
|
|
129
183
|
"canister_binds": {
|
|
@@ -147,6 +201,146 @@
|
|
|
147
201
|
}
|
|
148
202
|
}
|
|
149
203
|
},
|
|
204
|
+
"contract_binds": {
|
|
205
|
+
"type": "object",
|
|
206
|
+
"description": "An EVM contract (spec section 15, experimental): its ABI, the EIP-712 messages it verifies (section 15.9), and where it is deployed.",
|
|
207
|
+
"additionalProperties": false,
|
|
208
|
+
"properties": {
|
|
209
|
+
"abi": {
|
|
210
|
+
"$ref": "#/$defs/evm_abi"
|
|
211
|
+
},
|
|
212
|
+
"deployments": {
|
|
213
|
+
"type": "array",
|
|
214
|
+
"minItems": 1,
|
|
215
|
+
"description": "The chain ids and addresses the profile describes (ERC-7730 context.contract.deployments). A consumer applies the profile to a call only when its target is listed.",
|
|
216
|
+
"items": {
|
|
217
|
+
"type": "object",
|
|
218
|
+
"required": [
|
|
219
|
+
"chain_id",
|
|
220
|
+
"address"
|
|
221
|
+
],
|
|
222
|
+
"additionalProperties": false,
|
|
223
|
+
"properties": {
|
|
224
|
+
"chain_id": {
|
|
225
|
+
"type": "integer",
|
|
226
|
+
"minimum": 1
|
|
227
|
+
},
|
|
228
|
+
"address": {
|
|
229
|
+
"type": "string",
|
|
230
|
+
"pattern": "^0x[0-9a-fA-F]{40}$"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"eip712": {
|
|
236
|
+
"$ref": "#/$defs/eip712"
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"anyOf": [
|
|
240
|
+
{
|
|
241
|
+
"required": [
|
|
242
|
+
"abi"
|
|
243
|
+
],
|
|
244
|
+
"properties": {
|
|
245
|
+
"abi": true
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"required": [
|
|
250
|
+
"eip712"
|
|
251
|
+
],
|
|
252
|
+
"properties": {
|
|
253
|
+
"eip712": true
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
]
|
|
257
|
+
},
|
|
258
|
+
"evm_abi": {
|
|
259
|
+
"type": "array",
|
|
260
|
+
"minItems": 1,
|
|
261
|
+
"description": "EVM ABI function fragments: human-readable (`function transfer(address to, uint256 value) returns (bool)`) or JSON ABI entries. Only functions are read; events, errors, the constructor, fallback and receive are skipped. Parameter names are what addresses use.",
|
|
262
|
+
"items": {
|
|
263
|
+
"oneOf": [
|
|
264
|
+
{
|
|
265
|
+
"type": "string",
|
|
266
|
+
"pattern": "^\\s*(function|event|error|constructor|fallback|receive)\\b"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"type": "object",
|
|
270
|
+
"required": [
|
|
271
|
+
"type"
|
|
272
|
+
],
|
|
273
|
+
"properties": {
|
|
274
|
+
"type": {
|
|
275
|
+
"enum": [
|
|
276
|
+
"function",
|
|
277
|
+
"event",
|
|
278
|
+
"error",
|
|
279
|
+
"constructor",
|
|
280
|
+
"fallback",
|
|
281
|
+
"receive"
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"eip712": {
|
|
290
|
+
"type": "object",
|
|
291
|
+
"description": "EIP-712 typed messages (spec section 15.9, experimental): the struct types, in the JSON shape of an eth_signTypedData request without EIP712Domain, and the domain's name and version. A type whose name the profile tags with intent is a message; chainId and verifyingContract come from binds.deployments.",
|
|
292
|
+
"required": [
|
|
293
|
+
"types"
|
|
294
|
+
],
|
|
295
|
+
"additionalProperties": false,
|
|
296
|
+
"properties": {
|
|
297
|
+
"domain": {
|
|
298
|
+
"type": "object",
|
|
299
|
+
"minProperties": 1,
|
|
300
|
+
"additionalProperties": false,
|
|
301
|
+
"description": "Each value must equal the request's domain value of the same name (ERC-7730 context.eip712.domain).",
|
|
302
|
+
"properties": {
|
|
303
|
+
"name": {
|
|
304
|
+
"type": "string",
|
|
305
|
+
"minLength": 1
|
|
306
|
+
},
|
|
307
|
+
"version": {
|
|
308
|
+
"type": "string",
|
|
309
|
+
"minLength": 1
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"types": {
|
|
314
|
+
"type": "object",
|
|
315
|
+
"minProperties": 1,
|
|
316
|
+
"propertyNames": {
|
|
317
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
|
|
318
|
+
},
|
|
319
|
+
"additionalProperties": {
|
|
320
|
+
"type": "array",
|
|
321
|
+
"minItems": 1,
|
|
322
|
+
"items": {
|
|
323
|
+
"type": "object",
|
|
324
|
+
"required": [
|
|
325
|
+
"name",
|
|
326
|
+
"type"
|
|
327
|
+
],
|
|
328
|
+
"additionalProperties": false,
|
|
329
|
+
"properties": {
|
|
330
|
+
"name": {
|
|
331
|
+
"type": "string",
|
|
332
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
|
|
333
|
+
},
|
|
334
|
+
"type": {
|
|
335
|
+
"type": "string",
|
|
336
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_]*(\\[([1-9][0-9]*)?\\])*$"
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
},
|
|
150
344
|
"value_address": {
|
|
151
345
|
"type": "string",
|
|
152
346
|
"description": "METHOD(i)path | METHOD->(i)path | type:DECL path. Paths: .label, .#id, [] (vec element). opt is transparent.",
|
|
@@ -244,8 +438,6 @@
|
|
|
244
438
|
"properties": {
|
|
245
439
|
"tag": {
|
|
246
440
|
"enum": [
|
|
247
|
-
"intent",
|
|
248
|
-
"effect",
|
|
249
441
|
"idempotency",
|
|
250
442
|
"outcome",
|
|
251
443
|
"list",
|
|
@@ -262,6 +454,32 @@
|
|
|
262
454
|
}
|
|
263
455
|
}
|
|
264
456
|
},
|
|
457
|
+
{
|
|
458
|
+
"if": {
|
|
459
|
+
"properties": {
|
|
460
|
+
"tag": {
|
|
461
|
+
"enum": [
|
|
462
|
+
"intent",
|
|
463
|
+
"effect"
|
|
464
|
+
]
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
"then": {
|
|
469
|
+
"properties": {
|
|
470
|
+
"at": {
|
|
471
|
+
"anyOf": [
|
|
472
|
+
{
|
|
473
|
+
"$ref": "#/$defs/method_address"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"$ref": "#/$defs/value_address"
|
|
477
|
+
}
|
|
478
|
+
]
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
},
|
|
265
483
|
{
|
|
266
484
|
"if": {
|
|
267
485
|
"properties": {
|
|
@@ -610,9 +828,6 @@
|
|
|
610
828
|
},
|
|
611
829
|
"args_amount": {
|
|
612
830
|
"type": "object",
|
|
613
|
-
"required": [
|
|
614
|
-
"decimals"
|
|
615
|
-
],
|
|
616
831
|
"additionalProperties": false,
|
|
617
832
|
"properties": {
|
|
618
833
|
"decimals": {
|
|
@@ -638,6 +853,52 @@
|
|
|
638
853
|
"$ref": "#/$defs/dynamic"
|
|
639
854
|
}
|
|
640
855
|
]
|
|
856
|
+
},
|
|
857
|
+
"token": {
|
|
858
|
+
"$ref": "#/$defs/relpath",
|
|
859
|
+
"description": "An EVM amount in a token another field names (spec section 15.9): the relative path to that address, in the same array element as the amount. Its decimals and symbol are the token's, which the consumer supplies; decimals and symbol are then left out."
|
|
860
|
+
},
|
|
861
|
+
"threshold": {
|
|
862
|
+
"type": "string",
|
|
863
|
+
"pattern": "^(0|[1-9][0-9]{0,77})$",
|
|
864
|
+
"description": "Display only: a value at or above this (base units, a decimal string) displays as `message` and the symbol, for example \"Unlimited USDC\" (spec section 5.3)."
|
|
865
|
+
},
|
|
866
|
+
"message": {
|
|
867
|
+
"type": "string",
|
|
868
|
+
"minLength": 1,
|
|
869
|
+
"maxLength": 32,
|
|
870
|
+
"description": "What a value at or above `threshold` displays as (default \"Unlimited\")."
|
|
871
|
+
}
|
|
872
|
+
},
|
|
873
|
+
"dependentRequired": {
|
|
874
|
+
"message": [
|
|
875
|
+
"threshold"
|
|
876
|
+
]
|
|
877
|
+
},
|
|
878
|
+
"anyOf": [
|
|
879
|
+
{
|
|
880
|
+
"required": [
|
|
881
|
+
"decimals"
|
|
882
|
+
],
|
|
883
|
+
"properties": {
|
|
884
|
+
"decimals": true
|
|
885
|
+
}
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
"required": [
|
|
889
|
+
"token"
|
|
890
|
+
],
|
|
891
|
+
"properties": {
|
|
892
|
+
"token": true
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
],
|
|
896
|
+
"dependentSchemas": {
|
|
897
|
+
"token": {
|
|
898
|
+
"properties": {
|
|
899
|
+
"decimals": false,
|
|
900
|
+
"symbol": false
|
|
901
|
+
}
|
|
641
902
|
}
|
|
642
903
|
}
|
|
643
904
|
},
|
|
@@ -653,7 +914,40 @@
|
|
|
653
914
|
},
|
|
654
915
|
"epoch": {
|
|
655
916
|
"const": "unix"
|
|
917
|
+
},
|
|
918
|
+
"threshold": {
|
|
919
|
+
"type": "string",
|
|
920
|
+
"pattern": "^(0|[1-9][0-9]{0,77})$",
|
|
921
|
+
"description": "Display only: a value at or above this (in the tagged unit, a decimal string) displays as `message`, for example \"Never\" for a deadline of uint256 max (spec section 15.9)."
|
|
922
|
+
},
|
|
923
|
+
"message": {
|
|
924
|
+
"type": "string",
|
|
925
|
+
"minLength": 1,
|
|
926
|
+
"maxLength": 32,
|
|
927
|
+
"description": "What a value at or above `threshold` displays as."
|
|
928
|
+
},
|
|
929
|
+
"labels": {
|
|
930
|
+
"type": "object",
|
|
931
|
+
"minProperties": 1,
|
|
932
|
+
"maxProperties": 16,
|
|
933
|
+
"propertyNames": {
|
|
934
|
+
"pattern": "^(0|[1-9][0-9]{0,77})$"
|
|
935
|
+
},
|
|
936
|
+
"additionalProperties": {
|
|
937
|
+
"type": "string",
|
|
938
|
+
"minLength": 1,
|
|
939
|
+
"maxLength": 32
|
|
940
|
+
},
|
|
941
|
+
"description": "Display only: words for exact values (in the tagged unit), for example { \"0\": \"Only in the block it is used\" } (spec section 15.9)."
|
|
656
942
|
}
|
|
943
|
+
},
|
|
944
|
+
"dependentRequired": {
|
|
945
|
+
"message": [
|
|
946
|
+
"threshold"
|
|
947
|
+
],
|
|
948
|
+
"threshold": [
|
|
949
|
+
"message"
|
|
950
|
+
]
|
|
657
951
|
}
|
|
658
952
|
},
|
|
659
953
|
"args_duration": {
|