-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Withdraw rewards ...
tests
#773
Changes from all commits
4dea07b
cf91cc4
0a50a8e
671a0aa
e30b97e
74769a9
2174201
581d08f
18d99ed
23dbfaf
7063727
6a61be4
ec542d4
b6a9816
be0f646
6e90a97
6c41a3b
e529cf0
245c343
a436067
ad513c1
f8890c9
1eac213
74c692b
891700c
d41a705
8fdc02d
97838f0
ae0a2d0
7dff6e4
03d6dc7
09ef42d
a28938e
986aefa
d31e11c
953dab0
977e55c
7ceadce
fc6bcc8
370234c
39e12b5
9189233
cdce77f
13d659f
a004470
4d11606
5a5d5fa
7255a86
7666703
46b708c
d27f83c
afc9950
d05b6da
2f4bc36
a54d897
c49d7fa
1e42a5c
d3b6aeb
87e3c98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
enum Mnemonics { | ||
node0Mnemonic = "fox orange tiger coach ski arm shrimp scrub quote reason visa better wait drift program burst mind assault develop canvas inspire battle odor visit", | ||
node1Mnemonic = "merit daring radio hospital exchange kitten skirt cry seven evil faculty lion cup inherit live host stable tuna convince tip blur sphere curve search", | ||
firstMnemonic = "move drastic law sustain decade parent stairs minor cry help worry minute bridge bone force found mimic frown burst foil avocado water kingdom picture", | ||
secondMnemonic = "cancel fault concert check match goose auto item judge couch exist shop mango option sister edit maze wide praise tortoise memory right post unusual", | ||
thirdMnemonic = "pink neutral tray meadow pet caught cereal pass test swarm edge junior cradle all split matrix siege squeeze hobby fence act human patrol ramp", | ||
fourthMnemonic = "shell display fetch burst pear naive hip box nose gallery unlock sign surprise ancient elite girl winter disorder wish list maximum galaxy twenty rather", | ||
fifthMnemonic = "enroll collect warm liar allow symbol topic reveal forget cute layer lens crucial wheat remind unknown barrel piece horror depend quarter position adjust clog", | ||
sixthMnemonic = "wink trophy quit belt rely corn style cupboard mix price abstract sentence joy column half woman thank firm mushroom lamp into hockey diary inside", | ||
} | ||
|
||
enum ExistingAddresses { | ||
adminAccount = "tgrade1kalzk5cvq5yu6f5u73k7r905yw52sawckddsc3", | ||
node0Account = "tgrade1tsg4wldpwyehhkqx3za78ygkzatncxxup96k7h", | ||
node1Account = "tgrade12ty7w05kswvuvvzzdxdv8w4tf7g6y9xexy5rzj", | ||
firstAccount = "tgrade10jdqrtm46xsxtdmuyt2zfcrhupvycrpv80r7nh", | ||
secondAccount = "tgrade1aw7g4pxlzmj85fwhd3zs5hhgs0a9xeqg28z8jl", | ||
thirdAccount = "tgrade1dzav7m7r42sg02sqdvqelazsg0mu5ef0qjpq5e", | ||
fourthAccount = "tgrade1kjeuxlg02ku900mzddhrvpc2cjgaaen90czgg8", | ||
fifthAccount = "tgrade1kwh2efsmue7pms3930gsclr224k8c7uwke5jvd", | ||
sixthAccount = "tgrade1vl76n4q0pfk2ek07tz2cd5vnlvkuf5tnznqed5", | ||
} | ||
|
||
enum ValidatorName { | ||
node0Account = "moniker-0", | ||
node1Account = "delme", | ||
} | ||
|
||
export const selectValidatorNameByAddressNumber = (accountNumber: string): string => { | ||
switch (accountNumber) { | ||
case "node0Account": | ||
return ValidatorName.node0Account; | ||
case "node1Account": | ||
return ValidatorName.node1Account; | ||
default: | ||
return "no address number was provided"; | ||
} | ||
}; | ||
|
||
export const selectWalletAddressByNumber = (walletNumber: string): string => { | ||
switch (walletNumber) { | ||
case "node0Account": | ||
return ExistingAddresses.node0Account; | ||
case "node1Account": | ||
return ExistingAddresses.node1Account; | ||
case "firstAccount": | ||
return ExistingAddresses.firstAccount; | ||
case "secondAccount": | ||
return ExistingAddresses.secondAccount; | ||
case "thirdAccount": | ||
return ExistingAddresses.thirdAccount; | ||
case "fourthAccount": | ||
return ExistingAddresses.fourthAccount; | ||
case "fifthAccount": | ||
return ExistingAddresses.fifthAccount; | ||
case "sixthAccount": | ||
return ExistingAddresses.sixthAccount; | ||
default: | ||
return "no wallet number was provided"; | ||
} | ||
}; | ||
|
||
export const selectMnemonicByNumber = (mnemonicAddress: string): string => { | ||
switch (mnemonicAddress) { | ||
case "node0Mnemonic": | ||
return Mnemonics.node0Mnemonic; | ||
case "node1Mnemonic": | ||
return Mnemonics.node1Mnemonic; | ||
case "firstMnemonic": | ||
return Mnemonics.firstMnemonic; | ||
case "secondMnemonic": | ||
return Mnemonics.secondMnemonic; | ||
case "thirdMnemonic": | ||
return Mnemonics.thirdMnemonic; | ||
case "fourthMnemonic": | ||
return Mnemonics.fourthMnemonic; | ||
case "fifthMnemonic": | ||
return Mnemonics.fifthMnemonic; | ||
case "sixthMnemonic": | ||
return Mnemonics.sixthMnemonic; | ||
default: | ||
return "no mnemonic was provided"; | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { Bip39, Random } from "@cosmjs/crypto"; | ||
import { Bech32 } from "@cosmjs/encoding"; | ||
|
||
const generateMnemonic = (): string => Bip39.encode(Random.getBytes(16)).toString(); | ||
|
||
function makeRandomTgradeAddress(): string { | ||
return Bech32.encode("tgrade", Random.getBytes(20)); | ||
} | ||
|
||
const randomMnemonic01 = generateMnemonic(); | ||
const randomMnemonic02 = generateMnemonic(); | ||
const randomMnemonic03 = generateMnemonic(); | ||
const randomMnemonic04 = generateMnemonic(); | ||
const randomMnemonic05 = generateMnemonic(); | ||
const randomMnemonic06 = generateMnemonic(); | ||
|
||
const randomAddress01 = makeRandomTgradeAddress(); | ||
const randomAddress02 = makeRandomTgradeAddress(); | ||
const randomAddress03 = makeRandomTgradeAddress(); | ||
const randomAddress04 = makeRandomTgradeAddress(); | ||
const randomAddress05 = makeRandomTgradeAddress(); | ||
const randomAddress06 = makeRandomTgradeAddress(); | ||
|
||
export const selectRandomGeneratedMnemonicByNumber = (addressMnemonic: string): string => { | ||
switch (addressMnemonic) { | ||
case "randomMnemonic01": | ||
return randomMnemonic01; | ||
case "randomMnemonic02": | ||
return randomMnemonic02; | ||
case "randomMnemonic03": | ||
return randomMnemonic03; | ||
case "randomMnemonic04": | ||
return randomMnemonic04; | ||
case "randomMnemonic05": | ||
return randomMnemonic05; | ||
case "randomMnemonic06": | ||
return randomMnemonic06; | ||
default: | ||
return "no mnemonic was provided"; | ||
} | ||
}; | ||
|
||
export const selectRandomGeneratedAddressByNumber = (number: string): string => { | ||
switch (number) { | ||
case "randomAddress01": | ||
return randomAddress01; | ||
case "randomAddress02": | ||
return randomAddress02; | ||
case "randomAddress03": | ||
return randomAddress03; | ||
case "randomAddress04": | ||
return randomAddress04; | ||
case "randomAddress05": | ||
return randomAddress05; | ||
case "randomAddress06": | ||
return randomAddress06; | ||
default: | ||
return "no number was provided"; | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Feature: See my Tgrade token balance | ||
Background: | ||
* I connect Web Demo wallet | ||
* Open wallet dialog from main menu | ||
|
||
Scenario: Check TGD balance | ||
* I see TGD balance "10" for random address |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Feature: Withdraw my rewards to my address | ||
Background: | ||
* I connect Web Demo wallet | ||
* Set existing "firstMnemonic" wallet with Engagement Points and Engagement Rewards | ||
* Open wallet dialog from main menu | ||
* I see my TGD balance in wallet "firstMnemonic" | ||
* I close wallet dialog modal | ||
* I visit Engagement page | ||
|
||
Scenario: Withdraw rewards | ||
|
||
# Check balance of initial address before | ||
* I see the "Address" field prefilled with my "firstAccount" wallet | ||
* I see Engagement Points "5 / 2034 (0.25%)" and Engagement Rewards "9" TGD | ||
|
||
# Withdraw rewards | ||
* I click on the "Withdraw rewards" button | ||
* I see Tx success screen with existing "firstAccount" address | ||
* I click Go to Engagement button | ||
|
||
# Check balance of initial address after | ||
* I see Engagement Points "5 / 2034 (0.25%)" and Engagement Rewards "0" TGD | ||
* Open wallet dialog from main menu | ||
* I see that TGD balance "1009" has gone up for "firstAccount" address |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Feature: Withdraw my rewards to another address | ||
Background: | ||
* I connect Web Demo wallet | ||
* Set existing "secondMnemonic" wallet with Engagement Points and Engagement Rewards | ||
* Open wallet dialog from main menu | ||
* I see my TGD balance in wallet "secondMnemonic" | ||
* I close wallet dialog modal | ||
* I visit Engagement page | ||
|
||
Scenario: Withdraw rewards using "Receiver address" | ||
|
||
# Check balance of initial address before | ||
* I see the "Address" field prefilled with my "secondAccount" wallet | ||
* I see Engagement Points "7 / 2034 (0.34%)" and Engagement Rewards "14" TGD | ||
|
||
# Set receiver address | ||
* I enter address in the "Receiver address" field from "randomMnemonic01" wallet | ||
* I use "randomMnemonic01" to make query and check balance of this address "0" | ||
|
||
# Withdraw rewards | ||
* I click on the "Withdraw rewards" button | ||
* I see Tx success screen with address from "randomMnemonic01" | ||
* I click Go to Engagement button | ||
* I see Engagement Points "7 / 2034 (0.34%)" and Engagement Rewards "0" TGD | ||
|
||
# Check receiver address balance | ||
* I use "randomMnemonic01" to make query and check balance of this address "14" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very useful file, like
existingAccounts.ts
. I think it would be more readable to use numbers instead of string ordinalsrandomMnemonicFourth -> randomMnemonic04
, but I don't mind you doing it this way if you prefer it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, let me update it