@glowlabs-org/utils 0.2.51 → 0.2.52
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.js +8 -8
- package/dist/cjs/browser.js.map +1 -1
- package/dist/cjs/utils/stake-control.d.ts +10 -10
- package/dist/esm/browser.js +8 -8
- package/dist/esm/browser.js.map +1 -1
- package/dist/esm/utils/stake-control.d.ts +10 -10
- package/package.json +1 -1
- package/src/utils/stake-control.ts +18 -8
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
-
export declare const stakeControlEIP712Domain: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export declare const stakeControlEIP712Domain: (chainId: number) => {
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
chainId: number;
|
|
6
|
+
verifyingContract: "0x0000000000000000000000000000000000000000";
|
|
7
7
|
};
|
|
8
8
|
export declare const stakeEIP712Types: {
|
|
9
9
|
readonly Stake: readonly [{
|
|
@@ -181,9 +181,9 @@ export declare function buildUnstakeUnlockMessage(req: UnstakeUnlockMessageInput
|
|
|
181
181
|
export declare function buildUnstakeMoveMessage(req: UnstakeMoveMessageInput): UnstakeMoveMessage;
|
|
182
182
|
export declare function buildRestakeMessage(req: RestakeMessageInput): RestakeMessage;
|
|
183
183
|
export declare function buildCommitKickstarterMessage(req: CommitKickstarterMessageInput): CommitKickstarterMessage;
|
|
184
|
-
export declare function validateStakeSignature(input: StakeSignatureRequest, domain?: typeof stakeControlEIP712Domain): Promise<SignatureValidationResult>;
|
|
185
|
-
export declare function validateUnstakeUnlockSignature(input: UnstakeUnlockSignatureRequest, domain?: typeof stakeControlEIP712Domain): Promise<SignatureValidationResult>;
|
|
186
|
-
export declare function validateUnstakeMoveSignature(input: UnstakeMoveSignatureRequest, domain?: typeof stakeControlEIP712Domain): Promise<SignatureValidationResult>;
|
|
187
|
-
export declare function validateRestakeSignature(input: RestakeSignatureRequest, domain?: typeof stakeControlEIP712Domain): Promise<SignatureValidationResult>;
|
|
188
|
-
export declare function validateCommitKickstarterSignature(input: CommitKickstarterSignatureRequest, domain?: typeof stakeControlEIP712Domain): Promise<SignatureValidationResult>;
|
|
184
|
+
export declare function validateStakeSignature(input: StakeSignatureRequest, domain?: ReturnType<typeof stakeControlEIP712Domain>): Promise<SignatureValidationResult>;
|
|
185
|
+
export declare function validateUnstakeUnlockSignature(input: UnstakeUnlockSignatureRequest, domain?: ReturnType<typeof stakeControlEIP712Domain>): Promise<SignatureValidationResult>;
|
|
186
|
+
export declare function validateUnstakeMoveSignature(input: UnstakeMoveSignatureRequest, domain?: ReturnType<typeof stakeControlEIP712Domain>): Promise<SignatureValidationResult>;
|
|
187
|
+
export declare function validateRestakeSignature(input: RestakeSignatureRequest, domain?: ReturnType<typeof stakeControlEIP712Domain>): Promise<SignatureValidationResult>;
|
|
188
|
+
export declare function validateCommitKickstarterSignature(input: CommitKickstarterSignatureRequest, domain?: ReturnType<typeof stakeControlEIP712Domain>): Promise<SignatureValidationResult>;
|
|
189
189
|
export {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { verifyTypedData, type Hex } from "viem";
|
|
2
2
|
import z from "zod";
|
|
3
3
|
|
|
4
|
-
export const stakeControlEIP712Domain = {
|
|
4
|
+
export const stakeControlEIP712Domain = (chainId: number) => ({
|
|
5
5
|
name: "ControlManager",
|
|
6
6
|
version: "1",
|
|
7
|
-
chainId
|
|
7
|
+
chainId,
|
|
8
8
|
verifyingContract: "0x0000000000000000000000000000000000000000" as const,
|
|
9
|
-
}
|
|
9
|
+
});
|
|
10
10
|
|
|
11
11
|
// Distinct EIP-712 type sets for stake vs unstake
|
|
12
12
|
export const stakeEIP712Types = {
|
|
@@ -269,7 +269,9 @@ export function buildCommitKickstarterMessage(
|
|
|
269
269
|
// Helper to validate the signature using viem
|
|
270
270
|
export async function validateStakeSignature(
|
|
271
271
|
input: StakeSignatureRequest,
|
|
272
|
-
domain:
|
|
272
|
+
domain: ReturnType<
|
|
273
|
+
typeof stakeControlEIP712Domain
|
|
274
|
+
> = stakeControlEIP712Domain(1)
|
|
273
275
|
): Promise<SignatureValidationResult> {
|
|
274
276
|
const message = buildStakeMessage({
|
|
275
277
|
nonce: input.nonce,
|
|
@@ -299,7 +301,9 @@ export async function validateStakeSignature(
|
|
|
299
301
|
|
|
300
302
|
export async function validateUnstakeUnlockSignature(
|
|
301
303
|
input: UnstakeUnlockSignatureRequest,
|
|
302
|
-
domain:
|
|
304
|
+
domain: ReturnType<
|
|
305
|
+
typeof stakeControlEIP712Domain
|
|
306
|
+
> = stakeControlEIP712Domain(1)
|
|
303
307
|
): Promise<SignatureValidationResult> {
|
|
304
308
|
const message = buildUnstakeUnlockMessage({
|
|
305
309
|
nonce: input.nonce,
|
|
@@ -329,7 +333,9 @@ export async function validateUnstakeUnlockSignature(
|
|
|
329
333
|
|
|
330
334
|
export async function validateUnstakeMoveSignature(
|
|
331
335
|
input: UnstakeMoveSignatureRequest,
|
|
332
|
-
domain:
|
|
336
|
+
domain: ReturnType<
|
|
337
|
+
typeof stakeControlEIP712Domain
|
|
338
|
+
> = stakeControlEIP712Domain(1)
|
|
333
339
|
): Promise<SignatureValidationResult> {
|
|
334
340
|
const message = buildUnstakeMoveMessage({
|
|
335
341
|
nonce: input.nonce,
|
|
@@ -360,7 +366,9 @@ export async function validateUnstakeMoveSignature(
|
|
|
360
366
|
|
|
361
367
|
export async function validateRestakeSignature(
|
|
362
368
|
input: RestakeSignatureRequest,
|
|
363
|
-
domain:
|
|
369
|
+
domain: ReturnType<
|
|
370
|
+
typeof stakeControlEIP712Domain
|
|
371
|
+
> = stakeControlEIP712Domain(1)
|
|
364
372
|
): Promise<SignatureValidationResult> {
|
|
365
373
|
const message = buildRestakeMessage({
|
|
366
374
|
nonce: input.nonce,
|
|
@@ -391,7 +399,9 @@ export async function validateRestakeSignature(
|
|
|
391
399
|
|
|
392
400
|
export async function validateCommitKickstarterSignature(
|
|
393
401
|
input: CommitKickstarterSignatureRequest,
|
|
394
|
-
domain:
|
|
402
|
+
domain: ReturnType<
|
|
403
|
+
typeof stakeControlEIP712Domain
|
|
404
|
+
> = stakeControlEIP712Domain(1)
|
|
395
405
|
): Promise<SignatureValidationResult> {
|
|
396
406
|
const message = buildCommitKickstarterMessage({
|
|
397
407
|
nonce: input.nonce,
|