Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/solana-labs/chatgpt-plugin
https://github.com/solana-labs/chatgpt-plugin
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/solana-labs/chatgpt-plugin
- Owner: solana-labs
- License: other
- Created: 2023-04-25T18:50:37.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-09-26T14:57:28.000Z (about 1 year ago)
- Last Synced: 2024-09-28T09:42:37.558Z (about 1 month ago)
- Language: TypeScript
- Homepage: https://chatgpt.solanalabs.com
- Size: 5.4 MB
- Stars: 179
- Watchers: 12
- Forks: 63
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ChatGPT-repositories - chatgpt-plugin - π§¬@Solanalabs has developed an open-source reference implementation for a ChatGPT plugin.π§¬The availability of #ChatGPT plugins will enable #Solana users to verify their wallet balances, transfer tokens, and acquire NFTs.π½INFO (Browser-extensions)
README
# Solana ChatGPT Plugin
A ChatGPT plugin for Solana. Install as an unverified plugin with url `https://chatgpt.solanalabs.com`.
## Endpoints
ChatGPT can POST to the following resources, as described by `.well-known/openapi.yaml`.
/getAccountInfo { address }
Returns the output of `getAccountInfo` method from the RPC with buffer data, and if it can be deserialized by its program IDL, then the response payload has additional field called `extended` that has a JSON serialized string of the anchor data. Chat GPT's plugin model seems to be able to read this pretty well.
```json
{
...,
"extended": "{\"authority\":\"8fbqVvpK3Dj7fdP2c8JJhtD7Zy3n9qtwAeGfbkgPu625\",\"numMinted\":50}"
}
```/getBalance { address }
Returns
```json
{
"sol": 0.40296
}
```/getAssetsByOwner { address }
Returns the assets returned by the [Metaplex Read API spec](https://github.com/metaplex-foundation/api-specifications/blob/main/specifications/read_api/openrpc_spec.json)
/getTransaction { signature }
Accepts
```json
{
"signature": "h51pjmFcn8LkxejofUQoDYkyubUKaB7bNtyMMSCCamSEYRutS2G2vm2w1ERShko8boRqdaaTAs4MR6sGYkTByNF"
}
```Returns human-readable transaction information, parsed from the `getTransaction` method of the Solana RPC.
/getTokenAccounts { address }
Returns the token accounts owned by a user with an amount > 0. Derived from the `getTokenAccountsByOwner` method on the Solana RPC.
/getSignaturesForAddress { address }
Returns the transaction signatures returned in `getSignaturesForAddress` method from the Solana RPC.
/getTotalValue { address }
Returns the total value of the assets owned by `address`, broken down by NFTs and tokens. Token prices and NFT price estimates are provided by HelloMoon. An example output is provided below
```json
{
"total": "50.00",
"nftTotal": "25.00",
"tokenTotal": "25.00"
}
```### Endpoints for NFT discovery
These endpoints are under development and subject to rapid change. These currently use the [Hyperspace API](https://docs.hyperspace.xyz)./getCollectionsByFloorPrice { maxFloorPrice, minFloorPrice, orderBy, pageSize }
Returns
```json
{
"projects": [
{
"id": "",
"desc": "collection description",
"img": "collection image url",
"website": "collection website url",
"floor_price": 0.1
}
],
"hasMore": true,
"currentPage'": 1
}
```/getListedCollectionNFTs { projectId, pageSize, priceOrder }
Returns LLM friendly response of available NFTs:
```json
{
"listings": [
{
"price": 0.1,
"token": "",
"marketplace": ""
}
],
"hasMore": true,
"currentPage": 1
}
```## Private endpoints (not LLM accessible)
### Endpoints for Sending Transactions
Note: these endpoints are currently disabled in the production version of the ChatGPT plugin
/createBuyTransaction { token, price }
Right now we are trusting Hyperspace to craft a valid transaction for us.
In the future we will setup a write interface for programs on Solana to adhere to in order to
be a target of LLM transaction composition.Returns
```json
{
"linkToSign": ""
}
```/createTransferSol { destination, amount }
Creates a transaction to transfer an amount in Sol.
Returns
```json
{
"linkToSign": ""
}
```/createTransferToken { destination, mint, amount }
Creates a transaction to transfer an amount of token (from the mint).
Returns
```json
{
"linkToSign": ""
}
```### Endpoints for Transaction Composition
These are also subject to change, and we may create actual webpages to inspect
the transaction before signing. However for now, these are simply redirect links
to ensure that SolanaPay QR codes show up in the ChatGPT link previews./page/:methodName
Returns a webpage with [OpenGraph](https://ogp.me/) metadata that will be rendered in the ChatGPT
rich link preview. All ChatGPT links should be proxied through this sort of pipeline to maximize
user engagement of links. The `og:image` tag is to `/qr/:methodName` to show a SolanaPay QR code in link previews.This is currently a blank page, but we may show a preview of the transaction in the future.
/qr/:methodName
Returns a PNG QR code that has been optimized to show in the particular aspect ratio of ChatGPT plugins.
This just encodes a SolanaPay link that redirects to `/sign/:methodName`./sign/:methodName
This is the final redirect link that actually returns transaction bytes in a SolanaPay compatible format
so users can sign transactions that are recommended by ChatGPT.```json
{
"transaction": ""
}
```## Development
To install dependencies, just execute `yarn`. This project uses `node` with version `>=16.17.0`.
To start a development server, execute `yarn dev`. This will start the plugin available from `localhost:3333` with its own configuration settings in `.well-known-dev/`.
# License
This codebase is released under [Apache License 2.0](LICENSE.md).
# Disclaimer
By accessing or using this codebase or any of its components, you accept and agree with the [Disclaimer](DISCLAIMER.md).