starknet 6.19.0 → 6.20.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 +6 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.global.js +26 -9
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +26 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# [6.20.0](https://github.com/starknet-io/starknet.js/compare/v6.19.0...v6.20.0) (2024-11-27)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- add support for parsing emitted events ([#1227](https://github.com/starknet-io/starknet.js/issues/1227)) ([321ecae](https://github.com/starknet-io/starknet.js/commit/321ecaed2af5828501eccb982dc8744ec3e90f1f))
|
|
6
|
+
|
|
1
7
|
# [6.19.0](https://github.com/starknet-io/starknet.js/compare/v6.18.1...v6.19.0) (2024-11-26)
|
|
2
8
|
|
|
3
9
|
### Features
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as RPCSPEC07 from 'starknet-types-07';
|
|
2
|
-
import { ETransactionVersion as ETransactionVersion$1, STRUCT_EVENT as STRUCT_EVENT$1, ENUM_EVENT as ENUM_EVENT$1, EVENT_FIELD as EVENT_FIELD$1, ResourceBounds as ResourceBounds$2, EDataAvailabilityMode as EDataAvailabilityMode$1, Errors, ETransactionVersion2 as ETransactionVersion2$1, ETransactionVersion3 as ETransactionVersion3$1, StarknetDomain, StarknetEnumType, StarknetMerkleType, StarknetType, TypedData, TypedDataRevision, BlockWithTxReceipts, InvokedTransaction as InvokedTransaction$2, DeclaredTransaction as DeclaredTransaction$2, DeployedAccountTransaction as DeployedAccountTransaction$1, L1Message as L1Message$1, EventFilter as EventFilter$1, StarknetWindowObject, AccountChangeEventHandler, NetworkChangeEventHandler, WatchAssetParameters, AddStarknetChainParameters, Signature as Signature$1, EDAMode as EDAMode$1,
|
|
2
|
+
import { ETransactionVersion as ETransactionVersion$1, STRUCT_EVENT as STRUCT_EVENT$1, ENUM_EVENT as ENUM_EVENT$1, EVENT_FIELD as EVENT_FIELD$1, ResourceBounds as ResourceBounds$2, EDataAvailabilityMode as EDataAvailabilityMode$1, BlockHash as BlockHash$1, TransactionHash as TransactionHash$1, Errors, ETransactionVersion2 as ETransactionVersion2$1, ETransactionVersion3 as ETransactionVersion3$1, StarknetDomain, StarknetEnumType, StarknetMerkleType, StarknetType, TypedData, TypedDataRevision, BlockWithTxReceipts, InvokedTransaction as InvokedTransaction$2, DeclaredTransaction as DeclaredTransaction$2, DeployedAccountTransaction as DeployedAccountTransaction$1, L1Message as L1Message$1, EventFilter as EventFilter$1, StarknetWindowObject, AccountChangeEventHandler, NetworkChangeEventHandler, WatchAssetParameters, AddStarknetChainParameters, Signature as Signature$1, EDAMode as EDAMode$1, EmittedEvent as EmittedEvent$1, Methods as Methods$1, Address, Permission, ChainId as ChainId$1, AccountDeploymentData, AddInvokeTransactionParameters, AddInvokeTransactionResult, AddDeclareTransactionParameters, AddDeclareTransactionResult, SpecVersion } from 'starknet-types-07';
|
|
3
3
|
export { StarknetDomain, StarknetEnumType, StarknetMerkleType, StarknetType, TypedData, TypedDataRevision } from 'starknet-types-07';
|
|
4
4
|
import * as weierstrass from '@noble/curves/abstract/weierstrass';
|
|
5
5
|
import { RecoveredSignatureType } from '@noble/curves/abstract/weierstrass';
|
|
@@ -2531,6 +2531,10 @@ type CallOptions = Pick<ContractOptions, 'blockIdentifier' | 'parseRequest' | 'p
|
|
|
2531
2531
|
type InvokeOptions = Pick<ContractOptions, 'maxFee' | 'nonce' | 'signature' | 'parseRequest'>;
|
|
2532
2532
|
type ParsedEvent = {
|
|
2533
2533
|
[name: string]: ParsedStruct;
|
|
2534
|
+
} & {
|
|
2535
|
+
block_hash?: BlockHash$1;
|
|
2536
|
+
block_number?: BlockNumber;
|
|
2537
|
+
transaction_hash?: TransactionHash$1;
|
|
2534
2538
|
};
|
|
2535
2539
|
type ParsedEvents = Array<ParsedEvent>;
|
|
2536
2540
|
|
|
@@ -7162,7 +7166,7 @@ declare function getAbiEvents(abi: Abi): AbiEvents;
|
|
|
7162
7166
|
}}]
|
|
7163
7167
|
* ```
|
|
7164
7168
|
*/
|
|
7165
|
-
declare function parseEvents(providerReceivedEvents:
|
|
7169
|
+
declare function parseEvents(providerReceivedEvents: EmittedEvent$1[], abiEvents: AbiEvents, abiStructs: AbiStructs, abiEnums: AbiEnums): ParsedEvents;
|
|
7166
7170
|
/**
|
|
7167
7171
|
* Parse Transaction Receipt Event from UDC invoke transaction and
|
|
7168
7172
|
* create DeployContractResponse compatible response with addition of the UDC Event data
|
package/dist/index.global.js
CHANGED
|
@@ -28016,6 +28016,9 @@ var starknet = (() => {
|
|
|
28016
28016
|
parsedEvent[abiEvent.name]
|
|
28017
28017
|
);
|
|
28018
28018
|
});
|
|
28019
|
+
if ("block_hash" in recEvent) parsedEvent.block_hash = recEvent.block_hash;
|
|
28020
|
+
if ("block_number" in recEvent) parsedEvent.block_number = recEvent.block_number;
|
|
28021
|
+
if ("transaction_hash" in recEvent) parsedEvent.transaction_hash = recEvent.transaction_hash;
|
|
28019
28022
|
acc.push(parsedEvent);
|
|
28020
28023
|
return acc;
|
|
28021
28024
|
}, []);
|
|
@@ -29285,15 +29288,29 @@ var starknet = (() => {
|
|
|
29285
29288
|
};
|
|
29286
29289
|
}
|
|
29287
29290
|
parseEvents(receipt) {
|
|
29288
|
-
|
|
29289
|
-
|
|
29290
|
-
|
|
29291
|
-
|
|
29292
|
-
|
|
29293
|
-
|
|
29294
|
-
|
|
29295
|
-
|
|
29296
|
-
|
|
29291
|
+
let parsed;
|
|
29292
|
+
receipt.match({
|
|
29293
|
+
success: (txR) => {
|
|
29294
|
+
const emittedEvents = txR.events?.map((event) => {
|
|
29295
|
+
return {
|
|
29296
|
+
block_hash: txR.block_hash,
|
|
29297
|
+
block_number: txR.block_number,
|
|
29298
|
+
transaction_hash: txR.transaction_hash,
|
|
29299
|
+
...event
|
|
29300
|
+
};
|
|
29301
|
+
}).filter((event) => cleanHex(event.from_address) === cleanHex(this.address), []) || [];
|
|
29302
|
+
parsed = parseEvents(
|
|
29303
|
+
emittedEvents,
|
|
29304
|
+
this.events,
|
|
29305
|
+
this.structs,
|
|
29306
|
+
CallData.getAbiEnum(this.abi)
|
|
29307
|
+
);
|
|
29308
|
+
},
|
|
29309
|
+
_: () => {
|
|
29310
|
+
throw Error("This transaction was not successful.");
|
|
29311
|
+
}
|
|
29312
|
+
});
|
|
29313
|
+
return parsed;
|
|
29297
29314
|
}
|
|
29298
29315
|
isCairo1() {
|
|
29299
29316
|
return cairo_exports.isCairo1Abi(this.abi);
|