Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

WIP: feat: integrate terra #365

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
112 changes: 79 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@liquality/near-swap-find-provider": "1.1.8",
"@liquality/near-swap-provider": "1.1.8",
"@liquality/solana-networks": "^1.4.5",
"@liquality/solana-rpc-provider": "^1.4.5",
"@liquality/solana-rpc-provider": "^1.5.1",
"@liquality/solana-swap-find-provider": "^1.4.5",
"@liquality/solana-swap-provider": "^1.4.5",
"@liquality/solana-wallet-provider": "^1.4.5",
Expand Down
Binary file added src/.DS_Store
Binary file not shown.
Binary file added src/migrate/.DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions src/migrate/data/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,12 @@
"min": 5000000000000000000,
"max": 2e+21,
"minConf": 1
},
{
"code": "ULUNA",
"actualBalance": 0,
"min": 10000,
"max": 2e+21,
"minConf": 1
}
]
20 changes: 20 additions & 0 deletions src/migrate/data/markets.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,25 @@
"status": "ACTIVE",
"max": 2e+21,
"min": 5000000000000000000
},
{
"from": "ULUNA",
"to": "ETH",
"rate": 0.02,
"spread": 0,
"orderExpiresIn": 7200000,
"status": "ACTIVE",
"max": 2e+21,
"min": 10000
},
{
"from": "ETH",
"to": "ULUNA",
"rate": 50,
"spread": 0,
"orderExpiresIn": 7200000,
"status": "ACTIVE",
"max": 2e+21,
"min": 10000
}
]
28 changes: 28 additions & 0 deletions src/utils/clients.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ const { SolanaWalletProvider } = require('@liquality/solana-wallet-provider')
const { SolanaSwapProvider } = require('@liquality/solana-swap-provider')
const { SolanaSwapFindProvider } = require('@liquality/solana-swap-find-provider');

const { TerraNetworks } = require('@liquality/terra-networks')
const { TerraRpcProvider } = require('@liquality/terra-rpc-provider')
const { TerraWalletProvider } = require('@liquality/terra-wallet-provider')
const { TerraSwapProvider } = require('@liquality/terra-swap-provider')
const { TerraSwapFindProvider } = require('@liquality/terra-swap-find-provider');


function createBtcClient () {
const btcConfig = config.assets.BTC
const network = BitcoinNetworks[btcConfig.network]
Expand Down Expand Up @@ -144,6 +151,26 @@ function createSolClient() {
return solanaClient
}

function createTerraClient() {
const terraConfig = config.assets.ULUNA
const terraNetwork = TerraNetworks[terraConfig.network]

const terraClient = new Client()
const derivationPath = ''
terraClient.addProvider(new TerraRpcProvider(terraNetwork))
terraClient.addProvider(new TerraWalletProvider(
{
network: terraNetwork,
mnemonic: terraConfig.wallet.mnemonic,
derivationPath
}
))
terraClient.addProvider(new TerraSwapProvider(terraNetwork))
terraClient.addProvider(new TerraSwapFindProvider(terraNetwork))

return terraClient
}

const clients = {}

function createClient (asset) {
Expand All @@ -157,6 +184,7 @@ function createClient (asset) {
if (assetData.chain === 'ethereum') return createEthClient(asset)
if (assetData.chain === 'near') return createNearClient()
if (assetData.chain === 'solana') return createSolClient()
if (assetData.chain === 'terra') return createTerraClient()

throw new Error(`Could not create client for asset ${asset}`)
}
Expand Down
Binary file added src/worker/.DS_Store
Binary file not shown.
Binary file added test/.DS_Store
Binary file not shown.