Skip to content

introduce wallet activity webhook #1

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

Open
wants to merge 17 commits into
base: v0.6.0
Choose a base branch
from

Conversation

lizard-boy
Copy link

What changed? Why?

let w2 = await Webhook.create({ networkId: "base-mainnet", notificationUri: "https://e.com/callback", eventType: "wallet_activity",  eventTypeFilter: {addresses: ["0xa55C5950F7A3C42Fa5799B2Cac0e455774a07382"], wallet_id: "w1"}, eventFilters: [{ contract_address: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913" }], signatureHeader: "optional-signature-string"});
undefined
> w2.toString()
`Webhook { id: '66e9dc7bb97a771dc092d26b', networkId: 'base-mainnet', eventType: 'wallet_activity', eventFilter: [{"contract_address":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"}], eventTypeFilter: {"addresses":["0xa55c5950f7a3c42fa5799b2cac0e455774a07382"],"wallet_id":"w1"}, notificationUri: 'https://e.com/callback', signatureHeader: 'optional-signature-string' }`

Qualified Impact

@lizard-boy lizard-boy changed the title Wallet activity support introduce wallet activity webhook Sep 18, 2024
@dakshgup
Copy link

@greptileai

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR introduces support for wallet activity webhooks in the Coinbase SDK for Node.js, enhancing the webhook functionality with more specific event filtering capabilities.

  • Added eventTypeFilter field to CreateWebhookOptions type in src/coinbase/types.ts
  • Implemented createWebhook method in Wallet class in src/coinbase/wallet.ts
  • Updated Webhook class in src/coinbase/webhook.ts to handle new eventTypeFilter parameter
  • Modified webhook test suite in src/tests/webhook_test.ts to cover new functionality
  • Changes align with the example provided in the PR description, demonstrating proper implementation

4 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings

Comment on lines +770 to +773
addresses: this.addresses.map(address => address.getId()!),
wallet_id: this.getId()!,
},
signatureHeader: signatureHeader,
Copy link

Choose a reason for hiding this comment

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

logic: this.addresses might be empty if listAddresses hasn't been called. Consider adding a check or calling listAddresses if needed

Comment on lines +752 to +760
/**
* Creates a Webhook.
*
* @param notificationUri - [String] The URI to which the webhook notifications will be sent.
* @param signatureHeader - [String] (Optional) A header used to sign the webhook request,
* defaulting to an empty string.
*
* @returns [Coinbase::Webhook] The newly created webhook instance.
*/
Copy link

Choose a reason for hiding this comment

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

style: Add @throws annotation to document potential errors

Comment on lines +147 to +149
public getEventTypeFilter(): WebhookEventTypeFilter | undefined {
return this.model?.event_type_filter;
}
Copy link

Choose a reason for hiding this comment

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

style: Add JSDoc for the return type

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.

3 participants