Coder Social home page Coder Social logo

chatgpt-plugin's Introduction

Solana ChatGPT Plugin

A ChatGPT plugin for Solana. Install as an unverified plugin with url https://chatgpt.solanalabs.com.

Search NFTs in ChatGPT

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.

{
  ...,
  "extended": "{\"authority\":\"8fbqVvpK3Dj7fdP2c8JJhtD7Zy3n9qtwAeGfbkgPu625\",\"numMinted\":50}"
}
/getBalance { address }

Returns

{
  "sol": 0.40296
}
/getAssetsByOwner { address }

Returns the assets returned by the Metaplex Read API spec

/getTransaction { signature }

Accepts

{
  "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

{
  "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.

/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
} 

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

{
  "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>" 
}

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 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.

{
  "transaction": "<base64-encoded-transaction-bytes>"
}

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.

Disclaimer

By accessing or using this codebase or any of its components, you accept and agree with the Disclaimer.

chatgpt-plugin's People

Contributors

govarun avatar joeaba avatar ngundotra avatar nickfrosty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatgpt-plugin's Issues

[feat] Token search

Use @solflare/utl package to get name -> address

  • functionality
  • yaml update

[bug] Transaction Parsing

Memo instruction text doesn't get shown?

5cekeknfexACqzXtb3gVjGFKvjnYvLM1Tvm9e8reg9Cdj5LEcbQXPoSwGHwkNLx48rNFcMjmSAvNZrNR5cP1rSQc

[feat] Why Solana endpoints?

  • latency comparison sending USDC with other chains
  • fee comparison
  • tx confirmation latency
  • what integrations are possible
  • nft tx cost comparison

Chains to compare:

  • [ Eth, Polygon, Aptos, Sui, Avalance ]

Cease and Desist - Potential Patent Infringement

I am writing to you on behalf of Reflecto Technologies (the “Company”). It has come to our attention that the application of the "ChatGPT Plugin for Solana," may potentially infringe upon our pending patent application (Application No. 18/182,325), which pertains to interactive artificial intelligence system for blockchain transactions (terminals/devices, the message comprising a payment intent and variables executable by a blockchain)

Please respond to the email we sent or contact me directly.

Tg: vladimirdjukic
Tw: i_eat_software

Transaction Parsing

Addressed by #27

  • Transaction introspection

  • Anchor is done

  • mplx program

  • auth rules program

  • system program

  • compute budget

  • token, token 22

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.