Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push notifications #280

Open
lostystyg opened this issue May 2, 2022 · 7 comments · Fixed by #302 or #337
Open

Push notifications #280

lostystyg opened this issue May 2, 2022 · 7 comments · Fixed by #302 or #337
Assignees
Labels
feature New feature or request stale Is the issue not relevant?
Milestone

Comments

@lostystyg
Copy link
Collaborator

lostystyg commented May 2, 2022

RPC request with height as a parameter that represents concrete single block. Node parses block and group interested transactions in short form (#217) by user addresses.

  • Option 1
    Response contain all addresses from block, proxy filters interesting addresses itself.
    - Option 2
    RPC request also accepts a list of addresses for filtering on the node side
@lostystyg
Copy link
Collaborator Author

lostystyg commented May 30, 2022

Required order of selects for all notifications. Every field except 1,6 and 7 is optional

  • // Notifier data
    • 1 Address
    • 2 Lang
    • 3 Name
    • 4 Avatar
    • 5 Reputation
  • 6 Short form type
  • // Tx data
    • 7 Hash
    • 8 Type
    • 9 Address of tx creator
    • 10 Height
    • 11 BlockNum
    • 12 Time
    • 13 RootTxHash
    • 14 Post hash (e.x. for comments)
    • 15 Value
    • 16 Inputs
    • 17 Outputs
    • 18 Description
    • 19 Comment Parent Id
    • 20 Comment Answer Id
    • // Account data for tx creator
      • 21 Lang
      • 22 Name
      • 23 Avatar
      • 24 Reputation
  • 25 Multiple addresses str
  • // Related Conent
    • 26 Hash
    • 27 Type
    • 28 Address of tx creator
    • 29 Height
    • 30 BlockNum
    • 31 Time
    • 32 RootTxHash
    • 33 Post hash (e.x. for comments)
    • 34 Value
    • 35 Inputs
    • 36 Outputs
    • 37 Description
    • 38 Comment Parent Id
    • 39 Comment Answer Id
    • // Account data for tx creator
      • 40 Lang
      • 41 Name
      • 42 Avatar
      • 43 Reputation
    • 44 Multiple addresses str

Multiple addresses str - array of objects with address and account data:

[
  {
    "address" : "TG69Jioc81PiwMAJtRanfZqUmRY4TUG7nt",
    "account": {
      "lang" : "en",
      "name": "brangr0",
      "avatar": "imgur.com/123awd",
      "reputation": 101
    }
]

@lostystyg
Copy link
Collaborator Author

lostystyg commented Jul 6, 2022

TODO: outdated

Request description

"getnotifications" rpc request

Returns all notifications for all addresses from concrete block height

Params:

  • height # height to search for notifications
  • filters # an array of shortform types, corresponding to ones described in Short forms of accounts and content #217. If empty or not specified - search for everything.

Response is a map, where keys are addresses of accounts to be notified and values are vectors of Short Forms

Request example:

{
    "method": "getnotifications",
    "params" : [
        414152
    ]
}

Response example:

{
    "result": {
        "user_notifications": {
            "T9yywwbGexGmQUeALuP1RxU2VKyhV4eC7M": [
                {
                    "hash": "478fe8bfccda50279cf70050a5a785777aef2fb60f2f6d8b48615786d8f61085",
                    "txType": 204,
                    "height": 414152,
                    "blockNum": 1309,
                    "address": "TJAf3NwJ5LzdpXEHjBdempTqRdsaUZmzBG",
                    "account": {
                        "name": "TestName00591798033",
                        "avatar": "https://lumpics.ru/wp-content/uploads/2017/11/Programmyi-dlya-sozdaniya-avatarok.png",
                        "badge": "about",
                        "reputation": 0
                    },
                    "description": "{\"message\":\"Test\",\"url\":\"\",\"images\":[]}",
                    "type": "comment",
                    "relatedContent": {
                        "hash": "152f0b941974548741112fbf03c0acf7711fbb45a79542d64bcaecaefe8e708b",
                        "txType": 200,
                        "height": 413962,
                        "blockNum": 470,
                        "description": "Caption"
                    }
                },
                {
                    "hash": "82a63031e377d2068c84d9be9efa4885af12ccb56ce959d40af8b4439a917040",
                    "txType": 204,
                    "height": 414152,
                    "blockNum": 600,
                    "address": "TAt4exgfZpttYT5Z5BJjgMjRPMPR7ixrWs",
                    "account": {
                        "name": "Test0000100337226228",
                        "avatar": "https://lumpics.ru/wp-content/uploads/2017/11/Programmyi-dlya-sozdaniya-avatarok.png",
                        "badge": "about",
                        "reputation": 0
                    },
                    "description": "{\"message\":\"Test\",\"url\":\"\",\"images\":[]}",
                    "type": "comment",
                    "relatedContent": {
                        "hash": "152f0b941974548741112fbf03c0acf7711fbb45a79542d64bcaecaefe8e708b",
                        "txType": 200,
                        "height": 413962,
                        "blockNum": 470,
                        "description": "Caption"
                    }
                },
            ...
            ],
            "TA35ghGfDoZ9NXQqbtFJQUMaUY6gFjo2HP": [
                {
                    "hash": "151bef260de7ceb30d5965aa7adfec7ead7f70ebec3553a62ba8ae801d5f45aa",
                    "txType": 204,
                    "height": 414152,
                    "blockNum": 1648,
                    "address": "TCcn8RrRd5942c22aQeNpisqgR7qjrjEt2",
                    "account": {
                        "name": "TestName00033929485",
                        "avatar": "https://lumpics.ru/wp-content/uploads/2017/11/Programmyi-dlya-sozdaniya-avatarok.png",
                        "badge": "about",
                        "reputation": 0
                    },
                    "description": "{\"message\":\"Test\",\"url\":\"\",\"images\":[]}",
                    "type": "comment",
                    "relatedContent": {
                        "hash": "088174fd7dd46ecd36f5a106d478901778cfe7d5dd1af3c32f51232003efb8ef",
                        "txType": 200,
                        "height": 413962,
                        "blockNum": 854,
                        "description": "Caption"
                    }
                },
                {
                    "hash": "1926e9b480f2e35b6e8be0611cfb7495593e6f962673840a31795c6fa4bd6a97",
                    "txType": 204,
                    "height": 414152,
                    "blockNum": 1481,
                    "address": "TRF7vpvvbG8GQaBetx8XZd7ygsw3KziGfA",
                    "account": {
                        "name": "Test0000100921921461",
                        "avatar": "https://lumpics.ru/wp-content/uploads/2017/11/Programmyi-dlya-sozdaniya-avatarok.png",
                        "badge": "about",
                        "reputation": 0
                    },
                    "description": "{\"message\":\"Test\",\"url\":\"\",\"images\":[]}",
                    "type": "comment",
                    "relatedContent": {
                        "hash": "088174fd7dd46ecd36f5a106d478901778cfe7d5dd1af3c32f51232003efb8ef",
                        "txType": 200,
                        "height": 413962,
                        "blockNum": 854,
                        "description": "Caption"
                    }
                },
            ...
            ],
            ...
        },
        "pocketnetteam": [
            {
                "hash": "3a2c3b6c9b4d4dd43c0be035a32d04f831124a2a903d356b585219a9bfea017e",
                "txType": 200,
                "height": 677171,
                "blockNum": 2,
                "type": "pocketnetteam",
                "description": "Caption"
            },
            ...
        ]
    },
    "error": null,
    "id": null
}

@lostystyg
Copy link
Collaborator Author

lostystyg commented Jul 13, 2022

TODO: outdated

Concrete examples of format for all ShortForms types

Pocketnetteam Posts

{
    "hash": "3cef7bdef81f803c13ce58efe603609a43b16f19f0c57f3cbad52c4f84191b25",
    "txType": 202,
    "height": 677211,
    "blockNum": 2,
    "address": "TAqR1ncH95eq9XKSDRR18DtpXqktxh74UU",
    "account": {
        "name": "BASTYON_TEAM",
        "avatar": "https://github.com/pocketnetteam/pocketnet.gui/raw/master/img/logo_color/blue_pad_100.png",
        "badge": "",
        "reputation": 0
    },
    "type": "pocketnetteam"
}

Money

{
    "hash": "51904d1ac4c7570302c1203cd1b09da8aebebf95bad5c73d362ae7f02ecf3f84",
    "txType": 3,
    "height": 617736,
    "blockNum": 1,
    "address": "TUhp7mJFywjjenAKfU9gdpgNJ4vAPWxauU",
    "val": 123,
    "type": "money"
}

Answer

{
    "hash": "7b9d9d22190d0659577c62445b1a970e3c8408f5524525b1c6edbb9e7e2b0c52",
    "txType": 204,
    "height": 416415,
    "blockNum": 2,
    "address": "TG942ppcNEa8uhHLnm78M4nnEdGYetARtW",
    "account": {
        "name": "TestSack",
        "avatar": "https://i.imgur.com/Wh7oHZF.jpg",
        "badge": "",
        "reputation": 0
    },
    "description": "{\"message\":\"%40Redhead_Sorceress1%20%20%0Axzcvxv\",\"url\":\"\",\"images\":[]}",
    "commentParentId": "01bc825e350c34e4f492d4c0a65ff6feae267a3fa947d3b3fbe06ef682a17876",
    "commentAnswerId": "01bc825e350c34e4f492d4c0a65ff6feae267a3fa947d3b3fbe06ef682a17876",
    "type": "answer",
    "relatedContent": {
        "hash": "a17ea38a8896fc3ad01748caa26b52766f787e3d854ca5c06ea142a673bd5a7d",
        "txType": 200,
        "height": 416080,
        "blockNum": 3,
        "address": "TG942ppcNEa8uhHLnm78M4nnEdGYetARtW",
        "account": {
            "name": "TestSack",
            "avatar": "https://i.imgur.com/Wh7oHZF.jpg",
            "badge": "",
            "reputation": 0
        }
    }
}

Private content

{
    "hash": "b98a9e6f141145b1113c2c7b54b3b19fdaa807481a5450995b3986e84d6a2253",
    "txType": 202,
    "height": 729638,
    "blockNum": 2,
    "address": "TSisNge5kisi7cwGRwmUBuZQWZFD8cRoG8",
    "account": {
        "name": "Tester101",
        "avatar": "https://pocketnet.app:8092/i/zGuMmqggqbppqFOnZgosxy.jfif",
        "badge": "?",
        "reputation": 40
    },
    "type": "privatecontent"
}

Boost

{
    "hash": "0e9b186ff44460be21d387af30144d5fbeed797423dd3ea7da6b425d58c04118",
    "txType": 208,
    "height": 967114,
    "blockNum": 2,
    "address": "TQPBvaNUyEWoK9AfY7mUfx3BXZWE2fRXQd",
    "account": {
        "name": "Dev01",
        "avatar": "https://i.imgur.com/R7eWJPn.jpg",
        "badge": "?",
        "reputation": 20
    },
    "val": 50000000,
    "type": "boost",
    "relatedContent": {
        "hash": "08b4ae680a7d7a43dbd4642410a24ae61bbe5a7f633764f575615207f12de9d7",
        "txType": 200,
        "height": 964949,
        "blockNum": 2
    }
}

@lostystyg
Copy link
Collaborator Author

Work on this issue will continue in #337 and will be pulled to #302

@lostystyg lostystyg moved this to 👀 In review in Team Management Aug 11, 2022
@andyoknen andyoknen linked a pull request Aug 11, 2022 that will close this issue
@andyoknen andyoknen moved this from 👀 In review to 🏗 In progress in Team Management Aug 11, 2022
@andyoknen andyoknen linked a pull request Aug 15, 2022 that will close this issue
@lostystyg
Copy link
Collaborator Author

Some notes for the future improvements.
Divide money to default money transfers and Lottery/Coinstake incomings:

  • Lottery:
    • Add a new optional field in shortfrom that will contain vector of outputs that will be used to get money that each user in tx with multiple outputs receives
    • select ScriptPubKey from zero's output to get info about type of incoming money (attach it to whole tx data probably): select ScriptPubKey from TxOutputs where TxHash='...' and Number=0
  • Coinstake
    • Coinstake winner should also receive a notification so we need to calculate amount of money (outputs - input)

@lostystyg
Copy link
Collaborator Author

The info in the issue is pretty outdated... Need to actualize all descriptions before closing

@andyoknen andyoknen added feature New feature or request testing labels Dec 13, 2022
@andyoknen andyoknen added this to the v0.21.0 milestone Dec 19, 2022
@andyoknen andyoknen removed the tests label Nov 12, 2024
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale Is the issue not relevant? label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request stale Is the issue not relevant?
Projects
Status: 🏗 In progress
2 participants