Skip to content

Commit

Permalink
API docs, reorg (esp. RholangCrypto) (WIP)
Browse files Browse the repository at this point in the history
API top level now fits in a short list:

 - RHOCore
 - RegistryProxy
 - RevAddress
 - Ed25519keyPair
 - RNode
 - RholangCrypto
 - SignDeployment

  - test doc examples with markdown-doctest
    - include markdown-doctest with test script
    - setup config
      - lint un-ignore pattern
    - fix README example
    - add ed25519Verify example
  - rnodeAPI:
    - deprecate listenForDataAtPublicName etc.
    - move unforgeable name manipulation to RHOCore
    - fix (documented) names of SignDeployment.sign, verify
    - send: fix error handling logic
  - proxy: leave rhoCall undocumented
  - factor out runRholang (WIP)
  - assets: leave link() undocumented
  - tests: add flow, lint; import api consistently
    - export type JsonExt<T>
  • Loading branch information
dckc committed Apr 12, 2019
1 parent a51cd4a commit 027aca3
Show file tree
Hide file tree
Showing 19 changed files with 561 additions and 165 deletions.
27 changes: 27 additions & 0 deletions .markdown-doctest-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* global module, require */

const assert = require('assert');
const rchain = require('.');
const { RholangCrypto, RNode, Hex } = rchain;

// mock enough of grpc
// ISSUE: refactor overlap with test/testRNode.js
function DeployService(_hostPort, _chan) {
return Object.freeze({
doDeploy(_dd, _auto = false) { return 'Success!'; }
});
}
const casper = { DeployService };
const proto = { coop: { rchain: { casper: { protocol: casper } } } };
const grpc = {
loadPackageDefinition(_d) { return proto; },
credentials: { createInsecure() { } },
};

module.exports = {
babel: false,
globals: {
RholangCrypto, RNode, Hex, grpc,
assert,
},
};
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ doDeploy result: { success: true, message: 'Success!' }
There are not yet nice truffle-style build tools, so you will probably deploy your code directly using the `rnode deploy` thin client or using RChain-API itself.

```javascript
const myNode = RNode('localhost', 40401);
rchain.doDeploy({
const myNode = RNode(grpc, { host: 'localhost', port: 40401 });
myNode.doDeploy({
term: '@"aliceUpdates"!("Having fun traveling!")',
timestamp: clock().valueOf(),
// from: '0x1',
// nonce: 0,
timestamp: new Date().valueOf(),
phloLimit: 1000000,
phloPrice: 1,
})
```

Expand All @@ -71,7 +71,7 @@ rchain.doDeploy({


## License
Copyright 2018 RChain Cooperative
Copyright 2018-2019 RChain Cooperative

Apache 2.0 License (See LICENSE.txt)

Expand Down
19 changes: 13 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

const RHOCore = require('./src/RHOCore');

/*::
export type JsonExt<T> = JsonExt<T>;
*/

exports.RHOCore = RHOCore;


Expand All @@ -24,19 +28,22 @@ exports.RNode = RNode;
exports.SignDeployment = SignDeployment;
exports.Block = Block;

exports.RegistryProxy = require('./src/proxy');
/**
* Proxy method calls to registered RChain channels.
*/
const RegistryProxy = require('./src/proxy');

exports.RegistryProxy = RegistryProxy;

/*::
export type Signature = Signature;
export type PrivateKey = PrivateKey;
export type PublicKey = PublicKey;
*/
const { Ed25519, Blake2b256, SHA256, Keccak256 } = require('./src/signing');
const { Ed25519keyPair, RholangCrypto } = require('./src/signing');

exports.Ed25519 = Ed25519;
exports.Blake2b256 = Blake2b256;
exports.SHA256 = SHA256;
exports.Keccak256 = Keccak256;
exports.Ed25519keyPair = Ed25519keyPair;
exports.RholangCrypto = RholangCrypto;

/*::
export type HexStr<T> = HexStr<T>;
Expand Down
Loading

0 comments on commit 027aca3

Please sign in to comment.