@apibara/starknet 2.0.0-beta.9 → 2.1.0-beta.2
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 +353 -169
- package/dist/index.d.cts +1297 -1263
- package/dist/index.d.mts +1297 -1263
- package/dist/index.d.ts +1297 -1263
- package/dist/index.mjs +349 -170
- package/dist/parser.cjs +133 -0
- package/dist/parser.d.cts +72 -0
- package/dist/parser.d.mts +72 -0
- package/dist/parser.d.ts +72 -0
- package/dist/parser.mjs +109 -0
- package/dist/shared/starknet.2b19268a.d.cts +32 -0
- package/dist/shared/starknet.2b19268a.d.mts +32 -0
- package/dist/shared/starknet.2b19268a.d.ts +32 -0
- package/package.json +10 -2
- package/src/abi.ts +79 -0
- package/src/access.ts +6 -2
- package/src/block.ts +151 -155
- package/src/common.ts +2 -0
- package/src/event.ts +204 -0
- package/src/index.ts +11 -0
- package/src/parser.test.ts +169 -0
- package/src/parser.ts +170 -0
- package/src/proto/data.ts +56 -12
package/src/proto/data.ts
CHANGED
|
@@ -494,7 +494,7 @@ export interface Event {
|
|
|
494
494
|
| readonly number[]
|
|
495
495
|
| undefined;
|
|
496
496
|
/** The contract that emitted the event. */
|
|
497
|
-
readonly
|
|
497
|
+
readonly address?:
|
|
498
498
|
| FieldElement
|
|
499
499
|
| undefined;
|
|
500
500
|
/** The event keys. */
|
|
@@ -518,7 +518,11 @@ export interface Event {
|
|
|
518
518
|
| FieldElement
|
|
519
519
|
| undefined;
|
|
520
520
|
/** Transaction status. */
|
|
521
|
-
readonly transactionStatus?:
|
|
521
|
+
readonly transactionStatus?:
|
|
522
|
+
| TransactionStatus
|
|
523
|
+
| undefined;
|
|
524
|
+
/** Event index in the transaction. */
|
|
525
|
+
readonly eventIndexInTransaction?: number | undefined;
|
|
522
526
|
}
|
|
523
527
|
|
|
524
528
|
export interface MessageToL1 {
|
|
@@ -550,7 +554,11 @@ export interface MessageToL1 {
|
|
|
550
554
|
| FieldElement
|
|
551
555
|
| undefined;
|
|
552
556
|
/** Transaction status. */
|
|
553
|
-
readonly transactionStatus?:
|
|
557
|
+
readonly transactionStatus?:
|
|
558
|
+
| TransactionStatus
|
|
559
|
+
| undefined;
|
|
560
|
+
/** Message index in the transaction. */
|
|
561
|
+
readonly messageIndexInTransaction?: number | undefined;
|
|
554
562
|
}
|
|
555
563
|
|
|
556
564
|
/** Price of a unit of a resource. */
|
|
@@ -4134,13 +4142,14 @@ export const DeployAccountTransactionReceipt = {
|
|
|
4134
4142
|
function createBaseEvent(): Event {
|
|
4135
4143
|
return {
|
|
4136
4144
|
filterIds: [],
|
|
4137
|
-
|
|
4145
|
+
address: undefined,
|
|
4138
4146
|
keys: [],
|
|
4139
4147
|
data: [],
|
|
4140
4148
|
eventIndex: 0,
|
|
4141
4149
|
transactionIndex: 0,
|
|
4142
4150
|
transactionHash: undefined,
|
|
4143
4151
|
transactionStatus: 0,
|
|
4152
|
+
eventIndexInTransaction: 0,
|
|
4144
4153
|
};
|
|
4145
4154
|
}
|
|
4146
4155
|
|
|
@@ -4153,8 +4162,8 @@ export const Event = {
|
|
|
4153
4162
|
}
|
|
4154
4163
|
writer.ldelim();
|
|
4155
4164
|
}
|
|
4156
|
-
if (message.
|
|
4157
|
-
FieldElement.encode(message.
|
|
4165
|
+
if (message.address !== undefined) {
|
|
4166
|
+
FieldElement.encode(message.address, writer.uint32(18).fork()).ldelim();
|
|
4158
4167
|
}
|
|
4159
4168
|
if (message.keys !== undefined && message.keys.length !== 0) {
|
|
4160
4169
|
for (const v of message.keys) {
|
|
@@ -4178,6 +4187,9 @@ export const Event = {
|
|
|
4178
4187
|
if (message.transactionStatus !== undefined && message.transactionStatus !== 0) {
|
|
4179
4188
|
writer.uint32(64).int32(message.transactionStatus);
|
|
4180
4189
|
}
|
|
4190
|
+
if (message.eventIndexInTransaction !== undefined && message.eventIndexInTransaction !== 0) {
|
|
4191
|
+
writer.uint32(72).uint32(message.eventIndexInTransaction);
|
|
4192
|
+
}
|
|
4181
4193
|
return writer;
|
|
4182
4194
|
},
|
|
4183
4195
|
|
|
@@ -4210,7 +4222,7 @@ export const Event = {
|
|
|
4210
4222
|
break;
|
|
4211
4223
|
}
|
|
4212
4224
|
|
|
4213
|
-
message.
|
|
4225
|
+
message.address = FieldElement.decode(reader, reader.uint32());
|
|
4214
4226
|
continue;
|
|
4215
4227
|
case 3:
|
|
4216
4228
|
if (tag !== 26) {
|
|
@@ -4254,6 +4266,13 @@ export const Event = {
|
|
|
4254
4266
|
|
|
4255
4267
|
message.transactionStatus = reader.int32() as any;
|
|
4256
4268
|
continue;
|
|
4269
|
+
case 9:
|
|
4270
|
+
if (tag !== 72) {
|
|
4271
|
+
break;
|
|
4272
|
+
}
|
|
4273
|
+
|
|
4274
|
+
message.eventIndexInTransaction = reader.uint32();
|
|
4275
|
+
continue;
|
|
4257
4276
|
}
|
|
4258
4277
|
if ((tag & 7) === 4 || tag === 0) {
|
|
4259
4278
|
break;
|
|
@@ -4268,13 +4287,16 @@ export const Event = {
|
|
|
4268
4287
|
filterIds: globalThis.Array.isArray(object?.filterIds)
|
|
4269
4288
|
? object.filterIds.map((e: any) => globalThis.Number(e))
|
|
4270
4289
|
: [],
|
|
4271
|
-
|
|
4290
|
+
address: isSet(object.address) ? FieldElement.fromJSON(object.address) : undefined,
|
|
4272
4291
|
keys: globalThis.Array.isArray(object?.keys) ? object.keys.map((e: any) => FieldElement.fromJSON(e)) : [],
|
|
4273
4292
|
data: globalThis.Array.isArray(object?.data) ? object.data.map((e: any) => FieldElement.fromJSON(e)) : [],
|
|
4274
4293
|
eventIndex: isSet(object.eventIndex) ? globalThis.Number(object.eventIndex) : 0,
|
|
4275
4294
|
transactionIndex: isSet(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
|
|
4276
4295
|
transactionHash: isSet(object.transactionHash) ? FieldElement.fromJSON(object.transactionHash) : undefined,
|
|
4277
4296
|
transactionStatus: isSet(object.transactionStatus) ? transactionStatusFromJSON(object.transactionStatus) : 0,
|
|
4297
|
+
eventIndexInTransaction: isSet(object.eventIndexInTransaction)
|
|
4298
|
+
? globalThis.Number(object.eventIndexInTransaction)
|
|
4299
|
+
: 0,
|
|
4278
4300
|
};
|
|
4279
4301
|
},
|
|
4280
4302
|
|
|
@@ -4283,8 +4305,8 @@ export const Event = {
|
|
|
4283
4305
|
if (message.filterIds?.length) {
|
|
4284
4306
|
obj.filterIds = message.filterIds.map((e) => Math.round(e));
|
|
4285
4307
|
}
|
|
4286
|
-
if (message.
|
|
4287
|
-
obj.
|
|
4308
|
+
if (message.address !== undefined) {
|
|
4309
|
+
obj.address = FieldElement.toJSON(message.address);
|
|
4288
4310
|
}
|
|
4289
4311
|
if (message.keys?.length) {
|
|
4290
4312
|
obj.keys = message.keys.map((e) => FieldElement.toJSON(e));
|
|
@@ -4304,6 +4326,9 @@ export const Event = {
|
|
|
4304
4326
|
if (message.transactionStatus !== undefined && message.transactionStatus !== 0) {
|
|
4305
4327
|
obj.transactionStatus = transactionStatusToJSON(message.transactionStatus);
|
|
4306
4328
|
}
|
|
4329
|
+
if (message.eventIndexInTransaction !== undefined && message.eventIndexInTransaction !== 0) {
|
|
4330
|
+
obj.eventIndexInTransaction = Math.round(message.eventIndexInTransaction);
|
|
4331
|
+
}
|
|
4307
4332
|
return obj;
|
|
4308
4333
|
},
|
|
4309
4334
|
|
|
@@ -4313,8 +4338,8 @@ export const Event = {
|
|
|
4313
4338
|
fromPartial(object: DeepPartial<Event>): Event {
|
|
4314
4339
|
const message = createBaseEvent() as any;
|
|
4315
4340
|
message.filterIds = object.filterIds?.map((e) => e) || [];
|
|
4316
|
-
message.
|
|
4317
|
-
? FieldElement.fromPartial(object.
|
|
4341
|
+
message.address = (object.address !== undefined && object.address !== null)
|
|
4342
|
+
? FieldElement.fromPartial(object.address)
|
|
4318
4343
|
: undefined;
|
|
4319
4344
|
message.keys = object.keys?.map((e) => FieldElement.fromPartial(e)) || [];
|
|
4320
4345
|
message.data = object.data?.map((e) => FieldElement.fromPartial(e)) || [];
|
|
@@ -4324,6 +4349,7 @@ export const Event = {
|
|
|
4324
4349
|
? FieldElement.fromPartial(object.transactionHash)
|
|
4325
4350
|
: undefined;
|
|
4326
4351
|
message.transactionStatus = object.transactionStatus ?? 0;
|
|
4352
|
+
message.eventIndexInTransaction = object.eventIndexInTransaction ?? 0;
|
|
4327
4353
|
return message;
|
|
4328
4354
|
},
|
|
4329
4355
|
};
|
|
@@ -4338,6 +4364,7 @@ function createBaseMessageToL1(): MessageToL1 {
|
|
|
4338
4364
|
transactionIndex: 0,
|
|
4339
4365
|
transactionHash: undefined,
|
|
4340
4366
|
transactionStatus: 0,
|
|
4367
|
+
messageIndexInTransaction: 0,
|
|
4341
4368
|
};
|
|
4342
4369
|
}
|
|
4343
4370
|
|
|
@@ -4373,6 +4400,9 @@ export const MessageToL1 = {
|
|
|
4373
4400
|
if (message.transactionStatus !== undefined && message.transactionStatus !== 0) {
|
|
4374
4401
|
writer.uint32(64).int32(message.transactionStatus);
|
|
4375
4402
|
}
|
|
4403
|
+
if (message.messageIndexInTransaction !== undefined && message.messageIndexInTransaction !== 0) {
|
|
4404
|
+
writer.uint32(72).uint32(message.messageIndexInTransaction);
|
|
4405
|
+
}
|
|
4376
4406
|
return writer;
|
|
4377
4407
|
},
|
|
4378
4408
|
|
|
@@ -4449,6 +4479,13 @@ export const MessageToL1 = {
|
|
|
4449
4479
|
|
|
4450
4480
|
message.transactionStatus = reader.int32() as any;
|
|
4451
4481
|
continue;
|
|
4482
|
+
case 9:
|
|
4483
|
+
if (tag !== 72) {
|
|
4484
|
+
break;
|
|
4485
|
+
}
|
|
4486
|
+
|
|
4487
|
+
message.messageIndexInTransaction = reader.uint32();
|
|
4488
|
+
continue;
|
|
4452
4489
|
}
|
|
4453
4490
|
if ((tag & 7) === 4 || tag === 0) {
|
|
4454
4491
|
break;
|
|
@@ -4472,6 +4509,9 @@ export const MessageToL1 = {
|
|
|
4472
4509
|
transactionIndex: isSet(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
|
|
4473
4510
|
transactionHash: isSet(object.transactionHash) ? FieldElement.fromJSON(object.transactionHash) : undefined,
|
|
4474
4511
|
transactionStatus: isSet(object.transactionStatus) ? transactionStatusFromJSON(object.transactionStatus) : 0,
|
|
4512
|
+
messageIndexInTransaction: isSet(object.messageIndexInTransaction)
|
|
4513
|
+
? globalThis.Number(object.messageIndexInTransaction)
|
|
4514
|
+
: 0,
|
|
4475
4515
|
};
|
|
4476
4516
|
},
|
|
4477
4517
|
|
|
@@ -4501,6 +4541,9 @@ export const MessageToL1 = {
|
|
|
4501
4541
|
if (message.transactionStatus !== undefined && message.transactionStatus !== 0) {
|
|
4502
4542
|
obj.transactionStatus = transactionStatusToJSON(message.transactionStatus);
|
|
4503
4543
|
}
|
|
4544
|
+
if (message.messageIndexInTransaction !== undefined && message.messageIndexInTransaction !== 0) {
|
|
4545
|
+
obj.messageIndexInTransaction = Math.round(message.messageIndexInTransaction);
|
|
4546
|
+
}
|
|
4504
4547
|
return obj;
|
|
4505
4548
|
},
|
|
4506
4549
|
|
|
@@ -4523,6 +4566,7 @@ export const MessageToL1 = {
|
|
|
4523
4566
|
? FieldElement.fromPartial(object.transactionHash)
|
|
4524
4567
|
: undefined;
|
|
4525
4568
|
message.transactionStatus = object.transactionStatus ?? 0;
|
|
4569
|
+
message.messageIndexInTransaction = object.messageIndexInTransaction ?? 0;
|
|
4526
4570
|
return message;
|
|
4527
4571
|
},
|
|
4528
4572
|
};
|