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

Merge Feature/adapt-to-muzikie into development #58

Merged
merged 101 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
5f7a5ed
Add support for indexing subscription create
reyraa May 14, 2023
c4dacc8
Add subscriptions endpoint to gateway WIP
reyraa May 14, 2023
0df27b9
Add index logic for subscription:purchase
reyraa May 16, 2023
897cabe
Fix account indexing logoc of subscription:create
reyraa May 16, 2023
1385fdb
Add subscriptions to gateway
reyraa May 16, 2023
1d79973
Added data mapping
reyraa May 18, 2023
e5f2498
Store subscription NFT
reyraa May 21, 2023
4d8cb4b
fix the subscription endpoint data
reyraa May 24, 2023
3e7ed58
Fix event usage
reyraa May 24, 2023
52ca6c5
Clean logs and update unit tests
reyraa May 28, 2023
16b2524
Temporarily disable code coverage upload to codecov
reyraa May 28, 2023
5d4a42d
Merge pull request #7 from Muzikie/1-enable-service-to-support-the-co…
curvesy May 28, 2023
48f4767
Add subscription purchase logic
reyraa May 29, 2023
a2792d7
Move dev account to constants
reyraa May 29, 2023
54e4a73
Merge pull request #14 from Muzikie/8-add-support-for-indexing-subscr…
haghighatcs May 29, 2023
3e678ea
Fix the members indexing logic
reyraa May 31, 2023
b47ac15
Add Collection Indexing Part01
May 28, 2023
1ebc0df
Add collection to the gateway
curvesy May 29, 2023
4e700cd
Replace collection data service by subscription
May 30, 2023
5060b75
Fix databsae schema mispatch
reyraa May 31, 2023
04610b1
Fix data wiring issues
reyraa May 31, 2023
306e688
Fix event filtering mechanism
reyraa May 31, 2023
c3f59bd
Add getcolletions to the gateway known sources
reyraa May 31, 2023
cc8a4a3
Read the event name from constants
reyraa May 31, 2023
df0bf7e
Update unit tests
reyraa May 31, 2023
faa6d6d
Merge pull request #15 from Muzikie/13-1-Add-support-for-indexing-Col…
reyraa May 31, 2023
ff59df6
Add first modifications for CollectionAttributeSet
Jun 2, 2023
f5f3e5c
Second changes for collection setAttribute indexing
curvesy Jun 2, 2023
f04baba
Added updatedCollection function to applyTransactoin in SetAttribute …
curvesy Jun 3, 2023
8ac7a72
Fix underscrore_case name definition
reyraa Jun 3, 2023
05c9919
Merge pull request #16 from Muzikie/9-add-support-for-indexing-subscr…
reyraa Jun 3, 2023
2746a5b
Add support for indexing audio:create transactions
reyraa Jun 3, 2023
21a097e
Add featurng artist list
reyraa Jun 4, 2023
60ac7c7
Fix data wiring for audio
reyraa Jun 4, 2023
11fc3a3
Fix creatorAddress param pattern
reyraa Jun 4, 2023
8e108ca
Fix variable name to match the entity
reyraa Jun 4, 2023
cc6762b
Add support for audio:setAttribute transactions
reyraa Jun 4, 2023
952471a
Change the name of AttributeSet.js to SetAttribute.js in order to cor…
Jun 4, 2023
a10770e
Add Event Topic For Collection:Transfer Command
Jun 4, 2023
dc5a302
Add Index Transaction for Collection:Transfer Command
Jun 4, 2023
c72136c
Fix the command name (setAttributes)
reyraa Jun 5, 2023
100b520
Make creatorAddress required
reyraa Jun 5, 2023
60ef8ec
Fix typo (fit -> Feat)
reyraa Jun 5, 2023
37c09a2
Merge pull request #21 from Muzikie/20-add-support-for-indexing-audio…
reyraa Jun 5, 2023
de7b50d
Remove nonce from owners
reyraa Jun 5, 2023
e08df51
Add support for audio:transfer transactions
reyraa Jun 5, 2023
b0dab84
Update Collection:Transfer Indexing Feature
Jun 5, 2023
8977564
Merge branch 'feature/adapt-to-muzikie' into 23-Add-support-for-index…
curvesy Jun 5, 2023
cdd7ae6
Merge pull request #24 from Muzikie/23-Add-support-for-indexing-Trans…
haghighatcs Jun 5, 2023
48f8c6b
Created destroy file for indexing collection destroy transactions
curvesy Jun 5, 2023
0619b82
Merge pull request #25 from Muzikie/22-add-support-for-indexing-audio…
haghighatcs Jun 5, 2023
ed87502
Fix audio db schema according to the blockchain definitions
reyraa Jun 5, 2023
74865fb
Fix owners db schema according to the blockchain definitions
reyraa Jun 5, 2023
47546cf
Fix the use of owners properties in data retrieval
reyraa Jun 5, 2023
bcfc775
Improve audio:create to not process failed txs, and store owners corr…
reyraa Jun 5, 2023
e94cbce
Improve audio:setAttribute to not process failed txs, and account for…
reyraa Jun 5, 2023
9df2ecb
Improve audio:transfer to not process failed txs
reyraa Jun 5, 2023
bd23f2b
Add support for the audio:destroy command
reyraa Jun 5, 2023
b74d40e
Add trace level logging for collection destroy command
Jun 6, 2023
c12ee02
Merge pull request #29 from Muzikie/28-add-support-for-indexing-trans…
reyraa Jun 6, 2023
230f9a2
Merge pull request #31 from Muzikie/30-add-support-for-indexing-destr…
reyraa Jun 6, 2023
1ae1796
Add profile event constants to connector
Jun 6, 2023
7b45d0a
Add profile data service logic to indexer
Jun 6, 2023
1757937
Add profile database schema to indexer
Jun 6, 2023
f713856
Add profile transaction processor into indexer
Jun 6, 2023
a0ff73d
Add profile:create command support into gateway
Jun 6, 2023
3562ba2
Add support for indexing audio:streamed transactions
reyraa Jun 6, 2023
3a73730
Fix a mistake in profile/create.js that inserts data into the collect…
curvesy Jun 7, 2023
cff4508
Modify Social Accounts object in Profile schema
Jun 8, 2023
9c01da7
Modify Profile Schema & Indexer & DataService in order to write in DB…
Jun 9, 2023
9f15e0e
Correct linting error
Jun 9, 2023
2142f5f
Add social accounts schema to profile
Jun 10, 2023
66e44ab
Add audio reclaim command support
reyraa Jun 10, 2023
76c15aa
Remove the unnecessary find CollectionID from collectionTable in coll…
curvesy Jun 12, 2023
eb4de72
Merge pull request #34 from Muzikie/27-add-support-for-indexing-destr…
reyraa Jun 13, 2023
9060bdb
Fix issues with linting
Jun 13, 2023
93fc54f
Fix broken unit tests
reyraa Jun 13, 2023
a4e1834
Merge pull request #35 from Muzikie/10-add-support-for-indexing-profi…
reyraa Jun 13, 2023
4831911
Add Profile:SetAttribute Functionality
Jun 11, 2023
ebef060
Minor syntax adjustments
reyraa Jun 13, 2023
8b0f3d3
Merge pull request #38 from Muzikie/11-add-support-for-indexing-profi…
reyraa Jun 13, 2023
4a9a767
Merge branch 'feature/adapt-to-muzikie' into 32-add-support-for-index…
reyraa Jun 13, 2023
7e3bd16
Merge pull request #36 from Muzikie/32-add-support-for-indexing-strea…
reyraa Jun 13, 2023
4168a83
Merge branch 'feature/adapt-to-muzikie' into 26-add-support-for-index…
reyraa Jun 13, 2023
3421286
Merge pull request #44 from Muzikie/26-add-support-for-indexing-audio…
reyraa Jun 13, 2023
e27703f
Return audios by collectionID
curvesy Jun 25, 2023
2ed9c91
Return audios by ownerAddress
curvesy Jun 26, 2023
fd68a2c
Filter owner audios based on share greater than zero and fix the test…
curvesy Jun 27, 2023
461423f
Modify subscriptions to return active subscritions of a member
Jun 28, 2023
3d994d8
Modify subscriptions to filter by memberAddress
Jun 30, 2023
a8d1cb9
Fix concurrency condition
reyraa Jul 4, 2023
bb89c33
Merge pull request #49 from Muzikie/47-return-audios-by-collectionid-…
reyraa Jul 4, 2023
c86e774
Remove updateCollection function and use upsert to match the other co…
curvesy Jul 10, 2023
3f53692
Add limit and offset to the params
reyraa Jul 12, 2023
914a8f8
Return all entity parameters/values
reyraa Jul 12, 2023
d03b15f
Merge pull request #52 from Muzikie/46-return-subscriptions-by-member…
reyraa Jul 12, 2023
76e4920
Add offset and limit to the unit test models
reyraa Jul 12, 2023
c1f1867
Merge pull request #55 from Muzikie/54-the-audios-endpoint-doesnt-acc…
reyraa Jul 12, 2023
74e40d9
Fix social media storage
reyraa Jul 13, 2023
e25620c
Merge pull request #53 from Muzikie/39-fix-issues-discovered-with-col…
reyraa Jul 13, 2023
4aa637d
Merge pull request #57 from Muzikie/56-issue-updating-social-media-ac…
reyraa Jul 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .github/workflows/branch-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,3 @@ jobs:
run: make build-local
- name: Check test coverage
run: npm run test:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: coverage-final.json
name: codecov-umbrella
verbose: true
8 changes: 0 additions & 8 deletions .github/workflows/pr-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,3 @@ jobs:
run: make build-local
- name: Check test coverage
run: npm run test:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: coverage-final.json
name: codecov-umbrella
verbose: true
32 changes: 32 additions & 0 deletions services/blockchain-connector/shared/sdk/constants/eventTopics.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,22 @@ const {
MODULE_NAME_LEGACY,
EVENT_NAME_ACCOUNT_RECLAIMED,
EVENT_NAME_KEYS_REGISTERED,

MODULE_NAME_SUBSCRIPTION,
EVENT_NAME_SUBSCRIPTION_CREATED,
EVENT_NAME_SUBSCRIPTION_PURCHASED,

MODULE_NAME_COLLECTION,
EVENT_NAME_COLLECTION_CREATED,
EVENT_NAME_COLLECTION_TRANSFERED,

MODULE_NAME_AUDIO,
EVENT_NAME_AUDIO_CREATED,
EVENT_NAME_AUDIO_STREAMED,
EVENT_NAME_AUDIO_INCOME_RECLAIMED,

MODULE_NAME_PROFILE,
EVENT_NAME_PROFILE_CREATED,
} = require('./names');

const COMMAND_EXECUTION_RESULT_TOPICS = ['transactionID'];
Expand Down Expand Up @@ -140,6 +156,22 @@ const EVENT_TOPIC_MAPPINGS_BY_MODULE = {
[EVENT_NAME_ACCOUNT_RECLAIMED]: ['transactionID', 'legacyAddress', 'newAddress'],
[EVENT_NAME_KEYS_REGISTERED]: ['transactionID', 'validatorAddress', 'generatorKey', 'blsKey'],
},
[MODULE_NAME_SUBSCRIPTION]: {
[EVENT_NAME_SUBSCRIPTION_CREATED]: ['transactionID', 'senderAddress'],
[EVENT_NAME_SUBSCRIPTION_PURCHASED]: ['transactionID', 'senderAddress'],
},
[MODULE_NAME_COLLECTION]: {
[EVENT_NAME_COLLECTION_CREATED]: ['transactionID', 'senderAddress'],
[EVENT_NAME_COLLECTION_TRANSFERED]: ['transactionID', 'senderAddress'],
},
[MODULE_NAME_AUDIO]: {
[EVENT_NAME_AUDIO_CREATED]: ['transactionID', 'senderAddress'],
[EVENT_NAME_AUDIO_STREAMED]: ['transactionID', 'senderAddress'],
[EVENT_NAME_AUDIO_INCOME_RECLAIMED]: ['transactionID', 'senderAddress'],
},
[MODULE_NAME_PROFILE]: {
[EVENT_NAME_PROFILE_CREATED]: ['transactionID', 'senderAddress'],
},
};

module.exports = {
Expand Down
36 changes: 36 additions & 0 deletions services/blockchain-connector/shared/sdk/constants/names.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ const MODULE_NAME_LEGACY = 'legacy';
const EVENT_NAME_ACCOUNT_RECLAIMED = 'accountReclaimed';
const EVENT_NAME_KEYS_REGISTERED = 'keysRegistered';

// Subscription
const MODULE_NAME_SUBSCRIPTION = 'subscription';
const EVENT_NAME_SUBSCRIPTION_CREATED = 'subscriptionCreated';
const EVENT_NAME_SUBSCRIPTION_PURCHASED = 'subscriptionPurchased';

// Collection
const MODULE_NAME_COLLECTION = 'collection';
const EVENT_NAME_COLLECTION_CREATED = 'collectionCreated';
const EVENT_NAME_COLLECTION_TRANSFERED = 'collectionTransfered';

// Audios
const MODULE_NAME_AUDIO = 'audio';
const EVENT_NAME_AUDIO_CREATED = 'audioCreated';
const EVENT_NAME_AUDIO_STREAMED = 'audioStreamed';
const EVENT_NAME_AUDIO_INCOME_RECLAIMED = 'audioIncomeReclaimed';

// Profiles
const MODULE_NAME_PROFILE = 'profile';
const EVENT_NAME_PROFILE_CREATED = 'profileCreated';

module.exports = {
MODULE_NAME_AUTH,
EVENT_NAME_MULTISIGNATURE_REGISTERED,
Expand Down Expand Up @@ -146,4 +166,20 @@ module.exports = {
MODULE_NAME_LEGACY,
EVENT_NAME_ACCOUNT_RECLAIMED,
EVENT_NAME_KEYS_REGISTERED,

MODULE_NAME_SUBSCRIPTION,
EVENT_NAME_SUBSCRIPTION_CREATED,
EVENT_NAME_SUBSCRIPTION_PURCHASED,

MODULE_NAME_COLLECTION,
EVENT_NAME_COLLECTION_CREATED,
EVENT_NAME_COLLECTION_TRANSFERED,

MODULE_NAME_AUDIO,
EVENT_NAME_AUDIO_CREATED,
EVENT_NAME_AUDIO_STREAMED,
EVENT_NAME_AUDIO_INCOME_RECLAIMED,

MODULE_NAME_PROFILE,
EVENT_NAME_PROFILE_CREATED,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const {
HTTP: { StatusCodes: { BAD_REQUEST } },
Exceptions: { ValidationException, InvalidParamsException },
} = require('lisk-service-framework');

const dataService = require('../../../shared/dataService');

const getAudios = async params => {
const audios = {
data: [],
meta: {},
};

try {
const response = await dataService.getAudios(params);
if (response.data) audios.data = response.data;
if (response.meta) audios.meta = response.meta;

return audios;
} catch (err) {
let status;
if (err instanceof InvalidParamsException) status = 'INVALID_PARAMS';
if (err instanceof ValidationException) status = BAD_REQUEST;
if (status) return { status, data: { error: err.message } };
throw err;
}
};

module.exports = {
getAudios,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const {
HTTP: { StatusCodes: { BAD_REQUEST } },
Exceptions: { ValidationException, InvalidParamsException },
} = require('lisk-service-framework');

const dataService = require('../../../shared/dataService');

const getCollections = async params => {
const collections = {
data: [],
meta: {},
};

try {
const response = await dataService.getCollections(params);
if (response.data) collections.data = response.data;
if (response.meta) collections.meta = response.meta;

return collections;
} catch (err) {
let status;
if (err instanceof InvalidParamsException) status = 'INVALID_PARAMS';
if (err instanceof ValidationException) status = BAD_REQUEST;
if (status) return { status, data: { error: err.message } };
throw err;
}
};

module.exports = {
getCollections,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const {
HTTP: { StatusCodes: { BAD_REQUEST } },
Exceptions: { ValidationException, InvalidParamsException },
} = require('lisk-service-framework');

const dataService = require('../../../shared/dataService');

const getProfiles = async params => {
const profiles = {
data: [],
meta: {},
};

try {
const response = await dataService.getProfiles(params);
if (response.data) profiles.data = response.data;
if (response.meta) profiles.meta = response.meta;

return profiles;
} catch (err) {
let status;
if (err instanceof InvalidParamsException) status = 'INVALID_PARAMS';
if (err instanceof ValidationException) status = BAD_REQUEST;
if (status) return { status, data: { error: err.message } };
throw err;
}
};

module.exports = {
getProfiles,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const {
HTTP: { StatusCodes: { BAD_REQUEST } },
Exceptions: { ValidationException, InvalidParamsException },
} = require('lisk-service-framework');

const dataService = require('../../../shared/dataService');

const getSubscriptions = async params => {
const subscriptions = {
data: [],
meta: {},
};

try {
const response = await dataService.getSubscriptions(params);
if (response.data) subscriptions.data = response.data;
if (response.meta) subscriptions.meta = response.meta;

return subscriptions;
} catch (err) {
let status;
if (err instanceof InvalidParamsException) status = 'INVALID_PARAMS';
if (err instanceof ValidationException) status = BAD_REQUEST;
if (status) return { status, data: { error: err.message } };
throw err;
}
};

module.exports = {
getSubscriptions,
};
16 changes: 16 additions & 0 deletions services/blockchain-indexer/methods/dataService/modules/audio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const {
getAudios,
} = require('../controllers/audios');

module.exports = [
{
name: 'audios',
controller: getAudios,
params: {
creatorAddress: { optional: true, type: 'string' },
audioID: { optional: true, type: 'string' },
limit: { optional: true, type: 'number' },
offset: { optional: true, type: 'number' },
},
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const {
getCollections,
} = require('../controllers/collections');

module.exports = [
{
name: 'collections',
controller: getCollections,
params: {
creatorAddress: { optional: true, type: 'string' },
collectionID: { optional: true, type: 'string' },
limit: { optional: true, type: 'number' },
offset: { optional: true, type: 'number' },
},
},
];
16 changes: 16 additions & 0 deletions services/blockchain-indexer/methods/dataService/modules/profile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const {
getProfiles,
} = require('../controllers/profiles');

module.exports = [
{
name: 'profiles',
controller: getProfiles,
params: {
creatorAddress: { optional: true, type: 'string' },
profileID: { optional: true, type: 'string' },
limit: { optional: true, type: 'number' },
offset: { optional: true, type: 'number' },
},
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const {
getSubscriptions,
} = require('../controllers/subscriptions');

module.exports = [
{
name: 'subscriptions',
controller: getSubscriptions,
params: {
creatorAddress: { optional: true, type: 'string' },
subscriptionID: { optional: true, type: 'string' },
limit: { optional: true, type: 'number' },
offset: { optional: true, type: 'number' },
memberAddress: { optional: true, type: 'string' },
},
},
];
4 changes: 4 additions & 0 deletions services/blockchain-indexer/shared/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ const TRANSACTION_VERIFY_RESULT = {
OK: 1,
};

// @todo retrieve this from Core
const DEV_ADDRESS = 'lskh96jgzfftzff2fta2zvsmba9mvs5cnz9ahr3ke';

module.exports = {
updateFinalizedHeight,
getFinalizedHeight,
Expand All @@ -155,4 +158,5 @@ module.exports = {
KV_STORE_KEY,
TRANSACTION_STATUS,
TRANSACTION_VERIFY_RESULT,
DEV_ADDRESS,
};
22 changes: 22 additions & 0 deletions services/blockchain-indexer/shared/dataService/audios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const { Logger } = require('lisk-service-framework');
const util = require('util');

const logger = Logger();

const business = require('./business');

const getAudios = async params => {
// Store logs
if (params.audioID) logger.debug(`Retrieved audio with ID ${params.audioID} from Lisk Core`);
else if (params.creatorAddress) logger.debug(`Retrieved audio with creatorAddress: ${params.creatorAddress} from Lisk Core`);
else logger.debug(`Retrieved audios with custom search: ${util.inspect(params)} from Lisk Core`);

// Get data from server
const response = await business.getAudios(params);

return response;
};

module.exports = {
getAudios,
};
Loading