diff --git a/api/inbound-stream.js b/api/inbound-stream.js index 73948346..f0a8ddf9 100644 --- a/api/inbound-stream.js +++ b/api/inbound-stream.js @@ -313,13 +313,13 @@ class RedisHandler { // NEW this.redisTimelineImprovedPush( commands, - `!__timeline:application:${instruction.program_id}`, + `!__timeline:program:${instruction.program_id}`, txnMsg, ); // NEW this.redisRecencySetPush( commands, - `!__recent:applications`, + `!__recent:programs`, instruction.program_id, now_score, ); diff --git a/api/loaders/accounts/detail.js b/api/loaders/accounts/detail.js index 598ed749..5ab60909 100644 --- a/api/loaders/accounts/detail.js +++ b/api/loaders/accounts/detail.js @@ -13,7 +13,7 @@ async function loadAccountTimestamp(redisX, accountId) { * loadAccountDetail: retrieves raw data about an account from the data store and returns it for formatting * @param redisX * @param accountId - * @returns {Promise<{accountInfo: *, __errors__: *, programAccounts: *, applicationId: *, timestamp: *}>} + * @returns {Promise<{accountInfo: *, __errors__: *, programAccounts: *, programId: *, timestamp: *}>} */ export async function loadAccountDetail(redisX, accountId) { const connection = new solanaWeb3.Connection(FULLNODE_URL); diff --git a/api/loaders/applications/detail.js b/api/loaders/programs/detail.js similarity index 53% rename from api/loaders/applications/detail.js rename to api/loaders/programs/detail.js index 1b342b2a..6a1d1677 100644 --- a/api/loaders/applications/detail.js +++ b/api/loaders/programs/detail.js @@ -3,20 +3,20 @@ import * as solanaWeb3 from '@solana/web3.js'; import {FriendlyGet} from '../../friendlyGet'; import {FULLNODE_URL} from '../../fullnode-url'; -async function loadApplicationTimestamp(redisX, applicationId) { - const result = await redisX.zscoreAsync('!__recent:programs', applicationId); +async function loadProgramTimestamp(redisX, programId) { + const result = await redisX.zscoreAsync('!__recent:programs', programId); return result; } /** - * loadApplicationDetail: retrieves raw data about an application from the data store and returns it for formatting + * loadProgramDetail: retrieves raw data about a program from the data store and returns it for formatting * * @param redisX - * @param applicationId - * @returns {Promise<{accountInfo: *, __errors__: *, programAccounts: *, applicationId: *, timestamp: *}>} + * @param programId + * @returns {Promise<{accountInfo: *, __errors__: *, programAccounts: *, programId: *, timestamp: *}>} */ -export async function loadApplicationDetail(redisX, applicationId) { +export async function loadProgramDetail(redisX, programId) { const connection = new solanaWeb3.Connection(FULLNODE_URL); const { @@ -27,18 +27,18 @@ export async function loadApplicationDetail(redisX, applicationId) { } = await new FriendlyGet() .with( 'accountInfo', - connection.getAccountInfo(new solanaWeb3.PublicKey(applicationId)), + connection.getAccountInfo(new solanaWeb3.PublicKey(programId)), ) .with( 'programAccounts', - connection.getProgramAccounts(new solanaWeb3.PublicKey(applicationId)), + connection.getProgramAccounts(new solanaWeb3.PublicKey(programId)), ) - .with('timestamp', loadApplicationTimestamp(redisX, applicationId)) + .with('timestamp', loadProgramTimestamp(redisX, programId)) .get(); return { __errors__, - applicationId, + programId, accountInfo, programAccounts, timestamp, diff --git a/api/loaders/applications/index.js b/api/loaders/programs/index.js similarity index 68% rename from api/loaders/applications/index.js rename to api/loaders/programs/index.js index abe2dd27..22b72e34 100644 --- a/api/loaders/applications/index.js +++ b/api/loaders/programs/index.js @@ -1,6 +1,6 @@ import {getRecencySetInfo, getRecencySetPage} from '../recency'; -function parseApplicationEntry(data) { +function parseProgramEntry(data) { if (!data || data.length < 2) { return null; } @@ -12,7 +12,7 @@ function parseApplicationEntry(data) { } /** - * loadApplicationIndex: retrieves raw data from the data store and returns it for formatting + * loadProgramIndex: retrieves raw data from the data store and returns it for formatting * * @param redisX * @param start @@ -20,16 +20,16 @@ function parseApplicationEntry(data) { * @param direction * @returns {Promise<{timelinePage: *, timelineInfo: *}>} */ -export async function loadApplicationIndex(redisX, start, count, direction) { +export async function loadProgramIndex(redisX, start, count, direction) { const timelineInfo = await getRecencySetInfo( redisX, - 'applications', - parseApplicationEntry, + 'programs', + parseProgramEntry, ); const timelinePage = await getRecencySetPage( redisX, - 'applications', + 'programs', start, count, direction, diff --git a/api/loaders/recency.js b/api/loaders/recency.js index 70d6fabe..e0702a95 100644 --- a/api/loaders/recency.js +++ b/api/loaders/recency.js @@ -4,7 +4,7 @@ export const MAX_PAGE_SIZE = 1000; export const DEFAULT_PAGE_SIZE = 100; /** - * getRecencySetInfo: obtain description of recent accounts/applications set + * getRecencySetInfo: obtain description of recent accounts/programs set * * @param redisX * @param timeline @@ -59,7 +59,7 @@ export async function getRecencySetInfo( } /** - * getRecencySetPage: get one page of recent accounts/applications index + * getRecencySetPage: get one page of recent accounts/programs index * * @param redisX * @param timeline diff --git a/api/network-explorer.js b/api/network-explorer.js index 6fdb150d..bd390a53 100644 --- a/api/network-explorer.js +++ b/api/network-explorer.js @@ -3,8 +3,8 @@ import {BlockIndexView} from './views/blocks/index'; import {BlockDetailView} from './views/blocks/detail'; import {TransactionIndexView} from './views/transactions/index'; import {TransactionDetailView} from './views/transactions/detail'; -import {ApplicationIndexView} from './views/applications/index'; -import {ApplicationDetailView} from './views/applications/detail'; +import {ProgramIndexView} from './views/programs/index'; +import {ProgramDetailView} from './views/programs/detail'; import {AccountIndexView} from './views/accounts/index'; import {AccountDetailView} from './views/accounts/detail'; import {DEFAULT_PAGE_SIZE} from './loaders/timeline'; @@ -13,8 +13,8 @@ import {loadBlockIndex} from './loaders/blocks/index'; import {loadBlockDetail} from './loaders/blocks/detail'; import {loadTransactionIndex} from './loaders/transactions/index'; import {loadTransactionDetail} from './loaders/transactions/detail'; -import {loadApplicationIndex} from './loaders/applications/index'; -import {loadApplicationDetail} from './loaders/applications/detail'; +import {loadProgramIndex} from './loaders/programs/index'; +import {loadProgramDetail} from './loaders/programs/detail'; import {loadAccountIndex} from './loaders/accounts/index'; import {loadAccountDetail} from './loaders/accounts/detail'; import {FriendlyGet} from './friendlyGet'; @@ -139,18 +139,18 @@ export function addNetworkExplorerRoutes(redisX, app) { ); }); - // Network Explorer Applications Index - app.get('/explorer/applications/index', async (req, res) => { + // Network Explorer Programs Index + app.get('/explorer/programs/index', async (req, res) => { const q = req.query || {}; - const version = q.v || 'ApplicationIndexView@latest'; + const version = q.v || 'ProgramIndexView@latest'; const start = q.start || ''; const count = q.count ? parseInt(q.count) : DEFAULT_PAGE_SIZE; const direction = q.direction || '-'; const {__errors__, rawData} = await new FriendlyGet() .with( 'rawData', - loadApplicationIndex(redisX, start, count, direction), + loadProgramIndex(redisX, start, count, direction), {}, ) .get(); @@ -158,20 +158,20 @@ export function addNetworkExplorerRoutes(redisX, app) { res.send( prettify( req, - new ApplicationIndexView().asVersion(rawData, __errors__, version), + new ProgramIndexView().asVersion(rawData, __errors__, version), ), ); }); - // Network Explorer Application Detail - app.get('/explorer/applications/:id', async (req, res) => { + // Network Explorer Program Detail + app.get('/explorer/programs/:id', async (req, res) => { const q = req.query || {}; - const version = q.v || 'ApplicationDetailView@latest'; + const version = q.v || 'ProgramDetailView@latest'; const {__errors__, rawData} = await new FriendlyGet() .with( 'rawData', - loadApplicationDetail(redisX, req.params.id, version), + loadProgramDetail(redisX, req.params.id, version), {}, ) .get(); @@ -179,7 +179,7 @@ export function addNetworkExplorerRoutes(redisX, app) { res.send( prettify( req, - new ApplicationDetailView().asVersion(rawData, __errors__, version), + new ProgramDetailView().asVersion(rawData, __errors__, version), ), ); }); diff --git a/api/views/applications/detail.js b/api/views/programs/detail.js similarity index 79% rename from api/views/applications/detail.js rename to api/views/programs/detail.js index 11299d83..03a8820e 100644 --- a/api/views/applications/detail.js +++ b/api/views/programs/detail.js @@ -3,14 +3,14 @@ import Base58 from 'base-58'; const b58e = Base58.encode; /** - * ApplicationDetailView : supports the application detail page + * ProgramDetailView : supports the program detail page * * Changes: * - 20190912.01 : initial version */ -const __VERSION__ = 'ApplicationDetailView@1.0.0'; +const __VERSION__ = 'ProgramDetailView@1.0.0'; -export class ApplicationDetailView { +export class ProgramDetailView { asVersion(rawData, __errors__, version) { if (__errors__) { return { @@ -19,7 +19,7 @@ export class ApplicationDetailView { }; } - const applicationId = rawData.applicationId; + const programId = rawData.programId; const accountInfo = rawData.accountInfo && { data: rawData.accountInfo.data.toString(), @@ -42,13 +42,13 @@ export class ApplicationDetailView { const data = { __VERSION__, - applicationId, + programId, accountInfo, programAccounts, timestamp: rawData.timestamp && new Date(parseInt(rawData.timestamp)), }; - if (version === 'ApplicationDetailView@latest' || version === __VERSION__) { + if (version === 'ProgramDetailView@latest' || version === __VERSION__) { return data; } diff --git a/api/views/applications/index.js b/api/views/programs/index.js similarity index 84% rename from api/views/applications/index.js rename to api/views/programs/index.js index 51b1498a..1d53d0cd 100644 --- a/api/views/applications/index.js +++ b/api/views/programs/index.js @@ -1,13 +1,13 @@ import _ from 'lodash'; /** - * ApplicationIndexView : supports the application index page + * ProgramIndexView : supports the program index page * * Changes: * - 20190912.01 : initial version */ -const __VERSION__ = 'ApplicationIndexView@1.0.0'; -export class ApplicationIndexView { +const __VERSION__ = 'ProgramIndexView@1.0.0'; +export class ProgramIndexView { asVersion(rawData, __errors__, version) { if (__errors__) { return { @@ -52,7 +52,7 @@ export class ApplicationIndexView { timestamp: timelineInfo.dt, }; - if (version === 'ApplicationIndexView@latest' || version === __VERSION__) { + if (version === 'ProgramIndexView@latest' || version === __VERSION__) { return { __VERSION__, pageData,