11import {
22 createNativeTokenStreamingTerms ,
33 createTimestampTerms ,
4+ Delegation ,
45 encodeDelegations ,
56 ROOT_AUTHORITY ,
67} from '@metamask/delegation-core' ;
@@ -45,7 +46,7 @@ describe('permissionOnChainStatus', () => {
4546 timestampAfterThreshold : 0 ,
4647 timestampBeforeThreshold : expirySeconds ,
4748 } ) ;
48- const delegation = {
49+ const delegation : Delegation < Hex > = {
4950 delegate : '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' ,
5051 delegator : '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778' ,
5152 authority : ROOT_AUTHORITY ,
@@ -74,7 +75,7 @@ describe('permissionOnChainStatus', () => {
7475 } ) ;
7576
7677 it ( 'returns null when no timestamp caveat matches' , ( ) => {
77- const delegation = {
78+ const delegation : Delegation < Hex > = {
7879 delegate : '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' ,
7980 delegator : '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778' ,
8081 authority : ROOT_AUTHORITY ,
@@ -98,7 +99,7 @@ describe('permissionOnChainStatus', () => {
9899
99100 it ( 'returns null when TimestampEnforcer terms fail to decode' , ( ) => {
100101 const invalidTerms : Hex = `0x${ '01' . repeat ( 32 ) } ` ;
101- const delegation = {
102+ const delegation : Delegation < Hex > = {
102103 delegate : '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' ,
103104 delegator : '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778' ,
104105 authority : ROOT_AUTHORITY ,
@@ -230,7 +231,7 @@ describe('permissionOnChainStatus', () => {
230231
231232 it ( 'defaults missing entry status to Active when preserving after a resolution error' , async ( ) => {
232233 const getProviderForChainId = jest . fn ( ) ;
233- const entry = {
234+ const entry : PermissionInfoWithMetadata = {
234235 permissionResponse : {
235236 chainId : numberToHex ( CHAIN_ID . sepolia ) ,
236237 from : '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778' ,
@@ -249,7 +250,8 @@ describe('permissionOnChainStatus', () => {
249250 delegationManager : contracts . DelegationManager ,
250251 } ,
251252 siteOrigin : 'https://example.org' ,
252- } as PermissionInfoWithMetadata ;
253+ status : 'Active'
254+ } ;
253255
254256 const result = await resolveGrantedPermissionOnChainStatus ( entry , {
255257 getProviderForChainId,
@@ -261,7 +263,7 @@ describe('permissionOnChainStatus', () => {
261263 } ) ;
262264
263265 it ( 'sets Active when a single delegation is not disabled and has no timestamp expiry caveat' , async ( ) => {
264- const delegation = {
266+ const delegation : Delegation < Hex > = {
265267 delegate : '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' ,
266268 delegator : '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778' ,
267269 authority : ROOT_AUTHORITY ,
@@ -330,7 +332,7 @@ describe('permissionOnChainStatus', () => {
330332 timestampAfterThreshold : 0 ,
331333 timestampBeforeThreshold : expirySeconds ,
332334 } ) ;
333- const delegation = {
335+ const delegation : Delegation < Hex > = {
334336 delegate : '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' ,
335337 delegator : '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778' ,
336338 authority : ROOT_AUTHORITY ,
@@ -398,7 +400,7 @@ describe('permissionOnChainStatus', () => {
398400 } ) ;
399401
400402 it ( 'sets Revoked when disabledDelegations returns true' , async ( ) => {
401- const delegation = {
403+ const delegation : Delegation < Hex > = {
402404 delegate : '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' ,
403405 delegator : '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778' ,
404406 authority : ROOT_AUTHORITY ,
@@ -458,7 +460,7 @@ describe('permissionOnChainStatus', () => {
458460 } ) ;
459461
460462 it ( 'preserves prior status when deployment contracts are missing for the chain' , async ( ) => {
461- const delegation = {
463+ const delegation : Delegation < Hex > = {
462464 delegate : '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' ,
463465 delegator : '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778' ,
464466 authority : ROOT_AUTHORITY ,
@@ -524,7 +526,7 @@ describe('permissionOnChainStatus', () => {
524526 timestampAfterThreshold : 0 ,
525527 timestampBeforeThreshold : expirySeconds ,
526528 } ) ;
527- const delegation = {
529+ const delegation : Delegation < Hex > = {
528530 delegate : '0x4f71DA06987BfeDE90aF0b33E1e3e4ffDCEE7a63' ,
529531 delegator : '0xB68c70159E9892DdF5659ec42ff9BD2bbC23e778' ,
530532 authority : ROOT_AUTHORITY ,
0 commit comments