Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the new auth method and trigger matcher array #56

Merged
merged 15 commits into from
Jan 23, 2025

Conversation

v9n
Copy link
Member

@v9n v9n commented Jan 22, 2025

No description provided.

Copy link
Member

@chrisli30 chrisli30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments.

@@ -19,6 +19,8 @@ import { NodeType } from "@avaprotocol/types";
export const FACTORY_ADDRESS = "0x29adA1b5217242DEaBB142BC3b1bCfFdd56008e7";
export const EXPIRED_AT = Math.floor(Date.now() / 1000) + 24 * 60 * 60; // 24 hours from now

export const defaultTriggerId = `trigger${getNextId()}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a trigger prefix to the id of a trigger?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no we dont. this is just test. let me know if you want to remvoe it. i put it to easily found in in console log when develop locally. so hard to know which is which with all the uuid. because now we use uuid all so hard to know whether a uuid belong to trigger or node.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, we need to store that in a variable. The fix looks good.

apiKey: string,
expiredAtEpoch: number,
): Promise<KeyRequest> {
const chainId = CHAIN_ID;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the chainId needs to be passed in, but not a const.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's passed in in the actual function.
CleanShot 2025-01-22 at 09 53 31

The place you're commention is a test utils function. and the CHAIN_ID const is pre-define in the same with CHAIN_ENDPOINT.

CleanShot 2025-01-22 at 09 54 26

tests/utils.ts Outdated

return signature;
// Helper function to generate api key message
export async function generateAuthPayloadWithApiKey(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function doesn’t need the async keyword.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this func used only by the authWithAPIKey? I think it can be merged into the authWithAPIKey

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function doesn’t need the async keyword.

Will remove. I fetch the Chain ID dynamically from the RPC before but it make the test a bit slower than normal so i revert to setting the Chain ID together with the chain endpoint

Is this func used only by the authWithAPIKey? I think it can be merged into the authWithAPIKey

hmm, this function is inside tests/utils.ts for testing purpose...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, sorry I thought it was in source code. Then this is fine.

packages/sdk-js/src/models/trigger/event.ts Show resolved Hide resolved
@v9n
Copy link
Member Author

v9n commented Jan 23, 2025

@chrisli30 please review again

Copy link
Member

@chrisli30 chrisli30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, all comments are addressed.

@v9n v9n merged commit 947c15b into main Jan 23, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants