コード例 #1
0
        public async Task <string> DeployContractToModernAsync(string workHash, string workTitle, string coverImageHash,
                                                               string artistName, string genre)
        {
            var contract = await DeployContractAsync();

            var web3 = await CreateNewWeb3Instance();

            var workService = new WorkService(web3, contract);
            var keys        = new[]
            {
                WorkSchema.name, WorkSchema.audio, WorkSchema.genre, WorkSchema.image,
                WorkSchema.creator
            };

            var values = string.Join("|", workTitle, workHash, genre, coverImageHash, artistName);

            await workService.BulkSetValueAsync(Account, keys, values, true, DefaultGas);

            return(contract);
        }
コード例 #2
0
        public async Task <string> UpdateMetadataWithMockUpFields(string workHash, string workTitle, string coverImageHash,
                                                                  string artistNameAddress, string genre, string contract)
        {
            var web3 = await CreateNewWeb3Instance();

            var workService = new WorkService(web3, contract);
            var keys        = new[] { WorkSchema.name,
                                      WorkSchema.image,
                                      WorkSchema.audio,
                                      WorkSchema.genre,
                                      WorkSchema.keywords,
                                      WorkSchema.byArtist,
                                      WorkSchema.featuredArtist1,
                                      WorkSchema.featuredArtist2,
                                      WorkSchema.featuredArtist3,
                                      WorkSchema.featuredArtist4,
                                      WorkSchema.featuredArtist5,
                                      WorkSchema.featuredArtist6,
                                      WorkSchema.featuredArtist7,
                                      WorkSchema.featuredArtist8,
                                      WorkSchema.featuredArtist9,
                                      WorkSchema.featuredArtist10,
                                      WorkSchema.featuredArtistRole1,
                                      WorkSchema.featuredArtistRole2,
                                      WorkSchema.featuredArtistRole3,
                                      WorkSchema.featuredArtistRole4,
                                      WorkSchema.featuredArtistRole5,
                                      WorkSchema.featuredArtistRole6,
                                      WorkSchema.featuredArtistRole7,
                                      WorkSchema.featuredArtistRole8,
                                      WorkSchema.featuredArtistRole9,
                                      WorkSchema.featuredArtistRole10,
                                      WorkSchema.contributingArtist1,
                                      WorkSchema.contributingArtist2,
                                      WorkSchema.contributingArtist3,
                                      WorkSchema.contributingArtist4,
                                      WorkSchema.contributingArtist5,
                                      WorkSchema.contributingArtist6,
                                      WorkSchema.contributingArtist7,
                                      WorkSchema.contributingArtist8,
                                      WorkSchema.contributingArtist9,
                                      WorkSchema.contributingArtist10, };

            var keys2 = new[] {
                WorkSchema.contributingArtistRole1,
                WorkSchema.contributingArtistRole2,
                WorkSchema.contributingArtistRole3,
                WorkSchema.contributingArtistRole4,
                WorkSchema.contributingArtistRole5,
                WorkSchema.contributingArtistRole6,
                WorkSchema.contributingArtistRole7,
                WorkSchema.contributingArtistRole8,
                WorkSchema.contributingArtistRole9,
                WorkSchema.contributingArtistRole10,
                WorkSchema.performingArtist1,
                WorkSchema.performingArtist2,
                WorkSchema.performingArtist3,
                WorkSchema.performingArtist4,
                WorkSchema.performingArtist5,
                WorkSchema.performingArtist6,
                WorkSchema.performingArtist7,
                WorkSchema.performingArtist8,
                WorkSchema.performingArtist9,
                WorkSchema.performingArtist10,
                WorkSchema.performingArtistRole1,
                WorkSchema.performingArtistRole2,
                WorkSchema.performingArtistRole3,
                WorkSchema.performingArtistRole4,
                WorkSchema.performingArtistRole5,
                WorkSchema.performingArtistRole6,
                WorkSchema.performingArtistRole7,
                WorkSchema.performingArtistRole8,
                WorkSchema.performingArtistRole9,
                WorkSchema.performingArtistRole10,
                WorkSchema.label,
                WorkSchema.description,
                WorkSchema.publisher,
                WorkSchema.hasPartOf,
                WorkSchema.isPartOf,
                WorkSchema.isFamilyFriendly,
                WorkSchema.license,
                WorkSchema.iswcCode
            };
            string values  = GetValues(workHash, workTitle, coverImageHash, artistNameAddress, genre, keys);
            string values2 = GetValues(workHash, workTitle, coverImageHash, artistNameAddress, genre, keys2);

            var transactionhelper = new TransactionHelpers();
            var tx1 = await workService.BulkSetValueAsync(Account, keys, values, true, DefaultGas);

            var receipt = await transactionhelper.GetTransactionReceipt(web3, tx1);

            var tx2 = await workService.BulkSetValueAsync(Account, keys2, values2, true, DefaultGas);

            var receipt2 = await transactionhelper.GetTransactionReceipt(web3, tx2);

            //ensure nonces are in order by waiting to be mined.
            return(contract);
        }