starknet 9.1.1 → 9.2.1

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.mjs CHANGED
@@ -78,12 +78,32 @@ import { PAYMASTER_API } from "@starknet-io/starknet-types-010";
78
78
 
79
79
  // src/types/api/rpc.ts
80
80
  var rpc_exports = {};
81
- __reExport(rpc_exports, starknet_types_09_star);
82
- import * as starknet_types_09_star from "@starknet-io/starknet-types-09";
81
+ __reExport(rpc_exports, starknet_types_010_star);
82
+ import * as starknet_types_010_star from "@starknet-io/starknet-types-010";
83
83
 
84
84
  // src/types/api/index.ts
85
85
  __reExport(api_exports, rpc_exports);
86
86
 
87
+ // src/provider/types/spec.type.ts
88
+ var { ETransactionVersion } = RPCSPEC09;
89
+ var { ETransactionVersion2 } = RPCSPEC09;
90
+ var { ETransactionVersion3 } = RPCSPEC09;
91
+ var { EDataAvailabilityMode } = RPCSPEC010;
92
+ var { EDAMode } = RPCSPEC010;
93
+ function isRPC08Plus_ResourceBounds(entry) {
94
+ return "l1_data_gas" in entry;
95
+ }
96
+ function isRPC08Plus_ResourceBoundsBN(entry) {
97
+ return "l1_data_gas" in entry;
98
+ }
99
+ var { ETransactionStatus } = RPCSPEC010;
100
+ var { ETransactionExecutionStatus } = RPCSPEC010;
101
+ var { ETransactionType: TransactionType } = RPCSPEC09;
102
+ var { EBlockStatus: BlockStatus } = RPCSPEC09;
103
+ var { ETransactionFinalityStatus: TransactionFinalityStatus } = RPCSPEC09;
104
+ var { ETransactionExecutionStatus: TransactionExecutionStatus } = RPCSPEC09;
105
+ var { EBlockTag: BlockTag } = RPCSPEC09;
106
+
87
107
  // src/utils/encode.ts
88
108
  var encode_exports = {};
89
109
  __export(encode_exports, {
@@ -314,6 +334,22 @@ var DEFAULT_GLOBAL_CONFIG = {
314
334
  }
315
335
  },
316
336
  defaultTipType: "recommendedTip",
337
+ channelDefaults: {
338
+ options: {
339
+ headers: { "Content-Type": "application/json" },
340
+ blockIdentifier: BlockTag.LATEST,
341
+ retries: 200
342
+ },
343
+ methods: {
344
+ simulateTransaction: {
345
+ skipValidate: true,
346
+ skipFeeCharge: true
347
+ },
348
+ getEstimateFee: {
349
+ skipValidate: true
350
+ }
351
+ }
352
+ },
317
353
  fetch: void 0,
318
354
  websocket: void 0,
319
355
  buffer: void 0,
@@ -358,11 +394,51 @@ var Configuration = class _Configuration {
358
394
  }
359
395
  return _Configuration.instance;
360
396
  }
397
+ /**
398
+ * Get a nested value from an object using a dot-notation path
399
+ * @param obj - The object to traverse
400
+ * @param path - The dot-notation path (e.g., 'a.b.c')
401
+ * @returns The value at the path, or undefined if not found
402
+ */
403
+ getNestedValue(obj, path) {
404
+ const keys = path.split(".");
405
+ return keys.reduce((current, key) => {
406
+ if (current === null || current === void 0) {
407
+ return void 0;
408
+ }
409
+ return current[key];
410
+ }, obj);
411
+ }
412
+ /**
413
+ * Set a nested value in an object using a dot-notation path
414
+ * @param obj - The object to modify
415
+ * @param path - The dot-notation path (e.g., 'a.b.c')
416
+ * @param value - The value to set
417
+ */
418
+ setNestedValue(obj, path, value) {
419
+ const keys = path.split(".");
420
+ const lastKey = keys.pop();
421
+ const target = keys.reduce((current, key) => {
422
+ if (!(key in current) || typeof current[key] !== "object" || current[key] === null) {
423
+ current[key] = {};
424
+ }
425
+ return current[key];
426
+ }, obj);
427
+ target[lastKey] = value;
428
+ }
361
429
  get(key, defaultValue) {
430
+ if (key.includes(".")) {
431
+ const value = this.getNestedValue(this.config, key);
432
+ return value ?? defaultValue;
433
+ }
362
434
  return this.config[key] ?? defaultValue;
363
435
  }
364
436
  set(key, value) {
365
- this.config[key] = value;
437
+ if (key.includes(".")) {
438
+ this.setNestedValue(this.config, key, value);
439
+ } else {
440
+ this.config[key] = value;
441
+ }
366
442
  }
367
443
  update(configData) {
368
444
  this.config = {
@@ -531,26 +607,6 @@ var EntryPointType = {
531
607
  CONSTRUCTOR: "CONSTRUCTOR"
532
608
  };
533
609
 
534
- // src/provider/types/spec.type.ts
535
- var { ETransactionVersion: ETransactionVersion2 } = RPCSPEC09;
536
- var { ETransactionVersion2: ETransactionVersion22 } = RPCSPEC09;
537
- var { ETransactionVersion3 } = RPCSPEC09;
538
- var { EDataAvailabilityMode } = RPCSPEC010;
539
- var { EDAMode } = RPCSPEC010;
540
- function isRPC08Plus_ResourceBounds(entry) {
541
- return "l1_data_gas" in entry;
542
- }
543
- function isRPC08Plus_ResourceBoundsBN(entry) {
544
- return "l1_data_gas" in entry;
545
- }
546
- var { ETransactionStatus } = RPCSPEC010;
547
- var { ETransactionExecutionStatus } = RPCSPEC010;
548
- var { ETransactionType: TransactionType } = RPCSPEC09;
549
- var { EBlockStatus: BlockStatus } = RPCSPEC09;
550
- var { ETransactionFinalityStatus: TransactionFinalityStatus } = RPCSPEC09;
551
- var { ETransactionExecutionStatus: TransactionExecutionStatus } = RPCSPEC09;
552
- var { EBlockTag: BlockTag } = RPCSPEC09;
553
-
554
610
  // src/types/calldata.ts
555
611
  var ValidateType = {
556
612
  DEPLOY: "DEPLOY",
@@ -5181,8 +5237,8 @@ function computeCompiledClassHashBlake(casm) {
5181
5237
 
5182
5238
  // src/utils/resolve.ts
5183
5239
  function isV3Tx(details) {
5184
- const version = details.version ? toHex(details.version) : ETransactionVersion2.V3;
5185
- return version === ETransactionVersion2.V3 || version === ETransactionVersion2.F3;
5240
+ const version = details.version ? toHex(details.version) : ETransactionVersion.V3;
5241
+ return version === ETransactionVersion.V3 || version === ETransactionVersion.F3;
5186
5242
  }
5187
5243
  function isVersion(expected, provided) {
5188
5244
  const expectedParts = expected.split(".");
@@ -5387,10 +5443,10 @@ function toTransactionVersion(defaultVersion, providedVersion) {
5387
5443
  function toFeeVersion(providedVersion) {
5388
5444
  if (!providedVersion) return void 0;
5389
5445
  const version = toHex(providedVersion);
5390
- if (version === ETransactionVersion2.V0) return ETransactionVersion2.F0;
5391
- if (version === ETransactionVersion2.V1) return ETransactionVersion2.F1;
5392
- if (version === ETransactionVersion2.V2) return ETransactionVersion2.F2;
5393
- if (version === ETransactionVersion2.V3) return ETransactionVersion2.F3;
5446
+ if (version === ETransactionVersion.V0) return ETransactionVersion.F0;
5447
+ if (version === ETransactionVersion.V1) return ETransactionVersion.F1;
5448
+ if (version === ETransactionVersion.V2) return ETransactionVersion.F2;
5449
+ if (version === ETransactionVersion.V3) return ETransactionVersion.F3;
5394
5450
  throw Error(`toFeeVersion: ${version} is not supported`);
5395
5451
  }
5396
5452
  function v3Details(details) {
@@ -5714,16 +5770,11 @@ var getExecuteCalldata = (calls, cairoVersion = "0") => {
5714
5770
  };
5715
5771
  function getVersionsByType(versionType) {
5716
5772
  return versionType === "fee" ? {
5717
- v3: ETransactionVersion2.F3
5718
- } : { v3: ETransactionVersion2.V3 };
5773
+ v3: ETransactionVersion.F3
5774
+ } : { v3: ETransactionVersion.V3 };
5719
5775
  }
5720
5776
 
5721
5777
  // src/channel/rpc_0_9_0.ts
5722
- var defaultOptions = {
5723
- headers: { "Content-Type": "application/json" },
5724
- blockIdentifier: BlockTag.LATEST,
5725
- retries: 200
5726
- };
5727
5778
  var RpcChannel = class {
5728
5779
  id = "RPC090";
5729
5780
  /**
@@ -5773,11 +5824,12 @@ var RpcChannel = class {
5773
5824
  this.channelSpecVersion
5774
5825
  );
5775
5826
  }
5827
+ const channelDefaults = config.get("channelDefaults");
5776
5828
  this.baseFetch = baseFetch || config.get("fetch") || fetch_default;
5777
- this.blockIdentifier = blockIdentifier ?? defaultOptions.blockIdentifier;
5829
+ this.blockIdentifier = blockIdentifier ?? channelDefaults.options.blockIdentifier;
5778
5830
  this.chainId = chainId;
5779
- this.headers = { ...defaultOptions.headers, ...headers };
5780
- this.retries = retries ?? defaultOptions.retries;
5831
+ this.headers = { ...channelDefaults.options.headers, ...headers };
5832
+ this.retries = retries ?? channelDefaults.options.retries;
5781
5833
  this.specVersion = specVersion;
5782
5834
  this.transactionRetryIntervalFallback = transactionRetryIntervalFallback;
5783
5835
  this.waitMode = waitMode ?? false;
@@ -5991,14 +6043,16 @@ var RpcChannel = class {
5991
6043
  * @param invocations AccountInvocations
5992
6044
  * @param simulateTransactionOptions blockIdentifier and flags to skip validation and fee charge<br/>
5993
6045
  * - blockIdentifier<br/>
5994
- * - skipValidate (default false)<br/>
6046
+ * - skipValidate (default true)<br/>
5995
6047
  * - skipFeeCharge (default true)<br/>
5996
6048
  */
5997
6049
  simulateTransaction(invocations, simulateTransactionOptions = {}) {
6050
+ const channelDefaults = config.get("channelDefaults");
6051
+ const methodDefaults = channelDefaults.methods.simulateTransaction || {};
5998
6052
  const {
5999
6053
  blockIdentifier = this.blockIdentifier,
6000
- skipValidate = true,
6001
- skipFeeCharge = true
6054
+ skipValidate = methodDefaults.skipValidate,
6055
+ skipFeeCharge = methodDefaults.skipFeeCharge
6002
6056
  } = simulateTransactionOptions;
6003
6057
  const block_id = new Block(blockIdentifier).identifier;
6004
6058
  const simulationFlags = [];
@@ -6158,7 +6212,10 @@ var RpcChannel = class {
6158
6212
  contract_address
6159
6213
  });
6160
6214
  }
6161
- async getEstimateFee(invocations, { blockIdentifier = this.blockIdentifier, skipValidate = true } = {}) {
6215
+ async getEstimateFee(invocations, options = {}) {
6216
+ const channelDefaults = config.get("channelDefaults");
6217
+ const methodDefaults = channelDefaults.methods.getEstimateFee || {};
6218
+ const { blockIdentifier = this.blockIdentifier, skipValidate = methodDefaults.skipValidate } = options;
6162
6219
  const block_id = new Block(blockIdentifier).identifier;
6163
6220
  const flags = {
6164
6221
  simulation_flags: skipValidate ? [RPCSPEC09.ESimulationFlag.SKIP_VALIDATE] : []
@@ -6316,11 +6373,6 @@ var rpc_0_10_0_exports = {};
6316
6373
  __export(rpc_0_10_0_exports, {
6317
6374
  RpcChannel: () => RpcChannel2
6318
6375
  });
6319
- var defaultOptions2 = {
6320
- headers: { "Content-Type": "application/json" },
6321
- blockIdentifier: BlockTag.LATEST,
6322
- retries: 200
6323
- };
6324
6376
  var RpcChannel2 = class {
6325
6377
  id = "RPC0.10.0";
6326
6378
  /**
@@ -6370,11 +6422,12 @@ var RpcChannel2 = class {
6370
6422
  this.channelSpecVersion
6371
6423
  );
6372
6424
  }
6425
+ const channelDefaults = config.get("channelDefaults");
6373
6426
  this.baseFetch = baseFetch || config.get("fetch") || fetch_default;
6374
- this.blockIdentifier = blockIdentifier ?? defaultOptions2.blockIdentifier;
6427
+ this.blockIdentifier = blockIdentifier ?? channelDefaults.options.blockIdentifier;
6375
6428
  this.chainId = chainId;
6376
- this.headers = { ...defaultOptions2.headers, ...headers };
6377
- this.retries = retries ?? defaultOptions2.retries;
6429
+ this.headers = { ...channelDefaults.options.headers, ...headers };
6430
+ this.retries = retries ?? channelDefaults.options.retries;
6378
6431
  this.specVersion = specVersion;
6379
6432
  this.transactionRetryIntervalFallback = transactionRetryIntervalFallback;
6380
6433
  this.waitMode = waitMode ?? false;
@@ -6588,14 +6641,16 @@ var RpcChannel2 = class {
6588
6641
  * @param invocations AccountInvocations
6589
6642
  * @param simulateTransactionOptions blockIdentifier and flags to skip validation and fee charge<br/>
6590
6643
  * - blockIdentifier<br/>
6591
- * - skipValidate (default false)<br/>
6644
+ * - skipValidate (default true)<br/>
6592
6645
  * - skipFeeCharge (default true)<br/>
6593
6646
  */
6594
6647
  simulateTransaction(invocations, simulateTransactionOptions = {}) {
6648
+ const channelDefaults = config.get("channelDefaults");
6649
+ const methodDefaults = channelDefaults.methods.simulateTransaction || {};
6595
6650
  const {
6596
6651
  blockIdentifier = this.blockIdentifier,
6597
- skipValidate = true,
6598
- skipFeeCharge = true
6652
+ skipValidate = methodDefaults.skipValidate,
6653
+ skipFeeCharge = methodDefaults.skipFeeCharge
6599
6654
  } = simulateTransactionOptions;
6600
6655
  const block_id = new Block(blockIdentifier).identifier;
6601
6656
  const simulationFlags = [];
@@ -6755,7 +6810,10 @@ var RpcChannel2 = class {
6755
6810
  contract_address
6756
6811
  });
6757
6812
  }
6758
- async getEstimateFee(invocations, { blockIdentifier = this.blockIdentifier, skipValidate = true } = {}) {
6813
+ async getEstimateFee(invocations, options = {}) {
6814
+ const channelDefaults = config.get("channelDefaults");
6815
+ const methodDefaults = channelDefaults.methods.getEstimateFee || {};
6816
+ const { blockIdentifier = this.blockIdentifier, skipValidate = methodDefaults.skipValidate } = options;
6759
6817
  const block_id = new Block(blockIdentifier).identifier;
6760
6818
  const flags = {
6761
6819
  simulation_flags: skipValidate ? [RPCSPEC010.ESimulationFlag.SKIP_VALIDATE] : []
@@ -7044,7 +7102,7 @@ var Subscription = class {
7044
7102
  }
7045
7103
  };
7046
7104
 
7047
- // src/channel/ws/ws_0_9.ts
7105
+ // src/channel/ws/ws_0_10.ts
7048
7106
  var WebSocketChannel = class {
7049
7107
  /**
7050
7108
  * The URL of the WebSocket RPC Node.
@@ -10712,7 +10770,7 @@ var convertEXECUTION_PARAMETERS = (parameters) => ({
10712
10770
  feeMode: convertFEE_MODE(parameters.fee_mode),
10713
10771
  timeBounds: convertTIME_BOUNDS(parameters.time_bounds)
10714
10772
  });
10715
- var defaultOptions3 = {
10773
+ var defaultOptions = {
10716
10774
  headers: { "Content-Type": "application/json" }
10717
10775
  };
10718
10776
  var PaymasterRpc = class _PaymasterRpc {
@@ -10723,14 +10781,14 @@ var PaymasterRpc = class _PaymasterRpc {
10723
10781
  constructor(options) {
10724
10782
  if (options instanceof _PaymasterRpc) {
10725
10783
  this.nodeUrl = options.nodeUrl;
10726
- this.headers = { ...defaultOptions3.headers, ...options.headers };
10784
+ this.headers = { ...defaultOptions.headers, ...options.headers };
10727
10785
  this.baseFetch = options.baseFetch;
10728
10786
  this.requestId = options.requestId;
10729
10787
  return;
10730
10788
  }
10731
10789
  if (options && "nodeUrl" in options && "headers" in options && "baseFetch" in options) {
10732
10790
  this.nodeUrl = options.nodeUrl ?? getDefaultPaymasterNodeUrl(void 0);
10733
- this.headers = { ...defaultOptions3.headers, ...options.headers };
10791
+ this.headers = { ...defaultOptions.headers, ...options.headers };
10734
10792
  this.baseFetch = options.baseFetch ?? fetch_default;
10735
10793
  this.requestId = 0;
10736
10794
  return;
@@ -10744,7 +10802,7 @@ var PaymasterRpc = class _PaymasterRpc {
10744
10802
  this.nodeUrl = getDefaultPaymasterNodeUrl(void 0, options?.default);
10745
10803
  }
10746
10804
  this.baseFetch = baseFetch ?? fetch_default;
10747
- this.headers = { ...defaultOptions3.headers, ...headers };
10805
+ this.headers = { ...defaultOptions.headers, ...headers };
10748
10806
  this.requestId = 0;
10749
10807
  }
10750
10808
  fetch(method, params, id = 0) {
@@ -12136,7 +12194,10 @@ var WalletAccountV5 = class _WalletAccountV5 extends Account {
12136
12194
  // src/utils/events/index.ts
12137
12195
  var events_exports = {};
12138
12196
  __export(events_exports, {
12197
+ addGetByPathMethod: () => addGetByPathMethod,
12198
+ filterEventsByAddress: () => filterEventsByAddress,
12139
12199
  getAbiEvents: () => getAbiEvents,
12200
+ getEmittedEvents: () => getEmittedEvents,
12140
12201
  isAbiEvent: () => isAbiEvent,
12141
12202
  parseEvents: () => parseEvents
12142
12203
  });
@@ -12210,52 +12271,79 @@ function mergeAbiEvents(target, source) {
12210
12271
  return output;
12211
12272
  }
12212
12273
  function parseEvents(providerReceivedEvents, abiEvents, abiStructs, abiEnums, parser) {
12213
- const ret = providerReceivedEvents.flat().reduce((acc, recEvent) => {
12214
- const currentEvent = JSON.parse(JSON.stringify(recEvent));
12215
- let abiEvent = abiEvents[currentEvent.keys.shift() ?? 0];
12274
+ const ret = providerReceivedEvents.reduce((acc, recEvent) => {
12275
+ const eventKeys = [...recEvent.keys];
12276
+ const eventData = [...recEvent.data];
12277
+ let abiEvent = abiEvents[eventKeys.shift() ?? 0];
12216
12278
  if (!abiEvent) {
12217
12279
  return acc;
12218
12280
  }
12219
12281
  while (!abiEvent.name) {
12220
- const hashName = currentEvent.keys.shift();
12282
+ const hashName = eventKeys.shift();
12221
12283
  assert(!!hashName, 'Not enough data in "keys" property of this event.');
12222
12284
  abiEvent = abiEvent[hashName];
12223
12285
  }
12224
- const parsedEvent = {};
12225
- parsedEvent[abiEvent.name] = {};
12226
- const keysIter = currentEvent.keys[Symbol.iterator]();
12227
- const dataIter = currentEvent.data[Symbol.iterator]();
12286
+ const { from_address: _from, keys: _keys, data: _data, ...eventMetadata } = recEvent;
12287
+ const parsedEvent = eventMetadata;
12288
+ const eventName = abiEvent.name;
12289
+ parsedEvent[eventName] = {};
12290
+ const keysIter = eventKeys[Symbol.iterator]();
12291
+ const dataIter = eventData[Symbol.iterator]();
12228
12292
  const abiEventKeys = abiEvent.members?.filter((it) => it.kind === "key") || abiEvent.keys;
12229
12293
  const abiEventData = abiEvent.members?.filter((it) => it.kind === "data") || abiEvent.data;
12294
+ const parsedEventData = parsedEvent[eventName];
12230
12295
  abiEventKeys.forEach((key) => {
12231
- parsedEvent[abiEvent.name][key.name] = responseParser({
12296
+ parsedEventData[key.name] = responseParser({
12232
12297
  responseIterator: keysIter,
12233
12298
  output: key,
12234
12299
  structs: abiStructs,
12235
12300
  enums: abiEnums,
12236
12301
  parser,
12237
- parsedResult: parsedEvent[abiEvent.name]
12302
+ parsedResult: parsedEventData
12238
12303
  });
12239
12304
  });
12240
12305
  abiEventData.forEach((data) => {
12241
- parsedEvent[abiEvent.name][data.name] = responseParser({
12306
+ parsedEventData[data.name] = responseParser({
12242
12307
  responseIterator: dataIter,
12243
12308
  output: data,
12244
12309
  structs: abiStructs,
12245
12310
  enums: abiEnums,
12246
12311
  parser,
12247
- parsedResult: parsedEvent[abiEvent.name]
12312
+ parsedResult: parsedEventData
12248
12313
  });
12249
12314
  });
12250
- if ("block_hash" in currentEvent) parsedEvent.block_hash = currentEvent.block_hash;
12251
- if ("block_number" in currentEvent) parsedEvent.block_number = currentEvent.block_number;
12252
- if ("transaction_hash" in currentEvent)
12253
- parsedEvent.transaction_hash = currentEvent.transaction_hash;
12254
12315
  acc.push(parsedEvent);
12255
12316
  return acc;
12256
12317
  }, []);
12257
12318
  return ret;
12258
12319
  }
12320
+ function addGetByPathMethod(parsedEvents) {
12321
+ Object.defineProperty(parsedEvents, "getByPath", {
12322
+ value: (path) => {
12323
+ const event = parsedEvents.find((ev) => Object.keys(ev).some((key) => key.includes(path)));
12324
+ const eventKey = Object.keys(event || {}).find((key) => key.includes(path));
12325
+ return eventKey && event ? event[eventKey] : null;
12326
+ },
12327
+ writable: false,
12328
+ enumerable: false,
12329
+ configurable: false
12330
+ });
12331
+ return parsedEvents;
12332
+ }
12333
+ function getEmittedEvents(receipt, contractAddress) {
12334
+ if (!receipt.events) return [];
12335
+ const eventsToEnrich = contractAddress ? filterEventsByAddress(receipt.events, contractAddress) : receipt.events;
12336
+ return eventsToEnrich.map((event) => ({
12337
+ ...event,
12338
+ transaction_hash: receipt.transaction_hash,
12339
+ block_hash: receipt.block_hash,
12340
+ block_number: receipt.block_number
12341
+ }));
12342
+ }
12343
+ function filterEventsByAddress(events, contractAddress) {
12344
+ if (!events) return [];
12345
+ return events.filter((event) => toHex(event.from_address) === toHex(contractAddress));
12346
+ }
12259
12347
 
12260
12348
  // src/contract/default.ts
12261
12349
  function buildCall(contract, functionAbi) {
@@ -12516,45 +12604,19 @@ var Contract = class _Contract {
12516
12604
  calldata
12517
12605
  };
12518
12606
  }
12519
- // TODO: Demistify what is going on here ???
12520
- // TODO: receipt status filtering test and fix this do not look right
12521
12607
  parseEvents(receipt) {
12522
- let parsed = [];
12523
- receipt.match({
12524
- SUCCEEDED: (txR) => {
12525
- const emittedEvents = txR.events?.map((event) => {
12526
- return {
12527
- // TODO: this do not check that block is production and block_hash and block_number actually exists
12528
- // TODO: second issue is that ts do not complains about it
12529
- block_hash: txR.block_hash,
12530
- block_number: txR.block_number,
12531
- transaction_hash: txR.transaction_hash,
12532
- ...event
12533
- };
12534
- }).filter((event) => toHex(event.from_address) === toHex(this.address), []) || [];
12535
- parsed = parseEvents(
12536
- emittedEvents,
12537
- this.events,
12538
- this.structs,
12539
- CallData.getAbiEnum(this.abi),
12540
- this.callData.parser
12541
- );
12542
- },
12543
- _: () => {
12544
- throw Error("This transaction was not successful.");
12545
- }
12546
- });
12547
- Object.defineProperty(parsed, "getByPath", {
12548
- value: (path) => {
12549
- const event = parsed.find((ev) => Object.keys(ev).some((key) => key.includes(path)));
12550
- const eventKey = Object.keys(event || {}).find((key) => key.includes(path));
12551
- return eventKey && event ? event[eventKey] : null;
12552
- },
12553
- writable: false,
12554
- enumerable: false,
12555
- configurable: false
12556
- });
12557
- return parsed;
12608
+ if (!receipt.isSuccess()) {
12609
+ throw Error("This transaction was not successful.");
12610
+ }
12611
+ return addGetByPathMethod(
12612
+ parseEvents(
12613
+ getEmittedEvents(receipt.value, this.address),
12614
+ this.events,
12615
+ this.structs,
12616
+ CallData.getAbiEnum(this.abi),
12617
+ this.callData.parser
12618
+ )
12619
+ );
12558
12620
  }
12559
12621
  isCairo1() {
12560
12622
  return cairo_exports.isCairo1Abi(this.abi);
@@ -12770,8 +12832,8 @@ export {
12770
12832
  ETH_ADDRESS,
12771
12833
  ETransactionExecutionStatus,
12772
12834
  ETransactionStatus,
12773
- ETransactionVersion2 as ETransactionVersion,
12774
- ETransactionVersion22 as ETransactionVersion2,
12835
+ ETransactionVersion,
12836
+ ETransactionVersion2,
12775
12837
  ETransactionVersion3,
12776
12838
  EntryPointType,
12777
12839
  EthSigner,