From 838749870192989894adc0726a993b3b10c31c58 Mon Sep 17 00:00:00 2001 From: vlad3k Date: Thu, 27 May 2021 17:47:59 +0300 Subject: [PATCH 01/18] init xdai bridge --- .../bridge-page/bridge-page.module.ts | 2 + ...ereum-xdai-bridge-provider.service.spec.ts | 16 +++++ .../ethereum-xdai-bridge-provider.service.ts | 62 +++++++++++++++++++ .../bridge-page/services/bridge.service.ts | 8 ++- .../common/constants/BLOCKCHAINS.ts | 10 +++ .../tokens-input/tokens-input.component.ts | 1 - .../models/blockchain/BLOCKCHAIN_NAME.ts | 1 + src/app/shared/pipes/scanner-link.pipe.ts | 6 ++ src/assets/images/icons/coins/xdai.svg | 22 +++++++ 9 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.spec.ts create mode 100644 src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts create mode 100644 src/assets/images/icons/coins/xdai.svg diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/bridge-page.module.ts b/src/app/features/cross-chain-swaps-page/bridge-page/bridge-page.module.ts index cfb0aa2699..5da17de9c0 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/bridge-page.module.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/bridge-page.module.ts @@ -27,6 +27,7 @@ import { ReceiveButtonComponent } from './components/bridge-table/deposit-button import { EthereumTronBridgeProviderService } from './services/blockchains-bridge-provider/ethereum-tron-bridge-provider/ethereum-tron-bridge-provider.service'; import { BinanceTronBridgeProviderService } from './services/blockchains-bridge-provider/binance-tron-bridge-provider/binance-tron-bridge-provider.service'; import { PanamaBridgeProviderService } from './services/blockchains-bridge-provider/common/panama-bridge-provider/panama-bridge-provider.service'; +import { EthereumXdaiBridgeProviderService } from './services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service'; @NgModule({ declarations: [ @@ -61,6 +62,7 @@ import { PanamaBridgeProviderService } from './services/blockchains-bridge-provi EthereumBinanceRubicBridgeProviderService, EthereumPolygonBridgeProviderService, EthereumTronBridgeProviderService, + EthereumXdaiBridgeProviderService, BinanceTronBridgeProviderService ] }) diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.spec.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.spec.ts new file mode 100644 index 0000000000..5c28ab71f4 --- /dev/null +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { EthereumXdaiBridgeProviderService } from './ethereum-xdai-bridge-provider.service'; + +describe('EthereumXdaiBridgeProviderService', () => { + let service: EthereumXdaiBridgeProviderService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(EthereumXdaiBridgeProviderService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts new file mode 100644 index 0000000000..e8187b8a21 --- /dev/null +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts @@ -0,0 +1,62 @@ +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { List } from 'immutable'; +import { map } from 'rxjs/operators'; +import { BlockchainsBridgeProvider } from '../blockchains-bridge-provider'; +import { PanamaBridgeProviderService } from '../common/panama-bridge-provider/panama-bridge-provider.service'; +import SwapToken from '../../../../../../shared/models/tokens/SwapToken'; +import { BlockchainsTokens, BridgeToken } from '../../../models/BridgeToken'; +import { BLOCKCHAIN_NAME } from '../../../../../../shared/models/blockchain/BLOCKCHAIN_NAME'; +import { BridgeTrade } from '../../../models/BridgeTrade'; +import { PanamaToken } from '../common/panama-bridge-provider/models/PanamaToken'; + +@Injectable() +export class EthereumXdaiBridgeProviderService extends BlockchainsBridgeProvider { + constructor(private commonPanamaBridgeProviderService: PanamaBridgeProviderService) { + super(); + } + + private static parseUSDTPanamaToken(token: PanamaToken): BridgeToken { + return { + symbol: token.symbol, + image: '', + rank: 0, + + blockchainToken: { + [BLOCKCHAIN_NAME.ETHEREUM]: { + address: token.ethContractAddress, + name: token.name, + symbol: token.ethSymbol, + decimals: token.ethContractDecimal, + + minAmount: token.minAmount, + maxAmount: token.maxAmount + }, + [BLOCKCHAIN_NAME.XDAI]: { + address: '0x44fA8E6f47987339850636F88629646662444217', + name: token.name, + symbol: token.ethSymbol, + decimals: token.ethContractDecimal, + + minAmount: token.minAmount, + maxAmount: token.maxAmount + } + } as BlockchainsTokens + }; + } + + getTokensList(swapTokens: List): Observable> { + return undefined; + } + + getFee(token: BridgeToken, toBlockchain: BLOCKCHAIN_NAME): Observable { + return undefined; + } + + createTrade( + bridgeTrade: BridgeTrade, + updateTransactionsList: () => Promise + ): Observable { + return undefined; + } +} diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/bridge.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/bridge.service.ts index 722a206ba1..b1c3cef614 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/bridge.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/bridge.service.ts @@ -28,6 +28,7 @@ import { EthereumBinanceRubicBridgeProviderService } from './blockchains-bridge- import { EthereumBinanceBridgeProviderService } from './blockchains-bridge-provider/ethereum-binance-bridge-provider/ethereum-binance-bridge-provider.service'; import { BlockchainsBridgeProvider } from './blockchains-bridge-provider/blockchains-bridge-provider'; import { BridgeToken } from '../models/BridgeToken'; +import { EthereumXdaiBridgeProviderService } from './blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service'; @Injectable() export class BridgeService implements OnDestroy { @@ -49,7 +50,8 @@ export class BridgeService implements OnDestroy { [BLOCKCHAIN_NAME.ETHEREUM]: { [BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN]: List([]), [BLOCKCHAIN_NAME.POLYGON]: List([]), - [BLOCKCHAIN_NAME.TRON]: List([]) + [BLOCKCHAIN_NAME.TRON]: List([]), + [BLOCKCHAIN_NAME.XDAI]: List([]) }, [BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN]: { [BLOCKCHAIN_NAME.TRON]: List([]) @@ -77,6 +79,7 @@ export class BridgeService implements OnDestroy { private ethereumPolygonBridgeProviderService: EthereumPolygonBridgeProviderService, private ethereumTronBridgeProviderService: EthereumTronBridgeProviderService, private binanceTronBridgeProviderService: BinanceTronBridgeProviderService, + private ethereumXdaiBridgeProviderService: EthereumXdaiBridgeProviderService, private tokensService: TokensService, private web3PrivateService: Web3PrivateService, private web3PublicService: Web3PublicService, @@ -128,6 +131,9 @@ export class BridgeService implements OnDestroy { case BLOCKCHAIN_NAME.POLYGON: this.bridgeProvider = this.ethereumPolygonBridgeProviderService; break; + case BLOCKCHAIN_NAME.XDAI: + this.bridgeProvider = this.ethereumXdaiBridgeProviderService; + break; default: this.bridgeProvider = this.ethereumTronBridgeProviderService; } diff --git a/src/app/features/cross-chain-swaps-page/common/constants/BLOCKCHAINS.ts b/src/app/features/cross-chain-swaps-page/common/constants/BLOCKCHAINS.ts index c6fe3eb152..f18a689147 100644 --- a/src/app/features/cross-chain-swaps-page/common/constants/BLOCKCHAINS.ts +++ b/src/app/features/cross-chain-swaps-page/common/constants/BLOCKCHAINS.ts @@ -6,6 +6,7 @@ type Blockchains = { [BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN]: BridgeBlockchain; [BLOCKCHAIN_NAME.POLYGON]: BridgeBlockchain; [BLOCKCHAIN_NAME.TRON]: BridgeBlockchain; + [BLOCKCHAIN_NAME.XDAI]: BridgeBlockchain; }; export const BLOCKCHAINS: Blockchains = { @@ -44,5 +45,14 @@ export const BLOCKCHAINS: Blockchains = { baseUrl: 'https://tronscan.org/#/', addressBaseUrl: 'https://tronscan.org/#/address/', scannerLabel: 'Tron explorer' + }, + [BLOCKCHAIN_NAME.XDAI]: { + key: BLOCKCHAIN_NAME.XDAI, + label: 'XDAI', + name: 'XDAI', + img: 'xdai.svg', + baseUrl: 'https://blockscout.com/xdai/mainnet/', + addressBaseUrl: 'https://blockscout.com/xdai/mainnet/address/', + scannerLabel: 'xDai explorer' } }; diff --git a/src/app/shared/components/tokens-input/tokens-input.component.ts b/src/app/shared/components/tokens-input/tokens-input.component.ts index e772f7d7d4..ef56581a54 100644 --- a/src/app/shared/components/tokens-input/tokens-input.component.ts +++ b/src/app/shared/components/tokens-input/tokens-input.component.ts @@ -8,7 +8,6 @@ import { ViewChild } from '@angular/core'; import { List } from 'immutable'; -import BigNumber from 'bignumber.js'; import { InputTokenShort } from './types'; import { TokenLabelComponent } from './token-label/token-label.component'; import { InputDropdownComponent } from '../input-dropdown/input-dropdown.component'; diff --git a/src/app/shared/models/blockchain/BLOCKCHAIN_NAME.ts b/src/app/shared/models/blockchain/BLOCKCHAIN_NAME.ts index 261105ab42..f60bdf221f 100644 --- a/src/app/shared/models/blockchain/BLOCKCHAIN_NAME.ts +++ b/src/app/shared/models/blockchain/BLOCKCHAIN_NAME.ts @@ -3,6 +3,7 @@ export enum BLOCKCHAIN_NAME { BINANCE_SMART_CHAIN = 'BSC', POLYGON = 'POLYGON', TRON = 'TRX', + XDAI = 'XDAI', ETHEREUM_TESTNET = 'ETH_TESTNET', GOERLI_TESTNET = 'GOERLI_TESTNET', BINANCE_SMART_CHAIN_TESTNET = 'BSC_TESTNET', diff --git a/src/app/shared/pipes/scanner-link.pipe.ts b/src/app/shared/pipes/scanner-link.pipe.ts index 0edb01c626..ea0c9f000a 100644 --- a/src/app/shared/pipes/scanner-link.pipe.ts +++ b/src/app/shared/pipes/scanner-link.pipe.ts @@ -38,6 +38,12 @@ const blockchainsScanners = { [ADDRESS_TYPE.WALLET]: 'address/', [ADDRESS_TYPE.TOKEN]: 'token20/', [ADDRESS_TYPE.TRANSACTION]: 'transaction/' + }, + [BLOCKCHAIN_NAME.XDAI]: { + baseUrl: 'https://blockscout.com/xdai/mainnet/', + [ADDRESS_TYPE.WALLET]: 'address/', + [ADDRESS_TYPE.TOKEN]: 'tokens/', + [ADDRESS_TYPE.TRANSACTION]: 'tx/' } }; diff --git a/src/assets/images/icons/coins/xdai.svg b/src/assets/images/icons/coins/xdai.svg new file mode 100644 index 0000000000..044b3395a7 --- /dev/null +++ b/src/assets/images/icons/coins/xdai.svg @@ -0,0 +1,22 @@ + + + + +Group 6 +Created with Sketch. + + + + + + + + + + + + From cb7d3bd08e8af9b5da4496b12ab4777ee36742a1 Mon Sep 17 00:00:00 2001 From: vlad3k Date: Fri, 28 May 2021 17:49:52 +0300 Subject: [PATCH 02/18] xdai in progress --- package-lock.json | 252 +++++++++++++++--- package.json | 2 +- .../web3-private.service.ts | 3 +- .../brifge-form/bridge-form.component.html | 11 +- .../brifge-form/bridge-form.component.ts | 2 +- .../ethereum-xdai-bridge-provider.service.ts | 46 ++-- src/app/shared/pipes/with-round.pipe.ts | 2 +- 7 files changed, 265 insertions(+), 53 deletions(-) diff --git a/package-lock.json b/package-lock.json index beef721834..0ef90cc7b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2359,15 +2359,20 @@ } }, "@nguniversal/common": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/@nguniversal/common/-/common-12.0.0.tgz", - "integrity": "sha512-1zKSy1DSsuMbUdNtuior0i7oIZtzeJiCN4HKofACEcw2IkvwPN2gMbnWRmE69M3xGMDRPD/z5D9IYpriZSc9iA==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@nguniversal/common/-/common-12.0.1.tgz", + "integrity": "sha512-mBvcjd0FL/LNGSy31aMXBB3XkaGukbruN77UYbm3O7ViLr+ttaxiE+Hl/gjiSwIHPGfJYjDMRfa3rmZRJ0c6Sg==", "requires": { "critters": "0.0.10", - "jsdom": "16.5.3", + "jsdom": "16.6.0", "tslib": "^2.1.0" }, "dependencies": { + "acorn": { + "version": "8.2.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.2.4.tgz", + "integrity": "sha512-Ibt84YwBDDA890eDiDCEqcbwvHlBvzzDkU2cGBBDDI1QWT12jTiXIOn2CIw5KK4i6N5Z2HUxwYjzriDyqaqqZg==" + }, "critters": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/critters/-/critters-0.0.10.tgz", @@ -2380,10 +2385,69 @@ "pretty-bytes": "^5.3.0" } }, + "form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "jsdom": { + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.6.0.tgz", + "integrity": "sha512-Ty1vmF4NHJkolaEmdjtxTfSfkdb8Ywarwf63f+F8/mDD1uLSSWDxDuMiZxiPhwunLrn9LOSVItWj4bLYsLN3Dg==", + "requires": { + "abab": "^2.0.5", + "acorn": "^8.2.4", + "acorn-globals": "^6.0.0", + "cssom": "^0.4.4", + "cssstyle": "^2.3.0", + "data-urls": "^2.0.0", + "decimal.js": "^10.2.1", + "domexception": "^2.0.1", + "escodegen": "^2.0.0", + "form-data": "^3.0.0", + "html-encoding-sniffer": "^2.0.1", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.0", + "parse5": "6.0.1", + "saxes": "^5.0.1", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.0.0", + "w3c-hr-time": "^1.0.2", + "w3c-xmlserializer": "^2.0.0", + "webidl-conversions": "^6.1.0", + "whatwg-encoding": "^1.0.5", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^8.5.0", + "ws": "^7.4.5", + "xml-name-validator": "^3.0.0" + } + }, "parse5": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + }, + "tough-cookie": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", + "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==", + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.1.2" + } + }, + "ws": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==" } } }, @@ -2594,6 +2658,42 @@ "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" }, + "@sindresorhus/slugify": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@sindresorhus/slugify/-/slugify-1.1.2.tgz", + "integrity": "sha512-V9nR/W0Xd9TSGXpZ4iFUcFGhuOJtZX82Fzxj1YISlbSgKvIiNa7eLEZrT0vAraPOt++KHauIVNYgGRgjc13dXA==", + "dev": true, + "requires": { + "@sindresorhus/transliterate": "^0.1.1", + "escape-string-regexp": "^4.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + } + } + }, + "@sindresorhus/transliterate": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@sindresorhus/transliterate/-/transliterate-0.1.2.tgz", + "integrity": "sha512-5/kmIOY9FF32nicXH+5yLNTX4NJ4atl7jRgqAJuIn/iyDFXBktOKDxCvyGE/EzmF4ngSUvjXxQUQlQiZ5lfw+w==", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0", + "lodash.deburr": "^4.1.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + } + } + }, "@stylelint/postcss-css-in-js": { "version": "0.37.2", "resolved": "https://registry.npmjs.org/@stylelint/postcss-css-in-js/-/postcss-css-in-js-0.37.2.tgz", @@ -2624,8 +2724,7 @@ "@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "dev": true + "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==" }, "@types/bluebird": { "version": "3.5.33", @@ -3255,7 +3354,6 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, "requires": { "debug": "4" }, @@ -3264,7 +3362,6 @@ "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, "requires": { "ms": "2.1.2" } @@ -3272,8 +3369,7 @@ "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" } } }, @@ -9009,7 +9105,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "dev": true, "requires": { "@tootallnate/once": "1", "agent-base": "6", @@ -9020,7 +9115,6 @@ "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, "requires": { "ms": "2.1.2" } @@ -9028,8 +9122,7 @@ "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" } } }, @@ -9170,7 +9263,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "dev": true, "requires": { "agent-base": "6", "debug": "4" @@ -9180,7 +9272,6 @@ "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, "requires": { "ms": "2.1.2" } @@ -9188,8 +9279,7 @@ "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" } } }, @@ -9440,6 +9530,12 @@ "ipaddr.js": "^1.9.0" } }, + "interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true + }, "ip": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", @@ -10113,6 +10209,7 @@ "version": "16.5.3", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.5.3.tgz", "integrity": "sha512-Qj1H+PEvUsOtdPJ056ewXM4UJPCi4hhLA8wpiz9F2YvsRBhuFsXxtrIFAgGBDynQA9isAMGE91PfUYbdMPXuTA==", + "dev": true, "requires": { "abab": "^2.0.5", "acorn": "^8.1.0", @@ -10145,17 +10242,20 @@ "acorn": { "version": "8.2.4", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.2.4.tgz", - "integrity": "sha512-Ibt84YwBDDA890eDiDCEqcbwvHlBvzzDkU2cGBBDDI1QWT12jTiXIOn2CIw5KK4i6N5Z2HUxwYjzriDyqaqqZg==" + "integrity": "sha512-Ibt84YwBDDA890eDiDCEqcbwvHlBvzzDkU2cGBBDDI1QWT12jTiXIOn2CIw5KK4i6N5Z2HUxwYjzriDyqaqqZg==", + "dev": true }, "parse5": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", - "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", + "dev": true }, "tough-cookie": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==", + "dev": true, "requires": { "psl": "^1.1.33", "punycode": "^2.1.1", @@ -10163,9 +10263,10 @@ } }, "ws": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.5.tgz", - "integrity": "sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g==" + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "dev": true } } }, @@ -10996,6 +11097,12 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "lodash.deburr": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz", + "integrity": "sha1-3bG7s+8HRYwBd7oH3hRCLLAz/5s=", + "dev": true + }, "lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -18840,6 +18947,15 @@ "picomatch": "^2.2.1" } }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, "redent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", @@ -19052,6 +19168,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz", "integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==", + "dev": true, "requires": { "lodash": "^4.17.19" } @@ -19060,6 +19177,7 @@ "version": "1.0.9", "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz", "integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==", + "dev": true, "requires": { "request-promise-core": "1.1.4", "stealthy-require": "^1.1.1", @@ -19840,6 +19958,17 @@ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, + "shelljs": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", + "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", @@ -20520,7 +20649,8 @@ "stealthy-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", - "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", + "dev": true }, "stream-browserify": { "version": "2.0.2", @@ -22468,6 +22598,68 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, + "text2locale": { + "version": "github:juliandavidmr/text2locale#de6ee3d2ddb6dc61caf021378b72a5d602fc21fb", + "from": "github:juliandavidmr/text2locale", + "dev": true, + "requires": { + "@sindresorhus/slugify": "^1.1.0", + "jsdom": "^16.4.0", + "shelljs": "^0.8.4", + "yargs": "^16.0.3" + }, + "dependencies": { + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.7", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", + "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", + "dev": true + } + } + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -22645,9 +22837,9 @@ } }, "tr46": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.0.2.tgz", - "integrity": "sha512-3n1qG+/5kg+jrbTzwAykB5yRYtQCTqOGKq5U5PE3b0a1/mzo6snDhjGS0zJVJunO0NrT3Dg1MLy5TjWP/UJppg==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.1.0.tgz", + "integrity": "sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==", "requires": { "punycode": "^2.1.1" } @@ -22975,9 +23167,9 @@ } }, "typescript": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz", - "integrity": "sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.5.tgz", + "integrity": "sha512-6OSu9PTIzmn9TCDiovULTnET6BgXtDYL4Gg4szY+cGsc3JP1dQL8qvE8kShTRx1NIw4Q9IBHlwODjkjWEtMUyA==", "dev": true }, "ua-parser-js": { diff --git a/package.json b/package.json index 39fe20a3be..75625b9c90 100644 --- a/package.json +++ b/package.json @@ -100,6 +100,6 @@ "text2locale": "github:juliandavidmr/text2locale", "ts-node": "~7.0.0", "tslint": "~6.1.0", - "typescript": "^4.1.5" + "typescript": "~4.1.5" } } diff --git a/src/app/core/services/blockchain/web3-private-service/web3-private.service.ts b/src/app/core/services/blockchain/web3-private-service/web3-private.service.ts index 8015c32628..e6133c1843 100644 --- a/src/app/core/services/blockchain/web3-private-service/web3-private.service.ts +++ b/src/app/core/services/blockchain/web3-private-service/web3-private.service.ts @@ -5,13 +5,13 @@ import BigNumber from 'bignumber.js'; import { TransactionReceipt } from 'web3-eth'; import { Observable } from 'rxjs'; +import { TranslateService } from '@ngx-translate/core'; import { MetamaskProviderService } from '../private-provider/metamask-provider/metamask-provider.service'; import ERC20_TOKEN_ABI from '../constants/erc-20-abi'; import { IBlockchain } from '../../../../shared/models/blockchain/IBlockchain'; import { BLOCKCHAIN_NAME } from '../../../../shared/models/blockchain/BLOCKCHAIN_NAME'; import { UserRejectError } from '../../../../shared/models/errors/provider/UserRejectError'; import SwapToken from '../../../../shared/models/tokens/SwapToken'; -import { TranslateService } from '@ngx-translate/core'; @Injectable({ providedIn: 'root' @@ -109,6 +109,7 @@ export class Web3PrivateService { .on('receipt', resolve) .on('error', err => { console.error(`Tokens transfer error. ${err}`); + console.log(err); if (err.code === 4001) { reject(new UserRejectError(this.translateService)); } else { diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.html b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.html index 492c2a449e..7835779ce5 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.html +++ b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.html @@ -184,7 +184,9 @@ ? 'https://www.binance.org/' : isBlockchainSelected(BLOCKCHAIN_NAME.POLYGON) ? 'https://polygon.technology/' - : 'https://tron.network/' + : isBlockchainSelected(BLOCKCHAIN_NAME.TRON) + ? 'https://tron.network/' + : 'https://www.xdaichain.com/' " target="_blank" > @@ -194,9 +196,10 @@ ? 'Binance Smart Chain' : isBlockchainSelected(BLOCKCHAIN_NAME.POLYGON) ? 'Polygon' - : 'TRON' - }} - {{ 'bridgePage.whatIsAfter' | translate }}? + : isBlockchainSelected(BLOCKCHAIN_NAME.TRON) + ? 'TRON' + : 'xDai' + }}{{ 'bridgePage.whatIsAfter' | translate }}? diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts index c859fdae72..bfa22bce9f 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts @@ -33,7 +33,7 @@ export class BridgeFormComponent implements OnInit, OnDestroy { public ADDRESS_TYPE = ADDRESS_TYPE; public fromBlockchainsList: BridgeBlockchain[] = Object.values(BLOCKCHAINS).filter( - b => b.key !== BLOCKCHAIN_NAME.TRON + b => b.key !== BLOCKCHAIN_NAME.TRON && b.key !== BLOCKCHAIN_NAME.XDAI ); public toBlockchainsList: BridgeBlockchain[] = Object.values(BLOCKCHAINS); diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts index e8187b8a21..3fe3549311 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts @@ -1,22 +1,25 @@ import { Injectable } from '@angular/core'; -import { Observable } from 'rxjs'; +import { Observable, of } from 'rxjs'; import { List } from 'immutable'; import { map } from 'rxjs/operators'; import { BlockchainsBridgeProvider } from '../blockchains-bridge-provider'; import { PanamaBridgeProviderService } from '../common/panama-bridge-provider/panama-bridge-provider.service'; -import SwapToken from '../../../../../../shared/models/tokens/SwapToken'; import { BlockchainsTokens, BridgeToken } from '../../../models/BridgeToken'; import { BLOCKCHAIN_NAME } from '../../../../../../shared/models/blockchain/BLOCKCHAIN_NAME'; import { BridgeTrade } from '../../../models/BridgeTrade'; import { PanamaToken } from '../common/panama-bridge-provider/models/PanamaToken'; +import { Web3PrivateService } from '../../../../../../core/services/blockchain/web3-private-service/web3-private.service'; @Injectable() export class EthereumXdaiBridgeProviderService extends BlockchainsBridgeProvider { - constructor(private commonPanamaBridgeProviderService: PanamaBridgeProviderService) { + constructor( + private commonPanamaBridgeProviderService: PanamaBridgeProviderService, + private web3PrivateService: Web3PrivateService + ) { super(); } - private static parseUSDTPanamaToken(token: PanamaToken): BridgeToken { + private static parseXdaiPanamaToken(token: PanamaToken): BridgeToken { return { symbol: token.symbol, image: '', @@ -29,8 +32,8 @@ export class EthereumXdaiBridgeProviderService extends BlockchainsBridgeProvider symbol: token.ethSymbol, decimals: token.ethContractDecimal, - minAmount: token.minAmount, - maxAmount: token.maxAmount + minAmount: 0.005, + maxAmount: 9999999 }, [BLOCKCHAIN_NAME.XDAI]: { address: '0x44fA8E6f47987339850636F88629646662444217', @@ -45,18 +48,31 @@ export class EthereumXdaiBridgeProviderService extends BlockchainsBridgeProvider }; } - getTokensList(swapTokens: List): Observable> { - return undefined; + getTokensList(): Observable> { + return this.commonPanamaBridgeProviderService.getTokensList().pipe( + map(tokens => { + return tokens + .filter(token => token.symbol === 'DAI') + .map(EthereumXdaiBridgeProviderService.parseXdaiPanamaToken); + }) + ); } - getFee(token: BridgeToken, toBlockchain: BLOCKCHAIN_NAME): Observable { - return undefined; + getFee(): Observable { + return of(0); } - createTrade( - bridgeTrade: BridgeTrade, - updateTransactionsList: () => Promise - ): Observable { - return undefined; + public createTrade(bridgeTrade: BridgeTrade): Observable { + const { token } = bridgeTrade; + const tokenAddress = token.blockchainToken[bridgeTrade.fromBlockchain].address; + const depositAddress = '0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016'; + const { decimals } = token.blockchainToken[bridgeTrade.fromBlockchain]; + const amountInWei = bridgeTrade.amount.multipliedBy(10 ** decimals); + + this.web3PrivateService + .transferTokens(tokenAddress, depositAddress, amountInWei.toFixed()) + .then(receipt => console.log(receipt)); + + return of('welding'); } } diff --git a/src/app/shared/pipes/with-round.pipe.ts b/src/app/shared/pipes/with-round.pipe.ts index 0dd36f2a37..766038e06f 100644 --- a/src/app/shared/pipes/with-round.pipe.ts +++ b/src/app/shared/pipes/with-round.pipe.ts @@ -36,7 +36,7 @@ export class WithRoundPipe implements PipeTransform { } decimalSymbols = zerosAmount + maxRound; } - decimalSymbols = Math.min(decimalSymbols, token.decimals); + decimalSymbols = Math.min(decimalSymbols, token?.decimals); } else { decimalSymbols = token?.decimals ? token.decimals : this.DEFAULT_DECIMAL_LENGTH; } From 2b2fc6b9da1f43a658b2a8a9831f9c79ce55105f Mon Sep 17 00:00:00 2001 From: vlad3k Date: Fri, 28 May 2021 19:16:40 +0300 Subject: [PATCH 03/18] update image --- .../web3-private.service.ts | 1 - .../brifge-form/bridge-form.component.ts | 1 + .../ethereum-xdai-bridge-provider.service.ts | 6 +--- src/assets/images/icons/coins/xdai.svg | 28 +++++-------------- 4 files changed, 9 insertions(+), 27 deletions(-) diff --git a/src/app/core/services/blockchain/web3-private-service/web3-private.service.ts b/src/app/core/services/blockchain/web3-private-service/web3-private.service.ts index e6133c1843..01b7149a06 100644 --- a/src/app/core/services/blockchain/web3-private-service/web3-private.service.ts +++ b/src/app/core/services/blockchain/web3-private-service/web3-private.service.ts @@ -109,7 +109,6 @@ export class Web3PrivateService { .on('receipt', resolve) .on('error', err => { console.error(`Tokens transfer error. ${err}`); - console.log(err); if (err.code === 4001) { reject(new UserRejectError(this.translateService)); } else { diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts index bfa22bce9f..4f30560364 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts @@ -433,6 +433,7 @@ export class BridgeFormComponent implements OnInit, OnDestroy { this.buttonAnimation = false; }, err => { + console.log('errrrrororororororororororor'); this.tradeInProgress = false; this.buttonAnimation = false; this.errorsService.showErrorDialog(err, this.dialog); diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts index 3fe3549311..fb150a1f1f 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts @@ -69,10 +69,6 @@ export class EthereumXdaiBridgeProviderService extends BlockchainsBridgeProvider const { decimals } = token.blockchainToken[bridgeTrade.fromBlockchain]; const amountInWei = bridgeTrade.amount.multipliedBy(10 ** decimals); - this.web3PrivateService - .transferTokens(tokenAddress, depositAddress, amountInWei.toFixed()) - .then(receipt => console.log(receipt)); - - return of('welding'); + this.web3PrivateService.transferTokens(tokenAddress, depositAddress, amountInWei.toFixed()); } } diff --git a/src/assets/images/icons/coins/xdai.svg b/src/assets/images/icons/coins/xdai.svg index 044b3395a7..6a2d3358ae 100644 --- a/src/assets/images/icons/coins/xdai.svg +++ b/src/assets/images/icons/coins/xdai.svg @@ -1,22 +1,8 @@ - - - - -Group 6 -Created with Sketch. - - - - - - - - - - - + + + + + + + From b88830351824890a39cc841c6460f4f71d70068d Mon Sep 17 00:00:00 2001 From: vlad3k Date: Mon, 31 May 2021 13:18:19 +0300 Subject: [PATCH 04/18] post query --- .../backend/bridge-api/bridge-api.service.ts | 34 ++++++++++++++++ .../brifge-form/bridge-form.component.ts | 1 - .../ethereum-xdai-bridge-provider.service.ts | 40 ++++++++++++++++--- 3 files changed, 69 insertions(+), 6 deletions(-) diff --git a/src/app/core/services/backend/bridge-api/bridge-api.service.ts b/src/app/core/services/backend/bridge-api/bridge-api.service.ts index 7c23fb91bf..8aa8434110 100644 --- a/src/app/core/services/backend/bridge-api/bridge-api.service.ts +++ b/src/app/core/services/backend/bridge-api/bridge-api.service.ts @@ -176,6 +176,40 @@ export class BridgeApiService { }); } + public postXDaiTransaction( + bridgeTrade: BridgeTrade, + transactionHash: string, + userAddress: string + ): Promise { + const body = { + type: 'xdai', + fromNetwork: BLOCKCHAIN_NAME.ETHEREUM, + toNetwork: BLOCKCHAIN_NAME.XDAI, + actualFromAmount: bridgeTrade.amount, + actualToAmount: bridgeTrade.amount, + ethSymbol: bridgeTrade.token.blockchainToken[bridgeTrade.fromBlockchain].address, + bscSymbol: bridgeTrade.token.blockchainToken[bridgeTrade.toBlockchain].address, + updateTime: new Date(), + status: TRADE_STATUS.DEPOSIT_IN_PROGRESS, + transaction_id: transactionHash, + walletFromAddress: userAddress, + walletToAddress: userAddress, + walletDepositAddress: '0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016' + }; + + return new Promise((resolve, reject) => { + this.httpService.post('bridges/transactions', body).subscribe( + () => { + resolve(); + }, + error => { + console.error(error); + reject(error); + } + ); + }); + } + public notifyBridgeBot( bridgeTrade: BridgeTrade, transactionHash: string, diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts index 4f30560364..bfa22bce9f 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts @@ -433,7 +433,6 @@ export class BridgeFormComponent implements OnInit, OnDestroy { this.buttonAnimation = false; }, err => { - console.log('errrrrororororororororororor'); this.tradeInProgress = false; this.buttonAnimation = false; this.errorsService.showErrorDialog(err, this.dialog); diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts index fb150a1f1f..05422b93a2 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; -import { Observable, of } from 'rxjs'; +import { from, Observable, of } from 'rxjs'; import { List } from 'immutable'; -import { map } from 'rxjs/operators'; +import { map, tap } from 'rxjs/operators'; import { BlockchainsBridgeProvider } from '../blockchains-bridge-provider'; import { PanamaBridgeProviderService } from '../common/panama-bridge-provider/panama-bridge-provider.service'; import { BlockchainsTokens, BridgeToken } from '../../../models/BridgeToken'; @@ -9,12 +9,14 @@ import { BLOCKCHAIN_NAME } from '../../../../../../shared/models/blockchain/BLOC import { BridgeTrade } from '../../../models/BridgeTrade'; import { PanamaToken } from '../common/panama-bridge-provider/models/PanamaToken'; import { Web3PrivateService } from '../../../../../../core/services/blockchain/web3-private-service/web3-private.service'; +import { BridgeApiService } from '../../../../../../core/services/backend/bridge-api/bridge-api.service'; @Injectable() export class EthereumXdaiBridgeProviderService extends BlockchainsBridgeProvider { constructor( private commonPanamaBridgeProviderService: PanamaBridgeProviderService, - private web3PrivateService: Web3PrivateService + private web3PrivateService: Web3PrivateService, + private bridgeApiService: BridgeApiService ) { super(); } @@ -62,13 +64,41 @@ export class EthereumXdaiBridgeProviderService extends BlockchainsBridgeProvider return of(0); } - public createTrade(bridgeTrade: BridgeTrade): Observable { + public createTrade( + bridgeTrade: BridgeTrade, + updateTransactionsList: () => Promise + ): Observable { const { token } = bridgeTrade; const tokenAddress = token.blockchainToken[bridgeTrade.fromBlockchain].address; const depositAddress = '0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016'; const { decimals } = token.blockchainToken[bridgeTrade.fromBlockchain]; const amountInWei = bridgeTrade.amount.multipliedBy(10 ** decimals); - this.web3PrivateService.transferTokens(tokenAddress, depositAddress, amountInWei.toFixed()); + const onTradeTransactionHash = async hash => { + if (bridgeTrade.onTransactionHash) { + bridgeTrade.onTransactionHash(hash); + } + await this.bridgeApiService.postXDaiTransaction( + bridgeTrade, + hash, + this.web3PrivateService.address + ); + updateTransactionsList(); + }; + + return from( + this.web3PrivateService.transferTokens(tokenAddress, depositAddress, amountInWei.toFixed(), { + onTransactionHash: onTradeTransactionHash + }) + ).pipe( + map(receipt => receipt.transactionHash), + tap(transactionHash => { + this.bridgeApiService.notifyBridgeBot( + bridgeTrade, + transactionHash, + this.web3PrivateService.address + ); + }) + ); } } From fd7ea38c1676fa948e22d70eefdbaf33b1709d6a Mon Sep 17 00:00:00 2001 From: vlad3k Date: Tue, 1 Jun 2021 11:31:57 +0300 Subject: [PATCH 05/18] fix comments --- .../backend/bridge-api/bridge-api.service.ts | 3 +- .../brifge-form/bridge-form.component.html | 28 +------- .../brifge-form/bridge-form.component.ts | 38 +++++++++++ .../ethereum-xdai-bridge-provider.service.ts | 68 +++++++++---------- .../tokens-input/tokens-input.component.ts | 1 + .../constants/bridge/deposit-wallets.ts | 1 + 6 files changed, 78 insertions(+), 61 deletions(-) create mode 100644 src/app/shared/constants/bridge/deposit-wallets.ts diff --git a/src/app/core/services/backend/bridge-api/bridge-api.service.ts b/src/app/core/services/backend/bridge-api/bridge-api.service.ts index 8aa8434110..69748dd1da 100644 --- a/src/app/core/services/backend/bridge-api/bridge-api.service.ts +++ b/src/app/core/services/backend/bridge-api/bridge-api.service.ts @@ -11,6 +11,7 @@ import { HttpService } from '../../http/http.service'; import { TRADE_STATUS } from './models/TRADE_STATUS'; import { TokensService } from '../tokens-service/tokens.service'; import { BOT_URL } from '../constants/BOT_URL'; +import { ethToXDaiDepositWallet } from '../../../../shared/constants/bridge/deposit-wallets'; @Injectable({ providedIn: 'root' @@ -194,7 +195,7 @@ export class BridgeApiService { transaction_id: transactionHash, walletFromAddress: userAddress, walletToAddress: userAddress, - walletDepositAddress: '0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016' + walletDepositAddress: ethToXDaiDepositWallet }; return new Promise((resolve, reject) => { diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.html b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.html index 7835779ce5..6336e59e74 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.html +++ b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.html @@ -179,27 +179,11 @@ {{ 'bridgePage.whatIs' | translate }} - {{ - isBlockchainSelected(BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN) - ? 'Binance Smart Chain' - : isBlockchainSelected(BLOCKCHAIN_NAME.POLYGON) - ? 'Polygon' - : isBlockchainSelected(BLOCKCHAIN_NAME.TRON) - ? 'TRON' - : 'xDai' - }}{{ 'bridgePage.whatIsAfter' | translate }}? + {{ BLOCKCHAIN_DATA[toBlockchain.key]?.caption }}{{ 'bridgePage.whatIsAfter' | translate }}? @@ -238,13 +222,7 @@ > {{ 'bridgePage.assistanceOf' | translate }} blockchain diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts index bfa22bce9f..9bf9cee7da 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts @@ -11,6 +11,7 @@ import InputToken from 'src/app/shared/models/tokens/InputToken'; import { BLOCKCHAINS } from 'src/app/features/cross-chain-swaps-page/common/constants/BLOCKCHAINS'; import ADDRESS_TYPE from 'src/app/shared/models/blockchain/ADDRESS_TYPE'; import { ErrorsService } from 'src/app/core/services/errors/errors.service'; + import { BridgeToken } from '../../models/BridgeToken'; import { BridgeBlockchain } from '../../models/BridgeBlockchain'; import { BridgeTrade } from '../../models/BridgeTrade'; @@ -68,6 +69,39 @@ export class BridgeFormComponent implements OnInit, OnDestroy { public toWalletAddress: string; + public BLOCKCHAIN_DATA = { + [BLOCKCHAIN_NAME.ETHEREUM]: { + link: 'https://ethereum.org/en/', + caption: 'Ethereum', + providerImg: 'Binance' + }, + [BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN]: { + link: 'https://www.binance.org/', + caption: 'Binance Smart Chain', + providerImg: 'Polygon' + }, + [BLOCKCHAIN_NAME.BINANCE_SMART_CHAIN]: { + link: 'https://www.binance.org/', + caption: 'Binance Smart Chain', + providerImg: 'Binance' + }, + [BLOCKCHAIN_NAME.POLYGON]: { + link: 'https://polygon.technology/', + caption: 'Polygon', + providerImg: 'Polygon' + }, + [BLOCKCHAIN_NAME.TRON]: { + link: 'https://tron.network/', + caption: 'TRON', + providerImg: 'Binance' + }, + [BLOCKCHAIN_NAME.XDAI]: { + link: 'https://www.xdaichain.com/', + caption: 'xDai', + providerImg: 'XDai' + } + }; + private tokensSubscription$: Subscription; private addressSubscription$: Subscription; @@ -306,6 +340,10 @@ export class BridgeFormComponent implements OnInit, OnDestroy { return this.fromBlockchain.key === blockchain || this.toBlockchain.key === blockchain; } + public getBlockchainProviderImage() { + return this.BLOCKCHAIN_DATA[this.toBlockchain.key || this.fromBlockchain.key].providerImg; + } + private isBlockchainsPairValid(): boolean { if (this.isBlockchainSelected(BLOCKCHAIN_NAME.ETHEREUM)) { return true; diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts index 05422b93a2..b02f5d5c44 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts @@ -4,60 +4,54 @@ import { List } from 'immutable'; import { map, tap } from 'rxjs/operators'; import { BlockchainsBridgeProvider } from '../blockchains-bridge-provider'; import { PanamaBridgeProviderService } from '../common/panama-bridge-provider/panama-bridge-provider.service'; -import { BlockchainsTokens, BridgeToken } from '../../../models/BridgeToken'; +import { BridgeToken } from '../../../models/BridgeToken'; import { BLOCKCHAIN_NAME } from '../../../../../../shared/models/blockchain/BLOCKCHAIN_NAME'; import { BridgeTrade } from '../../../models/BridgeTrade'; -import { PanamaToken } from '../common/panama-bridge-provider/models/PanamaToken'; import { Web3PrivateService } from '../../../../../../core/services/blockchain/web3-private-service/web3-private.service'; import { BridgeApiService } from '../../../../../../core/services/backend/bridge-api/bridge-api.service'; +import { ethToXDaiDepositWallet } from '../../../../../../shared/constants/bridge/deposit-wallets'; @Injectable() export class EthereumXdaiBridgeProviderService extends BlockchainsBridgeProvider { - constructor( - private commonPanamaBridgeProviderService: PanamaBridgeProviderService, - private web3PrivateService: Web3PrivateService, - private bridgeApiService: BridgeApiService - ) { - super(); - } - - private static parseXdaiPanamaToken(token: PanamaToken): BridgeToken { - return { - symbol: token.symbol, + private xDaiProviderTokens = [ + { + symbol: 'DAI', image: '', rank: 0, blockchainToken: { [BLOCKCHAIN_NAME.ETHEREUM]: { - address: token.ethContractAddress, - name: token.name, - symbol: token.ethSymbol, - decimals: token.ethContractDecimal, + address: '0x6b175474e89094c44da98b954eedeac495271d0f', + name: 'Dai', + symbol: 'DAI', + decimals: 18, minAmount: 0.005, maxAmount: 9999999 }, [BLOCKCHAIN_NAME.XDAI]: { address: '0x44fA8E6f47987339850636F88629646662444217', - name: token.name, - symbol: token.ethSymbol, - decimals: token.ethContractDecimal, + name: 'Dai', + symbol: 'DAI', + decimals: 18, - minAmount: token.minAmount, - maxAmount: token.maxAmount + minAmount: 10, + maxAmount: 9999999 } - } as BlockchainsTokens - }; + } + } as BridgeToken + ]; + + constructor( + private commonPanamaBridgeProviderService: PanamaBridgeProviderService, + private web3PrivateService: Web3PrivateService, + private bridgeApiService: BridgeApiService + ) { + super(); } getTokensList(): Observable> { - return this.commonPanamaBridgeProviderService.getTokensList().pipe( - map(tokens => { - return tokens - .filter(token => token.symbol === 'DAI') - .map(EthereumXdaiBridgeProviderService.parseXdaiPanamaToken); - }) - ); + return of(List(this.xDaiProviderTokens)); } getFee(): Observable { @@ -70,7 +64,6 @@ export class EthereumXdaiBridgeProviderService extends BlockchainsBridgeProvider ): Observable { const { token } = bridgeTrade; const tokenAddress = token.blockchainToken[bridgeTrade.fromBlockchain].address; - const depositAddress = '0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016'; const { decimals } = token.blockchainToken[bridgeTrade.fromBlockchain]; const amountInWei = bridgeTrade.amount.multipliedBy(10 ** decimals); @@ -87,9 +80,14 @@ export class EthereumXdaiBridgeProviderService extends BlockchainsBridgeProvider }; return from( - this.web3PrivateService.transferTokens(tokenAddress, depositAddress, amountInWei.toFixed(), { - onTransactionHash: onTradeTransactionHash - }) + this.web3PrivateService.transferTokens( + tokenAddress, + ethToXDaiDepositWallet, + amountInWei.toFixed(), + { + onTransactionHash: onTradeTransactionHash + } + ) ).pipe( map(receipt => receipt.transactionHash), tap(transactionHash => { diff --git a/src/app/shared/components/tokens-input/tokens-input.component.ts b/src/app/shared/components/tokens-input/tokens-input.component.ts index e3354200f0..72b617dcaa 100644 --- a/src/app/shared/components/tokens-input/tokens-input.component.ts +++ b/src/app/shared/components/tokens-input/tokens-input.component.ts @@ -9,6 +9,7 @@ import { ViewChild } from '@angular/core'; import { List } from 'immutable'; +import BigNumber from 'bignumber.js'; import { InputTokenShort } from './types'; import { TokenLabelComponent } from './token-label/token-label.component'; import { InputDropdownComponent } from '../input-dropdown/input-dropdown.component'; diff --git a/src/app/shared/constants/bridge/deposit-wallets.ts b/src/app/shared/constants/bridge/deposit-wallets.ts new file mode 100644 index 0000000000..2c206dd681 --- /dev/null +++ b/src/app/shared/constants/bridge/deposit-wallets.ts @@ -0,0 +1 @@ +export const ethToXDaiDepositWallet = '0x4aa42145Aa6Ebf72e164C9bBC74fbD3788045016'; From 06fc9c59e3b67baf567490288a23aa445e643e48 Mon Sep 17 00:00:00 2001 From: vlad3k Date: Tue, 1 Jun 2021 13:10:33 +0300 Subject: [PATCH 06/18] JS doc and return type of create trade function --- .../brifge-form/bridge-form.component.ts | 5 ++-- .../binance-tron-bridge-provider.service.ts | 3 ++- .../blockchains-bridge-provider.ts | 20 +++++++++++++++- .../panama-bridge-provider.service.ts | 24 ++++++++++++------- ...thereum-binance-bridge-provider.service.ts | 3 ++- ...-binance-panama-bridge-provider.service.ts | 3 ++- ...m-binance-rubic-bridge-provider.service.ts | 13 +++++----- ...thereum-polygon-bridge-provider.service.ts | 23 +++++++++--------- .../ethereum-tron-bridge-provider.service.ts | 3 ++- .../ethereum-xdai-bridge-provider.service.ts | 9 +++---- .../bridge-page/services/bridge.service.ts | 3 ++- .../images/icons/collaborations/XDai.svg | 21 ++++++++++++++++ 12 files changed, 92 insertions(+), 38 deletions(-) create mode 100644 src/assets/images/icons/collaborations/XDai.svg diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts index 9bf9cee7da..fc7282b649 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.ts @@ -12,6 +12,7 @@ import { BLOCKCHAINS } from 'src/app/features/cross-chain-swaps-page/common/cons import ADDRESS_TYPE from 'src/app/shared/models/blockchain/ADDRESS_TYPE'; import { ErrorsService } from 'src/app/core/services/errors/errors.service'; +import { TransactionReceipt } from 'web3-eth'; import { BridgeToken } from '../../models/BridgeToken'; import { BridgeBlockchain } from '../../models/BridgeBlockchain'; import { BridgeTrade } from '../../models/BridgeTrade'; @@ -465,8 +466,8 @@ export class BridgeFormComponent implements OnInit, OnDestroy { .createTrade(bridgeTrade) .pipe(first()) .subscribe( - (res: string) => { - this.tradeSuccessId = res; + (res: TransactionReceipt) => { + this.tradeSuccessId = res.transactionHash; this.tradeInProgress = false; this.buttonAnimation = false; }, diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/binance-tron-bridge-provider/binance-tron-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/binance-tron-bridge-provider/binance-tron-bridge-provider.service.ts index 484f5f6286..6eea15a7c0 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/binance-tron-bridge-provider/binance-tron-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/binance-tron-bridge-provider/binance-tron-bridge-provider.service.ts @@ -8,6 +8,7 @@ import { BridgeToken } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeToken'; import { BridgeTrade } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeTrade'; +import { TransactionReceipt } from 'web3-eth'; import { BlockchainsBridgeProvider } from '../blockchains-bridge-provider'; import { PanamaBridgeProviderService } from '../common/panama-bridge-provider/panama-bridge-provider.service'; import { PanamaToken } from '../common/panama-bridge-provider/models/PanamaToken'; @@ -64,7 +65,7 @@ export class BinanceTronBridgeProviderService extends BlockchainsBridgeProvider createTrade( bridgeTrade: BridgeTrade, updateTransactionsList: () => Promise - ): Observable { + ): Observable { return this.commonPanamaBridgeProviderService.createTrade(bridgeTrade, updateTransactionsList); } } diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/blockchains-bridge-provider.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/blockchains-bridge-provider.ts index 5a1bda51a4..dc16027c26 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/blockchains-bridge-provider.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/blockchains-bridge-provider.ts @@ -4,14 +4,32 @@ import { BridgeTrade } from 'src/app/features/cross-chain-swaps-page/bridge-page import { BridgeToken } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeToken'; import SwapToken from 'src/app/shared/models/tokens/SwapToken'; import { BLOCKCHAIN_NAME } from 'src/app/shared/models/blockchain/BLOCKCHAIN_NAME'; +import { TransactionReceipt } from 'web3-eth'; export abstract class BlockchainsBridgeProvider { + /** + * @description get transformed list of bridge tokens from usually tokens + * @param swapTokens swap list tokens + * @return observable bridge list tokens + */ public abstract getTokensList(swapTokens: List): Observable>; + /** + * @description get price blockchain provider's fee + * @param token bridge token + * @param toBlockchain destination blockchain + * @return observable number fee price + */ public abstract getFee(token: BridgeToken, toBlockchain: BLOCKCHAIN_NAME): Observable; + /** + * @description create trade between different networks + * @param bridgeTrade object with data for trade + * @param updateTransactionsList callback function for update list of bridge trades + * @return observable transaction receipt object + */ public abstract createTrade( bridgeTrade: BridgeTrade, updateTransactionsList: () => Promise - ): Observable; + ): Observable; } diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/common/panama-bridge-provider/panama-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/common/panama-bridge-provider/panama-bridge-provider.service.ts index 890230cff0..03f10e3d73 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/common/panama-bridge-provider/panama-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/common/panama-bridge-provider/panama-bridge-provider.service.ts @@ -12,6 +12,7 @@ import { OverQueryLimitError } from 'src/app/shared/models/errors/bridge/OverQue import { RubicError } from 'src/app/shared/models/errors/RubicError'; import { BridgeToken } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeToken'; import { BridgeTrade } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeTrade'; +import { TransactionReceipt } from 'web3-eth'; import { PanamaToken } from './models/PanamaToken'; interface PanamaResponse { @@ -71,7 +72,7 @@ export class PanamaBridgeProviderService { public createTrade( bridgeTrade: BridgeTrade, updateTransactionsList: () => Promise - ): Observable { + ): Observable { const body = { amount: bridgeTrade.amount.toFixed(), fromNetwork: bridgeTrade.fromBlockchain, @@ -108,7 +109,7 @@ export class PanamaBridgeProviderService { bridgeTrade: BridgeTrade, depositAddress: string, updateTransactionsList: () => Promise - ): Promise { + ): Promise { const { token } = bridgeTrade; const tokenAddress = token.blockchainToken[bridgeTrade.fromBlockchain].address; const { decimals } = token.blockchainToken[bridgeTrade.fromBlockchain]; @@ -127,14 +128,20 @@ export class PanamaBridgeProviderService { updateTransactionsList(); }; + let receipt; + if (bridgeTrade.fromBlockchain === BLOCKCHAIN_NAME.ETHEREUM && token.symbol === 'ETH') { - await this.web3PrivateService.sendTransaction(depositAddress, amountInWei.toFixed(), { - onTransactionHash: onTradeTransactionHash, - inWei: true - }); + receipt = await this.web3PrivateService.sendTransaction( + depositAddress, + amountInWei.toFixed(), + { + onTransactionHash: onTradeTransactionHash, + inWei: true + } + ); } else { const estimatedGas = '120000'; // TODO: хотфикс сломавшегося в метамаске рассчета газа. Estimated gas не подойдет, т.к. в BSC не работает rpc - await this.web3PrivateService.transferTokens( + receipt = await this.web3PrivateService.transferTokens( tokenAddress, depositAddress, amountInWei.toFixed(), @@ -145,7 +152,6 @@ export class PanamaBridgeProviderService { ); } this.bridgeApiService.notifyBridgeBot(bridgeTrade, binanceId, this.web3PrivateService.address); - - return binanceId; + return receipt; } } diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-binance-bridge-provider/ethereum-binance-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-binance-bridge-provider/ethereum-binance-bridge-provider.service.ts index 29ab12ee28..cf8a3016e8 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-binance-bridge-provider/ethereum-binance-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-binance-bridge-provider/ethereum-binance-bridge-provider.service.ts @@ -5,6 +5,7 @@ import { List } from 'immutable'; import { BLOCKCHAIN_NAME } from 'src/app/shared/models/blockchain/BLOCKCHAIN_NAME'; import { BridgeToken } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeToken'; import { BridgeTrade } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeTrade'; +import { TransactionReceipt } from 'web3-eth'; import { EthereumBinancePanamaBridgeProviderService } from './panama-bridge-provider/ethereum-binance-panama-bridge-provider.service'; import { EthereumBinanceRubicBridgeProviderService } from './rubic-bridge-provider/ethereum-binance-rubic-bridge-provider.service'; import { BlockchainsBridgeProvider } from '../blockchains-bridge-provider'; @@ -38,7 +39,7 @@ export class EthereumBinanceBridgeProviderService extends BlockchainsBridgeProvi public createTrade( bridgeTrade: BridgeTrade, updateTransactionsList: () => Promise - ): Observable { + ): Observable { if (bridgeTrade.token.symbol === 'RBC') { return this.rubicBridgeProvider.createTrade(bridgeTrade, updateTransactionsList); } diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-binance-bridge-provider/panama-bridge-provider/ethereum-binance-panama-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-binance-bridge-provider/panama-bridge-provider/ethereum-binance-panama-bridge-provider.service.ts index e2cbe5d869..a101097547 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-binance-bridge-provider/panama-bridge-provider/ethereum-binance-panama-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-binance-bridge-provider/panama-bridge-provider/ethereum-binance-panama-bridge-provider.service.ts @@ -9,6 +9,7 @@ import { BridgeToken } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeToken'; import { BridgeTrade } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeTrade'; +import { TransactionReceipt } from 'web3-eth'; import { PanamaToken } from '../../common/panama-bridge-provider/models/PanamaToken'; import { PanamaBridgeProviderService } from '../../common/panama-bridge-provider/panama-bridge-provider.service'; import { BlockchainsBridgeProvider } from '../../blockchains-bridge-provider'; @@ -64,7 +65,7 @@ export class EthereumBinancePanamaBridgeProviderService extends BlockchainsBridg public createTrade( bridgeTrade: BridgeTrade, updateTransactionsList: () => Promise - ): Observable { + ): Observable { return this.panamaBridgeProvider.createTrade(bridgeTrade, updateTransactionsList); } } diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-binance-bridge-provider/rubic-bridge-provider/ethereum-binance-rubic-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-binance-bridge-provider/rubic-bridge-provider/ethereum-binance-rubic-bridge-provider.service.ts index 315c92978f..6f7619fca8 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-binance-bridge-provider/rubic-bridge-provider/ethereum-binance-rubic-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-binance-bridge-provider/rubic-bridge-provider/ethereum-binance-rubic-bridge-provider.service.ts @@ -15,6 +15,7 @@ import { BridgeToken } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeToken'; import { BridgeTrade } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeTrade'; +import { TransactionReceipt } from 'web3-eth'; import BinanceContractAbi from './abi/BinanceContractAbi'; import EthereumContractAbi from './abi/EthereumContractAbi'; import { BlockchainsBridgeProvider } from '../../blockchains-bridge-provider'; @@ -114,16 +115,16 @@ export class EthereumBinanceRubicBridgeProviderService extends BlockchainsBridge public createTrade( bridgeTrade: BridgeTrade, updateTransactionsList: () => Promise - ): Observable { + ): Observable { return new Observable(subscriber => { this.createRubicTrade(bridgeTrade, updateTransactionsList) - .then(transactionHash => { + .then(receipt => { this.bridgeApiService.notifyBridgeBot( bridgeTrade, - transactionHash, + receipt.transactionHash, this.web3PrivateService.address ); - subscriber.next(transactionHash); + subscriber.next(receipt); }) .catch(err => { subscriber.error(err); @@ -137,7 +138,7 @@ export class EthereumBinanceRubicBridgeProviderService extends BlockchainsBridge private async createRubicTrade( bridgeTrade: BridgeTrade, updateTransactionsList: () => Promise - ): Promise { + ): Promise { const { token } = bridgeTrade; if (token.symbol !== 'RBC') { @@ -192,7 +193,7 @@ export class EthereumBinanceRubicBridgeProviderService extends BlockchainsBridge } ); - return receipt.transactionHash; + return receipt; } private async provideAllowance(trade: RubicTrade, web3Public: Web3Public, onApprove) { diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-polygon-bridge-provider/ethereum-polygon-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-polygon-bridge-provider/ethereum-polygon-bridge-provider.service.ts index dcbe163932..762ff61e2d 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-polygon-bridge-provider/ethereum-polygon-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-polygon-bridge-provider/ethereum-polygon-bridge-provider.service.ts @@ -21,6 +21,7 @@ import { } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeToken'; import networks from 'src/app/shared/constants/blockchain/networks'; import { BridgeTrade } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeTrade'; +import { TransactionReceipt } from 'web3-eth'; import { BlockchainsBridgeProvider } from '../blockchains-bridge-provider'; interface PolygonGraphToken { @@ -211,12 +212,12 @@ export class EthereumPolygonBridgeProviderService extends BlockchainsBridgeProvi public createTrade( bridgeTrade: BridgeTrade, updateTransactionsList: () => Promise - ): Observable { + ): Observable { return this.createPolygonTrade(bridgeTrade, updateTransactionsList).pipe( - tap(transactionHash => { + tap(receipt => { this.bridgeApiService.notifyBridgeBot( bridgeTrade, - transactionHash, + receipt.transactionHash, this.web3PrivateService.address ); }) @@ -226,7 +227,7 @@ export class EthereumPolygonBridgeProviderService extends BlockchainsBridgeProvi public createPolygonTrade( bridgeTrade: BridgeTrade, updateTransactionsList: () => Promise - ): Observable { + ): Observable { const maticPOSClient = this.getMaticPOSClient(bridgeTrade.fromBlockchain); const userAddress = this.web3PrivateService.address; @@ -282,13 +283,13 @@ export class EthereumPolygonBridgeProviderService extends BlockchainsBridgeProvi userAddress: string, amountInWei: BigNumber, onTradeTransactionHash: (hash: string) => void - ): Observable { + ): Observable { return defer(async () => { const receipt = await maticPOSClient.depositEtherForUser(userAddress, amountInWei.toFixed(), { from: userAddress, onTransactionHash: onTradeTransactionHash }); - return receipt.transactionHash; + return receipt; }); } @@ -299,7 +300,7 @@ export class EthereumPolygonBridgeProviderService extends BlockchainsBridgeProvi amountInWei: BigNumber, onApprove: (hash: string) => void, onTradeTransactionHash: (hash: string) => void - ): Observable { + ): Observable { return defer(async () => { const allowance = await maticPOSClient.getERC20Allowance(userAddress, tokenAddress); if (amountInWei.gt(allowance)) { @@ -317,7 +318,7 @@ export class EthereumPolygonBridgeProviderService extends BlockchainsBridgeProvi onTransactionHash: onTradeTransactionHash } ); - return receipt.transactionHash; + return receipt; }); } @@ -327,13 +328,13 @@ export class EthereumPolygonBridgeProviderService extends BlockchainsBridgeProvi tokenAddress: string, amountInWei: BigNumber, onTradeTransactionHash: (hash: string) => void - ): Observable { + ): Observable { return defer(async () => { const receipt = await maticPOSClient.burnERC20(tokenAddress, amountInWei.toFixed(), { from: userAddress, onTransactionHash: onTradeTransactionHash }); - return receipt.transactionHash; + return receipt; }); } @@ -367,7 +368,7 @@ export class EthereumPolygonBridgeProviderService extends BlockchainsBridgeProvi receipt.transactionHash, TRADE_STATUS.COMPLETED ); - return receipt.transactionHash; + return receipt; }); } } diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-tron-bridge-provider/ethereum-tron-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-tron-bridge-provider/ethereum-tron-bridge-provider.service.ts index 78ad87eb6f..e6d445b9f5 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-tron-bridge-provider/ethereum-tron-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-tron-bridge-provider/ethereum-tron-bridge-provider.service.ts @@ -8,6 +8,7 @@ import { BridgeToken } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeToken'; import { BridgeTrade } from 'src/app/features/cross-chain-swaps-page/bridge-page/models/BridgeTrade'; +import { TransactionReceipt } from 'web3-eth'; import { BlockchainsBridgeProvider } from '../blockchains-bridge-provider'; import { PanamaBridgeProviderService } from '../common/panama-bridge-provider/panama-bridge-provider.service'; import { PanamaToken } from '../common/panama-bridge-provider/models/PanamaToken'; @@ -64,7 +65,7 @@ export class EthereumTronBridgeProviderService extends BlockchainsBridgeProvider createTrade( bridgeTrade: BridgeTrade, updateTransactionsList: () => Promise - ): Observable { + ): Observable { return this.commonPanamaBridgeProviderService.createTrade(bridgeTrade, updateTransactionsList); } } diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts index b02f5d5c44..030f2b1efe 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/ethereum-xdai-bridge-provider/ethereum-xdai-bridge-provider.service.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; import { from, Observable, of } from 'rxjs'; import { List } from 'immutable'; import { map, tap } from 'rxjs/operators'; +import { TransactionReceipt } from 'web3-eth'; import { BlockchainsBridgeProvider } from '../blockchains-bridge-provider'; import { PanamaBridgeProviderService } from '../common/panama-bridge-provider/panama-bridge-provider.service'; import { BridgeToken } from '../../../models/BridgeToken'; @@ -61,7 +62,7 @@ export class EthereumXdaiBridgeProviderService extends BlockchainsBridgeProvider public createTrade( bridgeTrade: BridgeTrade, updateTransactionsList: () => Promise - ): Observable { + ): Observable { const { token } = bridgeTrade; const tokenAddress = token.blockchainToken[bridgeTrade.fromBlockchain].address; const { decimals } = token.blockchainToken[bridgeTrade.fromBlockchain]; @@ -89,11 +90,11 @@ export class EthereumXdaiBridgeProviderService extends BlockchainsBridgeProvider } ) ).pipe( - map(receipt => receipt.transactionHash), - tap(transactionHash => { + map(receipt => receipt), + tap(receipt => { this.bridgeApiService.notifyBridgeBot( bridgeTrade, - transactionHash, + receipt.transactionHash, this.web3PrivateService.address ); }) diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/bridge.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/bridge.service.ts index b1c3cef614..5fb646e78f 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/bridge.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/bridge.service.ts @@ -19,6 +19,7 @@ import { Web3Public } from 'src/app/core/services/blockchain/web3-public-service import { UserRejectError } from 'src/app/shared/models/errors/provider/UserRejectError'; import SwapToken from 'src/app/shared/models/tokens/SwapToken'; import InsufficientFundsError from 'src/app/shared/models/errors/instant-trade/InsufficientFundsError'; +import { TransactionReceipt } from 'web3-eth'; import { BinanceTronBridgeProviderService } from './blockchains-bridge-provider/binance-tron-bridge-provider/binance-tron-bridge-provider.service'; import { EthereumTronBridgeProviderService } from './blockchains-bridge-provider/ethereum-tron-bridge-provider/ethereum-tron-bridge-provider.service'; import { BridgeTableTrade } from '../models/BridgeTableTrade'; @@ -266,7 +267,7 @@ export class BridgeService implements OnDestroy { } } - public createTrade(bridgeTrade: BridgeTrade): Observable { + public createTrade(bridgeTrade: BridgeTrade): Observable { return defer(async () => { this.checkSettings(bridgeTrade.fromBlockchain); const token = bridgeTrade.token.blockchainToken[bridgeTrade.fromBlockchain]; diff --git a/src/assets/images/icons/collaborations/XDai.svg b/src/assets/images/icons/collaborations/XDai.svg new file mode 100644 index 0000000000..d7df8bab48 --- /dev/null +++ b/src/assets/images/icons/collaborations/XDai.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + From 6274b607e1467d134224e4b0e90c291e369f1396 Mon Sep 17 00:00:00 2001 From: ottebrut Date: Wed, 2 Jun 2021 11:52:34 +0300 Subject: [PATCH 07/18] small bug fix --- .../panama-bridge-provider/panama-bridge-provider.service.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/common/panama-bridge-provider/panama-bridge-provider.service.ts b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/common/panama-bridge-provider/panama-bridge-provider.service.ts index 03f10e3d73..c7cdde9490 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/common/panama-bridge-provider/panama-bridge-provider.service.ts +++ b/src/app/features/cross-chain-swaps-page/bridge-page/services/blockchains-bridge-provider/common/panama-bridge-provider/panama-bridge-provider.service.ts @@ -2,8 +2,7 @@ import { Injectable } from '@angular/core'; import { List } from 'immutable'; import { HttpClient } from '@angular/common/http'; import { from, Observable, of, throwError } from 'rxjs'; -import { catchError, map } from 'rxjs/operators'; -import { flatMap } from 'rxjs/internal/operators'; +import { catchError, map, mergeMap } from 'rxjs/operators'; import { TranslateService } from '@ngx-translate/core'; import { Web3PrivateService } from 'src/app/core/services/blockchain/web3-private-service/web3-private.service'; import { BridgeApiService } from 'src/app/core/services/backend/bridge-api/bridge-api.service'; @@ -87,7 +86,7 @@ export class PanamaBridgeProviderService { }; return this.httpClient.post(`${this.apiUrl}swaps`, body).pipe( - flatMap((res: PanamaResponse) => { + mergeMap((res: PanamaResponse) => { if (res.code !== this.PANAMA_SUCCESS_CODE) { console.error(`Bridge POST error, code ${res.code}`); return throwError(new OverQueryLimitError(this.translateService)); From 7c5e347b4fd66a8954fb76b3bc85ec395d1ef0db Mon Sep 17 00:00:00 2001 From: vlad3k Date: Wed, 2 Jun 2021 13:18:40 +0300 Subject: [PATCH 08/18] fix comments --- .../brifge-form/bridge-form.component.html | 2 +- .../brifge-form/bridge-form.component.ts | 5 ----- .../ethereum-xdai-bridge-provider.service.ts | 11 ++++------- src/app/shared/pipes/scanner-link.pipe.ts | 18 ++++++++++++------ 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.html b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.html index 6336e59e74..6902253dbf 100644 --- a/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.html +++ b/src/app/features/cross-chain-swaps-page/bridge-page/components/brifge-form/bridge-form.component.html @@ -112,7 +112,7 @@