@apibara/starknet 2.1.0-beta.38 → 2.1.0-beta.39
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/dist/index.cjs +11 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -1
- package/dist/index.d.mts +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.mjs +12 -2
- package/dist/index.mjs.map +1 -1
- package/dist/parser.cjs +19 -0
- package/dist/parser.cjs.map +1 -1
- package/dist/parser.d.cts +7 -1
- package/dist/parser.d.mts +7 -1
- package/dist/parser.d.ts +7 -1
- package/dist/parser.mjs +19 -1
- package/dist/parser.mjs.map +1 -1
- package/package.json +2 -2
- package/src/abi-wan-helpers.ts +42 -1
- package/src/event.ts +15 -3
- package/src/parser.ts +28 -0
package/dist/index.cjs
CHANGED
|
@@ -8543,7 +8543,7 @@ function compileTypeParser(abi, type) {
|
|
|
8543
8543
|
return compileStructParser(abi, typeAbi.members);
|
|
8544
8544
|
}
|
|
8545
8545
|
case "enum": {
|
|
8546
|
-
|
|
8546
|
+
return compileEnumParser(abi, typeAbi);
|
|
8547
8547
|
}
|
|
8548
8548
|
default:
|
|
8549
8549
|
throw new DecodeEventError(`Invalid type ${typeAbi.type}`);
|
|
@@ -8559,6 +8559,16 @@ function compileStructParser(abi, members) {
|
|
|
8559
8559
|
}
|
|
8560
8560
|
return parser.parseStruct(parsers);
|
|
8561
8561
|
}
|
|
8562
|
+
function compileEnumParser(abi, enumAbi) {
|
|
8563
|
+
const parsers = {};
|
|
8564
|
+
for (const [index, variant] of enumAbi.variants.entries()) {
|
|
8565
|
+
parsers[variant.name] = {
|
|
8566
|
+
index,
|
|
8567
|
+
parser: compileTypeParser(abi, variant.type)
|
|
8568
|
+
};
|
|
8569
|
+
}
|
|
8570
|
+
return parser.parseEnum(parsers);
|
|
8571
|
+
}
|
|
8562
8572
|
|
|
8563
8573
|
const StarknetStream = new protocol.StreamConfig(
|
|
8564
8574
|
FilterFromBytes,
|