#32859 — feat(share): serve closed positions as their own share card kind

commit ffe5b7072a · service share · port 3000 · base main · run 2026-08-20T21:05:00Z · node v26.7.0
Run locally with yarn dev against dockerised CockroachDB (cockroachdb-blockchain), schema migrated with yarn kysely migrate:latest.
Total12
Pass12
Fail0
Skipped0

Cases

CaseRequestStatus exp/actGETdisplay.dateLabeldisplay.statspayload.closedAtVerdictLatency
Closed spot positionPOST /share 201 / 201 200 Closed on Aug 3, 2026 Entry, Exit 2026-08-03T09:15:00.000Z PASS383.5 ms
Open spot position (existing_position)POST /share 201 / 201 200 Aug 20, 2026 Entry, Current absent PASS118.6 ms
Closed spot priced in market capsPOST /share 201 / 201 200 Closed on Aug 3, 2026 Entry MC, Exit MC 2026-08-03T09:15:00.000Z PASS125.0 ms
Closed perp positionPOST /share 201 / 201 200 Closed on Aug 3, 2026 Entry, Exit 2026-08-03T09:15:00.000Z PASS171.7 ms
Closed predictionPOST /share 201 / 201 200 Closed on Aug 3, 2026 absent 2026-08-03T09:15:00.000Z PASS5.5 ms
Open prediction (existing_position)POST /share 201 / 201 200 Aug 20, 2026 Payout if right, Chance absent PASS5.5 ms
closedAt on new_position (rejected field)POST /share 201 / 201 200 Aug 20, 2026 Entry, Current absent PASS117.6 ms
closedAt on existing_position (rejected field)POST /share 201 / 201 200 Aug 20, 2026 Entry, Current absent PASS118.9 ms
closed_position missing closedAtPOST /share 400 / 400 PASS1.6 ms
closed_position missing performancePOST /share 400 / 400 PASS2.1 ms
closedAt not a timestampPOST /share 400 / 400 PASS1.3 ms
closedAt on a day the share is notPOST /share 201 / 201 200 Closed on Dec 31, 2024 Entry, Exit 2024-12-31T23:30:00.000Z PASS185.5 ms

Every display.* and payload.* column is read back from GET /share/<shareId> — the persisted record — not echoed from the request. means the case created no record.

Per-case detail

Closed spot position — PASS

Assertion: POST returns 201; GET 200 and display fields as tabled.

Request

POST http://localhost:3000/share
content-type: application/json
x-forwarded-user: 550e8400-…0000

{
  "payload": {
    "kind": "closed_position",
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "name": "Solana",
    "symbol": "SOL",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlUsd": "429.00",
      "pnlPct": "22.88"
    }
  }
}

Response — 201

{
  "shareId": "qn1dgs6O8V",
  "v": 2,
  "payload": {
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "name": "Solana",
    "symbol": "SOL",
    "logoUri": "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "kind": "closed_position",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlUsd": "429.00",
      "pnlPct": "22.88"
    }
  },
  "deepLinkPath": "portfolio",
  "createdAt": "2026-08-20T21:55:07.531Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "icon": {
      "url": "https://api.phantom.app/image-proxy/?image=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fsolana-labs%2Ftoken-list%40main%2Fassets%2Fmainnet%2FSo11111111111111111111111111111111111111112%2Flogo.png",
      "caip19": "solana:101/nativeToken:501",
      "fallbackText": "S"
    },
    "headline": {
      "value": "+$429.00",
      "amountUsd": "429.00",
      "changePct": "+22.88%",
      "tone": "positive"
    },
    "byline": {
      "value": "$2,304.00"
    },
    "stats": [
      {
        "label": "Entry",
        "value": "$150.00",
        "amountUsd": "150.00"
      },
      {
        "label": "Exit",
        "value": "$184.32",
        "amountUsd": "184.32"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "SOL",
      "subtitle": "Solana"
    },
    "titleVerified": true,
    "date": "2026-08-20T21:55:07.531Z",
    "dateLabel": "Closed on Aug 3, 2026"
  },
  "shareUrl": "https://phantom.com/share/qn1dgs6O8V"
}

GET /share/{id} — 200

{
  "shareId": "qn1dgs6O8V",
  "v": 2,
  "payload": {
    "amount": "12.5",
    "caip19": "solana:101/nativeToken:501",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "entryPriceUsd": "150.00",
    "kind": "closed_position",
    "logoUri": "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",
    "market": "spot",
    "name": "Solana",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlPct": "22.88",
      "pnlUsd": "429.00"
    },
    "symbol": "SOL"
  },
  "deepLinkPath": "portfolio",
  "createdAt": "2026-08-20T21:55:07.531Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "icon": {
      "url": "https://api.phantom.app/image-proxy/?image=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fsolana-labs%2Ftoken-list%40main%2Fassets%2Fmainnet%2FSo11111111111111111111111111111111111111112%2Flogo.png",
      "caip19": "solana:101/nativeToken:501",
      "fallbackText": "S"
    },
    "headline": {
      "value": "+$429.00",
      "amountUsd": "429.00",
      "changePct": "+22.88%",
      "tone": "positive"
    },
    "byline": {
      "value": "$2,304.00"
    },
    "stats": [
      {
        "label": "Entry",
        "value": "$150.00",
        "amountUsd": "150.00"
      },
      {
        "label": "Exit",
        "value": "$184.32",
        "amountUsd": "184.32"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "SOL",
      "subtitle": "Solana"
    },
    "titleVerified": true,
    "date": "2026-08-20T21:55:07.531Z",
    "dateLabel": "Closed on Aug 3, 2026"
  }
}
Open spot position (existing_position) — PASS

Assertion: POST returns 201; GET 200 and display fields as tabled.

Request

POST http://localhost:3000/share
content-type: application/json
x-forwarded-user: 550e8400-…0000

{
  "payload": {
    "kind": "existing_position",
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "name": "Solana",
    "symbol": "SOL",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlUsd": "429.00",
      "pnlPct": "22.88"
    }
  }
}

Response — 201

{
  "shareId": "ko1sp2mF0k",
  "v": 2,
  "payload": {
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "name": "Solana",
    "symbol": "SOL",
    "logoUri": "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "kind": "existing_position",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlUsd": "429.00",
      "pnlPct": "22.88"
    }
  },
  "deepLinkPath": "portfolio",
  "createdAt": "2026-08-20T21:55:07.869Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "icon": {
      "url": "https://api.phantom.app/image-proxy/?image=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fsolana-labs%2Ftoken-list%40main%2Fassets%2Fmainnet%2FSo11111111111111111111111111111111111111112%2Flogo.png",
      "caip19": "solana:101/nativeToken:501",
      "fallbackText": "S"
    },
    "headline": {
      "value": "+$429.00",
      "amountUsd": "429.00",
      "changePct": "+22.88%",
      "tone": "positive"
    },
    "byline": {
      "value": "$2,304.00"
    },
    "stats": [
      {
        "label": "Entry",
        "value": "$150.00",
        "amountUsd": "150.00"
      },
      {
        "label": "Current",
        "value": "$184.32",
        "amountUsd": "184.32"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "SOL",
      "subtitle": "Solana"
    },
    "titleVerified": true,
    "date": "2026-08-20T21:55:07.869Z",
    "dateLabel": "Aug 20, 2026"
  },
  "shareUrl": "https://phantom.com/share/ko1sp2mF0k"
}

GET /share/{id} — 200

{
  "shareId": "ko1sp2mF0k",
  "v": 2,
  "payload": {
    "amount": "12.5",
    "caip19": "solana:101/nativeToken:501",
    "entryPriceUsd": "150.00",
    "kind": "existing_position",
    "logoUri": "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",
    "market": "spot",
    "name": "Solana",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlPct": "22.88",
      "pnlUsd": "429.00"
    },
    "symbol": "SOL"
  },
  "deepLinkPath": "portfolio",
  "createdAt": "2026-08-20T21:55:07.869Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "icon": {
      "url": "https://api.phantom.app/image-proxy/?image=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fsolana-labs%2Ftoken-list%40main%2Fassets%2Fmainnet%2FSo11111111111111111111111111111111111111112%2Flogo.png",
      "caip19": "solana:101/nativeToken:501",
      "fallbackText": "S"
    },
    "headline": {
      "value": "+$429.00",
      "amountUsd": "429.00",
      "changePct": "+22.88%",
      "tone": "positive"
    },
    "byline": {
      "value": "$2,304.00"
    },
    "stats": [
      {
        "label": "Entry",
        "value": "$150.00",
        "amountUsd": "150.00"
      },
      {
        "label": "Current",
        "value": "$184.32",
        "amountUsd": "184.32"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "SOL",
      "subtitle": "Solana"
    },
    "titleVerified": true,
    "date": "2026-08-20T21:55:07.869Z",
    "dateLabel": "Aug 20, 2026"
  }
}
Closed spot priced in market caps — PASS

Assertion: POST returns 201; GET 200 and display fields as tabled.

Request

POST http://localhost:3000/share
content-type: application/json
x-forwarded-user: 550e8400-…0000

{
  "payload": {
    "kind": "closed_position",
    "market": "spot",
    "caip19": "solana:101/token:CATE",
    "symbol": "CATE",
    "amount": "1000",
    "entryPriceUsd": "0.174538",
    "entryMarketCapUsd": "61500000",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "performance": {
      "currentPriceUsd": "0.182391",
      "currentMarketCapUsd": "59400000",
      "pnlUsd": "19.63",
      "pnlPct": "4.50"
    }
  }
}

Response — 201

{
  "shareId": "3EKr0GB1QC",
  "v": 2,
  "payload": {
    "market": "spot",
    "caip19": "solana:101/token:CATE",
    "symbol": "CATE",
    "amount": "1000",
    "entryPriceUsd": "0.174538",
    "entryMarketCapUsd": "61500000",
    "kind": "closed_position",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "performance": {
      "currentPriceUsd": "0.182391",
      "currentMarketCapUsd": "59400000",
      "pnlUsd": "19.63",
      "pnlPct": "4.50"
    }
  },
  "deepLinkPath": "portfolio",
  "createdAt": "2026-08-20T21:55:08.028Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "icon": {
      "caip19": "solana:101/token:CATE",
      "fallbackText": "C"
    },
    "headline": {
      "value": "+$19.63",
      "amountUsd": "19.63",
      "changePct": "+4.50%",
      "tone": "positive"
    },
    "byline": {
      "value": "$182.39"
    },
    "stats": [
      {
        "label": "Entry MC",
        "value": "$61.5M",
        "amountUsd": "61500000"
      },
      {
        "label": "Exit MC",
        "value": "$59.4M",
        "amountUsd": "59400000"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "CATE",
      "subtitle": "$0.18"
    },
    "date": "2026-08-20T21:55:08.028Z",
    "dateLabel": "Closed on Aug 3, 2026"
  },
  "shareUrl": "https://phantom.com/share/3EKr0GB1QC"
}

GET /share/{id} — 200

{
  "shareId": "3EKr0GB1QC",
  "v": 2,
  "payload": {
    "amount": "1000",
    "caip19": "solana:101/token:CATE",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "entryMarketCapUsd": "61500000",
    "entryPriceUsd": "0.174538",
    "kind": "closed_position",
    "market": "spot",
    "performance": {
      "currentMarketCapUsd": "59400000",
      "currentPriceUsd": "0.182391",
      "pnlPct": "4.50",
      "pnlUsd": "19.63"
    },
    "symbol": "CATE"
  },
  "deepLinkPath": "portfolio",
  "createdAt": "2026-08-20T21:55:08.028Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "icon": {
      "caip19": "solana:101/token:CATE",
      "fallbackText": "C"
    },
    "headline": {
      "value": "+$19.63",
      "amountUsd": "19.63",
      "changePct": "+4.50%",
      "tone": "positive"
    },
    "byline": {
      "value": "$182.39"
    },
    "stats": [
      {
        "label": "Entry MC",
        "value": "$61.5M",
        "amountUsd": "61500000"
      },
      {
        "label": "Exit MC",
        "value": "$59.4M",
        "amountUsd": "59400000"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "CATE",
      "subtitle": "$0.18"
    },
    "date": "2026-08-20T21:55:08.028Z",
    "dateLabel": "Closed on Aug 3, 2026"
  }
}
Closed perp position — PASS

Assertion: POST returns 201; GET 200 and display fields as tabled.

Request

POST http://localhost:3000/share
content-type: application/json
x-forwarded-user: 550e8400-…0000

{
  "payload": {
    "kind": "closed_position",
    "market": "perp",
    "caip19": "hypercore:mainnet/perp:BTC",
    "symbol": "BTC",
    "side": "long",
    "leverage": "10",
    "size": "0.25",
    "entryPriceUsd": "63810.25",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "performance": {
      "currentPriceUsd": "67450.50",
      "pnlUsd": "910.06",
      "pnlPct": "5.70"
    }
  }
}

Response — 201

{
  "shareId": "iw0Baavlvv",
  "v": 2,
  "payload": {
    "market": "perp",
    "caip19": "hypercore:mainnet/perp:BTC",
    "symbol": "BTC",
    "side": "long",
    "leverage": "10",
    "size": "0.25",
    "entryPriceUsd": "63810.25",
    "kind": "closed_position",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "performance": {
      "currentPriceUsd": "67450.50",
      "pnlUsd": "910.06",
      "pnlPct": "5.70"
    }
  },
  "deepLinkPath": "v1/perps/btc-usd",
  "createdAt": "2026-08-20T21:55:08.226Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "badge": {
      "text": "10x Long",
      "colorHex": "#45E863"
    },
    "icon": {
      "caip19": "hypercore:mainnet/perp:BTC",
      "fallbackText": "B"
    },
    "headline": {
      "value": "+$910.06",
      "amountUsd": "910.06",
      "changePct": "+5.70%",
      "tone": "positive"
    },
    "byline": {
      "value": "$16,862.63"
    },
    "stats": [
      {
        "label": "Entry",
        "value": "$63,810.25",
        "amountUsd": "63810.25"
      },
      {
        "label": "Exit",
        "value": "$67,450.50",
        "amountUsd": "67450.50"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "BTC",
      "subtitle": "$67,450.50"
    },
    "date": "2026-08-20T21:55:08.226Z",
    "dateLabel": "Closed on Aug 3, 2026"
  },
  "shareUrl": "https://phantom.com/share/iw0Baavlvv"
}

GET /share/{id} — 200

{
  "shareId": "iw0Baavlvv",
  "v": 2,
  "payload": {
    "caip19": "hypercore:mainnet/perp:BTC",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "entryPriceUsd": "63810.25",
    "kind": "closed_position",
    "leverage": "10",
    "market": "perp",
    "performance": {
      "currentPriceUsd": "67450.50",
      "pnlPct": "5.70",
      "pnlUsd": "910.06"
    },
    "side": "long",
    "size": "0.25",
    "symbol": "BTC"
  },
  "deepLinkPath": "v1/perps/btc-usd",
  "createdAt": "2026-08-20T21:55:08.226Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "badge": {
      "text": "10x Long",
      "colorHex": "#45E863"
    },
    "icon": {
      "caip19": "hypercore:mainnet/perp:BTC",
      "fallbackText": "B"
    },
    "headline": {
      "value": "+$910.06",
      "amountUsd": "910.06",
      "changePct": "+5.70%",
      "tone": "positive"
    },
    "byline": {
      "value": "$16,862.63"
    },
    "stats": [
      {
        "label": "Entry",
        "value": "$63,810.25",
        "amountUsd": "63810.25"
      },
      {
        "label": "Exit",
        "value": "$67,450.50",
        "amountUsd": "67450.50"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "BTC",
      "subtitle": "$67,450.50"
    },
    "date": "2026-08-20T21:55:08.226Z",
    "dateLabel": "Closed on Aug 3, 2026"
  }
}
Closed prediction — PASS

Assertion: POST returns 201; GET 200 and display fields as tabled.

Request

POST http://localhost:3000/share
content-type: application/json
x-forwarded-user: 550e8400-…0000

{
  "payload": {
    "kind": "closed_position",
    "market": "prediction",
    "ticker": "KXATP-26USO-ALC",
    "outcome": "Alcaraz",
    "chanceMultiplier": "2.63",
    "valueUsd": "380.00",
    "payoutIfRightUsd": "999.40",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "performance": {
      "pnlUsd": "240.00",
      "pnlPct": "63.15"
    }
  }
}

Response — 201

{
  "shareId": "3UyBZ3VtSF",
  "v": 2,
  "payload": {
    "market": "prediction",
    "ticker": "KXATP-26USO-ALC",
    "outcome": "Alcaraz",
    "chanceMultiplier": "2.63",
    "valueUsd": "380.00",
    "payoutIfRightUsd": "999.40",
    "kind": "closed_position",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "performance": {
      "pnlUsd": "240.00",
      "pnlPct": "63.15"
    }
  },
  "deepLinkPath": "predictions/event/KXATP-26USO-ALC",
  "createdAt": "2026-08-20T21:55:08.260Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "badge": {
      "text": "Alcaraz"
    },
    "icon": {
      "fallbackText": "K"
    },
    "headline": {
      "value": "+$240.00",
      "amountUsd": "240.00",
      "changePct": "+63.15%",
      "tone": "positive"
    },
    "byline": {
      "value": "$380.00"
    },
    "heading": {
      "type": "title_subtitle",
      "title": "KXATP-26USO-ALC",
      "subtitle": "Alcaraz"
    },
    "date": "2026-08-20T21:55:08.260Z",
    "dateLabel": "Closed on Aug 3, 2026"
  },
  "shareUrl": "https://phantom.com/share/3UyBZ3VtSF"
}

GET /share/{id} — 200

{
  "shareId": "3UyBZ3VtSF",
  "v": 2,
  "payload": {
    "chanceMultiplier": "2.63",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "kind": "closed_position",
    "market": "prediction",
    "outcome": "Alcaraz",
    "payoutIfRightUsd": "999.40",
    "performance": {
      "pnlPct": "63.15",
      "pnlUsd": "240.00"
    },
    "ticker": "KXATP-26USO-ALC",
    "valueUsd": "380.00"
  },
  "deepLinkPath": "predictions/event/KXATP-26USO-ALC",
  "createdAt": "2026-08-20T21:55:08.260Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "badge": {
      "text": "Alcaraz"
    },
    "icon": {
      "fallbackText": "K"
    },
    "headline": {
      "value": "+$240.00",
      "amountUsd": "240.00",
      "changePct": "+63.15%",
      "tone": "positive"
    },
    "byline": {
      "value": "$380.00"
    },
    "heading": {
      "type": "title_subtitle",
      "title": "KXATP-26USO-ALC",
      "subtitle": "Alcaraz"
    },
    "date": "2026-08-20T21:55:08.260Z",
    "dateLabel": "Closed on Aug 3, 2026"
  }
}
Open prediction (existing_position) — PASS

Assertion: POST returns 201; GET 200 and display fields as tabled.

Request

POST http://localhost:3000/share
content-type: application/json
x-forwarded-user: 550e8400-…0000

{
  "payload": {
    "kind": "existing_position",
    "market": "prediction",
    "ticker": "KXATP-26USO-ALC",
    "outcome": "Alcaraz",
    "chanceMultiplier": "2.63",
    "valueUsd": "380.00",
    "payoutIfRightUsd": "999.40",
    "performance": {
      "pnlUsd": "240.00",
      "pnlPct": "63.15"
    }
  }
}

Response — 201

{
  "shareId": "bP2YPaYLVz",
  "v": 2,
  "payload": {
    "market": "prediction",
    "ticker": "KXATP-26USO-ALC",
    "outcome": "Alcaraz",
    "chanceMultiplier": "2.63",
    "valueUsd": "380.00",
    "payoutIfRightUsd": "999.40",
    "kind": "existing_position",
    "performance": {
      "pnlUsd": "240.00",
      "pnlPct": "63.15"
    }
  },
  "deepLinkPath": "predictions/event/KXATP-26USO-ALC",
  "createdAt": "2026-08-20T21:55:08.292Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "badge": {
      "text": "Alcaraz"
    },
    "icon": {
      "fallbackText": "K"
    },
    "headline": {
      "value": "+$240.00",
      "amountUsd": "240.00",
      "changePct": "+63.15%",
      "tone": "positive"
    },
    "byline": {
      "value": "$380.00"
    },
    "stats": [
      {
        "label": "Payout if right",
        "value": "+$999.40",
        "amountUsd": "999.40",
        "tone": "positive"
      },
      {
        "label": "Chance",
        "value": "38.02%"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "KXATP-26USO-ALC",
      "subtitle": "Alcaraz"
    },
    "date": "2026-08-20T21:55:08.292Z",
    "dateLabel": "Aug 20, 2026"
  },
  "shareUrl": "https://phantom.com/share/bP2YPaYLVz"
}

GET /share/{id} — 200

{
  "shareId": "bP2YPaYLVz",
  "v": 2,
  "payload": {
    "chanceMultiplier": "2.63",
    "kind": "existing_position",
    "market": "prediction",
    "outcome": "Alcaraz",
    "payoutIfRightUsd": "999.40",
    "performance": {
      "pnlPct": "63.15",
      "pnlUsd": "240.00"
    },
    "ticker": "KXATP-26USO-ALC",
    "valueUsd": "380.00"
  },
  "deepLinkPath": "predictions/event/KXATP-26USO-ALC",
  "createdAt": "2026-08-20T21:55:08.292Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "badge": {
      "text": "Alcaraz"
    },
    "icon": {
      "fallbackText": "K"
    },
    "headline": {
      "value": "+$240.00",
      "amountUsd": "240.00",
      "changePct": "+63.15%",
      "tone": "positive"
    },
    "byline": {
      "value": "$380.00"
    },
    "stats": [
      {
        "label": "Payout if right",
        "value": "+$999.40",
        "amountUsd": "999.40",
        "tone": "positive"
      },
      {
        "label": "Chance",
        "value": "38.02%"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "KXATP-26USO-ALC",
      "subtitle": "Alcaraz"
    },
    "date": "2026-08-20T21:55:08.292Z",
    "dateLabel": "Aug 20, 2026"
  }
}
closedAt on new_position (rejected field) — PASS

Assertion: POST returns 201; GET 200 and display fields as tabled.

Request

POST http://localhost:3000/share
content-type: application/json
x-forwarded-user: 550e8400-…0000

{
  "payload": {
    "kind": "new_position",
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "closedAt": "2026-08-03T09:15:00.000Z"
  }
}

Response — 201

{
  "shareId": "ixiKTwWNKf",
  "v": 2,
  "payload": {
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "name": "Solana",
    "symbol": "SOL",
    "logoUri": "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "kind": "new_position"
  },
  "deepLinkPath": "portfolio",
  "createdAt": "2026-08-20T21:55:08.454Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "icon": {
      "url": "https://api.phantom.app/image-proxy/?image=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fsolana-labs%2Ftoken-list%40main%2Fassets%2Fmainnet%2FSo11111111111111111111111111111111111111112%2Flogo.png",
      "caip19": "solana:101/nativeToken:501",
      "fallbackText": "S"
    },
    "headline": {
      "value": "$1,875.00",
      "amountUsd": "1875",
      "tone": "neutral"
    },
    "byline": {
      "value": "$1,875.00"
    },
    "stats": [
      {
        "label": "Entry",
        "value": "$150.00",
        "amountUsd": "150.00"
      },
      {
        "label": "Current",
        "value": "$150.00",
        "amountUsd": "150.00"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "SOL",
      "subtitle": "Solana"
    },
    "titleVerified": true,
    "date": "2026-08-20T21:55:08.454Z",
    "dateLabel": "Aug 20, 2026"
  },
  "shareUrl": "https://phantom.com/share/ixiKTwWNKf"
}

GET /share/{id} — 200

{
  "shareId": "ixiKTwWNKf",
  "v": 2,
  "payload": {
    "amount": "12.5",
    "caip19": "solana:101/nativeToken:501",
    "entryPriceUsd": "150.00",
    "kind": "new_position",
    "logoUri": "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",
    "market": "spot",
    "name": "Solana",
    "symbol": "SOL"
  },
  "deepLinkPath": "portfolio",
  "createdAt": "2026-08-20T21:55:08.454Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "icon": {
      "url": "https://api.phantom.app/image-proxy/?image=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fsolana-labs%2Ftoken-list%40main%2Fassets%2Fmainnet%2FSo11111111111111111111111111111111111111112%2Flogo.png",
      "caip19": "solana:101/nativeToken:501",
      "fallbackText": "S"
    },
    "headline": {
      "value": "$1,875.00",
      "amountUsd": "1875",
      "tone": "neutral"
    },
    "byline": {
      "value": "$1,875.00"
    },
    "stats": [
      {
        "label": "Entry",
        "value": "$150.00",
        "amountUsd": "150.00"
      },
      {
        "label": "Current",
        "value": "$150.00",
        "amountUsd": "150.00"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "SOL",
      "subtitle": "Solana"
    },
    "titleVerified": true,
    "date": "2026-08-20T21:55:08.454Z",
    "dateLabel": "Aug 20, 2026"
  }
}
closedAt on existing_position (rejected field) — PASS

Assertion: POST returns 201; GET 200 and display fields as tabled.

Request

POST http://localhost:3000/share
content-type: application/json
x-forwarded-user: 550e8400-…0000

{
  "payload": {
    "kind": "existing_position",
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "closedAt": "2026-08-03T09:15:00.000Z",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlUsd": "429.00",
      "pnlPct": "22.88"
    }
  }
}

Response — 201

{
  "shareId": "SNMDT1dk2I",
  "v": 2,
  "payload": {
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "name": "Solana",
    "symbol": "SOL",
    "logoUri": "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "kind": "existing_position",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlUsd": "429.00",
      "pnlPct": "22.88"
    }
  },
  "deepLinkPath": "portfolio",
  "createdAt": "2026-08-20T21:55:08.602Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "icon": {
      "url": "https://api.phantom.app/image-proxy/?image=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fsolana-labs%2Ftoken-list%40main%2Fassets%2Fmainnet%2FSo11111111111111111111111111111111111111112%2Flogo.png",
      "caip19": "solana:101/nativeToken:501",
      "fallbackText": "S"
    },
    "headline": {
      "value": "+$429.00",
      "amountUsd": "429.00",
      "changePct": "+22.88%",
      "tone": "positive"
    },
    "byline": {
      "value": "$2,304.00"
    },
    "stats": [
      {
        "label": "Entry",
        "value": "$150.00",
        "amountUsd": "150.00"
      },
      {
        "label": "Current",
        "value": "$184.32",
        "amountUsd": "184.32"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "SOL",
      "subtitle": "Solana"
    },
    "titleVerified": true,
    "date": "2026-08-20T21:55:08.602Z",
    "dateLabel": "Aug 20, 2026"
  },
  "shareUrl": "https://phantom.com/share/SNMDT1dk2I"
}

GET /share/{id} — 200

{
  "shareId": "SNMDT1dk2I",
  "v": 2,
  "payload": {
    "amount": "12.5",
    "caip19": "solana:101/nativeToken:501",
    "entryPriceUsd": "150.00",
    "kind": "existing_position",
    "logoUri": "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",
    "market": "spot",
    "name": "Solana",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlPct": "22.88",
      "pnlUsd": "429.00"
    },
    "symbol": "SOL"
  },
  "deepLinkPath": "portfolio",
  "createdAt": "2026-08-20T21:55:08.602Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "icon": {
      "url": "https://api.phantom.app/image-proxy/?image=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fsolana-labs%2Ftoken-list%40main%2Fassets%2Fmainnet%2FSo11111111111111111111111111111111111111112%2Flogo.png",
      "caip19": "solana:101/nativeToken:501",
      "fallbackText": "S"
    },
    "headline": {
      "value": "+$429.00",
      "amountUsd": "429.00",
      "changePct": "+22.88%",
      "tone": "positive"
    },
    "byline": {
      "value": "$2,304.00"
    },
    "stats": [
      {
        "label": "Entry",
        "value": "$150.00",
        "amountUsd": "150.00"
      },
      {
        "label": "Current",
        "value": "$184.32",
        "amountUsd": "184.32"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "SOL",
      "subtitle": "Solana"
    },
    "titleVerified": true,
    "date": "2026-08-20T21:55:08.602Z",
    "dateLabel": "Aug 20, 2026"
  }
}
closed_position missing closedAt — PASS

Assertion: POST returns 400 and no record is created.

Request

POST http://localhost:3000/share
content-type: application/json
x-forwarded-user: 550e8400-…0000

{
  "payload": {
    "kind": "closed_position",
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlUsd": "429.00",
      "pnlPct": "22.88"
    }
  }
}

Response — 400

{
  "message": "[\n  {\n    \"expected\": \"string\",\n    \"code\": \"invalid_type\",\n    \"path\": [\n      \"payload\",\n      \"closedAt\"\n    ],\n    \"message\": \"Invalid input: expected string, received undefined\"\n  }\n]",
  "statusCode": 400
}
closed_position missing performance — PASS

Assertion: POST returns 400 and no record is created.

Request

POST http://localhost:3000/share
content-type: application/json
x-forwarded-user: 550e8400-…0000

{
  "payload": {
    "kind": "closed_position",
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "closedAt": "2026-08-03T09:15:00.000Z"
  }
}

Response — 400

{
  "message": "[\n  {\n    \"expected\": \"object\",\n    \"code\": \"invalid_type\",\n    \"path\": [\n      \"payload\",\n      \"performance\"\n    ],\n    \"message\": \"Invalid input: expected object, received undefined\"\n  }\n]",
  "statusCode": 400
}
closedAt not a timestamp — PASS

Assertion: POST returns 400 and no record is created.

Request

POST http://localhost:3000/share
content-type: application/json
x-forwarded-user: 550e8400-…0000

{
  "payload": {
    "kind": "closed_position",
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "closedAt": "not-a-timestamp",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlUsd": "429.00",
      "pnlPct": "22.88"
    }
  }
}

Response — 400

{
  "message": "[\n  {\n    \"origin\": \"string\",\n    \"code\": \"invalid_format\",\n    \"format\": \"datetime\",\n    \"pattern\": \"/^(?:(?:\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\\\d|30)|(?:02)-(?:0[1-9]|1\\\\d|2[0-8])))T(?:(?:[01]\\\\d|2[0-3]):[0-5]\\\\d(?::[0-5]\\\\d(?:\\\\.\\\\d+)?)?(?:Z))$/\",\n    \"path\": [\n      \"payload\",\n      \"closedAt\"\n    ],\n    \"message\": \"Invalid ISO datetime\"\n  }\n]",
  "statusCode": 400
}
closedAt on a day the share is not — PASS

Assertion: POST returns 201; GET 200 and display fields as tabled.

Request

POST http://localhost:3000/share
content-type: application/json
x-forwarded-user: 550e8400-…0000

{
  "payload": {
    "kind": "closed_position",
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "closedAt": "2024-12-31T23:30:00.000Z",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlUsd": "429.00",
      "pnlPct": "22.88"
    }
  }
}

Response — 201

{
  "shareId": "b4s5lUpLVq",
  "v": 2,
  "payload": {
    "market": "spot",
    "caip19": "solana:101/nativeToken:501",
    "name": "Solana",
    "symbol": "SOL",
    "logoUri": "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",
    "amount": "12.5",
    "entryPriceUsd": "150.00",
    "kind": "closed_position",
    "closedAt": "2024-12-31T23:30:00.000Z",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlUsd": "429.00",
      "pnlPct": "22.88"
    }
  },
  "deepLinkPath": "portfolio",
  "createdAt": "2026-08-20T21:55:08.858Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "icon": {
      "url": "https://api.phantom.app/image-proxy/?image=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fsolana-labs%2Ftoken-list%40main%2Fassets%2Fmainnet%2FSo11111111111111111111111111111111111111112%2Flogo.png",
      "caip19": "solana:101/nativeToken:501",
      "fallbackText": "S"
    },
    "headline": {
      "value": "+$429.00",
      "amountUsd": "429.00",
      "changePct": "+22.88%",
      "tone": "positive"
    },
    "byline": {
      "value": "$2,304.00"
    },
    "stats": [
      {
        "label": "Entry",
        "value": "$150.00",
        "amountUsd": "150.00"
      },
      {
        "label": "Exit",
        "value": "$184.32",
        "amountUsd": "184.32"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "SOL",
      "subtitle": "Solana"
    },
    "titleVerified": true,
    "date": "2026-08-20T21:55:08.858Z",
    "dateLabel": "Closed on Dec 31, 2024"
  },
  "shareUrl": "https://phantom.com/share/b4s5lUpLVq"
}

GET /share/{id} — 200

{
  "shareId": "b4s5lUpLVq",
  "v": 2,
  "payload": {
    "amount": "12.5",
    "caip19": "solana:101/nativeToken:501",
    "closedAt": "2024-12-31T23:30:00.000Z",
    "entryPriceUsd": "150.00",
    "kind": "closed_position",
    "logoUri": "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png",
    "market": "spot",
    "name": "Solana",
    "performance": {
      "currentPriceUsd": "184.32",
      "pnlPct": "22.88",
      "pnlUsd": "429.00"
    },
    "symbol": "SOL"
  },
  "deepLinkPath": "portfolio",
  "createdAt": "2026-08-20T21:55:08.858Z",
  "sharer": {},
  "display": {
    "headerTitle": "Share Position",
    "icon": {
      "url": "https://api.phantom.app/image-proxy/?image=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fsolana-labs%2Ftoken-list%40main%2Fassets%2Fmainnet%2FSo11111111111111111111111111111111111111112%2Flogo.png",
      "caip19": "solana:101/nativeToken:501",
      "fallbackText": "S"
    },
    "headline": {
      "value": "+$429.00",
      "amountUsd": "429.00",
      "changePct": "+22.88%",
      "tone": "positive"
    },
    "byline": {
      "value": "$2,304.00"
    },
    "stats": [
      {
        "label": "Entry",
        "value": "$150.00",
        "amountUsd": "150.00"
      },
      {
        "label": "Exit",
        "value": "$184.32",
        "amountUsd": "184.32"
      }
    ],
    "heading": {
      "type": "title_subtitle",
      "title": "SOL",
      "subtitle": "Solana"
    },
    "titleVerified": true,
    "date": "2026-08-20T21:55:08.858Z",
    "dateLabel": "Closed on Dec 31, 2024"
  }
}

Environment

node v26.7.0
docker: cockroachdb-blockchain, dragonflydb-blockchain, kafka-blockchain, postgres-blockchain, valkey-cluster*-blockchain
migrations: kysely migrate:latest (no new migrations; shares table present)
env vars set (names only): DATABASE_URL, PORT, ENVIRONMENT, PHANTOM_API_URL, USER_SERVICE_URL,
  ACTIVATION_PROGRAM_SERVICE_URL, REDIS_HOST, BACKEND_RUDDERSTACK_WRITEKEY,
  EPPO_BACKEND_FEATURE_FLAG_ENVIRONMENT_AWARE_SDK_KEY, SOCIAL_CHAT_API_URL, SHARE_BACKDROP_RESOLVE_ENABLED, APP_VERSION
auth: x-forwarded-user header (local UUID), no production credentials used