-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor atomex builder, network option
- Loading branch information
1 parent
e0ca591
commit cf7f7b4
Showing
9 changed files
with
77 additions
and
61 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
4 changes: 2 additions & 2 deletions
4
src/ethereum/currencies.ts → src/ethereum/config/currencies.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
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,31 @@ | ||
import type { AtomexBlockchainOptions } from '../../atomex/models/index'; | ||
import { EthereumBalancesProvider } from '../balancesProviders/index'; | ||
import { Web3BlockchainToolkitProvider } from '../blockchainToolkitProviders/index'; | ||
import { EthereumSwapTransactionsProvider } from '../swapTransactionsProviders/index'; | ||
import { ethereumMainnetCurrencies, ethereumTestnetCurrencies } from './currencies'; | ||
|
||
export const createDefaultEthereumBlockchainOptions = (): AtomexBlockchainOptions => { | ||
const mainnetRpcUrl = 'https://mainnet.infura.io/v3/'; | ||
const testNetRpcUrl = 'https://goerli.infura.io/v3/'; | ||
const balancesProvider = new EthereumBalancesProvider(); | ||
const swapTransactionsProvider = new EthereumSwapTransactionsProvider(); | ||
|
||
const tezosOptions: AtomexBlockchainOptions = { | ||
mainnet: { | ||
currencies: ethereumMainnetCurrencies, | ||
currencyOptions: {}, | ||
blockchainToolkitProvider: new Web3BlockchainToolkitProvider(mainnetRpcUrl), | ||
balancesProvider, | ||
swapTransactionsProvider, | ||
}, | ||
testnet: { | ||
currencies: ethereumTestnetCurrencies, | ||
currencyOptions: {}, | ||
blockchainToolkitProvider: new Web3BlockchainToolkitProvider(testNetRpcUrl), | ||
balancesProvider, | ||
swapTransactionsProvider, | ||
} | ||
}; | ||
|
||
return tezosOptions; | ||
}; |
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,2 @@ | ||
export { ethereumMainnetCurrencies, ethereumTestnetCurrencies } from './currencies'; | ||
export { createDefaultEthereumBlockchainOptions } from './defaultOptions'; |
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,5 +1,5 @@ | ||
export { Web3EthereumSigner } from './signers'; | ||
export { ethereumMainnetCurrencies, ethereumTestnetCurrencies } from './currencies'; | ||
export { ethereumMainnetCurrencies, ethereumTestnetCurrencies, createDefaultEthereumBlockchainOptions } from './config/index'; | ||
export { EthereumBalancesProvider } from './balancesProviders'; | ||
export { EthereumSwapTransactionsProvider } from './swapTransactionsProviders'; | ||
export { EthereumBlockchainToolkitProvider } from './blockchainToolkitProviders'; | ||
export { Web3BlockchainToolkitProvider } from './blockchainToolkitProviders'; |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { AtomexBlockchainOptions } from '../../atomex/models/index'; | ||
import { TezosBalancesProvider } from '../balancesProviders/index'; | ||
import { TezosBlockchainToolkitProvider } from '../blockchainToolkitProviders/index'; | ||
import { TezosSwapTransactionsProvider } from '../swapTransactionsProviders/index'; | ||
import { tezosMainnetCurrencies, tezosTestnetCurrencies } from './currencies'; | ||
|
||
export const createDefaultTezosBlockchainOptions = (): AtomexBlockchainOptions => { | ||
const mainnetRpcUrl = 'https://mainnet.api.tez.ie'; | ||
const testNetRpcUrl = 'https://jakartanet.ecadinfra.com'; | ||
const balancesProvider = new TezosBalancesProvider(); | ||
const swapTransactionsProvider = new TezosSwapTransactionsProvider(); | ||
|
||
const tezosOptions: AtomexBlockchainOptions = { | ||
mainnet: { | ||
currencies: tezosMainnetCurrencies, | ||
currencyOptions: {}, | ||
blockchainToolkitProvider: new TezosBlockchainToolkitProvider(mainnetRpcUrl), | ||
balancesProvider, | ||
swapTransactionsProvider, | ||
}, | ||
testnet: { | ||
currencies: tezosTestnetCurrencies, | ||
currencyOptions: {}, | ||
blockchainToolkitProvider: new TezosBlockchainToolkitProvider(testNetRpcUrl), | ||
balancesProvider, | ||
swapTransactionsProvider, | ||
} | ||
}; | ||
|
||
return tezosOptions; | ||
}; |
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,2 @@ | ||
export { tezosMainnetCurrencies, tezosTestnetCurrencies } from './currencies'; | ||
export { createDefaultTezosBlockchainOptions } from './defaultOptions'; |
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,7 +1,7 @@ | ||
export { WalletTezosSigner } from './walletTezosSigner/index'; | ||
export { InMemoryTezosSigner } from './inMemoryTezosSigner'; | ||
export type { TezosCurrency, TezosFA12Currency, TezosFA2Currency } from './models/index'; | ||
export { tezosMainnetCurrencies, tezosTestnetCurrencies } from './currencies'; | ||
export { tezosMainnetCurrencies, tezosTestnetCurrencies, createDefaultTezosBlockchainOptions } from './config/index'; | ||
export { TezosBalancesProvider } from './balancesProviders'; | ||
export { TezosSwapTransactionsProvider } from './swapTransactionsProviders'; | ||
export { TezosBlockchainToolkitProvider } from './blockchainToolkitProviders'; |