diff --git a/.gitignore b/.gitignore index 091f7fbd0..8e07ad8a3 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,8 @@ /libdocs/ /dist/ /coverage/ +/.nyc_output/ /jsdoc/ .DS_Store .idea/ -js-stellar-base/ \ No newline at end of file +js-stellar-base/ diff --git a/package.json b/package.json index 94a05bf9f..87a5c5df3 100644 --- a/package.json +++ b/package.json @@ -119,6 +119,7 @@ "karma-sinon-chai": "^2.0.2", "karma-webpack": "^5.0.0", "lint-staged": "^13.2.1", + "lodash": "^4.17.21", "minami": "^1.1.1", "mocha": "^10.2.0", "node-polyfill-webpack-plugin": "^2.0.1", @@ -139,7 +140,6 @@ "bignumber.js": "^9.1.1", "detect-node": "^2.0.4", "eventsource": "^2.0.2", - "lodash": "^4.17.21", "randombytes": "^2.1.0", "stellar-base": "v9.0.0-beta.2", "toml": "^3.0.0", diff --git a/src/account_response.ts b/src/account_response.ts index 9cbd2a4dd..59ebeac26 100644 --- a/src/account_response.ts +++ b/src/account_response.ts @@ -1,6 +1,5 @@ /* tslint:disable:variable-name */ -import forIn from "lodash/forIn"; import { Account as BaseAccount } from "stellar-base"; import { Horizon } from "./horizon_api"; import { ServerApi } from "./server_api"; @@ -57,7 +56,7 @@ export class AccountResponse { this._baseAccount = new BaseAccount(response.account_id, response.sequence); // Extract response fields // TODO: do it in type-safe manner. - forIn(response, (value, key) => { + Object.entries(response).forEach(([key, value]) => { (this as any)[key] = value; }); } diff --git a/src/config.ts b/src/config.ts index 6830da82b..946c793d8 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,5 +1,3 @@ -import clone from "lodash/clone"; - interface Configuration { /** * Allow connecting to http servers, default: `false`. This must be set to false in production deployments! @@ -20,7 +18,7 @@ const defaultConfig: Configuration = { timeout: 0, }; -let config = clone(defaultConfig); +let config = Object.assign({}, defaultConfig); /** * Global config class. diff --git a/src/server.ts b/src/server.ts index dd3934a1a..d4ffa6a52 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,8 +1,6 @@ /* tslint:disable:variable-name no-namespace */ import BigNumber from "bignumber.js"; -import isEmpty from "lodash/isEmpty"; -import merge from "lodash/merge"; import { Asset, FeeBumpTransaction, @@ -83,7 +81,7 @@ export class Server { ? Config.isAllowHttp() : opts.allowHttp; - const customHeaders: any = {}; + const customHeaders: object = {}; if (opts.appName) { customHeaders["X-App-Name"] = opts.appName; @@ -94,10 +92,11 @@ export class Server { if (opts.authToken) { customHeaders["X-Auth-Token"] = opts.authToken; } - if (!isEmpty(customHeaders)) { + if (Object.keys(customHeaders).length > 0) { HorizonAxiosClient.interceptors.request.use((config) => { - // merge the custom headers with an existing headers - config.headers = merge(customHeaders, config.headers); + // merge the custom headers with an existing headers, where customs + // override defaults + config.headers = Object.assign(config.headers, customHeaders); return config; }); diff --git a/src/utils.ts b/src/utils.ts index c23fd1ca5..72105cd45 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,3 @@ -import clone from "lodash/clone"; import randomBytes from "randombytes"; import { Account, @@ -676,7 +675,7 @@ export namespace Utils { ): string[] { const hashedSignatureBase = transaction.hash(); - const txSignatures = clone(transaction.signatures); + const txSignatures = [...transaction.signatures]; // shallow copy for safe splicing const signersFound = new Set(); for (const signer of signers) {