Skip to content

Commit

Permalink
Bump to 0.7.0-rc5 and regen dist/docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cag committed Dec 19, 2017
1 parent 7a24ded commit 1085ae6
Show file tree
Hide file tree
Showing 16 changed files with 2,106 additions and 1,696 deletions.
3,557 changes: 1,925 additions & 1,632 deletions dist/gnosis.js

Large diffs are not rendered by default.

64 changes: 50 additions & 14 deletions docs/Gnosis.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ <h4 class="name" id="contracts"><span class="type-signature"></span>contracts<sp

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line95">line 95</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line100">line 100</a>
</li></ul></dd>


Expand Down Expand Up @@ -294,7 +294,7 @@ <h4 class="name" id="defaultAccount"><span class="type-signature"></span>default

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line251">line 251</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line256">line 256</a>
</li></ul></dd>


Expand Down Expand Up @@ -368,7 +368,7 @@ <h4 class="name" id="etherToken"><span class="type-signature"></span>etherToken<

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line208">line 208</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line213">line 213</a>
</li></ul></dd>


Expand Down Expand Up @@ -442,7 +442,7 @@ <h4 class="name" id="lmsrMarketMaker"><span class="type-signature"></span>lmsrMa

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line222">line 222</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line227">line 227</a>
</li></ul></dd>


Expand Down Expand Up @@ -516,7 +516,7 @@ <h4 class="name" id="olympiaToken"><span class="type-signature"></span>olympiaTo

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line229">line 229</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line234">line 234</a>
</li></ul></dd>


Expand Down Expand Up @@ -590,7 +590,7 @@ <h4 class="name" id="standardMarketFactory"><span class="type-signature"></span>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line215">line 215</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line220">line 220</a>
</li></ul></dd>


Expand Down Expand Up @@ -1755,7 +1755,7 @@ <h4 class="name" id=".create"><span class="type-signature">(static) </span>creat

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line73">line 73</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line74">line 74</a>
</li></ul></dd>


Expand Down Expand Up @@ -2064,6 +2064,42 @@ <h5>Parameters:</h5>
</tr>



<tr>

<td class="name"><code>opts.logger</code></td>


<td class="type">


<span class="param-type"><code>function</code></span>



</td>


<td class="attributes">

&lt;optional><br>





</td>




<td class="description last">
<p>A callback for logging. Can also provide 'console' to use <code>console.log</code>.</p>

</td>
</tr>


</tbody>
</table>

Expand Down Expand Up @@ -2347,7 +2383,7 @@ <h4 class="name" id="buyOutcomeTokens"><span class="type-signature"></span>buyOu

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="markets.js.html">markets.js</a>, <a href="markets.js.html#line53">line 53</a>
<a href="markets.js.html">markets.js</a>, <a href="markets.js.html#line83">line 83</a>
</li></ul></dd>


Expand Down Expand Up @@ -3267,7 +3303,7 @@ <h4 class="name" id="createMarket"><span class="type-signature"></span>createMar

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="markets.js.html">markets.js</a>, <a href="markets.js.html#line21">line 21</a>
<a href="markets.js.html">markets.js</a>, <a href="markets.js.html#line23">line 23</a>
</li></ul></dd>


Expand Down Expand Up @@ -4155,7 +4191,7 @@ <h4 class="name" id="loadEventDescription"><span class="type-signature"></span>l

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="events.js.html">events.js</a>, <a href="events.js.html#line71">line 71</a>
<a href="events.js.html">events.js</a>, <a href="events.js.html#line73">line 73</a>
</li></ul></dd>


Expand Down Expand Up @@ -4606,7 +4642,7 @@ <h4 class="name" id="resolveEvent"><span class="type-signature"></span>resolveEv

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="events.js.html">events.js</a>, <a href="events.js.html#line84">line 84</a>
<a href="events.js.html">events.js</a>, <a href="events.js.html#line86">line 86</a>
</li></ul></dd>


Expand Down Expand Up @@ -4779,7 +4815,7 @@ <h4 class="name" id="sellOutcomeTokens"><span class="type-signature"></span>sell

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="markets.js.html">markets.js</a>, <a href="markets.js.html#line152">line 152</a>
<a href="markets.js.html">markets.js</a>, <a href="markets.js.html#line184">line 184</a>
</li></ul></dd>


Expand Down Expand Up @@ -5313,7 +5349,7 @@ <h4 class="name" id="setWeb3Provider"><span class="type-signature"></span>setWeb

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line172">line 172</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line177">line 177</a>
</li></ul></dd>


Expand Down Expand Up @@ -5468,7 +5504,7 @@ <h5>Parameters:</h5>
<br class="clear">

<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Dec 17 2017 23:32:58 GMT-0600 (CST) using the Minami theme.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Dec 19 2017 15:29:49 GMT-0600 (CST) using the Minami theme.
</footer>

<script>hljs.initHighlightingOnLoad();</script>
Expand Down
6 changes: 4 additions & 2 deletions docs/events.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ <h1 class="page-title">events.js</h1>
* @alias Gnosis#publishEventDescription
*/
export async function publishEventDescription (description) {
return await this.ipfs.addJSONAsync(description)
const resultHash = await this.ipfs.addJSONAsync(description)
this.log(`published event description on IPFS at ${resultHash}`)
return resultHash
}

/**
Expand Down Expand Up @@ -159,7 +161,7 @@ <h1 class="page-title">events.js</h1>
<br class="clear">

<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Dec 17 2017 23:32:58 GMT-0600 (CST) using the Minami theme.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Dec 19 2017 15:29:49 GMT-0600 (CST) using the Minami theme.
</footer>

<script>hljs.initHighlightingOnLoad();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h3>Gas estimations</h3><p>Many of the methods on the gnosis API also have an as
<br class="clear">

<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Dec 17 2017 23:32:58 GMT-0600 (CST) using the Minami theme.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Dec 19 2017 15:29:49 GMT-0600 (CST) using the Minami theme.
</footer>

<script>hljs.initHighlightingOnLoad();</script>
Expand Down
7 changes: 6 additions & 1 deletion docs/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ <h1 class="page-title">index.js</h1>
* @param {string} [opts.ipfs.host='ipfs.infura.io'] - IPFS node address
* @param {Number} [opts.ipfs.port=5001] - IPFS protocol port
* @param {string} [opts.ipfs.protocol='https'] - IPFS protocol name
* @param {Function} [opts.logger] - A callback for logging. Can also provide 'console' to use `console.log`.
* @returns {Gnosis} An instance of the gnosis.js API
*/
static async create (opts) {
Expand All @@ -132,6 +133,10 @@ <h1 class="page-title">index.js</h1>
* @constructor
*/
constructor (opts) {
// Logger setup
const { logger } = opts
this.log = logger == null ? () => {} : logger === 'console' ? console.log : logger

// IPFS instantiation
this.ipfs = utils.promisifyAll(new IPFS(opts.ipfs))

Expand Down Expand Up @@ -321,7 +326,7 @@ <h1 class="page-title">index.js</h1>
<br class="clear">

<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Dec 17 2017 23:32:58 GMT-0600 (CST) using the Minami theme.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Dec 19 2017 15:29:49 GMT-0600 (CST) using the Minami theme.
</footer>

<script>hljs.initHighlightingOnLoad();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/lmsr.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ <h1 class="page-title">lmsr.js</h1>
<br class="clear">

<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Dec 17 2017 23:32:58 GMT-0600 (CST) using the Minami theme.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Dec 19 2017 15:29:49 GMT-0600 (CST) using the Minami theme.
</footer>

<script>hljs.initHighlightingOnLoad();</script>
Expand Down
80 changes: 57 additions & 23 deletions docs/markets.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ <h1 class="page-title">markets.js</h1>
normalizeWeb3Args,
wrapWeb3Function,
requireEventFromTXResult,
formatCallSignature,
TransactionError,
} from './utils'

/**
Expand Down Expand Up @@ -73,6 +75,34 @@ <h1 class="page-title">markets.js</h1>
}
}))

const pushDescribedTransaction = async (txInfo, log, opts) => {
const { caller, methodName, methodArgs } = opts
let txHash
try {
txHash = await caller[methodName].sendTransaction(...methodArgs)
log(`got tx hash ${txHash} for call ${
formatCallSignature(opts)
}`)
txInfo.push(Object.assign({ txHash }, opts))
} catch(subError) {
throw new TransactionError(Object.assign({ txHash, subError }, opts))
}
}

const syncDescribedTransactions = async (txInfo, log) =>
(await Promise.all(
txInfo.map(opts => opts.caller.constructor
.syncTransaction(opts.txHash)
.then(res => {
log(`tx ${opts.txHash} synced`)
return res
})
.catch(err =>
new TransactionError(Object.assign({ subError: err }, opts))
)
)
)).map((res, i) => requireEventFromTXResult(res, txInfo[i].requiredEventName))

/**
* Buys outcome tokens. If you have ether and plan on transacting with a market on an event which
* uses EtherToken as collateral, be sure to convert the ether into EtherToken by sending ether to
Expand Down Expand Up @@ -137,28 +167,30 @@ <h1 class="page-title">markets.js</h1>
const marketAllowance = await collateralToken.allowance(buyer, marketAddress, opts)

if(marketAllowance.lt(cost)) {
txInfo.push({
tx: await collateralToken.approve.sendTransaction(marketAddress, approvalResetAmount, approveTxOpts),
contract: this.contracts.Token,
await pushDescribedTransaction(txInfo, this.log, {
caller: collateralToken,
methodName: 'approve',
methodArgs: [marketAddress, approvalResetAmount, approveTxOpts],
requiredEventName: 'Approval',
})
}
} else if(this.web3.toBigNumber(0).lt(approvalAmount)) {
txInfo.push({
tx: await collateralToken.approve.sendTransaction(marketAddress, approvalAmount, approveTxOpts),
contract: this.contracts.Token,
await pushDescribedTransaction(txInfo, this.log, {
caller: collateralToken,
methodName: 'approve',
methodArgs: [marketAddress, approvalAmount, approveTxOpts],
requiredEventName: 'Approval',
})
}

txInfo.push({
tx: await market.buy.sendTransaction(outcomeTokenIndex, outcomeTokenCount, cost, buyTxOpts),
contract: this.contracts.Market,
await pushDescribedTransaction(txInfo, this.log, {
caller: market,
methodName: 'buy',
methodArgs: [outcomeTokenIndex, outcomeTokenCount, cost, buyTxOpts],
requiredEventName: 'OutcomeTokenPurchase',
})

const txRequiredEvents = (await Promise.all(txInfo.map(({ tx, contract }, i) => contract.syncTransaction(tx))))
.map((res, i) => requireEventFromTXResult(res, txInfo[i].requiredEventName))
const txRequiredEvents = await syncDescribedTransactions(txInfo, this.log)
const purchaseEvent = txRequiredEvents[txRequiredEvents.length - 1]

return purchaseEvent.args.outcomeTokenCost.plus(purchaseEvent.args.marketFees)
Expand Down Expand Up @@ -236,28 +268,30 @@ <h1 class="page-title">markets.js</h1>
const marketAllowance = await outcomeToken.allowance(seller, marketAddress, opts)

if(marketAllowance.lt(outcomeTokenCount)) {
txInfo.push({
tx: await outcomeToken.approve.sendTransaction(marketAddress, approvalResetAmount, approveTxOpts),
contract: this.contracts.Token,
await pushDescribedTransaction(txInfo, this.log, {
caller: outcomeToken,
methodName: 'approve',
methodArgs: [marketAddress, approvalResetAmount, approveTxOpts],
requiredEventName: 'Approval',
})
}
} else if(this.web3.toBigNumber(0).lt(approvalAmount)) {
txInfo.push({
tx: await outcomeToken.approve.sendTransaction(marketAddress, approvalAmount, approveTxOpts),
contract: this.contracts.Token,
await pushDescribedTransaction(txInfo, this.log, {
caller: outcomeToken,
methodName: 'approve',
methodArgs: [marketAddress, approvalAmount, approveTxOpts],
requiredEventName: 'Approval',
})
}

txInfo.push({
tx: await market.sell.sendTransaction(outcomeTokenIndex, outcomeTokenCount, minProfit, sellTxOpts),
contract: this.contracts.Market,
await pushDescribedTransaction(txInfo, this.log, {
caller: market,
methodName: 'sell',
methodArgs: [outcomeTokenIndex, outcomeTokenCount, minProfit, sellTxOpts],
requiredEventName: 'OutcomeTokenSale',
})

const txRequiredEvents = (await Promise.all(txInfo.map(({ tx, contract }, i) => contract.syncTransaction(tx))))
.map((res, i) => requireEventFromTXResult(res, txInfo[i].requiredEventName))
const txRequiredEvents = await syncDescribedTransactions(txInfo, this.log)
const saleEvent = txRequiredEvents[txRequiredEvents.length - 1]

return saleEvent.args.outcomeTokenProfit.minus(saleEvent.args.marketFees)
Expand All @@ -282,7 +316,7 @@ <h1 class="page-title">markets.js</h1>
<br class="clear">

<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Dec 17 2017 23:32:58 GMT-0600 (CST) using the Minami theme.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Dec 19 2017 15:29:49 GMT-0600 (CST) using the Minami theme.
</footer>

<script>hljs.initHighlightingOnLoad();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/oracles.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h1 class="page-title">oracles.js</h1>
<br class="clear">

<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Dec 17 2017 23:32:58 GMT-0600 (CST) using the Minami theme.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Dec 19 2017 15:29:49 GMT-0600 (CST) using the Minami theme.
</footer>

<script>hljs.initHighlightingOnLoad();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial-api-overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ <h1 class="page-title">API Overview</h1>
<br class="clear">

<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Dec 17 2017 23:32:58 GMT-0600 (CST) using the Minami theme.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Dec 19 2017 15:29:49 GMT-0600 (CST) using the Minami theme.
</footer>

<script>hljs.initHighlightingOnLoad();</script>
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial-developer-guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h1 class="page-title">Developer Guide</h1>
<br class="clear">

<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Dec 17 2017 23:32:58 GMT-0600 (CST) using the Minami theme.
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue Dec 19 2017 15:29:49 GMT-0600 (CST) using the Minami theme.
</footer>

<script>hljs.initHighlightingOnLoad();</script>
Expand Down
Loading

0 comments on commit 1085ae6

Please sign in to comment.