-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from EOSIO/develop
Release 3.0.0
- Loading branch information
Showing
17 changed files
with
1,440 additions
and
479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ yarn-error.log | |
.eslintrc.json | ||
README.md | ||
build-docs.sh | ||
.npmrc.template | ||
scripts/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,27 @@ language: node_js | |
node_js: | ||
- '10.0.0' | ||
before_install: | ||
- npm i -g [email protected] | ||
- npm install -g typescript | ||
script: | ||
- npm run lint | ||
|
||
stages: | ||
- test | ||
- name: deploy | ||
if: (NOT type IN (pull_request)) AND (branch = develop) | ||
jobs: | ||
include: | ||
- stage: test | ||
name: "Lint and Test" | ||
script: | ||
- npm run lint | ||
- npm run test | ||
- stage: deploy | ||
name: "Deploy to NPM" | ||
script: | ||
- npm run build | ||
deploy: | ||
provider: script | ||
skip_cleanup: true | ||
script: | ||
- ./scripts/publish.sh | ||
on: | ||
branch: develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
setup_git() { | ||
# Set the user name and email to match the API token holder | ||
# This will make sure the git commits will have the correct photo | ||
# and the user gets the credit for a checkin | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "blockone-devops" | ||
git config --global push.default matching | ||
|
||
# Get the credentials from a file | ||
git config credential.helper "store --file=.git/credentials" | ||
|
||
# This associates the API Key with the account | ||
echo "https://${GITHUB_API_KEY}:@github.com" > .git/credentials | ||
} | ||
|
||
make_version() { | ||
# Make sure that the workspace is clean | ||
# It could be "dirty" if | ||
# 1. package-lock.json is not aligned with package.json | ||
# 2. npm install is run | ||
git checkout -- . | ||
|
||
# Echo the status to the log so that we can see it is OK | ||
git status | ||
|
||
# Run the deploy build and increment the package versions | ||
current_commit="$(git rev-parse --short HEAD)"; | ||
|
||
npm version prerelease -preid "${current_commit}" -no-git-tag-version | ||
|
||
git commit -a -m "Updating version [skip ci]" | ||
} | ||
|
||
echo "Running on branch ${TRAVIS_BRANCH}": | ||
|
||
echo "Setting up git" | ||
setup_git | ||
|
||
echo "Creating new version" | ||
|
||
make_version | ||
|
||
echo "Publish to NPM" | ||
|
||
cp .npmrc.template $HOME/.npmrc | ||
|
||
npm publish --tag edge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,29 @@ | ||
import { MongoActionReader } from "./MongoActionReader" | ||
import { MongoBlock } from "./MongoBlock" | ||
import { mockConnect } from "./testHelpers/mongoMock" | ||
import { MongoClient } from "mongodb" | ||
|
||
const rawBlock = { | ||
_id: "5b720d6238dda5e3653eb12f", | ||
block_id: "0001796719f9556dca4dce19f7d83e3c390d76783193d59123706b7741686bac", | ||
block: { | ||
timestamp: "2018-08-13T22:59:46.000", | ||
producer: "eosio", | ||
confirmed: 0, | ||
previous: "0001796619c493e432bcf8105d45d1c7457b58f636c89bae3f1bda6574ff7502", | ||
transaction_mroot: "0000000000000000000000000000000000000000000000000000000000000000", | ||
action_mroot: "ae806e8b9f4c0740ae77377cca3b187460c3ded54d882accb1c0e90cbfc8d49e", | ||
schedule_version: 0, | ||
new_producers: null, | ||
header_extensions: [], | ||
producer_signature: `SIG_K1_JuWWv2dyszpR2skBHh6rRk37Ces5WPLCaj7vB2tqe5QqWcBuH | ||
EwKjttYApYJ27pWwFTp8SQNLS4RogLaGDHX6dCvvHoM8a`, | ||
transactions: [{ | ||
status: "executed", | ||
cpu_usage_us: 542, | ||
net_usage_words: 16, | ||
trx: { | ||
id: "051620080b3212292f56a836c6b2f294291f6e6793dc0f12ce6a886f83d97f83", | ||
signatures: [Array], | ||
compression: "none", | ||
packed_context_free_data: "", | ||
context_free_data: [], | ||
transaction: { | ||
expiration: "2018-08-13T23:11:22", | ||
ref_block_num: 32411, | ||
ref_block_prefix: 413523387, | ||
max_net_usage_words: 0, | ||
max_cpu_usage_ms: 0, | ||
delay_sec: 0, | ||
context_free_actions: [], | ||
actions: [ | ||
{ | ||
account: "eosio.token", | ||
name: "transfer", | ||
authorization: [{ actor: "bill", permission: "active" }], | ||
data: { from: "bill", to: "bob", quantity: "1.0000 EOS", memo: "m" }, | ||
hex_data: "000000000010a33b0000000000000e3d102700000000000004454f5300000000016d", | ||
}, | ||
{ | ||
account: "eosio.token", | ||
name: "transfer", | ||
authorization: [{ actor: "bill", permission: "active" }], | ||
data: { from: "bill", to: "bob", quantity: "1.0000 EOS", memo: "m" }, | ||
hex_data: "000000000010a33b0000000000000e3d102700000000000004454f5300000000016d", | ||
}, | ||
], | ||
transaction_extensions: [], | ||
}, | ||
}, | ||
}], | ||
block_extensions: [], | ||
}, | ||
block_num: 96615, | ||
createdAt: "2018-08-13T22:59:46.010Z", | ||
irreversible: false, | ||
} | ||
MongoClient.connect = jest.fn(() => mockConnect) | ||
|
||
describe("MongoActionReader", () => { | ||
let reader: any | ||
|
||
beforeEach(async () => { | ||
reader = new MongoActionReader("mongodb://127.0.0.1:27017", 0, true, 600, "EOS") | ||
reader = new MongoActionReader("mongodb://127.0.0.1:27017", 0, false, 600, "EOS") | ||
await reader.initialize() | ||
}) | ||
|
||
it("getHeadBlockNumber returns the last irreversible blocknum", async () => { | ||
it("returns the head block number", async () => { | ||
const blockNum = await reader.getHeadBlockNumber() | ||
expect(blockNum).toEqual(20) | ||
expect(blockNum).toEqual(21) | ||
}) | ||
|
||
describe("With onlyIrreversible set to false", () => { | ||
beforeEach(async () => { | ||
reader = new MongoActionReader("mongodb://127.0.0.1:27017", 0, false, 600, "EOS") | ||
await reader.initialize() | ||
}) | ||
|
||
it("getHeadBlockNumber returns the correct blockNumber", async () => { | ||
const blockNum = await reader.getHeadBlockNumber() | ||
expect(blockNum).toEqual(21) | ||
}) | ||
it("returns the last irreversible block number", async () => { | ||
const blockNum = await reader.getLastIrreversibleBlockNumber() | ||
expect(blockNum).toEqual(20) | ||
}) | ||
|
||
it("getBlock returns a MongoBlock", async () => { | ||
const returnedBlock = await reader.getBlock(20) | ||
const block = new MongoBlock(rawBlock) | ||
expect(returnedBlock).toEqual(block) | ||
}) | ||
it("returns block with the expected block number", async () => { | ||
const returnedBlock = await reader.getBlock(21) | ||
expect(returnedBlock.blockInfo.blockNumber).toEqual(21) | ||
}) | ||
}) |
Oops, something went wrong.