Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

ocean protocol react sample tutorial

<span class="token keyword">async</span> <span class="token function">componentDidMount</span> <span class="token punctuation">(</span> <span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">const</span> ocean <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token keyword">new</span> <span class="token class-name">Ocean <span class="token punctuation">.</span> getInstance</span> <span class="token punctuation">(</span> <span class="token punctuation">{</span>
      web3Provider <span class="token punctuation">:</span> web3 <span class="token punctuation">,</span>
      nodeUri <span class="token punctuation">:</span> <span class="token string">'https://nile.dev-ocean.com'</span> <span class="token punctuation">,</span>
      aquariusUri <span class="token punctuation">:</span> <span class="token string">'https://aquarius.marketplace.dev-ocean.com'</span> <span class="token punctuation">,</span>
      brizoUri <span class="token punctuation">:</span> <span class="token string">'https://brizo.marketplace.dev-ocean.com'</span> <span class="token punctuation">,</span>
      brizoAddress <span class="token punctuation">:</span> <span class="token string">'0x4aaab179035dc57b35e2ce066919048686f82972'</span> <span class="token punctuation">,</span>
      secretStoreUri <span class="token punctuation">:</span> <span class="token string">'https://secret-store.nile.dev-ocean.com'</span> <span class="token punctuation">,</span>
      <span class="token comment">// local Spree connection</span>
      <span class="token comment">// nodeUri: 'http://localhost:8545',</span>
      <span class="token comment">// aquariusUri: 'http://aquarius:5000',</span>
      <span class="token comment">// brizoUri: 'http://localhost:8030',</span>
      <span class="token comment">// brizoAddress: '0x00bd138abd70e2f00903268f3db08f2d25677c9e',</span>
      <span class="token comment">// secretStoreUri: 'http://localhost:12001',</span>
      verbose <span class="token punctuation">:</span> <span class="token boolean">true</span>
    <span class="token punctuation">}</span> <span class="token punctuation">)</span>
    <span class="token keyword">this</span> <span class="token punctuation">.</span> <span class="token function">setState</span> <span class="token punctuation">(</span> <span class="token punctuation">{</span> ocean <span class="token punctuation">}</span> <span class="token punctuation">)</span>
    console <span class="token punctuation">.</span> <span class="token function">log</span> <span class="token punctuation">(</span> <span class="token string">'Finished loading contracts.'</span> <span class="token punctuation">)</span>
  <span class="token punctuation">}</span>
 
Source by itzone.com.vn #
 
PREVIOUS NEXT
Tagged: #ocean #protocol #react #sample #tutorial
ADD COMMENT
Topic
Name
6+7 =