Skip to content

Commit

Permalink
Flow Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewKishino committed Mar 11, 2019
1 parent e1003cb commit 591f543
Show file tree
Hide file tree
Showing 44 changed files with 9,173 additions and 704 deletions.
5 changes: 4 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"presets": ["@babel/preset-env"],
"presets": [
"@babel/preset-env",
"@babel/preset-flow"
],
"plugins": []
}
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
node_modules/**
dist/**
dist-server/**
coverage/**
14 changes: 13 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"extends": "airbnb-base",
"extends": [
"airbnb-base",
"plugin:flowtype/recommended"
],
"parser": "babel-eslint",
"plugins": [
"flowtype"
],
"env": {
"browser": true,
"node": true,
Expand All @@ -19,5 +26,10 @@
"no-cond-assign": 0,
"no-plusplus": 0,
"no-use-before-define": 0
},
"settings": {
"flowtype": {
"onlyFilesWithFlowAnnotation": true
}
}
}
8 changes: 8 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[ignore]
.*/node_modules/.*

[include]
src/sotez.js

[libs]
flow-typed
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ before_install:
- sudo apt-get install -y libudev-dev libusb-1.0-0-dev
jobs:
include:
- stage: Lint
script: npm run flow:check

- stage: Test
script: npm run test

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Sotez - A JS Library for Tezos
![npm](https://img.shields.io/npm/v/sotez.svg?logo=npm&color=blue)
[![Build Status](https://travis-ci.org/AndrewKishino/sotez.svg?branch=master)](https://travis-ci.org/AndrewKishino/sotez)

# Getting Started
Expand Down
660 changes: 331 additions & 329 deletions dist/sotez.browser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/sotez.browser.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/sotez.node.js

Large diffs are not rendered by default.

56 changes: 15 additions & 41 deletions docs/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Enable additional logging by enabling debug mode
node.setDebugMode(true);
```

Returns **void**

### setProvider

Set a new default provider
Expand All @@ -44,6 +46,8 @@ Reset the provider to the default provider
node.resetProvider();
```

Returns **void**

### query

Queries a node given a path and payload
Expand All @@ -68,14 +72,6 @@ Returns **[Promise][3]** The response of the query



### setForgeLocal

Sets the forging strategy to either local or remote

#### Parameters

- `useLocal` **[Boolean][2]** Forge strategy true - local | false - remote (optional, default `true`)

### setLocalForgeValidation

Whether to validate locally forged operations against remotely forged operations
Expand All @@ -84,6 +80,8 @@ Whether to validate locally forged operations against remotely forged operations

- `localValidation` **[Boolean][2]** Validate local forge (optional, default `false`)

Returns **void**

### account

Originate a new account
Expand Down Expand Up @@ -191,17 +189,17 @@ rpc.getBaker('tz1fXdNLZ4jrkjtgJWMcfeNpFDK9mbCBsaV4')
frozen_balance,
frozen_balance_by_cycle,
staking_balance,
delegated_contracts
delegated_balance
delegated_contracts,
delegated_balance,
deactivated,
grace_period,
}) => console.log(
balance,
frozen_balance,
frozen_balance_by_cycle,
staking_balance,
delegated_contracts
delegated_balance
delegated_contracts,
delegated_balance,
deactivated,
grace_period,
))
Expand Down Expand Up @@ -519,8 +517,8 @@ Transfer operation
- `paramObject.keys` **[Object][4]?** The keys for which to originate the account. If using a ledger, this is optional
- `paramObject.to` **[String][1]** The address of the recipient
- `paramObject.amount` **[Number][5]** The amount in tez to transfer for the initial balance
- `paramObject.fee` **[Number][5]** The fee to set for the transaction (optional, default `1278`)
- `paramObject.parameter` **[String][1]** The parameter for the transaction (optional, default `false`)
- `paramObject.fee` **[Number][5]** The fee to set for the transaction (optional, default `1278`)
- `paramObject.gasLimit` **[Number][5]** The gas limit to set for the transaction (optional, default `10100`)
- `paramObject.storageLimit` **[Number][5]** The storage limit to set for the transaction (optional, default `0`)
- `paramObject.mutez` **[Number][5]** Whether the input amount is set to mutez (1/1,000,000 tez) (optional, default `false`)
Expand Down Expand Up @@ -735,30 +733,6 @@ Watch a contract's storage based on a given interval
Returns **[Object][4]** The setInterval object
### send
Send to contract
#### Parameters
- `paramObject` **[Object][4]** The parameters for the operation
- `paramObject.to` **[String][1]** The address of the recipient
- `paramObject.from` **[Object][4]** The address sending the operation
- `paramObject.keys` **[Object][4]?** The keys for which to originate the account. If using a ledger, this is optional
- `paramObject.amount` **[Number][5]** The amount in tez to transfer for the initial balance
- `paramObject.parameter` **[String][1]** The parameter for the transaction
- `paramObject.fee` **[Number][5]** The fee to set for the transaction (optional, default `1278`)
- `paramObject.gasLimit` **[Number][5]** The gas limit to set for the transaction (optional, default `400000`)
- `paramObject.storageLimit` **[Number][5]** The storage limit to set for the transaction (optional, default `60000`)
- `paramObject.mutez` **[Number][5]** Whether the input amount is set to mutez (1/1,000,000 tez) (optional, default `false`)
- `paramObject.rawParam` **[Number][5]** Whether to accept the object parameter format (optional, default `false`)
- `ledgerObject` **[Object][4]?** The ledger parameters for the operation (optional, default `{}`)
- `ledgerObject.useLedger` **[Boolean][2]** Whether to sign the transaction with a connected ledger device (optional, default `false`)
- `ledgerObject.path` **[String][1]** The ledger path (optional, default `44'/1729'/0'/0'`)
- `ledgerObject.curve` **[Number][5]** The value which defines the curve (0x00=tz1, 0x01=tz2, 0x02=tz3) (optional, default `0x00`)
Returns **[Promise][3]** Object containing the injected operation hash
## crypto
Expand Down Expand Up @@ -859,7 +833,7 @@ Convert from base58 to integer
#### Parameters
- `v` **[Number][5]** The b58 value
- `v` **[String][1]** The b58 value
Returns **[String][1]** The converted b58 value
Expand All @@ -871,7 +845,7 @@ Convert from mutez to tez
- `mutez` **[Number][5]** The amount in mutez to convert to tez
Returns **Integer** The mutez amount converted to tez
Returns **[Number][5]** The mutez amount converted to tez
### mutez
Expand Down Expand Up @@ -900,7 +874,7 @@ Base58 decode
#### Parameters
- `enc`
- `enc` **[string][1]**
- `prefixArg` **[Object][4]** The Uint8Array prefix values
- `payload` **[String][1]** The value to decode
Expand Down Expand Up @@ -1154,7 +1128,7 @@ ledger.signOperation({
path = "44'/1729'/0'/0'",
rawTxHex,
curve = 0x00,
}).then(({ signature }) => console.log(signature))
}).then((signature) => console.log(signature))
```
Returns **[Promise][3]** The signed operation
Expand Down
1 change: 0 additions & 1 deletion documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ toc:
- storage
- load
- watch
- send

- name: crypto
children:
Expand Down
Loading

0 comments on commit 591f543

Please sign in to comment.