From 41bff1f0aaffbbd2316705ea530acb9986407999 Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Tue, 18 Jul 2023 15:42:47 -0700 Subject: [PATCH 1/8] Move Horizon SDK into subfolders --- package.json | 4 ++-- src/{ => federation}/federation_server.ts | 4 ++-- src/{ => federation}/stellar_toml_resolver.ts | 0 src/{ => horizon}/account_call_builder.ts | 0 src/{ => horizon}/account_response.ts | 0 src/{ => horizon}/assets_call_builder.ts | 0 src/{ => horizon}/call_builder.ts | 0 .../claimable_balances_call_builder.ts | 0 src/{ => horizon}/effect_call_builder.ts | 0 src/{ => horizon}/friendbot_builder.ts | 0 src/{ => horizon}/horizon_api.ts | 0 src/{ => horizon}/horizon_axios_client.ts | 0 src/{ => horizon}/ledger_call_builder.ts | 0 src/{ => horizon}/liquidity_pool_call_builder.ts | 0 src/{ => horizon}/offer_call_builder.ts | 0 src/{ => horizon}/operation_call_builder.ts | 0 src/{ => horizon}/orderbook_call_builder.ts | 0 src/{ => horizon}/path_call_builder.ts | 0 src/{ => horizon}/payment_call_builder.ts | 0 src/{ => horizon}/server.ts | 0 src/{ => horizon}/server_api.ts | 0 .../strict_receive_path_call_builder.ts | 0 src/{ => horizon}/strict_send_path_call_builder.ts | 0 .../trade_aggregation_call_builder.ts | 0 src/{ => horizon}/trades_call_builder.ts | 0 src/{ => horizon}/transaction_call_builder.ts | 0 src/index.ts | 14 +++++++------- 27 files changed, 11 insertions(+), 11 deletions(-) rename src/{ => federation}/federation_server.ts (99%) rename src/{ => federation}/stellar_toml_resolver.ts (100%) rename src/{ => horizon}/account_call_builder.ts (100%) rename src/{ => horizon}/account_response.ts (100%) rename src/{ => horizon}/assets_call_builder.ts (100%) rename src/{ => horizon}/call_builder.ts (100%) rename src/{ => horizon}/claimable_balances_call_builder.ts (100%) rename src/{ => horizon}/effect_call_builder.ts (100%) rename src/{ => horizon}/friendbot_builder.ts (100%) rename src/{ => horizon}/horizon_api.ts (100%) rename src/{ => horizon}/horizon_axios_client.ts (100%) rename src/{ => horizon}/ledger_call_builder.ts (100%) rename src/{ => horizon}/liquidity_pool_call_builder.ts (100%) rename src/{ => horizon}/offer_call_builder.ts (100%) rename src/{ => horizon}/operation_call_builder.ts (100%) rename src/{ => horizon}/orderbook_call_builder.ts (100%) rename src/{ => horizon}/path_call_builder.ts (100%) rename src/{ => horizon}/payment_call_builder.ts (100%) rename src/{ => horizon}/server.ts (100%) rename src/{ => horizon}/server_api.ts (100%) rename src/{ => horizon}/strict_receive_path_call_builder.ts (100%) rename src/{ => horizon}/strict_send_path_call_builder.ts (100%) rename src/{ => horizon}/trade_aggregation_call_builder.ts (100%) rename src/{ => horizon}/trades_call_builder.ts (100%) rename src/{ => horizon}/transaction_call_builder.ts (100%) diff --git a/package.json b/package.json index 079aa9e6c..10d423668 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "author": "Stellar Development Foundation ", "main": "./lib/index.js", "types": "./lib/index.d.ts", - "browser": "./dist/stellar-sdk.js", + "browser": "./dist/stellar-sdk.min.js", "files": [ "/types", "/lib", @@ -143,7 +143,7 @@ "bignumber.js": "^9.1.1", "eventsource": "^2.0.2", "randombytes": "^2.1.0", - "stellar-base": "^9.0.0", + "stellar-base": "^10.0.0-soroban.4", "toml": "^3.0.0", "urijs": "^1.19.1" } diff --git a/src/federation_server.ts b/src/federation/federation_server.ts similarity index 99% rename from src/federation_server.ts rename to src/federation/federation_server.ts index 70eda449e..b30c8cb19 100644 --- a/src/federation_server.ts +++ b/src/federation/federation_server.ts @@ -2,8 +2,8 @@ import axios from "axios"; import { StrKey } from "stellar-base"; import URI from "urijs"; -import { Config } from "./config"; -import { BadResponseError } from "./errors"; +import { Config } from "../config"; +import { BadResponseError } from "../errors"; import { StellarTomlResolver } from "./stellar_toml_resolver"; // FEDERATION_RESPONSE_MAX_SIZE is the maximum size of response from a federation server diff --git a/src/stellar_toml_resolver.ts b/src/federation/stellar_toml_resolver.ts similarity index 100% rename from src/stellar_toml_resolver.ts rename to src/federation/stellar_toml_resolver.ts diff --git a/src/account_call_builder.ts b/src/horizon/account_call_builder.ts similarity index 100% rename from src/account_call_builder.ts rename to src/horizon/account_call_builder.ts diff --git a/src/account_response.ts b/src/horizon/account_response.ts similarity index 100% rename from src/account_response.ts rename to src/horizon/account_response.ts diff --git a/src/assets_call_builder.ts b/src/horizon/assets_call_builder.ts similarity index 100% rename from src/assets_call_builder.ts rename to src/horizon/assets_call_builder.ts diff --git a/src/call_builder.ts b/src/horizon/call_builder.ts similarity index 100% rename from src/call_builder.ts rename to src/horizon/call_builder.ts diff --git a/src/claimable_balances_call_builder.ts b/src/horizon/claimable_balances_call_builder.ts similarity index 100% rename from src/claimable_balances_call_builder.ts rename to src/horizon/claimable_balances_call_builder.ts diff --git a/src/effect_call_builder.ts b/src/horizon/effect_call_builder.ts similarity index 100% rename from src/effect_call_builder.ts rename to src/horizon/effect_call_builder.ts diff --git a/src/friendbot_builder.ts b/src/horizon/friendbot_builder.ts similarity index 100% rename from src/friendbot_builder.ts rename to src/horizon/friendbot_builder.ts diff --git a/src/horizon_api.ts b/src/horizon/horizon_api.ts similarity index 100% rename from src/horizon_api.ts rename to src/horizon/horizon_api.ts diff --git a/src/horizon_axios_client.ts b/src/horizon/horizon_axios_client.ts similarity index 100% rename from src/horizon_axios_client.ts rename to src/horizon/horizon_axios_client.ts diff --git a/src/ledger_call_builder.ts b/src/horizon/ledger_call_builder.ts similarity index 100% rename from src/ledger_call_builder.ts rename to src/horizon/ledger_call_builder.ts diff --git a/src/liquidity_pool_call_builder.ts b/src/horizon/liquidity_pool_call_builder.ts similarity index 100% rename from src/liquidity_pool_call_builder.ts rename to src/horizon/liquidity_pool_call_builder.ts diff --git a/src/offer_call_builder.ts b/src/horizon/offer_call_builder.ts similarity index 100% rename from src/offer_call_builder.ts rename to src/horizon/offer_call_builder.ts diff --git a/src/operation_call_builder.ts b/src/horizon/operation_call_builder.ts similarity index 100% rename from src/operation_call_builder.ts rename to src/horizon/operation_call_builder.ts diff --git a/src/orderbook_call_builder.ts b/src/horizon/orderbook_call_builder.ts similarity index 100% rename from src/orderbook_call_builder.ts rename to src/horizon/orderbook_call_builder.ts diff --git a/src/path_call_builder.ts b/src/horizon/path_call_builder.ts similarity index 100% rename from src/path_call_builder.ts rename to src/horizon/path_call_builder.ts diff --git a/src/payment_call_builder.ts b/src/horizon/payment_call_builder.ts similarity index 100% rename from src/payment_call_builder.ts rename to src/horizon/payment_call_builder.ts diff --git a/src/server.ts b/src/horizon/server.ts similarity index 100% rename from src/server.ts rename to src/horizon/server.ts diff --git a/src/server_api.ts b/src/horizon/server_api.ts similarity index 100% rename from src/server_api.ts rename to src/horizon/server_api.ts diff --git a/src/strict_receive_path_call_builder.ts b/src/horizon/strict_receive_path_call_builder.ts similarity index 100% rename from src/strict_receive_path_call_builder.ts rename to src/horizon/strict_receive_path_call_builder.ts diff --git a/src/strict_send_path_call_builder.ts b/src/horizon/strict_send_path_call_builder.ts similarity index 100% rename from src/strict_send_path_call_builder.ts rename to src/horizon/strict_send_path_call_builder.ts diff --git a/src/trade_aggregation_call_builder.ts b/src/horizon/trade_aggregation_call_builder.ts similarity index 100% rename from src/trade_aggregation_call_builder.ts rename to src/horizon/trade_aggregation_call_builder.ts diff --git a/src/trades_call_builder.ts b/src/horizon/trades_call_builder.ts similarity index 100% rename from src/trades_call_builder.ts rename to src/horizon/trades_call_builder.ts diff --git a/src/transaction_call_builder.ts b/src/horizon/transaction_call_builder.ts similarity index 100% rename from src/transaction_call_builder.ts rename to src/horizon/transaction_call_builder.ts diff --git a/src/index.ts b/src/index.ts index 49b9c30c5..f3de3bf13 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,27 +5,27 @@ const version = require("../package.json").version; // Expose all types -export * from "./horizon_api"; -export * from "./server_api"; +export * from "./horizon/horizon_api"; +export * from "./horizon/server_api"; // stellar-sdk classes to expose -export * from "./account_response"; +export * from "./horizon/account_response"; export * from "./errors"; export { Config } from "./config"; -export { Server } from "./server"; +export { Server } from "./horizon/server"; export { FederationServer, FEDERATION_RESPONSE_MAX_SIZE -} from "./federation_server"; +} from "./federation/federation_server"; export { StellarTomlResolver, STELLAR_TOML_MAX_SIZE -} from "./stellar_toml_resolver"; +} from "./federation/stellar_toml_resolver"; export { default as HorizonAxiosClient, SERVER_TIME_MAP, getCurrentServerTime -} from "./horizon_axios_client"; +} from "./horizon/horizon_axios_client"; export * from "./utils"; // expose classes and functions from stellar-base From 689f716972ef0f1a85cf4999fbc46ea78b1d6e7a Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Tue, 18 Jul 2023 15:46:01 -0700 Subject: [PATCH 2/8] Move types also --- src/{ => horizon}/types/account.ts | 0 src/{ => horizon}/types/assets.ts | 0 src/{ => horizon}/types/effects.ts | 0 src/{ => horizon}/types/offer.ts | 0 src/{ => horizon}/types/trade.ts | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename src/{ => horizon}/types/account.ts (100%) rename src/{ => horizon}/types/assets.ts (100%) rename src/{ => horizon}/types/effects.ts (100%) rename src/{ => horizon}/types/offer.ts (100%) rename src/{ => horizon}/types/trade.ts (100%) diff --git a/src/types/account.ts b/src/horizon/types/account.ts similarity index 100% rename from src/types/account.ts rename to src/horizon/types/account.ts diff --git a/src/types/assets.ts b/src/horizon/types/assets.ts similarity index 100% rename from src/types/assets.ts rename to src/horizon/types/assets.ts diff --git a/src/types/effects.ts b/src/horizon/types/effects.ts similarity index 100% rename from src/types/effects.ts rename to src/horizon/types/effects.ts diff --git a/src/types/offer.ts b/src/horizon/types/offer.ts similarity index 100% rename from src/types/offer.ts rename to src/horizon/types/offer.ts diff --git a/src/types/trade.ts b/src/horizon/types/trade.ts similarity index 100% rename from src/types/trade.ts rename to src/horizon/types/trade.ts From 13a2f7d6160d7e7590e07b7b7a6eadc1769a5fca Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Fri, 4 Aug 2023 15:27:59 -0700 Subject: [PATCH 3/8] WIP merge --- src/errors.ts | 2 +- src/federation/stellar_toml_resolver.ts | 5 +- src/horizon/account_call_builder.ts | 2 +- src/horizon/call_builder.ts | 7 +- src/horizon/horizon_axios_client.ts | 4 +- src/horizon/index.ts | 9 + src/horizon/server.ts | 4 +- src/horizon/server_api.ts | 2 +- src/horizon/trade_aggregation_call_builder.ts | 2 +- src/index.ts | 5 +- src/soroban/.eslintrc.js | 42 ++ src/soroban/axios.ts | 81 ++ src/soroban/browser.ts | 9 + src/soroban/friendbot.ts | 6 + src/soroban/index.ts | 25 + src/soroban/jsonrpc.ts | 75 ++ src/soroban/server.ts | 700 ++++++++++++++++++ src/soroban/soroban_rpc.ts | 140 ++++ src/soroban/transaction.ts | 112 +++ src/soroban/utils.ts | 8 + src/utils.ts | 2 +- yarn.lock | 25 +- 22 files changed, 1240 insertions(+), 27 deletions(-) create mode 100644 src/horizon/index.ts create mode 100644 src/soroban/.eslintrc.js create mode 100644 src/soroban/axios.ts create mode 100644 src/soroban/browser.ts create mode 100644 src/soroban/friendbot.ts create mode 100644 src/soroban/index.ts create mode 100644 src/soroban/jsonrpc.ts create mode 100644 src/soroban/server.ts create mode 100644 src/soroban/soroban_rpc.ts create mode 100644 src/soroban/transaction.ts create mode 100644 src/soroban/utils.ts diff --git a/src/errors.ts b/src/errors.ts index 7cc3cf4eb..3c2e62141 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -1,4 +1,4 @@ -import { Horizon } from "./horizon_api"; +import { Horizon } from "./horizon/horizon_api"; // For ES5 compatibility (https://stackoverflow.com/a/55066280). /* tslint:disable:variable-name max-classes-per-file */ diff --git a/src/federation/stellar_toml_resolver.ts b/src/federation/stellar_toml_resolver.ts index 181734daf..5e16944d9 100644 --- a/src/federation/stellar_toml_resolver.ts +++ b/src/federation/stellar_toml_resolver.ts @@ -1,7 +1,8 @@ import axios from "axios"; -import { Networks } from "stellar-base"; import toml from "toml"; -import { Config } from "./config"; +import { Networks } from "stellar-base"; + +import { Config } from "../config"; // STELLAR_TOML_MAX_SIZE is the maximum size of stellar.toml file export const STELLAR_TOML_MAX_SIZE = 100 * 1024; diff --git a/src/horizon/account_call_builder.ts b/src/horizon/account_call_builder.ts index ba840cf18..43303f533 100644 --- a/src/horizon/account_call_builder.ts +++ b/src/horizon/account_call_builder.ts @@ -78,4 +78,4 @@ export class AccountCallBuilder extends CallBuilder< this.url.setQuery("liquidity_pool", id); return this; } -} +} \ No newline at end of file diff --git a/src/horizon/call_builder.ts b/src/horizon/call_builder.ts index 88b490500..cd568ab5f 100644 --- a/src/horizon/call_builder.ts +++ b/src/horizon/call_builder.ts @@ -1,9 +1,10 @@ import URI from "urijs"; import URITemplate from "urijs/src/URITemplate"; -import { BadRequestError, NetworkError, NotFoundError } from "./errors"; +import { BadRequestError, NetworkError, NotFoundError } from "../errors"; + import { Horizon } from "./horizon_api"; -import HorizonAxiosClient from "./horizon_axios_client"; +import { HorizonAxiosClient } from "./horizon_axios_client"; import { ServerApi } from "./server_api"; /* tslint:disable-next-line:no-var-requires */ @@ -404,4 +405,4 @@ export class CallBuilder< return Promise.reject(new Error(error.message)); } } -} +} \ No newline at end of file diff --git a/src/horizon/horizon_axios_client.ts b/src/horizon/horizon_axios_client.ts index 8f105829f..57ff1cc18 100644 --- a/src/horizon/horizon_axios_client.ts +++ b/src/horizon/horizon_axios_client.ts @@ -2,7 +2,7 @@ import axios, { AxiosResponse } from "axios"; import URI from "urijs"; /* tslint:disable-next-line:no-var-requires */ -const version = require("../package.json").version; +const version = require("../../package.json").version; export interface ServerTime { serverTime: number; @@ -23,7 +23,7 @@ export interface ServerTime { */ export const SERVER_TIME_MAP: Record = {}; -const HorizonAxiosClient = axios.create({ +export const HorizonAxiosClient = axios.create({ headers: { "X-Client-Name": "js-stellar-sdk", "X-Client-Version": version, diff --git a/src/horizon/index.ts b/src/horizon/index.ts new file mode 100644 index 000000000..d149d4015 --- /dev/null +++ b/src/horizon/index.ts @@ -0,0 +1,9 @@ +import { AccountCallBuilder as ACB } from './account_call_builder' +import { AccountResponse as AR } from './account_response' + +export namespace Horizon { + export type AccountCallBuilder = ACB; + export type AccountResponse = AR; +} + +export default Horizon; \ No newline at end of file diff --git a/src/horizon/server.ts b/src/horizon/server.ts index 70f384388..684508df1 100644 --- a/src/horizon/server.ts +++ b/src/horizon/server.ts @@ -11,12 +11,12 @@ import { import URI from "urijs"; import { CallBuilder } from "./call_builder"; -import { Config } from "./config"; +import { Config } from "../config"; import { AccountRequiresMemoError, BadResponseError, NotFoundError, -} from "./errors"; +} from "../errors"; import { AccountCallBuilder } from "./account_call_builder"; import { AccountResponse } from "./account_response"; diff --git a/src/horizon/server_api.ts b/src/horizon/server_api.ts index bb210b09d..1c2b66601 100644 --- a/src/horizon/server_api.ts +++ b/src/horizon/server_api.ts @@ -417,4 +417,4 @@ export namespace ServerApi { destination_asset_code: string; destination_asset_issuer: string; } -} +} \ No newline at end of file diff --git a/src/horizon/trade_aggregation_call_builder.ts b/src/horizon/trade_aggregation_call_builder.ts index f5f9f139e..a663ed2ea 100644 --- a/src/horizon/trade_aggregation_call_builder.ts +++ b/src/horizon/trade_aggregation_call_builder.ts @@ -1,7 +1,7 @@ /* tslint:disable: variable-name */ import { Asset } from "stellar-base"; import { CallBuilder } from "./call_builder"; -import { BadRequestError } from "./errors"; +import { BadRequestError } from "../errors"; import { Horizon } from "./horizon_api"; import { ServerApi } from "./server_api"; diff --git a/src/index.ts b/src/index.ts index f3de3bf13..a8eaffebd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,14 +5,11 @@ const version = require("../package.json").version; // Expose all types -export * from "./horizon/horizon_api"; -export * from "./horizon/server_api"; +export * from "./horizon"; // stellar-sdk classes to expose -export * from "./horizon/account_response"; export * from "./errors"; export { Config } from "./config"; -export { Server } from "./horizon/server"; export { FederationServer, FEDERATION_RESPONSE_MAX_SIZE diff --git a/src/soroban/.eslintrc.js b/src/soroban/.eslintrc.js new file mode 100644 index 000000000..2dff00d7b --- /dev/null +++ b/src/soroban/.eslintrc.js @@ -0,0 +1,42 @@ +module.exports = { + env: { + es6: true, + }, + parser: "@babel/eslint-parser", + extends: ["airbnb-base", "prettier"], + plugins: ["prettier", "prefer-import"], + rules: { + // OFF + "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, + + // 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": [ + 1, + { + requireReturnDescription: false, + }, + ], + "prefer-const": 1, + "object-shorthand": 1, + "require-await": 1, + + // ERROR + "no-unused-expressions": [2, { allowTaggedTemplates: true }], + }, +}; diff --git a/src/soroban/axios.ts b/src/soroban/axios.ts new file mode 100644 index 000000000..384015a4c --- /dev/null +++ b/src/soroban/axios.ts @@ -0,0 +1,81 @@ +import axios, { AxiosResponse } from "axios"; +import URI from "urijs"; + +/* tslint:disable-next-line:no-var-requires */ +const version = require("../package.json").version; + +export interface ServerTime { + serverTime: number; + localTimeRecorded: number; +} + +/** + * keep a local map of server times + * (export this purely for testing purposes) + * + * each entry will map the server domain to the last-known time and the local + * time it was recorded, ex: + * + * "localhost:8000": { + * serverTime: 1552513039, + * localTimeRecorded: 1552513052 + * } + */ +export const SERVER_TIME_MAP: Record = {}; + +const AxiosClient = axios.create({ + headers: { + "X-Client-Name": "js-soroban-client", + "X-Client-Version": version, + }, +}); + +function _toSeconds(ms: number): number { + return Math.floor(ms / 1000); +} + +AxiosClient.interceptors.response.use(function interceptorHorizonResponse( + response: AxiosResponse, +) { + const hostname = URI(response.config.url!).hostname(); + const serverTime = _toSeconds(Date.parse(response.headers.date)); + const localTimeRecorded = _toSeconds(new Date().getTime()); + + if (!isNaN(serverTime)) { + SERVER_TIME_MAP[hostname] = { + serverTime, + localTimeRecorded, + }; + } + + return response; +}); + +export default AxiosClient; + +/** + * Given a hostname, get the current time of that server (i.e., use the last- + * recorded server time and offset it by the time since then.) If there IS no + * recorded server time, or it's been 5 minutes since the last, return null. + * @param {string} hostname Hostname of a Soroban-RPC server. + * @returns {number} The UNIX timestamp (in seconds, not milliseconds) + * representing the current time on that server, or `null` if we don't have + * a record of that time. + */ +export function getCurrentServerTime(hostname: string): number | null { + const entry = SERVER_TIME_MAP[hostname]; + + if (!entry || !entry.localTimeRecorded || !entry.serverTime) { + return null; + } + + const { serverTime, localTimeRecorded } = entry; + const currentTime = _toSeconds(new Date().getTime()); + + // if it's been more than 5 minutes from the last time, then null it out + if (currentTime - localTimeRecorded > 60 * 5) { + return null; + } + + return currentTime - localTimeRecorded + serverTime; +} diff --git a/src/soroban/browser.ts b/src/soroban/browser.ts new file mode 100644 index 000000000..03027026b --- /dev/null +++ b/src/soroban/browser.ts @@ -0,0 +1,9 @@ +/* tslint:disable:no-var-requires */ + +export * from "./index"; +export * as StellarBase from "stellar-base"; + +import axios from "axios"; // idk why axios is weird +export { axios }; + +export default module.exports; diff --git a/src/soroban/friendbot.ts b/src/soroban/friendbot.ts new file mode 100644 index 000000000..fe346d69e --- /dev/null +++ b/src/soroban/friendbot.ts @@ -0,0 +1,6 @@ +export namespace Friendbot { + // Just the fields we are interested in + export interface Response { + result_meta_xdr: string; + } +} diff --git a/src/soroban/index.ts b/src/soroban/index.ts new file mode 100644 index 000000000..eb4c72581 --- /dev/null +++ b/src/soroban/index.ts @@ -0,0 +1,25 @@ +// tslint:disable-next-line: no-reference +/// + +/* tslint:disable:no-var-requires */ +require("es6-promise").polyfill(); +const version = require("../../package.json").version; + +// Expose all types +export * from "./soroban_rpc"; + +// stellar-sdk classes to expose +export { Server } from "./server"; +export { + default as AxiosClient, + SERVER_TIME_MAP, + getCurrentServerTime, +} from "./axios"; +export * from "./transaction"; + +// expose classes and functions from stellar-base +export * from "stellar-base"; + +export { version }; + +export default module.exports; diff --git a/src/soroban/jsonrpc.ts b/src/soroban/jsonrpc.ts new file mode 100644 index 000000000..a1e1ea3a2 --- /dev/null +++ b/src/soroban/jsonrpc.ts @@ -0,0 +1,75 @@ +import axios from "./axios"; +import { hasOwnProperty } from "./utils"; + +export type Id = string | number; + +export interface Request { + jsonrpc: "2.0"; + id: Id; + method: string; + params: T; +} + +export interface Notification { + jsonrpc: "2.0"; + method: string; + params?: T; +} + +export type Response = { + jsonrpc: "2.0"; + id: Id; +} & ({ error: Error } | { result: T }); + +export interface Error { + code: number; + message?: string; + data?: E; +} + +/** + * Sends the jsonrpc 'params' as an array. + */ +export async function post( + url: string, + method: string, + ...params: any +): Promise { + if (params && params.length < 1) { + params = null; + } + const response = await axios.post>(url, { + jsonrpc: "2.0", + // TODO: Generate a unique request id + id: 1, + method, + params, + }); + if (hasOwnProperty(response.data, "error")) { + throw response.data.error; + } else { + return response.data?.result; + } +} + +/** + * Sends the jsonrpc 'params' as the single 'param' obj, no array wrapper is applied. + */ +export async function postObject( + url: string, + method: string, + param: any, +): Promise { + const response = await axios.post>(url, { + jsonrpc: "2.0", + // TODO: Generate a unique request id + id: 1, + method, + params: param, + }); + if (hasOwnProperty(response.data, "error")) { + throw response.data.error; + } else { + return response.data?.result; + } +} diff --git a/src/soroban/server.ts b/src/soroban/server.ts new file mode 100644 index 000000000..f82894785 --- /dev/null +++ b/src/soroban/server.ts @@ -0,0 +1,700 @@ +/* tslint:disable:variable-name no-namespace */ + +import isEmpty from "lodash/isEmpty"; +import merge from "lodash/merge"; +import { + Account, + Address, + Contract, + FeeBumpTransaction, + StrKey, + Transaction, + xdr, +} from "stellar-base"; +import URI from "urijs"; + +import AxiosClient from "./axios"; +import { Friendbot } from "./friendbot"; +import * as jsonrpc from "./jsonrpc"; +import { SorobanRpc } from "./soroban_rpc"; +import { assembleTransaction } from "./transaction"; + +export const SUBMIT_TRANSACTION_TIMEOUT = 60 * 1000; + +export interface GetEventsRequest { + startLedger?: number; + filters: SorobanRpc.EventFilter[]; + cursor?: string; + limit?: number; +} + +export enum Durability { + Temporary = 'temporary', + Persistent = 'persistent', +} + +/** + * Server handles the network connection to a + * [Soroban-RPC](https://soroban.stellar.org/docs) instance and exposes an + * interface for requests to that instance. + * + * @constructor + * + * @param {string} serverURL Soroban-RPC Server URL (ex. + * `http://localhost:8000/soroban/rpc`). + * @param {object} [opts] Options object + * @param {boolean} [opts.allowHttp] - Allow connecting to http servers, + * default: `false`. This must be set to false in production deployments! You + * can also use {@link Config} class to set this globally. + * @param {string} [opts.appName] - Allow set custom header `X-App-Name` + * @param {string} [opts.appVersion] - Allow set custom header `X-App-Version` + */ +export class Server { + /** + * Soroban-RPC Server URL (ex. `http://localhost:8000/soroban/rpc`). + */ + public readonly serverURL: URI; + + constructor(serverURL: string, opts: Server.Options = {}) { + this.serverURL = URI(serverURL); + + const customHeaders: any = {}; + + if (opts.appName) { + customHeaders["X-App-Name"] = opts.appName; + } + if (opts.appVersion) { + customHeaders["X-App-Version"] = opts.appVersion; + } + if (!isEmpty(customHeaders)) { + AxiosClient.interceptors.request.use((config: any) => { + // merge the custom headers with an existing headers + config.headers = merge(customHeaders, config.headers); + + return config; + }); + } + + if (this.serverURL.protocol() !== "https" && !opts.allowHttp) { + throw new Error("Cannot connect to insecure soroban-rpc server"); + } + } + + /** + * Fetch a minimal set of current info about a Stellar account. + * + * Needed to get the current sequence number for the account so you can build + * a successful transaction with {@link TransactionBuilder}. + * + * @example + * server.getAccount("GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4").then(account => { + * console.log("sequence:", account.sequence); + * }); + * + * @param {string} address - The public address of the account to load. + * @returns {Promise} Returns a promise to the {@link Account} object with populated sequence number. + */ + public async getAccount(address: string): Promise { + const ledgerKey = xdr.LedgerKey.account( + new xdr.LedgerKeyAccount({ + accountId: xdr.PublicKey.publicKeyTypeEd25519( + StrKey.decodeEd25519PublicKey(address), + ), + }), + ).toXDR("base64"); + const data: SorobanRpc.GetLedgerEntriesResponse = await jsonrpc.post( + this.serverURL.toString(), + "getLedgerEntries", + [ledgerKey], + ); + const ledgerEntries = data.entries ?? []; + if (ledgerEntries.length === 0) { + return Promise.reject({ + code: 404, + message: `Account not found: ${address}`, + }); + } + const ledgerEntryData = ledgerEntries[0].xdr; + const accountEntry = xdr.LedgerEntryData.fromXDR( + ledgerEntryData, + "base64", + ).account(); + const { high, low } = accountEntry.seqNum(); + const sequence = BigInt(high) * BigInt(4294967296) + BigInt(low); + return new Account(address, sequence.toString()); + } + + /** + * General node health check. + * + * @example + * server.getHealth().then(health => { + * console.log("status:", health.status); + * }); + * + * @returns {Promise} Returns a promise to the {@link SorobanRpc.GetHealthResponse} object with the status of the server ("healthy"). + */ + public async getHealth(): Promise { + return await jsonrpc.post( + this.serverURL.toString(), + "getHealth", + ); + } + + /** + * Reads the current value of contract data ledger entries directly. + * + * @example + * const contractId = "CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5"; + * const key = xdr.ScVal.scvSymbol("counter"); + * server.getContractData(contractId, key, 'temporary').then(data => { + * console.log("value:", data.xdr); + * console.log("lastModified:", data.lastModifiedLedgerSeq); + * console.log("latestLedger:", data.latestLedger); + * }); + * + * Allows you to directly inspect the current state of a contract. This is a + * backup way to access your contract data which may not be available via + * events or simulateTransaction. + * + * @param {string|Address|Contract} contract - The contract ID containing the + * data to load. Encoded as Stellar Contract Address string e.g. + * `CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5` or a + * {@link Contract} or {@link Address} instance. + * @param {xdr.ScVal} key - The key of the contract data to load. + * @param {Durability} [durability] - The "durability keyspace" that this + * ledger key belongs to, which is either 'temporary' or 'persistent' (the + * default), see {@link Durability}. + * + * @returns {Promise} Returns a promise to the + * {@link SorobanRpc.LedgerEntryResult} object with the current value. + * + * @warning If the data entry in question is a 'temporary' entry, it's + * entirely possible that it has expired out of existence. Future versions + * of this client may provide abstractions to handle that. + */ + public async getContractData( + contract: string | Address | Contract, + key: xdr.ScVal, + durability: Durability = Durability.Persistent, + ): Promise { + // coalesce `contract` param variants to an ScAddress + let scAddress: xdr.ScAddress; + if (typeof contract === 'string') { + scAddress = new Contract(contract).address().toScAddress(); + } else if (contract instanceof Address) { + scAddress = contract.toScAddress(); + } else if (contract instanceof Contract) { + scAddress = contract.address().toScAddress(); + } else { + throw new TypeError(`unknown contract type: ${contract}`); + } + + let xdrDurability: xdr.ContractDataDurability; + switch (durability) { + case Durability.Temporary: + xdrDurability = xdr.ContractDataDurability.temporary(); + break; + + case Durability.Persistent: + xdrDurability = xdr.ContractDataDurability.persistent(); + break; + + default: + throw new TypeError(`invalid durability: ${durability}`); + } + + let contractKey: string = xdr.LedgerKey.contractData( + new xdr.LedgerKeyContractData({ + contract: scAddress, + key, + durability: xdrDurability, + bodyType: xdr.ContractEntryBodyType.dataEntry() // expirationExtension is internal + }) + ).toXDR("base64"); + + return jsonrpc.post( + this.serverURL.toString(), + "getLedgerEntries", + [contractKey], + ).then(response => { + const ledgerEntries = response.entries ?? []; + if (ledgerEntries.length !== 1) { + return Promise.reject({ + code: 404, + message: `Contract data not found. Contract: ${Address.fromScAddress(scAddress).toString()}, Key: ${key.toXDR("base64")}, Durability: ${durability}`, + }); + } + return ledgerEntries[0]; + }); + } + + /** + * Reads the current value of ledger entries directly. + * + * Allows you to directly inspect the current state of contracts, contract's + * code, or any other ledger entries. This is a backup way to access your + * contract data which may not be available via events or simulateTransaction. + * + * To fetch contract wasm byte-code, use the ContractCode ledger entry key. + * + * @example + * const contractId = "0000000000000000000000000000000000000000000000000000000000000001"; + * const key = xdr.LedgerKey.contractData(new xdr.LedgerKeyContractData({ + * contractId: Buffer.from(contractId, "hex"), + * key: xdr.ScVal.scvSymbol("counter"), + * })); + * server.getLedgerEntries([key]).then(response => { + * const ledgerData = response.entries[0]; + * console.log("key:", ledgerData.key); + * console.log("value:", ledgerData.xdr); + * console.log("lastModified:", ledgerData.lastModifiedLedgerSeq); + * console.log("latestLedger:", response.latestLedger); + * }); + * + * @param {xdr.ScVal[]} keys - The ledger entry keys to load. + * + * @returns {Promise} Returns a promise + * to the {@link SorobanRpc.GetLedgerEntriesResponse} object with the + * current value. + */ + public async getLedgerEntries( + keys: xdr.LedgerKey[], + ): Promise { + return await jsonrpc.post( + this.serverURL.toString(), + "getLedgerEntries", + keys.map((k) => k.toXDR("base64")), + ); + } + + /** + * Fetch the details of a submitted transaction. + * + * When submitting a transaction, clients should poll this to tell when the + * transaction has completed. + * + * @example + * const transactionHash = "c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a"; + * server.getTransaction(transactionHash).then(transaction => { + * console.log("status:", transaction.status); + * console.log("envelopeXdr:", transaction.envelopeXdr); + * console.log("resultMetaXdr:", transaction.resultMetaXdr); + * console.log("resultXdr:", transaction.resultXdr); + * }); + * + * @param {string} hash - The hash of the transaction to check. Encoded as a + * hex string. + * + * @returns {Promise} Returns a + * promise to the {@link SorobanRpc.GetTransactionResponse} object + * with the status, result, and other details about the transaction. + */ + public async getTransaction( + hash: string, + ): Promise { + return await jsonrpc.post( + this.serverURL.toString(), + "getTransaction", + hash, + ); + } + + /** + * Fetches all events that match a given set of filters. + * + * The given filters (see {@link SorobanRpc.EventFilter} for detailed fields) + * are combined only in a logical OR fashion, and all of the fields in each + * filter are optional. + * + * To page through events, use the `pagingToken` field on the relevant + * {@link SorobanRpc.EventResponse} object to set the `cursor` parameter. + * + * @example + * server.getEvents({ + * startLedger: "1000", + * filters: [ + * { + * type: "contract", + * contractIds: [ "deadb33f..." ], + * topics: [[ "AAAABQAAAAh0cmFuc2Zlcg==", "AAAAAQB6Mcc=", "*" ]] + * }, { + * type: "system", + * contractIds: [ "...c4f3b4b3..." ], + * topics: [[ "*" ], [ "*", "AAAAAQB6Mcc=" ]] + * }, { + * contractIds: [ "...c4f3b4b3..." ], + * topics: [[ "AAAABQAAAAh0cmFuc2Zlcg==" ]] + * }, { + * type: "diagnostic", + * topics: [[ "AAAAAQB6Mcc=" ]] + * } + * ], + * limit: 10, + * }); + * + * @returns {Promise} a promise to the + * {@link SorobanRpc.GetEventsResponse} object containing a paginatable set + * of the events matching the given event filters. + */ + public async getEvents( + request: GetEventsRequest, + ): Promise { + // TODO: It'd be nice if we could do something to infer the types of filter + // arguments a user wants, e.g. converting something like "transfer/*/42" + // into the base64-encoded `ScVal` equivalents by inferring that the first + // is an ScSymbol and the last is a U32. + // + // The difficulty comes in matching up the correct integer primitives. + // + // It also means this library will rely on the XDR definitions. + return await jsonrpc.postObject(this.serverURL.toString(), "getEvents", { + filters: request.filters ?? [], + pagination: { + ...(request.cursor && { cursor: request.cursor }), // add fields only if defined + ...(request.limit && { limit: request.limit }), + }, + ...(request.startLedger && { startLedger: String(request.startLedger) }), + }); + } + + /** + * Fetches metadata about the network which Soroban-RPC is connected to. + * + * @example + * server.getNetwork().then(network => { + * console.log("friendbotUrl:", network.friendbotUrl); + * console.log("passphrase:", network.passphrase); + * console.log("protocolVersion:", network.protocolVersion); + * }); + * + * @returns {Promise} a promise to the + * {@link SorobanRpc.GetNetworkResponse} object containing metadata + * about the current network this soroban-rpc server is connected to. + */ + public async getNetwork(): Promise { + return await jsonrpc.post(this.serverURL.toString(), "getNetwork"); + } + + /** + * Fetches the latest ledger meta info from network which Soroban-RPC is connected to. + * + * @example + * server.getLatestLedger().then(response => { + * console.log("hash:", response.id); + * console.log("sequence:", response.sequence); + * console.log("protocolVersion:", response.protocolVersion); + * }); + * + * @returns {Promise} a promise to the + * {@link SorobanRpc.GetLatestLedgerResponse} object containing metadata + * about the latest ledger from network soroban-rpc server is connected to. + */ + public async getLatestLedger(): Promise { + return await jsonrpc.post(this.serverURL.toString(), "getLatestLedger"); + } + + /** + * Submit a trial contract invocation to get back return values, expected + * ledger footprint, expected authorizations, and expected costs. + * + * @example + * const contractId = '0000000000000000000000000000000000000000000000000000000000000001'; + * const contract = new SorobanClient.Contract(contractId); + * + * // Right now, this is just the default fee for this example. + * const fee = 100; + * + * const transaction = new SorobanClient.TransactionBuilder(account, { + * fee, + * // Uncomment the following line to build transactions for the live network. Be + * // sure to also change the horizon hostname. + * // networkPassphrase: SorobanClient.Networks.PUBLIC, + * networkPassphrase: SorobanClient.Networks.FUTURENET + * }) + * // Add a contract.increment soroban contract invocation operation + * .addOperation(contract.call("increment")) + * // Make this transaction valid for the next 30 seconds only + * .setTimeout(30) + * // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/) + * // .addMemo(SorobanClient.Memo.text('Hello world!')) + * .build(); + * + * // Sign this transaction with the secret key + * // NOTE: signing is transaction is network specific. Test network transactions + * // won't work in the public network. To switch networks, use the Network object + * // as explained above (look for SorobanClient.Network). + * const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey); + * transaction.sign(sourceKeypair); + * + * server.simulateTransaction(transaction).then(sim => { + * console.log("cost:", sim.cost); + * console.log("results:", sim.results); + * console.log("error:", sim.error); + * console.log("latestLedger:", sim.latestLedger); + * }); + * + * @param {Transaction | FeeBumpTransaction} transaction - The transaction to + * simulate. It should include exactly one operation, which must be one of + * {@link xdr.InvokeHostFunctionOp}, {@link xdr.BumpFootprintExpirationOp}, + * or {@link xdr.RestoreFootprintOp}. Any provided footprint will be + * ignored. + * + * @returns {Promise} Returns a + * promise to the {@link SorobanRpc.SimulateTransactionResponse} object + * with the cost, footprint, result/auth requirements (if applicable), and + * error of the transaction. + */ + public async simulateTransaction( + transaction: Transaction | FeeBumpTransaction, + ): Promise { + return await jsonrpc.post( + this.serverURL.toString(), + "simulateTransaction", + transaction.toXDR(), + ); + } + + /** + * Submit a trial contract invocation, first run a simulation of the contract + * invocation as defined on the incoming transaction, and apply the results to + * a new copy of the transaction which is then returned. Setting the ledger + * footprint and authorization, so the resulting transaction is ready for + * signing & sending. + * + * The returned transaction will also have an updated fee that is the sum of + * fee set on incoming transaction with the contract resource fees estimated + * from simulation. It is adviseable to check the fee on returned transaction + * and validate or take appropriate measures for interaction with user to + * confirm it is acceptable. + * + * You can call the {@link Server.simulateTransaction} method directly first + * if you want to inspect estimated fees for a given transaction in detail + * first, if that is of importance. + * + * @example + * const contractId = '0000000000000000000000000000000000000000000000000000000000000001'; + * const contract = new SorobanClient.Contract(contractId); + * + * // Right now, this is just the default fee for this example. + * const fee = 100; + * + * const transaction = new SorobanClient.TransactionBuilder(account, { + * fee, + * // Uncomment the following line to build transactions for the live network. Be + * // sure to also change the horizon hostname. + * // networkPassphrase: SorobanClient.Networks.PUBLIC, + * networkPassphrase: SorobanClient.Networks.TESTNET + * }) + * // Add a contract.increment soroban contract invocation operation + * .addOperation(contract.call("increment")) + * // Make this transaction valid for the next 30 seconds only + * .setTimeout(30) + * // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/) + * // .addMemo(SorobanClient.Memo.text('Hello world!')) + * .build(); + * + * preparedTransaction = await server.prepareTransaction(transaction); + * + * // Sign this transaction with the secret key + * // NOTE: signing is transaction is network specific. Test network transactions + * // won't work in the public network. To switch networks, use the Network object + * // as explained above (look for SorobanClient.Network). + * const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey); + * preparedTransaction.sign(sourceKeypair); + * + * server.sendTransaction(transaction).then(result => { + * console.log("hash:", result.hash); + * console.log("status:", result.status); + * console.log("errorResultXdr:", result.errorResultXdr); + * }); + * + * @param {Transaction | FeeBumpTransaction} transaction - The transaction to + * prepare. It should include exactly one operation, which must be one of + * {@link xdr.InvokeHostFunctionOp}, {@link xdr.BumpFootprintExpirationOp}, + * or {@link xdr.RestoreFootprintOp}. Any provided footprint will be + * overwritten. + * @param {string} [networkPassphrase] - Explicitly provide a network + * passphrase. If not passed, the current network passphrase will be + * requested from the server via {@link Server.getNetwork}. + * + * @returns {Promise} Returns a copy of the + * transaction, with the expected authorizations (in the case of + * invocation) and ledger footprint added. The transaction fee will also + * automatically be padded with the contract's minimum resource fees + * discovered from the simulation. + */ + public async prepareTransaction( + transaction: Transaction | FeeBumpTransaction, + networkPassphrase?: string, + ): Promise { + const [{ passphrase }, simResponse] = await Promise.all([ + networkPassphrase + ? Promise.resolve({ passphrase: networkPassphrase }) + : this.getNetwork(), + this.simulateTransaction(transaction), + ]); + if (simResponse.error) { + throw simResponse.error; + } + if (!simResponse.results || simResponse.results.length !== 1) { + throw new Error("transaction simulation failed"); + } + return assembleTransaction(transaction, passphrase, simResponse); + } + + /** + * Submit a real transaction to the Stellar network. This is the only way to + * make changes "on-chain". Unlike Horizon, Soroban-RPC does not wait for + * transaction completion. It simply validates the transaction and enqueues + * it. Clients should call {@link Server#getTransactionStatus} to learn about + * transaction success/failure. + * + * @example + * const contractId = '0000000000000000000000000000000000000000000000000000000000000001'; + * const contract = new SorobanClient.Contract(contractId); + * + * // Right now, this is just the default fee for this example. + * const fee = 100; + * + * const transaction = new SorobanClient.TransactionBuilder(account, { + * fee, + * // Uncomment the following line to build transactions for the live network. Be + * // sure to also change the horizon hostname. + * // networkPassphrase: SorobanClient.Networks.PUBLIC, + * networkPassphrase: SorobanClient.Networks.STANDALONE + * }) + * // Add a contract.increment soroban contract invocation operation + * // Note: For real transactions you will need to include the footprint + * // and auth in the operation, as returned from simulateTransaction. + * .addOperation(contract.call("increment")) + * // Make this transaction valid for the next 30 seconds only + * .setTimeout(30) + * // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/) + * // .addMemo(SorobanClient.Memo.text('Hello world!')) + * .build(); + * + * // Sign this transaction with the secret key + * // NOTE: signing is transaction is network specific. Test network transactions + * // won't work in the public network. To switch networks, use the Network object + * // as explained above (look for SorobanClient.Network). + * const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey); + * transaction.sign(sourceKeypair); + * + * server.sendTransaction(transaction).then(result => { + * console.log("hash:", result.hash); + * console.log("status:", result.status); + * console.log("errorResultXdr:", result.errorResultXdr); + * }); + * + * @param {Transaction | FeeBumpTransaction} transaction - The transaction to + * submit. + * @returns {Promise} Returns a promise to + * the {@link SorobanRpc.SendTransactionResponse} object with the + * transaction id, status, and any error if available. + */ + public async sendTransaction( + transaction: Transaction | FeeBumpTransaction, + ): Promise { + return await jsonrpc.post( + this.serverURL.toString(), + "sendTransaction", + transaction.toXDR(), + ); + } + + /** + * Use the friendbot faucet to create and fund a new account. The method will + * return an Account object for the created account, or if the account already + * existed. If friendbot is not configured on this network, this method will + * throw an error. If the request fails, this method will throw an error. + * + * @example + * server.requestAirdrop("GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4").then(accountCreated => { + * console.log("accountCreated:", accountCreated); + * }).catch(error => { + * console.error("error:", error); + * }); + * + * @param {string | Account} address - The address or account we want to create and fund. + * @param {string} [friendbotUrl] - The optional explicit address for + * friendbot. If not provided, the client will call the Soroban-RPC `getNetwork` + * method to attempt to find this network's friendbot url. + * @returns {Promise} Returns a promise to the {@link Account} object with populated sequence number. + */ + public async requestAirdrop( + address: string | Pick, + friendbotUrl?: string, + ): Promise { + const account = typeof address === "string" ? address : address.accountId(); + friendbotUrl = friendbotUrl || (await this.getNetwork()).friendbotUrl; + if (!friendbotUrl) { + throw new Error("No friendbot URL configured for current network"); + } + try { + const response = await AxiosClient.post( + `${friendbotUrl}?addr=${encodeURIComponent(account)}`, + ); + const meta = xdr.TransactionMeta.fromXDR( + response.data.result_meta_xdr, + "base64", + ); + const sequence = findCreatedAccountSequenceInTransactionMeta(meta); + return new Account(account, sequence); + } catch (error: any) { + if (error.response?.status === 400) { + if (error.response.detail?.includes("createAccountAlreadyExist")) { + // Account already exists, load the sequence number + return this.getAccount(account); + } + } + throw error; + } + } +} + +function findCreatedAccountSequenceInTransactionMeta( + meta: xdr.TransactionMeta, +): string { + let operations: xdr.OperationMeta[] = []; + switch (meta.switch()) { + case 0: + operations = meta.operations(); + break; + case 1: + operations = meta.v1().operations(); + break; + case 2: + operations = meta.v2().operations(); + break; + case 3: + operations = meta.v3().operations(); + break; + default: + throw new Error("Unexpected transaction meta switch value"); + } + + for (const op of operations) { + for (const c of op.changes()) { + if (c.switch() !== xdr.LedgerEntryChangeType.ledgerEntryCreated()) { + continue; + } + const data = c.created().data(); + if (data.switch() !== xdr.LedgerEntryType.account()) { + continue; + } + + return data.account().seqNum().toString(); + } + } + throw new Error("No account created in transaction"); +} + +export namespace Server { + export interface Options { + allowHttp?: boolean; + timeout?: number; + appName?: string; + appVersion?: string; + } +} diff --git a/src/soroban/soroban_rpc.ts b/src/soroban/soroban_rpc.ts new file mode 100644 index 000000000..2fc7bd923 --- /dev/null +++ b/src/soroban/soroban_rpc.ts @@ -0,0 +1,140 @@ +import { AssetType } from "stellar-base"; +import * as jsonrpc from "./jsonrpc"; + +// TODO: Better parsing for hashes, and base64-encoded xdr + +/* tslint:disable-next-line:no-namespace */ +/* @namespace SorobanRpc + */ +export namespace SorobanRpc { + export interface Balance { + asset_type: AssetType.credit4 | AssetType.credit12; + asset_code: string; + asset_issuer: string; + classic: string; + smart: string; + } + + export interface Cost { + cpuInsns: string; + memBytes: string; + } + + export interface GetHealthResponse { + status: "healthy"; + } + + export interface LedgerEntryResult { + key: string; + // xdr is a base-64 encoded {@link xdr.LedgerEntryData} + xdr: string; + lastModifiedLedgerSeq?: number; + } + + /* Response for jsonrpc method `getLedgerEntries` + */ + export interface GetLedgerEntriesResponse { + entries: LedgerEntryResult[] | null; + latestLedger: number; + } + + /* Response for jsonrpc method `getNetwork` + */ + export interface GetNetworkResponse { + friendbotUrl?: string; + passphrase: string; + protocolVersion: string; + } + + /* Response for jsonrpc method `getLatestLedger` + */ + export interface GetLatestLedgerResponse { + id: string; + sequence: number; + protocolVersion: string; + } + + export type GetTransactionStatus = "SUCCESS" | "NOT_FOUND" | "FAILED"; + + export interface GetTransactionResponse { + status: GetTransactionStatus; + latestLedger: number; + latestLedgerCloseTime: number; + oldestLedger: number; + oldestLedgerCloseTime: number; + + // the fields below are set if status is SUCCESS + applicationOrder?: number; + feeBump?: boolean; + envelopeXdr?: string; + resultXdr?: string; + resultMetaXdr?: string; + ledger?: number; + createdAt?: number; + } + + export type EventType = "contract" | "system" | "diagnostic"; + + export interface EventFilter { + type?: EventType; + contractIds?: string[]; + topics?: string[][]; + } + + export interface GetEventsResponse { + events?: EventResponse[]; + } + + export interface EventResponse { + ledger: string; + ledgerClosedAt: string; + contractId: string; + id: string; + pagingToken: string; + inSuccessfulContractCall: boolean; + topic: string[]; + value: { + xdr: string; + }; + } + + export interface RequestAirdropResponse { + transaction_id: string; + } + + export type SendTransactionStatus = + | "PENDING" + | "DUPLICATE" + | "TRY_AGAIN_LATER" + | "ERROR"; + + export interface SendTransactionResponse { + status: SendTransactionStatus; + // errorResultXdr is only set when status is ERROR + errorResultXdr?: string; + hash: string; + latestLedger: number; + latestLedgerCloseTime: number; + } + + export interface SimulateHostFunctionResult { + // each string is SorobanAuthorizationEntry XDR in base64 + auth?: string[]; + // function response as SCVal XDR in base64 + xdr: string; + } + + export interface SimulateTransactionResponse { + id: string; + error?: jsonrpc.Error; + // this is SorobanTransactionData XDR in base64 + transactionData: string; + events: string[]; + minResourceFee: string; + // This will only contain a single element, because only a single + // invokeHostFunctionOperation is supported per transaction. + results: SimulateHostFunctionResult[]; + latestLedger: number; + cost: Cost; + } +} diff --git a/src/soroban/transaction.ts b/src/soroban/transaction.ts new file mode 100644 index 000000000..cf3ecee86 --- /dev/null +++ b/src/soroban/transaction.ts @@ -0,0 +1,112 @@ +import { + Account, + FeeBumpTransaction, + Operation, + Transaction, + TransactionBuilder, + xdr, +} from "stellar-base"; + +import { SorobanRpc } from "./soroban_rpc"; + +// TODO: Transaction is immutable, so we need to re-build it here. :( +export function assembleTransaction( + raw: Transaction | FeeBumpTransaction, + networkPassphrase: string, + simulation: SorobanRpc.SimulateTransactionResponse +): Transaction { + if ("innerTransaction" in raw) { + // TODO: Handle feebump transactions + return assembleTransaction( + raw.innerTransaction, + networkPassphrase, + simulation + ); + } + + if (!isSorobanTransaction(raw)) { + throw new TypeError( + "unsupported transaction: must contain exactly one " + + "invokeHostFunction, bumpFootprintExpiration, or restoreFootprint " + + "operation" + ); + } + + if (simulation.results.length !== 1) { + throw new Error(`simulation results invalid: ${simulation.results}`); + } + + const source = new Account(raw.source, `${parseInt(raw.sequence, 10) - 1}`); + const classicFeeNum = parseInt(raw.fee, 10) || 0; + const minResourceFeeNum = parseInt(simulation.minResourceFee, 10) || 0; + const txnBuilder = new TransactionBuilder(source, { + // automatically update the tx fee that will be set on the resulting tx to + // the sum of 'classic' fee provided from incoming tx.fee and minResourceFee + // provided by simulation. + // + // 'classic' tx fees are measured as the product of tx.fee * 'number of + // operations', In soroban contract tx, there can only be single operation + // in the tx, so can make simplification of total classic fees for the + // soroban transaction will be equal to incoming tx.fee + minResourceFee. + fee: (classicFeeNum + minResourceFeeNum).toString(), + memo: raw.memo, + networkPassphrase, + timebounds: raw.timeBounds, + ledgerbounds: raw.ledgerBounds, + minAccountSequence: raw.minAccountSequence, + minAccountSequenceAge: raw.minAccountSequenceAge, + minAccountSequenceLedgerGap: raw.minAccountSequenceLedgerGap, + extraSigners: raw.extraSigners, + }); + + switch (raw.operations[0].type) { + case "invokeHostFunction": + const invokeOp: Operation.InvokeHostFunction = raw.operations[0]; + txnBuilder.addOperation( + Operation.invokeHostFunction({ + source: invokeOp.source, + func: invokeOp.func, + // apply the auth from the simulation + auth: (invokeOp.auth ?? []).concat( + simulation.results[0].auth?.map((a: string) => + xdr.SorobanAuthorizationEntry.fromXDR(a, "base64") + ) ?? [] + ), + }) + ); + break; + + case "bumpFootprintExpiration": + txnBuilder.addOperation(Operation.bumpFootprintExpiration(raw.operations[0])); + break; + + case "restoreFootprint": + txnBuilder.addOperation(Operation.restoreFootprint(raw.operations[0])); + break; + } + + // apply the pre-built Soroban Tx Data from simulation onto the Tx + const sorobanTxData = xdr.SorobanTransactionData.fromXDR( + simulation.transactionData, + "base64" + ); + txnBuilder.setSorobanData(sorobanTxData); + + return txnBuilder.build(); +} + +function isSorobanTransaction(tx: Transaction): boolean { + if (tx.operations.length !== 1) { + return false; + } + + switch (tx.operations[0].type) { + case "invokeHostFunction": + case "bumpFootprintExpiration": + case "restoreFootprint": + return true; + + default: + return false; + } +} diff --git a/src/soroban/utils.ts b/src/soroban/utils.ts new file mode 100644 index 000000000..af4bb76a2 --- /dev/null +++ b/src/soroban/utils.ts @@ -0,0 +1,8 @@ +// Check if the given object X has a field Y, and make that available to +// typescript typing. +export function hasOwnProperty( + obj: X, + prop: Y, +): obj is X & Record { + return obj.hasOwnProperty(prop); +} diff --git a/src/utils.ts b/src/utils.ts index 2a99b4a97..f6c5882d3 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -13,7 +13,7 @@ import { TransactionBuilder, } from "stellar-base"; import { InvalidSep10ChallengeError } from "./errors"; -import { ServerApi } from "./server_api"; +import { ServerApi } from "./horizon/server_api"; /** * @namespace Utils diff --git a/yarn.lock b/yarn.lock index e4bd090f6..0059fe275 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2775,6 +2775,11 @@ cors@~2.8.5: object-assign "^4" vary "^1" +crc@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/crc/-/crc-4.3.2.tgz#49b7821cbf2cf61dfd079ed93863bbebd5469b9a" + integrity sha512-uGDHf4KLLh2zsHa8D8hIQ1H/HtFQhyHrc0uhHBcoKGol/Xnb+MPYfUMw7cvON6ze/GUESTudKayDcJC5HnJv1A== + create-ecdh@^4.0.0: version "4.0.4" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e" @@ -4604,10 +4609,10 @@ js-tokens@^4.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-xdr@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/js-xdr/-/js-xdr-2.0.0.tgz#ef24ea27369ab60217c001fd0e27301f6981ba0a" - integrity sha512-4mctWHR47ejNcfpE8/Xl3l2wYqO1Qy09d1pveZRmarUz2BcuU/M8grzadxV6PoN/X0ywOb6cy6117qYUWkfeBA== +js-xdr@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/js-xdr/-/js-xdr-3.0.0.tgz#fb74275de0ed3cec61269721140a576edf6fca7e" + integrity sha512-tSt6UKJ2L7t+yaQURGkHo9kop9qnVbChTlCu62zNiDbDZQoZb/YjUj2iFJ3lgelhfg9p5bhO2o/QX+g36TPsSQ== js-yaml@4.1.0, js-yaml@^4.1.0: version "4.1.0" @@ -6459,15 +6464,17 @@ statuses@~1.5.0: resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== -stellar-base@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/stellar-base/-/stellar-base-9.0.0.tgz#af29349e011ee88657d9a62534388b50b3002d88" - integrity sha512-rnc0P28C2TlDoKpiL/Xw+4DyNqZ+hLxfcXub9gOH3FyPnGTr7QbGBiP0gYnRAndPp6xzX1F+hcCcPl31ce47/w== +stellar-base@^10.0.0-soroban.4: + version "10.0.0-soroban.4" + resolved "https://registry.yarnpkg.com/stellar-base/-/stellar-base-10.0.0-soroban.4.tgz#9baeaec1f750473cb0dc00c6fa0f3ec23cf7177d" + integrity sha512-Afl2Mlh+aXokIHhy2x67Df5ofbss83oAOHV7pHLI0fsPlxAgs7YtbClzkNxvpnXyxQI77PMIWFJbT17Y3dR/+A== dependencies: base32.js "^0.1.0" bignumber.js "^9.1.1" + buffer "^6.0.3" + crc "^4.3.2" crypto-browserify "^3.12.0" - js-xdr "^2.0.0" + js-xdr "^3.0.0" sha.js "^2.3.6" tweetnacl "^1.0.3" optionalDependencies: From ffeed24ac45e7c230009b60de4bd5c449390eecf Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Wed, 6 Sep 2023 15:55:20 -0700 Subject: [PATCH 4/8] Upgrade all dependencies to their latest versions --- package.json | 55 +- yarn.lock | 1790 ++++++++++++++++++++++++++++---------------------- 2 files changed, 1035 insertions(+), 810 deletions(-) diff --git a/package.json b/package.json index 10d423668..1d3913899 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stellar-sdk", - "version": "11.0.0-beta.1", + "version": "11.0.0-beta.2", "description": "A library for working with the Stellar Horizon server.", "keywords": [ "stellar" @@ -51,8 +51,7 @@ }, "lint-staged": { "**/*.{js,json,ts}": [ - "yarn fmt", - "yarn lint" + "yarn fmt" ] }, "mocha": { @@ -66,7 +65,7 @@ ], "sort": true, "recursive": true, - "timeout": 60000 + "timeout": 30000 }, "nyc": { "instrument": false, @@ -76,38 +75,38 @@ ] }, "devDependencies": { - "@babel/cli": "^7.22.6", - "@babel/core": "^7.22.8", - "@babel/eslint-parser": "^7.22.7", - "@babel/eslint-plugin": "^7.19.1", - "@babel/preset-env": "^7.22.7", - "@babel/preset-typescript": "^7.21.4", - "@babel/register": "^7.21.0", - "@definitelytyped/dtslint": "^0.0.163", + "@babel/cli": "^7.22.15", + "@babel/core": "^7.22.15", + "@babel/eslint-parser": "^7.22.15", + "@babel/eslint-plugin": "^7.22.10", + "@babel/preset-env": "^7.22.15", + "@babel/preset-typescript": "^7.22.15", + "@babel/register": "^7.22.15", + "@definitelytyped/dtslint": "^0.0.177", "@istanbuljs/nyc-config-babel": "3.0.0", "@stellar/tsconfig": "^1.0.2", "@types/detect-node": "^2.0.0", "@types/eventsource": "^1.1.2", - "@types/lodash": "^4.14.192", - "@types/node": "^20.4.1", + "@types/lodash": "^4.14.198", + "@types/node": "^20.5.9", "@types/randombytes": "^2.0.0", - "@types/urijs": "^1.19.6", - "@typescript-eslint/parser": "^5.59.7", + "@types/urijs": "^1.19.20", + "@typescript-eslint/parser": "^6.6.0", "axios-mock-adapter": "^1.21.5", "babel-loader": "^9.1.3", "babel-plugin-istanbul": "^6.1.1", "buffer": "^6.0.3", - "chai": "^4.3.7", + "chai": "^4.3.8", "chai-as-promised": "^7.1.1", "chai-http": "^4.3.0", "cross-env": "^7.0.3", - "eslint": "^8.44.0", + "eslint": "^8.48.0", "eslint-config-airbnb-base": "^15.0.0", - "eslint-config-prettier": "^8.8.0", - "eslint-plugin-import": "^2.25.2", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-import": "^2.28.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prefer-import": "^0.0.1", - "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-prettier": "^5.0.0", "eslint-webpack-plugin": "^4.0.1", "ghooks": "^2.0.4", "husky": "^8.0.3", @@ -120,30 +119,30 @@ "karma-mocha": "^2.0.0", "karma-sinon-chai": "^2.0.2", "karma-webpack": "^5.0.0", - "lint-staged": "^13.2.3", + "lint-staged": "^14.0.1", "lodash": "^4.17.21", "minami": "^1.1.1", "mocha": "^10.2.0", "node-polyfill-webpack-plugin": "^2.0.1", "nyc": "^15.1.0", - "prettier": "^2.8.7", + "prettier": "^3.0.3", "randombytes": "^2.1.0", "sinon": "^15.2.0", "sinon-chai": "^3.7.0", "taffydb": "^2.7.3", "terser-webpack-plugin": "^5.3.9", "ts-node": "^10.9.1", - "typescript": "^5.1.6", + "typescript": "^5.2.2", "utility-types": "^3.7.0", - "webpack": "^5.88.1", + "webpack": "^5.88.2", "webpack-cli": "^5.0.1" }, "dependencies": { - "axios": "^1.4.0", - "bignumber.js": "^9.1.1", + "axios": "^1.5.0", + "bignumber.js": "^9.1.2", "eventsource": "^2.0.2", "randombytes": "^2.1.0", - "stellar-base": "^10.0.0-soroban.4", + "stellar-base": "^10.0.0-soroban.8", "toml": "^3.0.0", "urijs": "^1.19.1" } diff --git a/yarn.lock b/yarn.lock index 0059fe275..179011698 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15,10 +15,10 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" -"@babel/cli@^7.22.6": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.22.9.tgz#501b3614aeda7399371f6d5991404f069b059986" - integrity sha512-nb2O7AThqRo7/E53EGiuAkMaRbb7J5Qp3RvN+dmua1U+kydm0oznkhqbTEG15yk26G/C3yL6OdZjzgl+DMXVVA== +"@babel/cli@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.22.15.tgz#22ed82d76745a43caa60a89917bedb7c9b5bd145" + integrity sha512-prtg5f6zCERIaECeTZzd2fMtVjlfjhUcO+fBLQ6DXXdq5FljN+excVitJ2nogsusdf31LeqkjAfXZ7Xq+HmN8g== dependencies: "@jridgewell/trace-mapping" "^0.3.17" commander "^4.0.1" @@ -31,61 +31,62 @@ "@nicolo-ribaudo/chokidar-2" "2.1.8-no-fsevents.3" chokidar "^3.4.0" -"@babel/code-frame@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.5.tgz#234d98e1551960604f1246e6475891a570ad5658" - integrity sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ== +"@babel/code-frame@^7.22.13": + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e" + integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w== dependencies: - "@babel/highlight" "^7.22.5" + "@babel/highlight" "^7.22.13" + chalk "^2.4.2" -"@babel/compat-data@^7.22.5", "@babel/compat-data@^7.22.6", "@babel/compat-data@^7.22.9": +"@babel/compat-data@^7.22.6", "@babel/compat-data@^7.22.9": version "7.22.9" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.9.tgz#71cdb00a1ce3a329ce4cbec3a44f9fef35669730" integrity sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ== -"@babel/core@^7.12.3", "@babel/core@^7.22.8", "@babel/core@^7.7.5": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.22.9.tgz#bd96492c68822198f33e8a256061da3cf391f58f" - integrity sha512-G2EgeufBcYw27U4hhoIwFcgc1XU7TlXJ3mv04oOv1WCuo900U/anZSPzEqNjwdjgffkk2Gs0AN0dW1CKVLcG7w== +"@babel/core@^7.12.3", "@babel/core@^7.22.15", "@babel/core@^7.7.5": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.22.15.tgz#15d4fd03f478a459015a4b94cfbb3bd42c48d2f4" + integrity sha512-PtZqMmgRrvj8ruoEOIwVA3yoF91O+Hgw9o7DAUTNBA6Mo2jpu31clx9a7Nz/9JznqetTR6zwfC4L3LAjKQXUwA== dependencies: "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.22.5" - "@babel/generator" "^7.22.9" - "@babel/helper-compilation-targets" "^7.22.9" - "@babel/helper-module-transforms" "^7.22.9" - "@babel/helpers" "^7.22.6" - "@babel/parser" "^7.22.7" - "@babel/template" "^7.22.5" - "@babel/traverse" "^7.22.8" - "@babel/types" "^7.22.5" + "@babel/code-frame" "^7.22.13" + "@babel/generator" "^7.22.15" + "@babel/helper-compilation-targets" "^7.22.15" + "@babel/helper-module-transforms" "^7.22.15" + "@babel/helpers" "^7.22.15" + "@babel/parser" "^7.22.15" + "@babel/template" "^7.22.15" + "@babel/traverse" "^7.22.15" + "@babel/types" "^7.22.15" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" - json5 "^2.2.2" + json5 "^2.2.3" semver "^6.3.1" -"@babel/eslint-parser@^7.22.7": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.22.9.tgz#75f8aa978d1e76c87cc6f26c1ea16ae58804d390" - integrity sha512-xdMkt39/nviO/4vpVdrEYPwXCsYIXSSAr6mC7WQsNIlGnuxKyKE7GZjalcnbSWiC4OXGNNN3UQPeHfjSC6sTDA== +"@babel/eslint-parser@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.22.15.tgz#263f059c476e29ca4972481a17b8b660cb025a34" + integrity sha512-yc8OOBIQk1EcRrpizuARSQS0TWAcOMpEJ1aafhNznaeYkeL+OhqnDObGFylB8ka8VFF/sZc+S4RzHyO+3LjQxg== dependencies: "@nicolo-ribaudo/eslint-scope-5-internals" "5.1.1-v1" eslint-visitor-keys "^2.1.0" semver "^6.3.1" -"@babel/eslint-plugin@^7.19.1": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/eslint-plugin/-/eslint-plugin-7.22.5.tgz#47407d8c9e527b62ff75ee11e4baa6de3da7cf0e" - integrity sha512-lDXW06rf1sXywWWw+UdS/iYxRjrqhH4AXdPeKE4+fEgEoGBXcdIDQ+uCJOUcvCb0jCTvfwHOSXkwnfd24EAkLQ== +"@babel/eslint-plugin@^7.22.10": + version "7.22.10" + resolved "https://registry.yarnpkg.com/@babel/eslint-plugin/-/eslint-plugin-7.22.10.tgz#b84e0f029b8f78604c3f6797cd6208cad46fbcf5" + integrity sha512-SRZcvo3fnO5h79B9DZSV6LG2vHH7OWsSNp1huFLHsXKyytRG413byQk9zxW1VcPOhnzfx2VIUz+8aGbiE7fOkA== dependencies: eslint-rule-composer "^0.3.0" -"@babel/generator@^7.22.7", "@babel/generator@^7.22.9": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.22.9.tgz#572ecfa7a31002fa1de2a9d91621fd895da8493d" - integrity sha512-KtLMbmicyuK2Ak/FTCJVbDnkN1SlT8/kceFTiuDiiRUUSMnHMidxSCdG4ndkTOHHpoomWe/4xkvHkEOncwjYIw== +"@babel/generator@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.22.15.tgz#1564189c7ec94cb8f77b5e8a90c4d200d21b2339" + integrity sha512-Zu9oWARBqeVOW0dZOjXc3JObrzuqothQ3y/n1kUtrjCoCPLkXUwMvOo/F/TCfoHMbWIFlWwpZtkZVb9ga4U2pA== dependencies: - "@babel/types" "^7.22.5" + "@babel/types" "^7.22.15" "@jridgewell/gen-mapping" "^0.3.2" "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" @@ -98,32 +99,32 @@ "@babel/types" "^7.22.5" "@babel/helper-builder-binary-assignment-operator-visitor@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.22.5.tgz#a3f4758efdd0190d8927fcffd261755937c71878" - integrity sha512-m1EP3lVOPptR+2DwD125gziZNcmoNSHGmJROKoy87loWUQyJaVXDgpmruWqDARZSmtYQ+Dl25okU8+qhVzuykw== + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.22.15.tgz#5426b109cf3ad47b91120f8328d8ab1be8b0b956" + integrity sha512-QkBXwGgaoC2GtGZRoma6kv7Szfv06khvhFav67ZExau2RaXzy8MpHSMO2PNoP2XtmQphJQRHFfg77Bq731Yizw== dependencies: - "@babel/types" "^7.22.5" + "@babel/types" "^7.22.15" -"@babel/helper-compilation-targets@^7.22.5", "@babel/helper-compilation-targets@^7.22.6", "@babel/helper-compilation-targets@^7.22.9": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.9.tgz#f9d0a7aaaa7cd32a3f31c9316a69f5a9bcacb892" - integrity sha512-7qYrNM6HjpnPHJbopxmb8hSPoZ0gsX8IvUS32JGVoy+pU9e5N0nLr1VjJoR6kA4d9dmGLxNYOjeB8sUDal2WMw== +"@babel/helper-compilation-targets@^7.22.15", "@babel/helper-compilation-targets@^7.22.5", "@babel/helper-compilation-targets@^7.22.6": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz#0698fc44551a26cf29f18d4662d5bf545a6cfc52" + integrity sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw== dependencies: "@babel/compat-data" "^7.22.9" - "@babel/helper-validator-option" "^7.22.5" + "@babel/helper-validator-option" "^7.22.15" browserslist "^4.21.9" lru-cache "^5.1.1" semver "^6.3.1" -"@babel/helper-create-class-features-plugin@^7.22.5", "@babel/helper-create-class-features-plugin@^7.22.9": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.9.tgz#c36ea240bb3348f942f08b0fbe28d6d979fab236" - integrity sha512-Pwyi89uO4YrGKxL/eNJ8lfEH55DnRloGPOseaA8NFNL6jAUnn+KccaISiFazCj5IolPPDjGSdzQzXVzODVRqUQ== +"@babel/helper-create-class-features-plugin@^7.22.11", "@babel/helper-create-class-features-plugin@^7.22.15", "@babel/helper-create-class-features-plugin@^7.22.5": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.15.tgz#97a61b385e57fe458496fad19f8e63b63c867de4" + integrity sha512-jKkwA59IXcvSaiK2UN45kKwSC9o+KuoXsBDvHvU/7BecYIp8GQ2UwrVvFgJASUT+hBnwJx6MhvMCuMzwZZ7jlg== dependencies: "@babel/helper-annotate-as-pure" "^7.22.5" "@babel/helper-environment-visitor" "^7.22.5" "@babel/helper-function-name" "^7.22.5" - "@babel/helper-member-expression-to-functions" "^7.22.5" + "@babel/helper-member-expression-to-functions" "^7.22.15" "@babel/helper-optimise-call-expression" "^7.22.5" "@babel/helper-replace-supers" "^7.22.9" "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" @@ -131,18 +132,18 @@ semver "^6.3.1" "@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.22.5": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.22.9.tgz#9d8e61a8d9366fe66198f57c40565663de0825f6" - integrity sha512-+svjVa/tFwsNSG4NEy1h85+HQ5imbT92Q5/bgtS7P0GTQlP8WuFdqsiABmQouhiFGyV66oGxZFpeYHza1rNsKw== + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.22.15.tgz#5ee90093914ea09639b01c711db0d6775e558be1" + integrity sha512-29FkPLFjn4TPEa3RE7GpW+qbE8tlsu3jntNYNfcGsc49LphF1PQIiD+vMZ1z1xVOKt+93khA9tc2JBs3kBjA7w== dependencies: "@babel/helper-annotate-as-pure" "^7.22.5" regexpu-core "^5.3.1" semver "^6.3.1" -"@babel/helper-define-polyfill-provider@^0.4.1": - version "0.4.1" - resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.1.tgz#af1429c4a83ac316a6a8c2cc8ff45cb5d2998d3a" - integrity sha512-kX4oXixDxG197yhX+J3Wp+NpL2wuCFjWQAr6yX2jtCnflK9ulMI51ULFGIrWiX1jGfvAxdHp+XQCcP2bZGPs9A== +"@babel/helper-define-polyfill-provider@^0.4.2": + version "0.4.2" + resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.2.tgz#82c825cadeeeee7aad237618ebbe8fa1710015d7" + integrity sha512-k0qnnOqHn5dK9pZpfD5XXZ9SojAITdCKRn2Lp6rnDGzIbaP0rHyMPk/4wsSxVBVz4RfN0q6VpXWP2pDGIoQ7hw== dependencies: "@babel/helper-compilation-targets" "^7.22.6" "@babel/helper-plugin-utils" "^7.22.5" @@ -170,30 +171,30 @@ dependencies: "@babel/types" "^7.22.5" -"@babel/helper-member-expression-to-functions@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.22.5.tgz#0a7c56117cad3372fbf8d2fb4bf8f8d64a1e76b2" - integrity sha512-aBiH1NKMG0H2cGZqspNvsaBe6wNGjbJjuLy29aU+eDZjSbbN53BaxlpB02xm9v34pLTZ1nIQPFYn2qMZoa5BQQ== +"@babel/helper-member-expression-to-functions@^7.22.15", "@babel/helper-member-expression-to-functions@^7.22.5": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.22.15.tgz#b95a144896f6d491ca7863576f820f3628818621" + integrity sha512-qLNsZbgrNh0fDQBCPocSL8guki1hcPvltGDv/NxvUoABwFq7GkKSu1nRXeJkVZc+wJvne2E0RKQz+2SQrz6eAA== dependencies: - "@babel/types" "^7.22.5" + "@babel/types" "^7.22.15" -"@babel/helper-module-imports@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.5.tgz#1a8f4c9f4027d23f520bd76b364d44434a72660c" - integrity sha512-8Dl6+HD/cKifutF5qGd/8ZJi84QeAKh+CEe1sBzz8UayBBGg1dAIJrdHOcOM5b2MpzWL2yuotJTtGjETq0qjXg== +"@babel/helper-module-imports@^7.22.15", "@babel/helper-module-imports@^7.22.5": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz#16146307acdc40cc00c3b2c647713076464bdbf0" + integrity sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w== dependencies: - "@babel/types" "^7.22.5" + "@babel/types" "^7.22.15" -"@babel/helper-module-transforms@^7.22.5", "@babel/helper-module-transforms@^7.22.9": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.22.9.tgz#92dfcb1fbbb2bc62529024f72d942a8c97142129" - integrity sha512-t+WA2Xn5K+rTeGtC8jCsdAH52bjggG5TKRuRrAGNM/mjIbO4GxvlLMFOEz9wXY5I2XQ60PMFsAG2WIcG82dQMQ== +"@babel/helper-module-transforms@^7.22.15", "@babel/helper-module-transforms@^7.22.5", "@babel/helper-module-transforms@^7.22.9": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.22.15.tgz#40ad2f6950f143900e9c1c72363c0b431a606082" + integrity sha512-l1UiX4UyHSFsYt17iQ3Se5pQQZZHa22zyIXURmvkmLCD4t/aU+dvNWHatKac/D9Vm9UES7nvIqHs4jZqKviUmQ== dependencies: "@babel/helper-environment-visitor" "^7.22.5" - "@babel/helper-module-imports" "^7.22.5" + "@babel/helper-module-imports" "^7.22.15" "@babel/helper-simple-access" "^7.22.5" "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/helper-validator-identifier" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.15" "@babel/helper-optimise-call-expression@^7.22.5": version "7.22.5" @@ -207,7 +208,7 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz#dd7ee3735e8a313b9f7b05a773d892e88e6d7295" integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg== -"@babel/helper-remap-async-to-generator@^7.22.5": +"@babel/helper-remap-async-to-generator@^7.22.5", "@babel/helper-remap-async-to-generator@^7.22.9": version "7.22.9" resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.22.9.tgz#53a25b7484e722d7efb9c350c75c032d4628de82" integrity sha512-8WWC4oR4Px+tr+Fp0X3RHDVfINGpF3ad1HIbrc8A77epiR6eMMc6jsgozkzT2uDiOOdoS9cLIQ+XD2XvI2WSmQ== @@ -251,77 +252,69 @@ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== -"@babel/helper-validator-identifier@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz#9544ef6a33999343c8740fa51350f30eeaaaf193" - integrity sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ== +"@babel/helper-validator-identifier@^7.22.15", "@babel/helper-validator-identifier@^7.22.5": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.15.tgz#601fa28e4cc06786c18912dca138cec73b882044" + integrity sha512-4E/F9IIEi8WR94324mbDUMo074YTheJmd7eZF5vITTeYchqAi6sYXRLHUVsmkdmY4QjfKTcB2jB7dVP3NaBElQ== -"@babel/helper-validator-option@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz#de52000a15a177413c8234fa3a8af4ee8102d0ac" - integrity sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw== +"@babel/helper-validator-option@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz#694c30dfa1d09a6534cdfcafbe56789d36aba040" + integrity sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA== "@babel/helper-wrap-function@^7.22.9": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.22.9.tgz#189937248c45b0182c1dcf32f3444ca153944cb9" - integrity sha512-sZ+QzfauuUEfxSEjKFmi3qDSHgLsTPK/pEpoD/qonZKOtTPTLbf59oabPQ4rKekt9lFcj/hTZaOhWwFYrgjk+Q== + version "7.22.10" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.22.10.tgz#d845e043880ed0b8c18bd194a12005cb16d2f614" + integrity sha512-OnMhjWjuGYtdoO3FmsEFWvBStBAe2QOgwOLsLNDjN+aaiMD8InJk1/O3HSD8lkqTjCgg5YI34Tz15KNNA3p+nQ== dependencies: "@babel/helper-function-name" "^7.22.5" "@babel/template" "^7.22.5" - "@babel/types" "^7.22.5" + "@babel/types" "^7.22.10" -"@babel/helpers@^7.22.6": - version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.22.6.tgz#8e61d3395a4f0c5a8060f309fb008200969b5ecd" - integrity sha512-YjDs6y/fVOYFV8hAf1rxd1QvR9wJe1pDBZ2AREKq/SDayfPzgk0PBnVuTCE5X1acEpMMNOVUqoe+OwiZGJ+OaA== +"@babel/helpers@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.22.15.tgz#f09c3df31e86e3ea0b7ff7556d85cdebd47ea6f1" + integrity sha512-7pAjK0aSdxOwR+CcYAqgWOGy5dcfvzsTIfFTb2odQqW47MDfv14UaJDY6eng8ylM2EaeKXdxaSWESbkmaQHTmw== dependencies: - "@babel/template" "^7.22.5" - "@babel/traverse" "^7.22.6" - "@babel/types" "^7.22.5" + "@babel/template" "^7.22.15" + "@babel/traverse" "^7.22.15" + "@babel/types" "^7.22.15" -"@babel/highlight@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.5.tgz#aa6c05c5407a67ebce408162b7ede789b4d22031" - integrity sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw== +"@babel/highlight@^7.22.13": + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.13.tgz#9cda839e5d3be9ca9e8c26b6dd69e7548f0cbf16" + integrity sha512-C/BaXcnnvBCmHTpz/VGZ8jgtE2aYlW4hxDhseJAWZb7gqGM/qtCK6iZUb0TyKFf7BOUsBH7Q7fkRsDRhg1XklQ== dependencies: "@babel/helper-validator-identifier" "^7.22.5" - chalk "^2.0.0" + chalk "^2.4.2" js-tokens "^4.0.0" -"@babel/parser@^7.14.7", "@babel/parser@^7.20.15", "@babel/parser@^7.22.5", "@babel/parser@^7.22.7": - version "7.22.7" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.7.tgz#df8cf085ce92ddbdbf668a7f186ce848c9036cae" - integrity sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q== +"@babel/parser@^7.14.7", "@babel/parser@^7.20.15", "@babel/parser@^7.22.15": + version "7.22.16" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.16.tgz#180aead7f247305cce6551bea2720934e2fa2c95" + integrity sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA== -"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.22.5.tgz#87245a21cd69a73b0b81bcda98d443d6df08f05e" - integrity sha512-NP1M5Rf+u2Gw9qfSO4ihjcTGW5zXTi36ITLd4/EoAcEhIZ0yjMqmftDNl3QC19CX7olhrjpyU454g/2W7X0jvQ== +"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.22.15.tgz#02dc8a03f613ed5fdc29fb2f728397c78146c962" + integrity sha512-FB9iYlz7rURmRJyXRKEnalYPPdn87H5no108cyuQQyMwlpJ2SJtpIUBI27kdTin956pz+LPypkPVPUTlxOmrsg== dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.22.5.tgz#fef09f9499b1f1c930da8a0c419db42167d792ca" - integrity sha512-31Bb65aZaUwqCbWMnZPduIZxCBngHFlzyN6Dq6KAJjtx+lx6ohKHubc61OomYi7XwVD4Ol0XCVz4h+pYFR048g== +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.22.15.tgz#2aeb91d337d4e1a1e7ce85b76a37f5301781200f" + integrity sha512-Hyph9LseGvAeeXzikV88bczhsrLrIZqDPxO+sSmAunMPaGrBGhfMWzCPYTtiW9t+HzSE2wtV8e5cc5P6r1xMDQ== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" - "@babel/plugin-transform-optional-chaining" "^7.22.5" + "@babel/plugin-transform-optional-chaining" "^7.22.15" "@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2": version "7.21.0-placeholder-for-preset-env.2" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz#7844f9289546efa9febac2de4cfe358a050bd703" integrity sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w== -"@babel/plugin-proposal-unicode-property-regex@^7.4.4": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.18.6.tgz#af613d2cd5e643643b65cded64207b15c85cb78e" - integrity sha512-2BShG/d5yoZyXZfVePH91urL5wTG6ASZU9M4o03lKK8u8UW1y08OMttBSOADTcJrnPMpvDXRG3G8fyLh4ovs8w== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" @@ -470,14 +463,14 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-async-generator-functions@^7.22.7": - version "7.22.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.22.7.tgz#053e76c0a903b72b573cb1ab7d6882174d460a1b" - integrity sha512-7HmE7pk/Fmke45TODvxvkxRMV9RazV+ZZzhOL9AG8G29TLrr3jkjwF7uJfxZ30EoXpO+LJkq4oA8NjO2DTnEDg== +"@babel/plugin-transform-async-generator-functions@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.22.15.tgz#3b153af4a6b779f340d5b80d3f634f55820aefa3" + integrity sha512-jBm1Es25Y+tVoTi5rfd5t1KLmL8ogLKpXszboWOTTtGFGz2RKnQe2yn7HbZ+kb/B8N0FVSGQo874NSlOU1T4+w== dependencies: "@babel/helper-environment-visitor" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" - "@babel/helper-remap-async-to-generator" "^7.22.5" + "@babel/helper-remap-async-to-generator" "^7.22.9" "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-transform-async-to-generator@^7.22.5": @@ -496,10 +489,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-block-scoping@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.22.5.tgz#8bfc793b3a4b2742c0983fadc1480d843ecea31b" - integrity sha512-EcACl1i5fSQ6bt+YGuU/XGCeZKStLmyVGytWkpyhCLeQVA0eu6Wtiw92V+I1T/hnezUv7j74dA/Ro69gWcU+hg== +"@babel/plugin-transform-block-scoping@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.22.15.tgz#494eb82b87b5f8b1d8f6f28ea74078ec0a10a841" + integrity sha512-G1czpdJBZCtngoK1sJgloLiOHUnkb/bLZwqVZD8kXmq0ZnVfTTWUcs9OWtp0mBtYJ+4LQY1fllqBkOIPhXmFmw== dependencies: "@babel/helper-plugin-utils" "^7.22.5" @@ -511,27 +504,27 @@ "@babel/helper-create-class-features-plugin" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-class-static-block@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.22.5.tgz#3e40c46f048403472d6f4183116d5e46b1bff5ba" - integrity sha512-SPToJ5eYZLxlnp1UzdARpOGeC2GbHvr9d/UV0EukuVx8atktg194oe+C5BqQ8jRTkgLRVOPYeXRSBg1IlMoVRA== +"@babel/plugin-transform-class-static-block@^7.22.11": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.22.11.tgz#dc8cc6e498f55692ac6b4b89e56d87cec766c974" + integrity sha512-GMM8gGmqI7guS/llMFk1bJDkKfn3v3C4KHK9Yg1ey5qcHcOlKb0QvcMrgzvxo+T03/4szNh5lghY+fEC98Kq9g== dependencies: - "@babel/helper-create-class-features-plugin" "^7.22.5" + "@babel/helper-create-class-features-plugin" "^7.22.11" "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-class-static-block" "^7.14.5" -"@babel/plugin-transform-classes@^7.22.6": - version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.22.6.tgz#e04d7d804ed5b8501311293d1a0e6d43e94c3363" - integrity sha512-58EgM6nuPNG6Py4Z3zSuu0xWu2VfodiMi72Jt5Kj2FECmaYk1RrTXA45z6KBFsu9tRgwQDwIiY4FXTt+YsSFAQ== +"@babel/plugin-transform-classes@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.22.15.tgz#aaf4753aee262a232bbc95451b4bdf9599c65a0b" + integrity sha512-VbbC3PGjBdE0wAWDdHM9G8Gm977pnYI0XpqMd6LrKISj8/DJXEsWqgRuTYaNE9Bv0JGhTZUzHDlMk18IpOuoqw== dependencies: "@babel/helper-annotate-as-pure" "^7.22.5" - "@babel/helper-compilation-targets" "^7.22.6" + "@babel/helper-compilation-targets" "^7.22.15" "@babel/helper-environment-visitor" "^7.22.5" "@babel/helper-function-name" "^7.22.5" "@babel/helper-optimise-call-expression" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" - "@babel/helper-replace-supers" "^7.22.5" + "@babel/helper-replace-supers" "^7.22.9" "@babel/helper-split-export-declaration" "^7.22.6" globals "^11.1.0" @@ -543,14 +536,14 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/template" "^7.22.5" -"@babel/plugin-transform-destructuring@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.22.5.tgz#d3aca7438f6c26c78cdd0b0ba920a336001b27cc" - integrity sha512-GfqcFuGW8vnEqTUBM7UtPd5A4q797LTvvwKxXTgRsFjoqaJiEg9deBG6kWeQYkVEL569NpnmpC0Pkr/8BLKGnQ== +"@babel/plugin-transform-destructuring@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.22.15.tgz#e7404ea5bb3387073b9754be654eecb578324694" + integrity sha512-HzG8sFl1ZVGTme74Nw+X01XsUTqERVQ6/RLHo3XjGRzm7XD6QTtfS3NJotVgCGy8BzkDqRjRBD8dAyJn5TuvSQ== dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-dotall-regex@^7.22.5", "@babel/plugin-transform-dotall-regex@^7.4.4": +"@babel/plugin-transform-dotall-regex@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.22.5.tgz#dbb4f0e45766eb544e193fb00e65a1dd3b2a4165" integrity sha512-5/Yk9QxCQCl+sOIB1WelKnVRxTJDSAIxtJLL2/pqL14ZVlbH0fUQUZa/T5/UnQtBNgghR7mfB8ERBKyKPCi7Vw== @@ -565,10 +558,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-dynamic-import@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.22.5.tgz#d6908a8916a810468c4edff73b5b75bda6ad393e" - integrity sha512-0MC3ppTB1AMxd8fXjSrbPa7LT9hrImt+/fcj+Pg5YMD7UQyWp/02+JWpdnCymmsXwIx5Z+sYn1bwCn4ZJNvhqQ== +"@babel/plugin-transform-dynamic-import@^7.22.11": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.22.11.tgz#2c7722d2a5c01839eaf31518c6ff96d408e447aa" + integrity sha512-g/21plo58sfteWjaO0ZNVb+uEOkJNjAaHhbejrnBmu011l/eNDScmkbjCC3l4FKb10ViaGU4aOkFznSu2zRHgA== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-dynamic-import" "^7.8.3" @@ -581,18 +574,18 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-export-namespace-from@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.22.5.tgz#57c41cb1d0613d22f548fddd8b288eedb9973a5b" - integrity sha512-X4hhm7FRnPgd4nDA4b/5V280xCx6oL7Oob5+9qVS5C13Zq4bh1qq7LU0GgRU6b5dBWBvhGaXYVB4AcN6+ol6vg== +"@babel/plugin-transform-export-namespace-from@^7.22.11": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.22.11.tgz#b3c84c8f19880b6c7440108f8929caf6056db26c" + integrity sha512-xa7aad7q7OiT8oNZ1mU7NrISjlSkVdMbNxn9IuLZyL9AJEhs1Apba3I+u5riX1dIkdptP5EKDG5XDPByWxtehw== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-export-namespace-from" "^7.8.3" -"@babel/plugin-transform-for-of@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.22.5.tgz#ab1b8a200a8f990137aff9a084f8de4099ab173f" - integrity sha512-3kxQjX1dU9uudwSshyLeEipvrLjBCVthCgeTp6CzE/9JYrlAIaeekVxRpCWsDDfYTfRZRoCeZatCQvwo+wvK8A== +"@babel/plugin-transform-for-of@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.22.15.tgz#f64b4ccc3a4f131a996388fae7680b472b306b29" + integrity sha512-me6VGeHsx30+xh9fbDLLPi0J1HzmeIIyenoOQHuw2D4m2SAU3NrspX5XxJLBpqn5yrLzrlw2Iy3RA//Bx27iOA== dependencies: "@babel/helper-plugin-utils" "^7.22.5" @@ -605,10 +598,10 @@ "@babel/helper-function-name" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-json-strings@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.22.5.tgz#14b64352fdf7e1f737eed68de1a1468bd2a77ec0" - integrity sha512-DuCRB7fu8MyTLbEQd1ew3R85nx/88yMoqo2uPSjevMj3yoN7CDM8jkgrY0wmVxfJZyJ/B9fE1iq7EQppWQmR5A== +"@babel/plugin-transform-json-strings@^7.22.11": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.22.11.tgz#689a34e1eed1928a40954e37f74509f48af67835" + integrity sha512-CxT5tCqpA9/jXFlme9xIBCc5RPtdDq3JpkkhgHQqtDdiTnTI0jtZ0QzXhr5DILeYifDPp2wvY2ad+7+hLMW5Pw== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-json-strings" "^7.8.3" @@ -620,10 +613,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-logical-assignment-operators@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.22.5.tgz#66ae5f068fd5a9a5dc570df16f56c2a8462a9d6c" - integrity sha512-MQQOUW1KL8X0cDWfbwYP+TbVbZm16QmQXJQ+vndPtH/BoO0lOKpVoEDMI7+PskYxH+IiE0tS8xZye0qr1lGzSA== +"@babel/plugin-transform-logical-assignment-operators@^7.22.11": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.22.11.tgz#24c522a61688bde045b7d9bc3c2597a4d948fc9c" + integrity sha512-qQwRTP4+6xFCDV5k7gZBF3C31K34ut0tbEcTKxlX/0KXxm9GLcO14p570aWxFvVzx6QAfPgq7gaeIHXJC8LswQ== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" @@ -643,22 +636,22 @@ "@babel/helper-module-transforms" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-modules-commonjs@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.22.5.tgz#7d9875908d19b8c0536085af7b053fd5bd651bfa" - integrity sha512-B4pzOXj+ONRmuaQTg05b3y/4DuFz3WcCNAXPLb2Q0GT0TrGKGxNKV4jwsXts+StaM0LQczZbOpj8o1DLPDJIiA== +"@babel/plugin-transform-modules-commonjs@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.22.15.tgz#b11810117ed4ee7691b29bd29fd9f3f98276034f" + integrity sha512-jWL4eh90w0HQOTKP2MoXXUpVxilxsB2Vl4ji69rSjS3EcZ/v4sBmn+A3NpepuJzBhOaEBbR7udonlHHn5DWidg== dependencies: - "@babel/helper-module-transforms" "^7.22.5" + "@babel/helper-module-transforms" "^7.22.15" "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-simple-access" "^7.22.5" -"@babel/plugin-transform-modules-systemjs@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.22.5.tgz#18c31410b5e579a0092638f95c896c2a98a5d496" - integrity sha512-emtEpoaTMsOs6Tzz+nbmcePl6AKVtS1yC4YNAeMun9U8YCsgadPNxnOPQ8GhHFB2qdx+LZu9LgoC0Lthuu05DQ== +"@babel/plugin-transform-modules-systemjs@^7.22.11": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.22.11.tgz#3386be5875d316493b517207e8f1931d93154bb1" + integrity sha512-rIqHmHoMEOhI3VkVf5jQ15l539KrwhzqcBO6wdCNWPWc/JWt9ILNYNUssbRpeq0qWns8svuw8LnMNCvWBIJ8wA== dependencies: "@babel/helper-hoist-variables" "^7.22.5" - "@babel/helper-module-transforms" "^7.22.5" + "@babel/helper-module-transforms" "^7.22.9" "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-validator-identifier" "^7.22.5" @@ -685,32 +678,32 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-nullish-coalescing-operator@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.22.5.tgz#f8872c65776e0b552e0849d7596cddd416c3e381" - integrity sha512-6CF8g6z1dNYZ/VXok5uYkkBBICHZPiGEl7oDnAx2Mt1hlHVHOSIKWJaXHjQJA5VB43KZnXZDIexMchY4y2PGdA== +"@babel/plugin-transform-nullish-coalescing-operator@^7.22.11": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.22.11.tgz#debef6c8ba795f5ac67cd861a81b744c5d38d9fc" + integrity sha512-YZWOw4HxXrotb5xsjMJUDlLgcDXSfO9eCmdl1bgW4+/lAGdkjaEvOnQ4p5WKKdUgSzO39dgPl0pTnfxm0OAXcg== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" -"@babel/plugin-transform-numeric-separator@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.22.5.tgz#57226a2ed9e512b9b446517ab6fa2d17abb83f58" - integrity sha512-NbslED1/6M+sXiwwtcAB/nieypGw02Ejf4KtDeMkCEpP6gWFMX1wI9WKYua+4oBneCCEmulOkRpwywypVZzs/g== +"@babel/plugin-transform-numeric-separator@^7.22.11": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.22.11.tgz#498d77dc45a6c6db74bb829c02a01c1d719cbfbd" + integrity sha512-3dzU4QGPsILdJbASKhF/V2TVP+gJya1PsueQCxIPCEcerqF21oEcrob4mzjsp2Py/1nLfF5m+xYNMDpmA8vffg== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-numeric-separator" "^7.10.4" -"@babel/plugin-transform-object-rest-spread@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.22.5.tgz#9686dc3447df4753b0b2a2fae7e8bc33cdc1f2e1" - integrity sha512-Kk3lyDmEslH9DnvCDA1s1kkd3YWQITiBOHngOtDL9Pt6BZjzqb6hiOlb8VfjiiQJ2unmegBqZu0rx5RxJb5vmQ== +"@babel/plugin-transform-object-rest-spread@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.22.15.tgz#21a95db166be59b91cde48775310c0df6e1da56f" + integrity sha512-fEB+I1+gAmfAyxZcX1+ZUwLeAuuf8VIg67CTznZE0MqVFumWkh8xWtn58I4dxdVf080wn7gzWoF8vndOViJe9Q== dependencies: - "@babel/compat-data" "^7.22.5" - "@babel/helper-compilation-targets" "^7.22.5" + "@babel/compat-data" "^7.22.9" + "@babel/helper-compilation-targets" "^7.22.15" "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-transform-parameters" "^7.22.5" + "@babel/plugin-transform-parameters" "^7.22.15" "@babel/plugin-transform-object-super@^7.22.5": version "7.22.5" @@ -720,27 +713,27 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-replace-supers" "^7.22.5" -"@babel/plugin-transform-optional-catch-binding@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.22.5.tgz#842080be3076703be0eaf32ead6ac8174edee333" - integrity sha512-pH8orJahy+hzZje5b8e2QIlBWQvGpelS76C63Z+jhZKsmzfNaPQ+LaW6dcJ9bxTpo1mtXbgHwy765Ro3jftmUg== +"@babel/plugin-transform-optional-catch-binding@^7.22.11": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.22.11.tgz#461cc4f578a127bb055527b3e77404cad38c08e0" + integrity sha512-rli0WxesXUeCJnMYhzAglEjLWVDF6ahb45HuprcmQuLidBJFWjNnOzssk2kuc6e33FlLaiZhG/kUIzUMWdBKaQ== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" -"@babel/plugin-transform-optional-chaining@^7.22.5", "@babel/plugin-transform-optional-chaining@^7.22.6": - version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.22.6.tgz#4bacfe37001fe1901117672875e931d439811564" - integrity sha512-Vd5HiWml0mDVtcLHIoEU5sw6HOUW/Zk0acLs/SAeuLzkGNOPc9DB4nkUajemhCmTIz3eiaKREZn2hQQqF79YTg== +"@babel/plugin-transform-optional-chaining@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.22.15.tgz#d7a5996c2f7ca4ad2ad16dbb74444e5c4385b1ba" + integrity sha512-ngQ2tBhq5vvSJw2Q2Z9i7ealNkpDMU0rGWnHPKqRZO0tzZ5tlaoz4hDvhXioOoaE0X2vfNss1djwg0DXlfu30A== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" "@babel/plugin-syntax-optional-chaining" "^7.8.3" -"@babel/plugin-transform-parameters@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.22.5.tgz#c3542dd3c39b42c8069936e48717a8d179d63a18" - integrity sha512-AVkFUBurORBREOmHRKo06FjHYgjrabpdqRSwq6+C7R5iTCZOsM4QbcB27St0a4U6fffyAOqh3s/qEfybAhfivg== +"@babel/plugin-transform-parameters@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.22.15.tgz#719ca82a01d177af358df64a514d64c2e3edb114" + integrity sha512-hjk7qKIqhyzhhUvRT683TYQOFa/4cQKwQy7ALvTpODswN40MljzNDa0YldevS6tGbxwaEKVn502JmY0dP7qEtQ== dependencies: "@babel/helper-plugin-utils" "^7.22.5" @@ -752,13 +745,13 @@ "@babel/helper-create-class-features-plugin" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-private-property-in-object@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.22.5.tgz#07a77f28cbb251546a43d175a1dda4cf3ef83e32" - integrity sha512-/9xnaTTJcVoBtSSmrVyhtSvO3kbqS2ODoh2juEU72c3aYonNF0OMGiaz2gjukyKM2wBBYJP38S4JiE0Wfb5VMQ== +"@babel/plugin-transform-private-property-in-object@^7.22.11": + version "7.22.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.22.11.tgz#ad45c4fc440e9cb84c718ed0906d96cf40f9a4e1" + integrity sha512-sSCbqZDBKHetvjSwpyWzhuHkmW5RummxJBVbYLkGkaiTOWGxml7SXt0iWa03bzxFIx7wOj3g/ILRd0RcJKBeSQ== dependencies: "@babel/helper-annotate-as-pure" "^7.22.5" - "@babel/helper-create-class-features-plugin" "^7.22.5" + "@babel/helper-create-class-features-plugin" "^7.22.11" "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-private-property-in-object" "^7.14.5" @@ -769,13 +762,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-regenerator@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.22.5.tgz#cd8a68b228a5f75fa01420e8cc2fc400f0fc32aa" - integrity sha512-rR7KePOE7gfEtNTh9Qw+iO3Q/e4DEsoQ+hdvM6QUDH7JRJ5qxq5AA52ZzBWbI5i9lfNuvySgOGP8ZN7LAmaiPw== +"@babel/plugin-transform-regenerator@^7.22.10": + version "7.22.10" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.22.10.tgz#8ceef3bd7375c4db7652878b0241b2be5d0c3cca" + integrity sha512-F28b1mDt8KcT5bUyJc/U9nwzw6cV+UmTeRlXYIl2TNqMMJif0Jeey9/RQ3C4NOd2zp0/TRsDns9ttj2L523rsw== dependencies: "@babel/helper-plugin-utils" "^7.22.5" - regenerator-transform "^0.15.1" + regenerator-transform "^0.15.2" "@babel/plugin-transform-reserved-words@^7.22.5": version "7.22.5" @@ -820,20 +813,20 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-typescript@^7.22.5": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.22.9.tgz#91e08ad1eb1028ecc62662a842e93ecfbf3c7234" - integrity sha512-BnVR1CpKiuD0iobHPaM1iLvcwPYN2uVFAqoLVSpEDKWuOikoCv5HbKLxclhKYUXlWkX86DoZGtqI4XhbOsyrMg== +"@babel/plugin-transform-typescript@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.22.15.tgz#15adef906451d86349eb4b8764865c960eb54127" + integrity sha512-1uirS0TnijxvQLnlv5wQBwOX3E1wCFX7ITv+9pBV2wKEk4K+M5tqDaoNXnTH8tjEIYHLO98MwiTWO04Ggz4XuA== dependencies: "@babel/helper-annotate-as-pure" "^7.22.5" - "@babel/helper-create-class-features-plugin" "^7.22.9" + "@babel/helper-create-class-features-plugin" "^7.22.15" "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-typescript" "^7.22.5" -"@babel/plugin-transform-unicode-escapes@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.22.5.tgz#ce0c248522b1cb22c7c992d88301a5ead70e806c" - integrity sha512-biEmVg1IYB/raUO5wT1tgfacCef15Fbzhkx493D3urBI++6hpJ+RFG4SrWMn0NEZLfvilqKf3QDrRVZHo08FYg== +"@babel/plugin-transform-unicode-escapes@^7.22.10": + version "7.22.10" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.22.10.tgz#c723f380f40a2b2f57a62df24c9005834c8616d9" + integrity sha512-lRfaRKGZCBqDlRU3UIFovdp9c9mEvlylmpod0/OatICsSfuQ9YFthRo1tpTkGsklEefZdqlEFdY4A2dwTb6ohg== dependencies: "@babel/helper-plugin-utils" "^7.22.5" @@ -861,17 +854,17 @@ "@babel/helper-create-regexp-features-plugin" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/preset-env@^7.22.7": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.22.9.tgz#57f17108eb5dfd4c5c25a44c1977eba1df310ac7" - integrity sha512-wNi5H/Emkhll/bqPjsjQorSykrlfY5OWakd6AulLvMEytpKasMVUpVy8RL4qBIBs5Ac6/5i0/Rv0b/Fg6Eag/g== +"@babel/preset-env@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.22.15.tgz#142716f8e00bc030dae5b2ac6a46fbd8b3e18ff8" + integrity sha512-tZFHr54GBkHk6hQuVA8w4Fmq+MSPsfvMG0vPnOYyTnJpyfMqybL8/MbNCPRT9zc2KBO2pe4tq15g6Uno4Jpoag== dependencies: "@babel/compat-data" "^7.22.9" - "@babel/helper-compilation-targets" "^7.22.9" + "@babel/helper-compilation-targets" "^7.22.15" "@babel/helper-plugin-utils" "^7.22.5" - "@babel/helper-validator-option" "^7.22.5" - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.22.5" - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.22.5" + "@babel/helper-validator-option" "^7.22.15" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.22.15" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.22.15" "@babel/plugin-proposal-private-property-in-object" "7.21.0-placeholder-for-preset-env.2" "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-class-properties" "^7.12.13" @@ -892,87 +885,85 @@ "@babel/plugin-syntax-top-level-await" "^7.14.5" "@babel/plugin-syntax-unicode-sets-regex" "^7.18.6" "@babel/plugin-transform-arrow-functions" "^7.22.5" - "@babel/plugin-transform-async-generator-functions" "^7.22.7" + "@babel/plugin-transform-async-generator-functions" "^7.22.15" "@babel/plugin-transform-async-to-generator" "^7.22.5" "@babel/plugin-transform-block-scoped-functions" "^7.22.5" - "@babel/plugin-transform-block-scoping" "^7.22.5" + "@babel/plugin-transform-block-scoping" "^7.22.15" "@babel/plugin-transform-class-properties" "^7.22.5" - "@babel/plugin-transform-class-static-block" "^7.22.5" - "@babel/plugin-transform-classes" "^7.22.6" + "@babel/plugin-transform-class-static-block" "^7.22.11" + "@babel/plugin-transform-classes" "^7.22.15" "@babel/plugin-transform-computed-properties" "^7.22.5" - "@babel/plugin-transform-destructuring" "^7.22.5" + "@babel/plugin-transform-destructuring" "^7.22.15" "@babel/plugin-transform-dotall-regex" "^7.22.5" "@babel/plugin-transform-duplicate-keys" "^7.22.5" - "@babel/plugin-transform-dynamic-import" "^7.22.5" + "@babel/plugin-transform-dynamic-import" "^7.22.11" "@babel/plugin-transform-exponentiation-operator" "^7.22.5" - "@babel/plugin-transform-export-namespace-from" "^7.22.5" - "@babel/plugin-transform-for-of" "^7.22.5" + "@babel/plugin-transform-export-namespace-from" "^7.22.11" + "@babel/plugin-transform-for-of" "^7.22.15" "@babel/plugin-transform-function-name" "^7.22.5" - "@babel/plugin-transform-json-strings" "^7.22.5" + "@babel/plugin-transform-json-strings" "^7.22.11" "@babel/plugin-transform-literals" "^7.22.5" - "@babel/plugin-transform-logical-assignment-operators" "^7.22.5" + "@babel/plugin-transform-logical-assignment-operators" "^7.22.11" "@babel/plugin-transform-member-expression-literals" "^7.22.5" "@babel/plugin-transform-modules-amd" "^7.22.5" - "@babel/plugin-transform-modules-commonjs" "^7.22.5" - "@babel/plugin-transform-modules-systemjs" "^7.22.5" + "@babel/plugin-transform-modules-commonjs" "^7.22.15" + "@babel/plugin-transform-modules-systemjs" "^7.22.11" "@babel/plugin-transform-modules-umd" "^7.22.5" "@babel/plugin-transform-named-capturing-groups-regex" "^7.22.5" "@babel/plugin-transform-new-target" "^7.22.5" - "@babel/plugin-transform-nullish-coalescing-operator" "^7.22.5" - "@babel/plugin-transform-numeric-separator" "^7.22.5" - "@babel/plugin-transform-object-rest-spread" "^7.22.5" + "@babel/plugin-transform-nullish-coalescing-operator" "^7.22.11" + "@babel/plugin-transform-numeric-separator" "^7.22.11" + "@babel/plugin-transform-object-rest-spread" "^7.22.15" "@babel/plugin-transform-object-super" "^7.22.5" - "@babel/plugin-transform-optional-catch-binding" "^7.22.5" - "@babel/plugin-transform-optional-chaining" "^7.22.6" - "@babel/plugin-transform-parameters" "^7.22.5" + "@babel/plugin-transform-optional-catch-binding" "^7.22.11" + "@babel/plugin-transform-optional-chaining" "^7.22.15" + "@babel/plugin-transform-parameters" "^7.22.15" "@babel/plugin-transform-private-methods" "^7.22.5" - "@babel/plugin-transform-private-property-in-object" "^7.22.5" + "@babel/plugin-transform-private-property-in-object" "^7.22.11" "@babel/plugin-transform-property-literals" "^7.22.5" - "@babel/plugin-transform-regenerator" "^7.22.5" + "@babel/plugin-transform-regenerator" "^7.22.10" "@babel/plugin-transform-reserved-words" "^7.22.5" "@babel/plugin-transform-shorthand-properties" "^7.22.5" "@babel/plugin-transform-spread" "^7.22.5" "@babel/plugin-transform-sticky-regex" "^7.22.5" "@babel/plugin-transform-template-literals" "^7.22.5" "@babel/plugin-transform-typeof-symbol" "^7.22.5" - "@babel/plugin-transform-unicode-escapes" "^7.22.5" + "@babel/plugin-transform-unicode-escapes" "^7.22.10" "@babel/plugin-transform-unicode-property-regex" "^7.22.5" "@babel/plugin-transform-unicode-regex" "^7.22.5" "@babel/plugin-transform-unicode-sets-regex" "^7.22.5" - "@babel/preset-modules" "^0.1.5" - "@babel/types" "^7.22.5" - babel-plugin-polyfill-corejs2 "^0.4.4" - babel-plugin-polyfill-corejs3 "^0.8.2" - babel-plugin-polyfill-regenerator "^0.5.1" + "@babel/preset-modules" "0.1.6-no-external-plugins" + "@babel/types" "^7.22.15" + babel-plugin-polyfill-corejs2 "^0.4.5" + babel-plugin-polyfill-corejs3 "^0.8.3" + babel-plugin-polyfill-regenerator "^0.5.2" core-js-compat "^3.31.0" semver "^6.3.1" -"@babel/preset-modules@^0.1.5": - version "0.1.5" - resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.5.tgz#ef939d6e7f268827e1841638dc6ff95515e115d9" - integrity sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA== +"@babel/preset-modules@0.1.6-no-external-plugins": + version "0.1.6-no-external-plugins" + resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz#ccb88a2c49c817236861fee7826080573b8a923a" + integrity sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" - "@babel/plugin-transform-dotall-regex" "^7.4.4" "@babel/types" "^7.4.4" esutils "^2.0.2" -"@babel/preset-typescript@^7.21.4": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.22.5.tgz#16367d8b01d640e9a507577ed4ee54e0101e51c8" - integrity sha512-YbPaal9LxztSGhmndR46FmAbkJ/1fAsw293tSU+I5E5h+cnJ3d4GTwyUgGYmOXJYdGA+uNePle4qbaRzj2NISQ== +"@babel/preset-typescript@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.22.15.tgz#43db30516fae1d417d748105a0bc95f637239d48" + integrity sha512-HblhNmh6yM+cU4VwbBRpxFhxsTdfS1zsvH9W+gEjD0ARV9+8B4sNfpI6GuhePti84nuvhiwKS539jKPFHskA9A== dependencies: "@babel/helper-plugin-utils" "^7.22.5" - "@babel/helper-validator-option" "^7.22.5" + "@babel/helper-validator-option" "^7.22.15" "@babel/plugin-syntax-jsx" "^7.22.5" - "@babel/plugin-transform-modules-commonjs" "^7.22.5" - "@babel/plugin-transform-typescript" "^7.22.5" + "@babel/plugin-transform-modules-commonjs" "^7.22.15" + "@babel/plugin-transform-typescript" "^7.22.15" -"@babel/register@^7.21.0": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.22.5.tgz#e4d8d0f615ea3233a27b5c6ada6750ee59559939" - integrity sha512-vV6pm/4CijSQ8Y47RH5SopXzursN35RQINfGJkmOlcpAtGuf94miFvIPhCKGQN7WGIcsgG1BHEX2KVdTYwTwUQ== +"@babel/register@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.22.15.tgz#c2c294a361d59f5fa7bcc8b97ef7319c32ecaec7" + integrity sha512-V3Q3EqoQdn65RCgTLwauZaTfd1ShhwPmbBv+1dkZV/HpCGMKVyn6oFcRlI7RaKqiDQjX2Qd3AuoEguBgdjIKlg== dependencies: clone-deep "^4.0.1" find-cache-dir "^2.0.0" @@ -986,44 +977,44 @@ integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== "@babel/runtime@^7.8.4": - version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.6.tgz#57d64b9ae3cff1d67eb067ae117dac087f5bd438" - integrity sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ== + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.15.tgz#38f46494ccf6cf020bd4eed7124b425e83e523b8" + integrity sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA== dependencies: - regenerator-runtime "^0.13.11" + regenerator-runtime "^0.14.0" -"@babel/template@^7.22.5": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.5.tgz#0c8c4d944509875849bd0344ff0050756eefc6ec" - integrity sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw== +"@babel/template@^7.22.15", "@babel/template@^7.22.5": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" + integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== dependencies: - "@babel/code-frame" "^7.22.5" - "@babel/parser" "^7.22.5" - "@babel/types" "^7.22.5" + "@babel/code-frame" "^7.22.13" + "@babel/parser" "^7.22.15" + "@babel/types" "^7.22.15" -"@babel/traverse@^7.22.6", "@babel/traverse@^7.22.8": - version "7.22.8" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.8.tgz#4d4451d31bc34efeae01eac222b514a77aa4000e" - integrity sha512-y6LPR+wpM2I3qJrsheCTwhIinzkETbplIgPBbwvqPKc+uljeA5gP+3nP8irdYt1mjQaDnlIcG+dw8OjAco4GXw== +"@babel/traverse@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.15.tgz#75be4d2d6e216e880e93017f4e2389aeb77ef2d9" + integrity sha512-DdHPwvJY0sEeN4xJU5uRLmZjgMMDIvMPniLuYzUVXj/GGzysPl0/fwt44JBkyUIzGJPV8QgHMcQdQ34XFuKTYQ== dependencies: - "@babel/code-frame" "^7.22.5" - "@babel/generator" "^7.22.7" + "@babel/code-frame" "^7.22.13" + "@babel/generator" "^7.22.15" "@babel/helper-environment-visitor" "^7.22.5" "@babel/helper-function-name" "^7.22.5" "@babel/helper-hoist-variables" "^7.22.5" "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/parser" "^7.22.7" - "@babel/types" "^7.22.5" + "@babel/parser" "^7.22.15" + "@babel/types" "^7.22.15" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.22.5", "@babel/types@^7.4.4": - version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.5.tgz#cd93eeaab025880a3a47ec881f4b096a5b786fbe" - integrity sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA== +"@babel/types@^7.22.10", "@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.4.4": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.15.tgz#266cb21d2c5fd0b3931e7a91b6dd72d2f617d282" + integrity sha512-X+NLXr0N8XXmN5ZsaQdm9U2SSC3UbIYq/doL++sueHOTisgZHoKaQtZxGuV2cUPQHMfjKEfg/g6oy7Hm6SKFtA== dependencies: "@babel/helper-string-parser" "^7.22.5" - "@babel/helper-validator-identifier" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.15" to-fast-properties "^2.0.0" "@colors/colors@1.5.0": @@ -1038,27 +1029,27 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@definitelytyped/dts-critic@^0.0.163": - version "0.0.163" - resolved "https://registry.yarnpkg.com/@definitelytyped/dts-critic/-/dts-critic-0.0.163.tgz#51750eddefd781daf481f8e4d4d277b7bd51fc87" - integrity sha512-HsTvylj8x2gQaawsOCcN2Xk2Cx0wgV9kaj83hgsO9SITZSPd7dA0UkHyNRadbMkMwqNDKcnizcmWdz0+0gIo8A== +"@definitelytyped/dts-critic@^0.0.177": + version "0.0.177" + resolved "https://registry.yarnpkg.com/@definitelytyped/dts-critic/-/dts-critic-0.0.177.tgz#0c8b2d9772c1f27242c47f0866fa66267d7854b2" + integrity sha512-EcKoBzaHMX4MwnPmg1yVNKkTG50ZWoLpPocejl0+AoWZNfk0f1T5/YTcabQ/pC7vrMlN6+C9EufTOs82gJ9ZIA== dependencies: - "@definitelytyped/header-parser" "^0.0.163" + "@definitelytyped/header-parser" "^0.0.177" command-exists "^1.2.8" rimraf "^3.0.2" - semver "^6.2.0" + semver "^7.5.2" tmp "^0.2.1" yargs "^15.3.1" -"@definitelytyped/dtslint@^0.0.163": - version "0.0.163" - resolved "https://registry.yarnpkg.com/@definitelytyped/dtslint/-/dtslint-0.0.163.tgz#d31f7c01f2f829d69ab0b3c46801d5547860236d" - integrity sha512-U0uw7Zu0QdYSuBMYgxvRYjkhkeulTEg8vDgJ7TiYQUv/wODeujSAmGahQn51E5hOlSMYUw7A9utdbUukxE02SQ== +"@definitelytyped/dtslint@^0.0.177": + version "0.0.177" + resolved "https://registry.yarnpkg.com/@definitelytyped/dtslint/-/dtslint-0.0.177.tgz#0a83ce54a6ff212617f8eea44dce9b22f1862df5" + integrity sha512-ocla41rNWXp9ZyuxhgtFHG+YKkNB1ZKBgFxEHZlRcoFxeiYRsMNe2OSMlubhUUEs7K7A83Vy7WyntNW1DwmEWg== dependencies: - "@definitelytyped/dts-critic" "^0.0.163" - "@definitelytyped/header-parser" "^0.0.163" - "@definitelytyped/typescript-versions" "^0.0.163" - "@definitelytyped/utils" "^0.0.163" + "@definitelytyped/dts-critic" "^0.0.177" + "@definitelytyped/header-parser" "^0.0.177" + "@definitelytyped/typescript-versions" "^0.0.177" + "@definitelytyped/utils" "^0.0.177" "@typescript-eslint/eslint-plugin" "^5.55.0" "@typescript-eslint/parser" "^5.55.0" "@typescript-eslint/types" "^5.56.0" @@ -1071,26 +1062,26 @@ tslint "5.14.0" yargs "^15.1.0" -"@definitelytyped/header-parser@^0.0.163": - version "0.0.163" - resolved "https://registry.yarnpkg.com/@definitelytyped/header-parser/-/header-parser-0.0.163.tgz#fdf5589a048e89b2a2adbd33d5d3d78ecd2a2ec6" - integrity sha512-Jr+/q+ESfc7uWldz/j11BfpjIN/gB4WmwhFENhWaMwM0W/9p0ShF+OiUqGhk2Q3Iz8v/oyWzSsxyxgasg9kCxQ== +"@definitelytyped/header-parser@^0.0.177": + version "0.0.177" + resolved "https://registry.yarnpkg.com/@definitelytyped/header-parser/-/header-parser-0.0.177.tgz#b9d2762800acc395237d6acc4458bcf640487f6e" + integrity sha512-siVtuvnQxXr4KhD14VV7AzFR0Xb+qcRxJWRQ4AogGkPakd5/ufljAXJ6fBq6HRB57Vy4MmgV9R0irfcMhdaK1A== dependencies: - "@definitelytyped/typescript-versions" "^0.0.163" + "@definitelytyped/typescript-versions" "^0.0.177" "@types/parsimmon" "^1.10.1" parsimmon "^1.13.0" -"@definitelytyped/typescript-versions@^0.0.163": - version "0.0.163" - resolved "https://registry.yarnpkg.com/@definitelytyped/typescript-versions/-/typescript-versions-0.0.163.tgz#b3e018057a0437740102850de2c093c8cddd9e6f" - integrity sha512-+GWtJhC+7UaCUnJ+ZkA7bfGuPd6ZbJKEjbHqh76/gOXsqAUOMEa49ufsLlIPUbkEeQlnDNoTHCegE5X/Q+u+/A== +"@definitelytyped/typescript-versions@^0.0.177": + version "0.0.177" + resolved "https://registry.yarnpkg.com/@definitelytyped/typescript-versions/-/typescript-versions-0.0.177.tgz#4ca225debaaad05f0df855c140b63f664a3a9791" + integrity sha512-PcSKwrB0zhpFq9KadHU7iVkqszg/4TqDlF+xrXNsMpFk523RC7S7HXdPNR3j55774fwvoIRudMbr96v2J+WNKg== -"@definitelytyped/utils@^0.0.163": - version "0.0.163" - resolved "https://registry.yarnpkg.com/@definitelytyped/utils/-/utils-0.0.163.tgz#1fb26bf5cf22a00c16924fcb115fe76a46817972" - integrity sha512-6MX5TxaQbG/j2RkCWbcbLvv+YNipKqY0eQJafDhwC/RprUocpg+uYVNlH8XzdKRWOGJ0pq7SZOsJD4C3A01ZXg== +"@definitelytyped/utils@^0.0.177": + version "0.0.177" + resolved "https://registry.yarnpkg.com/@definitelytyped/utils/-/utils-0.0.177.tgz#c6e53cdb7b639a532371587691e11e78fe057484" + integrity sha512-okfO4lAV3rRnvCYYqfPT3ZSqfM4Wwg+02ClzszV5AV0htYKiDn8KpdfM73Fm2DCoqeKuKlMPmtc5VtuRK6vCRg== dependencies: - "@definitelytyped/typescript-versions" "^0.0.163" + "@definitelytyped/typescript-versions" "^0.0.177" "@qiwi/npm-registry-client" "^8.9.1" "@types/node" "^14.14.35" charm "^1.0.2" @@ -1111,15 +1102,15 @@ dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.4.0": - version "4.5.1" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884" - integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ== +"@eslint-community/regexpp@^4.4.0", "@eslint-community/regexpp@^4.6.1": + version "4.8.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.8.0.tgz#11195513186f68d42fbf449f9a7136b2c0c92005" + integrity sha512-JylOEEzDiOryeUnFbQz+oViCXS0KsvR1mvHkoMiu5+UiBvy+RYX7tzlIIIEstF/gVa2tj9AQXk3dgnxv6KxhFg== -"@eslint/eslintrc@^2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.0.tgz#82256f164cc9e0b59669efc19d57f8092706841d" - integrity sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A== +"@eslint/eslintrc@^2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.2.tgz#c6936b4b328c64496692f76944e755738be62396" + integrity sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g== dependencies: ajv "^6.12.4" debug "^4.3.2" @@ -1131,15 +1122,15 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.44.0": - version "8.44.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.44.0.tgz#961a5903c74139390478bdc808bcde3fc45ab7af" - integrity sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw== +"@eslint/js@8.48.0": + version "8.48.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.48.0.tgz#642633964e217905436033a2bd08bf322849b7fb" + integrity sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw== "@humanwhocodes/config-array@^0.11.10": - version "0.11.10" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2" - integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ== + version "0.11.11" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.11.tgz#88a04c570dbbc7dd943e4712429c3df09bc32844" + integrity sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA== dependencies: "@humanwhocodes/object-schema" "^1.2.1" debug "^4.1.1" @@ -1176,19 +1167,19 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/schemas@^29.6.0": - version "29.6.0" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.0.tgz#0f4cb2c8e3dca80c135507ba5635a4fd755b0040" - integrity sha512-rxLjXyJBTL4LQeJW3aKo0M/+GkCOXsO+8i9Iu7eDb6KwtP65ayoDsitrdPBtujxQ88k4wI2FNYfa6TOGwSn6cQ== +"@jest/schemas@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" + integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== dependencies: "@sinclair/typebox" "^0.27.8" -"@jest/types@^29.6.1": - version "29.6.1" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.1.tgz#ae79080278acff0a6af5eb49d063385aaa897bf2" - integrity sha512-tPKQNMPuXgvdOn2/Lg9HNfUvjYVGolt04Hp03f5hAk878uwOLikN+JzeLY0HcVgKgFl9Hs3EIqpu3WX27XNhnw== +"@jest/types@^29.6.3": + version "29.6.3" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" + integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== dependencies: - "@jest/schemas" "^29.6.0" + "@jest/schemas" "^29.6.3" "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^3.0.0" "@types/node" "*" @@ -1204,12 +1195,7 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.9" -"@jridgewell/resolve-uri@3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" - integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== - -"@jridgewell/resolve-uri@^3.0.3": +"@jridgewell/resolve-uri@^3.0.3", "@jridgewell/resolve-uri@^3.1.0": version "3.1.1" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== @@ -1227,12 +1213,7 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" -"@jridgewell/sourcemap-codec@1.4.14": - version "1.4.14" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" - integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== - -"@jridgewell/sourcemap-codec@^1.4.10": +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": version "1.4.15" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== @@ -1246,12 +1227,12 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": - version "0.3.18" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6" - integrity sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA== + version "0.3.19" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz#f8a3249862f91be48d3127c3cfe992f79b4b8811" + integrity sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw== dependencies: - "@jridgewell/resolve-uri" "3.1.0" - "@jridgewell/sourcemap-codec" "1.4.14" + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" "@jsdoc/salty@^0.2.1": version "0.2.5" @@ -1272,11 +1253,6 @@ dependencies: eslint-scope "5.1.1" -"@nicolo-ribaudo/semver-v6@^6.3.3": - version "6.3.3" - resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/semver-v6/-/semver-v6-6.3.3.tgz#ea6d23ade78a325f7a52750aab1526b02b628c29" - integrity sha512-3Yc1fUTs69MG/uZbJlLSI3JISMn2UV2rg+1D/vROUqZyh3l6iYHCs7GMp+M40ZD7yOdDbYjJcU1oTJhrc+dGKg== - "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -1298,6 +1274,18 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@pkgr/utils@^2.3.1": + version "2.4.2" + resolved "https://registry.yarnpkg.com/@pkgr/utils/-/utils-2.4.2.tgz#9e638bbe9a6a6f165580dc943f138fd3309a2cbc" + integrity sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw== + dependencies: + cross-spawn "^7.0.3" + fast-glob "^3.3.0" + is-glob "^4.0.3" + open "^9.1.0" + picocolors "^1.0.0" + tslib "^2.6.0" + "@qiwi/npm-registry-client@^8.9.1": version "8.9.1" resolved "https://registry.yarnpkg.com/@qiwi/npm-registry-client/-/npm-registry-client-8.9.1.tgz#1769f6501a436ec39c496ca0a9a2fab9db7718df" @@ -1388,9 +1376,9 @@ integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== "@types/chai@4": - version "4.3.5" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.5.tgz#ae69bcbb1bebb68c4ac0b11e9d8ed04526b3562b" - integrity sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng== + version "4.3.6" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.6.tgz#7b489e8baf393d5dd1266fb203ddd4ea941259e6" + integrity sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw== "@types/cookie@^0.4.1": version "0.4.1" @@ -1403,9 +1391,9 @@ integrity sha512-t73xJJrvdTjXrn4jLS9VSGRbz0nUY3cl2DMGDU48lKl+HR9dbbjW2A9r3g40VA++mQpy6uuHg33gy7du2BKpog== "@types/cors@^2.8.12": - version "2.8.13" - resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.13.tgz#b8ade22ba455a1b8cb3b5d3f35910fd204f84f94" - integrity sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA== + version "2.8.14" + resolved "https://registry.yarnpkg.com/@types/cors/-/cors-2.8.14.tgz#94eeb1c95eda6a8ab54870a3bf88854512f43a92" + integrity sha512-RXHUvNWYICtbP6s18PnOCaqToK8y14DnLd75c6HfyKf228dxy7pHNOQkxPtvXKp/hINFMDjbYzsj63nnpPMSRQ== dependencies: "@types/node" "*" @@ -1423,9 +1411,9 @@ "@types/estree" "*" "@types/eslint@*", "@types/eslint@^8.37.0": - version "8.44.0" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.44.0.tgz#55818eabb376e2272f77fbf5c96c43137c3c1e53" - integrity sha512-gsF+c/0XOguWgaOgvFs+xnnRqt9GwgTvIks36WpE6ueeI4KCEHHd8K/CKHqhOqrJKsYH8m27kRzQEvWXAwXUTw== + version "8.44.2" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.44.2.tgz#0d21c505f98a89b8dd4d37fa162b09da6089199a" + integrity sha512-sdPRb9K6iL5XZOmBubg8yiFp5yS/JdUDQsq5e6h95km91MCYMuvp7mh1fjPEYUhvHepKpZOjnEaMBR4PxjWDzg== dependencies: "@types/estree" "*" "@types/json-schema" "*" @@ -1470,14 +1458,14 @@ integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== "@types/linkify-it@*": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-3.0.2.tgz#fd2cd2edbaa7eaac7e7f3c1748b52a19143846c9" - integrity sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA== + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-3.0.3.tgz#15a0712296c5041733c79efe233ba17ae5a7587b" + integrity sha512-pTjcqY9E4nOI55Wgpz7eiI8+LzdYnw3qxXCfHyBDdPbYvbyLgWLJGh8EdPvqawwMK1Uo1794AUkkR38Fr0g+2g== -"@types/lodash@^4.14.192": - version "4.14.195" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.195.tgz#bafc975b252eb6cea78882ce8a7b6bf22a6de632" - integrity sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg== +"@types/lodash@^4.14.198": + version "4.14.198" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.198.tgz#4d27465257011aedc741a809f1269941fa2c5d4c" + integrity sha512-trNJ/vtMZYMLhfN45uLq4ShQSw0/S7xCTLLVM+WM1rmFpba/VS42jVUgaO3w/NOLiWR/09lnYk0yMaA/atdIsg== "@types/markdown-it@^12.2.3": version "12.2.3" @@ -1492,15 +1480,15 @@ resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-1.0.2.tgz#e2ce9d83a613bacf284c7be7d491945e39e1f8e9" integrity sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA== -"@types/node@*", "@types/node@>=10.0.0", "@types/node@^20.4.1": - version "20.4.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.1.tgz#a6033a8718653c50ac4962977e14d0f984d9527d" - integrity sha512-JIzsAvJeA/5iY6Y/OxZbv1lUcc8dNSE77lb2gnBH+/PJ3lFR1Ccvgwl5JWnHAkNHcRsT0TbpVOsiMKZ1F/yyJg== +"@types/node@*", "@types/node@>=10.0.0", "@types/node@^20.5.9": + version "20.5.9" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.9.tgz#a70ec9d8fa0180a314c3ede0e20ea56ff71aed9a" + integrity sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ== "@types/node@^14.14.35": - version "14.18.53" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.53.tgz#42855629b8773535ab868238718745bf56c56219" - integrity sha512-soGmOpVBUq+gaBMwom1M+krC/NNbWlosh4AtGA03SyWNDiqSKtwp7OulO1M6+mg8YkHMvJ/y0AkCeO8d1hNb7A== + version "14.18.58" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.58.tgz#547e64027defb95f34824794574dabf5417bc615" + integrity sha512-Y8ETZc8afYf6lQ/mVp096phIVsgD/GmDxtm3YaPcc+71jmi/J6zdwbwaUU4JvS56mq6aSfbpkcKhQ5WugrWFPw== "@types/parsimmon@^1.10.1": version "1.10.6" @@ -1515,9 +1503,9 @@ "@types/node" "*" "@types/semver@^7.3.12": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.0.tgz#591c1ce3a702c45ee15f47a42ade72c2fd78978a" - integrity sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw== + version "7.5.1" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.1.tgz#0480eeb7221eb9bc398ad7432c9d7e14b1a5a367" + integrity sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg== "@types/superagent@4.1.13": version "4.1.13" @@ -1527,10 +1515,10 @@ "@types/cookiejar" "*" "@types/node" "*" -"@types/urijs@^1.19.6": - version "1.19.19" - resolved "https://registry.yarnpkg.com/@types/urijs/-/urijs-1.19.19.tgz#2789369799907fc11e2bc6e3a00f6478c2281b95" - integrity sha512-FDJNkyhmKLw7uEvTxx5tSXfPeQpO0iy73Ry+PmYZJvQy0QIWX8a7kJ4kLWRf+EbTPJEPDSgPXHaM7pzr5lmvCg== +"@types/urijs@^1.19.20": + version "1.19.20" + resolved "https://registry.yarnpkg.com/@types/urijs/-/urijs-1.19.20.tgz#7ea4254f4c2cdbd7d34e47d483e76fa1b81e19a4" + integrity sha512-77Mq/2BeHU894J364dUv9tSwxxyCLtcX228Pc8TwZpP5bvOoMns+gZoftp3LYl3FBH8vChpWbuagKGiMki2c1A== "@types/yargs-parser@*": version "21.0.0" @@ -1560,7 +1548,7 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/parser@^5.55.0", "@typescript-eslint/parser@^5.59.7": +"@typescript-eslint/parser@^5.55.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.62.0.tgz#1b63d082d849a2fcae8a569248fbe2ee1b8a56c7" integrity sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA== @@ -1570,6 +1558,17 @@ "@typescript-eslint/typescript-estree" "5.62.0" debug "^4.3.4" +"@typescript-eslint/parser@^6.6.0": + version "6.6.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.6.0.tgz#fe323a7b4eafb6d5ea82b96216561810394a739e" + integrity sha512-setq5aJgUwtzGrhW177/i+DMLqBaJbdwGj2CPIVFFLE0NCliy5ujIdLHd2D1ysmlmsjdL2GWW+hR85neEfc12w== + dependencies: + "@typescript-eslint/scope-manager" "6.6.0" + "@typescript-eslint/types" "6.6.0" + "@typescript-eslint/typescript-estree" "6.6.0" + "@typescript-eslint/visitor-keys" "6.6.0" + debug "^4.3.4" + "@typescript-eslint/scope-manager@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz#d9457ccc6a0b8d6b37d0eb252a23022478c5460c" @@ -1578,6 +1577,14 @@ "@typescript-eslint/types" "5.62.0" "@typescript-eslint/visitor-keys" "5.62.0" +"@typescript-eslint/scope-manager@6.6.0": + version "6.6.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.6.0.tgz#57105d4419d6de971f7d2c30a2ff4ac40003f61a" + integrity sha512-pT08u5W/GT4KjPUmEtc2kSYvrH8x89cVzkA0Sy2aaOUIw6YxOIjA8ilwLr/1fLjOedX1QAuBpG9XggWqIIfERw== + dependencies: + "@typescript-eslint/types" "6.6.0" + "@typescript-eslint/visitor-keys" "6.6.0" + "@typescript-eslint/type-utils@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz#286f0389c41681376cdad96b309cedd17d70346a" @@ -1593,6 +1600,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" integrity sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ== +"@typescript-eslint/types@6.6.0": + version "6.6.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.6.0.tgz#95e7ea650a2b28bc5af5ea8907114a48f54618c2" + integrity sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg== + "@typescript-eslint/typescript-estree@5.62.0", "@typescript-eslint/typescript-estree@^5.55.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b" @@ -1606,6 +1618,19 @@ semver "^7.3.7" tsutils "^3.21.0" +"@typescript-eslint/typescript-estree@6.6.0": + version "6.6.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.6.0.tgz#373c420d2e12c28220f4a83352280a04823a91b7" + integrity sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA== + dependencies: + "@typescript-eslint/types" "6.6.0" + "@typescript-eslint/visitor-keys" "6.6.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.5.4" + ts-api-utils "^1.0.1" + "@typescript-eslint/utils@5.62.0", "@typescript-eslint/utils@^5.55.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86" @@ -1628,6 +1653,14 @@ "@typescript-eslint/types" "5.62.0" eslint-visitor-keys "^3.3.0" +"@typescript-eslint/visitor-keys@6.6.0": + version "6.6.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.6.0.tgz#1109088b4346c8b2446f3845db526374d9a3bafc" + integrity sha512-L61uJT26cMOfFQ+lMZKoJNbAEckLe539VhTxiGHrWl5XSKQgA0RTBZJW2HFPy5T0ZvPVSD93QsrTKDkfNwJGyQ== + dependencies: + "@typescript-eslint/types" "6.6.0" + eslint-visitor-keys "^3.4.1" + "@webassemblyjs/ast@1.11.6", "@webassemblyjs/ast@^1.11.5": version "1.11.6" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.6.tgz#db046555d3c413f8966ca50a95176a0e2c642e24" @@ -1836,7 +1869,7 @@ ajv-keywords@^5.1.0: dependencies: fast-deep-equal "^3.1.3" -ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4, ajv@^6.12.5: +ajv@^6.12.3, ajv@^6.12.4, ajv@^6.12.5: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -1861,12 +1894,12 @@ ansi-colors@4.1.1: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== -ansi-escapes@^4.3.0: - version "4.3.2" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" - integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== +ansi-escapes@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-5.0.0.tgz#b6a0caf0eef0c41af190e9a749e0c00ec04bb2a6" + integrity sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA== dependencies: - type-fest "^0.21.3" + type-fest "^1.0.2" ansi-regex@^2.0.0: version "2.1.1" @@ -1902,7 +1935,7 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" -ansi-styles@^6.0.0: +ansi-styles@^6.0.0, ansi-styles@^6.1.0: version "6.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== @@ -1966,14 +1999,14 @@ array-buffer-byte-length@^1.0.0: is-array-buffer "^3.0.1" array-includes@^3.1.6: - version "3.1.6" - resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.6.tgz#9e9e720e194f198266ba9e18c29e6a9b0e4b225f" - integrity sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw== + version "3.1.7" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.7.tgz#8cd2e01b26f7a3086cbc87271593fe921c62abda" + integrity sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ== dependencies: call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" - get-intrinsic "^1.1.3" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" is-string "^1.0.7" array-union@^2.1.0: @@ -1981,14 +2014,25 @@ array-union@^2.1.0: resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== +array.prototype.findlastindex@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz#b37598438f97b579166940814e2c0493a4f50207" + integrity sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + es-shim-unscopables "^1.0.0" + get-intrinsic "^1.2.1" + array.prototype.flat@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz#ffc6576a7ca3efc2f46a143b9d1dda9b4b3cf5e2" - integrity sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA== + version "1.3.2" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz#1476217df8cff17d72ee8f3ba06738db5b387d18" + integrity sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA== dependencies: call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" + define-properties "^1.2.0" + es-abstract "^1.22.1" es-shim-unscopables "^1.0.0" array.prototype.flatmap@^1.3.1: @@ -2001,6 +2045,19 @@ array.prototype.flatmap@^1.3.1: es-abstract "^1.20.4" es-shim-unscopables "^1.0.0" +arraybuffer.prototype.slice@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz#98bd561953e3e74bb34938e77647179dfe6e9f12" + integrity sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw== + dependencies: + array-buffer-byte-length "^1.0.0" + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" + is-array-buffer "^3.0.2" + is-shared-array-buffer "^1.0.2" + asap@^2.0.0: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" @@ -2043,11 +2100,6 @@ assertion-error@^1.1.0: resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== -astral-regex@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" - integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -2076,10 +2128,10 @@ axios-mock-adapter@^1.21.5: fast-deep-equal "^3.1.3" is-buffer "^2.0.5" -axios@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f" - integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA== +axios@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.5.0.tgz#f02e4af823e2e46a9768cfc74691fdd0517ea267" + integrity sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ== dependencies: follow-redirects "^1.15.0" form-data "^4.0.0" @@ -2113,29 +2165,29 @@ babel-plugin-istanbul@^6.1.1: istanbul-lib-instrument "^5.0.4" test-exclude "^6.0.0" -babel-plugin-polyfill-corejs2@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.4.tgz#9f9a0e1cd9d645cc246a5e094db5c3aa913ccd2b" - integrity sha512-9WeK9snM1BfxB38goUEv2FLnA6ja07UMfazFHzCXUb3NyDZAwfXvQiURQ6guTTMeHcOsdknULm1PDhs4uWtKyA== +babel-plugin-polyfill-corejs2@^0.4.5: + version "0.4.5" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.5.tgz#8097b4cb4af5b64a1d11332b6fb72ef5e64a054c" + integrity sha512-19hwUH5FKl49JEsvyTcoHakh6BE0wgXLLptIyKZ3PijHc/Ci521wygORCUCCred+E/twuqRyAkE02BAWPmsHOg== dependencies: "@babel/compat-data" "^7.22.6" - "@babel/helper-define-polyfill-provider" "^0.4.1" - "@nicolo-ribaudo/semver-v6" "^6.3.3" + "@babel/helper-define-polyfill-provider" "^0.4.2" + semver "^6.3.1" -babel-plugin-polyfill-corejs3@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.2.tgz#d406c5738d298cd9c66f64a94cf8d5904ce4cc5e" - integrity sha512-Cid+Jv1BrY9ReW9lIfNlNpsI53N+FN7gE+f73zLAUbr9C52W4gKLWSByx47pfDJsEysojKArqOtOKZSVIIUTuQ== +babel-plugin-polyfill-corejs3@^0.8.3: + version "0.8.3" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.3.tgz#b4f719d0ad9bb8e0c23e3e630c0c8ec6dd7a1c52" + integrity sha512-z41XaniZL26WLrvjy7soabMXrfPWARN25PZoriDEiLMxAp50AUW3t35BGQUMg5xK3UrpVTtagIDklxYa+MhiNA== dependencies: - "@babel/helper-define-polyfill-provider" "^0.4.1" + "@babel/helper-define-polyfill-provider" "^0.4.2" core-js-compat "^3.31.0" -babel-plugin-polyfill-regenerator@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.1.tgz#ace7a5eced6dff7d5060c335c52064778216afd3" - integrity sha512-L8OyySuI6OSQ5hFy9O+7zFjyr4WhAfRjLIOkhQGYl+emwJkd/S4XXT1JpfrgR1jrQ1NcGiOh+yAdGlF8pnC3Jw== +babel-plugin-polyfill-regenerator@^0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.2.tgz#80d0f3e1098c080c8b5a65f41e9427af692dc326" + integrity sha512-tAlOptU0Xj34V1Y2PNTL4Y0FOJMDB6bZmoW39FeCQIhigGLkqu3Fj6uiXpxIf6Ij274ENdYx64y6Au+ZKlb1IA== dependencies: - "@babel/helper-define-polyfill-provider" "^0.4.1" + "@babel/helper-define-polyfill-provider" "^0.4.2" balanced-match@^1.0.0: version "1.0.2" @@ -2164,10 +2216,15 @@ bcrypt-pbkdf@^1.0.0: dependencies: tweetnacl "^0.14.3" -bignumber.js@^9.1.1: - version "9.1.1" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" - integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== +big-integer@^1.6.44: + version "1.6.51" + resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz#0df92a5d9880560d3ff2d5fd20245c889d130686" + integrity sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg== + +bignumber.js@^9.1.2: + version "9.1.2" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" + integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== binary-extensions@^2.0.0: version "2.2.0" @@ -2216,6 +2273,13 @@ body-parser@^1.19.0: type-is "~1.6.18" unpipe "1.0.0" +bplist-parser@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.2.0.tgz#43a9d183e5bf9d545200ceac3e712f79ebbe8d0e" + integrity sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw== + dependencies: + big-integer "^1.6.44" + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -2309,14 +2373,14 @@ browserify-zlib@^0.2.0: dependencies: pako "~1.0.5" -browserslist@^4.14.5, browserslist@^4.21.9: - version "4.21.9" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.9.tgz#e11bdd3c313d7e2a9e87e8b4b0c7872b13897635" - integrity sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg== +browserslist@^4.14.5, browserslist@^4.21.10, browserslist@^4.21.9: + version "4.21.10" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.10.tgz#dbbac576628c13d3b2231332cb2ec5a46e015bb0" + integrity sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ== dependencies: - caniuse-lite "^1.0.30001503" - electron-to-chromium "^1.4.431" - node-releases "^2.0.12" + caniuse-lite "^1.0.30001517" + electron-to-chromium "^1.4.477" + node-releases "^2.0.13" update-browserslist-db "^1.0.11" buffer-from@^1.0.0: @@ -2360,6 +2424,13 @@ builtins@^1.0.3: resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" integrity sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ== +bundle-name@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/bundle-name/-/bundle-name-3.0.0.tgz#ba59bcc9ac785fb67ccdbf104a2bf60c099f0e1a" + integrity sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw== + dependencies: + run-applescript "^5.0.0" + bytes@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" @@ -2398,10 +2469,10 @@ camelcase@^6.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001503: - version "1.0.30001515" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz#418aefeed9d024cd3129bfae0ccc782d4cb8f12b" - integrity sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA== +caniuse-lite@^1.0.30001517: + version "1.0.30001527" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001527.tgz#813826554828245ccee776c850566dce12bdeaba" + integrity sha512-YkJi7RwPgWtXVSgK4lG9AHH57nSzvvOp9MesgXmw4Q7n0C3H04L0foHqfxcmSAm5AcWb8dW9AYj2tR7/5GnddQ== caseless@~0.12.0: version "0.12.0" @@ -2436,10 +2507,10 @@ chai-http@^4.3.0: qs "^6.11.2" superagent "^8.0.9" -chai@^4.3.7: - version "4.3.7" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.7.tgz#ec63f6df01829088e8bf55fca839bcd464a8ec51" - integrity sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A== +chai@^4.3.8: + version "4.3.8" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.8.tgz#40c59718ad6928da6629c70496fe990b2bb5b17c" + integrity sha512-vX4YvVVtxlfSZ2VecZgFUTU5qPCYsobVI2O9FmwEXBhDigYGQA6jRXCycIs1yJnnWbZ6/+a2zNIF5DfVCcJBFQ== dependencies: assertion-error "^1.1.0" check-error "^1.0.2" @@ -2449,10 +2520,10 @@ chai@^4.3.7: pathval "^1.1.1" type-detect "^4.0.5" -chalk@5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.2.0.tgz#249623b7d66869c673699fb66d65723e54dfcfb3" - integrity sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA== +chalk@5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" + integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== chalk@^1.1.3: version "1.1.3" @@ -2465,7 +2536,7 @@ chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@^2.0.0, chalk@^2.3.0: +chalk@^2.3.0, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -2542,20 +2613,12 @@ clean-stack@^2.0.0: resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== -cli-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" - integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== - dependencies: - restore-cursor "^3.1.0" - -cli-truncate@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-2.1.0.tgz#c39e28bf05edcde5be3b98992a22deed5a2b93c7" - integrity sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg== +cli-cursor@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-4.0.0.tgz#3cecfe3734bf4fe02a8361cbdc0f6fe28c6a57ea" + integrity sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg== dependencies: - slice-ansi "^3.0.0" - string-width "^4.2.0" + restore-cursor "^4.0.0" cli-truncate@^3.1.0: version "3.1.0" @@ -2621,7 +2684,7 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -colorette@^2.0.14, colorette@^2.0.19: +colorette@^2.0.14, colorette@^2.0.20: version "2.0.20" resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== @@ -2643,6 +2706,11 @@ command-exists@^1.2.8: resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== +commander@11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-11.0.0.tgz#43e19c25dbedc8256203538e8d7e9346877a6f67" + integrity sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ== + commander@2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" @@ -2650,7 +2718,7 @@ commander@2.9.0: dependencies: graceful-readlink ">= 1.0.0" -commander@^10.0.0, commander@^10.0.1: +commander@^10.0.1: version "10.0.1" resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== @@ -2751,11 +2819,11 @@ cookiejar@^2.1.4: integrity sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw== core-js-compat@^3.31.0: - version "3.31.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.31.1.tgz#5084ad1a46858df50ff89ace152441a63ba7aae0" - integrity sha512-wIDWd2s5/5aJSdpOJHfSibxNODxoGoWOBHt8JSPB41NOE94M7kuTPZCYLOlTtuoXTsBPKobpJ6T+y0SSy5L9SA== + version "3.32.1" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.32.1.tgz#55f9a7d297c0761a8eb1d31b593e0f5b6ffae964" + integrity sha512-GSvKDv4wE0bPnQtjklV101juQ85g6H3rm5PDP20mqlS5j0kXF3pP97YvAu5hl+uFHqMictp3b2VxOHljWMAtuA== dependencies: - browserslist "^4.21.9" + browserslist "^4.21.10" core-util-is@1.0.2: version "1.0.2" @@ -2775,11 +2843,6 @@ cors@~2.8.5: object-assign "^4" vary "^1" -crc@^4.3.2: - version "4.3.2" - resolved "https://registry.yarnpkg.com/crc/-/crc-4.3.2.tgz#49b7821cbf2cf61dfd079ed93863bbebd5469b9a" - integrity sha512-uGDHf4KLLh2zsHa8D8hIQ1H/HtFQhyHrc0uhHBcoKGol/Xnb+MPYfUMw7cvON6ze/GUESTudKayDcJC5HnJv1A== - create-ecdh@^4.0.0: version "4.0.4" resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e" @@ -2909,6 +2972,24 @@ deep-is@^0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== +default-browser-id@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/default-browser-id/-/default-browser-id-3.0.0.tgz#bee7bbbef1f4e75d31f98f4d3f1556a14cea790c" + integrity sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA== + dependencies: + bplist-parser "^0.2.0" + untildify "^4.0.0" + +default-browser@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/default-browser/-/default-browser-4.0.0.tgz#53c9894f8810bf86696de117a6ce9085a3cbc7da" + integrity sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA== + dependencies: + bundle-name "^3.0.0" + default-browser-id "^3.0.0" + execa "^7.1.1" + titleize "^3.0.0" + default-require-extensions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-3.0.1.tgz#bfae00feeaeada68c2ae256c62540f60b80625bd" @@ -2916,6 +2997,11 @@ default-require-extensions@^3.0.0: dependencies: strip-bom "^4.0.0" +define-lazy-prop@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz#dbb19adfb746d7fc6d734a06b72f4a00d021255f" + integrity sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg== + define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.0.tgz#52988570670c9eacedd8064f4a990f2405849bd5" @@ -3048,10 +3134,10 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== -electron-to-chromium@^1.4.431: - version "1.4.457" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.457.tgz#3fdc7b4f97d628ac6b51e8b4b385befb362fe343" - integrity sha512-/g3UyNDmDd6ebeWapmAoiyy+Sy2HyJ+/X8KyvNeHfKRFfHaA2W8oF5fxD5F3tjBDcjpwo0iek6YNgxNXDBoEtA== +electron-to-chromium@^1.4.477: + version "1.4.509" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.509.tgz#9e276f8fcd70e1dfac541390da56a1ed7eea43d1" + integrity sha512-G5KlSWY0zzhANtX15tkikHl4WB7zil2Y65oT52EZUL194abjUXBZym12Ht7Bhuwm/G3LJFEqMADyv2Cks56dmg== elliptic@^6.5.3: version "6.5.4" @@ -3088,15 +3174,15 @@ end-of-stream@^1.4.1: dependencies: once "^1.4.0" -engine.io-parser@~5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.1.0.tgz#d593d6372d7f79212df48f807b8cace1ea1cb1b8" - integrity sha512-enySgNiK5tyZFynt3z7iqBR+Bto9EVVVvDFuTT0ioHCGbzirZVGDGiQjZzEp8hWl6hd5FSVytJGuScX1C1C35w== +engine.io-parser@~5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.2.1.tgz#9f213c77512ff1a6cc0c7a86108a7ffceb16fcfb" + integrity sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ== -engine.io@~6.5.0: - version "6.5.1" - resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.5.1.tgz#59725f8593ccc891abb47f1efcdc52a089525a56" - integrity sha512-mGqhI+D7YxS9KJMppR6Iuo37Ed3abhU8NdfgSvJSDUafQutrN+sPTncJYTyM9+tkhSmWodKtVYGPPHyXJEwEQA== +engine.io@~6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.5.2.tgz#769348ced9d56bd47bd83d308ec1c3375e85937c" + integrity sha512-IXsMcGpw/xRfjra46sVZVHiSWo/nJ/3g1337q9KNXtS6YRzbW5yIzTCb9DjhrBe7r3GZQR0I4+nq+4ODk5g/cA== dependencies: "@types/cookie" "^0.4.1" "@types/cors" "^2.8.12" @@ -3106,7 +3192,7 @@ engine.io@~6.5.0: cookie "~0.4.1" cors "~2.8.5" debug "~4.3.1" - engine.io-parser "~5.1.0" + engine.io-parser "~5.2.1" ws "~8.11.0" enhanced-resolve@^5.15.0: @@ -3132,18 +3218,19 @@ envinfo@^7.7.3: resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.10.0.tgz#55146e3909cc5fe63c22da63fb15b05aeac35b13" integrity sha512-ZtUjZO6l5mwTHvc1L9+1q5p/R3wTopcfqMW8r5t8SJSKqeVI/LtajORwRFEKpEFuekjD0VBjwu1HMxL4UalIRw== -es-abstract@^1.19.0, es-abstract@^1.20.4: - version "1.21.2" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.21.2.tgz#a56b9695322c8a185dc25975aa3b8ec31d0e7eff" - integrity sha512-y/B5POM2iBnIxCiernH1G7rC9qQoM77lLIMQLuob0zhp8C56Po81+2Nj0WFKnd0pNReDTnkYryc+zhOzpEIROg== +es-abstract@^1.20.4, es-abstract@^1.22.1: + version "1.22.1" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.1.tgz#8b4e5fc5cefd7f1660f0f8e1a52900dfbc9d9ccc" + integrity sha512-ioRRcXMO6OFyRpyzV3kE1IIBd4WG5/kltnzdxSCqoP8CMGs/Li+M1uF5o7lOkZVFjDs+NLesthnF66Pg/0q0Lw== dependencies: array-buffer-byte-length "^1.0.0" + arraybuffer.prototype.slice "^1.0.1" available-typed-arrays "^1.0.5" call-bind "^1.0.2" es-set-tostringtag "^2.0.1" es-to-primitive "^1.2.1" function.prototype.name "^1.1.5" - get-intrinsic "^1.2.0" + get-intrinsic "^1.2.1" get-symbol-description "^1.0.0" globalthis "^1.0.3" gopd "^1.0.1" @@ -3163,14 +3250,18 @@ es-abstract@^1.19.0, es-abstract@^1.20.4: object-inspect "^1.12.3" object-keys "^1.1.1" object.assign "^4.1.4" - regexp.prototype.flags "^1.4.3" + regexp.prototype.flags "^1.5.0" + safe-array-concat "^1.0.0" safe-regex-test "^1.0.0" string.prototype.trim "^1.2.7" string.prototype.trimend "^1.0.6" string.prototype.trimstart "^1.0.6" + typed-array-buffer "^1.0.0" + typed-array-byte-length "^1.0.0" + typed-array-byte-offset "^1.0.0" typed-array-length "^1.0.4" unbox-primitive "^1.0.2" - which-typed-array "^1.1.9" + which-typed-array "^1.1.10" es-module-lexer@^1.2.1: version "1.3.0" @@ -3247,21 +3338,21 @@ eslint-config-airbnb-base@^15.0.0: object.entries "^1.1.5" semver "^6.3.0" -eslint-config-prettier@^8.8.0: - version "8.8.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz#bfda738d412adc917fd7b038857110efe98c9348" - integrity sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA== +eslint-config-prettier@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.0.0.tgz#eb25485946dd0c66cd216a46232dc05451518d1f" + integrity sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw== eslint-import-resolver-node@^0.3.7: - version "0.3.7" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz#83b375187d412324a1963d84fa664377a23eb4d7" - integrity sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA== + version "0.3.9" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac" + integrity sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g== dependencies: debug "^3.2.7" - is-core-module "^2.11.0" - resolve "^1.22.1" + is-core-module "^2.13.0" + resolve "^1.22.4" -eslint-module-utils@^2.7.4: +eslint-module-utils@^2.8.0: version "2.8.0" resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz#e439fee65fc33f6bba630ff621efc38ec0375c49" integrity sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw== @@ -3276,26 +3367,28 @@ eslint-plugin-es@^3.0.0: eslint-utils "^2.0.0" regexpp "^3.0.0" -eslint-plugin-import@^2.25.2: - version "2.27.5" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz#876a6d03f52608a3e5bb439c2550588e51dd6c65" - integrity sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow== +eslint-plugin-import@^2.28.1: + version "2.28.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.28.1.tgz#63b8b5b3c409bfc75ebaf8fb206b07ab435482c4" + integrity sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A== dependencies: array-includes "^3.1.6" + array.prototype.findlastindex "^1.2.2" array.prototype.flat "^1.3.1" array.prototype.flatmap "^1.3.1" debug "^3.2.7" doctrine "^2.1.0" eslint-import-resolver-node "^0.3.7" - eslint-module-utils "^2.7.4" + eslint-module-utils "^2.8.0" has "^1.0.3" - is-core-module "^2.11.0" + is-core-module "^2.13.0" is-glob "^4.0.3" minimatch "^3.1.2" + object.fromentries "^2.0.6" + object.groupby "^1.0.0" object.values "^1.1.6" - resolve "^1.22.1" - semver "^6.3.0" - tsconfig-paths "^3.14.1" + semver "^6.3.1" + tsconfig-paths "^3.14.2" eslint-plugin-node@^11.1.0: version "11.1.0" @@ -3314,12 +3407,13 @@ eslint-plugin-prefer-import@^0.0.1: resolved "https://registry.yarnpkg.com/eslint-plugin-prefer-import/-/eslint-plugin-prefer-import-0.0.1.tgz#0df4e117da29109ef561d355ec19f41df0ada6f6" integrity sha512-2OKD3Bjgqkn0BvEGRwpEDhjXPSXvT3CXmWIrIavwafOkQE8FLTvFybEBT9dm7P0kHnjlNGv1AfNsL/i/GNDNHA== -eslint-plugin-prettier@^4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b" - integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ== +eslint-plugin-prettier@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz#6887780ed95f7708340ec79acfdf60c35b9be57a" + integrity sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w== dependencies: prettier-linter-helpers "^1.0.0" + synckit "^0.8.5" eslint-rule-composer@^0.3.0: version "0.3.0" @@ -3334,10 +3428,10 @@ eslint-scope@5.1.1, eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.0.tgz#f21ebdafda02352f103634b96dd47d9f81ca117b" - integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw== +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" @@ -3359,10 +3453,10 @@ eslint-visitor-keys@^2.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== -eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: - version "3.4.1" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" - integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== eslint-webpack-plugin@^4.0.1: version "4.0.1" @@ -3375,27 +3469,27 @@ eslint-webpack-plugin@^4.0.1: normalize-path "^3.0.0" schema-utils "^4.0.0" -eslint@^8.17.0, eslint@^8.44.0: - version "8.44.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.44.0.tgz#51246e3889b259bbcd1d7d736a0c10add4f0e500" - integrity sha512-0wpHoUbDUHgNCyvFB5aXLiQVfK9B0at6gUvzy83k4kAsQ/u769TQDX6iKC+aO4upIHO9WSaA3QoXYQDHbNwf1A== +eslint@^8.17.0, eslint@^8.48.0: + version "8.48.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.48.0.tgz#bf9998ba520063907ba7bfe4c480dc8be03c2155" + integrity sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg== dependencies: "@eslint-community/eslint-utils" "^4.2.0" - "@eslint-community/regexpp" "^4.4.0" - "@eslint/eslintrc" "^2.1.0" - "@eslint/js" "8.44.0" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.2" + "@eslint/js" "8.48.0" "@humanwhocodes/config-array" "^0.11.10" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" - ajv "^6.10.0" + ajv "^6.12.4" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.2.0" - eslint-visitor-keys "^3.4.1" - espree "^9.6.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" esquery "^1.4.2" esutils "^2.0.2" fast-deep-equal "^3.1.3" @@ -3405,7 +3499,6 @@ eslint@^8.17.0, eslint@^8.44.0: globals "^13.19.0" graphemer "^1.4.0" ignore "^5.2.0" - import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" is-path-inside "^3.0.3" @@ -3417,13 +3510,12 @@ eslint@^8.17.0, eslint@^8.44.0: natural-compare "^1.4.0" optionator "^0.9.3" strip-ansi "^6.0.1" - strip-json-comments "^3.1.0" text-table "^0.2.0" -espree@^9.6.0: - version "9.6.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.0.tgz#80869754b1c6560f32e3b6929194a3fe07c5b82f" - integrity sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A== +espree@^9.6.0, espree@^9.6.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== dependencies: acorn "^8.9.0" acorn-jsx "^5.3.2" @@ -3473,6 +3565,11 @@ eventemitter3@^4.0.0: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== +eventemitter3@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" + integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== + events@^3.2.0, events@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" @@ -3491,10 +3588,10 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: md5.js "^1.3.4" safe-buffer "^5.1.1" -execa@^7.0.0: - version "7.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-7.1.1.tgz#3eb3c83d239488e7b409d48e8813b76bb55c9c43" - integrity sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q== +execa@7.2.0, execa@^7.1.1: + version "7.2.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-7.2.0.tgz#657e75ba984f42a70f38928cedc87d6f2d4fe4e9" + integrity sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA== dependencies: cross-spawn "^7.0.3" get-stream "^6.0.1" @@ -3506,6 +3603,21 @@ execa@^7.0.0: signal-exit "^3.0.7" strip-final-newline "^3.0.0" +execa@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + extend@^3.0.0, extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" @@ -3531,10 +3643,10 @@ fast-diff@^1.1.2: resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== -fast-glob@^3.2.9: - version "3.3.0" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.0.tgz#7c40cb491e1e2ed5664749e87bfb516dbe8727c0" - integrity sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA== +fast-glob@^3.2.9, fast-glob@^3.3.0: + version "3.3.1" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.1.tgz#784b4e897340f3dbbef17413b3f11acf03c874c4" + integrity sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" @@ -3667,11 +3779,12 @@ findup@0.1.5: commander "~2.1.0" flat-cache@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" - integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + version "3.1.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.1.0.tgz#0e54ab4a1a60fe87e2946b6b00657f1c99e1af3f" + integrity sha512-OHx4Qwrrt0E4jEIcI5/Xb+f+QmJYNj2rrK8wiIdQOIrB9WrrJL8cjZvXdXuBTkkEwEqLycb5BeZDV1o2i9bTew== dependencies: - flatted "^3.1.0" + flatted "^3.2.7" + keyv "^4.5.3" rimraf "^3.0.2" flat@^5.0.2: @@ -3679,7 +3792,7 @@ flat@^5.0.2: resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== -flatted@^3.1.0, flatted@^3.2.7: +flatted@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== @@ -3783,9 +3896,9 @@ fs.realpath@^1.0.0: integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== fstream@^1.0.12: version "1.0.12" @@ -3803,16 +3916,16 @@ function-bind@^1.1.1: integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== function.prototype.name@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.5.tgz#cce0505fe1ffb80503e6f9e46cc64e46a12a9621" - integrity sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA== + version "1.1.6" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd" + integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.0" - functions-have-names "^1.2.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + functions-have-names "^1.2.3" -functions-have-names@^1.2.2, functions-have-names@^1.2.3: +functions-have-names@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== @@ -3846,7 +3959,7 @@ get-func-name@^2.0.0: resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" integrity sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig== -get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0: +get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0, get-intrinsic@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.1.tgz#d295644fed4505fc9cde952c37ee12b477a83d82" integrity sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw== @@ -3861,7 +3974,7 @@ get-package-type@^0.1.0: resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== -get-stream@^6.0.1: +get-stream@^6.0.0, get-stream@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== @@ -3942,9 +4055,9 @@ globals@^11.1.0: integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globals@^13.19.0: - version "13.20.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.20.0.tgz#ea276a1e508ffd4f1612888f9d1bad1e2717bf82" - integrity sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ== + version "13.21.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.21.0.tgz#163aae12f34ef502f5153cfbdd3600f36c63c571" + integrity sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg== dependencies: type-fest "^0.20.2" @@ -4150,6 +4263,11 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg== +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== + human-signals@^4.3.0: version "4.3.1" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" @@ -4177,7 +4295,7 @@ ignore@^5.1.1, ignore@^5.2.0: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== -import-fresh@^3.0.0, import-fresh@^3.2.1: +import-fresh@^3.2.1: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== @@ -4284,10 +4402,10 @@ is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== -is-core-module@^2.11.0, is-core-module@^2.5.0: - version "2.12.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.1.tgz#0c0b6885b6f80011c71541ce15c8d66cf5a4f9fd" - integrity sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg== +is-core-module@^2.13.0, is-core-module@^2.5.0: + version "2.13.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.0.tgz#bb52aa6e2cbd49a30c2ba68c42bf3435ba6072db" + integrity sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ== dependencies: has "^1.0.3" @@ -4303,6 +4421,11 @@ is-docker@^2.0.0: resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== +is-docker@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-3.0.0.tgz#90093aa3106277d8a77a5910dbae71747e15a200" + integrity sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ== + is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -4339,6 +4462,13 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: dependencies: is-extglob "^2.1.1" +is-inside-container@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-inside-container/-/is-inside-container-1.0.0.tgz#e81fba699662eb31dbdaf26766a61d4814717ea4" + integrity sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA== + dependencies: + is-docker "^3.0.0" + is-ip@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-ip/-/is-ip-2.0.0.tgz#68eea07e8a0a0a94c2d080dd674c731ab2a461ab" @@ -4428,15 +4558,11 @@ is-symbol@^1.0.2, is-symbol@^1.0.3: has-symbols "^1.0.2" is-typed-array@^1.1.10, is-typed-array@^1.1.3, is-typed-array@^1.1.9: - version "1.1.10" - resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.10.tgz#36a5b5cb4189b575d1a3e4b08536bfb485801e3f" - integrity sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A== + version "1.1.12" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a" + integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg== dependencies: - available-typed-arrays "^1.0.5" - call-bind "^1.0.2" - for-each "^0.3.3" - gopd "^1.0.1" - has-tostringtag "^1.0.0" + which-typed-array "^1.1.11" is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" @@ -4472,6 +4598,11 @@ isarray@0.0.1: resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== +isarray@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== + isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -4543,12 +4674,12 @@ istanbul-lib-processinfo@^2.0.2: uuid "^8.3.2" istanbul-lib-report@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#7518fe52ea44de372f460a76b5ecda9ffb73d8a6" - integrity sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw== + version "3.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" + integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== dependencies: istanbul-lib-coverage "^3.0.0" - make-dir "^3.0.0" + make-dir "^4.0.0" supports-color "^7.1.0" istanbul-lib-source-maps@^4.0.0, istanbul-lib-source-maps@^4.0.1: @@ -4561,19 +4692,19 @@ istanbul-lib-source-maps@^4.0.0, istanbul-lib-source-maps@^4.0.1: source-map "^0.6.1" istanbul-reports@^3.0.2, istanbul-reports@^3.0.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.5.tgz#cc9a6ab25cb25659810e4785ed9d9fb742578bae" - integrity sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w== + version "3.1.6" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.6.tgz#2544bcab4768154281a2f0870471902704ccaa1a" + integrity sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg== dependencies: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -jest-util@^29.6.1: - version "29.6.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.6.1.tgz#c9e29a87a6edbf1e39e6dee2b4689b8a146679cb" - integrity sha512-NRFCcjc+/uO3ijUVyNOQJluf8PtGCe/W6cix36+M3cTFgiYqFOOW5MgN4JOOcvbUhcKTYVd1CvHz/LWi8d16Mg== +jest-util@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.6.3.tgz#e15c3eac8716440d1ed076f09bc63ace1aebca63" + integrity sha512-QUjna/xSy4B32fzcKTSz1w7YYzgiHrjjJjevdRf61HYk998R5vVMMNmrHESYZVDS5DSWs+1srPLPKxXPkeSDOA== dependencies: - "@jest/types" "^29.6.1" + "@jest/types" "^29.6.3" "@types/node" "*" chalk "^4.0.0" ci-info "^3.2.0" @@ -4590,12 +4721,12 @@ jest-worker@^27.4.5: supports-color "^8.0.0" jest-worker@^29.5.0: - version "29.6.1" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.6.1.tgz#64b015f0e985ef3a8ad049b61fe92b3db74a5319" - integrity sha512-U+Wrbca7S8ZAxAe9L6nb6g8kPdia5hj32Puu5iOqBCMTMWFHXuK6dOV2IFrpedbTV8fjMFLdWNttQTBL6u2MRA== + version "29.6.4" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.6.4.tgz#f34279f4afc33c872b470d4af21b281ac616abd3" + integrity sha512-6dpvFV4WjcWbDVGgHTWo/aupl8/LbBx2NSKfiwqf79xC/yeJjKHT1+StcKy/2KTmW16hE68ccKVOtXf+WZGz7Q== dependencies: "@types/node" "*" - jest-util "^29.6.1" + jest-util "^29.6.3" merge-stream "^2.0.0" supports-color "^8.0.0" @@ -4672,6 +4803,11 @@ jsesc@~0.5.0: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" integrity sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA== +json-buffer@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== + json-parse-even-better-errors@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" @@ -4716,7 +4852,7 @@ json5@^1.0.2: dependencies: minimist "^1.2.0" -json5@^2.2.2: +json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== @@ -4831,6 +4967,13 @@ karma@^6.4.1: ua-parser-js "^0.7.30" yargs "^16.1.1" +keyv@^4.5.3: + version "4.5.3" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.3.tgz#00873d2b046df737963157bd04f294ca818c9c25" + integrity sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug== + dependencies: + json-buffer "3.0.1" + kind-of@^6.0.2: version "6.0.3" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" @@ -4863,38 +5006,33 @@ linkify-it@^3.0.1: dependencies: uc.micro "^1.0.1" -lint-staged@^13.2.3: - version "13.2.3" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-13.2.3.tgz#f899aad6c093473467e9c9e316e3c2d8a28f87a7" - integrity sha512-zVVEXLuQIhr1Y7R7YAWx4TZLdvuzk7DnmrsTNL0fax6Z3jrpFcas+vKbzxhhvp6TA55m1SQuWkpzI1qbfDZbAg== +lint-staged@^14.0.1: + version "14.0.1" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-14.0.1.tgz#57dfa3013a3d60762d9af5d9c83bdb51291a6232" + integrity sha512-Mw0cL6HXnHN1ag0mN/Dg4g6sr8uf8sn98w2Oc1ECtFto9tvRF7nkXGJRbx8gPlHyoR0pLyBr2lQHbWwmUHe1Sw== dependencies: - chalk "5.2.0" - cli-truncate "^3.1.0" - commander "^10.0.0" - debug "^4.3.4" - execa "^7.0.0" + chalk "5.3.0" + commander "11.0.0" + debug "4.3.4" + execa "7.2.0" lilconfig "2.1.0" - listr2 "^5.0.7" - micromatch "^4.0.5" - normalize-path "^3.0.0" - object-inspect "^1.12.3" - pidtree "^0.6.0" - string-argv "^0.3.1" - yaml "^2.2.2" + listr2 "6.6.1" + micromatch "4.0.5" + pidtree "0.6.0" + string-argv "0.3.2" + yaml "2.3.1" -listr2@^5.0.7: - version "5.0.8" - resolved "https://registry.yarnpkg.com/listr2/-/listr2-5.0.8.tgz#a9379ffeb4bd83a68931a65fb223a11510d6ba23" - integrity sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA== +listr2@6.6.1: + version "6.6.1" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-6.6.1.tgz#08b2329e7e8ba6298481464937099f4a2cd7f95d" + integrity sha512-+rAXGHh0fkEWdXBmX+L6mmfmXmXvDGEKzkjxO+8mP3+nI/r/CWznVBvsibXdxda9Zz0OW2e2ikphN3OwCT/jSg== dependencies: - cli-truncate "^2.1.0" - colorette "^2.0.19" - log-update "^4.0.0" - p-map "^4.0.0" + cli-truncate "^3.1.0" + colorette "^2.0.20" + eventemitter3 "^5.0.1" + log-update "^5.0.1" rfdc "^1.3.0" - rxjs "^7.8.0" - through "^2.3.8" - wrap-ansi "^7.0.0" + wrap-ansi "^8.1.0" loader-runner@^4.2.0: version "4.3.0" @@ -4980,15 +5118,16 @@ log-symbols@4.1.0: chalk "^4.1.0" is-unicode-supported "^0.1.0" -log-update@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/log-update/-/log-update-4.0.0.tgz#589ecd352471f2a1c0c570287543a64dfd20e0a1" - integrity sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg== +log-update@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-5.0.1.tgz#9e928bf70cb183c1f0c9e91d9e6b7115d597ce09" + integrity sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw== dependencies: - ansi-escapes "^4.3.0" - cli-cursor "^3.1.0" - slice-ansi "^4.0.0" - wrap-ansi "^6.2.0" + ansi-escapes "^5.0.0" + cli-cursor "^4.0.0" + slice-ansi "^5.0.0" + strip-ansi "^7.0.1" + wrap-ansi "^8.0.1" log4js@^6.4.1: version "6.9.1" @@ -5037,6 +5176,13 @@ make-dir@^3.0.0, make-dir@^3.0.2: dependencies: semver "^6.0.0" +make-dir@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" + integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== + dependencies: + semver "^7.5.3" + make-error@^1.1.1: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" @@ -5102,7 +5248,7 @@ methods@^1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== -micromatch@^4.0.4, micromatch@^4.0.5: +micromatch@4.0.5, micromatch@^4.0.4, micromatch@^4.0.5: version "4.0.5" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== @@ -5290,9 +5436,9 @@ nise@^5.1.4: path-to-regexp "^1.7.0" node-gyp-build@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.0.tgz#0c52e4cbf54bbd28b709820ef7b6a3c2d6209055" - integrity sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ== + version "4.6.1" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.1.tgz#24b6d075e5e391b8d5539d98c7fc5c210cac8a3e" + integrity sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ== node-polyfill-webpack-plugin@^2.0.1: version "2.0.1" @@ -5332,7 +5478,7 @@ node-preload@^0.2.1: dependencies: process-on-spawn "^1.0.0" -node-releases@^2.0.12: +node-releases@^2.0.13: version "2.0.13" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.13.tgz#d5ed1627c23e3461e819b02e57b75e4899b1c81d" integrity sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ== @@ -5361,6 +5507,13 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: semver "^7.3.4" validate-npm-package-name "^3.0.0" +npm-run-path@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + npm-run-path@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-5.1.0.tgz#bc62f7f3f6952d9894bd08944ba011a6ee7b7e00" @@ -5455,22 +5608,41 @@ object.assign@^4.1.2, object.assign@^4.1.4: object-keys "^1.1.1" object.entries@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.6.tgz#9737d0e5b8291edd340a3e3264bb8a3b00d5fa23" - integrity sha512-leTPzo4Zvg3pmbQ3rDK69Rl8GQvIqMWubrkxONG9/ojtFE2rD9fjMKfSI5BxW3osRH1m6VdzmqK8oAY9aT4x5w== + version "1.1.7" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.7.tgz#2b47760e2a2e3a752f39dd874655c61a7f03c131" + integrity sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA== dependencies: call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" + define-properties "^1.2.0" + es-abstract "^1.22.1" + +object.fromentries@^2.0.6: + version "2.0.7" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.7.tgz#71e95f441e9a0ea6baf682ecaaf37fa2a8d7e616" + integrity sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + +object.groupby@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object.groupby/-/object.groupby-1.0.1.tgz#d41d9f3c8d6c778d9cbac86b4ee9f5af103152ee" + integrity sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" object.values@^1.1.6: - version "1.1.6" - resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.6.tgz#4abbaa71eba47d63589d402856f908243eea9b1d" - integrity sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw== + version "1.1.7" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.7.tgz#617ed13272e7e1071b43973aa1655d9291b8442a" + integrity sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng== dependencies: call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" + define-properties "^1.2.0" + es-abstract "^1.22.1" on-finished@2.4.1: version "2.4.1" @@ -5493,7 +5665,7 @@ once@^1.3.0, once@^1.4.0: dependencies: wrappy "1" -onetime@^5.1.0: +onetime@^5.1.0, onetime@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== @@ -5507,6 +5679,16 @@ onetime@^6.0.0: dependencies: mimic-fn "^4.0.0" +open@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/open/-/open-9.1.0.tgz#684934359c90ad25742f5a26151970ff8c6c80b6" + integrity sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg== + dependencies: + default-browser "^4.0.0" + define-lazy-prop "^3.0.0" + is-inside-container "^1.0.0" + is-wsl "^2.2.0" + opt-cli@1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/opt-cli/-/opt-cli-1.5.1.tgz#04db447b13c96b992eb31685266f4ed0d9736dc2" @@ -5590,13 +5772,6 @@ p-map@^3.0.0: dependencies: aggregate-error "^3.0.0" -p-map@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b" - integrity sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ== - dependencies: - aggregate-error "^3.0.0" - p-try@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" @@ -5670,7 +5845,7 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== -path-key@^3.1.0: +path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== @@ -5728,7 +5903,7 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -pidtree@^0.6.0: +pidtree@0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.6.0.tgz#90ad7b6d42d5841e69e0a2419ef38f8883aa057c" integrity sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g== @@ -5776,10 +5951,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@^2.8.7: - version "2.8.8" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" - integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== +prettier@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643" + integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg== process-nextick-args@~2.0.0: version "2.0.1" @@ -5953,19 +6128,19 @@ regenerate@^1.4.2: resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a" integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A== -regenerator-runtime@^0.13.11: - version "0.13.11" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" - integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== +regenerator-runtime@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" + integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== -regenerator-transform@^0.15.1: - version "0.15.1" - resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.15.1.tgz#f6c4e99fc1b4591f780db2586328e4d9a9d8dc56" - integrity sha512-knzmNAcuyxV+gQCufkYcvOqX/qIIfHLv0u5x79kRxuGojfYVky1f15TzZEu2Avte8QGepvUNTnLskf8E6X6Vyg== +regenerator-transform@^0.15.2: + version "0.15.2" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.15.2.tgz#5bbae58b522098ebdf09bca2f83838929001c7a4" + integrity sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg== dependencies: "@babel/runtime" "^7.8.4" -regexp.prototype.flags@^1.4.3: +regexp.prototype.flags@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz#fe7ce25e7e4cca8db37b6634c8a2c7009199b9cb" integrity sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA== @@ -6075,19 +6250,19 @@ resolve-from@^5.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== -resolve@^1.10.1, resolve@^1.14.2, resolve@^1.20.0, resolve@^1.22.1, resolve@^1.3.2: - version "1.22.2" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" - integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== +resolve@^1.10.1, resolve@^1.14.2, resolve@^1.20.0, resolve@^1.22.4, resolve@^1.3.2: + version "1.22.4" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.4.tgz#1dc40df46554cdaf8948a486a10f6ba1e2026c34" + integrity sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg== dependencies: - is-core-module "^2.11.0" + is-core-module "^2.13.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -restore-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" - integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== +restore-cursor@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-4.0.0.tgz#519560a4318975096def6e609d44100edaa4ccb9" + integrity sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg== dependencies: onetime "^5.1.0" signal-exit "^3.0.2" @@ -6129,6 +6304,13 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" +run-applescript@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/run-applescript/-/run-applescript-5.0.0.tgz#e11e1c932e055d5c6b40d98374e0268d9b11899c" + integrity sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg== + dependencies: + execa "^5.0.0" + run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -6136,12 +6318,15 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -rxjs@^7.8.0: - version "7.8.1" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" - integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== +safe-array-concat@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.0.1.tgz#91686a63ce3adbea14d61b14c99572a8ff84754c" + integrity sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q== dependencies: - tslib "^2.1.0" + call-bind "^1.0.2" + get-intrinsic "^1.2.1" + has-symbols "^1.0.3" + isarray "^2.0.5" safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: version "5.2.1" @@ -6186,7 +6371,7 @@ schema-utils@^4.0.0: ajv-formats "^2.1.1" ajv-keywords "^5.1.0" -"semver@2 >=2.2.1 || 3.x || 4 || 5 || 7", semver@^7.3.4, semver@^7.3.7, semver@^7.3.8: +"semver@2 >=2.2.1 || 3.x || 4 || 5 || 7", semver@^7.3.4, semver@^7.3.7, semver@^7.3.8, semver@^7.5.2, semver@^7.5.3, semver@^7.5.4: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== @@ -6198,7 +6383,7 @@ semver@^5.3.0, semver@^5.6.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== -semver@^6.0.0, semver@^6.1.0, semver@^6.2.0, semver@^6.3.0, semver@^6.3.1: +semver@^6.0.0, semver@^6.1.0, semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== @@ -6268,7 +6453,7 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" -signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.7: +signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== @@ -6300,24 +6485,6 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -slice-ansi@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-3.0.0.tgz#31ddc10930a1b7e0b67b08c96c2f49b77a789787" - integrity sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ== - dependencies: - ansi-styles "^4.0.0" - astral-regex "^2.0.0" - is-fullwidth-code-point "^3.0.0" - -slice-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" - integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== - dependencies: - ansi-styles "^4.0.0" - astral-regex "^2.0.0" - is-fullwidth-code-point "^3.0.0" - slice-ansi@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-5.0.0.tgz#b73063c57aa96f9cd881654b15294d95d285c42a" @@ -6347,15 +6514,15 @@ socket.io-parser@~4.2.4: debug "~4.3.1" socket.io@^4.4.1: - version "4.7.1" - resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.7.1.tgz#9009f31bf7be25478895145e92fbc972ad1db900" - integrity sha512-W+utHys2w//dhFjy7iQQu9sGd3eokCjGbl2r59tyLqNiJJBdIebn3GAKEXBr3osqHTObJi2die/25bCx2zsaaw== + version "4.7.2" + resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.7.2.tgz#22557d76c3f3ca48f82e73d68b7add36a22df002" + integrity sha512-bvKVS29/I5fl2FGLNHuXlQaUH/BlzX1IN6S+NKLNZpBsPZIDH+90eQmCs2Railn4YUiww4SzUedJ6+uzwFnKLw== dependencies: accepts "~1.3.4" base64id "~2.0.0" cors "~2.8.5" debug "~4.3.2" - engine.io "~6.5.0" + engine.io "~6.5.2" socket.io-adapter "~2.5.2" socket.io-parser "~4.2.4" @@ -6464,16 +6631,14 @@ statuses@~1.5.0: resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== -stellar-base@^10.0.0-soroban.4: - version "10.0.0-soroban.4" - resolved "https://registry.yarnpkg.com/stellar-base/-/stellar-base-10.0.0-soroban.4.tgz#9baeaec1f750473cb0dc00c6fa0f3ec23cf7177d" - integrity sha512-Afl2Mlh+aXokIHhy2x67Df5ofbss83oAOHV7pHLI0fsPlxAgs7YtbClzkNxvpnXyxQI77PMIWFJbT17Y3dR/+A== +stellar-base@^10.0.0-soroban.8: + version "10.0.0-soroban.8" + resolved "https://registry.yarnpkg.com/stellar-base/-/stellar-base-10.0.0-soroban.8.tgz#8c5671f9d5a183aeb3077746db56e65b0b5c05da" + integrity sha512-mtj+4EcCnp4ZyH2FzRl62/DAstTXOddHVRZdzFQ94WgyQz2yVNzt+ANDS1D/7ku4d2mIzoJIj9l0/H0A5nRgXQ== dependencies: base32.js "^0.1.0" - bignumber.js "^9.1.1" + bignumber.js "^9.1.2" buffer "^6.0.3" - crc "^4.3.2" - crypto-browserify "^3.12.0" js-xdr "^3.0.0" sha.js "^2.3.6" tweetnacl "^1.0.3" @@ -6507,7 +6672,7 @@ streamroller@^3.1.5: debug "^4.3.4" fs-extra "^8.1.0" -string-argv@^0.3.1: +string-argv@0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q== @@ -6530,7 +6695,7 @@ string-width@^1.0.1: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string-width@^5.0.0: +string-width@^5.0.0, string-width@^5.0.1: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== @@ -6558,13 +6723,13 @@ string.prototype.trimend@^1.0.6: es-abstract "^1.20.4" string.prototype.trimstart@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz#e90ab66aa8e4007d92ef591bbf3cd422c56bdcf4" - integrity sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA== + version "1.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz#d4cdb44b83a4737ffbac2d406e405d43d0184298" + integrity sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg== dependencies: call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" + define-properties "^1.2.0" + es-abstract "^1.22.1" string_decoder@^1.1.1, string_decoder@^1.3.0: version "1.3.0" @@ -6611,6 +6776,11 @@ strip-bom@^4.0.0: resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + strip-final-newline@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" @@ -6627,9 +6797,9 @@ strip-json-comments@^2.0.1: integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== superagent@^8.0.9: - version "8.0.9" - resolved "https://registry.yarnpkg.com/superagent/-/superagent-8.0.9.tgz#2c6fda6fadb40516515f93e9098c0eb1602e0535" - integrity sha512-4C7Bh5pyHTvU33KpZgwrNKh/VQnvgtCSqPRfJAUdmrtSYePVzVg4E4OzsrbkhJj9O7SO6Bnv75K/F8XVZT8YHA== + version "8.1.2" + resolved "https://registry.yarnpkg.com/superagent/-/superagent-8.1.2.tgz#03cb7da3ec8b32472c9d20f6c2a57c7f3765f30b" + integrity sha512-6WTxW1EB6yCxV5VFOIPQruWGHqc3yI7hEmZK6h+pyk69Lk/Ut7rLUY6W/ONF2MjBuGjvmMiIpsrVJ2vjrHlslA== dependencies: component-emitter "^1.3.0" cookiejar "^2.1.4" @@ -6673,6 +6843,14 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== +synckit@^0.8.5: + version "0.8.5" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.5.tgz#b7f4358f9bb559437f9f167eb6bc46b3c9818fa3" + integrity sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q== + dependencies: + "@pkgr/utils" "^2.3.1" + tslib "^2.5.0" + taffydb@^2.7.3: version "2.7.3" resolved "https://registry.yarnpkg.com/taffydb/-/taffydb-2.7.3.tgz#2ad37169629498fca5bc84243096d3cde0ec3a34" @@ -6695,9 +6873,9 @@ tar-stream@^2.1.4: readable-stream "^3.1.1" tar@^6.1.11: - version "6.1.15" - resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.15.tgz#c9738b0b98845a3b344d334b8fa3041aaba53a69" - integrity sha512-/zKt9UyngnxIT/EAGYuxaMYgOIJiP81ab9ZfkILq4oNLPFX50qyYmu7jRj9qeXoxmJHjGlbH0+cm2uy1WCs10A== + version "6.2.0" + resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.0.tgz#b14ce49a79cb1cd23bc9b016302dea5474493f73" + integrity sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ== dependencies: chownr "^2.0.0" fs-minipass "^2.0.0" @@ -6718,9 +6896,9 @@ terser-webpack-plugin@^5.3.7, terser-webpack-plugin@^5.3.9: terser "^5.16.8" terser@^5.16.8: - version "5.19.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.19.0.tgz#7b3137b01226bdd179978207b9c8148754a6da9c" - integrity sha512-JpcpGOQLOXm2jsomozdMDpd5f8ZHh1rR48OFgWUH3QsyZcfPgv2qDCYbcDEAYNd4OZRj2bWYKpwdll/udZCk/Q== + version "5.19.4" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.19.4.tgz#941426fa482bf9b40a0308ab2b3cd0cf7c775ebd" + integrity sha512-6p1DjHeuluwxDXcuT9VR8p64klWJKo1ILiy19s6C9+0Bh2+NWTX6nD9EPppiER4ICkHDVB1RkVpin/YW2nQn/g== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.8.2" @@ -6741,11 +6919,6 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== -through@^2.3.8: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== - timers-browserify@^2.0.12: version "2.0.12" resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.12.tgz#44a45c11fbf407f34f97bccd1577c652361b00ee" @@ -6753,6 +6926,11 @@ timers-browserify@^2.0.12: dependencies: setimmediate "^1.0.4" +titleize@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53" + integrity sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ== + tmp@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" @@ -6790,6 +6968,11 @@ tough-cookie@~2.5.0: psl "^1.1.28" punycode "^2.1.1" +ts-api-utils@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.2.tgz#7c094f753b6705ee4faee25c3c684ade52d66d99" + integrity sha512-Cbu4nIqnEdd+THNEsBdkolnOXhg0I8XteoHaEKgvsxpsbWda4IsUut2c187HxywQCvveojow0Dgw/amxtSKVkQ== + ts-node@^10.9.1: version "10.9.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" @@ -6809,7 +6992,7 @@ ts-node@^10.9.1: v8-compile-cache-lib "^3.0.1" yn "3.1.1" -tsconfig-paths@^3.14.1: +tsconfig-paths@^3.14.2: version "3.14.2" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088" integrity sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g== @@ -6824,10 +7007,10 @@ tslib@^1.8.0, tslib@^1.8.1: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.1.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3" - integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA== +tslib@^2.5.0, tslib@^2.6.0: + version "2.6.2" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" + integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== tslint@5.14.0: version "5.14.0" @@ -6901,16 +7084,16 @@ type-fest@^0.20.2: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== -type-fest@^0.21.3: - version "0.21.3" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" - integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== - type-fest@^0.8.0: version "0.8.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== +type-fest@^1.0.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" + integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== + type-fest@^2.14.0: version "2.19.0" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.19.0.tgz#88068015bb33036a598b952e55e9311a60fd3a9b" @@ -6924,6 +7107,36 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" +typed-array-buffer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz#18de3e7ed7974b0a729d3feecb94338d1472cd60" + integrity sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.1" + is-typed-array "^1.1.10" + +typed-array-byte-length@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz#d787a24a995711611fb2b87a4052799517b230d0" + integrity sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA== + dependencies: + call-bind "^1.0.2" + for-each "^0.3.3" + has-proto "^1.0.1" + is-typed-array "^1.1.10" + +typed-array-byte-offset@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz#cbbe89b51fdef9cd6aaf07ad4707340abbc4ea0b" + integrity sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + for-each "^0.3.3" + has-proto "^1.0.1" + is-typed-array "^1.1.10" + typed-array-length@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb" @@ -6945,10 +7158,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -typescript@^5.1.6: - version "5.1.6" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" - integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== +typescript@^5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" + integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== ua-parser-js@^0.7.30: version "0.7.35" @@ -7008,6 +7221,11 @@ unpipe@1.0.0, unpipe@~1.0.0: resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== +untildify@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" + integrity sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw== + update-browserslist-db@^1.0.11: version "1.0.11" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz#9a2a641ad2907ae7b3616506f4b977851db5b940" @@ -7163,10 +7381,10 @@ webpack-sources@^3.2.3: resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== -webpack@^5.88.1: - version "5.88.1" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.88.1.tgz#21eba01e81bd5edff1968aea726e2fbfd557d3f8" - integrity sha512-FROX3TxQnC/ox4N+3xQoWZzvGXSuscxR32rbzjpXgEzWudJFEJBpdlkkob2ylrv5yzzufD1zph1OoFsLtm6stQ== +webpack@^5.88.2: + version "5.88.2" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.88.2.tgz#f62b4b842f1c6ff580f3fcb2ed4f0b579f4c210e" + integrity sha512-JmcgNZ1iKj+aiR0OvTYtWQqJwq37Pf683dY9bVORwVbUrDhLhdn/PlO2sHsFHPkj7sHNQF3JwaAkp49V+Sq1tQ== dependencies: "@types/eslint-scope" "^3.7.3" "@types/estree" "^1.0.0" @@ -7209,17 +7427,16 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.1.tgz#776b1fe35d90aebe99e8ac15eb24093389a4a409" integrity sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ== -which-typed-array@^1.1.2, which-typed-array@^1.1.9: - version "1.1.10" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.10.tgz#74baa2789991905c2076abb317103b866c64e69e" - integrity sha512-uxoA5vLUfRPdjCuJ1h5LlYdmTLbYfums398v3WLkM+i/Wltl2/XyZpQWKbN++ck5L64SR/grOHqtXCUKmlZPNA== +which-typed-array@^1.1.10, which-typed-array@^1.1.11, which-typed-array@^1.1.2: + version "1.1.11" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.11.tgz#99d691f23c72aab6768680805a271b69761ed61a" + integrity sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew== dependencies: available-typed-arrays "^1.0.5" call-bind "^1.0.2" for-each "^0.3.3" gopd "^1.0.1" has-tostringtag "^1.0.0" - is-typed-array "^1.1.10" which@^1.2.1: version "1.3.1" @@ -7270,6 +7487,15 @@ wrap-ansi@^7.0.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" + integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== + dependencies: + ansi-styles "^6.1.0" + string-width "^5.0.1" + strip-ansi "^7.0.1" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" @@ -7320,7 +7546,7 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yaml@^2.2.2: +yaml@2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.1.tgz#02fe0975d23cd441242aa7204e09fc28ac2ac33b" integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ== From 59b841c5e739494ced68f075dbc81902edb7441e Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Thu, 7 Sep 2023 16:36:33 -0700 Subject: [PATCH 5/8] Drop redundancies, tests pass! --- src/horizon/call_builder.ts | 5 +- src/horizon/horizon_axios_client.ts | 2 +- src/index.ts | 34 +- src/soroban/axios.ts | 72 +-- src/soroban/index.ts | 17 +- test/integration/apiary.js | 7 +- test/integration/client_headers_test.js | 6 +- test/integration/streaming_test.js | 9 +- test/test-browser.js | 1 + test/test-nodejs.js | 1 + test/unit/call_builders_test.js | 2 +- test/unit/federation_server_test.js | 86 +-- test/unit/horizon_path_test.js | 18 +- test/unit/liquidity_pool_endpoints_test.js | 38 +- test/unit/server/claimable_balances.js | 28 +- test/unit/server/join_test.js | 10 +- test/unit/server_check_memo_required_test.js | 20 +- test/unit/server_test.js | 407 ++++++------ test/unit/server_transaction_test.js | 44 +- test/unit/stellar_toml_resolver_test.js | 18 +- test/unit/utils_test.js | 644 +++++++++---------- 21 files changed, 699 insertions(+), 770 deletions(-) diff --git a/src/horizon/call_builder.ts b/src/horizon/call_builder.ts index cd568ab5f..2f3edbb74 100644 --- a/src/horizon/call_builder.ts +++ b/src/horizon/call_builder.ts @@ -4,12 +4,9 @@ import URITemplate from "urijs/src/URITemplate"; import { BadRequestError, NetworkError, NotFoundError } from "../errors"; import { Horizon } from "./horizon_api"; -import { HorizonAxiosClient } from "./horizon_axios_client"; +import { HorizonAxiosClient, version } from "./horizon_axios_client"; import { ServerApi } from "./server_api"; -/* tslint:disable-next-line:no-var-requires */ -const version = require("../package.json").version; - // Resources which can be included in the Horizon response via the `join` // query-param. const JOINABLE = ["transaction"]; diff --git a/src/horizon/horizon_axios_client.ts b/src/horizon/horizon_axios_client.ts index 57ff1cc18..9f2c1c074 100644 --- a/src/horizon/horizon_axios_client.ts +++ b/src/horizon/horizon_axios_client.ts @@ -2,7 +2,7 @@ import axios, { AxiosResponse } from "axios"; import URI from "urijs"; /* tslint:disable-next-line:no-var-requires */ -const version = require("../../package.json").version; +export const version = require("../../package.json").version; export interface ServerTime { serverTime: number; diff --git a/src/index.ts b/src/index.ts index a8eaffebd..9fa315ed3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,33 +1,39 @@ // tslint:disable-next-line: no-reference /// -/* tslint:disable:no-var-requires */ -const version = require("../package.json").version; - // Expose all types -export * from "./horizon"; +export * from './horizon'; +export * from './soroban/soroban_rpc'; // stellar-sdk classes to expose -export * from "./errors"; -export { Config } from "./config"; +export * from './errors'; +export { Config } from './config'; export { FederationServer, FEDERATION_RESPONSE_MAX_SIZE -} from "./federation/federation_server"; +} from './federation/federation_server'; export { StellarTomlResolver, STELLAR_TOML_MAX_SIZE -} from "./federation/stellar_toml_resolver"; +} from './federation/stellar_toml_resolver'; + export { default as HorizonAxiosClient, SERVER_TIME_MAP, - getCurrentServerTime -} from "./horizon/horizon_axios_client"; -export * from "./utils"; + getCurrentServerTime, + version +} from './horizon/horizon_axios_client'; -// expose classes and functions from stellar-base -export * from "stellar-base"; +export { Server as HorizonServer } from './horizon/server'; + +export * from './utils'; -export { version }; +// soroban-client classes to expose +export { SorobanClient, AxiosClient as SorobanAxiosClient } from './soroban'; + +export * from './soroban/transaction'; + +// expose classes and functions from stellar-base +export * from 'stellar-base'; export default module.exports; diff --git a/src/soroban/axios.ts b/src/soroban/axios.ts index 384015a4c..8fe3617b4 100644 --- a/src/soroban/axios.ts +++ b/src/soroban/axios.ts @@ -1,27 +1,7 @@ -import axios, { AxiosResponse } from "axios"; -import URI from "urijs"; +import axios from "axios"; /* tslint:disable-next-line:no-var-requires */ -const version = require("../package.json").version; - -export interface ServerTime { - serverTime: number; - localTimeRecorded: number; -} - -/** - * keep a local map of server times - * (export this purely for testing purposes) - * - * each entry will map the server domain to the last-known time and the local - * time it was recorded, ex: - * - * "localhost:8000": { - * serverTime: 1552513039, - * localTimeRecorded: 1552513052 - * } - */ -export const SERVER_TIME_MAP: Record = {}; +export const version = require("../../package.json").version; const AxiosClient = axios.create({ headers: { @@ -30,52 +10,4 @@ const AxiosClient = axios.create({ }, }); -function _toSeconds(ms: number): number { - return Math.floor(ms / 1000); -} - -AxiosClient.interceptors.response.use(function interceptorHorizonResponse( - response: AxiosResponse, -) { - const hostname = URI(response.config.url!).hostname(); - const serverTime = _toSeconds(Date.parse(response.headers.date)); - const localTimeRecorded = _toSeconds(new Date().getTime()); - - if (!isNaN(serverTime)) { - SERVER_TIME_MAP[hostname] = { - serverTime, - localTimeRecorded, - }; - } - - return response; -}); - export default AxiosClient; - -/** - * Given a hostname, get the current time of that server (i.e., use the last- - * recorded server time and offset it by the time since then.) If there IS no - * recorded server time, or it's been 5 minutes since the last, return null. - * @param {string} hostname Hostname of a Soroban-RPC server. - * @returns {number} The UNIX timestamp (in seconds, not milliseconds) - * representing the current time on that server, or `null` if we don't have - * a record of that time. - */ -export function getCurrentServerTime(hostname: string): number | null { - const entry = SERVER_TIME_MAP[hostname]; - - if (!entry || !entry.localTimeRecorded || !entry.serverTime) { - return null; - } - - const { serverTime, localTimeRecorded } = entry; - const currentTime = _toSeconds(new Date().getTime()); - - // if it's been more than 5 minutes from the last time, then null it out - if (currentTime - localTimeRecorded > 60 * 5) { - return null; - } - - return currentTime - localTimeRecorded + serverTime; -} diff --git a/src/soroban/index.ts b/src/soroban/index.ts index eb4c72581..94c74a5f0 100644 --- a/src/soroban/index.ts +++ b/src/soroban/index.ts @@ -1,25 +1,12 @@ // tslint:disable-next-line: no-reference /// -/* tslint:disable:no-var-requires */ -require("es6-promise").polyfill(); -const version = require("../../package.json").version; - // Expose all types export * from "./soroban_rpc"; // stellar-sdk classes to expose -export { Server } from "./server"; -export { - default as AxiosClient, - SERVER_TIME_MAP, - getCurrentServerTime, -} from "./axios"; +export { Server as SorobanClient } from "./server"; +export { default as AxiosClient } from "./axios"; export * from "./transaction"; -// expose classes and functions from stellar-base -export * from "stellar-base"; - -export { version }; - export default module.exports; diff --git a/test/integration/apiary.js b/test/integration/apiary.js index 7050bb4ee..d08603b99 100644 --- a/test/integration/apiary.js +++ b/test/integration/apiary.js @@ -4,13 +4,14 @@ // All endpoints from here are tested: // https://docs.google.com/document/d/1pXL8kr1a2vfYSap9T67R-g72B_WWbaE1YsLMa04OgoU/edit const _ = require("lodash"); +const { HorizonServer } = StellarSdk; const MOCK_SERVER = "https://private-d133c-ammmock.apiary-mock.com"; describe("tests the /liquidity_pools endpoint", function () { const lpId = "0569b19c75d7ecadce50501fffad6fe8ba4652455df9e1cc96dc408141124dd5"; - const server = new StellarSdk.Server(MOCK_SERVER, { allowHttp: true }); + const server = new HorizonServer(MOCK_SERVER, { allowHttp: true }); it("GET /", function (done) { chai @@ -93,7 +94,7 @@ describe("tests the /liquidity_pools endpoint", function () { }); describe("tests the /accounts endpoint", function () { - const server = new StellarSdk.Server(MOCK_SERVER, { allowHttp: true }); + const server = new HorizonServer(MOCK_SERVER, { allowHttp: true }); it("GET /", function (done) { chai @@ -157,7 +158,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..1e4f285fc 100644 --- a/test/integration/client_headers_test.js +++ b/test/integration/client_headers_test.js @@ -1,3 +1,5 @@ +const { HorizonServer } = StellarSdk; + const http = require("http"); const url = require("url"); const port = 3100; @@ -27,7 +29,7 @@ describe("integration tests: client headers", function (done) { return; } - new StellarSdk.Server(`http://localhost:${port}`, { allowHttp: true }) + new HorizonServer(`http://localhost:${port}`, { allowHttp: true }) .operations() .call(); }); @@ -56,7 +58,7 @@ describe("integration tests: client headers", function (done) { return; } - closeStream = new StellarSdk.Server(`http://localhost:${port}`, { + closeStream = new HorizonServer(`http://localhost:${port}`, { allowHttp: true, }) .operations() diff --git a/test/integration/streaming_test.js b/test/integration/streaming_test.js index 080fafc1c..8feced34f 100644 --- a/test/integration/streaming_test.js +++ b/test/integration/streaming_test.js @@ -1,5 +1,6 @@ +const { HorizonServer } = StellarSdk; + const http = require("http"); -const url = require("url"); const port = 3100; describe("integration tests: streaming", function (done) { @@ -26,7 +27,7 @@ describe("integration tests: streaming", function (done) { return; } - closeStream = new StellarSdk.Server(`http://localhost:${port}`, { + closeStream = new HorizonServer(`http://localhost:${port}`, { allowHttp: true, }) .operations() @@ -72,7 +73,7 @@ describe("integration tests: streaming", function (done) { return; } - closeStream = new StellarSdk.Server(`http://localhost:${port}`, { + closeStream = new HorizonServer(`http://localhost:${port}`, { allowHttp: true, }) .operations() @@ -99,7 +100,7 @@ describe("end-to-end tests: real streaming", function (done) { // ledger's transaction batch). it("streams in perpetuity", function (done) { const DURATION = 30; - const server = new StellarSdk.Server("https://horizon.stellar.org"); + const server = new HorizonServer("https://horizon.stellar.org"); this.timeout((DURATION + 5) * 1000); // pad timeout let transactions = []; diff --git a/test/test-browser.js b/test/test-browser.js index 430811c72..8bc12eeba 100644 --- a/test/test-browser.js +++ b/test/test-browser.js @@ -2,3 +2,4 @@ chai.use(require("chai-as-promised")); window.axios = StellarSdk.axios; window.HorizonAxiosClient = StellarSdk.HorizonAxiosClient; +window.SorobanAxiosClient = StellarSdk.SorobanAxiosClient; diff --git a/test/test-nodejs.js b/test/test-nodejs.js index 50c87d04b..cd5d582db 100644 --- a/test/test-nodejs.js +++ b/test/test-nodejs.js @@ -5,6 +5,7 @@ global.StellarSdk = require("../lib/"); global.axios = require("axios"); global.HorizonAxiosClient = StellarSdk.HorizonAxiosClient; +global.SorobanAxiosClient = StellarSdk.SorobanAxiosClient; var chaiAsPromised = require("chai-as-promised"); var chaiHttp = require("chai-http"); diff --git a/test/unit/call_builders_test.js b/test/unit/call_builders_test.js index 28a8f882f..80541b7ec 100644 --- a/test/unit/call_builders_test.js +++ b/test/unit/call_builders_test.js @@ -10,7 +10,7 @@ describe("CallBuilder functions", function () { 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 bc3bad34d..b8d97181f 100644 --- a/test/unit/federation_server_test.js +++ b/test/unit/federation_server_test.js @@ -4,7 +4,7 @@ describe("federation-server.js tests", function () { beforeEach(function () { this.server = new StellarSdk.FederationServer( "https://acme.com:1337/federation", - "stellar.org" + "stellar.org", ); this.axiosMock = sinon.mock(axios); @@ -21,8 +21,8 @@ describe("federation-server.js tests", function () { () => new StellarSdk.FederationServer( "http://acme.com:1337/federation", - "stellar.org" - ) + "stellar.org", + ), ).to.throw(/Cannot connect to insecure federation server/); }); @@ -32,8 +32,8 @@ describe("federation-server.js tests", function () { new StellarSdk.FederationServer( "http://acme.com:1337/federation", "stellar.org", - { allowHttp: true } - ) + { allowHttp: true }, + ), ).to.not.throw(); }); @@ -44,8 +44,8 @@ describe("federation-server.js tests", function () { new StellarSdk.FederationServer( "http://acme.com:1337/federation", "stellar.org", - { allowHttp: true } - ) + { allowHttp: true }, + ), ).to.not.throw(); }); }); @@ -56,8 +56,8 @@ describe("federation-server.js tests", function () { .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({ @@ -66,7 +66,7 @@ describe("federation-server.js tests", function () { account_id: "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", }, - }) + }), ); }); @@ -76,7 +76,7 @@ describe("federation-server.js tests", function () { .then((response) => { expect(response.stellar_address).equals("bob*stellar.org"); expect(response.account_id).equals( - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS" + "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", ); done(); }) @@ -91,7 +91,7 @@ describe("federation-server.js tests", function () { .then((response) => { expect(response.stellar_address).equals("bob*stellar.org"); expect(response.account_id).equals( - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS" + "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", ); done(); }) @@ -107,8 +107,8 @@ describe("federation-server.js tests", function () { .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({ @@ -117,19 +117,19 @@ describe("federation-server.js tests", function () { account_id: "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", }, - }) + }), ); }); it("requests is correct", function (done) { this.server .resolveAccountId( - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS" + "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", ) .then((response) => { expect(response.stellar_address).equals("bob*stellar.org"); expect(response.account_id).equals( - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS" + "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", ); done(); }) @@ -145,8 +145,8 @@ describe("federation-server.js tests", function () { .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({ @@ -155,19 +155,19 @@ describe("federation-server.js tests", function () { account_id: "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", }, - }) + }), ); }); it("requests is correct", function (done) { this.server .resolveTransactionId( - "3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889" + "3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889", ) .then((response) => { expect(response.stellar_address).equals("bob*stellar.org"); expect(response.account_id).equals( - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS" + "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", ); done(); }) @@ -189,19 +189,19 @@ describe("federation-server.js tests", function () { # for users on your domain. FEDERATION_SERVER="https://api.stellar.org/federation" `, - }) + }), ); StellarSdk.FederationServer.createForDomain("acme.com").then( (federationServer) => { 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"); done(); - } + }, ); }); @@ -212,12 +212,12 @@ FEDERATION_SERVER="https://api.stellar.org/federation" .returns( Promise.resolve({ data: "", - }) + }), ); 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); }); @@ -226,7 +226,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" describe("FederationServer.resolve", function () { it("succeeds for a valid account ID", function (done) { StellarSdk.FederationServer.resolve( - "GAFSZ3VPBC2H2DVKCEWLN3PQWZW6BVDMFROWJUDAJ3KWSOKQIJ4R5W4J" + "GAFSZ3VPBC2H2DVKCEWLN3PQWZW6BVDMFROWJUDAJ3KWSOKQIJ4R5W4J", ) .should.eventually.deep.equal({ account_id: @@ -252,15 +252,15 @@ FEDERATION_SERVER="https://api.stellar.org/federation" # for users on your domain. FEDERATION_SERVER="https://api.stellar.org/federation" `, - }) + }), ); this.axiosMock .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({ @@ -271,7 +271,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" memo_type: "id", memo: "100", }, - }) + }), ); StellarSdk.FederationServer.resolve("bob*stellar.org") @@ -296,8 +296,8 @@ FEDERATION_SERVER="https://api.stellar.org/federation" .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({ @@ -308,7 +308,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" memo_type: "id", memo: 100, }, - }) + }), ); this.server @@ -323,7 +323,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" return done(); } var response = Array(StellarSdk.FEDERATION_RESPONSE_MAX_SIZE + 10).join( - "a" + "a", ); let tempServer = http .createServer((req, res) => { @@ -334,11 +334,11 @@ FEDERATION_SERVER="https://api.stellar.org/federation" new StellarSdk.FederationServer( "http://localhost:4444/federation", "stellar.org", - { allowHttp: true } + { allowHttp: true }, ) .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()); @@ -376,7 +376,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" new StellarSdk.FederationServer( "http://localhost:4444/federation", "stellar.org", - opts + opts, ) .resolveAddress("bob*stellar.org") .should.be.rejectedWith(/timeout of 1000ms exceeded/) @@ -398,10 +398,10 @@ FEDERATION_SERVER="https://api.stellar.org/federation" new StellarSdk.FederationServer( "http://localhost:4444/federation", "stellar.org", - opts + opts, ) .resolveAccountId( - "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS" + "GB5XVAABEQMY63WTHDQ5RXADGYF345VWMNPTN2GFUDZT57D57ZQTJ7PS", ) .should.be.rejectedWith(/timeout of 1000ms exceeded/) .notify(done) @@ -422,10 +422,10 @@ FEDERATION_SERVER="https://api.stellar.org/federation" new StellarSdk.FederationServer( "http://localhost:4444/federation", "stellar.org", - opts + opts, ) .resolveTransactionId( - "3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889" + "3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889", ) .should.be.rejectedWith(/timeout of 1000ms exceeded/) .notify(done) diff --git a/test/unit/horizon_path_test.js b/test/unit/horizon_path_test.js index 65ef48ace..06e7da01b 100644 --- a/test/unit/horizon_path_test.js +++ b/test/unit/horizon_path_test.js @@ -1,3 +1,5 @@ +const { HorizonServer } = StellarSdk; + describe("horizon path tests", function () { beforeEach(function () { this.axiosMock = sinon.mock(HorizonAxiosClient); @@ -10,7 +12,7 @@ describe("horizon path tests", function () { }); function test_horizon_paths(serverUrl) { - let server = new StellarSdk.Server(serverUrl); + let server = new HorizonServer(serverUrl); let randomResult = { data: { @@ -47,7 +49,7 @@ describe("horizon path tests", function () { .call() .should.eventually.deep.equal(randomResult.data) .notify(done); - } + }, ); it("server.transactions() " + serverUrl, function (done) { @@ -69,7 +71,7 @@ describe("horizon path tests", function () { .call() .should.eventually.deep.equal(randomResult.data) .notify(done); - } + }, ); it("server.operations().includeFailed(true) " + serverUrl, function (done) { @@ -92,7 +94,7 @@ describe("horizon path tests", function () { .call() .should.eventually.deep.equal(randomResult.data) .notify(done); - } + }, ); it( @@ -105,7 +107,7 @@ describe("horizon path tests", function () { .call() .should.eventually.deep.equal(randomResult.data) .notify(done); - } + }, ); it("server.submitTransaction() " + serverUrl, function (done) { @@ -114,7 +116,7 @@ describe("horizon path tests", function () { let keypair = StellarSdk.Keypair.random(); let account = new StellarSdk.Account( keypair.publicKey(), - "56199647068161" + "56199647068161", ); let fakeTransaction = new StellarSdk.TransactionBuilder(account, { @@ -126,13 +128,13 @@ describe("horizon path tests", function () { destination: keypair.publicKey(), asset: StellarSdk.Asset.native(), 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 diff --git a/test/unit/liquidity_pool_endpoints_test.js b/test/unit/liquidity_pool_endpoints_test.js index 118b9c72a..3f9e39f3b 100644 --- a/test/unit/liquidity_pool_endpoints_test.js +++ b/test/unit/liquidity_pool_endpoints_test.js @@ -1,14 +1,11 @@ -// Helper function to deep-copy JSON responses. -function copyJson(js) { - return JSON.parse(JSON.stringify(js)); -} +const { HorizonServer } = StellarSdk; const BASE_URL = "https://horizon-live.stellar.org:1337"; const LP_URL = BASE_URL + "/liquidity_pools"; describe("/liquidity_pools tests", function () { beforeEach(function () { - this.server = new StellarSdk.Server(BASE_URL); + this.server = new HorizonServer(BASE_URL); this.axiosMock = sinon.mock(HorizonAxiosClient); StellarSdk.Config.setDefault(); }); @@ -88,11 +85,11 @@ describe("/liquidity_pools tests", function () { const EURT = new StellarSdk.Asset( "EURT", - "GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S" + "GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", ); const PHP = new StellarSdk.Asset( "PHP", - "GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S" + "GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S", ); it("returns the right root response", function (done) { @@ -143,7 +140,7 @@ describe("/liquidity_pools tests", function () { this.axiosMock .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 +150,7 @@ describe("/liquidity_pools tests", function () { .call() .then((pools) => { expect(pools.records).to.deep.equal( - testCase.response._embedded.records + testCase.response._embedded.records, ); done(); }) @@ -187,10 +184,10 @@ describe("/liquidity_pools tests", 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(); }); @@ -389,7 +386,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolOps) => { expect(poolOps.records).to.deep.equal( - poolOpsResponse._embedded.records + poolOpsResponse._embedded.records, ); done(); }) @@ -481,7 +478,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolTxs) => { expect(poolTxs.records).to.deep.equal( - poolTxsResponse._embedded.records + poolTxsResponse._embedded.records, ); done(); }) @@ -757,7 +754,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolEffects) => { expect(poolEffects.records).to.deep.equal( - poolEffectsResponse._embedded.records + poolEffectsResponse._embedded.records, ); done(); }) @@ -833,7 +830,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolTrades) => { expect(poolTrades.records).to.deep.equal( - poolTradesResponse._embedded.records + poolTradesResponse._embedded.records, ); done(); }) @@ -1000,7 +997,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolOps) => { expect(poolOps.records).to.deep.equal( - poolOpsResponse._embedded.records + poolOpsResponse._embedded.records, ); done(); }) @@ -1092,7 +1089,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolTxs) => { expect(poolTxs.records).to.deep.equal( - poolTxsResponse._embedded.records + poolTxsResponse._embedded.records, ); done(); }) @@ -1368,7 +1365,7 @@ describe("/liquidity_pools tests", function () { .call() .then((poolFxs) => { expect(poolFxs.records).to.deep.equal( - poolFxsResponse._embedded.records + poolFxsResponse._embedded.records, ); done(); }) @@ -1376,3 +1373,8 @@ describe("/liquidity_pools tests", function () { }); }); }); + +// Helper function to deep-copy JSON responses. +function copyJson(js) { + return JSON.parse(JSON.stringify(js)); +} diff --git a/test/unit/server/claimable_balances.js b/test/unit/server/claimable_balances.js index d02b94a66..e4ec38eff 100644 --- a/test/unit/server/claimable_balances.js +++ b/test/unit/server/claimable_balances.js @@ -1,10 +1,8 @@ -const MockAdapter = require("axios-mock-adapter"); +const { HorizonServer } = StellarSdk; describe("ClaimableBalanceCallBuilder", function () { beforeEach(function () { - this.server = new StellarSdk.Server( - "https://horizon-live.stellar.org:1337" - ); + this.server = new HorizonServer("https://horizon-live.stellar.org:1337"); this.axiosMock = sinon.mock(HorizonAxiosClient); StellarSdk.Config.setDefault(); }); @@ -43,15 +41,15 @@ describe("ClaimableBalanceCallBuilder", function () { .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) { @@ -85,8 +83,8 @@ describe("ClaimableBalanceCallBuilder", function () { .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 })); @@ -126,8 +124,8 @@ describe("ClaimableBalanceCallBuilder", function () { .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 })); @@ -167,8 +165,8 @@ describe("ClaimableBalanceCallBuilder", function () { .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 })); @@ -177,8 +175,8 @@ describe("ClaimableBalanceCallBuilder", function () { .asset( new StellarSdk.Asset( "USD", - "GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD" - ) + "GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD", + ), ) .call() .then(function (response) { diff --git a/test/unit/server/join_test.js b/test/unit/server/join_test.js index eee5183c6..2158e0be6 100644 --- a/test/unit/server/join_test.js +++ b/test/unit/server/join_test.js @@ -1,10 +1,8 @@ -const MockAdapter = require("axios-mock-adapter"); +const { HorizonServer } = StellarSdk; describe("Server - CallBuilder#join", function () { beforeEach(function () { - this.server = new StellarSdk.Server( - "https://horizon-live.stellar.org:1337" - ); + this.server = new HorizonServer("https://horizon-live.stellar.org:1337"); this.axiosMock = sinon.mock(HorizonAxiosClient); }); @@ -146,8 +144,8 @@ describe("Server - CallBuilder#join", function () { .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 })); diff --git a/test/unit/server_check_memo_required_test.js b/test/unit/server_check_memo_required_test.js index 017594f9a..d393c0f8f 100644 --- a/test/unit/server_check_memo_required_test.js +++ b/test/unit/server_check_memo_required_test.js @@ -1,3 +1,5 @@ +const { HorizonServer } = StellarSdk; + function buildTransaction(destination, operations = [], builderOpts = {}) { let txBuilderOpts = { fee: 100, @@ -9,13 +11,13 @@ function buildTransaction(destination, operations = [], builderOpts = {}) { 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", - }) + }), ); operations.forEach((op) => (transaction = transaction.addOperation(op))); @@ -28,7 +30,7 @@ function buildTransaction(destination, operations = [], builderOpts = {}) { keypair, "200", transaction, - txBuilderOpts.networkPassphrase + txBuilderOpts.networkPassphrase, ); } else { return transaction; @@ -105,7 +107,7 @@ function mockAccountRequest(axiosMock, id, status, data = {}) { describe("server.js check-memo-required", function () { beforeEach(function () { - this.server = new StellarSdk.Server("https://horizon-testnet.stellar.org"); + this.server = new HorizonServer("https://horizon-testnet.stellar.org"); this.axiosMock = sinon.mock(HorizonAxiosClient); }); @@ -132,7 +134,7 @@ describe("server.js check-memo-required", function () { expect(err.accountId).to.eq(accountId); expect(err.operationIndex).to.eq(0); done(); - } + }, ) .catch(function (err) { done(err); @@ -157,7 +159,7 @@ describe("server.js check-memo-required", function () { expect(err.accountId).to.eq(accountId); expect(err.operationIndex).to.eq(0); done(); - } + }, ) .catch(function (err) { done(err); @@ -208,7 +210,7 @@ describe("server.js check-memo-required", function () { function (err) { expect(err).to.be.instanceOf(StellarSdk.NetworkError); done(); - } + }, ) .catch(function (err) { done(err); @@ -251,11 +253,11 @@ describe("server.js check-memo-required", function () { const usd = new StellarSdk.Asset( "USD", - "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB" + "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB", ); const eur = new StellarSdk.Asset( "EUR", - "GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL" + "GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL", ); const liquidityPoolAsset = new StellarSdk.LiquidityPoolAsset(eur, usd, 30); diff --git a/test/unit/server_test.js b/test/unit/server_test.js index b0a2c40f8..21c557af8 100644 --- a/test/unit/server_test.js +++ b/test/unit/server_test.js @@ -1,10 +1,9 @@ +const { HorizonServer } = StellarSdk; const MockAdapter = require("axios-mock-adapter"); describe("server.js non-transaction tests", function () { beforeEach(function () { - this.server = new StellarSdk.Server( - "https://horizon-live.stellar.org:1337" - ); + this.server = new HorizonServer("https://horizon-live.stellar.org:1337"); this.axiosMock = sinon.mock(HorizonAxiosClient); StellarSdk.Config.setDefault(); }); @@ -17,23 +16,23 @@ describe("server.js non-transaction tests", function () { describe("Server.constructor", function () { it("throws error for insecure server", function () { expect( - () => new StellarSdk.Server("http://horizon-live.stellar.org:1337") + () => new HorizonServer("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 () { expect( () => - new StellarSdk.Server("http://horizon-live.stellar.org:1337", { + new HorizonServer("http://horizon-live.stellar.org:1337", { allowHttp: true, - }) + }), ).to.not.throw(); }); 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 HorizonServer("http://horizon-live.stellar.org:1337"), ).to.not.throw(); }); }); @@ -81,7 +80,7 @@ describe("server.js non-transaction tests", function () { {}, { date: "Wed, 13 Mar 2019 22:15:07 GMT", - } + }, ); this.server @@ -144,7 +143,7 @@ describe("server.js non-transaction tests", function () { this.axiosMock .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 })); @@ -163,7 +162,7 @@ describe("server.js non-transaction tests", function () { this.axiosMock .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: {} })); @@ -222,7 +221,7 @@ describe("server.js non-transaction tests", function () { this.axiosMock .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 })); @@ -325,8 +324,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -335,7 +334,7 @@ describe("server.js non-transaction tests", function () { .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"); @@ -410,7 +409,7 @@ describe("server.js non-transaction tests", function () { this.axiosMock .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,7 +418,7 @@ 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"); @@ -437,8 +436,8 @@ describe("server.js non-transaction tests", function () { .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 })); }); @@ -452,7 +451,7 @@ 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"); @@ -465,8 +464,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -479,7 +478,7 @@ describe("server.js non-transaction tests", function () { .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"); @@ -524,12 +523,12 @@ describe("server.js non-transaction tests", function () { this.axiosMock .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: {} }, - }) + }), ); this.server @@ -553,7 +552,7 @@ describe("server.js non-transaction tests", function () { this.axiosMock .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 })); @@ -577,8 +576,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -675,8 +674,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -684,8 +683,8 @@ describe("server.js non-transaction tests", function () { .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,7 +694,7 @@ 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_attr).to.be.equal(7952722); @@ -723,8 +722,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -732,8 +731,8 @@ describe("server.js non-transaction tests", function () { .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: [] } })); @@ -746,7 +745,7 @@ 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.next).to.be.a("function"); expect(response.prev).to.be.a("function"); @@ -841,15 +840,15 @@ describe("server.js non-transaction tests", function () { .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) { @@ -1039,20 +1038,20 @@ describe("server.js non-transaction tests", function () { .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"); @@ -1126,8 +1125,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -1250,8 +1249,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -1261,7 +1260,7 @@ describe("server.js non-transaction tests", function () { .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"); @@ -1378,8 +1377,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -1388,13 +1387,13 @@ describe("server.js non-transaction tests", function () { .forAsset( new StellarSdk.Asset( "USD", - "GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD" - ) + "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"); @@ -1515,8 +1514,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -1526,7 +1525,7 @@ describe("server.js non-transaction tests", function () { .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"); @@ -1670,20 +1669,20 @@ describe("server.js non-transaction tests", function () { .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"); @@ -1718,8 +1717,8 @@ describe("server.js non-transaction tests", function () { .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 @@ -1728,7 +1727,7 @@ describe("server.js non-transaction tests", function () { .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"); @@ -1774,7 +1773,7 @@ describe("server.js non-transaction tests", function () { this.axiosMock .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 })); @@ -1797,21 +1796,21 @@ describe("server.js non-transaction tests", function () { .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") .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"); @@ -1824,15 +1823,15 @@ describe("server.js non-transaction tests", function () { it("selling requests the correct endpoint", function (done) { const selling = new StellarSdk.Asset( "USD", - "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG" + "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG", ); this.axiosMock .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 })); @@ -1843,7 +1842,7 @@ describe("server.js non-transaction tests", function () { .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"); @@ -1856,15 +1855,15 @@ describe("server.js non-transaction tests", function () { it("buying requests the correct endpoint", function (done) { const buying = new StellarSdk.Asset( "COP", - "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG" + "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG", ); this.axiosMock .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 })); @@ -1875,7 +1874,7 @@ describe("server.js non-transaction tests", function () { .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"); @@ -1890,8 +1889,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -1902,7 +1901,7 @@ describe("server.js non-transaction tests", function () { .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"); @@ -1936,8 +1935,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -1946,8 +1945,8 @@ describe("server.js non-transaction tests", function () { StellarSdk.Asset.native(), new StellarSdk.Asset( "USD", - "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG" - ) + "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG", + ), ) .call() .then(function (response) { @@ -1964,8 +1963,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -1973,9 +1972,9 @@ describe("server.js non-transaction tests", function () { .orderbook( new StellarSdk.Asset( "USD", - "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG" + "GDVDKQFP665JAO7A2LSHNLQIUNYNAAIGJ6FYJVMG4DT3YJQQJSRBLQDG", ), - StellarSdk.Asset.native() + StellarSdk.Asset.native(), ) .call() .then(function (response) { @@ -2052,7 +2051,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(); }) @@ -2118,8 +2117,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -2129,13 +2128,13 @@ describe("server.js non-transaction tests", function () { StellarSdk.Asset.native(), new StellarSdk.Asset( "JPY", - "GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM" - ) + "GBVAOIACNSB7OVUXJYC5UE2D4YK2F7A24T7EE5YOMN4CE6GCHUTOUQXM", + ), ) .call() .then(function (response) { expect(response.records).to.be.deep.equal( - tradesResponse._embedded.records + tradesResponse._embedded.records, ); done(); }) @@ -2201,8 +2200,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -2212,7 +2211,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(); }) @@ -2273,20 +2272,20 @@ describe("server.js non-transaction tests", function () { .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(); }) @@ -2355,8 +2354,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -2368,7 +2367,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(); }) @@ -2434,8 +2433,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -2445,7 +2444,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(); }) @@ -2512,8 +2511,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -2523,7 +2522,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(); }) @@ -2610,8 +2609,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -2620,14 +2619,14 @@ describe("server.js non-transaction tests", function () { "GARSFJNXJIHO6ULUBK3DBYKVSIZE7SC72S5DYBCHU7DKL22UXKVD7MXP", new StellarSdk.Asset( "EUR", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN" + "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"); @@ -2639,14 +2638,14 @@ describe("server.js non-transaction tests", function () { }); 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") .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 })); @@ -2654,11 +2653,11 @@ describe("server.js non-transaction tests", function () { StellarSdk.Asset.native(), new StellarSdk.Asset( "EUR", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN" + "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", ), new StellarSdk.Asset( "USD", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN" + "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", ), ]; @@ -2667,14 +2666,14 @@ describe("server.js non-transaction tests", function () { assets, new StellarSdk.Asset( "EUR", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN" + "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"); @@ -2763,8 +2762,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -2772,15 +2771,15 @@ describe("server.js non-transaction tests", function () { .strictSendPaths( new StellarSdk.Asset( "EUR", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN" + "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", ), "20.0", - "GAEDTJ4PPEFVW5XV2S7LUXBEHNQMX5Q2GM562RJGOQG7GVCE5H3HIB4V" + "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"); @@ -2792,14 +2791,14 @@ describe("server.js non-transaction tests", function () { }); 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") .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 })); @@ -2807,11 +2806,11 @@ describe("server.js non-transaction tests", function () { StellarSdk.Asset.native(), new StellarSdk.Asset( "EUR", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN" + "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", ), new StellarSdk.Asset( "USD", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN" + "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", ), ]; @@ -2819,15 +2818,15 @@ describe("server.js non-transaction tests", function () { .strictSendPaths( new StellarSdk.Asset( "EUR", - "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN" + "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN", ), "20.0", - assets + 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"); @@ -2882,8 +2881,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -2893,7 +2892,7 @@ describe("server.js non-transaction tests", function () { .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"); @@ -2909,20 +2908,20 @@ describe("server.js non-transaction tests", function () { .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"); @@ -2938,20 +2937,20 @@ describe("server.js non-transaction tests", function () { .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"); @@ -2964,7 +2963,7 @@ describe("server.js non-transaction tests", function () { 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(); }); @@ -3023,8 +3022,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -3034,7 +3033,7 @@ 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"); @@ -3050,20 +3049,20 @@ describe("server.js non-transaction tests", function () { .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"); @@ -3079,20 +3078,20 @@ describe("server.js non-transaction tests", function () { .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"); @@ -3108,8 +3107,8 @@ describe("server.js non-transaction tests", function () { .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,7 +3118,7 @@ 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"); @@ -3135,8 +3134,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -3146,7 +3145,7 @@ 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"); @@ -3211,20 +3210,20 @@ describe("server.js non-transaction tests", function () { .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"); @@ -3240,8 +3239,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -3251,7 +3250,7 @@ describe("server.js non-transaction tests", function () { .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"); @@ -3267,20 +3266,20 @@ describe("server.js non-transaction tests", function () { .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"); @@ -3302,8 +3301,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -3377,8 +3376,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -3387,17 +3386,17 @@ describe("server.js non-transaction tests", function () { StellarSdk.Asset.native(), new StellarSdk.Asset( "BTC", - "GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH" + "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"); @@ -3413,8 +3412,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -3422,18 +3421,18 @@ describe("server.js non-transaction tests", function () { .tradeAggregation( new StellarSdk.Asset( "BTC", - "GATEMHCCKCY67ZUCKTROYN24ZYT5GK4EQZ65JJLDHKHRUZI3EUEKMTCH" + "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"); @@ -3503,7 +3502,7 @@ describe("server.js non-transaction tests", function () { this.axiosMock .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 })); @@ -3513,7 +3512,7 @@ describe("server.js non-transaction tests", function () { .call() .then(function (response) { expect(response.records).to.be.equal( - assetsResponse._embedded.records + assetsResponse._embedded.records, ); done(); }) @@ -3579,8 +3578,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -3591,7 +3590,7 @@ describe("server.js non-transaction tests", function () { .call() .then(function (response) { expect(response.records).to.be.equal( - assetsCodeResponse._embedded.records + assetsCodeResponse._embedded.records, ); done(); }) @@ -3657,8 +3656,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -3669,7 +3668,7 @@ describe("server.js non-transaction tests", function () { .call() .then(function (response) { expect(response.records).to.be.equal( - assetIssuerResponse._embedded.records + assetIssuerResponse._embedded.records, ); done(); }) @@ -3735,8 +3734,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -3747,7 +3746,7 @@ describe("server.js non-transaction tests", function () { .call() .then(function (response) { expect(response.records).to.be.equal( - assetCodeIssuerResponse._embedded.records + assetCodeIssuerResponse._embedded.records, ); done(); }) @@ -3761,8 +3760,8 @@ describe("server.js non-transaction tests", function () { .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 })); @@ -3773,7 +3772,7 @@ describe("server.js non-transaction tests", function () { .call() .then(function (response) { expect(response.records).to.be.equal( - assetCodeIssuerResponse._embedded.records + assetCodeIssuerResponse._embedded.records, ); done(); }) @@ -3789,8 +3788,8 @@ describe("server.js non-transaction tests", function () { .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: {} })); diff --git a/test/unit/server_transaction_test.js b/test/unit/server_transaction_test.js index 537355809..8d86b6d83 100644 --- a/test/unit/server_transaction_test.js +++ b/test/unit/server_transaction_test.js @@ -1,11 +1,11 @@ +const { HorizonServer } = StellarSdk; + describe("server.js transaction tests", function () { let keypair = StellarSdk.Keypair.random(); let account = new StellarSdk.Account(keypair.publicKey(), "56199647068161"); beforeEach(function () { - this.server = new StellarSdk.Server( - "https://horizon-live.stellar.org:1337" - ); + this.server = new HorizonServer("https://horizon-live.stellar.org:1337"); this.axiosMock = sinon.mock(HorizonAxiosClient); let transaction = new StellarSdk.TransactionBuilder(account, { fee: 100, @@ -18,7 +18,7 @@ describe("server.js transaction tests", function () { "GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW", asset: StellarSdk.Asset.native(), 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"), ); }); @@ -40,7 +40,7 @@ describe("server.js transaction tests", function () { .expects("post") .withArgs( "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}` + `tx=${this.blob}`, ) .returns(Promise.resolve({ data: {} })); @@ -73,7 +73,7 @@ describe("server.js transaction tests", function () { .expects("post") .withArgs( "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}` + `tx=${this.blob}`, ) .returns(Promise.resolve({ data: response })); @@ -119,7 +119,7 @@ describe("server.js transaction tests", function () { .expects("post") .withArgs( "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}` + `tx=${this.blob}`, ) .returns(Promise.resolve({ data: response })); @@ -163,7 +163,7 @@ describe("server.js transaction tests", function () { .expects("post") .withArgs( "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}` + `tx=${this.blob}`, ) .returns(Promise.resolve({ data: response })); @@ -207,7 +207,7 @@ describe("server.js transaction tests", function () { .expects("post") .withArgs( "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}` + `tx=${this.blob}`, ) .returns(Promise.resolve({ data: response })); @@ -226,13 +226,13 @@ describe("server.js transaction tests", function () { 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(); @@ -261,7 +261,7 @@ describe("server.js transaction tests", function () { .expects("post") .withArgs( "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}` + `tx=${this.blob}`, ) .returns(Promise.resolve({ data: response })); @@ -296,7 +296,7 @@ describe("server.js transaction tests", function () { .expects("post") .withArgs( "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}` + `tx=${this.blob}`, ) .returns(Promise.resolve({ data: response })); @@ -322,20 +322,20 @@ describe("server.js transaction tests", function () { .expects("post") .withArgs( "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}` + `tx=${this.blob}`, ) .returns(Promise.resolve({ data: {} })); this.axiosMock .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: {} }, - }) + }), ) .once(); @@ -353,18 +353,18 @@ describe("server.js transaction tests", function () { keypair, "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") .withArgs( "https://horizon-live.stellar.org:1337/transactions", - `tx=${this.blob}` + `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 62a2b5142..cd932490a 100644 --- a/test/unit/stellar_toml_resolver_test.js +++ b/test/unit/stellar_toml_resolver_test.js @@ -27,12 +27,12 @@ describe("stellar_toml_resolver.js tests", function () { # for users on your domain. FEDERATION_SERVER="https://api.stellar.org/federation" `, - }) + }), ); StellarSdk.StellarTomlResolver.resolve("acme.com").then((stellarToml) => { expect(stellarToml.FEDERATION_SERVER).equals( - "https://api.stellar.org/federation" + "https://api.stellar.org/federation", ); done(); }); @@ -49,14 +49,14 @@ FEDERATION_SERVER="https://api.stellar.org/federation" # for users on your domain. FEDERATION_SERVER="http://api.stellar.org/federation" `, - }) + }), ); 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(); }); @@ -75,12 +75,12 @@ FEDERATION_SERVER="http://api.stellar.org/federation" # for users on your domain. FEDERATION_SERVER="http://api.stellar.org/federation" `, - }) + }), ); StellarSdk.StellarTomlResolver.resolve("acme.com").then((stellarToml) => { expect(stellarToml.FEDERATION_SERVER).equals( - "http://api.stellar.org/federation" + "http://api.stellar.org/federation", ); done(); }); @@ -97,7 +97,7 @@ FEDERATION_SERVER="http://api.stellar.org/federation" # for users on your domain. FEDERATION_SERVER="https://api.stellar.org/federation" `, - }) + }), ); StellarSdk.StellarTomlResolver.resolve("acme.com") @@ -112,7 +112,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" .returns(Promise.reject()); StellarSdk.StellarTomlResolver.resolve( - "acme.com" + "acme.com", ).should.be.rejected.and.notify(done); }); @@ -132,7 +132,7 @@ FEDERATION_SERVER="https://api.stellar.org/federation" 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()); diff --git a/test/unit/utils_test.js b/test/unit/utils_test.js index 4dc8feb61..835b6364c 100644 --- a/test/unit/utils_test.js +++ b/test/unit/utils_test.js @@ -33,13 +33,13 @@ describe("Utils", function () { "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); }); @@ -56,13 +56,13 @@ describe("Utils", function () { 300, StellarSdk.Networks.TESTNET, "testanchor.stellar.org", - "8884404377665521220" - )) + "8884404377665521220", + )), ).not.to.throw(); const transaction = new StellarSdk.Transaction( challenge, StellarSdk.Networks.TESTNET, - true + true, ); expect(transaction.memo.value).to.equal("8884404377665521220"); }); @@ -78,8 +78,8 @@ describe("Utils", function () { 300, StellarSdk.Networks.TESTNET, "testanchor.stellar.org", - "memo text" - )) + "memo text", + )), ).to.throw(); }); @@ -96,8 +96,8 @@ describe("Utils", function () { 300, StellarSdk.Networks.TESTNET, "testanchor.stellar.org", - "8884404377665521220" - )) + "8884404377665521220", + )), ).to.throw(/memo cannot be used if clientAccountID is a muxed account/); }); @@ -114,12 +114,12 @@ describe("Utils", function () { "testanchor.stellar.org", null, "testdomain", - clientSigningKeypair.publicKey() + clientSigningKeypair.publicKey(), ); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect(transaction.sequence).to.eql("0"); @@ -134,12 +134,12 @@ describe("Utils", function () { expect(operation1.name).to.eql("testanchor.stellar.org auth"); expect(operation1.source).to.eql( - "GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF" + "GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF", ); expect(operation1.type).to.eql("manageData"); expect(operation1.value.length).to.eql(64); expect(Buffer.from(operation1.value.toString(), "base64").length).to.eql( - 48 + 48, ); expect(operation2.name).to.equal("web_auth_domain"); @@ -162,12 +162,12 @@ describe("Utils", function () { "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); @@ -190,8 +190,8 @@ describe("Utils", function () { 600, StellarSdk.Networks.TESTNET, "testanchor.stellar.org", - "10154623012567072189" - ) + "10154623012567072189", + ), ).to.throw(/memo cannot be used if clientAccountID is a muxed account/); }); @@ -206,8 +206,8 @@ describe("Utils", function () { "testanchor.stellar.org", null, "testdomain", - null - ) + null, + ), ).to.throw(/clientSigningKey is required if clientDomain is provided/); }); }); @@ -223,7 +223,7 @@ describe("Utils", function () { "SDF", 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org" + "testanchor.stellar.org", ); const innerTx = new StellarSdk.TransactionBuilder( @@ -235,14 +235,14 @@ describe("Utils", function () { minTime: 0, maxTime: 0, }, - } + }, ) .addOperation( StellarSdk.Operation.payment({ destination: clientKP.publicKey(), asset: StellarSdk.Asset.native(), amount: "10.000", - }) + }), ) .build(); @@ -250,7 +250,7 @@ describe("Utils", function () { serverKP, "300", innerTx, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ).toXDR(); expect(() => @@ -259,11 +259,11 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "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(() => @@ -272,8 +272,8 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.not.throw(StellarSdk.InvalidSep10ChallengeError); expect(() => StellarSdk.Utils.readChallengeTx( @@ -281,8 +281,8 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "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 () { @@ -295,14 +295,14 @@ describe("Utils", function () { "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( @@ -311,8 +311,8 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql({ tx: transaction, clientAccountID: clientKP.publicKey(), @@ -333,14 +333,14 @@ describe("Utils", function () { 300, StellarSdk.Networks.TESTNET, "testanchor.stellar.org", - clientMemo + clientMemo, ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect( @@ -349,8 +349,8 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql({ tx: transaction, clientAccountID: clientKP.publicKey(), @@ -370,7 +370,7 @@ describe("Utils", function () { "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( @@ -387,8 +387,8 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql({ tx: transaction, clientAccountID: muxedAddress, @@ -405,7 +405,7 @@ describe("Utils", function () { "MCQQMHTBRF2NPCEJWO2JMDT2HBQ2FGDCYREY2YIBSHLTXDG54Y3KTWX3R7NBER62VBELC"; const transaction = new StellarSdk.TransactionBuilder( serverAccount, - txBuilderOpts + txBuilderOpts, ) .addOperation( StellarSdk.Operation.manageData({ @@ -413,7 +413,7 @@ describe("Utils", function () { name: "testanchor.stellar.org auth", value: randomBytes(48).toString("base64"), withMuxing: true, - }) + }), ) .addMemo(new StellarSdk.Memo.id("5842698851377328257")) .setTimeout(30) @@ -424,7 +424,7 @@ describe("Utils", function () { const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect(() => @@ -433,11 +433,11 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "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/, ); }); @@ -447,14 +447,14 @@ describe("Utils", function () { const transaction = new StellarSdk.TransactionBuilder( new StellarSdk.Account(serverKP.publicKey(), "-1"), - { fee: 100, networkPassphrase: StellarSdk.Networks.TESTNET } + { fee: 100, networkPassphrase: StellarSdk.Networks.TESTNET }, ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), name: "SDF-test auth", value: randomBytes(48).toString("base64"), - }) + }), ) .setTimeout(30) .build(); @@ -467,11 +467,11 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "SDF-test", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.throw( StellarSdk.InvalidSep10ChallengeError, - "Transaction not signed by server: '" + serverKP.publicKey() + "'" + "Transaction not signed by server: '" + serverKP.publicKey() + "'", ); }); @@ -481,7 +481,7 @@ describe("Utils", function () { const account = new StellarSdk.Account(keypair.publicKey(), "100"); const transaction = new StellarSdk.TransactionBuilder( account, - txBuilderOpts + txBuilderOpts, ) .setTimeout(30) .build(); @@ -494,11 +494,11 @@ describe("Utils", function () { keypair.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction sequence number should be zero/ + /The transaction sequence number should be zero/, ); }); @@ -511,7 +511,7 @@ describe("Utils", function () { "SDF", 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org" + "testanchor.stellar.org", ); let serverAccountId = StellarSdk.Keypair.random().publicKey(); @@ -522,11 +522,11 @@ describe("Utils", function () { serverAccountId, StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "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/, ); }); @@ -535,7 +535,7 @@ describe("Utils", function () { const account = new StellarSdk.Account(keypair.publicKey(), "-1"); const transaction = new StellarSdk.TransactionBuilder( account, - txBuilderOpts + txBuilderOpts, ) .setTimeout(30) .build(); @@ -549,11 +549,11 @@ describe("Utils", function () { keypair.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction should contain at least one operation/ + /The transaction should contain at least one operation/, ); }); @@ -562,13 +562,13 @@ describe("Utils", function () { 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"), - }) + }), ) .setTimeout(30) .build(); @@ -582,11 +582,11 @@ describe("Utils", function () { keypair.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "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/, ); }); @@ -595,13 +595,13 @@ describe("Utils", function () { 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(), - }) + }), ) .setTimeout(30) .build(); @@ -615,11 +615,11 @@ describe("Utils", function () { keypair.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction\'s operation type should be \'manageData\'/ + /The transaction\'s operation type should be \'manageData\'/, ); }); @@ -648,7 +648,7 @@ describe("Utils", function () { name: `${anchorName} auth`, value, source: clientKeypair.publicKey(), - }) + }), ) .build(); @@ -657,7 +657,7 @@ describe("Utils", function () { transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); transaction.sign(clientKeypair); @@ -672,11 +672,11 @@ 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/, ); }); @@ -685,14 +685,14 @@ describe("Utils", function () { 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(64), source: "GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF", - }) + }), ) .setTimeout(30) .build(); @@ -706,11 +706,11 @@ describe("Utils", function () { keypair.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "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/, ); }); @@ -719,14 +719,14 @@ describe("Utils", function () { const account = new StellarSdk.Account(keypair.publicKey(), "-1"); const transaction = new StellarSdk.TransactionBuilder( account, - txBuilderOpts + txBuilderOpts, ) .addOperation( StellarSdk.Operation.manageData({ name: "SDF auth", value: null, source: "GBDIT5GUJ7R5BXO3GJHFXJ6AZ5UQK6MNOIDMPQUSMXLIHTUNR2Q5CFNF", - }) + }), ) .setTimeout(30) .build(); @@ -738,11 +738,11 @@ describe("Utils", function () { 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/, ); }); @@ -756,7 +756,7 @@ describe("Utils", function () { "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,7 +764,7 @@ describe("Utils", function () { const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); transaction.sign(clientKeypair); @@ -779,11 +779,11 @@ describe("Utils", function () { keypair.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction has expired/ + /The transaction has expired/, ); }); @@ -801,11 +801,11 @@ describe("Utils", function () { "GDMSN2PQ3EB32LZY5JVACI4H7GUVQ3YUWOM4437IDTVQHHWHYG7CGA5Z", StellarSdk.Networks.TESTNET, "testnet-sep.stablex.cloud", - "staging-transfer-server.zetl.network" - ) + "staging-transfer-server.zetl.network", + ), ).not.to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction has expired/ + /The transaction has expired/, ); }); @@ -815,14 +815,14 @@ describe("Utils", function () { 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"), - }) + }), ) .setTimeout(30) .build(); @@ -832,7 +832,7 @@ describe("Utils", function () { const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect( @@ -841,8 +841,8 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "testanchor.stellar.org", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql({ tx: transactionRoundTripped, clientAccountID: clientKP.publicKey(), @@ -857,14 +857,14 @@ describe("Utils", function () { 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"), - }) + }), ) .setTimeout(30) .build(); @@ -874,7 +874,7 @@ describe("Utils", function () { const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect( @@ -883,8 +883,8 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, ["SDF", "Test", "testanchor.stellar.org", "SDF-test"], - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql({ tx: transactionRoundTripped, clientAccountID: clientKP.publicKey(), @@ -899,14 +899,14 @@ describe("Utils", function () { 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"), - }) + }), ) .setTimeout(30) .build(); @@ -918,12 +918,12 @@ describe("Utils", function () { 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/, ); }); @@ -933,14 +933,14 @@ describe("Utils", function () { 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"), - }) + }), ) .setTimeout(30) .build(); @@ -954,11 +954,11 @@ 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/, ); }); @@ -968,14 +968,14 @@ describe("Utils", function () { 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"), - }) + }), ) .setTimeout(30) .build(); @@ -989,11 +989,11 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "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/, ); }); @@ -1003,14 +1003,14 @@ describe("Utils", function () { 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"), - }) + }), ) .setTimeout(30) .build(); @@ -1024,11 +1024,11 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, ["SDF", "Test", "testanchor.stellar.org", "SDF-test"], - "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/, ); }); @@ -1038,21 +1038,21 @@ describe("Utils", function () { 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"), - }) + }), ) .addOperation( StellarSdk.Operation.manageData({ source: serverKP.publicKey(), name: "a key", value: "a value", - }) + }), ) .setTimeout(30) .build(); @@ -1062,7 +1062,7 @@ describe("Utils", function () { const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect( @@ -1071,8 +1071,8 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql({ tx: transactionRoundTripped, clientAccountID: clientKP.publicKey(), @@ -1087,21 +1087,21 @@ describe("Utils", function () { 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"), - }) + }), ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), name: "a key", value: "a value", - }) + }), ) .setTimeout(30) .build(); @@ -1111,7 +1111,7 @@ describe("Utils", function () { const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect(() => @@ -1120,11 +1120,11 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /The transaction has operations that are unrecognized/ + /The transaction has operations that are unrecognized/, ); }); @@ -1134,20 +1134,20 @@ describe("Utils", function () { 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"), - }) + }), ) .addOperation( StellarSdk.Operation.bumpSequence({ source: clientKP.publicKey(), bumpTo: "0", - }) + }), ) .setTimeout(30) .build(); @@ -1157,7 +1157,7 @@ describe("Utils", function () { const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect(() => @@ -1166,11 +1166,11 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "SDF", - "testanchor.stellar.org" - ) + "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'/, ); }); @@ -1180,21 +1180,21 @@ describe("Utils", function () { 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"), - }) + }), ) .addOperation( StellarSdk.Operation.manageData({ source: serverKP.publicKey(), name: "web_auth_domain", value: "unexpected_web_auth_domain", - }) + }), ) .setTimeout(30) .build(); @@ -1204,7 +1204,7 @@ describe("Utils", function () { const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect(() => @@ -1213,11 +1213,11 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "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/, ); }); @@ -1227,21 +1227,21 @@ describe("Utils", function () { 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"), - }) + }), ) .addOperation( StellarSdk.Operation.manageData({ source: clientKP.publicKey(), name: "web_auth_domain", value: "testanchor.stellar.org", - }) + }), ) .setTimeout(30) .build(); @@ -1251,7 +1251,7 @@ describe("Utils", function () { const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect(() => @@ -1260,11 +1260,11 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "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/, ); }); @@ -1274,14 +1274,14 @@ describe("Utils", function () { 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"), - }) + }), ) .setTimeout(30) .build(); @@ -1291,7 +1291,7 @@ describe("Utils", function () { const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect( @@ -1300,8 +1300,8 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "testanchor.stellar.org", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql({ tx: transactionRoundTripped, clientAccountID: clientKP.publicKey(), @@ -1316,21 +1316,21 @@ describe("Utils", function () { 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"), - }) + }), ) .addOperation( StellarSdk.Operation.manageData({ source: serverKP.publicKey(), name: "web_auth_domain", value: "auth.stellar.org", - }) + }), ) .setTimeout(30) .build(); @@ -1340,7 +1340,7 @@ describe("Utils", function () { const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect( @@ -1349,8 +1349,8 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "testanchor.stellar.org", - "auth.stellar.org" - ) + "auth.stellar.org", + ), ).to.eql({ tx: transactionRoundTripped, clientAccountID: clientKP.publicKey(), @@ -1365,21 +1365,21 @@ describe("Utils", function () { 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"), - }) + }), ) .addOperation( StellarSdk.Operation.manageData({ source: serverKP.publicKey(), name: "nonWebAuthDomainKey", value: null, - }) + }), ) .setTimeout(30) .build(); @@ -1389,7 +1389,7 @@ describe("Utils", function () { const transactionRoundTripped = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); expect( @@ -1398,8 +1398,8 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "testanchor.stellar.org", - "auth.stellar.org" - ) + "auth.stellar.org", + ), ).to.eql({ tx: transactionRoundTripped, clientAccountID: clientKP.publicKey(), @@ -1416,21 +1416,21 @@ describe("Utils", function () { 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"), - }) + }), ) .addOperation( StellarSdk.Operation.manageData({ source: clientSigningKeypair.publicKey(), name: "client_domain", value: "testdomain", - }) + }), ) .setTimeout(30) .build(); @@ -1443,7 +1443,7 @@ describe("Utils", function () { serverKP.publicKey(), StellarSdk.Networks.TESTNET, "testanchor.stellar.org", - "testanchor.stellar.org" + "testanchor.stellar.org", ); }); }); @@ -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) @@ -1503,11 +1503,11 @@ describe("Utils", function () { threshold, signerSummary, "SDF-test", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.throw( StellarSdk.InvalidSep10ChallengeError, - "Transaction not signed by server: '" + this.serverKP.publicKey() + "'" + "Transaction not signed by server: '" + this.serverKP.publicKey() + "'", ); }); @@ -1518,14 +1518,14 @@ describe("Utils", function () { "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 @@ -1544,8 +1544,8 @@ describe("Utils", function () { threshold, signerSummary, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql([this.clientKP1.publicKey()]); }); @@ -1556,14 +1556,14 @@ describe("Utils", function () { "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 @@ -1585,8 +1585,8 @@ describe("Utils", function () { threshold, signerSummary, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql([this.clientKP1.publicKey(), this.clientKP2.publicKey()]); }); @@ -1597,14 +1597,14 @@ describe("Utils", function () { "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 @@ -1627,8 +1627,8 @@ describe("Utils", function () { threshold, signerSummary, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql([this.clientKP1.publicKey(), this.clientKP2.publicKey()]); }); @@ -1645,14 +1645,14 @@ describe("Utils", function () { "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 @@ -1678,8 +1678,8 @@ describe("Utils", function () { threshold, signerSummary, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql([this.clientKP1.publicKey(), this.clientKP2.publicKey()]); }); @@ -1690,14 +1690,14 @@ describe("Utils", function () { "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 @@ -1720,11 +1720,11 @@ describe("Utils", function () { threshold, signerSummary, "SDF", - "testanchor.stellar.org" - ) + "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}"`, ); }); @@ -1735,14 +1735,14 @@ describe("Utils", function () { "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 @@ -1764,11 +1764,11 @@ describe("Utils", function () { threshold, signerSummary, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Transaction has unrecognized signatures/ + /Transaction has unrecognized signatures/, ); }); @@ -1779,14 +1779,14 @@ describe("Utils", function () { "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 @@ -1804,11 +1804,11 @@ describe("Utils", function () { threshold, [], "SDF", - "testanchor.stellar.org" - ) + "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/, ); }); }); @@ -1850,14 +1850,14 @@ describe("Utils", function () { "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); @@ -1873,15 +1873,15 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [this.clientKP1.publicKey()], "SDF", - "testanchor.stellar.org" - ) + "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) @@ -1901,11 +1901,11 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [this.clientKP1.publicKey()], "SDF-test", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.throw( StellarSdk.InvalidSep10ChallengeError, - "Transaction not signed by server: '" + this.serverKP.publicKey() + "'" + "Transaction not signed by server: '" + this.serverKP.publicKey() + "'", ); }); @@ -1916,7 +1916,7 @@ describe("Utils", function () { "SDF", 300, StellarSdk.Networks.TESTNET, - "testanchor.stellar.org" + "testanchor.stellar.org", ); clock.tick(200); @@ -1928,11 +1928,11 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [], "SDF", - "testanchor.stellar.org" - ) + "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/, ); }); @@ -1943,18 +1943,18 @@ describe("Utils", function () { "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() @@ -1968,11 +1968,11 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [this.clientKP1.publicKey()], "SDF", - "testanchor.stellar.org" - ) + "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/, ); }); @@ -1983,14 +1983,14 @@ describe("Utils", function () { "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); @@ -2008,8 +2008,8 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, clientSignersPubKey, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql(clientSignersPubKey); }); @@ -2020,14 +2020,14 @@ describe("Utils", function () { "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()); @@ -2045,8 +2045,8 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, clientSignersPubKey, "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.have.same.members(clientSignersPubKey); }); @@ -2057,14 +2057,14 @@ describe("Utils", function () { "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); @@ -2080,8 +2080,8 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey()], "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql([this.clientKP2.publicKey()]); }); @@ -2092,14 +2092,14 @@ describe("Utils", function () { "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); @@ -2115,8 +2115,8 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey(), StellarSdk.Keypair.random().publicKey()], "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql([this.clientKP2.publicKey()]); }); @@ -2127,14 +2127,14 @@ describe("Utils", function () { "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); @@ -2150,11 +2150,11 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey(), this.serverKP.publicKey()], "SDF", - "testanchor.stellar.org" - ) + "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/, ); }); @@ -2165,14 +2165,14 @@ describe("Utils", function () { "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); @@ -2188,8 +2188,8 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey(), this.clientKP2.publicKey()], "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql([this.clientKP2.publicKey()]); }); @@ -2206,14 +2206,14 @@ describe("Utils", function () { "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); @@ -2229,8 +2229,8 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey(), preauthTxHash, xHash, unknownSignerType], "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.eql([this.clientKP2.publicKey()]); }); @@ -2241,14 +2241,14 @@ describe("Utils", function () { "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 @@ -2263,11 +2263,11 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey(), this.clientKP2.publicKey()], "SDF", - "testanchor.stellar.org" - ) + "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/, ); }); @@ -2278,14 +2278,14 @@ describe("Utils", function () { "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); @@ -2301,11 +2301,11 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [this.clientKP2.publicKey()], "SDF", - "testanchor.stellar.org" - ) + "testanchor.stellar.org", + ), ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Transaction has unrecognized signatures/ + /Transaction has unrecognized signatures/, ); }); @@ -2316,14 +2316,14 @@ describe("Utils", function () { "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); @@ -2339,18 +2339,18 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [this.clientKP2.secret()], "SDF", - "testanchor.stellar.org" - ) + "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 () { const transaction = new StellarSdk.TransactionBuilder( this.txAccount, - this.txBuilderOpts + this.txBuilderOpts, ) .addOperation(this.operation) .setTimeout(30) @@ -2371,11 +2371,11 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, clientSigners, "SDF-test", - "testanchor.stellar.org" - ) + "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/, ); }); @@ -2386,14 +2386,14 @@ describe("Utils", function () { "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); @@ -2409,11 +2409,11 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [], "SDF", - "testanchor.stellar.org" - ) + "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/, ); }); @@ -2430,14 +2430,14 @@ describe("Utils", function () { "testanchor.stellar.org", null, "testdomain", - clientSigningKey.publicKey() + clientSigningKey.publicKey(), ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); transaction.sign(clientKP); @@ -2454,7 +2454,7 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [clientKP.publicKey()], "SDF", - "testanchor.stellar.org" + "testanchor.stellar.org", ); expect(signersFound.indexOf(clientSigningKey.publicKey())).to.eql(-1); @@ -2473,14 +2473,14 @@ describe("Utils", function () { "testanchor.stellar.org", null, "testdomain", - clientSigningKeypair.publicKey() + clientSigningKeypair.publicKey(), ); clock.tick(200); const transaction = new StellarSdk.Transaction( challenge, - StellarSdk.Networks.TESTNET + StellarSdk.Networks.TESTNET, ); transaction.sign(clientKP); @@ -2497,11 +2497,11 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [clientKP.publicKey()], "SDF", - "testanchor.stellar.org" - ) + "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/, ); }); @@ -2514,28 +2514,28 @@ describe("Utils", function () { 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"), - }) + }), ) .addOperation( StellarSdk.Operation.manageData({ source: clientSigningKeypair.publicKey(), name: "client_domain", value: "testdomain", - }) + }), ) .addOperation( StellarSdk.Operation.manageData({ source: clientSigningKeypair.publicKey(), name: "client_domain", value: "testdomain2", - }) + }), ) .setTimeout(30) .build(); @@ -2558,11 +2558,11 @@ describe("Utils", function () { StellarSdk.Networks.TESTNET, [clientKP.publicKey()], "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/, ); }); }); @@ -2573,7 +2573,7 @@ describe("Utils", function () { this.account = new StellarSdk.Account(this.keypair.publicKey(), "-1"); this.transaction = new StellarSdk.TransactionBuilder( this.account, - txBuilderOpts + txBuilderOpts, ) .setTimeout(30) .build(); @@ -2589,8 +2589,8 @@ describe("Utils", function () { expect( StellarSdk.Utils.verifyTxSignedBy( this.transaction, - this.keypair.publicKey() - ) + this.keypair.publicKey(), + ), ).to.eql(true); }); @@ -2602,8 +2602,8 @@ describe("Utils", function () { expect( StellarSdk.Utils.verifyTxSignedBy( this.transaction, - differentKeypair.publicKey() - ) + differentKeypair.publicKey(), + ), ).to.eql(false); }); @@ -2611,8 +2611,8 @@ describe("Utils", function () { expect( StellarSdk.Utils.verifyTxSignedBy( this.transaction, - this.keypair.publicKey() - ) + this.keypair.publicKey(), + ), ).to.eql(false); }); }); @@ -2624,7 +2624,7 @@ describe("Utils", function () { this.account = new StellarSdk.Account(this.keypair1.publicKey(), "-1"); this.transaction = new StellarSdk.TransactionBuilder( this.account, - txBuilderOpts + txBuilderOpts, ) .setTimeout(30) .build(); @@ -2642,7 +2642,7 @@ describe("Utils", function () { this.keypair2.publicKey(), ]; expect( - StellarSdk.Utils.gatherTxSigners(this.transaction, expectedSignatures) + StellarSdk.Utils.gatherTxSigners(this.transaction, expectedSignatures), ).to.eql(expectedSignatures); }); @@ -2653,7 +2653,7 @@ describe("Utils", function () { this.keypair1, this.keypair2, this.keypair2, - this.keypair2 + this.keypair2, ); const expectedSignatures = [ @@ -2664,7 +2664,7 @@ describe("Utils", function () { StellarSdk.Utils.gatherTxSigners(this.transaction, [ this.keypair1.publicKey(), this.keypair2.publicKey(), - ]) + ]), ).to.eql(expectedSignatures); }); @@ -2678,7 +2678,7 @@ describe("Utils", function () { ]; expect( - StellarSdk.Utils.gatherTxSigners(this.transaction, wrongSignatures) + StellarSdk.Utils.gatherTxSigners(this.transaction, wrongSignatures), ).to.eql([]); }); @@ -2687,7 +2687,7 @@ describe("Utils", function () { StellarSdk.Utils.gatherTxSigners(this.transaction, [ this.keypair1.publicKey(), this.keypair2.publicKey(), - ]) + ]), ).to.eql([]); }); @@ -2699,10 +2699,10 @@ describe("Utils", function () { StellarSdk.Utils.gatherTxSigners(this.transaction, [ preauthTxHash, this.keypair1.publicKey(), - ]) + ]), ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Signer is not a valid address/ + /Signer is not a valid address/, ); }); @@ -2714,10 +2714,10 @@ describe("Utils", function () { StellarSdk.Utils.gatherTxSigners(this.transaction, [ invalidGHash, this.keypair1.publicKey(), - ]) + ]), ).to.throw( StellarSdk.InvalidSep10ChallengeError, - /Signer is not a valid address/ + /Signer is not a valid address/, ); }); }); From 820c9bae20bdb0b53171ec804e9505227f2d965b Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Thu, 14 Sep 2023 16:40:26 -0700 Subject: [PATCH 6/8] Move over latest soroban-client source code --- package.json | 2 +- src/soroban/axios.ts | 3 +- src/soroban/jsonrpc.ts | 10 +- src/soroban/server.ts | 591 +++++++++++++++++++------------------ src/soroban/soroban_rpc.ts | 186 ++++++++++-- src/soroban/transaction.ts | 181 +++++++++--- 6 files changed, 627 insertions(+), 346 deletions(-) diff --git a/package.json b/package.json index 1d3913899..f5d1831bd 100644 --- a/package.json +++ b/package.json @@ -142,7 +142,7 @@ "bignumber.js": "^9.1.2", "eventsource": "^2.0.2", "randombytes": "^2.1.0", - "stellar-base": "^10.0.0-soroban.8", + "stellar-base": "^10.0.0-beta.1", "toml": "^3.0.0", "urijs": "^1.19.1" } diff --git a/src/soroban/axios.ts b/src/soroban/axios.ts index 8fe3617b4..42561871c 100644 --- a/src/soroban/axios.ts +++ b/src/soroban/axios.ts @@ -2,8 +2,7 @@ import axios from "axios"; /* tslint:disable-next-line:no-var-requires */ export const version = require("../../package.json").version; - -const AxiosClient = axios.create({ +export const AxiosClient = axios.create({ headers: { "X-Client-Name": "js-soroban-client", "X-Client-Version": version, diff --git a/src/soroban/jsonrpc.ts b/src/soroban/jsonrpc.ts index a1e1ea3a2..18dcfd65c 100644 --- a/src/soroban/jsonrpc.ts +++ b/src/soroban/jsonrpc.ts @@ -1,5 +1,4 @@ import axios from "./axios"; -import { hasOwnProperty } from "./utils"; export type Id = string | number; @@ -73,3 +72,12 @@ export async function postObject( return response.data?.result; } } + +// Check if the given object X has a field Y, and make that available to +// typescript typing. +function hasOwnProperty( + obj: X, + prop: Y, +): obj is X & Record { + return obj.hasOwnProperty(prop); +} diff --git a/src/soroban/server.ts b/src/soroban/server.ts index f82894785..3b1211b36 100644 --- a/src/soroban/server.ts +++ b/src/soroban/server.ts @@ -1,7 +1,6 @@ /* tslint:disable:variable-name no-namespace */ +import URI from "urijs"; -import isEmpty from "lodash/isEmpty"; -import merge from "lodash/merge"; import { Account, Address, @@ -11,31 +10,41 @@ import { Transaction, xdr, } from "stellar-base"; -import URI from "urijs"; import AxiosClient from "./axios"; import { Friendbot } from "./friendbot"; import * as jsonrpc from "./jsonrpc"; import { SorobanRpc } from "./soroban_rpc"; -import { assembleTransaction } from "./transaction"; +import { assembleTransaction, parseRawSimulation } from "./transaction"; export const SUBMIT_TRANSACTION_TIMEOUT = 60 * 1000; -export interface GetEventsRequest { - startLedger?: number; - filters: SorobanRpc.EventFilter[]; - cursor?: string; - limit?: number; +/** + * Specifies the durability namespace of contract-related ledger entries. + */ +export enum Durability { + Temporary = "temporary", + Persistent = "persistent", } -export enum Durability { - Temporary = 'temporary', - Persistent = 'persistent', +export namespace Server { + /** Describes the complex filter combinations available for event queries. */ + export interface GetEventsRequest { + filters: SorobanRpc.EventFilter[]; + startLedger?: number; // either this or cursor + cursor?: string; // either this or startLedger + limit?: number; + } + + export interface Options { + allowHttp?: boolean; + timeout?: number; + headers?: Record; + } } /** - * Server handles the network connection to a - * [Soroban-RPC](https://soroban.stellar.org/docs) instance and exposes an + * Handles the network connection to a Soroban RPC instance, exposing an * interface for requests to that instance. * * @constructor @@ -43,40 +52,32 @@ export enum Durability { * @param {string} serverURL Soroban-RPC Server URL (ex. * `http://localhost:8000/soroban/rpc`). * @param {object} [opts] Options object - * @param {boolean} [opts.allowHttp] - Allow connecting to http servers, - * default: `false`. This must be set to false in production deployments! You - * can also use {@link Config} class to set this globally. - * @param {string} [opts.appName] - Allow set custom header `X-App-Name` - * @param {string} [opts.appVersion] - Allow set custom header `X-App-Version` + * @param {boolean} [opts.allowHttp] allows connecting to insecure http servers + * (default: `false`). This must be set to false in production deployments! + * You can also use {@link Config} class to set this globally. + * @param {Record} [opts.headers] allows setting custom headers + * + * @see https://soroban.stellar.org/api/methods */ export class Server { - /** - * Soroban-RPC Server URL (ex. `http://localhost:8000/soroban/rpc`). - */ + /** Soroban RPC Server URL (ex. `http://localhost:8000/soroban/rpc`). */ public readonly serverURL: URI; constructor(serverURL: string, opts: Server.Options = {}) { this.serverURL = URI(serverURL); - const customHeaders: any = {}; - - if (opts.appName) { - customHeaders["X-App-Name"] = opts.appName; - } - if (opts.appVersion) { - customHeaders["X-App-Version"] = opts.appVersion; - } - if (!isEmpty(customHeaders)) { + if (opts.headers && Object.keys(opts.headers).length === 0) { AxiosClient.interceptors.request.use((config: any) => { - // merge the custom headers with an existing headers - config.headers = merge(customHeaders, config.headers); - + // merge the custom headers into any existing headers + config.headers = Object.assign(config.headers, opts.headers); return config; }); } if (this.serverURL.protocol() !== "https" && !opts.allowHttp) { - throw new Error("Cannot connect to insecure soroban-rpc server"); + throw new Error( + "Cannot connect to insecure Soroban RPC server if `allowHttp` isn't set" + ); } } @@ -86,13 +87,17 @@ export class Server { * Needed to get the current sequence number for the account so you can build * a successful transaction with {@link TransactionBuilder}. * + * @param {string} address - The public address of the account to load. + * + * @returns {Promise} a promise to the {@link Account} object with + * a populated sequence number + * + * @see https://soroban.stellar.org/api/methods/getLedgerEntries * @example - * server.getAccount("GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4").then(account => { + * const accountId = "GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4"; + * server.getAccount(accountId).then((account) => { * console.log("sequence:", account.sequence); * }); - * - * @param {string} address - The public address of the account to load. - * @returns {Promise} Returns a promise to the {@link Account} object with populated sequence number. */ public async getAccount(address: string): Promise { const ledgerKey = xdr.LedgerKey.account( @@ -101,41 +106,41 @@ export class Server { StrKey.decodeEd25519PublicKey(address), ), }), - ).toXDR("base64"); - const data: SorobanRpc.GetLedgerEntriesResponse = await jsonrpc.post( - this.serverURL.toString(), - "getLedgerEntries", - [ledgerKey], ); - const ledgerEntries = data.entries ?? []; - if (ledgerEntries.length === 0) { + const resp = await this.getLedgerEntries(ledgerKey); + + const entries = resp.entries ?? []; + if (entries.length === 0) { return Promise.reject({ code: 404, message: `Account not found: ${address}`, }); } - const ledgerEntryData = ledgerEntries[0].xdr; + + const ledgerEntryData = entries[0].xdr; const accountEntry = xdr.LedgerEntryData.fromXDR( ledgerEntryData, "base64", ).account(); - const { high, low } = accountEntry.seqNum(); - const sequence = BigInt(high) * BigInt(4294967296) + BigInt(low); - return new Account(address, sequence.toString()); + + return new Account(address, accountEntry.seqNum().toString()); } /** * General node health check. * + * @returns {Promise} a promise to the + * {@link SorobanRpc.GetHealthResponse} object with the status of the + * server (e.g. "healthy"). + * + * @see https://soroban.stellar.org/api/methods/getHealth * @example - * server.getHealth().then(health => { + * server.getHealth().then((health) => { * console.log("status:", health.status); * }); - * - * @returns {Promise} Returns a promise to the {@link SorobanRpc.GetHealthResponse} object with the status of the server ("healthy"). */ public async getHealth(): Promise { - return await jsonrpc.post( + return jsonrpc.post( this.serverURL.toString(), "getHealth", ); @@ -144,6 +149,24 @@ export class Server { /** * Reads the current value of contract data ledger entries directly. * + * Allows you to directly inspect the current state of a contract. This is a + * backup way to access your contract data which may not be available via + * events or {@link Server.simulateTransaction}. + * + * @param {string|Address|Contract} contract the contract ID containing the + * data to load as a strkey (`C...` form), a {@link Contract}, or an + * {@link Address} instance + * @param {xdr.ScVal} key the key of the contract data to load + * @param {Durability} [durability=Durability.Persistent] the "durability + * keyspace" that this ledger key belongs to, which is either 'temporary' + * or 'persistent' (the default), see {@link Durability}. + * + * @returns {Promise} the current data value + * + * @warning If the data entry in question is a 'temporary' entry, it's + * entirely possible that it has expired out of existence. + * + * @see https://soroban.stellar.org/api/methods/getLedgerEntries * @example * const contractId = "CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5"; * const key = xdr.ScVal.scvSymbol("counter"); @@ -152,26 +175,6 @@ export class Server { * console.log("lastModified:", data.lastModifiedLedgerSeq); * console.log("latestLedger:", data.latestLedger); * }); - * - * Allows you to directly inspect the current state of a contract. This is a - * backup way to access your contract data which may not be available via - * events or simulateTransaction. - * - * @param {string|Address|Contract} contract - The contract ID containing the - * data to load. Encoded as Stellar Contract Address string e.g. - * `CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5` or a - * {@link Contract} or {@link Address} instance. - * @param {xdr.ScVal} key - The key of the contract data to load. - * @param {Durability} [durability] - The "durability keyspace" that this - * ledger key belongs to, which is either 'temporary' or 'persistent' (the - * default), see {@link Durability}. - * - * @returns {Promise} Returns a promise to the - * {@link SorobanRpc.LedgerEntryResult} object with the current value. - * - * @warning If the data entry in question is a 'temporary' entry, it's - * entirely possible that it has expired out of existence. Future versions - * of this client may provide abstractions to handle that. */ public async getContractData( contract: string | Address | Contract, @@ -180,7 +183,7 @@ export class Server { ): Promise { // coalesce `contract` param variants to an ScAddress let scAddress: xdr.ScAddress; - if (typeof contract === 'string') { + if (typeof contract === "string") { scAddress = new Contract(contract).address().toScAddress(); } else if (contract instanceof Address) { scAddress = contract.toScAddress(); @@ -204,46 +207,56 @@ export class Server { throw new TypeError(`invalid durability: ${durability}`); } - let contractKey: string = xdr.LedgerKey.contractData( + let contractKey = xdr.LedgerKey.contractData( new xdr.LedgerKeyContractData({ - contract: scAddress, key, - durability: xdrDurability, - bodyType: xdr.ContractEntryBodyType.dataEntry() // expirationExtension is internal - }) - ).toXDR("base64"); + contract: scAddress, + durability: xdrDurability + }), + ); - return jsonrpc.post( - this.serverURL.toString(), - "getLedgerEntries", - [contractKey], - ).then(response => { - const ledgerEntries = response.entries ?? []; - if (ledgerEntries.length !== 1) { - return Promise.reject({ - code: 404, - message: `Contract data not found. Contract: ${Address.fromScAddress(scAddress).toString()}, Key: ${key.toXDR("base64")}, Durability: ${durability}`, - }); - } - return ledgerEntries[0]; - }); + return this + .getLedgerEntries(contractKey) + .then((response) => { + const entries = response.entries ?? []; + if (entries.length === 0) { + return Promise.reject({ + code: 404, + message: `Contract data not found. Contract: ${Address.fromScAddress( + scAddress, + ).toString()}, Key: ${key.toXDR( + "base64", + )}, Durability: ${durability}`, + }); + } + + return entries[0]; + }); } /** - * Reads the current value of ledger entries directly. + * Reads the current value of arbitrary ledger entries directly. * * Allows you to directly inspect the current state of contracts, contract's - * code, or any other ledger entries. This is a backup way to access your - * contract data which may not be available via events or simulateTransaction. + * code, accounts, or any other ledger entries. + * + * To fetch a contract's WASM byte-code, built the appropriate + * {@link xdr.LedgerKeyContractCode} ledger entry key (or see + * {@link Contract.getFootprint}). + * + * @param {xdr.ScVal[]} keys one or more ledger entry keys to load * - * To fetch contract wasm byte-code, use the ContractCode ledger entry key. + * @returns {Promise} the current + * on-chain values for the given ledger keys * + * @see https://soroban.stellar.org/api/methods/getLedgerEntries * @example - * const contractId = "0000000000000000000000000000000000000000000000000000000000000001"; + * const contractId = "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM"; * const key = xdr.LedgerKey.contractData(new xdr.LedgerKeyContractData({ - * contractId: Buffer.from(contractId, "hex"), + * contractId: StrKey.decodeContract(contractId), * key: xdr.ScVal.scvSymbol("counter"), * })); + * * server.getLedgerEntries([key]).then(response => { * const ledgerData = response.entries[0]; * console.log("key:", ledgerData.key); @@ -251,15 +264,9 @@ export class Server { * console.log("lastModified:", ledgerData.lastModifiedLedgerSeq); * console.log("latestLedger:", response.latestLedger); * }); - * - * @param {xdr.ScVal[]} keys - The ledger entry keys to load. - * - * @returns {Promise} Returns a promise - * to the {@link SorobanRpc.GetLedgerEntriesResponse} object with the - * current value. */ public async getLedgerEntries( - keys: xdr.LedgerKey[], + ...keys: xdr.LedgerKey[] ): Promise { return await jsonrpc.post( this.serverURL.toString(), @@ -271,37 +278,72 @@ export class Server { /** * Fetch the details of a submitted transaction. * - * When submitting a transaction, clients should poll this to tell when the + * After submitting a transaction, clients should poll this to tell when the * transaction has completed. * + * @param {string} hash hex-encoded hash of the transaction to check + * + * @returns {Promise} the status, + * result, and other details about the transaction + * + * @see https://soroban.stellar.org/api/methods/getTransaction * @example * const transactionHash = "c4515e3bdc0897f21cc5dbec8c82cf0a936d4741cb74a8e158eb51b9fb00411a"; - * server.getTransaction(transactionHash).then(transaction => { - * console.log("status:", transaction.status); - * console.log("envelopeXdr:", transaction.envelopeXdr); - * console.log("resultMetaXdr:", transaction.resultMetaXdr); - * console.log("resultXdr:", transaction.resultXdr); + * server.getTransaction(transactionHash).then((tx) => { + * console.log("status:", tx.status); + * console.log("envelopeXdr:", tx.envelopeXdr); + * console.log("resultMetaXdr:", tx.resultMetaXdr); + * console.log("resultXdr:", tx.resultXdr); * }); - * - * @param {string} hash - The hash of the transaction to check. Encoded as a - * hex string. - * - * @returns {Promise} Returns a - * promise to the {@link SorobanRpc.GetTransactionResponse} object - * with the status, result, and other details about the transaction. */ public async getTransaction( hash: string, ): Promise { - return await jsonrpc.post( + const raw = await jsonrpc.post( this.serverURL.toString(), "getTransaction", hash, ); + + let successInfo: Omit< + SorobanRpc.GetSuccessfulTransactionResponse, + keyof SorobanRpc.GetFailedTransactionResponse + > = {} as any; + + if (raw.status === SorobanRpc.GetTransactionStatus.SUCCESS) { + const meta = xdr.TransactionMeta.fromXDR(raw.resultMetaXdr!, "base64"); + successInfo = { + ledger: raw.ledger!, + createdAt: raw.createdAt!, + applicationOrder: raw.applicationOrder!, + feeBump: raw.feeBump!, + envelopeXdr: xdr.TransactionEnvelope.fromXDR( + raw.envelopeXdr!, + "base64", + ), + resultXdr: xdr.TransactionResult.fromXDR(raw.resultXdr!, "base64"), + resultMetaXdr: meta, + ...(meta.switch() === 3 && + meta.v3().sorobanMeta() !== null && { + returnValue: meta.v3().sorobanMeta()?.returnValue(), + }), + }; + } + + const result: SorobanRpc.GetTransactionResponse = { + status: raw.status, + latestLedger: raw.latestLedger, + latestLedgerCloseTime: raw.latestLedgerCloseTime, + oldestLedger: raw.oldestLedger, + oldestLedgerCloseTime: raw.oldestLedgerCloseTime, + ...successInfo, + }; + + return result; } /** - * Fetches all events that match a given set of filters. + * Fetch all events that match a given set of filters. * * The given filters (see {@link SorobanRpc.EventFilter} for detailed fields) * are combined only in a logical OR fashion, and all of the fields in each @@ -310,6 +352,11 @@ export class Server { * To page through events, use the `pagingToken` field on the relevant * {@link SorobanRpc.EventResponse} object to set the `cursor` parameter. * + * @param {Server.GetEventsRequest} request event filters + * @returns {Promise} a paginatable set of the + * events matching the given event filters + * + * @see https://soroban.stellar.org/api/methods/getEvents * @example * server.getEvents({ * startLedger: "1000", @@ -332,13 +379,9 @@ export class Server { * ], * limit: 10, * }); - * - * @returns {Promise} a promise to the - * {@link SorobanRpc.GetEventsResponse} object containing a paginatable set - * of the events matching the given event filters. */ public async getEvents( - request: GetEventsRequest, + request: Server.GetEventsRequest, ): Promise { // TODO: It'd be nice if we could do something to infer the types of filter // arguments a user wants, e.g. converting something like "transfer/*/42" @@ -346,113 +389,105 @@ export class Server { // is an ScSymbol and the last is a U32. // // The difficulty comes in matching up the correct integer primitives. - // - // It also means this library will rely on the XDR definitions. - return await jsonrpc.postObject(this.serverURL.toString(), "getEvents", { + return jsonrpc.postObject(this.serverURL.toString(), "getEvents", { filters: request.filters ?? [], pagination: { - ...(request.cursor && { cursor: request.cursor }), // add fields only if defined + ...(request.cursor && { cursor: request.cursor }), // add if defined ...(request.limit && { limit: request.limit }), }, - ...(request.startLedger && { startLedger: String(request.startLedger) }), + ...(request.startLedger && { startLedger: request.startLedger.toString() }), }); } /** - * Fetches metadata about the network which Soroban-RPC is connected to. + * Fetch metadata about the network this Soroban RPC server is connected to. + * + * @returns {Promise} metadata about the + * current network this RPC server is connected to * + * @see https://soroban.stellar.org/api/methods/getNetwork * @example - * server.getNetwork().then(network => { + * server.getNetwork().then((network) => { * console.log("friendbotUrl:", network.friendbotUrl); * console.log("passphrase:", network.passphrase); * console.log("protocolVersion:", network.protocolVersion); * }); - * - * @returns {Promise} a promise to the - * {@link SorobanRpc.GetNetworkResponse} object containing metadata - * about the current network this soroban-rpc server is connected to. */ public async getNetwork(): Promise { return await jsonrpc.post(this.serverURL.toString(), "getNetwork"); } /** - * Fetches the latest ledger meta info from network which Soroban-RPC is connected to. + * Fetch the latest ledger meta info from network which this Soroban RPC + * server is connected to. + * + * @returns {Promise} metadata about the + * latest ledger on the network that this RPC server is connected to * + * @see https://soroban.stellar.org/api/methods/getLatestLedger * @example - * server.getLatestLedger().then(response => { + * server.getLatestLedger().then((response) => { * console.log("hash:", response.id); * console.log("sequence:", response.sequence); * console.log("protocolVersion:", response.protocolVersion); * }); - * - * @returns {Promise} a promise to the - * {@link SorobanRpc.GetLatestLedgerResponse} object containing metadata - * about the latest ledger from network soroban-rpc server is connected to. */ public async getLatestLedger(): Promise { - return await jsonrpc.post(this.serverURL.toString(), "getLatestLedger"); + return jsonrpc.post(this.serverURL.toString(), "getLatestLedger"); } /** * Submit a trial contract invocation to get back return values, expected * ledger footprint, expected authorizations, and expected costs. * + * @param {Transaction | FeeBumpTransaction} transaction the transaction to + * simulate, which should include exactly one operation (one of + * {@link xdr.InvokeHostFunctionOp}, {@link xdr.BumpFootprintExpirationOp}, + * or {@link xdr.RestoreFootprintOp}). Any provided footprint or auth + * information will be ignored. + * + * @returns {Promise} an object with + * the cost, footprint, result/auth requirements (if applicable), and error + * of the transaction + * + * @see https://developers.stellar.org/docs/glossary/transactions/ + * @see https://soroban.stellar.org/api/methods/simulateTransaction + * @see Server.prepareTransaction + * @see assembleTransaction + * * @example - * const contractId = '0000000000000000000000000000000000000000000000000000000000000001'; + * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE'; * const contract = new SorobanClient.Contract(contractId); * * // Right now, this is just the default fee for this example. - * const fee = 100; - * - * const transaction = new SorobanClient.TransactionBuilder(account, { - * fee, - * // Uncomment the following line to build transactions for the live network. Be - * // sure to also change the horizon hostname. - * // networkPassphrase: SorobanClient.Networks.PUBLIC, - * networkPassphrase: SorobanClient.Networks.FUTURENET - * }) - * // Add a contract.increment soroban contract invocation operation + * const fee = SorobanClient.BASE_FEE; + * const transaction = new SorobanClient.TransactionBuilder(account, { fee }) + * // Uncomment the following line to build transactions for the live network. Be + * // sure to also change the horizon hostname. + * //.setNetworkPassphrase(SorobanClient.Networks.PUBLIC) + * .setNetworkPassphrase(SorobanClient.Networks.FUTURENET) + * .setTimeout(30) // valid for the next 30s + * // Add an operation to call increment() on the contract * .addOperation(contract.call("increment")) - * // Make this transaction valid for the next 30 seconds only - * .setTimeout(30) - * // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/) - * // .addMemo(SorobanClient.Memo.text('Hello world!')) * .build(); * - * // Sign this transaction with the secret key - * // NOTE: signing is transaction is network specific. Test network transactions - * // won't work in the public network. To switch networks, use the Network object - * // as explained above (look for SorobanClient.Network). - * const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey); - * transaction.sign(sourceKeypair); - * - * server.simulateTransaction(transaction).then(sim => { + * server.simulateTransaction(transaction).then((sim) => { * console.log("cost:", sim.cost); - * console.log("results:", sim.results); + * console.log("result:", sim.result); * console.log("error:", sim.error); * console.log("latestLedger:", sim.latestLedger); * }); - * - * @param {Transaction | FeeBumpTransaction} transaction - The transaction to - * simulate. It should include exactly one operation, which must be one of - * {@link xdr.InvokeHostFunctionOp}, {@link xdr.BumpFootprintExpirationOp}, - * or {@link xdr.RestoreFootprintOp}. Any provided footprint will be - * ignored. - * - * @returns {Promise} Returns a - * promise to the {@link SorobanRpc.SimulateTransactionResponse} object - * with the cost, footprint, result/auth requirements (if applicable), and - * error of the transaction. */ public async simulateTransaction( transaction: Transaction | FeeBumpTransaction, ): Promise { - return await jsonrpc.post( - this.serverURL.toString(), - "simulateTransaction", - transaction.toXDR(), - ); + return jsonrpc + .post( + this.serverURL.toString(), + "simulateTransaction", + transaction.toXDR(), + ) + .then(parseRawSimulation); } /** @@ -470,31 +505,48 @@ export class Server { * * You can call the {@link Server.simulateTransaction} method directly first * if you want to inspect estimated fees for a given transaction in detail - * first, if that is of importance. + * first, then re-assemble it manually or via {@link assembleTransaction}. * + * @param {Transaction | FeeBumpTransaction} transaction the transaction to + * prepare. It should include exactly one operation, which must be one of + * {@link xdr.InvokeHostFunctionOp}, {@link xdr.BumpFootprintExpirationOp}, + * or {@link xdr.RestoreFootprintOp}. + * + * Any provided footprint will be overwritten. However, if your operation + * has existing auth entries, they will be preferred over ALL auth entries + * from the simulation. In other words, if you include auth entries, you + * don't care about the auth returned from the simulation. Other fields + * (footprint, etc.) will be filled as normal. + * @param {string} [networkPassphrase] explicitly provide a network + * passphrase (default: requested from the server via + * {@link Server.getNetwork}). + * + * @returns {Promise} a copy of the + * transaction with the expected authorizations (in the case of + * invocation), resources, and ledger footprints added. The transaction fee + * will also automatically be padded with the contract's minimum resource + * fees discovered from the simulation. + * + * @see assembleTransaction + * @see https://soroban.stellar.org/api/methods/simulateTransaction + * @throws {jsonrpc.Error | Error} if simulation fails * @example - * const contractId = '0000000000000000000000000000000000000000000000000000000000000001'; + * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE'; * const contract = new SorobanClient.Contract(contractId); * * // Right now, this is just the default fee for this example. - * const fee = 100; - * - * const transaction = new SorobanClient.TransactionBuilder(account, { - * fee, - * // Uncomment the following line to build transactions for the live network. Be - * // sure to also change the horizon hostname. - * // networkPassphrase: SorobanClient.Networks.PUBLIC, - * networkPassphrase: SorobanClient.Networks.TESTNET - * }) - * // Add a contract.increment soroban contract invocation operation + * const fee = SorobanClient.BASE_FEE; + * const transaction = new SorobanClient.TransactionBuilder(account, { fee }) + * // Uncomment the following line to build transactions for the live network. Be + * // sure to also change the horizon hostname. + * //.setNetworkPassphrase(SorobanClient.Networks.PUBLIC) + * .setNetworkPassphrase(SorobanClient.Networks.FUTURENET) + * .setTimeout(30) // valid for the next 30s + * // Add an operation to call increment() on the contract * .addOperation(contract.call("increment")) - * // Make this transaction valid for the next 30 seconds only - * .setTimeout(30) - * // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/) - * // .addMemo(SorobanClient.Memo.text('Hello world!')) * .build(); * - * preparedTransaction = await server.prepareTransaction(transaction); + * const preparedTransaction = await server.prepareTransaction(transaction); * * // Sign this transaction with the secret key * // NOTE: signing is transaction is network specific. Test network transactions @@ -508,21 +560,6 @@ export class Server { * console.log("status:", result.status); * console.log("errorResultXdr:", result.errorResultXdr); * }); - * - * @param {Transaction | FeeBumpTransaction} transaction - The transaction to - * prepare. It should include exactly one operation, which must be one of - * {@link xdr.InvokeHostFunctionOp}, {@link xdr.BumpFootprintExpirationOp}, - * or {@link xdr.RestoreFootprintOp}. Any provided footprint will be - * overwritten. - * @param {string} [networkPassphrase] - Explicitly provide a network - * passphrase. If not passed, the current network passphrase will be - * requested from the server via {@link Server.getNetwork}. - * - * @returns {Promise} Returns a copy of the - * transaction, with the expected authorizations (in the case of - * invocation) and ledger footprint added. The transaction fee will also - * automatically be padded with the contract's minimum resource fees - * discovered from the simulation. */ public async prepareTransaction( transaction: Transaction | FeeBumpTransaction, @@ -534,44 +571,44 @@ export class Server { : this.getNetwork(), this.simulateTransaction(transaction), ]); - if (simResponse.error) { + if (SorobanRpc.isSimulationError(simResponse)) { throw simResponse.error; } - if (!simResponse.results || simResponse.results.length !== 1) { + if (!simResponse.result) { throw new Error("transaction simulation failed"); } - return assembleTransaction(transaction, passphrase, simResponse); + + return assembleTransaction(transaction, passphrase, simResponse).build(); } /** - * Submit a real transaction to the Stellar network. This is the only way to - * make changes "on-chain". Unlike Horizon, Soroban-RPC does not wait for - * transaction completion. It simply validates the transaction and enqueues - * it. Clients should call {@link Server#getTransactionStatus} to learn about - * transaction success/failure. + * Submit a real transaction to the Stellar network. + * + * Unlike Horizon, Soroban RPC does not wait for transaction completion. It + * simply validates the transaction and enqueues it. Clients should call + * {@link Server.getTransactionStatus} to learn about transaction + * success/failure. + * + * @param {Transaction | FeeBumpTransaction} transaction to submit + * @returns {Promise} the + * transaction id, status, and any error if available * + * @see https://developers.stellar.org/docs/glossary/transactions/ + * @see https://soroban.stellar.org/api/methods/sendTransaction * @example - * const contractId = '0000000000000000000000000000000000000000000000000000000000000001'; + * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE'; * const contract = new SorobanClient.Contract(contractId); * * // Right now, this is just the default fee for this example. - * const fee = 100; - * - * const transaction = new SorobanClient.TransactionBuilder(account, { - * fee, - * // Uncomment the following line to build transactions for the live network. Be - * // sure to also change the horizon hostname. - * // networkPassphrase: SorobanClient.Networks.PUBLIC, - * networkPassphrase: SorobanClient.Networks.STANDALONE - * }) - * // Add a contract.increment soroban contract invocation operation - * // Note: For real transactions you will need to include the footprint - * // and auth in the operation, as returned from simulateTransaction. + * const fee = SorobanClient.BASE_FEE; + * const transaction = new SorobanClient.TransactionBuilder(account, { fee }) + * // Uncomment the following line to build transactions for the live network. Be + * // sure to also change the horizon hostname. + * //.setNetworkPassphrase(SorobanClient.Networks.PUBLIC) + * .setNetworkPassphrase(SorobanClient.Networks.FUTURENET) + * .setTimeout(30) // valid for the next 30s + * // Add an operation to call increment() on the contract * .addOperation(contract.call("increment")) - * // Make this transaction valid for the next 30 seconds only - * .setTimeout(30) - * // Uncomment to add a memo (https://developers.stellar.org/docs/glossary/transactions/) - * // .addMemo(SorobanClient.Memo.text('Hello world!')) * .build(); * * // Sign this transaction with the secret key @@ -581,17 +618,11 @@ export class Server { * const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey); * transaction.sign(sourceKeypair); * - * server.sendTransaction(transaction).then(result => { + * server.sendTransaction(transaction).then((result) => { * console.log("hash:", result.hash); * console.log("status:", result.status); * console.log("errorResultXdr:", result.errorResultXdr); * }); - * - * @param {Transaction | FeeBumpTransaction} transaction - The transaction to - * submit. - * @returns {Promise} Returns a promise to - * the {@link SorobanRpc.SendTransactionResponse} object with the - * transaction id, status, and any error if available. */ public async sendTransaction( transaction: Transaction | FeeBumpTransaction, @@ -604,23 +635,33 @@ export class Server { } /** - * Use the friendbot faucet to create and fund a new account. The method will - * return an Account object for the created account, or if the account already - * existed. If friendbot is not configured on this network, this method will - * throw an error. If the request fails, this method will throw an error. + * Fund a new account using the network's friendbot faucet, if any. * - * @example - * server.requestAirdrop("GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4").then(accountCreated => { - * console.log("accountCreated:", accountCreated); - * }).catch(error => { - * console.error("error:", error); - * }); + * @param {string | Account} address the address or account instance that we + * want to create and fund with friendbot + * @param {string} [friendbotUrl] optionally, an explicit address for + * friendbot (by default: this calls the Soroban RPC + * {@link Server.getNetwork} method to try to discover this network's + * Friendbot url). * - * @param {string | Account} address - The address or account we want to create and fund. - * @param {string} [friendbotUrl] - The optional explicit address for - * friendbot. If not provided, the client will call the Soroban-RPC `getNetwork` - * method to attempt to find this network's friendbot url. - * @returns {Promise} Returns a promise to the {@link Account} object with populated sequence number. + * @returns {Promise} an {@link Account} object for the created + * account, or the existing account if it's already funded with the + * populated sequence number (note that the account will not be "topped + * off" if it already exists) + * + * @throws if Friendbot is not configured on this network or request failure + * + * @see + * https://developers.stellar.org/docs/fundamentals-and-concepts/testnet-and-pubnet#friendbot + * @see Friendbot.Response + * @example + * server + * .requestAirdrop("GBZC6Y2Y7Q3ZQ2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4QZJ2XZ3Z5YXZ6Z7Z2Y4") + * .then((accountCreated) => { + * console.log("accountCreated:", accountCreated); + * }).catch((error) => { + * console.error("error:", error); + * }); */ public async requestAirdrop( address: string | Pick, @@ -631,10 +672,12 @@ export class Server { if (!friendbotUrl) { throw new Error("No friendbot URL configured for current network"); } + try { const response = await AxiosClient.post( `${friendbotUrl}?addr=${encodeURIComponent(account)}`, ); + const meta = xdr.TransactionMeta.fromXDR( response.data.result_meta_xdr, "base64", @@ -662,13 +705,9 @@ function findCreatedAccountSequenceInTransactionMeta( operations = meta.operations(); break; case 1: - operations = meta.v1().operations(); - break; case 2: - operations = meta.v2().operations(); - break; - case 3: - operations = meta.v3().operations(); + case 3: // all three have the same interface + operations = (meta.value() as xdr.TransactionMetaV3).operations(); break; default: throw new Error("Unexpected transaction meta switch value"); @@ -687,14 +726,6 @@ function findCreatedAccountSequenceInTransactionMeta( return data.account().seqNum().toString(); } } - throw new Error("No account created in transaction"); -} -export namespace Server { - export interface Options { - allowHttp?: boolean; - timeout?: number; - appName?: string; - appVersion?: string; - } + throw new Error("No account created in transaction"); } diff --git a/src/soroban/soroban_rpc.ts b/src/soroban/soroban_rpc.ts index 2fc7bd923..74fab8a32 100644 --- a/src/soroban/soroban_rpc.ts +++ b/src/soroban/soroban_rpc.ts @@ -1,10 +1,10 @@ -import { AssetType } from "stellar-base"; -import * as jsonrpc from "./jsonrpc"; +import { AssetType, SorobanDataBuilder, xdr } from "stellar-base"; -// TODO: Better parsing for hashes, and base64-encoded xdr +// TODO: Better parsing for hashes /* tslint:disable-next-line:no-namespace */ -/* @namespace SorobanRpc +/** + * @namespace SorobanRpc */ export namespace SorobanRpc { export interface Balance { @@ -25,10 +25,11 @@ export namespace SorobanRpc { } export interface LedgerEntryResult { + lastModifiedLedgerSeq?: number; + /** a base-64 encoded {@link xdr.LedgerKey} instance */ key: string; - // xdr is a base-64 encoded {@link xdr.LedgerEntryData} + /** a base-64 encoded {@link xdr.LedgerEntryData} instance */ xdr: string; - lastModifiedLedgerSeq?: number; } /* Response for jsonrpc method `getLedgerEntries` @@ -54,13 +55,52 @@ export namespace SorobanRpc { protocolVersion: string; } - export type GetTransactionStatus = "SUCCESS" | "NOT_FOUND" | "FAILED"; + export enum GetTransactionStatus { + SUCCESS = "SUCCESS", + NOT_FOUND = "NOT_FOUND", + FAILED = "FAILED" + } + + export type GetTransactionResponse = + | GetSuccessfulTransactionResponse + | GetFailedTransactionResponse + | GetMissingTransactionResponse; - export interface GetTransactionResponse { + interface GetAnyTransactionResponse { status: GetTransactionStatus; - latestLedger: number; + latestLedger: string; + latestLedgerCloseTime: number; + oldestLedger: string; + oldestLedgerCloseTime: number; + } + + export interface GetMissingTransactionResponse extends GetAnyTransactionResponse { + status: GetTransactionStatus.NOT_FOUND; + } + + export interface GetFailedTransactionResponse extends GetAnyTransactionResponse { + status: GetTransactionStatus.FAILED; + } + + export interface GetSuccessfulTransactionResponse extends GetAnyTransactionResponse { + status: GetTransactionStatus.SUCCESS; + + ledger: number; + createdAt: number; + applicationOrder: number; + feeBump: boolean; + envelopeXdr: xdr.TransactionEnvelope; + resultXdr: xdr.TransactionResult; + resultMetaXdr: xdr.TransactionMeta; + + returnValue?: xdr.ScVal; // present iff resultMeta is a v3 + } + + export interface RawGetTransactionResponse { + status: GetTransactionStatus; + latestLedger: string; latestLedgerCloseTime: number; - oldestLedger: number; + oldestLedger: string; oldestLedgerCloseTime: number; // the fields below are set if status is SUCCESS @@ -82,10 +122,12 @@ export namespace SorobanRpc { } export interface GetEventsResponse { - events?: EventResponse[]; + latestLedger: string; + events: EventResponse[]; } export interface EventResponse { + type: EventType; ledger: string; ledgerClosedAt: string; contractId: string; @@ -118,23 +160,123 @@ export namespace SorobanRpc { } export interface SimulateHostFunctionResult { + auth: xdr.SorobanAuthorizationEntry[]; + retval: xdr.ScVal; + } + + /** + * Simplifies {@link RawSimulateTransactionResponse} into separate interfaces + * based on status: + * - on success, this includes all fields, though `result` is only present + * if an invocation was simulated (since otherwise there's nothing to + * "resultify") + * - if there was an expiration error, this includes error and restoration + * fields + * - for all other errors, this only includes error fields + * + * @see https://soroban.stellar.org/api/methods/simulateTransaction#returns + */ + export type SimulateTransactionResponse = + | SimulateTransactionSuccessResponse + | SimulateTransactionRestoreResponse + | SimulateTransactionErrorResponse; + + export interface BaseSimulateTransactionResponse { + /** always present: the JSON-RPC request ID */ + id: string; + + /** always present: the LCL known to the server when responding */ + latestLedger: string; + + /** + * The field is always present, but may be empty in cases where: + * - you didn't simulate an invocation or + * - there were no events + * @see {@link humanizeEvents} + */ + events: xdr.DiagnosticEvent[]; + + /** a private field to mark the schema as parsed */ + _parsed: boolean; + } + + /** Includes simplified fields only present on success. */ + export interface SimulateTransactionSuccessResponse + extends BaseSimulateTransactionResponse { + transactionData: SorobanDataBuilder; + minResourceFee: string; + cost: Cost; + + /** present only for invocation simulation */ + result?: SimulateHostFunctionResult; + } + + /** Includes details about why the simulation failed */ + export interface SimulateTransactionErrorResponse + extends BaseSimulateTransactionResponse { + error: string; + events: xdr.DiagnosticEvent[]; + } + + export interface SimulateTransactionRestoreResponse + extends SimulateTransactionSuccessResponse { + result: SimulateHostFunctionResult; // not optional now + + /** + * Indicates that a restoration is necessary prior to submission. + * + * In other words, seeing a restoration preamble means that your invocation + * was executed AS IF the required ledger entries were present, and this + * field includes information about what you need to restore for the + * simulation to succeed. + */ + restorePreamble: { + minResourceFee: string; + transactionData: SorobanDataBuilder; + } + } + + export function isSimulationError(sim: SimulateTransactionResponse): + sim is SimulateTransactionErrorResponse { + return 'error' in sim; + } + + export function isSimulationSuccess(sim: SimulateTransactionResponse): + sim is SimulateTransactionSuccessResponse { + return 'transactionData' in sim; + } + + export function isSimulationRestore(sim: SimulateTransactionResponse): + sim is SimulateTransactionRestoreResponse { + return isSimulationSuccess(sim) && 'restorePreamble' in sim && + !!sim.restorePreamble.transactionData; + } + + interface RawSimulateHostFunctionResult { // each string is SorobanAuthorizationEntry XDR in base64 auth?: string[]; - // function response as SCVal XDR in base64 + // invocation return value: the ScVal in base64 xdr: string; } - export interface SimulateTransactionResponse { + /** @see https://soroban.stellar.org/api/methods/simulateTransaction#returns */ + export interface RawSimulateTransactionResponse { id: string; - error?: jsonrpc.Error; - // this is SorobanTransactionData XDR in base64 - transactionData: string; - events: string[]; - minResourceFee: string; - // This will only contain a single element, because only a single + latestLedger: string; + error?: string; + // this is an xdr.SorobanTransactionData in base64 + transactionData?: string; + // these are xdr.DiagnosticEvents in base64 + events?: string[]; + minResourceFee?: string; + // This will only contain a single element if present, because only a single // invokeHostFunctionOperation is supported per transaction. - results: SimulateHostFunctionResult[]; - latestLedger: number; - cost: Cost; + results?: RawSimulateHostFunctionResult[]; + cost?: Cost; + // present if succeeded but has expired ledger entries + restorePreamble?: { + minResourceFee: string; + transactionData: string; + } } } diff --git a/src/soroban/transaction.ts b/src/soroban/transaction.ts index cf3ecee86..126803b2e 100644 --- a/src/soroban/transaction.ts +++ b/src/soroban/transaction.ts @@ -1,20 +1,40 @@ import { - Account, FeeBumpTransaction, Operation, Transaction, TransactionBuilder, - xdr, + SorobanDataBuilder, + xdr } from "stellar-base"; import { SorobanRpc } from "./soroban_rpc"; -// TODO: Transaction is immutable, so we need to re-build it here. :( +/** + * Combines the given raw transaction alongside the simulation results. + * + * @param raw the initial transaction, w/o simulation applied + * @param networkPassphrase the network this simulation applies to (see + * {@link Networks} for options) + * @param simulation the Soroban RPC simulation result (see + * {@link Server.simulateTransaction}) + * + * @returns a new, cloned transaction with the proper auth and resource (fee, + * footprint) simulation data applied + * + * @note if the given transaction already has authorization entries in a host + * function invocation (see {@link Operation.invokeHostFunction}), **the + * simulation entries are ignored**. + * + * @see {Server.simulateTransaction} + * @see {Server.prepareTransaction} + */ export function assembleTransaction( raw: Transaction | FeeBumpTransaction, networkPassphrase: string, - simulation: SorobanRpc.SimulateTransactionResponse -): Transaction { + simulation: + | SorobanRpc.SimulateTransactionResponse + | SorobanRpc.RawSimulateTransactionResponse +): TransactionBuilder { if ("innerTransaction" in raw) { // TODO: Handle feebump transactions return assembleTransaction( @@ -32,14 +52,14 @@ export function assembleTransaction( ); } - if (simulation.results.length !== 1) { - throw new Error(`simulation results invalid: ${simulation.results}`); + let success = parseRawSimulation(simulation); + if (!SorobanRpc.isSimulationSuccess(success)) { + throw new Error(`simulation incorrect: ${JSON.stringify(success)}`); } - const source = new Account(raw.source, `${parseInt(raw.sequence, 10) - 1}`); - const classicFeeNum = parseInt(raw.fee, 10) || 0; - const minResourceFeeNum = parseInt(simulation.minResourceFee, 10) || 0; - const txnBuilder = new TransactionBuilder(source, { + const classicFeeNum = parseInt(raw.fee) || 0; + const minResourceFeeNum = parseInt(success.minResourceFee) || 0; + const txnBuilder = TransactionBuilder.cloneFrom(raw, { // automatically update the tx fee that will be set on the resulting tx to // the sum of 'classic' fee provided from incoming tx.fee and minResourceFee // provided by simulation. @@ -49,50 +69,131 @@ export function assembleTransaction( // in the tx, so can make simplification of total classic fees for the // soroban transaction will be equal to incoming tx.fee + minResourceFee. fee: (classicFeeNum + minResourceFeeNum).toString(), - memo: raw.memo, - networkPassphrase, - timebounds: raw.timeBounds, - ledgerbounds: raw.ledgerBounds, - minAccountSequence: raw.minAccountSequence, - minAccountSequenceAge: raw.minAccountSequenceAge, - minAccountSequenceLedgerGap: raw.minAccountSequenceLedgerGap, - extraSigners: raw.extraSigners, + // apply the pre-built Soroban Tx Data from simulation onto the Tx + sorobanData: success.transactionData.build(), + networkPassphrase }); switch (raw.operations[0].type) { case "invokeHostFunction": + // In this case, we don't want to clone the operation, so we drop it. + txnBuilder.clearOperations(); + const invokeOp: Operation.InvokeHostFunction = raw.operations[0]; + const existingAuth = invokeOp.auth ?? []; txnBuilder.addOperation( Operation.invokeHostFunction({ source: invokeOp.source, func: invokeOp.func, - // apply the auth from the simulation - auth: (invokeOp.auth ?? []).concat( - simulation.results[0].auth?.map((a: string) => - xdr.SorobanAuthorizationEntry.fromXDR(a, "base64") - ) ?? [] - ), + // if auth entries are already present, we consider this "advanced + // usage" and disregard ALL auth entries from the simulation + // + // the intuition is "if auth exists, this tx has probably been + // simulated before" + auth: existingAuth.length > 0 ? existingAuth : success.result!.auth, }) ); break; + } - case "bumpFootprintExpiration": - txnBuilder.addOperation(Operation.bumpFootprintExpiration(raw.operations[0])); - break; + return txnBuilder; +} - case "restoreFootprint": - txnBuilder.addOperation(Operation.restoreFootprint(raw.operations[0])); - break; +/** + * Converts a raw response schema into one with parsed XDR fields and a + * simplified interface. + * + * @param raw the raw response schema (parsed ones are allowed, best-effort + * detected, and returned untouched) + * + * @returns the original parameter (if already parsed), parsed otherwise + */ +export function parseRawSimulation( + sim: + | SorobanRpc.SimulateTransactionResponse + | SorobanRpc.RawSimulateTransactionResponse +): SorobanRpc.SimulateTransactionResponse { + const looksRaw = isSimulationRaw(sim); + if (!looksRaw) { + // Gordon Ramsey in shambles + return sim; + } + + // shared across all responses + let base: SorobanRpc.BaseSimulateTransactionResponse = { + _parsed: true, + id: sim.id, + latestLedger: sim.latestLedger, + events: sim.events?.map( + evt => xdr.DiagnosticEvent.fromXDR(evt, 'base64') + ) ?? [], + }; + + // error type: just has error string + if (typeof sim.error === 'string') { + return { + ...base, + error: sim.error, + }; } - // apply the pre-built Soroban Tx Data from simulation onto the Tx - const sorobanTxData = xdr.SorobanTransactionData.fromXDR( - simulation.transactionData, - "base64" - ); - txnBuilder.setSorobanData(sorobanTxData); + return parseSuccessful(sim, base); +} + +function parseSuccessful( + sim: SorobanRpc.RawSimulateTransactionResponse, + partial: SorobanRpc.BaseSimulateTransactionResponse +): + | SorobanRpc.SimulateTransactionRestoreResponse + | SorobanRpc.SimulateTransactionSuccessResponse { - return txnBuilder.build(); + // success type: might have a result (if invoking) and... + const success: SorobanRpc.SimulateTransactionSuccessResponse = { + ...partial, + transactionData: new SorobanDataBuilder(sim.transactionData!), + minResourceFee: sim.minResourceFee!, + cost: sim.cost!, + ...( + // coalesce 0-or-1-element results[] list into a single result struct + // with decoded fields if present + (sim.results?.length ?? 0 > 0) && + { + result: sim.results!.map(row => { + return { + auth: (row.auth ?? []).map((entry) => + xdr.SorobanAuthorizationEntry.fromXDR(entry, 'base64')), + // if return value is missing ("falsy") we coalesce to void + retval: !!row.xdr + ? xdr.ScVal.fromXDR(row.xdr, 'base64') + : xdr.ScVal.scvVoid() + } + })[0], + } + ) + }; + + if (!sim.restorePreamble || sim.restorePreamble.transactionData === '') { + return success; + } + + // ...might have a restoration hint (if some state is expired) + return { + ...success, + restorePreamble: { + minResourceFee: sim.restorePreamble!.minResourceFee, + transactionData: new SorobanDataBuilder( + sim.restorePreamble!.transactionData + ), + } + }; +} + +export function isSimulationRaw( + sim: + | SorobanRpc.SimulateTransactionResponse + | SorobanRpc.RawSimulateTransactionResponse +): sim is SorobanRpc.RawSimulateTransactionResponse { + return !(sim as SorobanRpc.SimulateTransactionResponse)._parsed; } function isSorobanTransaction(tx: Transaction): boolean { @@ -104,9 +205,9 @@ function isSorobanTransaction(tx: Transaction): boolean { case "invokeHostFunction": case "bumpFootprintExpiration": case "restoreFootprint": - return true; + return true default: return false; } -} +} \ No newline at end of file From 5b2c403ba2e07b2df94896faa024d69fa3dd6ff1 Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Thu, 14 Sep 2023 16:59:49 -0700 Subject: [PATCH 7/8] Trying to update Soroban tests to pass --- package.json | 24 +- src/index.ts | 3 +- src/soroban/contract_spec.ts | 693 ++++++++++++++++++ src/soroban/index.ts | 3 +- src/soroban/server.ts | 38 +- test/spec.json | 34 + test/test-nodejs.js | 1 + test/tsconfig.json | 15 + test/unit/call_builders_test.js | 5 +- test/unit/contract_spec.js | 244 ++++++ test/unit/contract_spec.ts | 288 ++++++++ .../{ => horizon}/claimable_balances.js | 0 test/unit/server/{ => horizon}/join_test.js | 0 test/unit/server/soroban/constructor_test.js | 27 + test/unit/server/soroban/get_account_test.js | 107 +++ .../server/soroban/get_contract_data_test.js | 113 +++ test/unit/server/soroban/get_events_test.js | 265 +++++++ test/unit/server/soroban/get_health_test.js | 39 + .../server/soroban/get_latest_ledger_test.js | 40 + test/unit/server/soroban/get_network_test.js | 40 + .../server/soroban/get_transaction_test.js | 164 +++++ .../server/soroban/request_airdrop_test.js | 255 +++++++ .../server/soroban/send_transaction_test.js | 71 ++ .../soroban/simulate_transaction_test.js | 281 +++++++ test/unit/transaction_test.js | 232 ++++++ yarn.lock | 280 +++++-- 26 files changed, 3155 insertions(+), 107 deletions(-) create mode 100644 src/soroban/contract_spec.ts create mode 100644 test/spec.json create mode 100644 test/tsconfig.json create mode 100644 test/unit/contract_spec.js create mode 100644 test/unit/contract_spec.ts rename test/unit/server/{ => horizon}/claimable_balances.js (100%) rename test/unit/server/{ => horizon}/join_test.js (100%) create mode 100644 test/unit/server/soroban/constructor_test.js create mode 100644 test/unit/server/soroban/get_account_test.js create mode 100644 test/unit/server/soroban/get_contract_data_test.js create mode 100644 test/unit/server/soroban/get_events_test.js create mode 100644 test/unit/server/soroban/get_health_test.js create mode 100644 test/unit/server/soroban/get_latest_ledger_test.js create mode 100644 test/unit/server/soroban/get_network_test.js create mode 100644 test/unit/server/soroban/get_transaction_test.js create mode 100644 test/unit/server/soroban/request_airdrop_test.js create mode 100644 test/unit/server/soroban/send_transaction_test.js create mode 100644 test/unit/server/soroban/simulate_transaction_test.js create mode 100644 test/unit/transaction_test.js diff --git a/package.json b/package.json index f5d1831bd..419b050da 100644 --- a/package.json +++ b/package.json @@ -28,18 +28,19 @@ "build:prod": "cross-env NODE_ENV=production yarn _build", "build:node": "yarn _babel && yarn build:ts", "build:ts": "tsc -p ./config/tsconfig.json", + "build:test": "tsc -p ./test/tsconfig.json", "build:browser": "webpack -c config/webpack.config.browser.js", "build:docs": "cross-env NODE_ENV=docs yarn _babel", "clean": "rm -rf lib/ dist/ coverage/ .nyc_output/ jsdoc/", "docs": "yarn build:docs && jsdoc -c ./config/.jsdoc.json --verbose", - "test": "yarn test:node && yarn test:integration && yarn test:browser", + "test": "yarn build:test && yarn test:node && yarn test:integration && yarn test:browser", "test:node": "yarn _nyc mocha --recursive 'test/unit/**/*.js'", "test:integration": "yarn _nyc mocha --recursive 'test/integration/**/*.js'", "test:browser": "karma start config/karma.conf.js", "fmt": "yarn eslint -c .eslintrc.js src/ --fix && yarn _prettier", "preversion": "yarn clean && yarn fmt && yarn build:prod && yarn test", "prepare": "yarn build:prod", - "_build": "yarn build:node && yarn build:browser", + "_build": "yarn build:node && yarn build:test && 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'" @@ -76,23 +77,26 @@ }, "devDependencies": { "@babel/cli": "^7.22.15", - "@babel/core": "^7.22.15", + "@babel/core": "^7.22.19", "@babel/eslint-parser": "^7.22.15", "@babel/eslint-plugin": "^7.22.10", "@babel/preset-env": "^7.22.15", "@babel/preset-typescript": "^7.22.15", "@babel/register": "^7.22.15", - "@definitelytyped/dtslint": "^0.0.177", + "@definitelytyped/dtslint": "^0.0.178", "@istanbuljs/nyc-config-babel": "3.0.0", "@stellar/tsconfig": "^1.0.2", + "@types/chai": "^4.3.6", "@types/detect-node": "^2.0.0", "@types/eventsource": "^1.1.2", "@types/lodash": "^4.14.198", - "@types/node": "^20.5.9", + "@types/mocha": "^10.0.1", + "@types/node": "^20.6.0", "@types/randombytes": "^2.0.0", + "@types/sinon": "^10.0.16", "@types/urijs": "^1.19.20", - "@typescript-eslint/parser": "^6.6.0", - "axios-mock-adapter": "^1.21.5", + "@typescript-eslint/parser": "^6.7.0", + "axios-mock-adapter": "^1.22.0", "babel-loader": "^9.1.3", "babel-plugin-istanbul": "^6.1.1", "buffer": "^6.0.3", @@ -100,7 +104,7 @@ "chai-as-promised": "^7.1.1", "chai-http": "^4.3.0", "cross-env": "^7.0.3", - "eslint": "^8.48.0", + "eslint": "^8.49.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-import": "^2.28.1", @@ -127,7 +131,7 @@ "nyc": "^15.1.0", "prettier": "^3.0.3", "randombytes": "^2.1.0", - "sinon": "^15.2.0", + "sinon": "^16.0.0", "sinon-chai": "^3.7.0", "taffydb": "^2.7.3", "terser-webpack-plugin": "^5.3.9", @@ -142,7 +146,7 @@ "bignumber.js": "^9.1.2", "eventsource": "^2.0.2", "randombytes": "^2.1.0", - "stellar-base": "^10.0.0-beta.1", + "stellar-base": "10.0.0-beta.1", "toml": "^3.0.0", "urijs": "^1.19.1" } diff --git a/src/index.ts b/src/index.ts index 9fa315ed3..25709ef5b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,9 +29,10 @@ export { Server as HorizonServer } from './horizon/server'; export * from './utils'; // soroban-client classes to expose -export { SorobanClient, AxiosClient as SorobanAxiosClient } from './soroban'; +export { SorobanServer, AxiosClient as SorobanAxiosClient } from './soroban'; export * from './soroban/transaction'; +export { ContractSpec } from './soroban/contract_spec'; // expose classes and functions from stellar-base export * from 'stellar-base'; diff --git a/src/soroban/contract_spec.ts b/src/soroban/contract_spec.ts new file mode 100644 index 000000000..72afdc032 --- /dev/null +++ b/src/soroban/contract_spec.ts @@ -0,0 +1,693 @@ +import { ScIntType, XdrLargeInt, xdr } from "stellar-base"; + +import { Address } from "stellar-base"; +import { Contract } from "stellar-base"; +import { scValToBigInt } from "stellar-base"; + +export interface Union { + tag: string; + values?: T; +} + +/** + * Provides a ContractSpec class which can contains the XDR types defined by the contract. + * This allows the class to be used to convert between native and raw `xdr.ScVal`s. + * + * @example + * const specEntries = [...]; // XDR spec entries of a smart contract + * const contractSpec = new ContractSpec(specEntries); + * + * // Convert native value to ScVal + * const args = { + * arg1: 'value1', + * arg2: 1234 + * }; + * const scArgs = contractSpec.funcArgsToScVals('funcName', args); + * + * // Call contract + * const resultScv = await callContract(contractId, 'funcName', scArgs); + * + * // Convert result ScVal back to native value + * const result = contractSpec.funcResToNative('funcName', resultScv); + * + * console.log(result); // {success: true} + */ +export class ContractSpec { + public entries: xdr.ScSpecEntry[] = []; + + /** + * Constructs a new ContractSpec from an array of XDR spec entries. + * + * @param {xdr.ScSpecEntry[] | string[]} entries the XDR spec entries + * + * @throws {Error} if entries is invalid + */ + constructor(entries: xdr.ScSpecEntry[] | string[]) { + if (entries.length == 0) { + throw new Error("Contract spec must have at least one entry"); + } + let entry = entries[0]; + if (typeof entry === "string") { + this.entries = (entries as string[]).map((s) => + xdr.ScSpecEntry.fromXDR(s, "base64") + ); + } else { + this.entries = entries as xdr.ScSpecEntry[]; + } + } + /** + * Gets the XDR function spec for the given function name. + * + * @param {string} name the name of the function + * @returns {xdr.ScSpecFunctionV0} the function spec + * + * @throws {Error} if no function with the given name exists + */ + getFunc(name: string): xdr.ScSpecFunctionV0 { + let entry = this.findEntry(name); + if ( + entry.switch().value !== xdr.ScSpecEntryKind.scSpecEntryFunctionV0().value + ) { + throw new Error(`${name} is not a function`); + } + return entry.value() as xdr.ScSpecFunctionV0; + } + + /** + * Converts native JS arguments to ScVals for calling a contract function. + * + * @param {string} name the name of the function + * @param {Object} args the arguments object + * @returns {xdr.ScVal[]} the converted arguments + * + * @throws {Error} if argument is missing or incorrect type + * + * @example + * ```js + * const args = { + * arg1: 'value1', + * arg2: 1234 + * }; + * const scArgs = contractSpec.funcArgsToScVals('funcName', args); + * ``` + */ + funcArgsToScVals(name: string, args: object): xdr.ScVal[] { + let fn = this.getFunc(name); + return fn + .inputs() + .map((input) => this.nativeToScVal(readObj(args, input), input.type())); + } + + /** + * Converts the result ScVal of a function call to a native JS value. + * + * @param {string} name the name of the function + * @param {xdr.ScVal | string} val_or_base64 the result ScVal or base64 encoded string + * @returns {any} the converted native value + * + * @throws {Error} if return type mismatch or invalid input + * + * @example + * ```js + * const resultScv = 'AAA=='; // Base64 encoded ScVal + * const result = contractSpec.funcResToNative('funcName', resultScv); + * ``` + */ + funcResToNative(name: string, val_or_base64: xdr.ScVal | string): any { + let val = + typeof val_or_base64 === "string" + ? xdr.ScVal.fromXDR(val_or_base64, "base64") + : val_or_base64; + let func = this.getFunc(name); + let outputs = func.outputs(); + if (outputs.length === 0) { + let type = val.switch(); + if (type.value !== xdr.ScValType.scvVoid().value) { + throw new Error(`Expected void, got ${type.name}`); + } + return null; + } + if (outputs.length > 1) { + throw new Error(`Multiple outputs not supported`); + } + let output = outputs[0]; + if (output.switch().value === xdr.ScSpecType.scSpecTypeResult().value) { + return this.scValToNative( + val, + output.result().okType() + ); + } + return this.scValToNative(val, output); + } + + /** + * Finds the XDR spec entry for the given name. + * + * @param {string} name the name to find + * @returns {xdr.ScSpecEntry} the entry + * + * @throws {Error} if no entry with the given name exists + */ + findEntry(name: string): xdr.ScSpecEntry { + let entry = this.entries.find( + (entry) => entry.value().name().toString() === name + ); + if (!entry) { + throw new Error(`no such entry: ${name}`); + } + return entry; + } + + /** + * Converts a native JS value to an ScVal based on the given type. + * + * @param {any} val the native JS value + * @param {xdr.ScSpecTypeDef} [ty] the expected type + * @returns {xdr.ScVal} the converted ScVal + * + * @throws {Error} if value cannot be converted to the given type + */ + nativeToScVal(val: any, ty: xdr.ScSpecTypeDef): xdr.ScVal { + let t: xdr.ScSpecType = ty.switch(); + let value = t.value; + if (t.value === xdr.ScSpecType.scSpecTypeUdt().value) { + let udt = ty.value() as xdr.ScSpecTypeUdt; + return this.nativeToUdt(val, udt.name().toString()); + } + if (value === xdr.ScSpecType.scSpecTypeOption().value) { + let opt = ty.value() as xdr.ScSpecTypeOption; + if (val === undefined) { + return xdr.ScVal.scvVoid(); + } + return this.nativeToScVal(val, opt.valueType()); + } + + switch (typeof val) { + case "object": { + if (val === null) { + switch (value) { + case xdr.ScSpecType.scSpecTypeVoid().value: + return xdr.ScVal.scvVoid(); + default: + throw new TypeError( + `Type ${ty} was not void, but value was null` + ); + } + } + + if (val instanceof xdr.ScVal) { + return val; // should we copy? + } + + if (val instanceof Address) { + if (ty.switch().value !== xdr.ScSpecType.scSpecTypeAddress().value) { + throw new TypeError( + `Type ${ty} was not address, but value was Address` + ); + } + return val.toScVal(); + } + + if (val instanceof Contract) { + if (ty.switch().value !== xdr.ScSpecType.scSpecTypeAddress().value) { + throw new TypeError( + `Type ${ty} was not address, but value was Address` + ); + } + return val.address().toScVal(); + } + + if (val instanceof Uint8Array || Buffer.isBuffer(val)) { + const copy = Uint8Array.from(val); + switch (value) { + case xdr.ScSpecType.scSpecTypeBytesN().value: { + let bytes_n = ty.value() as xdr.ScSpecTypeBytesN; + if (copy.length !== bytes_n.n()) { + throw new TypeError( + `expected ${bytes_n.n()} bytes, but got ${copy.length}` + ); + } + //@ts-ignore + return xdr.ScVal.scvBytes(copy); + } + case xdr.ScSpecType.scSpecTypeBytes().value: + //@ts-ignore + return xdr.ScVal.scvBytes(copy); + default: + throw new TypeError( + `invalid type (${ty}) specified for Bytes and BytesN` + ); + } + } + if (Array.isArray(val)) { + if (xdr.ScSpecType.scSpecTypeVec().value === value) { + let vec = ty.value() as xdr.ScSpecTypeVec; + let elementType = vec.elementType(); + return xdr.ScVal.scvVec( + val.map((v) => this.nativeToScVal(v, elementType)) + ); + } else if (xdr.ScSpecType.scSpecTypeTuple().value === value) { + let tup = ty.value() as xdr.ScSpecTypeTuple; + let valTypes = tup.valueTypes(); + if (val.length !== valTypes.length) { + throw new TypeError( + `Tuple expects ${valTypes.length} values, but ${val.length} were provided` + ); + } + return xdr.ScVal.scvVec( + val.map((v, i) => this.nativeToScVal(v, valTypes[i])) + ); + } else { + throw new TypeError(`Type ${ty} was not vec, but value was Array`); + } + } + if (val.constructor === Map) { + if (value !== xdr.ScSpecType.scSpecTypeMap().value) { + throw new TypeError(`Type ${ty} was not map, but value was Map`); + } + let scMap = ty.value() as xdr.ScSpecTypeMap; + let map = val as Map; + let entries: xdr.ScMapEntry[] = []; + let values = map.entries(); + let res = values.next(); + while (!res.done) { + let [k, v] = res.value; + let key = this.nativeToScVal(k, scMap.keyType()); + let val = this.nativeToScVal(v, scMap.valueType()); + entries.push(new xdr.ScMapEntry({ key, val })); + res = values.next(); + } + return xdr.ScVal.scvMap(entries); + } + + if ((val.constructor?.name ?? "") !== "Object") { + throw new TypeError( + `cannot interpret ${ + val.constructor?.name + } value as ScVal (${JSON.stringify(val)})` + ); + } + + throw new TypeError( + `Received object ${val} did not match the provided type ${ty}` + ); + } + + case "number": + case "bigint": { + switch (value) { + case xdr.ScSpecType.scSpecTypeU32().value: + return xdr.ScVal.scvU32(val as number); + case xdr.ScSpecType.scSpecTypeI32().value: + return xdr.ScVal.scvI32(val as number); + case xdr.ScSpecType.scSpecTypeU64().value: + case xdr.ScSpecType.scSpecTypeI64().value: + case xdr.ScSpecType.scSpecTypeU128().value: + case xdr.ScSpecType.scSpecTypeI128().value: + case xdr.ScSpecType.scSpecTypeU256().value: + case xdr.ScSpecType.scSpecTypeI256().value: { + const intType = t.name.substring(10).toLowerCase() as ScIntType; + return new XdrLargeInt(intType, val as bigint).toScVal(); + } + default: + throw new TypeError(`invalid type (${ty}) specified for integer`); + } + } + case "string": + return stringToScVal(val, t); + + case "boolean": { + if (value !== xdr.ScSpecType.scSpecTypeBool().value) { + throw TypeError(`Type ${ty} was not bool, but value was bool`); + } + return xdr.ScVal.scvBool(val); + } + case "undefined": { + if (!ty) { + return xdr.ScVal.scvVoid(); + } + switch (value) { + case xdr.ScSpecType.scSpecTypeVoid().value: + case xdr.ScSpecType.scSpecTypeOption().value: + return xdr.ScVal.scvVoid(); + default: + throw new TypeError( + `Type ${ty} was not void, but value was undefined` + ); + } + } + + case "function": // FIXME: Is this too helpful? + return this.nativeToScVal(val(), ty); + + default: + throw new TypeError(`failed to convert typeof ${typeof val} (${val})`); + } + } + + private nativeToUdt(val: any, name: string): xdr.ScVal { + let entry = this.findEntry(name); + switch (entry.switch()) { + case xdr.ScSpecEntryKind.scSpecEntryUdtEnumV0(): + if (typeof val !== "number") { + throw new TypeError( + `expected number for enum ${name}, but got ${typeof val}` + ); + } + return this.nativeToEnum( + val as number, + entry.value() as xdr.ScSpecUdtEnumV0 + ); + case xdr.ScSpecEntryKind.scSpecEntryUdtStructV0(): + return this.nativeToStruct(val, entry.value() as xdr.ScSpecUdtStructV0); + case xdr.ScSpecEntryKind.scSpecEntryUdtUnionV0(): + return this.nativeToUnion(val, entry.value() as xdr.ScSpecUdtUnionV0); + default: + throw new Error(`failed to parse udt ${name}`); + } + } + + private nativeToUnion( + val: Union, + union_: xdr.ScSpecUdtUnionV0 + ): xdr.ScVal { + let entry_name = val.tag; + let case_ = union_.cases().find((entry) => { + let case_ = entry.value().name().toString(); + return case_ === entry_name; + }); + if (!case_) { + throw new TypeError(`no such enum entry: ${entry_name} in ${union_}`); + } + let key = xdr.ScVal.scvSymbol(entry_name); + switch (case_.switch()) { + case xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0(): { + return xdr.ScVal.scvVec([key]); + } + case xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0(): { + let types = (case_.value() as xdr.ScSpecUdtUnionCaseTupleV0).type(); + // if (types.length == 1) { + // return xdr.ScVal.scvVec([ + // key, + // this.nativeToScVal(val.values, types[0]), + // ]); + // } + if (Array.isArray(val.values)) { + if (val.values.length != types.length) { + throw new TypeError( + `union ${union_} expects ${types.length} values, but got ${val.values.length}` + ); + } + let scvals = val.values.map((v, i) => + this.nativeToScVal(v, types[i]) + ); + scvals.unshift(key); + return xdr.ScVal.scvVec(scvals); + } + throw new Error(`failed to parse union case ${case_} with ${val}`); + } + default: + throw new Error(`failed to parse union ${union_} with ${val}`); + } + + // enum_.cases() + } + + private nativeToStruct(val: any, struct: xdr.ScSpecUdtStructV0): xdr.ScVal { + let fields = struct.fields(); + if (fields.some(isNumeric)) { + if (!fields.every(isNumeric)) { + throw new Error( + "mixed numeric and non-numeric field names are not allowed" + ); + } + return xdr.ScVal.scvVec( + fields.map((_, i) => this.nativeToScVal(val[i], fields[i].type())) + ); + } + return xdr.ScVal.scvMap( + fields.map((field) => { + let name = field.name().toString(); + return new xdr.ScMapEntry({ + key: this.nativeToScVal(name, xdr.ScSpecTypeDef.scSpecTypeSymbol()), + val: this.nativeToScVal(val[name], field.type()), + }); + }) + ); + } + + private nativeToEnum(val: number, enum_: xdr.ScSpecUdtEnumV0): xdr.ScVal { + if (enum_.cases().some((entry) => entry.value() === val)) { + return xdr.ScVal.scvU32(val); + } + throw new TypeError(`no such enum entry: ${val} in ${enum_}`); + } + + /** + * Converts an base64 encoded ScVal back to a native JS value based on the given type. + * + * @param {string} scv the base64 encoded ScVal + * @param {xdr.ScSpecTypeDef} typeDef the expected type + * @returns {any} the converted native JS value + * + * @throws {Error} if ScVal cannot be converted to the given type + */ + scValStrToNative(scv: string, typeDef: xdr.ScSpecTypeDef): T { + return this.scValToNative(xdr.ScVal.fromXDR(scv, "base64"), typeDef); + } + + /** + * Converts an ScVal back to a native JS value based on the given type. + * + * @param {xdr.ScVal} scv the ScVal + * @param {xdr.ScSpecTypeDef} typeDef the expected type + * @returns {any} the converted native JS value + * + * @throws {Error} if ScVal cannot be converted to the given type + */ + scValToNative(scv: xdr.ScVal, typeDef: xdr.ScSpecTypeDef): T { + let t = typeDef.switch(); + let value = t.value; + if (value === xdr.ScSpecType.scSpecTypeUdt().value) { + return this.scValUdtToNative(scv, typeDef.value() as xdr.ScSpecTypeUdt); + } + // we use the verbose xdr.ScValType..value form here because it's faster + // than string comparisons and the underlying constants never need to be + // updated + switch (scv.switch().value) { + case xdr.ScValType.scvVoid().value: + return void 0 as T; + + // these can be converted to bigints directly + case xdr.ScValType.scvU64().value: + case xdr.ScValType.scvI64().value: + // these can be parsed by internal abstractions note that this can also + // handle the above two cases, but it's not as efficient (another + // type-check, parsing, etc.) + case xdr.ScValType.scvU128().value: + case xdr.ScValType.scvI128().value: + case xdr.ScValType.scvU256().value: + case xdr.ScValType.scvI256().value: + return scValToBigInt(scv) as T; + + case xdr.ScValType.scvVec().value: { + if (value == xdr.ScSpecType.scSpecTypeVec().value) { + let vec = typeDef.value() as xdr.ScSpecTypeVec; + return (scv.vec() ?? []).map((elm) => + this.scValToNative(elm, vec.elementType()) + ) as T; + } else if (value == xdr.ScSpecType.scSpecTypeTuple().value) { + let tuple = typeDef.value() as xdr.ScSpecTypeTuple; + let valTypes = tuple.valueTypes(); + return (scv.vec() ?? []).map((elm, i) => + this.scValToNative(elm, valTypes[i]) + ) as T; + } + throw new TypeError(`Type ${typeDef} was not vec, but ${scv} is`); + } + + case xdr.ScValType.scvAddress().value: + return Address.fromScVal(scv) as T; + + case xdr.ScValType.scvMap().value: { + let map = scv.map() ?? []; + if (value == xdr.ScSpecType.scSpecTypeMap().value) { + let type_ = typeDef.value() as xdr.ScSpecTypeMap; + let keyType = type_.keyType(); + let valueType = type_.valueType(); + return new Map( + map.map((entry) => [ + this.scValToNative(entry.key(), keyType), + this.scValToNative(entry.val(), valueType), + ]) + ) as T; + } + throw new TypeError( + `ScSpecType ${t.name} was not map, but ${JSON.stringify(scv, null, 2)} is` + ); + } + + // these return the primitive type directly + case xdr.ScValType.scvBool().value: + case xdr.ScValType.scvU32().value: + case xdr.ScValType.scvI32().value: + case xdr.ScValType.scvBytes().value: + return scv.value() as T; + + case xdr.ScValType.scvString().value: + case xdr.ScValType.scvSymbol().value: { + if ( + value !== xdr.ScSpecType.scSpecTypeString().value && + value !== xdr.ScSpecType.scSpecTypeSymbol().value + ) { + throw new Error( + `ScSpecType ${t.name} was not string or symbol, but ${JSON.stringify(scv, null, 2)} is` + ); + } + return scv.value()?.toString() as T; + } + + // these can be converted to bigint + case xdr.ScValType.scvTimepoint().value: + case xdr.ScValType.scvDuration().value: + return scValToBigInt(xdr.ScVal.scvU64(scv.value() as xdr.Uint64)) as T; + + // in the fallthrough case, just return the underlying value directly + default: + throw new TypeError( + `failed to convert ${JSON.stringify(scv, null, 2)} to native type from type ${t.name}` + ); + } + } + + private scValUdtToNative(scv: xdr.ScVal, udt: xdr.ScSpecTypeUdt): any { + let entry = this.findEntry(udt.name().toString()); + switch (entry.switch()) { + case xdr.ScSpecEntryKind.scSpecEntryUdtEnumV0(): + return this.enumToNative(scv, entry.value() as xdr.ScSpecUdtEnumV0); + case xdr.ScSpecEntryKind.scSpecEntryUdtStructV0(): + return this.structToNative(scv, entry.value() as xdr.ScSpecUdtStructV0); + case xdr.ScSpecEntryKind.scSpecEntryUdtUnionV0(): + return this.unionToNative(scv, entry.value() as xdr.ScSpecUdtUnionV0); + default: + throw new Error( + `failed to parse udt ${udt.name().toString()}: ${entry}` + ); + } + } + + private unionToNative(val: xdr.ScVal, udt: xdr.ScSpecUdtUnionV0): any { + let vec = val.vec(); + if (!vec) { + throw new Error(`${JSON.stringify(val, null, 2)} is not a vec`); + } + if (vec.length === 0 && udt.cases.length !== 0) { + throw new Error( + `${val} has length 0, but the there are at least one case in the union` + ); + } + let name = vec[0].sym().toString(); + if (vec[0].switch().value != xdr.ScValType.scvSymbol().value) { + throw new Error(`{vec[0]} is not a symbol`); + } + let entry = udt.cases().find(findCase(name)); + if (!entry) { + throw new Error( + `failed to find entry ${name} in union {udt.name().toString()}` + ); + } + let res: Union = { tag: name, values: undefined }; + if ( + entry.switch().value === + xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value + ) { + let tuple = entry.value() as xdr.ScSpecUdtUnionCaseTupleV0; + let ty = tuple.type(); + //@ts-ignore + let values = []; + for (let i = 0; i < ty.length; i++) { + let v = this.scValToNative(vec[i + 1], ty[i]); + values.push(v); + } + let r = { tag: name, values }; + return r; + } + return res; + } + private structToNative(val: xdr.ScVal, udt: xdr.ScSpecUdtStructV0): any { + let res: any = {}; + let fields = udt.fields(); + if (fields.some(isNumeric)) { + let r = val + .vec() + ?.map((entry, i) => this.scValToNative(entry, fields[i].type())); + return r; + } + val.map()?.forEach((entry, i) => { + let field = fields[i]; + res[field.name().toString()] = this.scValToNative( + entry.val(), + field.type() + ); + }); + return res; + } + + private enumToNative(scv: xdr.ScVal, udt: xdr.ScSpecUdtEnumV0): any { + if (scv.switch().value !== xdr.ScValType.scvU32().value) { + throw new Error(`Enum must have a u32 value`); + } + let num = scv.value() as number; + if (udt.cases().some((entry) => entry.value() === num)) { + } + return num; + } +} + +function stringToScVal(str: string, ty: xdr.ScSpecType): xdr.ScVal { + switch (ty.value) { + case xdr.ScSpecType.scSpecTypeString().value: + return xdr.ScVal.scvString(str); + case xdr.ScSpecType.scSpecTypeSymbol().value: + return xdr.ScVal.scvSymbol(str); + case xdr.ScSpecType.scSpecTypeAddress().value: { + let addr = Address.fromString(str as string); + return xdr.ScVal.scvAddress(addr.toScAddress()); + } + + default: + throw new TypeError( + `invalid type ${ty.name} specified for string value` + ); + } +} + +function isNumeric(field: xdr.ScSpecUdtStructFieldV0) { + return /^\d+$/.test(field.name().toString()); +} + +function findCase(name: string) { + return function matches(entry: xdr.ScSpecUdtUnionCaseV0) { + switch (entry.switch().value) { + case xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value: { + let tuple = entry.value() as xdr.ScSpecUdtUnionCaseTupleV0; + return tuple.name().toString() === name; + } + case xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0().value: { + let void_case = entry.value() as xdr.ScSpecUdtUnionCaseVoidV0; + return void_case.name().toString() === name; + } + default: + return false; + } + }; +} + +function readObj(args: object, input: xdr.ScSpecFunctionInputV0): any { + let inputName = input.name().toString(); + let entry = Object.entries(args).find(([name, _]) => name === inputName); + if (!entry) { + throw new Error(`Missing field ${inputName}`); + } + return entry[1]; +} diff --git a/src/soroban/index.ts b/src/soroban/index.ts index 94c74a5f0..ad7fcc611 100644 --- a/src/soroban/index.ts +++ b/src/soroban/index.ts @@ -5,8 +5,9 @@ export * from "./soroban_rpc"; // stellar-sdk classes to expose -export { Server as SorobanClient } from "./server"; +export { Server as SorobanServer } from "./server"; export { default as AxiosClient } from "./axios"; export * from "./transaction"; +export * from "./contract_spec"; export default module.exports; diff --git a/src/soroban/server.ts b/src/soroban/server.ts index 3b1211b36..dfd947e8c 100644 --- a/src/soroban/server.ts +++ b/src/soroban/server.ts @@ -457,15 +457,15 @@ export class Server { * * @example * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE'; - * const contract = new SorobanClient.Contract(contractId); + * const contract = new StellarSdk.Contract(contractId); * * // Right now, this is just the default fee for this example. - * const fee = SorobanClient.BASE_FEE; - * const transaction = new SorobanClient.TransactionBuilder(account, { fee }) + * const fee = StellarSdk.BASE_FEE; + * const transaction = new StellarSdk.TransactionBuilder(account, { fee }) * // Uncomment the following line to build transactions for the live network. Be * // sure to also change the horizon hostname. - * //.setNetworkPassphrase(SorobanClient.Networks.PUBLIC) - * .setNetworkPassphrase(SorobanClient.Networks.FUTURENET) + * //.setNetworkPassphrase(StellarSdk.Networks.PUBLIC) + * .setNetworkPassphrase(StellarSdk.Networks.FUTURENET) * .setTimeout(30) // valid for the next 30s * // Add an operation to call increment() on the contract * .addOperation(contract.call("increment")) @@ -532,15 +532,15 @@ export class Server { * @throws {jsonrpc.Error | Error} if simulation fails * @example * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE'; - * const contract = new SorobanClient.Contract(contractId); + * const contract = new StellarSdk.Contract(contractId); * * // Right now, this is just the default fee for this example. - * const fee = SorobanClient.BASE_FEE; - * const transaction = new SorobanClient.TransactionBuilder(account, { fee }) + * const fee = StellarSdk.BASE_FEE; + * const transaction = new StellarSdk.TransactionBuilder(account, { fee }) * // Uncomment the following line to build transactions for the live network. Be * // sure to also change the horizon hostname. - * //.setNetworkPassphrase(SorobanClient.Networks.PUBLIC) - * .setNetworkPassphrase(SorobanClient.Networks.FUTURENET) + * //.setNetworkPassphrase(StellarSdk.Networks.PUBLIC) + * .setNetworkPassphrase(StellarSdk.Networks.FUTURENET) * .setTimeout(30) // valid for the next 30s * // Add an operation to call increment() on the contract * .addOperation(contract.call("increment")) @@ -551,8 +551,8 @@ export class Server { * // Sign this transaction with the secret key * // NOTE: signing is transaction is network specific. Test network transactions * // won't work in the public network. To switch networks, use the Network object - * // as explained above (look for SorobanClient.Network). - * const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey); + * // as explained above (look for StellarSdk.Network). + * const sourceKeypair = StellarSdk.Keypair.fromSecret(sourceSecretKey); * preparedTransaction.sign(sourceKeypair); * * server.sendTransaction(transaction).then(result => { @@ -597,15 +597,15 @@ export class Server { * @see https://soroban.stellar.org/api/methods/sendTransaction * @example * const contractId = 'CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE'; - * const contract = new SorobanClient.Contract(contractId); + * const contract = new StellarSdk.Contract(contractId); * * // Right now, this is just the default fee for this example. - * const fee = SorobanClient.BASE_FEE; - * const transaction = new SorobanClient.TransactionBuilder(account, { fee }) + * const fee = StellarSdk.BASE_FEE; + * const transaction = new StellarSdk.TransactionBuilder(account, { fee }) * // Uncomment the following line to build transactions for the live network. Be * // sure to also change the horizon hostname. - * //.setNetworkPassphrase(SorobanClient.Networks.PUBLIC) - * .setNetworkPassphrase(SorobanClient.Networks.FUTURENET) + * //.setNetworkPassphrase(StellarSdk.Networks.PUBLIC) + * .setNetworkPassphrase(StellarSdk.Networks.FUTURENET) * .setTimeout(30) // valid for the next 30s * // Add an operation to call increment() on the contract * .addOperation(contract.call("increment")) @@ -614,8 +614,8 @@ export class Server { * // Sign this transaction with the secret key * // NOTE: signing is transaction is network specific. Test network transactions * // won't work in the public network. To switch networks, use the Network object - * // as explained above (look for SorobanClient.Network). - * const sourceKeypair = SorobanClient.Keypair.fromSecret(sourceSecretKey); + * // as explained above (look for StellarSdk.Network). + * const sourceKeypair = StellarSdk.Keypair.fromSecret(sourceSecretKey); * transaction.sign(sourceKeypair); * * server.sendTransaction(transaction).then((result) => { diff --git a/test/spec.json b/test/spec.json new file mode 100644 index 000000000..887412199 --- /dev/null +++ b/test/spec.json @@ -0,0 +1,34 @@ +["AAAAAQAAAC9UaGlzIGlzIGZyb20gdGhlIHJ1c3QgZG9jIGFib3ZlIHRoZSBzdHJ1Y3QgVGVzdAAAAAAAAAAABFRlc3QAAAADAAAAAAAAAAFhAAAAAAAABAAAAAAAAAABYgAAAAAAAAEAAAAAAAAAAWMAAAAAAAAR", +"AAAAAgAAAAAAAAAAAAAAClNpbXBsZUVudW0AAAAAAAMAAAAAAAAAAAAAAAVGaXJzdAAAAAAAAAAAAAAAAAAABlNlY29uZAAAAAAAAAAAAAAAAAAFVGhpcmQAAAA=", +"AAAAAwAAAAAAAAAAAAAACVJveWFsQ2FyZAAAAAAAAAMAAAAAAAAABEphY2sAAAALAAAAAAAAAAVRdWVlbgAAAAAAAAwAAAAAAAAABEtpbmcAAAAN", +"AAAAAQAAAAAAAAAAAAAAC1R1cGxlU3RydWN0AAAAAAIAAAAAAAAAATAAAAAAAAfQAAAABFRlc3QAAAAAAAAAATEAAAAAAAfQAAAAClNpbXBsZUVudW0AAA==", +"AAAAAgAAAAAAAAAAAAAAC0NvbXBsZXhFbnVtAAAAAAUAAAABAAAAAAAAAAZTdHJ1Y3QAAAAAAAEAAAfQAAAABFRlc3QAAAABAAAAAAAAAAVUdXBsZQAAAAAAAAEAAAfQAAAAC1R1cGxlU3RydWN0AAAAAAEAAAAAAAAABEVudW0AAAABAAAH0AAAAApTaW1wbGVFbnVtAAAAAAABAAAAAAAAAAVBc3NldAAAAAAAAAIAAAATAAAACwAAAAAAAAAAAAAABFZvaWQ=", +"AAAABAAAAAAAAAAAAAAABUVycm9yAAAAAAAAAQAAABxQbGVhc2UgcHJvdmlkZSBhbiBvZGQgbnVtYmVyAAAAD051bWJlck11c3RCZU9kZAAAAAAB", +"AAAAAAAAAAAAAAAFaGVsbG8AAAAAAAABAAAAAAAAAAVoZWxsbwAAAAAAABEAAAABAAAAEQ==", +"AAAAAAAAAAAAAAAEd29pZAAAAAAAAAAA", +"AAAAAAAAAAAAAAADdmFsAAAAAAAAAAABAAAAAA==", +"AAAAAAAAAAAAAAAQdTMyX2ZhaWxfb25fZXZlbgAAAAEAAAAAAAAABHUzMl8AAAAEAAAAAQAAA+kAAAAEAAAAAw==", +"AAAAAAAAAAAAAAAEdTMyXwAAAAEAAAAAAAAABHUzMl8AAAAEAAAAAQAAAAQ=", +"AAAAAAAAAAAAAAAEaTMyXwAAAAEAAAAAAAAABGkzMl8AAAAFAAAAAQAAAAU=", +"AAAAAAAAAAAAAAAEaTY0XwAAAAEAAAAAAAAABGk2NF8AAAAHAAAAAQAAAAc=", +"AAAAAAAAACxFeGFtcGxlIGNvbnRyYWN0IG1ldGhvZCB3aGljaCB0YWtlcyBhIHN0cnVjdAAAAApzdHJ1a3RfaGVsAAAAAAABAAAAAAAAAAZzdHJ1a3QAAAAAB9AAAAAEVGVzdAAAAAEAAAPqAAAAEQ==", +"AAAAAAAAAAAAAAAGc3RydWt0AAAAAAABAAAAAAAAAAZzdHJ1a3QAAAAAB9AAAAAEVGVzdAAAAAEAAAfQAAAABFRlc3Q=", +"AAAAAAAAAAAAAAAGc2ltcGxlAAAAAAABAAAAAAAAAAZzaW1wbGUAAAAAB9AAAAAKU2ltcGxlRW51bQAAAAAAAQAAB9AAAAAKU2ltcGxlRW51bQAA", +"AAAAAAAAAAAAAAAHY29tcGxleAAAAAABAAAAAAAAAAdjb21wbGV4AAAAB9AAAAALQ29tcGxleEVudW0AAAAAAQAAB9AAAAALQ29tcGxleEVudW0A", +"AAAAAAAAAAAAAAAIYWRkcmVzc2UAAAABAAAAAAAAAAhhZGRyZXNzZQAAABMAAAABAAAAEw==", +"AAAAAAAAAAAAAAAFYnl0ZXMAAAAAAAABAAAAAAAAAAVieXRlcwAAAAAAAA4AAAABAAAADg==", +"AAAAAAAAAAAAAAAHYnl0ZXNfbgAAAAABAAAAAAAAAAdieXRlc19uAAAAA+4AAAAJAAAAAQAAA+4AAAAJ", +"AAAAAAAAAAAAAAAEY2FyZAAAAAEAAAAAAAAABGNhcmQAAAfQAAAACVJveWFsQ2FyZAAAAAAAAAEAAAfQAAAACVJveWFsQ2FyZAAAAA==", +"AAAAAAAAAAAAAAAHYm9vbGVhbgAAAAABAAAAAAAAAAdib29sZWFuAAAAAAEAAAABAAAAAQ==", +"AAAAAAAAABdOZWdhdGVzIGEgYm9vbGVhbiB2YWx1ZQAAAAADbm90AAAAAAEAAAAAAAAAB2Jvb2xlYW4AAAAAAQAAAAEAAAAB", +"AAAAAAAAAAAAAAAEaTEyOAAAAAEAAAAAAAAABGkxMjgAAAALAAAAAQAAAAs=", +"AAAAAAAAAAAAAAAEdTEyOAAAAAEAAAAAAAAABHUxMjgAAAAKAAAAAQAAAAo=", +"AAAAAAAAAAAAAAAKbXVsdGlfYXJncwAAAAAAAgAAAAAAAAABYQAAAAAAAAQAAAAAAAAAAWIAAAAAAAABAAAAAQAAAAQ=", +"AAAAAAAAAAAAAAADbWFwAAAAAAEAAAAAAAAAA21hcAAAAAPsAAAABAAAAAEAAAABAAAD7AAAAAQAAAAB", +"AAAAAAAAAAAAAAADdmVjAAAAAAEAAAAAAAAAA3ZlYwAAAAPqAAAABAAAAAEAAAPqAAAABA==", +"AAAAAAAAAAAAAAAFdHVwbGUAAAAAAAABAAAAAAAAAAV0dXBsZQAAAAAAA+0AAAACAAAAEQAAAAQAAAABAAAD7QAAAAIAAAARAAAABA==", +"AAAAAAAAAB9FeGFtcGxlIG9mIGFuIG9wdGlvbmFsIGFyZ3VtZW50AAAAAAZvcHRpb24AAAAAAAEAAAAAAAAABm9wdGlvbgAAAAAD6AAAAAQAAAABAAAD6AAAAAQ=", +"AAAAAAAAAAAAAAAEdTI1NgAAAAEAAAAAAAAABHUyNTYAAAAMAAAAAQAAAAw=", +"AAAAAAAAAAAAAAAEaTI1NgAAAAEAAAAAAAAABGkyNTYAAAANAAAAAQAAAA0=", +"AAAAAAAAAAAAAAAGc3RyaW5nAAAAAAABAAAAAAAAAAZzdHJpbmcAAAAAABAAAAABAAAAEA==", +"AAAAAAAAAAAAAAAMdHVwbGVfc3RydWt0AAAAAQAAAAAAAAAMdHVwbGVfc3RydWt0AAAH0AAAAAtUdXBsZVN0cnVjdAAAAAABAAAH0AAAAAtUdXBsZVN0cnVjdAA="] \ No newline at end of file diff --git a/test/test-nodejs.js b/test/test-nodejs.js index cd5d582db..ed29d26e0 100644 --- a/test/test-nodejs.js +++ b/test/test-nodejs.js @@ -6,6 +6,7 @@ global.StellarSdk = require("../lib/"); global.axios = require("axios"); global.HorizonAxiosClient = StellarSdk.HorizonAxiosClient; global.SorobanAxiosClient = StellarSdk.SorobanAxiosClient; +global.serverUrl = 'https://horizon-live.stellar.org:1337/api/v1/jsonrpc'; var chaiAsPromised = require("chai-as-promised"); var chaiHttp = require("chai-http"); diff --git a/test/tsconfig.json b/test/tsconfig.json new file mode 100644 index 000000000..841368ba1 --- /dev/null +++ b/test/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "@stellar/tsconfig", + "compilerOptions": { + "declaration": false, + "sourceMap": false, + "removeComments": false, + "lib": ["es2015"], + "moduleResolution": "node", + "rootDir": "..", + // "outDir": "./unit/build", + "target": "ES2020", + "strict": false, + }, + "include": ["**/*.ts" ] + } \ No newline at end of file diff --git a/test/unit/call_builders_test.js b/test/unit/call_builders_test.js index 80541b7ec..551ecfc3f 100644 --- a/test/unit/call_builders_test.js +++ b/test/unit/call_builders_test.js @@ -1,5 +1,6 @@ -const URI = require("urijs"); -const CallBuilder = require("../../lib/call_builder").CallBuilder; +import URI from "urijs"; + +const { CallBuilder } = StellarSdk; describe("CallBuilder functions", function () { it("doesn't mutate the constructor passed url argument (it clones it instead)", function () { diff --git a/test/unit/contract_spec.js b/test/unit/contract_spec.js new file mode 100644 index 000000000..cf0d5f453 --- /dev/null +++ b/test/unit/contract_spec.js @@ -0,0 +1,244 @@ +import { xdr, ContractSpec, Address } from "../../lib"; +//@ts-ignore +import spec from "../spec.json"; +import { expect } from "chai"; +const publicKey = "GCBVOLOM32I7OD5TWZQCIXCXML3TK56MDY7ZMTAILIBQHHKPCVU42XYW"; +const addr = Address.fromString(publicKey); +let SPEC; +before(() => { + SPEC = new ContractSpec(spec); +}); +it("throws if no entries", () => { + expect(() => new ContractSpec([])).to.throw(/Contract spec must have at least one entry/i); +}); +describe("Can round trip custom types", function () { + function getResultType(funcName) { + let fn = SPEC.findEntry(funcName).value(); + if (!(fn instanceof xdr.ScSpecFunctionV0)) { + throw new Error("Not a function"); + } + if (fn.outputs().length === 0) { + return xdr.ScSpecTypeDef.scSpecTypeVoid(); + } + return fn.outputs()[0]; + } + function roundtrip(funcName, input, typeName) { + let type = getResultType(funcName); + let ty = typeName ?? funcName; + let obj = {}; + obj[ty] = input; + let scVal = SPEC.funcArgsToScVals(funcName, obj)[0]; + let result = SPEC.scValToNative(scVal, type); + expect(result).deep.equal(input); + } + it("u32", () => { + roundtrip("u32_", 1); + }); + it("i32", () => { + roundtrip("i32_", -1); + }); + it("i64", () => { + roundtrip("i64_", 1n); + }); + it("strukt", () => { + roundtrip("strukt", { a: 0, b: true, c: "hello" }); + }); + describe("simple", () => { + it("first", () => { + const simple = { tag: "First", values: undefined }; + roundtrip("simple", simple); + }); + it("simple second", () => { + const simple = { tag: "Second", values: undefined }; + roundtrip("simple", simple); + }); + it("simple third", () => { + const simple = { tag: "Third", values: undefined }; + roundtrip("simple", simple); + }); + }); + describe("complex", () => { + it("struct", () => { + const complex = { + tag: "Struct", + values: [{ a: 0, b: true, c: "hello" }], + }; + roundtrip("complex", complex); + }); + it("tuple", () => { + const complex = { + tag: "Tuple", + values: [ + [ + { a: 0, b: true, c: "hello" }, + { tag: "First", values: undefined }, + ], + ], + }; + roundtrip("complex", complex); + }); + it("enum", () => { + const complex = { + tag: "Enum", + values: [{ tag: "First", values: undefined }], + }; + roundtrip("complex", complex); + }); + it("asset", () => { + const complex = { tag: "Asset", values: [addr, 1n] }; + roundtrip("complex", complex); + }); + it("void", () => { + const complex = { tag: "Void", values: undefined }; + roundtrip("complex", complex); + }); + }); + it("addresse", () => { + roundtrip("addresse", addr); + }); + it("bytes", () => { + const bytes = Buffer.from("hello"); + roundtrip("bytes", bytes); + }); + it("bytes_n", () => { + const bytes_n = Buffer.from("123456789"); // what's the correct way to construct bytes_n? + roundtrip("bytes_n", bytes_n); + }); + it("card", () => { + const card = 11; + roundtrip("card", card); + }); + it("boolean", () => { + roundtrip("boolean", true); + }); + it("not", () => { + roundtrip("boolean", false); + }); + it("i128", () => { + roundtrip("i128", -1n); + }); + it("u128", () => { + roundtrip("u128", 1n); + }); + it("map", () => { + const map = new Map(); + map.set(1, true); + map.set(2, false); + roundtrip("map", map); + map.set(3, "hahaha"); + expect(() => roundtrip("map", map)).to.throw(/invalid type scSpecTypeBool specified for string value/i); + }); + it("vec", () => { + const vec = [1, 2, 3]; + roundtrip("vec", vec); + }); + it("tuple", () => { + const tuple = ["hello", 1]; + roundtrip("tuple", tuple); + }); + it("option", () => { + roundtrip("option", 1); + roundtrip("option", undefined); + }); + it("u256", () => { + roundtrip("u256", 1n); + expect(() => roundtrip("u256", -1n)).to.throw(/expected a positive value, got: -1/i); + }); + it("i256", () => { + roundtrip("i256", -1n); + }); + it("string", () => { + roundtrip("string", "hello"); + }); + it("tuple_strukt", () => { + const arg = [ + { a: 0, b: true, c: "hello" }, + { tag: "First", values: undefined }, + ]; + roundtrip("tuple_strukt", arg); + }); +}); +describe("parsing and building ScVals", function () { + it("Can parse entries", function () { + let spec = new ContractSpec([GIGA_MAP, func]); + let fn = spec.findEntry("giga_map"); + let gigaMap = spec.findEntry("GigaMap"); + expect(gigaMap).deep.equal(GIGA_MAP); + expect(fn).deep.equal(func); + }); +}); +export const GIGA_MAP = xdr.ScSpecEntry.scSpecEntryUdtStructV0(new xdr.ScSpecUdtStructV0({ + doc: "This is a kitchen sink of all the types", + lib: "", + name: "GigaMap", + fields: [ + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "bool", + type: xdr.ScSpecTypeDef.scSpecTypeBool(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i128", + type: xdr.ScSpecTypeDef.scSpecTypeI128(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u128", + type: xdr.ScSpecTypeDef.scSpecTypeU128(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i256", + type: xdr.ScSpecTypeDef.scSpecTypeI256(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u256", + type: xdr.ScSpecTypeDef.scSpecTypeU256(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i32", + type: xdr.ScSpecTypeDef.scSpecTypeI32(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u32", + type: xdr.ScSpecTypeDef.scSpecTypeU32(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i64", + type: xdr.ScSpecTypeDef.scSpecTypeI64(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u64", + type: xdr.ScSpecTypeDef.scSpecTypeU64(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "symbol", + type: xdr.ScSpecTypeDef.scSpecTypeSymbol(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "string", + type: xdr.ScSpecTypeDef.scSpecTypeString(), + }), + ], +})); +const GIGA_MAP_TYPE = xdr.ScSpecTypeDef.scSpecTypeUdt(new xdr.ScSpecTypeUdt({ name: "GigaMap" })); +let func = xdr.ScSpecEntry.scSpecEntryFunctionV0(new xdr.ScSpecFunctionV0({ + doc: "Kitchen Sink", + name: "giga_map", + inputs: [ + new xdr.ScSpecFunctionInputV0({ + doc: "", + name: "giga_map", + type: GIGA_MAP_TYPE, + }), + ], + outputs: [GIGA_MAP_TYPE], +})); diff --git a/test/unit/contract_spec.ts b/test/unit/contract_spec.ts new file mode 100644 index 000000000..02a12111c --- /dev/null +++ b/test/unit/contract_spec.ts @@ -0,0 +1,288 @@ +import { xdr, ContractSpec, Address } from "../../lib"; +//@ts-ignore +import spec from "../spec.json"; +import { expect } from "chai"; + +const publicKey = "GCBVOLOM32I7OD5TWZQCIXCXML3TK56MDY7ZMTAILIBQHHKPCVU42XYW"; +const addr = Address.fromString(publicKey); +let SPEC: ContractSpec; + +before(() => { + SPEC = new ContractSpec(spec); +}) + +it("throws if no entries", () => { + expect(() => new ContractSpec([])).to.throw(/Contract spec must have at least one entry/i); +}); + +describe("Can round trip custom types", function () { + + function getResultType(funcName: string): xdr.ScSpecTypeDef { + let fn = SPEC.findEntry(funcName).value(); + if (!(fn instanceof xdr.ScSpecFunctionV0)) { + throw new Error("Not a function"); + } + if (fn.outputs().length === 0) { + return xdr.ScSpecTypeDef.scSpecTypeVoid(); + } + return fn.outputs()[0]; + } + + function roundtrip(funcName: string, input: any, typeName?: string) { + let type = getResultType(funcName); + let ty = typeName ?? funcName; + let obj: any = {}; + obj[ty] = input; + let scVal = SPEC.funcArgsToScVals(funcName, obj)[0]; + let result = SPEC.scValToNative(scVal, type); + expect(result).deep.equal(input); + } + + it("u32", () => { + roundtrip("u32_", 1); + }); + + it("i32", () => { + roundtrip("i32_", -1); + }); + + it("i64", () => { + roundtrip("i64_", 1n); + }); + + it("strukt", () => { + roundtrip("strukt", { a: 0, b: true, c: "hello" }); + }); + + describe("simple", () => { + it("first", () => { + const simple = { tag: "First", values: undefined } as const; + roundtrip("simple", simple); + }); + it("simple second", () => { + const simple = { tag: "Second", values: undefined } as const; + roundtrip("simple", simple); + }); + + it("simple third", () => { + const simple = { tag: "Third", values: undefined } as const; + roundtrip("simple", simple); + }); + }); + + describe("complex", () => { + it("struct", () => { + const complex = { + tag: "Struct", + values: [{ a: 0, b: true, c: "hello" }], + } as const; + roundtrip("complex", complex); + }); + + it("tuple", () => { + const complex = { + tag: "Tuple", + values: [ + [ + { a: 0, b: true, c: "hello" }, + { tag: "First", values: undefined }, + ], + ], + } as const; + roundtrip("complex", complex); + }); + + it("enum", () => { + const complex = { + tag: "Enum", + values: [{ tag: "First", values: undefined }], + } as const; + roundtrip("complex", complex); + }); + + it("asset", () => { + const complex = { tag: "Asset", values: [addr, 1n] } as const; + roundtrip("complex", complex); + }); + + it("void", () => { + const complex = { tag: "Void", values: undefined } as const; + roundtrip("complex", complex); + }); + }); + + it("addresse", () => { + roundtrip("addresse", addr); + }); + + it("bytes", () => { + const bytes = Buffer.from("hello"); + roundtrip("bytes", bytes); + }); + + it("bytes_n", () => { + const bytes_n = Buffer.from("123456789"); // what's the correct way to construct bytes_n? + roundtrip("bytes_n", bytes_n); + }); + + it("card", () => { + const card = 11; + roundtrip("card", card); + }); + + it("boolean", () => { + roundtrip("boolean", true); + }); + + it("not", () => { + roundtrip("boolean", false); + }); + + it("i128", () => { + roundtrip("i128", -1n); + }); + + it("u128", () => { + roundtrip("u128", 1n); + }); + + it("map", () => { + const map = new Map(); + map.set(1, true); + map.set(2, false); + roundtrip("map", map); + + map.set(3, "hahaha") + expect(() => roundtrip("map", map)).to.throw(/invalid type scSpecTypeBool specified for string value/i); + }); + + it("vec", () => { + const vec = [1, 2, 3]; + roundtrip("vec", vec); + }); + + it("tuple", () => { + const tuple = ["hello", 1] as const; + roundtrip("tuple", tuple); + }); + + it("option", () => { + roundtrip("option", 1); + roundtrip("option", undefined); + }); + + it("u256", () => { + roundtrip("u256", 1n); + expect(() =>roundtrip("u256", -1n)).to.throw(/expected a positive value, got: -1/i) + }); + + it("i256", () => { + roundtrip("i256", -1n); + }); + + it("string", () => { + roundtrip("string", "hello"); + }); + + it("tuple_strukt", () => { + const arg = [ + { a: 0, b: true, c: "hello" }, + { tag: "First", values: undefined }, + ] as const; + + roundtrip("tuple_strukt", arg); + }); +}); + +describe("parsing and building ScVals", function () { + it("Can parse entries", function () { + let spec = new ContractSpec([GIGA_MAP, func]); + let fn = spec.findEntry("giga_map"); + let gigaMap = spec.findEntry("GigaMap"); + expect(gigaMap).deep.equal(GIGA_MAP); + expect(fn).deep.equal(func); + }); +}); + +export const GIGA_MAP = xdr.ScSpecEntry.scSpecEntryUdtStructV0( + new xdr.ScSpecUdtStructV0({ + doc: "This is a kitchen sink of all the types", + lib: "", + name: "GigaMap", + fields: [ + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "bool", + type: xdr.ScSpecTypeDef.scSpecTypeBool(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i128", + type: xdr.ScSpecTypeDef.scSpecTypeI128(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u128", + type: xdr.ScSpecTypeDef.scSpecTypeU128(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i256", + type: xdr.ScSpecTypeDef.scSpecTypeI256(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u256", + type: xdr.ScSpecTypeDef.scSpecTypeU256(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i32", + type: xdr.ScSpecTypeDef.scSpecTypeI32(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u32", + type: xdr.ScSpecTypeDef.scSpecTypeU32(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i64", + type: xdr.ScSpecTypeDef.scSpecTypeI64(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u64", + type: xdr.ScSpecTypeDef.scSpecTypeU64(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "symbol", + type: xdr.ScSpecTypeDef.scSpecTypeSymbol(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "string", + type: xdr.ScSpecTypeDef.scSpecTypeString(), + }), + ], + }) +); +const GIGA_MAP_TYPE = xdr.ScSpecTypeDef.scSpecTypeUdt( + new xdr.ScSpecTypeUdt({ name: "GigaMap" }) +); + +let func = xdr.ScSpecEntry.scSpecEntryFunctionV0( + new xdr.ScSpecFunctionV0({ + doc: "Kitchen Sink", + name: "giga_map", + inputs: [ + new xdr.ScSpecFunctionInputV0({ + doc: "", + name: "giga_map", + type: GIGA_MAP_TYPE, + }), + ], + outputs: [GIGA_MAP_TYPE], + }) +); diff --git a/test/unit/server/claimable_balances.js b/test/unit/server/horizon/claimable_balances.js similarity index 100% rename from test/unit/server/claimable_balances.js rename to test/unit/server/horizon/claimable_balances.js diff --git a/test/unit/server/join_test.js b/test/unit/server/horizon/join_test.js similarity index 100% rename from test/unit/server/join_test.js rename to test/unit/server/horizon/join_test.js diff --git a/test/unit/server/soroban/constructor_test.js b/test/unit/server/soroban/constructor_test.js new file mode 100644 index 000000000..697b8b5cb --- /dev/null +++ b/test/unit/server/soroban/constructor_test.js @@ -0,0 +1,27 @@ +const { SorobanServer } = StellarSdk; + +describe('Server.constructor', function () { + beforeEach(function () { + this.server = new SorobanServer(serverUrl); + this.axiosMock = sinon.mock(AxiosClient); + }); + + afterEach(function () { + this.axiosMock.verify(); + this.axiosMock.restore(); + }); + + let insecureServerUrl = serverUrl.replace('https://', 'http://'); + + it('throws error for insecure server', function () { + expect(() => new SorobanServer(insecureServerUrl)).to.throw( + /Cannot connect to insecure Soroban RPC server/i + ); + }); + + it('allow insecure server when opts.allowHttp flag is set', function () { + expect( + () => new SorobanServer(insecureServerUrl, { allowHttp: true }) + ).to.not.throw(); + }); +}); diff --git a/test/unit/server/soroban/get_account_test.js b/test/unit/server/soroban/get_account_test.js new file mode 100644 index 000000000..aac7845ab --- /dev/null +++ b/test/unit/server/soroban/get_account_test.js @@ -0,0 +1,107 @@ +const { SorobanServer } = StellarSdk; + +describe('Server#getAccount', function () { + const { Account, StrKey, xdr } = StellarSdk; + + beforeEach(function () { + this.server = new SorobanServer(serverUrl); + this.axiosMock = sinon.mock(AxiosClient); + }); + + afterEach(function () { + this.axiosMock.verify(); + this.axiosMock.restore(); + }); + + it('requests the correct method', function (done) { + const address = 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'; + const accountId = xdr.PublicKey.publicKeyTypeEd25519( + StrKey.decodeEd25519PublicKey(address) + ); + + this.axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'getLedgerEntries', + params: [ + [ + xdr.LedgerKey.account( + new xdr.LedgerKeyAccount({ + accountId + }) + ).toXDR('base64') + ] + ] + }) + .returns( + Promise.resolve({ + data: { + result: { + entries: [ + { + xdr: 'AAAAAAAAAABzdv3ojkzWHMD7KUoXhrPx0GH18vHKV0ZfqpMiEblG1g3gtpoE608YAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAQAAAAAY9D8iA' + } + ] + } + } + }) + ); + + const expected = new Account(address, '1'); + this.server + .getAccount(address) + .then(function (response) { + expect(response).to.be.deep.equal(expected); + done(); + }) + .catch(done); + }); + + it('throws a useful error when the account is not found', function (done) { + const address = 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'; + const accountId = xdr.PublicKey.publicKeyTypeEd25519( + StrKey.decodeEd25519PublicKey(address) + ); + + this.axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'getLedgerEntries', + params: [ + [ + xdr.LedgerKey.account( + new xdr.LedgerKeyAccount({ + accountId + }) + ).toXDR('base64') + ] + ] + }) + .returns( + Promise.resolve({ + data: { + result: { + entries: null + } + } + }) + ); + + this.server + .getAccount(address) + .then(function (_) { + done(new Error('Expected error to be thrown')); + }) + .catch(function (err) { + done( + err.message === `Account not found: ${address}` + ? null + : new Error(`Received unexpected error: ${err.message}`) + ); + }); + }); +}); diff --git a/test/unit/server/soroban/get_contract_data_test.js b/test/unit/server/soroban/get_contract_data_test.js new file mode 100644 index 000000000..85ef5c011 --- /dev/null +++ b/test/unit/server/soroban/get_contract_data_test.js @@ -0,0 +1,113 @@ +const { SorobanServer, xdr } = StellarSdk; + +describe('Server#getContractData', function () { + beforeEach(function () { + this.server = new SorobanServer(serverUrl); + this.axiosMock = sinon.mock(AxiosClient); + }); + + afterEach(function () { + this.axiosMock.verify(); + this.axiosMock.restore(); + }); + + let address = 'CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5'; + let key = StellarSdk.xdr.ScVal.scvVec([ + StellarSdk.xdr.ScVal.scvSymbol('Admin') + ]); + + it('key found', function (done) { + let result = { + id: address, + sequence: '1' + }; + + this.axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'getLedgerEntries', + params: [ + [ + xdr.LedgerKey.contractData( + new xdr.LedgerKeyContractData({ + key, + contract: new StellarSdk.Contract(address) + .address() + .toScAddress(), + durability: xdr.ContractDataDurability.persistent() + }) + ).toXDR('base64') + ] + ] + }) + .returns( + Promise.resolve({ + data: { + result: { + entries: [result] + } + } + }) + ); + + this.server + .getContractData(address, key, 'persistent') + .then(function (response) { + expect(response).to.be.deep.equal(result); + done(); + }) + .catch(function (err) { + done(err); + }); + }); + + it('key not found', function (done) { + this.axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'getLedgerEntries', + params: [ + [ + xdr.LedgerKey.contractData( + new xdr.LedgerKeyContractData({ + key, + contract: new StellarSdk.Contract(address) + .address() + .toScAddress(), + durability: xdr.ContractDataDurability.temporary() + }) + ).toXDR('base64') + ] + ] + }) + .returns(Promise.resolve({ data: { result: { entries: [] } } })); + + this.server + .getContractData(address, key, 'temporary') + .then(function (_response) { + done(new Error('Expected error')); + }) + .catch(function (err) { + done( + err.code == 404 + ? null + : new Error('Expected error code 404, got: ' + err.code) + ); + }); + }); + + it('fails on hex address (was deprecated now unsupported)', function (done) { + let hexAddress = '0'.repeat(63) + '1'; + this.server + .getContractData(hexAddress, key, 'persistent') + .then((reply) => done(new Error(`should fail, got: ${reply}`))) + .catch((error) => { + expect(error).to.contain(/unsupported contract id/i); + done(); + }); + }); +}); diff --git a/test/unit/server/soroban/get_events_test.js b/test/unit/server/soroban/get_events_test.js new file mode 100644 index 000000000..014f8185f --- /dev/null +++ b/test/unit/server/soroban/get_events_test.js @@ -0,0 +1,265 @@ +const { SorobanServer } = StellarSdk; + +describe('Server#getEvents', function () { + beforeEach(function () { + this.server = new SorobanServer(serverUrl); + this.axiosMock = sinon.mock(AxiosClient); + }); + + afterEach(function () { + this.axiosMock.verify(); + this.axiosMock.restore(); + }); + + it('requests the correct endpoint', function (done) { + let result = { events: [] }; + setupMock( + this.axiosMock, + { + filters: [], + pagination: {}, + startLedger: '1' + }, + result + ); + + this.server + .getEvents({ startLedger: 1 }) + .then(function (response) { + expect(response).to.be.deep.equal(result); + done(); + }) + .catch(function (err) { + done(err); + }); + }); + + it('can build wildcard filters', function (done) { + let result = filterEvents(getEventsResponseFixture, '*/*'); + + setupMock( + this.axiosMock, + { + startLedger: '1', + filters: [ + { + topics: [['*', '*']] + } + ], + pagination: {} + }, + result + ); + + this.server + .getEvents({ + startLedger: 1, + filters: [ + { + topics: [['*', '*']] + } + ] + }) + .then(function (response) { + expect(response).to.be.deep.equal(result); + done(); + }) + .catch(done); + }); + + it('can build matching filters', function (done) { + let result = filterEvents( + getEventsResponseFixture, + 'AAAABQAAAAh0cmFuc2Zlcg==/AAAAAQB6Mcc=' + ); + + setupMock( + this.axiosMock, + { + startLedger: '1', + filters: [ + { + topics: [['AAAABQAAAAh0cmFuc2Zlcg==', 'AAAAAQB6Mcc=']] + } + ], + pagination: {} + }, + result + ); + + this.server + .getEvents({ + startLedger: 1, + filters: [ + { + topics: [['AAAABQAAAAh0cmFuc2Zlcg==', 'AAAAAQB6Mcc=']] + } + ] + }) + .then(function (response) { + expect(response).to.be.deep.equal(result); + done(); + }) + .catch(done); + }); + + it('can build mixed filters', function (done) { + let result = filterEventsByLedger( + filterEvents(getEventsResponseFixture, 'AAAABQAAAAh0cmFuc2Zlcg==/*'), + 1 + ); + + setupMock( + this.axiosMock, + { + startLedger: '1', + filters: [ + { + topics: [['AAAABQAAAAh0cmFuc2Zlcg==', '*']] + } + ], + pagination: {} + }, + result + ); + + this.server + .getEvents({ + startLedger: 1, + filters: [ + { + topics: [['AAAABQAAAAh0cmFuc2Zlcg==', '*']] + } + ] + }) + .then(function (response) { + expect(response).to.be.deep.equal(result); + done(); + }) + .catch(done); + }); + + it('can paginate', function (done) { + let result = filterEventsByLedger( + filterEvents(getEventsResponseFixture, '*/*'), + 1 + ); + + setupMock( + this.axiosMock, + { + filters: [ + { + topics: [['*', '*']] + } + ], + pagination: { + limit: 10, + cursor: '0164090849041387521-0000000000' + } + }, + result + ); + + this.server + .getEvents({ + filters: [ + { + topics: [['*', '*']] + } + ], + cursor: '0164090849041387521-0000000000', + limit: 10 + }) + .then(function (response) { + expect(response).to.be.deep.equal(result); + done(); + }) + .catch(done); + }); +}); + +function filterEvents(events, filter) { + return events.filter( + (e, i) => + e.topic.length == filter.length && + e.topic.every((s, j) => s === filter[j] || s === '*') + ); +} + +function filterEventsByLedger(events, start) { + return events.filter((e) => { + return e.ledger.parseInt() >= start; + }); +} + +function setupMock(axiosMock, params, result) { + axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'getEvents', + params: params + }) + .returns(Promise.resolve({ data: { result } })); +} + +let getEventsResponseFixture = [ + { + type: 'system', + ledger: '1', + ledgerClosedAt: '2022-11-16T16:10:41Z', + contractId: + 'e3e82a76cc316f6289fd1ffbdf315da0f2c6be9582b84b9983a402f02ea0fff7', + id: '0164090849041387521-0000000003', + pagingToken: '164090849041387521-3', + topic: ['AAAABQAAAAh0cmFuc2Zlcg==', 'AAAAAQB6Mcc='], + inSuccessfulContractCall: true, + value: { + xdr: 'AAAABQAAAApHaWJNb255UGxzAAA=' + } + }, + { + type: 'contract', + ledger: '2', + ledgerClosedAt: '2022-11-16T16:10:41Z', + contractId: + 'e3e82a76cc316f6289fd1ffbdf315da0f2c6be9582b84b9983a402f02ea0fff7', + id: '0164090849041387521-0000000003', + pagingToken: '164090849041387521-3', + topic: ['AAAAAQB6Mcc=', 'AAAABQAAAAh0cmFuc2Zlcg=='], + inSuccessfulContractCall: true, + value: { + xdr: 'AAAABQAAAApHaWJNb255UGxzAAA=' + } + }, + { + type: 'diagnostic', + ledger: '2', + ledgerClosedAt: '2022-11-16T16:10:41Z', + contractId: + 'a3e82a76cc316f6289fd1ffbdf315da0f2c6be9582b84b9983a402f02ea0fff7', + id: '0164090849041387521-0000000003', + pagingToken: '164090849041387521-3', + inSuccessfulContractCall: true, + topic: ['AAAAAQB6Mcc='], + value: { + xdr: 'AAAABQAAAApHaWJNb255UGxzAAA=' + } + }, + { + type: 'contract', + ledger: '3', + ledgerClosedAt: '2022-12-14T01:01:20Z', + contractId: + '6ebe0114ae15f72f187f05d06dcb66b22bd97218755c9b4646b034ab961fc1d5', + id: '0000000171798695936-0000000001', + pagingToken: '0000000171798695936-0000000001', + inSuccessfulContractCall: true, + topic: ['AAAABQAAAAdDT1VOVEVSAA==', 'AAAABQAAAAlpbmNyZW1lbnQAAAA='], + value: { + xdr: 'AAAAAQAAAAE=' + } + } +]; diff --git a/test/unit/server/soroban/get_health_test.js b/test/unit/server/soroban/get_health_test.js new file mode 100644 index 000000000..872db12f0 --- /dev/null +++ b/test/unit/server/soroban/get_health_test.js @@ -0,0 +1,39 @@ +const { SorobanServer } = StellarSdk; + +describe('Server#getHealth', function () { + beforeEach(function () { + this.server = new SorobanServer(serverUrl); + this.axiosMock = sinon.mock(AxiosClient); + }); + + afterEach(function () { + this.axiosMock.verify(); + this.axiosMock.restore(); + }); + + it('requests the correct endpoint', function (done) { + let result = { + status: 'healthy' + }; + + this.axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'getHealth', + params: null + }) + .returns(Promise.resolve({ data: { result } })); + + this.server + .getHealth() + .then(function (response) { + expect(response).to.be.deep.equal(result); + done(); + }) + .catch(function (err) { + done(err); + }); + }); +}); diff --git a/test/unit/server/soroban/get_latest_ledger_test.js b/test/unit/server/soroban/get_latest_ledger_test.js new file mode 100644 index 000000000..1fa1a29f0 --- /dev/null +++ b/test/unit/server/soroban/get_latest_ledger_test.js @@ -0,0 +1,40 @@ +const { SorobanServer } = StellarSdk; + +describe('Server#getLatestLedger', function () { + beforeEach(function () { + this.server = new SorobanServer(serverUrl); + this.axiosMock = sinon.mock(AxiosClient); + }); + + afterEach(function () { + this.axiosMock.verify(); + this.axiosMock.restore(); + }); + + it('requests the correct method', function (done) { + const result = { + id: 'hashed_id', + sequence: 123, + protocolVersion: 20 + }; + this.axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'getLatestLedger', + params: null + }) + .returns(Promise.resolve({ data: { result } })); + + this.server + .getLatestLedger() + .then(function (response) { + expect(response).to.be.deep.equal(result); + done(); + }) + .catch(function (err) { + done(err); + }); + }); +}); diff --git a/test/unit/server/soroban/get_network_test.js b/test/unit/server/soroban/get_network_test.js new file mode 100644 index 000000000..3521ff862 --- /dev/null +++ b/test/unit/server/soroban/get_network_test.js @@ -0,0 +1,40 @@ +const { SorobanServer } = StellarSdk; + +describe('Server#getNetwork', function () { + beforeEach(function () { + this.server = new SorobanServer(serverUrl); + this.axiosMock = sinon.mock(AxiosClient); + }); + + afterEach(function () { + this.axiosMock.verify(); + this.axiosMock.restore(); + }); + + it('requests the correct method', function (done) { + const result = { + friendbotUrl: 'https://friendbot.stellar.org', + passphrase: 'Soroban Testnet ; December 2018', + protocolVersion: 20 + }; + this.axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'getNetwork', + params: null + }) + .returns(Promise.resolve({ data: { result } })); + + this.server + .getNetwork() + .then(function (response) { + expect(response).to.be.deep.equal(result); + done(); + }) + .catch(function (err) { + done(err); + }); + }); +}); diff --git a/test/unit/server/soroban/get_transaction_test.js b/test/unit/server/soroban/get_transaction_test.js new file mode 100644 index 000000000..1483e17d8 --- /dev/null +++ b/test/unit/server/soroban/get_transaction_test.js @@ -0,0 +1,164 @@ +const { + xdr, + Keypair, + Account, + Server, + TransactionBuilder, + nativeToScVal, + XdrLargeInt +} = StellarSdk; + +describe('Server#getTransaction', function () { + let keypair = Keypair.random(); + let account = new StellarSdk.Account( + keypair.publicKey(), + '56199647068161' + ); + + beforeEach(function () { + this.server = new Server(serverUrl); + this.axiosMock = sinon.mock(AxiosClient); + let transaction = new TransactionBuilder(account, { + fee: 100, + networkPassphrase: StellarSdk.Networks.TESTNET, + v1: true + }) + .addOperation( + StellarSdk.Operation.payment({ + destination: + 'GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW', + asset: StellarSdk.Asset.native(), + amount: '100.50' + }) + ) + .setTimeout(StellarSdk.TimeoutInfinite) + .build(); + transaction.sign(keypair); + + this.transaction = transaction; + this.hash = this.transaction.hash().toString('hex'); + this.blob = transaction.toEnvelope().toXDR().toString('base64'); + this.prepareAxios = (result) => { + this.axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'getTransaction', + params: [this.hash] + }) + .returns(Promise.resolve({ data: { id: 1, result } })); + }; + }); + + afterEach(function () { + this.axiosMock.verify(); + this.axiosMock.restore(); + }); + + it('transaction not found', function (done) { + const result = makeTxResult('NOT_FOUND'); + this.prepareAxios(result); + + this.server + .getTransaction(this.hash) + .then(function (response) { + expect(response).to.be.deep.equal(result); + done(); + }) + .catch((err) => done(err)); + }); + + it('transaction success', function (done) { + const result = makeTxResult('SUCCESS', true); + this.prepareAxios(result); + + let expected = JSON.parse(JSON.stringify(result)); + [ + ['envelopeXdr', xdr.TransactionEnvelope], + ['resultXdr', xdr.TransactionResult], + ['resultMetaXdr', xdr.TransactionMeta] + ].forEach(([field, struct]) => { + expected[field] = struct.fromXDR(result[field], 'base64'); + }); + expected.returnValue = expected.resultMetaXdr + .v3() + .sorobanMeta() + .returnValue(); + + this.server + .getTransaction(this.hash) + .then((resp) => { + expect(Object.keys(resp)).to.eql(Object.keys(expected)); + expect(resp).to.eql(expected); + expect(resp.returnValue).to.eql(new XdrLargeInt('u64', 1234).toScVal()); + done(); + }) + .catch((err) => done(err)); + }); + + xit('non-Soroban transaction success', function (done) { + const result = makeTxResult('SUCCESS', false); + this.prepareAxios(result); + + this.server + .getTransaction(this.hash) + .then((resp) => { + expect(resp).to.be.deep.equal(result); + done(); + }) + .catch((err) => done(err)); + }); + + xit('transaction pending', function (done) {}); + xit('transaction error', function (done) {}); +}); + +function makeTxResult(status, addSoroban = true) { + const metaV3 = new xdr.TransactionMeta( + 3, + new xdr.TransactionMetaV3({ + ext: new xdr.ExtensionPoint(0), + txChangesBefore: [], + operations: [], + txChangesAfter: [], + sorobanMeta: new xdr.SorobanTransactionMeta({ + ext: new xdr.ExtensionPoint(0), + events: [], + diagnosticEvents: [], + returnValue: nativeToScVal(1234) + }) + }) + ); + + // only injected in the success case + // + // this data was picked from a random transaction in horizon: + // aa6a8e198abe53c7e852e4870413b29fe9ef04da1415a97a5de1a4ae489e11e2 + const successInfo = { + ledger: 1234, + createdAt: 123456789010, + applicationOrder: 2, + feeBump: false, + envelopeXdr: + 'AAAAAgAAAAAT/LQZdYz0FcQ4Xwyg8IM17rkUx3pPCCWLu+SowQ/T+gBLB24poiQa9iwAngAAAAEAAAAAAAAAAAAAAABkwdeeAAAAAAAAAAEAAAABAAAAAC/9E8hDhnktyufVBS5tqA734Yz5XrLX2XNgBgH/YEkiAAAADQAAAAAAAAAAAAA1/gAAAAAv/RPIQ4Z5Lcrn1QUubagO9+GM+V6y19lzYAYB/2BJIgAAAAAAAAAAAAA1/gAAAAQAAAACU0lMVkVSAAAAAAAAAAAAAFDutWuu6S6UPJBrotNSgfmXa27M++63OT7TYn1qjgy+AAAAAVNHWAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AAAACUEFMTEFESVVNAAAAAAAAAFDutWuu6S6UPJBrotNSgfmXa27M++63OT7TYn1qjgy+AAAAAlNJTFZFUgAAAAAAAAAAAABQ7rVrrukulDyQa6LTUoH5l2tuzPvutzk+02J9ao4MvgAAAAAAAAACwQ/T+gAAAEA+ztVEKWlqHXNnqy6FXJeHr7TltHzZE6YZm5yZfzPIfLaqpp+5cyKotVkj3d89uZCQNsKsZI48uoyERLne+VwL/2BJIgAAAEA7323gPSaezVSa7Vi0J4PqsnklDH1oHLqNBLwi5EWo5W7ohLGObRVQZ0K0+ufnm4hcm9J4Cuj64gEtpjq5j5cM', + resultXdr: + 'AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAANAAAAAAAAAAUAAAACZ4W6fmN63uhVqYRcHET+D2NEtJvhCIYflFh9GqtY+AwAAAACU0lMVkVSAAAAAAAAAAAAAFDutWuu6S6UPJBrotNSgfmXa27M++63OT7TYn1qjgy+AAAYW0toL2gAAAAAAAAAAAAANf4AAAACcgyAkXD5kObNTeRYciLh7R6ES/zzKp0n+cIK3Y6TjBkAAAABU0dYAAAAAABQ7rVrrukulDyQa6LTUoH5l2tuzPvutzk+02J9ao4MvgAAGlGnIJrXAAAAAlNJTFZFUgAAAAAAAAAAAABQ7rVrrukulDyQa6LTUoH5l2tuzPvutzk+02J9ao4MvgAAGFtLaC9oAAAAApmc7UgUBInrDvij8HMSridx2n1w3I8TVEn4sLr1LSpmAAAAAlBBTExBRElVTQAAAAAAAABQ7rVrrukulDyQa6LTUoH5l2tuzPvutzk+02J9ao4MvgAAIUz88EqYAAAAAVNHWAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AABpRpyCa1wAAAAKYUsaaCZ233xB1p+lG7YksShJWfrjsmItbokiR3ifa0gAAAAJTSUxWRVIAAAAAAAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AABv52PPa5wAAAAJQQUxMQURJVU0AAAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AACFM/PBKmAAAAAJnhbp+Y3re6FWphFwcRP4PY0S0m+EIhh+UWH0aq1j4DAAAAAAAAAAAAAA9pAAAAAJTSUxWRVIAAAAAAAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AABv52PPa5wAAAAAv/RPIQ4Z5Lcrn1QUubagO9+GM+V6y19lzYAYB/2BJIgAAAAAAAAAAAAA9pAAAAAA=', + resultMetaXdr: metaV3.toXDR('base64') + }; + + if (!addSoroban) { + // replace the V3 Soroban meta with a "classic" V2 version + successInfo.resultMetaXdr = + 'AAAAAgAAAAIAAAADAtL5awAAAAAAAAAAS0CFMhOtWUKJWerx66zxkxORaiH6/3RUq7L8zspD5RoAAAAAAcm9QAKVkpMAAHpMAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAC0vi5AAAAAGTB02oAAAAAAAAAAQLS+WsAAAAAAAAAAEtAhTITrVlCiVnq8eus8ZMTkWoh+v90VKuy/M7KQ+UaAAAAAAHJvUAClZKTAAB6TQAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAtL5awAAAABkwdd1AAAAAAAAAAEAAAAGAAAAAwLS+VQAAAACAAAAAG4cwu71zHNXx3jHCzRGOIthcnfwRgfN2f/AoHFLLMclAAAAAEySDkgAAAAAAAAAAkJVU0lORVNTAAAAAAAAAAC3JfDeo9vreItKNPoe74EkFIqWybeUQNFvLvURhHtskAAAAAAeQtHTL5f6TAAAXH0AAAAAAAAAAAAAAAAAAAABAtL5awAAAAIAAAAAbhzC7vXMc1fHeMcLNEY4i2Fyd/BGB83Z/8CgcUssxyUAAAAATJIOSAAAAAAAAAACQlVTSU5FU1MAAAAAAAAAALcl8N6j2+t4i0o0+h7vgSQUipbJt5RA0W8u9RGEe2yQAAAAAB5C0dNHf4CAAACLCQAAAAAAAAAAAAAAAAAAAAMC0vlUAAAAAQAAAABuHMLu9cxzV8d4xws0RjiLYXJ38EYHzdn/wKBxSyzHJQAAAAJCVVNJTkVTUwAAAAAAAAAAtyXw3qPb63iLSjT6Hu+BJBSKlsm3lEDRby71EYR7bJAAAAAAAABAL3//////////AAAAAQAAAAEAE3H3TnhnuQAAAAAAAAAAAAAAAAAAAAAAAAABAtL5awAAAAEAAAAAbhzC7vXMc1fHeMcLNEY4i2Fyd/BGB83Z/8CgcUssxyUAAAACQlVTSU5FU1MAAAAAAAAAALcl8N6j2+t4i0o0+h7vgSQUipbJt5RA0W8u9RGEe2yQAAAAAAAAQC9//////////wAAAAEAAAABABNx9J6Z4RkAAAAAAAAAAAAAAAAAAAAAAAAAAwLS+WsAAAAAAAAAAG4cwu71zHNXx3jHCzRGOIthcnfwRgfN2f/AoHFLLMclAAAAH37+zXQCXdRTAAASZAAAApIAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAABbBXKIigAAABhZWyiOAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAtL0awAAAABkwbqrAAAAAAAAAAEC0vlrAAAAAAAAAABuHMLu9cxzV8d4xws0RjiLYXJ38EYHzdn/wKBxSyzHJQAAAB9+/s10Al3UUwAAEmQAAAKSAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAWwVyiIoAAAAYWVsojgAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAALS9GsAAAAAZMG6qwAAAAAAAAAA'; + } + + return { + status, + latestLedger: 100, + latestLedgerCloseTime: 12345, + oldestLedger: 50, + oldestLedgerCloseTime: 500, + ...(status === 'SUCCESS' && successInfo) + }; +} diff --git a/test/unit/server/soroban/request_airdrop_test.js b/test/unit/server/soroban/request_airdrop_test.js new file mode 100644 index 000000000..67366a1d5 --- /dev/null +++ b/test/unit/server/soroban/request_airdrop_test.js @@ -0,0 +1,255 @@ +const { SorobanServer } = StellarSdk; + +describe('Server#requestAirdrop', function () { + const { Account, StrKey, xdr } = StellarSdk; + + function accountLedgerEntryData(accountId, sequence) { + return new xdr.LedgerEntryData.account( + new xdr.AccountEntry({ + accountId: xdr.AccountId.publicKeyTypeEd25519( + StrKey.decodeEd25519PublicKey(accountId) + ), + balance: xdr.Int64.fromString('1'), + seqNum: xdr.SequenceNumber.fromString(sequence), + numSubEntries: 0, + inflationDest: null, + flags: 0, + homeDomain: '', + // Taken from a real response. idk. + thresholds: Buffer.from('AQAAAA==', 'base64'), + signers: [], + ext: new xdr.AccountEntryExt(0) + }) + ); + } + + // Create a mock transaction meta for the account we're going to request an airdrop for + function transactionMetaFor(accountId, sequence) { + const meta = new xdr.TransactionMeta(0, [ + new xdr.OperationMeta({ + changes: [ + xdr.LedgerEntryChange.ledgerEntryCreated( + new xdr.LedgerEntry({ + lastModifiedLedgerSeq: 0, + data: accountLedgerEntryData(accountId, sequence), + ext: new xdr.LedgerEntryExt(0) + }) + ) + ] + }) + ]); + return meta; + } + + beforeEach(function () { + this.server = new SorobanServer(serverUrl); + this.axiosMock = sinon.mock(AxiosClient); + }); + + afterEach(function () { + this.axiosMock.verify(); + this.axiosMock.restore(); + }); + + function mockGetNetwork(friendbotUrl) { + const result = { + friendbotUrl, + passphrase: 'Soroban Testnet ; December 2018', + protocolVersion: 20 + }; + this.axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'getNetwork', + params: null + }) + .returns(Promise.resolve({ data: { result } })); + } + + it('returns true when the account is created', function (done) { + const friendbotUrl = 'https://friendbot.stellar.org'; + const accountId = + 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'; + mockGetNetwork.call(this, friendbotUrl); + + const result_meta_xdr = transactionMetaFor(accountId, '1234').toXDR( + 'base64' + ); + this.axiosMock + .expects('post') + .withArgs(`${friendbotUrl}?addr=${accountId}`) + .returns(Promise.resolve({ data: { result_meta_xdr } })); + + this.server + .requestAirdrop(accountId) + .then(function (response) { + expect(response).to.be.deep.equal(new Account(accountId, '1234')); + done(); + }) + .catch(function (err) { + done(err); + }); + }); + + it('returns false if the account already exists', function (done) { + const friendbotUrl = 'https://friendbot.stellar.org'; + const accountId = + 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'; + mockGetNetwork.call(this, friendbotUrl); + + this.axiosMock + .expects('post') + .withArgs(`${friendbotUrl}?addr=${accountId}`) + .returns( + Promise.reject({ + response: { + status: 400, + detail: + 'createAccountAlreadyExist (AAAAAAAAAGT/////AAAAAQAAAAAAAAAA/////AAAAAA=)' + } + }) + ); + + this.axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'getLedgerEntries', + params: [ + [ + xdr.LedgerKey.account( + new xdr.LedgerKeyAccount({ + accountId: xdr.PublicKey.publicKeyTypeEd25519( + StrKey.decodeEd25519PublicKey(accountId) + ) + }) + ).toXDR('base64') + ] + ] + }) + .returns( + Promise.resolve({ + data: { + result: { + entries: [ + { + xdr: accountLedgerEntryData(accountId, '1234').toXDR('base64') + } + ] + } + } + }) + ); + + this.server + .requestAirdrop(accountId) + .then(function (response) { + expect(response).to.be.deep.equal(new Account(accountId, '1234')); + done(); + }) + .catch(function (err) { + done(err); + }); + }); + + it('uses custom friendbotUrl if passed', function (done) { + const friendbotUrl = 'https://custom-friendbot.stellar.org'; + const accountId = + 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'; + + const result_meta_xdr = transactionMetaFor(accountId, '1234').toXDR( + 'base64' + ); + this.axiosMock + .expects('post') + .withArgs(`${friendbotUrl}?addr=${accountId}`) + .returns(Promise.resolve({ data: { result_meta_xdr } })); + + this.server + .requestAirdrop(accountId, friendbotUrl) + .then(function (response) { + expect(response).to.be.deep.equal(new Account(accountId, '1234')); + done(); + }) + .catch(function (err) { + done(err); + }); + }); + + it('rejects invalid addresses', function (done) { + const friendbotUrl = 'https://friendbot.stellar.org'; + const accountId = 'addr&injected=1'; + mockGetNetwork.call(this, friendbotUrl); + + this.axiosMock + .expects('post') + .withArgs(`${friendbotUrl}?addr=addr%26injected%3D1`) + .returns( + Promise.reject({ + response: { + status: 400, + type: 'https://stellar.org/horizon-errors/bad_request', + title: 'Bad Request', + detail: 'The request you sent was invalid in some way.', + extras: { + invalid_field: 'addr', + reason: + 'base32 decode failed: illegal base32 data at input byte 7' + } + } + }) + ); + + this.server + .requestAirdrop(accountId) + .then(function (_) { + done(new Error('Should have thrown')); + }) + .catch(function (err) { + expect(err.response.extras.reason).to.include('base32 decode failed'); + done(); + }); + }); + + it('throws if there is no friendbotUrl set', function (done) { + const accountId = 'addr&injected=1'; + mockGetNetwork.call(this, undefined); + + this.server + .requestAirdrop(accountId) + .then(function (_) { + done(new Error('Should have thrown')); + }) + .catch(function (err) { + expect(err.message).to.be.equal( + 'No friendbot URL configured for current network' + ); + done(); + }); + }); + + it('throws if the request fails', function (done) { + const friendbotUrl = 'https://friendbot.stellar.org'; + const accountId = + 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'; + mockGetNetwork.call(this, friendbotUrl); + + this.axiosMock + .expects('post') + .withArgs(`${friendbotUrl}?addr=${accountId}`) + .returns(Promise.reject(new Error('Request failed'))); + + this.server + .requestAirdrop(accountId) + .then(function (_) { + done(new Error('Should have thrown')); + }) + .catch(function (err) { + expect(err.message).to.be.equal('Request failed'); + done(); + }); + }); +}); diff --git a/test/unit/server/soroban/send_transaction_test.js b/test/unit/server/soroban/send_transaction_test.js new file mode 100644 index 000000000..49f31a5e8 --- /dev/null +++ b/test/unit/server/soroban/send_transaction_test.js @@ -0,0 +1,71 @@ +const { SorobanServer } = StellarSdk; + +describe('Server#sendTransaction', function () { + let keypair = StellarSdk.Keypair.random(); + let account = new StellarSdk.Account( + keypair.publicKey(), + '56199647068161' + ); + + beforeEach(function () { + this.server = new SorobanServer(serverUrl); + this.axiosMock = sinon.mock(AxiosClient); + let transaction = new StellarSdk.TransactionBuilder(account, { + fee: 100, + networkPassphrase: StellarSdk.Networks.TESTNET, + v1: true + }) + .addOperation( + StellarSdk.Operation.payment({ + destination: + 'GASOCNHNNLYFNMDJYQ3XFMI7BYHIOCFW3GJEOWRPEGK2TDPGTG2E5EDW', + asset: StellarSdk.Asset.native(), + amount: '100.50' + }) + ) + .setTimeout(StellarSdk.TimeoutInfinite) + .build(); + transaction.sign(keypair); + + this.transaction = transaction; + this.hash = this.transaction.hash().toString('hex'); + this.blob = transaction.toEnvelope().toXDR().toString('base64'); + }); + + afterEach(function () { + this.axiosMock.verify(); + this.axiosMock.restore(); + }); + + it('sends a transaction', function (done) { + this.axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'sendTransaction', + params: [this.blob] + }) + .returns( + Promise.resolve({ + data: { id: 1, result: { id: this.hash, status: 'PENDING' } } + }) + ); + + this.server + .sendTransaction(this.transaction) + .then(function () { + done(); + }) + .catch(function (err) { + done(err); + }); + }); + xit('adds metadata - tx was too small and was immediately deleted'); + xit('adds metadata, order immediately fills'); + xit('adds metadata, order is open'); + xit('adds metadata, partial fill'); + xit('doesnt add metadata to non-offers'); + xit('adds metadata about offers, even if some ops are not'); + xit('submits fee bump transactions'); +}); diff --git a/test/unit/server/soroban/simulate_transaction_test.js b/test/unit/server/soroban/simulate_transaction_test.js new file mode 100644 index 000000000..dcfd4b078 --- /dev/null +++ b/test/unit/server/soroban/simulate_transaction_test.js @@ -0,0 +1,281 @@ +const { + Account, + Keypair, + Networks, + SorobanServer, + SorobanDataBuilder, + authorizeInvocation, + xdr +} = StellarSdk; + +describe('Server#simulateTransaction', function () { + let keypair = Keypair.random(); + let contractId = 'CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM'; + let contract = new StellarSdk.Contract(contractId); + let address = contract.address().toScAddress(); + + const simulationResponse = invokeSimulationResponse(address); + const parsedSimulationResponse = { + id: simulationResponse.id, + events: simulationResponse.events, + latestLedger: simulationResponse.latestLedger, + minResourceFee: simulationResponse.minResourceFee, + transactionData: new SorobanDataBuilder(simulationResponse.transactionData), + result: { + auth: simulationResponse.results[0].auth.map((entry) => + xdr.SorobanAuthorizationEntry.fromXDR(entry, 'base64') + ), + retval: xdr.ScVal.fromXDR(simulationResponse.results[0].xdr, 'base64') + }, + cost: simulationResponse.cost, + _parsed: true + }; + + beforeEach(function () { + this.server = new SorobanServer(serverUrl); + this.axiosMock = sinon.mock(AxiosClient); + const source = new Account( + 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI', + '1' + ); + function emptyContractTransaction() { + return new StellarSdk.TransactionBuilder(source, { fee: 100 }) + .setNetworkPassphrase('Test') + .setTimeout(StellarSdk.TimeoutInfinite) + .addOperation( + StellarSdk.Operation.invokeHostFunction({ + func: new xdr.HostFunction.hostFunctionTypeInvokeContract( + new xdr.InvokeContractArgs({ + contractAddress: address, + functionName: 'hello', + args: [] + }) + ), + auth: [] + }) + ) + .build(); + } + + const transaction = emptyContractTransaction(); + transaction.sign(keypair); + + this.transaction = transaction; + this.hash = this.transaction.hash().toString('hex'); + this.blob = transaction.toEnvelope().toXDR().toString('base64'); + }); + + afterEach(function () { + this.axiosMock.verify(); + this.axiosMock.restore(); + }); + + it('simulates a transaction', function (done) { + this.axiosMock + .expects('post') + .withArgs(serverUrl, { + jsonrpc: '2.0', + id: 1, + method: 'simulateTransaction', + params: [this.blob] + }) + .returns( + Promise.resolve({ data: { id: 1, result: simulationResponse } }) + ); + + this.server + .simulateTransaction(this.transaction) + .then(function (response) { + expect(response).to.be.deep.equal(parsedSimulationResponse); + done(); + }) + .catch(function (err) { + done(err); + }); + }); + + it('works when there are no results', function () { + const simResponse = baseSimulationResponse(); + const parsedCopy = cloneSimulation(parsedSimulationResponse); + delete parsedCopy.result; + + const parsed = StellarSdk.parseRawSimulation(simResponse); + expect(parsed).to.deep.equal(parsedCopy); + expect(StellarSdk.SorobanRpc.isSimulationSuccess(parsed)).to.be.true; + }); + + it('works with no auth', function () { + const simResponse = invokeSimulationResponse(address); + delete simResponse.results[0].auth; + + const parsedCopy = cloneSimulation(parsedSimulationResponse); + parsedCopy.result.auth = []; + const parsed = StellarSdk.parseRawSimulation(simResponse); + + // FIXME: This is a workaround for an xdrgen bug that does not allow you to + // build "perfectly-equal" xdr.ExtensionPoint instances (but they're still + // binary-equal, so the test passes). + parsedCopy.transactionData = parsedCopy.transactionData.build(); + parsed.transactionData = parsed.transactionData.build(); + + expect(parsed).to.be.deep.equal(parsedCopy); + expect(StellarSdk.SorobanRpc.isSimulationSuccess(parsed)).to.be.true; + }); + + xit('works with restoration', function () { + const simResponse = invokeSimulationResponseWithRestoration(address); + + const expected = cloneSimulation(parsedSimulationResponse); + expected.restorePreamble = { + minResourceFee: '51', + transactionData: new SorobanDataBuilder() + }; + + const parsed = StellarSdk.parseRawSimulation(simResponse); + expect(parsed).to.be.deep.equal(expected); + expect(StellarSdk.SorobanRpc.isSimulationRestore(parsed)).to.be.true; + }); + + it('works with errors', function () { + let simResponse = simulationResponseError(); + + const expected = cloneSimulation(parsedSimulationResponse); + // drop fields that go away with errors + delete expected.result; + delete expected.cost; + delete expected.transactionData; + delete expected.minResourceFee; + expected.error = 'This is an error'; + expected.events = []; + + const parsed = StellarSdk.parseRawSimulation(simResponse); + expect(parsed).to.be.deep.equal(expected); + expect(StellarSdk.SorobanRpc.isSimulationError(parsed)).to.be.true; + }); + + xit('simulates fee bump transactions'); +}); + +function cloneSimulation(sim) { + return { + id: sim.id, + events: Array.from(sim.events), + latestLedger: sim.latestLedger, + minResourceFee: sim.minResourceFee, + transactionData: new SorobanDataBuilder(sim.transactionData.build()), + result: { + auth: sim.result.auth.map((entry) => + xdr.SorobanAuthorizationEntry.fromXDR(entry.toXDR()) + ), + retval: xdr.ScVal.fromXDR(sim.result.retval.toXDR()) + }, + cost: sim.cost, + _parsed: sim._parsed + }; +} + +function buildAuthEntry(address) { + if (!address) { + throw new Error('where address?'); + } + + // Basic fake invocation + const root = new xdr.SorobanAuthorizedInvocation({ + subInvocations: [], + function: + xdr.SorobanAuthorizedFunction.sorobanAuthorizedFunctionTypeContractFn( + new xdr.InvokeContractArgs({ + contractAddress: address, + functionName: 'test', + args: [] + }) + ) + }); + + const kp = Keypair.random(); + return authorizeInvocation(kp, Networks.FUTURENET, 1, root); +} + +function invokeSimulationResponse(address) { + return baseSimulationResponse([ + { + auth: [buildAuthEntry(address)].map((entry) => entry.toXDR('base64')), + xdr: xdr.ScVal.scvU32(0).toXDR('base64') + } + ]); +} + +function simulationResponseError(events) { + return { + id: 1, + ...(events !== undefined && { events }), + latestLedger: 3, + error: 'This is an error' + }; +} + +function baseSimulationResponse(results) { + return { + id: 1, + events: [], + latestLedger: 3, + minResourceFee: '15', + transactionData: new SorobanDataBuilder().build().toXDR('base64'), + ...(results !== undefined && { results }), + cost: { + cpuInsns: '1', + memBytes: '2' + } + }; +} + +function invokeSimulationResponseWithRestoration(address) { + return { + ...invokeSimulationResponse(address), + restorePreamble: { + minResourceFee: '51', + transactionData: new SorobanDataBuilder().build().toXDR('base64') + } + }; +} + +describe('works with real responses', function () { + const schema = { + transactionData: + 'AAAAAAAAAAIAAAAGAAAAAa/6eoLeofDK5ksPljSZ7t/rAj/XR18e40fCB9LBugstAAAAFAAAAAEAAAAHqA0LEZLq3WL+N3rBQLTWuPqdV3Vv6XIAGeBJaz1wMdsAAAAAABg1gAAAAxwAAAAAAAAAAAAAAAk=', + minResourceFee: '27889', + events: [ + 'AAAAAQAAAAAAAAAAAAAAAgAAAAAAAAADAAAADwAAAAdmbl9jYWxsAAAAAA0AAAAgr/p6gt6h8MrmSw+WNJnu3+sCP9dHXx7jR8IH0sG6Cy0AAAAPAAAABWhlbGxvAAAAAAAADwAAAAVBbG9oYQAAAA==', + 'AAAAAQAAAAAAAAABr/p6gt6h8MrmSw+WNJnu3+sCP9dHXx7jR8IH0sG6Cy0AAAACAAAAAAAAAAIAAAAPAAAACWZuX3JldHVybgAAAAAAAA8AAAAFaGVsbG8AAAAAAAAQAAAAAQAAAAIAAAAPAAAABUhlbGxvAAAAAAAADwAAAAVBbG9oYQAAAA==' + ], + results: [ + { + auth: [], + xdr: 'AAAAEAAAAAEAAAACAAAADwAAAAVIZWxsbwAAAAAAAA8AAAAFQWxvaGEAAAA=' + } + ], + cost: { + cpuInsns: '1322134', + memBytes: '1207047' + }, + restorePreamble: { + transactionData: '', + minResourceFee: '0' + }, + latestLedger: '2634' + }; + + it('parses the schema', function () { + expect(StellarSdk.isSimulationRaw(schema)).to.be.true; + + const parsed = StellarSdk.parseRawSimulation(schema); + + expect(parsed.results).to.be.undefined; + expect(parsed.result.auth).to.be.empty; + expect(parsed.result.retval).to.be.instanceOf(xdr.ScVal); + expect(parsed.transactionData).to.be.instanceOf(SorobanDataBuilder); + expect(parsed.events).to.be.lengthOf(2); + expect(parsed.events[0]).to.be.instanceOf(xdr.DiagnosticEvent); + expect(parsed.restorePreamble).to.be.undefined; + }); +}); diff --git a/test/unit/transaction_test.js b/test/unit/transaction_test.js new file mode 100644 index 000000000..a8e6c8067 --- /dev/null +++ b/test/unit/transaction_test.js @@ -0,0 +1,232 @@ +const xdr = StellarSdk.xdr; // shorthand + +describe('assembleTransaction', () => { + xit('works with keybump transactions'); + + const scAddress = new StellarSdk.Address( + 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI' + ).toScAddress(); + + const fnAuth = new xdr.SorobanAuthorizationEntry({ + // Include a credentials w/ a nonce to trigger this + credentials: new xdr.SorobanCredentials.sorobanCredentialsAddress( + new xdr.SorobanAddressCredentials({ + address: scAddress, + nonce: new xdr.Int64(0), + signatureExpirationLedger: 1, + signature: xdr.ScVal.scvVoid() + }) + ), + // And a basic invocation + rootInvocation: new xdr.SorobanAuthorizedInvocation({ + function: + xdr.SorobanAuthorizedFunction.sorobanAuthorizedFunctionTypeContractFn( + new xdr.InvokeContractArgs({ + contractAddress: scAddress, + functionName: 'fn', + args: [] + }) + ), + subInvocations: [] + }) + }).toXDR(); + + const sorobanTransactionData = new StellarSdk.SorobanDataBuilder() + .setResources(0, 5, 0, 0) + .build(); + + const simulationResponse = { + transactionData: sorobanTransactionData.toXDR('base64'), + events: [], + minResourceFee: '115', + results: [ + { + auth: [fnAuth], + xdr: xdr.ScVal.scvU32(0).toXDR('base64') + } + ], + latestLedger: 3, + cost: { + cpuInsns: '0', + memBytes: '0' + } + }; + + describe('Transaction', () => { + const networkPassphrase = StellarSdk.Networks.TESTNET; + const source = new StellarSdk.Account( + 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI', + '1' + ); + + function singleContractFnTransaction(auth) { + return new StellarSdk.TransactionBuilder(source, { fee: 100 }) + .setNetworkPassphrase('Test') + .setTimeout(StellarSdk.TimeoutInfinite) + .addOperation( + StellarSdk.Operation.invokeHostFunction({ + func: xdr.HostFunction.hostFunctionTypeInvokeContract( + new xdr.InvokeContractArgs({ + contractAddress: scAddress, + functionName: 'hello', + args: [xdr.ScVal.scvString('hello')] + }) + ), + auth: auth ?? [] + }) + ) + .build(); + } + + it('simulate updates the tx data from simulation response', () => { + const txn = singleContractFnTransaction(); + const result = StellarSdk.assembleTransaction( + txn, + networkPassphrase, + simulationResponse + ).build(); + + // validate it auto updated the tx fees from sim response fees + // since it was greater than tx.fee + expect(result.toEnvelope().v1().tx().fee()).to.equal(215); + + // validate it udpated sorobantransactiondata block in the tx ext + expect(result.toEnvelope().v1().tx().ext().sorobanData()).to.deep.equal( + sorobanTransactionData + ); + }); + + it('simulate adds the auth to the host function in tx operation', () => { + const txn = singleContractFnTransaction(); + const result = StellarSdk.assembleTransaction( + txn, + networkPassphrase, + simulationResponse + ).build(); + + expect( + result + .toEnvelope() + .v1() + .tx() + .operations()[0] + .body() + .invokeHostFunctionOp() + .auth()[0] + .rootInvocation() + .function() + .contractFn() + .functionName() + .toString() + ).to.equal('fn'); + + expect( + StellarSdk.StrKey.encodeEd25519PublicKey( + result + .toEnvelope() + .v1() + .tx() + .operations()[0] + .body() + .invokeHostFunctionOp() + .auth()[0] + .credentials() + .address() + .address() + .accountId() + .ed25519() + ) + ).to.equal('GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'); + }); + + it('simulate ignores non auth from simulation', () => { + const txn = singleContractFnTransaction(); + let simulateResp = JSON.parse(JSON.stringify(simulationResponse)); + simulateResp.results[0].auth = null; + const result = StellarSdk.assembleTransaction( + txn, + networkPassphrase, + simulateResp + ).build(); + + expect( + result + .toEnvelope() + .v1() + .tx() + .operations()[0] + .body() + .invokeHostFunctionOp() + .auth() + ).to.have.length(0); + }); + + it('throws for non-Soroban ops', () => { + const txn = new StellarSdk.TransactionBuilder(source, { + fee: 100, + networkPassphrase, + v1: true + }) + .addOperation( + StellarSdk.Operation.changeTrust({ + asset: StellarSdk.Asset.native() + }) + ) + .setTimeout(StellarSdk.TimeoutInfinite) + .build(); + + expect(() => { + StellarSdk.assembleTransaction(txn, networkPassphrase, { + transactionData: {}, + events: [], + minResourceFee: '0', + results: [], + latestLedger: 3 + }).build(); + expect.fail(); + }).to.throw(/unsupported transaction/i); + }); + + it('works for all Soroban ops', function () { + [ + StellarSdk.Operation.invokeHostFunction({ + func: xdr.HostFunction.hostFunctionTypeInvokeContract() + }), + StellarSdk.Operation.bumpFootprintExpiration({ + ledgersToExpire: 27 + }), + StellarSdk.Operation.restoreFootprint() + ].forEach((op) => { + const txn = new StellarSdk.TransactionBuilder(source, { + fee: 100, + networkPassphrase, + v1: true + }) + .setTimeout(StellarSdk.TimeoutInfinite) + .addOperation(op) + .build(); + + const tx = StellarSdk.assembleTransaction( + txn, + networkPassphrase, + simulationResponse + ).build(); + expect(tx.operations[0].type).to.equal(op.body().switch().name); + }); + }); + + it("doesn't overwrite auth if it's present", function () { + const txn = singleContractFnTransaction([fnAuth, fnAuth, fnAuth]); + const tx = StellarSdk.assembleTransaction( + txn, + networkPassphrase, + simulationResponse + ).build(); + + expect(tx.operations[0].auth.length).to.equal( + 3, + `auths aren't preserved after simulation: ${simulationResponse}, ${tx}` + ); + }); + }); +}); diff --git a/yarn.lock b/yarn.lock index 179011698..9abd11e05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -44,7 +44,7 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.9.tgz#71cdb00a1ce3a329ce4cbec3a44f9fef35669730" integrity sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ== -"@babel/core@^7.12.3", "@babel/core@^7.22.15", "@babel/core@^7.7.5": +"@babel/core@^7.12.3", "@babel/core@^7.7.5": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.22.15.tgz#15d4fd03f478a459015a4b94cfbb3bd42c48d2f4" integrity sha512-PtZqMmgRrvj8ruoEOIwVA3yoF91O+Hgw9o7DAUTNBA6Mo2jpu31clx9a7Nz/9JznqetTR6zwfC4L3LAjKQXUwA== @@ -65,6 +65,27 @@ json5 "^2.2.3" semver "^6.3.1" +"@babel/core@^7.22.19": + version "7.22.19" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.22.19.tgz#b38162460a6f3baf2a424bda720b24a8aafea241" + integrity sha512-Q8Yj5X4LHVYTbLCKVz0//2D2aDmHF4xzCdEttYvKOnWvErGsa6geHXD6w46x64n5tP69VfeH+IfSrdyH3MLhwA== + dependencies: + "@ampproject/remapping" "^2.2.0" + "@babel/code-frame" "^7.22.13" + "@babel/generator" "^7.22.15" + "@babel/helper-compilation-targets" "^7.22.15" + "@babel/helper-module-transforms" "^7.22.19" + "@babel/helpers" "^7.22.15" + "@babel/parser" "^7.22.16" + "@babel/template" "^7.22.15" + "@babel/traverse" "^7.22.19" + "@babel/types" "^7.22.19" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.3" + semver "^6.3.1" + "@babel/eslint-parser@^7.22.15": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.22.15.tgz#263f059c476e29ca4972481a17b8b660cb025a34" @@ -196,6 +217,17 @@ "@babel/helper-split-export-declaration" "^7.22.6" "@babel/helper-validator-identifier" "^7.22.15" +"@babel/helper-module-transforms@^7.22.19": + version "7.22.19" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.22.19.tgz#94b1f281caa6518f02ec0f5ea2b5348e298ce266" + integrity sha512-m6h1cJvn+OJ+R3jOHp30faq5xKJ7VbjwDj5RGgHuRlU9hrMeKsGC+JpihkR5w1g7IfseCPPtZ0r7/hB4UKaYlA== + dependencies: + "@babel/helper-environment-visitor" "^7.22.5" + "@babel/helper-module-imports" "^7.22.15" + "@babel/helper-simple-access" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/helper-validator-identifier" "^7.22.19" + "@babel/helper-optimise-call-expression@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.22.5.tgz#f21531a9ccbff644fdd156b4077c16ff0c3f609e" @@ -257,6 +289,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.15.tgz#601fa28e4cc06786c18912dca138cec73b882044" integrity sha512-4E/F9IIEi8WR94324mbDUMo074YTheJmd7eZF5vITTeYchqAi6sYXRLHUVsmkdmY4QjfKTcB2jB7dVP3NaBElQ== +"@babel/helper-validator-identifier@^7.22.19": + version "7.22.19" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.19.tgz#2f34ab1e445f5b95e2e6edfe50ea2449e610583a" + integrity sha512-Tinq7ybnEPFFXhlYOYFiSjespWQk0dq2dRNAiMdRTOYQzEGqnnNyrTxPYHP5r6wGjlF1rFgABdDV0g8EwD6Qbg== + "@babel/helper-validator-option@^7.22.15": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz#694c30dfa1d09a6534cdfcafbe56789d36aba040" @@ -289,7 +326,7 @@ chalk "^2.4.2" js-tokens "^4.0.0" -"@babel/parser@^7.14.7", "@babel/parser@^7.20.15", "@babel/parser@^7.22.15": +"@babel/parser@^7.14.7", "@babel/parser@^7.20.15", "@babel/parser@^7.22.15", "@babel/parser@^7.22.16": version "7.22.16" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.16.tgz#180aead7f247305cce6551bea2720934e2fa2c95" integrity sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA== @@ -1008,6 +1045,22 @@ debug "^4.1.0" globals "^11.1.0" +"@babel/traverse@^7.22.19": + version "7.22.19" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.19.tgz#bb2b12b7de9d7fec9e812ed89eea097b941954f8" + integrity sha512-ZCcpVPK64krfdScRbpxF6xA5fz7IOsfMwx1tcACvCzt6JY+0aHkBk7eIU8FRDSZRU5Zei6Z4JfgAxN1bqXGECg== + dependencies: + "@babel/code-frame" "^7.22.13" + "@babel/generator" "^7.22.15" + "@babel/helper-environment-visitor" "^7.22.5" + "@babel/helper-function-name" "^7.22.5" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.22.16" + "@babel/types" "^7.22.19" + debug "^4.1.0" + globals "^11.1.0" + "@babel/types@^7.22.10", "@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.4.4": version "7.22.15" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.15.tgz#266cb21d2c5fd0b3931e7a91b6dd72d2f617d282" @@ -1017,6 +1070,15 @@ "@babel/helper-validator-identifier" "^7.22.15" to-fast-properties "^2.0.0" +"@babel/types@^7.22.19": + version "7.22.19" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.19.tgz#7425343253556916e440e662bb221a93ddb75684" + integrity sha512-P7LAw/LbojPzkgp5oznjE6tQEIWbp4PkkfrZDINTro9zgBRtI324/EYsiSI7lhPbpIQ+DCeR2NNmMWANGGfZsg== + dependencies: + "@babel/helper-string-parser" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.19" + to-fast-properties "^2.0.0" + "@colors/colors@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" @@ -1029,27 +1091,27 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@definitelytyped/dts-critic@^0.0.177": - version "0.0.177" - resolved "https://registry.yarnpkg.com/@definitelytyped/dts-critic/-/dts-critic-0.0.177.tgz#0c8b2d9772c1f27242c47f0866fa66267d7854b2" - integrity sha512-EcKoBzaHMX4MwnPmg1yVNKkTG50ZWoLpPocejl0+AoWZNfk0f1T5/YTcabQ/pC7vrMlN6+C9EufTOs82gJ9ZIA== +"@definitelytyped/dts-critic@^0.0.178": + version "0.0.178" + resolved "https://registry.yarnpkg.com/@definitelytyped/dts-critic/-/dts-critic-0.0.178.tgz#79e82ef35615b1534da979eb925a6130e1977d94" + integrity sha512-1JiY6giD2qLYxDPSWPbZiICzmTX+cHBNMXf09SeY6CJX0kZPcAkX+Uhc64HSqlhutECRWy7SdQCp/NP3xVOt4Q== dependencies: - "@definitelytyped/header-parser" "^0.0.177" + "@definitelytyped/header-parser" "^0.0.178" command-exists "^1.2.8" rimraf "^3.0.2" semver "^7.5.2" tmp "^0.2.1" yargs "^15.3.1" -"@definitelytyped/dtslint@^0.0.177": - version "0.0.177" - resolved "https://registry.yarnpkg.com/@definitelytyped/dtslint/-/dtslint-0.0.177.tgz#0a83ce54a6ff212617f8eea44dce9b22f1862df5" - integrity sha512-ocla41rNWXp9ZyuxhgtFHG+YKkNB1ZKBgFxEHZlRcoFxeiYRsMNe2OSMlubhUUEs7K7A83Vy7WyntNW1DwmEWg== +"@definitelytyped/dtslint@^0.0.178": + version "0.0.178" + resolved "https://registry.yarnpkg.com/@definitelytyped/dtslint/-/dtslint-0.0.178.tgz#9e76093ed0913d3b0e78fefb834d2e3d86bb6246" + integrity sha512-IK4IqJSIY6wS+8Tg0hIuwAltPs0ZIWibMd3CSurQ8E1gNvuXaR48xjsjFVh2R8pxGrIR75mJ5o6H1GjxFZwK1A== dependencies: - "@definitelytyped/dts-critic" "^0.0.177" - "@definitelytyped/header-parser" "^0.0.177" - "@definitelytyped/typescript-versions" "^0.0.177" - "@definitelytyped/utils" "^0.0.177" + "@definitelytyped/dts-critic" "^0.0.178" + "@definitelytyped/header-parser" "^0.0.178" + "@definitelytyped/typescript-versions" "^0.0.178" + "@definitelytyped/utils" "^0.0.178" "@typescript-eslint/eslint-plugin" "^5.55.0" "@typescript-eslint/parser" "^5.55.0" "@typescript-eslint/types" "^5.56.0" @@ -1062,26 +1124,26 @@ tslint "5.14.0" yargs "^15.1.0" -"@definitelytyped/header-parser@^0.0.177": - version "0.0.177" - resolved "https://registry.yarnpkg.com/@definitelytyped/header-parser/-/header-parser-0.0.177.tgz#b9d2762800acc395237d6acc4458bcf640487f6e" - integrity sha512-siVtuvnQxXr4KhD14VV7AzFR0Xb+qcRxJWRQ4AogGkPakd5/ufljAXJ6fBq6HRB57Vy4MmgV9R0irfcMhdaK1A== +"@definitelytyped/header-parser@^0.0.178": + version "0.0.178" + resolved "https://registry.yarnpkg.com/@definitelytyped/header-parser/-/header-parser-0.0.178.tgz#2cfd170a33b014d686135673fa7fac837cfe5556" + integrity sha512-16FFuaWW2Hq+a0Abyt+9gvPAT0w/ezy4eph3RbtLSqxH3T/UHDla1jgnp1DMvfNeBWaIqHxcr+Vrr7BPquw7mw== dependencies: - "@definitelytyped/typescript-versions" "^0.0.177" + "@definitelytyped/typescript-versions" "^0.0.178" "@types/parsimmon" "^1.10.1" parsimmon "^1.13.0" -"@definitelytyped/typescript-versions@^0.0.177": - version "0.0.177" - resolved "https://registry.yarnpkg.com/@definitelytyped/typescript-versions/-/typescript-versions-0.0.177.tgz#4ca225debaaad05f0df855c140b63f664a3a9791" - integrity sha512-PcSKwrB0zhpFq9KadHU7iVkqszg/4TqDlF+xrXNsMpFk523RC7S7HXdPNR3j55774fwvoIRudMbr96v2J+WNKg== +"@definitelytyped/typescript-versions@^0.0.178": + version "0.0.178" + resolved "https://registry.yarnpkg.com/@definitelytyped/typescript-versions/-/typescript-versions-0.0.178.tgz#98a92f2251f18b32122e808b968ca8e009d3b123" + integrity sha512-pPXy3z5gE4xnVgqIRApFcQ6M6kqtRK1gnqyGx/I0Yo1CH8RAsRvumCDB/KiZmQDpCHiy//E9dOIUFdquvC5t7g== -"@definitelytyped/utils@^0.0.177": - version "0.0.177" - resolved "https://registry.yarnpkg.com/@definitelytyped/utils/-/utils-0.0.177.tgz#c6e53cdb7b639a532371587691e11e78fe057484" - integrity sha512-okfO4lAV3rRnvCYYqfPT3ZSqfM4Wwg+02ClzszV5AV0htYKiDn8KpdfM73Fm2DCoqeKuKlMPmtc5VtuRK6vCRg== +"@definitelytyped/utils@^0.0.178": + version "0.0.178" + resolved "https://registry.yarnpkg.com/@definitelytyped/utils/-/utils-0.0.178.tgz#f403be41816690246a4e0244d125a0084b16462a" + integrity sha512-nYg3E51XpTodS0/5w5r1wM/DhPYhyqa9BP8ili4XgB5s9j4v4mDPX9Jwjns2q24derBvyhdUpzshKDh43aqwZw== dependencies: - "@definitelytyped/typescript-versions" "^0.0.177" + "@definitelytyped/typescript-versions" "^0.0.178" "@qiwi/npm-registry-client" "^8.9.1" "@types/node" "^14.14.35" charm "^1.0.2" @@ -1127,7 +1189,12 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.48.0.tgz#642633964e217905436033a2bd08bf322849b7fb" integrity sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw== -"@humanwhocodes/config-array@^0.11.10": +"@eslint/js@8.49.0": + version "8.49.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.49.0.tgz#86f79756004a97fa4df866835093f1df3d03c333" + integrity sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w== + +"@humanwhocodes/config-array@^0.11.10", "@humanwhocodes/config-array@^0.11.11": version "0.11.11" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.11.tgz#88a04c570dbbc7dd943e4712429c3df09bc32844" integrity sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA== @@ -1375,7 +1442,7 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== -"@types/chai@4": +"@types/chai@4", "@types/chai@^4.3.6": version "4.3.6" resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.6.tgz#7b489e8baf393d5dd1266fb203ddd4ea941259e6" integrity sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw== @@ -1480,7 +1547,12 @@ resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-1.0.2.tgz#e2ce9d83a613bacf284c7be7d491945e39e1f8e9" integrity sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA== -"@types/node@*", "@types/node@>=10.0.0", "@types/node@^20.5.9": +"@types/mocha@^10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.1.tgz#2f4f65bb08bc368ac39c96da7b2f09140b26851b" + integrity sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q== + +"@types/node@*", "@types/node@>=10.0.0": version "20.5.9" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.9.tgz#a70ec9d8fa0180a314c3ede0e20ea56ff71aed9a" integrity sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ== @@ -1490,6 +1562,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.58.tgz#547e64027defb95f34824794574dabf5417bc615" integrity sha512-Y8ETZc8afYf6lQ/mVp096phIVsgD/GmDxtm3YaPcc+71jmi/J6zdwbwaUU4JvS56mq6aSfbpkcKhQ5WugrWFPw== +"@types/node@^20.6.0": + version "20.6.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.0.tgz#9d7daa855d33d4efec8aea88cd66db1c2f0ebe16" + integrity sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg== + "@types/parsimmon@^1.10.1": version "1.10.6" resolved "https://registry.yarnpkg.com/@types/parsimmon/-/parsimmon-1.10.6.tgz#8fcf95990514d2a7624aa5f630c13bf2427f9cdd" @@ -1507,6 +1584,18 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.1.tgz#0480eeb7221eb9bc398ad7432c9d7e14b1a5a367" integrity sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg== +"@types/sinon@^10.0.16": + version "10.0.16" + resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-10.0.16.tgz#4bf10313bd9aa8eef1e50ec9f4decd3dd455b4d3" + integrity sha512-j2Du5SYpXZjJVJtXBokASpPRj+e2z+VUhCPHmM6WMfe3dpHu6iVKJMU6AiBcMp/XTAYnEj6Wc1trJUWwZ0QaAQ== + dependencies: + "@types/sinonjs__fake-timers" "*" + +"@types/sinonjs__fake-timers@*": + version "8.1.2" + resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.2.tgz#bf2e02a3dbd4aecaf95942ecd99b7402e03fad5e" + integrity sha512-9GcLXF0/v3t80caGs5p2rRfkB+a8VBGLJZVih6CNFkx8IZ994wiKKLSRs9nuFwk1HevWs/1mnUmkApGrSGsShA== + "@types/superagent@4.1.13": version "4.1.13" resolved "https://registry.yarnpkg.com/@types/superagent/-/superagent-4.1.13.tgz#0aaa3f4ff9404b94932d1dcdfb7f3d39d23997a0" @@ -1558,15 +1647,15 @@ "@typescript-eslint/typescript-estree" "5.62.0" debug "^4.3.4" -"@typescript-eslint/parser@^6.6.0": - version "6.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.6.0.tgz#fe323a7b4eafb6d5ea82b96216561810394a739e" - integrity sha512-setq5aJgUwtzGrhW177/i+DMLqBaJbdwGj2CPIVFFLE0NCliy5ujIdLHd2D1ysmlmsjdL2GWW+hR85neEfc12w== +"@typescript-eslint/parser@^6.7.0": + version "6.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.7.0.tgz#332fe9c7ecf6783d3250b4c8a960bd4af0995807" + integrity sha512-jZKYwqNpNm5kzPVP5z1JXAuxjtl2uG+5NpaMocFPTNC2EdYIgbXIPImObOkhbONxtFTTdoZstLZefbaK+wXZng== dependencies: - "@typescript-eslint/scope-manager" "6.6.0" - "@typescript-eslint/types" "6.6.0" - "@typescript-eslint/typescript-estree" "6.6.0" - "@typescript-eslint/visitor-keys" "6.6.0" + "@typescript-eslint/scope-manager" "6.7.0" + "@typescript-eslint/types" "6.7.0" + "@typescript-eslint/typescript-estree" "6.7.0" + "@typescript-eslint/visitor-keys" "6.7.0" debug "^4.3.4" "@typescript-eslint/scope-manager@5.62.0": @@ -1577,13 +1666,13 @@ "@typescript-eslint/types" "5.62.0" "@typescript-eslint/visitor-keys" "5.62.0" -"@typescript-eslint/scope-manager@6.6.0": - version "6.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.6.0.tgz#57105d4419d6de971f7d2c30a2ff4ac40003f61a" - integrity sha512-pT08u5W/GT4KjPUmEtc2kSYvrH8x89cVzkA0Sy2aaOUIw6YxOIjA8ilwLr/1fLjOedX1QAuBpG9XggWqIIfERw== +"@typescript-eslint/scope-manager@6.7.0": + version "6.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.7.0.tgz#6b3c22187976e2bf5ed0dc0d9095f1f2cbd1d106" + integrity sha512-lAT1Uau20lQyjoLUQ5FUMSX/dS07qux9rYd5FGzKz/Kf8W8ccuvMyldb8hadHdK/qOI7aikvQWqulnEq2nCEYA== dependencies: - "@typescript-eslint/types" "6.6.0" - "@typescript-eslint/visitor-keys" "6.6.0" + "@typescript-eslint/types" "6.7.0" + "@typescript-eslint/visitor-keys" "6.7.0" "@typescript-eslint/type-utils@5.62.0": version "5.62.0" @@ -1600,10 +1689,10 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" integrity sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ== -"@typescript-eslint/types@6.6.0": - version "6.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.6.0.tgz#95e7ea650a2b28bc5af5ea8907114a48f54618c2" - integrity sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg== +"@typescript-eslint/types@6.7.0": + version "6.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.7.0.tgz#8de8ba9cafadc38e89003fe303e219c9250089ae" + integrity sha512-ihPfvOp7pOcN/ysoj0RpBPOx3HQTJTrIN8UZK+WFd3/iDeFHHqeyYxa4hQk4rMhsz9H9mXpR61IzwlBVGXtl9Q== "@typescript-eslint/typescript-estree@5.62.0", "@typescript-eslint/typescript-estree@^5.55.0": version "5.62.0" @@ -1618,13 +1707,13 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@6.6.0": - version "6.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.6.0.tgz#373c420d2e12c28220f4a83352280a04823a91b7" - integrity sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA== +"@typescript-eslint/typescript-estree@6.7.0": + version "6.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.0.tgz#20ce2801733bd46f02cc0f141f5b63fbbf2afb63" + integrity sha512-dPvkXj3n6e9yd/0LfojNU8VMUGHWiLuBZvbM6V6QYD+2qxqInE7J+J/ieY2iGwR9ivf/R/haWGkIj04WVUeiSQ== dependencies: - "@typescript-eslint/types" "6.6.0" - "@typescript-eslint/visitor-keys" "6.6.0" + "@typescript-eslint/types" "6.7.0" + "@typescript-eslint/visitor-keys" "6.7.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" @@ -1653,12 +1742,12 @@ "@typescript-eslint/types" "5.62.0" eslint-visitor-keys "^3.3.0" -"@typescript-eslint/visitor-keys@6.6.0": - version "6.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.6.0.tgz#1109088b4346c8b2446f3845db526374d9a3bafc" - integrity sha512-L61uJT26cMOfFQ+lMZKoJNbAEckLe539VhTxiGHrWl5XSKQgA0RTBZJW2HFPy5T0ZvPVSD93QsrTKDkfNwJGyQ== +"@typescript-eslint/visitor-keys@6.7.0": + version "6.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.0.tgz#34140ac76dfb6316d17012e4469acf3366ad3f44" + integrity sha512-/C1RVgKFDmGMcVGeD8HjKv2bd72oI1KxQDeY8uc66gw9R0OK0eMq48cA+jv9/2Ag6cdrsUGySm1yzYmfz0hxwQ== dependencies: - "@typescript-eslint/types" "6.6.0" + "@typescript-eslint/types" "6.7.0" eslint-visitor-keys "^3.4.1" "@webassemblyjs/ast@1.11.6", "@webassemblyjs/ast@^1.11.5": @@ -2120,10 +2209,10 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3" integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== -axios-mock-adapter@^1.21.5: - version "1.21.5" - resolved "https://registry.yarnpkg.com/axios-mock-adapter/-/axios-mock-adapter-1.21.5.tgz#dd85081717a759f88509c20515082dc09c1cedd7" - integrity sha512-5NI1V/VK+8+JeTF8niqOowuysA4b8mGzdlMN/QnTnoXbYh4HZSNiopsDclN2g/m85+G++IrEtUdZaQ3GnaMsSA== +axios-mock-adapter@^1.22.0: + version "1.22.0" + resolved "https://registry.yarnpkg.com/axios-mock-adapter/-/axios-mock-adapter-1.22.0.tgz#0f3e6be0fc9b55baab06f2d49c0b71157e7c053d" + integrity sha512-dmI0KbkyAhntUR05YY96qg2H6gg0XMl2+qTW0xmYg6Up+BFBAJYRLROMXRdDEL06/Wqwa0TJThAYvFtSFdRCZw== dependencies: fast-deep-equal "^3.1.3" is-buffer "^2.0.5" @@ -3469,7 +3558,7 @@ eslint-webpack-plugin@^4.0.1: normalize-path "^3.0.0" schema-utils "^4.0.0" -eslint@^8.17.0, eslint@^8.48.0: +eslint@^8.17.0: version "8.48.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.48.0.tgz#bf9998ba520063907ba7bfe4c480dc8be03c2155" integrity sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg== @@ -3512,6 +3601,49 @@ eslint@^8.17.0, eslint@^8.48.0: strip-ansi "^6.0.1" text-table "^0.2.0" +eslint@^8.49.0: + version "8.49.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.49.0.tgz#09d80a89bdb4edee2efcf6964623af1054bf6d42" + integrity sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.2" + "@eslint/js" "8.49.0" + "@humanwhocodes/config-array" "^0.11.11" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + ajv "^6.12.4" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" + esquery "^1.4.2" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.19.0" + graphemer "^1.4.0" + ignore "^5.2.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.3" + strip-ansi "^6.0.1" + text-table "^0.2.0" + espree@^9.6.0, espree@^9.6.1: version "9.6.1" resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" @@ -6463,10 +6595,10 @@ sinon-chai@^3.7.0: resolved "https://registry.yarnpkg.com/sinon-chai/-/sinon-chai-3.7.0.tgz#cfb7dec1c50990ed18c153f1840721cf13139783" integrity sha512-mf5NURdUaSdnatJx3uhoBOrY9dtL19fiOtAdT1Azxg3+lNJFiuN0uzaU3xX1LeAfL17kHQhTAJgpsfhbMJMY2g== -sinon@^15.2.0: - version "15.2.0" - resolved "https://registry.yarnpkg.com/sinon/-/sinon-15.2.0.tgz#5e44d4bc5a9b5d993871137fd3560bebfac27565" - integrity sha512-nPS85arNqwBXaIsFCkolHjGIkFo+Oxu9vbgmBJizLAhqe6P2o3Qmj3KCUoRkfhHtvgDhZdWD3risLHAUJ8npjw== +sinon@^16.0.0: + version "16.0.0" + resolved "https://registry.yarnpkg.com/sinon/-/sinon-16.0.0.tgz#06da4e63624b946c9d7e67cce21c2f67f40f23a9" + integrity sha512-B8AaZZm9CT5pqe4l4uWJztfD/mOTa7dL8Qo0W4+s+t74xECOgSZDDQCBjNgIK3+n4kyxQrSTv2V5ul8K25qkiQ== dependencies: "@sinonjs/commons" "^3.0.0" "@sinonjs/fake-timers" "^10.3.0" @@ -6631,10 +6763,10 @@ statuses@~1.5.0: resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== -stellar-base@^10.0.0-soroban.8: - version "10.0.0-soroban.8" - resolved "https://registry.yarnpkg.com/stellar-base/-/stellar-base-10.0.0-soroban.8.tgz#8c5671f9d5a183aeb3077746db56e65b0b5c05da" - integrity sha512-mtj+4EcCnp4ZyH2FzRl62/DAstTXOddHVRZdzFQ94WgyQz2yVNzt+ANDS1D/7ku4d2mIzoJIj9l0/H0A5nRgXQ== +stellar-base@10.0.0-beta.1: + version "10.0.0-beta.1" + resolved "https://registry.yarnpkg.com/stellar-base/-/stellar-base-10.0.0-beta.1.tgz#5b4209fbc44b8af82dd3ee8b7f6f4397126d8c3b" + integrity sha512-zXC5AsbUsLi57JruyeIMv23s3iUxq/P2ZFrSJ+FerLIZjSAjY8EDs4zwY4LCuu7swUu46Lm8GK6sqxUZCPekHw== dependencies: base32.js "^0.1.0" bignumber.js "^9.1.2" From 455fab8fd5a145eb0d0b37890fdf7b70ed124448 Mon Sep 17 00:00:00 2001 From: George Kudrayvtsev Date: Thu, 14 Sep 2023 17:01:52 -0700 Subject: [PATCH 8/8] More moving, formatting pass --- test/test-nodejs.js | 2 +- test/unit/contract_spec.js | 428 +++++++++--------- test/unit/server/soroban/constructor_test.js | 14 +- test/unit/server/soroban/get_account_test.js | 74 +-- .../server/soroban/get_contract_data_test.js | 68 +-- test/unit/server/soroban/get_events_test.js | 180 ++++---- test/unit/server/soroban/get_health_test.js | 16 +- .../server/soroban/get_latest_ledger_test.js | 18 +- test/unit/server/soroban/get_network_test.js | 20 +- .../server/soroban/get_transaction_test.js | 73 ++- .../server/soroban/request_airdrop_test.js | 164 +++---- .../server/soroban/send_transaction_test.js | 49 +- .../soroban/simulate_transaction_test.js | 128 +++--- test/unit/transaction_test.js | 106 ++--- 14 files changed, 674 insertions(+), 666 deletions(-) diff --git a/test/test-nodejs.js b/test/test-nodejs.js index ed29d26e0..d33cbe981 100644 --- a/test/test-nodejs.js +++ b/test/test-nodejs.js @@ -6,7 +6,7 @@ global.StellarSdk = require("../lib/"); global.axios = require("axios"); global.HorizonAxiosClient = StellarSdk.HorizonAxiosClient; global.SorobanAxiosClient = StellarSdk.SorobanAxiosClient; -global.serverUrl = 'https://horizon-live.stellar.org:1337/api/v1/jsonrpc'; +global.serverUrl = "https://horizon-live.stellar.org:1337/api/v1/jsonrpc"; var chaiAsPromised = require("chai-as-promised"); var chaiHttp = require("chai-http"); diff --git a/test/unit/contract_spec.js b/test/unit/contract_spec.js index cf0d5f453..a106c0e2d 100644 --- a/test/unit/contract_spec.js +++ b/test/unit/contract_spec.js @@ -6,239 +6,251 @@ const publicKey = "GCBVOLOM32I7OD5TWZQCIXCXML3TK56MDY7ZMTAILIBQHHKPCVU42XYW"; const addr = Address.fromString(publicKey); let SPEC; before(() => { - SPEC = new ContractSpec(spec); + SPEC = new ContractSpec(spec); }); it("throws if no entries", () => { - expect(() => new ContractSpec([])).to.throw(/Contract spec must have at least one entry/i); + expect(() => new ContractSpec([])).to.throw( + /Contract spec must have at least one entry/i, + ); }); describe("Can round trip custom types", function () { - function getResultType(funcName) { - let fn = SPEC.findEntry(funcName).value(); - if (!(fn instanceof xdr.ScSpecFunctionV0)) { - throw new Error("Not a function"); - } - if (fn.outputs().length === 0) { - return xdr.ScSpecTypeDef.scSpecTypeVoid(); - } - return fn.outputs()[0]; + function getResultType(funcName) { + let fn = SPEC.findEntry(funcName).value(); + if (!(fn instanceof xdr.ScSpecFunctionV0)) { + throw new Error("Not a function"); } - function roundtrip(funcName, input, typeName) { - let type = getResultType(funcName); - let ty = typeName ?? funcName; - let obj = {}; - obj[ty] = input; - let scVal = SPEC.funcArgsToScVals(funcName, obj)[0]; - let result = SPEC.scValToNative(scVal, type); - expect(result).deep.equal(input); + if (fn.outputs().length === 0) { + return xdr.ScSpecTypeDef.scSpecTypeVoid(); } - it("u32", () => { - roundtrip("u32_", 1); + return fn.outputs()[0]; + } + function roundtrip(funcName, input, typeName) { + let type = getResultType(funcName); + let ty = typeName ?? funcName; + let obj = {}; + obj[ty] = input; + let scVal = SPEC.funcArgsToScVals(funcName, obj)[0]; + let result = SPEC.scValToNative(scVal, type); + expect(result).deep.equal(input); + } + it("u32", () => { + roundtrip("u32_", 1); + }); + it("i32", () => { + roundtrip("i32_", -1); + }); + it("i64", () => { + roundtrip("i64_", 1n); + }); + it("strukt", () => { + roundtrip("strukt", { a: 0, b: true, c: "hello" }); + }); + describe("simple", () => { + it("first", () => { + const simple = { tag: "First", values: undefined }; + roundtrip("simple", simple); }); - it("i32", () => { - roundtrip("i32_", -1); + it("simple second", () => { + const simple = { tag: "Second", values: undefined }; + roundtrip("simple", simple); }); - it("i64", () => { - roundtrip("i64_", 1n); + it("simple third", () => { + const simple = { tag: "Third", values: undefined }; + roundtrip("simple", simple); }); - it("strukt", () => { - roundtrip("strukt", { a: 0, b: true, c: "hello" }); - }); - describe("simple", () => { - it("first", () => { - const simple = { tag: "First", values: undefined }; - roundtrip("simple", simple); - }); - it("simple second", () => { - const simple = { tag: "Second", values: undefined }; - roundtrip("simple", simple); - }); - it("simple third", () => { - const simple = { tag: "Third", values: undefined }; - roundtrip("simple", simple); - }); - }); - describe("complex", () => { - it("struct", () => { - const complex = { - tag: "Struct", - values: [{ a: 0, b: true, c: "hello" }], - }; - roundtrip("complex", complex); - }); - it("tuple", () => { - const complex = { - tag: "Tuple", - values: [ - [ - { a: 0, b: true, c: "hello" }, - { tag: "First", values: undefined }, - ], - ], - }; - roundtrip("complex", complex); - }); - it("enum", () => { - const complex = { - tag: "Enum", - values: [{ tag: "First", values: undefined }], - }; - roundtrip("complex", complex); - }); - it("asset", () => { - const complex = { tag: "Asset", values: [addr, 1n] }; - roundtrip("complex", complex); - }); - it("void", () => { - const complex = { tag: "Void", values: undefined }; - roundtrip("complex", complex); - }); - }); - it("addresse", () => { - roundtrip("addresse", addr); - }); - it("bytes", () => { - const bytes = Buffer.from("hello"); - roundtrip("bytes", bytes); - }); - it("bytes_n", () => { - const bytes_n = Buffer.from("123456789"); // what's the correct way to construct bytes_n? - roundtrip("bytes_n", bytes_n); - }); - it("card", () => { - const card = 11; - roundtrip("card", card); - }); - it("boolean", () => { - roundtrip("boolean", true); - }); - it("not", () => { - roundtrip("boolean", false); - }); - it("i128", () => { - roundtrip("i128", -1n); - }); - it("u128", () => { - roundtrip("u128", 1n); - }); - it("map", () => { - const map = new Map(); - map.set(1, true); - map.set(2, false); - roundtrip("map", map); - map.set(3, "hahaha"); - expect(() => roundtrip("map", map)).to.throw(/invalid type scSpecTypeBool specified for string value/i); - }); - it("vec", () => { - const vec = [1, 2, 3]; - roundtrip("vec", vec); + }); + describe("complex", () => { + it("struct", () => { + const complex = { + tag: "Struct", + values: [{ a: 0, b: true, c: "hello" }], + }; + roundtrip("complex", complex); }); it("tuple", () => { - const tuple = ["hello", 1]; - roundtrip("tuple", tuple); - }); - it("option", () => { - roundtrip("option", 1); - roundtrip("option", undefined); - }); - it("u256", () => { - roundtrip("u256", 1n); - expect(() => roundtrip("u256", -1n)).to.throw(/expected a positive value, got: -1/i); + const complex = { + tag: "Tuple", + values: [ + [ + { a: 0, b: true, c: "hello" }, + { tag: "First", values: undefined }, + ], + ], + }; + roundtrip("complex", complex); }); - it("i256", () => { - roundtrip("i256", -1n); + it("enum", () => { + const complex = { + tag: "Enum", + values: [{ tag: "First", values: undefined }], + }; + roundtrip("complex", complex); }); - it("string", () => { - roundtrip("string", "hello"); + it("asset", () => { + const complex = { tag: "Asset", values: [addr, 1n] }; + roundtrip("complex", complex); }); - it("tuple_strukt", () => { - const arg = [ - { a: 0, b: true, c: "hello" }, - { tag: "First", values: undefined }, - ]; - roundtrip("tuple_strukt", arg); + it("void", () => { + const complex = { tag: "Void", values: undefined }; + roundtrip("complex", complex); }); + }); + it("addresse", () => { + roundtrip("addresse", addr); + }); + it("bytes", () => { + const bytes = Buffer.from("hello"); + roundtrip("bytes", bytes); + }); + it("bytes_n", () => { + const bytes_n = Buffer.from("123456789"); // what's the correct way to construct bytes_n? + roundtrip("bytes_n", bytes_n); + }); + it("card", () => { + const card = 11; + roundtrip("card", card); + }); + it("boolean", () => { + roundtrip("boolean", true); + }); + it("not", () => { + roundtrip("boolean", false); + }); + it("i128", () => { + roundtrip("i128", -1n); + }); + it("u128", () => { + roundtrip("u128", 1n); + }); + it("map", () => { + const map = new Map(); + map.set(1, true); + map.set(2, false); + roundtrip("map", map); + map.set(3, "hahaha"); + expect(() => roundtrip("map", map)).to.throw( + /invalid type scSpecTypeBool specified for string value/i, + ); + }); + it("vec", () => { + const vec = [1, 2, 3]; + roundtrip("vec", vec); + }); + it("tuple", () => { + const tuple = ["hello", 1]; + roundtrip("tuple", tuple); + }); + it("option", () => { + roundtrip("option", 1); + roundtrip("option", undefined); + }); + it("u256", () => { + roundtrip("u256", 1n); + expect(() => roundtrip("u256", -1n)).to.throw( + /expected a positive value, got: -1/i, + ); + }); + it("i256", () => { + roundtrip("i256", -1n); + }); + it("string", () => { + roundtrip("string", "hello"); + }); + it("tuple_strukt", () => { + const arg = [ + { a: 0, b: true, c: "hello" }, + { tag: "First", values: undefined }, + ]; + roundtrip("tuple_strukt", arg); + }); }); describe("parsing and building ScVals", function () { - it("Can parse entries", function () { - let spec = new ContractSpec([GIGA_MAP, func]); - let fn = spec.findEntry("giga_map"); - let gigaMap = spec.findEntry("GigaMap"); - expect(gigaMap).deep.equal(GIGA_MAP); - expect(fn).deep.equal(func); - }); + it("Can parse entries", function () { + let spec = new ContractSpec([GIGA_MAP, func]); + let fn = spec.findEntry("giga_map"); + let gigaMap = spec.findEntry("GigaMap"); + expect(gigaMap).deep.equal(GIGA_MAP); + expect(fn).deep.equal(func); + }); }); -export const GIGA_MAP = xdr.ScSpecEntry.scSpecEntryUdtStructV0(new xdr.ScSpecUdtStructV0({ +export const GIGA_MAP = xdr.ScSpecEntry.scSpecEntryUdtStructV0( + new xdr.ScSpecUdtStructV0({ doc: "This is a kitchen sink of all the types", lib: "", name: "GigaMap", fields: [ - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "bool", - type: xdr.ScSpecTypeDef.scSpecTypeBool(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "i128", - type: xdr.ScSpecTypeDef.scSpecTypeI128(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "u128", - type: xdr.ScSpecTypeDef.scSpecTypeU128(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "i256", - type: xdr.ScSpecTypeDef.scSpecTypeI256(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "u256", - type: xdr.ScSpecTypeDef.scSpecTypeU256(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "i32", - type: xdr.ScSpecTypeDef.scSpecTypeI32(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "u32", - type: xdr.ScSpecTypeDef.scSpecTypeU32(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "i64", - type: xdr.ScSpecTypeDef.scSpecTypeI64(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "u64", - type: xdr.ScSpecTypeDef.scSpecTypeU64(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "symbol", - type: xdr.ScSpecTypeDef.scSpecTypeSymbol(), - }), - new xdr.ScSpecUdtStructFieldV0({ - doc: "", - name: "string", - type: xdr.ScSpecTypeDef.scSpecTypeString(), - }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "bool", + type: xdr.ScSpecTypeDef.scSpecTypeBool(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i128", + type: xdr.ScSpecTypeDef.scSpecTypeI128(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u128", + type: xdr.ScSpecTypeDef.scSpecTypeU128(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i256", + type: xdr.ScSpecTypeDef.scSpecTypeI256(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u256", + type: xdr.ScSpecTypeDef.scSpecTypeU256(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i32", + type: xdr.ScSpecTypeDef.scSpecTypeI32(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u32", + type: xdr.ScSpecTypeDef.scSpecTypeU32(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "i64", + type: xdr.ScSpecTypeDef.scSpecTypeI64(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "u64", + type: xdr.ScSpecTypeDef.scSpecTypeU64(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "symbol", + type: xdr.ScSpecTypeDef.scSpecTypeSymbol(), + }), + new xdr.ScSpecUdtStructFieldV0({ + doc: "", + name: "string", + type: xdr.ScSpecTypeDef.scSpecTypeString(), + }), ], -})); -const GIGA_MAP_TYPE = xdr.ScSpecTypeDef.scSpecTypeUdt(new xdr.ScSpecTypeUdt({ name: "GigaMap" })); -let func = xdr.ScSpecEntry.scSpecEntryFunctionV0(new xdr.ScSpecFunctionV0({ + }), +); +const GIGA_MAP_TYPE = xdr.ScSpecTypeDef.scSpecTypeUdt( + new xdr.ScSpecTypeUdt({ name: "GigaMap" }), +); +let func = xdr.ScSpecEntry.scSpecEntryFunctionV0( + new xdr.ScSpecFunctionV0({ doc: "Kitchen Sink", name: "giga_map", inputs: [ - new xdr.ScSpecFunctionInputV0({ - doc: "", - name: "giga_map", - type: GIGA_MAP_TYPE, - }), + new xdr.ScSpecFunctionInputV0({ + doc: "", + name: "giga_map", + type: GIGA_MAP_TYPE, + }), ], outputs: [GIGA_MAP_TYPE], -})); + }), +); diff --git a/test/unit/server/soroban/constructor_test.js b/test/unit/server/soroban/constructor_test.js index 697b8b5cb..fc4bbd532 100644 --- a/test/unit/server/soroban/constructor_test.js +++ b/test/unit/server/soroban/constructor_test.js @@ -1,9 +1,9 @@ const { SorobanServer } = StellarSdk; -describe('Server.constructor', function () { +describe("Server.constructor", function () { beforeEach(function () { this.server = new SorobanServer(serverUrl); - this.axiosMock = sinon.mock(AxiosClient); + this.axiosMock = sinon.mock(SorobanAxiosClient); }); afterEach(function () { @@ -11,17 +11,17 @@ describe('Server.constructor', function () { this.axiosMock.restore(); }); - let insecureServerUrl = serverUrl.replace('https://', 'http://'); + let insecureServerUrl = serverUrl.replace("https://", "http://"); - it('throws error for insecure server', function () { + it("throws error for insecure server", function () { expect(() => new SorobanServer(insecureServerUrl)).to.throw( - /Cannot connect to insecure Soroban RPC server/i + /Cannot connect to insecure Soroban RPC server/i, ); }); - it('allow insecure server when opts.allowHttp flag is set', function () { + it("allow insecure server when opts.allowHttp flag is set", function () { expect( - () => new SorobanServer(insecureServerUrl, { allowHttp: true }) + () => new SorobanServer(insecureServerUrl, { allowHttp: true }), ).to.not.throw(); }); }); diff --git a/test/unit/server/soroban/get_account_test.js b/test/unit/server/soroban/get_account_test.js index aac7845ab..3ebbb1917 100644 --- a/test/unit/server/soroban/get_account_test.js +++ b/test/unit/server/soroban/get_account_test.js @@ -1,11 +1,11 @@ const { SorobanServer } = StellarSdk; -describe('Server#getAccount', function () { +describe("Server#getAccount", function () { const { Account, StrKey, xdr } = StellarSdk; beforeEach(function () { this.server = new SorobanServer(serverUrl); - this.axiosMock = sinon.mock(AxiosClient); + this.axiosMock = sinon.mock(SorobanAxiosClient); }); afterEach(function () { @@ -13,27 +13,27 @@ describe('Server#getAccount', function () { this.axiosMock.restore(); }); - it('requests the correct method', function (done) { - const address = 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'; + it("requests the correct method", function (done) { + const address = "GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI"; const accountId = xdr.PublicKey.publicKeyTypeEd25519( - StrKey.decodeEd25519PublicKey(address) + StrKey.decodeEd25519PublicKey(address), ); this.axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'getLedgerEntries', + method: "getLedgerEntries", params: [ [ xdr.LedgerKey.account( new xdr.LedgerKeyAccount({ - accountId - }) - ).toXDR('base64') - ] - ] + accountId, + }), + ).toXDR("base64"), + ], + ], }) .returns( Promise.resolve({ @@ -41,15 +41,15 @@ describe('Server#getAccount', function () { result: { entries: [ { - xdr: 'AAAAAAAAAABzdv3ojkzWHMD7KUoXhrPx0GH18vHKV0ZfqpMiEblG1g3gtpoE608YAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAQAAAAAY9D8iA' - } - ] - } - } - }) + xdr: "AAAAAAAAAABzdv3ojkzWHMD7KUoXhrPx0GH18vHKV0ZfqpMiEblG1g3gtpoE608YAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAQAAAAAY9D8iA", + }, + ], + }, + }, + }), ); - const expected = new Account(address, '1'); + const expected = new Account(address, "1"); this.server .getAccount(address) .then(function (response) { @@ -59,48 +59,48 @@ describe('Server#getAccount', function () { .catch(done); }); - it('throws a useful error when the account is not found', function (done) { - const address = 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'; + it("throws a useful error when the account is not found", function (done) { + const address = "GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI"; const accountId = xdr.PublicKey.publicKeyTypeEd25519( - StrKey.decodeEd25519PublicKey(address) + StrKey.decodeEd25519PublicKey(address), ); this.axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'getLedgerEntries', + method: "getLedgerEntries", params: [ [ xdr.LedgerKey.account( new xdr.LedgerKeyAccount({ - accountId - }) - ).toXDR('base64') - ] - ] + accountId, + }), + ).toXDR("base64"), + ], + ], }) .returns( Promise.resolve({ data: { result: { - entries: null - } - } - }) + entries: null, + }, + }, + }), ); this.server .getAccount(address) .then(function (_) { - done(new Error('Expected error to be thrown')); + done(new Error("Expected error to be thrown")); }) .catch(function (err) { done( err.message === `Account not found: ${address}` ? null - : new Error(`Received unexpected error: ${err.message}`) + : new Error(`Received unexpected error: ${err.message}`), ); }); }); diff --git a/test/unit/server/soroban/get_contract_data_test.js b/test/unit/server/soroban/get_contract_data_test.js index 85ef5c011..e9d01fed8 100644 --- a/test/unit/server/soroban/get_contract_data_test.js +++ b/test/unit/server/soroban/get_contract_data_test.js @@ -1,9 +1,9 @@ const { SorobanServer, xdr } = StellarSdk; -describe('Server#getContractData', function () { +describe("Server#getContractData", function () { beforeEach(function () { this.server = new SorobanServer(serverUrl); - this.axiosMock = sinon.mock(AxiosClient); + this.axiosMock = sinon.mock(SorobanAxiosClient); }); afterEach(function () { @@ -11,23 +11,23 @@ describe('Server#getContractData', function () { this.axiosMock.restore(); }); - let address = 'CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5'; + let address = "CCJZ5DGASBWQXR5MPFCJXMBI333XE5U3FSJTNQU7RIKE3P5GN2K2WYD5"; let key = StellarSdk.xdr.ScVal.scvVec([ - StellarSdk.xdr.ScVal.scvSymbol('Admin') + StellarSdk.xdr.ScVal.scvSymbol("Admin"), ]); - it('key found', function (done) { + it("key found", function (done) { let result = { id: address, - sequence: '1' + sequence: "1", }; this.axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'getLedgerEntries', + method: "getLedgerEntries", params: [ [ xdr.LedgerKey.contractData( @@ -36,24 +36,24 @@ describe('Server#getContractData', function () { contract: new StellarSdk.Contract(address) .address() .toScAddress(), - durability: xdr.ContractDataDurability.persistent() - }) - ).toXDR('base64') - ] - ] + durability: xdr.ContractDataDurability.persistent(), + }), + ).toXDR("base64"), + ], + ], }) .returns( Promise.resolve({ data: { result: { - entries: [result] - } - } - }) + entries: [result], + }, + }, + }), ); this.server - .getContractData(address, key, 'persistent') + .getContractData(address, key, "persistent") .then(function (response) { expect(response).to.be.deep.equal(result); done(); @@ -63,13 +63,13 @@ describe('Server#getContractData', function () { }); }); - it('key not found', function (done) { + it("key not found", function (done) { this.axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'getLedgerEntries', + method: "getLedgerEntries", params: [ [ xdr.LedgerKey.contractData( @@ -78,32 +78,32 @@ describe('Server#getContractData', function () { contract: new StellarSdk.Contract(address) .address() .toScAddress(), - durability: xdr.ContractDataDurability.temporary() - }) - ).toXDR('base64') - ] - ] + durability: xdr.ContractDataDurability.temporary(), + }), + ).toXDR("base64"), + ], + ], }) .returns(Promise.resolve({ data: { result: { entries: [] } } })); this.server - .getContractData(address, key, 'temporary') + .getContractData(address, key, "temporary") .then(function (_response) { - done(new Error('Expected error')); + done(new Error("Expected error")); }) .catch(function (err) { done( err.code == 404 ? null - : new Error('Expected error code 404, got: ' + err.code) + : new Error("Expected error code 404, got: " + err.code), ); }); }); - it('fails on hex address (was deprecated now unsupported)', function (done) { - let hexAddress = '0'.repeat(63) + '1'; + it("fails on hex address (was deprecated now unsupported)", function (done) { + let hexAddress = "0".repeat(63) + "1"; this.server - .getContractData(hexAddress, key, 'persistent') + .getContractData(hexAddress, key, "persistent") .then((reply) => done(new Error(`should fail, got: ${reply}`))) .catch((error) => { expect(error).to.contain(/unsupported contract id/i); diff --git a/test/unit/server/soroban/get_events_test.js b/test/unit/server/soroban/get_events_test.js index 014f8185f..5713e2cfc 100644 --- a/test/unit/server/soroban/get_events_test.js +++ b/test/unit/server/soroban/get_events_test.js @@ -1,9 +1,9 @@ const { SorobanServer } = StellarSdk; -describe('Server#getEvents', function () { +describe("Server#getEvents", function () { beforeEach(function () { this.server = new SorobanServer(serverUrl); - this.axiosMock = sinon.mock(AxiosClient); + this.axiosMock = sinon.mock(SorobanAxiosClient); }); afterEach(function () { @@ -11,16 +11,16 @@ describe('Server#getEvents', function () { this.axiosMock.restore(); }); - it('requests the correct endpoint', function (done) { + it("requests the correct endpoint", function (done) { let result = { events: [] }; setupMock( this.axiosMock, { filters: [], pagination: {}, - startLedger: '1' + startLedger: "1", }, - result + result, ); this.server @@ -34,21 +34,21 @@ describe('Server#getEvents', function () { }); }); - it('can build wildcard filters', function (done) { - let result = filterEvents(getEventsResponseFixture, '*/*'); + it("can build wildcard filters", function (done) { + let result = filterEvents(getEventsResponseFixture, "*/*"); setupMock( this.axiosMock, { - startLedger: '1', + startLedger: "1", filters: [ { - topics: [['*', '*']] - } + topics: [["*", "*"]], + }, ], - pagination: {} + pagination: {}, }, - result + result, ); this.server @@ -56,9 +56,9 @@ describe('Server#getEvents', function () { startLedger: 1, filters: [ { - topics: [['*', '*']] - } - ] + topics: [["*", "*"]], + }, + ], }) .then(function (response) { expect(response).to.be.deep.equal(result); @@ -67,24 +67,24 @@ describe('Server#getEvents', function () { .catch(done); }); - it('can build matching filters', function (done) { + it("can build matching filters", function (done) { let result = filterEvents( getEventsResponseFixture, - 'AAAABQAAAAh0cmFuc2Zlcg==/AAAAAQB6Mcc=' + "AAAABQAAAAh0cmFuc2Zlcg==/AAAAAQB6Mcc=", ); setupMock( this.axiosMock, { - startLedger: '1', + startLedger: "1", filters: [ { - topics: [['AAAABQAAAAh0cmFuc2Zlcg==', 'AAAAAQB6Mcc=']] - } + topics: [["AAAABQAAAAh0cmFuc2Zlcg==", "AAAAAQB6Mcc="]], + }, ], - pagination: {} + pagination: {}, }, - result + result, ); this.server @@ -92,9 +92,9 @@ describe('Server#getEvents', function () { startLedger: 1, filters: [ { - topics: [['AAAABQAAAAh0cmFuc2Zlcg==', 'AAAAAQB6Mcc=']] - } - ] + topics: [["AAAABQAAAAh0cmFuc2Zlcg==", "AAAAAQB6Mcc="]], + }, + ], }) .then(function (response) { expect(response).to.be.deep.equal(result); @@ -103,24 +103,24 @@ describe('Server#getEvents', function () { .catch(done); }); - it('can build mixed filters', function (done) { + it("can build mixed filters", function (done) { let result = filterEventsByLedger( - filterEvents(getEventsResponseFixture, 'AAAABQAAAAh0cmFuc2Zlcg==/*'), - 1 + filterEvents(getEventsResponseFixture, "AAAABQAAAAh0cmFuc2Zlcg==/*"), + 1, ); setupMock( this.axiosMock, { - startLedger: '1', + startLedger: "1", filters: [ { - topics: [['AAAABQAAAAh0cmFuc2Zlcg==', '*']] - } + topics: [["AAAABQAAAAh0cmFuc2Zlcg==", "*"]], + }, ], - pagination: {} + pagination: {}, }, - result + result, ); this.server @@ -128,9 +128,9 @@ describe('Server#getEvents', function () { startLedger: 1, filters: [ { - topics: [['AAAABQAAAAh0cmFuc2Zlcg==', '*']] - } - ] + topics: [["AAAABQAAAAh0cmFuc2Zlcg==", "*"]], + }, + ], }) .then(function (response) { expect(response).to.be.deep.equal(result); @@ -139,10 +139,10 @@ describe('Server#getEvents', function () { .catch(done); }); - it('can paginate', function (done) { + it("can paginate", function (done) { let result = filterEventsByLedger( - filterEvents(getEventsResponseFixture, '*/*'), - 1 + filterEvents(getEventsResponseFixture, "*/*"), + 1, ); setupMock( @@ -150,26 +150,26 @@ describe('Server#getEvents', function () { { filters: [ { - topics: [['*', '*']] - } + topics: [["*", "*"]], + }, ], pagination: { limit: 10, - cursor: '0164090849041387521-0000000000' - } + cursor: "0164090849041387521-0000000000", + }, }, - result + result, ); this.server .getEvents({ filters: [ { - topics: [['*', '*']] - } + topics: [["*", "*"]], + }, ], - cursor: '0164090849041387521-0000000000', - limit: 10 + cursor: "0164090849041387521-0000000000", + limit: 10, }) .then(function (response) { expect(response).to.be.deep.equal(result); @@ -183,7 +183,7 @@ function filterEvents(events, filter) { return events.filter( (e, i) => e.topic.length == filter.length && - e.topic.every((s, j) => s === filter[j] || s === '*') + e.topic.every((s, j) => s === filter[j] || s === "*"), ); } @@ -195,71 +195,71 @@ function filterEventsByLedger(events, start) { function setupMock(axiosMock, params, result) { axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'getEvents', - params: params + method: "getEvents", + params: params, }) .returns(Promise.resolve({ data: { result } })); } let getEventsResponseFixture = [ { - type: 'system', - ledger: '1', - ledgerClosedAt: '2022-11-16T16:10:41Z', + type: "system", + ledger: "1", + ledgerClosedAt: "2022-11-16T16:10:41Z", contractId: - 'e3e82a76cc316f6289fd1ffbdf315da0f2c6be9582b84b9983a402f02ea0fff7', - id: '0164090849041387521-0000000003', - pagingToken: '164090849041387521-3', - topic: ['AAAABQAAAAh0cmFuc2Zlcg==', 'AAAAAQB6Mcc='], + "e3e82a76cc316f6289fd1ffbdf315da0f2c6be9582b84b9983a402f02ea0fff7", + id: "0164090849041387521-0000000003", + pagingToken: "164090849041387521-3", + topic: ["AAAABQAAAAh0cmFuc2Zlcg==", "AAAAAQB6Mcc="], inSuccessfulContractCall: true, value: { - xdr: 'AAAABQAAAApHaWJNb255UGxzAAA=' - } + xdr: "AAAABQAAAApHaWJNb255UGxzAAA=", + }, }, { - type: 'contract', - ledger: '2', - ledgerClosedAt: '2022-11-16T16:10:41Z', + type: "contract", + ledger: "2", + ledgerClosedAt: "2022-11-16T16:10:41Z", contractId: - 'e3e82a76cc316f6289fd1ffbdf315da0f2c6be9582b84b9983a402f02ea0fff7', - id: '0164090849041387521-0000000003', - pagingToken: '164090849041387521-3', - topic: ['AAAAAQB6Mcc=', 'AAAABQAAAAh0cmFuc2Zlcg=='], + "e3e82a76cc316f6289fd1ffbdf315da0f2c6be9582b84b9983a402f02ea0fff7", + id: "0164090849041387521-0000000003", + pagingToken: "164090849041387521-3", + topic: ["AAAAAQB6Mcc=", "AAAABQAAAAh0cmFuc2Zlcg=="], inSuccessfulContractCall: true, value: { - xdr: 'AAAABQAAAApHaWJNb255UGxzAAA=' - } + xdr: "AAAABQAAAApHaWJNb255UGxzAAA=", + }, }, { - type: 'diagnostic', - ledger: '2', - ledgerClosedAt: '2022-11-16T16:10:41Z', + type: "diagnostic", + ledger: "2", + ledgerClosedAt: "2022-11-16T16:10:41Z", contractId: - 'a3e82a76cc316f6289fd1ffbdf315da0f2c6be9582b84b9983a402f02ea0fff7', - id: '0164090849041387521-0000000003', - pagingToken: '164090849041387521-3', + "a3e82a76cc316f6289fd1ffbdf315da0f2c6be9582b84b9983a402f02ea0fff7", + id: "0164090849041387521-0000000003", + pagingToken: "164090849041387521-3", inSuccessfulContractCall: true, - topic: ['AAAAAQB6Mcc='], + topic: ["AAAAAQB6Mcc="], value: { - xdr: 'AAAABQAAAApHaWJNb255UGxzAAA=' - } + xdr: "AAAABQAAAApHaWJNb255UGxzAAA=", + }, }, { - type: 'contract', - ledger: '3', - ledgerClosedAt: '2022-12-14T01:01:20Z', + type: "contract", + ledger: "3", + ledgerClosedAt: "2022-12-14T01:01:20Z", contractId: - '6ebe0114ae15f72f187f05d06dcb66b22bd97218755c9b4646b034ab961fc1d5', - id: '0000000171798695936-0000000001', - pagingToken: '0000000171798695936-0000000001', + "6ebe0114ae15f72f187f05d06dcb66b22bd97218755c9b4646b034ab961fc1d5", + id: "0000000171798695936-0000000001", + pagingToken: "0000000171798695936-0000000001", inSuccessfulContractCall: true, - topic: ['AAAABQAAAAdDT1VOVEVSAA==', 'AAAABQAAAAlpbmNyZW1lbnQAAAA='], + topic: ["AAAABQAAAAdDT1VOVEVSAA==", "AAAABQAAAAlpbmNyZW1lbnQAAAA="], value: { - xdr: 'AAAAAQAAAAE=' - } - } + xdr: "AAAAAQAAAAE=", + }, + }, ]; diff --git a/test/unit/server/soroban/get_health_test.js b/test/unit/server/soroban/get_health_test.js index 872db12f0..7ce66ae38 100644 --- a/test/unit/server/soroban/get_health_test.js +++ b/test/unit/server/soroban/get_health_test.js @@ -1,9 +1,9 @@ const { SorobanServer } = StellarSdk; -describe('Server#getHealth', function () { +describe("Server#getHealth", function () { beforeEach(function () { this.server = new SorobanServer(serverUrl); - this.axiosMock = sinon.mock(AxiosClient); + this.axiosMock = sinon.mock(SorobanAxiosClient); }); afterEach(function () { @@ -11,18 +11,18 @@ describe('Server#getHealth', function () { this.axiosMock.restore(); }); - it('requests the correct endpoint', function (done) { + it("requests the correct endpoint", function (done) { let result = { - status: 'healthy' + status: "healthy", }; this.axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'getHealth', - params: null + method: "getHealth", + params: null, }) .returns(Promise.resolve({ data: { result } })); diff --git a/test/unit/server/soroban/get_latest_ledger_test.js b/test/unit/server/soroban/get_latest_ledger_test.js index 1fa1a29f0..d772b2ac0 100644 --- a/test/unit/server/soroban/get_latest_ledger_test.js +++ b/test/unit/server/soroban/get_latest_ledger_test.js @@ -1,9 +1,9 @@ const { SorobanServer } = StellarSdk; -describe('Server#getLatestLedger', function () { +describe("Server#getLatestLedger", function () { beforeEach(function () { this.server = new SorobanServer(serverUrl); - this.axiosMock = sinon.mock(AxiosClient); + this.axiosMock = sinon.mock(SorobanAxiosClient); }); afterEach(function () { @@ -11,19 +11,19 @@ describe('Server#getLatestLedger', function () { this.axiosMock.restore(); }); - it('requests the correct method', function (done) { + it("requests the correct method", function (done) { const result = { - id: 'hashed_id', + id: "hashed_id", sequence: 123, - protocolVersion: 20 + protocolVersion: 20, }; this.axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'getLatestLedger', - params: null + method: "getLatestLedger", + params: null, }) .returns(Promise.resolve({ data: { result } })); diff --git a/test/unit/server/soroban/get_network_test.js b/test/unit/server/soroban/get_network_test.js index 3521ff862..44a4d9391 100644 --- a/test/unit/server/soroban/get_network_test.js +++ b/test/unit/server/soroban/get_network_test.js @@ -1,9 +1,9 @@ const { SorobanServer } = StellarSdk; -describe('Server#getNetwork', function () { +describe("Server#getNetwork", function () { beforeEach(function () { this.server = new SorobanServer(serverUrl); - this.axiosMock = sinon.mock(AxiosClient); + this.axiosMock = sinon.mock(SorobanAxiosClient); }); afterEach(function () { @@ -11,19 +11,19 @@ describe('Server#getNetwork', function () { this.axiosMock.restore(); }); - it('requests the correct method', function (done) { + it("requests the correct method", function (done) { const result = { - friendbotUrl: 'https://friendbot.stellar.org', - passphrase: 'Soroban Testnet ; December 2018', - protocolVersion: 20 + friendbotUrl: "https://friendbot.stellar.org", + passphrase: "Soroban Testnet ; December 2018", + protocolVersion: 20, }; this.axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'getNetwork', - params: null + method: "getNetwork", + params: null, }) .returns(Promise.resolve({ data: { result } })); diff --git a/test/unit/server/soroban/get_transaction_test.js b/test/unit/server/soroban/get_transaction_test.js index 1483e17d8..33a994d0c 100644 --- a/test/unit/server/soroban/get_transaction_test.js +++ b/test/unit/server/soroban/get_transaction_test.js @@ -5,47 +5,44 @@ const { Server, TransactionBuilder, nativeToScVal, - XdrLargeInt + XdrLargeInt, } = StellarSdk; -describe('Server#getTransaction', function () { +describe("Server#getTransaction", function () { let keypair = Keypair.random(); - let account = new StellarSdk.Account( - keypair.publicKey(), - '56199647068161' - ); + let account = new StellarSdk.Account(keypair.publicKey(), "56199647068161"); beforeEach(function () { this.server = new Server(serverUrl); - this.axiosMock = sinon.mock(AxiosClient); + this.axiosMock = sinon.mock(SorobanAxiosClient); let transaction = new 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(); transaction.sign(keypair); this.transaction = transaction; - this.hash = this.transaction.hash().toString('hex'); - this.blob = transaction.toEnvelope().toXDR().toString('base64'); + this.hash = this.transaction.hash().toString("hex"); + this.blob = transaction.toEnvelope().toXDR().toString("base64"); this.prepareAxios = (result) => { this.axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'getTransaction', - params: [this.hash] + method: "getTransaction", + params: [this.hash], }) .returns(Promise.resolve({ data: { id: 1, result } })); }; @@ -56,8 +53,8 @@ describe('Server#getTransaction', function () { this.axiosMock.restore(); }); - it('transaction not found', function (done) { - const result = makeTxResult('NOT_FOUND'); + it("transaction not found", function (done) { + const result = makeTxResult("NOT_FOUND"); this.prepareAxios(result); this.server @@ -69,17 +66,17 @@ describe('Server#getTransaction', function () { .catch((err) => done(err)); }); - it('transaction success', function (done) { - const result = makeTxResult('SUCCESS', true); + it("transaction success", function (done) { + const result = makeTxResult("SUCCESS", true); this.prepareAxios(result); let expected = JSON.parse(JSON.stringify(result)); [ - ['envelopeXdr', xdr.TransactionEnvelope], - ['resultXdr', xdr.TransactionResult], - ['resultMetaXdr', xdr.TransactionMeta] + ["envelopeXdr", xdr.TransactionEnvelope], + ["resultXdr", xdr.TransactionResult], + ["resultMetaXdr", xdr.TransactionMeta], ].forEach(([field, struct]) => { - expected[field] = struct.fromXDR(result[field], 'base64'); + expected[field] = struct.fromXDR(result[field], "base64"); }); expected.returnValue = expected.resultMetaXdr .v3() @@ -91,14 +88,14 @@ describe('Server#getTransaction', function () { .then((resp) => { expect(Object.keys(resp)).to.eql(Object.keys(expected)); expect(resp).to.eql(expected); - expect(resp.returnValue).to.eql(new XdrLargeInt('u64', 1234).toScVal()); + expect(resp.returnValue).to.eql(new XdrLargeInt("u64", 1234).toScVal()); done(); }) .catch((err) => done(err)); }); - xit('non-Soroban transaction success', function (done) { - const result = makeTxResult('SUCCESS', false); + xit("non-Soroban transaction success", function (done) { + const result = makeTxResult("SUCCESS", false); this.prepareAxios(result); this.server @@ -110,8 +107,8 @@ describe('Server#getTransaction', function () { .catch((err) => done(err)); }); - xit('transaction pending', function (done) {}); - xit('transaction error', function (done) {}); + xit("transaction pending", function (done) {}); + xit("transaction error", function (done) {}); }); function makeTxResult(status, addSoroban = true) { @@ -126,9 +123,9 @@ function makeTxResult(status, addSoroban = true) { ext: new xdr.ExtensionPoint(0), events: [], diagnosticEvents: [], - returnValue: nativeToScVal(1234) - }) - }) + returnValue: nativeToScVal(1234), + }), + }), ); // only injected in the success case @@ -141,16 +138,16 @@ function makeTxResult(status, addSoroban = true) { applicationOrder: 2, feeBump: false, envelopeXdr: - 'AAAAAgAAAAAT/LQZdYz0FcQ4Xwyg8IM17rkUx3pPCCWLu+SowQ/T+gBLB24poiQa9iwAngAAAAEAAAAAAAAAAAAAAABkwdeeAAAAAAAAAAEAAAABAAAAAC/9E8hDhnktyufVBS5tqA734Yz5XrLX2XNgBgH/YEkiAAAADQAAAAAAAAAAAAA1/gAAAAAv/RPIQ4Z5Lcrn1QUubagO9+GM+V6y19lzYAYB/2BJIgAAAAAAAAAAAAA1/gAAAAQAAAACU0lMVkVSAAAAAAAAAAAAAFDutWuu6S6UPJBrotNSgfmXa27M++63OT7TYn1qjgy+AAAAAVNHWAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AAAACUEFMTEFESVVNAAAAAAAAAFDutWuu6S6UPJBrotNSgfmXa27M++63OT7TYn1qjgy+AAAAAlNJTFZFUgAAAAAAAAAAAABQ7rVrrukulDyQa6LTUoH5l2tuzPvutzk+02J9ao4MvgAAAAAAAAACwQ/T+gAAAEA+ztVEKWlqHXNnqy6FXJeHr7TltHzZE6YZm5yZfzPIfLaqpp+5cyKotVkj3d89uZCQNsKsZI48uoyERLne+VwL/2BJIgAAAEA7323gPSaezVSa7Vi0J4PqsnklDH1oHLqNBLwi5EWo5W7ohLGObRVQZ0K0+ufnm4hcm9J4Cuj64gEtpjq5j5cM', + "AAAAAgAAAAAT/LQZdYz0FcQ4Xwyg8IM17rkUx3pPCCWLu+SowQ/T+gBLB24poiQa9iwAngAAAAEAAAAAAAAAAAAAAABkwdeeAAAAAAAAAAEAAAABAAAAAC/9E8hDhnktyufVBS5tqA734Yz5XrLX2XNgBgH/YEkiAAAADQAAAAAAAAAAAAA1/gAAAAAv/RPIQ4Z5Lcrn1QUubagO9+GM+V6y19lzYAYB/2BJIgAAAAAAAAAAAAA1/gAAAAQAAAACU0lMVkVSAAAAAAAAAAAAAFDutWuu6S6UPJBrotNSgfmXa27M++63OT7TYn1qjgy+AAAAAVNHWAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AAAACUEFMTEFESVVNAAAAAAAAAFDutWuu6S6UPJBrotNSgfmXa27M++63OT7TYn1qjgy+AAAAAlNJTFZFUgAAAAAAAAAAAABQ7rVrrukulDyQa6LTUoH5l2tuzPvutzk+02J9ao4MvgAAAAAAAAACwQ/T+gAAAEA+ztVEKWlqHXNnqy6FXJeHr7TltHzZE6YZm5yZfzPIfLaqpp+5cyKotVkj3d89uZCQNsKsZI48uoyERLne+VwL/2BJIgAAAEA7323gPSaezVSa7Vi0J4PqsnklDH1oHLqNBLwi5EWo5W7ohLGObRVQZ0K0+ufnm4hcm9J4Cuj64gEtpjq5j5cM", resultXdr: - 'AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAANAAAAAAAAAAUAAAACZ4W6fmN63uhVqYRcHET+D2NEtJvhCIYflFh9GqtY+AwAAAACU0lMVkVSAAAAAAAAAAAAAFDutWuu6S6UPJBrotNSgfmXa27M++63OT7TYn1qjgy+AAAYW0toL2gAAAAAAAAAAAAANf4AAAACcgyAkXD5kObNTeRYciLh7R6ES/zzKp0n+cIK3Y6TjBkAAAABU0dYAAAAAABQ7rVrrukulDyQa6LTUoH5l2tuzPvutzk+02J9ao4MvgAAGlGnIJrXAAAAAlNJTFZFUgAAAAAAAAAAAABQ7rVrrukulDyQa6LTUoH5l2tuzPvutzk+02J9ao4MvgAAGFtLaC9oAAAAApmc7UgUBInrDvij8HMSridx2n1w3I8TVEn4sLr1LSpmAAAAAlBBTExBRElVTQAAAAAAAABQ7rVrrukulDyQa6LTUoH5l2tuzPvutzk+02J9ao4MvgAAIUz88EqYAAAAAVNHWAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AABpRpyCa1wAAAAKYUsaaCZ233xB1p+lG7YksShJWfrjsmItbokiR3ifa0gAAAAJTSUxWRVIAAAAAAAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AABv52PPa5wAAAAJQQUxMQURJVU0AAAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AACFM/PBKmAAAAAJnhbp+Y3re6FWphFwcRP4PY0S0m+EIhh+UWH0aq1j4DAAAAAAAAAAAAAA9pAAAAAJTSUxWRVIAAAAAAAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AABv52PPa5wAAAAAv/RPIQ4Z5Lcrn1QUubagO9+GM+V6y19lzYAYB/2BJIgAAAAAAAAAAAAA9pAAAAAA=', - resultMetaXdr: metaV3.toXDR('base64') + "AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAANAAAAAAAAAAUAAAACZ4W6fmN63uhVqYRcHET+D2NEtJvhCIYflFh9GqtY+AwAAAACU0lMVkVSAAAAAAAAAAAAAFDutWuu6S6UPJBrotNSgfmXa27M++63OT7TYn1qjgy+AAAYW0toL2gAAAAAAAAAAAAANf4AAAACcgyAkXD5kObNTeRYciLh7R6ES/zzKp0n+cIK3Y6TjBkAAAABU0dYAAAAAABQ7rVrrukulDyQa6LTUoH5l2tuzPvutzk+02J9ao4MvgAAGlGnIJrXAAAAAlNJTFZFUgAAAAAAAAAAAABQ7rVrrukulDyQa6LTUoH5l2tuzPvutzk+02J9ao4MvgAAGFtLaC9oAAAAApmc7UgUBInrDvij8HMSridx2n1w3I8TVEn4sLr1LSpmAAAAAlBBTExBRElVTQAAAAAAAABQ7rVrrukulDyQa6LTUoH5l2tuzPvutzk+02J9ao4MvgAAIUz88EqYAAAAAVNHWAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AABpRpyCa1wAAAAKYUsaaCZ233xB1p+lG7YksShJWfrjsmItbokiR3ifa0gAAAAJTSUxWRVIAAAAAAAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AABv52PPa5wAAAAJQQUxMQURJVU0AAAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AACFM/PBKmAAAAAJnhbp+Y3re6FWphFwcRP4PY0S0m+EIhh+UWH0aq1j4DAAAAAAAAAAAAAA9pAAAAAJTSUxWRVIAAAAAAAAAAAAAUO61a67pLpQ8kGui01KB+Zdrbsz77rc5PtNifWqODL4AABv52PPa5wAAAAAv/RPIQ4Z5Lcrn1QUubagO9+GM+V6y19lzYAYB/2BJIgAAAAAAAAAAAAA9pAAAAAA=", + resultMetaXdr: metaV3.toXDR("base64"), }; if (!addSoroban) { // replace the V3 Soroban meta with a "classic" V2 version successInfo.resultMetaXdr = - 'AAAAAgAAAAIAAAADAtL5awAAAAAAAAAAS0CFMhOtWUKJWerx66zxkxORaiH6/3RUq7L8zspD5RoAAAAAAcm9QAKVkpMAAHpMAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAC0vi5AAAAAGTB02oAAAAAAAAAAQLS+WsAAAAAAAAAAEtAhTITrVlCiVnq8eus8ZMTkWoh+v90VKuy/M7KQ+UaAAAAAAHJvUAClZKTAAB6TQAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAtL5awAAAABkwdd1AAAAAAAAAAEAAAAGAAAAAwLS+VQAAAACAAAAAG4cwu71zHNXx3jHCzRGOIthcnfwRgfN2f/AoHFLLMclAAAAAEySDkgAAAAAAAAAAkJVU0lORVNTAAAAAAAAAAC3JfDeo9vreItKNPoe74EkFIqWybeUQNFvLvURhHtskAAAAAAeQtHTL5f6TAAAXH0AAAAAAAAAAAAAAAAAAAABAtL5awAAAAIAAAAAbhzC7vXMc1fHeMcLNEY4i2Fyd/BGB83Z/8CgcUssxyUAAAAATJIOSAAAAAAAAAACQlVTSU5FU1MAAAAAAAAAALcl8N6j2+t4i0o0+h7vgSQUipbJt5RA0W8u9RGEe2yQAAAAAB5C0dNHf4CAAACLCQAAAAAAAAAAAAAAAAAAAAMC0vlUAAAAAQAAAABuHMLu9cxzV8d4xws0RjiLYXJ38EYHzdn/wKBxSyzHJQAAAAJCVVNJTkVTUwAAAAAAAAAAtyXw3qPb63iLSjT6Hu+BJBSKlsm3lEDRby71EYR7bJAAAAAAAABAL3//////////AAAAAQAAAAEAE3H3TnhnuQAAAAAAAAAAAAAAAAAAAAAAAAABAtL5awAAAAEAAAAAbhzC7vXMc1fHeMcLNEY4i2Fyd/BGB83Z/8CgcUssxyUAAAACQlVTSU5FU1MAAAAAAAAAALcl8N6j2+t4i0o0+h7vgSQUipbJt5RA0W8u9RGEe2yQAAAAAAAAQC9//////////wAAAAEAAAABABNx9J6Z4RkAAAAAAAAAAAAAAAAAAAAAAAAAAwLS+WsAAAAAAAAAAG4cwu71zHNXx3jHCzRGOIthcnfwRgfN2f/AoHFLLMclAAAAH37+zXQCXdRTAAASZAAAApIAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAABbBXKIigAAABhZWyiOAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAtL0awAAAABkwbqrAAAAAAAAAAEC0vlrAAAAAAAAAABuHMLu9cxzV8d4xws0RjiLYXJ38EYHzdn/wKBxSyzHJQAAAB9+/s10Al3UUwAAEmQAAAKSAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAWwVyiIoAAAAYWVsojgAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAALS9GsAAAAAZMG6qwAAAAAAAAAA'; + "AAAAAgAAAAIAAAADAtL5awAAAAAAAAAAS0CFMhOtWUKJWerx66zxkxORaiH6/3RUq7L8zspD5RoAAAAAAcm9QAKVkpMAAHpMAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAwAAAAAC0vi5AAAAAGTB02oAAAAAAAAAAQLS+WsAAAAAAAAAAEtAhTITrVlCiVnq8eus8ZMTkWoh+v90VKuy/M7KQ+UaAAAAAAHJvUAClZKTAAB6TQAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAtL5awAAAABkwdd1AAAAAAAAAAEAAAAGAAAAAwLS+VQAAAACAAAAAG4cwu71zHNXx3jHCzRGOIthcnfwRgfN2f/AoHFLLMclAAAAAEySDkgAAAAAAAAAAkJVU0lORVNTAAAAAAAAAAC3JfDeo9vreItKNPoe74EkFIqWybeUQNFvLvURhHtskAAAAAAeQtHTL5f6TAAAXH0AAAAAAAAAAAAAAAAAAAABAtL5awAAAAIAAAAAbhzC7vXMc1fHeMcLNEY4i2Fyd/BGB83Z/8CgcUssxyUAAAAATJIOSAAAAAAAAAACQlVTSU5FU1MAAAAAAAAAALcl8N6j2+t4i0o0+h7vgSQUipbJt5RA0W8u9RGEe2yQAAAAAB5C0dNHf4CAAACLCQAAAAAAAAAAAAAAAAAAAAMC0vlUAAAAAQAAAABuHMLu9cxzV8d4xws0RjiLYXJ38EYHzdn/wKBxSyzHJQAAAAJCVVNJTkVTUwAAAAAAAAAAtyXw3qPb63iLSjT6Hu+BJBSKlsm3lEDRby71EYR7bJAAAAAAAABAL3//////////AAAAAQAAAAEAE3H3TnhnuQAAAAAAAAAAAAAAAAAAAAAAAAABAtL5awAAAAEAAAAAbhzC7vXMc1fHeMcLNEY4i2Fyd/BGB83Z/8CgcUssxyUAAAACQlVTSU5FU1MAAAAAAAAAALcl8N6j2+t4i0o0+h7vgSQUipbJt5RA0W8u9RGEe2yQAAAAAAAAQC9//////////wAAAAEAAAABABNx9J6Z4RkAAAAAAAAAAAAAAAAAAAAAAAAAAwLS+WsAAAAAAAAAAG4cwu71zHNXx3jHCzRGOIthcnfwRgfN2f/AoHFLLMclAAAAH37+zXQCXdRTAAASZAAAApIAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAEAAABbBXKIigAAABhZWyiOAAAAAgAAAAAAAAAAAAAAAAAAAAMAAAAAAtL0awAAAABkwbqrAAAAAAAAAAEC0vlrAAAAAAAAAABuHMLu9cxzV8d4xws0RjiLYXJ38EYHzdn/wKBxSyzHJQAAAB9+/s10Al3UUwAAEmQAAAKSAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAABAAAAWwVyiIoAAAAYWVsojgAAAAIAAAAAAAAAAAAAAAAAAAADAAAAAALS9GsAAAAAZMG6qwAAAAAAAAAA"; } return { @@ -159,6 +156,6 @@ function makeTxResult(status, addSoroban = true) { latestLedgerCloseTime: 12345, oldestLedger: 50, oldestLedgerCloseTime: 500, - ...(status === 'SUCCESS' && successInfo) + ...(status === "SUCCESS" && successInfo), }; } diff --git a/test/unit/server/soroban/request_airdrop_test.js b/test/unit/server/soroban/request_airdrop_test.js index 67366a1d5..64006b9c9 100644 --- a/test/unit/server/soroban/request_airdrop_test.js +++ b/test/unit/server/soroban/request_airdrop_test.js @@ -1,25 +1,25 @@ const { SorobanServer } = StellarSdk; -describe('Server#requestAirdrop', function () { +describe("Server#requestAirdrop", function () { const { Account, StrKey, xdr } = StellarSdk; function accountLedgerEntryData(accountId, sequence) { return new xdr.LedgerEntryData.account( new xdr.AccountEntry({ accountId: xdr.AccountId.publicKeyTypeEd25519( - StrKey.decodeEd25519PublicKey(accountId) + StrKey.decodeEd25519PublicKey(accountId), ), - balance: xdr.Int64.fromString('1'), + balance: xdr.Int64.fromString("1"), seqNum: xdr.SequenceNumber.fromString(sequence), numSubEntries: 0, inflationDest: null, flags: 0, - homeDomain: '', + homeDomain: "", // Taken from a real response. idk. - thresholds: Buffer.from('AQAAAA==', 'base64'), + thresholds: Buffer.from("AQAAAA==", "base64"), signers: [], - ext: new xdr.AccountEntryExt(0) - }) + ext: new xdr.AccountEntryExt(0), + }), ); } @@ -32,18 +32,18 @@ describe('Server#requestAirdrop', function () { new xdr.LedgerEntry({ lastModifiedLedgerSeq: 0, data: accountLedgerEntryData(accountId, sequence), - ext: new xdr.LedgerEntryExt(0) - }) - ) - ] - }) + ext: new xdr.LedgerEntryExt(0), + }), + ), + ], + }), ]); return meta; } beforeEach(function () { this.server = new SorobanServer(serverUrl); - this.axiosMock = sinon.mock(AxiosClient); + this.axiosMock = sinon.mock(SorobanAxiosClient); }); afterEach(function () { @@ -54,38 +54,38 @@ describe('Server#requestAirdrop', function () { function mockGetNetwork(friendbotUrl) { const result = { friendbotUrl, - passphrase: 'Soroban Testnet ; December 2018', - protocolVersion: 20 + passphrase: "Soroban Testnet ; December 2018", + protocolVersion: 20, }; this.axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'getNetwork', - params: null + method: "getNetwork", + params: null, }) .returns(Promise.resolve({ data: { result } })); } - it('returns true when the account is created', function (done) { - const friendbotUrl = 'https://friendbot.stellar.org'; + it("returns true when the account is created", function (done) { + const friendbotUrl = "https://friendbot.stellar.org"; const accountId = - 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'; + "GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI"; mockGetNetwork.call(this, friendbotUrl); - const result_meta_xdr = transactionMetaFor(accountId, '1234').toXDR( - 'base64' + const result_meta_xdr = transactionMetaFor(accountId, "1234").toXDR( + "base64", ); this.axiosMock - .expects('post') + .expects("post") .withArgs(`${friendbotUrl}?addr=${accountId}`) .returns(Promise.resolve({ data: { result_meta_xdr } })); this.server .requestAirdrop(accountId) .then(function (response) { - expect(response).to.be.deep.equal(new Account(accountId, '1234')); + expect(response).to.be.deep.equal(new Account(accountId, "1234")); done(); }) .catch(function (err) { @@ -93,42 +93,42 @@ describe('Server#requestAirdrop', function () { }); }); - it('returns false if the account already exists', function (done) { - const friendbotUrl = 'https://friendbot.stellar.org'; + it("returns false if the account already exists", function (done) { + const friendbotUrl = "https://friendbot.stellar.org"; const accountId = - 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'; + "GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI"; mockGetNetwork.call(this, friendbotUrl); this.axiosMock - .expects('post') + .expects("post") .withArgs(`${friendbotUrl}?addr=${accountId}`) .returns( Promise.reject({ response: { status: 400, detail: - 'createAccountAlreadyExist (AAAAAAAAAGT/////AAAAAQAAAAAAAAAA/////AAAAAA=)' - } - }) + "createAccountAlreadyExist (AAAAAAAAAGT/////AAAAAQAAAAAAAAAA/////AAAAAA=)", + }, + }), ); this.axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'getLedgerEntries', + method: "getLedgerEntries", params: [ [ xdr.LedgerKey.account( new xdr.LedgerKeyAccount({ accountId: xdr.PublicKey.publicKeyTypeEd25519( - StrKey.decodeEd25519PublicKey(accountId) - ) - }) - ).toXDR('base64') - ] - ] + StrKey.decodeEd25519PublicKey(accountId), + ), + }), + ).toXDR("base64"), + ], + ], }) .returns( Promise.resolve({ @@ -136,18 +136,20 @@ describe('Server#requestAirdrop', function () { result: { entries: [ { - xdr: accountLedgerEntryData(accountId, '1234').toXDR('base64') - } - ] - } - } - }) + xdr: accountLedgerEntryData(accountId, "1234").toXDR( + "base64", + ), + }, + ], + }, + }, + }), ); this.server .requestAirdrop(accountId) .then(function (response) { - expect(response).to.be.deep.equal(new Account(accountId, '1234')); + expect(response).to.be.deep.equal(new Account(accountId, "1234")); done(); }) .catch(function (err) { @@ -155,23 +157,23 @@ describe('Server#requestAirdrop', function () { }); }); - it('uses custom friendbotUrl if passed', function (done) { - const friendbotUrl = 'https://custom-friendbot.stellar.org'; + it("uses custom friendbotUrl if passed", function (done) { + const friendbotUrl = "https://custom-friendbot.stellar.org"; const accountId = - 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'; + "GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI"; - const result_meta_xdr = transactionMetaFor(accountId, '1234').toXDR( - 'base64' + const result_meta_xdr = transactionMetaFor(accountId, "1234").toXDR( + "base64", ); this.axiosMock - .expects('post') + .expects("post") .withArgs(`${friendbotUrl}?addr=${accountId}`) .returns(Promise.resolve({ data: { result_meta_xdr } })); this.server .requestAirdrop(accountId, friendbotUrl) .then(function (response) { - expect(response).to.be.deep.equal(new Account(accountId, '1234')); + expect(response).to.be.deep.equal(new Account(accountId, "1234")); done(); }) .catch(function (err) { @@ -179,76 +181,76 @@ describe('Server#requestAirdrop', function () { }); }); - it('rejects invalid addresses', function (done) { - const friendbotUrl = 'https://friendbot.stellar.org'; - const accountId = 'addr&injected=1'; + it("rejects invalid addresses", function (done) { + const friendbotUrl = "https://friendbot.stellar.org"; + const accountId = "addr&injected=1"; mockGetNetwork.call(this, friendbotUrl); this.axiosMock - .expects('post') + .expects("post") .withArgs(`${friendbotUrl}?addr=addr%26injected%3D1`) .returns( Promise.reject({ response: { status: 400, - type: 'https://stellar.org/horizon-errors/bad_request', - title: 'Bad Request', - detail: 'The request you sent was invalid in some way.', + type: "https://stellar.org/horizon-errors/bad_request", + title: "Bad Request", + detail: "The request you sent was invalid in some way.", extras: { - invalid_field: 'addr', + invalid_field: "addr", reason: - 'base32 decode failed: illegal base32 data at input byte 7' - } - } - }) + "base32 decode failed: illegal base32 data at input byte 7", + }, + }, + }), ); this.server .requestAirdrop(accountId) .then(function (_) { - done(new Error('Should have thrown')); + done(new Error("Should have thrown")); }) .catch(function (err) { - expect(err.response.extras.reason).to.include('base32 decode failed'); + expect(err.response.extras.reason).to.include("base32 decode failed"); done(); }); }); - it('throws if there is no friendbotUrl set', function (done) { - const accountId = 'addr&injected=1'; + it("throws if there is no friendbotUrl set", function (done) { + const accountId = "addr&injected=1"; mockGetNetwork.call(this, undefined); this.server .requestAirdrop(accountId) .then(function (_) { - done(new Error('Should have thrown')); + done(new Error("Should have thrown")); }) .catch(function (err) { expect(err.message).to.be.equal( - 'No friendbot URL configured for current network' + "No friendbot URL configured for current network", ); done(); }); }); - it('throws if the request fails', function (done) { - const friendbotUrl = 'https://friendbot.stellar.org'; + it("throws if the request fails", function (done) { + const friendbotUrl = "https://friendbot.stellar.org"; const accountId = - 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'; + "GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI"; mockGetNetwork.call(this, friendbotUrl); this.axiosMock - .expects('post') + .expects("post") .withArgs(`${friendbotUrl}?addr=${accountId}`) - .returns(Promise.reject(new Error('Request failed'))); + .returns(Promise.reject(new Error("Request failed"))); this.server .requestAirdrop(accountId) .then(function (_) { - done(new Error('Should have thrown')); + done(new Error("Should have thrown")); }) .catch(function (err) { - expect(err.message).to.be.equal('Request failed'); + expect(err.message).to.be.equal("Request failed"); done(); }); }); diff --git a/test/unit/server/soroban/send_transaction_test.js b/test/unit/server/soroban/send_transaction_test.js index 49f31a5e8..31e38d811 100644 --- a/test/unit/server/soroban/send_transaction_test.js +++ b/test/unit/server/soroban/send_transaction_test.js @@ -1,35 +1,32 @@ const { SorobanServer } = StellarSdk; -describe('Server#sendTransaction', function () { +describe("Server#sendTransaction", 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 SorobanServer(serverUrl); - this.axiosMock = sinon.mock(AxiosClient); + this.axiosMock = sinon.mock(SorobanAxiosClient); 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(); transaction.sign(keypair); this.transaction = transaction; - this.hash = this.transaction.hash().toString('hex'); - this.blob = transaction.toEnvelope().toXDR().toString('base64'); + this.hash = this.transaction.hash().toString("hex"); + this.blob = transaction.toEnvelope().toXDR().toString("base64"); }); afterEach(function () { @@ -37,19 +34,19 @@ describe('Server#sendTransaction', function () { this.axiosMock.restore(); }); - it('sends a transaction', function (done) { + it("sends a transaction", function (done) { this.axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'sendTransaction', - params: [this.blob] + method: "sendTransaction", + params: [this.blob], }) .returns( Promise.resolve({ - data: { id: 1, result: { id: this.hash, status: 'PENDING' } } - }) + data: { id: 1, result: { id: this.hash, status: "PENDING" } }, + }), ); this.server @@ -61,11 +58,11 @@ describe('Server#sendTransaction', function () { done(err); }); }); - xit('adds metadata - tx was too small and was immediately deleted'); - xit('adds metadata, order immediately fills'); - xit('adds metadata, order is open'); - xit('adds metadata, partial fill'); - xit('doesnt add metadata to non-offers'); - xit('adds metadata about offers, even if some ops are not'); - xit('submits fee bump transactions'); + xit("adds metadata - tx was too small and was immediately deleted"); + xit("adds metadata, order immediately fills"); + xit("adds metadata, order is open"); + xit("adds metadata, partial fill"); + xit("doesnt add metadata to non-offers"); + xit("adds metadata about offers, even if some ops are not"); + xit("submits fee bump transactions"); }); diff --git a/test/unit/server/soroban/simulate_transaction_test.js b/test/unit/server/soroban/simulate_transaction_test.js index dcfd4b078..a9738cc4d 100644 --- a/test/unit/server/soroban/simulate_transaction_test.js +++ b/test/unit/server/soroban/simulate_transaction_test.js @@ -5,12 +5,12 @@ const { SorobanServer, SorobanDataBuilder, authorizeInvocation, - xdr + xdr, } = StellarSdk; -describe('Server#simulateTransaction', function () { +describe("Server#simulateTransaction", function () { let keypair = Keypair.random(); - let contractId = 'CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM'; + let contractId = "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM"; let contract = new StellarSdk.Contract(contractId); let address = contract.address().toScAddress(); @@ -23,36 +23,36 @@ describe('Server#simulateTransaction', function () { transactionData: new SorobanDataBuilder(simulationResponse.transactionData), result: { auth: simulationResponse.results[0].auth.map((entry) => - xdr.SorobanAuthorizationEntry.fromXDR(entry, 'base64') + xdr.SorobanAuthorizationEntry.fromXDR(entry, "base64"), ), - retval: xdr.ScVal.fromXDR(simulationResponse.results[0].xdr, 'base64') + retval: xdr.ScVal.fromXDR(simulationResponse.results[0].xdr, "base64"), }, cost: simulationResponse.cost, - _parsed: true + _parsed: true, }; beforeEach(function () { this.server = new SorobanServer(serverUrl); - this.axiosMock = sinon.mock(AxiosClient); + this.axiosMock = sinon.mock(SorobanAxiosClient); const source = new Account( - 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI', - '1' + "GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI", + "1", ); function emptyContractTransaction() { return new StellarSdk.TransactionBuilder(source, { fee: 100 }) - .setNetworkPassphrase('Test') + .setNetworkPassphrase("Test") .setTimeout(StellarSdk.TimeoutInfinite) .addOperation( StellarSdk.Operation.invokeHostFunction({ func: new xdr.HostFunction.hostFunctionTypeInvokeContract( new xdr.InvokeContractArgs({ contractAddress: address, - functionName: 'hello', - args: [] - }) + functionName: "hello", + args: [], + }), ), - auth: [] - }) + auth: [], + }), ) .build(); } @@ -61,8 +61,8 @@ describe('Server#simulateTransaction', function () { transaction.sign(keypair); this.transaction = transaction; - this.hash = this.transaction.hash().toString('hex'); - this.blob = transaction.toEnvelope().toXDR().toString('base64'); + this.hash = this.transaction.hash().toString("hex"); + this.blob = transaction.toEnvelope().toXDR().toString("base64"); }); afterEach(function () { @@ -70,17 +70,17 @@ describe('Server#simulateTransaction', function () { this.axiosMock.restore(); }); - it('simulates a transaction', function (done) { + it("simulates a transaction", function (done) { this.axiosMock - .expects('post') + .expects("post") .withArgs(serverUrl, { - jsonrpc: '2.0', + jsonrpc: "2.0", id: 1, - method: 'simulateTransaction', - params: [this.blob] + method: "simulateTransaction", + params: [this.blob], }) .returns( - Promise.resolve({ data: { id: 1, result: simulationResponse } }) + Promise.resolve({ data: { id: 1, result: simulationResponse } }), ); this.server @@ -94,7 +94,7 @@ describe('Server#simulateTransaction', function () { }); }); - it('works when there are no results', function () { + it("works when there are no results", function () { const simResponse = baseSimulationResponse(); const parsedCopy = cloneSimulation(parsedSimulationResponse); delete parsedCopy.result; @@ -104,7 +104,7 @@ describe('Server#simulateTransaction', function () { expect(StellarSdk.SorobanRpc.isSimulationSuccess(parsed)).to.be.true; }); - it('works with no auth', function () { + it("works with no auth", function () { const simResponse = invokeSimulationResponse(address); delete simResponse.results[0].auth; @@ -122,13 +122,13 @@ describe('Server#simulateTransaction', function () { expect(StellarSdk.SorobanRpc.isSimulationSuccess(parsed)).to.be.true; }); - xit('works with restoration', function () { + xit("works with restoration", function () { const simResponse = invokeSimulationResponseWithRestoration(address); const expected = cloneSimulation(parsedSimulationResponse); expected.restorePreamble = { - minResourceFee: '51', - transactionData: new SorobanDataBuilder() + minResourceFee: "51", + transactionData: new SorobanDataBuilder(), }; const parsed = StellarSdk.parseRawSimulation(simResponse); @@ -136,7 +136,7 @@ describe('Server#simulateTransaction', function () { expect(StellarSdk.SorobanRpc.isSimulationRestore(parsed)).to.be.true; }); - it('works with errors', function () { + it("works with errors", function () { let simResponse = simulationResponseError(); const expected = cloneSimulation(parsedSimulationResponse); @@ -145,7 +145,7 @@ describe('Server#simulateTransaction', function () { delete expected.cost; delete expected.transactionData; delete expected.minResourceFee; - expected.error = 'This is an error'; + expected.error = "This is an error"; expected.events = []; const parsed = StellarSdk.parseRawSimulation(simResponse); @@ -153,7 +153,7 @@ describe('Server#simulateTransaction', function () { expect(StellarSdk.SorobanRpc.isSimulationError(parsed)).to.be.true; }); - xit('simulates fee bump transactions'); + xit("simulates fee bump transactions"); }); function cloneSimulation(sim) { @@ -165,18 +165,18 @@ function cloneSimulation(sim) { transactionData: new SorobanDataBuilder(sim.transactionData.build()), result: { auth: sim.result.auth.map((entry) => - xdr.SorobanAuthorizationEntry.fromXDR(entry.toXDR()) + xdr.SorobanAuthorizationEntry.fromXDR(entry.toXDR()), ), - retval: xdr.ScVal.fromXDR(sim.result.retval.toXDR()) + retval: xdr.ScVal.fromXDR(sim.result.retval.toXDR()), }, cost: sim.cost, - _parsed: sim._parsed + _parsed: sim._parsed, }; } function buildAuthEntry(address) { if (!address) { - throw new Error('where address?'); + throw new Error("where address?"); } // Basic fake invocation @@ -186,10 +186,10 @@ function buildAuthEntry(address) { xdr.SorobanAuthorizedFunction.sorobanAuthorizedFunctionTypeContractFn( new xdr.InvokeContractArgs({ contractAddress: address, - functionName: 'test', - args: [] - }) - ) + functionName: "test", + args: [], + }), + ), }); const kp = Keypair.random(); @@ -199,9 +199,9 @@ function buildAuthEntry(address) { function invokeSimulationResponse(address) { return baseSimulationResponse([ { - auth: [buildAuthEntry(address)].map((entry) => entry.toXDR('base64')), - xdr: xdr.ScVal.scvU32(0).toXDR('base64') - } + auth: [buildAuthEntry(address)].map((entry) => entry.toXDR("base64")), + xdr: xdr.ScVal.scvU32(0).toXDR("base64"), + }, ]); } @@ -210,7 +210,7 @@ function simulationResponseError(events) { id: 1, ...(events !== undefined && { events }), latestLedger: 3, - error: 'This is an error' + error: "This is an error", }; } @@ -219,13 +219,13 @@ function baseSimulationResponse(results) { id: 1, events: [], latestLedger: 3, - minResourceFee: '15', - transactionData: new SorobanDataBuilder().build().toXDR('base64'), + minResourceFee: "15", + transactionData: new SorobanDataBuilder().build().toXDR("base64"), ...(results !== undefined && { results }), cost: { - cpuInsns: '1', - memBytes: '2' - } + cpuInsns: "1", + memBytes: "2", + }, }; } @@ -233,39 +233,39 @@ function invokeSimulationResponseWithRestoration(address) { return { ...invokeSimulationResponse(address), restorePreamble: { - minResourceFee: '51', - transactionData: new SorobanDataBuilder().build().toXDR('base64') - } + minResourceFee: "51", + transactionData: new SorobanDataBuilder().build().toXDR("base64"), + }, }; } -describe('works with real responses', function () { +describe("works with real responses", function () { const schema = { transactionData: - 'AAAAAAAAAAIAAAAGAAAAAa/6eoLeofDK5ksPljSZ7t/rAj/XR18e40fCB9LBugstAAAAFAAAAAEAAAAHqA0LEZLq3WL+N3rBQLTWuPqdV3Vv6XIAGeBJaz1wMdsAAAAAABg1gAAAAxwAAAAAAAAAAAAAAAk=', - minResourceFee: '27889', + "AAAAAAAAAAIAAAAGAAAAAa/6eoLeofDK5ksPljSZ7t/rAj/XR18e40fCB9LBugstAAAAFAAAAAEAAAAHqA0LEZLq3WL+N3rBQLTWuPqdV3Vv6XIAGeBJaz1wMdsAAAAAABg1gAAAAxwAAAAAAAAAAAAAAAk=", + minResourceFee: "27889", events: [ - 'AAAAAQAAAAAAAAAAAAAAAgAAAAAAAAADAAAADwAAAAdmbl9jYWxsAAAAAA0AAAAgr/p6gt6h8MrmSw+WNJnu3+sCP9dHXx7jR8IH0sG6Cy0AAAAPAAAABWhlbGxvAAAAAAAADwAAAAVBbG9oYQAAAA==', - 'AAAAAQAAAAAAAAABr/p6gt6h8MrmSw+WNJnu3+sCP9dHXx7jR8IH0sG6Cy0AAAACAAAAAAAAAAIAAAAPAAAACWZuX3JldHVybgAAAAAAAA8AAAAFaGVsbG8AAAAAAAAQAAAAAQAAAAIAAAAPAAAABUhlbGxvAAAAAAAADwAAAAVBbG9oYQAAAA==' + "AAAAAQAAAAAAAAAAAAAAAgAAAAAAAAADAAAADwAAAAdmbl9jYWxsAAAAAA0AAAAgr/p6gt6h8MrmSw+WNJnu3+sCP9dHXx7jR8IH0sG6Cy0AAAAPAAAABWhlbGxvAAAAAAAADwAAAAVBbG9oYQAAAA==", + "AAAAAQAAAAAAAAABr/p6gt6h8MrmSw+WNJnu3+sCP9dHXx7jR8IH0sG6Cy0AAAACAAAAAAAAAAIAAAAPAAAACWZuX3JldHVybgAAAAAAAA8AAAAFaGVsbG8AAAAAAAAQAAAAAQAAAAIAAAAPAAAABUhlbGxvAAAAAAAADwAAAAVBbG9oYQAAAA==", ], results: [ { auth: [], - xdr: 'AAAAEAAAAAEAAAACAAAADwAAAAVIZWxsbwAAAAAAAA8AAAAFQWxvaGEAAAA=' - } + xdr: "AAAAEAAAAAEAAAACAAAADwAAAAVIZWxsbwAAAAAAAA8AAAAFQWxvaGEAAAA=", + }, ], cost: { - cpuInsns: '1322134', - memBytes: '1207047' + cpuInsns: "1322134", + memBytes: "1207047", }, restorePreamble: { - transactionData: '', - minResourceFee: '0' + transactionData: "", + minResourceFee: "0", }, - latestLedger: '2634' + latestLedger: "2634", }; - it('parses the schema', function () { + it("parses the schema", function () { expect(StellarSdk.isSimulationRaw(schema)).to.be.true; const parsed = StellarSdk.parseRawSimulation(schema); diff --git a/test/unit/transaction_test.js b/test/unit/transaction_test.js index a8e6c8067..ff2407122 100644 --- a/test/unit/transaction_test.js +++ b/test/unit/transaction_test.js @@ -1,10 +1,10 @@ const xdr = StellarSdk.xdr; // shorthand -describe('assembleTransaction', () => { - xit('works with keybump transactions'); +describe("assembleTransaction", () => { + xit("works with keybump transactions"); const scAddress = new StellarSdk.Address( - 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI' + "GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI", ).toScAddress(); const fnAuth = new xdr.SorobanAuthorizationEntry({ @@ -14,8 +14,8 @@ describe('assembleTransaction', () => { address: scAddress, nonce: new xdr.Int64(0), signatureExpirationLedger: 1, - signature: xdr.ScVal.scvVoid() - }) + signature: xdr.ScVal.scvVoid(), + }), ), // And a basic invocation rootInvocation: new xdr.SorobanAuthorizedInvocation({ @@ -23,12 +23,12 @@ describe('assembleTransaction', () => { xdr.SorobanAuthorizedFunction.sorobanAuthorizedFunctionTypeContractFn( new xdr.InvokeContractArgs({ contractAddress: scAddress, - functionName: 'fn', - args: [] - }) + functionName: "fn", + args: [], + }), ), - subInvocations: [] - }) + subInvocations: [], + }), }).toXDR(); const sorobanTransactionData = new StellarSdk.SorobanDataBuilder() @@ -36,54 +36,54 @@ describe('assembleTransaction', () => { .build(); const simulationResponse = { - transactionData: sorobanTransactionData.toXDR('base64'), + transactionData: sorobanTransactionData.toXDR("base64"), events: [], - minResourceFee: '115', + minResourceFee: "115", results: [ { auth: [fnAuth], - xdr: xdr.ScVal.scvU32(0).toXDR('base64') - } + xdr: xdr.ScVal.scvU32(0).toXDR("base64"), + }, ], latestLedger: 3, cost: { - cpuInsns: '0', - memBytes: '0' - } + cpuInsns: "0", + memBytes: "0", + }, }; - describe('Transaction', () => { + describe("Transaction", () => { const networkPassphrase = StellarSdk.Networks.TESTNET; const source = new StellarSdk.Account( - 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI', - '1' + "GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI", + "1", ); function singleContractFnTransaction(auth) { return new StellarSdk.TransactionBuilder(source, { fee: 100 }) - .setNetworkPassphrase('Test') + .setNetworkPassphrase("Test") .setTimeout(StellarSdk.TimeoutInfinite) .addOperation( StellarSdk.Operation.invokeHostFunction({ func: xdr.HostFunction.hostFunctionTypeInvokeContract( new xdr.InvokeContractArgs({ contractAddress: scAddress, - functionName: 'hello', - args: [xdr.ScVal.scvString('hello')] - }) + functionName: "hello", + args: [xdr.ScVal.scvString("hello")], + }), ), - auth: auth ?? [] - }) + auth: auth ?? [], + }), ) .build(); } - it('simulate updates the tx data from simulation response', () => { + it("simulate updates the tx data from simulation response", () => { const txn = singleContractFnTransaction(); const result = StellarSdk.assembleTransaction( txn, networkPassphrase, - simulationResponse + simulationResponse, ).build(); // validate it auto updated the tx fees from sim response fees @@ -92,16 +92,16 @@ describe('assembleTransaction', () => { // validate it udpated sorobantransactiondata block in the tx ext expect(result.toEnvelope().v1().tx().ext().sorobanData()).to.deep.equal( - sorobanTransactionData + sorobanTransactionData, ); }); - it('simulate adds the auth to the host function in tx operation', () => { + it("simulate adds the auth to the host function in tx operation", () => { const txn = singleContractFnTransaction(); const result = StellarSdk.assembleTransaction( txn, networkPassphrase, - simulationResponse + simulationResponse, ).build(); expect( @@ -117,8 +117,8 @@ describe('assembleTransaction', () => { .function() .contractFn() .functionName() - .toString() - ).to.equal('fn'); + .toString(), + ).to.equal("fn"); expect( StellarSdk.StrKey.encodeEd25519PublicKey( @@ -134,19 +134,19 @@ describe('assembleTransaction', () => { .address() .address() .accountId() - .ed25519() - ) - ).to.equal('GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'); + .ed25519(), + ), + ).to.equal("GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI"); }); - it('simulate ignores non auth from simulation', () => { + it("simulate ignores non auth from simulation", () => { const txn = singleContractFnTransaction(); let simulateResp = JSON.parse(JSON.stringify(simulationResponse)); simulateResp.results[0].auth = null; const result = StellarSdk.assembleTransaction( txn, networkPassphrase, - simulateResp + simulateResp, ).build(); expect( @@ -157,20 +157,20 @@ describe('assembleTransaction', () => { .operations()[0] .body() .invokeHostFunctionOp() - .auth() + .auth(), ).to.have.length(0); }); - it('throws for non-Soroban ops', () => { + it("throws for non-Soroban ops", () => { const txn = new StellarSdk.TransactionBuilder(source, { fee: 100, networkPassphrase, - v1: true + v1: true, }) .addOperation( StellarSdk.Operation.changeTrust({ - asset: StellarSdk.Asset.native() - }) + asset: StellarSdk.Asset.native(), + }), ) .setTimeout(StellarSdk.TimeoutInfinite) .build(); @@ -179,28 +179,28 @@ describe('assembleTransaction', () => { StellarSdk.assembleTransaction(txn, networkPassphrase, { transactionData: {}, events: [], - minResourceFee: '0', + minResourceFee: "0", results: [], - latestLedger: 3 + latestLedger: 3, }).build(); expect.fail(); }).to.throw(/unsupported transaction/i); }); - it('works for all Soroban ops', function () { + it("works for all Soroban ops", function () { [ StellarSdk.Operation.invokeHostFunction({ - func: xdr.HostFunction.hostFunctionTypeInvokeContract() + func: xdr.HostFunction.hostFunctionTypeInvokeContract(), }), StellarSdk.Operation.bumpFootprintExpiration({ - ledgersToExpire: 27 + ledgersToExpire: 27, }), - StellarSdk.Operation.restoreFootprint() + StellarSdk.Operation.restoreFootprint(), ].forEach((op) => { const txn = new StellarSdk.TransactionBuilder(source, { fee: 100, networkPassphrase, - v1: true + v1: true, }) .setTimeout(StellarSdk.TimeoutInfinite) .addOperation(op) @@ -209,7 +209,7 @@ describe('assembleTransaction', () => { const tx = StellarSdk.assembleTransaction( txn, networkPassphrase, - simulationResponse + simulationResponse, ).build(); expect(tx.operations[0].type).to.equal(op.body().switch().name); }); @@ -220,12 +220,12 @@ describe('assembleTransaction', () => { const tx = StellarSdk.assembleTransaction( txn, networkPassphrase, - simulationResponse + simulationResponse, ).build(); expect(tx.operations[0].auth.length).to.equal( 3, - `auths aren't preserved after simulation: ${simulationResponse}, ${tx}` + `auths aren't preserved after simulation: ${simulationResponse}, ${tx}`, ); }); });