Git Product home page Git Product logo

flow-interaction-template-service's Introduction

๐ŸŒŠ Flow Interaction Template Service

This Flow Interaction Template Service provides a way to propose, store and host InteractionTemplate data structures.

๐Ÿ“– Overview

This repository is a place for developers to propose their Interaction Templates to be audited, and where Interaction Templates can be stored and hosted by the provided API.

๐Ÿ’ก Propose Interaction Template

If you have created an Interaction Template, you can create a PR to palce your Interaction Template into the ./proposals folder of this repository.

Auditors in the Flow ecosystem can check this folder to see new Interaction Templates available for audit.

๐Ÿ’พ Store Interaction Templates

If you have created an Interaction Template, you can create a PR to place your Interaction Template in the ./templates folder of this repository.

๐Ÿ“ค Host Interaction Templates

The ./api folder of this repository contains an API which can be run, and makes available the Interaction Templates stored in the ./templates folder in a queryable way.

With the API you can query Interaction Template by their ID:

GET /v1/templates/${template_id}
  => InteractionTemplate

You can also query for Interaction Template by their cadence body:

POST /v1/templates/search
  body (JSON): {
    cadence_base64: "...",
    network: "..." (mainnet | testnet)
  }
  => InteractionTemplate

You can query for known Auditor information for a given network:

GET /v1/auditors?network=(mainnet | testnet)
  => [FlowInteractionTemplateAuditor]

  // Flow Interaction Template Auditor
  // {
  //   f_type: "FlowInteractionTemplateAuditor"
  //   f_version: "1.0.0"
  //   address: string
  //   name: string
  //   website_url?: string
  //   twitter_url?: string
  // }

Interaction Template can be hosted under a static identifer (name), allowing the underlying Interaction Template to change while the way to query for it remained constant:

GET /v1/templates?name=transfer-flow
  => InteractionTemplate

Flow's Interaction Template service is available at:

https://flix.flow.com

eg: GET https://flix.flow.com/v1/templates?name=transfer-flow
eg: GET https://flix.flow.com/v1/templates/${template_id}
eg: POST https://flix.flow.com/v1/templates/search
    body (JSON): {
      cadence_base64: "...",
      network: "..." (mainnet | testnet)
    }

๐ŸŒŽ๐ŸŒ๐ŸŒ Open to Anyone

This project is open to be run by anyone. By forking this repository, and running the provided API service, anyone can run an instance of FLIX and make available Interaction Template for querying.

If you don't wish to operate your own instance of FLIX, and wish to instead use the one provided by Flow, you can always do so! To add Interaction Templates to Flow's instance of FLIX, follow the Propose Templates workflow above.

๐Ÿ›  Notable backlog issues:

  • Sync Interaction Template between FLIX instances (#9)

flow-interaction-template-service's People

Contributors

chasefleming avatar jacob-tucker avatar jeffreydoyle avatar justinbarry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flow-interaction-template-service's Issues

[FLIX Web UI] Create Initial Web App

Issue to be solved

The implementation of the FLIX Web UI should take form as a web app

Suggest A Solution

Create a Web App which will be used to host the FLIX Web UI

[FLIX Web UI] View Interaction Template audit status.

Issue to be solved

On the FLIX Web UI, a user should be able to view the audit status of an Interaction Template from all known ecosystem auditors.

Suggest A Solution

The Web UI should have a dedicated page for each Interaction Template where:

  • The audit status for all known ecosystem auditors of that Interaction Template is displayed.

[FLIX Web UI] Copy Interaction Template URL

Issue to be solved

On the FLIX Web UI, a user should be able to copy the FLIX URL for an Interaction Template.

Suggest A Solution

The Web UI should have a dedicated page for each Interaction Template where:

  • A user can easily copy the FLIX URL for that Interaction Template

[FEATURE] Easier audits retrieval through FLIX API

Issue to be solved

FLIX API currently only supports retrieving auditors, but not their audits themselves. To do that, you'd need to set up FCL (or any other client lib) and query the blockchain (retrieve the FlowInteractionTemplateAudit.AuditManager resource in the auditor's storage) to obtain that info.

I think exposing that info through the FLIX API could make it easier for others to consume it. But advanced users could always retrieve it from the blockchain if they want to (e.g. don't trust the FLIX API instance).

Suggest A Solution

Either one (or both) of these options could work:

  • /auditors/:address/audits - retrieves a list of audits by auditors
  • /templates/:template_id/audits - retrieves a list of audits by specific template

What are you currently working on that this is blocking?

We are trying to display some basic FLIX audit info in Flowser, but I figured it might be beneficial to implement audit retrieval logic on the FLIX API side instead of in Flowser internally to benefit other users as well.

Add Interaction Templates for NFT Catalog projects

Issue to be solved

The NFT Catalog supports auto-generating transactions for supported projects.

Suggest A Solution

We should templetize these transactions and add them to FLIX to increase the range of supported transactions and projects.

[FEATURE] Add more standard transactions/scripts to FLIX

Issue to be solved

It seems like there are lots of "standard" transactions and scripts from well-known flow repos that aren't included in FLIX yet.

This includes files from these repos:

Suggest A Solution

Produce FLIX json files for Cadence interactions in the repos mentioned above.

I believe those won't need much auditing work either, since they are already verified by the flow core team who wrote them in the first place.

What are you currently working on that this is blocking?

We integrated FLIX to Flowser (supporting FLIX template discovery and display of certain metadata), so I'm trying to improve and expand FLIX template collection to benefit future Flowser and FLIX users.

Sync Interaction Template between FLIX instances

Overview

Many parties may choose to operate an instance of FLIX. A way for each instance to sync Interaction Templates that the others have would be idea, as then the ecosystem could each have the same Interaction Templates as the other.

Outcomes

  • A FLIX instance can "sync" Interaction Templates available from other known FLIX instances.

Match cadence to template using cadence AST

Match cadence to template using cadence AST

Cadence shouldn't have to be exactly match the cadence in a template for the template to be returned. By comparing ASTs, matching should become more reliable.

Problems with running server locally

Current Behavior

I've noticed a few issues when I tried to setup and run this project.

  1. Invalid default MIGRATION_PATH setting

When you run the start command (which sets the current working directory to ./api), I get this error:

[Error: ENOENT: no such file or directory, scandir '/Users/bartkozorog/Projects/flow-interaction-template-service/dist/migrations'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '/Users/bartkozorog/Projects/flow-interaction-template-service/dist/migrations'
}

This seems to be caused by this setting: MIGRATION_PATH=../dist/migrations. This should probably be MIGRATION_PATH=./dist/migrations (without .. part) instead.

  1. Invalid default TEMPLATE_DIR setting

The default glob pattern used (../templates) is also returning directories. These directory paths are then passed to fs.readFile, which doesn't seem to accept directories, given that it throws:

[Error: EISDIR: illegal operation on a directory, read] {
  errno: -21,
  code: 'EISDIR',
  syscall: 'read'
}

I believe the default setting here should be TEMPLATE_DIR=../templates/**/*.json, which returns all JSON files in subdirectories.

Expected Behavior

Explained above.

Steps To Reproduce

Do a clean project setup (e.g. by cloning the repo and running npm i) and try running it.

Environment

- Node: v16.7.0
- npm: 7.20.3

What are you currently working on that this is blocking?

I'm playing around with this project a bit, to see if we can extend it to support use cases mentioned here: #18 (comment)

[FEATURE] Deduplicate the generic StorefrontRemoveItem template

Issue to be solved

Transactions for removing a listing from the storefront are generic, so they should work for any resource type.

But since the templates under templates/NFTCatalog were generated using the NFT catalog tool, each project sub-directory contains its own {ProjectName}-StorefrontRemoveItem.mainnet.template.json template file.

So if someone were to search for a "remove item" template, all these templates that essentially do the same thing would show up. Their labels would suggest that each template is built for a specific NFT collection, but that's not the case as they are generic. This makes this confusing and could present an unnecessary clutter in a template discovery tool.

I realized this when I was integrating template discovery support in Flowser:
Screenshot 2023-11-12 at 11 32 23

Suggest A Solution

Deduplicate these templates, by creating a generic StorefrontRemoveItem contract and remove all the other project-specific ones.

This shouldn't be a breaking change, since these templates only differ in comments which are not present in the AST that's used for hash calculation in the scope of reverse lookup (the /templates/search?cadence_base64= endpoint).

What are you currently working on that this is blocking?

No response

Improve Discoverability of Interaction Templates hosted on FLIX

Issue to be solved

In order to promote composability of applications on Flow, we need a good way for developers to discover available Interaction Templates hosted on FLIX.

Suggest A Solution

Create a solution where developers can either programatically, or using a UI, discover existing Interaction Templates they can use that are already hosted on FLIX.

What are you currently working on that this is blocking?

No response

[FLIX Web UI] Download Interaction Template

Issue to be solved

On the FLIX Web UI, a user should be able to download an Interaction Template.

Suggest A Solution

The Web UI should have a dedicated page for each Interaction Template where:

  • A user can easily download that Interaction Template as JSON.

[FLIX Web UI] Create FLIX Web UI

Issue to be solved

In order to Improve the Discoverability of Interaction Templates hosted on FLIX (#18) we should create a Web UI to enable developers to easily view and find Interaction Templates.

Suggest A Solution

User stories:

  • A user can navigate to the Web UI and view Interaction Templates that are hosted on FLIX.
    • The Interaction Templates should be organized by Project they correspond to
    • There should be specific pages for each project where that project's Interaction Templates are displayed
  • A user can easily see the audit status by known ecosystem auditors of the Interaction Templates hosted on FLIX.
  • A user can easily copy the URL to the Interaction Template
  • A user can easily download an Interaction Template

[FLIX Web UI] View Interaction Templates hosted on FLIX

Issue to be solved

On the FLIX Web UI, a user should be able to view all Interaction Templates hosted on FLIX.

User Story:

  • A user can navigate to the Web UI and view Interaction Templates that are hosted on FLIX.
    • The Interaction Templates should be organized by Project they correspond to
    • There should be specific pages for each project where that project's Interaction Templates are displayed

Suggest A Solution

The Web UI must query FLIX for all Interaction Templates hosted by it.

The Web UI should display the available Interaction Templates organized by their corresponding project.

NFT Catalogue integration

Support FLIX on the NFT Catalogue.

Developers should be able to optionally generate FLIX templates for their marketplace transactions as they do for DUC templates.

They can easily submit these templates for audits/review to get HRM for their dapp in a relatively simple and short time frame.

Note we cannot approve these on our FLIX service, we need someone else to approve them.

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.