- Notifications
You must be signed in to change notification settings - Fork72
License
solana-labs/chatgpt-plugin
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A ChatGPT plugin for Solana. Install as an unverified plugin with urlhttps://chatgpt.solanalabs.com.
ChatGPT can POST to the following resources, as described by.well-known/openapi.yaml.
/getAccountInfo { address }
Returns the output ofgetAccountInfo method from the RPC with buffer data, and if it can be deserialized by its program IDL, then the response payload has additional field calledextended that has a JSON serialized string of the anchor data. Chat GPT's plugin model seems to be able to read this pretty well.
{...,"extended":"{\"authority\":\"8fbqVvpK3Dj7fdP2c8JJhtD7Zy3n9qtwAeGfbkgPu625\",\"numMinted\":50}"}/getBalance { address }
Returns
{"sol":0.40296}/getAssetsByOwner { address }
Returns the assets returned by theMetaplex Read API spec
/getTransaction { signature }
Accepts
{"signature":"h51pjmFcn8LkxejofUQoDYkyubUKaB7bNtyMMSCCamSEYRutS2G2vm2w1ERShko8boRqdaaTAs4MR6sGYkTByNF"}Returns human-readable transaction information, parsed from thegetTransaction method of the Solana RPC.
/getTokenAccounts { address }
Returns the token accounts owned by a user with an amount > 0. Derived from thegetTokenAccountsByOwner method on the Solana RPC.
/getSignaturesForAddress { address }
Returns the transaction signatures returned ingetSignaturesForAddress method from the Solana RPC.
/getTotalValue { address }
Returns the total value of the assets owned byaddress, broken down by NFTs and tokens. Token prices and NFT price estimates are provided by HelloMoon. An example output is provided below
{"total":"50.00","nftTotal":"25.00","tokenTotal":"25.00"}These endpoints are under development and subject to rapid change. These currently use theHyperspace API.
/getCollectionsByFloorPrice { maxFloorPrice, minFloorPrice, orderBy, pageSize }
Returns
{"projects": [ {"id":"<hyperspace-collection-id or pubkey>","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:
{"listings": [ {"price":0.1,"token":"<token-address-pubkey>","marketplace":"<marketplace-pubkey>" } ],"hasMore":true,"currentPage":1}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 tobe a target of LLM transaction composition.
Returns
{"linkToSign":"<url-to-sign-transaction>" }/createTransferSol { destination, amount }
Creates a transaction to transfer an amount in Sol.
Returns
{"linkToSign":"<url-to-sign-transaction>" }/createTransferToken { destination, mint, amount }
Creates a transaction to transfer an amount of token (from the mint).
Returns
{"linkToSign":"<url-to-sign-transaction>" }These are also subject to change, and we may create actual webpages to inspectthe transaction before signing. However for now, these are simply redirect linksto ensure that SolanaPay QR codes show up in the ChatGPT link previews.
/page/:methodName
Returns a webpage withOpenGraph metadata that will be rendered in the ChatGPTrich link preview. All ChatGPT links should be proxied through this sort of pipeline to maximizeuser engagement of links. Theog: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 formatso users can sign transactions that are recommended by ChatGPT.
{"transaction":"<base64-encoded-transaction-bytes>"}To install dependencies, just executeyarn. This project usesnode with version>=16.17.0.
To start a development server, executeyarn dev. This will start the plugin available fromlocalhost:3333 with its own configuration settings in.well-known-dev/.
This codebase is released underApache License 2.0.
By accessing or using this codebase or any of its components, you accept and agree with theDisclaimer.
About
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.
