new file: Pnuttaste.code-workspace
new file: SDK-mstr/.eslintrc.js new file: SDK-mstr/.github/release-drafter.yml new file: SDK-mstr/.github/workflows/cd-master.yml new file: SDK-mstr/.github/workflows/ci-docs.yml new file: SDK-mstr/.github/workflows/ci-master.yml new file: SDK-mstr/.gitignore new file: SDK-mstr/.nvmrc new file: SDK-mstr/.prettierrc.json new file: SDK-mstr/LICENSE new file: SDK-mstr/README.md new file: SDK-mstr/TODO.md new file: SDK-mstr/__tests__/api-tests/cross-chain-trades.ts new file: SDK-mstr/__tests__/api-tests/instant-trades.ts new file: SDK-mstr/__tests__/test-runners/avalanche-test-runner.spec.ts new file: SDK-mstr/__tests__/test-runners/bsc-test-runner.spec.ts new file: SDK-mstr/__tests__/test-runners/eth-test-runner.spec.ts new file: SDK-mstr/__tests__/test-runners/fantom-test-runner.spec.ts new file: SDK-mstr/__tests__/test-runners/harmony-test-runner.spec.ts new file: SDK-mstr/__tests__/test-runners/moonriver-test-runner.spec.ts new file: SDK-mstr/__tests__/test-runners/polygon-test-runner.spec.ts new file: SDK-mstr/__tests__/unit-tests/common/decorators/cache.decorator.spec.ts new file: SDK-mstr/__tests__/unit-tests/common/utils/p-timeout.spec.ts new file: SDK-mstr/__tests__/unit-tests/core/sdk/sdk.spec.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/avalanche/joe/joe.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/avalanche/pangolin/pangolin.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/avalanche/sushi-swap/sushi-swap.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/bsc/one-inch/one-inch.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/bsc/pancake-swap/pancake-swap.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/bsc/sushi-swap/sushi-swap.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/ethereum/one-inch/one-inch.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/ethereum/sushi-swap/sushi-swap.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/ethereum/uni-swap-v2/uni-swap-v2-provider.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/ethereum/uni-swap-v2/uni-swap-v2-trade.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/ethereum/uni-swap-v3/uni-swap-v3-ethereum-provider.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/ethereum/uni-swap-v3/uni-swap-v3-ethereum-trade.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/ethereum/zrx/zrx.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/fantom/spirit-swap/spirit-swap.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/fantom/spooky-swap/spooky-swap.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/fantom/sushi-swap/sushi-swap.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/harmony/sushi-swap.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/moonriver/solarbeam/solarbeam.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/moonriver/sushi-swap/sushi-swap.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/polygon/algebra/algebra-provider.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/polygon/algebra/algebra-trade.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/polygon/one-inch/one-inch.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/polygon/quick-swap/quick-swap.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/polygon/sushi-swap/sushi-swap.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/polygon/uni-swap-v3/uni-swap-v3-polygon-provider.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/dexes/polygon/uni-swap-v3/uni-swap-v3-polygon-trade.ts new file: SDK-mstr/__tests__/unit-tests/features/swap/utils/utils.ts new file: SDK-mstr/__tests__/utils/accounts-from-mnemonic.ts new file: SDK-mstr/__tests__/utils/chain.ts new file: SDK-mstr/__tests__/utils/configuration.ts new file: SDK-mstr/__tests__/utils/constants/free-rpc.ts new file: SDK-mstr/__tests__/utils/constants/mnemonic.ts new file: SDK-mstr/__tests__/utils/mock-injector.ts new file: SDK-mstr/__tests__/utils/models/global.ts new file: SDK-mstr/__tests__/utils/tokens.ts new file: SDK-mstr/docker-compose.yml new file: SDK-mstr/jest.config.js new file: SDK-mstr/package.json new file: SDK-mstr/scripts/build-env.js new file: SDK-mstr/scripts/test-runner.sh new file: SDK-mstr/src/common/errors/blockchain/deflation-token.error.ts new file: SDK-mstr/src/common/errors/blockchain/healthcheck.error.ts new file: SDK-mstr/src/common/errors/blockchain/index.ts new file: SDK-mstr/src/common/errors/blockchain/invalid-address.error.ts new file: SDK-mstr/src/common/errors/blockchain/low-gas.error.ts new file: SDK-mstr/src/common/errors/blockchain/transaction-reverted.error.ts new file: SDK-mstr/src/common/errors/blockchain/tron-insufficient-native-balance.ts new file: SDK-mstr/src/common/errors/blockchain/tron-transaction-expired.ts new file: SDK-mstr/src/common/errors/blockchain/user-reject.error.ts new file: SDK-mstr/src/common/errors/blockchain/wrong-from-address.error.ts new file: SDK-mstr/src/common/errors/blockchain/wrong-receiver-address.error.ts new file: SDK-mstr/src/common/errors/cross-chain/cross-chain-is-unavailable.error.ts new file: SDK-mstr/src/common/errors/cross-chain/index.ts new file: SDK-mstr/src/common/errors/cross-chain/insufficient-funds-gas-price-value.error.ts new file: SDK-mstr/src/common/errors/cross-chain/low-to-slippage.error.ts new file: SDK-mstr/src/common/errors/cross-chain/max-gas-price-overflow.error.ts new file: SDK-mstr/src/common/errors/cross-chain/too-low-amount.error.ts new file: SDK-mstr/src/common/errors/cross-chain/unsupported-receiver-address.error.ts new file: SDK-mstr/src/common/errors/cross-chain/updated-rates-error.ts new file: SDK-mstr/src/common/errors/index.ts new file: SDK-mstr/src/common/errors/on-chain/index.ts new file: SDK-mstr/src/common/errors/on-chain/on-chain-is-unavailable.error.ts new file: SDK-mstr/src/common/errors/proxy/unapproved-contract-error.ts new file: SDK-mstr/src/common/errors/proxy/unapproved-method-error.ts new file: SDK-mstr/src/common/errors/rubic-sdk.error.ts new file: SDK-mstr/src/common/errors/swap/bridgers-pair-is-unavailable.error.ts new file: SDK-mstr/src/common/errors/swap/failed-to-check-for-transaction-receipt.error.ts new file: SDK-mstr/src/common/errors/swap/index.ts new file: SDK-mstr/src/common/errors/swap/insufficient-funds-oneinch.error.ts new file: SDK-mstr/src/common/errors/swap/insufficient-funds.error.ts new file: SDK-mstr/src/common/errors/swap/insufficient-liquidity.error.ts new file: SDK-mstr/src/common/errors/swap/lifi-pair-is-unavailable.error.ts new file: SDK-mstr/src/common/errors/swap/low-slippage-deflationary-token.error.ts new file: SDK-mstr/src/common/errors/swap/low-slippage.error.ts new file: SDK-mstr/src/common/errors/swap/max-amount.error.ts new file: SDK-mstr/src/common/errors/swap/min-amount.error.ts new file: SDK-mstr/src/common/errors/swap/no-linked-account-erros.ts new file: SDK-mstr/src/common/errors/swap/not-supported-blockchain.ts new file: SDK-mstr/src/common/errors/swap/not-supported-tokens.error.ts new file: SDK-mstr/src/common/errors/swap/not-whitelisted-provider.error.ts new file: SDK-mstr/src/common/errors/swap/swap-error-on-provider-side.ts new file: SDK-mstr/src/common/errors/swap/swap-request.error.ts new file: SDK-mstr/src/common/errors/swap/unnecessary-approve.error.ts new file: SDK-mstr/src/common/errors/swap/wallet-not-connected.error.ts new file: SDK-mstr/src/common/errors/swap/wrong-network.error.ts new file: SDK-mstr/src/common/errors/utils/index.ts new file: SDK-mstr/src/common/errors/utils/timeout.error.ts new file: SDK-mstr/src/common/tokens/constants/native-tokens.ts new file: SDK-mstr/src/common/tokens/constants/wrapped-addresses.ts new file: SDK-mstr/src/common/tokens/constants/wrapped-native-tokens.ts new file: SDK-mstr/src/common/tokens/index.ts new file: SDK-mstr/src/common/tokens/models/token-base-struct.ts new file: SDK-mstr/src/common/tokens/price-token-amount.ts new file: SDK-mstr/src/common/tokens/price-token.ts new file: SDK-mstr/src/common/tokens/token-amount.ts new file: SDK-mstr/src/common/tokens/token.ts new file: SDK-mstr/src/common/utils/blockchain.ts new file: SDK-mstr/src/common/utils/decorators/cache-decorator/cache.decorator.ts new file: SDK-mstr/src/common/utils/decorators/cache-decorator/models/cache-config.ts new file: SDK-mstr/src/common/utils/decorators/cache-decorator/models/conditional-result.ts new file: SDK-mstr/src/common/utils/decorators/index.ts new file: SDK-mstr/src/common/utils/decorators/static-implements.ts new file: SDK-mstr/src/common/utils/errors.ts new file: SDK-mstr/src/common/utils/functions.ts new file: SDK-mstr/src/common/utils/object.ts new file: SDK-mstr/src/common/utils/options.ts new file: SDK-mstr/src/common/utils/p-timeout.ts new file: SDK-mstr/src/common/utils/token-utils.ts new file: SDK-mstr/src/common/utils/types/abstract-constructor-parameters.ts new file: SDK-mstr/src/common/utils/types/any.ts new file: SDK-mstr/src/common/utils/types/constructor.ts new file: SDK-mstr/src/common/utils/types/index.ts new file: SDK-mstr/src/common/utils/types/infinite-array.ts new file: SDK-mstr/src/common/utils/types/mutable.ts new file: SDK-mstr/src/common/utils/waitFor.ts new file: SDK-mstr/src/core/blockchain/constants/healthcheck.ts new file: SDK-mstr/src/core/blockchain/constants/solana/native-solana-mint-address.ts new file: SDK-mstr/src/core/blockchain/constants/tron/tron-web.ts new file: SDK-mstr/src/core/blockchain/models/backend-blockchains.ts new file: SDK-mstr/src/core/blockchain/models/blockchain-name.ts new file: SDK-mstr/src/core/blockchain/models/chain-type.ts new file: SDK-mstr/src/core/blockchain/models/solana-web3-types.ts new file: SDK-mstr/src/core/blockchain/models/web3-primitive-type.ts new file: SDK-mstr/src/core/blockchain/utils/blockchains-info/blockchains-info.ts new file: SDK-mstr/src/core/blockchain/utils/blockchains-info/constants/blockchain-id.ts new file: SDK-mstr/src/core/blockchain/utils/blockchains-info/constants/chain-type-by-blockchain.ts new file: SDK-mstr/src/core/blockchain/utils/changenow-receiver-address-validator.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/models/create-web3-private.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/models/web-private-supported-blockchain.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/models/web-private-supported-chain-type.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/models/web3-private-storage.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private-service.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/empty-web3-private.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/evm-web3-private/evm-web3-private.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/evm-web3-private/models/evm-basic-transaction-options.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/evm-web3-private/models/evm-transaction-options.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/models/basic-transaction-options.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/models/web3.error.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/solana-web3-private/models/solana-transaction-options.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/solana-web3-private/solana-web3-private.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/tron-web3-private/models/method-parameters.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/tron-web3-private/models/tron-transaction-options.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/tron-web3-private/models/tron-transaction-receipt.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/tron-web3-private/tron-web3-private.ts new file: SDK-mstr/src/core/blockchain/web3-private-service/web3-private/web3-private.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/constants/rpc-errors.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/models/create-web3-public-proxy.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/models/web3-public-storage.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public-service.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/constants/multicall-addresses.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/evm-web3-public/constants/erc-20-token-abi.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/evm-web3-public/constants/evm-multicall-abi.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/evm-web3-public/constants/uni-v3-permit2-abi.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/evm-web3-public/evm-web3-public.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/evm-web3-public/models/batch-call.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/evm-web3-public/models/evm-call.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/evm-web3-public/models/evm-multicall-response.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/evm-web3-public/models/gas-price.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/evm-web3-public/models/permit2-contract-types.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/evm-web3-public/models/rpc-response.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/models/contract-multicall-response.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/models/method-data.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/models/supported-token-field.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/models/tx-status.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/solana-web3-public/solana-web3-public.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/tron-web3-public/constants/trc-20-contract-abi.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/tron-web3-public/constants/tron-multicall-abi.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/tron-web3-public/models/tron-block.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/tron-web3-public/models/tron-call.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/tron-web3-public/models/tron-multicall-response.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/tron-web3-public/models/tron-transaction-info.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/tron-web3-public/models/tron-web-provider.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/tron-web3-public/tron-web3-public.ts new file: SDK-mstr/src/core/blockchain/web3-public-service/web3-public/web3-public.ts new file: SDK-mstr/src/core/blockchain/web3-pure/models/web3-pure-container.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/bitcoin-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/eos-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/evm-web3-pure/evm-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/evm-web3-pure/models/evm-encode-config.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/filecoin-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/icp-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/algorand-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/aptos-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/astar-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/cardano-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/casper-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/cosmos-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/dash-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/dogecoin-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/flow-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/hedear-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/iota-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/kadena-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/kava-cosmos-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/kusama-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/litecoin-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/mina-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/monero-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/near-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/neo-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/osmosis-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/polkadot-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/ripple-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/secret-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/sia-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/stellar-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/tezos-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/ton-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/waves-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/wax-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/non-evm-web3-pure/zilliqa-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/ontology-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/solana-web3-pure/solana-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/tron-web3-pure/models/tron-parameters.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/tron-web3-pure/models/tron-transaction-config.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/tron-web3-pure/tron-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/typed-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/typed-web3-pure/xdc-web3-pure.ts new file: SDK-mstr/src/core/blockchain/web3-pure/web3-pure.ts new file: SDK-mstr/src/core/coingecko-api/coingecko-api.ts new file: SDK-mstr/src/core/gas-price-api/constants/eip1559-compatible-blockchains.ts new file: SDK-mstr/src/core/gas-price-api/gas-price-api.ts new file: SDK-mstr/src/core/gas-price-api/models/1inch-gas-response.ts new file: SDK-mstr/src/core/http-client/default-http-client.ts new file: SDK-mstr/src/core/http-client/models/http-client.ts new file: SDK-mstr/src/core/injector/injector.ts new file: SDK-mstr/src/core/sdk/models/configuration.ts new file: SDK-mstr/src/core/sdk/models/provider-address.ts new file: SDK-mstr/src/core/sdk/models/rpc-provider.ts new file: SDK-mstr/src/core/sdk/models/solana-web3.ts new file: SDK-mstr/src/core/sdk/models/wallet-provider.ts new file: SDK-mstr/src/core/sdk/sdk.ts new file: SDK-mstr/src/features/common/constants/fake-wallet-address.ts new file: SDK-mstr/src/features/common/constants/proxy-supported-blockchain.ts new file: SDK-mstr/src/features/common/constants/wl-contract-abi.ts new file: SDK-mstr/src/features/common/constants/wl-contract-address.ts new file: SDK-mstr/src/features/common/models/contract-params.ts new file: SDK-mstr/src/features/common/models/encode-transaction-options.ts new file: SDK-mstr/src/features/common/models/non-evm-chain-address-correct-response.ts new file: SDK-mstr/src/features/common/models/swap-transaction-options.ts new file: SDK-mstr/src/features/common/providers/bridgers/constants/bridgers-native-address.ts new file: SDK-mstr/src/features/common/providers/bridgers/constants/to-bridgers-blockchain.ts new file: SDK-mstr/src/features/common/providers/bridgers/models/bridgers-contract-addresses.ts new file: SDK-mstr/src/features/common/providers/bridgers/models/bridgers-get-trans-data-by-id-api.ts new file: SDK-mstr/src/features/common/providers/bridgers/models/bridgers-quote-api.ts new file: SDK-mstr/src/features/common/providers/bridgers/models/bridgers-source-flag.ts new file: SDK-mstr/src/features/common/providers/bridgers/models/bridgers-swap-api.ts new file: SDK-mstr/src/features/common/providers/bridgers/models/bridgers-update-data-and-status-api.ts new file: SDK-mstr/src/features/common/providers/changenow/constants/changenow-api-key.ts new file: SDK-mstr/src/features/common/providers/dln/dln-api-service.ts new file: SDK-mstr/src/features/common/providers/dln/dln-utils.ts new file: SDK-mstr/src/features/common/providers/dln/models/dln-estimation.ts new file: SDK-mstr/src/features/common/providers/rango/constants/rango-api-common.ts new file: SDK-mstr/src/features/common/providers/rango/constants/rango-contract-address.ts new file: SDK-mstr/src/features/common/providers/rango/models/rango-api-best-route-types.ts new file: SDK-mstr/src/features/common/providers/rango/models/rango-api-blockchain-names.ts new file: SDK-mstr/src/features/common/providers/rango/models/rango-api-common-types.ts new file: SDK-mstr/src/features/common/providers/rango/models/rango-api-status-types.ts new file: SDK-mstr/src/features/common/providers/rango/models/rango-api-swap-types.ts new file: SDK-mstr/src/features/common/providers/rango/models/rango-api-symbol-names.ts new file: SDK-mstr/src/features/common/providers/rango/models/rango-api-trade-types.ts new file: SDK-mstr/src/features/common/providers/rango/models/rango-parser-types.ts new file: SDK-mstr/src/features/common/providers/rango/models/rango-supported-blockchains.ts new file: SDK-mstr/src/features/common/providers/rango/services/rango-parser.ts new file: SDK-mstr/src/features/common/providers/rango/utils/rango-utils.ts new file: SDK-mstr/src/features/common/providers/symbiosis/constants/symbiosis-api-common.ts new file: SDK-mstr/src/features/common/providers/symbiosis/models/symbiosis-api-common-types.ts new file: SDK-mstr/src/features/common/providers/symbiosis/models/symbiosis-api-parser-types.ts new file: SDK-mstr/src/features/common/providers/symbiosis/models/symbiosis-api-swap-types.ts new file: SDK-mstr/src/features/common/providers/symbiosis/services/symbiosis-api-service.ts new file: SDK-mstr/src/features/common/providers/symbiosis/services/symbiosis-parser.ts new file: SDK-mstr/src/features/common/providers/xy/constants/xy-api-params.ts new file: SDK-mstr/src/features/common/providers/xy/constants/xy-error-code.ts new file: SDK-mstr/src/features/common/providers/xy/models/xy-build-tx-request.ts new file: SDK-mstr/src/features/common/providers/xy/models/xy-build-tx-response.ts new file: SDK-mstr/src/features/common/providers/xy/models/xy-quote-error-response.ts new file: SDK-mstr/src/features/common/providers/xy/models/xy-quote-request.ts new file: SDK-mstr/src/features/common/providers/xy/models/xy-quote-response.ts new file: SDK-mstr/src/features/common/providers/xy/models/xy-quote-success-response.ts new file: SDK-mstr/src/features/common/providers/xy/utils/xy-utils.ts new file: SDK-mstr/src/features/common/status-manager/models/tx-status-data.ts new file: SDK-mstr/src/features/common/status-manager/utils/get-bridgers-trade-status.ts new file: SDK-mstr/src/features/common/status-manager/utils/get-src-tx-status.ts new file: SDK-mstr/src/features/common/utils/check-address.ts new file: SDK-mstr/src/features/common/utils/check-unsupported-receiver-address.ts new file: SDK-mstr/src/features/common/utils/get-from-without-fee.ts new file: SDK-mstr/src/features/common/utils/get-price-tokens-from-input-tokens.ts new file: SDK-mstr/src/features/common/utils/token-native-address-proxy.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/constants/cross-chain-providers.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/constants/default-cross-chain-calculation-options.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/constants/default-provider-addresses.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/cross-chain-manager.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/models/cross-chain-manager-options.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/models/cross-chain-options.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/models/cross-chain-reactively-calculated-trade-data.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/models/cross-chain-trade-type.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/models/cross-chain-typed-trade-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/models/wrapped-cross-chain-trade-or-null.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/arbitrum-rbc-bridge/arbitrum-rbc-bridge-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/arbitrum-rbc-bridge/arbitrum-rbc-bridge-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/arbitrum-rbc-bridge/constants/arbitrum-rbc-bridge-contract-address.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/arbitrum-rbc-bridge/constants/arbitrum-rbc-bridge-supported-blockchain.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/arbitrum-rbc-bridge/constants/l1-erc20-gateway-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/arbitrum-rbc-bridge/constants/l2-erc20-gateway-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/arbitrum-rbc-bridge/constants/outbox-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/arbitrum-rbc-bridge/constants/retryable-factory-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/archon-bridge/archon-bridge-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/archon-bridge/archon-bridge-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/archon-bridge/archon-contract-service.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/archon-bridge/constants/archon-bridge-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/archon-bridge/constants/archon-bridge-out-contract-address.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/archon-bridge/constants/archon-bridge-supported-blockchain.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/archon-bridge/constants/archon-wrap-bridge-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/archon-bridge/constants/layer-zero-ids.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/archon-bridge/constants/supported-tokens.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/bridgers-provider/bridgers-cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/bridgers-provider/constants/bridgers-cross-chain-supported-blockchain.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/bridgers-provider/evm-bridgers-trade/evm-bridgers-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/bridgers-provider/evm-bridgers-trade/models/evm-bridgers-transaction-data.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/bridgers-provider/tron-bridgers-trade/models/tron-bridgers-transaction-data.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/bridgers-provider/tron-bridgers-trade/tron-bridgers-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/bridgers-provider/utils/get-proxy-method-arguments-and-transaction-data.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/cbridge-cross-chain-api-service.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/cbridge-cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/cbridge-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/constants/cbridge-contract-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/constants/cbridge-contract-address.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/constants/cbridge-supported-blockchains.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/models/cbridge-chain-token-info.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/models/cbridge-chain.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/models/cbridge-estimate-amount-request.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/models/cbridge-estimate-amount-response.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/models/cbridge-status-response.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/models/cbridge-transfer-configs-response.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/cbridge/models/pegged-pair-config.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/changenow-provider/changenow-cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/changenow-provider/changenow-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/changenow-provider/constants/changenow-api-blockchain.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/changenow-provider/constants/changenow-proxy-supported-blockchains.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/changenow-provider/constants/native-addresses.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/changenow-provider/models/changenow-currencies-api.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/changenow-provider/models/changenow-minmax-range-api.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/changenow-provider/models/changenow-payment-info.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/changenow-provider/models/changenow-quote-api.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/changenow-provider/models/changenow-swap.api.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/changenow-provider/models/changenow-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/changenow-provider/services/changenow-cross-chain-api-service.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/constants/proxy-hash-errors.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/constants/rubic-proxy-contract-address.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/emv-cross-chain-trade/constants/evm-common-cross-chain-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/emv-cross-chain-trade/constants/gateway-rubic-cross-chain-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/emv-cross-chain-trade/evm-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/emv-cross-chain-trade/models/gas-data.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/models/bridge-type.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/models/calculation-result.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/models/default-bridge-type.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/models/fee-info.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/models/get-contract-params-options.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/models/on-chain-subtype.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/models/proxy-bridge-params.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/models/proxy-swap-params.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/models/rubicStep.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/models/trade-info.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/models/universal-contract.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/models/wrapped-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/proxy-cross-chain-evm-facade/proxy-cross-chain-evm-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/solana-cross-chain-trade/solana-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/tron-cross-chain-trade/constants/tron-common-cross-chain-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/tron-cross-chain-trade/constants/tron-native-swap-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/tron-cross-chain-trade/models/tron-contract-params.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/tron-cross-chain-trade/models/tron-get-contract-params-options.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/common/tron-cross-chain-trade/tron-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/debridge-provider/chains/debridge-evm-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/debridge-provider/chains/debridge-solana-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/debridge-provider/constants/debridge-cross-chain-supported-blockchain.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/debridge-provider/debridge-cross-chain-factory.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/debridge-provider/debridge-cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/debridge-provider/models/debridge-cross-chain-trade-constructor.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/debridge-provider/models/estimation-request.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/debridge-provider/models/estimation-response.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/debridge-provider/models/transaction-request.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/debridge-provider/models/transaction-response.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/layerzero-bridge/constants/algb-token-addresses.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/layerzero-bridge/constants/layerzero-bridge-address.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/layerzero-bridge/constants/layzerzero-chain-ids.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/layerzero-bridge/layerzero-bridge-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/layerzero-bridge/layerzero-bridge-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/layerzero-bridge/models/layerzero-bridge-supported-blockchains.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/layerzero-bridge/models/layerzero-oft-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/lifi-provider/constants/lifi-cross-chain-supported-blockchain.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/lifi-provider/lifi-cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/lifi-provider/lifi-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/lifi-provider/models/lifi-bridge-types.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/lifi-provider/models/lifi-cross-chain-token.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/lifi-provider/models/lifi-exchange-tools.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/lifi-provider/models/lifi-fee-cost.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/lifi-provider/models/lifi-route.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/lifi-provider/models/lifi-swap-status.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/lifi-provider/models/lifi-transaction-request.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/lifi-provider/models/uniq-lifi-bridge-types.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/lifi-provider/services/lifi-api-service.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/meson-provider/constants/meson-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/meson-provider/constants/meson-contract-addresses.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/meson-provider/constants/meson-cross-chain-supported-chains.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/meson-provider/meson-cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/meson-provider/meson-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/meson-provider/models/meson-api-types.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/meson-provider/models/meson-provider-types.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/meson-provider/models/meson-trade-types.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/meson-provider/services/meson-cross-chain-api-service.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/constants/orbiter-api.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/constants/orbiter-router-v3-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/models/orbiter-api-common-types.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/models/orbiter-api-quote-types.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/models/orbiter-api-status-types.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/models/orbiter-bridge-trade-types.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/models/orbiter-contract-addresses.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/models/orbiter-supported-blockchains.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/models/orbiter-utils-types.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/orbiter-bridge-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/orbiter-bridge-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/services/orbiter-api-service.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/orbiter-bridge/services/orbiter-utils.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/constants/erc-677-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/constants/fee-manager-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/constants/foreign-bridge-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/constants/home-bridge-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/constants/native-bridge-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/constants/pulse-chain-contract-address.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/constants/pulse-chain-supported-blockchains.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/omni-bridge-entities/bridge-manager.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/omni-bridge-entities/foreign-bridge.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/omni-bridge-entities/home-bridge.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/omni-bridge-entities/omni-bridge.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/pulse-chain-cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/pulse-chain-bridge/pulse-chain-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/rango-provider/model/rango-cross-chain-api-types.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/rango-provider/model/rango-cross-chain-parser-types.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/rango-provider/rango-cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/rango-provider/rango-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/rango-provider/services/rango-cross-chain-api-service.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/rango-provider/services/rango-cross-chain-params-parser.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/scroll-bridge/constants/l1-erc20-scroll-gateway-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/scroll-bridge/constants/l2-erc20-scroll-gateway-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/scroll-bridge/constants/scroll-bridge-contract-address.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/scroll-bridge/models/scroll-bridge-supported-blockchain.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/scroll-bridge/scroll-bridge-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/scroll-bridge/scroll-bridge-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/squidrouter-provider/constants/squidrouter-contract-address.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/squidrouter-provider/constants/squidrouter-cross-chain-supported-blockchain.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/squidrouter-provider/models/estimation-response.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/squidrouter-provider/models/transaction-request.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/squidrouter-provider/models/transaction-response.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/squidrouter-provider/squidrouter-cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/squidrouter-provider/squidrouter-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/fee-library-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/relayers-addresses.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-blockchain-supported-pool.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-bridge-token.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-chain-id.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-contract-address.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-cross-chain-supported-blockchain.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-factory-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-fee-library-contract-address.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-pool-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-pool-id.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-pool-mapping.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-pools-decimals.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-router-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/constants/stargate-router-eth-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/stargate-cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/stargate-provider/stargate-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/constants/mete-router-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/models/symbiosis-call-data-decode.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/models/symbiosis-cross-chain-supported-blockchains.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/models/symbiosis-error.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/models/symbiosis-swap-status.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/models/symbiosis-swapping-params.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/models/symbiosis-trade-data.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/symbiosis-cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/symbiosis-provider/symbiosis-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/taiko-bridge/constants/taiko-bridge-contract-address.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/taiko-bridge/constants/taiko-gateway-abi.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/taiko-bridge/models/taiko-bridge-supported-blockchains.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/taiko-bridge/taiko-bridge-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/taiko-bridge/taiko-bridge-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/xy-provider/constants/xy-contract-address.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/xy-provider/constants/xy-status-code.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/xy-provider/constants/xy-supported-blockchains.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/xy-provider/xy-cross-chain-provider.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/providers/xy-provider/xy-cross-chain-trade.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/utils/compare-cross-chain-trades.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/utils/convert-gas-price.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/utils/decode-method.ts new file: SDK-mstr/src/features/cross-chain/calculation-manager/utils/get-cross-chain-gas-data.ts new file: SDK-mstr/src/features/cross-chain/cbridge-manager/cross-chain-cbridge-manager.ts new file: SDK-mstr/src/features/cross-chain/status-manager/constants/celer-cross-chain-event-statuses-abi.ts new file: SDK-mstr/src/features/cross-chain/status-manager/constants/multichain-status-mapping.ts new file: SDK-mstr/src/features/cross-chain/status-manager/cross-chain-status-manager.ts new file: SDK-mstr/src/features/cross-chain/status-manager/models/celer-transfer-status.enum.ts new file: SDK-mstr/src/features/cross-chain/status-manager/models/changenow-api-response.ts new file: SDK-mstr/src/features/cross-chain/status-manager/models/cross-chain-status.ts new file: SDK-mstr/src/features/cross-chain/status-manager/models/cross-chain-trade-data.ts new file: SDK-mstr/src/features/cross-chain/status-manager/models/multichain-status-api-response.ts new file: SDK-mstr/src/features/cross-chain/status-manager/models/rubic-backend-ps-status.ts new file: SDK-mstr/src/features/cross-chain/status-manager/models/scroll-api-response.ts new file: SDK-mstr/src/features/cross-chain/status-manager/models/squidrouter-api-response.ts new file: SDK-mstr/src/features/cross-chain/status-manager/models/squidrouter-transfer-status.enum.ts new file: SDK-mstr/src/features/cross-chain/status-manager/models/statuses-api.ts new file: SDK-mstr/src/features/cross-chain/status-manager/models/taiko-api-response.ts new file: SDK-mstr/src/features/cross-chain/status-manager/models/xy-api-response.ts new file: SDK-mstr/src/features/cross-chain/symbiosis-manager/cross-chain-symbiosis-manager.ts new file: SDK-mstr/src/features/cross-chain/symbiosis-manager/models/symbiosis-revert-api.ts new file: SDK-mstr/src/features/cross-chain/symbiosis-manager/models/symbiosis-stucked-api.ts new file: SDK-mstr/src/features/deflation-token-manager/constants/simulator-contract-abi.ts new file: SDK-mstr/src/features/deflation-token-manager/constants/simulator-contract-address.ts new file: SDK-mstr/src/features/deflation-token-manager/deflation-token-manager.ts new file: SDK-mstr/src/features/deflation-token-manager/models/deflation-manager-supported-blockchain.ts new file: SDK-mstr/src/features/deflation-token-manager/models/is-deflation-token.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/constants/trade-providers/algebra-trade-providers.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/constants/trade-providers/bridgers-trade-providers.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/constants/trade-providers/curve-trade-providers.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/constants/trade-providers/izumi-trade-providers.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/constants/trade-providers/pancake-router-providers.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/constants/trade-providers/sync-swap-trade-providers.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/constants/trade-providers/typed-trade-providers.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/constants/trade-providers/uniswap-v2-trade-providers.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/constants/trade-providers/uniswap-v3-trade-providers.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/constants/trade-providers/vooi-trade-providers.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/models/on-chain-manager-aggregators-types.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/models/on-chain-manager-calculation-options.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/models/on-chain-reactively-calculated-trade-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/models/on-chain-trade-error.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/models/on-chain-typed-trade-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/models/required-on-chain-manager-calculation-options.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/models/wrapped-on-chain-trade-or-null.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/on-chain-manager.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/constants/arbitrum-protocols.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/constants/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/constants/one-inch-supported-blockchains.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/models/oneinch-calculation-options.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/models/oneinch-quote-request.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/models/oneinch-quote-response.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/models/oneinch-swap-request.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/models/oneinch-swap-response.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/models/oneinch-tokens-response.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/models/oneinch-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/one-inch-api-service.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/one-inch-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/1inch/one-inch-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/common/native-router-abstract/constants/native-router-abstract-supported-blockchains.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/common/native-router-abstract/models/native-router-quote.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/common/native-router-abstract/models/native-router-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/common/native-router-abstract/models/native-router-transaction-request.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/common/native-router-abstract/native-router-abstract-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/common/native-router-abstract/native-router-abstract-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/common/native-router-abstract/services/native-router-api-service.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/dln/chains/dln-evm-on-chain-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/dln/chains/dln-solana-on-chain-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/dln/constants/dln-on-chain-supported-blockchains.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/dln/dln-on-chain-factory.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/dln/dln-on-chain-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/dln/models/dln-on-chain-calculation-options.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/dln/models/dln-on-chain-estimate-request.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/dln/models/dln-on-chain-estimate-response.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/dln/models/dln-on-chain-swap-request.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/dln/models/dln-on-chain-swap-response.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/dln/models/dln-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/lifi/constants/lifi-providers.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/lifi/constants/lifi-supported-blockchains.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/lifi/lifi-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/lifi/lifi-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/lifi/models/lifi-calculation-options.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/lifi/models/lifi-on-chain-transaction-request.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/lifi/models/lifi-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/lifi/services/lifi-on-chain-api-service.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/native-router/constants/native-router-supported-blockchains.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/native-router/native-router-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/native-router/native-router-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/odos/constants/odos-api-consts.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/odos/models/odos-api-best-route-types.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/odos/models/odos-api-swap-types.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/odos/models/odos-on-chain-parser-types.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/odos/models/odos-on-chain-trade-types.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/odos/models/odos-supported-blockchains.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/odos/odos-on-chain-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/odos/odos-on-chain-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/odos/services/odos-on-chain-api-service.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/odos/services/odos-on-chain-parser.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/okuswap/constants/okuswap-api.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/okuswap/models/okuswap-api-types.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/okuswap/models/okuswap-chain-names.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/okuswap/models/okuswap-on-chain-supported-chains.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/okuswap/models/okuswap-trade-types.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/okuswap/okuswap-on-chain-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/okuswap/okuswap-on-chain-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/okuswap/services/okuswap-api-service.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/open-ocean/constants/arbitrum-gas-price.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/open-ocean/constants/get-open-ocean-api-url.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/open-ocean/constants/open-ocean-blockchain.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/open-ocean/constants/open-ocean-on-chain-supported-blockchain.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/open-ocean/models/open-cean-swap-quote-response.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/open-ocean/models/open-ocean-quote-response.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/open-ocean/models/open-ocean-token-list-response.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/open-ocean/models/open-ocean-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/open-ocean/open-ocean-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/open-ocean/open-ocean-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/piteas/constants/piteas-on-chain-supported-blockchains.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/piteas/constants/piteas-router-address.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/piteas/models/piteas-quote.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/piteas/models/piteas-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/piteas/piteas-api-service.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/piteas/piteas-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/piteas/piteas-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/rango/models/rango-on-chain-disabled-providers.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/rango/models/rango-on-chain-trade-types.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/rango/rango-on-chain-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/rango/rango-on-chain-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/rango/services/rango-on-chain-api-service.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/symbiosis/models/symbiosis-on-chain-supported-blockchains.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/symbiosis/models/symbiosis-on-chain-trade-types.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/symbiosis/symbiosis-on-chain-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/symbiosis/symbiosis-on-chain-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/xy-dex/constants/xy-dex-supported-blockchains.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/xy-dex/models/xy-dex-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/xy-dex/xy-dex-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/xy-dex/xy-dex-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/zetaswap/constants/zetaswap-supported-blockchains.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/zetaswap/zetaswap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/zetaswap/zetaswap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/zrx/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/zrx/constants/zrx-supported-blockchains.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/zrx/models/zrx-quote-request.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/zrx/models/zrx-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/zrx/models/zrx-types.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/zrx/utils.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/zrx/zrx-api-service.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/zrx/zrx-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/aggregators/zrx/zrx-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/evm-wrap-trade/evm-wrap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/evm-wrap-trade/wrap-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/models/on-chain-calculation-options.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/models/on-chain-proxy-fee-info.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/models/on-chain-trade-type.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-aggregator/aggregator-evm-on-chain-trade-abstract.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-aggregator/aggregator-on-chain-provider-abstract.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-aggregator/aggregator-solana-on-chain-trade-abstract.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-aggregator/models/aggregator-on-chain-types.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-proxy-service/on-chain-proxy-service.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-trade/evm-on-chain-trade/evm-on-chain-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-trade/evm-on-chain-trade/models/evm-on-chain-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-trade/evm-on-chain-trade/models/exact.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-trade/evm-on-chain-trade/models/gas-fee-info.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-trade/evm-on-chain-trade/models/gas-params.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-trade/evm-on-chain-trade/models/permit2-approve-config.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-trade/on-chain-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-trade/solana-on-chain-trade/solana-on-chain-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/on-chain-trade/tron-on-chain-trade/tron-on-chain-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/utils/get-gas-fee-info.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/common/utils/get-gas-price-info.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/camelot-arbitrum/camelot-arbitrum-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/camelot-arbitrum/camelot-arbitrum-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/camelot-arbitrum/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/camelot-arbitrum/constants/swap-router-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/camelot-arbitrum/utils/quoter-controller/constants/quoter-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/curve-arbitrum/curve-arbitrum-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/curve-arbitrum/curve-arbitrum-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/izumi-arbitrum/izumi-arbitrum-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/sushi-swap-arbitrum/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/sushi-swap-arbitrum/sushi-swap-arbitrum-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/sushi-swap-arbitrum/sushi-swap-arbitrum-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/uni-swap-v3-arbitrum/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/uni-swap-v3-arbitrum/constants/router-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/uni-swap-v3-arbitrum/uni-swap-v3-arbitrum-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arbitrum/uni-swap-v3-arbitrum/uni-swap-v3-arbitrum-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arthera-testnet/algebra-integral/algebra-integral-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arthera-testnet/algebra-integral/algebra-integral-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arthera-testnet/algebra-integral/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arthera-testnet/algebra-integral/constants/swap-router-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arthera-testnet/algebra-integral/models/algebra-integral-route.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arthera-testnet/algebra-integral/models/algebra-integral-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arthera-testnet/algebra-integral/utils/quoter-controller/constants/quoter-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/arthera-testnet/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/astar-evm/arth-swap/arth-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/astar-evm/arth-swap/arth-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/astar-evm/arth-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/astar-evm/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/aurora/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/aurora/trisolaris-aurora/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/aurora/trisolaris-aurora/trisolaris-aurora-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/aurora/trisolaris-aurora/trisolaris-aurora-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/aurora/wanna-swap-aurora/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/aurora/wanna-swap-aurora/wanna-swap-aurora-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/aurora/wanna-swap-aurora/wanna-swap-aurora-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/avax-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/curve-avalanche/curve-avalanche-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/curve-avalanche/curve-avalanche-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/joe/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/joe/joe-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/joe/joe-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/pangolin/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/pangolin/pangolin-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/pangolin/pangolin-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/sushi-swap-avalanche/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/sushi-swap-avalanche/sushi-swap-avalanche-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/sushi-swap-avalanche/sushi-swap-avalanche-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/avalanche/swap-methods.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/base/aerodrome/aerodrome-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/base/aerodrome/aerodrome-path-factory.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/base/aerodrome/aerodrome-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/base/aerodrome/aerodrome-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/base/aerodrome/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/base/base-swap/base-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/base/base-swap/base-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/base/base-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/base/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/base/izumi-base/izumi-base-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/berachain-testnet/berachain-testnet-algebra/berachain-testnet-algebra-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/berachain-testnet/berachain-testnet-algebra/berachain-testnet-algebra-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/berachain-testnet/berachain-testnet-algebra/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/berachain-testnet/berachain-testnet-algebra/constants/swap-router-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/berachain-testnet/berachain-testnet-algebra/models/berachain-testnet-algebra-route.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/berachain-testnet/berachain-testnet-algebra/models/berachain-testnet-algebra-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/berachain-testnet/berachain-testnet-algebra/utils/quoter-controller/constants/quoter-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/berachain-testnet/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/blast/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/blast/fenix-blast/blast-fenix-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/blast/fenix-blast/blast-fenix-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/blast/fenix-blast/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/blast/fenix-blast/constants/swap-router-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/blast/fenix-blast/models/blast-fenix-route.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/blast/fenix-blast/models/blast-fenix-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/blast/fenix-blast/utils/quoter-controller/constants/quoter-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/blast/izumi-blast/izumi-blast-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/blast/uni-swap-v2-blast/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/blast/uni-swap-v2-blast/uni-swap-v2-blast-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/blast/uni-swap-v2-blast/uni-swap-v2-blast-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/boba/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/boba/oolong-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/boba/oolong-swap/oolong-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/boba/oolong-swap/oolong-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsc/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsc/izumi-bsc/izumi-bsc-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsc/pancake-router-bsc/pancake-router-bsc-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsc/pancake-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsc/pancake-swap/pancake-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsc/pancake-swap/pancake-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsc/sushi-swap-bsc/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsc/sushi-swap-bsc/sushi-swap-bsc-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsc/sushi-swap-bsc/sushi-swap-bsc-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsct/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsct/pancake-swap-testnet/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsct/pancake-swap-testnet/pancake-swap-testnet-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsct/pancake-swap-testnet/pancake-swap-testnet-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsct/trader-joe-bsct/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsct/trader-joe-bsct/trader-joe-bsct-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/bsct/trader-joe-bsct/trader-joe-bsct-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/celo/curve-celo/curve-celo-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/celo/curve-celo/curve-celo-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/algebra/algebra-quoter-controller.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/curve-provider/constants/address-provider-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/curve-provider/constants/registry-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/curve-provider/constants/registry-exchange-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/curve-provider/curve-abstract-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/curve-provider/curve-abstract-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/curve-provider/models/curve-on-chain-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/curve-provider/models/curve-trade-class.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/izumi-abstract/contracts/izumi-quoter-contract-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/izumi-abstract/contracts/izumi-swap-contract-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/izumi-abstract/izumi-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/izumi-abstract/izumi-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/izumi-abstract/models/izumi-pool-response.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/izumi-abstract/models/izumi-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/on-chain-provider/constants/provider-default-options.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/on-chain-provider/evm-on-chain-provider/constants/evm-provider-default-options.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/on-chain-provider/evm-on-chain-provider/evm-on-chain-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/on-chain-provider/evm-on-chain-provider/models/gas-price-info.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/on-chain-provider/on-chain-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/on-chain-provider/tron-on-chain-provider/constants/tron-provider-default-options.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/on-chain-provider/tron-on-chain-provider/tron-on-chain-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/pancake-router/abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/pancake-router/models/pancake-router-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/pancake-router/pancake-router-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/pancake-router/pancake-router-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/quickswap-v3/quickswap-v3-quoter-controller.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/sync-swap-abstract/router-support-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/sync-swap-abstract/sync-swap-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/sync-swap-abstract/sync-swap-abstract-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/sync-swap-abstract/sync-swap-abstract-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/sync-swap-abstract/sync-swap-stable-pool.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/sync-swap-abstract/utils/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/sync-swap-abstract/utils/sync-swap-factory.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/sync-swap-abstract/utils/sync-swap-path-factory.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/sync-swap-abstract/utils/sync-swap-router.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/sync-swap-abstract/utils/typings.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/constants/EDDY_SWAP_METHOD.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/constants/SWAP_METHOD.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/constants/default-estimated-gas.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/constants/dex-trader/dex-trader-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/constants/dex-trader/dex-trader-swap-method.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/constants/uniswap-v2-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/models/aerodrome-route-method-arguments.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/models/default-estimated-gas.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/models/route-method-arguments.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/models/uniswap-calculated-info.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/models/uniswap-route.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/models/uniswap-v2-calculation-options.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/models/uniswap-v2-provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/models/uniswap-v2-trade-class.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/models/uniswap-v2-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/path-factory.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/uniswap-v2-abstract-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v2-abstract/uniswap-v2-abstract-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/constants/swap-router-contract-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/models/uniswap-v3-calculated-info.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/models/uniswap-v3-route.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/models/uniswap-v3-router-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/models/uniswap-v3-trade-class.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/models/uniswap-v3-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/uniswap-v3-abstract-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/uniswap-v3-abstract-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/utils/quoter-controller/constants/factory-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/utils/quoter-controller/constants/quoter-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/utils/quoter-controller/fusionx-uniswap-v3-quoter-controller.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/utils/quoter-controller/horizondex-uniswap-v3-quoter-controller.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/utils/quoter-controller/models/liquidity-pool.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-abstract/utils/quoter-controller/uniswap-v3-quoter-controller.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/constants/estimated-gas.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/models/create-trade-instance.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/models/uniswap-v3-algebra-calculated-info.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/models/uniswap-v3-algebra-calculation-options.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/models/uniswap-v3-algebra-provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/models/uniswap-v3-algebra-quoter-controller.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/models/uniswap-v3-algebra-route.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/models/uniswap-v3-algebra-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/models/unwrapWethMethodName.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/uniswap-v3-algebra-abstract-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/uniswap-v3-algebra-abstract/uniswap-v3-algebra-abstract-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/utils/get-from-to-tokens-amounts-by-exact.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/vooi-abstract/constants/omni-pool-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/vooi-abstract/constants/vooi-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/vooi-abstract/models/vooi-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/vooi-abstract/vooi-abstract-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/common/vooi-abstract/vooi-abstract-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/cronos/cro-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/cronos/cro-swap/cro-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/cronos/cro-swap/cro-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/cronos/crodex/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/cronos/crodex/crodex-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/cronos/crodex/crodex-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/cronos/crona-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/cronos/crona-swap/crona-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/cronos/crona-swap/crona-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/cronos/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/defi-kingdoms/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/defi-kingdoms/trader-dfk/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/defi-kingdoms/trader-dfk/trader-dfk-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/defi-kingdoms/trader-dfk/trader-dfk-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum-pow/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum-pow/sushi-swap-ethereum-pow/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum-pow/sushi-swap-ethereum-pow/sushi-swap-ethereum-pow-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum-pow/sushi-swap-ethereum-pow/sushi-swap-ethereum-pow-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum-pow/uni-swap-v2-ethereum-pow/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum-pow/uni-swap-v2-ethereum-pow/uni-swap-v2-ethereum-pow-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum-pow/uni-swap-v2-ethereum-pow/uni-swap-v2-ethereum-pow-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum-pow/uni-swap-v3-ethereum-pow/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum-pow/uni-swap-v3-ethereum-pow/constants/router-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum-pow/uni-swap-v3-ethereum-pow/uni-swap-v3-ethereum-pow-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum-pow/uni-swap-v3-ethereum-pow/uni-swap-v3-ethereum-pow-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/curve-ethereum/curve-ethereum-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/curve-ethereum/curve-ethereum-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/pancake-router-ethereum/pancake-router-ethereum-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/sushi-swap-ethereum/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/sushi-swap-ethereum/sushi-swap-ethereum-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/sushi-swap-ethereum/sushi-swap-ethereum-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v2-ethereum/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v2-ethereum/uni-swap-v2-ethereum-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v2-ethereum/uni-swap-v2-ethereum-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v3-ethereum/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v3-ethereum/constants/router-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v3-ethereum/uni-swap-v3-ethereum-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v3-ethereum/uni-swap-v3-ethereum-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/verse/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/verse/verse-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/ethereum/verse/verse-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/curve-fantom/curve-fantom-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/curve-fantom/curve-fantom-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/soul-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/soul-swap/soul-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/soul-swap/soul-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/spirit-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/spirit-swap/spirit-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/spirit-swap/spirit-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/spooky-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/spooky-swap/spooky-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/spooky-swap/spooky-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/sushi-swap-fantom/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/sushi-swap-fantom/sushi-swap-fantom-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fantom/sushi-swap-fantom/sushi-swap-fantom-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fuji/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fuji/joe-fuji/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fuji/joe-fuji/joe-fuji-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fuji/joe-fuji/joe-fuji-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fuji/pangolin-fuji/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fuji/pangolin-fuji/pangolin-fuji-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/fuji/pangolin-fuji/pangolin-fuji-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/gnosis/curve-gnosis/curve-gnosis-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/gnosis/curve-gnosis/curve-gnosis-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/goerli/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/goerli/uni-swap-v2-goerli/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/goerli/uni-swap-v2-goerli/uni-swap-v2-goerli-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/goerli/uni-swap-v2-goerli/uni-swap-v2-goerli-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/harmony/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/harmony/sushi-swap-harmony/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/harmony/sushi-swap-harmony/sushi-swap-harmony-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/harmony/sushi-swap-harmony/sushi-swap-harmony-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/harmony/trader-harmony/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/harmony/trader-harmony/trader-harmony-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/harmony/trader-harmony/trader-harmony-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/harmony/viper-swap-harmony/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/harmony/viper-swap-harmony/viper-swap-harmony-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/harmony/viper-swap-harmony/viper-swap-harmony-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/horizen-eon/ascent-horizon-eon/ascent-horizen-eon-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/horizen-eon/ascent-horizon-eon/ascent-horizen-eon-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/horizen-eon/ascent-horizon-eon/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/horizen-eon/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/horizen-eon/spooky-swap-horizen-eon/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/horizen-eon/spooky-swap-horizen-eon/spooky-swap-horizen-eon-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/horizen-eon/spooky-swap-horizen-eon/spooky-swap-horizen-eon-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/curve-kava/curve-kava-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/curve-kava/curve-kava-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/elk/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/elk/elk-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/elk/elk-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/jupiter-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/jupiter-swap/jupiter-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/jupiter-swap/jupiter-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/photon-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/photon-swap/photon-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/photon-swap/photon-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/surfdex/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/surfdex/surfdex-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kava/surfdex/surfdex-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/klaytn/claim-swap/claim-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/klaytn/claim-swap/claim-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/klaytn/claim-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/klaytn/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/klaytn/klaytn-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/klaytn/klaytn-swap-method.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/kroma/izumi-kroma/izumi-kroma-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/linea/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/linea/horizondex/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/linea/horizondex/constants/router-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/linea/horizondex/horizondex-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/linea/horizondex/horizondex-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/linea/horizondex/utils/quoter-controller/constants/quoter-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/linea/izumi-linea/izumi-linea-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/linea/sync-swap/linea-sync-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/linea/vooi/constants/pool-id-mapping.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/linea/vooi/vooi-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/linea/vooi/vooi-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/manta-pacific/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/manta-pacific/izumi-manta-pacific/izumi-manta-pacific-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mantle/fusionx/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mantle/fusionx/constants/router-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mantle/fusionx/fusionx-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mantle/fusionx/fusionx-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mantle/fusionx/utils/quoter-controller/constants/quoter-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mantle/izumi-mantle/izumi-mantle-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/merlin/izumi-merlin/izumi-merlin-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/merlin/merlin-swap/merlin-swap-merlin-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/merlin/merlin-swap/merlin-swap-merlin-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/metis/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/metis/metis-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/metis/metis-swap-methods.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/metis/net-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/metis/net-swap/net-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/metis/net-swap/net-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mode/algebra-mode/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mode/algebra-mode/constants/swap-router-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mode/algebra-mode/mode-algebra-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mode/algebra-mode/mode-algebra-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mode/algebra-mode/models/mode-algebra-route.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mode/algebra-mode/models/mode-algebra-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mode/algebra-mode/utils/quoter-controller/constants/quoter-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mode/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mode/eddy-finance-mode/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mode/eddy-finance-mode/eddy-finance-mode-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mode/eddy-finance-mode/eddy-finance-mode-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mode/izumi-mode/izumi-mode-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/moonbeam/curve-moonbeam/curve-moonbeam-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/moonbeam/curve-moonbeam/curve-moonbeam-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/moonriver/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/moonriver/solarbeam/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/moonriver/solarbeam/solarbeam-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/moonriver/solarbeam/solarbeam-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/moonriver/sushi-swap-moonriver/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/moonriver/sushi-swap-moonriver/sushi-swap-moonriver-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/moonriver/sushi-swap-moonriver/sushi-swap-moonriver-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mumbai/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mumbai/quick-swap-mumbai/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mumbai/quick-swap-mumbai/quick-swap-mumbai-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/mumbai/quick-swap-mumbai/quick-swap-mumbai-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/oasis/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/oasis/yuzu-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/oasis/yuzu-swap/yuzu-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/oasis/yuzu-swap/yuzu-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/optimism/curve-optimism/curve-optimism-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/optimism/curve-optimism/curve-optimism-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon-zkevm/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon-zkevm/pancake-router-polygon-zkevm/pancake-router-polygon-zkevm-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon-zkevm/quick-swap-v3/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon-zkevm/quick-swap-v3/constants/swap-router-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon-zkevm/quick-swap-v3/quick-swap-v3-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon-zkevm/quick-swap-v3/quick-swap-v3-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon-zkevm/quick-swap-v3/utils/quoter-controller/constants/quoter-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/algebra/algebra-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/algebra/algebra-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/algebra/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/algebra/constants/swap-router-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/algebra/models/algebra-route.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/algebra/models/algebra-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/algebra/utils/quoter-controller/constants/quoter-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/algebra/utils/quoter-controller/constants/router-tokens.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/curve-polygon/curve-polygon-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/curve-polygon/curve-polygon-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap-v3/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap-v3/constants/swap-router-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap-v3/models/quick-swap-v3-route.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap-v3/models/quick-swap-v3-trade-struct.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap-v3/quick-swap-v3-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap-v3/quick-swap-v3-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap-v3/utils/quoter-controller/constants/quoter-contract-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap/quick-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap/quick-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/sushi-swap-polygon/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/sushi-swap-polygon/sushi-swap-polygon-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/sushi-swap-polygon/sushi-swap-polygon-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/uni-swap-v3-polygon/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/uni-swap-v3-polygon/constants/router-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/uni-swap-v3-polygon/uni-swap-v3-polygon-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/polygon/uni-swap-v3-polygon/uni-swap-v3-polygon-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/pulsechain/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/pulsechain/pulsex-v1/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/pulsechain/pulsex-v1/pulsex-v1-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/pulsechain/pulsex-v1/pulsex-v1-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/pulsechain/pulsex-v2/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/pulsechain/pulsex-v2/pulsex-v2-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/pulsechain/pulsex-v2/pulsex-v2-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/scroll-sepolia/uni-swap-v2-scroll-sepolia/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/scroll-sepolia/uni-swap-v2-scroll-sepolia/uni-swap-v2-scroll-sepolia-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/scroll-sepolia/uni-swap-v2-scroll-sepolia/uni-swap-v2-scroll-sepolia-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/scroll-sepolia/uni-swap-v3-scroll-sepolia/constants/provider-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/scroll-sepolia/uni-swap-v3-scroll-sepolia/constants/router-configuration.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/scroll-sepolia/uni-swap-v3-scroll-sepolia/uni-swap-v3-scroll-sepolia-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/scroll-sepolia/uni-swap-v3-scroll-sepolia/uni-swap-v3-scroll-sepolia-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/scroll/izumi-scroll/izumi-scroll-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/scroll/sync-swap/scroll-sync-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/syscoin/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/syscoin/pegasys/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/syscoin/pegasys/pegasys-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/syscoin/pegasys/pegasys-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/syscoin/syscoin-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/syscoin/syscoin-swap-method.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/taiko/izumi-taiko/izumi-taiko-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/ape-swap/ape-swap-telos-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/ape-swap/ape-swap-telos-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/ape-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/omnidex/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/omnidex/omnidex-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/omnidex/omnidex-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/sushi-swap-telos/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/sushi-swap-telos/sushi-swap-telos-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/sushi-swap-telos/sushi-swap-telos-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/zappy/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/zappy/trisolaris-aurora-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/telos/zappy/trisolaris-aurora-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/tron/bridgers/bridgers-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/tron/bridgers/bridgers-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/velas/astro-swap/astro-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/velas/astro-swap/astro-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/velas/astro-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/velas/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/velas/wagyu-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/velas/wagyu-swap/wagyu-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/velas/wagyu-swap/wagyu-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/xlayer/izumi-xlayer/izumi-xlayer-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zetachain/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zetachain/eddy-finance/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zetachain/eddy-finance/eddy-finance-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zetachain/eddy-finance/eddy-finance-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zetachain/izumi-zetachain/izumi-zetachain-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zetachain/sushi-swap-zetachain/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zetachain/sushi-swap-zetachain/sushi-swap-zetachain-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zetachain/sushi-swap-zetachain/sushi-swap-zetachain-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zkfair/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zkfair/izumi-zkfair/izumi-zkfair-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zklink/izumi-zklink/izumi-zklink-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zksync/default-constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zksync/izumi-zksync/izumi-zksync-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zksync/mute-swap/constants.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zksync/mute-swap/mute-swap-abi.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zksync/mute-swap/mute-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zksync/mute-swap/mute-swap-trade.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zksync/sync-swap/zksync-sync-swap-provider.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/providers/dexes/zksync/utils.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/utils/get-on-chain-gas-data.ts new file: SDK-mstr/src/features/on-chain/calculation-manager/utils/type-guards.ts new file: SDK-mstr/src/features/on-chain/status-manager/on-chain-status-manager.ts new file: SDK-mstr/tsconfig.json new file: SDK-mstr/tsconfig.test.json new file: SDK-mstr/typedoc.json new file: SDK-mstr/webpack.config.js new file: SDK-mstr/yarn.lock
This commit is contained in:
parent
df8039f494
commit
df9ec7dab2
8
Pnuttaste.code-workspace
Normal file
8
Pnuttaste.code-workspace
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {}
|
||||||
|
}
|
180
SDK-mstr/.eslintrc.js
Normal file
180
SDK-mstr/.eslintrc.js
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
ignorePatterns: ['**/*.js'],
|
||||||
|
plugins: ['import'],
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['src/**/*.ts'],
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
parserOptions: {
|
||||||
|
project: './tsconfig.json',
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
createDefaultProgram: true
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
'@typescript-eslint',
|
||||||
|
'unused-imports',
|
||||||
|
'simple-import-sort'
|
||||||
|
],
|
||||||
|
extends: [
|
||||||
|
'airbnb-typescript/base',
|
||||||
|
'plugin:prettier/recommended',
|
||||||
|
'prettier'
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
'import/prefer-default-export': 'off',
|
||||||
|
'@typescript-eslint/no-useless-constructor': 'off',
|
||||||
|
'no-plusplus': 'off',
|
||||||
|
'class-method-use-this': 'off',
|
||||||
|
'no-underscore-dangle': 'off',
|
||||||
|
'no-inferrable-types': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 2,
|
||||||
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
|
'simple-import-sort/imports': 'error',
|
||||||
|
'simple-import-sort/exports': 'error',
|
||||||
|
'unused-imports/no-unused-imports': 'error',
|
||||||
|
'unused-imports/no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
vars: 'all',
|
||||||
|
args: 'all',
|
||||||
|
ignoreRestSiblings: false,
|
||||||
|
argsIgnorePattern: '^_'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-inferrable-types': 'off',
|
||||||
|
'class-methods-use-this': 'off',
|
||||||
|
complexity: ['error', 20],
|
||||||
|
eqeqeq: ['error', 'smart'],
|
||||||
|
'@typescript-eslint/naming-convention': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
selector: 'enumMember',
|
||||||
|
format: ['UPPER_CASE']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'no-empty': ['error', { 'allowEmptyCatch': true }],
|
||||||
|
'no-bitwise': 'off',
|
||||||
|
// Styling.
|
||||||
|
'array-bracket-spacing': ['error', 'never'],
|
||||||
|
'object-curly-spacing': ['error', 'always'],
|
||||||
|
indent: 'off',
|
||||||
|
'comma-dangle': 'off',
|
||||||
|
'@typescript-eslint/comma-dangle': ['error', 'never'],
|
||||||
|
// Temporary rules. Remove after full refactoring.
|
||||||
|
'import/no-extraneous-dependencies': 'off',
|
||||||
|
'@typescript-eslint/dot-notation': 'off',
|
||||||
|
'no-restricted-globals': 'off',
|
||||||
|
'@typescript-eslint/no-empty-function': 'off',
|
||||||
|
'no-param-reassign': 'off',
|
||||||
|
// Temporary rules. Remove as fast as it can be.
|
||||||
|
'max-classes-per-file': 'off',
|
||||||
|
radix: ['warn', 'as-needed'],
|
||||||
|
'no-prototype-builtins': 'off',
|
||||||
|
'no-return-assign': 'off',
|
||||||
|
'no-restricted-syntax': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
"selector": "TSEnumDeclaration",
|
||||||
|
"message": "Don't declare enums"
|
||||||
|
},
|
||||||
|
'LabeledStatement',
|
||||||
|
'WithStatement'
|
||||||
|
],
|
||||||
|
'no-console': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
allow: ['debug', 'error', 'info']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'import/export': 0,
|
||||||
|
'@typescript-eslint/no-shadow': 'off',
|
||||||
|
'@typescript-eslint/return-await': 'off',
|
||||||
|
'prefer-destructuring': 'off',
|
||||||
|
'no-bitwise': 'off',
|
||||||
|
"prettier/prettier": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"endOfLine": "auto"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['__tests__/**/*.ts'],
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
parserOptions: {
|
||||||
|
project: './tsconfig.test.json',
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
createDefaultProgram: true
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
'@typescript-eslint',
|
||||||
|
'unused-imports'
|
||||||
|
],
|
||||||
|
extends: [
|
||||||
|
'airbnb-typescript/base',
|
||||||
|
'plugin:prettier/recommended',
|
||||||
|
'prettier'
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
'import/prefer-default-export': 'off',
|
||||||
|
'@typescript-eslint/no-useless-constructor': 'off',
|
||||||
|
'no-plusplus': 'off',
|
||||||
|
'class-method-use-this': 'off',
|
||||||
|
'no-underscore-dangle': 'off',
|
||||||
|
'no-inferrable-types': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 2,
|
||||||
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
|
'unused-imports/no-unused-imports': 'error',
|
||||||
|
'unused-imports/no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
vars: 'all',
|
||||||
|
args: 'all',
|
||||||
|
ignoreRestSiblings: false,
|
||||||
|
argsIgnorePattern: '^_'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-inferrable-types': 'off',
|
||||||
|
'class-methods-use-this': 'off',
|
||||||
|
complexity: ['error', 20],
|
||||||
|
eqeqeq: ['error', 'smart'],
|
||||||
|
'@typescript-eslint/naming-convention': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
selector: 'enumMember',
|
||||||
|
format: ['UPPER_CASE']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'no-empty': ['error', { 'allowEmptyCatch': true }],
|
||||||
|
// Styling.
|
||||||
|
'array-bracket-spacing': ['error', 'never'],
|
||||||
|
'object-curly-spacing': ['error', 'always'],
|
||||||
|
indent: 'off',
|
||||||
|
'comma-dangle': 'off',
|
||||||
|
'@typescript-eslint/comma-dangle': ['error', 'never'],
|
||||||
|
// Temporary rules. Remove after full refactoring.
|
||||||
|
'import/no-extraneous-dependencies': 'off',
|
||||||
|
'@typescript-eslint/dot-notation': 'off',
|
||||||
|
'no-restricted-globals': 'off',
|
||||||
|
'@typescript-eslint/no-empty-function': 'off',
|
||||||
|
'no-param-reassign': 'off',
|
||||||
|
// Temporary rules. Remove as fast as it can be.
|
||||||
|
'max-classes-per-file': 'off',
|
||||||
|
radix: ['warn', 'as-needed'],
|
||||||
|
'no-prototype-builtins': 'off',
|
||||||
|
'no-return-assign': 'off',
|
||||||
|
'no-restricted-syntax': [
|
||||||
|
'error',
|
||||||
|
'LabeledStatement',
|
||||||
|
'WithStatement'
|
||||||
|
],
|
||||||
|
'no-console': 'off',
|
||||||
|
'import/export': 0,
|
||||||
|
'@typescript-eslint/no-shadow': 'off',
|
||||||
|
'@typescript-eslint/return-await': 'off'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
2
SDK-mstr/.github/release-drafter.yml
vendored
Normal file
2
SDK-mstr/.github/release-drafter.yml
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
template: |
|
||||||
|
## Change log
|
45
SDK-mstr/.github/workflows/cd-master.yml
vendored
Normal file
45
SDK-mstr/.github/workflows/cd-master.yml
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
name: Publish package and draft release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
name: Publish package to NPM
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Read .nvmrc
|
||||||
|
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||||
|
id: nvm
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
|
- name: Set up yarn
|
||||||
|
run: npm install --global yarn
|
||||||
|
|
||||||
|
- name: Set up dependencies
|
||||||
|
run: yarn
|
||||||
|
|
||||||
|
- name: Compile lib
|
||||||
|
run: yarn compile
|
||||||
|
|
||||||
|
- name: Build bundle
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Publish package
|
||||||
|
run: npm publish --access public
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
38
SDK-mstr/.github/workflows/ci-docs.yml
vendored
Normal file
38
SDK-mstr/.github/workflows/ci-docs.yml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
name: Documentation generation
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
name: Generate docs and push to github pages
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Read .nvmrc
|
||||||
|
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||||
|
id: nvm
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
||||||
|
|
||||||
|
- name: Set up yarn
|
||||||
|
run: npm install --global yarn
|
||||||
|
|
||||||
|
- name: Set up dependencies
|
||||||
|
run: yarn
|
||||||
|
|
||||||
|
- name: Generate docs
|
||||||
|
run: yarn docs
|
||||||
|
|
||||||
|
- name: Deploy Github Page
|
||||||
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_dir: ./docs
|
41
SDK-mstr/.github/workflows/ci-master.yml
vendored
Normal file
41
SDK-mstr/.github/workflows/ci-master.yml
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
name: Tests and build
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
name: Check code base before merge to master
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Read .nvmrc
|
||||||
|
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||||
|
id: nvm
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
||||||
|
|
||||||
|
- name: Set up yarn
|
||||||
|
run: npm install --global yarn
|
||||||
|
|
||||||
|
- name: Set up dependencies
|
||||||
|
run: yarn
|
||||||
|
|
||||||
|
- name: Run lint
|
||||||
|
run: yarn lint
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: yarn test:unit
|
||||||
|
|
||||||
|
- name: Compile lib
|
||||||
|
run: yarn compile
|
||||||
|
|
||||||
|
- name: Build bundle
|
||||||
|
run: yarn build
|
16
SDK-mstr/.gitignore
vendored
Normal file
16
SDK-mstr/.gitignore
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
.idea
|
||||||
|
/node_modules/
|
||||||
|
/.env
|
||||||
|
/yarn-error.log
|
||||||
|
/.data/
|
||||||
|
/coverage/
|
||||||
|
/__tests__/env.js
|
||||||
|
/lib/
|
||||||
|
/dist/
|
||||||
|
/cache/
|
||||||
|
/scripts/node.log
|
||||||
|
stats.json
|
||||||
|
.DS_Store
|
||||||
|
/docs/
|
||||||
|
/src/index.ts
|
||||||
|
.eslintignore
|
1
SDK-mstr/.nvmrc
Normal file
1
SDK-mstr/.nvmrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
v20.11.0
|
14
SDK-mstr/.prettierrc.json
Normal file
14
SDK-mstr/.prettierrc.json
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json.schemastore.org/prettierrc",
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"printWidth": 100,
|
||||||
|
"proseWrap": "always",
|
||||||
|
"quoteProps": "as-needed",
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 4,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"useTabs": false,
|
||||||
|
"endOfLine": "auto"
|
||||||
|
}
|
674
SDK-mstr/LICENSE
Normal file
674
SDK-mstr/LICENSE
Normal file
|
@ -0,0 +1,674 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
361
SDK-mstr/README.md
Normal file
361
SDK-mstr/README.md
Normal file
|
@ -0,0 +1,361 @@
|
||||||
|
# Rubic SDK
|
||||||
|
|
||||||
|
## API Documentation
|
||||||
|
|
||||||
|
[Latest API Documentation](https://cryptorubic.github.io/rubic-sdk)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
### Installation with cdn
|
||||||
|
```html
|
||||||
|
<script src="https://unpkg.com/rubic-sdk@latest/dist/rubic-sdk.min.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Installation with npm and webpack (React, ...)
|
||||||
|
1. `npm install rubic-sdk`
|
||||||
|
|
||||||
|
|
||||||
|
ℹ️️ Skip the rest of the steps if your have already installed [web3](https://github.com/ChainSafe/web3.js) in your project.
|
||||||
|
|
||||||
|
|
||||||
|
2. `npm install --save-dev http-browserify https-browserify stream-browserify crypto-browserify`
|
||||||
|
3. modify webpack.config.js. If you use create-react-app, run `npm run eject` to extract config
|
||||||
|
1. add to `plugins`
|
||||||
|
```javascript
|
||||||
|
new webpack.ProvidePlugin({
|
||||||
|
Buffer: ['buffer', 'Buffer'],
|
||||||
|
process: 'process/browser'
|
||||||
|
})
|
||||||
|
```
|
||||||
|
2. add `resolve.fallback`
|
||||||
|
```json
|
||||||
|
"fallback": {
|
||||||
|
"fs": false,
|
||||||
|
"constants": false,
|
||||||
|
"querystring": false,
|
||||||
|
"url": false,
|
||||||
|
"path": false,
|
||||||
|
"os": false,
|
||||||
|
"http": require.resolve("http-browserify"),
|
||||||
|
"https": require.resolve("https-browserify"),
|
||||||
|
"zlib": false,
|
||||||
|
"stream": require.resolve("stream-browserify"),
|
||||||
|
"crypto": require.resolve("crypto-browserify"),
|
||||||
|
"zlib": require.resolve('browserify-zlib')
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Installation with npm for Angular
|
||||||
|
1. `npm install rubic-sdk`
|
||||||
|
|
||||||
|
|
||||||
|
ℹ️️ Skip the rest of the steps if your have already installed [web3](https://github.com/ChainSafe/web3.js) in your project.
|
||||||
|
|
||||||
|
|
||||||
|
2. `npm install --save-dev stream-browserify assert https-browserify os-browserify stream-http crypto-browserify process buffer`
|
||||||
|
3. Modify tsconfig.json
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
...
|
||||||
|
"paths" : {
|
||||||
|
...
|
||||||
|
"stream": ["./node_modules/stream-browserify"],
|
||||||
|
"assert": ["./node_modules/assert"],
|
||||||
|
"https": ["./node_modules/https-browserify"],
|
||||||
|
"os": ["./node_modules/os-browserify"],
|
||||||
|
"http": ["./node_modules/stream-http"],
|
||||||
|
"crypto": ["./node_modules/crypto-browserify"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
4. Modify polyfills.ts
|
||||||
|
```typescript
|
||||||
|
import Process = NodeJS.Process;
|
||||||
|
|
||||||
|
export interface AppWindow extends Window {
|
||||||
|
process: Process;
|
||||||
|
Buffer: Buffer;
|
||||||
|
global?: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
(window as AppWindow).global = window;
|
||||||
|
(window as AppWindow).process = window.process || require('process');
|
||||||
|
(window as AppWindow).Buffer = (window as any).Buffer || require('buffer').Buffer;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Trades usage
|
||||||
|
|
||||||
|
### Get started after cdn installation
|
||||||
|
```html
|
||||||
|
<script>
|
||||||
|
// you have to declare rpc links only for networks you will use
|
||||||
|
const configuration = {
|
||||||
|
rpcProviders: {
|
||||||
|
ETH: {
|
||||||
|
rpcList: ['<your ethereum rpc>']
|
||||||
|
},
|
||||||
|
BSC: {
|
||||||
|
rpcList: ['<your bsc rpc>']
|
||||||
|
},
|
||||||
|
...
|
||||||
|
TRON: {
|
||||||
|
rpcList: [
|
||||||
|
{
|
||||||
|
fullHost: '<tron-api>',
|
||||||
|
headers: { "TRON-PRO-API-KEY": 'your api key' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// if you are whitelisted integrator, provide your wallet address here
|
||||||
|
providerAddress: {
|
||||||
|
[CHAIN_TYPE.EVM]: {
|
||||||
|
crossChain: '0x0000000000000000000000000000000000000000', // Address for cross chain fee
|
||||||
|
onChain: '0x0000000000000000000000000000000000000000' // Address for on chain fee
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
// create SDK instance
|
||||||
|
const sdk = await RubicSDK.SDK.createSDK(configuration);
|
||||||
|
|
||||||
|
// define example trade parameters
|
||||||
|
const blockchain = 'ETH';
|
||||||
|
const fromTokenAddress = '0x0000000000000000000000000000000000000000';
|
||||||
|
const fromAmount = 1;
|
||||||
|
const toTokenAddress = '0xdac17f958d2ee523a2206206994597c13d831ec7';
|
||||||
|
|
||||||
|
// calculate trades
|
||||||
|
const trades = await sdk.onChainManager
|
||||||
|
.calculateTrade({blockchain, address: fromTokenAddress}, fromAmount, toTokenAddress);
|
||||||
|
|
||||||
|
console.log(trades);
|
||||||
|
}
|
||||||
|
main();
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Get started after npm installation
|
||||||
|
1. Create configuration
|
||||||
|
```typescript
|
||||||
|
import { Configuration, BLOCKCHAIN_NAME } from 'rubic-sdk';
|
||||||
|
|
||||||
|
// you have to declare rpc links only for networks you will use
|
||||||
|
export const configuration: Configuration = {
|
||||||
|
rpcProviders: {
|
||||||
|
[BLOCKCHAIN_NAME.ETHEREUM]: {
|
||||||
|
rpcList: ['<your ethereum rpc #1>', '<your ethereum rpc #2>', ...]
|
||||||
|
},
|
||||||
|
[BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN]: {
|
||||||
|
rpcList: ['<your bsc rpc>']
|
||||||
|
},
|
||||||
|
...
|
||||||
|
[BLOCKCHAIN_NAME.TRON]: {
|
||||||
|
rpcList: [
|
||||||
|
{
|
||||||
|
fullHost: '<tron api>',
|
||||||
|
headers: { "TRON-PRO-API-KEY": 'your api key' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// if you are whitelisted integrator, provide your wallet address here
|
||||||
|
providerAddress: {
|
||||||
|
[CHAIN_TYPE.EVM]: {
|
||||||
|
crossChain: '0x0000000000000000000000000000000000000000', // Address for cross chain fee
|
||||||
|
onChain: '0x0000000000000000000000000000000000000000' // Address for on chain fee
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
2. Create sdk instance
|
||||||
|
```typescript
|
||||||
|
import { SDK } from 'rubic-sdk';
|
||||||
|
|
||||||
|
const sdk = await SDK.createSDK(configuration);
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Use sdk instance for trade calculation
|
||||||
|
```typescript
|
||||||
|
import { BLOCKCHAIN_NAME, TradeType, OnChainTrade, EvmOnChainTrade } from 'rubic-sdk';
|
||||||
|
|
||||||
|
const blockchain = BLOCKCHAIN_NAME.ETHEREUM;
|
||||||
|
const fromTokenAddress = '0x0000000000000000000000000000000000000000'; // ETH
|
||||||
|
const fromAmount = 1;
|
||||||
|
const toTokenAddress = '0xdac17f958d2ee523a2206206994597c13d831ec7'; // USDT
|
||||||
|
|
||||||
|
const trades = await sdk.onChainManager.calculateTrade(
|
||||||
|
{ blockchain, address: fromTokenAddress },
|
||||||
|
fromAmount,
|
||||||
|
toTokenAddress
|
||||||
|
);
|
||||||
|
const bestTrade = trades[0];
|
||||||
|
|
||||||
|
trades.forEach(trade => {
|
||||||
|
const tradeType: TradeType = trade.type;
|
||||||
|
console.log(`trade type: ${tradeType}`);
|
||||||
|
|
||||||
|
if (trade instanceof OnChainTrade) {
|
||||||
|
console.log(`to amount: ${trade.to.tokenAmount.toFormat(3)}`);
|
||||||
|
} else {
|
||||||
|
console.log(`error: ${trade.error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// explore trades info
|
||||||
|
if (trade instanceof EvmOnChainTrade) {
|
||||||
|
console.log(`Gas fee: ${bestTrade.gasFeeInfo}`);
|
||||||
|
}
|
||||||
|
...
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
4. When user connects wallet (e.g. MetaMask) you should change configuration to use trade `swap` method.<br />
|
||||||
|
**⚠️ Recalculate trades after this**.
|
||||||
|
```typescript
|
||||||
|
import { WalletProvider, CHAIN_TYPE, Configuration } from 'rubic-sdk';
|
||||||
|
|
||||||
|
const walletProvider: WalletProvider = {
|
||||||
|
[CHAIN_TYPE.EVM]: {
|
||||||
|
address: '0x123...', // user wallet address
|
||||||
|
core: window.ethereum
|
||||||
|
},
|
||||||
|
[CHAIN_TYPE.TRON]: {
|
||||||
|
address: 'T123...', // user wallet address
|
||||||
|
core: window.tronLink.tronWeb // or window.tronWeb
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// initial configuration example
|
||||||
|
const configuration: Configuration = {
|
||||||
|
...
|
||||||
|
walletProvider
|
||||||
|
}
|
||||||
|
const sdk = await SDK.createSDK(configuration);
|
||||||
|
|
||||||
|
// after user's wallet address changed
|
||||||
|
// Example #1:
|
||||||
|
sdk.updateWalletProvider(walletProvider);
|
||||||
|
|
||||||
|
// Example #2:
|
||||||
|
sdk.updateWalletAddress(CHAIN_TYPE.EVM, address);
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Now you can use `swap` method of trade instance. Approve transaction will be sent automatically if needed.
|
||||||
|
```typescript
|
||||||
|
const onConfirm = (hash: string) => console.log(hash);
|
||||||
|
|
||||||
|
// check that trade is defined
|
||||||
|
сonst bestTrade = trades[0];
|
||||||
|
const receipt = await bestTrade.swap({ onConfirm });
|
||||||
|
```
|
||||||
|
|
||||||
|
### Get started with cross-chain swaps
|
||||||
|
Steps 1. and 2. are the same. You can use single sdk instance for on-chain trades and cross-chain swaps calculations.
|
||||||
|
|
||||||
|
3. Use sdk instance for trade calculation
|
||||||
|
```typescript
|
||||||
|
import { BLOCKCHAIN_NAME } from 'rubic-sdk';
|
||||||
|
|
||||||
|
const fromBlockchain = BLOCKCHAIN_NAME.ETHEREUM;
|
||||||
|
const fromTokenAddress = '0x0000000000000000000000000000000000000000'; // ETH
|
||||||
|
const fromAmount = 1;
|
||||||
|
const toBlockchain = BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN;
|
||||||
|
const toTokenAddress = '0xe9e7cea3dedca5984780bafc599bd69add087d56'; // BUSD
|
||||||
|
|
||||||
|
const wrappedTrades = await sdk.crossChainManager.calculateTrade(
|
||||||
|
{ blockchain: fromBlockchain, address: fromTokenAddress },
|
||||||
|
fromAmount,
|
||||||
|
{ blockchain: toBlockchain, address: toTokenAddress }
|
||||||
|
);
|
||||||
|
|
||||||
|
wrappedTrades.forEach(wrappedTrade => {
|
||||||
|
const tradeType: TradeType = wrappedTrade.type;
|
||||||
|
console.log(`trade type: ${tradeType}`);
|
||||||
|
|
||||||
|
if (wrappedTrade.error) {
|
||||||
|
console.log(`error: ${wrappedTrade.error}`);
|
||||||
|
} else {
|
||||||
|
const trade = wrappedTrade.trade!;
|
||||||
|
console.log(`to amount: ${trade.to.tokenAmount.toFormat(3)}`);
|
||||||
|
|
||||||
|
// explore trades info
|
||||||
|
if (trade instanceof EvmCrossChainTrade) {
|
||||||
|
console.log(trade.gasData)
|
||||||
|
}
|
||||||
|
...
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Same as in on-chain.
|
||||||
|
|
||||||
|
5. Now you can use `swap` method of trade instance. Approve transaction will be sent automatically if needed.
|
||||||
|
```typescript
|
||||||
|
const onConfirm = (hash: string) => console.log(hash);
|
||||||
|
|
||||||
|
// check, that trade is defined
|
||||||
|
const bestTrade = wrappedTrades[0].trade;
|
||||||
|
const receipt = await bestTrade.swap({ onConfirm });
|
||||||
|
```
|
||||||
|
|
||||||
|
## Token classes
|
||||||
|
|
||||||
|
You can use specific sdk `Token` classes to work with tokens.
|
||||||
|
|
||||||
|
### Token
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { BLOCKCHAIN_NAME } from 'rubic-sdk';
|
||||||
|
|
||||||
|
const token: Token = await Token.createToken({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.ETHEREUM,
|
||||||
|
address: '0xdac17f958d2ee523a2206206994597c13d831ec7'
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(token.symbol); // USDT
|
||||||
|
console.log(token.name); // Tether USD
|
||||||
|
console.log(token.decimals); // 6
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also use constructor directly.
|
||||||
|
```typescript
|
||||||
|
import { BLOCKCHAIN_NAME } from 'rubic-sdk';
|
||||||
|
|
||||||
|
const token = new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.ETHEREUM,
|
||||||
|
address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
|
||||||
|
name: 'USD Coin',
|
||||||
|
symbol: 'USDC',
|
||||||
|
decimals: 6
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### PriceToken
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { BLOCKCHAIN_NAME } from 'rubic-sdk';
|
||||||
|
|
||||||
|
const token: PriceToken = await PriceToken.createToken({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.ETHEREUM,
|
||||||
|
address: '0xdac17f958d2ee523a2206206994597c13d831ec7'
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(token.price);
|
||||||
|
```
|
||||||
|
|
||||||
|
### PriceTokenAmount
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { BLOCKCHAIN_NAME } from 'rubic-sdk';
|
||||||
|
|
||||||
|
const token: PriceTokenAmount = await PriceTokenAmount.createToken({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.ETHEREUM,
|
||||||
|
address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(token.weiAmount);
|
||||||
|
```
|
9
SDK-mstr/TODO.md
Normal file
9
SDK-mstr/TODO.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Rubic sdk todo
|
||||||
|
|
||||||
|
### Todo
|
||||||
|
|
||||||
|
- [ ] Tests
|
||||||
|
- [ ] Make ethereum test env
|
||||||
|
- [ ] Write unit tests
|
||||||
|
- [ ] Write API tests
|
||||||
|
- [ ] Add CONTRIBUTING.md
|
35
SDK-mstr/__tests__/api-tests/cross-chain-trades.ts
Normal file
35
SDK-mstr/__tests__/api-tests/cross-chain-trades.ts
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import { minimalConfiguration } from '../utils/configuration';
|
||||||
|
import { SDK } from 'src/core/sdk/sdk';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const crossChainApiSpec = () =>
|
||||||
|
describe('Cross chain trades module tests', () => {
|
||||||
|
let sdk: SDK;
|
||||||
|
beforeEach(async () => {
|
||||||
|
sdk = await SDK.createSDK(minimalConfiguration);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Should create InstantTradesManager instance', async () => {
|
||||||
|
expect(typeof sdk.crossChainManager).toBe('object');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Should calculate MATIC to USDT trade', async () => {
|
||||||
|
const fromToken = {
|
||||||
|
address: '0x0000000000000000000000000000000000000000',
|
||||||
|
blockchain: BLOCKCHAIN_NAME.POLYGON
|
||||||
|
};
|
||||||
|
const toToken = {
|
||||||
|
address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
|
||||||
|
blockchain: BLOCKCHAIN_NAME.ETHEREUM
|
||||||
|
};
|
||||||
|
const fromAmount = 100;
|
||||||
|
|
||||||
|
const trade = await sdk.crossChainManager.calculateTrade(
|
||||||
|
fromToken,
|
||||||
|
fromAmount.toString(),
|
||||||
|
toToken
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(!!trade).toBeTruthy();
|
||||||
|
}, 400_000);
|
||||||
|
});
|
28
SDK-mstr/__tests__/api-tests/instant-trades.ts
Normal file
28
SDK-mstr/__tests__/api-tests/instant-trades.ts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import { minimalConfiguration } from '../utils/configuration';
|
||||||
|
import { SDK } from '../../src/core/sdk/sdk';
|
||||||
|
import { BLOCKCHAIN_NAME } from '../../src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const instantTradesApiSpec = () =>
|
||||||
|
describe('Instant trades module tests', () => {
|
||||||
|
let sdk: SDK;
|
||||||
|
beforeEach(async () => {
|
||||||
|
sdk = await SDK.createSDK(minimalConfiguration);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Should create InstantTradesManager instance', async () => {
|
||||||
|
expect(typeof sdk.onChainManager).toBe('object');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Should calculate ETH to USDT trade', async () => {
|
||||||
|
const fromToken = {
|
||||||
|
address: '0x0000000000000000000000000000000000000000',
|
||||||
|
blockchain: BLOCKCHAIN_NAME.ETHEREUM
|
||||||
|
};
|
||||||
|
const toToken = '0xdac17f958d2ee523a2206206994597c13d831ec7';
|
||||||
|
const fromAmount = 1;
|
||||||
|
|
||||||
|
const trades = await sdk.onChainManager.calculateTrade(fromToken, fromAmount, toToken);
|
||||||
|
expect(Array.isArray(trades)).toBeTruthy();
|
||||||
|
expect(trades.length).not.toBe(0);
|
||||||
|
}, 400_000);
|
||||||
|
});
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { joeAvalancheProviderSpec } from '__tests__/unit-tests/features/swap/dexes/avalanche/joe/joe';
|
||||||
|
import { pangolinAvalancheProviderSpec } from '__tests__/unit-tests/features/swap/dexes/avalanche/pangolin/pangolin';
|
||||||
|
import { sushiSwapAvalancheProviderSpec } from '__tests__/unit-tests/features/swap/dexes/avalanche/sushi-swap/sushi-swap';
|
||||||
|
|
||||||
|
describe('Avalanche tests', () => {
|
||||||
|
joeAvalancheProviderSpec();
|
||||||
|
pangolinAvalancheProviderSpec();
|
||||||
|
sushiSwapAvalancheProviderSpec();
|
||||||
|
});
|
9
SDK-mstr/__tests__/test-runners/bsc-test-runner.spec.ts
Normal file
9
SDK-mstr/__tests__/test-runners/bsc-test-runner.spec.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import { pancakeSwapBscProviderSpec } from '__tests__/unit-tests/features/swap/dexes/bsc/pancake-swap/pancake-swap';
|
||||||
|
import { sushiSwapBscProviderSpec } from '__tests__/unit-tests/features/swap/dexes/bsc/sushi-swap/sushi-swap';
|
||||||
|
import { oneinchBscProviderSpec } from '__tests__/unit-tests/features/swap/dexes/bsc/one-inch/one-inch';
|
||||||
|
|
||||||
|
describe('BSC tests', () => {
|
||||||
|
pancakeSwapBscProviderSpec();
|
||||||
|
sushiSwapBscProviderSpec();
|
||||||
|
oneinchBscProviderSpec();
|
||||||
|
});
|
24
SDK-mstr/__tests__/test-runners/eth-test-runner.spec.ts
Normal file
24
SDK-mstr/__tests__/test-runners/eth-test-runner.spec.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import { instantTradesApiSpec } from '__tests__/api-tests/instant-trades';
|
||||||
|
import { crossChainApiSpec } from '__tests__/api-tests/cross-chain-trades';
|
||||||
|
import { uniswapV2ProviderSpec } from '__tests__/unit-tests/features/swap/dexes/ethereum/uni-swap-v2/uni-swap-v2-provider';
|
||||||
|
import { uniswapV3EthTradeSpec } from '__tests__/unit-tests/features/swap/dexes/ethereum/uni-swap-v3/uni-swap-v3-ethereum-trade';
|
||||||
|
import { uniswapV3EthProviderSpec } from '__tests__/unit-tests/features/swap/dexes/ethereum/uni-swap-v3/uni-swap-v3-ethereum-provider';
|
||||||
|
import { uniswapV2TradeSpec } from '__tests__/unit-tests/features/swap/dexes/ethereum/uni-swap-v2/uni-swap-v2-trade';
|
||||||
|
import { oneinchProviderEthereumSpec } from '__tests__/unit-tests/features/swap/dexes/ethereum/one-inch/one-inch';
|
||||||
|
import { sushiSwapProviderEthereumSpec } from '__tests__/unit-tests/features/swap/dexes/ethereum/sushi-swap/sushi-swap';
|
||||||
|
import { zrxProviderEthereumSpec } from '__tests__/unit-tests/features/swap/dexes/ethereum/zrx/zrx';
|
||||||
|
|
||||||
|
describe('Eth tests', () => {
|
||||||
|
instantTradesApiSpec();
|
||||||
|
crossChainApiSpec();
|
||||||
|
|
||||||
|
uniswapV2ProviderSpec();
|
||||||
|
uniswapV2TradeSpec();
|
||||||
|
|
||||||
|
uniswapV3EthProviderSpec();
|
||||||
|
uniswapV3EthTradeSpec();
|
||||||
|
|
||||||
|
oneinchProviderEthereumSpec();
|
||||||
|
sushiSwapProviderEthereumSpec();
|
||||||
|
zrxProviderEthereumSpec();
|
||||||
|
});
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { spiritSwapFantomProviderSpec } from '__tests__/unit-tests/features/swap/dexes/fantom/spirit-swap/spirit-swap';
|
||||||
|
import { spookySwapFantomProviderSpec } from '__tests__/unit-tests/features/swap/dexes/fantom/spooky-swap/spooky-swap';
|
||||||
|
import { sushiSwapFantomProviderSpec } from '__tests__/unit-tests/features/swap/dexes/fantom/sushi-swap/sushi-swap';
|
||||||
|
|
||||||
|
describe('Fantom tests', () => {
|
||||||
|
spiritSwapFantomProviderSpec();
|
||||||
|
spookySwapFantomProviderSpec();
|
||||||
|
sushiSwapFantomProviderSpec();
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
import { sushiSwapHarmonyProviderSpec } from '__tests__/unit-tests/features/swap/dexes/harmony/sushi-swap';
|
||||||
|
|
||||||
|
describe('Harmony tests', () => {
|
||||||
|
sushiSwapHarmonyProviderSpec();
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { solarbeamMoonriverProviderSpec } from '__tests__/unit-tests/features/swap/dexes/moonriver/solarbeam/solarbeam';
|
||||||
|
import { sushiSwapMoonriverProviderSpec } from '__tests__/unit-tests/features/swap/dexes/moonriver/sushi-swap/sushi-swap';
|
||||||
|
|
||||||
|
describe('Moonriver tests', () => {
|
||||||
|
solarbeamMoonriverProviderSpec();
|
||||||
|
sushiSwapMoonriverProviderSpec();
|
||||||
|
});
|
19
SDK-mstr/__tests__/test-runners/polygon-test-runner.spec.ts
Normal file
19
SDK-mstr/__tests__/test-runners/polygon-test-runner.spec.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import { uniswapV3PolygonTradeSpec } from '__tests__/unit-tests/features/swap/dexes/polygon/uni-swap-v3/uni-swap-v3-polygon-trade';
|
||||||
|
import { uniswapV3PolygonProviderSpec } from '__tests__/unit-tests/features/swap/dexes/polygon/uni-swap-v3/uni-swap-v3-polygon-provider';
|
||||||
|
import { sushiSwapPolygonProviderSpec } from '__tests__/unit-tests/features/swap/dexes/polygon/sushi-swap/sushi-swap';
|
||||||
|
import { oneinchPolygonProviderSpec } from '__tests__/unit-tests/features/swap/dexes/polygon/one-inch/one-inch';
|
||||||
|
import { algebraPolygonProviderSpec } from '__tests__/unit-tests/features/swap/dexes/polygon/algebra/algebra-provider';
|
||||||
|
import { algebraPolygonTradeSpec } from '__tests__/unit-tests/features/swap/dexes/polygon/algebra/algebra-trade';
|
||||||
|
|
||||||
|
describe('Polygon tests', () => {
|
||||||
|
uniswapV3PolygonProviderSpec();
|
||||||
|
uniswapV3PolygonTradeSpec();
|
||||||
|
|
||||||
|
algebraPolygonProviderSpec();
|
||||||
|
algebraPolygonTradeSpec();
|
||||||
|
|
||||||
|
// quickSwapPolygonProviderSpec();
|
||||||
|
sushiSwapPolygonProviderSpec();
|
||||||
|
|
||||||
|
oneinchPolygonProviderSpec();
|
||||||
|
});
|
|
@ -0,0 +1,393 @@
|
||||||
|
import JestMockPromise from 'jest-mock-promise';
|
||||||
|
import { Cache } from 'src/common/utils/decorators';
|
||||||
|
import fn = jest.fn;
|
||||||
|
|
||||||
|
describe('Cache decorator tests', () => {
|
||||||
|
test('Cache must be used when method is called second time.', () => {
|
||||||
|
const spyFn = fn();
|
||||||
|
const returnedValue = 1;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache
|
||||||
|
public zeroParametersCacheableMethod() {
|
||||||
|
spyFn();
|
||||||
|
return returnedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallResult = testClassInstance.zeroParametersCacheableMethod();
|
||||||
|
const secondCallResult = testClassInstance.zeroParametersCacheableMethod();
|
||||||
|
|
||||||
|
expect(spyFn.mock.calls.length).toBe(1);
|
||||||
|
expect(firstCallResult).toBe(returnedValue);
|
||||||
|
expect(secondCallResult).toBe(returnedValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Cache must not be used when method is called second time with other parameter.', () => {
|
||||||
|
const spyFn = fn();
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache
|
||||||
|
public oneParametersCacheableMethod(parameter: unknown) {
|
||||||
|
spyFn();
|
||||||
|
return parameter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
testClassInstance.oneParametersCacheableMethod(0);
|
||||||
|
testClassInstance.oneParametersCacheableMethod(1);
|
||||||
|
|
||||||
|
expect(spyFn.mock.calls.length).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Cache must be used when method is called second time with same parameter. Stored value must be correct.', () => {
|
||||||
|
const spyFn = fn();
|
||||||
|
const additionSeed = 1;
|
||||||
|
const firstCallParameter = 2;
|
||||||
|
const secondCallParameter = 3;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache
|
||||||
|
public oneParametersCacheableMethod(parameter: number) {
|
||||||
|
spyFn();
|
||||||
|
return additionSeed + parameter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallResult = testClassInstance.oneParametersCacheableMethod(firstCallParameter);
|
||||||
|
const secondCallResult =
|
||||||
|
testClassInstance.oneParametersCacheableMethod(secondCallParameter);
|
||||||
|
const spyCallsAfterSecondTimeMethodCall = spyFn.mock.calls.length;
|
||||||
|
const thirdCallResult = testClassInstance.oneParametersCacheableMethod(firstCallParameter);
|
||||||
|
const spyCallsAfterThirdTimeMethodCall = spyFn.mock.calls.length;
|
||||||
|
|
||||||
|
expect(spyCallsAfterSecondTimeMethodCall).toBe(2);
|
||||||
|
expect(spyCallsAfterThirdTimeMethodCall).toBe(2);
|
||||||
|
expect(firstCallResult).toBe(additionSeed + firstCallParameter);
|
||||||
|
expect(secondCallResult).toBe(additionSeed + secondCallParameter);
|
||||||
|
expect(thirdCallResult).toBe(firstCallResult);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Cache decorator must works with async functions.', async () => {
|
||||||
|
const spyFn = fn();
|
||||||
|
const promise = new JestMockPromise();
|
||||||
|
|
||||||
|
const returnedValue = 1;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache
|
||||||
|
public async asyncCacheableMethod() {
|
||||||
|
spyFn();
|
||||||
|
await promise;
|
||||||
|
return returnedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallPromise = testClassInstance.asyncCacheableMethod();
|
||||||
|
const secondCallPromise = testClassInstance.asyncCacheableMethod();
|
||||||
|
promise.resolve();
|
||||||
|
|
||||||
|
const firstCallResult = await firstCallPromise;
|
||||||
|
const secondCallResult = await secondCallPromise;
|
||||||
|
|
||||||
|
expect(firstCallResult).toBe(returnedValue);
|
||||||
|
expect(secondCallResult).toBe(returnedValue);
|
||||||
|
expect(spyFn.mock.calls.length).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Cache decorator must works with async function which resolves before second call.', async () => {
|
||||||
|
const spyFn = fn();
|
||||||
|
const promise = new JestMockPromise();
|
||||||
|
|
||||||
|
const returnedValue = 1;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache
|
||||||
|
public async asyncCacheableMethod() {
|
||||||
|
spyFn();
|
||||||
|
await promise;
|
||||||
|
return returnedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallPromise = testClassInstance.asyncCacheableMethod();
|
||||||
|
promise.resolve();
|
||||||
|
const secondCallPromise = testClassInstance.asyncCacheableMethod();
|
||||||
|
|
||||||
|
const firstCallResult = await firstCallPromise;
|
||||||
|
const secondCallResult = await secondCallPromise;
|
||||||
|
|
||||||
|
expect(firstCallResult).toBe(returnedValue);
|
||||||
|
expect(secondCallResult).toBe(returnedValue);
|
||||||
|
expect(spyFn.mock.calls.length).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Cache must be used when async method is called second time with same parameter. Stored value must be correct.', async () => {
|
||||||
|
const spyFn = fn();
|
||||||
|
const promise = new JestMockPromise();
|
||||||
|
const additionSeed = 1;
|
||||||
|
const firstCallParameter = 2;
|
||||||
|
const secondCallParameter = 3;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache
|
||||||
|
public async oneParametersAsyncCacheableMethod(parameter: number) {
|
||||||
|
spyFn();
|
||||||
|
const additionSeedValue = await promise;
|
||||||
|
return additionSeedValue + parameter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallPromise =
|
||||||
|
testClassInstance.oneParametersAsyncCacheableMethod(firstCallParameter);
|
||||||
|
const secondCallPromise =
|
||||||
|
testClassInstance.oneParametersAsyncCacheableMethod(secondCallParameter);
|
||||||
|
const spyCallsAfterSecondTimeMethodCall = spyFn.mock.calls.length;
|
||||||
|
const thirdCallPromise =
|
||||||
|
testClassInstance.oneParametersAsyncCacheableMethod(firstCallParameter);
|
||||||
|
const spyCallsAfterThirdTimeMethodCall = spyFn.mock.calls.length;
|
||||||
|
promise.resolve(additionSeed);
|
||||||
|
|
||||||
|
const firstCallResult = await firstCallPromise;
|
||||||
|
const secondCallResult = await secondCallPromise;
|
||||||
|
const thirdCallResult = await thirdCallPromise;
|
||||||
|
|
||||||
|
expect(spyCallsAfterSecondTimeMethodCall).toBe(2);
|
||||||
|
expect(spyCallsAfterThirdTimeMethodCall).toBe(2);
|
||||||
|
expect(firstCallResult).toBe(additionSeed + firstCallParameter);
|
||||||
|
expect(secondCallResult).toBe(additionSeed + secondCallParameter);
|
||||||
|
expect(thirdCallResult).toBe(firstCallResult);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Cache decorator must works with getters.', () => {
|
||||||
|
const spyFn = fn();
|
||||||
|
const returnedValue = 1;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache
|
||||||
|
public get cacheableGetter(): number {
|
||||||
|
spyFn();
|
||||||
|
return returnedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallResult = testClassInstance.cacheableGetter;
|
||||||
|
const secondCallResult = testClassInstance.cacheableGetter;
|
||||||
|
|
||||||
|
expect(spyFn.mock.calls.length).toBe(1);
|
||||||
|
expect(firstCallResult).toBe(returnedValue);
|
||||||
|
expect(secondCallResult).toBe(returnedValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Cached value must be used before maxAge time is not up. ', () => {
|
||||||
|
jest.useFakeTimers().setSystemTime(0);
|
||||||
|
const spyFn = fn();
|
||||||
|
const returnedValue = 1;
|
||||||
|
const maxAge = 10;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache({ maxAge })
|
||||||
|
public cacheableMethod(): number {
|
||||||
|
spyFn();
|
||||||
|
return returnedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallResult = testClassInstance.cacheableMethod();
|
||||||
|
jest.useFakeTimers().setSystemTime(maxAge - 1);
|
||||||
|
const secondCallResult = testClassInstance.cacheableMethod();
|
||||||
|
|
||||||
|
expect(spyFn.mock.calls.length).toBe(1);
|
||||||
|
expect(firstCallResult).toBe(returnedValue);
|
||||||
|
expect(secondCallResult).toBe(returnedValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Cached value must not be used after maxAge time is up.', () => {
|
||||||
|
jest.useFakeTimers().setSystemTime(0);
|
||||||
|
const spyFn = fn();
|
||||||
|
const returnedValue = 1;
|
||||||
|
const maxAge = 10;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache({ maxAge })
|
||||||
|
public cacheableMethod(): number {
|
||||||
|
spyFn();
|
||||||
|
return returnedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallResult = testClassInstance.cacheableMethod();
|
||||||
|
jest.useFakeTimers().setSystemTime(maxAge + 1);
|
||||||
|
const secondCallResult = testClassInstance.cacheableMethod();
|
||||||
|
|
||||||
|
expect(spyFn.mock.calls.length).toBe(2);
|
||||||
|
expect(firstCallResult).toBe(returnedValue);
|
||||||
|
expect(secondCallResult).toBe(returnedValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Cached value must be used in async function before maxAge time is up but even if first promise has not resolved yet.', async () => {
|
||||||
|
jest.useFakeTimers().setSystemTime(0);
|
||||||
|
const spyFn = fn();
|
||||||
|
const promise = new JestMockPromise();
|
||||||
|
const returnedValue = 1;
|
||||||
|
const maxAge = 10;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache({ maxAge: 10 })
|
||||||
|
public async cacheableMethod(): Promise<number> {
|
||||||
|
spyFn();
|
||||||
|
await promise;
|
||||||
|
return returnedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallPromise = testClassInstance.cacheableMethod();
|
||||||
|
jest.useFakeTimers().setSystemTime(maxAge - 1);
|
||||||
|
const secondCallPromise = testClassInstance.cacheableMethod();
|
||||||
|
promise.resolve();
|
||||||
|
const firstCallResult = await firstCallPromise;
|
||||||
|
const secondCallResult = await secondCallPromise;
|
||||||
|
|
||||||
|
expect(spyFn.mock.calls.length).toBe(1);
|
||||||
|
expect(firstCallResult).toBe(returnedValue);
|
||||||
|
expect(secondCallResult).toBe(returnedValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Cached value must not be used in async function after maxAge time is up but even if first promise has not resolved yet.', async () => {
|
||||||
|
jest.useFakeTimers().setSystemTime(0);
|
||||||
|
const spyFn = fn();
|
||||||
|
const promise = new JestMockPromise();
|
||||||
|
const returnedValue = 1;
|
||||||
|
const maxAge = 10;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache({ maxAge: 10 })
|
||||||
|
public async cacheableMethod(): Promise<number> {
|
||||||
|
spyFn();
|
||||||
|
await promise;
|
||||||
|
return returnedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallPromise = testClassInstance.cacheableMethod();
|
||||||
|
jest.useFakeTimers().setSystemTime(maxAge + 1);
|
||||||
|
const secondCallPromise = testClassInstance.cacheableMethod();
|
||||||
|
promise.resolve();
|
||||||
|
const firstCallResult = await firstCallPromise;
|
||||||
|
const secondCallResult = await secondCallPromise;
|
||||||
|
|
||||||
|
expect(spyFn.mock.calls.length).toBe(2);
|
||||||
|
expect(firstCallResult).toBe(returnedValue);
|
||||||
|
expect(secondCallResult).toBe(returnedValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Conditional cache must not be saved if flag is passed.', () => {
|
||||||
|
const spyFn = fn();
|
||||||
|
const returnedValue = 1;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache({ conditionalCache: true })
|
||||||
|
public conditionalCacheableMethod() {
|
||||||
|
spyFn();
|
||||||
|
return {
|
||||||
|
notSave: true,
|
||||||
|
value: returnedValue
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallResult = testClassInstance.conditionalCacheableMethod();
|
||||||
|
const secondCallResult = testClassInstance.conditionalCacheableMethod();
|
||||||
|
|
||||||
|
expect(spyFn.mock.calls.length).toBe(2);
|
||||||
|
expect(firstCallResult).toBe(returnedValue);
|
||||||
|
expect(secondCallResult).toBe(returnedValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Conditional cache must be saved if flag is not passed.', () => {
|
||||||
|
const spyFn = fn();
|
||||||
|
const returnedValue = 1;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache({ conditionalCache: true })
|
||||||
|
public conditionalCacheableMethod() {
|
||||||
|
spyFn();
|
||||||
|
return {
|
||||||
|
notSave: false,
|
||||||
|
value: returnedValue
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallResult = testClassInstance.conditionalCacheableMethod();
|
||||||
|
const secondCallResult = testClassInstance.conditionalCacheableMethod();
|
||||||
|
|
||||||
|
expect(spyFn.mock.calls.length).toBe(1);
|
||||||
|
expect(firstCallResult).toBe(returnedValue);
|
||||||
|
expect(secondCallResult).toBe(returnedValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Conditional cache must be saved if flag is not passed in async method.', async () => {
|
||||||
|
const spyFn = fn();
|
||||||
|
const promise = new JestMockPromise();
|
||||||
|
const returnedValue = 1;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache({ conditionalCache: true })
|
||||||
|
public async conditionalAsyncCacheableMethod() {
|
||||||
|
spyFn();
|
||||||
|
await promise;
|
||||||
|
return {
|
||||||
|
notSave: false,
|
||||||
|
value: returnedValue
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallPromise = testClassInstance.conditionalAsyncCacheableMethod();
|
||||||
|
promise.resolve();
|
||||||
|
const secondCallPromise = testClassInstance.conditionalAsyncCacheableMethod();
|
||||||
|
const firstCallResult = await firstCallPromise;
|
||||||
|
const secondCallResult = await secondCallPromise;
|
||||||
|
|
||||||
|
expect(spyFn.mock.calls.length).toBe(1);
|
||||||
|
expect(firstCallResult).toBe(returnedValue);
|
||||||
|
expect(secondCallResult).toBe(returnedValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Conditional cache must be saved before async method resolves, but must not be saved after promise resolving if fleg is passed.', async () => {
|
||||||
|
const spyFn = fn();
|
||||||
|
const promise = new JestMockPromise();
|
||||||
|
const returnedValue = 1;
|
||||||
|
class CacheTestClass {
|
||||||
|
@Cache({ conditionalCache: true })
|
||||||
|
public async conditionalAsyncCacheableMethod() {
|
||||||
|
spyFn();
|
||||||
|
await promise;
|
||||||
|
return {
|
||||||
|
notSave: true,
|
||||||
|
value: returnedValue
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const testClassInstance = new CacheTestClass();
|
||||||
|
const firstCallPromise = testClassInstance.conditionalAsyncCacheableMethod();
|
||||||
|
const secondCallPromise = testClassInstance.conditionalAsyncCacheableMethod();
|
||||||
|
const spyCallsNumberAfterSecondMethodCall = spyFn.mock.calls.length;
|
||||||
|
promise.resolve();
|
||||||
|
const firstCallResult = await firstCallPromise;
|
||||||
|
const secondCallResult = await secondCallPromise;
|
||||||
|
|
||||||
|
const thirdCallPromise = testClassInstance.conditionalAsyncCacheableMethod();
|
||||||
|
const spyCallsNumberAfterThirdMethodCall = spyFn.mock.calls.length;
|
||||||
|
promise.resolve();
|
||||||
|
const thirdCallResult = await thirdCallPromise;
|
||||||
|
|
||||||
|
expect(spyCallsNumberAfterSecondMethodCall).toBe(1);
|
||||||
|
expect(spyCallsNumberAfterThirdMethodCall).toBe(2);
|
||||||
|
expect(firstCallResult).toBe(returnedValue);
|
||||||
|
expect(secondCallResult).toBe(returnedValue);
|
||||||
|
expect(thirdCallResult).toBe(returnedValue);
|
||||||
|
});
|
||||||
|
});
|
137
SDK-mstr/__tests__/unit-tests/common/utils/p-timeout.spec.ts
Normal file
137
SDK-mstr/__tests__/unit-tests/common/utils/p-timeout.spec.ts
Normal file
|
@ -0,0 +1,137 @@
|
||||||
|
import { TimeoutError } from 'src/common/errors';
|
||||||
|
import CancelablePromise from 'cancelable-promise';
|
||||||
|
import pTimeout from 'src/common/utils/p-timeout';
|
||||||
|
import delay from 'delay';
|
||||||
|
import fn = jest.fn;
|
||||||
|
|
||||||
|
describe('p-timeout tests', () => {
|
||||||
|
const expected = Symbol('expected');
|
||||||
|
const expectedError = new Error('expectedError');
|
||||||
|
|
||||||
|
const smallTimeout = 50;
|
||||||
|
const bigTimeout = 200;
|
||||||
|
|
||||||
|
test('Resolves before timeout', async () => {
|
||||||
|
const result = await pTimeout(
|
||||||
|
delay(smallTimeout).then(() => expected),
|
||||||
|
bigTimeout
|
||||||
|
);
|
||||||
|
expect(result).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Resolves after timeout', async () => {
|
||||||
|
await expect(pTimeout(delay(bigTimeout), smallTimeout)).rejects.toThrow(
|
||||||
|
new TimeoutError(`Promise timed out after ${smallTimeout} milliseconds`)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Throws when milliseconds is negative number', async () => {
|
||||||
|
const milliseconds = -1;
|
||||||
|
await expect(pTimeout(delay(smallTimeout), milliseconds)).rejects.toThrow(
|
||||||
|
`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Throws when milliseconds is NaN', async () => {
|
||||||
|
const milliseconds = NaN;
|
||||||
|
await expect(pTimeout(delay(smallTimeout), milliseconds)).rejects.toThrow(
|
||||||
|
`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Handles milliseconds being `Infinity`', async () => {
|
||||||
|
const result = await pTimeout(
|
||||||
|
delay(smallTimeout).then(() => expected),
|
||||||
|
+Infinity
|
||||||
|
);
|
||||||
|
expect(result).toBe(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Rejects after timeout', async () => {
|
||||||
|
await expect(
|
||||||
|
pTimeout(
|
||||||
|
delay(bigTimeout).then(() => expected),
|
||||||
|
smallTimeout
|
||||||
|
)
|
||||||
|
).rejects.toThrow(new TimeoutError(`Promise timed out after ${smallTimeout} milliseconds`));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Rejects before timeout if specified promise rejects', async () => {
|
||||||
|
await expect(
|
||||||
|
pTimeout(
|
||||||
|
delay(smallTimeout).then(() => Promise.reject(expectedError)),
|
||||||
|
bigTimeout
|
||||||
|
)
|
||||||
|
).rejects.toThrow(expectedError);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Fallback argument', async () => {
|
||||||
|
await expect(pTimeout(delay(bigTimeout), smallTimeout, 'error message')).rejects.toThrow(
|
||||||
|
'error message'
|
||||||
|
);
|
||||||
|
await expect(
|
||||||
|
pTimeout(delay(bigTimeout), smallTimeout, new RangeError('error message'))
|
||||||
|
).rejects.toThrow(new RangeError('error message'));
|
||||||
|
await expect(
|
||||||
|
pTimeout(delay(bigTimeout), smallTimeout, () => Promise.reject(expectedError))
|
||||||
|
).rejects.toThrow(expectedError);
|
||||||
|
await expect(
|
||||||
|
pTimeout(delay(bigTimeout), smallTimeout, () => {
|
||||||
|
throw new RangeError('error message');
|
||||||
|
})
|
||||||
|
).rejects.toThrow(new RangeError('error message'));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Calls `.cancel()` on promise when it exists', async () => {
|
||||||
|
const callSpy = fn();
|
||||||
|
|
||||||
|
const promise = new CancelablePromise<void>(async (resolve, _, onCancel) => {
|
||||||
|
onCancel(() => {
|
||||||
|
callSpy();
|
||||||
|
});
|
||||||
|
|
||||||
|
await delay(bigTimeout);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
|
||||||
|
await expect(pTimeout(promise, smallTimeout)).rejects.toThrow(
|
||||||
|
new TimeoutError(`Promise timed out after ${smallTimeout} milliseconds`)
|
||||||
|
);
|
||||||
|
expect(promise.isCanceled).toBeTruthy();
|
||||||
|
expect(callSpy.mock.calls.length).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Accepts `customTimers` option', async () => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
const setTimeoutSpy = fn((_: number | undefined) => {});
|
||||||
|
const clearTimeoutSpy = fn();
|
||||||
|
|
||||||
|
await pTimeout(delay(smallTimeout), bigTimeout, undefined, {
|
||||||
|
customTimers: {
|
||||||
|
setTimeout: function (handler: () => void, timeout?: number) {
|
||||||
|
setTimeoutSpy(timeout);
|
||||||
|
return setTimeout(handler as unknown as () => void, timeout || 1000);
|
||||||
|
} as typeof setTimeout,
|
||||||
|
clearTimeout(timeoutId) {
|
||||||
|
clearTimeoutSpy();
|
||||||
|
return clearTimeout(timeoutId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(setTimeoutSpy.mock.calls.length).toBe(1);
|
||||||
|
expect(setTimeoutSpy.mock.calls[0]).toEqual([bigTimeout]);
|
||||||
|
expect(clearTimeoutSpy.mock.calls.length).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('`.clear()` method', async () => {
|
||||||
|
const promise = pTimeout(
|
||||||
|
delay(bigTimeout).then(() => expected),
|
||||||
|
smallTimeout
|
||||||
|
);
|
||||||
|
promise.clear();
|
||||||
|
|
||||||
|
const result = await promise;
|
||||||
|
expect(result).toBe(expected);
|
||||||
|
});
|
||||||
|
});
|
12
SDK-mstr/__tests__/unit-tests/core/sdk/sdk.spec.ts
Normal file
12
SDK-mstr/__tests__/unit-tests/core/sdk/sdk.spec.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { SDK } from 'src/core/sdk/sdk';
|
||||||
|
import { freeRpc } from '__tests__/utils/constants/free-rpc';
|
||||||
|
import { Configuration } from 'src/core/sdk/models/configuration';
|
||||||
|
|
||||||
|
describe('Common SDK tests', () => {
|
||||||
|
const minimalConfig: Configuration = { rpcProviders: freeRpc };
|
||||||
|
|
||||||
|
test('Should create sdk instance', async () => {
|
||||||
|
const sdk = await SDK.createSDK(minimalConfig);
|
||||||
|
expect(typeof sdk).toBe('object');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { JoeProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/avalanche/joe/joe-provider';
|
||||||
|
import { JoeTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/avalanche/joe/joe-trade';
|
||||||
|
import { JOE_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/avalanche/joe/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const joeAvalancheProviderSpec = () => {
|
||||||
|
describe('Joe provider tests', () => {
|
||||||
|
let joeProvider: JoeProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
joeProvider = new JoeProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(joeProvider.blockchain).toBe(BLOCKCHAIN_NAME.AVALANCHE);
|
||||||
|
expect(typeof joeProvider.UniswapV2TradeClass).toBe(typeof JoeTrade);
|
||||||
|
expect(joeProvider.providerSettings).toBe(JOE_PROVIDER_CONFIGURATION);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { PangolinProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/avalanche/pangolin/pangolin-provider';
|
||||||
|
import { PangolinTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/avalanche/pangolin/pangolin-trade';
|
||||||
|
import { PANGOLIN_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/avalanche/pangolin/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const pangolinAvalancheProviderSpec = () => {
|
||||||
|
describe('Pangolin provider tests', () => {
|
||||||
|
let pangolinProvider: PangolinProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
pangolinProvider = new PangolinProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(pangolinProvider.blockchain).toBe(BLOCKCHAIN_NAME.AVALANCHE);
|
||||||
|
expect(typeof pangolinProvider.UniswapV2TradeClass).toBe(typeof PangolinTrade);
|
||||||
|
expect(pangolinProvider.providerSettings).toBe(PANGOLIN_PROVIDER_CONFIGURATION);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { SushiSwapAvalancheProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/avalanche/sushi-swap-avalanche/sushi-swap-avalanche-provider';
|
||||||
|
import { SushiSwapAvalancheTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/avalanche/sushi-swap-avalanche/sushi-swap-avalanche-trade';
|
||||||
|
import { SUSHI_SWAP_AVALANCHE_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/avalanche/sushi-swap-avalanche/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const sushiSwapAvalancheProviderSpec = () => {
|
||||||
|
describe('SushiSwap provider tests', () => {
|
||||||
|
let sushiSwapProvider: SushiSwapAvalancheProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
sushiSwapProvider = new SushiSwapAvalancheProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(sushiSwapProvider.blockchain).toBe(BLOCKCHAIN_NAME.AVALANCHE);
|
||||||
|
expect(typeof sushiSwapProvider.UniswapV2TradeClass).toBe(
|
||||||
|
typeof SushiSwapAvalancheTrade
|
||||||
|
);
|
||||||
|
expect(sushiSwapProvider.providerSettings).toBe(
|
||||||
|
SUSHI_SWAP_AVALANCHE_PROVIDER_CONFIGURATION
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { TRADE_TYPE } from 'src/features';
|
||||||
|
import { OneinchBscProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/bsc/oneinch-bsc/oneinch-bsc-provider';
|
||||||
|
import { mockEmptyInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const oneinchBscProviderSpec = () => {
|
||||||
|
let oneinchProvider: OneinchBscProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
mockEmptyInjector();
|
||||||
|
oneinchProvider = new OneinchBscProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('', () => {
|
||||||
|
expect(oneinchProvider.type).toBe(TRADE_TYPE.ONE_INCH_BSC);
|
||||||
|
expect(oneinchProvider.blockchain).toBe(BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { PancakeSwapProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/bsc/pancake-swap/pancake-swap-provider';
|
||||||
|
import { PancakeSwapTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/bsc/pancake-swap/pancake-swap-trade';
|
||||||
|
import { PANCAKE_SWAP_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/bsc/pancake-swap/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const pancakeSwapBscProviderSpec = () => {
|
||||||
|
let pancakeSwapProvider: PancakeSwapProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
pancakeSwapProvider = new PancakeSwapProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(pancakeSwapProvider.blockchain).toBe(BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN);
|
||||||
|
expect(typeof pancakeSwapProvider.UniswapV2TradeClass).toBe(typeof PancakeSwapTrade);
|
||||||
|
expect(pancakeSwapProvider.providerSettings).toBe(PANCAKE_SWAP_PROVIDER_CONFIGURATION);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { SushiSwapBscProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/bsc/sushi-swap-bsc/sushi-swap-bsc-provider';
|
||||||
|
import { SushiSwapBscTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/bsc/sushi-swap-bsc/sushi-swap-bsc-trade';
|
||||||
|
import { SUSHI_SWAP_BSC_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/bsc/sushi-swap-bsc/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const sushiSwapBscProviderSpec = () => {
|
||||||
|
let sushiSwapBscProvider: SushiSwapBscProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
sushiSwapBscProvider = new SushiSwapBscProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(sushiSwapBscProvider.blockchain).toBe(BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN);
|
||||||
|
expect(typeof sushiSwapBscProvider.UniswapV2TradeClass).toBe(typeof SushiSwapBscTrade);
|
||||||
|
expect(sushiSwapBscProvider.providerSettings).toBe(SUSHI_SWAP_BSC_PROVIDER_CONFIGURATION);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { TRADE_TYPE } from 'src/features';
|
||||||
|
import { OneinchEthereumProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/ethereum/oneinch-ethereum/oneinch-ethereum-provider';
|
||||||
|
import { mockEmptyInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const oneinchProviderEthereumSpec = () => {
|
||||||
|
let oneinchProvider: OneinchEthereumProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
mockEmptyInjector();
|
||||||
|
oneinchProvider = new OneinchEthereumProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(oneinchProvider.type).toBe(TRADE_TYPE.ONE_INCH_ETHEREUM);
|
||||||
|
expect(oneinchProvider.blockchain).toBe(BLOCKCHAIN_NAME.ETHEREUM);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { SushiSwapEthereumProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/ethereum/sushi-swap-ethereum/sushi-swap-ethereum-provider';
|
||||||
|
import { SUSHI_SWAP_ETHEREUM_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/ethereum/sushi-swap-ethereum/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const sushiSwapProviderEthereumSpec = () => {
|
||||||
|
let sushiSwapProvider: SushiSwapEthereumProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
sushiSwapProvider = new SushiSwapEthereumProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(sushiSwapProvider.blockchain).toBe(BLOCKCHAIN_NAME.ETHEREUM);
|
||||||
|
expect(typeof sushiSwapProvider.UniswapV2TradeClass).toBe(typeof SushiSwapEthereumProvider);
|
||||||
|
expect(sushiSwapProvider.providerSettings).toBe(SUSHI_SWAP_ETHEREUM_PROVIDER_CONFIGURATION);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,92 @@
|
||||||
|
import { Chain } from '__tests__/utils/chain';
|
||||||
|
import { mockInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { TOKENS as ALL_TOKENS } from '__tests__/utils/tokens';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { PriceTokenAmount } from 'src/common/tokens/price-token-amount';
|
||||||
|
import { PriceToken } from 'src/common/tokens/price-token';
|
||||||
|
import { UniSwapV2EthereumProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v2-ethereum/uni-swap-v2-ethereum-provider';
|
||||||
|
import { UniSwapV2EthereumTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v2-ethereum/uni-swap-v2-ethereum-trade';
|
||||||
|
import { UNISWAP_V2_ETHEREUM_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v2-ethereum/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
const TOKENS = ALL_TOKENS[BLOCKCHAIN_NAME.ETHEREUM];
|
||||||
|
|
||||||
|
export const uniswapV2ProviderSpec = () =>
|
||||||
|
describe('Uniswap V2 provider tests', () => {
|
||||||
|
let uniswapV2Provider: UniSwapV2EthereumProvider;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
uniswapV2Provider = new UniSwapV2EthereumProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const chain = await Chain.reset(BLOCKCHAIN_NAME.ETHEREUM);
|
||||||
|
const configuration = await chain.getConfiguration();
|
||||||
|
await mockInjector(configuration);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(uniswapV2Provider.blockchain).toBe(BLOCKCHAIN_NAME.ETHEREUM);
|
||||||
|
expect(typeof uniswapV2Provider.UniswapV2TradeClass).toBe(
|
||||||
|
typeof UniSwapV2EthereumTrade
|
||||||
|
);
|
||||||
|
expect(uniswapV2Provider.providerSettings).toBe(
|
||||||
|
UNISWAP_V2_ETHEREUM_PROVIDER_CONFIGURATION
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Must calculate correct NATIVE-ERC20 trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = 3173.460947; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.ETH,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDT);
|
||||||
|
|
||||||
|
const trade = await uniswapV2Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.ETH.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.USDT.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-NATIVE trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '0.000313213011396446'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.ETH);
|
||||||
|
|
||||||
|
const trade = await uniswapV2Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.USDT.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.ETH.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-ERC20 trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '4.557092512974888195'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.RBC);
|
||||||
|
|
||||||
|
const trade = await uniswapV2Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.USDT.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.WETH.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.RBC.address);
|
||||||
|
}, 400_000);
|
||||||
|
});
|
|
@ -0,0 +1,166 @@
|
||||||
|
import { Chain } from '__tests__/utils/chain';
|
||||||
|
import { mockInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { TOKENS as ALL_TOKENS } from '__tests__/utils/tokens';
|
||||||
|
import { Injector } from 'src/core/injector/injector';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { Web3Public } from 'src/core';
|
||||||
|
import { PriceTokenAmount } from 'src/common/tokens/price-token-amount';
|
||||||
|
import { PriceToken } from 'src/common/tokens/price-token';
|
||||||
|
import { TransactionReceipt } from 'web3-eth';
|
||||||
|
import { UniSwapV2EthereumProvider } from '@rsdk-features/instant-trades/dexes/ethereum/uni-swap-v2-ethereum/uni-swap-v2-ethereum-provider';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
import fn = jest.fn;
|
||||||
|
|
||||||
|
const TOKENS = ALL_TOKENS[BLOCKCHAIN_NAME.ETHEREUM];
|
||||||
|
|
||||||
|
export const uniswapV2TradeSpec = () =>
|
||||||
|
describe('Uniswap V2 trade tests.', () => {
|
||||||
|
let chain: Chain;
|
||||||
|
let uniswapV2Provider: UniSwapV2EthereumProvider;
|
||||||
|
let web3Public: Web3Public;
|
||||||
|
let userAddress: string;
|
||||||
|
|
||||||
|
const getTransactionFeeByReceipt = async (
|
||||||
|
transactionReceipt: TransactionReceipt
|
||||||
|
): Promise<BigNumber> => {
|
||||||
|
const transaction = (await web3Public.getTransactionByHash(
|
||||||
|
transactionReceipt.transactionHash
|
||||||
|
))!;
|
||||||
|
return new BigNumber(transactionReceipt.gasUsed).multipliedBy(transaction.gasPrice);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getTransactionFeeByHash = async (transactionHash: string): Promise<BigNumber> => {
|
||||||
|
const transaction = (await web3Public.getTransactionByHash(transactionHash))!;
|
||||||
|
const transactionReceipt = (await chain.web3.eth.getTransactionReceipt(
|
||||||
|
transactionHash
|
||||||
|
))!;
|
||||||
|
return new BigNumber(transactionReceipt.gasUsed).multipliedBy(transaction.gasPrice);
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
uniswapV2Provider = new UniSwapV2EthereumProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
chain = await Chain.reset(BLOCKCHAIN_NAME.ETHEREUM);
|
||||||
|
const configuration = await chain.getConfiguration();
|
||||||
|
await mockInjector(configuration);
|
||||||
|
web3Public = Injector.web3PublicService.getWeb3Public(BLOCKCHAIN_NAME.ETHEREUM);
|
||||||
|
userAddress = Injector.web3PrivateService.address;
|
||||||
|
}, 20_000);
|
||||||
|
|
||||||
|
test('Swap method must works with NATIVE-ERC20 trade', async () => {
|
||||||
|
const ethTokenAmountToSwap = 1;
|
||||||
|
const expectedToTokensAmount = 3173.460947; // constant data about tokens rate in 13961175 block
|
||||||
|
const ethBalanceBefore = await web3Public.getBalance(userAddress);
|
||||||
|
const usdtBalanceBefore = await web3Public.getBalance(userAddress, TOKENS.USDT.address);
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.ETH,
|
||||||
|
tokenAmount: new BigNumber(ethTokenAmountToSwap)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDT);
|
||||||
|
|
||||||
|
const trade = await uniswapV2Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
const transactionReceipt = await trade.swap();
|
||||||
|
const ethBalanceAfter = await web3Public.getBalance(userAddress);
|
||||||
|
const usdtBalanceAfter = await web3Public.getBalance(userAddress, TOKENS.USDT.address);
|
||||||
|
const transactionFee = await getTransactionFeeByReceipt(transactionReceipt);
|
||||||
|
|
||||||
|
expect(transactionReceipt.status).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
ethBalanceAfter.isEqualTo(
|
||||||
|
ethBalanceBefore
|
||||||
|
.minus(ethTokenAmountToSwap * 10 ** TOKENS.ETH.decimals)
|
||||||
|
.minus(transactionFee)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
usdtBalanceAfter.isEqualTo(
|
||||||
|
usdtBalanceBefore.plus(expectedToTokensAmount * 10 ** TOKENS.USDT.decimals)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
|
const trade1 = await uniswapV2Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
expect(trade1.to.weiAmount.isEqualTo(trade.to.weiAmount)).not.toBeTruthy();
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Swap method must works with ERC20-NATIVE trade', async () => {
|
||||||
|
const rbcTokenAmountToSwap = 1;
|
||||||
|
const expectedToTokensAmount = '0.000068319082745321'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.RBC,
|
||||||
|
tokenAmount: new BigNumber(rbcTokenAmountToSwap)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.ETH);
|
||||||
|
await chain.increaseTokensBalance(from, rbcTokenAmountToSwap, { inEtherUnits: true });
|
||||||
|
const rbcBalanceBefore = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const ethBalanceBefore = await web3Public.getBalance(userAddress);
|
||||||
|
let approveTxHash = '';
|
||||||
|
|
||||||
|
const onApprove = fn(hash => (approveTxHash = hash));
|
||||||
|
const trade = await uniswapV2Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
const transactionReceipt = await trade.swap({ onApprove });
|
||||||
|
const rbcBalanceAfter = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const ethBalanceAfter = await web3Public.getBalance(userAddress);
|
||||||
|
const approveTransactionFee = await getTransactionFeeByHash(approveTxHash);
|
||||||
|
const transactionFee = await getTransactionFeeByReceipt(transactionReceipt);
|
||||||
|
|
||||||
|
expect(transactionReceipt.status).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
rbcBalanceAfter.isEqualTo(
|
||||||
|
rbcBalanceBefore.minus(rbcTokenAmountToSwap * 10 ** from.decimals)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
ethBalanceAfter.isEqualTo(
|
||||||
|
ethBalanceBefore
|
||||||
|
.plus(new BigNumber(expectedToTokensAmount).multipliedBy(10 ** to.decimals))
|
||||||
|
.minus(approveTransactionFee)
|
||||||
|
.minus(transactionFee)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
expect(onApprove.mock.calls.length).toBe(1);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Swap method must works with ERC20-ERC20 trade', async () => {
|
||||||
|
const rbcTokenAmountToSwap = 1;
|
||||||
|
const expectedToTokensAmount = '0.216816'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.RBC,
|
||||||
|
tokenAmount: new BigNumber(rbcTokenAmountToSwap)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDT);
|
||||||
|
await chain.increaseTokensBalance(from, rbcTokenAmountToSwap, { inEtherUnits: true });
|
||||||
|
const rbcBalanceBefore = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const usdtBalanceBefore = await web3Public.getBalance(userAddress, to.address);
|
||||||
|
|
||||||
|
const trade = await uniswapV2Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
const transactionReceipt = await trade.swap();
|
||||||
|
const rbcBalanceAfter = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const usdtBalanceAfter = await web3Public.getBalance(userAddress, to.address);
|
||||||
|
|
||||||
|
expect(transactionReceipt.status).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
rbcBalanceAfter.isEqualTo(
|
||||||
|
rbcBalanceBefore.minus(rbcTokenAmountToSwap * 10 ** from.decimals)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
usdtBalanceAfter.isEqualTo(
|
||||||
|
usdtBalanceBefore.plus(
|
||||||
|
new BigNumber(expectedToTokensAmount).multipliedBy(10 ** to.decimals)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
}, 400_000);
|
||||||
|
});
|
|
@ -0,0 +1,94 @@
|
||||||
|
import { Chain } from '__tests__/utils/chain';
|
||||||
|
import { mockInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { TOKENS as ALL_TOKENS } from '__tests__/utils/tokens';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { PriceTokenAmount } from 'src/common/tokens/price-token-amount';
|
||||||
|
import { PriceToken } from 'src/common/tokens/price-token';
|
||||||
|
import { UniSwapV3EthereumTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v3-ethereum/uni-swap-v3-ethereum-trade';
|
||||||
|
import { UNI_SWAP_V3_ETHEREUM_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v3-ethereum/constants/provider-configuration';
|
||||||
|
import { UNI_SWAP_V3_ETHEREUM_ROUTER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v3-ethereum/constants/router-configuration';
|
||||||
|
import { UniSwapV3EthereumProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v3-ethereum/uni-swap-v3-ethereum-provider';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
const TOKENS = ALL_TOKENS[BLOCKCHAIN_NAME.ETHEREUM];
|
||||||
|
|
||||||
|
export const uniswapV3EthProviderSpec = () =>
|
||||||
|
describe('UnisSwap V3 Ethereum provider tests', () => {
|
||||||
|
let uniswapV3Provider: UniSwapV3EthereumProvider;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
uniswapV3Provider = new UniSwapV3EthereumProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const chain = await Chain.reset(BLOCKCHAIN_NAME.ETHEREUM);
|
||||||
|
const configuration = await chain.getConfiguration();
|
||||||
|
await mockInjector(configuration);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(uniswapV3Provider.blockchain).toBe(BLOCKCHAIN_NAME.ETHEREUM);
|
||||||
|
expect(typeof uniswapV3Provider.OnChainTradeClass).toBe(typeof UniSwapV3EthereumTrade);
|
||||||
|
expect(uniswapV3Provider.providerConfiguration).toBe(
|
||||||
|
UNI_SWAP_V3_ETHEREUM_PROVIDER_CONFIGURATION
|
||||||
|
);
|
||||||
|
expect(uniswapV3Provider.routerConfiguration).toBe(
|
||||||
|
UNI_SWAP_V3_ETHEREUM_ROUTER_CONFIGURATION
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Must calculate correct NATIVE-ERC20 trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '3177.56875989798300356'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.ETH,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.DAI);
|
||||||
|
|
||||||
|
const trade = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.ETH.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.DAI.address);
|
||||||
|
}, 800_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-NATIVE trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '0.000314923189705958'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.ETH);
|
||||||
|
|
||||||
|
const trade = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.USDT.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.ETH.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-ERC20 trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '1.02692208070202167'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.DAI);
|
||||||
|
|
||||||
|
const trade = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.USDT.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.WBTC.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.DAI.address);
|
||||||
|
}, 400_000);
|
||||||
|
});
|
|
@ -0,0 +1,160 @@
|
||||||
|
import { Chain } from '__tests__/utils/chain';
|
||||||
|
import { mockInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { TOKENS as ALL_TOKENS } from '__tests__/utils/tokens';
|
||||||
|
import { Utils } from '__tests__/unit-tests/features/swap/utils/utils';
|
||||||
|
import { Injector } from 'src/core/injector/injector';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { EvmWeb3Public } from 'src/core/blockchain/web3-public-service/web3-public/evm-web3-public/evm-web3-public';
|
||||||
|
import { PriceTokenAmount } from 'src/common/tokens/price-token-amount';
|
||||||
|
import { PriceToken } from 'src/common/tokens/price-token';
|
||||||
|
import { UniSwapV3EthereumProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/ethereum/uni-swap-v3-ethereum/uni-swap-v3-ethereum-provider';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
import fn = jest.fn;
|
||||||
|
|
||||||
|
const TOKENS = ALL_TOKENS[BLOCKCHAIN_NAME.ETHEREUM];
|
||||||
|
|
||||||
|
export const uniswapV3EthTradeSpec = () =>
|
||||||
|
describe('UniSwap V3 Ethereum trade tests.', () => {
|
||||||
|
let chain: Chain;
|
||||||
|
let uniswapV3Provider: UniSwapV3EthereumProvider;
|
||||||
|
let web3Public: EvmWeb3Public;
|
||||||
|
let userAddress: string;
|
||||||
|
let utils: Utils;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
uniswapV3Provider = new UniSwapV3EthereumProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
chain = await Chain.reset(BLOCKCHAIN_NAME.ETHEREUM);
|
||||||
|
const configuration = await chain.getConfiguration();
|
||||||
|
await mockInjector(configuration);
|
||||||
|
web3Public = Injector.web3PublicService.getWeb3Public(BLOCKCHAIN_NAME.ETHEREUM);
|
||||||
|
userAddress = Injector.web3PrivateService.getWeb3PrivateByBlockchain(
|
||||||
|
BLOCKCHAIN_NAME.POLYGON
|
||||||
|
).address;
|
||||||
|
utils = new Utils(chain, web3Public);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Swap method must works with NATIVE-ERC20 trade', async () => {
|
||||||
|
const ethTokenAmountToSwap = 1;
|
||||||
|
const expectedToTokensAmount = '3177.56875989798300356'; // constant data about tokens rate in 13961175 block
|
||||||
|
const ethBalanceBefore = await web3Public.getBalance(userAddress);
|
||||||
|
const daiBalanceBefore = await web3Public.getBalance(userAddress, TOKENS.DAI.address);
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.ETH,
|
||||||
|
tokenAmount: new BigNumber(ethTokenAmountToSwap)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.DAI);
|
||||||
|
|
||||||
|
const trade = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
const transactionHash = await trade.swap();
|
||||||
|
const transactionReceipt = await web3Public.getTransactionReceipt(transactionHash);
|
||||||
|
const ethBalanceAfter = await web3Public.getBalance(userAddress);
|
||||||
|
const daiBalanceAfter = await web3Public.getBalance(userAddress, TOKENS.DAI.address);
|
||||||
|
const transactionFee = await utils.getTransactionFeeByReceipt(transactionReceipt);
|
||||||
|
|
||||||
|
expect(transactionReceipt.status).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
ethBalanceAfter.isEqualTo(
|
||||||
|
ethBalanceBefore
|
||||||
|
.minus(ethTokenAmountToSwap * 10 ** TOKENS.ETH.decimals)
|
||||||
|
.minus(transactionFee)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
daiBalanceAfter.isEqualTo(
|
||||||
|
daiBalanceBefore.plus(
|
||||||
|
new BigNumber(expectedToTokensAmount).multipliedBy(
|
||||||
|
10 ** TOKENS.DAI.decimals
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
|
const trade1 = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
expect(trade1.to.weiAmount.isEqualTo(trade.to.weiAmount)).not.toBeTruthy();
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Swap method must works with ERC20-NATIVE trade', async () => {
|
||||||
|
const usdtTokenAmountToSwap = 1;
|
||||||
|
const expectedToTokensAmount = '0.000314923189705958'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(usdtTokenAmountToSwap)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.ETH);
|
||||||
|
await chain.increaseTokensBalance(from, usdtTokenAmountToSwap, { inEtherUnits: true });
|
||||||
|
const usdtBalanceBefore = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const ethBalanceBefore = await web3Public.getBalance(userAddress);
|
||||||
|
let approveTxHash = '';
|
||||||
|
|
||||||
|
const onApprove = fn(hash => (approveTxHash = hash));
|
||||||
|
const trade = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
const transactionHash = await trade.swap({ onApprove });
|
||||||
|
const transactionReceipt = await web3Public.getTransactionReceipt(transactionHash);
|
||||||
|
const usdtBalanceAfter = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const ethBalanceAfter = await web3Public.getBalance(userAddress);
|
||||||
|
const approveTransactionFee = await utils.getTransactionFeeByHash(approveTxHash);
|
||||||
|
const transactionFee = await utils.getTransactionFeeByReceipt(transactionReceipt);
|
||||||
|
|
||||||
|
expect(transactionReceipt.status).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
usdtBalanceAfter.isEqualTo(
|
||||||
|
usdtBalanceBefore.minus(usdtTokenAmountToSwap * 10 ** from.decimals)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
ethBalanceAfter.isEqualTo(
|
||||||
|
ethBalanceBefore
|
||||||
|
.plus(new BigNumber(expectedToTokensAmount).multipliedBy(10 ** to.decimals))
|
||||||
|
.minus(approveTransactionFee)
|
||||||
|
.minus(transactionFee)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
expect(onApprove.mock.calls.length).toBe(1);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Swap method must works with ERC20-ERC20 trade', async () => {
|
||||||
|
const usdtTokenAmountToSwap = 1;
|
||||||
|
const expectedToTokensAmount = '1.02692208070202167'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(usdtTokenAmountToSwap)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.DAI);
|
||||||
|
await chain.increaseTokensBalance(from, usdtTokenAmountToSwap, { inEtherUnits: true });
|
||||||
|
const usdtBalanceBefore = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const daiBalanceBefore = await web3Public.getBalance(userAddress, to.address);
|
||||||
|
|
||||||
|
const trade = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
const transactionHash = await trade.swap();
|
||||||
|
const transactionReceipt = await web3Public.getTransactionReceipt(transactionHash);
|
||||||
|
const usdtBalanceAfter = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const daiBalanceAfter = await web3Public.getBalance(userAddress, to.address);
|
||||||
|
|
||||||
|
expect(transactionReceipt.status).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
usdtBalanceAfter.isEqualTo(
|
||||||
|
usdtBalanceBefore.minus(usdtTokenAmountToSwap * 10 ** from.decimals)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
daiBalanceAfter.isEqualTo(
|
||||||
|
daiBalanceBefore.plus(
|
||||||
|
new BigNumber(expectedToTokensAmount).multipliedBy(10 ** to.decimals)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
}, 400_000);
|
||||||
|
});
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { TRADE_TYPE } from 'src/features';
|
||||||
|
import { ZrxEthereumProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/ethereum/zrx-ethereum/zrx-ethereum-provider';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const zrxProviderEthereumSpec = () => {
|
||||||
|
let zrxProvider: ZrxEthereumProvider;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
zrxProvider = new ZrxEthereumProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(zrxProvider.type).toBe(TRADE_TYPE.ZRX_ETHEREUM);
|
||||||
|
expect(zrxProvider.blockchain).toBe(BLOCKCHAIN_NAME.ETHEREUM);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
import { SpiritSwapProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/fantom/spirit-swap/spirit-swap-provider';
|
||||||
|
import { SpiritSwapTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/fantom/spirit-swap/spirit-swap-trade';
|
||||||
|
import { SPIRIT_SWAP_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/fantom/spirit-swap/constants';
|
||||||
|
|
||||||
|
export const spiritSwapFantomProviderSpec = () => {
|
||||||
|
let spiritSwapProvider: SpiritSwapProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
spiritSwapProvider = new SpiritSwapProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(spiritSwapProvider.blockchain).toBe(BLOCKCHAIN_NAME.FANTOM);
|
||||||
|
expect(typeof spiritSwapProvider.UniswapV2TradeClass).toBe(typeof SpiritSwapTrade);
|
||||||
|
expect(spiritSwapProvider.providerSettings).toBe(SPIRIT_SWAP_PROVIDER_CONFIGURATION);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core';
|
||||||
|
import { SpookySwapTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/fantom/spooky-swap/spooky-swap-trade';
|
||||||
|
import { SPOOKY_SWAP_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/fantom/spooky-swap/constants';
|
||||||
|
import { SpookySwapProvider } from '@rsdk-features/instant-trades/dexes/fantom/spooky-swap/spooky-swap-provider';
|
||||||
|
|
||||||
|
export const spookySwapFantomProviderSpec = () => {
|
||||||
|
let spookySwapProvider: SpookySwapProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
spookySwapProvider = new SpookySwapProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(spookySwapProvider.blockchain).toBe(BLOCKCHAIN_NAME.FANTOM);
|
||||||
|
expect(typeof spookySwapProvider.InstantTradeClass).toBe(typeof SpookySwapTrade);
|
||||||
|
expect(spookySwapProvider.providerSettings).toBe(SPOOKY_SWAP_PROVIDER_CONFIGURATION);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { SushiSwapFantomProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/fantom/sushi-swap-fantom/sushi-swap-fantom-provider';
|
||||||
|
import { SushiSwapFantomTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/fantom/sushi-swap-fantom/sushi-swap-fantom-trade';
|
||||||
|
import { SUSHI_SWAP_FANTOM_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/fantom/sushi-swap-fantom/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const sushiSwapFantomProviderSpec = () => {
|
||||||
|
let sushiSwapProvider: SushiSwapFantomProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
sushiSwapProvider = new SushiSwapFantomProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(sushiSwapProvider.blockchain).toBe(BLOCKCHAIN_NAME.FANTOM);
|
||||||
|
expect(typeof sushiSwapProvider.UniswapV2TradeClass).toBe(typeof SushiSwapFantomTrade);
|
||||||
|
expect(sushiSwapProvider.providerSettings).toBe(SUSHI_SWAP_FANTOM_PROVIDER_CONFIGURATION);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { SushiSwapHarmonyProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/harmony/sushi-swap-harmony/sushi-swap-harmony-provider';
|
||||||
|
import { SushiSwapHarmonyTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/harmony/sushi-swap-harmony/sushi-swap-harmony-trade';
|
||||||
|
import { SUSHI_SWAP_HARMONY_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/harmony/sushi-swap-harmony/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const sushiSwapHarmonyProviderSpec = () => {
|
||||||
|
let sushiSwapProvider: SushiSwapHarmonyProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
sushiSwapProvider = new SushiSwapHarmonyProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(sushiSwapProvider.blockchain).toBe(BLOCKCHAIN_NAME.HARMONY);
|
||||||
|
expect(typeof sushiSwapProvider.UniswapV2TradeClass).toBe(typeof SushiSwapHarmonyTrade);
|
||||||
|
expect(sushiSwapProvider.providerSettings).toBe(SUSHI_SWAP_HARMONY_PROVIDER_CONFIGURATION);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { SolarbeamProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/moonriver/solarbeam/solarbeam-provider';
|
||||||
|
import { SolarbeamTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/moonriver/solarbeam/solarbeam-trade';
|
||||||
|
import { SOLARBEAM_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/moonriver/solarbeam/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const solarbeamMoonriverProviderSpec = () => {
|
||||||
|
describe('Solarbeam provider tests', () => {
|
||||||
|
let solarbeamProvider: SolarbeamProvider;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
solarbeamProvider = new SolarbeamProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(solarbeamProvider.blockchain).toBe(BLOCKCHAIN_NAME.MOONRIVER);
|
||||||
|
expect(typeof solarbeamProvider.UniswapV2TradeClass).toBe(typeof SolarbeamTrade);
|
||||||
|
expect(solarbeamProvider.providerSettings).toBe(SOLARBEAM_PROVIDER_CONFIGURATION);
|
||||||
|
}, 400_000);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { SushiSwapMoonriverProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/moonriver/sushi-swap-moonriver/sushi-swap-moonriver-provider';
|
||||||
|
import { SushiSwapMoonriverTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/moonriver/sushi-swap-moonriver/sushi-swap-moonriver-trade';
|
||||||
|
import { SUSHI_SWAP_MOONRIVER_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/moonriver/sushi-swap-moonriver/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const sushiSwapMoonriverProviderSpec = () => {
|
||||||
|
describe('SushiSwap provider tests', () => {
|
||||||
|
let sushiSwapProvider: SushiSwapMoonriverProvider;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
sushiSwapProvider = new SushiSwapMoonriverProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(sushiSwapProvider.blockchain).toBe(BLOCKCHAIN_NAME.MOONRIVER);
|
||||||
|
expect(typeof sushiSwapProvider.UniswapV2TradeClass).toBe(
|
||||||
|
typeof SushiSwapMoonriverTrade
|
||||||
|
);
|
||||||
|
expect(sushiSwapProvider.providerSettings).toBe(
|
||||||
|
SUSHI_SWAP_MOONRIVER_PROVIDER_CONFIGURATION
|
||||||
|
);
|
||||||
|
}, 400_000);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,76 @@
|
||||||
|
import { Chain } from '__tests__/utils/chain';
|
||||||
|
import { mockInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { TOKENS as ALL_TOKENS } from '__tests__/utils/tokens';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { PriceTokenAmount } from 'src/common/tokens/price-token-amount';
|
||||||
|
import { PriceToken } from 'src/common/tokens/price-token';
|
||||||
|
import { AlgebraProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/polygon/algebra/algebra-provider';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
const TOKENS = ALL_TOKENS[BLOCKCHAIN_NAME.POLYGON];
|
||||||
|
|
||||||
|
export const algebraPolygonProviderSpec = () => {
|
||||||
|
describe('Algebra provider tests', () => {
|
||||||
|
let algebraProvider: AlgebraProvider;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
algebraProvider = new AlgebraProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const chain = await Chain.reset(BLOCKCHAIN_NAME.POLYGON);
|
||||||
|
const configuration = await chain.getConfiguration();
|
||||||
|
await mockInjector(configuration);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Must calculate correct NATIVE-ERC20 trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '2.037958'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.MATIC,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDT);
|
||||||
|
|
||||||
|
const trade = await algebraProvider.calculate(from, to, { gasCalculation: 'disabled' });
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.MATIC.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.USDC.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.USDT.address);
|
||||||
|
}, 300_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-NATIVE trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '0.487931209815334164'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.MATIC);
|
||||||
|
|
||||||
|
const trade = await algebraProvider.calculate(from, to, { gasCalculation: 'disabled' });
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.USDT.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.USDC.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.MATIC.address);
|
||||||
|
}, 300_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-ERC20 trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '1.000083'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDC);
|
||||||
|
|
||||||
|
const trade = await algebraProvider.calculate(from, to, { gasCalculation: 'disabled' });
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.USDT.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.USDC.address);
|
||||||
|
}, 300_000);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,147 @@
|
||||||
|
import { Chain } from '__tests__/utils/chain';
|
||||||
|
import { mockInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { TOKENS as ALL_TOKENS } from '__tests__/utils/tokens';
|
||||||
|
import { Utils } from '__tests__/unit-tests/features/swap/utils/utils';
|
||||||
|
import { Injector } from 'src/core/injector/injector';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { BLOCKCHAIN_NAME, Web3Public } from 'src/core';
|
||||||
|
import { PriceTokenAmount } from 'src/common/tokens/price-token-amount';
|
||||||
|
import { PriceToken } from 'src/common/tokens/price-token';
|
||||||
|
import { AlgebraProvider } from '@rsdk-features/instant-trades/dexes/polygon/algebra/algebra-provider';
|
||||||
|
import fn = jest.fn;
|
||||||
|
|
||||||
|
const TOKENS = ALL_TOKENS[BLOCKCHAIN_NAME.POLYGON];
|
||||||
|
|
||||||
|
export const algebraPolygonTradeSpec = () => {
|
||||||
|
describe('Algebra trade tests.', () => {
|
||||||
|
let chain: Chain;
|
||||||
|
let algebraProvider: AlgebraProvider;
|
||||||
|
let web3Public: Web3Public;
|
||||||
|
let userAddress: string;
|
||||||
|
let utils: Utils;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
algebraProvider = new AlgebraProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
chain = await Chain.reset(BLOCKCHAIN_NAME.POLYGON);
|
||||||
|
const configuration = await chain.getConfiguration();
|
||||||
|
await mockInjector(configuration);
|
||||||
|
web3Public = Injector.web3PublicService.getWeb3Public(BLOCKCHAIN_NAME.POLYGON);
|
||||||
|
userAddress = Injector.web3PrivateService.address;
|
||||||
|
utils = new Utils(chain, web3Public);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Swap method must works with NATIVE-ERC20 trade', async () => {
|
||||||
|
const maticTokenAmountToSwap = 1;
|
||||||
|
const expectedToTokensAmount = '2.037958'; // constant data about tokens rate in 23571568 block
|
||||||
|
const maticBalanceBefore = await web3Public.getBalance(userAddress);
|
||||||
|
const usdtBalanceBefore = await web3Public.getBalance(userAddress, TOKENS.USDT.address);
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.MATIC,
|
||||||
|
tokenAmount: new BigNumber(maticTokenAmountToSwap)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDT);
|
||||||
|
|
||||||
|
const trade = await algebraProvider.calculate(from, to, { gasCalculation: 'disabled' });
|
||||||
|
const transactionReceipt = await trade.swap();
|
||||||
|
const maticBalanceAfter = await web3Public.getBalance(userAddress);
|
||||||
|
const usdtBalanceAfter = await web3Public.getBalance(userAddress, TOKENS.USDT.address);
|
||||||
|
const transactionFee = await utils.getTransactionFeeByReceipt(transactionReceipt);
|
||||||
|
|
||||||
|
expect(transactionReceipt.status).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
maticBalanceAfter.isEqualTo(
|
||||||
|
maticBalanceBefore
|
||||||
|
.minus(maticTokenAmountToSwap * 10 ** from.decimals)
|
||||||
|
.minus(transactionFee)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
usdtBalanceAfter.isEqualTo(
|
||||||
|
usdtBalanceBefore.plus(
|
||||||
|
new BigNumber(expectedToTokensAmount).multipliedBy(10 ** to.decimals)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
|
const trade1 = await algebraProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
expect(trade1.to.weiAmount.isEqualTo(trade.to.weiAmount)).not.toBeTruthy();
|
||||||
|
}, 300_000);
|
||||||
|
|
||||||
|
test('Swap method must works with ERC20-NATIVE trade', async () => {
|
||||||
|
const usdtTokenAmountToSwap = 1;
|
||||||
|
const expectedToTokensAmount = '0.487931209815334164'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(usdtTokenAmountToSwap)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.MATIC);
|
||||||
|
await chain.increaseTokensBalance(from, usdtTokenAmountToSwap, { inEtherUnits: true });
|
||||||
|
const usdtBalanceBefore = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const maticBalanceBefore = await web3Public.getBalance(userAddress);
|
||||||
|
let approveTxHash = '';
|
||||||
|
|
||||||
|
const onApprove = fn(hash => (approveTxHash = hash));
|
||||||
|
const trade = await algebraProvider.calculate(from, to, { gasCalculation: 'disabled' });
|
||||||
|
const transactionReceipt = await trade.swap({ onApprove });
|
||||||
|
const usdtBalanceAfter = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const maticBalanceAfter = await web3Public.getBalance(userAddress);
|
||||||
|
const approveTransactionFee = await utils.getTransactionFeeByHash(approveTxHash);
|
||||||
|
const transactionFee = await utils.getTransactionFeeByReceipt(transactionReceipt);
|
||||||
|
|
||||||
|
expect(transactionReceipt.status).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
usdtBalanceAfter.isEqualTo(
|
||||||
|
usdtBalanceBefore.minus(usdtTokenAmountToSwap * 10 ** from.decimals)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
maticBalanceAfter.isEqualTo(
|
||||||
|
maticBalanceBefore
|
||||||
|
.plus(new BigNumber(expectedToTokensAmount).multipliedBy(10 ** to.decimals))
|
||||||
|
.minus(approveTransactionFee)
|
||||||
|
.minus(transactionFee)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
expect(onApprove.mock.calls.length).toBe(1);
|
||||||
|
}, 300_000);
|
||||||
|
|
||||||
|
test('Swap method must works with ERC20-ERC20 trade', async () => {
|
||||||
|
const usdtTokenAmountToSwap = 1;
|
||||||
|
const expectedToTokensAmount = '1.000083'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(usdtTokenAmountToSwap)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDC);
|
||||||
|
await chain.increaseTokensBalance(from, usdtTokenAmountToSwap, { inEtherUnits: true });
|
||||||
|
const usdtBalanceBefore = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const usdcBalanceBefore = await web3Public.getBalance(userAddress, to.address);
|
||||||
|
|
||||||
|
const trade = await algebraProvider.calculate(from, to, { gasCalculation: 'disabled' });
|
||||||
|
const transactionReceipt = await trade.swap();
|
||||||
|
const usdtBalanceAfter = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const usdcBalanceAfter = await web3Public.getBalance(userAddress, to.address);
|
||||||
|
|
||||||
|
expect(transactionReceipt.status).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
usdtBalanceAfter.isEqualTo(
|
||||||
|
usdtBalanceBefore.minus(usdtTokenAmountToSwap * 10 ** from.decimals)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
usdcBalanceAfter.isEqualTo(
|
||||||
|
usdcBalanceBefore.plus(
|
||||||
|
new BigNumber(expectedToTokensAmount).multipliedBy(10 ** to.decimals)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
}, 300_000);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { TRADE_TYPE } from 'src/features';
|
||||||
|
import { OneinchPolygonProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/polygon/oneinch-polygon/oneinch-polygon-provider';
|
||||||
|
import { mockEmptyInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
export const oneinchPolygonProviderSpec = () => {
|
||||||
|
describe('QuickSwap provider tests', () => {
|
||||||
|
let oneinchPolygonProvider: OneinchPolygonProvider;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
mockEmptyInjector();
|
||||||
|
oneinchPolygonProvider = new OneinchPolygonProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(oneinchPolygonProvider.type).toBe(TRADE_TYPE.ONE_INCH_POLYGON);
|
||||||
|
expect(oneinchPolygonProvider.blockchain).toBe(BLOCKCHAIN_NAME.POLYGON);
|
||||||
|
}, 400_000);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,204 @@
|
||||||
|
import { Chain } from '__tests__/utils/chain';
|
||||||
|
import { mockInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { TOKENS as ALL_TOKENS } from '__tests__/utils/tokens';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { PriceTokenAmount } from 'src/common/tokens/price-token-amount';
|
||||||
|
import { PriceToken } from 'src/common/tokens/price-token';
|
||||||
|
import { QuickSwapProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap/quick-swap-provider';
|
||||||
|
import { QuickSwapTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap/quick-swap-trade';
|
||||||
|
import { QUICK_SWAP_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/polygon/quick-swap/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
const TOKENS = ALL_TOKENS[BLOCKCHAIN_NAME.POLYGON];
|
||||||
|
|
||||||
|
export const quickSwapPolygonProviderSpec = () => {
|
||||||
|
describe('QuickSwap provider tests', () => {
|
||||||
|
let quickSwapProvider: QuickSwapProvider;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
quickSwapProvider = new QuickSwapProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const chain = await Chain.reset(BLOCKCHAIN_NAME.POLYGON);
|
||||||
|
const configuration = await chain.getConfiguration();
|
||||||
|
await mockInjector(configuration);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(quickSwapProvider.blockchain).toBe(BLOCKCHAIN_NAME.POLYGON);
|
||||||
|
expect(typeof quickSwapProvider.UniswapV2TradeClass).toBe(typeof QuickSwapTrade);
|
||||||
|
expect(quickSwapProvider.providerSettings).toBe(QUICK_SWAP_PROVIDER_CONFIGURATION);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct NATIVE-ERC20 trade with simple path without gas calculation.', async () => {
|
||||||
|
const expectedToTokensAmount = '2.051425'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.MATIC,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDT);
|
||||||
|
|
||||||
|
const trade = await quickSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(4);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.MATIC.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.QUICK.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.USDC.address);
|
||||||
|
expect(trade.path[3].address).toBe(TOKENS.USDT.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-ERC20 trade with simple path without gas calculation.', async () => {
|
||||||
|
const expectedToTokensAmount = '263.134808'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.QUICK,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDC);
|
||||||
|
|
||||||
|
const trade = await quickSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.QUICK.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.USDC.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-NATIVE trade with simple path without gas calculation.', async () => {
|
||||||
|
const expectedToTokensAmount = '127.513605898661444581'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.QUICK,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.MATIC);
|
||||||
|
|
||||||
|
const trade = await quickSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.QUICK.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.USDC.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.MATIC.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct NATIVE-ERC20 trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '2.051425'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.MATIC,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDT);
|
||||||
|
|
||||||
|
const trade = await quickSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'calculate'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(4);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.MATIC.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.QUICK.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.USDC.address);
|
||||||
|
expect(trade.path[3].address).toBe(TOKENS.USDT.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-ERC20 trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '0.003783444491122842'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.QUICK);
|
||||||
|
|
||||||
|
const trade = await quickSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'calculate'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.USDT.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.WETH.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.QUICK.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-NATIVE trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '1488.913004591397373038'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.WETH,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.MATIC);
|
||||||
|
|
||||||
|
const trade = await quickSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'calculate'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.WETH.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.MATIC.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct NATIVE-ERC20 trade with simple path with rubic optimisation.', async () => {
|
||||||
|
const expectedToTokensAmount = '2.051886'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.MATIC,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDC);
|
||||||
|
|
||||||
|
const trade = await quickSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'rubicOptimisation'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.MATIC.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.QUICK.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.USDC.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-ERC20 trade with simple path with rubic optimisation.', async () => {
|
||||||
|
const expectedToTokensAmount = '0.003788546445518352'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDC,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.QUICK);
|
||||||
|
|
||||||
|
const trade = await quickSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'rubicOptimisation'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.USDC.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.WETH.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.QUICK.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-NATIVE trade with simple path with rubic optimisation.', async () => {
|
||||||
|
const expectedToTokensAmount = '0.485965481122745139'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.DAI,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.MATIC);
|
||||||
|
|
||||||
|
const trade = await quickSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'rubicOptimisation'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.DAI.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.MATIC.address);
|
||||||
|
}, 400_000);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,202 @@
|
||||||
|
import { Chain } from '__tests__/utils/chain';
|
||||||
|
import { mockInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { TOKENS as ALL_TOKENS } from '__tests__/utils/tokens';
|
||||||
|
import { PriceTokenAmount } from 'src/common/tokens/price-token-amount';
|
||||||
|
import { PriceToken } from 'src/common/tokens/price-token';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { SushiSwapPolygonProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/polygon/sushi-swap-polygon/sushi-swap-polygon-provider';
|
||||||
|
import { SushiSwapPolygonTrade } from 'src/features/on-chain/calculation-manager/providers/dexes/polygon/sushi-swap-polygon/sushi-swap-polygon-trade';
|
||||||
|
import { SUSHI_SWAP_POLYGON_PROVIDER_CONFIGURATION } from 'src/features/on-chain/calculation-manager/providers/dexes/polygon/sushi-swap-polygon/constants';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
const TOKENS = ALL_TOKENS[BLOCKCHAIN_NAME.POLYGON];
|
||||||
|
|
||||||
|
export const sushiSwapPolygonProviderSpec = () => {
|
||||||
|
describe('SushiSwap provider tests', () => {
|
||||||
|
let sushiSwapProvider: SushiSwapPolygonProvider;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
sushiSwapProvider = new SushiSwapPolygonProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const chain = await Chain.reset(BLOCKCHAIN_NAME.POLYGON);
|
||||||
|
const configuration = await chain.getConfiguration();
|
||||||
|
await mockInjector(configuration);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Initialize values', () => {
|
||||||
|
expect(sushiSwapProvider.blockchain).toBe(BLOCKCHAIN_NAME.POLYGON);
|
||||||
|
expect(typeof sushiSwapProvider.UniswapV2TradeClass).toBe(typeof SushiSwapPolygonTrade);
|
||||||
|
expect(sushiSwapProvider.providerSettings).toBe(
|
||||||
|
SUSHI_SWAP_POLYGON_PROVIDER_CONFIGURATION
|
||||||
|
);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct NATIVE-ERC20 trade with simple path without gas calculation.', async () => {
|
||||||
|
const expectedToTokensAmount = '2.050733'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.MATIC,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDT);
|
||||||
|
|
||||||
|
const trade = await sushiSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.MATIC.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.USDC.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.USDT.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-ERC20 trade with simple path without gas calculation.', async () => {
|
||||||
|
const expectedToTokensAmount = '159.954588'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.QUICK,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDC);
|
||||||
|
|
||||||
|
const trade = await sushiSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.QUICK.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.USDC.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-NATIVE trade with simple path without gas calculation.', async () => {
|
||||||
|
const expectedToTokensAmount = '77.507430129172371211'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.QUICK,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.MATIC);
|
||||||
|
|
||||||
|
const trade = await sushiSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.QUICK.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.USDC.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.MATIC.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct NATIVE-ERC20 trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '2.050733'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.MATIC,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDT);
|
||||||
|
|
||||||
|
const trade = await sushiSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'calculate'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.MATIC.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.USDC.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.USDT.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-ERC20 trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '0.003770130241669953'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.QUICK);
|
||||||
|
|
||||||
|
const trade = await sushiSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'calculate'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.USDT.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.WMATIC.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.QUICK.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-NATIVE trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '1488.721017828230077849'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.WETH,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.MATIC);
|
||||||
|
|
||||||
|
const trade = await sushiSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'calculate'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.WETH.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.MATIC.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct NATIVE-ERC20 trade with simple path with rubic optimisation.', async () => {
|
||||||
|
const expectedToTokensAmount = '2.051291'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.MATIC,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDC);
|
||||||
|
|
||||||
|
const trade = await sushiSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'rubicOptimisation'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.MATIC.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.USDC.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-ERC20 trade with simple path with rubic optimisation.', async () => {
|
||||||
|
const expectedToTokensAmount = '0.003779917038690047'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDC,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.QUICK);
|
||||||
|
|
||||||
|
const trade = await sushiSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'rubicOptimisation'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.USDC.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.QUICK.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-NATIVE trade with simple path with rubic optimisation.', async () => {
|
||||||
|
const expectedToTokensAmount = '0.486133316016377403'; // constant data about tokens rate in 13961175 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.DAI,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.MATIC);
|
||||||
|
|
||||||
|
const trade = await sushiSwapProvider.calculate(from, to, {
|
||||||
|
gasCalculation: 'rubicOptimisation'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.DAI.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.MATIC.address);
|
||||||
|
}, 400_000);
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,80 @@
|
||||||
|
import { Chain } from '__tests__/utils/chain';
|
||||||
|
import { mockInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { TOKENS as ALL_TOKENS } from '__tests__/utils/tokens';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { PriceTokenAmount } from 'src/common/tokens/price-token-amount';
|
||||||
|
import { PriceToken } from 'src/common/tokens/price-token';
|
||||||
|
import { UniSwapV3PolygonProvider } from '@rsdk-features/instant-trades/dexes/polygon/uni-swap-v3-polygon/uni-swap-v3-polygon-provider';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
const TOKENS = ALL_TOKENS[BLOCKCHAIN_NAME.POLYGON];
|
||||||
|
|
||||||
|
export const uniswapV3PolygonProviderSpec = () =>
|
||||||
|
describe('UnisSwap V3 Polygon provider tests', () => {
|
||||||
|
let uniswapV3Provider: UniSwapV3PolygonProvider;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
uniswapV3Provider = new UniSwapV3PolygonProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
const chain = await Chain.reset(BLOCKCHAIN_NAME.POLYGON);
|
||||||
|
const configuration = await chain.getConfiguration();
|
||||||
|
await mockInjector(configuration);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Must calculate correct NATIVE-ERC20 trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '2.055903'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.MATIC,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDT);
|
||||||
|
|
||||||
|
const trade = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.MATIC.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.USDT.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-NATIVE trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '0.487261802620573316'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.MATIC);
|
||||||
|
|
||||||
|
const trade = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(3);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.USDT.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.DAI.address);
|
||||||
|
expect(trade.path[2].address).toBe(TOKENS.MATIC.address);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Must calculate correct ERC20-ERC20 trade with simple path.', async () => {
|
||||||
|
const expectedToTokensAmount = '0.998641521554865859'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(1)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.DAI);
|
||||||
|
|
||||||
|
const trade = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(trade.to.tokenAmount.isEqualTo(expectedToTokensAmount)).toBeTruthy();
|
||||||
|
expect(trade.path.length).toBe(2);
|
||||||
|
expect(trade.path[0].address).toBe(TOKENS.USDT.address);
|
||||||
|
expect(trade.path[1].address).toBe(TOKENS.DAI.address);
|
||||||
|
}, 400_000);
|
||||||
|
});
|
|
@ -0,0 +1,158 @@
|
||||||
|
import { Chain } from '__tests__/utils/chain';
|
||||||
|
import { mockInjector } from '__tests__/utils/mock-injector';
|
||||||
|
import { TOKENS as ALL_TOKENS } from '__tests__/utils/tokens';
|
||||||
|
import { Utils } from '__tests__/unit-tests/features/swap/utils/utils';
|
||||||
|
import { Injector } from 'src/core/injector/injector';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { EvmWeb3Public } from 'src/core/blockchain/web3-public-service/web3-public/evm-web3-public/evm-web3-public';
|
||||||
|
import { PriceTokenAmount } from 'src/common/tokens/price-token-amount';
|
||||||
|
import { PriceToken } from 'src/common/tokens/price-token';
|
||||||
|
import { UniSwapV3PolygonProvider } from 'src/features/on-chain/calculation-manager/providers/dexes/polygon/uni-swap-v3-polygon/uni-swap-v3-polygon-provider';
|
||||||
|
import { BLOCKCHAIN_NAME } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
import fn = jest.fn;
|
||||||
|
|
||||||
|
const TOKENS = ALL_TOKENS[BLOCKCHAIN_NAME.POLYGON];
|
||||||
|
|
||||||
|
export const uniswapV3PolygonTradeSpec = () =>
|
||||||
|
describe('UniSwap V3 Polygon trade tests.', () => {
|
||||||
|
let chain: Chain;
|
||||||
|
let uniswapV3Provider: UniSwapV3PolygonProvider;
|
||||||
|
let web3Public: EvmWeb3Public;
|
||||||
|
let userAddress: string;
|
||||||
|
let utils: Utils;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
uniswapV3Provider = new UniSwapV3PolygonProvider();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
chain = await Chain.reset(BLOCKCHAIN_NAME.POLYGON);
|
||||||
|
const configuration = await chain.getConfiguration();
|
||||||
|
await mockInjector(configuration);
|
||||||
|
web3Public = Injector.web3PublicService.getWeb3Public(BLOCKCHAIN_NAME.POLYGON);
|
||||||
|
userAddress = Injector.web3PrivateService.getWeb3PrivateByBlockchain(
|
||||||
|
BLOCKCHAIN_NAME.POLYGON
|
||||||
|
).address;
|
||||||
|
utils = new Utils(chain, web3Public);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Swap method must works with NATIVE-ERC20 trade', async () => {
|
||||||
|
const maticTokenAmountToSwap = 1;
|
||||||
|
const expectedToTokensAmount = '2.055903'; // constant data about tokens rate in 23571568 block
|
||||||
|
const maticBalanceBefore = await web3Public.getBalance(userAddress);
|
||||||
|
const usdtBalanceBefore = await web3Public.getBalance(userAddress, TOKENS.USDT.address);
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.MATIC,
|
||||||
|
tokenAmount: new BigNumber(maticTokenAmountToSwap)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.USDT);
|
||||||
|
|
||||||
|
const trade = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
const transactionHash = await trade.swap();
|
||||||
|
const transactionReceipt = await web3Public.getTransactionReceipt(transactionHash);
|
||||||
|
const maticBalanceAfter = await web3Public.getBalance(userAddress);
|
||||||
|
const usdtBalanceAfter = await web3Public.getBalance(userAddress, TOKENS.USDT.address);
|
||||||
|
const transactionFee = await utils.getTransactionFeeByReceipt(transactionReceipt);
|
||||||
|
|
||||||
|
expect(transactionReceipt.status).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
maticBalanceAfter.isEqualTo(
|
||||||
|
maticBalanceBefore
|
||||||
|
.minus(maticTokenAmountToSwap * 10 ** from.decimals)
|
||||||
|
.minus(transactionFee)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
usdtBalanceAfter.isEqualTo(
|
||||||
|
usdtBalanceBefore.plus(
|
||||||
|
new BigNumber(expectedToTokensAmount).multipliedBy(10 ** to.decimals)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
|
const trade1 = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
expect(trade1.to.weiAmount.isEqualTo(trade.to.weiAmount)).not.toBeTruthy();
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Swap method must works with ERC20-NATIVE trade', async () => {
|
||||||
|
const usdtTokenAmountToSwap = 1;
|
||||||
|
const expectedToTokensAmount = '0.487261802620573316'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(usdtTokenAmountToSwap)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.MATIC);
|
||||||
|
await chain.increaseTokensBalance(from, usdtTokenAmountToSwap, { inEtherUnits: true });
|
||||||
|
const usdtBalanceBefore = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const maticBalanceBefore = await web3Public.getBalance(userAddress);
|
||||||
|
let approveTxHash = '';
|
||||||
|
|
||||||
|
const onApprove = fn(hash => (approveTxHash = hash));
|
||||||
|
const trade = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
const transactionHash = await trade.swap({ onApprove });
|
||||||
|
const transactionReceipt = await web3Public.getTransactionReceipt(transactionHash);
|
||||||
|
const usdtBalanceAfter = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const maticBalanceAfter = await web3Public.getBalance(userAddress);
|
||||||
|
const approveTransactionFee = await utils.getTransactionFeeByHash(approveTxHash);
|
||||||
|
const transactionFee = await utils.getTransactionFeeByReceipt(transactionReceipt);
|
||||||
|
|
||||||
|
expect(transactionReceipt.status).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
usdtBalanceAfter.isEqualTo(
|
||||||
|
usdtBalanceBefore.minus(usdtTokenAmountToSwap * 10 ** from.decimals)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
maticBalanceAfter.isEqualTo(
|
||||||
|
maticBalanceBefore
|
||||||
|
.plus(new BigNumber(expectedToTokensAmount).multipliedBy(10 ** to.decimals))
|
||||||
|
.minus(approveTransactionFee)
|
||||||
|
.minus(transactionFee)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
expect(onApprove.mock.calls.length).toBe(1);
|
||||||
|
}, 400_000);
|
||||||
|
|
||||||
|
test('Swap method must works with ERC20-ERC20 trade', async () => {
|
||||||
|
const usdtTokenAmountToSwap = 1;
|
||||||
|
const expectedToTokensAmount = '0.998641521554865859'; // constant data about tokens rate in 23571568 block
|
||||||
|
const from = await PriceTokenAmount.createFromToken({
|
||||||
|
...TOKENS.USDT,
|
||||||
|
tokenAmount: new BigNumber(usdtTokenAmountToSwap)
|
||||||
|
});
|
||||||
|
const to = await PriceToken.createFromToken(TOKENS.DAI);
|
||||||
|
await chain.increaseTokensBalance(from, usdtTokenAmountToSwap, { inEtherUnits: true });
|
||||||
|
const usdtBalanceBefore = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const daiBalanceBefore = await web3Public.getBalance(userAddress, to.address);
|
||||||
|
|
||||||
|
const trade = await uniswapV3Provider.calculate(from, to, {
|
||||||
|
gasCalculation: 'disabled'
|
||||||
|
});
|
||||||
|
const transactionHash = await trade.swap();
|
||||||
|
const transactionReceipt = await web3Public.getTransactionReceipt(transactionHash);
|
||||||
|
const usdtBalanceAfter = await web3Public.getBalance(userAddress, from.address);
|
||||||
|
const daiBalanceAfter = await web3Public.getBalance(userAddress, to.address);
|
||||||
|
|
||||||
|
expect(transactionReceipt.status).toBeTruthy();
|
||||||
|
expect(
|
||||||
|
usdtBalanceAfter.isEqualTo(
|
||||||
|
usdtBalanceBefore.minus(usdtTokenAmountToSwap * 10 ** from.decimals)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
daiBalanceAfter.isEqualTo(
|
||||||
|
daiBalanceBefore.plus(
|
||||||
|
new BigNumber(expectedToTokensAmount).multipliedBy(10 ** to.decimals)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).toBeTruthy();
|
||||||
|
}, 400_000);
|
||||||
|
});
|
23
SDK-mstr/__tests__/unit-tests/features/swap/utils/utils.ts
Normal file
23
SDK-mstr/__tests__/unit-tests/features/swap/utils/utils.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import { TransactionReceipt } from 'web3-eth';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { Web3Public } from 'src/core/blockchain/web3-public-service/web3-public/web3-public';
|
||||||
|
import { Chain } from '__tests__/utils/chain';
|
||||||
|
|
||||||
|
export class Utils {
|
||||||
|
constructor(private readonly chain: Chain, private readonly web3Public: Web3Public) {}
|
||||||
|
|
||||||
|
async getTransactionFeeByReceipt(transactionReceipt: TransactionReceipt): Promise<BigNumber> {
|
||||||
|
const transaction = (await this.web3Public.getTransactionByHash(
|
||||||
|
transactionReceipt.transactionHash
|
||||||
|
))!;
|
||||||
|
return new BigNumber(transactionReceipt.gasUsed).multipliedBy(transaction.gasPrice);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getTransactionFeeByHash(transactionHash: string): Promise<BigNumber> {
|
||||||
|
const transaction = (await this.web3Public.getTransactionByHash(transactionHash))!;
|
||||||
|
const transactionReceipt = (await this.chain.web3.eth.getTransactionReceipt(
|
||||||
|
transactionHash
|
||||||
|
))!;
|
||||||
|
return new BigNumber(transactionReceipt.gasUsed).multipliedBy(transaction.gasPrice);
|
||||||
|
}
|
||||||
|
}
|
17
SDK-mstr/__tests__/utils/accounts-from-mnemonic.ts
Normal file
17
SDK-mstr/__tests__/utils/accounts-from-mnemonic.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import { mnemonicToSeedSync } from 'bip39';
|
||||||
|
import { hdkey } from 'ethereumjs-wallet';
|
||||||
|
|
||||||
|
export function generateAccountsFromMnemonic(mnemonic: string, count: number) {
|
||||||
|
const seed = mnemonicToSeedSync(mnemonic);
|
||||||
|
const hdwallet = hdkey.fromMasterSeed(seed);
|
||||||
|
const walletHdpath = "m/44'/60'/0'/0/";
|
||||||
|
|
||||||
|
const accounts = [];
|
||||||
|
for (let i = 0; i < count; i++) {
|
||||||
|
const wallet = hdwallet.derivePath(walletHdpath + i).getWallet();
|
||||||
|
const address = `0x${wallet.getAddress().toString('hex')}`;
|
||||||
|
const privateKey = wallet.getPrivateKey().toString('hex');
|
||||||
|
accounts.push({ address, privateKey });
|
||||||
|
}
|
||||||
|
return accounts;
|
||||||
|
}
|
146
SDK-mstr/__tests__/utils/chain.ts
Normal file
146
SDK-mstr/__tests__/utils/chain.ts
Normal file
|
@ -0,0 +1,146 @@
|
||||||
|
import { ERC20_TOKEN_ABI } from 'src/core/blockchain/web3-public-service/web3-public/evm-web3-public/constants/erc-20-token-abi';
|
||||||
|
import { generateAccountsFromMnemonic } from '__tests__/utils/accounts-from-mnemonic';
|
||||||
|
import {
|
||||||
|
publicProvidersRPC,
|
||||||
|
publicProvidersSupportServerUrls
|
||||||
|
} from '__tests__/utils/configuration';
|
||||||
|
import { DEFAULT_MNEMONIC } from '__tests__/utils/constants/mnemonic';
|
||||||
|
import { TOKENS_HOLDERS } from '__tests__/utils/tokens';
|
||||||
|
import axios from 'axios';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { BlockchainName } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
import { Configuration } from 'src/core/sdk/models/configuration';
|
||||||
|
import * as util from 'util';
|
||||||
|
import Web3 from 'web3';
|
||||||
|
import { HttpProvider } from 'web3-core';
|
||||||
|
import { Token } from 'src/common/tokens';
|
||||||
|
import { CHAIN_TYPE } from 'src/core/blockchain/models/chain-type';
|
||||||
|
|
||||||
|
export class Chain {
|
||||||
|
private static walletsNumber = 10;
|
||||||
|
|
||||||
|
private static wallets = generateAccountsFromMnemonic(DEFAULT_MNEMONIC, Chain.walletsNumber);
|
||||||
|
|
||||||
|
private static web3Instances = Object.fromEntries(
|
||||||
|
Object.entries(publicProvidersRPC).map(([key, value]) => {
|
||||||
|
const web3 = new Web3(value);
|
||||||
|
Chain.wallets.forEach(wallet => {
|
||||||
|
web3.eth.accounts.wallet.add(wallet.privateKey);
|
||||||
|
});
|
||||||
|
return [key, web3];
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
private static get accounts(): string[] {
|
||||||
|
return Chain.wallets.map(wallet => wallet.address);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async reset(
|
||||||
|
blockchainName: BlockchainName,
|
||||||
|
blockNumber?: number
|
||||||
|
): Promise<Chain> {
|
||||||
|
const rpcUrl = publicProvidersRPC[blockchainName];
|
||||||
|
const resetUrl = publicProvidersSupportServerUrls[blockchainName];
|
||||||
|
|
||||||
|
if (!rpcUrl || !resetUrl) {
|
||||||
|
throw new Error(`RPC for ${blockchainName} was not set.`);
|
||||||
|
}
|
||||||
|
await axios.post(resetUrl, { blockNumber });
|
||||||
|
|
||||||
|
return new Chain(Chain.web3Instances[blockchainName], Chain.accounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
private constructor(public web3: Web3, public accounts: string[]) {}
|
||||||
|
|
||||||
|
public async getConfiguration(): Promise<Configuration> {
|
||||||
|
return {
|
||||||
|
rpcProviders: Object.fromEntries(
|
||||||
|
Object.entries(publicProvidersRPC).map(([key, value]) => [
|
||||||
|
key,
|
||||||
|
{
|
||||||
|
mainRpc: value
|
||||||
|
}
|
||||||
|
])
|
||||||
|
),
|
||||||
|
walletProvider: {
|
||||||
|
[CHAIN_TYPE.EVM]: {
|
||||||
|
core: this.web3,
|
||||||
|
address: this.accounts[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public async increaseTokensBalance(
|
||||||
|
token: Token,
|
||||||
|
amount: number | string | BigNumber,
|
||||||
|
options: { inEtherUnits: boolean } = { inEtherUnits: false }
|
||||||
|
): Promise<void> {
|
||||||
|
const weiAmount = options.inEtherUnits
|
||||||
|
? new BigNumber(amount).multipliedBy(10 ** token.decimals)
|
||||||
|
: new BigNumber(amount);
|
||||||
|
const holder = this.getTokenHolderAddress(token);
|
||||||
|
await this.setBalance(holder, 1, {
|
||||||
|
inEtherUnits: true
|
||||||
|
});
|
||||||
|
|
||||||
|
const tokenContract = new this.web3.eth.Contract(ERC20_TOKEN_ABI, token.address);
|
||||||
|
const holderBalance = new BigNumber(await tokenContract.methods.balanceOf(holder).call());
|
||||||
|
if (holderBalance.lt(weiAmount)) {
|
||||||
|
throw new Error(`${
|
||||||
|
token.symbol
|
||||||
|
} holder balance is not enough to transfer, set other holder to config.
|
||||||
|
Holder balance is ${holderBalance.toFixed()}, but ${weiAmount.toFixed(
|
||||||
|
0
|
||||||
|
)} is required.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.impersonateAccount(holder);
|
||||||
|
await tokenContract.methods
|
||||||
|
.transfer(this.accounts[0], weiAmount.toFixed(0))
|
||||||
|
.send({ from: holder, gas: 100_000 });
|
||||||
|
await this.stopImpersonateAccount(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
private getTokenHolderAddress(token: Token): string {
|
||||||
|
const holder =
|
||||||
|
TOKENS_HOLDERS[token.blockchain as keyof typeof TOKENS_HOLDERS]?.[token.address];
|
||||||
|
if (!holder) {
|
||||||
|
throw new Error(`Holder for ${token.symbol} is not specified.`);
|
||||||
|
}
|
||||||
|
return holder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async impersonateAccount(address: string): Promise<void> {
|
||||||
|
await this.sendRpcRequest('hardhat_impersonateAccount', [address]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async stopImpersonateAccount(address: string): Promise<void> {
|
||||||
|
await this.sendRpcRequest('hardhat_stopImpersonatingAccount', [address]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async setBalance(
|
||||||
|
address: string,
|
||||||
|
value: number | string | BigNumber,
|
||||||
|
options: { inEtherUnits: boolean } = { inEtherUnits: false }
|
||||||
|
): Promise<void> {
|
||||||
|
const bnValue = options.inEtherUnits
|
||||||
|
? new BigNumber(value).multipliedBy(10 ** 18)
|
||||||
|
: new BigNumber(value);
|
||||||
|
|
||||||
|
const hexValue = `0x${bnValue.toString(16)}`;
|
||||||
|
|
||||||
|
await this.sendRpcRequest('hardhat_setBalance', [address, hexValue]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async sendRpcRequest(method: string, params: string[]): Promise<void> {
|
||||||
|
await util.promisify(
|
||||||
|
(this.web3.currentProvider as HttpProvider).send.bind(this.web3.currentProvider)
|
||||||
|
)({
|
||||||
|
method,
|
||||||
|
params,
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
id: new Date().getTime()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
29
SDK-mstr/__tests__/utils/configuration.ts
Normal file
29
SDK-mstr/__tests__/utils/configuration.ts
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import { BLOCKCHAIN_NAME, BlockchainName } from '../../src/core/blockchain/models/blockchain-name';
|
||||||
|
import { Configuration } from '../../src/core/sdk/models/configuration';
|
||||||
|
|
||||||
|
const baseRpcUrl = 'http://localhost';
|
||||||
|
|
||||||
|
const addPort = (port: number) => `${baseRpcUrl}:${port}`;
|
||||||
|
|
||||||
|
export const publicProvidersRPC: Partial<Record<BlockchainName, string>> = {
|
||||||
|
[BLOCKCHAIN_NAME.ETHEREUM]: addPort(8545),
|
||||||
|
[BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN]: addPort(8546),
|
||||||
|
[BLOCKCHAIN_NAME.POLYGON]: addPort(8547)
|
||||||
|
};
|
||||||
|
|
||||||
|
export const publicProvidersSupportServerUrls: Partial<Record<BlockchainName, string>> = {
|
||||||
|
[BLOCKCHAIN_NAME.ETHEREUM]: addPort(1545),
|
||||||
|
[BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN]: addPort(1546),
|
||||||
|
[BLOCKCHAIN_NAME.POLYGON]: addPort(1547)
|
||||||
|
};
|
||||||
|
|
||||||
|
export const minimalConfiguration: Configuration = {
|
||||||
|
rpcProviders: Object.fromEntries(
|
||||||
|
Object.entries(publicProvidersRPC).map(([key, value]) => [
|
||||||
|
key,
|
||||||
|
{
|
||||||
|
mainRpc: value
|
||||||
|
}
|
||||||
|
])
|
||||||
|
)
|
||||||
|
};
|
29
SDK-mstr/__tests__/utils/constants/free-rpc.ts
Normal file
29
SDK-mstr/__tests__/utils/constants/free-rpc.ts
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import {
|
||||||
|
BLOCKCHAIN_NAME,
|
||||||
|
EvmBlockchainName,
|
||||||
|
TronBlockchainName
|
||||||
|
} from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
import { TronWebProvider } from 'src/core/blockchain/web3-public-service/web3-public/tron-web3-public/models/tron-web-provider';
|
||||||
|
import { RpcProvider } from 'src/core/sdk/models/rpc-provider';
|
||||||
|
|
||||||
|
export const freeRpc: Partial<
|
||||||
|
Record<EvmBlockchainName, RpcProvider<string>> &
|
||||||
|
Record<TronBlockchainName, RpcProvider<TronWebProvider>>
|
||||||
|
> = {
|
||||||
|
[BLOCKCHAIN_NAME.ETHEREUM]: {
|
||||||
|
rpcList: ['https://rpc.ankr.com/eth']
|
||||||
|
},
|
||||||
|
[BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN]: {
|
||||||
|
rpcList: ['https://bsc-dataseed.binance.org']
|
||||||
|
},
|
||||||
|
[BLOCKCHAIN_NAME.POLYGON]: {
|
||||||
|
rpcList: ['https://polygon-rpc.com']
|
||||||
|
},
|
||||||
|
[BLOCKCHAIN_NAME.TRON]: {
|
||||||
|
rpcList: [
|
||||||
|
{
|
||||||
|
fullHost: 'https://rpc.ankr.com/http/tron'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
1
SDK-mstr/__tests__/utils/constants/mnemonic.ts
Normal file
1
SDK-mstr/__tests__/utils/constants/mnemonic.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export const DEFAULT_MNEMONIC = 'test test test test test test test test test test test junk';
|
18
SDK-mstr/__tests__/utils/mock-injector.ts
Normal file
18
SDK-mstr/__tests__/utils/mock-injector.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import { DefaultHttpClient } from 'src/core/http-client/default-http-client';
|
||||||
|
import { Web3PrivateService } from 'src/core/blockchain/web3-private-service/web3-private-service';
|
||||||
|
import { Web3PublicService } from 'src/core/blockchain/web3-public-service/web3-public-service';
|
||||||
|
import { Injector } from 'src/core/injector/injector';
|
||||||
|
import { Configuration } from 'src/core/sdk/models/configuration';
|
||||||
|
|
||||||
|
export async function mockInjector(configuration: Configuration): Promise<void> {
|
||||||
|
const web3PublicService = new Web3PublicService(configuration.rpcProviders);
|
||||||
|
const web3PrivateService = new Web3PrivateService(configuration.walletProvider);
|
||||||
|
const httpClient = configuration.httpClient || (await DefaultHttpClient.getInstance());
|
||||||
|
|
||||||
|
Injector.createInjector(web3PublicService, web3PrivateService, httpClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mockEmptyInjector(): void {
|
||||||
|
// @ts-ignore
|
||||||
|
Injector.createInjector(null, null, null);
|
||||||
|
}
|
7
SDK-mstr/__tests__/utils/models/global.ts
Normal file
7
SDK-mstr/__tests__/utils/models/global.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { BlockchainName } from 'src/core';
|
||||||
|
|
||||||
|
export interface Global {
|
||||||
|
sdkEnv: {
|
||||||
|
providers: Record<BlockchainName, { jsonRpcUrl: string; blockNumber: number }>;
|
||||||
|
};
|
||||||
|
}
|
111
SDK-mstr/__tests__/utils/tokens.ts
Normal file
111
SDK-mstr/__tests__/utils/tokens.ts
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
import { BLOCKCHAIN_NAME, BlockchainName } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
import { Token } from 'src/common/tokens';
|
||||||
|
import { EvmWeb3Pure } from 'src/core/blockchain/web3-pure/typed-web3-pure/evm-web3-pure/evm-web3-pure';
|
||||||
|
|
||||||
|
export const TOKENS = {
|
||||||
|
[BLOCKCHAIN_NAME.ETHEREUM]: {
|
||||||
|
ETH: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.ETHEREUM,
|
||||||
|
address: EvmWeb3Pure.nativeTokenAddress,
|
||||||
|
decimals: 18,
|
||||||
|
symbol: 'ETH',
|
||||||
|
name: 'Ethereum'
|
||||||
|
}),
|
||||||
|
USDT: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.ETHEREUM,
|
||||||
|
address: '0xdac17f958d2ee523a2206206994597c13d831ec7',
|
||||||
|
decimals: 6,
|
||||||
|
symbol: 'USDT',
|
||||||
|
name: 'Tether USD'
|
||||||
|
}),
|
||||||
|
RBC: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.ETHEREUM,
|
||||||
|
address: '0xa4eed63db85311e22df4473f87ccfc3dadcfa3e3',
|
||||||
|
decimals: 18,
|
||||||
|
symbol: 'RBC',
|
||||||
|
name: 'Rubic'
|
||||||
|
}),
|
||||||
|
WETH: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.ETHEREUM,
|
||||||
|
address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
||||||
|
decimals: 18,
|
||||||
|
symbol: 'WETH',
|
||||||
|
name: 'Wrapped Ether'
|
||||||
|
}),
|
||||||
|
DAI: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.ETHEREUM,
|
||||||
|
address: '0x6b175474e89094c44da98b954eedeac495271d0f',
|
||||||
|
decimals: 18,
|
||||||
|
symbol: 'DAI',
|
||||||
|
name: 'Dai Stablecoin'
|
||||||
|
}),
|
||||||
|
WBTC: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.ETHEREUM,
|
||||||
|
address: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
|
||||||
|
decimals: 8,
|
||||||
|
symbol: 'WBTC',
|
||||||
|
name: 'Wrapped BTC'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
[BLOCKCHAIN_NAME.POLYGON]: {
|
||||||
|
MATIC: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.POLYGON,
|
||||||
|
address: EvmWeb3Pure.nativeTokenAddress,
|
||||||
|
decimals: 18,
|
||||||
|
symbol: 'MAT',
|
||||||
|
name: 'Matoc'
|
||||||
|
}),
|
||||||
|
WMATIC: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.POLYGON,
|
||||||
|
address: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
|
||||||
|
decimals: 18,
|
||||||
|
symbol: 'WMATIC',
|
||||||
|
name: 'Wrapped Matic'
|
||||||
|
}),
|
||||||
|
WETH: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.POLYGON,
|
||||||
|
address: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',
|
||||||
|
decimals: 18,
|
||||||
|
symbol: 'WETH',
|
||||||
|
name: 'Wrapped Ether'
|
||||||
|
}),
|
||||||
|
USDT: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.POLYGON,
|
||||||
|
address: '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
|
||||||
|
decimals: 6,
|
||||||
|
symbol: 'USDT',
|
||||||
|
name: '(PoS) Tether USD'
|
||||||
|
}),
|
||||||
|
DAI: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.POLYGON,
|
||||||
|
address: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063',
|
||||||
|
decimals: 18,
|
||||||
|
symbol: 'DAI',
|
||||||
|
name: '(PoS) Dai Stablecoin'
|
||||||
|
}),
|
||||||
|
USDC: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.POLYGON,
|
||||||
|
address: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
|
||||||
|
decimals: 6,
|
||||||
|
symbol: 'USDC',
|
||||||
|
name: 'USD Coin (PoS)'
|
||||||
|
}),
|
||||||
|
QUICK: new Token({
|
||||||
|
blockchain: BLOCKCHAIN_NAME.POLYGON,
|
||||||
|
address: '0x831753DD7087CaC61aB5644b308642cc1c33Dc13',
|
||||||
|
decimals: 18,
|
||||||
|
symbol: 'QUICK',
|
||||||
|
name: 'Quickswap'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const TOKENS_HOLDERS: Partial<Record<BlockchainName, Record<string, string>>> = {
|
||||||
|
[BLOCKCHAIN_NAME.ETHEREUM]: {
|
||||||
|
'0xa4eed63db85311e22df4473f87ccfc3dadcfa3e3': '0x0541f3300307984984a587aeb7c34139e19124fa', // RBC
|
||||||
|
'0xdac17f958d2ee523a2206206994597c13d831ec7': '0x5754284f345afc66a98fbb0a0afe71e0f007b949' // USDT
|
||||||
|
},
|
||||||
|
[BLOCKCHAIN_NAME.POLYGON]: {
|
||||||
|
'0xc2132d05d31c914a87c6611c10748aeb04b58e8f': '0xdac17f958d2ee523a2206206994597c13d831ec7' // USDT
|
||||||
|
}
|
||||||
|
};
|
16
SDK-mstr/docker-compose.yml
Normal file
16
SDK-mstr/docker-compose.yml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
version: "3.7"
|
||||||
|
|
||||||
|
services:
|
||||||
|
eth-node:
|
||||||
|
image: ottebrut/rubic-sdk-tools:eth-node-1.2
|
||||||
|
container_name: eth-node
|
||||||
|
ports:
|
||||||
|
- 8545:8545
|
||||||
|
- 1545:1545
|
||||||
|
polygon-node:
|
||||||
|
image: ottebrut/rubic-sdk-tools:polygon-node-1.2
|
||||||
|
container_name: polygon-node
|
||||||
|
ports:
|
||||||
|
- 8547:8545
|
||||||
|
- 1547:1545
|
||||||
|
|
25
SDK-mstr/jest.config.js
Normal file
25
SDK-mstr/jest.config.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
module.exports = {
|
||||||
|
preset: 'ts-jest',
|
||||||
|
roots: [
|
||||||
|
"src", "__tests__"
|
||||||
|
],
|
||||||
|
moduleDirectories: ['node_modules', '<rootDir>/src'],
|
||||||
|
testEnvironment: 'node',
|
||||||
|
transform: {
|
||||||
|
"node_modules/(ethereum-cryptography)/.+\\.(j|t)sx?$": "ts-jest",
|
||||||
|
"node_modules/@layerzerolabs/.+\\.(j|t)sx?$": "ts-jest"
|
||||||
|
},
|
||||||
|
transformIgnorePatterns: [ 'node_modules/((?!ethereum-cryptography)/.*)', "node_modules/(?!@layerzerolabs/.*)"],
|
||||||
|
testMatch: ["**/?(*.)+(spec|test).[jt]s?(x)"],
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
tsconfig: 'tsconfig.test.json',
|
||||||
|
useESM: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
moduleNameMapper: {
|
||||||
|
'^src/(.*)$': '<rootDir>/src/$1',
|
||||||
|
'__tests__/(.*)$': '<rootDir>/__tests__/$1',
|
||||||
|
},
|
||||||
|
testTimeout: 300_000
|
||||||
|
};
|
155
SDK-mstr/package.json
Normal file
155
SDK-mstr/package.json
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
{
|
||||||
|
"name": "rubic-sdk",
|
||||||
|
"version": "5.26.2",
|
||||||
|
"description": "Simplify dApp creation",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"types": "lib/index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"lib",
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/Cryptorubic/rubic-sdk.git"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/Cryptorubic/rubic-sdk",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/Cryptorubic/rubic-sdk/issues"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"Ethereum",
|
||||||
|
"Rubic",
|
||||||
|
"Cross-chain",
|
||||||
|
"Multi-Chain",
|
||||||
|
"SDK",
|
||||||
|
"dApp",
|
||||||
|
"DEX",
|
||||||
|
"Polygon",
|
||||||
|
"Binance-Smart-Chain"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16"
|
||||||
|
},
|
||||||
|
"author": "rubic.exchange",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Sergey Andreev",
|
||||||
|
"email": "andreev@mywish.io",
|
||||||
|
"homepage": "https://github.com/siandreev"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Andrey Ott",
|
||||||
|
"email": "ott@mywish.io",
|
||||||
|
"url": "https://github.com/ottebrut"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Sleta Dmitry",
|
||||||
|
"email": "sleta@rubic.finance",
|
||||||
|
"url": "https://github.com/axtezy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Kolebaev Vladislav",
|
||||||
|
"email": "ko1ebayev.worx@gmail.com",
|
||||||
|
"url": "https://github.com/ko1ebayev"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"scripts": {
|
||||||
|
"build": "yarn create-index && webpack && yarn delete-index",
|
||||||
|
"start": "webpack --watch",
|
||||||
|
"compile": "yarn create-index && npx rimraf lib && tsc --project tsconfig.json && tscpaths -p ./tsconfig.json -s ./src -o ./lib && yarn delete-index",
|
||||||
|
"lint": "eslint src __tests__",
|
||||||
|
"create-index": "cti entrypoint ./src --withoutbackup && renamer -f \"/^entrypoint/\" -r \"index\" \"./src/*\" --force",
|
||||||
|
"delete-index": "npx rimraf ./src/index.ts",
|
||||||
|
"test": "cd ./scripts && bash test-runner.sh",
|
||||||
|
"test:unit": "yarn jest ./__tests__/unit-tests",
|
||||||
|
"build:publish": "yarn compile && yarn build && npm publish --access public",
|
||||||
|
"analyze": "webpack --profile --json > stats.json && webpack-bundle-analyzer stats.json",
|
||||||
|
"docs": "yarn create-index && typedoc && yarn delete-index",
|
||||||
|
"publish": "yarn publish --access public",
|
||||||
|
"publish:alpha": "yarn publish --access public --tag alpha"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@1inch/limit-order-protocol-utils": "3.0.1",
|
||||||
|
"@arbitrum/sdk": "^3.1.3",
|
||||||
|
"@debridge-finance/debridge-external-call": "^1.0.7",
|
||||||
|
"@layerzerolabs/scan-client": "^0.0.0-beta.6",
|
||||||
|
"@noble/secp256k1": "^1.7.1",
|
||||||
|
"@pancakeswap/sdk": "^5.1.0",
|
||||||
|
"@pancakeswap/smart-router": "4.2.1",
|
||||||
|
"@pancakeswap/swap-sdk-core": "^1.0.0",
|
||||||
|
"@pancakeswap/tokens": "0.1.6",
|
||||||
|
"@solana/web3.js": "^1.89.1",
|
||||||
|
"@solflare-wallet/utl-sdk": "^1.4.0",
|
||||||
|
"@viaprotocol/router-sdk": "^1.0.7",
|
||||||
|
"assert": "^2.0.0",
|
||||||
|
"axios": "^0.26.1",
|
||||||
|
"bignumber.js": "9.1.0",
|
||||||
|
"bitcoin-address-validation": "2.2.1",
|
||||||
|
"browserify-zlib": "^0.2.0",
|
||||||
|
"cbridge-revert-manager": "1.1.0",
|
||||||
|
"crc32": "^0.2.2",
|
||||||
|
"ethers": "^5.6.8",
|
||||||
|
"graphql-request": "^6.1.0",
|
||||||
|
"grpc-web": "^1.4.2",
|
||||||
|
"iziswap-sdk": "1.4.12",
|
||||||
|
"lodash.clonedeep": "^4.5.0",
|
||||||
|
"rxjs": "7.8.1",
|
||||||
|
"tronweb": "^5.3.2",
|
||||||
|
"viem": "^1.3.1",
|
||||||
|
"web3": "^1.8.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.0.0-0",
|
||||||
|
"@types/jest": "^29.2.3",
|
||||||
|
"@types/lodash.clonedeep": "^4.5.7",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.61.0",
|
||||||
|
"@typescript-eslint/parser": "^5.36.2",
|
||||||
|
"bip39": "^3.0.4",
|
||||||
|
"cancelable-promise": "^4.2.1",
|
||||||
|
"commander": "^8.3.0",
|
||||||
|
"compression-webpack-plugin": "^9.2.0",
|
||||||
|
"create-ts-index": "^1.14.0",
|
||||||
|
"crypto-browserify": "^3.12.0",
|
||||||
|
"delay": "^5.0.0",
|
||||||
|
"eslint": "8.22.0",
|
||||||
|
"eslint-config-airbnb-typescript": "^17.0.0",
|
||||||
|
"eslint-config-prettier": "^8.3.0",
|
||||||
|
"eslint-plugin-import": "^2.22.1",
|
||||||
|
"eslint-plugin-prettier": "^3.4.0",
|
||||||
|
"eslint-plugin-simple-import-sort": "^8.0.0",
|
||||||
|
"eslint-plugin-unused-imports": "^1.1.4",
|
||||||
|
"ethereumjs-wallet": "^1.0.2",
|
||||||
|
"http-browserify": "^1.7.0",
|
||||||
|
"https-browserify": "^1.0.0",
|
||||||
|
"jest": "^29.3.1",
|
||||||
|
"jest-mock-promise": "^2.0.2",
|
||||||
|
"prettier": "^2.2.1",
|
||||||
|
"querystring-es3": "^0.2.1",
|
||||||
|
"renamer": "^4.0.0",
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
|
"stream-browserify": "^3.0.0",
|
||||||
|
"terser-webpack-plugin": "^5.3.0",
|
||||||
|
"ts-essentials": "^9.0.0",
|
||||||
|
"ts-jest": "^29.0.3",
|
||||||
|
"ts-loader": "^9.3.0",
|
||||||
|
"ts-patch": "^3.0.1",
|
||||||
|
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
||||||
|
"tscpaths": "^0.0.9",
|
||||||
|
"typedoc": "^0.23.21",
|
||||||
|
"typescript": "^5.1.6",
|
||||||
|
"typescript-transform-paths": "^3.4.6",
|
||||||
|
"url": "^0.11.0",
|
||||||
|
"webpack": "^5.65.0",
|
||||||
|
"webpack-bundle-analyzer": "^4.5.0",
|
||||||
|
"webpack-cli": "^4.9.1"
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"ethers": {
|
||||||
|
"bignumber.js": "9.1.0"
|
||||||
|
},
|
||||||
|
"symbiosis-js-sdk": {
|
||||||
|
"bignumber.js": "9.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
SDK-mstr/scripts/build-env.js
Normal file
31
SDK-mstr/scripts/build-env.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
const fs = require('fs');
|
||||||
|
const commander = require('commander');
|
||||||
|
const program = new commander.Command();
|
||||||
|
|
||||||
|
program
|
||||||
|
.option('--eth <eth-prc>')
|
||||||
|
.option('--polygon <polygon-rpc>')
|
||||||
|
.parse();
|
||||||
|
|
||||||
|
const options = program.opts();
|
||||||
|
|
||||||
|
if (!options.eth || !options.polygon) {
|
||||||
|
throw new Error('You must pass providers for all networks.');
|
||||||
|
}
|
||||||
|
|
||||||
|
const config = `
|
||||||
|
global.sdkEnv = {
|
||||||
|
providers: {
|
||||||
|
ETH: {
|
||||||
|
jsonRpcUrl: '${options.eth}',
|
||||||
|
blockNumber: 13961175
|
||||||
|
},
|
||||||
|
POLYGON: {
|
||||||
|
jsonRpcUrl: '${options.polygon}',
|
||||||
|
blockNumber: 23571568
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
fs.writeFileSync('./__tests__/env.js', config);
|
19
SDK-mstr/scripts/test-runner.sh
Normal file
19
SDK-mstr/scripts/test-runner.sh
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
rm node.log 2> /dev/null
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
docker compose up &> scripts/node.log &
|
||||||
|
|
||||||
|
echo 'See node logs in scripts/node.log'
|
||||||
|
|
||||||
|
while ! ( grep -q 'Account #19:' scripts/node.log )
|
||||||
|
do
|
||||||
|
sleep 2
|
||||||
|
echo "Waiting for node..."
|
||||||
|
done
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
jest
|
||||||
|
|
||||||
|
docker compose down
|
|
@ -0,0 +1,13 @@
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
import { Token } from 'src/common/tokens';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, if token has deflation.
|
||||||
|
*/
|
||||||
|
export class DeflationTokenError extends RubicSdkError {
|
||||||
|
constructor(public readonly token: Token, public readonly deflationPercent: BigNumber) {
|
||||||
|
super(`Token ${token.address} has ${deflationPercent.dp(2).toFixed()}% deflation`);
|
||||||
|
Object.setPrototypeOf(this, DeflationTokenError.prototype);
|
||||||
|
}
|
||||||
|
}
|
12
SDK-mstr/src/common/errors/blockchain/healthcheck.error.ts
Normal file
12
SDK-mstr/src/common/errors/blockchain/healthcheck.error.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* Thrown, if rpc provider has not passed healthcheck.
|
||||||
|
*/
|
||||||
|
export class HealthcheckError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, HealthcheckError.prototype);
|
||||||
|
}
|
||||||
|
}
|
8
SDK-mstr/src/common/errors/blockchain/index.ts
Normal file
8
SDK-mstr/src/common/errors/blockchain/index.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
export * from './deflation-token.error';
|
||||||
|
export * from './healthcheck.error';
|
||||||
|
export * from './invalid-address.error';
|
||||||
|
export * from './low-gas.error';
|
||||||
|
export * from './transaction-reverted.error';
|
||||||
|
export * from './user-reject.error';
|
||||||
|
export * from './wrong-from-address.error';
|
||||||
|
export * from './wrong-receiver-address.error';
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when passed wallet address is invalid for {@link chainType}.
|
||||||
|
*/
|
||||||
|
export class InvalidAddressError extends RubicSdkError {
|
||||||
|
constructor(public readonly address: string) {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, InvalidAddressError.prototype);
|
||||||
|
}
|
||||||
|
}
|
11
SDK-mstr/src/common/errors/blockchain/low-gas.error.ts
Normal file
11
SDK-mstr/src/common/errors/blockchain/low-gas.error.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when gas price is too low.
|
||||||
|
*/
|
||||||
|
export class LowGasError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, LowGasError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, if transaction was reverted without specified error.
|
||||||
|
*/
|
||||||
|
export class TransactionRevertedError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, TransactionRevertedError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, if transaction was reverted because of insufficient native balance.
|
||||||
|
*/
|
||||||
|
export class TronInsufficientNativeBalance extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super(
|
||||||
|
'Insufficient funds of native token. Decrease swap amount or increase native tokens balance.'
|
||||||
|
);
|
||||||
|
Object.setPrototypeOf(this, TronInsufficientNativeBalance.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, if transaction signing in wallet expired.
|
||||||
|
*/
|
||||||
|
export class TronTransactionExpired extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super('Signing timeout expired. Please, try again.');
|
||||||
|
Object.setPrototypeOf(this, TronTransactionExpired.prototype);
|
||||||
|
}
|
||||||
|
}
|
11
SDK-mstr/src/common/errors/blockchain/user-reject.error.ts
Normal file
11
SDK-mstr/src/common/errors/blockchain/user-reject.error.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when user cancels transaction.
|
||||||
|
*/
|
||||||
|
export class UserRejectError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, UserRejectError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when passed wrong from address in `encode` function.
|
||||||
|
*/
|
||||||
|
export class WrongFromAddressError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, WrongFromAddressError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when passed wrong receiver address.
|
||||||
|
*/
|
||||||
|
export class WrongReceiverAddressError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, WrongReceiverAddressError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when cross-chain contracts are on pause or there is not enough crypto balance.
|
||||||
|
*/
|
||||||
|
export class CrossChainIsUnavailableError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, CrossChainIsUnavailableError.prototype);
|
||||||
|
}
|
||||||
|
}
|
6
SDK-mstr/src/common/errors/cross-chain/index.ts
Normal file
6
SDK-mstr/src/common/errors/cross-chain/index.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
export * from './cross-chain-is-unavailable.error';
|
||||||
|
export * from './insufficient-funds-gas-price-value.error';
|
||||||
|
export * from './low-to-slippage.error';
|
||||||
|
export * from './max-gas-price-overflow.error';
|
||||||
|
export * from './too-low-amount.error';
|
||||||
|
export * from './unsupported-receiver-address.error';
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when user doesn't have enough native token balance for gas fee plus `value`.
|
||||||
|
*/
|
||||||
|
export class InsufficientFundsGasPriceValueError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, InsufficientFundsGasPriceValueError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when toSlippage tolerance is too low to calculate Celer trade.
|
||||||
|
*/
|
||||||
|
export class LowToSlippageError extends RubicSdkError {}
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when current gas price is higher, than max gas price on cross-chain contract
|
||||||
|
* in target network.
|
||||||
|
*/
|
||||||
|
export class MaxGasPriceOverflowError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, MaxGasPriceOverflowError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when amount of tokens don't cover provider's fee
|
||||||
|
*/
|
||||||
|
export class TooLowAmountError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super(
|
||||||
|
"The swap can't be executed with the entered amount of tokens. Please change it to the greater amount."
|
||||||
|
);
|
||||||
|
Object.setPrototypeOf(this, TooLowAmountError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
export class UnsupportedReceiverAddressError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super('This provider doesn’t support the receiver address');
|
||||||
|
Object.setPrototypeOf(this, UnsupportedReceiverAddressError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when current gas price is higher, than max gas price on cross-chain contract
|
||||||
|
* in target network.
|
||||||
|
*/
|
||||||
|
export class UpdatedRatesError extends RubicSdkError {
|
||||||
|
constructor(public readonly oldAmount: string, public readonly newAmount: string) {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, UpdatedRatesError.prototype);
|
||||||
|
}
|
||||||
|
}
|
5
SDK-mstr/src/common/errors/index.ts
Normal file
5
SDK-mstr/src/common/errors/index.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export * from './blockchain';
|
||||||
|
export * from './cross-chain';
|
||||||
|
export * from './rubic-sdk.error';
|
||||||
|
export * from './swap';
|
||||||
|
export * from './utils';
|
1
SDK-mstr/src/common/errors/on-chain/index.ts
Normal file
1
SDK-mstr/src/common/errors/on-chain/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export * from './on-chain-is-unavailable.error';
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when on-chain contracts are on pause.
|
||||||
|
*/
|
||||||
|
export class OnChainIsUnavailableError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, OnChainIsUnavailableError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when contract is not whitelisted on proxy contract.
|
||||||
|
*/
|
||||||
|
export class UnapprovedContractError extends RubicSdkError {
|
||||||
|
constructor(public readonly method: string, public readonly contract: string) {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, UnapprovedContractError.prototype);
|
||||||
|
}
|
||||||
|
}
|
11
SDK-mstr/src/common/errors/proxy/unapproved-method-error.ts
Normal file
11
SDK-mstr/src/common/errors/proxy/unapproved-method-error.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when method is not whitelisted on proxy contract.
|
||||||
|
*/
|
||||||
|
export class UnapprovedMethodError extends RubicSdkError {
|
||||||
|
constructor(public readonly method: string, public readonly contract: string) {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, UnapprovedMethodError.prototype);
|
||||||
|
}
|
||||||
|
}
|
9
SDK-mstr/src/common/errors/rubic-sdk.error.ts
Normal file
9
SDK-mstr/src/common/errors/rubic-sdk.error.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/**
|
||||||
|
* Base class for all errors that can be thrown in sdk.
|
||||||
|
*/
|
||||||
|
export class RubicSdkError extends Error {
|
||||||
|
constructor(message?: string, errorPotions?: ErrorOptions) {
|
||||||
|
super(message, errorPotions);
|
||||||
|
Object.setPrototypeOf(this, RubicSdkError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when `quote` request in bridgers is failed.
|
||||||
|
*/
|
||||||
|
export class BridgersPairIsUnavailableError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super('The swap using this pair is currently unavailable. Please try again later.');
|
||||||
|
Object.setPrototypeOf(this, BridgersPairIsUnavailableError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* Thrown, when transaction is passed, but web3 cannot retrieve transaction receipt.
|
||||||
|
*/
|
||||||
|
export class FailedToCheckForTransactionReceiptError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, FailedToCheckForTransactionReceiptError.prototype);
|
||||||
|
}
|
||||||
|
}
|
17
SDK-mstr/src/common/errors/swap/index.ts
Normal file
17
SDK-mstr/src/common/errors/swap/index.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
export * from './bridgers-pair-is-unavailable.error';
|
||||||
|
export * from './failed-to-check-for-transaction-receipt.error';
|
||||||
|
export * from './insufficient-funds.error';
|
||||||
|
export * from './insufficient-funds-oneinch.error';
|
||||||
|
export * from './insufficient-liquidity.error';
|
||||||
|
export * from './lifi-pair-is-unavailable.error';
|
||||||
|
export * from './low-slippage.error';
|
||||||
|
export * from './low-slippage-deflationary-token.error';
|
||||||
|
export * from './max-amount.error';
|
||||||
|
export * from './min-amount.error';
|
||||||
|
export * from './not-supported-blockchain';
|
||||||
|
export * from './not-supported-tokens.error';
|
||||||
|
export * from './not-whitelisted-provider.error';
|
||||||
|
export * from './swap-request.error';
|
||||||
|
export * from './unnecessary-approve.error';
|
||||||
|
export * from './wallet-not-connected.error';
|
||||||
|
export * from './wrong-network.error';
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
import { BlockchainName } from 'src/core/blockchain/models/blockchain-name';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown by 1inch, if user doesn't have enough balance.
|
||||||
|
*/
|
||||||
|
export class InsufficientFundsOneinchError extends RubicSdkError {
|
||||||
|
constructor(public readonly blockchain: BlockchainName) {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, InsufficientFundsOneinchError.prototype);
|
||||||
|
}
|
||||||
|
}
|
22
SDK-mstr/src/common/errors/swap/insufficient-funds.error.ts
Normal file
22
SDK-mstr/src/common/errors/swap/insufficient-funds.error.ts
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
import { Token } from 'src/common/tokens';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when user doesn't have enough balance.
|
||||||
|
*/
|
||||||
|
export class InsufficientFundsError extends RubicSdkError {
|
||||||
|
/**
|
||||||
|
* @param token Token to swap.
|
||||||
|
* @param balance Token's balance on user wallet in Eth units.
|
||||||
|
* @param requiredBalance Required token's amount to swap in Eth units.
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
public readonly token: Token,
|
||||||
|
public readonly balance: BigNumber,
|
||||||
|
public readonly requiredBalance: BigNumber
|
||||||
|
) {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, InsufficientFundsError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when tokens' pair doesn't have enough liquidity.
|
||||||
|
*/
|
||||||
|
export class InsufficientLiquidityError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, InsufficientLiquidityError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when `swap` transaction in lifi is failed.
|
||||||
|
*/
|
||||||
|
export class LifiPairIsUnavailableError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super('The swap using this pair is currently unavailable. Please try again later.');
|
||||||
|
Object.setPrototypeOf(this, LifiPairIsUnavailableError.prototype);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when user is selling deflationary token with too low slippage.
|
||||||
|
*/
|
||||||
|
export class LowSlippageDeflationaryTokenError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, LowSlippageDeflationaryTokenError.prototype);
|
||||||
|
}
|
||||||
|
}
|
11
SDK-mstr/src/common/errors/swap/low-slippage.error.ts
Normal file
11
SDK-mstr/src/common/errors/swap/low-slippage.error.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown, when slippage tolerance is too low for selected token.
|
||||||
|
*/
|
||||||
|
export class LowSlippageError extends RubicSdkError {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
Object.setPrototypeOf(this, LowSlippageError.prototype);
|
||||||
|
}
|
||||||
|
}
|
9
SDK-mstr/src/common/errors/swap/max-amount.error.ts
Normal file
9
SDK-mstr/src/common/errors/swap/max-amount.error.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
export class MaxAmountError extends RubicSdkError {
|
||||||
|
constructor(public readonly maxAmount: BigNumber, public readonly tokenSymbol: string) {
|
||||||
|
super(`Max amount is ${new BigNumber(maxAmount).toFixed()} ${tokenSymbol}`);
|
||||||
|
Object.setPrototypeOf(this, MaxAmountError.prototype);
|
||||||
|
}
|
||||||
|
}
|
9
SDK-mstr/src/common/errors/swap/min-amount.error.ts
Normal file
9
SDK-mstr/src/common/errors/swap/min-amount.error.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { RubicSdkError } from 'src/common/errors/rubic-sdk.error';
|
||||||
|
|
||||||
|
export class MinAmountError extends RubicSdkError {
|
||||||
|
constructor(public readonly minAmount: BigNumber, public readonly tokenSymbol: string) {
|
||||||
|
super(`Min amount is ${new BigNumber(minAmount).toFixed()} ${tokenSymbol}`);
|
||||||
|
Object.setPrototypeOf(this, MinAmountError.prototype);
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user