Unlike classical music listening applications it is an app where you pay for the number of music listening without paying a monthly fee ... https://www.loom.com/share/3f75552a65e84fe1a47209bc2b7d13da
- Create songs with song name, artist name, genre, description etc. fields. Then may modify, inactivate them.
- EDetermines and creates membership types.
- Creates membership, buy subscription types so buys the right to play songs. Also may checks/list songs, account details.
Name | Type |
---|---|
owner | AccountId |
artist | String |
songName | String |
Description | String |
albumName | String |
genre | String |
label | String |
country | String |
isActive | bool |
CreatedDate | Timestamp |
ModifiedDate | Timestamp |
DeletedDate | Timestamp |
Name | Type |
---|---|
owner | AccountId |
typeCode | String |
price | Money |
listenSongCount | i32 |
CreatedDate | Timestamp |
ModifiedDate | Timestamp |
DeletedDate | Timestamp |
Name | Type |
---|---|
owner | AccountId |
subscriptionType | i32 |
remainingListenSongCount | i32 |
CreatedDate | Timestamp |
ModifiedDate | Timestamp |
yarn
yarn build:release
near dev-deploy ./build/release/nearMusic.wasm
export CONTRACT=<AccountId>
echo $CONTRACT
near create-account <subAccName1>.<AccountName>.testnet --masterAccount <AccountName>.testnet --initialBalance 10
near create-account <subAccName2>.<AccountName>.testnet --masterAccount <AccountName>.testnet --initialBalance 10
near state <subAccName1>.<AccountName>.testnet
near state <subAccName2>.<AccountName>.testnet
near state <AccountName>.testnet
near send <AccountName>.testnet <subAccName1>.<AccountName>.testnet 10
near delete <subAccName1>.<AccountName>.testnet <AccountName>.testnet
near delete <subAccName2>.<AccountName>.testnet <AccountName>.testnet
Initializing
near call $CONTRACT init --accountId aysug.testnet
Adding Song
near call $CONTRACT addSong '{"artist":"Beyonce","songName":"Crazy in love","description":"feat JayZ","albumName":"Dangerous in love","genre":"R&B","label":"Sony Music","country":"USA"}' --accountId aysug.testnet
Modifying Song
near call $CONTRACT modifySong '{"songId":0,"artist":"Beyonce","songName":"Crazy in love","description":"feat JayZ MODIFIED","albumName":"Crazy in love","genre":"R&B","label":"Sony Music","country":"USA"}' --accountId aysug.testnet
Inactivating Song
near call $CONTRACT inactivateSong '{"songId":0}' --accountId aysug.testnet
Getting All Songs
near view $CONTRACT getAllSongs
Getting Songs With Parameters
near view $CONTRACT getSongsBySongId '{"songId":0}'
near view $CONTRACT getSongsByArtistName '{"artistName":"Beyonce"}'
near view $CONTRACT getSongsBySongName '{"songName":"Crazy in love"}'
near view $CONTRACT getSongsByAlbumName '{"albumName":"Crazy in love"}'
Creating Subscriber
near call $CONTRACT createSubscriber --accountId sub1.aysug.testnet
Buyying Subscription
near call $CONTRACT buySubscription '{"subscriberId":0,"subscriptionTypeId":0}' --accountId sub1.aysug.testnet --deposit 3
Getting All Subscribers
near view $CONTRACT getAllSubscribers
Getting Subscribers With Parameter
near view $CONTRACT getSubscribersBySubscriberId '{"subscriberId":0}'
near view $CONTRACT getSubscribersByAccountId '{"AccountId":"sub1.aysug.testnet"}'
Adding Subscription Type
near call $CONTRACT addSubscriptionType '{"typeCode":"Basic","price":"500000000000000000000000","listenSongCount":500}' --accountId aysug.testnet
Modifying Subscription Type
near call $CONTRACT modifySubscriptionType '{"subscriptionTypeId":3,"typeCode":"Old Type MODIFIED","price":"100000000000000000000000","listenSongCount":100}' --accountId aysug.testnet
Getting All Subscription Type
near view $CONTRACT getAllSubscriptionTypes '{}'
Getting All Subscription Type By Type Id
near view $CONTRACT getSubscriptionTypesByTypeID '{"subscriptionTypeId":2}'