Skip to content

Commit dd053e2

Browse files
committed
Update Wallet Api State Request
1 parent 88cbd04 commit dd053e2

32 files changed

+326
-121
lines changed

frontend/src/components-ui/Table.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export const Table = ({ data, columns, noDataText }) => (
66
data={data}
77
columns={columns}
88
className="-striped"
9-
showPagination={false}
10-
resizable={false}
9+
showPagination={true}
10+
resizable={true}
1111
minRows={1}
1212
pageSize={data.length}
1313
noDataText={noDataText}

frontend/src/components/GatewayApplicationWallet.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from "react";
2-
import {Button, Divider, Grid, Icon, Input, Modal, Segment} from "semantic-ui-react";
3-
import {EtherscanLink} from "../components-ui/EtherscanLink";
2+
import {Segment} from "semantic-ui-react";
43
import {connect} from "react-redux";
54

65

@@ -15,11 +14,17 @@ import {
1514
import {getGatewayWalletSelector} from "../selectors/getGatewayWalletsSelector";
1615

1716
import {GatewayApplicationWalletRemove} from "./GatewayApplicationWalletRemove";
18-
import {GatewayApplicationWalletPrivateKey} from "./GatewayApplicationWalletPrivateKey";
1917
import {WalletImport} from "./GatewayApplicationWalletImport";
2018
import {OpenScanLink} from "../components-ui/OpenScanLink";
2119

2220
const getColumns = (wallets, onRemove, onExport) => [
21+
{
22+
Header: 'Wallet Type',
23+
accessor: 'walletType',
24+
width: 200,
25+
Cell: ({ value }) => <span>{value}</span>,
26+
sortable: false
27+
},
2328
{
2429
Header: 'Wallet Address',
2530
accessor: 'address',
@@ -44,7 +49,7 @@ const getColumns = (wallets, onRemove, onExport) => [
4449
),
4550
sortable: false
4651
},
47-
{
52+
/*{
4853
Header: '',
4954
accessor: 'address',
5055
width: 150,
@@ -54,7 +59,7 @@ const getColumns = (wallets, onRemove, onExport) => [
5459
</span>
5560
),
5661
sortable: false
57-
}
62+
}*/
5863
];
5964

6065
class GatewayApplicationWalletComponent extends React.Component {
@@ -85,7 +90,7 @@ class GatewayApplicationWalletComponent extends React.Component {
8590
return (
8691
<div className="table-with-add">
8792
<WalletGenerate gateway={gateway} onSubmit={this.onGenerateWallet} />
88-
<WalletImport gateway={gateway} onSubmit={this.onImportWallet} />
93+
8994
<Segment attached styles={{ padding: 0 }}>
9095
<Table data={wallets.list} columns={columns} noDataText={noDataText} />
9196
</Segment>

payment-chooser/build/resources/static/static/js/payment-chooser.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

payment-chooser/build/resources/static/static/js/payment-chooser.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

payment-chooser/build/static/js/payment-chooser.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

payment-chooser/build/static/js/payment-chooser.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/kotlin/io/openfuture/api/component/key/DefaultKeyApi.kt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ import org.springframework.web.client.RestTemplate
66

77

88
@Component
9-
class DefaultKeyApi(private val keyRestTemplate: RestTemplate): KeyApi {
10-
override fun generateKey(createKeyRequest: CreateKeyRequest): KeyWalletDto {
9+
class DefaultKeyApi(
10+
private val keyRestTemplate: RestTemplate
11+
): KeyApi {
12+
13+
override fun generateWallet(createKeyRequest: CreateKeyRequest): KeyWalletDto {
1114
val response = keyRestTemplate.postForEntity("/key", createKeyRequest, KeyWalletDto::class.java)
1215
return response.body!!
1316
}
@@ -17,17 +20,22 @@ class DefaultKeyApi(private val keyRestTemplate: RestTemplate): KeyApi {
1720
return response.body!!
1821
}
1922

20-
override fun generateMultipleKey(createMultipleKeyRequest: CreateMultipleKeyRequest): Array<KeyWalletDto> {
23+
override fun generateMultipleWallets(createMultipleKeyRequest: CreateMultipleKeyRequest): Array<KeyWalletDto> {
2124
val response = keyRestTemplate.postForEntity("/key/multiple", createMultipleKeyRequest, Array<KeyWalletDto>::class.java)
2225
return response.body!!
2326
}
2427

25-
override fun getAllKeysByApplication(applicationId: String): Array<KeyWalletDto> {
28+
override fun updateWallets(createMultipleKeyRequest: CreateMultipleKeyRequest): Array<KeyWalletDto> {
29+
val response = keyRestTemplate.postForEntity("/key/update", createMultipleKeyRequest, Array<KeyWalletDto>::class.java)
30+
return response.body!!
31+
}
32+
33+
override fun getAllWalletsByApplication(applicationId: String): Array<KeyWalletDto> {
2634
val response = keyRestTemplate.getForEntity("/key?applicationId={applicationId}", Array<KeyWalletDto>::class.java, applicationId)
2735
return response.body!!
2836
}
2937

30-
override fun getAllKeysByOrderKey(orderKey: String): Array<KeyWalletDto> {
38+
override fun getAllWalletsByOrderKey(orderKey: String): Array<KeyWalletDto> {
3139
val url = "/key/order/${orderKey}"
3240
val response = keyRestTemplate.getForEntity(url, Array<KeyWalletDto>::class.java)
3341
return response.body!!
@@ -38,7 +46,7 @@ class DefaultKeyApi(private val keyRestTemplate: RestTemplate): KeyApi {
3846
return response.body!!
3947
}
4048

41-
override fun deleteAllKeysByApplicationAddress(applicationId: String, address: String) {
49+
override fun deleteAllWalletsByApplicationAddress(applicationId: String, address: String) {
4250
val url = "/key?applicationId=${applicationId}&address=${address}"
4351
keyRestTemplate.delete(url)
4452
}

src/main/kotlin/io/openfuture/api/component/key/KeyApi.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package io.openfuture.api.component.key
33
import io.openfuture.api.domain.key.*
44

55
interface KeyApi {
6-
fun generateKey(createKeyRequest: CreateKeyRequest): KeyWalletDto
6+
fun generateWallet(createKeyRequest: CreateKeyRequest): KeyWalletDto
77
fun importWallet(request: ImportKeyRequest): KeyWalletDto
8-
fun generateMultipleKey(createMultipleKeyRequest: CreateMultipleKeyRequest): Array<KeyWalletDto>
9-
fun getAllKeysByApplication(applicationId: String): Array<KeyWalletDto>
10-
fun getAllKeysByOrderKey(orderKey: String): Array<KeyWalletDto>
8+
fun generateMultipleWallets(createMultipleKeyRequest: CreateMultipleKeyRequest): Array<KeyWalletDto>
9+
fun updateWallets(createMultipleKeyRequest: CreateMultipleKeyRequest): Array<KeyWalletDto>
10+
fun getAllWalletsByApplication(applicationId: String): Array<KeyWalletDto>
11+
fun getAllWalletsByOrderKey(orderKey: String): Array<KeyWalletDto>
1112
fun getApplicationByAddress(address: String): WalletAddressResponse
12-
fun deleteAllKeysByApplicationAddress(applicationId: String, address: String)
13+
fun deleteAllWalletsByApplicationAddress(applicationId: String, address: String)
1314
fun exportPrivateKey(keyWalletDto: KeyWalletDto): String
1415
}

src/main/kotlin/io/openfuture/api/component/state/DefaultStateApi.kt

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,41 @@
11
package io.openfuture.api.component.state
22

3-
import io.openfuture.api.domain.key.KeyWalletDto
3+
import io.openfuture.api.domain.state.WalletApiStateResponse
44
import io.openfuture.api.domain.state.*
55
import io.openfuture.api.domain.transaction.TransactionDto
66
import io.openfuture.api.domain.widget.PaymentWidgetResponse
77
import io.openfuture.api.entity.state.Blockchain
8-
import io.openfuture.api.util.getOrderKey
9-
import io.openfuture.api.util.getRandomNumber
108
import org.springframework.stereotype.Component
119
import org.springframework.web.client.RestTemplate
12-
import java.math.BigDecimal
1310

1411
@Component
1512
class DefaultStateApi(private val stateRestTemplate: RestTemplate) : StateApi {
1613

17-
override fun createWallet(address: String, webHook: String, blockchain: Blockchain): CreateStateWalletResponse {
18-
val request = CreateStateWalletRequestMetadata(
19-
webHook,
20-
listOf(KeyWalletDto(address, blockchain.getValue())),
21-
WalletMetaData(
22-
"0",
23-
"1000",
24-
"op_UxQr1LLdREboF",
25-
"USD",
26-
"open",
27-
false
28-
)
29-
)
30-
return stateRestTemplate.postForEntity("/wallets", request, CreateStateWalletResponse::class.java).body!!
14+
override fun createWallet(address: String, webHook: String, blockchain: Blockchain, applicationId: String): StateWalletDto {
15+
val request = CreateStateWalletRequest(address, webHook, blockchain.getValue(), applicationId)
16+
println("Blockchain : $blockchain")
17+
val response = stateRestTemplate.postForEntity("/wallets/single", request, StateWalletDto::class.java)
18+
return response.body!!
3119
}
3220

3321
override fun createWalletWithMetadata(request: CreateStateWalletRequestMetadata): CreateStateWalletResponse {
3422
return stateRestTemplate.postForEntity("/wallets", request, CreateStateWalletResponse::class.java).body!!
3523
}
3624

25+
override fun updateWalletWithMetadata(request: UpdateStateWalletMetadata) {
26+
stateRestTemplate.postForEntity("/wallets/update", request, Void::class.java)
27+
}
28+
3729
override fun deleteWallet(address: String, blockchain: Blockchain) {
3830
val url = "/wallets/blockchain/${blockchain.getValue()}/address/${address}"
3931
stateRestTemplate.delete(url)
4032
}
4133

34+
override fun getWallet(address: String, blockchain: Blockchain): WalletApiStateResponse {
35+
val url = "/wallets/blockchain/${blockchain.getValue()}/address/${address}"
36+
return stateRestTemplate.getForEntity(url, WalletApiStateResponse::class.java).body!!
37+
}
38+
4239
override fun getAddressTransactionsByAddress(address: String): StateWalletTransactionDetail {
4340
val url = "/wallets/transactions/address/${address}"
4441
return stateRestTemplate.getForEntity(url, StateWalletTransactionDetail::class.java).body!!

src/main/kotlin/io/openfuture/api/component/state/StateApi.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
package io.openfuture.api.component.state
22

3+
import io.openfuture.api.domain.state.WalletApiStateResponse
34
import io.openfuture.api.domain.state.*
45
import io.openfuture.api.domain.transaction.TransactionDto
56
import io.openfuture.api.domain.widget.PaymentWidgetResponse
67
import io.openfuture.api.entity.state.Blockchain
78

89
interface StateApi {
910

10-
fun createWallet(address: String, webHook: String, blockchain: Blockchain): CreateStateWalletResponse
11+
fun createWallet(address: String, webHook: String, blockchain: Blockchain, applicationId: String): StateWalletDto
1112

1213
fun createWalletWithMetadata(request: CreateStateWalletRequestMetadata): CreateStateWalletResponse
1314

15+
fun updateWalletWithMetadata(request: UpdateStateWalletMetadata)
16+
1417
fun deleteWallet(address: String, blockchain: Blockchain)
1518

19+
fun getWallet(address: String, blockchain: Blockchain): WalletApiStateResponse
20+
1621
fun getAddressTransactionsByAddress(address: String): StateWalletTransactionDetail
1722

1823
fun getTransactionsByAddress(address: String): Array<TransactionDto>

0 commit comments

Comments
 (0)