Skip to content

Commit

Permalink
add 0x prefix to the address stf type
Browse files Browse the repository at this point in the history
  • Loading branch information
ecioppettini committed Aug 14, 2024
1 parent b569c27 commit 635f2ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/engine/paima-sm/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ export type GameStateTransitionFunction<Event extends EventPathAndDef> = (
) => Promise<{
stateTransitions: SQLUpdate[];
events: {
address: string;
address: `0x${string}`;
data: {
name: string;
fields: ResolvedPath<Event['path']> & Event['type'];
Expand Down
13 changes: 8 additions & 5 deletions packages/paima-sdk/paima-events/src/app-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ export const generateAppEvents = <

// create payload for the stf from an object.
export function createEventForStf<T extends ReturnType<typeof genEvent>>(
address: string,
address: `0x${string}`,
event: T,
fields: KeypairToObj<T['fields']>
): { address: string; data: { name: string; fields: KeypairToObj<T['fields']>; topic: string } } {
): {
address: `0x${string}`;
data: { name: string; fields: KeypairToObj<T['fields']>; topic: string };
} {
return { address, data: { name: event.name, fields, topic: toTopicHash(event) } };
}

Expand All @@ -76,15 +79,15 @@ type EmitFunction<
T extends ReadonlyArray<LogEvent<LogEventFields<TSchema>[]>>,
Name extends string,
> = {
emit: (name: Name, address: string, fields: UnionForOverloadedEvents<T, Name>) => void;
emit: (name: Name, address: `0x${string}`, fields: UnionForOverloadedEvents<T, Name>) => void;
};

type EventQueue<T extends ReadonlyArray<LogEvent<LogEventFields<TSchema>[]>>> = EmitFunction<
T,
T[number]['name']
> & {
get: () => {
address: string;
address: `0x${string}`;
data: { name: string; fields: KeypairToObj<T[number]['fields']>; topic: string };
}[];
};
Expand Down Expand Up @@ -185,7 +188,7 @@ export function eventQueueFactory<

obj.buffer = buffer;
obj.get = (): {
address: string;
address: `0x${string}`;
data: { name: string; fields: KeypairToObj<T[number]['fields']>; topic: string };
} => {
return buffer;
Expand Down

0 comments on commit 635f2ba

Please sign in to comment.