@@ -17,7 +17,8 @@ import {
1717 createDelegateeTracker ,
1818 createQueryStakePoolsProvider ,
1919 createRewardsProvider ,
20- fetchRewardsTrigger$ , getStakePoolIdAtEpoch
20+ fetchRewardsTrigger$ ,
21+ getStakePoolIdAtEpoch
2122} from '../../../src' ;
2223import { RetryBackoffConfig } from 'backoff-rxjs' ;
2324import { TxWithEpoch } from '../../../src/services/DelegationTracker/types' ;
@@ -147,7 +148,8 @@ describe('RewardAccounts', () => {
147148 certificates : [
148149 {
149150 __typename : Cardano . CertificateType . VoteRegistrationDelegation
150- } as Cardano . VoteRegistrationDelegationCertificate ] ,
151+ } as Cardano . VoteRegistrationDelegationCertificate
152+ ] ,
151153 epoch : Cardano . EpochNo ( 103 )
152154 } ,
153155 {
@@ -170,7 +172,8 @@ describe('RewardAccounts', () => {
170172 {
171173 __typename : Cardano . CertificateType . StakeRegistrationDelegation ,
172174 poolId : poolId1
173- } as Cardano . StakeRegistrationDelegationCertificate ] ,
175+ } as Cardano . StakeRegistrationDelegationCertificate
176+ ] ,
174177 epoch : Cardano . EpochNo ( 106 )
175178 } ,
176179 // Unregister stake key
@@ -184,7 +187,8 @@ describe('RewardAccounts', () => {
184187 {
185188 __typename : Cardano . CertificateType . StakeVoteRegistrationDelegation ,
186189 poolId : poolId2
187- } as Cardano . StakeVoteRegistrationDelegationCertificate ] ,
190+ } as Cardano . StakeVoteRegistrationDelegationCertificate
191+ ] ,
188192 epoch : Cardano . EpochNo ( 108 )
189193 } ,
190194 // Delegation ignored after stake key is unregistered
@@ -595,8 +599,12 @@ describe('RewardAccounts', () => {
595599 describe ( 'addressDRepDelegatees' , ( ) => {
596600 it ( 'emits a dRep delegatee for every reward account' , ( ) => {
597601 createTestScheduler ( ) . run ( ( { cold, expectObservable } ) => {
598- const rewardAccount1 = Cardano . RewardAccount ( 'stake_test1uqfu74w3wh4gfzu8m6e7j987h4lq9r3t7ef5gaw497uu85qsqfy27' ) ;
599- const rewardAccount2 = Cardano . RewardAccount ( 'stake_test1up7pvfq8zn4quy45r2g572290p9vf99mr9tn7r9xrgy2l2qdsf58d' ) ;
602+ const rewardAccount1 = Cardano . RewardAccount (
603+ 'stake_test1uqfu74w3wh4gfzu8m6e7j987h4lq9r3t7ef5gaw497uu85qsqfy27'
604+ ) ;
605+ const rewardAccount2 = Cardano . RewardAccount (
606+ 'stake_test1up7pvfq8zn4quy45r2g572290p9vf99mr9tn7r9xrgy2l2qdsf58d'
607+ ) ;
600608 const stakeKeyHash1 = Cardano . RewardAccount . toHash ( rewardAccount1 ) ;
601609 const stakeKeyHash2 = Cardano . RewardAccount . toHash ( rewardAccount2 ) ;
602610 const transactions$ = cold ( 'a-b-c' , {
@@ -666,23 +674,38 @@ describe('RewardAccounts', () => {
666674 const tracker$ = addressDRepDelegatees ( [ rewardAccount1 , rewardAccount2 ] , transactions$ ) ;
667675 expectObservable ( tracker$ ) . toBe ( 'a-b-c' , {
668676 a : [ undefined , undefined ] ,
669- b : [ { delegateRepresentative : {
677+ b : [
678+ {
679+ delegateRepresentative : {
670680 __typename : 'AlwaysAbstain'
671- } } ,
672- undefined ] ,
673- c : [ { delegateRepresentative : {
681+ }
682+ } ,
683+ undefined
684+ ] ,
685+ c : [
686+ {
687+ delegateRepresentative : {
674688 __typename : 'AlwaysAbstain'
675- } } , { delegateRepresentative : {
689+ }
690+ } ,
691+ {
692+ delegateRepresentative : {
676693 __typename : 'AlwaysAbstain'
677- } } ]
694+ }
695+ }
696+ ]
678697 } ) ;
679698 } ) ;
680699 } ) ;
681700
682701 it ( 'emits the most recent dRep delegatee' , ( ) => {
683702 createTestScheduler ( ) . run ( ( { cold, expectObservable } ) => {
684- const rewardAccount1 = Cardano . RewardAccount ( 'stake_test1uqfu74w3wh4gfzu8m6e7j987h4lq9r3t7ef5gaw497uu85qsqfy27' ) ;
685- const rewardAccount2 = Cardano . RewardAccount ( 'stake_test1up7pvfq8zn4quy45r2g572290p9vf99mr9tn7r9xrgy2l2qdsf58d' ) ;
703+ const rewardAccount1 = Cardano . RewardAccount (
704+ 'stake_test1uqfu74w3wh4gfzu8m6e7j987h4lq9r3t7ef5gaw497uu85qsqfy27'
705+ ) ;
706+ const rewardAccount2 = Cardano . RewardAccount (
707+ 'stake_test1up7pvfq8zn4quy45r2g572290p9vf99mr9tn7r9xrgy2l2qdsf58d'
708+ ) ;
686709 const stakeKeyHash1 = Cardano . RewardAccount . toHash ( rewardAccount1 ) ;
687710 const stakeKeyHash2 = Cardano . RewardAccount . toHash ( rewardAccount2 ) ;
688711
@@ -755,20 +778,30 @@ describe('RewardAccounts', () => {
755778 const tracker$ = addressDRepDelegatees ( [ rewardAccount1 ] , transactions$ ) ;
756779 expectObservable ( tracker$ ) . toBe ( 'a-b-c' , {
757780 a : [ undefined ] ,
758- b : [ { delegateRepresentative : {
781+ b : [
782+ {
783+ delegateRepresentative : {
759784 __typename : 'AlwaysNoConfidence'
760- } } ] ,
761- c : [ { delegateRepresentative : {
785+ }
786+ }
787+ ] ,
788+ c : [
789+ {
790+ delegateRepresentative : {
762791 hash : Crypto . Hash28ByteBase16 . fromEd25519KeyHashHex ( stakeKeyHash2 ) ,
763792 type : Cardano . CredentialType . KeyHash
764- } } ]
793+ }
794+ }
795+ ]
765796 } ) ;
766797 } ) ;
767798 } ) ;
768799
769800 it ( 'unsets dRep if a StakeDeregistration happens' , ( ) => {
770801 createTestScheduler ( ) . run ( ( { cold, expectObservable } ) => {
771- const rewardAccount1 = Cardano . RewardAccount ( 'stake_test1uqfu74w3wh4gfzu8m6e7j987h4lq9r3t7ef5gaw497uu85qsqfy27' ) ;
802+ const rewardAccount1 = Cardano . RewardAccount (
803+ 'stake_test1uqfu74w3wh4gfzu8m6e7j987h4lq9r3t7ef5gaw497uu85qsqfy27'
804+ ) ;
772805 const stakeKeyHash1 = Cardano . RewardAccount . toHash ( rewardAccount1 ) ;
773806
774807 const transactions$ = cold ( 'a-b-c-d-e' , {
@@ -945,7 +978,8 @@ describe('RewardAccounts', () => {
945978 __typename : Cardano . CertificateType . VoteDelegation ,
946979 dRep : {
947980 __typename : 'AlwaysNoConfidence'
948- } , stakeCredential : {
981+ } ,
982+ stakeCredential : {
949983 hash : Crypto . Hash28ByteBase16 . fromEd25519KeyHashHex ( stakeKeyHash1 ) ,
950984 type : Cardano . CredentialType . KeyHash
951985 }
@@ -959,20 +993,31 @@ describe('RewardAccounts', () => {
959993 const tracker$ = addressDRepDelegatees ( [ rewardAccount1 ] , transactions$ ) ;
960994 expectObservable ( tracker$ ) . toBe ( 'a-b-c---d' , {
961995 a : [ undefined ] ,
962- b : [ { delegateRepresentative : {
996+ b : [
997+ {
998+ delegateRepresentative : {
963999 __typename : 'AlwaysNoConfidence'
964- } } ] ,
1000+ }
1001+ }
1002+ ] ,
9651003 c : [ undefined ] , // Un-register sets dRep to undefined, re-register still doesnt defined dRep but observable doesnt re-emit undefined
966- d : [ { delegateRepresentative : { // delegate
1004+ d : [
1005+ {
1006+ delegateRepresentative : {
1007+ // delegate
9671008 __typename : 'AlwaysNoConfidence'
968- } } ]
1009+ }
1010+ }
1011+ ]
9691012 } ) ;
9701013 } ) ;
9711014 } ) ;
9721015
9731016 it ( 'unsets dRep if a Unregistration happens' , ( ) => {
9741017 createTestScheduler ( ) . run ( ( { cold, expectObservable } ) => {
975- const rewardAccount1 = Cardano . RewardAccount ( 'stake_test1uqfu74w3wh4gfzu8m6e7j987h4lq9r3t7ef5gaw497uu85qsqfy27' ) ;
1018+ const rewardAccount1 = Cardano . RewardAccount (
1019+ 'stake_test1uqfu74w3wh4gfzu8m6e7j987h4lq9r3t7ef5gaw497uu85qsqfy27'
1020+ ) ;
9761021 const stakeKeyHash1 = Cardano . RewardAccount . toHash ( rewardAccount1 ) ;
9771022
9781023 const transactions$ = cold ( 'a-b-c-d' , {
@@ -1098,21 +1143,34 @@ describe('RewardAccounts', () => {
10981143 const tracker$ = addressDRepDelegatees ( [ rewardAccount1 ] , transactions$ ) ;
10991144 expectObservable ( tracker$ ) . toBe ( 'a-b-c-d' , {
11001145 a : [ undefined ] ,
1101- b : [ { delegateRepresentative : {
1146+ b : [
1147+ {
1148+ delegateRepresentative : {
11021149 __typename : 'AlwaysNoConfidence'
1103- } } ] ,
1150+ }
1151+ }
1152+ ] ,
11041153 c : [ undefined ] , // Un-register sets dRep to undefined
1105- d : [ { delegateRepresentative : { // re-register + vote delegate
1154+ d : [
1155+ {
1156+ delegateRepresentative : {
1157+ // re-register + vote delegate
11061158 __typename : 'AlwaysNoConfidence'
1107- } } ]
1159+ }
1160+ }
1161+ ]
11081162 } ) ;
11091163 } ) ;
11101164 } ) ;
11111165
11121166 it ( 'detects all vote delegation certificates' , ( ) => {
11131167 createTestScheduler ( ) . run ( ( { cold, expectObservable } ) => {
1114- const rewardAccount1 = Cardano . RewardAccount ( 'stake_test1uqfu74w3wh4gfzu8m6e7j987h4lq9r3t7ef5gaw497uu85qsqfy27' ) ;
1115- const rewardAccount2 = Cardano . RewardAccount ( 'stake_test1up7pvfq8zn4quy45r2g572290p9vf99mr9tn7r9xrgy2l2qdsf58d' ) ;
1168+ const rewardAccount1 = Cardano . RewardAccount (
1169+ 'stake_test1uqfu74w3wh4gfzu8m6e7j987h4lq9r3t7ef5gaw497uu85qsqfy27'
1170+ ) ;
1171+ const rewardAccount2 = Cardano . RewardAccount (
1172+ 'stake_test1up7pvfq8zn4quy45r2g572290p9vf99mr9tn7r9xrgy2l2qdsf58d'
1173+ ) ;
11161174 const stakeKeyHash1 = Cardano . RewardAccount . toHash ( rewardAccount1 ) ;
11171175 const stakeKeyHash2 = Cardano . RewardAccount . toHash ( rewardAccount2 ) ;
11181176
@@ -1331,20 +1389,36 @@ describe('RewardAccounts', () => {
13311389 const tracker$ = addressDRepDelegatees ( [ rewardAccount1 ] , transactions$ ) ;
13321390 expectObservable ( tracker$ ) . toBe ( 'a-b-c-d-e' , {
13331391 a : [ undefined ] ,
1334- b : [ { delegateRepresentative : {
1392+ b : [
1393+ {
1394+ delegateRepresentative : {
13351395 __typename : 'AlwaysAbstain'
1336- } } ] ,
1337- c : [ { delegateRepresentative : {
1396+ }
1397+ }
1398+ ] ,
1399+ c : [
1400+ {
1401+ delegateRepresentative : {
13381402 __typename : 'AlwaysNoConfidence'
1339- } } ] ,
1340- d : [ { delegateRepresentative : {
1403+ }
1404+ }
1405+ ] ,
1406+ d : [
1407+ {
1408+ delegateRepresentative : {
13411409 hash : Crypto . Hash28ByteBase16 . fromEd25519KeyHashHex ( stakeKeyHash2 ) ,
13421410 type : Cardano . CredentialType . KeyHash
1343- } } ] ,
1344- e : [ { delegateRepresentative : {
1411+ }
1412+ }
1413+ ] ,
1414+ e : [
1415+ {
1416+ delegateRepresentative : {
13451417 hash : Crypto . Hash28ByteBase16 . fromEd25519KeyHashHex ( stakeKeyHash1 ) ,
13461418 type : Cardano . CredentialType . ScriptHash
1347- } } ]
1419+ }
1420+ }
1421+ ]
13481422 } ) ;
13491423 } ) ;
13501424 } ) ;
0 commit comments