Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

Commit

Permalink
chore: remove buy crypto workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nattb8 committed Nov 26, 2023
1 parent faaf7fa commit 49d94d0
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 468 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,18 @@ package com.immutable.sdk
internal object ImmutableConfig {
private object Production {
const val PUBLIC_API_URL = "https://api.x.immutable.com"
const val MOONPAY_BUY_CRYPTO_URL = "https://buy.moonpay.io"
const val MOONPAY_API_KEY = "pk_live_lgGxv3WyWjnWff44ch4gmolN0953"
const val CORE_CONTRACT_ADDRESS = "0x5FDCCA53617f4d2b9134B29090C87D01058e27e9"
const val REGISTRATION_CONTRACT_ADDRESS = "0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c"
}

private object Sandbox {
const val PUBLIC_API_URL = "https://api.sandbox.x.immutable.com"
const val MOONPAY_BUY_CRYPTO_URL = "https://buy-staging.moonpay.io"
const val MOONPAY_API_KEY = "pk_test_nGdsu1IBkjiFzmEvN8ddf4gM9GNy5Sgz"
const val CORE_CONTRACT_ADDRESS = "0x7917eDb51ecD6CdB3F9854c3cc593F33de10c623"
const val REGISTRATION_CONTRACT_ADDRESS = "0x1C97Ada273C9A52253f463042f29117090Cd7D83"
}

private object Ropsten {
const val PUBLIC_API_URL = "https://api.ropsten.x.immutable.com"
const val MOONPAY_BUY_CRYPTO_URL = "https://buy-staging.moonpay.io"
const val MOONPAY_API_KEY = "pk_test_nGdsu1IBkjiFzmEvN8ddf4gM9GNy5Sgz"
const val CORE_CONTRACT_ADDRESS = "0x4527BE8f31E2ebFbEF4fCADDb5a17447B27d2aef"
const val REGISTRATION_CONTRACT_ADDRESS = "0x6C21EC8DE44AE44D0992ec3e2d9f1aBb6207D864"
}
Expand All @@ -31,18 +25,6 @@ internal object ImmutableConfig {
ImmutableXBase.Sandbox -> Sandbox.PUBLIC_API_URL
}

fun getMoonpayApiKey(base: ImmutableXBase) = when (base) {
ImmutableXBase.Production -> Production.MOONPAY_API_KEY
ImmutableXBase.Ropsten -> Ropsten.MOONPAY_API_KEY
ImmutableXBase.Sandbox -> Sandbox.MOONPAY_API_KEY
}

fun getBuyCryptoUrl(base: ImmutableXBase) = when (base) {
ImmutableXBase.Production -> Production.MOONPAY_BUY_CRYPTO_URL
ImmutableXBase.Ropsten -> Ropsten.MOONPAY_BUY_CRYPTO_URL
ImmutableXBase.Sandbox -> Sandbox.MOONPAY_BUY_CRYPTO_URL
}

fun getCoreContractAddress(base: ImmutableXBase) = when (base) {
ImmutableXBase.Production -> Production.CORE_CONTRACT_ADDRESS
ImmutableXBase.Ropsten -> Ropsten.CORE_CONTRACT_ADDRESS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.immutable.sdk

import com.google.common.annotations.VisibleForTesting
import com.immutable.sdk.Constants.DEFAULT_MOONPAY_COLOUR_CODE
import com.immutable.sdk.api.AssetsApi
import com.immutable.sdk.api.BalancesApi
import com.immutable.sdk.api.CollectionsApi
Expand Down Expand Up @@ -1173,26 +1172,6 @@ class ImmutableX(
): CompletableFuture<CreateTransferResponse> =
com.immutable.sdk.workflows.transfer(transfers, signer, starkSigner)

/**
* Gets a URL to MoonPay that provides a service for buying crypto directly on Immutable in exchange for fiat.
*
* It is recommended to open this URL in a Chrome Custom Tab.
*
* @param signer represents the users L1 wallet to get the address
* @param colourCodeHex The color code in hex (e.g. #00818e) for the Moon pay widget main color. It is used for buttons,
* links and highlighted text.
* @throws Throwable if any error occurs
*/
fun buyCrypto(
signer: Signer,
colourCodeHex: String = DEFAULT_MOONPAY_COLOUR_CODE
): CompletableFuture<String> =
com.immutable.sdk.workflows.buyCrypto(
base = base,
signer = signer,
colourCodeHex = colourCodeHex
)

@Suppress("TooGenericExceptionCaught")
private fun <T> apiCall(callName: String, call: () -> T): T {
try {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import com.immutable.sdk.api.model.Collection
import com.immutable.sdk.model.Erc721Asset
import com.immutable.sdk.model.EthAsset
import com.immutable.sdk.workflows.createTrade
import com.immutable.sdk.workflows.buyCrypto
import com.immutable.sdk.workflows.cancelOrder
import com.immutable.sdk.workflows.registerOffChain
import com.immutable.sdk.workflows.createOrder
Expand Down Expand Up @@ -222,14 +221,6 @@ class ImmutableXTest {
)
}

@Test
fun testBuyCrypto() {
val future = CompletableFuture<String>()
mockkStatic(::buyCrypto)
every { buyCrypto(any(), signer, any(), "colorCode", any()) } returns future
assertEquals(future, sdk.buyCrypto(signer, "colorCode"))
}

@Test
fun testDeposit() {
mockkStatic(::deposit)
Expand Down
Loading

0 comments on commit 49d94d0

Please sign in to comment.