-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tron and bridgers refactoring, add meson and orbiter (5.43.0)
- Loading branch information
Showing
42 changed files
with
1,283 additions
and
848 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
...ore/blockchain/web3-pure/typed-web3-pure/tron-web3-pure/models/tron-transaction-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
import { TronParameters } from 'src/core/blockchain/web3-pure/typed-web3-pure/tron-web3-pure/models/tron-parameters'; | ||
|
||
export interface TronTransactionConfig { | ||
signature: string; | ||
arguments: TronParameters; | ||
to: string; | ||
data: string; | ||
callValue?: string; | ||
|
||
feeLimit?: number; | ||
callValue?: string; | ||
|
||
rawParameter?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* used for passing fromAddress in swap/quote requests with disabled wallet */ | ||
export const FAKE_WALLET_ADDRESS = '0xe388Ed184958062a2ea29B7fD049ca21244AE02e'; | ||
export const FAKE_SOLANA_WALLET_ADDRESS = '7cwWhuCJUHc27Dq4nQRhggwgeuVHEeS3NWv7BY6yY9Bk'; | ||
export const FAKE_TRON_WALLET_ADDRESS = 'TFwy9q45E5kK6HKzmc3gAcJY4rVD96VNi5'; |
4 changes: 2 additions & 2 deletions
4
src/features/common/providers/bridgers/models/bridgers-swap-api.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
.../calculation-manager/providers/bridgers-provider/bridgers-cross-chain-provider-factory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { | ||
BlockchainName, | ||
EvmBlockchainName, | ||
TronBlockchainName | ||
} from 'src/core/blockchain/models/blockchain-name'; | ||
import { BlockchainsInfo } from 'src/core/blockchain/utils/blockchains-info/blockchains-info'; | ||
import { | ||
BridgersCrossChainGasParams, | ||
BridgersCrossChainParams, | ||
BridgersEvmCrossChainParams, | ||
BridgersTronCrossChainParams | ||
} from 'src/features/cross-chain/calculation-manager/providers/bridgers-provider/models/bridgers-cross-chain-trade-types'; | ||
import { EvmBridgersCrossChainTrade } from 'src/features/cross-chain/calculation-manager/providers/bridgers-provider/networks/evm-bridgers-cross-chain-trade'; | ||
import { TronBridgersCrossChainTrade } from 'src/features/cross-chain/calculation-manager/providers/bridgers-provider/networks/tron-bridgers-cross-chain-trade'; | ||
import { GasData } from 'src/features/cross-chain/calculation-manager/providers/common/evm-cross-chain-trade/models/gas-data'; | ||
|
||
export class BridgersCrossChainProviderFactory { | ||
public static createTrade( | ||
params: BridgersCrossChainParams<TronBlockchainName | EvmBlockchainName> | ||
): EvmBridgersCrossChainTrade | TronBridgersCrossChainTrade { | ||
const fromBlockchain = params.crossChainTrade.from.blockchain; | ||
if (BlockchainsInfo.isTronBlockchainName(fromBlockchain)) { | ||
return new TronBridgersCrossChainTrade(params as BridgersTronCrossChainParams); | ||
} | ||
|
||
if (BlockchainsInfo.isEvmBlockchainName(fromBlockchain)) { | ||
return new EvmBridgersCrossChainTrade(params as BridgersEvmCrossChainParams); | ||
} | ||
throw new Error('Can not create trade instance'); | ||
} | ||
|
||
public static async getGasData( | ||
calculateGas: boolean, | ||
params: BridgersCrossChainGasParams<BlockchainName> | ||
): Promise<GasData | null> { | ||
if (calculateGas) { | ||
const fromBlockchain = params.from.blockchain; | ||
if (BlockchainsInfo.isEvmBlockchainName(fromBlockchain)) { | ||
return EvmBridgersCrossChainTrade.getGasData( | ||
params as BridgersCrossChainGasParams<EvmBlockchainName> | ||
); | ||
} | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...alculation-manager/providers/bridgers-provider/models/bridgers-cross-chain-trade-types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import BigNumber from 'bignumber.js'; | ||
import { PriceTokenAmount } from 'src/common/tokens'; | ||
import { | ||
BlockchainName, | ||
EvmBlockchainName, | ||
TronBlockchainName | ||
} from 'src/core/blockchain/models/blockchain-name'; | ||
|
||
import { GasData } from '../../common/evm-cross-chain-trade/models/gas-data'; | ||
import { FeeInfo } from '../../common/models/fee-info'; | ||
import { RubicStep } from '../../common/models/rubicStep'; | ||
|
||
export interface BridgersCrossChainGasParams<Blockchain extends BlockchainName> { | ||
from: PriceTokenAmount<Blockchain>; | ||
to: PriceTokenAmount; | ||
receiverAddress: string; | ||
providerAddress: string; | ||
feeInfo: FeeInfo; | ||
} | ||
|
||
export interface BridgersCrossChainParams<Blockchain extends BlockchainName> { | ||
crossChainTrade: { | ||
from: PriceTokenAmount<Blockchain>; | ||
to: PriceTokenAmount; | ||
toTokenAmountMin: BigNumber; | ||
feeInfo: FeeInfo; | ||
gasData: GasData; | ||
slippage: number; | ||
}; | ||
providerAddress: string; | ||
routePath: RubicStep[]; | ||
useProxy: boolean; | ||
} | ||
|
||
export type BridgersEvmCrossChainParams = BridgersCrossChainParams<EvmBlockchainName>; | ||
export type BridgersTronCrossChainParams = BridgersCrossChainParams<TronBlockchainName>; |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.