Skip to content

Commit

Permalink
fix reading cairo 1.0 input specs (#359)
Browse files Browse the repository at this point in the history
* [skip testnet]
  • Loading branch information
cfal committed May 5, 2023
1 parent 5d94eb7 commit 424a687
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/starknet-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export interface CairoFunction {
}

export interface EventSpecification {
data: Argument[];
data?: Argument[]; // cairo 0
inputs?: Argument[]; // cairo 1
keys: string[];
name: string;
type: "event";
Expand Down
3 changes: 2 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,8 @@ export class StarknetContract {
throw new StarknetPluginError(msg);
}

const adapted = adaptOutputUtil(rawEventData, eventSpecification.data, this.abi);
const inputSpecs = this.isCairo1 ? eventSpecification.inputs : eventSpecification.data;
const adapted = adaptOutputUtil(rawEventData, inputSpecs, this.abi);
decodedEvents.push({ name: eventSpecification.name, data: adapted });
}

Expand Down

0 comments on commit 424a687

Please sign in to comment.