@xyo-network/xl1-protocol 1.12.86 → 1.12.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,37 +1,48 @@
1
1
  import type { Address } from '@xylabs/hex';
2
2
  import type { Promisable } from '@xylabs/promise';
3
3
  import type { BlockRange, RewardShare, StepIdentity, StepIdentityString } from '../../model/index.ts';
4
- export interface RewardsViewer<TIndex> {
5
- claimed(index: TIndex, range?: BlockRange): Promisable<bigint>;
6
- reward(index: TIndex, step: StepIdentity): Promisable<RewardShare>;
7
- rewards(index: TIndex, range?: BlockRange): Promisable<Record<StepIdentityString, RewardShare>>;
8
- unclaimed(index: TIndex, range?: BlockRange): Promisable<bigint>;
4
+ import type { AttoXL1 } from '../../xl1/index.ts';
5
+ export type RecordKeyType<T = keyof any> = T extends keyof any ? T : never;
6
+ export interface RewardsViewerTemplate<TOptions, TResult> {
7
+ bonus(options?: TOptions): Promisable<TResult>;
8
+ claimed(options?: TOptions): Promisable<TResult>;
9
+ earned(options?: TOptions): Promisable<TResult>;
10
+ total(options?: TOptions): Promisable<TResult>;
11
+ unclaimed(options?: TOptions): Promisable<TResult>;
9
12
  }
10
- export interface RewardsStakerViewer extends RewardsViewer<Address> {
13
+ export interface RewardsByIndexViewer<TOptions, TResultIndex extends RecordKeyType> extends RewardsViewerTemplate<TOptions, Record<TResultIndex, AttoXL1>> {
11
14
  }
12
- export interface RewardsStepViewer {
15
+ export interface RewardsRangeOptions {
16
+ range?: BlockRange;
17
+ }
18
+ export interface RewardsByStepViewerOptions extends RewardsRangeOptions {
19
+ steps?: StepIdentity[];
20
+ }
21
+ export interface RewardsByStakerViewerOptions extends RewardsRangeOptions {
22
+ stakers?: Address[];
23
+ }
24
+ export interface RewardsByPositionViewerOptions extends RewardsRangeOptions {
25
+ positions?: number[];
26
+ }
27
+ export interface RewardsByStepViewer extends RewardsByIndexViewer<RewardsByStepViewerOptions, StepIdentityString> {
28
+ }
29
+ export interface RewardsByStakerViewer extends RewardsByIndexViewer<RewardsByStakerViewerOptions, Address> {
30
+ }
31
+ export interface RewardsByPositionViewer extends RewardsByIndexViewer<RewardsByPositionViewerOptions, number> {
32
+ }
33
+ export interface RewardsTotalViewer extends RewardsViewerTemplate<RewardsRangeOptions, AttoXL1> {
34
+ }
35
+ export interface StepViewer {
13
36
  randomizer(step: StepIdentity): Promisable<bigint>;
14
37
  rewards(step: StepIdentity): Promisable<Record<Address, RewardShare>>;
15
38
  stake(step: StepIdentity): Promisable<bigint>;
16
39
  stakers(step: StepIdentity): Promisable<Address[]>;
17
40
  weight(step: StepIdentity): Promisable<bigint>;
18
41
  }
19
- export interface RewardsPositionViewer {
20
- claimed(position: number, range?: BlockRange): Promisable<bigint>;
21
- reward(position: number, step: StepIdentity): Promisable<RewardShare>;
22
- rewards(staker: Address, range?: BlockRange): Promisable<Record<StepIdentityString, RewardShare>>;
23
- unclaimed(position: number, range?: BlockRange): Promisable<bigint>;
24
- }
25
- export interface RewardsTotalViewer {
26
- available(range?: BlockRange): Promisable<bigint>;
27
- claimed(range?: BlockRange): Promisable<bigint>;
28
- earned(range?: BlockRange): Promisable<bigint>;
29
- unclaimed(range?: BlockRange): Promisable<bigint>;
30
- }
31
42
  export interface StepRewardsViewer {
32
- position(): Promisable<RewardsPositionViewer>;
33
- staker(): Promisable<RewardsViewer<Address>>;
34
- step(): Promisable<RewardsViewer<StepIdentity>>;
43
+ position(): Promisable<RewardsByPositionViewer>;
44
+ staker(): Promisable<RewardsByStakerViewer>;
45
+ step(): Promisable<RewardsByStepViewer>;
35
46
  total(): Promisable<RewardsTotalViewer>;
36
47
  }
37
48
  export interface NetworkStakeViewer {
@@ -1 +1 @@
1
- {"version":3,"file":"NetworkStakeViewer.d.ts","sourceRoot":"","sources":["../../../../src/interfaces/viewers/NetworkStakeViewer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EA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 "version": "1.12.87",
5
5
  "description": "XYO Layer One Protocol",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -4,17 +4,43 @@ import type { Promisable } from '@xylabs/promise'
4
4
  import type {
5
5
  BlockRange, RewardShare, StepIdentity, StepIdentityString,
6
6
  } from '../../model/index.ts'
7
+ import type { AttoXL1 } from '../../xl1/index.ts'
7
8
 
8
- export interface RewardsViewer<TIndex> {
9
- claimed(index: TIndex, range?: BlockRange): Promisable<bigint>
10
- reward(index: TIndex, step: StepIdentity): Promisable<RewardShare>
11
- rewards(index: TIndex, range?: BlockRange): Promisable<Record<StepIdentityString, RewardShare>>
12
- unclaimed(index: TIndex, range?: BlockRange): Promisable<bigint>
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ export type RecordKeyType<T = keyof any> = T extends keyof any ? T : never
11
+
12
+ export interface RewardsViewerTemplate<TOptions, TResult> {
13
+ bonus(options?: TOptions): Promisable<TResult>
14
+ claimed(options?: TOptions): Promisable<TResult>
15
+ earned(options?: TOptions): Promisable<TResult>
16
+ total(options?: TOptions): Promisable<TResult>
17
+ unclaimed(options?: TOptions): Promisable<TResult>
18
+ }
19
+
20
+ export interface RewardsByIndexViewer<TOptions, TResultIndex extends RecordKeyType> extends RewardsViewerTemplate<TOptions, Record<TResultIndex, AttoXL1>> {}
21
+
22
+ export interface RewardsRangeOptions {
23
+ range?: BlockRange
24
+ }
25
+
26
+ export interface RewardsByStepViewerOptions extends RewardsRangeOptions {
27
+ steps?: StepIdentity[]
28
+ }
29
+
30
+ export interface RewardsByStakerViewerOptions extends RewardsRangeOptions {
31
+ stakers?: Address[]
32
+ }
33
+
34
+ export interface RewardsByPositionViewerOptions extends RewardsRangeOptions {
35
+ positions?: number[]
13
36
  }
14
37
 
15
- export interface RewardsStakerViewer extends RewardsViewer<Address> {}
38
+ export interface RewardsByStepViewer extends RewardsByIndexViewer<RewardsByStepViewerOptions, StepIdentityString> {}
39
+ export interface RewardsByStakerViewer extends RewardsByIndexViewer<RewardsByStakerViewerOptions, Address> {}
40
+ export interface RewardsByPositionViewer extends RewardsByIndexViewer<RewardsByPositionViewerOptions, number> {}
41
+ export interface RewardsTotalViewer extends RewardsViewerTemplate<RewardsRangeOptions, AttoXL1> {}
16
42
 
17
- export interface RewardsStepViewer {
43
+ export interface StepViewer {
18
44
 
19
45
  // the predictable random number for a given step and block
20
46
  randomizer(step: StepIdentity): Promisable<bigint>
@@ -32,33 +58,10 @@ export interface RewardsStepViewer {
32
58
  weight(step: StepIdentity): Promisable<bigint>
33
59
  }
34
60
 
35
- export interface RewardsPositionViewer {
36
-
37
- // total amount claimed by a given position for a given range
38
- claimed(position: number, range?: BlockRange): Promisable<bigint>
39
-
40
- // estimate the current reward for a given position at a given step
41
- reward(position: number, step: StepIdentity): Promisable<RewardShare>
42
-
43
- // the step rewards for a specific network stakers for all of history
44
- rewards(staker: Address, range?: BlockRange): Promisable<Record<StepIdentityString, RewardShare>>
45
-
46
- // total amount unclaimed by a given position for a given range
47
- unclaimed(position: number, range?: BlockRange): Promisable<bigint>
48
- }
49
-
50
- export interface RewardsTotalViewer {
51
- // the available tokens in the overall reward pool
52
- available(range?: BlockRange): Promisable<bigint>
53
- claimed(range?: BlockRange): Promisable<bigint>
54
- earned(range?: BlockRange): Promisable<bigint>
55
- unclaimed(range?: BlockRange): Promisable<bigint>
56
- }
57
-
58
61
  export interface StepRewardsViewer {
59
- position(): Promisable<RewardsPositionViewer>
60
- staker(): Promisable<RewardsViewer<Address>>
61
- step(): Promisable<RewardsViewer<StepIdentity>>
62
+ position(): Promisable<RewardsByPositionViewer>
63
+ staker(): Promisable<RewardsByStakerViewer>
64
+ step(): Promisable<RewardsByStepViewer>
62
65
  total(): Promisable<RewardsTotalViewer>
63
66
  }
64
67