@apibara/starknet 2.1.0-beta.35 → 2.1.0-beta.37
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 +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +8 -1
- package/dist/index.mjs.map +1 -1
- package/dist/parser.cjs +33 -0
- package/dist/parser.cjs.map +1 -1
- package/dist/parser.d.cts +5 -1
- package/dist/parser.d.mts +5 -1
- package/dist/parser.d.ts +5 -1
- package/dist/parser.mjs +33 -1
- package/dist/parser.mjs.map +1 -1
- package/package.json +2 -3
- package/src/abi.ts +6 -0
- package/src/event.ts +6 -0
- package/src/parser.ts +68 -1
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { MessageCodec, OptionalCodec, RequiredCodec, BigIntCodec, DateCodec, Str
|
|
|
3
3
|
import Long from 'long';
|
|
4
4
|
import _m0 from 'protobufjs/minimal.js';
|
|
5
5
|
import { keccak } from '@scure/starknet';
|
|
6
|
-
import { parseBool, parseFelt252, parseU8, parseU16, parseU32, parseU64, parseU128, parseU256, parseContractAddress, ParseError, parseStruct, parseArray, parseSpan, parseOption, parseEmpty } from './parser.mjs';
|
|
6
|
+
import { parseBool, parseFelt252, parseU8, parseU16, parseU32, parseU64, parseU128, parseU256, parseBytes31, parseContractAddress, ParseError, parseStruct, parseArray, parseSpan, parseOption, parseEmpty, parseByteArray } from './parser.mjs';
|
|
7
7
|
|
|
8
8
|
const MAX_U64 = 0xffffffffffffffffn;
|
|
9
9
|
const FieldElement$1 = {
|
|
@@ -8335,6 +8335,7 @@ const PrimitiveTypeParsers = {
|
|
|
8335
8335
|
"core::integer::u64": parseU64,
|
|
8336
8336
|
"core::integer::u128": parseU128,
|
|
8337
8337
|
"core::integer::u256": parseU256,
|
|
8338
|
+
"core::bytes_31::bytes31": parseBytes31,
|
|
8338
8339
|
"core::starknet::contract_address::ContractAddress": parseContractAddress
|
|
8339
8340
|
};
|
|
8340
8341
|
function isPrimitiveType(type) {
|
|
@@ -8361,6 +8362,9 @@ function getOptionType(type) {
|
|
|
8361
8362
|
function isEmptyType(type) {
|
|
8362
8363
|
return type === "()";
|
|
8363
8364
|
}
|
|
8365
|
+
function isByteArray(type) {
|
|
8366
|
+
return type === "core::byte_array::ByteArray";
|
|
8367
|
+
}
|
|
8364
8368
|
|
|
8365
8369
|
function isEventAbi(item) {
|
|
8366
8370
|
return item.type === "event";
|
|
@@ -8520,6 +8524,9 @@ function compileTypeParser(abi, type) {
|
|
|
8520
8524
|
if (isEmptyType(type)) {
|
|
8521
8525
|
return parseEmpty;
|
|
8522
8526
|
}
|
|
8527
|
+
if (isByteArray(type)) {
|
|
8528
|
+
return parseByteArray;
|
|
8529
|
+
}
|
|
8523
8530
|
const typeAbi = abi.find((item) => item.name === type);
|
|
8524
8531
|
if (!typeAbi) {
|
|
8525
8532
|
throw new DecodeEventError(`Type ${type} not found in ABI`);
|