Skip to content

Commit 68f7902

Browse files
committed
chore: remove fee, update tests
1 parent 6b4c041 commit 68f7902

File tree

7 files changed

+73
-81
lines changed

7 files changed

+73
-81
lines changed

internal/participation.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,6 @@ func FindParticipationIdForVoteKey(slice *[]api.ParticipationKey, votekey []byte
109109
}
110110

111111
func ToLoraDeepLink(network string, offline bool, incentiveEligible bool, part api.ParticipationKey) (string, error) {
112-
var fee int
113-
if incentiveEligible {
114-
fee = 2000000
115-
} else {
116-
//TODO: get suggested params
117-
fee = 1000
118-
}
119-
120112
var loraNetwork = strings.Replace(strings.Replace(network, "-v1.0", "", 1), "-v1", "", 1)
121113
if loraNetwork == "dockernet" || loraNetwork == "tuinet" {
122114
loraNetwork = "localnet"
@@ -131,8 +123,7 @@ func ToLoraDeepLink(network string, offline bool, incentiveEligible bool, part a
131123
)
132124
} else {
133125
query = fmt.Sprintf(
134-
"type[0]=keyreg&fee[0]=%d&sender[0]=%s&selkey[0]=%s&sprfkey[0]=%s&votekey[0]=%s&votefst[0]=%d&votelst[0]=%d&votekd[0]=%d",
135-
fee,
126+
"type[0]=keyreg&sender[0]=%s&selkey[0]=%s&sprfkey[0]=%s&votekey[0]=%s&votefst[0]=%d&votelst[0]=%d&votekd[0]=%d",
136127
part.Address,
137128
base64.RawURLEncoding.EncodeToString(part.Key.SelectionParticipationKey),
138129
base64.RawURLEncoding.EncodeToString(*part.Key.StateProofKey),
@@ -141,6 +132,9 @@ func ToLoraDeepLink(network string, offline bool, incentiveEligible bool, part a
141132
part.Key.VoteLastValid,
142133
part.Key.VoteKeyDilution,
143134
)
135+
if incentiveEligible {
136+
query += fmt.Sprintf("&fee[0]=%d", 2000000)
137+
}
144138
}
145139
return fmt.Sprintf("https://lora.algokit.io/%s/transaction-wizard?%s", loraNetwork, strings.Replace(query, "[0]", encodedIndex, -1)), nil
146140
}

internal/participation_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ func Test_ToLoraDeeplink(t *testing.T) {
3131
if err != nil {
3232
t.Error(err)
3333
}
34-
if link != "https://lora.algokit.io/localnet/transaction-wizard?type%5B0%5D=keyreg&fee%5B0%5D=2000000&sender%5B0%5D=ABC&selkey%5B0%5D=VEVTVEtFWQ&sprfkey%5B0%5D=VEVTVEtFWQ&votekey%5B0%5D=VEVTVEtFWQ&votefst%5B0%5D=0&votelst%5B0%5D=30000&votekd%5B0%5D=100" {
34+
if link != "https://lora.algokit.io/localnet/transaction-wizard?type%5B0%5D=keyreg&sender%5B0%5D=ABC&selkey%5B0%5D=VEVTVEtFWQ&sprfkey%5B0%5D=VEVTVEtFWQ&votekey%5B0%5D=VEVTVEtFWQ&votefst%5B0%5D=0&votelst%5B0%5D=30000&votekd%5B0%5D=100&fee%5B0%5D=2000000" {
3535
t.Error("Link should be a known deeplink fee")
3636
}
3737

3838
link, err = ToLoraDeepLink("tuinet-v1", false, false, mock.Keys[0])
3939
if err != nil {
4040
t.Error(err)
4141
}
42-
if link != "https://lora.algokit.io/localnet/transaction-wizard?type%5B0%5D=keyreg&fee%5B0%5D=1000&sender%5B0%5D=ABC&selkey%5B0%5D=VEVTVEtFWQ&sprfkey%5B0%5D=VEVTVEtFWQ&votekey%5B0%5D=VEVTVEtFWQ&votefst%5B0%5D=0&votelst%5B0%5D=30000&votekd%5B0%5D=100" {
42+
if link != "https://lora.algokit.io/localnet/transaction-wizard?type%5B0%5D=keyreg&sender%5B0%5D=ABC&selkey%5B0%5D=VEVTVEtFWQ&sprfkey%5B0%5D=VEVTVEtFWQ&votekey%5B0%5D=VEVTVEtFWQ&votefst%5B0%5D=0&votelst%5B0%5D=30000&votekd%5B0%5D=100" {
4343
t.Error("Link should be a known deeplink fee")
4444
}
4545

ui/internal/test/state.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ func GetState(client api.ClientWithResponsesInterface) *internal.StateModel {
4242
val, ok := values[key.Address]
4343
if !ok {
4444
values[key.Address] = internal.Account{
45-
Address: key.Address,
46-
Status: "Offline",
47-
Balance: 0,
48-
Expires: internal.GetExpiresTime(clock, key, sm),
49-
Keys: 1,
45+
Address: key.Address,
46+
Status: "Offline",
47+
Balance: 0,
48+
IncentiveEligible: true,
49+
Expires: internal.GetExpiresTime(clock, key, sm),
50+
Keys: 1,
5051
}
5152
} else {
5253
val.Keys++

ui/modal/testdata/Test_Snapshot/TransactionModal.golden

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222

2323

24+
2425

2526

2627
╭──Register Offline─────────────────────────────────────────╮
@@ -29,22 +30,20 @@
2930
│ Scan the QR code with Pera or Defly │
3031
│ (make sure you use the testnet-v1.0 network) │
3132
│ │
32-
│ █████████████████████████████████ │
33-
│ ██ ▄▄▄▄▄ █▀▀ ▄█▀▄██▀█ ▄█ ▄▄▄▄▄ ██ │
34-
│ ██ █ █ ██▄█ █▀█▄██▄▀ █ █ █ ██ │
35-
│ ██ █▄▄▄█ █▄ ▄▀▄▄▀▀ █ ▄█ █▄▄▄█ ██ │
36-
│ ██▄▄▄▄▄▄▄█▄▀▄▀ █▄█ ▀▄▀▄█▄▄▄▄▄▄▄██ │
37-
│ ██ ▀ █ ▀▄██▀█ ▀▀██ ▀██▀██▄█▀ ▀██ │
38-
│ ██▄ ▀▄██▄ ▀▄ ▄▀▀ ▀▀▀█▀█▀ ▄▄█▄ ██ │
39-
│ ██ ▄▀▄ █▄ ██▀▄█ █ ▄▀██ ▄█▄ █ ██ │
40-
│ ██▀▄▀▀█▀▄▀▀▀ ██▄██▄▀ ▀▀█ ▄▀██ ▄██ │
41-
│ ███▀██▀▄▄ ▄▀▀▀▄▀██▀ ▀▄██ ▀█▀█ ▀██ │
42-
│ ██▄▀ ▀▄▄▄ ▄ █▀▀ ▀█▀▄▀▀▄▀▄▀▄▄▄▄██ │
43-
│ ██▄█▄▄██▄█▀█▀███ ▄▀ █▀ ▄▄▄ █▀▀ ██ │
44-
│ ██ ▄▄▄▄▄ ██▄█▄█▄█▀▀▀▀▄ █▄█ ██▄ ██ │
45-
│ ██ █ █ █▄▄▄█▄▀██ ▄ █▄▄▄ ██▀ ██ │
46-
│ ██ █▄▄▄█ █▄ ▄█▀ ██▀▀ ██▀ ▀▄▀▄██ │
47-
│ ██▄▄▄▄▄▄▄█▄█▄███▄▄▄▄█▄▄████▄█▄▄██ │
33+
│ █████████████████████████████ │
34+
│ ██ ▄▄▄▄▄ █▀█▄▀█▀█ ▀█ ▄▄▄▄▄ ██ │
35+
│ ██ █ █ ██▀▄▀ █ █ █ █ █ ██ │
36+
│ ██ █▄▄▄█ █▄▀▀▀█▀ ██ █▄▄▄█ ██ │
37+
│ ██▄▄▄▄▄▄▄█▄█▄█▄▀ ▀ █▄▄▄▄▄▄▄██ │
38+
│ ██▄▀ ▀ █▄▀▀ ▄█▄ █▀▀▀▀▄██ ▀██ │
39+
│ ███▀ ▄▀▄▄▀▀█▄█▄▀▀█▀▄▀▀▀▄█ ▄██ │
40+
│ ███▀█ ▀▄ █ ▄▀▄▄█▄█▀ ██▀ ▀██ │
41+
│ ██▄▀█ ▄▄ █▄ █▀ ██▄▀█▄▄█▄▄██ │
42+
│ ██▄███▄█▄▄▀▄▀█ █▀ ▄▄▄ █▀ ██ │
43+
│ ██ ▄▄▄▄▄ ██▄ ▀▀▀▀█ █▄█ ██ ██ │
44+
│ ██ █ █ █▄ ▀█ ▄▀▀ ▄▄ ▀█████ │
45+
│ ██ █▄▄▄█ █▄▀ █▄▀ ▀▄▀▄ ▄▄▀▄██ │
46+
│ ██▄▄▄▄▄▄▄█▄█▄██▄█▄▄▄▄▄███▄▄██ │
4847
│ │
4948
│ -or- │
5049
│ │
@@ -75,6 +74,7 @@
7574

7675

7776

77+
7878

7979

8080

ui/modals/transaction/controller.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,15 @@ func (m *ViewModel) UpdateState() {
6363
m.ATxn = &encoder.AUrlTxn{}
6464
}
6565

66-
var fee uint64
67-
if m.Account().IncentiveEligible {
68-
fee = uint64(2000000)
69-
} else {
70-
// TODO: Maybe keep suggested params in state?
71-
fee = uint64(1000)
66+
var fee *uint64
67+
if m.Account().IncentiveEligible && !m.Active {
68+
feeInst := uint64(2000000)
69+
fee = &feeInst
7270
}
71+
7372
m.ATxn.AUrlTxnKeyCommon.Sender = m.Participation.Address
7473
m.ATxn.AUrlTxnKeyCommon.Type = string(types.KeyRegistrationTx)
75-
m.ATxn.AUrlTxnKeyCommon.Fee = &fee
74+
m.ATxn.AUrlTxnKeyCommon.Fee = fee
7675

7776
if !m.Active {
7877
m.Title = string(OnlineTitle)

ui/modals/transaction/testdata/Test_Snapshot/Offline.golden

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,20 @@
33
Scan the QR code with Pera or Defly
44
(make sure you use the testnet-v1.0 network)
55

6-
█████████████████████████████████
7-
██ ▄▄▄▄▄ █▀▀ ▄█▀▄██▀█ ▄█ ▄▄▄▄▄ ██
8-
██ █ █ ██▄█ █▀█▄██▄▀ █ █ █ ██
9-
██ █▄▄▄█ █▄ ▄▀▄▄▀▀ █ ▄█ █▄▄▄█ ██
10-
██▄▄▄▄▄▄▄█▄▀▄▀ █▄█ ▀▄▀▄█▄▄▄▄▄▄▄██
11-
██ ▀ █ ▀▄██▀█ ▀▀██ ▀██▀██▄█▀ ▀██
12-
██▄ ▀▄██▄ ▀▄ ▄▀▀ ▀▀▀█▀█▀ ▄▄█▄ ██
13-
██ ▄▀▄ █▄ ██▀▄█ █ ▄▀██ ▄█▄ █ ██
14-
██▀▄▀▀█▀▄▀▀▀ ██▄██▄▀ ▀▀█ ▄▀██ ▄██
15-
███▀██▀▄▄ ▄▀▀▀▄▀██▀ ▀▄██ ▀█▀█ ▀██
16-
██▄▀ ▀▄▄▄ ▄ █▀▀ ▀█▀▄▀▀▄▀▄▀▄▄▄▄██
17-
██▄█▄▄██▄█▀█▀███ ▄▀ █▀ ▄▄▄ █▀▀ ██
18-
██ ▄▄▄▄▄ ██▄█▄█▄█▀▀▀▀▄ █▄█ ██▄ ██
19-
██ █ █ █▄▄▄█▄▀██ ▄ █▄▄▄ ██▀ ██
20-
██ █▄▄▄█ █▄ ▄█▀ ██▀▀ ██▀ ▀▄▀▄██
21-
██▄▄▄▄▄▄▄█▄█▄███▄▄▄▄█▄▄████▄█▄▄██
6+
█████████████████████████████
7+
██ ▄▄▄▄▄ █▀█▄▀█▀█ ▀█ ▄▄▄▄▄ ██
8+
██ █ █ ██▀▄▀ █ █ █ █ █ ██
9+
██ █▄▄▄█ █▄▀▀▀█▀ ██ █▄▄▄█ ██
10+
██▄▄▄▄▄▄▄█▄█▄█▄▀ ▀ █▄▄▄▄▄▄▄██
11+
██▄▀ ▀ █▄▀▀ ▄█▄ █▀▀▀▀▄██ ▀██
12+
███▀ ▄▀▄▄▀▀█▄█▄▀▀█▀▄▀▀▀▄█ ▄██
13+
███▀█ ▀▄ █ ▄▀▄▄█▄█▀ ██▀ ▀██
14+
██▄▀█ ▄▄ █▄ █▀ ██▄▀█▄▄█▄▄██
15+
██▄███▄█▄▄▀▄▀█ █▀ ▄▄▄ █▀ ██
16+
██ ▄▄▄▄▄ ██▄ ▀▀▀▀█ █▄█ ██ ██
17+
██ █ █ █▄ ▀█ ▄▀▀ ▄▄ ▀█████
18+
██ █▄▄▄█ █▄▀ █▄▀ ▀▄▀▄ ▄▄▀▄██
19+
██▄▄▄▄▄▄▄█▄█▄██▄█▄▄▄▄▄███▄▄██
2220

2321
-or-
2422

0 commit comments

Comments
 (0)