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

chore: update sdk #398

Merged
merged 2 commits into from
Feb 19, 2025
Merged

chore: update sdk #398

merged 2 commits into from
Feb 19, 2025

Conversation

notV4l
Copy link
Collaborator

@notV4l notV4l commented Feb 17, 2025

update sdk to support dojoengine/dojo.c@4bd2be5

Summary by CodeRabbit

  • New Features

    • Enhanced token querying by adding an extra filtering option for more precise token-related data.
  • Refactor

    • Streamlined client initialization across sample projects by removing redundant connection settings.
  • Chores

    • Updated the version of the dojoup command in the CI workflow.
    • Updated subproject commit references for various components.

Copy link

coderabbitai bot commented Feb 17, 2025

Walkthrough

The changes update the SDK by adding a new parameter token_ids to several methods in both the implementation and type definitions. Additionally, multiple example projects have removed the usage of the rpcUrl configuration from client initializations. A subproject commit in the Dojo starter was also updated. Overall, the modifications refine how token data is queried and streamline client configuration in examples.

Changes

File(s) Change Summary
packages/sdk/src/index.ts
packages/sdk/src/types.ts
Added a new token_ids: string[] parameter to the getTokens, getTokenBalances, onTokenBalanceUpdated, and updateTokenBalanceSubscription methods, with corresponding documentation updates.
worlds/dojo-starter Updated subproject commit from 435171ea38c17e36d6760532e34fb797dc1cf834 to 0c97b2c79646039b4af8c6fd3735470946512422.
Examples (multiple)
(e.g., examples/example-vanillajs-phaser-recs/src/dojo/setup.ts,
examples/example-vite-experimental-sdk/src/main.ts,
examples/example-vite-grpc-playground/src/main.tsx,
examples/example-vite-kitchen-sink/src/main.tsx,
examples/example-vite-phaser-sdk/src/main.ts,
examples/example-vite-react-app-recs/src/dojo/setup.ts,
examples/example-vite-react-sdk/src/main.tsx,
examples/example-vite-react-sql/src/main.tsx,
examples/example-vite-svelte-recs/src/dojo/setup.ts)
Removed the rpcUrl property from client configuration objects; in one instance, also removed the getRpcUrl function call and its import.

Sequence Diagram(s)

sequenceDiagram
  participant C as Caller
  participant S as SDK
  participant CL as Client

  C->>S: Call getTokens(contract_addresses, token_ids)
  S->>CL: Forward call with contract_addresses & token_ids
  CL-->>S: Return tokens data
  S-->>C: Return tokens data
Loading

Possibly related PRs

  • fix: sdk function params refac to object param #337: The changes in the main PR are related to those in the retrieved PR as both involve modifications to method signatures in the packages/sdk/src/index.ts and packages/sdk/src/types.ts files, specifically adding parameters to existing methods.
  • feat: add torii tokens functions to dojo sdk #339: The changes in the main PR are related to those in the retrieved PR as both modify the getTokens and getTokenBalances methods in the packages/sdk/src/index.ts and packages/sdk/src/types.ts files, with the main PR adding parameters while the retrieved PR introduces the methods.
  • feat: grpc playground #388: The changes in the main PR are related to the modifications of method signatures in the SDK interface, which directly correspond to the updates made in the packages/sdk/src/types.ts file, indicating a strong connection at the code level.

Poem

Hop along, dear coder, in fields so bright,
I’m a rabbit of code, leaping with delight.
Token IDs now added, a fresh new spring in air,
RPC removals clear the path, clean and fair.
With a twitch of my nose and a hearty “HOP!”
I celebrate these changes that never stop!
🐰✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 82f5bc6 and 896c98e.

⛔ Files ignored due to path filters (4)
  • examples/example-vite-react-phaser-recs/src/dojo/generated/setup.ts is excluded by !**/generated/**
  • examples/example-vite-react-pwa-recs/src/dojo/generated/setup.ts is excluded by !**/generated/**
  • examples/example-vite-react-threejs-recs/src/dojo/generated/setup.ts is excluded by !**/generated/**
  • examples/example-vue-app-recs/src/dojo/generated/setup.ts is excluded by !**/generated/**
📒 Files selected for processing (13)
  • .github/workflows/ci.yaml (1 hunks)
  • examples/example-vanillajs-phaser-recs/src/dojo/setup.ts (0 hunks)
  • examples/example-vite-experimental-sdk/src/main.ts (0 hunks)
  • examples/example-vite-grpc-playground/src/main.tsx (0 hunks)
  • examples/example-vite-kitchen-sink/src/main.tsx (1 hunks)
  • examples/example-vite-phaser-sdk/src/main.ts (0 hunks)
  • examples/example-vite-react-app-recs/src/dojo/setup.ts (0 hunks)
  • examples/example-vite-react-sdk/src/main.tsx (0 hunks)
  • examples/example-vite-react-sql/src/main.tsx (0 hunks)
  • examples/example-vite-svelte-recs/src/dojo/setup.ts (0 hunks)
  • packages/sdk/src/__example__/index.ts (0 hunks)
  • worlds/dojo-starter (1 hunks)
  • worlds/onchain-dash (1 hunks)
💤 Files with no reviewable changes (9)
  • examples/example-vite-react-sql/src/main.tsx
  • examples/example-vite-experimental-sdk/src/main.ts
  • examples/example-vite-grpc-playground/src/main.tsx
  • examples/example-vanillajs-phaser-recs/src/dojo/setup.ts
  • examples/example-vite-react-sdk/src/main.tsx
  • examples/example-vite-phaser-sdk/src/main.ts
  • packages/sdk/src/example/index.ts
  • examples/example-vite-svelte-recs/src/dojo/setup.ts
  • examples/example-vite-react-app-recs/src/dojo/setup.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • examples/example-vite-kitchen-sink/src/main.tsx
  • worlds/onchain-dash
  • worlds/dojo-starter
  • .github/workflows/ci.yaml
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: check

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@notV4l notV4l requested a review from MartianGreed February 17, 2025 20:48
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 720b48f and 20d294e.

📒 Files selected for processing (4)
  • packages/sdk/src/index.ts (5 hunks)
  • packages/sdk/src/types.ts (5 hunks)
  • worlds/dojo-starter (1 hunks)
  • worlds/onchain-dash (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • worlds/onchain-dash
  • worlds/dojo-starter
🧰 Additional context used
🪛 Biome (1.9.4)
packages/sdk/src/index.ts

[error] 305-305: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (2)
packages/sdk/src/types.ts (1)

327-327: LGTM! The token-related method signatures have been consistently updated.

The changes consistently add the token_ids parameter to all token-related methods in the SDK interface, along with proper documentation. This enhancement allows for more granular filtering of tokens.

Also applies to: 331-333, 343-344, 363-363, 383-384

packages/sdk/src/index.ts (1)

260-260: LGTM! The token-related method implementations have been consistently updated.

The changes consistently add the token_ids parameter to all token-related methods and properly pass it to the corresponding client methods.

Also applies to: 264-267, 278-284, 304-311, 331-338

@@ -295,11 +301,13 @@ export async function init<T extends SchemaType>(
onTokenBalanceUpdated: (
contract_addresses: string[],
account_addresses: string[],
token_ids: string[],
callback: Function
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Replace Function type with a more specific callback type.

Using the Function type reduces type safety as it accepts any function-like value. Consider defining a more specific callback type.

Apply this diff to improve type safety:

-callback: Function
+callback: (response: { data?: torii.TokenBalances; error?: Error }) => void
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
callback: Function
callback: (response: { data?: torii.TokenBalances; error?: Error }) => void
🧰 Tools
🪛 Biome (1.9.4)

[error] 305-305: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)

@MartianGreed MartianGreed force-pushed the update_sdk branch 3 times, most recently from 1e689fe to 175c80f Compare February 19, 2025 13:25
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/ci.yaml (1)

53-57: Optional cleanup for commented-out Codecov steps.
The commented-out section for uploading coverage reports to Codecov remains in the workflow. If these steps are no longer planned for use, consider removing them to simplify the file and maintain clarity.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0dc71cd and 175c80f.

⛔ Files ignored due to path filters (4)
  • examples/example-vite-react-phaser-recs/src/dojo/generated/setup.ts is excluded by !**/generated/**
  • examples/example-vite-react-pwa-recs/src/dojo/generated/setup.ts is excluded by !**/generated/**
  • examples/example-vite-react-threejs-recs/src/dojo/generated/setup.ts is excluded by !**/generated/**
  • examples/example-vue-app-recs/src/dojo/generated/setup.ts is excluded by !**/generated/**
📒 Files selected for processing (12)
  • .github/workflows/ci.yaml (1 hunks)
  • examples/example-vanillajs-phaser-recs/src/dojo/setup.ts (0 hunks)
  • examples/example-vite-experimental-sdk/src/main.ts (0 hunks)
  • examples/example-vite-grpc-playground/src/main.tsx (0 hunks)
  • examples/example-vite-kitchen-sink/src/main.tsx (1 hunks)
  • examples/example-vite-phaser-sdk/src/main.ts (0 hunks)
  • examples/example-vite-react-app-recs/src/dojo/setup.ts (0 hunks)
  • examples/example-vite-react-sdk/src/main.tsx (0 hunks)
  • examples/example-vite-react-sql/src/main.tsx (0 hunks)
  • examples/example-vite-svelte-recs/src/dojo/setup.ts (0 hunks)
  • worlds/dojo-starter (1 hunks)
  • worlds/onchain-dash (1 hunks)
💤 Files with no reviewable changes (8)
  • examples/example-vite-experimental-sdk/src/main.ts
  • examples/example-vite-react-sql/src/main.tsx
  • examples/example-vite-phaser-sdk/src/main.ts
  • examples/example-vite-react-sdk/src/main.tsx
  • examples/example-vite-grpc-playground/src/main.tsx
  • examples/example-vite-react-app-recs/src/dojo/setup.ts
  • examples/example-vite-svelte-recs/src/dojo/setup.ts
  • examples/example-vanillajs-phaser-recs/src/dojo/setup.ts
✅ Files skipped from review due to trivial changes (1)
  • worlds/onchain-dash
🚧 Files skipped from review as they are similar to previous changes (2)
  • worlds/dojo-starter
  • examples/example-vite-kitchen-sink/src/main.tsx
🔇 Additional comments (1)
.github/workflows/ci.yaml (1)

22-23: Updated dojoup version usage.
The CI workflow now explicitly calls dojoup with version v1.1.1, which is in line with the SDK update objectives. Please verify that the new version is compatible with subsequent commands (e.g., the sozo build and sozo test steps) and that no breaking changes were introduced.

@MartianGreed MartianGreed force-pushed the update_sdk branch 4 times, most recently from 82f5bc6 to 185925a Compare February 19, 2025 15:06
@MartianGreed MartianGreed merged commit accf743 into main Feb 19, 2025
5 checks passed
@MartianGreed MartianGreed deleted the update_sdk branch February 19, 2025 15:37
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