@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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
13
|
+
export interface RewardsByIndexViewer<TOptions, TResultIndex extends RecordKeyType> extends RewardsViewerTemplate<TOptions, Record<TResultIndex, AttoXL1>> {
|
|
11
14
|
}
|
|
12
|
-
export interface
|
|
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<
|
|
33
|
-
staker(): Promisable<
|
|
34
|
-
step(): Promisable<
|
|
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,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EACV,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,kBAAkB,EAC1D,MAAM,sBAAsB,CAAA;
|
|
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,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EACV,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,kBAAkB,EAC1D,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAGjD,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,SAAS,MAAM,GAAG,GAAG,CAAC,GAAG,KAAK,CAAA;AAE1E,MAAM,WAAW,qBAAqB,CAAC,QAAQ,EAAE,OAAO;IACtD,KAAK,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IAC9C,OAAO,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IAChD,MAAM,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IAC/C,KAAK,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC,OA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,UAAU,CAAC,OAAO,EAAE,CAAC,CAAA;IAGlD,MAAM,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;CAC/C;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,IAAI,UAAU,CAAC,uBAAuB,CAAC,CAAA;IAC/C,MAAM,IAAI,UAAU,CAAC,qBAAqB,CAAC,CAAA;IAC3C,IAAI,IAAI,UAAU,CAAC,mBAAmB,CAAC,CAAA;IACvC,KAAK,IAAI,UAAU,CAAC,kBAAkB,CAAC,CAAA;CACxC;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,IAAI,UAAU,CAAC,iBAAiB,CAAC,CAAA;CAC7C"}
|
package/package.json
CHANGED
|
@@ -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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
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
|
|
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<
|
|
60
|
-
staker(): Promisable<
|
|
61
|
-
step(): Promisable<
|
|
62
|
+
position(): Promisable<RewardsByPositionViewer>
|
|
63
|
+
staker(): Promisable<RewardsByStakerViewer>
|
|
64
|
+
step(): Promisable<RewardsByStepViewer>
|
|
62
65
|
total(): Promisable<RewardsTotalViewer>
|
|
63
66
|
}
|
|
64
67
|
|