Skip to content

Commit

Permalink
change EventRecord['topics'][0] type to plain Hash
Browse files Browse the repository at this point in the history
  • Loading branch information
peetzweg committed Feb 16, 2024
1 parent 5db72af commit cc946da
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/api-contract/src/Abi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// SPDX-License-Identifier: Apache-2.0

import type { Bytes } from '@polkadot/types';

Check failure on line 4 in packages/api-contract/src/Abi/index.ts

View workflow job for this annotation

GitHub Actions / pr (lint)

Run autofix to sort these imports!
import type { ChainProperties, ContractConstructorSpecLatest, ContractEventSpecLatest, ContractMessageParamSpecLatest, ContractMessageSpecLatest, ContractMetadata, ContractMetadataLatest, ContractProjectInfo, ContractTypeSpec, EventRecord } from '@polkadot/types/interfaces';
import type { Codec, Registry, TypeDef } from '@polkadot/types/types';
import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from '../types.js';

import { Option, TypeRegistry } from '@polkadot/types';
import { TypeDefInfo } from '@polkadot/types-create';
import type { ChainProperties, ContractConstructorSpecLatest, ContractEventSpecLatest, ContractMessageParamSpecLatest, ContractMessageSpecLatest, ContractMetadata, ContractMetadataLatest, ContractProjectInfo, ContractTypeSpec } from '@polkadot/types/interfaces';
import type { Hash } from '@polkadot/types/interfaces/runtime';
import type { Codec, Registry, TypeDef } from '@polkadot/types/types';
import { assertReturn, compactAddLength, compactStripLength, isBn, isNumber, isObject, isString, isUndefined, logger, stringCamelCase, stringify, u8aConcat, u8aToHex } from '@polkadot/util';
import type { AbiConstructor, AbiEvent, AbiMessage, AbiParam, DecodedEvent, DecodedMessage } from '../types.js';

import { convertVersions, enumVersions } from './toLatest.js';

Expand Down Expand Up @@ -162,9 +162,9 @@ export class Abi {
/**
* Warning: Unstable API, bound to change
*/
public decodeEvent (data: Bytes | Uint8Array, topic: EventRecord['topics'][0]): DecodedEvent {
public decodeEvent (data: Bytes | Uint8Array, signatureTopic: Hash): DecodedEvent {
// try to find a topic signature match - ink! v5 upwards
let event = this.events.find((e) => e.signatureTopic === topic.toHex());
let event = this.events.find((e) => e.signatureTopic === signatureTopic.toHex());

if (event) {
return event.fromU8a(data.subarray(0));
Expand Down

0 comments on commit cc946da

Please sign in to comment.