Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • Sign in / Register
Minds Frontend
Minds Frontend
  • Project overview
  • Repository
  • Issues 407
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 61
  • CI / CD
  • Security & Compliance
  • Packages
  • Wiki
  • Snippets
  • Members
  • Collapse sidebar
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Minds
  • Minds FrontendMinds Frontend
  • Issues
  • #2281

Closed
Open
Opened 2 weeks ago by Olivia Madrid@omadrid
Report abuse New issue

Implement wallet service

Responses

1. Token transactions table

(USD transactions will likely be similar in structure but still need final UX mockup to be sure)

It's fine to calculate running total on client side. If that's how we're going to do it, then tx diffs should have 18 decimals.

Response structure I want (WIP!!!)

token_transactions: {
    filters: [
      {
        id: 'transaction_types',
        label: 'Transaction Types',
        options: [
          {
            id: 'all',
            label: 'All',
            selected: true,
          },
          {
            id: 'offchain_wire',
            label: 'Off-Chain Wire',
            selected: false,
          },
          {
            id: 'onchain_wire',
            label: 'On-Chain Wire',
            selected: false,
          },
          {
            id: 'rewards',
            label: 'Rewards',
            selected: false,
          },
          {
            id: 'purchases',
            label: 'Purchases',
            selected: false,
          },
          {
            id: 'boost',
            label: 'Boost',
            selected: false,
          },
          {
            id: 'onchain_transfer',
            label: 'On-Chain Transfer',
            selected: false,
          },
        ],
      },
    ],
// Never mind I can just get pending elsewhere    
// pending: {
      // total_points: 7,
      // contributions: [
        // { id: 'checkins', label: 'Check-ins', occurrences: 1, points: 2 },
        // { id: 'comments', label: 'Comments', occurrences: 2, points: 4 },
        // { id: 'votes', label: 'Votes', occurrences: 1, points: 1 },
      // ],
    // },
    days: [
      {
        ts_ms: 1567296000000, // today's date
        transactions: [
          {
            ts_ms: 1567296000090, // time of tx
            type_id: 'boosts',
            type_label: 'Boosts',
            diff: -5.000000000000000000, // if we calc running total on client side then the diffs should not be rounded to 3 decimals
            running_total: 25.0,
          },
          {
            ts_ms: 1567296000080,
            type_id: 'rewards',
            type_label: 'Rewards',
            diff: 0.400000000000000000,
            running_total: 30.0,
            details: {
              total_points: 10,
              contributions: [
                {
                  id: 'checkins',
                  label: 'Check-ins',
                  occurrences: 4,
                  points: 8,
                },
                { id: 'comments', label: 'Comments', occurrences: 1, points: 2 },
              ],
            },
          },
          {
            ts_ms: 1567296000070,
            type_id: 'wires',
            type_label: 'Wires', // make sure we have the label field bc this eventually needs to change to 'Pay'
            diff: -1.5,
            running_total: 29.6,
            subtype_id: 'offchain_wires_outbound',
            entity: {
              user_guid: 123,
              username: 'my_wire_recipient',
              //...etc...
            },
          },
          {
            ts_ms: 1567296000060,
            type_id: 'wires',
            type_label: 'Wires',
            diff: 2.0,
            running_total: 30.1,
            subtype_id: 'offchain_wires_inbound',
            entity: {
              user_guid: 456,
              username: 'whoever_wired_me',
              //...etc...
            },
          },
        ],
      },
      {
        ts_ms: 1567295000000, // yesterday's date
        transactions: [
          {
            ts_ms: 1567295000090,
            type_id: 'purchases',
            type_label: 'Purchases',
            diff: -10.0,
            running_total: 28.1,
            subtype_id: 'minds_pro_membership',
          },
          {
            ts_ms: 1567295000080,
            type_id: 'rewards',
            type_label: 'Rewards',
            diff: 0.9,
            running_total: 38.1,
            details: {
              total_points: 50,
              contributions: [
                {
                  id: 'jury_duty',
                  label: 'Jury Duty',
                  occurrences: 2,
                  points: 50,
                },
              ],
            },
          },
        ],
      },
      // days go on...
    ],
    load_next: '',
    status: 'success',
  }

Transaction types

(need to see final UX mockup to be sure about this list)

  • Minds rewards
  • Boosts
  • Wires
  • Purchases
  • On-chain transfers
  • Subscriptions (?)

Minds rewards

  • Found in <m-wallet-token--contributions>
  • Api call looks like:
      let response: any = await this.client.get(
        `api/v2/blockchain/contributions`,
        {
          from: Math.floor(+startDate / 1000),
          to: Math.floor(+endDate / 1000),
        }
      );
  • Example response structure:
contributions: {
  0:  {
    amount:  2,
    metrics:  {
      checkins:  {
        amount:  "1",
        metric:  "checkins",
        score:  2,
        timestamp:  1573776000000,
        user:  "930229554033729554"
      },
      votes:  {
        amount:  "1",
        metric:  "votes",
        score:  1,
        timestamp:  1573776000000,
        user:  "930229554033729554"
      }
    },
    score:  3,
    share:  0.0025391236637861718,
    timestamp:  1573776000000
  },
  1: {
     ... etc...
  }, 
  2: {
     ...etc...
  },
  load-next:  "",
  status:  "success"
}

2. Tokens overview chart

Let's say the user has chosen the 30 day report:

selected_timespan: {
  id: '30d',
  label: '30D',
  interval: 'day',
  from_ts_ms: 1567296000000,
  from_ts_iso: '2019-09-01T00:00:00+00:00',
}

To draw the graph we need these buckets:

buckets: [
{
  key: 1567296000000,
  date: '2019-09-01T00:00:00+00:00',
  value: 11.123,
},
{
  key: 1567382400000,
  date: '2019-09-02T00:00:00+00:00',
  value: 12.456,
},
{
  key: 1567468800000,
  date: '2019-09-03T00:00:00+00:00',
  value: 13.789,
},
etc... ]
  • key: GMT unix timestamp in ms
  • date: GMT date in ISO8601 format
  • value: token value rounded to 3 decimal places

The selected interval shapes the buckets like so:

  • The key of the first bucket should equal selected_timespan.from_ts_ms
  • Interval between each bucket thereafter is determined by timespan.interval (currently we're only using only day & month but this might change)
  • Must consider how best to handle the 'Max' timespan (a.k.a. beginning of time - present)
Edited 4 days ago by Olivia Madrid

Related issues
0

Related merge requests
1
  • WIP: Wallet upgrade
    !675
    Wallet Upgrade
  • Discussion 4
  • Designs 0
  • Olivia Madrid @omadrid added Sprint::11/20 - Silly Sheep scoped label 2 weeks ago

    added scoped label

  • Olivia Madrid @omadrid assigned to @omadrid 2 weeks ago

    assigned to @omadrid

  • Olivia Madrid @omadrid changed milestone to %Wallet Upgrade 2 weeks ago

    changed milestone to %Wallet Upgrade

  • Olivia Madrid @omadrid added Platform::Browser Product::Wallet Squad::Blue Type::Feature scoped labels 2 weeks ago

    added scoped labels

  • Olivia Madrid @omadrid changed time estimate to 1d 2 weeks ago

    changed time estimate to 1d

  • Olivia Madrid @omadrid changed time estimate to 1d 4h 1 week ago

    changed time estimate to 1d 4h

  • Olivia Madrid @omadrid added Status::InProgress scoped label 1 week ago

    added scoped label

  • Olivia Madrid @omadrid changed the description 1 week ago

    changed the description

  • Olivia Madrid @omadrid changed the description 1 week ago

    changed the description

  • Olivia Madrid @omadrid changed the description 1 week ago

    changed the description

  • Olivia Madrid @omadrid added Status::Review scoped label and automatically removed Status::InProgress label 6 days ago

    added scoped label and automatically removed label

  • Olivia Madrid @omadrid changed the description 6 days ago

    changed the description

  • Brian Hatchet :speech_balloon: @brianhatchet assigned to @markeharding 5 days ago

    assigned to @markeharding

  • Brian Hatchet
    Brian Hatchet :speech_balloon: @brianhatchet · 5 days ago
    Developer

    @markeharding @omadrid needs your help finalizing the data model

  • Olivia Madrid @omadrid mentioned in merge request !675 (closed) 5 days ago

    mentioned in merge request !675 (closed)

  • Olivia Madrid @omadrid changed the description 4 days ago

    changed the description

  • Olivia Madrid @omadrid changed the description 4 days ago

    changed the description

  • Mark Harding
    Mark Harding @markeharding · 20 minutes ago
    Owner
    {
    user_guid: 100000000000000060
    amount: "-1000000000000000000"
    contract: "offchain:boost"
    failed: false
    guid: ""
    timestamp: 1576003323
    tx: "oc:1051207184760340480"
    user: {guid: "100000000000000063", type: "user", subtype: false, time_created: "1348141290",…}
    user_guid: 100000000000000060
    wallet_address: "offchain"
    }
  • Mark Harding
    Mark Harding @markeharding · 17 minutes ago
    Owner

    wire

    {
    amount: "-1000000000000000000"
    contract: "offchain:wire"
    failed: false
    guid: ""
    receiver: {guid: "441939549992521728", type: "user", subtype: false, time_created: "1430742599",…}
    sender: {guid: "100000000000000063", type: "user", subtype: false, time_created: "1348141290",…}
    timestamp: 1575227037
    tx: "oc:1047951205955825664"
    user: {guid: "100000000000000063", type: "user", subtype: false, time_created: "1348141290",…}
    user_guid: 100000000000000060
    wallet_address: "offchain"
    }
  • Mark Harding
    Mark Harding @markeharding · 13 minutes ago
    Owner
    {
    amount: "-1000000000000000000"
    contract: "offchain:withdraw"
    failed: false
    guid: ""
    timestamp: 1574331126
    tx: "oc:1044193481901219841"
    user: {guid: "100000000000000063", type: "user", subtype: false, time_created: "1348141290",…}
    user_guid: 100000000000000060
    wallet_address: "offchain"
    }
Please register or sign in to reply
2 Assignees
Mark Harding's avatar
Olivia Madrid's avatar
none
Epic
None
Wallet Upgrade
Milestone
Wallet Upgrade
Time tracking
Estimated: 1d 4h
None
Due date
None
6
Labels
Platform::Browser Product::Wallet Sprint::11/20 - Silly Sheep Squad::Blue Status::Review Type::Feature
None
Weight
None
Confidentiality
Not confidential
Lock issue
Unlocked
3
3 participants
user avatar
Mark Harding
user avatar
Olivia Madrid
user avatar
Brian Hatchet
Reference: minds/front#2281