Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Project registration endpoint #81

Closed
4 of 5 tasks
xla opened this issue Jan 14, 2020 · 11 comments
Closed
4 of 5 tasks

Project registration endpoint #81

xla opened this issue Jan 14, 2020 · 11 comments
Assignees

Comments

@xla
Copy link
Contributor

xla commented Jan 14, 2020

We want to support registration on the Registry in the context of existing projects. For that we need a new mutation.

Design

The schema addition proposal:

scalar Rad

type TransactionCosts {
  fees: Rad!
  total: Rad!
}

union TransactionState = Accepted | Applied | Rejected

type Accepted {
  # Address or other identity of the node that accepted the transaction.
  node: String!
}

type Applied {
  # Number of blocks that this transaction has been applied to.
  blocks: Int!
}

type Rejected {
  # The issue that prevented this transaction to be accepted/applied.
  reason: String!
}

union Message = ProjectRegistration

type ProjectRegistration {
  name: String!
  domain: String!
}

type Transaction {
  id: ID!
  messages: [Message!]!
  costs: TransactionCosts!
  state: TransactionState!
  timestamp: Datetime!
}

type Mutation {
  registerProject(domain: String!, name: String!): Transaction!
}

input TranscationCostInput {
  messages: [Message!]!
}

type Query {
  transactionCosts(draft: TranscationCostInput): TransactionCosts!
}

Implementation roadmap

@geigerzaehler
Copy link
Contributor

type ProjectRegistration {
  name: String!
  domain: String!
}

Project registration also requires an existing checkpoint.

type Mutation {
  registerProject(domain: String!, name: String!): Transaction!
}

Does registerProject submit the transaction? What is the purpose of the Transaction.state field?

@xla
Copy link
Contributor Author

xla commented Jan 15, 2020

Project registration also requires an existing checkpoint.

We going to surface that once we have that concept in the UI, until then we construct one silently in the proxy.

Does registerProject submit the transaction? What is the purpose of the Transaction.state field?

Yes it submits the transaction. The state is to surface the lifecycle of transactions in the UI (notifications, progress, etc.).

@geigerzaehler
Copy link
Contributor

Yes it submits the transaction. The state is to surface the lifecycle of transactions in the UI (notifications, progress, etc.).

If registerProject returns once the transaction is submitted then the Applied transaction state can never occur. It will always be Accepted or Rejected. How is the UI notified of changes?

@xla
Copy link
Contributor Author

xla commented Jan 15, 2020

@geigerzaehler Maybe I mixed something up, but wasn't it communicated that the when the sign_and_submit call returns it is accepted and when the future it carries returns it is applied?

@geigerzaehler
Copy link
Contributor

@geigerzaehler Maybe I mixed something up, but wasn't it communicated that the when the sign_and_submit call returns it is accepted and when the future it carries returns it is applied?

Yes, that is correct. I’m just wondering how it would work in the GraphQL communication between the UI and the proxy

@xla
Copy link
Contributor Author

xla commented Jan 15, 2020

We gonna see, for now it's more important to account for possible states. A general route we can take is pushing updates with the help of subscriptions.

@rudolfs
Copy link
Member

rudolfs commented Jan 16, 2020

Additionally would be great if we could get a list of all transactions to show them in the wallet section:

type Query {
  transactions(walletId: ID!): [Transaction]!
}

The transaction status subscription could look something like this:

type Subscription {
  transactionStateChanged(transactionId: ID!): Transaction
}

Potentially we could also use a subscription for new transactions to show a badge on the wallet icon:

type Subscription {
  newTransaction(walletId: ID!): Transaction
}

@xla
Copy link
Contributor Author

xla commented Jan 17, 2020

@rudolfs These look pretty good, might breaking it out into its own issue? Don't think these are crucial for the project registration success.

@rudolfs
Copy link
Member

rudolfs commented Jan 17, 2020

Could we have a query to check if the name is already taken? Or would that also be beyond the scope here?

@xla
Copy link
Contributor Author

xla commented Jan 17, 2020

That's very reasonable, it should be equivalent to a getProject(domain, name).

@xla xla self-assigned this Jan 21, 2020
xla added a commit that referenced this issue Jan 22, 2020
Add mutation for project registration to enable integration in the UI.
First part of #81. Follow up in #99.

***

* Set up skeleton for project registration mutation
* Bump registry client dependency
* Remove dead code exceptions
* Fake transaction id
* Draft transaction state
* Add error handling for time conversion
* Add documentation
* Make initialisors const where possible
* Handle int conversion properly
* Fix tests
* Bump registry client dependency
* Apply suggestions from code review
Co-Authored-By: Nuno Alexandre <nunombalexandre@gmail.com>

* Replace deprecated Error display
* Use the exposed hashes for the transaction and block
* Incorporate feedback
* Leave TODOs for #99
* Update schema to reflect new mutation
* Update app/schema.graphql
Co-Authored-By: Thomas Scholtes <thomas@monadic.xyz>
Co-authored-by: Nuno Alexandre <alexandre.nunomiguel@gmail.com>
Co-authored-by: Thomas Scholtes <thomas-scholtes@gmx.de>
@xla
Copy link
Contributor Author

xla commented Feb 5, 2020

The main share of this issue is completed, the last point is being addressed in #98.

@xla xla closed this as completed Feb 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants