@glowlabs-org/utils 0.2.47 → 0.2.49
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.
- package/dist/cjs/browser.d.ts +1 -0
- package/dist/cjs/browser.js +12211 -4
- package/dist/cjs/browser.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +95 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/control-api/control-router.d.ts +4 -4
- package/dist/cjs/lib/control-api/kickstarter-router.d.ts +9 -0
- package/dist/cjs/lib/control-api/region-router.d.ts +1 -6
- package/dist/cjs/lib/types/index.d.ts +30 -0
- package/dist/cjs/{region-router-1QcGCT_a.js → region-router-CWDa2tGJ.js} +11 -68
- package/dist/cjs/region-router-CWDa2tGJ.js.map +1 -0
- package/dist/cjs/utils/stake-control.d.ts +156 -0
- package/dist/esm/browser.d.ts +1 -0
- package/dist/esm/browser.js +12196 -2
- package/dist/esm/browser.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +96 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/control-api/control-router.d.ts +4 -4
- package/dist/esm/lib/control-api/kickstarter-router.d.ts +9 -0
- package/dist/esm/lib/control-api/region-router.d.ts +1 -6
- package/dist/esm/lib/types/index.d.ts +30 -0
- package/dist/esm/{region-router-DDMKweoS.js → region-router-C51TpxDG.js} +11 -68
- package/dist/esm/region-router-C51TpxDG.js.map +1 -0
- package/dist/esm/utils/stake-control.d.ts +156 -0
- package/package.json +6 -3
- package/src/browser.ts +1 -0
- package/src/index.ts +1 -0
- package/src/lib/control-api/control-router.ts +9 -14
- package/src/lib/control-api/kickstarter-router.ts +119 -0
- package/src/lib/control-api/region-router.ts +4 -75
- package/src/lib/types/index.ts +44 -6
- package/src/utils/stake-control.ts +343 -0
- package/dist/cjs/region-router-1QcGCT_a.js.map +0 -1
- package/dist/esm/region-router-DDMKweoS.js.map +0 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
export declare const stakeControlEIP712Domain: {
|
|
3
|
+
readonly name: "ControlManager";
|
|
4
|
+
readonly version: "1";
|
|
5
|
+
readonly chainId: number;
|
|
6
|
+
readonly verifyingContract: "0x0000000000000000000000000000000000000000";
|
|
7
|
+
};
|
|
8
|
+
export declare const stakeEIP712Types: {
|
|
9
|
+
readonly Stake: readonly [{
|
|
10
|
+
readonly name: "nonce";
|
|
11
|
+
readonly type: "uint256";
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "amount";
|
|
14
|
+
readonly type: "uint256";
|
|
15
|
+
}, {
|
|
16
|
+
readonly name: "toZoneId";
|
|
17
|
+
readonly type: "uint256";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "deadline";
|
|
20
|
+
readonly type: "uint256";
|
|
21
|
+
}];
|
|
22
|
+
};
|
|
23
|
+
export declare const unstakeUnlockEIP712Types: {
|
|
24
|
+
readonly Unstake: readonly [{
|
|
25
|
+
readonly name: "nonce";
|
|
26
|
+
readonly type: "uint256";
|
|
27
|
+
}, {
|
|
28
|
+
readonly name: "amount";
|
|
29
|
+
readonly type: "uint256";
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "fromZoneId";
|
|
32
|
+
readonly type: "uint256";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "deadline";
|
|
35
|
+
readonly type: "uint256";
|
|
36
|
+
}];
|
|
37
|
+
};
|
|
38
|
+
export declare const unstakeMoveEIP712Types: {
|
|
39
|
+
readonly UnstakeMove: readonly [{
|
|
40
|
+
readonly name: "nonce";
|
|
41
|
+
readonly type: "uint256";
|
|
42
|
+
}, {
|
|
43
|
+
readonly name: "amount";
|
|
44
|
+
readonly type: "uint256";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "fromZoneId";
|
|
47
|
+
readonly type: "uint256";
|
|
48
|
+
}, {
|
|
49
|
+
readonly name: "toZoneId";
|
|
50
|
+
readonly type: "uint256";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "deadline";
|
|
53
|
+
readonly type: "uint256";
|
|
54
|
+
}];
|
|
55
|
+
};
|
|
56
|
+
export declare const restakeEIP712Types: {
|
|
57
|
+
readonly Restake: readonly [{
|
|
58
|
+
readonly name: "nonce";
|
|
59
|
+
readonly type: "uint256";
|
|
60
|
+
}, {
|
|
61
|
+
readonly name: "amount";
|
|
62
|
+
readonly type: "uint256";
|
|
63
|
+
}, {
|
|
64
|
+
readonly name: "fromZoneId";
|
|
65
|
+
readonly type: "uint256";
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "toZoneId";
|
|
68
|
+
readonly type: "uint256";
|
|
69
|
+
}, {
|
|
70
|
+
readonly name: "deadline";
|
|
71
|
+
readonly type: "uint256";
|
|
72
|
+
}];
|
|
73
|
+
};
|
|
74
|
+
export declare const stakeSignatureRequestSchema: z.ZodObject<{
|
|
75
|
+
wallet: z.ZodString;
|
|
76
|
+
signature: z.ZodString;
|
|
77
|
+
nonce: z.ZodString;
|
|
78
|
+
amount: z.ZodString;
|
|
79
|
+
toZoneId: z.ZodString;
|
|
80
|
+
deadline: z.ZodString;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
export declare const unstakeUnlockSignatureRequestSchema: z.ZodObject<{
|
|
83
|
+
wallet: z.ZodString;
|
|
84
|
+
signature: z.ZodString;
|
|
85
|
+
nonce: z.ZodString;
|
|
86
|
+
amount: z.ZodString;
|
|
87
|
+
fromZoneId: z.ZodString;
|
|
88
|
+
deadline: z.ZodString;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
export declare const unstakeMoveSignatureRequestSchema: z.ZodObject<{
|
|
91
|
+
wallet: z.ZodString;
|
|
92
|
+
signature: z.ZodString;
|
|
93
|
+
nonce: z.ZodString;
|
|
94
|
+
amount: z.ZodString;
|
|
95
|
+
fromZoneId: z.ZodString;
|
|
96
|
+
toZoneId: z.ZodString;
|
|
97
|
+
deadline: z.ZodString;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
export declare const restakeSignatureRequestSchema: z.ZodObject<{
|
|
100
|
+
wallet: z.ZodString;
|
|
101
|
+
signature: z.ZodString;
|
|
102
|
+
nonce: z.ZodString;
|
|
103
|
+
amount: z.ZodString;
|
|
104
|
+
fromZoneId: z.ZodString;
|
|
105
|
+
toZoneId: z.ZodString;
|
|
106
|
+
deadline: z.ZodString;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
export type StakeSignatureRequest = z.infer<typeof stakeSignatureRequestSchema>;
|
|
109
|
+
export type UnstakeUnlockSignatureRequest = z.infer<typeof unstakeUnlockSignatureRequestSchema>;
|
|
110
|
+
export type UnstakeMoveSignatureRequest = z.infer<typeof unstakeMoveSignatureRequestSchema>;
|
|
111
|
+
export type RestakeSignatureRequest = z.infer<typeof restakeSignatureRequestSchema>;
|
|
112
|
+
export type StakeMessage = {
|
|
113
|
+
nonce: bigint;
|
|
114
|
+
amount: bigint;
|
|
115
|
+
toZoneId: bigint;
|
|
116
|
+
deadline: bigint;
|
|
117
|
+
};
|
|
118
|
+
export type UnstakeUnlockMessage = {
|
|
119
|
+
nonce: bigint;
|
|
120
|
+
amount: bigint;
|
|
121
|
+
fromZoneId: bigint;
|
|
122
|
+
deadline: bigint;
|
|
123
|
+
};
|
|
124
|
+
export type UnstakeMoveMessage = {
|
|
125
|
+
nonce: bigint;
|
|
126
|
+
amount: bigint;
|
|
127
|
+
fromZoneId: bigint;
|
|
128
|
+
toZoneId: bigint;
|
|
129
|
+
deadline: bigint;
|
|
130
|
+
};
|
|
131
|
+
export type RestakeMessage = {
|
|
132
|
+
nonce: bigint;
|
|
133
|
+
amount: bigint;
|
|
134
|
+
fromZoneId: bigint;
|
|
135
|
+
toZoneId: bigint;
|
|
136
|
+
deadline: bigint;
|
|
137
|
+
};
|
|
138
|
+
export type SignatureValidationReason = "deadline_expired" | "signature_failed" | "signer_mismatch" | null;
|
|
139
|
+
export type SignatureValidationResult = {
|
|
140
|
+
valid: boolean;
|
|
141
|
+
recovered: string | null;
|
|
142
|
+
reason: SignatureValidationReason;
|
|
143
|
+
};
|
|
144
|
+
type StakeMessageInput = Pick<StakeSignatureRequest, "nonce" | "amount" | "toZoneId" | "deadline">;
|
|
145
|
+
type UnstakeUnlockMessageInput = Pick<UnstakeUnlockSignatureRequest, "nonce" | "amount" | "fromZoneId" | "deadline">;
|
|
146
|
+
type UnstakeMoveMessageInput = Pick<UnstakeMoveSignatureRequest, "nonce" | "amount" | "fromZoneId" | "toZoneId" | "deadline">;
|
|
147
|
+
type RestakeMessageInput = Pick<RestakeSignatureRequest, "nonce" | "amount" | "fromZoneId" | "toZoneId" | "deadline">;
|
|
148
|
+
export declare function buildStakeMessage(req: StakeMessageInput): StakeMessage;
|
|
149
|
+
export declare function buildUnstakeUnlockMessage(req: UnstakeUnlockMessageInput): UnstakeUnlockMessage;
|
|
150
|
+
export declare function buildUnstakeMoveMessage(req: UnstakeMoveMessageInput): UnstakeMoveMessage;
|
|
151
|
+
export declare function buildRestakeMessage(req: RestakeMessageInput): RestakeMessage;
|
|
152
|
+
export declare function validateStakeSignature(input: StakeSignatureRequest, domain?: typeof stakeControlEIP712Domain): Promise<SignatureValidationResult>;
|
|
153
|
+
export declare function validateUnstakeUnlockSignature(input: UnstakeUnlockSignatureRequest, domain?: typeof stakeControlEIP712Domain): Promise<SignatureValidationResult>;
|
|
154
|
+
export declare function validateUnstakeMoveSignature(input: UnstakeMoveSignatureRequest, domain?: typeof stakeControlEIP712Domain): Promise<SignatureValidationResult>;
|
|
155
|
+
export declare function validateRestakeSignature(input: RestakeSignatureRequest, domain?: typeof stakeControlEIP712Domain): Promise<SignatureValidationResult>;
|
|
156
|
+
export {};
|
package/dist/esm/browser.d.ts
CHANGED