diff --git a/.eslintrc.js b/.eslintrc.js index 1ad7098b9..f6ef1fe3c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,11 +1,11 @@ module.exports = { env: { - es6: true, + es6: true }, - extends: ["airbnb-base", "prettier"], - plugins: ["@babel", "prettier", "prefer-import"], - parser: "@babel/eslint-parser", + extends: ['airbnb-base', 'prettier'], + plugins: ['@babel', 'prettier', 'prefer-import'], + parser: '@babel/eslint-parser', rules: { - "node/no-unpublished-require": 0, - }, + 'node/no-unpublished-require': 0 + } }; diff --git a/package.json b/package.json index 7203755d4..bda34bddf 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "_build": "yarn build:node && yarn build:browser", "_babel": "babel --extensions '.ts' --out-dir lib/ src/", "_nyc": "nyc --nycrc-path config/.nycrc", - "_prettier": "prettier --ignore-path config/.prettierignore --write './**/*.js'" + "_prettier": "prettier --config config/prettier.config.js --ignore-path config/.prettierignore --write './**/*.js'" }, "husky": { "hooks": { diff --git a/src/.eslintrc.js b/src/.eslintrc.js index 7ceb3272d..128adddd7 100644 --- a/src/.eslintrc.js +++ b/src/.eslintrc.js @@ -1,39 +1,39 @@ module.exports = { env: { - es6: true, + es6: true }, rules: { // OFF - "import/prefer-default-export": 0, - "node/no-unsupported-features/es-syntax": 0, - "node/no-unsupported-features/es-builtins": 0, + 'import/prefer-default-export': 0, + 'node/no-unsupported-features/es-syntax': 0, + 'node/no-unsupported-features/es-builtins': 0, camelcase: 0, - "class-methods-use-this": 0, - "linebreak-style": 0, - "new-cap": 0, - "no-param-reassign": 0, - "no-underscore-dangle": 0, - "no-use-before-define": 0, - "prefer-destructuring": 0, - "lines-between-class-members": 0, + 'class-methods-use-this': 0, + 'linebreak-style': 0, + 'new-cap': 0, + 'no-param-reassign': 0, + 'no-underscore-dangle': 0, + 'no-use-before-define': 0, + 'prefer-destructuring': 0, + 'lines-between-class-members': 0, // WARN - "prefer-import/prefer-import-over-require": [1], - "no-console": ["warn", { allow: ["assert"] }], - "no-debugger": 1, - "no-unused-vars": 1, - "arrow-body-style": 1, - "valid-jsdoc": [ + 'prefer-import/prefer-import-over-require': [1], + 'no-console': ['warn', { allow: ['assert'] }], + 'no-debugger': 1, + 'no-unused-vars': 1, + 'arrow-body-style': 1, + 'valid-jsdoc': [ 1, { - requireReturnDescription: false, - }, + requireReturnDescription: false + } ], - "prefer-const": 1, - "object-shorthand": 1, - "require-await": 1, + 'prefer-const': 1, + 'object-shorthand': 1, + 'require-await': 1, // ERROR - "no-unused-expressions": [2, { allowTaggedTemplates: true }], - }, + 'no-unused-expressions': [2, { allowTaggedTemplates: true }] + } }; diff --git a/test/.eslintrc.js b/test/.eslintrc.js index 5aa559806..8f7d8e0f9 100644 --- a/test/.eslintrc.js +++ b/test/.eslintrc.js @@ -1,6 +1,6 @@ module.exports = { env: { - mocha: true, + mocha: true }, globals: { StellarSdk: true, @@ -8,9 +8,9 @@ module.exports = { chai: true, sinon: true, expect: true, - HorizonAxiosClient: true, + HorizonAxiosClient: true }, rules: { - "no-unused-vars": 0, - }, + 'no-unused-vars': 0 + } }; diff --git a/test/integration/apiary.js b/test/integration/apiary.js index 7c95d40fc..c8f3bb607 100644 --- a/test/integration/apiary.js +++ b/test/integration/apiary.js @@ -3,19 +3,19 @@ // All endpoints from here are tested: // https://docs.google.com/document/d/1pXL8kr1a2vfYSap9T67R-g72B_WWbaE1YsLMa04OgoU/edit -const _ = require("lodash"); +const _ = require('lodash'); -const MOCK_SERVER = "https://private-d133c-ammmock.apiary-mock.com"; +const MOCK_SERVER = 'https://private-d133c-ammmock.apiary-mock.com'; -describe("tests the /liquidity_pools endpoint", function () { +describe('tests the /liquidity_pools endpoint', function () { const lpId = - "0569b19c75d7ecadce50501fffad6fe8ba4652455df9e1cc96dc408141124dd5"; + '0569b19c75d7ecadce50501fffad6fe8ba4652455df9e1cc96dc408141124dd5'; const server = new StellarSdk.Server(MOCK_SERVER, { allowHttp: true }); - it("GET /", function (done) { + it('GET /', function (done) { chai .request(MOCK_SERVER) - .get("/liquidity_pools") + .get('/liquidity_pools') .end(function (err, res) { if (err != null) done(err); expect(res.body).not.to.be.null; @@ -31,7 +31,7 @@ describe("tests the /liquidity_pools endpoint", function () { }); }); - it("GET /", function (done) { + it('GET /', function (done) { chai .request(MOCK_SERVER) .get(`/liquidity_pools/${lpId}`) @@ -55,7 +55,7 @@ describe("tests the /liquidity_pools endpoint", function () { effects: server.effects(), operations: server.operations(), trades: server.trades(), - transactions: server.transactions(), + transactions: server.transactions() }; Object.keys(testCases).forEach((suffix) => { @@ -77,7 +77,7 @@ describe("tests the /liquidity_pools endpoint", function () { // TransactionRecord values don't map 1-to-1 to the JSON (see // e.g. the ledger vs. ledger_attr properties), so we do a "best // effort" validation by checking that at least the keys exist. - if (suffix === "transactions") { + if (suffix === 'transactions') { record = Object.keys(record); expectedRecord = Object.keys(expectedRecord); } @@ -92,13 +92,13 @@ describe("tests the /liquidity_pools endpoint", function () { }); }); -describe("tests the /accounts endpoint", function () { +describe('tests the /accounts endpoint', function () { const server = new StellarSdk.Server(MOCK_SERVER, { allowHttp: true }); - it("GET /", function (done) { + it('GET /', function (done) { chai .request(MOCK_SERVER) - .get("/accounts") + .get('/accounts') .end(function (err, res) { if (err != null) return done(err); expect(res.body).not.to.be.null; @@ -115,13 +115,13 @@ describe("tests the /accounts endpoint", function () { }); }); - it("GET /?liquidity_pool=", function (done) { + it('GET /?liquidity_pool=', function (done) { const lpId = - "0569b19c75d7ecadce50501fffad6fe8ba4652455df9e1cc96dc408141124dd5"; + '0569b19c75d7ecadce50501fffad6fe8ba4652455df9e1cc96dc408141124dd5'; chai .request(MOCK_SERVER) - .get("/accounts") + .get('/accounts') .query({ liquidity_pool: lpId }) .end(function (err, res) { if (err != null) return done(err); @@ -139,9 +139,9 @@ describe("tests the /accounts endpoint", function () { }); }); - it("GET /", function (done) { + it('GET /', function (done) { const accountId = - "GDQNY3PBOJOKYZSRMK2S7LHHGWZIUISD4QORETLMXEWXBI7KFZZMKTL3"; + 'GDQNY3PBOJOKYZSRMK2S7LHHGWZIUISD4QORETLMXEWXBI7KFZZMKTL3'; chai .request(MOCK_SERVER) @@ -157,7 +157,7 @@ describe("tests the /accounts endpoint", function () { .then((resp) => { // find the pool share balance(s) const poolShares = resp.balances.filter( - (b) => b.asset_type === "liquidity_pool_shares", + (b) => b.asset_type === 'liquidity_pool_shares' ); expect(poolShares).to.have.lengthOf(1); diff --git a/test/integration/client_headers_test.js b/test/integration/client_headers_test.js index b285ab605..c262ad3e7 100644 --- a/test/integration/client_headers_test.js +++ b/test/integration/client_headers_test.js @@ -1,21 +1,21 @@ -const http = require("http"); -const url = require("url"); +const http = require('http'); +const url = require('url'); const port = 3100; const versionPattern = /^[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+(\.[0-9])?)?$/; -describe("integration tests: client headers", function (done) { - if (typeof window !== "undefined") { +describe('integration tests: client headers', function (done) { + if (typeof window !== 'undefined') { done(); return; } - it("sends client via headers", function (done) { + it('sends client via headers', function (done) { let server; const requestHandler = (request, response) => { - expect(request.headers["x-client-name"]).to.be.equal("js-stellar-sdk"); - expect(request.headers["x-client-version"]).to.match(versionPattern); + expect(request.headers['x-client-name']).to.be.equal('js-stellar-sdk'); + expect(request.headers['x-client-version']).to.match(versionPattern); response.end(); server.close(() => done()); }; @@ -33,15 +33,15 @@ describe("integration tests: client headers", function (done) { }); }); - it("sends client data via get params when streaming", function (done) { + it('sends client data via get params when streaming', function (done) { let server; let closeStream; const requestHandler = (request, response) => { // eslint-disable-next-line node/no-deprecated-api let query = url.parse(request.url, true).query; - expect(query["X-Client-Name"]).to.be.equal("js-stellar-sdk"); - expect(query["X-Client-Version"]).to.match(versionPattern); + expect(query['X-Client-Name']).to.be.equal('js-stellar-sdk'); + expect(query['X-Client-Version']).to.match(versionPattern); response.end(); server.close(() => { closeStream(); @@ -57,13 +57,13 @@ describe("integration tests: client headers", function (done) { } closeStream = new StellarSdk.Server(`http://localhost:${port}`, { - allowHttp: true, + allowHttp: true }) .operations() .stream({ onerror: (err) => { done(err); - }, + } }); }); }); diff --git a/test/integration/streaming_test.js b/test/integration/streaming_test.js index 080fafc1c..4d5f16bfd 100644 --- a/test/integration/streaming_test.js +++ b/test/integration/streaming_test.js @@ -1,14 +1,14 @@ -const http = require("http"); -const url = require("url"); +const http = require('http'); +const url = require('url'); const port = 3100; -describe("integration tests: streaming", function (done) { - if (typeof window !== "undefined") { +describe('integration tests: streaming', function (done) { + if (typeof window !== 'undefined') { done(); return; } - it("handles onerror", function (done) { + it('handles onerror', function (done) { let server; let closeStream; @@ -27,7 +27,7 @@ describe("integration tests: streaming", function (done) { } closeStream = new StellarSdk.Server(`http://localhost:${port}`, { - allowHttp: true, + allowHttp: true }) .operations() .stream({ @@ -35,12 +35,12 @@ describe("integration tests: streaming", function (done) { server.close(); closeStream(); done(); - }, + } }); }); }); - it("handles close message", function (done) { + it('handles close message', function (done) { let server; let closeStream; @@ -51,18 +51,18 @@ describe("integration tests: streaming", function (done) { return; } - request.once("close", (e) => { + request.once('close', (e) => { closeStream(); server.close(); done(); }); response.writeHead(200, { - "Content-Type": "text/event-stream", - "Cache-Control": "no-cache", - Connection: "keep-alive", + 'Content-Type': 'text/event-stream', + 'Cache-Control': 'no-cache', + Connection: 'keep-alive' }); - response.write("retry: 10\nevent: close\ndata: byebye\n\n"); + response.write('retry: 10\nevent: close\ndata: byebye\n\n'); }; server = http.createServer(requestHandler); @@ -73,23 +73,23 @@ describe("integration tests: streaming", function (done) { } closeStream = new StellarSdk.Server(`http://localhost:${port}`, { - allowHttp: true, + allowHttp: true }) .operations() .stream({ onmessage: (m) => { - done("unexpected message " + JSON.stringify(m)); + done('unexpected message ' + JSON.stringify(m)); }, onerror: (err) => { done(err); - }, + } }); }); }); }); -describe("end-to-end tests: real streaming", function (done) { - if (typeof window !== "undefined") { +describe('end-to-end tests: real streaming', function (done) { + if (typeof window !== 'undefined') { done(); return; } @@ -97,9 +97,9 @@ describe("end-to-end tests: real streaming", function (done) { // stream transactions from pubnet for a while and ensure that we cross a // ledger boundary (if streaming is broken, we will get stuck on a single // ledger's transaction batch). - it("streams in perpetuity", function (done) { + it('streams in perpetuity', function (done) { const DURATION = 30; - const server = new StellarSdk.Server("https://horizon.stellar.org"); + const server = new StellarSdk.Server('https://horizon.stellar.org'); this.timeout((DURATION + 5) * 1000); // pad timeout let transactions = []; @@ -118,12 +118,12 @@ describe("end-to-end tests: real streaming", function (done) { let closeHandler = server .transactions() - .cursor("now") + .cursor('now') .stream({ onmessage: (msg) => { transactions.push(msg); }, - onerror: finishTest, + onerror: finishTest }); let timeout = setTimeout(finishTest, DURATION * 1000); diff --git a/test/test-browser.js b/test/test-browser.js index 430811c72..dc80010b6 100644 --- a/test/test-browser.js +++ b/test/test-browser.js @@ -1,4 +1,4 @@ /* eslint-disable no-undef */ -chai.use(require("chai-as-promised")); +chai.use(require('chai-as-promised')); window.axios = StellarSdk.axios; window.HorizonAxiosClient = StellarSdk.HorizonAxiosClient; diff --git a/test/test-nodejs.js b/test/test-nodejs.js index 50c87d04b..56a42f6b0 100644 --- a/test/test-nodejs.js +++ b/test/test-nodejs.js @@ -1,17 +1,17 @@ /* eslint-disable no-undef */ -require("@babel/register"); -global.StellarSdk = require("../lib/"); +require('@babel/register'); +global.StellarSdk = require('../lib/'); -global.axios = require("axios"); +global.axios = require('axios'); global.HorizonAxiosClient = StellarSdk.HorizonAxiosClient; -var chaiAsPromised = require("chai-as-promised"); -var chaiHttp = require("chai-http"); -global.chai = require("chai"); +var chaiAsPromised = require('chai-as-promised'); +var chaiHttp = require('chai-http'); +global.chai = require('chai'); global.chai.should(); global.chai.use(chaiAsPromised); global.chai.use(chaiHttp); global.expect = global.chai.expect; -global.sinon = require("sinon"); +global.sinon = require('sinon'); diff --git a/test/unit/browser_test.js b/test/unit/browser_test.js index eea4c4824..426573f4a 100644 --- a/test/unit/browser_test.js +++ b/test/unit/browser_test.js @@ -1,7 +1,7 @@ -describe("Browser version tests", function () { - it("lodash is not exported globally", function () { - if (typeof window !== "undefined") { - expect(typeof _ === "undefined").to.be.true; +describe('Browser version tests', function () { + it('lodash is not exported globally', function () { + if (typeof window !== 'undefined') { + expect(typeof _ === 'undefined').to.be.true; } }); }); diff --git a/test/unit/call_builders_test.js b/test/unit/call_builders_test.js index 80541b7ec..ed24accc6 100644 --- a/test/unit/call_builders_test.js +++ b/test/unit/call_builders_test.js @@ -1,16 +1,16 @@ -const URI = require("urijs"); -const CallBuilder = require("../../lib/call_builder").CallBuilder; +const URI = require('urijs'); +const CallBuilder = require('../../lib/call_builder').CallBuilder; -describe("CallBuilder functions", function () { +describe('CallBuilder functions', function () { it("doesn't mutate the constructor passed url argument (it clones it instead)", function () { - let arg = URI("https://onedom.ain/"); + let arg = URI('https://onedom.ain/'); const builder = new CallBuilder(arg); - builder.url.segment("one_segment"); + builder.url.segment('one_segment'); builder.checkFilter(); - expect(arg.toString()).not.to.be.equal("https://onedom.ain/one_segment"); // https://onedom.ain/ + expect(arg.toString()).not.to.be.equal('https://onedom.ain/one_segment'); // https://onedom.ain/ expect(builder.url.toString()).to.be.equal( - "https://onedom.ain/one_segment", + 'https://onedom.ain/one_segment' ); }); }); diff --git a/test/unit/federation_server_test.js b/test/unit/federation_server_test.js index b8d97181f..c91ba7880 100644 --- a/test/unit/federation_server_test.js +++ b/test/unit/federation_server_test.js @@ -1,10 +1,10 @@ -const http = require("http"); +const http = require('http'); -describe("federation-server.js tests", function () { +describe('federation-server.js tests', function () { beforeEach(function () { this.server = new StellarSdk.FederationServer( - "https://acme.com:1337/federation", - "stellar.org", + 'https://acme.com:1337/federation', + 'stellar.org' ); this.axiosMock = sinon.mock(axios); @@ -15,68 +15,68 @@ describe("federation-server.js tests", function () { this.axiosMock.verify(); // also restores }); - describe("FederationServer.constructor", function () { - it("throws error for insecure server", function () { + describe('FederationServer.constructor', function () { + it('throws error for insecure server', function () { expect( () => new StellarSdk.FederationServer( - "http://acme.com:1337/federation", - "stellar.org", - ), + 'http://acme.com:1337/federation', + 'stellar.org' + ) ).to.throw(/Cannot connect to insecure federation server/); }); - it("allow insecure server when opts.allowHttp flag is set", function () { + it('allow insecure server when opts.allowHttp flag is set', function () { expect( () => new StellarSdk.FederationServer( - "http://acme.com:1337/federation", - "stellar.org", - { allowHttp: true }, - ), + 'http://acme.com:1337/federation', + 'stellar.org', + { allowHttp: true } + ) ).to.not.throw(); }); - it("allow insecure server when global Config.allowHttp flag is set", function () { + it('allow insecure server when global Config.allowHttp flag is set', function () { StellarSdk.Config.setAllowHttp(true); expect( () => new StellarSdk.FederationServer( - "http://acme.com:1337/federation", - "stellar.org", - { allowHttp: true }, - ), + 'http://acme.com:1337/federation', + 'stellar.org', + { allowHttp: true } + ) ).to.not.throw(); }); }); - describe("FederationServer.resolveAddress", function () { + describe('FederationServer.resolveAddress', function () { beforeEach(function () { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://acme.com:1337/federation?type=name&q=bob%2Astellar.org", - ), + 'https://acme.com:1337/federation?type=name&q=bob%2Astellar.org' + ) ) .returns( Promise.resolve({ data: { - stellar_address: "bob*stellar.org", + stellar_address: 'bob*stellar.org', account_id: - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", - }, - }), + 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS' + } + }) ); }); - it("requests is correct", function (done) { + it('requests is correct', function (done) { this.server - .resolveAddress("bob*stellar.org") + .resolveAddress('bob*stellar.org') .then((response) => { - expect(response.stellar_address).equals("bob*stellar.org"); + expect(response.stellar_address).equals('bob*stellar.org'); expect(response.account_id).equals( - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", + 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS' ); done(); }) @@ -85,13 +85,13 @@ describe("federation-server.js tests", function () { }); }); - it("requests is correct for username as stellar address", function (done) { + it('requests is correct for username as stellar address', function (done) { this.server - .resolveAddress("bob") + .resolveAddress('bob') .then((response) => { - expect(response.stellar_address).equals("bob*stellar.org"); + expect(response.stellar_address).equals('bob*stellar.org'); expect(response.account_id).equals( - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", + 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS' ); done(); }) @@ -101,35 +101,35 @@ describe("federation-server.js tests", function () { }); }); - describe("FederationServer.resolveAccountId", function () { + describe('FederationServer.resolveAccountId', function () { beforeEach(function () { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://acme.com:1337/federation?type=id&q=GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", - ), + 'https://acme.com:1337/federation?type=id&q=GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS' + ) ) .returns( Promise.resolve({ data: { - stellar_address: "bob*stellar.org", + stellar_address: 'bob*stellar.org', account_id: - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", - }, - }), + 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS' + } + }) ); }); - it("requests is correct", function (done) { + it('requests is correct', function (done) { this.server .resolveAccountId( - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", + 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS' ) .then((response) => { - expect(response.stellar_address).equals("bob*stellar.org"); + expect(response.stellar_address).equals('bob*stellar.org'); expect(response.account_id).equals( - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", + 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS' ); done(); }) @@ -139,35 +139,35 @@ describe("federation-server.js tests", function () { }); }); - describe("FederationServer.resolveTransactionId", function () { + describe('FederationServer.resolveTransactionId', function () { beforeEach(function () { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://acme.com:1337/federation?type=txid&q=3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889", - ), + 'https://acme.com:1337/federation?type=txid&q=3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889' + ) ) .returns( Promise.resolve({ data: { - stellar_address: "bob*stellar.org", + stellar_address: 'bob*stellar.org', account_id: - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", - }, - }), + 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS' + } + }) ); }); - it("requests is correct", function (done) { + it('requests is correct', function (done) { this.server .resolveTransactionId( - "3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889", + '3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889' ) .then((response) => { - expect(response.stellar_address).equals("bob*stellar.org"); + expect(response.stellar_address).equals('bob*stellar.org'); expect(response.account_id).equals( - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", + 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS' ); done(); }) @@ -177,168 +177,167 @@ describe("federation-server.js tests", function () { }); }); - describe("FederationServer.createForDomain", function () { - it("creates correct object", function (done) { + describe('FederationServer.createForDomain', function () { + it('creates correct object', function (done) { this.axiosMock - .expects("get") - .withArgs(sinon.match("https://acme.com/.well-known/stellar.toml")) + .expects('get') + .withArgs(sinon.match('https://acme.com/.well-known/stellar.toml')) .returns( Promise.resolve({ data: ` # The endpoint which clients should query to resolve stellar addresses # for users on your domain. FEDERATION_SERVER="https://api.stellar.org/federation" -`, - }), +` + }) ); - StellarSdk.FederationServer.createForDomain("acme.com").then( + StellarSdk.FederationServer.createForDomain('acme.com').then( (federationServer) => { - expect(federationServer.serverURL.protocol()).equals("https"); + expect(federationServer.serverURL.protocol()).equals('https'); expect(federationServer.serverURL.hostname()).equals( - "api.stellar.org", + 'api.stellar.org' ); - expect(federationServer.serverURL.path()).equals("/federation"); - expect(federationServer.domain).equals("acme.com"); + expect(federationServer.serverURL.path()).equals('/federation'); + expect(federationServer.domain).equals('acme.com'); done(); - }, + } ); }); - it("fails when stellar.toml does not contain federation server info", function (done) { + it('fails when stellar.toml does not contain federation server info', function (done) { this.axiosMock - .expects("get") - .withArgs(sinon.match("https://acme.com/.well-known/stellar.toml")) + .expects('get') + .withArgs(sinon.match('https://acme.com/.well-known/stellar.toml')) .returns( Promise.resolve({ - data: "", - }), + data: '' + }) ); - StellarSdk.FederationServer.createForDomain("acme.com") + StellarSdk.FederationServer.createForDomain('acme.com') .should.be.rejectedWith( - /stellar.toml does not contain FEDERATION_SERVER field/, + /stellar.toml does not contain FEDERATION_SERVER field/ ) .and.notify(done); }); }); - describe("FederationServer.resolve", function () { - it("succeeds for a valid account ID", function (done) { + describe('FederationServer.resolve', function () { + it('succeeds for a valid account ID', function (done) { StellarSdk.FederationServer.resolve( - "GAFSZ3VPBC2H2DVKCEWLN3PQWZW6BVDMFROWJUDAJ3KWSOKQIJ4R5W4J", + 'GAFSZ3VPBC2H2DVKCEWLN3PQWZW6BVDMFROWJUDAJ3KWSOKQIJ4R5W4J' ) .should.eventually.deep.equal({ - account_id: - "GAFSZ3VPBC2H2DVKCEWLN3PQWZW6BVDMFROWJUDAJ3KWSOKQIJ4R5W4J", + account_id: 'GAFSZ3VPBC2H2DVKCEWLN3PQWZW6BVDMFROWJUDAJ3KWSOKQIJ4R5W4J' }) .notify(done); }); - it("fails for invalid account ID", function (done) { - StellarSdk.FederationServer.resolve("invalid") + it('fails for invalid account ID', function (done) { + StellarSdk.FederationServer.resolve('invalid') .should.be.rejectedWith(/Invalid Account ID/) .notify(done); }); - it("succeeds for a valid Stellar address", function (done) { + it('succeeds for a valid Stellar address', function (done) { this.axiosMock - .expects("get") - .withArgs(sinon.match("https://stellar.org/.well-known/stellar.toml")) + .expects('get') + .withArgs(sinon.match('https://stellar.org/.well-known/stellar.toml')) .returns( Promise.resolve({ data: ` # The endpoint which clients should query to resolve stellar addresses # for users on your domain. FEDERATION_SERVER="https://api.stellar.org/federation" -`, - }), +` + }) ); this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://api.stellar.org/federation?type=name&q=bob%2Astellar.org", - ), + 'https://api.stellar.org/federation?type=name&q=bob%2Astellar.org' + ) ) .returns( Promise.resolve({ data: { - stellar_address: "bob*stellar.org", + stellar_address: 'bob*stellar.org', account_id: - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", - memo_type: "id", - memo: "100", - }, - }), + 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS', + memo_type: 'id', + memo: '100' + } + }) ); - StellarSdk.FederationServer.resolve("bob*stellar.org") + StellarSdk.FederationServer.resolve('bob*stellar.org') .should.eventually.deep.equal({ - stellar_address: "bob*stellar.org", + stellar_address: 'bob*stellar.org', account_id: - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", - memo_type: "id", - memo: "100", + 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS', + memo_type: 'id', + memo: '100' }) .notify(done); }); - it("fails for invalid Stellar address", function (done) { - StellarSdk.FederationServer.resolve("bob*stellar.org*test") + it('fails for invalid Stellar address', function (done) { + StellarSdk.FederationServer.resolve('bob*stellar.org*test') .should.be.rejectedWith(/Invalid Stellar address/) .notify(done); }); - it("fails when memo is not string", function (done) { + it('fails when memo is not string', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://acme.com:1337/federation?type=name&q=bob%2Astellar.org", - ), + 'https://acme.com:1337/federation?type=name&q=bob%2Astellar.org' + ) ) .returns( Promise.resolve({ data: { - stellar_address: "bob*stellar.org", + stellar_address: 'bob*stellar.org', account_id: - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", - memo_type: "id", - memo: 100, - }, - }), + 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS', + memo_type: 'id', + memo: 100 + } + }) ); this.server - .resolveAddress("bob*stellar.org") + .resolveAddress('bob*stellar.org') .should.be.rejectedWith(/memo value should be of type string/) .notify(done); }); - it("fails when response exceeds the limit", function (done) { + it('fails when response exceeds the limit', function (done) { // Unable to create temp server in a browser - if (typeof window != "undefined") { + if (typeof window != 'undefined') { return done(); } var response = Array(StellarSdk.FEDERATION_RESPONSE_MAX_SIZE + 10).join( - "a", + 'a' ); let tempServer = http .createServer((req, res) => { - res.setHeader("Content-Type", "application/json; charset=UTF-8"); + res.setHeader('Content-Type', 'application/json; charset=UTF-8'); res.end(response); }) .listen(4444, () => { new StellarSdk.FederationServer( - "http://localhost:4444/federation", - "stellar.org", - { allowHttp: true }, + 'http://localhost:4444/federation', + 'stellar.org', + { allowHttp: true } ) - .resolveAddress("bob*stellar.org") + .resolveAddress('bob*stellar.org') .should.be.rejectedWith( - /federation response exceeds allowed size of [0-9]+/, + /federation response exceeds allowed size of [0-9]+/ ) .notify(done) .then(() => tempServer.close()); @@ -346,7 +345,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" }); }); - describe("FederationServer times out when response lags and timeout set", function () { + describe('FederationServer times out when response lags and timeout set', function () { afterEach(function () { StellarSdk.Config.setDefault(); }); @@ -356,15 +355,15 @@ FEDERATION_SERVER="https://api.stellar.org/federation" for (let i = 0; i < 2; i++) { if (i === 0) { StellarSdk.Config.setTimeout(1000); - message = "with global config set"; + message = 'with global config set'; } else { opts = { allowHttp: true, timeout: 1000 }; - message = "with instance opts set"; + message = 'with instance opts set'; } it(`resolveAddress times out ${message}`, function (done) { // Unable to create temp server in a browser - if (typeof window != "undefined") { + if (typeof window != 'undefined') { return done(); } @@ -374,11 +373,11 @@ FEDERATION_SERVER="https://api.stellar.org/federation" }) .listen(4444, () => { new StellarSdk.FederationServer( - "http://localhost:4444/federation", - "stellar.org", - opts, + 'http://localhost:4444/federation', + 'stellar.org', + opts ) - .resolveAddress("bob*stellar.org") + .resolveAddress('bob*stellar.org') .should.be.rejectedWith(/timeout of 1000ms exceeded/) .notify(done) .then(() => tempServer.close()); @@ -387,7 +386,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" it(`resolveAccountId times out ${message}`, function (done) { // Unable to create temp server in a browser - if (typeof window != "undefined") { + if (typeof window != 'undefined') { return done(); } let tempServer = http @@ -396,12 +395,12 @@ FEDERATION_SERVER="https://api.stellar.org/federation" }) .listen(4444, () => { new StellarSdk.FederationServer( - "http://localhost:4444/federation", - "stellar.org", - opts, + 'http://localhost:4444/federation', + 'stellar.org', + opts ) .resolveAccountId( - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", + 'GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS' ) .should.be.rejectedWith(/timeout of 1000ms exceeded/) .notify(done) @@ -411,7 +410,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" it(`resolveTransactionId times out ${message}`, function (done) { // Unable to create temp server in a browser - if (typeof window != "undefined") { + if (typeof window != 'undefined') { return done(); } let tempServer = http @@ -420,12 +419,12 @@ FEDERATION_SERVER="https://api.stellar.org/federation" }) .listen(4444, () => { new StellarSdk.FederationServer( - "http://localhost:4444/federation", - "stellar.org", - opts, + 'http://localhost:4444/federation', + 'stellar.org', + opts ) .resolveTransactionId( - "3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889", + '3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889' ) .should.be.rejectedWith(/timeout of 1000ms exceeded/) .notify(done) @@ -435,7 +434,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" it(`createForDomain times out ${message}`, function (done) { // Unable to create temp server in a browser - if (typeof window != "undefined") { + if (typeof window != 'undefined') { return done(); } let tempServer = http @@ -443,7 +442,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" setTimeout(() => {}, 10000); }) .listen(4444, () => { - StellarSdk.FederationServer.createForDomain("localhost:4444", opts) + StellarSdk.FederationServer.createForDomain('localhost:4444', opts) .should.be.rejectedWith(/timeout of 1000ms exceeded/) .notify(done) .then(() => tempServer.close()); @@ -452,7 +451,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" it(`resolve times out ${message}`, function (done) { // Unable to create temp server in a browser - if (typeof window != "undefined") { + if (typeof window != 'undefined') { return done(); } @@ -461,7 +460,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" setTimeout(() => {}, 10000); }) .listen(4444, () => { - StellarSdk.FederationServer.resolve("bob*localhost:4444", opts) + StellarSdk.FederationServer.resolve('bob*localhost:4444', opts) .should.eventually.be.rejectedWith(/timeout of 1000ms exceeded/) .notify(done) .then(() => tempServer.close()); diff --git a/test/unit/horizon_axios_client_test.js b/test/unit/horizon_axios_client_test.js index a56e8622b..7abe2eb9f 100644 --- a/test/unit/horizon_axios_client_test.js +++ b/test/unit/horizon_axios_client_test.js @@ -1,7 +1,7 @@ const SERVER_TIME_MAP = StellarSdk.SERVER_TIME_MAP; const getCurrentServerTime = StellarSdk.getCurrentServerTime; -describe("getCurrentServerTime", () => { +describe('getCurrentServerTime', () => { let clock; beforeEach(() => { @@ -14,27 +14,27 @@ describe("getCurrentServerTime", () => { }); it("returns null when the hostname hasn't been hit", () => { - expect(getCurrentServerTime("host")).to.be.null; + expect(getCurrentServerTime('host')).to.be.null; }); - it("returns null when no time is available", () => { + it('returns null when no time is available', () => { SERVER_TIME_MAP.host = {}; - expect(getCurrentServerTime("host")).to.be.null; + expect(getCurrentServerTime('host')).to.be.null; }); - it("returns null when the old time is too old", () => { + it('returns null when the old time is too old', () => { SERVER_TIME_MAP.host = { serverTime: 10, - localTimeRecorded: 5, + localTimeRecorded: 5 }; - expect(getCurrentServerTime("host")).to.be.null; + expect(getCurrentServerTime('host')).to.be.null; }); - it("returns the delta between then and now", () => { + it('returns the delta between then and now', () => { SERVER_TIME_MAP.host = { serverTime: 10, - localTimeRecorded: 5005, + localTimeRecorded: 5005 }; - expect(getCurrentServerTime("host")).to.equal(55); + expect(getCurrentServerTime('host')).to.equal(55); }); }); diff --git a/test/unit/horizon_path_test.js b/test/unit/horizon_path_test.js index 2b62adfdc..6578b2380 100644 --- a/test/unit/horizon_path_test.js +++ b/test/unit/horizon_path_test.js @@ -1,4 +1,4 @@ -describe("horizon path tests", function () { +describe('horizon path tests', function () { beforeEach(function () { this.axiosMock = sinon.mock(HorizonAxiosClient); StellarSdk.Config.setDefault(); @@ -16,20 +16,20 @@ describe("horizon path tests", function () { data: { url: serverUrl, random: Math.round(1000 * Math.random()), - endpoint: "bogus", - }, + endpoint: 'bogus' + } }; function prepareAxios(axiosMock, endpoint) { randomResult.endpoint = endpoint; axiosMock - .expects("get") + .expects('get') .withArgs(sinon.match(serverUrl + endpoint)) .returns(Promise.resolve(randomResult)); } - it("server.accounts() " + serverUrl, function (done) { - prepareAxios(this.axiosMock, "/accounts"); + it('server.accounts() ' + serverUrl, function (done) { + prepareAxios(this.axiosMock, '/accounts'); server .accounts() .call() @@ -40,18 +40,18 @@ describe("horizon path tests", function () { it( "server.accounts().accountId('fooAccountId') " + serverUrl, function (done) { - prepareAxios(this.axiosMock, "/accounts/fooAccountId"); + prepareAxios(this.axiosMock, '/accounts/fooAccountId'); server .accounts() - .accountId("fooAccountId") + .accountId('fooAccountId') .call() .should.eventually.deep.equal(randomResult.data) .notify(done); - }, + } ); - it("server.transactions() " + serverUrl, function (done) { - prepareAxios(this.axiosMock, "/transactions"); + it('server.transactions() ' + serverUrl, function (done) { + prepareAxios(this.axiosMock, '/transactions'); server .transactions() .call() @@ -60,20 +60,20 @@ describe("horizon path tests", function () { }); it( - "server.transactions().includeFailed(true) " + serverUrl, + 'server.transactions().includeFailed(true) ' + serverUrl, function (done) { - prepareAxios(this.axiosMock, "/transactions?include_failed=true"); + prepareAxios(this.axiosMock, '/transactions?include_failed=true'); server .transactions() .includeFailed(true) .call() .should.eventually.deep.equal(randomResult.data) .notify(done); - }, + } ); - it("server.operations().includeFailed(true) " + serverUrl, function (done) { - prepareAxios(this.axiosMock, "/operations?include_failed=true"); + it('server.operations().includeFailed(true) ' + serverUrl, function (done) { + prepareAxios(this.axiosMock, '/operations?include_failed=true'); server .operations() .includeFailed(true) @@ -85,59 +85,59 @@ describe("horizon path tests", function () { it( "server.transactions().transaction('fooTransactionId') " + serverUrl, function (done) { - prepareAxios(this.axiosMock, "/transactions/fooTransactionId"); + prepareAxios(this.axiosMock, '/transactions/fooTransactionId'); server .transactions() - .transaction("fooTransactionId") + .transaction('fooTransactionId') .call() .should.eventually.deep.equal(randomResult.data) .notify(done); - }, + } ); it( "server.transactions().forAccount('fooAccountId') " + serverUrl, function (done) { - prepareAxios(this.axiosMock, "/accounts/fooAccountId/transactions"); + prepareAxios(this.axiosMock, '/accounts/fooAccountId/transactions'); server .transactions() - .forAccount("fooAccountId") + .forAccount('fooAccountId') .call() .should.eventually.deep.equal(randomResult.data) .notify(done); - }, + } ); - it("server.submitTransaction() " + serverUrl, function (done) { - randomResult.endpoint = "post"; + it('server.submitTransaction() ' + serverUrl, function (done) { + randomResult.endpoint = 'post'; let keypair = StellarSdk.Keypair.random(); let account = new StellarSdk.Account( keypair.publicKey(), - "56199647068161", + '56199647068161' ); let fakeTransaction = new StellarSdk.TransactionBuilder(account, { fee: 100, - networkPassphrase: StellarSdk.Networks.TESTNET, + networkPassphrase: StellarSdk.Networks.TESTNET }) .addOperation( StellarSdk.Operation.payment({ destination: keypair.publicKey(), asset: StellarSdk.Asset.native(), - amount: "100.50", - }), + amount: '100.50' + }) ) .setTimeout(StellarSdk.TimeoutInfinite) .build(); fakeTransaction.sign(keypair); let tx = encodeURIComponent( - fakeTransaction.toEnvelope().toXDR().toString("base64"), + fakeTransaction.toEnvelope().toXDR().toString('base64') ); this.axiosMock - .expects("post") - .withArgs(sinon.match(serverUrl + "/transactions", `tx=${tx}`)) + .expects('post') + .withArgs(sinon.match(serverUrl + '/transactions', `tx=${tx}`)) .returns(Promise.resolve(randomResult)); server @@ -150,13 +150,13 @@ describe("horizon path tests", function () { let serverUrls = []; //server url without folder path. - serverUrls.push("https://acme.com:1337"); + serverUrls.push('https://acme.com:1337'); //server url folder path. - serverUrls.push("https://acme.com:1337/folder"); + serverUrls.push('https://acme.com:1337/folder'); //server url folder and subfolder path. - serverUrls.push("https://acme.com:1337/folder/subfolder"); + serverUrls.push('https://acme.com:1337/folder/subfolder'); for (var index = 0; index < serverUrls.length; index++) { var serverUrl = serverUrls[index]; diff --git a/test/unit/liquidity_pool_endpoints_test.js b/test/unit/liquidity_pool_endpoints_test.js index 92ab3b196..6d1ed7b02 100644 --- a/test/unit/liquidity_pool_endpoints_test.js +++ b/test/unit/liquidity_pool_endpoints_test.js @@ -3,10 +3,10 @@ function copyJson(js) { return JSON.parse(JSON.stringify(js)); } -const BASE_URL = "https://horizon-live.stellar.org:1337"; -const LP_URL = BASE_URL + "/liquidity_pools"; +const BASE_URL = 'https://horizon-live.stellar.org:1337'; +const LP_URL = BASE_URL + '/liquidity_pools'; -describe("/liquidity_pools tests", function () { +describe('/liquidity_pools tests', function () { beforeEach(function () { this.server = new StellarSdk.Server(BASE_URL); this.axiosMock = sinon.mock(HorizonAxiosClient); @@ -18,66 +18,66 @@ describe("/liquidity_pools tests", function () { this.axiosMock.restore(); }); - it("can create a LiquidityPoolCallBuilder", function () { + it('can create a LiquidityPoolCallBuilder', function () { expect(this.server.liquidityPools()).not.to.be.undefined; }); const rootResponse = { _links: { self: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools?cursor=113725249324879873&limit=10&order=asc' }, next: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools?cursor=113725249324879873&limit=10&order=asc' }, prev: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools?cursor=113725249324879873&limit=10&order=desc", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools?cursor=113725249324879873&limit=10&order=desc' + } }, _embedded: { records: [ { - id: "1", - paging_token: "113725249324879873", + id: '1', + paging_token: '113725249324879873', fee_bp: 30, - type: "constant_product", - total_trustlines: "300", - total_shares: "5000", + type: 'constant_product', + total_trustlines: '300', + total_shares: '5000', reserves: [ { - amount: "1000.0000005", + amount: '1000.0000005', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "2000.0000000", + amount: '2000.0000000', asset: - "PHP:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - }, - ], + 'PHP:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' + } + ] }, { - id: "2", - paging_token: "113725249324879874", + id: '2', + paging_token: '113725249324879874', fee_bp: 30, - type: "constant_product", - total_trustlines: "200", - total_shares: "3500", + type: 'constant_product', + total_trustlines: '200', + total_shares: '3500', reserves: [ { - amount: "1000.0000005", + amount: '1000.0000005', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "1200.0000000", + amount: '1200.0000000', asset: - "USDC:GC5W3BH2MQRQK2H4A6LP3SXDSAAY2W2W64OWKKVNQIAOVWSAHFDEUSDC", - }, - ], - }, - ], - }, + 'USDC:GC5W3BH2MQRQK2H4A6LP3SXDSAAY2W2W64OWKKVNQIAOVWSAHFDEUSDC' + } + ] + } + ] + } }; let emptyResponse = copyJson(rootResponse); @@ -87,17 +87,17 @@ describe("/liquidity_pools tests", function () { phpResponse._embedded.records.pop(); // last elem doesn't have PHP asset const EURT = new StellarSdk.Asset( - "EURT", - "GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT', + 'GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' ); const PHP = new StellarSdk.Asset( - "PHP", - "GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'PHP', + 'GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' ); - it("returns the right root response", function (done) { + it('returns the right root response', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs(sinon.match(LP_URL)) .returns(Promise.resolve({ data: rootResponse })); @@ -111,39 +111,39 @@ describe("/liquidity_pools tests", function () { .catch(done); }); - describe("filters", function () { + describe('filters', function () { const testCases = [ { assets: [StellarSdk.Asset.native()], - response: emptyResponse, + response: emptyResponse }, { assets: [EURT], - response: rootResponse, + response: rootResponse }, { assets: [PHP], - response: phpResponse, + response: phpResponse }, { assets: [EURT, PHP], - response: phpResponse, - }, + response: phpResponse + } ]; testCases.forEach((testCase) => { const queryStr = testCase.assets .map((asset) => asset.toString()) - .join(","); + .join(','); const description = testCase.assets .map((asset) => asset.getCode()) - .join(" + "); + .join(' + '); - it("filters by asset(s) " + description, function (done) { + it('filters by asset(s) ' + description, function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( - sinon.match(`${LP_URL}?reserves=${encodeURIComponent(queryStr)}`), + sinon.match(`${LP_URL}?reserves=${encodeURIComponent(queryStr)}`) ) .returns(Promise.resolve({ data: testCase.response })); @@ -153,7 +153,7 @@ describe("/liquidity_pools tests", function () { .call() .then((pools) => { expect(pools.records).to.deep.equal( - testCase.response._embedded.records, + testCase.response._embedded.records ); done(); }) @@ -161,11 +161,11 @@ describe("/liquidity_pools tests", function () { }); }); - it("filters by account", function (done) { + it('filters by account', function (done) { const accountId = - "GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S"; + 'GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S'; this.axiosMock - .expects("get") + .expects('get') .withArgs(sinon.match(`${LP_URL}?account=${accountId}`)) .returns(Promise.resolve({ data: rootResponse })); @@ -181,43 +181,43 @@ describe("/liquidity_pools tests", function () { }); }); - describe("querying a specific pool", function () { + describe('querying a specific pool', function () { const lpId = - "ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a"; + 'ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a'; - it("checks for valid IDs", function () { + it('checks for valid IDs', function () { expect(() => - this.server.liquidityPools().liquidityPoolId("nonsense"), + this.server.liquidityPools().liquidityPoolId('nonsense') ).to.throw(); expect(() => - this.server.liquidityPools().liquidityPoolId(lpId), + this.server.liquidityPools().liquidityPoolId(lpId) ).not.to.throw(); }); - it("filters by specific ID", function (done) { + it('filters by specific ID', function (done) { const poolResponse = { id: lpId, - paging_token: "113725249324879873", + paging_token: '113725249324879873', fee_bp: 30, - type: "constant_product", - total_trustlines: "300", - total_shares: "5000", + type: 'constant_product', + total_trustlines: '300', + total_shares: '5000', reserves: [ { - amount: "1000.0000005", + amount: '1000.0000005', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "2000.0000000", + amount: '2000.0000000', asset: - "PHP:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - }, - ], + 'PHP:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' + } + ] }; this.axiosMock - .expects("get") + .expects('get') .withArgs(sinon.match(`${LP_URL}/${lpId}`)) .returns(Promise.resolve({ data: poolResponse })); @@ -235,151 +235,151 @@ describe("/liquidity_pools tests", function () { const poolOpsResponse = { _links: { self: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/operations?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/operations?cursor=113725249324879873&limit=10&order=asc' }, next: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/operations?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/operations?cursor=113725249324879873&limit=10&order=asc' }, prev: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/operations?cursor=113725249324879873&limit=10&order=desc", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/operations?cursor=113725249324879873&limit=10&order=desc' + } }, _embedded: { records: [ { - id: "3697472920621057", - paging_token: "3697472920621057", + id: '3697472920621057', + paging_token: '3697472920621057', transaction_successful: true, source_account: - "GBB4JST32UWKOLGYYSCEYBHBCOFL2TGBHDVOMZP462ET4ZRD4ULA7S2L", - type: "liquidity_pool_deposit", + 'GBB4JST32UWKOLGYYSCEYBHBCOFL2TGBHDVOMZP462ET4ZRD4ULA7S2L', + type: 'liquidity_pool_deposit', type_i: 22, - created_at: "2021-11-18T03:47:47Z", + created_at: '2021-11-18T03:47:47Z', transaction_hash: - "43ed5ce19190822ec080b67c3ccbab36a56bc34102b1a21d3ee690ed3bc23378", + '43ed5ce19190822ec080b67c3ccbab36a56bc34102b1a21d3ee690ed3bc23378', liquidity_pool_id: - "ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a", + 'ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a', reserves_max: [ { asset: - "JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - amount: "1000.0000005", + 'JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', + amount: '1000.0000005' }, { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "3000.0000005", - }, + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '3000.0000005' + } ], - min_price: "0.2680000", + min_price: '0.2680000', min_price_r: { n: 67, - d: 250, + d: 250 }, - max_price: "0.3680000", + max_price: '0.3680000', max_price_r: { n: 73, - d: 250, + d: 250 }, reserves_deposited: [ { asset: - "JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - amount: "983.0000005", + 'JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', + amount: '983.0000005' }, { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "2378.0000005", - }, + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '2378.0000005' + } ], - shares_received: "1000", + shares_received: '1000' }, { - id: "3697472920621057", - paging_token: "3697472920621057", + id: '3697472920621057', + paging_token: '3697472920621057', transaction_successful: true, source_account: - "GBB4JST32UWKOLGYYSCEYBHBCOFL2TGBHDVOMZP462ET4ZRD4ULA7S2L", - type: "liquidity_pool_withdraw", + 'GBB4JST32UWKOLGYYSCEYBHBCOFL2TGBHDVOMZP462ET4ZRD4ULA7S2L', + type: 'liquidity_pool_withdraw', type_i: 23, - created_at: "2021-11-18T03:47:47Z", + created_at: '2021-11-18T03:47:47Z', transaction_hash: - "43ed5ce19190822ec080b67c3ccbab36a56bc34102b1a21d3ee690ed3bc23378", + '43ed5ce19190822ec080b67c3ccbab36a56bc34102b1a21d3ee690ed3bc23378', liquidity_pool_id: - "ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a", + 'ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a', reserves_min: [ { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - min: "1000.0000005", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + min: '1000.0000005' }, { asset: - "PHP:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - min: "3000.0000005", - }, + 'PHP:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + min: '3000.0000005' + } ], - shares: "200", + shares: '200', reserves_received: [ { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "993.0000005", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '993.0000005' }, { asset: - "PHP:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "2478.0000005", - }, - ], + 'PHP:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '2478.0000005' + } + ] }, { - id: "157639717969326081", - paging_token: "157639717969326081", + id: '157639717969326081', + paging_token: '157639717969326081', transaction_successful: true, source_account: - "GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG", - type: "change_trust", + 'GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG', + type: 'change_trust', type_i: 6, - created_at: "2021-08-04T20:01:24Z", + created_at: '2021-08-04T20:01:24Z', transaction_hash: - "941f2fa2101d1265696a3c7d35e7688cd210324114e96b64a386ab55f65e488f", - asset_type: "liquidity_pool_shares", + '941f2fa2101d1265696a3c7d35e7688cd210324114e96b64a386ab55f65e488f', + asset_type: 'liquidity_pool_shares', liquidity_pool_id: - "ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a", - limit: "1000", - trustor: "GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG", + 'ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a', + limit: '1000', + trustor: 'GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG' }, { - id: "157235845014249474-0", - paging_token: "157235845014249474-0", - ledger_close_time: "2021-07-29T21:10:53Z", - trade_type: "liquidity_pool", - base_liquidity_pool_id: "abcdef", + id: '157235845014249474-0', + paging_token: '157235845014249474-0', + ledger_close_time: '2021-07-29T21:10:53Z', + trade_type: 'liquidity_pool', + base_liquidity_pool_id: 'abcdef', liquidity_pool_fee_bp: 30, - base_amount: "0.0002007", - base_asset_type: "native", + base_amount: '0.0002007', + base_asset_type: 'native', counter_account: - "GDW634JZX3VMEF2RZTCJTT34RITIMNX46QOGTYHCJEJL3MM7BLOQ6HOW", - counter_amount: "0.0022300", - counter_asset_type: "credit_alphanum4", - counter_asset_code: "VZT", + 'GDW634JZX3VMEF2RZTCJTT34RITIMNX46QOGTYHCJEJL3MM7BLOQ6HOW', + counter_amount: '0.0022300', + counter_asset_type: 'credit_alphanum4', + counter_asset_code: 'VZT', counter_asset_issuer: - "GBENYXZDFFR2J4F4DB3YPBBAM244TXYOTIOOUQI5DBT3OKUU4ZJ2M7NO", + 'GBENYXZDFFR2J4F4DB3YPBBAM244TXYOTIOOUQI5DBT3OKUU4ZJ2M7NO', base_is_seller: false, price: { - n: "10000000", - d: "899997", - }, - }, - ], - }, + n: '10000000', + d: '899997' + } + } + ] + } }; - it("retrieves its operations", function (done) { + it('retrieves its operations', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs(sinon.match(`${LP_URL}/${lpId}/operations`)) .returns(Promise.resolve({ data: poolOpsResponse })); @@ -389,7 +389,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolOps) => { expect(poolOps.records).to.deep.equal( - poolOpsResponse._embedded.records, + poolOpsResponse._embedded.records ); done(); }) @@ -399,79 +399,79 @@ describe("/liquidity_pools tests", function () { const poolTxsResponse = { _links: { self: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/transactions?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/transactions?cursor=113725249324879873&limit=10&order=asc' }, next: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/transactions?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/transactions?cursor=113725249324879873&limit=10&order=asc' }, prev: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/transactions?cursor=113725249324879873&limit=10&order=desc", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/transactions?cursor=113725249324879873&limit=10&order=desc' + } }, _embedded: { records: [ { _links: { self: { - href: "https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908", + href: 'https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908' }, account: { - href: "https://private-33c60-amm3.apiary-mock.com/accounts/GAHQN6YNYD6ZT7TLAVE4R36MSZWQJZ22XB3WD4RLSHURMXHW4VHJIDF7", + href: 'https://private-33c60-amm3.apiary-mock.com/accounts/GAHQN6YNYD6ZT7TLAVE4R36MSZWQJZ22XB3WD4RLSHURMXHW4VHJIDF7' }, ledger: { - href: "https://private-33c60-amm3.apiary-mock.com/ledgers/895788", + href: 'https://private-33c60-amm3.apiary-mock.com/ledgers/895788' }, operations: { - href: "https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908/operations", - templated: true, + href: 'https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908/operations', + templated: true }, effects: { - href: "https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908/effects", - templated: true, + href: 'https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908/effects', + templated: true }, precedes: { - href: "https://private-33c60-amm3.apiary-mock.com/transactions?order=asc&cursor=3847380164161536", + href: 'https://private-33c60-amm3.apiary-mock.com/transactions?order=asc&cursor=3847380164161536' }, succeeds: { - href: "https://private-33c60-amm3.apiary-mock.com/transactions?order=desc&cursor=3847380164161536", + href: 'https://private-33c60-amm3.apiary-mock.com/transactions?order=desc&cursor=3847380164161536' }, transaction: { - href: "https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908' + } }, - id: "2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908", - paging_token: "3847380164161536", + id: '2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908', + paging_token: '3847380164161536', successful: true, - hash: "2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908", + hash: '2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908', ledger: 895788, - created_at: "2021-08-09T20:53:11Z", + created_at: '2021-08-09T20:53:11Z', source_account: - "GAHQN6YNYD6ZT7TLAVE4R36MSZWQJZ22XB3WD4RLSHURMXHW4VHJIDF7", - source_account_sequence: "3847371574214658", + 'GAHQN6YNYD6ZT7TLAVE4R36MSZWQJZ22XB3WD4RLSHURMXHW4VHJIDF7', + source_account_sequence: '3847371574214658', fee_account: - "GAHQN6YNYD6ZT7TLAVE4R36MSZWQJZ22XB3WD4RLSHURMXHW4VHJIDF7", - fee_charged: "10000", - max_fee: "10001", + 'GAHQN6YNYD6ZT7TLAVE4R36MSZWQJZ22XB3WD4RLSHURMXHW4VHJIDF7', + fee_charged: '10000', + max_fee: '10001', operation_count: 1, envelope_xdr: - "AAAAAgAAAAAPBvsNwP2Z/msFScjvzJZt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AAgAAAAMADasrAAAAAAAAAAAPBvsNwP2Z/msFScjvzJZtBOdauHdh8iuR6RZc9uVOlAAAAAAa0nQcAA2rKgAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEADassAAAAAAAAAAAPBvsNwP2Z/msFScjvzJZtBOdauHdh8iuR6RZc9uVOlAAAAAAa0k0MAA2rKgAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==", - memo_type: "none", + 'AAAAAgAAAAMADasrAAAAAAAAAAAPBvsNwP2Z/msFScjvzJZtBOdauHdh8iuR6RZc9uVOlAAAAAAa0nQcAA2rKgAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEADassAAAAAAAAAAAPBvsNwP2Z/msFScjvzJZtBOdauHdh8iuR6RZc9uVOlAAAAAAa0k0MAA2rKgAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==', + memo_type: 'none', signatures: [ - "l5kbKF5kYiY1K7W5A2WEZ82nObNQlVeINkZSIASLkLcttZ6c9wNVYVHEpgMfhprMhsVRbyK3HbLU2sCZZsvZBQ==", - ], - }, - ], - }, + 'l5kbKF5kYiY1K7W5A2WEZ82nObNQlVeINkZSIASLkLcttZ6c9wNVYVHEpgMfhprMhsVRbyK3HbLU2sCZZsvZBQ==' + ] + } + ] + } }; - it("retrieves its transactions", function (done) { + it('retrieves its transactions', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs(sinon.match(`${LP_URL}/${lpId}/transactions`)) .returns(Promise.resolve({ data: poolTxsResponse })); @@ -481,7 +481,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolTxs) => { expect(poolTxs.records).to.deep.equal( - poolTxsResponse._embedded.records, + poolTxsResponse._embedded.records ); done(); }) @@ -491,263 +491,263 @@ describe("/liquidity_pools tests", function () { const poolEffectsResponse = { _links: { self: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/effects?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/effects?cursor=113725249324879873&limit=10&order=asc' }, next: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/effects?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/effects?cursor=113725249324879873&limit=10&order=asc' }, prev: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/effects?cursor=113725249324879873&limit=10&order=asc", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a/effects?cursor=113725249324879873&limit=10&order=asc' + } }, _embedded: { records: [ { _links: { operation: { - href: "https://private-33c60-amm3.apiary-mock.com/operations/3849085266190337", + href: 'https://private-33c60-amm3.apiary-mock.com/operations/3849085266190337' }, succeeds: { - href: "https://private-33c60-amm3.apiary-mock.com/effects?order=desc&cursor=3849085266190337-1", + href: 'https://private-33c60-amm3.apiary-mock.com/effects?order=desc&cursor=3849085266190337-1' }, precedes: { - href: "https://private-33c60-amm3.apiary-mock.com/effects?order=asc&cursor=3849085266190337-1", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/effects?order=asc&cursor=3849085266190337-1' + } }, - id: "0000000012884905986-0000000001", - paging_token: "12884905986-2", - account: "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - type: "liquidity_pool_deposited", + id: '0000000012884905986-0000000001', + paging_token: '12884905986-2', + account: 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + type: 'liquidity_pool_deposited', type_i: 81, - created_at: "2021-11-18T03:15:54Z", + created_at: '2021-11-18T03:15:54Z', liquidity_pool: { - id: "abcdef", + id: 'abcdef', fee_bp: 30, - type: "constant_product", - total_trustlines: "300", - total_shares: "5000", + type: 'constant_product', + total_trustlines: '300', + total_shares: '5000', reserves: [ { - amount: "1000.0000005", + amount: '1000.0000005', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "2000.0000000", + amount: '2000.0000000', asset: - "PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP", - }, - ], + 'PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP' + } + ] }, reserves_deposited: [ { asset: - "JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - amount: "983.0000005", + 'JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', + amount: '983.0000005' }, { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "2378.0000005", - }, + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '2378.0000005' + } ], - shares_received: "1000", + shares_received: '1000' }, { - id: "0000000012884905986-0000000002", - paging_token: "12884905986-2", - account: "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - type: "liquidity_pool_withdrew", + id: '0000000012884905986-0000000002', + paging_token: '12884905986-2', + account: 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + type: 'liquidity_pool_withdrew', type_i: 82, - created_at: "2021-11-18T03:15:54Z", + created_at: '2021-11-18T03:15:54Z', liquidity_pool: { - id: "abcdef", + id: 'abcdef', fee_bp: 30, - type: "constant_product", - total_trustlines: "299", - total_shares: "4000", + type: 'constant_product', + total_trustlines: '299', + total_shares: '4000', reserves: [ { - amount: "7.0000005", + amount: '7.0000005', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "1.0000000", + amount: '1.0000000', asset: - "PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP", - }, - ], + 'PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP' + } + ] }, reserves_received: [ { asset: - "JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - amount: "993.0000005", + 'JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', + amount: '993.0000005' }, { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "2478.0000005", - }, + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '2478.0000005' + } ], - shares_redeemed: "1000", + shares_redeemed: '1000' }, { - id: "0000000012884905986-0000000003", - paging_token: "12884905986-2", - account: "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - type: "liquidity_pool_trade", + id: '0000000012884905986-0000000003', + paging_token: '12884905986-2', + account: 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + type: 'liquidity_pool_trade', type_i: 83, - created_at: "2021-11-18T03:15:54Z", + created_at: '2021-11-18T03:15:54Z', liquidity_pool: { - id: "abcdef", + id: 'abcdef', fee_bp: 30, - type: "constant_product", - total_trustlines: "300", - total_shares: "5000", + type: 'constant_product', + total_trustlines: '300', + total_shares: '5000', reserves: [ { - amount: "1000.0000005", + amount: '1000.0000005', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "2000.0000000", + amount: '2000.0000000', asset: - "PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP", - }, - ], + 'PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP' + } + ] }, sold: { asset: - "JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - amount: "983.0000005", + 'JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', + amount: '983.0000005' }, bought: { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "2378.0000005", - }, + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '2378.0000005' + } }, { - id: "0000000012884905986-0000000004", - paging_token: "12884905986-2", - account: "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - type: "liquidity_pool_created", + id: '0000000012884905986-0000000004', + paging_token: '12884905986-2', + account: 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + type: 'liquidity_pool_created', type_i: 84, - created_at: "2021-11-18T03:15:54Z", + created_at: '2021-11-18T03:15:54Z', liquidity_pool: { - id: "abcdef", + id: 'abcdef', fee_bp: 30, - type: "constant_product", - total_trustlines: "1", - total_shares: "0", + type: 'constant_product', + total_trustlines: '1', + total_shares: '0', reserves: [ { - amount: "0", + amount: '0', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "0", + amount: '0', asset: - "PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP", - }, - ], - }, + 'PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP' + } + ] + } }, { - id: "0000000012884905986-0000000005", - paging_token: "12884905986-2", - account: "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - type: "liquidity_pool_removed", + id: '0000000012884905986-0000000005', + paging_token: '12884905986-2', + account: 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + type: 'liquidity_pool_removed', type_i: 85, - created_at: "2021-11-18T03:15:54Z", - liquidity_pool_id: "abcdef", + created_at: '2021-11-18T03:15:54Z', + liquidity_pool_id: 'abcdef' }, { - id: "0000000012884905986-0000000006", - paging_token: "12884905986-2", - account: "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - type: "liquidity_pool_revoked", + id: '0000000012884905986-0000000006', + paging_token: '12884905986-2', + account: 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + type: 'liquidity_pool_revoked', type_i: 86, - created_at: "2021-11-18T03:15:54Z", + created_at: '2021-11-18T03:15:54Z', liquidity_pool: { - id: "abcdef", + id: 'abcdef', fee_bp: 30, - type: "constant_product", - total_trustlines: "299", - total_shares: "4000", + type: 'constant_product', + total_trustlines: '299', + total_shares: '4000', reserves: [ { - amount: "7.0000005", + amount: '7.0000005', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "1.0000000", + amount: '1.0000000', asset: - "PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP", - }, - ], + 'PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP' + } + ] }, reserves_revoked: [ { asset: - "JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - amount: "993.0000005", - claimable_balance_id: "cbid1235", + 'JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', + amount: '993.0000005', + claimable_balance_id: 'cbid1235' }, { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "2478.0000005", - claimable_balance_id: "idcbd1234", - }, + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '2478.0000005', + claimable_balance_id: 'idcbd1234' + } ], - shares_revoked: "1000", + shares_revoked: '1000' }, { - id: "0000000012884905986-0000000007", - paging_token: "157639717969326081-1", - account: "GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG", - type: "trustline_created", + id: '0000000012884905986-0000000007', + paging_token: '157639717969326081-1', + account: 'GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG', + type: 'trustline_created', type_i: 20, - created_at: "2021-08-04T20:01:24Z", - asset_type: "liquidity_pool_shares", - liquidity_pool_id: "abcdef", - limit: "1000", + created_at: '2021-08-04T20:01:24Z', + asset_type: 'liquidity_pool_shares', + liquidity_pool_id: 'abcdef', + limit: '1000' }, { - id: "0000000012884905986-0000000008", - paging_token: "157639717969326081-1", - account: "GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG", - type: "trustline_updated", + id: '0000000012884905986-0000000008', + paging_token: '157639717969326081-1', + account: 'GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG', + type: 'trustline_updated', type_i: 22, - created_at: "2021-08-04T20:01:24Z", - asset_type: "liquidity_pool_shares", - liquidity_pool_id: "abcdef", - limit: "2000", + created_at: '2021-08-04T20:01:24Z', + asset_type: 'liquidity_pool_shares', + liquidity_pool_id: 'abcdef', + limit: '2000' }, { - id: "0000000012884905986-0000000009", - paging_token: "157639717969326081-1", - account: "GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG", - type: "trustline_removed", + id: '0000000012884905986-0000000009', + paging_token: '157639717969326081-1', + account: 'GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG', + type: 'trustline_removed', type_i: 21, - created_at: "2021-08-04T20:01:24Z", - asset_type: "liquidity_pool_shares", - liquidity_pool_id: "abcdef", - limit: "0.0000000", - }, - ], - }, + created_at: '2021-08-04T20:01:24Z', + asset_type: 'liquidity_pool_shares', + liquidity_pool_id: 'abcdef', + limit: '0.0000000' + } + ] + } }; - it("retrieves its effects", function (done) { + it('retrieves its effects', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs(sinon.match(`${LP_URL}/${lpId}/effects`)) .returns(Promise.resolve({ data: poolEffectsResponse })); @@ -757,7 +757,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolEffects) => { expect(poolEffects.records).to.deep.equal( - poolEffectsResponse._embedded.records, + poolEffectsResponse._embedded.records ); done(); }) @@ -767,63 +767,63 @@ describe("/liquidity_pools tests", function () { const poolTradesResponse = { _links: { self: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/3b476aff8a406a6ec3b61d5c038009cef85f2ddfaf616822dc4fec92845149b4/trades?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/3b476aff8a406a6ec3b61d5c038009cef85f2ddfaf616822dc4fec92845149b4/trades?cursor=113725249324879873&limit=10&order=asc' }, next: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/3b476aff8a406a6ec3b61d5c038009cef85f2ddfaf616822dc4fec92845149b4/trades?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/3b476aff8a406a6ec3b61d5c038009cef85f2ddfaf616822dc4fec92845149b4/trades?cursor=113725249324879873&limit=10&order=asc' }, prev: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/3b476aff8a406a6ec3b61d5c038009cef85f2ddfaf616822dc4fec92845149b4/trades?cursor=113725249324879873&limit=10&order=asc", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/3b476aff8a406a6ec3b61d5c038009cef85f2ddfaf616822dc4fec92845149b4/trades?cursor=113725249324879873&limit=10&order=asc' + } }, _embedded: { records: [ { _links: { self: { - href: "", + href: '' }, base: { - href: "https://private-33c60-amm3.apiary-mock.com/accounts/GAVH5JM5OKXGMQDS7YPRJ4MQCPXJUGH26LYQPQJ4SOMOJ4SXY472ZM7G", + href: 'https://private-33c60-amm3.apiary-mock.com/accounts/GAVH5JM5OKXGMQDS7YPRJ4MQCPXJUGH26LYQPQJ4SOMOJ4SXY472ZM7G' }, counter: { - href: "https://private-33c60-amm3.apiary-mock.com/accounts/GBB4JST32UWKOLGYYSCEYBHBCOFL2TGBHDVOMZP462ET4ZRD4ULA7S2L", + href: 'https://private-33c60-amm3.apiary-mock.com/accounts/GBB4JST32UWKOLGYYSCEYBHBCOFL2TGBHDVOMZP462ET4ZRD4ULA7S2L' }, operation: { - href: "https://private-33c60-amm3.apiary-mock.com/operations/3697472920621057", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/operations/3697472920621057' + } }, - id: "3697472920621057-0", - paging_token: "3697472920621057-0", - ledger_close_time: "2015-11-18T03:47:47Z", - offer_id: "9", - base_offer_id: "9", + id: '3697472920621057-0', + paging_token: '3697472920621057-0', + ledger_close_time: '2015-11-18T03:47:47Z', + offer_id: '9', + base_offer_id: '9', base_account: - "GAVH5JM5OKXGMQDS7YPRJ4MQCPXJUGH26LYQPQJ4SOMOJ4SXY472ZM7G", - base_amount: "10.0000000", - base_asset_type: "native", + 'GAVH5JM5OKXGMQDS7YPRJ4MQCPXJUGH26LYQPQJ4SOMOJ4SXY472ZM7G', + base_amount: '10.0000000', + base_asset_type: 'native', counter_liquidity_pool: - "3b476aff8a406a6ec3b61d5c038009cef85f2ddfaf616822dc4fec92845149b4", - liquidity_pool_fee_bp: "30", - counter_amount: "2.6700000", - counter_asset_type: "credit_alphanum4", - counter_asset_code: "JPY", + '3b476aff8a406a6ec3b61d5c038009cef85f2ddfaf616822dc4fec92845149b4', + liquidity_pool_fee_bp: '30', + counter_amount: '2.6700000', + counter_asset_type: 'credit_alphanum4', + counter_asset_code: 'JPY', counter_asset_issuer: - "GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", + 'GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', base_is_seller: true, price: { - n: "267", - d: "1000", + n: '267', + d: '1000' }, - trade_type: "liquidity_pool", - }, - ], - }, + trade_type: 'liquidity_pool' + } + ] + } }; - it("retrieves its trades", function (done) { + it('retrieves its trades', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs(sinon.match(`${LP_URL}/${lpId}/trades`)) .returns(Promise.resolve({ data: poolTradesResponse })); @@ -833,7 +833,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolTrades) => { expect(poolTrades.records).to.deep.equal( - poolTradesResponse._embedded.records, + poolTradesResponse._embedded.records ); done(); }) @@ -841,156 +841,156 @@ describe("/liquidity_pools tests", function () { }); }); - describe("querying a specific pool", function () { + describe('querying a specific pool', function () { const lpId = - "ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a"; + 'ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a'; const poolOpsResponse = { _links: { self: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/1/operations?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/1/operations?cursor=113725249324879873&limit=10&order=asc' }, next: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/1/operations?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/1/operations?cursor=113725249324879873&limit=10&order=asc' }, prev: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/1/operations?cursor=113725249324879873&limit=10&order=desc", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/1/operations?cursor=113725249324879873&limit=10&order=desc' + } }, _embedded: { records: [ { - id: "3697472920621057", - paging_token: "3697472920621057", + id: '3697472920621057', + paging_token: '3697472920621057', transaction_successful: true, source_account: - "GBB4JST32UWKOLGYYSCEYBHBCOFL2TGBHDVOMZP462ET4ZRD4ULA7S2L", - type: "liquidity_pool_deposit", + 'GBB4JST32UWKOLGYYSCEYBHBCOFL2TGBHDVOMZP462ET4ZRD4ULA7S2L', + type: 'liquidity_pool_deposit', type_i: 22, - created_at: "2021-11-18T03:47:47Z", + created_at: '2021-11-18T03:47:47Z', transaction_hash: - "43ed5ce19190822ec080b67c3ccbab36a56bc34102b1a21d3ee690ed3bc23378", + '43ed5ce19190822ec080b67c3ccbab36a56bc34102b1a21d3ee690ed3bc23378', liquidity_pool_id: - "ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a", + 'ae44a51f6191ce24414fbd1326e93ccb0ae656f07fc1e37602b11d0802f74b9a', reserves_max: [ { asset: - "JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - amount: "1000.0000005", + 'JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', + amount: '1000.0000005' }, { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "3000.0000005", - }, + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '3000.0000005' + } ], - min_price: "0.2680000", + min_price: '0.2680000', min_price_r: { n: 67, - d: 250, + d: 250 }, - max_price: "0.3680000", + max_price: '0.3680000', max_price_r: { n: 73, - d: 250, + d: 250 }, reserves_deposited: [ { asset: - "JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - amount: "983.0000005", + 'JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', + amount: '983.0000005' }, { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "2378.0000005", - }, + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '2378.0000005' + } ], - shares_received: "1000", + shares_received: '1000' }, { - id: "3697472920621057", - paging_token: "3697472920621057", + id: '3697472920621057', + paging_token: '3697472920621057', transaction_successful: true, source_account: - "GBB4JST32UWKOLGYYSCEYBHBCOFL2TGBHDVOMZP462ET4ZRD4ULA7S2L", - type: "liquidity_pool_withdraw", + 'GBB4JST32UWKOLGYYSCEYBHBCOFL2TGBHDVOMZP462ET4ZRD4ULA7S2L', + type: 'liquidity_pool_withdraw', type_i: 23, - created_at: "2021-11-18T03:47:47Z", + created_at: '2021-11-18T03:47:47Z', transaction_hash: - "43ed5ce19190822ec080b67c3ccbab36a56bc34102b1a21d3ee690ed3bc23378", - liquidity_pool_id: "1", + '43ed5ce19190822ec080b67c3ccbab36a56bc34102b1a21d3ee690ed3bc23378', + liquidity_pool_id: '1', reserves_min: [ { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - min: "1000.0000005", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + min: '1000.0000005' }, { asset: - "PHP:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - min: "3000.0000005", - }, + 'PHP:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + min: '3000.0000005' + } ], - shares: "200", + shares: '200', reserves_received: [ { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "993.0000005", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '993.0000005' }, { asset: - "PHP:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "2478.0000005", - }, - ], + 'PHP:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '2478.0000005' + } + ] }, { - id: "157639717969326081", - paging_token: "157639717969326081", + id: '157639717969326081', + paging_token: '157639717969326081', transaction_successful: true, source_account: - "GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG", - type: "change_trust", + 'GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG', + type: 'change_trust', type_i: 6, - created_at: "2021-08-04T20:01:24Z", + created_at: '2021-08-04T20:01:24Z', transaction_hash: - "941f2fa2101d1265696a3c7d35e7688cd210324114e96b64a386ab55f65e488f", - asset_type: "liquidity_pool_shares", - liquidity_pool_id: "1", - limit: "1000", - trustor: "GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG", + '941f2fa2101d1265696a3c7d35e7688cd210324114e96b64a386ab55f65e488f', + asset_type: 'liquidity_pool_shares', + liquidity_pool_id: '1', + limit: '1000', + trustor: 'GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG' }, { - id: "157235845014249474-0", - paging_token: "157235845014249474-0", - ledger_close_time: "2021-07-29T21:10:53Z", - trade_type: "liquidity_pool", - base_liquidity_pool_id: "abcdef", + id: '157235845014249474-0', + paging_token: '157235845014249474-0', + ledger_close_time: '2021-07-29T21:10:53Z', + trade_type: 'liquidity_pool', + base_liquidity_pool_id: 'abcdef', liquidity_pool_fee_bp: 30, - base_amount: "0.0002007", - base_asset_type: "native", + base_amount: '0.0002007', + base_asset_type: 'native', counter_account: - "GDW634JZX3VMEF2RZTCJTT34RITIMNX46QOGTYHCJEJL3MM7BLOQ6HOW", - counter_amount: "0.0022300", - counter_asset_type: "credit_alphanum4", - counter_asset_code: "VZT", + 'GDW634JZX3VMEF2RZTCJTT34RITIMNX46QOGTYHCJEJL3MM7BLOQ6HOW', + counter_amount: '0.0022300', + counter_asset_type: 'credit_alphanum4', + counter_asset_code: 'VZT', counter_asset_issuer: - "GBENYXZDFFR2J4F4DB3YPBBAM244TXYOTIOOUQI5DBT3OKUU4ZJ2M7NO", + 'GBENYXZDFFR2J4F4DB3YPBBAM244TXYOTIOOUQI5DBT3OKUU4ZJ2M7NO', base_is_seller: false, price: { - n: "10000000", - d: "899997", - }, - }, - ], - }, + n: '10000000', + d: '899997' + } + } + ] + } }; - it("retrieves its operations", function (done) { + it('retrieves its operations', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs(sinon.match(`${LP_URL}/${lpId}/operations`)) .returns(Promise.resolve({ data: poolOpsResponse })); @@ -1000,7 +1000,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolOps) => { expect(poolOps.records).to.deep.equal( - poolOpsResponse._embedded.records, + poolOpsResponse._embedded.records ); done(); }) @@ -1010,79 +1010,79 @@ describe("/liquidity_pools tests", function () { const poolTxsResponse = { _links: { self: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/1/transactions?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/1/transactions?cursor=113725249324879873&limit=10&order=asc' }, next: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/1/transactions?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/1/transactions?cursor=113725249324879873&limit=10&order=asc' }, prev: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools/1/transactions?cursor=113725249324879873&limit=10&order=desc", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools/1/transactions?cursor=113725249324879873&limit=10&order=desc' + } }, _embedded: { records: [ { _links: { self: { - href: "https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908", + href: 'https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908' }, account: { - href: "https://private-33c60-amm3.apiary-mock.com/accounts/GAHQN6YNYD6ZT7TLAVE4R36MSZWQJZ22XB3WD4RLSHURMXHW4VHJIDF7", + href: 'https://private-33c60-amm3.apiary-mock.com/accounts/GAHQN6YNYD6ZT7TLAVE4R36MSZWQJZ22XB3WD4RLSHURMXHW4VHJIDF7' }, ledger: { - href: "https://private-33c60-amm3.apiary-mock.com/ledgers/895788", + href: 'https://private-33c60-amm3.apiary-mock.com/ledgers/895788' }, operations: { - href: "https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908/operations", - templated: true, + href: 'https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908/operations', + templated: true }, effects: { - href: "https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908/effects", - templated: true, + href: 'https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908/effects', + templated: true }, precedes: { - href: "https://private-33c60-amm3.apiary-mock.com/transactions?order=asc&cursor=3847380164161536", + href: 'https://private-33c60-amm3.apiary-mock.com/transactions?order=asc&cursor=3847380164161536' }, succeeds: { - href: "https://private-33c60-amm3.apiary-mock.com/transactions?order=desc&cursor=3847380164161536", + href: 'https://private-33c60-amm3.apiary-mock.com/transactions?order=desc&cursor=3847380164161536' }, transaction: { - href: "https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/transactions/2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908' + } }, - id: "2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908", - paging_token: "3847380164161536", + id: '2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908', + paging_token: '3847380164161536', successful: true, - hash: "2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908", + hash: '2ff47e1bafe68639276b2a8df0a73597ee0c062fbcc72d121af314fe7851c908', ledger: 895788, - created_at: "2021-08-09T20:53:11Z", + created_at: '2021-08-09T20:53:11Z', source_account: - "GAHQN6YNYD6ZT7TLAVE4R36MSZWQJZ22XB3WD4RLSHURMXHW4VHJIDF7", - source_account_sequence: "3847371574214658", + 'GAHQN6YNYD6ZT7TLAVE4R36MSZWQJZ22XB3WD4RLSHURMXHW4VHJIDF7', + source_account_sequence: '3847371574214658', fee_account: - "GAHQN6YNYD6ZT7TLAVE4R36MSZWQJZ22XB3WD4RLSHURMXHW4VHJIDF7", - fee_charged: "10000", - max_fee: "10001", + 'GAHQN6YNYD6ZT7TLAVE4R36MSZWQJZ22XB3WD4RLSHURMXHW4VHJIDF7', + fee_charged: '10000', + max_fee: '10001', operation_count: 1, envelope_xdr: - "AAAAAgAAAAAPBvsNwP2Z/msFScjvzJZtBOdauHdh8iuR6RZc9uVOlAAAJxEADasqAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAADwb7DcD9mf5rBUnI78yWbQTnWrh3YfIrkekWXPblTpQAAAAGAAAAAVNFQwAAAAAAm6XFaVsf8OSuS9C9gMplyTjagE9jAnnqwxSDJ6fin6IAsaK8LsUAAAAAAAAAAAAB9uVOlAAAAECXmRsoXmRiJjUrtbkDZYRnzac5s1CVV4g2RlIgBIuQty21npz3A1VhUcSmAx+GmsyGxVFvIrcdstTawJlmy9kF", - result_xdr: "AAAAAAAAJxAAAAAAAAAAAQAAAAAAAAAGAAAAAAAAAAA=", + 'AAAAAgAAAAAPBvsNwP2Z/msFScjvzJZtBOdauHdh8iuR6RZc9uVOlAAAJxEADasqAAAAAgAAAAAAAAAAAAAAAQAAAAEAAAAADwb7DcD9mf5rBUnI78yWbQTnWrh3YfIrkekWXPblTpQAAAAGAAAAAVNFQwAAAAAAm6XFaVsf8OSuS9C9gMplyTjagE9jAnnqwxSDJ6fin6IAsaK8LsUAAAAAAAAAAAAB9uVOlAAAAECXmRsoXmRiJjUrtbkDZYRnzac5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ttZ6c9wNVYVHEpgMfhprMhsVRbyK3HbLU2sCZZsvZBQ==", - ], - }, - ], - }, + 'l5kbKF5kYiY1K7W5A2WEZ82nObNQlVeINkZSIASLkLcttZ6c9wNVYVHEpgMfhprMhsVRbyK3HbLU2sCZZsvZBQ==' + ] + } + ] + } }; - it("retrieves its transactions", function (done) { + it('retrieves its transactions', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs(sinon.match(`${LP_URL}/${lpId}/transactions`)) .returns(Promise.resolve({ data: poolTxsResponse })); @@ -1092,7 +1092,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolTxs) => { expect(poolTxs.records).to.deep.equal( - poolTxsResponse._embedded.records, + poolTxsResponse._embedded.records ); done(); }) @@ -1102,263 +1102,263 @@ describe("/liquidity_pools tests", function () { const poolFxsResponse = { _links: { self: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools?cursor=113725249324879873&limit=10&order=asc' }, next: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools?cursor=113725249324879873&limit=10&order=asc", + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools?cursor=113725249324879873&limit=10&order=asc' }, prev: { - href: "https://private-33c60-amm3.apiary-mock.com/liquidity_pools?cursor=113725249324879873&limit=10&order=asc", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/liquidity_pools?cursor=113725249324879873&limit=10&order=asc' + } }, _embedded: { records: [ { _links: { operation: { - href: "https://private-33c60-amm3.apiary-mock.com/operations/3849085266190337", + href: 'https://private-33c60-amm3.apiary-mock.com/operations/3849085266190337' }, succeeds: { - href: "https://private-33c60-amm3.apiary-mock.com/effects?order=desc&cursor=3849085266190337-1", + href: 'https://private-33c60-amm3.apiary-mock.com/effects?order=desc&cursor=3849085266190337-1' }, precedes: { - href: "https://private-33c60-amm3.apiary-mock.com/effects?order=asc&cursor=3849085266190337-1", - }, + href: 'https://private-33c60-amm3.apiary-mock.com/effects?order=asc&cursor=3849085266190337-1' + } }, - id: "0000000012884905986-0000000001", - paging_token: "12884905986-2", - account: "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - type: "liquidity_pool_deposited", + id: '0000000012884905986-0000000001', + paging_token: '12884905986-2', + account: 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + type: 'liquidity_pool_deposited', type_i: 81, - created_at: "2021-11-18T03:15:54Z", + created_at: '2021-11-18T03:15:54Z', liquidity_pool: { - id: "abcdef", + id: 'abcdef', fee_bp: 30, - type: "constant_product", - total_trustlines: "300", - total_shares: "5000", + type: 'constant_product', + total_trustlines: '300', + total_shares: '5000', reserves: [ { - amount: "1000.0000005", + amount: '1000.0000005', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "2000.0000000", + amount: '2000.0000000', asset: - "PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP", - }, - ], + 'PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP' + } + ] }, reserves_deposited: [ { asset: - "JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - amount: "983.0000005", + 'JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', + amount: '983.0000005' }, { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "2378.0000005", - }, + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '2378.0000005' + } ], - shares_received: "1000", + shares_received: '1000' }, { - id: "0000000012884905986-0000000002", - paging_token: "12884905986-2", - account: "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - type: "liquidity_pool_withdrew", + id: '0000000012884905986-0000000002', + paging_token: '12884905986-2', + account: 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + type: 'liquidity_pool_withdrew', type_i: 82, - created_at: "2021-11-18T03:15:54Z", + created_at: '2021-11-18T03:15:54Z', liquidity_pool: { - id: "abcdef", + id: 'abcdef', fee_bp: 30, - type: "constant_product", - total_trustlines: "299", - total_shares: "4000", + type: 'constant_product', + total_trustlines: '299', + total_shares: '4000', reserves: [ { - amount: "7.0000005", + amount: '7.0000005', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "1.0000000", + amount: '1.0000000', asset: - "PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP", - }, - ], + 'PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP' + } + ] }, reserves_received: [ { asset: - "JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - amount: "993.0000005", + 'JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', + amount: '993.0000005' }, { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "2478.0000005", - }, + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '2478.0000005' + } ], - shares_redeemed: "1000", + shares_redeemed: '1000' }, { - id: "0000000012884905986-0000000003", - paging_token: "12884905986-2", - account: "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - type: "liquidity_pool_trade", + id: '0000000012884905986-0000000003', + paging_token: '12884905986-2', + account: 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + type: 'liquidity_pool_trade', type_i: 83, - created_at: "2021-11-18T03:15:54Z", + created_at: '2021-11-18T03:15:54Z', liquidity_pool: { - id: "abcdef", + id: 'abcdef', fee_bp: 30, - type: "constant_product", - total_trustlines: "300", - total_shares: "5000", + type: 'constant_product', + total_trustlines: '300', + total_shares: '5000', reserves: [ { - amount: "1000.0000005", + amount: '1000.0000005', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "2000.0000000", + amount: '2000.0000000', asset: - "PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP", - }, - ], + 'PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP' + } + ] }, sold: { asset: - "JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - amount: "983.0000005", + 'JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', + amount: '983.0000005' }, bought: { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "2378.0000005", - }, + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '2378.0000005' + } }, { - id: "0000000012884905986-0000000004", - paging_token: "12884905986-2", - account: "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - type: "liquidity_pool_created", + id: '0000000012884905986-0000000004', + paging_token: '12884905986-2', + account: 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + type: 'liquidity_pool_created', type_i: 84, - created_at: "2021-11-18T03:15:54Z", + created_at: '2021-11-18T03:15:54Z', liquidity_pool: { - id: "abcdef", + id: 'abcdef', fee_bp: 30, - type: "constant_product", - total_trustlines: "1", - total_shares: "0", + type: 'constant_product', + total_trustlines: '1', + total_shares: '0', reserves: [ { - amount: "0", + amount: '0', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "0", + amount: '0', asset: - "PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP", - }, - ], - }, + 'PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP' + } + ] + } }, { - id: "0000000012884905986-0000000005", - paging_token: "12884905986-2", - account: "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - type: "liquidity_pool_removed", + id: '0000000012884905986-0000000005', + paging_token: '12884905986-2', + account: 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + type: 'liquidity_pool_removed', type_i: 85, - created_at: "2021-11-18T03:15:54Z", - liquidity_pool_id: "abcdef", + created_at: '2021-11-18T03:15:54Z', + liquidity_pool_id: 'abcdef' }, { - id: "0000000012884905986-0000000006", - paging_token: "12884905986-2", - account: "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - type: "liquidity_pool_revoked", + id: '0000000012884905986-0000000006', + paging_token: '12884905986-2', + account: 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + type: 'liquidity_pool_revoked', type_i: 86, - created_at: "2021-11-18T03:15:54Z", + created_at: '2021-11-18T03:15:54Z', liquidity_pool: { - id: "abcdef", + id: 'abcdef', fee_bp: 30, - type: "constant_product", - total_trustlines: "299", - total_shares: "4000", + type: 'constant_product', + total_trustlines: '299', + total_shares: '4000', reserves: [ { - amount: "7.0000005", + amount: '7.0000005', asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S' }, { - amount: "1.0000000", + amount: '1.0000000', asset: - "PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP", - }, - ], + 'PHP:GBUQWP3BOUZX34TOND2QV7QQ7K7VJTG6VSE7WMLBTMDJLLAW7YKGU6EP' + } + ] }, reserves_revoked: [ { asset: - "JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - amount: "993.0000005", - claimable_balance_id: "cbid1235", + 'JPY:GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', + amount: '993.0000005', + claimable_balance_id: 'cbid1235' }, { asset: - "EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", - amount: "2478.0000005", - claimable_balance_id: "idcbd1234", - }, + 'EURT:GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S', + amount: '2478.0000005', + claimable_balance_id: 'idcbd1234' + } ], - shares_revoked: "1000", + shares_revoked: '1000' }, { - id: "0000000012884905986-0000000007", - paging_token: "157639717969326081-1", - account: "GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG", - type: "trustline_created", + id: '0000000012884905986-0000000007', + paging_token: '157639717969326081-1', + account: 'GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG', + type: 'trustline_created', type_i: 20, - created_at: "2021-08-04T20:01:24Z", - asset_type: "liquidity_pool_shares", - liquidity_pool_id: "abcdef", - limit: "1000", + created_at: '2021-08-04T20:01:24Z', + asset_type: 'liquidity_pool_shares', + liquidity_pool_id: 'abcdef', + limit: '1000' }, { - id: "0000000012884905986-0000000008", - paging_token: "157639717969326081-1", - account: "GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG", - type: "trustline_updated", + id: '0000000012884905986-0000000008', + paging_token: '157639717969326081-1', + account: 'GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG', + type: 'trustline_updated', type_i: 22, - created_at: "2021-08-04T20:01:24Z", - asset_type: "liquidity_pool_shares", - liquidity_pool_id: "abcdef", - limit: "2000", + created_at: '2021-08-04T20:01:24Z', + asset_type: 'liquidity_pool_shares', + liquidity_pool_id: 'abcdef', + limit: '2000' }, { - id: "0000000012884905986-0000000009", - paging_token: "157639717969326081-1", - account: "GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG", - type: "trustline_removed", + id: '0000000012884905986-0000000009', + paging_token: '157639717969326081-1', + account: 'GBBWI7TEVQBPEUXKYNGI3GBAH7EHFEREONKK3UK56ZSLJIDIYHQJCVSG', + type: 'trustline_removed', type_i: 21, - created_at: "2021-08-04T20:01:24Z", - asset_type: "liquidity_pool_shares", - liquidity_pool_id: "abcdef", - limit: "0.0000000", - }, - ], - }, + created_at: '2021-08-04T20:01:24Z', + asset_type: 'liquidity_pool_shares', + liquidity_pool_id: 'abcdef', + limit: '0.0000000' + } + ] + } }; - it("retrieves its effects", function (done) { + it('retrieves its effects', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs(sinon.match(`${LP_URL}/${lpId}/effects`)) .returns(Promise.resolve({ data: poolFxsResponse })); @@ -1368,7 +1368,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolFxs) => { expect(poolFxs.records).to.deep.equal( - poolFxsResponse._embedded.records, + poolFxsResponse._embedded.records ); done(); }) diff --git a/test/unit/server/claimable_balances.js b/test/unit/server/claimable_balances.js index d25680b13..d5f0405b1 100644 --- a/test/unit/server/claimable_balances.js +++ b/test/unit/server/claimable_balances.js @@ -1,9 +1,9 @@ -const MockAdapter = require("axios-mock-adapter"); +const MockAdapter = require('axios-mock-adapter'); -describe("ClaimableBalanceCallBuilder", function () { +describe('ClaimableBalanceCallBuilder', function () { beforeEach(function () { this.server = new StellarSdk.Server( - "https://horizon-live.stellar.org:1337", + 'https://horizon-live.stellar.org:1337' ); this.axiosMock = sinon.mock(HorizonAxiosClient); StellarSdk.Config.setDefault(); @@ -14,44 +14,44 @@ describe("ClaimableBalanceCallBuilder", function () { this.axiosMock.restore(); }); - it("requests the correct endpoint", function (done) { + it('requests the correct endpoint', function (done) { let singleBalanceResponse = { _links: { self: { - href: "horizon-live.stellar.org:1337/claimable_balances/00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072", - }, + href: 'horizon-live.stellar.org:1337/claimable_balances/00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072' + } }, - id: "00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072", - asset: "native", - amount: "200.0000000", - sponsor: "GBVFLWXYCIGPO3455XVFIKHS66FCT5AI64ZARKS7QJN4NF7K5FOXTJNL", + id: '00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072', + asset: 'native', + amount: '200.0000000', + sponsor: 'GBVFLWXYCIGPO3455XVFIKHS66FCT5AI64ZARKS7QJN4NF7K5FOXTJNL', last_modified_ledger: 38888, claimants: [ { destination: - "GBVFLWXYCIGPO3455XVFIKHS66FCT5AI64ZARKS7QJN4NF7K5FOXTJNL", + 'GBVFLWXYCIGPO3455XVFIKHS66FCT5AI64ZARKS7QJN4NF7K5FOXTJNL', predicate: { - unconditional: true, - }, - }, + unconditional: true + } + } ], paging_token: - "38888-00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072", + '38888-00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072' }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/claimable_balances/00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072", - ), + 'https://horizon-live.stellar.org:1337/claimable_balances/00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072' + ) ) .returns(Promise.resolve({ data: singleBalanceResponse })); this.server .claimableBalances() .claimableBalance( - "00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072", + '00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072' ) .call() .then(function (response) { @@ -67,36 +67,36 @@ describe("ClaimableBalanceCallBuilder", function () { const data = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc", + href: 'https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc' }, next: { - href: "https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc", + href: 'https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc' }, prev: { - href: "https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=desc", - }, + href: 'https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=desc' + } }, _embedded: { - records: [], - }, + records: [] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD", - ), + 'https://horizon-live.stellar.org:1337/claimable_balances?sponsor=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD' + ) ) .returns(Promise.resolve({ data })); this.server .claimableBalances() - .sponsor("GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD") + .sponsor('GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD') .call() .then(function (response) { - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -108,36 +108,36 @@ describe("ClaimableBalanceCallBuilder", function () { const data = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc", + href: 'https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc' }, next: { - href: "https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc", + href: 'https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc' }, prev: { - href: "https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=desc", - }, + href: 'https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=desc' + } }, _embedded: { - records: [], - }, + records: [] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD", - ), + 'https://horizon-live.stellar.org:1337/claimable_balances?claimant=GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD' + ) ) .returns(Promise.resolve({ data })); this.server .claimableBalances() - .claimant("GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD") + .claimant('GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD') .call() .then(function (response) { - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -149,26 +149,26 @@ describe("ClaimableBalanceCallBuilder", function () { const data = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc", + href: 'https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc' }, next: { - href: "https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc", + href: 'https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=asc' }, prev: { - href: "https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=desc", - }, + href: 'https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD&cursor=&limit=10&order=desc' + } }, _embedded: { - records: [], - }, + records: [] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD", - ), + 'https://horizon-live.stellar.org:1337/claimable_balances?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD' + ) ) .returns(Promise.resolve({ data })); @@ -176,14 +176,14 @@ describe("ClaimableBalanceCallBuilder", function () { .claimableBalances() .asset( new StellarSdk.Asset( - "USD", - "GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD", - ), + 'USD', + 'GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD' + ) ) .call() .then(function (response) { - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { diff --git a/test/unit/server/join_test.js b/test/unit/server/join_test.js index 39853a83d..b6e6a7e62 100644 --- a/test/unit/server/join_test.js +++ b/test/unit/server/join_test.js @@ -1,9 +1,9 @@ -const MockAdapter = require("axios-mock-adapter"); +const MockAdapter = require('axios-mock-adapter'); -describe("Server - CallBuilder#join", function () { +describe('Server - CallBuilder#join', function () { beforeEach(function () { this.server = new StellarSdk.Server( - "https://horizon-live.stellar.org:1337", + 'https://horizon-live.stellar.org:1337' ); this.axiosMock = sinon.mock(HorizonAxiosClient); }); @@ -13,151 +13,151 @@ describe("Server - CallBuilder#join", function () { this.axiosMock.restore(); }); - describe("#join", function () { + describe('#join', function () { const transaction = { - memo: "", + memo: '', _links: { self: { - href: "https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5", + href: 'https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5' }, account: { - href: "https://horizon-live.stellar.org:1337/accounts/GBIABVWR2LOKFDMAI6QA2NGT4G54O3BC577GAWDQ6QMOUP5E3ULBBGYX", + href: 'https://horizon-live.stellar.org:1337/accounts/GBIABVWR2LOKFDMAI6QA2NGT4G54O3BC577GAWDQ6QMOUP5E3ULBBGYX' }, ledger: { - href: "https://horizon-live.stellar.org:1337/ledgers/679846", + href: 'https://horizon-live.stellar.org:1337/ledgers/679846' }, operations: { - href: "https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5/operations{?cursor,limit,order}", - templated: true, + href: 'https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5/operations{?cursor,limit,order}', + templated: true }, effects: { - href: "https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5/effects{?cursor,limit,order}", - templated: true, + href: 'https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5/effects{?cursor,limit,order}', + templated: true }, precedes: { - href: "https://horizon-live.stellar.org:1337/transactions?order=asc\u0026cursor=2919916336320512", + href: 'https://horizon-live.stellar.org:1337/transactions?order=asc\u0026cursor=2919916336320512' }, succeeds: { - href: "https://horizon-live.stellar.org:1337/transactions?order=desc\u0026cursor=2919916336320512", - }, + href: 'https://horizon-live.stellar.org:1337/transactions?order=desc\u0026cursor=2919916336320512' + } }, - id: "de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5", - paging_token: "2919916336320512", + id: 'de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5', + paging_token: '2919916336320512', successful: true, - hash: "de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5", + hash: 'de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5', ledger: 679846, - created_at: "2019-09-12T14:24:35Z", + created_at: '2019-09-12T14:24:35Z', source_account: - "GBIABVWR2LOKFDMAI6QA2NGT4G54O3BC577GAWDQ6QMOUP5E3ULBBGYX", - source_account_sequence: "2954696981479425", + 'GBIABVWR2LOKFDMAI6QA2NGT4G54O3BC577GAWDQ6QMOUP5E3ULBBGYX', + source_account_sequence: '2954696981479425', fee_charged: 3600, max_fee: 3600, operation_count: 6, envelope_xdr: - "AAAAAFAA1tHS3KKNgEegDTTT4bvHbCLv/mBYcPQY6j+k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dZxiBTrsAJvpRqoJtmjEjL8AQ==", - ], + '5QcaEgzj+krAtiH0+iRho6gjxWIUMkTfVo28FqoBqlraePffIIDL7TiJN1gMrdZxiBTrsAJvpRqoJtmjEjL8AQ==' + ] }; const operationsResponse = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/operations?cursor=\u0026join=transactions\u0026limit=10\u0026order=asc", + href: 'https://horizon-live.stellar.org:1337/operations?cursor=\u0026join=transactions\u0026limit=10\u0026order=asc' }, next: { - href: "https://horizon-live.stellar.org:1337/operations?cursor=2919916336320518\u0026join=transactions\u0026limit=10\u0026order=asc", + href: 'https://horizon-live.stellar.org:1337/operations?cursor=2919916336320518\u0026join=transactions\u0026limit=10\u0026order=asc' }, prev: { - href: "https://horizon-live.stellar.org:1337/operations?cursor=2919916336320518\u0026join=transactions\u0026limit=1\u0026order=asc", - }, + href: 'https://horizon-live.stellar.org:1337/operations?cursor=2919916336320518\u0026join=transactions\u0026limit=1\u0026order=asc' + } }, _embedded: { records: [ { _links: { self: { - href: "https://horizon-live.stellar.org:1337/operations/2919916336320518", + href: 'https://horizon-live.stellar.org:1337/operations/2919916336320518' }, transaction: { - href: "https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5", + href: 'https://horizon-live.stellar.org:1337/transactions/de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5' }, effects: { - href: "https://horizon-live.stellar.org:1337/operations/2919916336320518/effects", + href: 'https://horizon-live.stellar.org:1337/operations/2919916336320518/effects' }, succeeds: { - href: "https://horizon-live.stellar.org:1337/effects?order=desc\u0026cursor=2919916336320518", + href: 'https://horizon-live.stellar.org:1337/effects?order=desc\u0026cursor=2919916336320518' }, precedes: { - href: "https://horizon-live.stellar.org:1337/effects?order=asc\u0026cursor=2919916336320518", - }, + href: 'https://horizon-live.stellar.org:1337/effects?order=asc\u0026cursor=2919916336320518' + } }, - id: "2919916336320518", - paging_token: "2919916336320518", + id: '2919916336320518', + paging_token: '2919916336320518', transaction_successful: true, source_account: - "GD7PZVW3WXKEWT4XQPV57K3DARCAQ5XZE5ZWFSDTGHBMQ4U7ZWYWZLPC", - type: "path_payment", + 'GD7PZVW3WXKEWT4XQPV57K3DARCAQ5XZE5ZWFSDTGHBMQ4U7ZWYWZLPC', + type: 'path_payment', type_i: 2, - created_at: "2019-09-12T14:24:35Z", + created_at: '2019-09-12T14:24:35Z', transaction_hash: - "de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5", + 'de8ca055af7972f817e9d3f7c7a0b480de82593bc378f0e48f83b8e31985e4e5', transaction, - asset_type: "credit_alphanum4", - asset_code: "USD", + asset_type: 'credit_alphanum4', + asset_code: 'USD', asset_issuer: - "GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD", - from: "GD7PZVW3WXKEWT4XQPV57K3DARCAQ5XZE5ZWFSDTGHBMQ4U7ZWYWZLPC", - to: "GCC3LGXHBZ6NSJOJCETNRRYTNDQJGCRC3P7YC2ZQ2ER3YWVJJQ2YDUL7", - amount: "10000.0000000", + 'GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD', + from: 'GD7PZVW3WXKEWT4XQPV57K3DARCAQ5XZE5ZWFSDTGHBMQ4U7ZWYWZLPC', + to: 'GCC3LGXHBZ6NSJOJCETNRRYTNDQJGCRC3P7YC2ZQ2ER3YWVJJQ2YDUL7', + amount: '10000.0000000', path: [ { - asset_type: "credit_alphanum4", - asset_code: "USD", + asset_type: 'credit_alphanum4', + asset_code: 'USD', asset_issuer: - "GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD", + 'GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD' }, { - asset_type: "credit_alphanum4", - asset_code: "USD", + asset_type: 'credit_alphanum4', + asset_code: 'USD', asset_issuer: - "GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD", - }, + 'GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD' + } ], - source_amount: "10000.0000000", - source_max: "10000.0000000", - source_asset_type: "credit_alphanum4", - source_asset_code: "USD", + source_amount: '10000.0000000', + source_max: '10000.0000000', + source_asset_type: 'credit_alphanum4', + source_asset_code: 'USD', source_asset_issuer: - "GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD", - }, - ], - }, + 'GBXGR3C3VKWAJCWLF7LX5TLS4KWQKPKJ4KUOJ6T6NEBROA62TTUUM6GD' + } + ] + } }; - it("loads resources in join and avoids extra call to server", function (done) { + it('loads resources in join and avoids extra call to server', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/operations?join=transactions", - ), + 'https://horizon-live.stellar.org:1337/operations?join=transactions' + ) ) .returns(Promise.resolve({ data: operationsResponse })); this.server .operations() - .join("transactions") + .join('transactions') .call() .then((response) => { const record = response.records[0]; - expect(record.transaction).to.be.a("function"); + expect(record.transaction).to.be.a('function'); record.transaction().then((transaction) => { expect(transaction).to.deep.equal(transaction); diff --git a/test/unit/server_check_memo_required_test.js b/test/unit/server_check_memo_required_test.js index bde7f2bb6..56381c725 100644 --- a/test/unit/server_check_memo_required_test.js +++ b/test/unit/server_check_memo_required_test.js @@ -2,20 +2,20 @@ function buildTransaction(destination, operations = [], builderOpts = {}) { let txBuilderOpts = { fee: 100, networkPassphrase: StellarSdk.Networks.TESTNET, - v1: true, + v1: true }; Object.assign(txBuilderOpts, builderOpts); let keypair = StellarSdk.Keypair.random(); - let account = new StellarSdk.Account(keypair.publicKey(), "56199647068161"); + let account = new StellarSdk.Account(keypair.publicKey(), '56199647068161'); let transaction = new StellarSdk.TransactionBuilder( account, - txBuilderOpts, + txBuilderOpts ).addOperation( StellarSdk.Operation.payment({ destination: destination, asset: StellarSdk.Asset.native(), - amount: "100.50", - }), + amount: '100.50' + }) ); operations.forEach((op) => (transaction = transaction.addOperation(op))); @@ -26,9 +26,9 @@ function buildTransaction(destination, operations = [], builderOpts = {}) { if (builderOpts.feeBump) { return StellarSdk.TransactionBuilder.buildFeeBumpTransaction( keypair, - "200", + '200', transaction, - txBuilderOpts.networkPassphrase, + txBuilderOpts.networkPassphrase ); } else { return transaction; @@ -40,40 +40,40 @@ function buildAccount(id, data = {}) { _links: { data: { href: `https://horizon-testnet.stellar.org/accounts/${id}/data/{key}`, - templated: true, - }, + templated: true + } }, id: id, account_id: id, - sequence: "3298702387052545", + sequence: '3298702387052545', subentry_count: 1, last_modified_ledger: 768061, thresholds: { low_threshold: 0, med_threshold: 0, - high_threshold: 0, + high_threshold: 0 }, flags: { auth_required: false, auth_revocable: false, - auth_immutable: false, + auth_immutable: false }, balances: [ { - balance: "9999.9999900", - buying_liabilities: "0.0000000", - selling_liabilities: "0.0000000", - asset_type: "native", - }, + balance: '9999.9999900', + buying_liabilities: '0.0000000', + selling_liabilities: '0.0000000', + asset_type: 'native' + } ], signers: [ { weight: 1, key: id, - type: "ed25519_public_key", - }, + type: 'ed25519_public_key' + } ], - data: data, + data: data }; } @@ -83,12 +83,12 @@ function mockAccountRequest(axiosMock, id, status, data = {}) { switch (status) { case 404: response = Promise.reject({ - response: { status: 404, statusText: "NotFound", data: {} }, + response: { status: 404, statusText: 'NotFound', data: {} } }); break; case 400: response = Promise.reject({ - response: { status: 400, statusText: "BadRequestError", data: {} }, + response: { status: 400, statusText: 'BadRequestError', data: {} } }); break; default: @@ -97,15 +97,15 @@ function mockAccountRequest(axiosMock, id, status, data = {}) { } axiosMock - .expects("get") + .expects('get') .withArgs(sinon.match(`https://horizon-testnet.stellar.org/accounts/${id}`)) .returns(response) .once(); } -describe("server.js check-memo-required", function () { +describe('server.js check-memo-required', function () { beforeEach(function () { - this.server = new StellarSdk.Server("https://horizon-testnet.stellar.org"); + this.server = new StellarSdk.Server('https://horizon-testnet.stellar.org'); this.axiosMock = sinon.mock(HorizonAxiosClient); }); @@ -114,10 +114,10 @@ describe("server.js check-memo-required", function () { this.axiosMock.restore(); }); - it("fails if memo is required", function (done) { - let accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA"; + it('fails if memo is required', function (done) { + let accountId = 'GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA'; mockAccountRequest(this.axiosMock, accountId, 200, { - "config.memo_required": "MQ==", + 'config.memo_required': 'MQ==' }); let transaction = buildTransaction(accountId); @@ -125,24 +125,24 @@ describe("server.js check-memo-required", function () { .checkMemoRequired(transaction) .then( function () { - expect.fail("promise should have failed"); + expect.fail('promise should have failed'); }, function (err) { expect(err).to.be.instanceOf(StellarSdk.AccountRequiresMemoError); expect(err.accountId).to.eq(accountId); expect(err.operationIndex).to.eq(0); done(); - }, + } ) .catch(function (err) { done(err); }); }); - it("fee bump - fails if memo is required", function (done) { - let accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA"; + it('fee bump - fails if memo is required', function (done) { + let accountId = 'GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA'; mockAccountRequest(this.axiosMock, accountId, 200, { - "config.memo_required": "MQ==", + 'config.memo_required': 'MQ==' }); let transaction = buildTransaction(accountId, [], { feeBump: true }); @@ -150,14 +150,14 @@ describe("server.js check-memo-required", function () { .checkMemoRequired(transaction) .then( function () { - expect.fail("promise should have failed"); + expect.fail('promise should have failed'); }, function (err) { expect(err).to.be.instanceOf(StellarSdk.AccountRequiresMemoError); expect(err.accountId).to.eq(accountId); expect(err.operationIndex).to.eq(0); done(); - }, + } ) .catch(function (err) { done(err); @@ -165,7 +165,7 @@ describe("server.js check-memo-required", function () { }); it("returns false if account doesn't exist", function (done) { - let accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA"; + let accountId = 'GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA'; mockAccountRequest(this.axiosMock, accountId, 404, {}); let transaction = buildTransaction(accountId); @@ -179,8 +179,8 @@ describe("server.js check-memo-required", function () { }); }); - it("returns false if data field is not present", function (done) { - let accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA"; + it('returns false if data field is not present', function (done) { + let accountId = 'GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA'; mockAccountRequest(this.axiosMock, accountId, 200, {}); let transaction = buildTransaction(accountId); @@ -194,8 +194,8 @@ describe("server.js check-memo-required", function () { }); }); - it("returns err with client errors", function (done) { - let accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA"; + it('returns err with client errors', function (done) { + let accountId = 'GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA'; mockAccountRequest(this.axiosMock, accountId, 400, {}); let transaction = buildTransaction(accountId); @@ -203,12 +203,12 @@ describe("server.js check-memo-required", function () { .checkMemoRequired(transaction) .then( function () { - expect.fail("promise should have failed"); + expect.fail('promise should have failed'); }, function (err) { expect(err).to.be.instanceOf(StellarSdk.NetworkError); done(); - }, + } ) .catch(function (err) { done(err); @@ -216,15 +216,15 @@ describe("server.js check-memo-required", function () { }); it("doesn't repeat account check if the destination is more than once", function (done) { - let accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA"; + let accountId = 'GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA'; mockAccountRequest(this.axiosMock, accountId, 200, {}); let operations = [ StellarSdk.Operation.payment({ destination: accountId, asset: StellarSdk.Asset.native(), - amount: "100.50", - }), + amount: '100.50' + }) ]; let transaction = buildTransaction(accountId, operations); @@ -239,52 +239,52 @@ describe("server.js check-memo-required", function () { }); }); - it("other operations", function (done) { - let accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA"; + it('other operations', function (done) { + let accountId = 'GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA'; mockAccountRequest(this.axiosMock, accountId, 200, {}); const destinations = [ - "GASGNGGXDNJE5C2O7LDCATIVYSSTZKB24SHYS6F4RQT4M4IGNYXB4TIV", - "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB", - "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ", + 'GASGNGGXDNJE5C2O7LDCATIVYSSTZKB24SHYS6F4RQT4M4IGNYXB4TIV', + 'GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB', + 'GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ' ]; const usd = new StellarSdk.Asset( - "USD", - "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB", + 'USD', + 'GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB' ); const eur = new StellarSdk.Asset( - "EUR", - "GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL", + 'EUR', + 'GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL' ); const liquidityPoolAsset = new StellarSdk.LiquidityPoolAsset(eur, usd, 30); let operations = [ StellarSdk.Operation.accountMerge({ - destination: destinations[0], + destination: destinations[0] }), StellarSdk.Operation.pathPaymentStrictReceive({ sendAsset: StellarSdk.Asset.native(), - sendMax: "5.0000000", + sendMax: '5.0000000', destination: destinations[1], destAsset: StellarSdk.Asset.native(), - destAmount: "5.50", - path: [usd, eur], + destAmount: '5.50', + path: [usd, eur] }), StellarSdk.Operation.pathPaymentStrictSend({ sendAsset: StellarSdk.Asset.native(), - sendAmount: "5.0000000", + sendAmount: '5.0000000', destination: destinations[2], destAsset: StellarSdk.Asset.native(), - destMin: "5.50", - path: [usd, eur], + destMin: '5.50', + path: [usd, eur] }), StellarSdk.Operation.changeTrust({ - asset: usd, + asset: usd }), StellarSdk.Operation.changeTrust({ - asset: liquidityPoolAsset, - }), + asset: liquidityPoolAsset + }) ]; destinations.forEach((d) => mockAccountRequest(this.axiosMock, d, 200, {})); @@ -300,9 +300,9 @@ describe("server.js check-memo-required", function () { done(err); }); }); - it("checks for memo required by default", function (done) { - let accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA"; - let memo = StellarSdk.Memo.text("42"); + it('checks for memo required by default', function (done) { + let accountId = 'GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA'; + let memo = StellarSdk.Memo.text('42'); let transaction = buildTransaction(accountId, [], { memo }); this.server .checkMemoRequired(transaction) diff --git a/test/unit/server_test.js b/test/unit/server_test.js index 0d1ff3b44..81abd6a38 100644 --- a/test/unit/server_test.js +++ b/test/unit/server_test.js @@ -1,9 +1,9 @@ -const MockAdapter = require("axios-mock-adapter"); +const MockAdapter = require('axios-mock-adapter'); -describe("server.js non-transaction tests", function () { +describe('server.js non-transaction tests', function () { beforeEach(function () { this.server = new StellarSdk.Server( - "https://horizon-live.stellar.org:1337", + 'https://horizon-live.stellar.org:1337' ); this.axiosMock = sinon.mock(HorizonAxiosClient); StellarSdk.Config.setDefault(); @@ -14,31 +14,31 @@ describe("server.js non-transaction tests", function () { this.axiosMock.restore(); }); - describe("Server.constructor", function () { - it("throws error for insecure server", function () { + describe('Server.constructor', function () { + it('throws error for insecure server', function () { expect( - () => new StellarSdk.Server("http://horizon-live.stellar.org:1337"), + () => new StellarSdk.Server('http://horizon-live.stellar.org:1337') ).to.throw(/Cannot connect to insecure horizon server/); }); - it("allow insecure server when opts.allowHttp flag is set", function () { + it('allow insecure server when opts.allowHttp flag is set', function () { expect( () => - new StellarSdk.Server("http://horizon-live.stellar.org:1337", { - allowHttp: true, - }), + new StellarSdk.Server('http://horizon-live.stellar.org:1337', { + allowHttp: true + }) ).to.not.throw(); }); - it("allow insecure server when global Config.allowHttp flag is set", function () { + it('allow insecure server when global Config.allowHttp flag is set', function () { StellarSdk.Config.setAllowHttp(true); expect( - () => new StellarSdk.Server("http://horizon-live.stellar.org:1337"), + () => new StellarSdk.Server('http://horizon-live.stellar.org:1337') ).to.not.throw(); }); }); - describe("Server.fetchTimebounds", function () { + describe('Server.fetchTimebounds', function () { let clock; beforeEach(function () { @@ -57,9 +57,9 @@ describe("server.js non-transaction tests", function () { // the next two tests are run in a deliberate order!! // don't change the order!! - it("fetches falls back to local time if fetch is bad", function (done) { + it('fetches falls back to local time if fetch is bad', function (done) { this.axiosMockAdapter - .onGet("https://horizon-live.stellar.org:1337/") + .onGet('https://horizon-live.stellar.org:1337/') .reply(200, {}, {}); this.server @@ -73,15 +73,15 @@ describe("server.js non-transaction tests", function () { }); }); - it("fetches if nothing is recorded", function (done) { + it('fetches if nothing is recorded', function (done) { this.axiosMockAdapter - .onGet("https://horizon-live.stellar.org:1337/") + .onGet('https://horizon-live.stellar.org:1337/') .reply( 200, {}, { - date: "Wed, 13 Mar 2019 22:15:07 GMT", - }, + date: 'Wed, 13 Mar 2019 22:15:07 GMT' + } ); this.server @@ -90,7 +90,7 @@ describe("server.js non-transaction tests", function () { expect(serverTime).to.eql({ minTime: 0, // this is server time 1552515307 plus 20 - maxTime: 1552515327, + maxTime: 1552515327 }); done(); @@ -101,50 +101,50 @@ describe("server.js non-transaction tests", function () { }); }); - describe("Server.fetchBaseFee", function () { + describe('Server.fetchBaseFee', function () { let response = { - last_ledger: "256736", - last_ledger_base_fee: "888", - ledger_capacity_usage: "0.18", + last_ledger: '256736', + last_ledger_base_fee: '888', + ledger_capacity_usage: '0.18', max_fee: { - max: "2000", - min: "100", - mode: "2000", - p10: "100", - p20: "100", - p30: "100", - p40: "300", - p50: "650", - p60: "2000", - p70: "2000", - p80: "2000", - p90: "2000", - p95: "2000", - p99: "2000", + max: '2000', + min: '100', + mode: '2000', + p10: '100', + p20: '100', + p30: '100', + p40: '300', + p50: '650', + p60: '2000', + p70: '2000', + p80: '2000', + p90: '2000', + p95: '2000', + p99: '2000' }, fee_charged: { - min: "100", - max: "100", - mode: "100", - p10: "100", - p20: "100", - p30: "100", - p40: "100", - p50: "100", - p60: "100", - p70: "100", - p80: "100", - p90: "100", - p95: "100", - p99: "100", - }, + min: '100', + max: '100', + mode: '100', + p10: '100', + p20: '100', + p30: '100', + p40: '100', + p50: '100', + p60: '100', + p70: '100', + p80: '100', + p90: '100', + p95: '100', + p99: '100' + } }; - it("returns the base reserve", function (done) { + it('returns the base reserve', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( - sinon.match("https://horizon-live.stellar.org:1337/fee_stats"), + sinon.match('https://horizon-live.stellar.org:1337/fee_stats') ) .returns(Promise.resolve({ data: response })); @@ -159,11 +159,11 @@ describe("server.js non-transaction tests", function () { }); }); - it("returns default value (100) if last_ledger_base_fee is missing", function (done) { + it('returns default value (100) if last_ledger_base_fee is missing', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( - sinon.match("https://horizon-live.stellar.org:1337/fee_stats"), + sinon.match('https://horizon-live.stellar.org:1337/fee_stats') ) .returns(Promise.resolve({ data: {} })); @@ -179,50 +179,50 @@ describe("server.js non-transaction tests", function () { }); }); - describe("Server.feeStats", function () { + describe('Server.feeStats', function () { let response = { - last_ledger: "256736", - last_ledger_base_fee: "100", - ledger_capacity_usage: "0.18", + last_ledger: '256736', + last_ledger_base_fee: '100', + ledger_capacity_usage: '0.18', max_fee: { - max: "2000", - min: "100", - mode: "2000", - p10: "100", - p20: "100", - p30: "100", - p40: "300", - p50: "650", - p60: "2000", - p70: "2000", - p80: "2000", - p90: "2000", - p95: "2000", - p99: "2000", + max: '2000', + min: '100', + mode: '2000', + p10: '100', + p20: '100', + p30: '100', + p40: '300', + p50: '650', + p60: '2000', + p70: '2000', + p80: '2000', + p90: '2000', + p95: '2000', + p99: '2000' }, fee_charged: { - min: "100", - max: "100", - mode: "100", - p10: "100", - p20: "100", - p30: "100", - p40: "100", - p50: "100", - p60: "100", - p70: "100", - p80: "100", - p90: "100", - p95: "100", - p99: "100", - }, + min: '100', + max: '100', + mode: '100', + p10: '100', + p20: '100', + p30: '100', + p40: '100', + p50: '100', + p60: '100', + p70: '100', + p80: '100', + p90: '100', + p95: '100', + p99: '100' + } }; - it("returns the base reserve", function (done) { + it('returns the base reserve', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( - sinon.match("https://horizon-live.stellar.org:1337/fee_stats"), + sinon.match('https://horizon-live.stellar.org:1337/fee_stats') ) .returns(Promise.resolve({ data: response })); @@ -238,7 +238,7 @@ describe("server.js non-transaction tests", function () { }); }); - describe("Server.loadAccount", function () { + describe('Server.loadAccount', function () { //prettier-ignore let accountResponse = { "_links": { @@ -320,36 +320,36 @@ describe("server.js non-transaction tests", function () { "data": {} }; - it("returns AccountResponse object", function (done) { + it('returns AccountResponse object', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts/GBAH7FQMC3CZJ4WD6GE7G7YXCIU36LC2IHXQ7D5MQAUO4PODOWIVLSFS", - ), + 'https://horizon-live.stellar.org:1337/accounts/GBAH7FQMC3CZJ4WD6GE7G7YXCIU36LC2IHXQ7D5MQAUO4PODOWIVLSFS' + ) ) .returns(Promise.resolve({ data: accountResponse })); this.server - .loadAccount("GBAH7FQMC3CZJ4WD6GE7G7YXCIU36LC2IHXQ7D5MQAUO4PODOWIVLSFS") + .loadAccount('GBAH7FQMC3CZJ4WD6GE7G7YXCIU36LC2IHXQ7D5MQAUO4PODOWIVLSFS') .then((response) => { // Response data expect(response.account_id).to.be.equal( - "GBAH7FQMC3CZJ4WD6GE7G7YXCIU36LC2IHXQ7D5MQAUO4PODOWIVLSFS", + 'GBAH7FQMC3CZJ4WD6GE7G7YXCIU36LC2IHXQ7D5MQAUO4PODOWIVLSFS' ); expect(response.subentry_count).to.be.equal(5); - expect(response.transactions).to.be.a("function"); - expect(response.operations).to.be.a("function"); - expect(response.payments).to.be.a("function"); - expect(response.effects).to.be.a("function"); - expect(response.offers).to.be.a("function"); + expect(response.transactions).to.be.a('function'); + expect(response.operations).to.be.a('function'); + expect(response.payments).to.be.a('function'); + expect(response.effects).to.be.a('function'); + expect(response.offers).to.be.a('function'); expect(Object.keys(response.flags).length).to.be.equal(4); // AccountResponse methods - expect(response.sequenceNumber()).to.be.equal("5387216134078475"); - expect(response.sequence).to.be.equal("5387216134078475"); + expect(response.sequenceNumber()).to.be.equal('5387216134078475'); + expect(response.sequence).to.be.equal('5387216134078475'); response.incrementSequenceNumber(); - expect(response.sequenceNumber()).to.be.equal("5387216134078476"); - expect(response.sequence).to.be.equal("5387216134078476"); + expect(response.sequenceNumber()).to.be.equal('5387216134078476'); + expect(response.sequence).to.be.equal('5387216134078476'); done(); }) .catch(function (err) { @@ -358,59 +358,59 @@ describe("server.js non-transaction tests", function () { }); }); - describe("Server._sendResourceRequest", function () { - describe("requests all ledgers", function () { + describe('Server._sendResourceRequest', function () { + describe('requests all ledgers', function () { let ledgersResponse = { _embedded: { records: [ { _links: { effects: { - href: "/ledgers/1/effects{?cursor,limit,order}", - templated: true, + href: '/ledgers/1/effects{?cursor,limit,order}', + templated: true }, operations: { - href: "/ledgers/1/operations{?cursor,limit,order}", - templated: true, + href: '/ledgers/1/operations{?cursor,limit,order}', + templated: true }, self: { - href: "/ledgers/1", + href: '/ledgers/1' }, transactions: { - href: "/ledgers/1/transactions{?cursor,limit,order}", - templated: true, - }, + href: '/ledgers/1/transactions{?cursor,limit,order}', + templated: true + } }, - id: "63d98f536ee68d1b27b5b89f23af5311b7569a24faf1403ad0b52b633b07be99", - paging_token: "4294967296", - hash: "63d98f536ee68d1b27b5b89f23af5311b7569a24faf1403ad0b52b633b07be99", + id: '63d98f536ee68d1b27b5b89f23af5311b7569a24faf1403ad0b52b633b07be99', + paging_token: '4294967296', + hash: '63d98f536ee68d1b27b5b89f23af5311b7569a24faf1403ad0b52b633b07be99', sequence: 1, transaction_count: 0, operation_count: 0, tx_set_operation_count: 0, - closed_at: "1970-01-01T00:00:00Z", - }, - ], + closed_at: '1970-01-01T00:00:00Z' + } + ] }, _links: { next: { - href: "/ledgers?order=asc\u0026limit=1\u0026cursor=4294967296", + href: '/ledgers?order=asc\u0026limit=1\u0026cursor=4294967296' }, prev: { - href: "/ledgers?order=desc\u0026limit=1\u0026cursor=4294967296", + href: '/ledgers?order=desc\u0026limit=1\u0026cursor=4294967296' }, self: { - href: "/ledgers?order=asc\u0026limit=1\u0026cursor=", - }, - }, + href: '/ledgers?order=asc\u0026limit=1\u0026cursor=' + } + } }; - describe("without options", function () { - it("requests the correct endpoint", function (done) { + describe('without options', function () { + it('requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( - sinon.match("https://horizon-live.stellar.org:1337/ledgers"), + sinon.match('https://horizon-live.stellar.org:1337/ledgers') ) .returns(Promise.resolve({ data: ledgersResponse })); @@ -419,10 +419,10 @@ describe("server.js non-transaction tests", function () { .call() .then((response) => { expect(response.records).to.be.deep.equal( - ledgersResponse._embedded.records, + ledgersResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -431,58 +431,58 @@ describe("server.js non-transaction tests", function () { }); }); - describe("with options", function () { + describe('with options', function () { beforeEach(function () { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/ledgers?limit=1&cursor=b&order=asc", - ), + 'https://horizon-live.stellar.org:1337/ledgers?limit=1&cursor=b&order=asc' + ) ) .returns(Promise.resolve({ data: ledgersResponse })); }); - it("requests the correct endpoint", function (done) { + it('requests the correct endpoint', function (done) { this.server .ledgers() - .limit("1") - .cursor("b") - .order("asc") + .limit('1') + .cursor('b') + .order('asc') .call() .then((response) => { expect(response.records).to.be.deep.equal( - ledgersResponse._embedded.records, + ledgersResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }); }); - it("can call .next() on the result to retrieve the next page", function (done) { + it('can call .next() on the result to retrieve the next page', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/ledgers?order=asc&limit=1&cursor=4294967296", - ), + 'https://horizon-live.stellar.org:1337/ledgers?order=asc&limit=1&cursor=4294967296' + ) ) .returns(Promise.resolve({ data: ledgersResponse })); this.server .ledgers() - .limit("1") - .cursor("b") - .order("asc") + .limit('1') + .cursor('b') + .order('asc') .call() .then(function (page) { page.next().then(function (response) { expect(response.records).to.be.deep.equal( - ledgersResponse._embedded.records, + ledgersResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }); }); @@ -490,46 +490,46 @@ describe("server.js non-transaction tests", function () { }); }); - describe("requests a single ledger", function () { + describe('requests a single ledger', function () { let singleLedgerResponse = { _links: { effects: { - href: "/ledgers/1/effects{?cursor,limit,order}", - templated: true, + href: '/ledgers/1/effects{?cursor,limit,order}', + templated: true }, operations: { - href: "/ledgers/1/operations{?cursor,limit,order}", - templated: true, + href: '/ledgers/1/operations{?cursor,limit,order}', + templated: true }, self: { - href: "/ledgers/1", + href: '/ledgers/1' }, transactions: { - href: "/ledgers/1/transactions{?cursor,limit,order}", - templated: true, - }, + href: '/ledgers/1/transactions{?cursor,limit,order}', + templated: true + } }, - id: "63d98f536ee68d1b27b5b89f23af5311b7569a24faf1403ad0b52b633b07be99", - paging_token: "4294967296", - hash: "63d98f536ee68d1b27b5b89f23af5311b7569a24faf1403ad0b52b633b07be99", + id: '63d98f536ee68d1b27b5b89f23af5311b7569a24faf1403ad0b52b633b07be99', + paging_token: '4294967296', + hash: '63d98f536ee68d1b27b5b89f23af5311b7569a24faf1403ad0b52b633b07be99', sequence: 1, transaction_count: 0, operation_count: 0, tx_set_operation_count: 0, - closed_at: "1970-01-01T00:00:00Z", + closed_at: '1970-01-01T00:00:00Z' }; - describe("for a non existent ledger", function () { - it("throws a NotFoundError", function (done) { + describe('for a non existent ledger', function () { + it('throws a NotFoundError', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( - sinon.match("https://horizon-live.stellar.org:1337/ledgers/1"), + sinon.match('https://horizon-live.stellar.org:1337/ledgers/1') ) .returns( Promise.reject({ - response: { status: 404, statusText: "NotFound", data: {} }, - }), + response: { status: 404, statusText: 'NotFound', data: {} } + }) ); this.server @@ -548,18 +548,18 @@ describe("server.js non-transaction tests", function () { }); }); }); - describe("without options", function () { - it("requests the correct endpoint", function (done) { + describe('without options', function () { + it('requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( - sinon.match("https://horizon-live.stellar.org:1337/ledgers/1"), + sinon.match('https://horizon-live.stellar.org:1337/ledgers/1') ) .returns(Promise.resolve({ data: singleLedgerResponse })); this.server .ledgers() - .ledger("1") + .ledger('1') .call() .then(function (response) { expect(response).to.be.deep.equal(singleLedgerResponse); @@ -571,23 +571,23 @@ describe("server.js non-transaction tests", function () { }); }); - describe("with options", function () { - it("requests the correct endpoint", function (done) { + describe('with options', function () { + it('requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/ledgers/1?limit=1&cursor=b&order=asc", - ), + 'https://horizon-live.stellar.org:1337/ledgers/1?limit=1&cursor=b&order=asc' + ) ) .returns(Promise.resolve({ data: singleLedgerResponse })); this.server .ledgers() - .ledger("1") - .limit("1") - .cursor("b") - .order("asc") + .ledger('1') + .limit('1') + .cursor('b') + .order('asc') .call() .then(function (response) { expect(response).to.be.deep.equal(singleLedgerResponse); @@ -600,92 +600,92 @@ describe("server.js non-transaction tests", function () { }); }); - describe("requests a sub resource", function (done) { + describe('requests a sub resource', function (done) { let transactionsResponse = { _links: { self: { - href: "https://horizon.stellar.org/transactions?order=desc\u0026limit=1\u0026cursor=", + href: 'https://horizon.stellar.org/transactions?order=desc\u0026limit=1\u0026cursor=' }, next: { - href: "https://horizon.stellar.org/transactions?order=desc\u0026limit=1\u0026cursor=34156680904183808", + href: 'https://horizon.stellar.org/transactions?order=desc\u0026limit=1\u0026cursor=34156680904183808' }, prev: { - href: "https://horizon.stellar.org/transactions?order=asc\u0026limit=1\u0026cursor=34156680904183808", - }, + href: 'https://horizon.stellar.org/transactions?order=asc\u0026limit=1\u0026cursor=34156680904183808' + } }, _embedded: { records: [ { _links: { self: { - href: "https://horizon.stellar.org/transactions/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1", + href: 'https://horizon.stellar.org/transactions/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1' }, account: { - href: "https://horizon.stellar.org/accounts/GBURK32BMC7XORYES62HDKY7VTA5MO7JYBDH7KTML4EPN4BV2MIRQOVR", + href: 'https://horizon.stellar.org/accounts/GBURK32BMC7XORYES62HDKY7VTA5MO7JYBDH7KTML4EPN4BV2MIRQOVR' }, ledger: { - href: "https://horizon.stellar.org/ledgers/7952722", + href: 'https://horizon.stellar.org/ledgers/7952722' }, operations: { - href: "https://horizon.stellar.org/transactions/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1/operations{?cursor,limit,order}", - templated: true, + href: 'https://horizon.stellar.org/transactions/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1/operations{?cursor,limit,order}', + templated: true }, effects: { - href: "https://horizon.stellar.org/transactions/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1/effects{?cursor,limit,order}", - templated: true, + href: 'https://horizon.stellar.org/transactions/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1/effects{?cursor,limit,order}', + templated: true }, precedes: { - href: "https://horizon.stellar.org/transactions?order=asc\u0026cursor=34156680904183808", + href: 'https://horizon.stellar.org/transactions?order=asc\u0026cursor=34156680904183808' }, succeeds: { - href: "https://horizon.stellar.org/transactions?order=desc\u0026cursor=34156680904183808", - }, + href: 'https://horizon.stellar.org/transactions?order=desc\u0026cursor=34156680904183808' + } }, - id: "c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1", - paging_token: "34156680904183808", - hash: "c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1", + id: 'c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1', + paging_token: '34156680904183808', + hash: 'c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1', ledger: 7952722, - created_at: "2016-12-09T12:36:51Z", + created_at: '2016-12-09T12:36:51Z', source_account: - "GBURK32BMC7XORYES62HDKY7VTA5MO7JYBDH7KTML4EPN4BV2MIRQOVR", - source_account_sequence: "25631492944168311", + 'GBURK32BMC7XORYES62HDKY7VTA5MO7JYBDH7KTML4EPN4BV2MIRQOVR', + source_account_sequence: '25631492944168311', fee_charged: 3600, max_fee: 3600, operation_count: 4, envelope_xdr: - "AAAAAGkVb0Fgv3dHBJe0casfrMHWO+nARn+qbF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AAAAA', + memo_type: 'none', signatures: [ - "pox1kE2/f2oYQw/PdJZHUk74JVWRHDPwcqzGP+lSJljl6ABBRPqXewP1jAzpgY+vicDeLR/35/HyDyeAG7H0Aw==", - ], - }, - ], - }, + 'pox1kE2/f2oYQw/PdJZHUk74JVWRHDPwcqzGP+lSJljl6ABBRPqXewP1jAzpgY+vicDeLR/35/HyDyeAG7H0Aw==' + ] + } + ] + } }; - describe("without options", function () { - it("requests the correct endpoint", function (done) { + describe('without options', function () { + it('requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/ledgers/7952722/transactions", - ), + 'https://horizon-live.stellar.org:1337/ledgers/7952722/transactions' + ) ) .returns(Promise.resolve({ data: transactionsResponse })); this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - /^https:\/\/horizon.stellar.org\/transactions\/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1\/operations/, - ), + /^https:\/\/horizon.stellar.org\/transactions\/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1\/operations/ + ) ) .returns(Promise.resolve({ data: { operations: [] } })); @@ -695,12 +695,12 @@ describe("server.js non-transaction tests", function () { .call() .then(function (response) { expect(response.records).to.be.deep.equal( - transactionsResponse._embedded.records, + transactionsResponse._embedded.records ); - expect(response.records[0].ledger).to.be.a("function"); + expect(response.records[0].ledger).to.be.a('function'); expect(response.records[0].ledger_attr).to.be.equal(7952722); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); response.records[0] .operations() @@ -717,39 +717,39 @@ describe("server.js non-transaction tests", function () { }); }); }); - describe("with options", function () { - it("requests the correct endpoint", function (done) { + describe('with options', function () { + it('requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/ledgers/7952722/transactions?cursor=b&limit=1&order=asc", - ), + 'https://horizon-live.stellar.org:1337/ledgers/7952722/transactions?cursor=b&limit=1&order=asc' + ) ) .returns(Promise.resolve({ data: transactionsResponse })); this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - /^https:\/\/horizon.stellar.org\/transactions\/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1\/operations\?limit=1/, - ), + /^https:\/\/horizon.stellar.org\/transactions\/c585b8764b28be678c482f8b6e87e76e4b5f28043c53f4dcb7b724b4b2efebc1\/operations\?limit=1/ + ) ) .returns(Promise.resolve({ data: { operations: [] } })); this.server .transactions() - .forLedger("7952722") - .cursor("b") - .limit("1") - .order("asc") + .forLedger('7952722') + .cursor('b') + .limit('1') + .order('asc') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - transactionsResponse._embedded.records, + transactionsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); response.records[0] .operations({ limit: 1 }) .then(function (response) { @@ -768,88 +768,88 @@ describe("server.js non-transaction tests", function () { }); }); - describe("Server._parseResult", function () { - it("creates link functions", function () { + describe('Server._parseResult', function () { + it('creates link functions', function () { var callBuilder = this.server.ledgers(); var json = callBuilder._parseResponse({ _links: { test: function () { - return "hi"; - }, - }, + return 'hi'; + } + } }); - expect(typeof json.test).to.be.equal("function"); + expect(typeof json.test).to.be.equal('function'); }); }); - describe("Smoke tests for the rest of the builders", function () { - describe("TransactionCallBuilder", function () { - it("#transaction - requests the correct endpoint", function (done) { + describe('Smoke tests for the rest of the builders', function () { + describe('TransactionCallBuilder', function () { + it('#transaction - requests the correct endpoint', function (done) { let singleTranssactionResponse = { _links: { self: { - href: "https://horizon-testnet.stellar.org/transactions/6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0", + href: 'https://horizon-testnet.stellar.org/transactions/6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0' }, account: { - href: "https://horizon-testnet.stellar.org/accounts/GBCCHT5P34DMK2LTN4SPHBAJCXYFNUEWSM7SDSWEXJA7NN6CA3HNHTM6", + href: 'https://horizon-testnet.stellar.org/accounts/GBCCHT5P34DMK2LTN4SPHBAJCXYFNUEWSM7SDSWEXJA7NN6CA3HNHTM6' }, ledger: { - href: "https://horizon-testnet.stellar.org/ledgers/121879", + href: 'https://horizon-testnet.stellar.org/ledgers/121879' }, operations: { - href: "https://horizon-testnet.stellar.org/transactions/6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0/operations{?cursor,limit,order}", - templated: true, + href: 'https://horizon-testnet.stellar.org/transactions/6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0/operations{?cursor,limit,order}', + templated: true }, effects: { - href: "https://horizon-testnet.stellar.org/transactions/6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0/effects{?cursor,limit,order}", - templated: true, + href: 'https://horizon-testnet.stellar.org/transactions/6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0/effects{?cursor,limit,order}', + templated: true }, precedes: { - href: "https://horizon-testnet.stellar.org/transactions?order=asc&cursor=523466319077376", + href: 'https://horizon-testnet.stellar.org/transactions?order=asc&cursor=523466319077376' }, succeeds: { - href: "https://horizon-testnet.stellar.org/transactions?order=desc&cursor=523466319077376", - }, + href: 'https://horizon-testnet.stellar.org/transactions?order=desc&cursor=523466319077376' + } }, - id: "6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0", - paging_token: "523466319077376", + id: '6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0', + paging_token: '523466319077376', successful: true, - hash: "6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0", + hash: '6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0', ledger: 121879, - created_at: "2020-02-06T01:57:18Z", + created_at: '2020-02-06T01:57:18Z', source_account: - "GBCCHT5P34DMK2LTN4SPHBAJCXYFNUEWSM7SDSWEXJA7NN6CA3HNHTM6", - source_account_sequence: "523406189527045", + 'GBCCHT5P34DMK2LTN4SPHBAJCXYFNUEWSM7SDSWEXJA7NN6CA3HNHTM6', + source_account_sequence: '523406189527045', fee_paid: 100, fee_charged: 100, max_fee: 100, operation_count: 1, envelope_xdr: - "AAAAAEQjz6/fBsVpc28k84QJFfBW0JaTPyHKxLpB9rfCBs7TAAAAZAAB3AkAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAMBwd6tPbAYimyr/BzBgOosIbrnrzfxfS/gmfqoDSx0IAAAAAHc1lAAAAAAAAAAABwgbO0wAAAECl/OULPE7Q3ikmwIYeECFtxVH4rh8lmk465QLIeHEeEcbYhaTfgfe8VAwKsYf4YqK+YKiSiI0BqJKDr6CeI3QJ", - result_xdr: "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=", + 'AAAAAEQjz6/fBsVpc28k84QJFfBW0JaTPyHKxLpB9rfCBs7TAAAAZAAB3AkAAAAFAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAMBwd6tPbAYimyr/BzBgOosIbrnrzfxfS/gmfqoDSx0IAAAAAHc1lAAAAAAAAAAABwgbO0wAAAECl/OULPE7Q3ikmwIYeECFtxVH4rh8lmk465QLIeHEeEcbYhaTfgfe8VAwKsYf4YqK+YKiSiI0BqJKDr6CeI3QJ', + result_xdr: 'AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=', result_meta_xdr: - "AAAAAQAAAAIAAAADAAHcFwAAAAAAAAAARCPPr98GxWlzbyTzhAkV8FbQlpM/IcrEukH2t8IGztMAAAAW0UFSDAAB3AkAAAAEAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAAHcFwAAAAAAAAAARCPPr98GxWlzbyTzhAkV8FbQlpM/IcrEukH2t8IGztMAAAAW0UFSDAAB3AkAAAAFAAAAAAAAAAAAAAAAAAAAAAE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AAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==', fee_meta_xdr: - "AAAAAgAAAAMAAdwUAAAAAAAAAABEI8+v3wbFaXNvJPOECRXwVtCWkz8hysS6Qfa3wgbO0wAAABbRQVJwAAHcCQAAAAQAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEAAdwXAAAAAAAAAABEI8+v3wbFaXNvJPOECRXwVtCWkz8hysS6Qfa3wgbO0wAAABbRQVIMAAHcCQAAAAQAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==", - memo_type: "none", + 'AAAAAgAAAAMAAdwUAAAAAAAAAABEI8+v3wbFaXNvJPOECRXwVtCWkz8hysS6Qfa3wgbO0wAAABbRQVJwAAHcCQAAAAQAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEAAdwXAAAAAAAAAABEI8+v3wbFaXNvJPOECRXwVtCWkz8hysS6Qfa3wgbO0wAAABbRQVIMAAHcCQAAAAQAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==', + memo_type: 'none', signatures: [ - "pfzlCzxO0N4pJsCGHhAhbcVR+K4fJZpOOuUCyHhxHhHG2IWk34H3vFQMCrGH+GKivmCokoiNAaiSg6+gniN0CQ==", - ], + 'pfzlCzxO0N4pJsCGHhAhbcVR+K4fJZpOOuUCyHhxHhHG2IWk34H3vFQMCrGH+GKivmCokoiNAaiSg6+gniN0CQ==' + ] }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/transactions/6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0", - ), + 'https://horizon-live.stellar.org:1337/transactions/6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0' + ) ) .returns(Promise.resolve({ data: singleTranssactionResponse })); this.server .transactions() .transaction( - "6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0", + '6bbd8cbd90498a26210a21ec599702bead8f908f412455da300318aba36831b0' ) .call() .then(function (response) { @@ -864,198 +864,198 @@ describe("server.js non-transaction tests", function () { const transactionsResponse = { _links: { self: { - href: "https://horizon.stellar.org/transactions?cursor=\u0026limit=3\u0026order=asc", + href: 'https://horizon.stellar.org/transactions?cursor=\u0026limit=3\u0026order=asc' }, next: { - href: "https://horizon.stellar.org/transactions?cursor=33736968114176\u0026limit=3\u0026order=asc", + href: 'https://horizon.stellar.org/transactions?cursor=33736968114176\u0026limit=3\u0026order=asc' }, prev: { - href: "https://horizon.stellar.org/transactions?cursor=12884905984\u0026limit=3\u0026order=desc", - }, + href: 'https://horizon.stellar.org/transactions?cursor=12884905984\u0026limit=3\u0026order=desc' + } }, _embedded: { records: [ { - memo: "hello world", + memo: 'hello world', _links: { self: { - href: "https://horizon.stellar.org/transactions/3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889", + href: 'https://horizon.stellar.org/transactions/3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889' }, account: { - href: "https://horizon.stellar.org/accounts/GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", + href: 'https://horizon.stellar.org/accounts/GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7' }, ledger: { - href: "https://horizon.stellar.org/ledgers/3", + href: 'https://horizon.stellar.org/ledgers/3' }, operations: { - href: "https://horizon.stellar.org/transactions/3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889/operations{?cursor,limit,order}", - templated: true, + href: 'https://horizon.stellar.org/transactions/3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889/operations{?cursor,limit,order}', + templated: true }, effects: { - href: "https://horizon.stellar.org/transactions/3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889/effects{?cursor,limit,order}", - templated: true, + href: 'https://horizon.stellar.org/transactions/3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889/effects{?cursor,limit,order}', + templated: true }, precedes: { - href: "https://horizon.stellar.org/transactions?order=asc\u0026cursor=12884905984", + href: 'https://horizon.stellar.org/transactions?order=asc\u0026cursor=12884905984' }, succeeds: { - href: "https://horizon.stellar.org/transactions?order=desc\u0026cursor=12884905984", - }, + href: 'https://horizon.stellar.org/transactions?order=desc\u0026cursor=12884905984' + } }, - id: "3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889", - paging_token: "12884905984", + id: '3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889', + paging_token: '12884905984', successful: true, - hash: "3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889", + hash: '3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889', ledger: 3, - created_at: "2015-09-30T17:15:54Z", + created_at: '2015-09-30T17:15:54Z', source_account: - "GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7", - source_account_sequence: "1", + 'GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7', + source_account_sequence: '1', fee_charged: 300, max_fee: 300, operation_count: 3, envelope_xdr: - "AAAAAAGUcmKO5465JxTSLQOQljwk2SfqAJmZSG6JH6wtqpwhAAABLAAAAAAAAAABAAAAAAAAAAEAAAALaGVsbG8gd29ybGQAAAAAAwAAAAAAAAAAAAAAABbxCy3mLg3hiTqX4VUEEp60pFOrJNxYM1JtxXTwXhY2AAAAAAvrwgAAAAAAAAAAAQAAAAAW8Qst5i4N4Yk6l+FVBBKetKRTqyTcWDNSbcV08F4WNgAAAAAN4Lazj4x61AAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABLaqcIQAAAEBKwqWy3TaOxoGnfm9eUjfTRBvPf34dvDA0Nf+B8z4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AAAAAAAZRyYo7njrknFNItA5CWPCTZJ+oAmZlIbokfrC2qnCEAAAAAC+vCAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=', fee_meta_xdr: - "AAAAAgAAAAMAAAABAAAAAAAAAAABlHJijueOuScU0i0DkJY8JNkn6gCZmUhuiR+sLaqcIQ3gtrOnZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAABlHJijueOuScU0i0DkJY8JNkn6gCZmUhuiR+sLaqcIQ3gtrOnY/7UAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==", - memo_type: "text", + 'AAAAAgAAAAMAAAABAAAAAAAAAAABlHJijueOuScU0i0DkJY8JNkn6gCZmUhuiR+sLaqcIQ3gtrOnZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEAAAADAAAAAAAAAAABlHJijueOuScU0i0DkJY8JNkn6gCZmUhuiR+sLaqcIQ3gtrOnY/7UAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==', + memo_type: 'text', signatures: [ - "SsKlst02jsaBp35vXlI300Qbz39+HbwwNDX/gfM+MwaG/dFF7bgqpkKsDAsh/qJDiN3NOW695IZB9Mj+JAsHBA==", - ], + 'SsKlst02jsaBp35vXlI300Qbz39+HbwwNDX/gfM+MwaG/dFF7bgqpkKsDAsh/qJDiN3NOW695IZB9Mj+JAsHBA==' + ] }, { - memo: "testpool,faucet,sdf", + memo: 'testpool,faucet,sdf', _links: { self: { - href: "https://horizon.stellar.org/transactions/2db4b22ca018119c5027a80578813ffcf582cda4aa9e31cd92b43cf1bda4fc5a", + href: 'https://horizon.stellar.org/transactions/2db4b22ca018119c5027a80578813ffcf582cda4aa9e31cd92b43cf1bda4fc5a' }, account: { - href: "https://horizon.stellar.org/accounts/GALPCCZN4YXA3YMJHKL6CVIECKPLJJCTVMSNYWBTKJW4K5HQLYLDMZTB", + href: 'https://horizon.stellar.org/accounts/GALPCCZN4YXA3YMJHKL6CVIECKPLJJCTVMSNYWBTKJW4K5HQLYLDMZTB' }, ledger: { - href: "https://horizon.stellar.org/ledgers/7841", + href: 'https://horizon.stellar.org/ledgers/7841' }, operations: { - href: "https://horizon.stellar.org/transactions/2db4b22ca018119c5027a80578813ffcf582cda4aa9e31cd92b43cf1bda4fc5a/operations{?cursor,limit,order}", - templated: true, + href: 'https://horizon.stellar.org/transactions/2db4b22ca018119c5027a80578813ffcf582cda4aa9e31cd92b43cf1bda4fc5a/operations{?cursor,limit,order}', + templated: true }, effects: { - href: "https://horizon.stellar.org/transactions/2db4b22ca018119c5027a80578813ffcf582cda4aa9e31cd92b43cf1bda4fc5a/effects{?cursor,limit,order}", - templated: true, + href: 'https://horizon.stellar.org/transactions/2db4b22ca018119c5027a80578813ffcf582cda4aa9e31cd92b43cf1bda4fc5a/effects{?cursor,limit,order}', + templated: true }, precedes: { - href: "https://horizon.stellar.org/transactions?order=asc\u0026cursor=33676838572032", + href: 'https://horizon.stellar.org/transactions?order=asc\u0026cursor=33676838572032' }, succeeds: { - href: "https://horizon.stellar.org/transactions?order=desc\u0026cursor=33676838572032", - }, + href: 'https://horizon.stellar.org/transactions?order=desc\u0026cursor=33676838572032' + } }, - id: "2db4b22ca018119c5027a80578813ffcf582cda4aa9e31cd92b43cf1bda4fc5a", - paging_token: "33676838572032", + id: '2db4b22ca018119c5027a80578813ffcf582cda4aa9e31cd92b43cf1bda4fc5a', + paging_token: '33676838572032', successful: true, - hash: "2db4b22ca018119c5027a80578813ffcf582cda4aa9e31cd92b43cf1bda4fc5a", + hash: '2db4b22ca018119c5027a80578813ffcf582cda4aa9e31cd92b43cf1bda4fc5a', ledger: 7841, - created_at: "2015-10-01T04:15:01Z", + created_at: '2015-10-01T04:15:01Z', source_account: - "GALPCCZN4YXA3YMJHKL6CVIECKPLJJCTVMSNYWBTKJW4K5HQLYLDMZTB", - source_account_sequence: "12884901890", + 'GALPCCZN4YXA3YMJHKL6CVIECKPLJJCTVMSNYWBTKJW4K5HQLYLDMZTB', + source_account_sequence: '12884901890', fee_charged: 300, max_fee: 300, operation_count: 3, envelope_xdr: - "AAAAABbxCy3mLg3hiTqX4VUEEp60pFOrJNxYM1JtxXTwXhY2AAABLAAAAAMAAAACAAAAAAAAAAEAAAATdGVzdHBvb2wsZmF1Y2V0LHNkZgAAAAADAAAAAAAAAAAAAAAAH6Ue1GOPj6Hb/ROPyIFCJpQPMujihEIvJSfK0UfMDIgAAAAAC+vCAAAAAAAAAAAAAAAAALMw4P7yJTyqj6ptNh7BPyXEoT+zVwTcU4JVbGyonvgbAAAAAAvrwgAAAAAAAAAAAAAAAABJlwu05Op/5x1uyrweYsyR6pTTos33hRNZe5IF6blnzwAAAAAL68IAAAAAAAAAAAHwXhY2AAAAQDSBB5eNEKkWIoQbZ1YQabJuE5mW/AKhrHTxw9H3m/sai90YcaZlsAe3ueO9jExjSZF289ZcR4vc0wFw1p/WyAc=", + 'AAAAABbxCy3mLg3hiTqX4VUEEp60pFOrJNxYM1JtxXTwXhY2AAABLAAAAAMAAAACAAAAAAAAAAEAAAATdGVzdHBvb2wsZmF1Y2V0LHNkZgAAAAADAAAAAAAAAAAAAAAAH6Ue1GOPj6Hb/ROPyIFCJpQPMujihEIvJSfK0UfMDIgAAAAAC+vCAAAAAAAAAAAAAAAAALMw4P7yJTyqj6ptNh7BPyXEoT+zVwTcU4JVbGyonvgbAAAAAAvrwgAAAAAAAAAAAAAAAABJlwu05Op/5x1uyrweYsyR6pTTos33hRNZe5IF6blnzwAAAAAL68IAAAAAAAAAAAHwXhY2AAAAQDSBB5eNEKkWIoQbZ1YQabJuE5mW/AKhrHTxw9H3m/sai90YcaZlsAe3ueO9jExjSZF289ZcR4vc0wFw1p/WyAc=', result_xdr: - "AAAAAAAAASwAAAAAAAAAAwA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SbcV08F4WNg3gtrObeDuoAAAAAwAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEAAB6hAAAAAAAAAAAW8Qst5i4N4Yk6l+FVBBKetKRTqyTcWDNSbcV08F4WNg3gtrObeDp8AAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==', + memo_type: 'text', signatures: [ - "NIEHl40QqRYihBtnVhBpsm4TmZb8AqGsdPHD0feb+xqL3RhxpmWwB7e5472MTGNJkXbz1lxHi9zTAXDWn9bIBw==", - ], + 'NIEHl40QqRYihBtnVhBpsm4TmZb8AqGsdPHD0feb+xqL3RhxpmWwB7e5472MTGNJkXbz1lxHi9zTAXDWn9bIBw==' + ] }, { - memo: "", + memo: '', _links: { self: { - href: "https://horizon.stellar.org/transactions/3ce2aca2fed36da2faea31352c76c5e412348887a4c119b1e90de8d1b937396a", + href: 'https://horizon.stellar.org/transactions/3ce2aca2fed36da2faea31352c76c5e412348887a4c119b1e90de8d1b937396a' }, account: { - href: "https://horizon.stellar.org/accounts/GALPCCZN4YXA3YMJHKL6CVIECKPLJJCTVMSNYWBTKJW4K5HQLYLDMZTB", + href: 'https://horizon.stellar.org/accounts/GALPCCZN4YXA3YMJHKL6CVIECKPLJJCTVMSNYWBTKJW4K5HQLYLDMZTB' }, ledger: { - href: "https://horizon.stellar.org/ledgers/7855", + href: 'https://horizon.stellar.org/ledgers/7855' }, operations: { - href: "https://horizon.stellar.org/transactions/3ce2aca2fed36da2faea31352c76c5e412348887a4c119b1e90de8d1b937396a/operations{?cursor,limit,order}", - templated: true, + href: 'https://horizon.stellar.org/transactions/3ce2aca2fed36da2faea31352c76c5e412348887a4c119b1e90de8d1b937396a/operations{?cursor,limit,order}', + templated: true }, effects: { - href: "https://horizon.stellar.org/transactions/3ce2aca2fed36da2faea31352c76c5e412348887a4c119b1e90de8d1b937396a/effects{?cursor,limit,order}", - templated: true, + href: 'https://horizon.stellar.org/transactions/3ce2aca2fed36da2faea31352c76c5e412348887a4c119b1e90de8d1b937396a/effects{?cursor,limit,order}', + templated: true }, precedes: { - href: "https://horizon.stellar.org/transactions?order=asc\u0026cursor=33736968114176", + href: 'https://horizon.stellar.org/transactions?order=asc\u0026cursor=33736968114176' }, succeeds: { - href: "https://horizon.stellar.org/transactions?order=desc\u0026cursor=33736968114176", - }, + href: 'https://horizon.stellar.org/transactions?order=desc\u0026cursor=33736968114176' + } }, - id: "3ce2aca2fed36da2faea31352c76c5e412348887a4c119b1e90de8d1b937396a", - paging_token: "33736968114176", + id: '3ce2aca2fed36da2faea31352c76c5e412348887a4c119b1e90de8d1b937396a', + paging_token: '33736968114176', successful: true, - hash: "3ce2aca2fed36da2faea31352c76c5e412348887a4c119b1e90de8d1b937396a", + hash: '3ce2aca2fed36da2faea31352c76c5e412348887a4c119b1e90de8d1b937396a', ledger: 7855, - created_at: "2015-10-01T04:16:11Z", + created_at: '2015-10-01T04:16:11Z', source_account: - "GALPCCZN4YXA3YMJHKL6CVIECKPLJJCTVMSNYWBTKJW4K5HQLYLDMZTB", - source_account_sequence: "12884901891", + 'GALPCCZN4YXA3YMJHKL6CVIECKPLJJCTVMSNYWBTKJW4K5HQLYLDMZTB', + source_account_sequence: '12884901891', fee_charged: 100, max_fee: 100, operation_count: 1, envelope_xdr: - "AAAAABbxCy3mLg3hiTqX4VUEEp60pFOrJNxYM1JtxXTwXhY2AAAAZAAAAAMAAAADAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAFAAAAAQAAAAAfpR7UY4+Podv9E4/IgUImlA8y6OKEQi8lJ8rRR8wMiAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwXhY2AAAAQNbDcWsR3s3z8Qzqatcdc/k2L4LXWJMA6eXac8dbXkAdc4ppH25isGC5OwvG06Vwvc3Ce3/r2rYcBP3vxhx18A8=", - result_xdr: "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAFAAAA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type: "text", + 'AAAAAgAAAAMAAB6hAAAAAAAAAAAW8Qst5i4N4Yk6l+FVBBKetKRTqyTcWDNSbcV08F4WNg3gtrN3tPR8AAAAAwAAAAIAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAEAAB6vAAAAAAAAAAAW8Qst5i4N4Yk6l+FVBBKetKRTqyTcWDNSbcV08F4WNg3gtrN3tPQYAAAAAwAAAAMAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAA==', + memo_type: 'text', signatures: [ - "1sNxaxHezfPxDOpq1x1z+TYvgtdYkwDp5dpzx1teQB1zimkfbmKwYLk7C8bTpXC9zcJ7f+vathwE/e/GHHXwDw==", - ], - }, - ], - }, + '1sNxaxHezfPxDOpq1x1z+TYvgtdYkwDp5dpzx1teQB1zimkfbmKwYLk7C8bTpXC9zcJ7f+vathwE/e/GHHXwDw==' + ] + } + ] + } }; - it("forClaimableBalance() requests the correct endpoint", function (done) { + it('forClaimableBalance() requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/claimable_balances/000000000102030000000000000000000000000000000000000000000000000000000000/transactions", - ), + 'https://horizon-live.stellar.org:1337/claimable_balances/000000000102030000000000000000000000000000000000000000000000000000000000/transactions' + ) ) .returns(Promise.resolve({ data: transactionsResponse })); this.server .transactions() .forClaimableBalance( - "000000000102030000000000000000000000000000000000000000000000000000000000", + '000000000102030000000000000000000000000000000000000000000000000000000000' ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - transactionsResponse._embedded.records, + transactionsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -1064,76 +1064,76 @@ describe("server.js non-transaction tests", function () { }); }); - describe("AccountCallBuilder", function () { - it("requests the correct endpoint", function (done) { + describe('AccountCallBuilder', function () { + it('requests the correct endpoint', function (done) { let singleAccountResponse = { _links: { effects: { - href: "/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/effects{?cursor,limit,order}", - templated: true, + href: '/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/effects{?cursor,limit,order}', + templated: true }, offers: { - href: "/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/offers{?cursor,limit,order}", - templated: true, + href: '/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/offers{?cursor,limit,order}', + templated: true }, operations: { - href: "/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/operations{?cursor,limit,order}", - templated: true, + href: '/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/operations{?cursor,limit,order}', + templated: true }, self: { - href: "/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", + href: '/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K' }, transactions: { - href: "/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/transactions{?cursor,limit,order}", - templated: true, - }, + href: '/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/transactions{?cursor,limit,order}', + templated: true + } }, - id: "GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", - paging_token: "146028892161", + id: 'GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K', + paging_token: '146028892161', account_id: - "GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", + 'GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K', sequence: 146028888090, subentry_count: 0, inflation_destination: null, - home_domain: "", + home_domain: '', thresholds: { low_threshold: 0, med_threshold: 0, - high_threshold: 0, + high_threshold: 0 }, flags: { auth_required: false, auth_revocable: false, auth_immutable: false, - auth_clawback_enabled: false, + auth_clawback_enabled: false }, balances: [ { - asset_type: "native", - balance: "9760000.3997400", - }, + asset_type: 'native', + balance: '9760000.3997400' + } ], signers: [ { public_key: - "GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", - weight: 1, - }, - ], + 'GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K', + weight: 1 + } + ] }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", - ), + 'https://horizon-live.stellar.org:1337/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K' + ) ) .returns(Promise.resolve({ data: singleAccountResponse })); this.server .accounts() - .accountId("GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K") + .accountId('GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K') .call() .then(function (response) { expect(response).to.be.deep.equal(singleAccountResponse); @@ -1148,123 +1148,123 @@ describe("server.js non-transaction tests", function () { let accountsForSignerResponse = { _links: { self: { - href: "/accounts?cursor=&limit=10&order=asc&signer=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", + href: '/accounts?cursor=&limit=10&order=asc&signer=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42' }, next: { - href: "/accounts?cursor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42&limit=10&order=asc&signer=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", + href: '/accounts?cursor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42&limit=10&order=asc&signer=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42' }, prev: { - href: "/accounts?cursor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42&limit=10&order=desc&signer=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", - }, + href: '/accounts?cursor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42&limit=10&order=desc&signer=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42' + } }, _embedded: { records: [ { _links: { self: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42' }, transactions: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/transactions{?cursor,limit,order}", - templated: true, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/transactions{?cursor,limit,order}', + templated: true }, operations: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/operations{?cursor,limit,order}", - templated: true, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/operations{?cursor,limit,order}', + templated: true }, payments: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/payments{?cursor,limit,order}", - templated: true, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/payments{?cursor,limit,order}', + templated: true }, effects: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/effects{?cursor,limit,order}", - templated: true, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/effects{?cursor,limit,order}', + templated: true }, offers: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/offers{?cursor,limit,order}", - templated: true, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/offers{?cursor,limit,order}', + templated: true }, trades: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/trades{?cursor,limit,order}", - templated: true, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/trades{?cursor,limit,order}', + templated: true }, data: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/data/{key}", - templated: true, - }, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/data/{key}', + templated: true + } }, - id: "GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", + id: 'GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42', account_id: - "GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", - sequence: "4233832731508737", + 'GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42', + sequence: '4233832731508737', subentry_count: 1, last_modified_ledger: 986912, - last_modified_time: "1970-01-01T00:00:00Z", + last_modified_time: '1970-01-01T00:00:00Z', thresholds: { low_threshold: 0, med_threshold: 0, - high_threshold: 0, + high_threshold: 0 }, flags: { auth_required: false, auth_revocable: false, auth_immutable: false, - auth_clawback_enabled: false, + auth_clawback_enabled: false }, balances: [ { - balance: "0.0000000", - limit: "450.0000000", - buying_liabilities: "0.0000000", - selling_liabilities: "0.0000000", + balance: '0.0000000', + limit: '450.0000000', + buying_liabilities: '0.0000000', + selling_liabilities: '0.0000000', last_modified_ledger: 986912, is_authorized: true, - asset_type: "credit_alphanum4", - asset_code: "USD", + asset_type: 'credit_alphanum4', + asset_code: 'USD', asset_issuer: - "GDUEG67IE5TJUVWRRTMXDP3Q6EMMZJ6HL5OMWLBYOIUIZEUW2T2PBPJH", + 'GDUEG67IE5TJUVWRRTMXDP3Q6EMMZJ6HL5OMWLBYOIUIZEUW2T2PBPJH' }, { - balance: "9999.9999900", - buying_liabilities: "0.0000000", - selling_liabilities: "0.0000000", - asset_type: "native", - }, + balance: '9999.9999900', + buying_liabilities: '0.0000000', + selling_liabilities: '0.0000000', + asset_type: 'native' + } ], signers: [ { weight: 1, - key: "GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", - type: "ed25519_public_key", - }, + key: 'GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42', + type: 'ed25519_public_key' + } ], data: {}, paging_token: - "GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", - }, - ], - }, + 'GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42' + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts?signer=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", - ), + 'https://horizon-live.stellar.org:1337/accounts?signer=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42' + ) ) .returns(Promise.resolve({ data: accountsForSignerResponse })); this.server .accounts() - .forSigner("GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42") + .forSigner('GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - accountsForSignerResponse._embedded.records, + accountsForSignerResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -1276,110 +1276,110 @@ describe("server.js non-transaction tests", function () { let accountsForAssetResponse = { _links: { self: { - href: "/accounts?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD\u0026cursor=\u0026limit=10\u0026order=asc", + href: '/accounts?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD\u0026cursor=\u0026limit=10\u0026order=asc' }, next: { - href: "/accounts?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD\u0026cursor=GC4J73PTB5WN7MOJWOAECPHRCV2UU3WCY37L3BNY6RZVKE23JGQYJMJ6\u0026limit=10\u0026order=asc", + href: '/accounts?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD\u0026cursor=GC4J73PTB5WN7MOJWOAECPHRCV2UU3WCY37L3BNY6RZVKE23JGQYJMJ6\u0026limit=10\u0026order=asc' }, prev: { - href: "/accounts?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD\u0026cursor=GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667\u0026limit=10\u0026order=desc", - }, + href: '/accounts?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD\u0026cursor=GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667\u0026limit=10\u0026order=desc' + } }, _embedded: { records: [ { _links: { self: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667", + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667' }, transactions: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/transactions{?cursor,limit,order}", - templated: true, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/transactions{?cursor,limit,order}', + templated: true }, operations: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/operations{?cursor,limit,order}", - templated: true, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/operations{?cursor,limit,order}', + templated: true }, payments: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/payments{?cursor,limit,order}", - templated: true, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/payments{?cursor,limit,order}', + templated: true }, effects: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/effects{?cursor,limit,order}", - templated: true, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/effects{?cursor,limit,order}', + templated: true }, offers: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/offers{?cursor,limit,order}", - templated: true, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/offers{?cursor,limit,order}', + templated: true }, trades: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/trades{?cursor,limit,order}", - templated: true, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/trades{?cursor,limit,order}', + templated: true }, data: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/data/{key}", - templated: true, - }, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/data/{key}', + templated: true + } }, - id: "GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667", + id: 'GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667', account_id: - "GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667", - sequence: "3902600558673934", + 'GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667', + sequence: '3902600558673934', subentry_count: 3, last_modified_ledger: 983682, - last_modified_time: "1970-01-01T00:00:00Z", + last_modified_time: '1970-01-01T00:00:00Z', thresholds: { low_threshold: 0, med_threshold: 0, - high_threshold: 0, + high_threshold: 0 }, flags: { auth_required: false, auth_revocable: false, auth_immutable: false, - auth_clawback_enabled: false, + auth_clawback_enabled: false }, balances: [ { - balance: "0.0000000", - limit: "25.0000000", - buying_liabilities: "0.0000000", - selling_liabilities: "0.0000000", + balance: '0.0000000', + limit: '25.0000000', + buying_liabilities: '0.0000000', + selling_liabilities: '0.0000000', last_modified_ledger: 983682, is_authorized: true, - asset_type: "credit_alphanum4", - asset_code: "USD", + asset_type: 'credit_alphanum4', + asset_code: 'USD', asset_issuer: - "GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD", + 'GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD' }, { - balance: "9999.9998600", - buying_liabilities: "0.0000000", - selling_liabilities: "0.0000000", - asset_type: "native", - }, + balance: '9999.9998600', + buying_liabilities: '0.0000000', + selling_liabilities: '0.0000000', + asset_type: 'native' + } ], signers: [ { weight: 1, - key: "GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667", - type: "ed25519_public_key", - }, + key: 'GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667', + type: 'ed25519_public_key' + } ], data: {}, paging_token: - "GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667", - }, - ], - }, + 'GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667' + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD", - ), + 'https://horizon-live.stellar.org:1337/accounts?asset=USD%3AGDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD' + ) ) .returns(Promise.resolve({ data: accountsForAssetResponse })); @@ -1387,17 +1387,17 @@ describe("server.js non-transaction tests", function () { .accounts() .forAsset( new StellarSdk.Asset( - "USD", - "GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD", - ), + 'USD', + 'GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD' + ) ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - accountsForAssetResponse._embedded.records, + accountsForAssetResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -1409,127 +1409,127 @@ describe("server.js non-transaction tests", function () { let accountsForSponsor = { _links: { self: { - href: "/accounts?cursor=&limit=10&order=asc&sponsor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", + href: '/accounts?cursor=&limit=10&order=asc&sponsor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42' }, next: { - href: "/accounts?cursor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42&limit=10&order=asc&sponsor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", + href: '/accounts?cursor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42&limit=10&order=asc&sponsor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42' }, prev: { - href: "/accounts?cursor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42&limit=10&order=desc&sponsor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", - }, + href: '/accounts?cursor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42&limit=10&order=desc&sponsor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42' + } }, _embedded: { records: [ { _links: { self: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42' }, transactions: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/transactions{?cursor,limit,order}", - templated: true, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/transactions{?cursor,limit,order}', + templated: true }, operations: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/operations{?cursor,limit,order}", - templated: true, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/operations{?cursor,limit,order}', + templated: true }, payments: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/payments{?cursor,limit,order}", - templated: true, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/payments{?cursor,limit,order}', + templated: true }, effects: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/effects{?cursor,limit,order}", - templated: true, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/effects{?cursor,limit,order}', + templated: true }, offers: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/offers{?cursor,limit,order}", - templated: true, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/offers{?cursor,limit,order}', + templated: true }, trades: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/trades{?cursor,limit,order}", - templated: true, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/trades{?cursor,limit,order}', + templated: true }, data: { - href: "/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/data/{key}", - templated: true, - }, + href: '/accounts/GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42/data/{key}', + templated: true + } }, - id: "GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", + id: 'GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42', account_id: - "GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", - sequence: "4233832731508737", + 'GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42', + sequence: '4233832731508737', subentry_count: 1, last_modified_ledger: 986912, - last_modified_time: "1970-01-01T00:00:00Z", + last_modified_time: '1970-01-01T00:00:00Z', thresholds: { low_threshold: 0, med_threshold: 0, - high_threshold: 0, + high_threshold: 0 }, flags: { auth_required: false, auth_revocable: false, auth_immutable: false, - auth_clawback_enabled: false, + auth_clawback_enabled: false }, balances: [ { - balance: "0.0000000", - limit: "450.0000000", - buying_liabilities: "0.0000000", - selling_liabilities: "0.0000000", + balance: '0.0000000', + limit: '450.0000000', + buying_liabilities: '0.0000000', + selling_liabilities: '0.0000000', last_modified_ledger: 986912, is_authorized: true, - asset_type: "credit_alphanum4", - asset_code: "USD", + asset_type: 'credit_alphanum4', + asset_code: 'USD', asset_issuer: - "GDUEG67IE5TJUVWRRTMXDP3Q6EMMZJ6HL5OMWLBYOIUIZEUW2T2PBPJH", + 'GDUEG67IE5TJUVWRRTMXDP3Q6EMMZJ6HL5OMWLBYOIUIZEUW2T2PBPJH', sponsor: - "GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", + 'GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42' }, { - balance: "9999.9999900", - buying_liabilities: "0.0000000", - selling_liabilities: "0.0000000", - asset_type: "native", - }, + balance: '9999.9999900', + buying_liabilities: '0.0000000', + selling_liabilities: '0.0000000', + asset_type: 'native' + } ], signers: [ { weight: 1, - key: "GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", - type: "ed25519_public_key", - }, + key: 'GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42', + type: 'ed25519_public_key' + } ], data: {}, paging_token: - "GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", + 'GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42', num_sponsoring: 0, - num_sponsored: 3, - }, - ], - }, + num_sponsored: 3 + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts?sponsor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42", - ), + 'https://horizon-live.stellar.org:1337/accounts?sponsor=GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42' + ) ) .returns(Promise.resolve({ data: accountsForSponsor })); this.server .accounts() - .sponsor("GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42") + .sponsor('GBCR5OVQ54S2EKHLBZMK6VYMTXZHXN3T45Y6PRX4PX4FXDMJJGY4FD42') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - accountsForSponsor._embedded.records, + accountsForSponsor._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -1541,152 +1541,152 @@ describe("server.js non-transaction tests", function () { const accountsForAssetResponse = { _links: { self: { - href: "/accounts?liquidity_pool=dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7&cursor=&limit=10&order=asc", + href: '/accounts?liquidity_pool=dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7&cursor=&limit=10&order=asc' }, next: { - href: "/accounts?liquidity_pool=dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7&cursor=GC4J73PTB5WN7MOJWOAECPHRCV2UU3WCY37L3BNY6RZVKE23JGQYJMJ6&limit=10&order=asc", + href: '/accounts?liquidity_pool=dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7&cursor=GC4J73PTB5WN7MOJWOAECPHRCV2UU3WCY37L3BNY6RZVKE23JGQYJMJ6&limit=10&order=asc' }, prev: { - href: "/accounts?liquidity_pool=dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7&cursor=GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667&limit=10&order=desc", - }, + href: '/accounts?liquidity_pool=dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7&cursor=GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667&limit=10&order=desc' + } }, _embedded: { records: [ { _links: { self: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667", + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667' }, transactions: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/transactions{?cursor,limit,order}", - templated: true, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/transactions{?cursor,limit,order}', + templated: true }, operations: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/operations{?cursor,limit,order}", - templated: true, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/operations{?cursor,limit,order}', + templated: true }, payments: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/payments{?cursor,limit,order}", - templated: true, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/payments{?cursor,limit,order}', + templated: true }, effects: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/effects{?cursor,limit,order}", - templated: true, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/effects{?cursor,limit,order}', + templated: true }, offers: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/offers{?cursor,limit,order}", - templated: true, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/offers{?cursor,limit,order}', + templated: true }, trades: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/trades{?cursor,limit,order}", - templated: true, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/trades{?cursor,limit,order}', + templated: true }, data: { - href: "/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/data/{key}", - templated: true, - }, + href: '/accounts/GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667/data/{key}', + templated: true + } }, - id: "GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667", + id: 'GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667', account_id: - "GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667", - sequence: "3902600558673934", + 'GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667', + sequence: '3902600558673934', subentry_count: 3, last_modified_ledger: 983682, - last_modified_time: "1970-01-01T00:00:00Z", + last_modified_time: '1970-01-01T00:00:00Z', thresholds: { low_threshold: 0, med_threshold: 0, - high_threshold: 0, + high_threshold: 0 }, flags: { auth_required: false, auth_revocable: false, auth_immutable: false, - auth_clawback_enabled: false, + auth_clawback_enabled: false }, balances: [ { liquidity_pool_id: - "dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7", - asset_type: "liquidity_pool_shares", - balance: "10", - limit: "10000", + 'dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7', + asset_type: 'liquidity_pool_shares', + balance: '10', + limit: '10000', last_modified_ledger: 7877447, is_authorized: true, is_authorized_to_maintain_liabilities: false, - is_clawback_enabled: false, + is_clawback_enabled: false }, { - balance: "0.0000000", - limit: "922337203685.4775807", - buying_liabilities: "0.0000000", - selling_liabilities: "0.0000000", + balance: '0.0000000', + limit: '922337203685.4775807', + buying_liabilities: '0.0000000', + selling_liabilities: '0.0000000', last_modified_ledger: 983682, is_authorized: true, is_authorized_to_maintain_liabilities: false, is_clawback_enabled: false, - asset_type: "credit_alphanum4", - asset_code: "ARST", + asset_type: 'credit_alphanum4', + asset_code: 'ARST', asset_issuer: - "GB7TAYRUZGE6TVT7NHP5SMIZRNQA6PLM423EYISAOAP3MKYIQMVYP2JO", + 'GB7TAYRUZGE6TVT7NHP5SMIZRNQA6PLM423EYISAOAP3MKYIQMVYP2JO' }, { - balance: "0.0000000", - limit: "922337203685.4775807", - buying_liabilities: "0.0000000", - selling_liabilities: "0.0000000", + balance: '0.0000000', + limit: '922337203685.4775807', + buying_liabilities: '0.0000000', + selling_liabilities: '0.0000000', last_modified_ledger: 983682, is_authorized: true, is_authorized_to_maintain_liabilities: false, is_clawback_enabled: false, - asset_type: "credit_alphanum4", - asset_code: "USD", + asset_type: 'credit_alphanum4', + asset_code: 'USD', asset_issuer: - "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ", + 'GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ' }, { - balance: "9999.9998600", - buying_liabilities: "0.0000000", - selling_liabilities: "0.0000000", - asset_type: "native", - }, + balance: '9999.9998600', + buying_liabilities: '0.0000000', + selling_liabilities: '0.0000000', + asset_type: 'native' + } ], signers: [ { weight: 1, - key: "GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667", - type: "ed25519_public_key", - }, + key: 'GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667', + type: 'ed25519_public_key' + } ], data: {}, paging_token: - "GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667", - }, - ], - }, + 'GBPFGVESMB7HSTQREV354WA4UDGAPS2NCB5DZQ7K2VZM3PSX4TDCV667' + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts?liquidity_pool=dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7", - ), + 'https://horizon-live.stellar.org:1337/accounts?liquidity_pool=dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7' + ) ) .returns(Promise.resolve({ data: accountsForAssetResponse })); this.server .accounts() .forLiquidityPool( - "dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7", + 'dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7' ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - accountsForAssetResponse._embedded.records, + accountsForAssetResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -1695,43 +1695,43 @@ describe("server.js non-transaction tests", function () { }); }); - describe("OfferCallBuilder", function () { + describe('OfferCallBuilder', function () { const offersResponse = { _embedded: { - records: [], + records: [] }, _links: { next: { - href: "/offers", + href: '/offers' }, prev: { - href: "/offers", + href: '/offers' }, self: { - href: "/offers", - }, - }, + href: '/offers' + } + } }; - it("without params requests the correct endpoint", function (done) { + it('without params requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/offers?order=asc", - ), + 'https://horizon-live.stellar.org:1337/offers?order=asc' + ) ) .returns(Promise.resolve({ data: offersResponse })); this.server .offers() - .order("asc") + .order('asc') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - offersResponse._embedded.records, + offersResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -1739,52 +1739,52 @@ describe("server.js non-transaction tests", function () { }); }); - it("single offer requests the correct endpoint", function (done) { + it('single offer requests the correct endpoint', function (done) { const offerResponse = { _links: { self: { - href: "https://horizon.stellar.org/offers/12345", + href: 'https://horizon.stellar.org/offers/12345' }, offer_maker: { - href: "https://horizon.stellar.org/accounts/GCK4WSNF3F6ZNCMK6BU77ZCZ3NMF3JGU2U3ZAPKXYBKYYCJA72FDBY7K", - }, + href: 'https://horizon.stellar.org/accounts/GCK4WSNF3F6ZNCMK6BU77ZCZ3NMF3JGU2U3ZAPKXYBKYYCJA72FDBY7K' + } }, id: 12345, - paging_token: "12345", - seller: "GCK4WSNF3F6ZNCMK6BU77ZCZ3NMF3JGU2U3ZAPKXYBKYYCJA72FDBY7K", + paging_token: '12345', + seller: 'GCK4WSNF3F6ZNCMK6BU77ZCZ3NMF3JGU2U3ZAPKXYBKYYCJA72FDBY7K', selling: { - asset_type: "credit_alphanum4", - asset_code: "NGNT", + asset_type: 'credit_alphanum4', + asset_code: 'NGNT', asset_issuer: - "GAWODAROMJ33V5YDFY3NPYTHVYQG7MJXVJ2ND3AOGIHYRWINES6ACCPD", + 'GAWODAROMJ33V5YDFY3NPYTHVYQG7MJXVJ2ND3AOGIHYRWINES6ACCPD' }, buying: { - asset_type: "native", + asset_type: 'native' }, - amount: "21611.9486669", + amount: '21611.9486669', price_r: { n: 52836797, - d: 1396841783, + d: 1396841783 }, - price: "0.0378259", + price: '0.0378259', last_modified_ledger: 28285404, - last_modified_time: "2020-02-18T17:00:56Z", + last_modified_time: '2020-02-18T17:00:56Z' }; this.axiosMock - .expects("get") + .expects('get') .withArgs( - sinon.match("https://horizon-live.stellar.org:1337/offers/12345"), + sinon.match('https://horizon-live.stellar.org:1337/offers/12345') ) .returns(Promise.resolve({ data: offerResponse })); this.server .offers() - .offer("12345") + .offer('12345') .call() .then(function (response) { expect(response).to.be.deep.equal(offerResponse); - expect(response.self).to.be.a("function"); + expect(response.self).to.be.a('function'); done(); }) .catch(function (err) { @@ -1792,120 +1792,120 @@ describe("server.js non-transaction tests", function () { }); }); - it("forAccount requests the correct endpoint", function (done) { + it('forAccount requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/offers?order=asc", - ), + 'https://horizon-live.stellar.org:1337/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/offers?order=asc' + ) ) .returns(Promise.resolve({ data: offersResponse })); this.server .offers() .forAccount( - "GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", + 'GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K' ) - .order("asc") + .order('asc') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - offersResponse._embedded.records, + offersResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { done(err); }); }); - it("selling requests the correct endpoint", function (done) { + it('selling requests the correct endpoint', function (done) { const selling = new StellarSdk.Asset( - "USD", - "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG", + 'USD', + 'GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG' ); this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/offers?selling_asset_type=credit_alphanum4&selling_asset_code=USD&selling_asset_issuer=GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG&order=asc", - ), + 'https://horizon-live.stellar.org:1337/offers?selling_asset_type=credit_alphanum4&selling_asset_code=USD&selling_asset_issuer=GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG&order=asc' + ) ) .returns(Promise.resolve({ data: offersResponse })); this.server .offers() .selling(selling) - .order("asc") + .order('asc') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - offersResponse._embedded.records, + offersResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { done(err); }); }); - it("buying requests the correct endpoint", function (done) { + it('buying requests the correct endpoint', function (done) { const buying = new StellarSdk.Asset( - "COP", - "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG", + 'COP', + 'GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG' ); this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/offers?buying_asset_type=credit_alphanum4&buying_asset_code=COP&buying_asset_issuer=GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG&order=asc", - ), + 'https://horizon-live.stellar.org:1337/offers?buying_asset_type=credit_alphanum4&buying_asset_code=COP&buying_asset_issuer=GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG&order=asc' + ) ) .returns(Promise.resolve({ data: offersResponse })); this.server .offers() .buying(buying) - .order("asc") + .order('asc') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - offersResponse._embedded.records, + offersResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { done(err); }); }); - it("sponsor requests the correct endpoint", function (done) { + it('sponsor requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/offers?sponsor=GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG&order=asc", - ), + 'https://horizon-live.stellar.org:1337/offers?sponsor=GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG&order=asc' + ) ) .returns(Promise.resolve({ data: offersResponse })); this.server .offers() - .sponsor("GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG") - .order("asc") + .sponsor('GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG') + .order('asc') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - offersResponse._embedded.records, + offersResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -1914,30 +1914,30 @@ describe("server.js non-transaction tests", function () { }); }); - describe("OrderbookCallBuilder", function () { + describe('OrderbookCallBuilder', function () { let orderBookResponse = { bids: [], asks: [], base: { - asset_type: "native", - asset_code: "", - asset_issuer: "", + asset_type: 'native', + asset_code: '', + asset_issuer: '' }, counter: { - asset_type: "credit_alphanum4", - asset_code: "USD", + asset_type: 'credit_alphanum4', + asset_code: 'USD', asset_issuer: - "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG", - }, + 'GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG' + } }; - it("requests the correct endpoint native/credit", function (done) { + it('requests the correct endpoint native/credit', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/order_book?selling_asset_type=native&buying_asset_type=credit_alphanum4&buying_asset_code=USD&buying_asset_issuer=GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG", - ), + 'https://horizon-live.stellar.org:1337/order_book?selling_asset_type=native&buying_asset_type=credit_alphanum4&buying_asset_code=USD&buying_asset_issuer=GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG' + ) ) .returns(Promise.resolve({ data: orderBookResponse })); @@ -1945,9 +1945,9 @@ describe("server.js non-transaction tests", function () { .orderbook( StellarSdk.Asset.native(), new StellarSdk.Asset( - "USD", - "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG", - ), + 'USD', + 'GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG' + ) ) .call() .then(function (response) { @@ -1959,23 +1959,23 @@ describe("server.js non-transaction tests", function () { }); }); - it("requests the correct endpoint credit/native", function (done) { + it('requests the correct endpoint credit/native', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/order_book?selling_asset_type=credit_alphanum4&selling_asset_code=USD&selling_asset_issuer=GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG&buying_asset_type=native", - ), + 'https://horizon-live.stellar.org:1337/order_book?selling_asset_type=credit_alphanum4&selling_asset_code=USD&selling_asset_issuer=GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG&buying_asset_type=native' + ) ) .returns(Promise.resolve({ data: orderBookResponse })); this.server .orderbook( new StellarSdk.Asset( - "USD", - "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG", + 'USD', + 'GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG' ), - StellarSdk.Asset.native(), + StellarSdk.Asset.native() ) .call() .then(function (response) { @@ -1988,63 +1988,63 @@ describe("server.js non-transaction tests", function () { }); }); - describe("TradesCallBuilder", function () { - it("trades() requests the correct endpoint (no filters)", function (done) { + describe('TradesCallBuilder', function () { + it('trades() requests the correct endpoint (no filters)', function (done) { let tradesResponse = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/trades?order=asc&limit=200&cursor=", + href: 'https://horizon-live.stellar.org:1337/trades?order=asc&limit=200&cursor=' }, next: { - href: "https://horizon-live.stellar.org:1337/trades?order=asc&limit=200&cursor=64199539053039617-0", + href: 'https://horizon-live.stellar.org:1337/trades?order=asc&limit=200&cursor=64199539053039617-0' }, prev: { - href: "https://horizon-live.stellar.org:1337/trades?order=desc&limit=200&cursor=64199539053039617-0", - }, + href: 'https://horizon-live.stellar.org:1337/trades?order=desc&limit=200&cursor=64199539053039617-0' + } }, _embedded: { records: [ { _links: { base: { - href: "https://horizon-live.stellar.org:1337/accounts/GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W", + href: 'https://horizon-live.stellar.org:1337/accounts/GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W' }, counter: { - href: "https://horizon-live.stellar.org:1337/accounts/GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN", + href: 'https://horizon-live.stellar.org:1337/accounts/GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN' }, operation: { - href: "https://horizon-live.stellar.org:1337/operations/64199539053039617", - }, - }, - id: "64199539053039617-0", - paging_token: "64199539053039617-0", - ledger_close_time: "2017-12-07T16:45:19Z", - offer_id: "278232", - trade_type: "orderbook", + href: 'https://horizon-live.stellar.org:1337/operations/64199539053039617' + } + }, + id: '64199539053039617-0', + paging_token: '64199539053039617-0', + ledger_close_time: '2017-12-07T16:45:19Z', + offer_id: '278232', + trade_type: 'orderbook', base_account: - "GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W", - base_amount: "1269.2134875", - base_asset_type: "native", + 'GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W', + base_amount: '1269.2134875', + base_asset_type: 'native', counter_account: - "GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN", - counter_amount: "19637.5167985", - counter_asset_type: "credit_alphanum4", - counter_asset_code: "JPY", + 'GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN', + counter_amount: '19637.5167985', + counter_asset_type: 'credit_alphanum4', + counter_asset_code: 'JPY', counter_asset_issuer: - "GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", + 'GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', base_is_seller: true, price: { - n: "1", - d: "2", - }, - }, - ], - }, + n: '1', + d: '2' + } + } + ] + } }; this.axiosMock - .expects("get") - .withArgs(sinon.match("https://horizon-live.stellar.org:1337/trades")) + .expects('get') + .withArgs(sinon.match('https://horizon-live.stellar.org:1337/trades')) .returns(Promise.resolve({ data: tradesResponse })); this.server @@ -2052,7 +2052,7 @@ describe("server.js non-transaction tests", function () { .call() .then(function (response) { expect(response.records).to.be.deep.equal( - tradesResponse._embedded.records, + tradesResponse._embedded.records ); done(); }) @@ -2061,65 +2061,65 @@ describe("server.js non-transaction tests", function () { }); }); - it("trades() requests the correct endpoint for assets", function (done) { + it('trades() requests the correct endpoint for assets', function (done) { let tradesResponse = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/trades?base_asset_type=native&counter_asset_type=credit_alphanum4&counter_asset_code=JPY&counter_asset_issuer=GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM&order=asc&limit=10&cursor=", + href: 'https://horizon-live.stellar.org:1337/trades?base_asset_type=native&counter_asset_type=credit_alphanum4&counter_asset_code=JPY&counter_asset_issuer=GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM&order=asc&limit=10&cursor=' }, next: { - href: "https://horizon-live.stellar.org:1337/trades?base_asset_type=native&counter_asset_type=credit_alphanum4&counter_asset_code=JPY&counter_asset_issuer=GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM&order=asc&limit=10&cursor=64199539053039617-0", + href: 'https://horizon-live.stellar.org:1337/trades?base_asset_type=native&counter_asset_type=credit_alphanum4&counter_asset_code=JPY&counter_asset_issuer=GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM&order=asc&limit=10&cursor=64199539053039617-0' }, prev: { - href: "https://horizon-live.stellar.org:1337/trades?base_asset_type=native&counter_asset_type=credit_alphanum4&counter_asset_code=JPY&counter_asset_issuer=GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM&order=desc&limit=10&cursor=64199539053039617-0", - }, + href: 'https://horizon-live.stellar.org:1337/trades?base_asset_type=native&counter_asset_type=credit_alphanum4&counter_asset_code=JPY&counter_asset_issuer=GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM&order=desc&limit=10&cursor=64199539053039617-0' + } }, _embedded: { records: [ { _links: { base: { - href: "https://horizon-live.stellar.org:1337/accounts/GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W", + href: 'https://horizon-live.stellar.org:1337/accounts/GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W' }, counter: { - href: "https://horizon-live.stellar.org:1337/accounts/GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN", + href: 'https://horizon-live.stellar.org:1337/accounts/GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN' }, operation: { - href: "https://horizon-live.stellar.org:1337/operations/64199539053039617", - }, - }, - id: "64199539053039617-0", - paging_token: "64199539053039617-0", - ledger_close_time: "2017-12-07T16:45:19Z", - offer_id: "278232", - trade_type: "orderbook", + href: 'https://horizon-live.stellar.org:1337/operations/64199539053039617' + } + }, + id: '64199539053039617-0', + paging_token: '64199539053039617-0', + ledger_close_time: '2017-12-07T16:45:19Z', + offer_id: '278232', + trade_type: 'orderbook', base_account: - "GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W", - base_amount: "1269.2134875", - base_asset_type: "native", + 'GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W', + base_amount: '1269.2134875', + base_asset_type: 'native', counter_account: - "GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN", - counter_amount: "19637.5167985", - counter_asset_type: "credit_alphanum4", - counter_asset_code: "JPY", + 'GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN', + counter_amount: '19637.5167985', + counter_asset_type: 'credit_alphanum4', + counter_asset_code: 'JPY', counter_asset_issuer: - "GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", + 'GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', base_is_seller: true, price: { - n: "1", - d: "2", - }, - }, - ], - }, + n: '1', + d: '2' + } + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/trades?base_asset_type=native&counter_asset_type=credit_alphanum4&counter_asset_code=JPY&counter_asset_issuer=GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - ), + 'https://horizon-live.stellar.org:1337/trades?base_asset_type=native&counter_asset_type=credit_alphanum4&counter_asset_code=JPY&counter_asset_issuer=GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM' + ) ) .returns(Promise.resolve({ data: tradesResponse })); @@ -2128,14 +2128,14 @@ describe("server.js non-transaction tests", function () { .forAssetPair( StellarSdk.Asset.native(), new StellarSdk.Asset( - "JPY", - "GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", - ), + 'JPY', + 'GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM' + ) ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - tradesResponse._embedded.records, + tradesResponse._embedded.records ); done(); }) @@ -2144,75 +2144,75 @@ describe("server.js non-transaction tests", function () { }); }); - it("trades() requests the correct endpoint for offer", function (done) { + it('trades() requests the correct endpoint for offer', function (done) { let tradesResponse = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/trades?offer_id=278232&order=asc&limit=10&cursor=", + href: 'https://horizon-live.stellar.org:1337/trades?offer_id=278232&order=asc&limit=10&cursor=' }, next: { - href: "https://horizon-live.stellar.org:1337/trades?offer_id=278232&order=asc&limit=10&cursor=64199539053039617-0", + href: 'https://horizon-live.stellar.org:1337/trades?offer_id=278232&order=asc&limit=10&cursor=64199539053039617-0' }, prev: { - href: "https://horizon-live.stellar.org:1337/trades?offer_id=278232&order=desc&limit=10&cursor=64199539053039617-0", - }, + href: 'https://horizon-live.stellar.org:1337/trades?offer_id=278232&order=desc&limit=10&cursor=64199539053039617-0' + } }, _embedded: { records: [ { _links: { base: { - href: "https://horizon-live.stellar.org:1337/accounts/GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W", + href: 'https://horizon-live.stellar.org:1337/accounts/GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W' }, counter: { - href: "https://horizon-live.stellar.org:1337/accounts/GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN", + href: 'https://horizon-live.stellar.org:1337/accounts/GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN' }, operation: { - href: "https://horizon-live.stellar.org:1337/operations/64199539053039617", - }, - }, - id: "64199539053039617-0", - paging_token: "64199539053039617-0", - ledger_close_time: "2017-12-07T16:45:19Z", - offer_id: "278232", - trade_type: "orderbook", + href: 'https://horizon-live.stellar.org:1337/operations/64199539053039617' + } + }, + id: '64199539053039617-0', + paging_token: '64199539053039617-0', + ledger_close_time: '2017-12-07T16:45:19Z', + offer_id: '278232', + trade_type: 'orderbook', base_account: - "GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W", - base_amount: "1269.2134875", - base_asset_type: "native", + 'GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W', + base_amount: '1269.2134875', + base_asset_type: 'native', counter_account: - "GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN", - counter_amount: "19637.5167985", - counter_asset_type: "credit_alphanum4", - counter_asset_code: "JPY", + 'GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN', + counter_amount: '19637.5167985', + counter_asset_type: 'credit_alphanum4', + counter_asset_code: 'JPY', counter_asset_issuer: - "GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", + 'GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', base_is_seller: true, price: { - n: "1", - d: "2", - }, - }, - ], - }, + n: '1', + d: '2' + } + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/trades?offer_id=278232", - ), + 'https://horizon-live.stellar.org:1337/trades?offer_id=278232' + ) ) .returns(Promise.resolve({ data: tradesResponse })); this.server .trades() - .forOffer("278232") + .forOffer('278232') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - tradesResponse._embedded.records, + tradesResponse._embedded.records ); done(); }) @@ -2221,72 +2221,72 @@ describe("server.js non-transaction tests", function () { }); }); - it("trades() requests the correct endpoint for account", function (done) { + it('trades() requests the correct endpoint for account', function (done) { let tradesResponse = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/accounts/GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY/trades?cursor=&limit=10&order=asc", + href: 'https://horizon-live.stellar.org:1337/accounts/GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY/trades?cursor=&limit=10&order=asc' }, next: { - href: "https://horizon-live.stellar.org:1337/accounts/GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY/trades?cursor=77434489365606401-1&limit=10&order=asc", + href: 'https://horizon-live.stellar.org:1337/accounts/GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY/trades?cursor=77434489365606401-1&limit=10&order=asc' }, prev: { - href: "https://horizon-live.stellar.org:1337/accounts/GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY/trades?cursor=77434489365606401-1&limit=10&order=desc", - }, + href: 'https://horizon-live.stellar.org:1337/accounts/GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY/trades?cursor=77434489365606401-1&limit=10&order=desc' + } }, _embedded: { records: [ { _links: { self: { - href: "", + href: '' }, seller: { - href: "https://horizon-live.stellar.org:1337/accounts/GBDTBUKFHJOEAFAVNPGIY65CBIH75DYEZ5VQXOE7YHZM7AJKDNEOW5JG", + href: 'https://horizon-live.stellar.org:1337/accounts/GBDTBUKFHJOEAFAVNPGIY65CBIH75DYEZ5VQXOE7YHZM7AJKDNEOW5JG' }, buyer: { - href: "https://horizon-live.stellar.org:1337/accounts/GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY", + href: 'https://horizon-live.stellar.org:1337/accounts/GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY' }, operation: { - href: "https://horizon-live.stellar.org:1337/operations/77434489365606401", - }, + href: 'https://horizon-live.stellar.org:1337/operations/77434489365606401' + } }, - id: "77434489365606401-1", - paging_token: "77434489365606401-1", - offer_id: "", - trade_type: "orderbook", + id: '77434489365606401-1', + paging_token: '77434489365606401-1', + offer_id: '', + trade_type: 'orderbook', seller: - "GBDTBUKFHJOEAFAVNPGIY65CBIH75DYEZ5VQXOE7YHZM7AJKDNEOW5JG", - sold_amount: "", - sold_asset_type: "", + 'GBDTBUKFHJOEAFAVNPGIY65CBIH75DYEZ5VQXOE7YHZM7AJKDNEOW5JG', + sold_amount: '', + sold_asset_type: '', buyer: - "GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY", - bought_amount: "", - bought_asset_type: "", - created_at: "2018-05-23T22:42:28Z", - }, - ], - }, + 'GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY', + bought_amount: '', + bought_asset_type: '', + created_at: '2018-05-23T22:42:28Z' + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts/GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY/trades", - ), + 'https://horizon-live.stellar.org:1337/accounts/GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY/trades' + ) ) .returns(Promise.resolve({ data: tradesResponse })); this.server .trades() .forAccount( - "GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY", + 'GABJBA4HI4LVKWAYORE7SOAAZMVXDHI566JBSD25O5TRDM7LVID6YOXY' ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - tradesResponse._embedded.records, + tradesResponse._embedded.records ); done(); }) @@ -2295,80 +2295,80 @@ describe("server.js non-transaction tests", function () { }); }); - it("trades() requests the correct endpoint for paging", function (done) { + it('trades() requests the correct endpoint for paging', function (done) { let tradesResponse = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/trades?order=asc&limit=1&cursor=64199539053039617-0", + href: 'https://horizon-live.stellar.org:1337/trades?order=asc&limit=1&cursor=64199539053039617-0' }, next: { - href: "https://horizon-live.stellar.org:1337/trades?order=asc&limit=1&cursor=64199676491993090-0", + href: 'https://horizon-live.stellar.org:1337/trades?order=asc&limit=1&cursor=64199676491993090-0' }, prev: { - href: "https://horizon-live.stellar.org:1337/trades?order=desc&limit=1&cursor=64199676491993090-0", - }, + href: 'https://horizon-live.stellar.org:1337/trades?order=desc&limit=1&cursor=64199676491993090-0' + } }, _embedded: { records: [ { _links: { base: { - href: "https://horizon-live.stellar.org:1337/accounts/GBBHSWC3XSUFKEFDPQO346BCLM3EAJHICWRVSVIQOG4YBIH3A2VCJ6G2", + href: 'https://horizon-live.stellar.org:1337/accounts/GBBHSWC3XSUFKEFDPQO346BCLM3EAJHICWRVSVIQOG4YBIH3A2VCJ6G2' }, counter: { - href: "https://horizon-live.stellar.org:1337/accounts/GDBXANSAUQ5WBFSA6LFQXR5PYVYAQ3T4KI4LHZ3YAAEFI3BS2Z3SFRVG", + href: 'https://horizon-live.stellar.org:1337/accounts/GDBXANSAUQ5WBFSA6LFQXR5PYVYAQ3T4KI4LHZ3YAAEFI3BS2Z3SFRVG' }, operation: { - href: "https://horizon-live.stellar.org:1337/operations/64199676491993090", - }, - }, - id: "64199676491993090-0", - paging_token: "64199676491993090-0", - ledger_close_time: "2017-12-07T16:47:59Z", - offer_id: "278245", - trade_type: "orderbook", + href: 'https://horizon-live.stellar.org:1337/operations/64199676491993090' + } + }, + id: '64199676491993090-0', + paging_token: '64199676491993090-0', + ledger_close_time: '2017-12-07T16:47:59Z', + offer_id: '278245', + trade_type: 'orderbook', base_account: - "GBBHSWC3XSUFKEFDPQO346BCLM3EAJHICWRVSVIQOG4YBIH3A2VCJ6G2", - base_amount: "0.0000128", - base_asset_type: "credit_alphanum4", - base_asset_code: "BTC", + 'GBBHSWC3XSUFKEFDPQO346BCLM3EAJHICWRVSVIQOG4YBIH3A2VCJ6G2', + base_amount: '0.0000128', + base_asset_type: 'credit_alphanum4', + base_asset_code: 'BTC', base_asset_issuer: - "GBSTRH4QOTWNSVA6E4HFERETX4ZLSR3CIUBLK7AXYII277PFJC4BBYOG", + 'GBSTRH4QOTWNSVA6E4HFERETX4ZLSR3CIUBLK7AXYII277PFJC4BBYOG', counter_account: - "GDBXANSAUQ5WBFSA6LFQXR5PYVYAQ3T4KI4LHZ3YAAEFI3BS2Z3SFRVG", - counter_amount: "0.0005000", - counter_asset_type: "credit_alphanum4", - counter_asset_code: "ETH", + 'GDBXANSAUQ5WBFSA6LFQXR5PYVYAQ3T4KI4LHZ3YAAEFI3BS2Z3SFRVG', + counter_amount: '0.0005000', + counter_asset_type: 'credit_alphanum4', + counter_asset_code: 'ETH', counter_asset_issuer: - "GBSTRH4QOTWNSVA6E4HFERETX4ZLSR3CIUBLK7AXYII277PFJC4BBYOG", + 'GBSTRH4QOTWNSVA6E4HFERETX4ZLSR3CIUBLK7AXYII277PFJC4BBYOG', base_is_seller: false, price: { - n: "1", - d: "2", - }, - }, - ], - }, + n: '1', + d: '2' + } + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/trades?order=asc&limit=1&cursor=64199539053039617-0", - ), + 'https://horizon-live.stellar.org:1337/trades?order=asc&limit=1&cursor=64199539053039617-0' + ) ) .returns(Promise.resolve({ data: tradesResponse })); this.server .trades() - .order("asc") - .limit("1") - .cursor("64199539053039617-0") + .order('asc') + .limit('1') + .cursor('64199539053039617-0') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - tradesResponse._embedded.records, + tradesResponse._embedded.records ); done(); }) @@ -2377,75 +2377,75 @@ describe("server.js non-transaction tests", function () { }); }); - it("trades() requests the correct endpoint for type orderbook", function (done) { + it('trades() requests the correct endpoint for type orderbook', function (done) { let tradesResponse = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/trades?order=asc&limit=200&trade_type=orderbook&cursor=", + href: 'https://horizon-live.stellar.org:1337/trades?order=asc&limit=200&trade_type=orderbook&cursor=' }, next: { - href: "https://horizon-live.stellar.org:1337/trades?order=asc&limit=200&trade_type=orderbook&cursor=64199539053039617-0", + href: 'https://horizon-live.stellar.org:1337/trades?order=asc&limit=200&trade_type=orderbook&cursor=64199539053039617-0' }, prev: { - href: "https://horizon-live.stellar.org:1337/trades?order=desc&limit=200&trade_type=orderbook&cursor=64199539053039617-0", - }, + href: 'https://horizon-live.stellar.org:1337/trades?order=desc&limit=200&trade_type=orderbook&cursor=64199539053039617-0' + } }, _embedded: { records: [ { _links: { base: { - href: "https://horizon-live.stellar.org:1337/accounts/GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W", + href: 'https://horizon-live.stellar.org:1337/accounts/GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W' }, counter: { - href: "https://horizon-live.stellar.org:1337/accounts/GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN", + href: 'https://horizon-live.stellar.org:1337/accounts/GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN' }, operation: { - href: "https://horizon-live.stellar.org:1337/operations/64199539053039617", - }, - }, - id: "64199539053039617-0", - paging_token: "64199539053039617-0", - ledger_close_time: "2017-12-07T16:45:19Z", - offer_id: "278232", - trade_type: "orderbook", + href: 'https://horizon-live.stellar.org:1337/operations/64199539053039617' + } + }, + id: '64199539053039617-0', + paging_token: '64199539053039617-0', + ledger_close_time: '2017-12-07T16:45:19Z', + offer_id: '278232', + trade_type: 'orderbook', base_account: - "GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W", - base_amount: "1269.2134875", - base_asset_type: "native", + 'GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W', + base_amount: '1269.2134875', + base_asset_type: 'native', counter_account: - "GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN", - counter_amount: "19637.5167985", - counter_asset_type: "credit_alphanum4", - counter_asset_code: "JPY", + 'GC6APVH2HCFB7QLSTG3U55IYSW7ZRNSCTOZZYZJCNHWX2FONCNJNULYN', + counter_amount: '19637.5167985', + counter_asset_type: 'credit_alphanum4', + counter_asset_code: 'JPY', counter_asset_issuer: - "GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", + 'GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', base_is_seller: true, price: { - n: "1", - d: "2", - }, - }, - ], - }, + n: '1', + d: '2' + } + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/trades?trade_type=orderbook", - ), + 'https://horizon-live.stellar.org:1337/trades?trade_type=orderbook' + ) ) .returns(Promise.resolve({ data: tradesResponse })); this.server .trades() - .forType("orderbook") + .forType('orderbook') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - tradesResponse._embedded.records, + tradesResponse._embedded.records ); done(); }) @@ -2454,76 +2454,76 @@ describe("server.js non-transaction tests", function () { }); }); - it("trades() requests the correct endpoint for type liquidity_pool", function (done) { + it('trades() requests the correct endpoint for type liquidity_pool', function (done) { let tradesResponse = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/trades?order=asc&limit=200&trade_type=liquidity_pool&cursor=", + href: 'https://horizon-live.stellar.org:1337/trades?order=asc&limit=200&trade_type=liquidity_pool&cursor=' }, next: { - href: "https://horizon-live.stellar.org:1337/trades?order=asc&limit=200&trade_type=liquidity_pool&cursor=64199539053039617-0", + href: 'https://horizon-live.stellar.org:1337/trades?order=asc&limit=200&trade_type=liquidity_pool&cursor=64199539053039617-0' }, prev: { - href: "https://horizon-live.stellar.org:1337/trades?order=desc&limit=200&trade_type=liquidity_pool&cursor=64199539053039617-0", - }, + href: 'https://horizon-live.stellar.org:1337/trades?order=desc&limit=200&trade_type=liquidity_pool&cursor=64199539053039617-0' + } }, _embedded: { records: [ { _links: { base: { - href: "https://horizon-live.stellar.org:1337/accounts/GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W", + href: 'https://horizon-live.stellar.org:1337/accounts/GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W' }, counter: { - href: "https://horizon-live.stellar.org:1337/liquidity_pool/dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7", + href: 'https://horizon-live.stellar.org:1337/liquidity_pool/dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7' }, operation: { - href: "https://horizon-live.stellar.org:1337/operations/64199539053039617", - }, - }, - id: "64199539053039617-0", - paging_token: "64199539053039617-0", - ledger_close_time: "2017-12-07T16:45:19Z", - offer_id: "4616800602922426369", - trade_type: "liquidity_pool", + href: 'https://horizon-live.stellar.org:1337/operations/64199539053039617' + } + }, + id: '64199539053039617-0', + paging_token: '64199539053039617-0', + ledger_close_time: '2017-12-07T16:45:19Z', + offer_id: '4616800602922426369', + trade_type: 'liquidity_pool', liquidity_pool_fee_bp: 30, base_account: - "GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W", - base_amount: "1269.2134875", - base_asset_type: "native", + 'GB7JKG66CJN3ACX5DX43FOZTTSOI7GZUP547I3BSXIJVUX3NRYUXHE6W', + base_amount: '1269.2134875', + base_asset_type: 'native', counter_liquidity_pool_id: - "dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7", - counter_amount: "19637.5167985", - counter_asset_type: "credit_alphanum4", - counter_asset_code: "JPY", + 'dd7b1ab831c273310ddbec6f97870aa83c2fbd78ce22aded37ecbf4f3380fac7', + counter_amount: '19637.5167985', + counter_asset_type: 'credit_alphanum4', + counter_asset_code: 'JPY', counter_asset_issuer: - "GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", + 'GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM', base_is_seller: true, price: { - n: "1", - d: "2", - }, - }, - ], - }, + n: '1', + d: '2' + } + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/trades?trade_type=liquidity_pool", - ), + 'https://horizon-live.stellar.org:1337/trades?trade_type=liquidity_pool' + ) ) .returns(Promise.resolve({ data: tradesResponse })); this.server .trades() - .forType("liquidity_pool") + .forType('liquidity_pool') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - tradesResponse._embedded.records, + tradesResponse._embedded.records ); done(); }) @@ -2533,151 +2533,151 @@ describe("server.js non-transaction tests", function () { }); }); - describe("StrictReceivePathCallBuilder", function () { + describe('StrictReceivePathCallBuilder', function () { let pathsResponse = { _embedded: { records: [ { - destination_amount: "20.0000000", - destination_asset_code: "EUR", + destination_amount: '20.0000000', + destination_asset_code: 'EUR', destination_asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - destination_asset_type: "credit_alphanum4", + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + destination_asset_type: 'credit_alphanum4', path: [], - source_amount: "30.0000000", - source_asset_code: "USD", + source_amount: '30.0000000', + source_asset_code: 'USD', source_asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - source_asset_type: "credit_alphanum4", + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + source_asset_type: 'credit_alphanum4' }, { - destination_amount: "20.0000000", - destination_asset_code: "EUR", + destination_amount: '20.0000000', + destination_asset_code: 'EUR', destination_asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - destination_asset_type: "credit_alphanum4", + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + destination_asset_type: 'credit_alphanum4', path: [ { - asset_code: "1", + asset_code: '1', asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - asset_type: "credit_alphanum4", - }, + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + asset_type: 'credit_alphanum4' + } ], - source_amount: "20.0000000", - source_asset_code: "USD", + source_amount: '20.0000000', + source_asset_code: 'USD', source_asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - source_asset_type: "credit_alphanum4", + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + source_asset_type: 'credit_alphanum4' }, { - destination_amount: "20.0000000", - destination_asset_code: "EUR", + destination_amount: '20.0000000', + destination_asset_code: 'EUR', destination_asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - destination_asset_type: "credit_alphanum4", + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + destination_asset_type: 'credit_alphanum4', path: [ { - asset_code: "21", + asset_code: '21', asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - asset_type: "credit_alphanum4", + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + asset_type: 'credit_alphanum4' }, { - asset_code: "22", + asset_code: '22', asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - asset_type: "credit_alphanum4", - }, + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + asset_type: 'credit_alphanum4' + } ], - source_amount: "20.0000000", - source_asset_code: "USD", + source_amount: '20.0000000', + source_asset_code: 'USD', source_asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - source_asset_type: "credit_alphanum4", - }, - ], + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + source_asset_type: 'credit_alphanum4' + } + ] }, _links: { self: { - href: "/paths/strict-receive", - }, - }, + href: '/paths/strict-receive' + } + } }; - it("requests the correct endpoint when source is an account", function (done) { + it('requests the correct endpoint when source is an account', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/paths/strict-receive?source_account=GARSFJNXJIHO6ULUBK3DBYKVSIZE7SC72S5DYBCHU7DKL22UXKVD7MXP&destination_amount=20.0&destination_asset_type=credit_alphanum4&destination_asset_code=EUR&destination_asset_issuer=GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - ), + 'https://horizon-live.stellar.org:1337/paths/strict-receive?source_account=GARSFJNXJIHO6ULUBK3DBYKVSIZE7SC72S5DYBCHU7DKL22UXKVD7MXP&destination_amount=20.0&destination_asset_type=credit_alphanum4&destination_asset_code=EUR&destination_asset_issuer=GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN' + ) ) .returns(Promise.resolve({ data: pathsResponse })); this.server .strictReceivePaths( - "GARSFJNXJIHO6ULUBK3DBYKVSIZE7SC72S5DYBCHU7DKL22UXKVD7MXP", + 'GARSFJNXJIHO6ULUBK3DBYKVSIZE7SC72S5DYBCHU7DKL22UXKVD7MXP', new StellarSdk.Asset( - "EUR", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", + 'EUR', + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN' ), - "20.0", + '20.0' ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - pathsResponse._embedded.records, + pathsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { done(err); }); }); - it("requests the correct endpoint when source is a list of assets", function (done) { + it('requests the correct endpoint when source is a list of assets', function (done) { let destinationAssets = encodeURIComponent( - "native,EUR:GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN,USD:GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", + 'native,EUR:GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN,USD:GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN' ); this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - `https://horizon-live.stellar.org:1337/paths/strict-receive?source_assets=${destinationAssets}&destination_amount=20.0&destination_asset_type=credit_alphanum4&destination_asset_code=EUR&destination_asset_issuer=GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN`, - ), + `https://horizon-live.stellar.org:1337/paths/strict-receive?source_assets=${destinationAssets}&destination_amount=20.0&destination_asset_type=credit_alphanum4&destination_asset_code=EUR&destination_asset_issuer=GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN` + ) ) .returns(Promise.resolve({ data: pathsResponse })); let assets = [ StellarSdk.Asset.native(), new StellarSdk.Asset( - "EUR", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", + 'EUR', + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN' ), new StellarSdk.Asset( - "USD", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - ), + 'USD', + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN' + ) ]; this.server .strictReceivePaths( assets, new StellarSdk.Asset( - "EUR", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", + 'EUR', + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN' ), - "20.0", + '20.0' ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - pathsResponse._embedded.records, + pathsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -2686,151 +2686,151 @@ describe("server.js non-transaction tests", function () { }); }); - describe("PathStrictSendCallBuilder", function () { + describe('PathStrictSendCallBuilder', function () { let pathsResponse = { _embedded: { records: [ { - destination_amount: "20.0000000", - destination_asset_code: "EUR", + destination_amount: '20.0000000', + destination_asset_code: 'EUR', destination_asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - destination_asset_type: "credit_alphanum4", + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + destination_asset_type: 'credit_alphanum4', path: [], - source_amount: "30.0000000", - source_asset_code: "USD", + source_amount: '30.0000000', + source_asset_code: 'USD', source_asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - source_asset_type: "credit_alphanum4", + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + source_asset_type: 'credit_alphanum4' }, { - destination_amount: "20.0000000", - destination_asset_code: "EUR", + destination_amount: '20.0000000', + destination_asset_code: 'EUR', destination_asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - destination_asset_type: "credit_alphanum4", + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + destination_asset_type: 'credit_alphanum4', path: [ { - asset_code: "1", + asset_code: '1', asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - asset_type: "credit_alphanum4", - }, + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + asset_type: 'credit_alphanum4' + } ], - source_amount: "20.0000000", - source_asset_code: "USD", + source_amount: '20.0000000', + source_asset_code: 'USD', source_asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - source_asset_type: "credit_alphanum4", + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + source_asset_type: 'credit_alphanum4' }, { - destination_amount: "20.0000000", - destination_asset_code: "EUR", + destination_amount: '20.0000000', + destination_asset_code: 'EUR', destination_asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - destination_asset_type: "credit_alphanum4", + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + destination_asset_type: 'credit_alphanum4', path: [ { - asset_code: "21", + asset_code: '21', asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - asset_type: "credit_alphanum4", + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + asset_type: 'credit_alphanum4' }, { - asset_code: "22", + asset_code: '22', asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - asset_type: "credit_alphanum4", - }, + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + asset_type: 'credit_alphanum4' + } ], - source_amount: "20.0000000", - source_asset_code: "USD", + source_amount: '20.0000000', + source_asset_code: 'USD', source_asset_issuer: - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - source_asset_type: "credit_alphanum4", - }, - ], + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN', + source_asset_type: 'credit_alphanum4' + } + ] }, _links: { self: { - href: "/paths/strict-send", - }, - }, + href: '/paths/strict-send' + } + } }; - it("requests the correct endpoint when destination is account", function (done) { + it('requests the correct endpoint when destination is account', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/paths/strict-send?source_asset_type=credit_alphanum4&source_asset_code=EUR&source_asset_issuer=GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN&source_amount=20.0&destination_account=GAEDTJ4PPEFVW5XV2S7LUXBEHNQMX5Q2GM562RJGOQG7GVCE5H3HIB4V", - ), + 'https://horizon-live.stellar.org:1337/paths/strict-send?source_asset_type=credit_alphanum4&source_asset_code=EUR&source_asset_issuer=GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN&source_amount=20.0&destination_account=GAEDTJ4PPEFVW5XV2S7LUXBEHNQMX5Q2GM562RJGOQG7GVCE5H3HIB4V' + ) ) .returns(Promise.resolve({ data: pathsResponse })); this.server .strictSendPaths( new StellarSdk.Asset( - "EUR", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", + 'EUR', + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN' ), - "20.0", - "GAEDTJ4PPEFVW5XV2S7LUXBEHNQMX5Q2GM562RJGOQG7GVCE5H3HIB4V", + '20.0', + 'GAEDTJ4PPEFVW5XV2S7LUXBEHNQMX5Q2GM562RJGOQG7GVCE5H3HIB4V' ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - pathsResponse._embedded.records, + pathsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { done(err); }); }); - it("requests the correct endpoint when destination is a list of assets", function (done) { + it('requests the correct endpoint when destination is a list of assets', function (done) { let destinationAssets = encodeURIComponent( - "native,EUR:GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN,USD:GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", + 'native,EUR:GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN,USD:GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN' ); this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - `https://horizon-live.stellar.org:1337/paths/strict-send?source_asset_type=credit_alphanum4&source_asset_code=EUR&source_asset_issuer=GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN&source_amount=20.0&destination_assets=${destinationAssets}`, - ), + `https://horizon-live.stellar.org:1337/paths/strict-send?source_asset_type=credit_alphanum4&source_asset_code=EUR&source_asset_issuer=GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN&source_amount=20.0&destination_assets=${destinationAssets}` + ) ) .returns(Promise.resolve({ data: pathsResponse })); let assets = [ StellarSdk.Asset.native(), new StellarSdk.Asset( - "EUR", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", + 'EUR', + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN' ), new StellarSdk.Asset( - "USD", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", - ), + 'USD', + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN' + ) ]; this.server .strictSendPaths( new StellarSdk.Asset( - "EUR", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", + 'EUR', + 'GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN' ), - "20.0", - assets, + '20.0', + assets ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - pathsResponse._embedded.records, + pathsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -2839,64 +2839,64 @@ describe("server.js non-transaction tests", function () { }); }); - describe("EffectCallBuilder", function () { + describe('EffectCallBuilder', function () { let effectsResponse = { _embedded: { records: [ { _links: { operation: { - href: "/operations/146028892161", + href: '/operations/146028892161' }, precedes: { - href: "/effects?cursor=146028892161-1\u0026order=asc", + href: '/effects?cursor=146028892161-1\u0026order=asc' }, succeeds: { - href: "/effects?cursor=146028892161-1\u0026order=desc", - }, + href: '/effects?cursor=146028892161-1\u0026order=desc' + } }, account: - "GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", - paging_token: "146028892161-1", - starting_balance: "10000000.0", + 'GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K', + paging_token: '146028892161-1', + starting_balance: '10000000.0', type: 0, - type_s: "account_created", - }, - ], + type_s: 'account_created' + } + ] }, _links: { next: { - href: "/effects?order=asc\u0026limit=1\u0026cursor=146028892161-1", + href: '/effects?order=asc\u0026limit=1\u0026cursor=146028892161-1' }, prev: { - href: "/effects?order=desc\u0026limit=1\u0026cursor=146028892161-1", + href: '/effects?order=desc\u0026limit=1\u0026cursor=146028892161-1' }, self: { - href: "/effects?order=asc\u0026limit=1\u0026cursor=", - }, - }, + href: '/effects?order=asc\u0026limit=1\u0026cursor=' + } + } }; - it("requests the correct endpoint", function (done) { + it('requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/effects?cursor=b", - ), + 'https://horizon-live.stellar.org:1337/effects?cursor=b' + ) ) .returns(Promise.resolve({ data: effectsResponse })); this.server .effects() - .cursor("b") + .cursor('b') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - effectsResponse._embedded.records, + effectsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -2904,28 +2904,28 @@ describe("server.js non-transaction tests", function () { }); }); - it("forAccount() requests the correct endpoint", function (done) { + it('forAccount() requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts/GCGHCFUB6JKQE42C76BK2LYB3EHKP4WQJE624WTSL3CU2PPDYE5RBMJE/effects", - ), + 'https://horizon-live.stellar.org:1337/accounts/GCGHCFUB6JKQE42C76BK2LYB3EHKP4WQJE624WTSL3CU2PPDYE5RBMJE/effects' + ) ) .returns(Promise.resolve({ data: effectsResponse })); this.server .effects() .forAccount( - "GCGHCFUB6JKQE42C76BK2LYB3EHKP4WQJE624WTSL3CU2PPDYE5RBMJE", + 'GCGHCFUB6JKQE42C76BK2LYB3EHKP4WQJE624WTSL3CU2PPDYE5RBMJE' ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - effectsResponse._embedded.records, + effectsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -2933,28 +2933,28 @@ describe("server.js non-transaction tests", function () { }); }); - it("forTransaction() requests the correct endpoint", function (done) { + it('forTransaction() requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/transactions/ef37d6770c40c3bdb6adba80759f2819971396d1c3dfb7b5611f63ad72a9a4ae/effects", - ), + 'https://horizon-live.stellar.org:1337/transactions/ef37d6770c40c3bdb6adba80759f2819971396d1c3dfb7b5611f63ad72a9a4ae/effects' + ) ) .returns(Promise.resolve({ data: effectsResponse })); this.server .effects() .forTransaction( - "ef37d6770c40c3bdb6adba80759f2819971396d1c3dfb7b5611f63ad72a9a4ae", + 'ef37d6770c40c3bdb6adba80759f2819971396d1c3dfb7b5611f63ad72a9a4ae' ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - effectsResponse._embedded.records, + effectsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -2962,82 +2962,82 @@ describe("server.js non-transaction tests", function () { }); }); - it("rejects two filters", function (done) { + it('rejects two filters', function (done) { expect(() => - this.server.effects().forOperation("blah").forLedger("234").call(), + this.server.effects().forOperation('blah').forLedger('234').call() ).to.throw(/Too many filters/); done(); }); }); - describe("OperationCallBuilder", function () { + describe('OperationCallBuilder', function () { let operationsResponse = { _embedded: { records: [ { _links: { effects: { - href: "/operations/146028892161/effects{?cursor,limit,order}", - templated: true, + href: '/operations/146028892161/effects{?cursor,limit,order}', + templated: true }, precedes: { - href: "/operations?cursor=146028892161\u0026order=asc", + href: '/operations?cursor=146028892161\u0026order=asc' }, self: { - href: "/operations/146028892161", + href: '/operations/146028892161' }, succeeds: { - href: "/operations?cursor=146028892161\u0026order=desc", + href: '/operations?cursor=146028892161\u0026order=desc' }, transaction: { - href: "/transactions/991534d902063b7715cd74207bef4e7bd7aa2f108f62d3eba837ce6023b2d4f3", - }, + href: '/transactions/991534d902063b7715cd74207bef4e7bd7aa2f108f62d3eba837ce6023b2d4f3' + } }, account: - "GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", + 'GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K', funder: - "GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H", + 'GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H', id: 146028892161, - paging_token: "146028892161", - starting_balance: "10000000.0", + paging_token: '146028892161', + starting_balance: '10000000.0', type: 0, - type_s: "create_account", - }, - ], + type_s: 'create_account' + } + ] }, _links: { next: { - href: "/operations?order=asc\u0026limit=1\u0026cursor=146028892161", + href: '/operations?order=asc\u0026limit=1\u0026cursor=146028892161' }, prev: { - href: "/operations?order=desc\u0026limit=1\u0026cursor=146028892161", + href: '/operations?order=desc\u0026limit=1\u0026cursor=146028892161' }, self: { - href: "/operations?order=asc\u0026limit=1\u0026cursor=", - }, - }, + href: '/operations?order=asc\u0026limit=1\u0026cursor=' + } + } }; - it("operation() requests the correct endpoint", function (done) { + it('operation() requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/operations/123456789", - ), + 'https://horizon-live.stellar.org:1337/operations/123456789' + ) ) .returns(Promise.resolve({ data: operationsResponse })); this.server .operations() - .operation("123456789") + .operation('123456789') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - operationsResponse._embedded.records, + operationsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -3045,28 +3045,28 @@ describe("server.js non-transaction tests", function () { }); }); - it("forAccount() requests the correct endpoint", function (done) { + it('forAccount() requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts/GCGHCFUB6JKQE42C76BK2LYB3EHKP4WQJE624WTSL3CU2PPDYE5RBMJE/operations", - ), + 'https://horizon-live.stellar.org:1337/accounts/GCGHCFUB6JKQE42C76BK2LYB3EHKP4WQJE624WTSL3CU2PPDYE5RBMJE/operations' + ) ) .returns(Promise.resolve({ data: operationsResponse })); this.server .operations() .forAccount( - "GCGHCFUB6JKQE42C76BK2LYB3EHKP4WQJE624WTSL3CU2PPDYE5RBMJE", + 'GCGHCFUB6JKQE42C76BK2LYB3EHKP4WQJE624WTSL3CU2PPDYE5RBMJE' ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - operationsResponse._embedded.records, + operationsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -3074,28 +3074,28 @@ describe("server.js non-transaction tests", function () { }); }); - it("forClaimableBalance() requests the correct endpoint", function (done) { + it('forClaimableBalance() requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/claimable_balances/000000000102030000000000000000000000000000000000000000000000000000000000/operations", - ), + 'https://horizon-live.stellar.org:1337/claimable_balances/000000000102030000000000000000000000000000000000000000000000000000000000/operations' + ) ) .returns(Promise.resolve({ data: operationsResponse })); this.server .operations() .forClaimableBalance( - "000000000102030000000000000000000000000000000000000000000000000000000000", + '000000000102030000000000000000000000000000000000000000000000000000000000' ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - operationsResponse._embedded.records, + operationsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -3103,13 +3103,13 @@ describe("server.js non-transaction tests", function () { }); }); - it("forLedger() requests the correct endpoint", function (done) { + it('forLedger() requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/ledgers/123456789/operations", - ), + 'https://horizon-live.stellar.org:1337/ledgers/123456789/operations' + ) ) .returns(Promise.resolve({ data: operationsResponse })); @@ -3119,10 +3119,10 @@ describe("server.js non-transaction tests", function () { .call() .then(function (response) { expect(response.records).to.be.deep.equal( - operationsResponse._embedded.records, + operationsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -3130,26 +3130,26 @@ describe("server.js non-transaction tests", function () { }); }); - it("forTransaction() requests the correct endpoint", function (done) { + it('forTransaction() requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/transactions/blah/operations", - ), + 'https://horizon-live.stellar.org:1337/transactions/blah/operations' + ) ) .returns(Promise.resolve({ data: operationsResponse })); this.server .operations() - .forTransaction("blah") + .forTransaction('blah') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - operationsResponse._embedded.records, + operationsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -3158,76 +3158,76 @@ describe("server.js non-transaction tests", function () { }); }); - describe("PaymentCallBuilder", function () { + describe('PaymentCallBuilder', function () { let paymentsResponse = { _embedded: { records: [ { _links: { effects: { - href: "/operations/146028892161/effects{?cursor,limit,order}", - templated: true, + href: '/operations/146028892161/effects{?cursor,limit,order}', + templated: true }, precedes: { - href: "/operations?cursor=146028892161\u0026order=asc", + href: '/operations?cursor=146028892161\u0026order=asc' }, self: { - href: "/operations/146028892161", + href: '/operations/146028892161' }, succeeds: { - href: "/operations?cursor=146028892161\u0026order=desc", + href: '/operations?cursor=146028892161\u0026order=desc' }, transaction: { - href: "/transactions/991534d902063b7715cd74207bef4e7bd7aa2f108f62d3eba837ce6023b2d4f3", - }, + href: '/transactions/991534d902063b7715cd74207bef4e7bd7aa2f108f62d3eba837ce6023b2d4f3' + } }, account: - "GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", + 'GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K', funder: - "GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H", + 'GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H', id: 146028892161, - paging_token: "146028892161", - starting_balance: "10000000.0", + paging_token: '146028892161', + starting_balance: '10000000.0', type: 0, - type_s: "create_account", - }, - ], + type_s: 'create_account' + } + ] }, _links: { next: { - href: "/payments?order=asc\u0026limit=1\u0026cursor=146028892161", + href: '/payments?order=asc\u0026limit=1\u0026cursor=146028892161' }, prev: { - href: "/payments?order=desc\u0026limit=1\u0026cursor=146028892161", + href: '/payments?order=desc\u0026limit=1\u0026cursor=146028892161' }, self: { - href: "/payments?order=asc\u0026limit=1\u0026cursor=", - }, - }, + href: '/payments?order=asc\u0026limit=1\u0026cursor=' + } + } }; - it("forAccount() requests the correct endpoint", function (done) { + it('forAccount() requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/payments", - ), + 'https://horizon-live.stellar.org:1337/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/payments' + ) ) .returns(Promise.resolve({ data: paymentsResponse })); this.server .payments() .forAccount( - "GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", + 'GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K' ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - paymentsResponse._embedded.records, + paymentsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -3235,26 +3235,26 @@ describe("server.js non-transaction tests", function () { }); }); - it("forLedger() requests the correct endpoint", function (done) { + it('forLedger() requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/ledgers/123456789/payments", - ), + 'https://horizon-live.stellar.org:1337/ledgers/123456789/payments' + ) ) .returns(Promise.resolve({ data: paymentsResponse })); this.server .payments() - .forLedger("123456789") + .forLedger('123456789') .call() .then(function (response) { expect(response.records).to.be.deep.equal( - paymentsResponse._embedded.records, + paymentsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -3262,28 +3262,28 @@ describe("server.js non-transaction tests", function () { }); }); - it("forTransaction() requests the correct endpoint", function (done) { + it('forTransaction() requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/transactions/77277606902d80a03a892536ebff8466726a4e55c3923ec2d3eeb3aa5bdc3731/payments", - ), + 'https://horizon-live.stellar.org:1337/transactions/77277606902d80a03a892536ebff8466726a4e55c3923ec2d3eeb3aa5bdc3731/payments' + ) ) .returns(Promise.resolve({ data: paymentsResponse })); this.server .payments() .forTransaction( - "77277606902d80a03a892536ebff8466726a4e55c3923ec2d3eeb3aa5bdc3731", + '77277606902d80a03a892536ebff8466726a4e55c3923ec2d3eeb3aa5bdc3731' ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - paymentsResponse._embedded.records, + paymentsResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -3292,23 +3292,23 @@ describe("server.js non-transaction tests", function () { }); }); - describe("FriendbotCallBuilder", function () { + describe('FriendbotCallBuilder', function () { let friendbotResponse = { - ledger: 2, + ledger: 2 }; - it("requests the correct endpoint", function (done) { + it('requests the correct endpoint', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/friendbot?addr=GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K", - ), + 'https://horizon-live.stellar.org:1337/friendbot?addr=GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K' + ) ) .returns(Promise.resolve({ data: friendbotResponse })); this.server - .friendbot("GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K") + .friendbot('GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K') .call() .then(function (response) { expect(response.ledger).to.be.equal(friendbotResponse.ledger); @@ -3320,65 +3320,65 @@ describe("server.js non-transaction tests", function () { }); }); - describe("TradeAggregationCallBuilder", function () { + describe('TradeAggregationCallBuilder', function () { let tradeAggregationResponse = { _links: { self: { - href: "https://horizon.stellar.org/trade_aggregations?base_asset_type=native\u0026counter_asset_type=credit_alphanum4\u0026counter_asset_code=BTC\u0026counter_asset_issuer=GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH\u0026start_time=1512689100000\u0026end_time=1512775500000\u0026resolution=300000", + href: 'https://horizon.stellar.org/trade_aggregations?base_asset_type=native\u0026counter_asset_type=credit_alphanum4\u0026counter_asset_code=BTC\u0026counter_asset_issuer=GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH\u0026start_time=1512689100000\u0026end_time=1512775500000\u0026resolution=300000' }, next: { - href: "https://horizon.stellar.org/trade_aggregations?base_asset_type=native\u0026counter_asset_code=BTC\u0026counter_asset_issuer=GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH\u0026counter_asset_type=credit_alphanum4\u0026end_time=1512775500000\u0026resolution=300000\u0026start_time=1512765000000", + href: 'https://horizon.stellar.org/trade_aggregations?base_asset_type=native\u0026counter_asset_code=BTC\u0026counter_asset_issuer=GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH\u0026counter_asset_type=credit_alphanum4\u0026end_time=1512775500000\u0026resolution=300000\u0026start_time=1512765000000' }, prev: { - href: "", - }, + href: '' + } }, _embedded: { records: [ { timestamp: 1512731100000, trade_count: 2, - base_volume: "341.8032786", - counter_volume: "0.0041700", - avg: "0.0000122", - high: "0.0000122", - low: "0.0000122", - open: "0.0000122", - close: "0.0000122", + base_volume: '341.8032786', + counter_volume: '0.0041700', + avg: '0.0000122', + high: '0.0000122', + low: '0.0000122', + open: '0.0000122', + close: '0.0000122' }, { timestamp: 1512732300000, trade_count: 1, - base_volume: "233.6065573", - counter_volume: "0.0028500", - avg: "0.0000122", - high: "0.0000122", - low: "0.0000122", - open: "0.0000122", - close: "0.0000122", + base_volume: '233.6065573', + counter_volume: '0.0028500', + avg: '0.0000122', + high: '0.0000122', + low: '0.0000122', + open: '0.0000122', + close: '0.0000122' }, { timestamp: 1512764700000, trade_count: 1, - base_volume: "451.0000000", - counter_volume: "0.0027962", - avg: "0.0000062", - high: "0.0000062", - low: "0.0000062", - open: "0.0000062", - close: "0.0000062", - }, - ], - }, + base_volume: '451.0000000', + counter_volume: '0.0027962', + avg: '0.0000062', + high: '0.0000062', + low: '0.0000062', + open: '0.0000062', + close: '0.0000062' + } + ] + } }; - it("requests the correct endpoint native/credit", function (done) { + it('requests the correct endpoint native/credit', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/trade_aggregations?base_asset_type=native&counter_asset_type=credit_alphanum4&counter_asset_code=BTC&counter_asset_issuer=GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH&start_time=1512689100000&end_time=1512775500000&resolution=300000", - ), + 'https://horizon-live.stellar.org:1337/trade_aggregations?base_asset_type=native&counter_asset_type=credit_alphanum4&counter_asset_code=BTC&counter_asset_issuer=GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH&start_time=1512689100000&end_time=1512775500000&resolution=300000' + ) ) .returns(Promise.resolve({ data: tradeAggregationResponse })); @@ -3386,21 +3386,21 @@ describe("server.js non-transaction tests", function () { .tradeAggregation( StellarSdk.Asset.native(), new StellarSdk.Asset( - "BTC", - "GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH", + 'BTC', + 'GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH' ), 1512689100000, 1512775500000, 300000, - 0, + 0 ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - tradeAggregationResponse._embedded.records, + tradeAggregationResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -3408,35 +3408,35 @@ describe("server.js non-transaction tests", function () { }); }); - it("requests the correct endpoint credit/native", function (done) { + it('requests the correct endpoint credit/native', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/trade_aggregations?base_asset_type=credit_alphanum4&base_asset_code=BTC&base_asset_issuer=GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH&counter_asset_type=native&start_time=1512689100000&end_time=1512775500000&resolution=300000", - ), + 'https://horizon-live.stellar.org:1337/trade_aggregations?base_asset_type=credit_alphanum4&base_asset_code=BTC&base_asset_issuer=GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH&counter_asset_type=native&start_time=1512689100000&end_time=1512775500000&resolution=300000' + ) ) .returns(Promise.resolve({ data: tradeAggregationResponse })); this.server .tradeAggregation( new StellarSdk.Asset( - "BTC", - "GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH", + 'BTC', + 'GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH' ), StellarSdk.Asset.native(), 1512689100000, 1512775500000, 300000, - 0, + 0 ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - tradeAggregationResponse._embedded.records, + tradeAggregationResponse._embedded.records ); - expect(response.next).to.be.a("function"); - expect(response.prev).to.be.a("function"); + expect(response.next).to.be.a('function'); + expect(response.prev).to.be.a('function'); done(); }) .catch(function (err) { @@ -3445,75 +3445,75 @@ describe("server.js non-transaction tests", function () { }); }); - describe("AssetsCallBuilder", function () { - it("requests the correct endpoint", function (done) { + describe('AssetsCallBuilder', function () { + it('requests the correct endpoint', function (done) { let assetsResponse = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/assets?order=asc\u0026limit=1\u0026cursor=", + href: 'https://horizon-live.stellar.org:1337/assets?order=asc\u0026limit=1\u0026cursor=' }, next: { - href: "https://horizon-live.stellar.org:1337/assets?order=asc\u0026limit=1\u0026cursor=9HORIZONS_GB2HXY7UEDCSHOWZ4553QFGFILNU73OFS2P4HU5IB3UUU66TWPBPVTGW_credit_alphanum12", + href: 'https://horizon-live.stellar.org:1337/assets?order=asc\u0026limit=1\u0026cursor=9HORIZONS_GB2HXY7UEDCSHOWZ4553QFGFILNU73OFS2P4HU5IB3UUU66TWPBPVTGW_credit_alphanum12' }, prev: { - href: "https://horizon-live.stellar.org:1337/assets?order=desc\u0026limit=1\u0026cursor=9HORIZONS_GB2HXY7UEDCSHOWZ4553QFGFILNU73OFS2P4HU5IB3UUU66TWPBPVTGW_credit_alphanum12", - }, + href: 'https://horizon-live.stellar.org:1337/assets?order=desc\u0026limit=1\u0026cursor=9HORIZONS_GB2HXY7UEDCSHOWZ4553QFGFILNU73OFS2P4HU5IB3UUU66TWPBPVTGW_credit_alphanum12' + } }, _embedded: { records: [ { _links: { toml: { - href: "", - }, + href: '' + } }, - asset_type: "credit_alphanum12", - asset_code: "9HORIZONS", + asset_type: 'credit_alphanum12', + asset_code: '9HORIZONS', asset_issuer: - "GB2HXY7UEDCSHOWZ4553QFGFILNU73OFS2P4HU5IB3UUU66TWPBPVTGW", + 'GB2HXY7UEDCSHOWZ4553QFGFILNU73OFS2P4HU5IB3UUU66TWPBPVTGW', paging_token: - "9HORIZONS_GB2HXY7UEDCSHOWZ4553QFGFILNU73OFS2P4HU5IB3UUU66TWPBPVTGW_credit_alphanum12", + '9HORIZONS_GB2HXY7UEDCSHOWZ4553QFGFILNU73OFS2P4HU5IB3UUU66TWPBPVTGW_credit_alphanum12', accounts: { authorized: 2, authorized_to_maintain_liabilities: 1, - unauthorized: 0, + unauthorized: 0 }, num_claimable_balances: 3, num_contracts: 2, balances: { - authorized: "1000000.0000000", - authorized_to_maintain_liabilities: "500000.0000000", - unauthorized: "0.0000000", + authorized: '1000000.0000000', + authorized_to_maintain_liabilities: '500000.0000000', + unauthorized: '0.0000000' }, - claimable_balances_amount: "0.0000000", - contracts_amount: "1000.0000000", - amount: "1000000.0000000", + claimable_balances_amount: '0.0000000', + contracts_amount: '1000.0000000', + amount: '1000000.0000000', num_accounts: 2, flags: { auth_required: false, auth_revocable: false, auth_immutable: false, - auth_clawback_enabled: false, - }, - }, - ], - }, + auth_clawback_enabled: false + } + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( - sinon.match("https://horizon-live.stellar.org:1337/assets?limit=1"), + sinon.match('https://horizon-live.stellar.org:1337/assets?limit=1') ) .returns(Promise.resolve({ data: assetsResponse })); this.server .assets() - .limit("1") + .limit('1') .call() .then(function (response) { expect(response.records).to.be.equal( - assetsResponse._embedded.records, + assetsResponse._embedded.records ); done(); }) @@ -3522,76 +3522,76 @@ describe("server.js non-transaction tests", function () { }); }); - it("requests the correct endpoint (asset_code)", function (done) { + it('requests the correct endpoint (asset_code)', function (done) { let assetsCodeResponse = { _links: { self: { - href: "https://horizon-live.stellar.org:1337/assets?order=asc\u0026limit=1\u0026cursor=\u0026asset_code=USD", + href: 'https://horizon-live.stellar.org:1337/assets?order=asc\u0026limit=1\u0026cursor=\u0026asset_code=USD' }, next: { - href: "https://horizon-live.stellar.org:1337/assets?order=asc\u0026limit=1\u0026cursor=USD_GCYK67DDGBOANS6UODJ62QWGLEB2A7JQ3XUV25HCMLT7CI23PMMK3W6R_credit_alphanum4\u0026asset_code=USD", + href: 'https://horizon-live.stellar.org:1337/assets?order=asc\u0026limit=1\u0026cursor=USD_GCYK67DDGBOANS6UODJ62QWGLEB2A7JQ3XUV25HCMLT7CI23PMMK3W6R_credit_alphanum4\u0026asset_code=USD' }, prev: { - href: "https://horizon-live.stellar.org:1337/assets?order=desc\u0026limit=1\u0026cursor=USD_GCYK67DDGBOANS6UODJ62QWGLEB2A7JQ3XUV25HCMLT7CI23PMMK3W6R_credit_alphanum4\u0026asset_code=USD", - }, + href: 'https://horizon-live.stellar.org:1337/assets?order=desc\u0026limit=1\u0026cursor=USD_GCYK67DDGBOANS6UODJ62QWGLEB2A7JQ3XUV25HCMLT7CI23PMMK3W6R_credit_alphanum4\u0026asset_code=USD' + } }, _embedded: { records: [ { _links: { toml: { - href: "", - }, + href: '' + } }, - asset_type: "credit_alphanum4", - asset_code: "USD", + asset_type: 'credit_alphanum4', + asset_code: 'USD', asset_issuer: - "GCYK67DDGBOANS6UODJ62QWGLEB2A7JQ3XUV25HCMLT7CI23PMMK3W6R", + 'GCYK67DDGBOANS6UODJ62QWGLEB2A7JQ3XUV25HCMLT7CI23PMMK3W6R', paging_token: - "USD_GCYK67DDGBOANS6UODJ62QWGLEB2A7JQ3XUV25HCMLT7CI23PMMK3W6R_credit_alphanum4", + 'USD_GCYK67DDGBOANS6UODJ62QWGLEB2A7JQ3XUV25HCMLT7CI23PMMK3W6R_credit_alphanum4', accounts: { authorized: 127, authorized_to_maintain_liabilities: 64, - unauthorized: 0, + unauthorized: 0 }, num_claimable_balances: 3, num_contracts: 2, balances: { - authorized: "111.0010000", - authorized_to_maintain_liabilities: "55.5005000", - unauthorized: "0.0000000", + authorized: '111.0010000', + authorized_to_maintain_liabilities: '55.5005000', + unauthorized: '0.0000000' }, - claimable_balances_amount: "0.0000000", - contracts_amount: "10000.0000000", - amount: "111.0010000", + claimable_balances_amount: '0.0000000', + contracts_amount: '10000.0000000', + amount: '111.0010000', num_accounts: 127, flags: { auth_required: false, auth_revocable: false, auth_immutable: false, - auth_clawback_enabled: false, - }, - }, - ], - }, + auth_clawback_enabled: false + } + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/assets?asset_code=USD&limit=1", - ), + 'https://horizon-live.stellar.org:1337/assets?asset_code=USD&limit=1' + ) ) .returns(Promise.resolve({ data: assetsCodeResponse })); this.server .assets() - .forCode("USD") - .limit("1") + .forCode('USD') + .limit('1') .call() .then(function (response) { expect(response.records).to.be.equal( - assetsCodeResponse._embedded.records, + assetsCodeResponse._embedded.records ); done(); }) @@ -3600,76 +3600,76 @@ describe("server.js non-transaction tests", function () { }); }); - it("requests the correct endpoint (asset_issuer)", function (done) { + it('requests the correct endpoint (asset_issuer)', function (done) { let assetIssuerResponse = { _links: { self: { - href: "http://horizon-testnet.stellar.org:1337/assets?order=asc\u0026limit=10\u0026cursor=\u0026asset_issuer=GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN", + href: 'http://horizon-testnet.stellar.org:1337/assets?order=asc\u0026limit=10\u0026cursor=\u0026asset_issuer=GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN' }, next: { - href: "http://horizon-testnet.stellar.org:1337/assets?order=asc\u0026limit=10\u0026cursor=00acc1_GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN_credit_alphanum12\u0026asset_issuer=GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN", + href: 'http://horizon-testnet.stellar.org:1337/assets?order=asc\u0026limit=10\u0026cursor=00acc1_GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN_credit_alphanum12\u0026asset_issuer=GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN' }, prev: { - href: "http://horizon-testnet.stellar.org:1337/assets?order=desc\u0026limit=10\u0026cursor=004d40_GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN_credit_alphanum12\u0026asset_issuer=GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN", - }, + href: 'http://horizon-testnet.stellar.org:1337/assets?order=desc\u0026limit=10\u0026cursor=004d40_GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN_credit_alphanum12\u0026asset_issuer=GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN' + } }, _embedded: { records: [ { _links: { toml: { - href: "", - }, + href: '' + } }, - asset_type: "credit_alphanum12", - asset_code: "004d40", + asset_type: 'credit_alphanum12', + asset_code: '004d40', asset_issuer: - "GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN", + 'GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN', paging_token: - "004d40_GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN_credit_alphanum12", + '004d40_GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN_credit_alphanum12', accounts: { authorized: 18, authorized_to_maintain_liabilities: 9, - unauthorized: 0, + unauthorized: 0 }, num_claimable_balances: 3, num_contracts: 2, balances: { - authorized: "757.0000000", - authorized_to_maintain_liabilities: "378.5000000", - unauthorized: "0.0000000", + authorized: '757.0000000', + authorized_to_maintain_liabilities: '378.5000000', + unauthorized: '0.0000000' }, - claimable_balances_amount: "0.0000000", - contracts_amount: "10000.0000000", - amount: "757.0000000", + claimable_balances_amount: '0.0000000', + contracts_amount: '10000.0000000', + amount: '757.0000000', num_accounts: 18, flags: { auth_required: false, auth_revocable: false, auth_immutable: false, - auth_clawback_enabled: false, - }, - }, - ], - }, + auth_clawback_enabled: false + } + } + ] + } }; this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/assets?asset_issuer=GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN&limit=1", - ), + 'https://horizon-live.stellar.org:1337/assets?asset_issuer=GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN&limit=1' + ) ) .returns(Promise.resolve({ data: assetIssuerResponse })); this.server .assets() - .forIssuer("GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN") - .limit("1") + .forIssuer('GCOGPF7IRVXUCJZAQWXVFQEE4HAOCTDGZI2QZSMKLM5BTTGRLY6GDOJN') + .limit('1') .call() .then(function (response) { expect(response.records).to.be.equal( - assetIssuerResponse._embedded.records, + assetIssuerResponse._embedded.records ); done(); }) @@ -3681,73 +3681,73 @@ describe("server.js non-transaction tests", function () { let assetCodeIssuerResponse = { _links: { self: { - href: "http://horizon-testnet.stellar.org/assets?order=asc\u0026limit=10\u0026cursor=\u0026asset_code=USD\u0026asset_issuer=GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR", + href: 'http://horizon-testnet.stellar.org/assets?order=asc\u0026limit=10\u0026cursor=\u0026asset_code=USD\u0026asset_issuer=GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR' }, next: { - href: "http://horizon-testnet.stellar.org/assets?order=asc\u0026limit=10\u0026cursor=USD_GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR_credit_alphanum4\u0026asset_code=USD\u0026asset_issuer=GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR", + href: 'http://horizon-testnet.stellar.org/assets?order=asc\u0026limit=10\u0026cursor=USD_GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR_credit_alphanum4\u0026asset_code=USD\u0026asset_issuer=GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR' }, prev: { - href: "http://horizon-testnet.stellar.org/assets?order=desc\u0026limit=10\u0026cursor=USD_GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR_credit_alphanum4\u0026asset_code=USD\u0026asset_issuer=GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR", - }, + href: 'http://horizon-testnet.stellar.org/assets?order=desc\u0026limit=10\u0026cursor=USD_GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR_credit_alphanum4\u0026asset_code=USD\u0026asset_issuer=GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR' + } }, _embedded: { records: [ { _links: { toml: { - href: "https://bakalr/.well-known/stellar.toml", - }, + href: 'https://bakalr/.well-known/stellar.toml' + } }, - asset_type: "credit_alphanum4", - asset_code: "USD", + asset_type: 'credit_alphanum4', + asset_code: 'USD', asset_issuer: - "GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR", + 'GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR', paging_token: - "USD_GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR_credit_alphanum4", + 'USD_GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR_credit_alphanum4', accounts: { authorized: 1, authorized_to_maintain_liabilities: 0, - unauthorized: 0, + unauthorized: 0 }, num_claimable_balances: 0, num_contracts: 2, balances: { - authorized: "1387.0000000", - authorized_to_maintain_liabilities: "0.0000000", - unauthorized: "0.0000000", + authorized: '1387.0000000', + authorized_to_maintain_liabilities: '0.0000000', + unauthorized: '0.0000000' }, - claimable_balances_amount: "0.0000000", - contracts_amount: "10000.0000000", - amount: "1387.0000000", + claimable_balances_amount: '0.0000000', + contracts_amount: '10000.0000000', + amount: '1387.0000000', num_accounts: 1, flags: { auth_required: true, auth_revocable: true, auth_immutable: false, - auth_clawback_enabled: false, - }, - }, - ], - }, + auth_clawback_enabled: false + } + } + ] + } }; - it("requests the correct endpoint (asset_code then asset_issuer)", function (done) { + it('requests the correct endpoint (asset_code then asset_issuer)', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/assets?asset_issuer=GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR&asset_code=USD", - ), + 'https://horizon-live.stellar.org:1337/assets?asset_issuer=GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR&asset_code=USD' + ) ) .returns(Promise.resolve({ data: assetCodeIssuerResponse })); this.server .assets() - .forIssuer("GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR") - .forCode("USD") + .forIssuer('GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR') + .forCode('USD') .call() .then(function (response) { expect(response.records).to.be.equal( - assetCodeIssuerResponse._embedded.records, + assetCodeIssuerResponse._embedded.records ); done(); }) @@ -3756,24 +3756,24 @@ describe("server.js non-transaction tests", function () { }); }); - it("requests the correct endpoint (asset_issuer then asset_code)", function (done) { + it('requests the correct endpoint (asset_issuer then asset_code)', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/assets?asset_code=USD&asset_issuer=GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR", - ), + 'https://horizon-live.stellar.org:1337/assets?asset_code=USD&asset_issuer=GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR' + ) ) .returns(Promise.resolve({ data: assetCodeIssuerResponse })); this.server .assets() - .forCode("USD") - .forIssuer("GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR") + .forCode('USD') + .forIssuer('GBW3EZBZKRERB4JUDWGQPIBGHKJ4XPOFG2VQ2WTFR4F7TYC5WS7F3XGR') .call() .then(function (response) { expect(response.records).to.be.equal( - assetCodeIssuerResponse._embedded.records, + assetCodeIssuerResponse._embedded.records ); done(); }) @@ -3783,21 +3783,21 @@ describe("server.js non-transaction tests", function () { }); }); - describe("Regressions", function () { - it("offers callBuilder does not pollute Server instance URI #379", function (done) { + describe('Regressions', function () { + it('offers callBuilder does not pollute Server instance URI #379', function (done) { this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/effects", - ), + 'https://horizon-live.stellar.org:1337/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/effects' + ) ) .returns(Promise.resolve({ data: {} })); const account = - "GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K"; + 'GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K'; - const offerCallBuilder = this.server.offers("accounts", account); + const offerCallBuilder = this.server.offers('accounts', account); const effectCallBuilder = this.server .effects() .forAccount(account) diff --git a/test/unit/server_transaction_test.js b/test/unit/server_transaction_test.js index 50ea7d49c..8970ac4e2 100644 --- a/test/unit/server_transaction_test.js +++ b/test/unit/server_transaction_test.js @@ -1,24 +1,24 @@ -describe("server.js transaction tests", function () { +describe('server.js transaction tests', function () { let keypair = StellarSdk.Keypair.random(); - let account = new StellarSdk.Account(keypair.publicKey(), "56199647068161"); + let account = new StellarSdk.Account(keypair.publicKey(), '56199647068161'); beforeEach(function () { this.server = new StellarSdk.Server( - "https://horizon-live.stellar.org:1337", + 'https://horizon-live.stellar.org:1337' ); this.axiosMock = sinon.mock(HorizonAxiosClient); let transaction = new StellarSdk.TransactionBuilder(account, { fee: 100, networkPassphrase: StellarSdk.Networks.TESTNET, - v1: true, + v1: true }) .addOperation( StellarSdk.Operation.payment({ destination: - "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW", + 'GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW', asset: StellarSdk.Asset.native(), - amount: "100.50", - }), + amount: '100.50' + }) ) .setTimeout(StellarSdk.TimeoutInfinite) .build(); @@ -26,7 +26,7 @@ describe("server.js transaction tests", function () { this.transaction = transaction; this.blob = encodeURIComponent( - transaction.toEnvelope().toXDR().toString("base64"), + transaction.toEnvelope().toXDR().toString('base64') ); }); @@ -35,12 +35,12 @@ describe("server.js transaction tests", function () { this.axiosMock.restore(); }); - it("sends a transaction", function (done) { + it('sends a transaction', function (done) { this.axiosMock - .expects("post") + .expects('post') .withArgs( - "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}`, + 'https://horizon-live.stellar.org:1337/transactions', + `tx=${this.blob}` ) .returns(Promise.resolve({ data: {} })); @@ -53,27 +53,27 @@ describe("server.js transaction tests", function () { done(err); }); }); - it("adds metadata - tx was too small and was immediately deleted", function (done) { + it('adds metadata - tx was too small and was immediately deleted', function (done) { const response = { _links: { transaction: { - href: "https://horizon.stellar.org/transactions/db2c69a07be57eb5baefbfbb72b95c7c20d2c4d6f2a0e84e7c27dd0359055a2f", - }, + href: 'https://horizon.stellar.org/transactions/db2c69a07be57eb5baefbfbb72b95c7c20d2c4d6f2a0e84e7c27dd0359055a2f' + } }, - hash: "db2c69a07be57eb5baefbfbb72b95c7c20d2c4d6f2a0e84e7c27dd0359055a2f", + hash: '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AAAAAAAAAAAAAAAAEBXVwVAAAAAAAAAACFABFt40Ld/n20+pwgEgNf/EVnafXydsKMajx2T0FB/wAAAAJThGhSAQf86AAAACMAAAAFAAAAAQAAAACEPwEuxkVAQXfespLpiilBRPdvqIsEbieyl7rz8ME0FgAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAA=", + 'AAAAAQAAAAIAAAADAV1cFQAAAAAAAAAAhQARbeNC3f59tPqcIBIDX/xFZ2n18nbCjGo8dk9BQf8AAAACU4RoUgEH/OgAAAAiAAAABQAAAAEAAAAAhD8BLsZFQEF33rKS6YopQUT3b6iLBG4nspe68/DBNBYAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBXVwVAAAAAAAAAACFABFt40Ld/n20+pwgEgNf/EVnafXydsKMajx2T0FB/wAAAAJThGhSAQf86AAAACMAAAAFAAAAAQAAAACEPwEuxkVAQXfespLpiilBRPdvqIsEbieyl7rz8ME0FgAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAA=' }; this.axiosMock - .expects("post") + .expects('post') .withArgs( - "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}`, + 'https://horizon-live.stellar.org:1337/transactions', + `tx=${this.blob}` ) .returns(Promise.resolve({ data: response })); @@ -82,14 +82,14 @@ describe("server.js transaction tests", function () { .then(function (res) { expect(res.offerResults).to.be.an.instanceOf(Array); expect(res.offerResults[0].offersClaimed).to.be.an.instanceOf(Array); - expect(typeof res.offerResults[0].effect).to.equal("string"); + expect(typeof res.offerResults[0].effect).to.equal('string'); expect(res.offerResults[0].wasImmediatelyFilled).to.equal(false); expect(res.offerResults[0].wasImmediatelyDeleted).to.equal(true); expect(res.offerResults[0].wasPartiallyFilled).to.equal(false); expect(res.offerResults[0].operationIndex).to.equal(0); - expect(res.offerResults[0].amountBought).to.equal("0"); - expect(res.offerResults[0].amountSold).to.equal("0"); + expect(res.offerResults[0].amountBought).to.equal('0'); + expect(res.offerResults[0].amountSold).to.equal('0'); expect(res.offerResults[0].currentOffer).to.equal(undefined); done(); @@ -98,28 +98,28 @@ describe("server.js transaction tests", function () { done(err); }); }); - it("adds metadata, order immediately fills", function (done) { + it('adds metadata, order immediately fills', function (done) { const response = { _links: { transaction: { - href: "https://horizon.stellar.org/transactions/d88ded94c558790f7e819b85fd35adb10a1e474312c34ebd611495c349a8eb69", - }, + href: 'https://horizon.stellar.org/transactions/d88ded94c558790f7e819b85fd35adb10a1e474312c34ebd611495c349a8eb69' + } }, - hash: "d88ded94c558790f7e819b85fd35adb10a1e474312c34ebd611495c349a8eb69", + hash: 'd88ded94c558790f7e819b85fd35adb10a1e474312c34ebd611495c349a8eb69', ledger: 22895558, envelope_xdr: - "AAAAAIUAEW3jQt3+fbT6nCASA1/8RWdp9fJ2woxqPHZPQUH/AAAAZAEH/OgAAAAgAAAAAQAAAAAAAAAAAAAAAFyIDD0AAAAAAAAAAQAAAAAAAAADAAAAAAAAAAFCQVQAAAAAAEZK09vHmzOmEMoVWYtbbZcKv3ZOoo06ckzbhyDIFKfhAAAAAAExLQAAAAABAAAAAgAAAAAAAAAAAAAAAAAAAAFPQUH/AAAAQHk3Igj+JXqggsJBFl4mrzgACqxWpx87psxu5UHnSskbwRjHZz89NycCZmJL4gN5WN7twm+wK371K9XcRNDiBwQ=", + 'AAAAAIUAEW3jQt3+fbT6nCASA1/8RWdp9fJ2woxqPHZPQUH/AAAAZAEH/OgAAAAgAAAAAQAAAAAAAAAAAAAAAFyIDD0AAAAAAAAAAQAAAAAAAAADAAAAAAAAAAFCQVQAAAAAAEZK09vHmzOmEMoVWYtbbZcKv3ZOoo06ckzbhyDIFKfhAAAAAAExLQAAAAABAAAAAgAAAAAAAAAAAAAAAAAAAAFPQUH/AAAAQHk3Igj+JXqggsJBFl4mrzgACqxWpx87psxu5UHnSskbwRj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AAAQAAAACFABFt40Ld/n20+pwgEgNf/EVnafXydsKMajx2T0FB/wAAAAFCQVQAAAAAAEZK09vHmzOmEMoVWYtbbZcKv3ZOoo06ckzbhyDIFKfhAAAAAAAAAAB//////////wAAAAEAAAAAAAAAAAAAAAEBXVvGAAAAAQAAAACFABFt40Ld/n20+pwgEgNf/EVnafXydsKMajx2T0FB/wAAAAFCQVQAAAAAAEZK09vHmzOmEMoVWYtbbZcKv3ZOoo06ckzbhyDIFKfhAAAAAACj1/l//////////wAAAAEAAAAAAAAAAAAAAAMBXVvGAAAAAAAAAACFABFt40Ld/n20+pwgEgNf/EVnafXydsKMajx2T0FB/wAAAAJUtZZ9AQf86AAAACAAAAAFAAAAAQAAAACEPwEuxkVAQXfespLpiilBRPdvqIsEbieyl7rz8ME0FgAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQFdW8YAAAAAAAAAAIUAEW3jQt3+fbT6nCASA1/8RWdp9fJ2woxqPHZPQUH/AAAAAlOEaX4BB/zoAAAAIAAAAAUAAAABAAAAAIQ/AS7GRUBBd96ykumKKUFE92+oiwRuJ7KXuvPwwTQWAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=' }; this.axiosMock - .expects("post") + .expects('post') .withArgs( - "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}`, + 'https://horizon-live.stellar.org:1337/transactions', + `tx=${this.blob}` ) .returns(Promise.resolve({ data: response })); @@ -128,13 +128,13 @@ describe("server.js transaction tests", function () { .then(function (res) { expect(res.offerResults).to.be.an.instanceOf(Array); expect(res.offerResults[0].offersClaimed).to.be.an.instanceOf(Array); - expect(typeof res.offerResults[0].effect).to.equal("string"); + expect(typeof res.offerResults[0].effect).to.equal('string'); expect(res.offerResults[0].wasImmediatelyFilled).to.equal(true); expect(res.offerResults[0].wasImmediatelyDeleted).to.equal(false); expect(res.offerResults[0].wasPartiallyFilled).to.equal(false); expect(res.offerResults[0].operationIndex).to.equal(0); - expect(res.offerResults[0].amountSold).to.equal("1.9999999"); + expect(res.offerResults[0].amountSold).to.equal('1.9999999'); done(); }) @@ -142,28 +142,28 @@ describe("server.js transaction tests", function () { done(err); }); }); - it("adds metadata, order is open", function (done) { + it('adds metadata, order is open', function (done) { const response = { _links: { transaction: { - href: "https://horizon.stellar.org/transactions/e1c2b91141d8c4185dc8c18118f345a269d88c476bdadec695c1b3ecdc999831", - }, + href: 'https://horizon.stellar.org/transactions/e1c2b91141d8c4185dc8c18118f345a269d88c476bdadec695c1b3ecdc999831' + } }, - hash: "e1c2b91141d8c4185dc8c18118f345a269d88c476bdadec695c1b3ecdc999831", + hash: 'e1c2b91141d8c4185dc8c18118f345a269d88c476bdadec695c1b3ecdc999831', ledger: 22896129, envelope_xdr: - "AAAAAIUAEW3jQt3+fbT6nCASA1/8RWdp9fJ2woxqPHZPQUH/AAAAZAEH/OgAAAAkAAAAAQAAAAAAAAAAAAAAAFyIF70AAAAAAAAAAQAAAAAAAAADAAAAAAAAAAFCQVQAAAAAAEZK09vHmzOmEMoVWYtbbZcKv3ZOoo06ckzbhyDIFKfhAAAAAACYloAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAFPQUH/AAAAQJYfX7d9Cp609ChIRR5ONhCkSM2a1YLmi21rNLjcw5XFZg5R6Y3ZQ6kwVyJBcgqMwpH9F+NgoybKpepIIaXJiQs=", + 'AAAAAIUAEW3jQt3+fbT6nCASA1/8RWdp9fJ2woxqPHZPQUH/AAAAZAEH/OgAAAAkAAAAAQAAAAAAAAAAAAAAAFyIF70AAAAAAAAAAQAAAAAAAAADAAAAAAAAAAFCQVQAAAAAAEZK09vHmzOmEMoVWYtbbZcKv3ZOoo06ckzbhyDIFKfhAAAAAACYloAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAFPQUH/AAAAQJYfX7d9Cp609ChIRR5ONhCkSM2a1YLmi21rNLjcw5XFZg5R6Y3ZQ6k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Mock - .expects("post") + .expects('post') .withArgs( - "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}`, + 'https://horizon-live.stellar.org:1337/transactions', + `tx=${this.blob}` ) .returns(Promise.resolve({ data: response })); @@ -172,9 +172,9 @@ describe("server.js transaction tests", function () { .then(function (res) { expect(res.offerResults).to.be.an.instanceOf(Array); expect(res.offerResults[0].offersClaimed).to.be.an.instanceOf(Array); - expect(typeof res.offerResults[0].effect).to.equal("string"); + expect(typeof res.offerResults[0].effect).to.equal('string'); expect(res.offerResults[0].wasImmediatelyFilled).to.equal(false); - expect(res.offerResults[0].amountBought).to.equal("0"); + expect(res.offerResults[0].amountBought).to.equal('0'); expect(res.offerResults[0].wasImmediatelyDeleted).to.equal(false); expect(res.offerResults[0].wasPartiallyFilled).to.equal(false); expect(res.offerResults[0].isFullyOpen).to.equal(true); @@ -186,28 +186,28 @@ describe("server.js transaction tests", function () { done(err); }); }); - it("adds metadata, partial fill", function (done) { + it('adds metadata, partial fill', function (done) { const response = { _links: { transaction: { - href: "https://horizon.stellar.org/transactions/28552ba6a70ab74f6de05319950e2ddad94491159ebc97b14cfcde2d3c7e70a1", - }, + href: 'https://horizon.stellar.org/transactions/28552ba6a70ab74f6de05319950e2ddad94491159ebc97b14cfcde2d3c7e70a1' + } }, - hash: "28552ba6a70ab74f6de05319950e2ddad94491159ebc97b14cfcde2d3c7e70a1", + hash: '28552ba6a70ab74f6de05319950e2ddad94491159ebc97b14cfcde2d3c7e70a1', ledger: 22896525, envelope_xdr: - "AAAAAIUAEW3jQt3+fbT6nCASA1/8RWdp9fJ2woxqPHZPQUH/AAAAZAEH/OgAAAAlAAAAAQAAAAAAAAAAAAAAAFyIH7sAAAAAAAAAAQAAAAAAAAADAAAAAAAAAAFCQVQAAAAAAEZK09vHmzOmEMoVWYtbbZcKv3ZOoo06ckzbhyDIFKfhAAAAAG1Y3jgATEtAAIv23wAAAAAAAAAAAAAAAAAAAAFPQUH/AAAAQBa4GPm0vQ/pR5lxfR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0injJs+K7BsCpQVl1UTSG08d4CYMK712JH8AAAAAUJBVAAAAAAARkrT28ebM6YQyhVZi1ttlwq/dk6ijTpyTNuHIMgUp+EAAAABgQWCFn//////////AAAAAQAAAAEAAAAIIq08AgAAAAGBBYIVAAAAAAAAAAAAAAABAV1fjQAAAAEAAAAAdZtwPxUrSKeMmz4rsGwKlBWXVRNIbTx3gJgwrvXYkfwAAAABQkFUAAAAAABGStPbx5szphDKFVmLW22XCr92TqKNOnJM24cgyBSn4QAAAAFg77c/f/////////8AAAABAAAAAQAAAAgirTwCAAAAAWDvtz4AAAAAAAAAAAAAAAABXV+NAAAAAgAAAACFABFt40Ld/n20+pwgEgNf/EVnafXydsKMajx2T0FB/wAAAAAEZsEvAAAAAAAAAAFCQVQAAAAAAEZK09vHmzOmEMoVWYtbbZcKv3ZOoo06ckzbhyDIFKfhAAAAADJ8VSAATEtAAIv23wAAAAAAAAAAAAAAAA==' }; this.axiosMock - .expects("post") + .expects('post') .withArgs( - "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}`, + 'https://horizon-live.stellar.org:1337/transactions', + `tx=${this.blob}` ) .returns(Promise.resolve({ data: response })); @@ -217,22 +217,22 @@ describe("server.js transaction tests", function () { expect(res.offerResults).to.be.an.instanceOf(Array); expect(res.offerResults[0].offersClaimed).to.be.an.instanceOf(Array); expect(res.offerResults[0].offersClaimed).to.have.lengthOf(1); - expect(res.offerResults[0].effect).to.equal("manageOfferCreated"); - expect(typeof res.offerResults[0].effect).to.equal("string"); + expect(res.offerResults[0].effect).to.equal('manageOfferCreated'); + expect(typeof res.offerResults[0].effect).to.equal('string'); expect(res.offerResults[0].wasImmediatelyFilled).to.equal(false); - expect(res.offerResults[0].amountBought).to.equal("53.8299095"); + expect(res.offerResults[0].amountBought).to.equal('53.8299095'); expect(res.offerResults[0].wasImmediatelyDeleted).to.equal(false); expect(res.offerResults[0].wasPartiallyFilled).to.equal(true); expect(res.offerResults[0].isFullyOpen).to.equal(false); expect(res.offerResults[0].operationIndex).to.equal(0); expect(res.offerResults[0].currentOffer.selling.type).to.equal( - "native", + 'native' ); expect(res.offerResults[0].currentOffer.buying.assetCode).to.equal( - "BAT", + 'BAT' ); expect(res.offerResults[0].currentOffer.buying.issuer).to.equal( - "GBDEVU63Y6NTHJQQZIKVTC23NWLQVP3WJ2RI2OTSJTNYOIGICST6DUXR", + 'GBDEVU63Y6NTHJQQZIKVTC23NWLQVP3WJ2RI2OTSJTNYOIGICST6DUXR' ); done(); @@ -245,23 +245,23 @@ describe("server.js transaction tests", function () { const response = { _links: { transaction: { - href: "https://horizon.stellar.org/transactions/6c3191f252f2c586c74275c766ce761021513e520eab3bb63d3fd18d0d01492e", - }, + href: 'https://horizon.stellar.org/transactions/6c3191f252f2c586c74275c766ce761021513e520eab3bb63d3fd18d0d01492e' + } }, - hash: "6c3191f252f2c586c74275c766ce761021513e520eab3bb63d3fd18d0d01492e", + hash: '6c3191f252f2c586c74275c766ce761021513e520eab3bb63d3fd18d0d01492e', ledger: 22893969, envelope_xdr: - "AAAAAIUAEW3jQt3+fbT6nCASA1/8RWdp9fJ2woxqPHZPQUH/AAAAZAEH/OgAAAAeAAAAAQAAAAAAAAAAAAAAAFyH7EoAAAAAAAAAAQAAAAAAAAAGAAAAAUJUQwAAAAAAKTpjGpnWX8jImMrLprg+1nHJhiAVINNe+zSvg3bvNiUAAAAAAAAAAAAAAAAAAAABT0FB/wAAAEBDRFjJITX4LIIY2tc8KxVU3Pe7dqZ+BkWft93SCVlEXxiCHnoNop5UEKRoRTvAUh34I6As4IN/QpGGqHmbKv8F", - result_xdr: "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAAGAAAAAAAAAAA=", + 'AAAAAIUAEW3jQt3+fbT6nCASA1/8RWdp9fJ2woxqPHZPQUH/AAAAZAEH/OgAAAAeAAAAAQAAAAAAAAAAAAAAAFyH7EoAAAAAAAAAAQAAAAAAAAAGAAAAAUJUQwAAAAAAKTpjGpnWX8jImMrLprg+1nHJhiAVIN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AAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAV1VkQAAAAAAAAAAhQARbeNC3f59tPqcIBIDX/xFZ2n18nbCjGo8dk9BQf8AAAACVLWYcQEH/OgAAAAeAAAABQAAAAEAAAAAhD8BLsZFQEF33rKS6YopQUT3b6iLBG4nspe68/DBNBYAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==' }; this.axiosMock - .expects("post") + .expects('post') .withArgs( - "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}`, + 'https://horizon-live.stellar.org:1337/transactions', + `tx=${this.blob}` ) .returns(Promise.resolve({ data: response })); @@ -275,28 +275,28 @@ describe("server.js transaction tests", function () { done(err); }); }); - it("adds metadata about offers, even if some ops are not", function (done) { + it('adds metadata about offers, even if some ops are not', function (done) { const response = { _links: { transaction: { - href: "https://horizon.stellar.org/transactions/6a22d6896140f6f330ef19086827df0780eb2ad3324f3271b38c70cb1cba1c3d", - }, + href: 'https://horizon.stellar.org/transactions/6a22d6896140f6f330ef19086827df0780eb2ad3324f3271b38c70cb1cba1c3d' + } }, - hash: "6a22d6896140f6f330ef19086827df0780eb2ad3324f3271b38c70cb1cba1c3d", + hash: '6a22d6896140f6f330ef19086827df0780eb2ad3324f3271b38c70cb1cba1c3d', ledger: 22894978, envelope_xdr: - "AAAAAIUAEW3jQt3+fbT6nCASA1/8RWdp9fJ2woxqPHZPQUH/AAABkAEH/OgAAAAfAAAAAQAAAAAAAAAAAAAAAFyIAGgAAAAAAAAABAAAAAAAAAAGAAAAAUJBVAAAAAAARkrT28ebM6YQyhVZi1ttlwq/dk6ijTpyTNuHIMgUp+F//////////wAAAAAAAAAFAAAAAQAAAACEPwEuxkVAQXfespLpiilBRPdvqIsEbieyl7rz8ME0FgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAUJBVAAAAAAARk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AAAAABAV1ZggAAAAAAAAAAhQARbeNC3f59tPqcIBIDX/xFZ2n18nbCjGo8dk9BQf8AAAACVLWW4QEH/OgAAAAfAAAABQAAAAEAAAAAhD8BLsZFQEF33rKS6YopQUT3b6iLBG4nspe68/DBNBYAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' }; this.axiosMock - .expects("post") + .expects('post') .withArgs( - "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}`, + 'https://horizon-live.stellar.org:1337/transactions', + `tx=${this.blob}` ) .returns(Promise.resolve({ data: response })); @@ -306,10 +306,10 @@ describe("server.js transaction tests", function () { expect(res.offerResults).to.be.an.instanceOf(Array); expect(res.offerResults).to.have.lengthOf(2); expect(res.offerResults[0].offersClaimed).to.be.an.instanceOf(Array); - expect(typeof res.offerResults[0].effect).to.equal("string"); + expect(typeof res.offerResults[0].effect).to.equal('string'); expect(res.offerResults[0].operationIndex).to.equal(2); expect(res.offerResults[1].offersClaimed).to.be.an.instanceOf(Array); - expect(typeof res.offerResults[1].effect).to.equal("string"); + expect(typeof res.offerResults[1].effect).to.equal('string'); expect(res.offerResults[1].operationIndex).to.equal(3); done(); }) @@ -317,25 +317,25 @@ describe("server.js transaction tests", function () { done(err); }); }); - it("checks for memo required by default", function (done) { + it('checks for memo required by default', function (done) { this.axiosMock - .expects("post") + .expects('post') .withArgs( - "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}`, + 'https://horizon-live.stellar.org:1337/transactions', + `tx=${this.blob}` ) .returns(Promise.resolve({ data: {} })); this.axiosMock - .expects("get") + .expects('get') .withArgs( sinon.match( - "https://horizon-live.stellar.org:1337/accounts/GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW", - ), + 'https://horizon-live.stellar.org:1337/accounts/GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW' + ) ) .returns( Promise.reject({ - response: { status: 404, statusText: "NotFound", data: {} }, - }), + response: { status: 404, statusText: 'NotFound', data: {} } + }) ) .once(); @@ -348,23 +348,23 @@ describe("server.js transaction tests", function () { done(err); }); }); - it("submits fee bump transactions", function (done) { + it('submits fee bump transactions', function (done) { const feeBumpTx = StellarSdk.TransactionBuilder.buildFeeBumpTransaction( keypair, - "200", + '200', this.transaction, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); this.blob = encodeURIComponent( - feeBumpTx.toEnvelope().toXDR().toString("base64"), + feeBumpTx.toEnvelope().toXDR().toString('base64') ); this.axiosMock - .expects("post") + .expects('post') .withArgs( - "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}`, + 'https://horizon-live.stellar.org:1337/transactions', + `tx=${this.blob}` ) .returns(Promise.resolve({ data: {} })); diff --git a/test/unit/stellar_toml_resolver_test.js b/test/unit/stellar_toml_resolver_test.js index cd932490a..024aae33c 100644 --- a/test/unit/stellar_toml_resolver_test.js +++ b/test/unit/stellar_toml_resolver_test.js @@ -1,6 +1,6 @@ -const http = require("http"); +const http = require('http'); -describe("stellar_toml_resolver.js tests", function () { +describe('stellar_toml_resolver.js tests', function () { beforeEach(function () { this.axiosMock = sinon.mock(axios); StellarSdk.Config.setDefault(); @@ -11,139 +11,139 @@ describe("stellar_toml_resolver.js tests", function () { this.axiosMock.restore(); }); - describe("StellarTomlResolver.resolve", function () { + describe('StellarTomlResolver.resolve', function () { afterEach(function () { StellarSdk.Config.setDefault(); }); - it("returns stellar.toml object for valid request and stellar.toml file", function (done) { + it('returns stellar.toml object for valid request and stellar.toml file', function (done) { this.axiosMock - .expects("get") - .withArgs(sinon.match("https://acme.com/.well-known/stellar.toml")) + .expects('get') + .withArgs(sinon.match('https://acme.com/.well-known/stellar.toml')) .returns( Promise.resolve({ data: ` # The endpoint which clients should query to resolve stellar addresses # for users on your domain. FEDERATION_SERVER="https://api.stellar.org/federation" -`, - }), +` + }) ); - StellarSdk.StellarTomlResolver.resolve("acme.com").then((stellarToml) => { + StellarSdk.StellarTomlResolver.resolve('acme.com').then((stellarToml) => { expect(stellarToml.FEDERATION_SERVER).equals( - "https://api.stellar.org/federation", + 'https://api.stellar.org/federation' ); done(); }); }); - it("returns stellar.toml object for valid request and stellar.toml file when allowHttp is `true`", function (done) { + it('returns stellar.toml object for valid request and stellar.toml file when allowHttp is `true`', function (done) { this.axiosMock - .expects("get") - .withArgs(sinon.match("http://acme.com/.well-known/stellar.toml")) + .expects('get') + .withArgs(sinon.match('http://acme.com/.well-known/stellar.toml')) .returns( Promise.resolve({ data: ` # The endpoint which clients should query to resolve stellar addresses # for users on your domain. FEDERATION_SERVER="http://api.stellar.org/federation" -`, - }), +` + }) ); - StellarSdk.StellarTomlResolver.resolve("acme.com", { - allowHttp: true, + StellarSdk.StellarTomlResolver.resolve('acme.com', { + allowHttp: true }).then((stellarToml) => { expect(stellarToml.FEDERATION_SERVER).equals( - "http://api.stellar.org/federation", + 'http://api.stellar.org/federation' ); done(); }); }); - it("returns stellar.toml object for valid request and stellar.toml file when global Config.allowHttp flag is set", function (done) { + it('returns stellar.toml object for valid request and stellar.toml file when global Config.allowHttp flag is set', function (done) { StellarSdk.Config.setAllowHttp(true); this.axiosMock - .expects("get") - .withArgs(sinon.match("http://acme.com/.well-known/stellar.toml")) + .expects('get') + .withArgs(sinon.match('http://acme.com/.well-known/stellar.toml')) .returns( Promise.resolve({ data: ` # The endpoint which clients should query to resolve stellar addresses # for users on your domain. FEDERATION_SERVER="http://api.stellar.org/federation" -`, - }), +` + }) ); - StellarSdk.StellarTomlResolver.resolve("acme.com").then((stellarToml) => { + StellarSdk.StellarTomlResolver.resolve('acme.com').then((stellarToml) => { expect(stellarToml.FEDERATION_SERVER).equals( - "http://api.stellar.org/federation", + 'http://api.stellar.org/federation' ); done(); }); }); - it("rejects when stellar.toml file is invalid", function (done) { + it('rejects when stellar.toml file is invalid', function (done) { this.axiosMock - .expects("get") - .withArgs(sinon.match("https://acme.com/.well-known/stellar.toml")) + .expects('get') + .withArgs(sinon.match('https://acme.com/.well-known/stellar.toml')) .returns( Promise.resolve({ data: ` /# The endpoint which clients should query to resolve stellar addresses # for users on your domain. FEDERATION_SERVER="https://api.stellar.org/federation" -`, - }), +` + }) ); - StellarSdk.StellarTomlResolver.resolve("acme.com") + StellarSdk.StellarTomlResolver.resolve('acme.com') .should.be.rejectedWith(/Parsing error on line/) .and.notify(done); }); - it("rejects when there was a connection error", function (done) { + it('rejects when there was a connection error', function (done) { this.axiosMock - .expects("get") - .withArgs(sinon.match("https://acme.com/.well-known/stellar.toml")) + .expects('get') + .withArgs(sinon.match('https://acme.com/.well-known/stellar.toml')) .returns(Promise.reject()); StellarSdk.StellarTomlResolver.resolve( - "acme.com", + 'acme.com' ).should.be.rejected.and.notify(done); }); - it("fails when response exceeds the limit", function (done) { + it('fails when response exceeds the limit', function (done) { // Unable to create temp server in a browser - if (typeof window != "undefined") { + if (typeof window != 'undefined') { return done(); } - var response = Array(StellarSdk.STELLAR_TOML_MAX_SIZE + 10).join("a"); + var response = Array(StellarSdk.STELLAR_TOML_MAX_SIZE + 10).join('a'); let tempServer = http .createServer((req, res) => { - res.setHeader("Content-Type", "text/x-toml; charset=UTF-8"); + res.setHeader('Content-Type', 'text/x-toml; charset=UTF-8'); res.end(response); }) .listen(4444, () => { - StellarSdk.StellarTomlResolver.resolve("localhost:4444", { - allowHttp: true, + StellarSdk.StellarTomlResolver.resolve('localhost:4444', { + allowHttp: true }) .should.be.rejectedWith( - /stellar.toml file exceeds allowed size of [0-9]+/, + /stellar.toml file exceeds allowed size of [0-9]+/ ) .notify(done) .then(() => tempServer.close()); }); }); - it("rejects after given timeout when global Config.timeout flag is set", function (done) { + it('rejects after given timeout when global Config.timeout flag is set', function (done) { StellarSdk.Config.setTimeout(1000); // Unable to create temp server in a browser - if (typeof window != "undefined") { + if (typeof window != 'undefined') { return done(); } @@ -152,8 +152,8 @@ FEDERATION_SERVER="https://api.stellar.org/federation" setTimeout(() => {}, 10000); }) .listen(4444, () => { - StellarSdk.StellarTomlResolver.resolve("localhost:4444", { - allowHttp: true, + StellarSdk.StellarTomlResolver.resolve('localhost:4444', { + allowHttp: true }) .should.be.rejectedWith(/timeout of 1000ms exceeded/) .notify(done) @@ -164,9 +164,9 @@ FEDERATION_SERVER="https://api.stellar.org/federation" }); }); - it("rejects after given timeout when timeout specified in StellarTomlResolver opts param", function (done) { + it('rejects after given timeout when timeout specified in StellarTomlResolver opts param', function (done) { // Unable to create temp server in a browser - if (typeof window != "undefined") { + if (typeof window != 'undefined') { return done(); } @@ -175,9 +175,9 @@ FEDERATION_SERVER="https://api.stellar.org/federation" setTimeout(() => {}, 10000); }) .listen(4444, () => { - StellarSdk.StellarTomlResolver.resolve("localhost:4444", { + StellarSdk.StellarTomlResolver.resolve('localhost:4444', { allowHttp: true, - timeout: 1000, + timeout: 1000 }) .should.be.rejectedWith(/timeout of 1000ms exceeded/) .notify(done) diff --git a/test/unit/utils_test.js b/test/unit/utils_test.js index f712c9d7c..724b630e1 100644 --- a/test/unit/utils_test.js +++ b/test/unit/utils_test.js @@ -1,17 +1,17 @@ -const randomBytes = require("randombytes"); +const randomBytes = require('randombytes'); function newClientSigner(key, weight) { return { key, weight }; } -describe("Utils", function () { +describe('Utils', function () { let clock, txBuilderOpts; beforeEach(function () { clock = sinon.useFakeTimers(); txBuilderOpts = { fee: 100, - networkPassphrase: StellarSdk.Networks.TESTNET, + networkPassphrase: StellarSdk.Networks.TESTNET }; }); @@ -19,32 +19,32 @@ describe("Utils", function () { clock.restore(); }); - describe("Utils.buildChallengeTx", function () { - it("allows non-muxed accounts", function () { + describe('Utils.buildChallengeTx', function () { + it('allows non-muxed accounts', function () { let keypair = StellarSdk.Keypair.random(); let muxedAddress = - "MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL6"; + 'MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL6'; let challenge; expect( () => (challenge = StellarSdk.Utils.buildChallengeTx( keypair, - "MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL6", - "testanchor.stellar.org", + 'MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL6', + 'testanchor.stellar.org', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - )), + 'testanchor.stellar.org' + )) ).not.to.throw(); const transaction = new StellarSdk.Transaction( challenge, StellarSdk.Networks.TESTNET, - true, + true ); expect(transaction.operations[0].source).to.equal(muxedAddress); }); - it("allows ID memos", function () { + it('allows ID memos', function () { let keypair = StellarSdk.Keypair.random(); let challenge; expect( @@ -52,77 +52,77 @@ describe("Utils", function () { (challenge = StellarSdk.Utils.buildChallengeTx( keypair, StellarSdk.Keypair.random().publicKey(), - "testanchor.stellar.org", + 'testanchor.stellar.org', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "8884404377665521220", - )), + 'testanchor.stellar.org', + '8884404377665521220' + )) ).not.to.throw(); const transaction = new StellarSdk.Transaction( challenge, StellarSdk.Networks.TESTNET, - true, + true ); - expect(transaction.memo.value).to.equal("8884404377665521220"); + expect(transaction.memo.value).to.equal('8884404377665521220'); }); - it("disallows non-ID memos", function () { + it('disallows non-ID memos', function () { let keypair = StellarSdk.Keypair.random(); expect( () => (challenge = StellarSdk.Utils.buildChallengeTx( keypair, StellarSdk.Keypair.random().publicKey(), - "testanchor.stellar.org", + 'testanchor.stellar.org', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "memo text", - )), + 'testanchor.stellar.org', + 'memo text' + )) ).to.throw(); }); - it("disallows memos with muxed accounts", function () { + it('disallows memos with muxed accounts', function () { let keypair = StellarSdk.Keypair.random(); const muxedAddress = - "MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL6"; + 'MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL6'; expect( () => (challenge = StellarSdk.Utils.buildChallengeTx( keypair, muxedAddress, - "testanchor.stellar.org", + 'testanchor.stellar.org', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "8884404377665521220", - )), + 'testanchor.stellar.org', + '8884404377665521220' + )) ).to.throw(/memo cannot be used if clientAccountID is a muxed account/); }); - it("returns challenge which follows SEP0010 spec", function () { + it('returns challenge which follows SEP0010 spec', function () { let keypair = StellarSdk.Keypair.random(); let clientSigningKeypair = StellarSdk.Keypair.random(); const challenge = StellarSdk.Utils.buildChallengeTx( keypair, - "GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF", - "testanchor.stellar.org", + 'GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF', + 'testanchor.stellar.org', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org', null, - "testdomain", - clientSigningKeypair.publicKey(), + 'testdomain', + clientSigningKeypair.publicKey() ); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); - expect(transaction.sequence).to.eql("0"); + expect(transaction.sequence).to.eql('0'); expect(transaction.source).to.eql(keypair.publicKey()); expect(transaction.operations.length).to.eql(3); @@ -132,42 +132,42 @@ describe("Utils", function () { const [operation1, operation2, operation3] = transaction.operations; - expect(operation1.name).to.eql("testanchor.stellar.org auth"); + expect(operation1.name).to.eql('testanchor.stellar.org auth'); expect(operation1.source).to.eql( - "GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF", + 'GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF' ); - expect(operation1.type).to.eql("manageData"); + expect(operation1.type).to.eql('manageData'); expect(operation1.value.length).to.eql(64); - expect(Buffer.from(operation1.value.toString(), "base64").length).to.eql( - 48, + expect(Buffer.from(operation1.value.toString(), 'base64').length).to.eql( + 48 ); - expect(operation2.name).to.equal("web_auth_domain"); + expect(operation2.name).to.equal('web_auth_domain'); expect(operation2.source).to.eql(keypair.publicKey()); - expect(operation2.type).to.eql("manageData"); - expect(operation2.value.toString()).to.eql("testanchor.stellar.org"); + expect(operation2.type).to.eql('manageData'); + expect(operation2.value.toString()).to.eql('testanchor.stellar.org'); - expect(operation3.name).to.eql("client_domain"); + expect(operation3.name).to.eql('client_domain'); expect(operation3.source).to.eql(clientSigningKeypair.publicKey()); - expect(operation3.type).to.eql("manageData"); - expect(operation3.value.toString()).to.eql("testdomain"); + expect(operation3.type).to.eql('manageData'); + expect(operation3.value.toString()).to.eql('testdomain'); }); - it("uses the passed-in timeout", function () { + it('uses the passed-in timeout', function () { let keypair = StellarSdk.Keypair.random(); const challenge = StellarSdk.Utils.buildChallengeTx( keypair, - "GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF", - "testanchor.stellar.org", + 'GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF', + 'testanchor.stellar.org', 600, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); let maxTime = parseInt(transaction.timeBounds.maxTime); @@ -178,79 +178,79 @@ describe("Utils", function () { expect(maxTime - minTime).to.eql(600); }); - it("throws an error if a muxed account and memo is passed", function () { + it('throws an error if a muxed account and memo is passed', function () { let keypair = StellarSdk.Keypair.random(); const muxedAddress = - "MCQQMHTBRF2NPCEJWO2JMDT2HBQ2FGDCYREY2YIBSHLTXDG54Y3KTWX3R7NBER62VBELC"; + 'MCQQMHTBRF2NPCEJWO2JMDT2HBQ2FGDCYREY2YIBSHLTXDG54Y3KTWX3R7NBER62VBELC'; expect(() => StellarSdk.Utils.buildChallengeTx( keypair, muxedAddress, - "testanchor.stellar.org", + 'testanchor.stellar.org', 600, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "10154623012567072189", - ), + 'testanchor.stellar.org', + '10154623012567072189' + ) ).to.throw(/memo cannot be used if clientAccountID is a muxed account/); }); - it("throws an error if clientSigningKey is not passed", function () { + it('throws an error if clientSigningKey is not passed', function () { expect(() => StellarSdk.Utils.buildChallengeTx( StellarSdk.Keypair.random(), StellarSdk.Keypair.random().publicKey(), - "testanchor.stellar.org", + 'testanchor.stellar.org', 600, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - null, - "testdomain", + 'testanchor.stellar.org', null, - ), + 'testdomain', + null + ) ).to.throw(/clientSigningKey is required if clientDomain is provided/); }); }); - describe("Utils.readChallengeTx", function () { - it("requires a envelopeTypeTxV0 or envelopeTypeTx", function () { + describe('Utils.readChallengeTx', function () { + it('requires a envelopeTypeTxV0 or envelopeTypeTx', function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); const challenge = StellarSdk.Utils.buildChallengeTx( serverKP, clientKP.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); const innerTx = new StellarSdk.TransactionBuilder( - new StellarSdk.Account(clientKP.publicKey(), "0"), + new StellarSdk.Account(clientKP.publicKey(), '0'), { - fee: "100", + fee: '100', networkPassphrase: StellarSdk.Networks.TESTNET, timebounds: { minTime: 0, - maxTime: 0, - }, - }, + maxTime: 0 + } + } ) .addOperation( StellarSdk.Operation.payment({ destination: clientKP.publicKey(), asset: StellarSdk.Asset.native(), - amount: "10.000", - }), + amount: '10.000' + }) ) .build(); let feeBump = StellarSdk.TransactionBuilder.buildFeeBumpTransaction( serverKP, - "300", + '300', innerTx, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ).toXDR(); expect(() => @@ -258,12 +258,12 @@ describe("Utils", function () { feeBump, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Invalid challenge: expected a Transaction but received a FeeBumpTransaction/, + /Invalid challenge: expected a Transaction but received a FeeBumpTransaction/ ); expect(() => @@ -271,18 +271,18 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.not.throw(StellarSdk.InvalidSep10ChallengeError); expect(() => StellarSdk.Utils.readChallengeTx( - feeBump.toXDR().toString("base64"), + feeBump.toXDR().toString('base64'), serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.not.throw(StellarSdk.InvalidSep10ChallengeError); }); it("returns the transaction and the clientAccountID (client's pubKey) if the challenge was created successfully", function () { @@ -292,17 +292,17 @@ describe("Utils", function () { const challenge = StellarSdk.Utils.buildChallengeTx( serverKP, clientKP.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect( @@ -310,37 +310,37 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql({ tx: transaction, clientAccountID: clientKP.publicKey(), - matchedHomeDomain: "SDF", - memo: null, + matchedHomeDomain: 'SDF', + memo: null }); }); - it("returns the clientAccountID and memo if the challenge includes a memo", function () { + it('returns the clientAccountID and memo if the challenge includes a memo', function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - let clientMemo = "7659725268483412096"; + let clientMemo = '7659725268483412096'; const challenge = StellarSdk.Utils.buildChallengeTx( serverKP, clientKP.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - clientMemo, + 'testanchor.stellar.org', + clientMemo ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect( @@ -348,29 +348,29 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql({ tx: transaction, clientAccountID: clientKP.publicKey(), - matchedHomeDomain: "SDF", - memo: clientMemo, + matchedHomeDomain: 'SDF', + memo: clientMemo }); }); - it("returns the muxed clientAccountID if included in the challenge", function () { + it('returns the muxed clientAccountID if included in the challenge', function () { let serverKP = StellarSdk.Keypair.random(); let muxedAddress = - "MCQQMHTBRF2NPCEJWO2JMDT2HBQ2FGDCYREY2YIBSHLTXDG54Y3KTWX3R7NBER62VBELC"; + 'MCQQMHTBRF2NPCEJWO2JMDT2HBQ2FGDCYREY2YIBSHLTXDG54Y3KTWX3R7NBER62VBELC'; const challenge = StellarSdk.Utils.buildChallengeTx( serverKP, muxedAddress, - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); @@ -378,7 +378,7 @@ describe("Utils", function () { const transaction = new StellarSdk.Transaction( challenge, StellarSdk.Networks.TESTNET, - true, + true ); expect( @@ -386,45 +386,45 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql({ tx: transaction, clientAccountID: muxedAddress, - matchedHomeDomain: "SDF", - memo: null, + matchedHomeDomain: 'SDF', + memo: null }); }); - it("throws an error if the transaction uses a muxed account and has a memo", function () { + it('throws an error if the transaction uses a muxed account and has a memo', function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const clientMuxedAddress = - "MCQQMHTBRF2NPCEJWO2JMDT2HBQ2FGDCYREY2YIBSHLTXDG54Y3KTWX3R7NBER62VBELC"; + 'MCQQMHTBRF2NPCEJWO2JMDT2HBQ2FGDCYREY2YIBSHLTXDG54Y3KTWX3R7NBER62VBELC'; const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientMuxedAddress, - name: "testanchor.stellar.org auth", - value: randomBytes(48).toString("base64"), - withMuxing: true, - }), + name: 'testanchor.stellar.org auth', + value: randomBytes(48).toString('base64'), + withMuxing: true + }) ) - .addMemo(new StellarSdk.Memo.id("5842698851377328257")) + .addMemo(new StellarSdk.Memo.id('5842698851377328257')) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect(() => @@ -432,12 +432,12 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "testanchor.stellar.org", - ), + 'testanchor.stellar.org', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction has a memo but the client account ID is a muxed account/, + /The transaction has a memo but the client account ID is a muxed account/ ); }); @@ -446,72 +446,72 @@ describe("Utils", function () { let clientKP = StellarSdk.Keypair.random(); const transaction = new StellarSdk.TransactionBuilder( - new StellarSdk.Account(serverKP.publicKey(), "-1"), - { fee: 100, networkPassphrase: StellarSdk.Networks.TESTNET }, + new StellarSdk.Account(serverKP.publicKey(), '-1'), + { fee: 100, networkPassphrase: StellarSdk.Networks.TESTNET } ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "SDF-test auth", - value: randomBytes(48).toString("base64"), - }), + name: 'SDF-test auth', + value: randomBytes(48).toString('base64') + }) ) .setTimeout(30) .build(); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); expect(() => StellarSdk.Utils.readChallengeTx( challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "SDF-test", - "testanchor.stellar.org", - ), + 'SDF-test', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - "Transaction not signed by server: '" + serverKP.publicKey() + "'", + "Transaction not signed by server: '" + serverKP.publicKey() + "'" ); }); - it("throws an error if transaction sequenceNumber is different to zero", function () { + it('throws an error if transaction sequenceNumber is different to zero', function () { let keypair = StellarSdk.Keypair.random(); - const account = new StellarSdk.Account(keypair.publicKey(), "100"); + const account = new StellarSdk.Account(keypair.publicKey(), '100'); const transaction = new StellarSdk.TransactionBuilder( account, - txBuilderOpts, + txBuilderOpts ) .setTimeout(30) .build(); - let challenge = transaction.toEnvelope().toXDR("base64").toString(); + let challenge = transaction.toEnvelope().toXDR('base64').toString(); expect(() => StellarSdk.Utils.readChallengeTx( challenge, keypair.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction sequence number should be zero/, + /The transaction sequence number should be zero/ ); }); - it("throws an error if transaction source account is different to server account id", function () { + it('throws an error if transaction source account is different to server account id', function () { let keypair = StellarSdk.Keypair.random(); const challenge = StellarSdk.Utils.buildChallengeTx( keypair, - "GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF", - "SDF", + 'GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF', + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); let serverAccountId = StellarSdk.Keypair.random().publicKey(); @@ -521,149 +521,149 @@ describe("Utils", function () { challenge, serverAccountId, StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction source account is not equal to the server's account/, + /The transaction source account is not equal to the server's account/ ); }); it("throws an error if transaction doesn't contain any operation", function () { let keypair = StellarSdk.Keypair.random(); - const account = new StellarSdk.Account(keypair.publicKey(), "-1"); + const account = new StellarSdk.Account(keypair.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( account, - txBuilderOpts, + txBuilderOpts ) .setTimeout(30) .build(); transaction.sign(keypair); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); expect(() => StellarSdk.Utils.readChallengeTx( challenge, keypair.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction should contain at least one operation/, + /The transaction should contain at least one operation/ ); }); - it("throws an error if operation does not contain the source account", function () { + it('throws an error if operation does not contain the source account', function () { let keypair = StellarSdk.Keypair.random(); - const account = new StellarSdk.Account(keypair.publicKey(), "-1"); + const account = new StellarSdk.Account(keypair.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( account, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ - name: "SDF auth", - value: randomBytes(48).toString("base64"), - }), + name: 'SDF auth', + value: randomBytes(48).toString('base64') + }) ) .setTimeout(30) .build(); transaction.sign(keypair); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); expect(() => StellarSdk.Utils.readChallengeTx( challenge, keypair.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction\'s operation should contain a source account/, + /The transaction\'s operation should contain a source account/ ); }); - it("throws an error if operation is not manage data", function () { + it('throws an error if operation is not manage data', function () { let keypair = StellarSdk.Keypair.random(); - const account = new StellarSdk.Account(keypair.publicKey(), "-1"); + const account = new StellarSdk.Account(keypair.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( account, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.accountMerge({ destination: keypair.publicKey(), - source: keypair.publicKey(), - }), + source: keypair.publicKey() + }) ) .setTimeout(30) .build(); transaction.sign(keypair); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); expect(() => StellarSdk.Utils.readChallengeTx( challenge, keypair.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction\'s operation type should be \'manageData\'/, + /The transaction\'s operation type should be \'manageData\'/ ); }); - it("throws an error if transaction.timeBounds.maxTime is infinite", function () { + it('throws an error if transaction.timeBounds.maxTime is infinite', function () { let serverKeypair = StellarSdk.Keypair.random(); let clientKeypair = StellarSdk.Keypair.random(); - const anchorName = "SDF"; + const anchorName = 'SDF'; const networkPassphrase = StellarSdk.Networks.TESTNET; - const account = new StellarSdk.Account(serverKeypair.publicKey(), "-1"); + const account = new StellarSdk.Account(serverKeypair.publicKey(), '-1'); const now = Math.floor(Date.now() / 1000); - const value = randomBytes(48).toString("base64"); + const value = randomBytes(48).toString('base64'); let transaction = new StellarSdk.TransactionBuilder(account, { fee: StellarSdk.BASE_FEE, networkPassphrase, timebounds: { minTime: now, - maxTime: "0", - }, + maxTime: '0' + } }) .addOperation( StellarSdk.Operation.manageData({ name: `${anchorName} auth`, value, - source: clientKeypair.publicKey(), - }), + source: clientKeypair.publicKey() + }) ) .build(); transaction.sign(serverKeypair); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(clientKeypair); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect(() => @@ -672,91 +672,91 @@ describe("Utils", function () { serverKeypair.publicKey(), StellarSdk.Networks.TESTNET, anchorName, - "testanchor.stellar.org", - ), + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction requires non-infinite timebounds/, + /The transaction requires non-infinite timebounds/ ); }); - it("throws an error if operation value is not a 64 bytes base64 string", function () { + it('throws an error if operation value is not a 64 bytes base64 string', function () { let keypair = StellarSdk.Keypair.random(); - const account = new StellarSdk.Account(keypair.publicKey(), "-1"); + const account = new StellarSdk.Account(keypair.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( account, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ - name: "SDF auth", + name: 'SDF auth', value: randomBytes(64), - source: "GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF", - }), + source: 'GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF' + }) ) .setTimeout(30) .build(); transaction.sign(keypair); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); expect(() => StellarSdk.Utils.readChallengeTx( challenge, keypair.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction\'s operation value should be a 64 bytes base64 random string/, + /The transaction\'s operation value should be a 64 bytes base64 random string/ ); }); - it("throws an error if operation value is null", function () { + it('throws an error if operation value is null', function () { let keypair = StellarSdk.Keypair.random(); - const account = new StellarSdk.Account(keypair.publicKey(), "-1"); + const account = new StellarSdk.Account(keypair.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( account, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ - name: "SDF auth", + name: 'SDF auth', value: null, - source: "GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF", - }), + source: 'GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF' + }) ) .setTimeout(30) .build(); transaction.sign(keypair); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); expect(() => StellarSdk.Utils.readChallengeTx( challenge, keypair.publicKey(), - StellarSdk.Networks.TESTNET, - ), + StellarSdk.Networks.TESTNET + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction\'s operation values should not be null/, + /The transaction\'s operation values should not be null/ ); }); - it("throws an error if transaction does not contain valid timeBounds", function () { + it('throws an error if transaction does not contain valid timeBounds', function () { let keypair = StellarSdk.Keypair.random(); let clientKeypair = StellarSdk.Keypair.random(); const challenge = StellarSdk.Utils.buildChallengeTx( keypair, clientKeypair.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); // Note that this is greater than the grace period of 5 minutes (600 seconds) @@ -764,13 +764,13 @@ describe("Utils", function () { const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(clientKeypair); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect(() => @@ -778,61 +778,61 @@ describe("Utils", function () { signedChallenge, keypair.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction has expired/, + /The transaction has expired/ ); }); - it("does NOT throw errors when the user is slightly out of minTime", function () { + it('does NOT throw errors when the user is slightly out of minTime', function () { clock.tick(1626888681 * 1000); // this challenge from Stablex's testnet env, collected 2021-07-21T17:31:21.530Z, // is erroring, and we want to know if it's a bug on our side or in the sdk const signedChallenge = - "AAAAAgAAAADZJunw2QO9LzjqagEjh/mpWG8Us5nOb+gc6wOex8G+IwAAAGQAAAAAAAAAAAAAAAEAAAAAYPhZ6gAAAXrKHz2UAAAAAAAAAAEAAAABAAAAAJyknd/qYHdzX6iV3TkHlh/usJUr5/U8cRsfVNqaruBAAAAACgAAAB50ZXN0bmV0LXNlcC5zdGFibGV4LmNsb3VkIGF1dGgAAAAAAAEAAABAaEs3QUZieUFCZzBEekx0WnpTVXJkcEhWOXdkdExXUkwxUHFFOW5QRVIrZVlaZzQvdDJlc3drclpBc0ZnTnp5UQAAAAAAAAABx8G+IwAAAEA8I5qQ+/HHXoHrULlg1ODTiCEQ92GQrVBFaB40OKxJhTf1c597AuKLHhJ3c4TNdSp1rjLGbk7qUuhjauxUuH0N"; + 'AAAAAgAAAADZJunw2QO9LzjqagEjh/mpWG8Us5nOb+gc6wOex8G+IwAAAGQAAAAAAAAAAAAAAAEAAAAAYPhZ6gAAAXrKHz2UAAAAAAAAAAEAAAABAAAAAJyknd/qYHdzX6iV3TkHlh/usJUr5/U8cRsfVNqaruBAAAAACgAAAB50ZXN0bmV0LXNlcC5zdGFibGV4LmNsb3VkIGF1dGgAAAAAAAEAAABAaEs3QUZieUFCZzBEekx0WnpTVXJkcEhWOXdkdExXUkwxUHFFOW5QRVIrZVlaZzQvdDJlc3drclpBc0ZnTnp5UQAAAAAAAAABx8G+IwAAAEA8I5qQ+/HHXoHrULlg1ODTiCEQ92GQrVBFaB40OKxJhTf1c597AuKLHhJ3c4TNdSp1rjLGbk7qUuhjauxUuH0N'; expect(() => StellarSdk.Utils.readChallengeTx( signedChallenge, - "GDMSN2PQ3EB32LZY5JVACI4H7GUVQ3YUWOM4437IDTVQHHWHYG7CGA5Z", + 'GDMSN2PQ3EB32LZY5JVACI4H7GUVQ3YUWOM4437IDTVQHHWHYG7CGA5Z', StellarSdk.Networks.TESTNET, - "testnet-sep.stablex.cloud", - "staging-transfer-server.zetl.network", - ), + 'testnet-sep.stablex.cloud', + 'staging-transfer-server.zetl.network' + ) ).not.to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction has expired/, + /The transaction has expired/ ); }); it("home domain string matches transaction's operation key name", function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "testanchor.stellar.org auth", - value: randomBytes(48).toString("base64"), - }), + name: 'testanchor.stellar.org auth', + value: randomBytes(48).toString('base64') + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect( @@ -840,41 +840,41 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "testanchor.stellar.org", - ), + 'testanchor.stellar.org', + 'testanchor.stellar.org' + ) ).to.eql({ tx: transactionRoundTripped, clientAccountID: clientKP.publicKey(), - matchedHomeDomain: "testanchor.stellar.org", - memo: null, + matchedHomeDomain: 'testanchor.stellar.org', + memo: null }); }); it("home domain in array matches transaction's operation key name", function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "testanchor.stellar.org auth", - value: randomBytes(48).toString("base64"), - }), + name: 'testanchor.stellar.org auth', + value: randomBytes(48).toString('base64') + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect( @@ -882,71 +882,71 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - ["SDF", "Test", "testanchor.stellar.org", "SDF-test"], - "testanchor.stellar.org", - ), + ['SDF', 'Test', 'testanchor.stellar.org', 'SDF-test'], + 'testanchor.stellar.org' + ) ).to.eql({ tx: transactionRoundTripped, clientAccountID: clientKP.publicKey(), - matchedHomeDomain: "testanchor.stellar.org", - memo: null, + matchedHomeDomain: 'testanchor.stellar.org', + memo: null }); }); - it("throws an error if home domain is not provided", function () { + it('throws an error if home domain is not provided', function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "testanchor.stellar.org auth", - value: randomBytes(48).toString("base64"), - }), + name: 'testanchor.stellar.org auth', + value: randomBytes(48).toString('base64') + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); expect(() => StellarSdk.Utils.readChallengeTx( challenge, serverKP.publicKey(), - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET // home domain not provided - ), + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Invalid homeDomains: a home domain must be provided for verification/, + /Invalid homeDomains: a home domain must be provided for verification/ ); }); - it("throws an error if home domain type is not string or array", function () { + it('throws an error if home domain type is not string or array', function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "testanchor.stellar.org auth", - value: randomBytes(48).toString("base64"), - }), + name: 'testanchor.stellar.org auth', + value: randomBytes(48).toString('base64') + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); expect(() => StellarSdk.Utils.readChallengeTx( @@ -954,115 +954,115 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, // home domain as number - 1, - ), + 1 + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Invalid homeDomains: homeDomains type is number but should be a string or an array/, + /Invalid homeDomains: homeDomains type is number but should be a string or an array/ ); }); it("throws an error if home domain string does not match transaction's operation key name", function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "does.not.match auth", - value: randomBytes(48).toString("base64"), - }), + name: 'does.not.match auth', + value: randomBytes(48).toString('base64') + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); expect(() => StellarSdk.Utils.readChallengeTx( challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "testanchor.stellar.org", - ), + 'testanchor.stellar.org', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Invalid homeDomains: the transaction\'s operation key name does not match the expected home domain/, + /Invalid homeDomains: the transaction\'s operation key name does not match the expected home domain/ ); }); it("throws an error if home domain array does not have a match to transaction's operation key name", function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "does.not.match auth", - value: randomBytes(48).toString("base64"), - }), + name: 'does.not.match auth', + value: randomBytes(48).toString('base64') + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); expect(() => StellarSdk.Utils.readChallengeTx( challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - ["SDF", "Test", "testanchor.stellar.org", "SDF-test"], - "testanchor.stellar.org", - ), + ['SDF', 'Test', 'testanchor.stellar.org', 'SDF-test'], + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Invalid homeDomains: the transaction\'s operation key name does not match the expected home domain/, + /Invalid homeDomains: the transaction\'s operation key name does not match the expected home domain/ ); }); - it("allows transaction to contain subsequent manage data ops with server account as source account", function () { + it('allows transaction to contain subsequent manage data ops with server account as source account', function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "SDF auth", - value: randomBytes(48).toString("base64"), - }), + name: 'SDF auth', + value: randomBytes(48).toString('base64') + }) ) .addOperation( StellarSdk.Operation.manageData({ source: serverKP.publicKey(), - name: "a key", - value: "a value", - }), + name: 'a key', + value: 'a value' + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect( @@ -1070,48 +1070,48 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql({ tx: transactionRoundTripped, clientAccountID: clientKP.publicKey(), - matchedHomeDomain: "SDF", - memo: null, + matchedHomeDomain: 'SDF', + memo: null }); }); - it("throws an error if the transaction contain subsequent manage data ops without the server account as the source account", function () { + it('throws an error if the transaction contain subsequent manage data ops without the server account as the source account', function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "SDF auth", - value: randomBytes(48).toString("base64"), - }), + name: 'SDF auth', + value: randomBytes(48).toString('base64') + }) ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "a key", - value: "a value", - }), + name: 'a key', + value: 'a value' + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect(() => @@ -1119,45 +1119,45 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction has operations that are unrecognized/, + /The transaction has operations that are unrecognized/ ); }); - it("throws an error if the transaction contain subsequent ops that are not manage data ops", function () { + it('throws an error if the transaction contain subsequent ops that are not manage data ops', function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "SDF auth", - value: randomBytes(48).toString("base64"), - }), + name: 'SDF auth', + value: randomBytes(48).toString('base64') + }) ) .addOperation( StellarSdk.Operation.bumpSequence({ source: clientKP.publicKey(), - bumpTo: "0", - }), + bumpTo: '0' + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect(() => @@ -1165,46 +1165,46 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction has operations that are not of type 'manageData'/, + /The transaction has operations that are not of type 'manageData'/ ); }); it("throws an error if the provided webAuthDomain does not match the 'web_auth_domain' operation's value", function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "testanchor.stellar.org auth", - value: randomBytes(48).toString("base64"), - }), + name: 'testanchor.stellar.org auth', + value: randomBytes(48).toString('base64') + }) ) .addOperation( StellarSdk.Operation.manageData({ source: serverKP.publicKey(), - name: "web_auth_domain", - value: "unexpected_web_auth_domain", - }), + name: 'web_auth_domain', + value: 'unexpected_web_auth_domain' + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect(() => @@ -1212,46 +1212,46 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "testanchor.stellar.org", - ), + 'testanchor.stellar.org', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /'web_auth_domain' operation value does not match testanchor.stellar.org/, + /'web_auth_domain' operation value does not match testanchor.stellar.org/ ); }); it("throws an error if the 'web_auth_domain' operation's source account is not the server's public key", function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "testanchor.stellar.org auth", - value: randomBytes(48).toString("base64"), - }), + name: 'testanchor.stellar.org auth', + value: randomBytes(48).toString('base64') + }) ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "web_auth_domain", - value: "testanchor.stellar.org", - }), + name: 'web_auth_domain', + value: 'testanchor.stellar.org' + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect(() => @@ -1259,39 +1259,39 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "testanchor.stellar.org", - ), + 'testanchor.stellar.org', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction has operations that are unrecognized/, + /The transaction has operations that are unrecognized/ ); }); it("allows transaction to omit the 'web_auth_domain' operation", function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "testanchor.stellar.org auth", - value: randomBytes(48).toString("base64"), - }), + name: 'testanchor.stellar.org auth', + value: randomBytes(48).toString('base64') + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect( @@ -1299,48 +1299,48 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "testanchor.stellar.org", - ), + 'testanchor.stellar.org', + 'testanchor.stellar.org' + ) ).to.eql({ tx: transactionRoundTripped, clientAccountID: clientKP.publicKey(), - matchedHomeDomain: "testanchor.stellar.org", - memo: null, + matchedHomeDomain: 'testanchor.stellar.org', + memo: null }); }); it("matches the 'web_auth_domain' operation value with webAuthDomain", function () { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "testanchor.stellar.org auth", - value: randomBytes(48).toString("base64"), - }), + name: 'testanchor.stellar.org auth', + value: randomBytes(48).toString('base64') + }) ) .addOperation( StellarSdk.Operation.manageData({ source: serverKP.publicKey(), - name: "web_auth_domain", - value: "auth.stellar.org", - }), + name: 'web_auth_domain', + value: 'auth.stellar.org' + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect( @@ -1348,48 +1348,48 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "auth.stellar.org", - ), + 'testanchor.stellar.org', + 'auth.stellar.org' + ) ).to.eql({ tx: transactionRoundTripped, clientAccountID: clientKP.publicKey(), - matchedHomeDomain: "testanchor.stellar.org", - memo: null, + matchedHomeDomain: 'testanchor.stellar.org', + memo: null }); }); - it("allows subsequent manageData operations to have undefined values", () => { + it('allows subsequent manageData operations to have undefined values', () => { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "testanchor.stellar.org auth", - value: randomBytes(48).toString("base64"), - }), + name: 'testanchor.stellar.org auth', + value: randomBytes(48).toString('base64') + }) ) .addOperation( StellarSdk.Operation.manageData({ source: serverKP.publicKey(), - name: "nonWebAuthDomainKey", - value: null, - }), + name: 'nonWebAuthDomainKey', + value: null + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); expect( @@ -1397,76 +1397,76 @@ describe("Utils", function () { challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "auth.stellar.org", - ), + 'testanchor.stellar.org', + 'auth.stellar.org' + ) ).to.eql({ tx: transactionRoundTripped, clientAccountID: clientKP.publicKey(), - matchedHomeDomain: "testanchor.stellar.org", - memo: null, + matchedHomeDomain: 'testanchor.stellar.org', + memo: null }); }); it("validates a challenge containing a 'client_domain' manageData operation", () => { let serverKP = StellarSdk.Keypair.random(); let clientKP = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); let clientSigningKeypair = StellarSdk.Keypair.random(); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "testanchor.stellar.org auth", - value: randomBytes(48).toString("base64"), - }), + name: 'testanchor.stellar.org auth', + value: randomBytes(48).toString('base64') + }) ) .addOperation( StellarSdk.Operation.manageData({ source: clientSigningKeypair.publicKey(), - name: "client_domain", - value: "testdomain", - }), + name: 'client_domain', + value: 'testdomain' + }) ) .setTimeout(30) .build(); transaction.sign(serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); StellarSdk.Utils.readChallengeTx( challenge, serverKP.publicKey(), StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", - "testanchor.stellar.org", + 'testanchor.stellar.org', + 'testanchor.stellar.org' ); }); }); - describe("Utils.verifyChallengeTxThreshold", function () { + describe('Utils.verifyChallengeTxThreshold', function () { beforeEach(function () { this.serverKP = StellarSdk.Keypair.random(); this.clientKP1 = StellarSdk.Keypair.random(); this.clientKP2 = StellarSdk.Keypair.random(); this.clientKP3 = StellarSdk.Keypair.random(); - this.txAccount = new StellarSdk.Account(this.serverKP.publicKey(), "-1"); - this.opAccount = new StellarSdk.Account(this.clientKP1.publicKey(), "0"); + this.txAccount = new StellarSdk.Account(this.serverKP.publicKey(), '-1'); + this.opAccount = new StellarSdk.Account(this.clientKP1.publicKey(), '0'); this.operation = StellarSdk.Operation.manageData({ source: this.clientKP1.publicKey(), - name: "SDF-test auth", - value: randomBytes(48).toString("base64"), + name: 'SDF-test auth', + value: randomBytes(48).toString('base64') }); this.txBuilderOpts = { fee: 100, - networkPassphrase: StellarSdk.Networks.TESTNET, + networkPassphrase: StellarSdk.Networks.TESTNET }; }); @@ -1482,7 +1482,7 @@ describe("Utils", function () { it("throws an error if the server hasn't signed the transaction", function () { const transaction = new StellarSdk.TransactionBuilder( this.txAccount, - this.txBuilderOpts, + this.txBuilderOpts ) .addOperation(this.operation) .setTimeout(30) @@ -1493,7 +1493,7 @@ describe("Utils", function () { transaction.sign(this.clientKP1); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); expect(() => StellarSdk.Utils.verifyChallengeTxThreshold( @@ -1502,35 +1502,35 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, threshold, signerSummary, - "SDF-test", - "testanchor.stellar.org", - ), + 'SDF-test', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - "Transaction not signed by server: '" + this.serverKP.publicKey() + "'", + "Transaction not signed by server: '" + this.serverKP.publicKey() + "'" ); }); - it("successfully validates server and client key meeting threshold", function () { + it('successfully validates server and client key meeting threshold', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP1); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); const threshold = 1; @@ -1543,38 +1543,38 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, threshold, signerSummary, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql([this.clientKP1.publicKey()]); }); - it("successfully validates server and multiple client keys, meeting threshold", function () { + it('successfully validates server and multiple client keys, meeting threshold', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP1, this.clientKP2); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); const threshold = 3; const signerSummary = [ newClientSigner(this.clientKP1.publicKey(), 1), - newClientSigner(this.clientKP2.publicKey(), 2), + newClientSigner(this.clientKP2.publicKey(), 2) ]; expect( @@ -1584,39 +1584,39 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, threshold, signerSummary, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql([this.clientKP1.publicKey(), this.clientKP2.publicKey()]); }); - it("successfully validates server and multiple client keys, meeting threshold with more keys than needed", function () { + it('successfully validates server and multiple client keys, meeting threshold with more keys than needed', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP1, this.clientKP2); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); const threshold = 3; const signerSummary = [ newClientSigner(this.clientKP1.publicKey(), 1), newClientSigner(this.clientKP2.publicKey(), 2), - newClientSigner(this.clientKP3.publicKey(), 2), + newClientSigner(this.clientKP3.publicKey(), 2) ]; expect( @@ -1626,38 +1626,38 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, threshold, signerSummary, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql([this.clientKP1.publicKey(), this.clientKP2.publicKey()]); }); - it("successfully validates server and multiple client keys, meeting threshold with more keys than needed but ignoring PreauthTxHash and XHash", function () { + it('successfully validates server and multiple client keys, meeting threshold with more keys than needed but ignoring PreauthTxHash and XHash', function () { const preauthTxHash = - "TAQCSRX2RIDJNHFIFHWD63X7D7D6TRT5Y2S6E3TEMXTG5W3OECHZ2OG4"; - const xHash = "XDRPF6NZRR7EEVO7ESIWUDXHAOMM2QSKIQQBJK6I2FB7YKDZES5UCLWD"; + 'TAQCSRX2RIDJNHFIFHWD63X7D7D6TRT5Y2S6E3TEMXTG5W3OECHZ2OG4'; + const xHash = 'XDRPF6NZRR7EEVO7ESIWUDXHAOMM2QSKIQQBJK6I2FB7YKDZES5UCLWD'; const unknownSignerType = - "?ARPF6NZRR7EEVO7ESIWUDXHAOMM2QSKIQQBJK6I2FB7YKDZES5UCLWD"; + '?ARPF6NZRR7EEVO7ESIWUDXHAOMM2QSKIQQBJK6I2FB7YKDZES5UCLWD'; const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP1, this.clientKP2); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); const threshold = 3; @@ -1667,7 +1667,7 @@ describe("Utils", function () { newClientSigner(this.clientKP3.publicKey(), 2), newClientSigner(preauthTxHash, 10), newClientSigner(xHash, 10), - newClientSigner(unknownSignerType, 10), + newClientSigner(unknownSignerType, 10) ]; expect( @@ -1677,39 +1677,39 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, threshold, signerSummary, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql([this.clientKP1.publicKey(), this.clientKP2.publicKey()]); }); - it("throws an error if multiple client keys were not enough to meet the threshold", function () { + it('throws an error if multiple client keys were not enough to meet the threshold', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP1, this.clientKP2); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); const threshold = 10; const signerSummary = [ newClientSigner(this.clientKP1.publicKey(), 1), newClientSigner(this.clientKP2.publicKey(), 2), - newClientSigner(this.clientKP3.publicKey(), 2), + newClientSigner(this.clientKP3.publicKey(), 2) ]; expect(() => @@ -1719,41 +1719,41 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, threshold, signerSummary, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - `signers with weight 3 do not meet threshold ${threshold}"`, + `signers with weight 3 do not meet threshold ${threshold}"` ); }); - it("throws an error if an unrecognized (not from the signerSummary) key has signed the transaction", function () { + it('throws an error if an unrecognized (not from the signerSummary) key has signed the transaction', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP1, this.clientKP2, this.clientKP3); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); const threshold = 10; const signerSummary = [ newClientSigner(this.clientKP1.publicKey(), 1), - newClientSigner(this.clientKP2.publicKey(), 2), + newClientSigner(this.clientKP2.publicKey(), 2) ]; expect(() => @@ -1763,35 +1763,35 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, threshold, signerSummary, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Transaction has unrecognized signatures/, + /Transaction has unrecognized signatures/ ); }); - it("throws an error if the signerSummary is empty", function () { + it('throws an error if the signerSummary is empty', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP1, this.clientKP2, this.clientKP3); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); const threshold = 10; @@ -1803,34 +1803,34 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, threshold, [], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /No verifiable client signers provided, at least one G... address must be provided/, + /No verifiable client signers provided, at least one G... address must be provided/ ); }); }); - describe("Utils.verifyChallengeTxSigners", function () { + describe('Utils.verifyChallengeTxSigners', function () { beforeEach(function () { this.serverKP = StellarSdk.Keypair.random(); this.clientKP1 = StellarSdk.Keypair.random(); this.clientKP2 = StellarSdk.Keypair.random(); - this.txAccount = new StellarSdk.Account(this.serverKP.publicKey(), "-1"); - this.opAccount = new StellarSdk.Account(this.clientKP1.publicKey(), "0"); + this.txAccount = new StellarSdk.Account(this.serverKP.publicKey(), '-1'); + this.opAccount = new StellarSdk.Account(this.clientKP1.publicKey(), '0'); this.operation = StellarSdk.Operation.manageData({ source: this.clientKP1.publicKey(), - name: "SDF-test auth", - value: randomBytes(48).toString("base64"), + name: 'SDF-test auth', + value: randomBytes(48).toString('base64') }); this.txBuilderOpts = { fee: 100, - networkPassphrase: StellarSdk.Networks.TESTNET, + networkPassphrase: StellarSdk.Networks.TESTNET }; }); @@ -1843,27 +1843,27 @@ describe("Utils", function () { (this.operation = null); }); - it("successfully validates server and client master key signatures in the transaction", function () { + it('successfully validates server and client master key signatures in the transaction', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP1); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect( @@ -1872,16 +1872,16 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [this.clientKP1.publicKey()], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql([this.clientKP1.publicKey()]); }); it("throws an error if the server hasn't signed the transaction", function () { const transaction = new StellarSdk.TransactionBuilder( this.txAccount, - this.txBuilderOpts, + this.txBuilderOpts ) .addOperation(this.operation) .setTimeout(30) @@ -1891,7 +1891,7 @@ describe("Utils", function () { const invalidsServerSignedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect(() => @@ -1900,23 +1900,23 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [this.clientKP1.publicKey()], - "SDF-test", - "testanchor.stellar.org", - ), + 'SDF-test', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - "Transaction not signed by server: '" + this.serverKP.publicKey() + "'", + "Transaction not signed by server: '" + this.serverKP.publicKey() + "'" ); }); - it("throws an error if the list of signers is empty", function () { + it('throws an error if the list of signers is empty', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); @@ -1927,38 +1927,38 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /No verifiable client signers provided, at least one G... address must be provided/, + /No verifiable client signers provided, at least one G... address must be provided/ ); }); - it("throws an error if none of the given signers have signed the transaction", function () { + it('throws an error if none of the given signers have signed the transaction', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign( StellarSdk.Keypair.random(), - StellarSdk.Keypair.random(), + StellarSdk.Keypair.random() ); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect(() => @@ -1967,30 +1967,30 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [this.clientKP1.publicKey()], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /None of the given signers match the transaction signatures/, + /None of the given signers match the transaction signatures/ ); }); - it("successfully validates server and multiple client signers in the transaction", function () { + it('successfully validates server and multiple client signers in the transaction', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); const clientSigners = [this.clientKP1, this.clientKP2]; transaction.sign(...clientSigners); @@ -1998,7 +1998,7 @@ describe("Utils", function () { const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect( @@ -2007,27 +2007,27 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, clientSignersPubKey, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql(clientSignersPubKey); }); - it("successfully validates server and multiple client signers, in reverse order", function () { + it('successfully validates server and multiple client signers, in reverse order', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); const clientSigners = [this.clientKP1, this.clientKP2]; transaction.sign(...clientSigners.reverse()); @@ -2035,7 +2035,7 @@ describe("Utils", function () { const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect( @@ -2044,33 +2044,33 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, clientSignersPubKey, - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.have.same.members(clientSignersPubKey); }); - it("successfully validates server and non-masterkey client signer", function () { + it('successfully validates server and non-masterkey client signer', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP2); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect( @@ -2079,33 +2079,33 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey()], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql([this.clientKP2.publicKey()]); }); - it("successfully validates server and non-master key client signer, ignoring extra signer", function () { + it('successfully validates server and non-master key client signer, ignoring extra signer', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP2); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect( @@ -2114,33 +2114,33 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey(), StellarSdk.Keypair.random().publicKey()], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql([this.clientKP2.publicKey()]); }); - it("throws an error if no client but instead the server has signed the transaction", function () { + it('throws an error if no client but instead the server has signed the transaction', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.serverKP); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect(() => @@ -2149,36 +2149,36 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey(), this.serverKP.publicKey()], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /None of the given signers match the transaction signatures/, + /None of the given signers match the transaction signatures/ ); }); - it("successfully validates server and non-masterkey client signer, ignoring duplicated client signers", function () { + it('successfully validates server and non-masterkey client signer, ignoring duplicated client signers', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP2); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect( @@ -2187,39 +2187,39 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey(), this.clientKP2.publicKey()], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql([this.clientKP2.publicKey()]); }); - it("successfully validates server and non-masterkey client signer, ignoring preauthTxHash and xHash", function () { + it('successfully validates server and non-masterkey client signer, ignoring preauthTxHash and xHash', function () { const preauthTxHash = - "TAQCSRX2RIDJNHFIFHWD63X7D7D6TRT5Y2S6E3TEMXTG5W3OECHZ2OG4"; - const xHash = "XDRPF6NZRR7EEVO7ESIWUDXHAOMM2QSKIQQBJK6I2FB7YKDZES5UCLWD"; + 'TAQCSRX2RIDJNHFIFHWD63X7D7D6TRT5Y2S6E3TEMXTG5W3OECHZ2OG4'; + const xHash = 'XDRPF6NZRR7EEVO7ESIWUDXHAOMM2QSKIQQBJK6I2FB7YKDZES5UCLWD'; const unknownSignerType = - "?ARPF6NZRR7EEVO7ESIWUDXHAOMM2QSKIQQBJK6I2FB7YKDZES5UCLWD"; + '?ARPF6NZRR7EEVO7ESIWUDXHAOMM2QSKIQQBJK6I2FB7YKDZES5UCLWD'; const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP2); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect( @@ -2228,9 +2228,9 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey(), preauthTxHash, xHash, unknownSignerType], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.eql([this.clientKP2.publicKey()]); }); @@ -2238,22 +2238,22 @@ describe("Utils", function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP1); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect(() => @@ -2262,36 +2262,36 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey(), this.clientKP2.publicKey()], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /None of the given signers match the transaction signatures/, + /None of the given signers match the transaction signatures/ ); }); - it("throws an error if the same KP has signed the transaction more than once", function () { + it('throws an error if the same KP has signed the transaction more than once', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP2, this.clientKP2); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect(() => @@ -2300,36 +2300,36 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey()], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Transaction has unrecognized signatures/, + /Transaction has unrecognized signatures/ ); }); - it("throws an error if the client attempts to verify the transaction with a Seed instead of the Public Key", function () { + it('throws an error if the client attempts to verify the transaction with a Seed instead of the Public Key', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP2, this.clientKP2); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect(() => @@ -2338,30 +2338,30 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [this.clientKP2.secret()], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /No verifiable client signers provided, at least one G... address must be provided/, + /No verifiable client signers provided, at least one G... address must be provided/ ); }); - it("throws an error if no client has signed the transaction", function () { + it('throws an error if no client has signed the transaction', function () { const transaction = new StellarSdk.TransactionBuilder( this.txAccount, - this.txBuilderOpts, + this.txBuilderOpts ) .addOperation(this.operation) .setTimeout(30) .build(); transaction.sign(this.serverKP); - const challenge = transaction.toEnvelope().toXDR("base64").toString(); + const challenge = transaction.toEnvelope().toXDR('base64').toString(); const clientSigners = [ this.clientKP1.publicKey(), - this.clientKP2.publicKey(), + this.clientKP2.publicKey() ]; expect(() => @@ -2370,36 +2370,36 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, clientSigners, - "SDF-test", - "testanchor.stellar.org", - ), + 'SDF-test', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /None of the given signers match the transaction signatures/, + /None of the given signers match the transaction signatures/ ); }); - it("throws an error if no public keys were provided to verify signatires", function () { + it('throws an error if no public keys were provided to verify signatires', function () { const challenge = StellarSdk.Utils.buildChallengeTx( this.serverKP, this.clientKP1.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org' ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(this.clientKP1); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect(() => @@ -2408,36 +2408,36 @@ describe("Utils", function () { this.serverKP.publicKey(), StellarSdk.Networks.TESTNET, [], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /No verifiable client signers provided, at least one G... address must be provided/, + /No verifiable client signers provided, at least one G... address must be provided/ ); }); - it("validates challenges containing client domain signers", () => { + it('validates challenges containing client domain signers', () => { const serverKP = StellarSdk.Keypair.random(); const clientKP = StellarSdk.Keypair.random(); const clientSigningKey = StellarSdk.Keypair.random(); const challenge = StellarSdk.Utils.buildChallengeTx( serverKP, clientKP.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org', null, - "testdomain", - clientSigningKey.publicKey(), + 'testdomain', + clientSigningKey.publicKey() ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(clientKP); @@ -2445,7 +2445,7 @@ describe("Utils", function () { const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); const signersFound = StellarSdk.Utils.verifyChallengeTxSigners( @@ -2453,8 +2453,8 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, [clientKP.publicKey()], - "SDF", - "testanchor.stellar.org", + 'SDF', + 'testanchor.stellar.org' ); expect(signersFound.indexOf(clientSigningKey.publicKey())).to.eql(-1); @@ -2467,27 +2467,27 @@ describe("Utils", function () { const challenge = StellarSdk.Utils.buildChallengeTx( serverKP, clientKP.publicKey(), - "SDF", + 'SDF', 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org", + 'testanchor.stellar.org', null, - "testdomain", - clientSigningKeypair.publicKey(), + 'testdomain', + clientSigningKeypair.publicKey() ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET, + StellarSdk.Networks.TESTNET ); transaction.sign(clientKP); const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect(() => @@ -2496,46 +2496,46 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, [clientKP.publicKey()], - "SDF", - "testanchor.stellar.org", - ), + 'SDF', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Transaction not signed by the source account of the 'client_domain' ManageData operation/, + /Transaction not signed by the source account of the 'client_domain' ManageData operation/ ); }); - it("throws an error if a challenge has multiple client_domain operations", () => { + it('throws an error if a challenge has multiple client_domain operations', () => { const serverKP = StellarSdk.Keypair.random(); const clientKP = StellarSdk.Keypair.random(); const clientSigningKeypair = StellarSdk.Keypair.random(); - const serverAccount = new StellarSdk.Account(serverKP.publicKey(), "-1"); + const serverAccount = new StellarSdk.Account(serverKP.publicKey(), '-1'); const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts, + txBuilderOpts ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), - name: "testanchor.stellar.org auth", - value: randomBytes(48).toString("base64"), - }), + name: 'testanchor.stellar.org auth', + value: randomBytes(48).toString('base64') + }) ) .addOperation( StellarSdk.Operation.manageData({ source: clientSigningKeypair.publicKey(), - name: "client_domain", - value: "testdomain", - }), + name: 'client_domain', + value: 'testdomain' + }) ) .addOperation( StellarSdk.Operation.manageData({ source: clientSigningKeypair.publicKey(), - name: "client_domain", - value: "testdomain2", - }), + name: 'client_domain', + value: 'testdomain2' + }) ) .setTimeout(30) .build(); @@ -2548,7 +2548,7 @@ describe("Utils", function () { const signedChallenge = transaction .toEnvelope() - .toXDR("base64") + .toXDR('base64') .toString(); expect(() => @@ -2557,23 +2557,23 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, [clientKP.publicKey()], - "testanchor.stellar.org", - "testanchor.stellar.org", - ), + 'testanchor.stellar.org', + 'testanchor.stellar.org' + ) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Found more than one client_domain operation/, + /Found more than one client_domain operation/ ); }); }); - describe("Utils.verifyTxSignedBy", function () { + describe('Utils.verifyTxSignedBy', function () { beforeEach(function () { this.keypair = StellarSdk.Keypair.random(); - this.account = new StellarSdk.Account(this.keypair.publicKey(), "-1"); + this.account = new StellarSdk.Account(this.keypair.publicKey(), '-1'); this.transaction = new StellarSdk.TransactionBuilder( this.account, - txBuilderOpts, + txBuilderOpts ) .setTimeout(30) .build(); @@ -2583,18 +2583,18 @@ describe("Utils", function () { this.keypair, this.account, (this.transaction = null); }); - it("returns true if the transaction was signed by the given account", function () { + it('returns true if the transaction was signed by the given account', function () { this.transaction.sign(this.keypair); expect( StellarSdk.Utils.verifyTxSignedBy( this.transaction, - this.keypair.publicKey(), - ), + this.keypair.publicKey() + ) ).to.eql(true); }); - it("returns false if the transaction was not signed by the given account", function () { + it('returns false if the transaction was not signed by the given account', function () { this.transaction.sign(this.keypair); let differentKeypair = StellarSdk.Keypair.random(); @@ -2602,29 +2602,29 @@ describe("Utils", function () { expect( StellarSdk.Utils.verifyTxSignedBy( this.transaction, - differentKeypair.publicKey(), - ), + differentKeypair.publicKey() + ) ).to.eql(false); }); - it("works with an unsigned transaction", function () { + it('works with an unsigned transaction', function () { expect( StellarSdk.Utils.verifyTxSignedBy( this.transaction, - this.keypair.publicKey(), - ), + this.keypair.publicKey() + ) ).to.eql(false); }); }); - describe("Utils.gatherTxSigners", function () { + describe('Utils.gatherTxSigners', function () { beforeEach(function () { this.keypair1 = StellarSdk.Keypair.random(); this.keypair2 = StellarSdk.Keypair.random(); - this.account = new StellarSdk.Account(this.keypair1.publicKey(), "-1"); + this.account = new StellarSdk.Account(this.keypair1.publicKey(), '-1'); this.transaction = new StellarSdk.TransactionBuilder( this.account, - txBuilderOpts, + txBuilderOpts ) .setTimeout(30) .build(); @@ -2634,90 +2634,90 @@ describe("Utils", function () { this.keypair1, this.keypair2, this.account, (this.transaction = null); }); - it("returns a list with the signatures used in the transaction", function () { + it('returns a list with the signatures used in the transaction', function () { this.transaction.sign(this.keypair1, this.keypair2); const expectedSignatures = [ this.keypair1.publicKey(), - this.keypair2.publicKey(), + this.keypair2.publicKey() ]; expect( - StellarSdk.Utils.gatherTxSigners(this.transaction, expectedSignatures), + StellarSdk.Utils.gatherTxSigners(this.transaction, expectedSignatures) ).to.eql(expectedSignatures); }); - it("returns a list with the signatures used in the transaction, removing duplicates", function () { + it('returns a list with the signatures used in the transaction, removing duplicates', function () { this.transaction.sign( this.keypair1, this.keypair1, this.keypair1, this.keypair2, this.keypair2, - this.keypair2, + this.keypair2 ); const expectedSignatures = [ this.keypair1.publicKey(), - this.keypair2.publicKey(), + this.keypair2.publicKey() ]; expect( StellarSdk.Utils.gatherTxSigners(this.transaction, [ this.keypair1.publicKey(), - this.keypair2.publicKey(), - ]), + this.keypair2.publicKey() + ]) ).to.eql(expectedSignatures); }); - it("returns an empty list if the transaction was not signed by the given accounts", function () { + it('returns an empty list if the transaction was not signed by the given accounts', function () { this.transaction.sign(this.keypair1, this.keypair2); let wrongSignatures = [ StellarSdk.Keypair.random().publicKey(), StellarSdk.Keypair.random().publicKey(), - StellarSdk.Keypair.random().publicKey(), + StellarSdk.Keypair.random().publicKey() ]; expect( - StellarSdk.Utils.gatherTxSigners(this.transaction, wrongSignatures), + StellarSdk.Utils.gatherTxSigners(this.transaction, wrongSignatures) ).to.eql([]); }); - it("calling gatherTxSigners with an unsigned transaction will return an empty list", function () { + it('calling gatherTxSigners with an unsigned transaction will return an empty list', function () { expect( StellarSdk.Utils.gatherTxSigners(this.transaction, [ this.keypair1.publicKey(), - this.keypair2.publicKey(), - ]), + this.keypair2.publicKey() + ]) ).to.eql([]); }); - it("Raises an error in case one of the given signers is not a valid G signer", function () { + it('Raises an error in case one of the given signers is not a valid G signer', function () { this.transaction.sign(this.keypair1, this.keypair2); const preauthTxHash = - "TAQCSRX2RIDJNHFIFHWD63X7D7D6TRT5Y2S6E3TEMXTG5W3OECHZ2OG4"; + 'TAQCSRX2RIDJNHFIFHWD63X7D7D6TRT5Y2S6E3TEMXTG5W3OECHZ2OG4'; expect(() => StellarSdk.Utils.gatherTxSigners(this.transaction, [ preauthTxHash, - this.keypair1.publicKey(), - ]), + this.keypair1.publicKey() + ]) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Signer is not a valid address/, + /Signer is not a valid address/ ); }); - it("Raises an error in case one of the given signers is an invalid G signer", function () { + it('Raises an error in case one of the given signers is an invalid G signer', function () { this.transaction.sign(this.keypair1, this.keypair2); const invalidGHash = - "GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CAAA"; + 'GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CAAA'; expect(() => StellarSdk.Utils.gatherTxSigners(this.transaction, [ invalidGHash, - this.keypair1.publicKey(), - ]), + this.keypair1.publicKey() + ]) ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Signer is not a valid address/, + /Signer is not a valid address/ ); }); });