@@ -2,27 +2,19 @@ package promotion
2
2
3
3
import (
4
4
"context"
5
- "encoding/hex"
6
- "errors"
7
5
"fmt"
8
6
"os"
9
7
"sync"
10
8
"time"
11
9
12
- "github.com/brave-intl/bat-go/libs/altcurrency"
13
10
"github.com/brave-intl/bat-go/libs/clients/cbr"
14
11
"github.com/brave-intl/bat-go/libs/clients/reputation"
15
12
appctx "github.com/brave-intl/bat-go/libs/context"
16
- errorutils "github.com/brave-intl/bat-go/libs/errors"
17
- "github.com/brave-intl/bat-go/libs/httpsignature"
18
13
kafkautils "github.com/brave-intl/bat-go/libs/kafka"
19
- w "github.com/brave-intl/bat-go/libs/wallet"
20
- "github.com/brave-intl/bat-go/libs/wallet/provider/uphold"
21
14
"github.com/brave-intl/bat-go/services/wallet"
22
15
"github.com/linkedin/goavro"
23
16
"github.com/prometheus/client_golang/prometheus"
24
17
"github.com/segmentio/kafka-go"
25
- "golang.org/x/crypto/ed25519"
26
18
)
27
19
28
20
const localEnv = "local"
@@ -89,7 +81,6 @@ type Service struct {
89
81
kafkaWriter * kafka.Writer
90
82
kafkaDialer * kafka.Dialer
91
83
kafkaAdminAttestationReader kafkautils.Consumer
92
- hotWallet * uphold.Wallet
93
84
pauseSuggestionsUntil time.Time
94
85
pauseSuggestionsUntilMu sync.RWMutex
95
86
}
@@ -117,44 +108,6 @@ func (service *Service) InitKafka(ctx context.Context) error {
117
108
return nil
118
109
}
119
110
120
- // InitHotWallet by reading the keypair and card id from the environment
121
- func (service * Service ) InitHotWallet (ctx context.Context ) error {
122
- grantWalletPublicKeyHex := os .Getenv ("GRANT_WALLET_PUBLIC_KEY" )
123
- grantWalletPrivateKeyHex := os .Getenv ("GRANT_WALLET_PRIVATE_KEY" )
124
- grantWalletCardID := os .Getenv ("GRANT_WALLET_CARD_ID" )
125
-
126
- if len (grantWalletCardID ) > 0 {
127
- var info w.Info
128
- info .Provider = "uphold"
129
- info .ProviderID = grantWalletCardID
130
- {
131
- tmp := altcurrency .BAT
132
- info .AltCurrency = & tmp
133
- }
134
-
135
- var pubKey httpsignature.Ed25519PubKey
136
- var privKey ed25519.PrivateKey
137
- var err error
138
-
139
- pubKey , err = hex .DecodeString (grantWalletPublicKeyHex )
140
- if err != nil {
141
- return errorutils .Wrap (err , "grantWalletPublicKeyHex is invalid" )
142
- }
143
- privKey , err = hex .DecodeString (grantWalletPrivateKeyHex )
144
- if err != nil {
145
- return errorutils .Wrap (err , "grantWalletPrivateKeyHex is invalid" )
146
- }
147
-
148
- service .hotWallet , err = uphold .New (ctx , info , privKey , pubKey )
149
- if err != nil {
150
- return err
151
- }
152
- } else if os .Getenv ("ENV" ) != localEnv {
153
- return errors .New ("GRANT_WALLET_CARD_ID must be set in production" )
154
- }
155
- return nil
156
- }
157
-
158
111
// InitService creates a service using the passed datastore and clients configured from the environment
159
112
func InitService (
160
113
ctx context.Context ,
@@ -212,10 +165,6 @@ func InitService(
212
165
return nil , err
213
166
}
214
167
215
- err = service .InitHotWallet (ctx )
216
- if err != nil {
217
- return nil , err
218
- }
219
168
return service , nil
220
169
}
221
170
0 commit comments