Skip to content

Commit b1c4582

Browse files
Merge pull request #101 from OpenFuturePlatform/key-master-fix
Update Wallet Api State Request Test Fix
2 parents ae60e71 + f2d15ad commit b1c4582

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

src/main/kotlin/io/openfuture/api/service/DefaultApplicationWalletService.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DefaultApplicationWalletService(
2626
val keyWalletDto = keyApi.generateWallet(CreateKeyRequest(request.applicationId, user.id.toString(), request.blockchainType))
2727

2828
// Save webhook on open state
29-
//stateApi.createWallet(keyWalletDto.address, request.webHook, Blockchain.getBlockchainBySymbol(request.blockchainType.getValue()))
29+
stateApi.createWallet(keyWalletDto.address, request.webHook, Blockchain.getBlockchainBySymbol(request.blockchainType.getValue()), request.applicationId)
3030

3131
return keyWalletDto
3232
}
@@ -43,7 +43,7 @@ class DefaultApplicationWalletService(
4343
// Delete from Open Key
4444
keyApi.deleteAllWalletsByApplicationAddress(applicationId, address)
4545
// Delete from Open State
46-
//stateApi.deleteWallet(address, Blockchain.Ethereum)
46+
stateApi.deleteWallet(address, Blockchain.Ethereum)
4747
}
4848

4949
override fun getAddressTransactionsByAddress(address: String): StateWalletTransactionDetail {

src/test/kotlin/io/openfuture/api/component/state/DefaultStateApiTests.kt

+8-18
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import org.springframework.http.ResponseEntity
1414
import org.springframework.web.client.RestTemplate
1515
import java.math.BigDecimal
1616
import java.time.LocalDateTime
17+
import java.util.*
1718

1819
class DefaultStateApiTests : UnitTest() {
1920

@@ -29,27 +30,16 @@ class DefaultStateApiTests : UnitTest() {
2930

3031
@Test
3132
fun createWalletTest() {
32-
val request = CreateStateWalletRequestMetadata(
33+
val request = CreateStateWalletRequest(
34+
"address",
3335
"webhook",
34-
"applicationId",
35-
listOf(KeyWalletDto("address", Blockchain.Ethereum.getValue(), "CUSTODIAL")),
36-
WalletMetaData(
37-
"0",
38-
"op_UxQr1LLdREboF",
39-
"USD",
40-
"open",
41-
false,
42-
false
43-
)
44-
)
45-
val response = CreateStateWalletResponse(
46-
"webhook",
47-
"op_UxQr1LLdREboF",
48-
BigDecimal.ZERO,
49-
listOf(WalletCreateResponse(Blockchain.Ethereum.getValue(),"address", BigDecimal.ZERO))
36+
Blockchain.Ethereum.getValue(),
37+
"applicationId"
5038
)
39+
val response = StateWalletDto(
40+
UUID.randomUUID().toString(), "address", "webhook", Blockchain.Ethereum, LocalDateTime.now())
5141

52-
given(restTemplate.postForEntity("/wallets", request, CreateStateWalletResponse::class.java)).willReturn(ResponseEntity(response, HttpStatus.OK))
42+
given(restTemplate.postForEntity("/wallets/single", request, StateWalletDto::class.java)).willReturn(ResponseEntity(response, HttpStatus.OK))
5343

5444
val result = stateApi.createWallet("address", "webhook", Blockchain.Ethereum, "applicationId")
5545

0 commit comments

Comments
 (0)