Skip to content

Commit

Permalink
feat: Lulo support with Blinks (#269)
Browse files Browse the repository at this point in the history
* Add lulo support with blinks

* Add changeset
  • Loading branch information
0xaguspunk authored Jan 22, 2025
1 parent 4091ea5 commit ead5c2c
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 0 deletions.
5 changes: 5 additions & 0 deletions typescript/.changeset/light-humans-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@goat-sdk/plugin-lulo": patch
---

Release package
32 changes: 32 additions & 0 deletions typescript/packages/plugins/lulo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@goat-sdk/plugin-lulo",
"version": "0.1.0",
"files": ["dist/**/*", "README.md", "package.json"],
"scripts": {
"build": "tsup",
"clean": "rm -rf dist",
"test": "vitest run --passWithNoTests"
},
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"sideEffects": false,
"homepage": "https://ohmygoat.dev",
"repository": {
"type": "git",
"url": "git+https://github.com/goat-sdk/goat.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/goat-sdk/goat/issues"
},
"keywords": ["ai", "agents", "web3"],
"dependencies": {
"@goat-sdk/core": "workspace:*",
"zod": "catalog:",
"@goat-sdk/wallet-solana": "workspace:*"
},
"peerDependencies": {
"@goat-sdk/core": "workspace:*"
}
}
2 changes: 2 additions & 0 deletions typescript/packages/plugins/lulo/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./lulo.plugin";
export * from "./parameters";
14 changes: 14 additions & 0 deletions typescript/packages/plugins/lulo/src/lulo.plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { PluginBase } from "@goat-sdk/core";
import { LuloService } from "./lulo.service";

export class LuloPlugin extends PluginBase {
constructor() {
super("lulo", [new LuloService()]);
}

supportsChain = () => true;
}

export function lulo() {
return new LuloPlugin();
}
27 changes: 27 additions & 0 deletions typescript/packages/plugins/lulo/src/lulo.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Tool } from "@goat-sdk/core";
import { SolanaWalletClient } from "@goat-sdk/wallet-solana";
import { DepositUSDCParameters } from "./parameters";

export class LuloService {
@Tool({
name: "lulo_deposit_usdc",
description: "Deposit USDC into Lulo",
})
async depositUSDC(walletClient: SolanaWalletClient, parameters: DepositUSDCParameters) {
const response = await fetch(`https://blink.lulo.fi/actions?amount=${parameters.amount}&symbol=USDC`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
account: walletClient.getAddress(),
}),
});

const data = await response.json();

const tx = await walletClient.sendRawTransaction(data.transaction);

return tx.hash;
}
}
8 changes: 8 additions & 0 deletions typescript/packages/plugins/lulo/src/parameters.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createToolParameters } from "@goat-sdk/core";
import { z } from "zod";

export class DepositUSDCParameters extends createToolParameters(
z.object({
amount: z.string().describe("Amount of USDC to deposit"),
}),
) {}
6 changes: 6 additions & 0 deletions typescript/packages/plugins/lulo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../../../tsconfig.base.json",
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
6 changes: 6 additions & 0 deletions typescript/packages/plugins/lulo/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from "tsup";
import { treeShakableConfig } from "../../../tsup.config.base";

export default defineConfig({
...treeShakableConfig,
});
11 changes: 11 additions & 0 deletions typescript/packages/plugins/lulo/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"tasks": {
"build": {
"inputs": ["src/**", "tsup.config.ts", "!./**/*.test.{ts,tsx}", "tsconfig.json"],
"dependsOn": ["^build"],
"outputs": ["dist/**"]
}
}
}
12 changes: 12 additions & 0 deletions typescript/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ead5c2c

Please sign in to comment.