-
Notifications
You must be signed in to change notification settings - Fork 542
feat: Add Nebula AI chat and transaction execution API #5948
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
feat: Add Nebula AI chat and transaction execution API #5948
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 19cbb18 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
import { getContract } from "../contract/contract.js"; | ||
import * as Nebula from "./index.js"; | ||
|
||
describe("chat", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test file execute.test.ts
has a describe
block labeled as "chat"
, but since these tests are validating the execute functionality, the block should be labeled as "execute"
to accurately reflect its purpose.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
packages/thirdweb/src/ai/common.ts
Outdated
transactions = data.actions.map((action) => { | ||
const tx = JSON.parse(action.data) as { | ||
chainId: number; | ||
to: Address | undefined; | ||
value: Hex; | ||
data: Hex; | ||
}; | ||
return prepareTransaction({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The action.type
check is missing before parsing transaction data. Since action.type
can be 'init'
, 'presence'
, or 'sign_transaction'
, and each type may have different data structures, add a guard to ensure only 'sign_transaction'
actions are processed as transactions. This will prevent potential runtime errors from parsing incompatible data formats.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
543f9ec
to
07a59a2
Compare
07a59a2
to
1017315
Compare
size-limit report 📦
|
1017315
to
19cbb18
Compare
Fixes TOOL-3063
How to test
pnpm test:dev chat.test.ts
pnpm test:dev execute.test.ts
PR-Codex overview
This PR introduces the
Nebula
API, enabling users to interact with it for chat and transaction execution functionalities. It enhances thethirdweb
package with new methods and updates documentation for better usage examples.Detailed summary
Nebula
export inpackages/thirdweb/src/exports/ai.ts
.chat
andexecute
functions inpackages/thirdweb/src/ai/chat.ts
andpackages/thirdweb/src/ai/execute.ts
.packages/thirdweb/src/ai/common.ts
withInput
andOutput
types.chat
andexecute
inpackages/thirdweb/src/ai/chat.test.ts
andpackages/thirdweb/src/ai/execute.test.ts
.typedoc.mjs
to include the newsrc/ai/index.ts
.packages/thirdweb/package.json
to includeai
types and imports.Nebula
API usage examples inchangeset/warm-dodos-destroy.md
.