From c89bb96e838488a210796fa0563c33f9315dc837 Mon Sep 17 00:00:00 2001 From: Bartek Nowotarski Date: Tue, 31 Jan 2017 14:37:09 +0100 Subject: [PATCH] Update stellar-base --- .travis.yml | 32 +++++++++++++++----------------- package.json | 2 +- src/federation_server.js | 4 ++-- test/unit/server_test.js | 3 ++- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2c8d1cb82..647355c03 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,15 @@ language: node_js -sudo: required # to install newer g++ and use docker -dist: trusty # https://github.com/travis-ci/travis-ci/issues/5448 +sudo: required +dist: trusty services: - - docker +- docker matrix: include: - - node_js: "4.2" - - node_js: "0.12" - - node_js: "6.9.1" - env: SAUCE=true - - node_js: "6.9.1" - env: INTEGRATION=true + - node_js: '4.2' + - node_js: 6.9.4 + env: SAUCE=true + - node_js: 6.9.4 + env: INTEGRATION=true before_install: - npm install -g npm@'>=2.13.5' script: @@ -40,9 +39,8 @@ after_success: fi env: global: - # GITHUB_TOKEN - - secure: Pc3DwkXywnOGAhUdBZiUCKjyljzrQzPoqm9EEr+UL2BaeaDniFLCLEkuU+ViiuJBo8oPyOIl7I+d86Mi5q06fQx55+xH7DmiW/aj4qKVB2U6Ghn6A3QWkQuvRB1o8SP7iTYRCX480ULZs6AGrMd9y1PFRx/L93fBrO+J/bOtEmg= - - CXX=g++-4.8 # node bindings in 4.0.0 + - secure: Pc3DwkXywnOGAhUdBZiUCKjyljzrQzPoqm9EEr+UL2BaeaDniFLCLEkuU+ViiuJBo8oPyOIl7I+d86Mi5q06fQx55+xH7DmiW/aj4qKVB2U6Ghn6A3QWkQuvRB1o8SP7iTYRCX480ULZs6AGrMd9y1PFRx/L93fBrO+J/bOtEmg= + - CXX=g++-4.8 addons: apt: sources: @@ -54,22 +52,22 @@ notifications: slack: secure: CgXxNEQrQ82EatyF/wSdF0P5rXcWPL+fFZ1lb1aBb8RbVt5gwddJ6xWVD/nYSr6tIJvIYHYhoYsIDPENwezIPsesG7kWXerQhydsEcA34JKxzsStd/TmU6Moxuwy6KTN7yzmL6586nSvoAw9TNPgvRkJFkH07asjGIc9Rlaq7/Y= before_deploy: gulp build -after_deploy: ./after_deploy.sh +after_deploy: "./after_deploy.sh" deploy: - provider: npm email: npm@stellar.org - api_key: $NPM_TOKEN + api_key: "$NPM_TOKEN" skip_cleanup: true on: tags: true repo: stellar/js-stellar-sdk - node: "6.9.1" + node: 6.9.4 condition: "$INTEGRATION = true" - provider: script - script: ./bower_publish.sh + script: "./bower_publish.sh" skip_cleanup: true on: tags: true repo: stellar/js-stellar-sdk - node: "6.9.1" + node: 6.9.4 condition: "$INTEGRATION = true" diff --git a/package.json b/package.json index 8f5893516..3fc1bdced 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "eventsource": "^0.2.1", "jsdoc": "^3.4.1", "lodash": "^4.0.1", - "stellar-base": "^0.6.0", + "stellar-base": "^0.7.1", "toml": "^2.3.0" } } diff --git a/src/federation_server.js b/src/federation_server.js index cd1cdd685..d9abd01fc 100644 --- a/src/federation_server.js +++ b/src/federation_server.js @@ -4,7 +4,7 @@ import Promise from 'bluebird'; import isString from "lodash/isString"; import pick from "lodash/pick"; import {Config} from "./config"; -import {Account, Keypair} from 'stellar-base'; +import {Account, StrKey} from 'stellar-base'; import {StellarTomlResolver} from "./stellar_toml_resolver"; export class FederationServer { @@ -72,7 +72,7 @@ export class FederationServer { static resolve(value, opts = {}) { // Check if `value` is in account ID format if (value.indexOf('*') < 0) { - if (!Keypair.isValidPublicKey(value)) { + if (!StrKey.isValidEd25519PublicKey(value)) { return Promise.reject(new Error('Invalid Account ID')); } else { return Promise.resolve({account_id: value}); diff --git a/test/unit/server_test.js b/test/unit/server_test.js index b0d759322..8cd6e71cc 100644 --- a/test/unit/server_test.js +++ b/test/unit/server_test.js @@ -3,6 +3,7 @@ describe("server.js tests", function () { this.server = new StellarSdk.Server('https://horizon-live.stellar.org:1337'); this.axiosMock = sinon.mock(axios); StellarSdk.Config.setDefault(); + StellarSdk.Network.useTestNetwork(); }); afterEach(function () { @@ -467,7 +468,7 @@ describe("server.js tests", function () { describe('Server.submitTransaction', function() { it("sends a transaction", function(done) { let keypair = StellarSdk.Keypair.random(); - let account = new StellarSdk.Account(keypair.accountId(), "56199647068161"); + let account = new StellarSdk.Account(keypair.publicKey(), "56199647068161"); let transaction = new StellarSdk.TransactionBuilder(account) .addOperation(StellarSdk.Operation.payment({ destination: "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW",