This repository has been archived by the owner on Jul 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(news): implement blockfolio signals (#560)
- Loading branch information
1 parent
2884e44
commit 1947fd0
Showing
10 changed files
with
257 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export interface BlockfolioSignal { | ||
id: number; | ||
text: string; | ||
links: string[]; | ||
category: string; | ||
author: { title: string; name: string; team: string }; | ||
is_featured: boolean; | ||
created_at: string; | ||
updated_at: string; | ||
} | ||
|
||
export interface BlockfolioResponse { | ||
data: BlockfolioSignal[]; | ||
meta: { | ||
current_page: number; | ||
from: number; | ||
last_page: number; | ||
path: string; | ||
per_page: number; | ||
to: number; | ||
total: number; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import "jest-extended"; | ||
|
||
import { Request } from "@arkecosystem/platform-sdk-http-got"; | ||
import nock from "nock"; | ||
|
||
import { Blockfolio } from "./blockfolio"; | ||
|
||
let subject: Blockfolio; | ||
|
||
beforeAll(() => nock.disableNetConnect()); | ||
|
||
beforeEach(() => (subject = new Blockfolio(new Request()))); | ||
|
||
afterEach(() => nock.cleanAll()); | ||
|
||
describe("Blockfolio", () => { | ||
describe("#findByCoin", () => { | ||
it("should retrieve the feed and findByCoin it", async () => { | ||
nock("https://platform.ark.io") | ||
.get("/coins/ark/signals") | ||
.query(true) | ||
.reply(200, require("../test/fixtures/blockfolio.json")); | ||
|
||
const result = await subject.findByCoin("ark"); | ||
|
||
expect(result).toBeObject(); | ||
expect(result.data).toBeArray(); | ||
expect(result.meta).toBeObject(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Contracts } from "@arkecosystem/platform-sdk"; | ||
|
||
import { BlockfolioResponse } from "./blockfolio.models"; | ||
|
||
export class Blockfolio { | ||
readonly #httpClient: Contracts.HttpClient; | ||
|
||
public constructor(httpClient: Contracts.HttpClient) { | ||
this.#httpClient = httpClient; | ||
} | ||
|
||
public async findByCoin(coin: string, page = 1): Promise<BlockfolioResponse> { | ||
const { data, meta }: any = ( | ||
await this.#httpClient.get(`https://platform.ark.io/coins/${coin}/signals`, { page }) | ||
).json(); | ||
|
||
return { data, meta }; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from "./blockfolio.models"; | ||
export * from "./blockfolio"; | ||
export * from "./feed"; |
177 changes: 177 additions & 0 deletions
177
packages/platform-sdk-news/test/fixtures/blockfolio.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"id": 952, | ||
"text": "Recently we released our all-in-one toolkit the ARK Platform SDK, along with an overview and what blockchain projects it will initially support. Today we are going into more details on a technical level. https://blog.ark.io/ark-platform-sdk-modernization-of-blockchain-network-interactions-b5a7d70c2461", | ||
"links": [ | ||
"https://blog.ark.io/ark-platform-sdk-modernization-of-blockchain-network-interactions-b5a7d70c2461" | ||
], | ||
"category": "Technical", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-07-21T17:54:34.000000Z", | ||
"updated_at": "2020-07-21T17:54:34.000000Z" | ||
}, | ||
{ | ||
"id": 921, | ||
"text": "June is over and it's time for the Monthly Update. This blog post will cover last month\u2019s highlights, activities, development, partner activities, news and updates of our upcoming releases. https://blog.ark.io/ark-monthly-update-june-2020-edition-279a3dd47a36", | ||
"links": ["https://blog.ark.io/ark-monthly-update-june-2020-edition-279a3dd47a36"], | ||
"category": "Marketing", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-07-03T16:20:04.000000Z", | ||
"updated_at": "2020-07-03T16:20:04.000000Z" | ||
}, | ||
{ | ||
"id": 941, | ||
"text": "Government representatives want to attack encryption and implement mandatory backdoors to access your information, what does this mean for you? https://blog.ark.io/new-anti-encryption-bill-is-the-largest-threat-to-our-privacy-today-68a85216ed2d", | ||
"links": [ | ||
"https://blog.ark.io/new-anti-encryption-bill-is-the-largest-threat-to-our-privacy-today-68a85216ed2d" | ||
], | ||
"category": "Community", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-07-15T17:43:57.000000Z", | ||
"updated_at": "2020-07-15T17:43:57.000000Z" | ||
}, | ||
{ | ||
"id": 938, | ||
"text": "With the recent ARK Desktop Wallet updates for v2.9.3, we want to go over some changes and features with a new walk through video. https://youtu.be/AslAEyPZnXQ", | ||
"links": ["https://youtu.be/AslAEyPZnXQ"], | ||
"category": "Community", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-07-13T16:15:17.000000Z", | ||
"updated_at": "2020-07-13T16:15:17.000000Z" | ||
}, | ||
{ | ||
"id": 922, | ||
"text": "The 82nd episode of the ARK Crypto Podcast is here! This week, we go over everything you might have missed that happened recently for ARK. https://ark.io/podcast/ark-crypto-podcast-082-arkio-monthly-update-june-2020", | ||
"links": ["https://ark.io/podcast/ark-crypto-podcast-082-arkio-monthly-update-june-2020"], | ||
"category": "Marketing", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-07-03T18:57:10.000000Z", | ||
"updated_at": "2020-07-03T18:57:10.000000Z" | ||
}, | ||
{ | ||
"id": 919, | ||
"text": "June is behind us and it is time once again for the Monthly Development Report. With over 250k lines of code added, June was very productive. Let's go deep into detail in the blog post. https://blog.ark.io/ark-development-report-june-2020-20c2a42857a5", | ||
"links": ["https://blog.ark.io/ark-development-report-june-2020-20c2a42857a5"], | ||
"category": "Technical", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-07-02T15:59:52.000000Z", | ||
"updated_at": "2020-07-02T15:59:52.000000Z" | ||
}, | ||
{ | ||
"id": 875, | ||
"text": "May is over and it's time for the Monthly Update. This blog post will cover last month\u2019s highlights, activities, development, partner activities, news and updates of our upcoming releases. https://blog.ark.io/ark-monthly-update-may-2020-edition-af9ccd426e9b", | ||
"links": ["https://blog.ark.io/ark-monthly-update-may-2020-edition-af9ccd426e9b"], | ||
"category": "Marketing", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-06-04T19:29:15.000000Z", | ||
"updated_at": "2020-06-04T19:29:15.000000Z" | ||
}, | ||
{ | ||
"id": 915, | ||
"text": "The 80th episode of the ARK Crypto Podcast is here! This week we welcome Protokol, ARK's new enterprise entity, to the show. We introduce the team, dive into Protokol's mission and answer community questions. https://ark.io/podcast/ark-crypto-podcast-080-protokol-enterprise-solutions-soft-launch-interview-part-1", | ||
"links": [ | ||
"https://ark.io/podcast/ark-crypto-podcast-080-protokol-enterprise-solutions-soft-launch-interview-part-1" | ||
], | ||
"category": "Marketing", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-06-19T14:25:57.000000Z", | ||
"updated_at": "2020-06-19T14:25:57.000000Z" | ||
}, | ||
{ | ||
"id": 502, | ||
"text": "The April Development Report is here. With over 31,000 lines of code added and 1,000 files changed, it was a very productive month. Let's go into more detail and cover everything that happened in the entire ARK Ecosystem Public GitHub Repository in this blog post. https://blog.ark.io/ark-development-report-april-2020-dbf050601d62", | ||
"links": ["https://blog.ark.io/ark-development-report-april-2020-dbf050601d62"], | ||
"category": "Technical", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-05-05T14:04:27.000000Z", | ||
"updated_at": "2020-05-05T14:04:27.000000Z" | ||
}, | ||
{ | ||
"id": 507, | ||
"text": "The final part of our game developer tutorial is here. This 6 part series will help you convert HTML5 games into ARK Desktop Wallet Plugins. In this part, we finalize our plugin to run in the ARK Wallet and play our game! https://blog.ark.io/launching-html5-games-in-the-ark-desktop-wallet-part-six-ad887fd2e888", | ||
"links": ["https://blog.ark.io/launching-html5-games-in-the-ark-desktop-wallet-part-six-ad887fd2e888"], | ||
"category": "Technical", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-04-29T16:41:55.000000Z", | ||
"updated_at": "2020-04-29T16:41:55.000000Z" | ||
}, | ||
{ | ||
"id": 508, | ||
"text": "Part 5 of our game developer tutorial is here! This series will help you convert HTML5 games into ARK Desktop Wallet Plugins. In this part, we implement prize logic and payouts utilizing multipayments. https://blog.ark.io/launching-html5-games-in-the-ark-desktop-wallet-part-five-a2cf1d32be20", | ||
"links": ["https://blog.ark.io/launching-html5-games-in-the-ark-desktop-wallet-part-five-a2cf1d32be20"], | ||
"category": "Technical", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-04-27T16:38:57.000000Z", | ||
"updated_at": "2020-04-27T16:38:57.000000Z" | ||
}, | ||
{ | ||
"id": 516, | ||
"text": "ARK was recently added to Swipe Wallet and Swipe Visa Card. Let's go over what that means, where it's available and what Swipe is. https://blog.ark.io/ark-is-now-available-on-the-swipe-app-with-visa-card-and-in-app-exchange-for-europe-and-beyond-ecf9e8374aef", | ||
"links": [ | ||
"https://blog.ark.io/ark-is-now-available-on-the-swipe-app-with-visa-card-and-in-app-exchange-for-europe-and-beyond-ecf9e8374aef" | ||
], | ||
"category": "Community", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-04-14T16:40:25.000000Z", | ||
"updated_at": "2020-04-14T16:40:25.000000Z" | ||
}, | ||
{ | ||
"id": 518, | ||
"text": "With ARK Core 2.6 live and running let's quickly go over newly developed features and transaction types in this animated video. https://youtu.be/FpB64_timVM", | ||
"links": ["https://youtu.be/FpB64_timVM"], | ||
"category": "Marketing", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-04-09T17:50:33.000000Z", | ||
"updated_at": "2020-04-09T17:50:33.000000Z" | ||
}, | ||
{ | ||
"id": 845, | ||
"text": "As we near open DevNet v2 release we want to give everyone a quick Core v2 progress update. https://blog.ark.io/ark-core-v2-progress-update-b1c5d5f19a23", | ||
"links": ["https://blog.ark.io/ark-core-v2-progress-update-b1c5d5f19a23"], | ||
"category": "Technical", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2018-08-07T18:16:36.000000Z", | ||
"updated_at": "2019-04-01T20:51:15.000000Z" | ||
}, | ||
{ | ||
"id": 525, | ||
"text": "Let's Explore ARK Core v3 Part 4. Diving into a technical breakdown of the upcoming ARK Core v3. In this part, we\u2019ll learn about the extensibility and testability of Core packages and why this is important. https://blog.ark.io/lets-explore-core-part-4-extensibility-c60522f1b700", | ||
"links": ["https://blog.ark.io/lets-explore-core-part-4-extensibility-c60522f1b700"], | ||
"category": "Technical", | ||
"author": { "title": "Co-Founder", "name": "Travis Walker", "team": "Team Ark" }, | ||
"is_featured": false, | ||
"created_at": "2020-04-02T18:23:18.000000Z", | ||
"updated_at": "2020-04-02T18:23:18.000000Z" | ||
} | ||
], | ||
"links": { | ||
"first": "https://platform.ark.io/api/coins/ark/signals?page=1", | ||
"last": "https://platform.ark.io/api/coins/ark/signals?page=27", | ||
"prev": null, | ||
"next": "https://platform.ark.io/api/coins/ark/signals?page=2" | ||
}, | ||
"meta": { | ||
"current_page": 1, | ||
"from": 1, | ||
"last_page": 27, | ||
"path": "https://platform.ark.io/api/coins/ark/signals", | ||
"per_page": 15, | ||
"to": 15, | ||
"total": 399 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters