-
Notifications
You must be signed in to change notification settings - Fork 153
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
fetches the address of lens post creator #190
Closed
+689
−87
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
{ | ||
"private": true, | ||
"name": "goat-repo", | ||
"version": "0.1.0", | ||
"scripts": { | ||
"build": "pnpm turbo build", | ||
"prepare": "husky" | ||
}, | ||
"devDependencies": { | ||
"husky": "^9.1.7" | ||
}, | ||
"engines": { | ||
"node": ">=20.12.2 <23", | ||
"npm": "please-use-pnpm", | ||
"pnpm": ">=9", | ||
"yarn": "please-use-pnpm" | ||
}, | ||
"homepage": "https://github.com/crossmint/goat", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/crossmint/goat.git" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/crossmint/goat/issues" | ||
}, | ||
"keywords": [ | ||
"ai", | ||
"agents", | ||
"web3" | ||
], | ||
"packageManager": "[email protected]" | ||
"private": true, | ||
"name": "goat-repo", | ||
"version": "0.1.0", | ||
"scripts": { | ||
"build": "turbo run build", | ||
"prepare": "husky" | ||
}, | ||
"devDependencies": { | ||
"husky": "^9.1.7" | ||
}, | ||
"engines": { | ||
"node": ">=20.12.2 <23", | ||
"npm": "please-use-pnpm", | ||
"pnpm": ">=9", | ||
"yarn": "please-use-pnpm" | ||
}, | ||
"homepage": "https://github.com/crossmint/goat", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/crossmint/goat.git" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/crossmint/goat/issues" | ||
}, | ||
"keywords": [ | ||
"ai", | ||
"agents", | ||
"web3" | ||
], | ||
"packageManager": "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
WALLET_PRIVATE_KEY= | ||
ALCHEMY_LENS_RPC_URL= | ||
OPENAI_API_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# goat-examples-vercel-ai-uniswap | ||
|
||
## 0.1.6 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [50180d4] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
|
||
## 0.1.5 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [1906022] | ||
- @goat-sdk/[email protected] | ||
|
||
## 0.1.4 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [778440b] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
|
||
## 0.1.3 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [279dfcd] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
|
||
## 0.1.2 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [6c03f61] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
|
||
## 0.1.1 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [608f9f1] | ||
- @goat-sdk/[email protected] | ||
|
||
## 0.1.0 | ||
|
||
### Minor Changes | ||
|
||
- d3d9a7d: Upgrade to new plugin architecture | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [d3d9a7d] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
|
||
## 0.0.3 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [a66ceec] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
|
||
## 0.0.2 | ||
|
||
### Patch Changes | ||
|
||
- 16271ab: Simplify core architecture | ||
- Updated dependencies [16271ab] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
|
||
## 0.0.1 | ||
|
||
### Patch Changes | ||
|
||
- cad06c0: uniswap package and example | ||
- Updated dependencies [cad06c0] | ||
- Updated dependencies [ad45f94] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] | ||
- @goat-sdk/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Vercel AI Uniswap Example | ||
|
||
## Setup | ||
|
||
Create an `.env` file by copying the `.env.template` and populating with your values. | ||
|
||
``` | ||
cp .env.template .env | ||
``` | ||
|
||
`UNISWAP_API_KEY` and `UNISWAP_BASE_URL` will be populated in the next step. | ||
|
||
## Usage | ||
|
||
1. Create an API key for Uniswap's Trading API by visiting [this page](https://hub.uniswap.org/) and following the instructions. Also obtain the url from the API key creation page. | ||
|
||
2. Run the script with your prompt! | ||
|
||
``` | ||
npx ts-node index.ts | ||
``` | ||
|
||
Some examples: | ||
|
||
* Prompt it to swap 1 ETH for USDC | ||
|
||
## Actions it supports | ||
|
||
- `Get Quote`: Get a quote for a swap | ||
- `Get Swap Transaction`: Get the transaction details for a swap | ||
- `Send Transaction`: Send a transaction | ||
- `Check Approval`: Check if the wallet has enough approval for a token and returns the transaction to approve the token. The approval must takes place before the swap transaction. | ||
|
||
Want support for more actions? [Open an issue](https://github.com/goat-sdk/goat-sdk/issues) and let us know! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { defineChain } from "viem"; | ||
|
||
export const lens_testnet = /*#__PURE__*/ defineChain({ | ||
id: 37111, | ||
name: "Lens Testnet", | ||
network: "Lens Network Sepolia Testnet", | ||
nativeCurrency: { | ||
name: "GRASS", | ||
symbol: "GSS", | ||
decimals: 18, | ||
}, | ||
rpcUrls: { | ||
default: { | ||
http: ["https://rpc.testnet.lens.dev"], | ||
}, | ||
}, | ||
blockExplorers: { | ||
default: { | ||
name: "Lens Explorer", | ||
url: "https://block-explorer.testnet.lens.dev", | ||
apiUrl: "https://block-explorer-api.staging.lens.dev", | ||
}, | ||
}, | ||
testnet: false, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { openai } from "@ai-sdk/openai"; | ||
import { generateText } from "ai"; | ||
|
||
import { http } from "viem"; | ||
import { createWalletClient } from "viem"; | ||
import { privateKeyToAccount } from "viem/accounts"; | ||
import { lens_testnet } from "./chain"; | ||
import { getOnChainTools } from "@goat-sdk/adapter-vercel-ai"; | ||
import { lens } from "@goat-sdk/plugin-lens"; | ||
import { viem } from "@goat-sdk/wallet-viem"; | ||
|
||
require("dotenv").config(); | ||
|
||
const account = privateKeyToAccount(`0x${process.env.WALLET_PRIVATE_KEY}`); | ||
|
||
const walletClient = createWalletClient({ | ||
account: account, | ||
transport: http(`${process.env.ALCHEMY_LENS_RPC_URL}`), | ||
chain: lens_testnet, | ||
}); | ||
|
||
(async () => { | ||
const tools = await getOnChainTools({ | ||
wallet: viem(walletClient), | ||
plugins: [lens()], | ||
}); | ||
|
||
const result = await generateText({ | ||
model: openai("gpt-4o"), | ||
tools: tools, | ||
maxSteps: 5, | ||
prompt: "Get the creator of post https://hey.xyz/posts/0x033026-0x0580 and tip him 1 token", | ||
}); | ||
|
||
console.log(result.text); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "goat-examples-vercel-ai-lens", | ||
"version": "0.1.6", | ||
"description": "", | ||
"private": true, | ||
"scripts": { | ||
"test": "vitest run --passWithNoTests" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@ai-sdk/openai": "^1.0.4", | ||
"@goat-sdk/adapter-vercel-ai": "workspace:*", | ||
"@goat-sdk/core": "workspace:*", | ||
"@goat-sdk/plugin-lens": "workspace:*", | ||
"@goat-sdk/wallet-viem": "workspace:*", | ||
"ai": "^4.0.3", | ||
"dotenv": "^16.4.5", | ||
"viem": "2.21.49" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"outDir": "dist" | ||
}, | ||
"include": ["index.ts"], | ||
"exclude": ["node_modules", "dist"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# @goat-sdk/plugin-opensea | ||
|
||
## 0.1.1 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [50180d4] | ||
- @goat-sdk/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Goat Lens Plugin 🐐 - TypeScript | ||
|
||
Lens plugin for [Goat 🐐](https://ohmygoat.dev). Allows you to fetch the wallet address of lens creator based on their post | ||
|
||
## Installation | ||
|
||
``` | ||
npm install @goat-sdk/plugin-lens | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript | ||
import { opensea } from "@goat-sdk/plugin-lens"; | ||
|
||
const plugin = lens({}); | ||
``` | ||
|
||
## Working example | ||
|
||
## Goat | ||
|
||
<div align="center"> | ||
Go out and eat some grass. | ||
|
||
[Docs](https://ohmygoat.dev) | [Examples](https://github.com/goat-sdk/goat/tree/main/typescript/examples) | [Discord](https://discord.gg/2F8zTVnnFz)</div> | ||
|
||
## Goat 🐐 | ||
|
||
Goat 🐐 (Great Onchain Agent Toolkit) is an open-source library enabling AI agents to interact with blockchain protocols and smart contracts via their own wallets. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
You can also use the lens package to import the network without having to define it :)
https://dev-preview.lens.xyz/docs/network/getting-started/viem