@glowlabs-org/utils 0.2.91 → 0.2.93
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 +675 -636
- package/dist/cjs/browser.js.map +1 -1
- package/dist/cjs/{farms-router-ClIWm9AQ.js → farms-router-C2sviclU.js} +71 -22
- package/dist/cjs/farms-router-C2sviclU.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/lib/control-api/control-router.d.ts +16 -0
- package/dist/cjs/lib/types/index.d.ts +14 -2
- package/dist/cjs/utils/stake-control.d.ts +33 -0
- package/dist/esm/browser.js +669 -633
- package/dist/esm/browser.js.map +1 -1
- package/dist/esm/{farms-router-DVSHNqsT.js → farms-router-oHFOyL2k.js} +69 -23
- package/dist/esm/farms-router-oHFOyL2k.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/lib/control-api/control-router.d.ts +16 -0
- package/dist/esm/lib/types/index.d.ts +14 -2
- package/dist/esm/utils/stake-control.d.ts +33 -0
- package/package.json +1 -1
- package/src/lib/control-api/control-router.ts +43 -0
- package/src/lib/hooks/use-forwarder.ts +23 -22
- package/src/lib/types/index.ts +16 -12
- package/src/utils/stake-control.ts +82 -1
- package/dist/cjs/farms-router-ClIWm9AQ.js.map +0 -1
- package/dist/esm/farms-router-DVSHNqsT.js.map +0 -1
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import type { StakeRequest, RegionStake, WalletRegionStake, WalletRegionUnlocked, TransferDetails, GlwRegionRewardsResponse, MintedEventsResponse, StakeEventsResponse, FailedOperationsResponse, PendingTransfersResponse, PendingTransferType, RestakeRequest } from "../types";
|
|
2
|
+
export interface PayProtocolDepositUsingStakedControlRequest {
|
|
3
|
+
wallet: string;
|
|
4
|
+
regionId: number;
|
|
5
|
+
applicationId: string;
|
|
6
|
+
amount: string;
|
|
7
|
+
signature: string;
|
|
8
|
+
deadline: string;
|
|
9
|
+
nonce: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PayProtocolDepositUsingStakedControlResponse {
|
|
12
|
+
success: true;
|
|
13
|
+
farmId: string;
|
|
14
|
+
applicationId: string;
|
|
15
|
+
}
|
|
2
16
|
export declare function ControlRouter(baseUrl: string): {
|
|
3
17
|
readonly fetchGctlBalance: (wallet: string) => Promise<string>;
|
|
4
18
|
readonly fetchGctlPrice: () => Promise<string>;
|
|
@@ -18,8 +32,10 @@ export declare function ControlRouter(baseUrl: string): {
|
|
|
18
32
|
readonly unstakeGctl: (unstakeRequest: StakeRequest) => Promise<boolean>;
|
|
19
33
|
readonly restakeGctl: (restakeRequest: RestakeRequest) => Promise<boolean>;
|
|
20
34
|
readonly retryFailedOperation: (operationId: string) => Promise<boolean>;
|
|
35
|
+
readonly payProtocolDepositUsingStakedControl: (paymentRequest: PayProtocolDepositUsingStakedControlRequest) => Promise<PayProtocolDepositUsingStakedControlResponse>;
|
|
21
36
|
readonly isStaking: boolean;
|
|
22
37
|
readonly isUnstaking: boolean;
|
|
23
38
|
readonly isRestaking: boolean;
|
|
24
39
|
readonly isRetryingFailedOperation: boolean;
|
|
40
|
+
readonly isPayingProtocolDepositUsingStakedControl: boolean;
|
|
25
41
|
};
|
|
@@ -34,8 +34,19 @@ export interface PendingTransfer {
|
|
|
34
34
|
regionId?: number;
|
|
35
35
|
kickstarterId?: string;
|
|
36
36
|
}
|
|
37
|
-
export declare const TRANSFER_TYPES:
|
|
38
|
-
|
|
37
|
+
export declare const TRANSFER_TYPES: {
|
|
38
|
+
readonly PayProtocolFeeAndMintGCTLAndStake: "PayProtocolFeeAndMintGCTLAndStake";
|
|
39
|
+
readonly PayProtocolFee: "PayProtocolFee";
|
|
40
|
+
readonly PayAuditFees: "PayAuditFees";
|
|
41
|
+
readonly CommitKickstarter: "CommitKickstarter";
|
|
42
|
+
readonly MintGCTLAndStake: "MintGCTLAndStake";
|
|
43
|
+
readonly MintGCTL: "MintGCTL";
|
|
44
|
+
readonly BuySolarFarm: "BuySolarFarm";
|
|
45
|
+
readonly SponsorProtocolFee: "SponsorProtocolFee";
|
|
46
|
+
readonly SponsorProtocolFeeAndMintGCTLAndStake: "SponsorProtocolFeeAndMintGCTLAndStake";
|
|
47
|
+
readonly PayProtocolDepositUsingStakedControl: "PayProtocolDepositUsingStakedControl";
|
|
48
|
+
};
|
|
49
|
+
export type PendingTransferType = (typeof TRANSFER_TYPES)[keyof typeof TRANSFER_TYPES];
|
|
39
50
|
export interface TransferDetails extends PendingTransfer {
|
|
40
51
|
blockNumber: string;
|
|
41
52
|
failureInfo?: {
|
|
@@ -190,6 +201,7 @@ export interface KickstarterDetails extends Kickstarter {
|
|
|
190
201
|
contributorsCount: number;
|
|
191
202
|
farmCount: number;
|
|
192
203
|
solarFarmApplications: SolarFarmApplication[];
|
|
204
|
+
sponsoredFarms: SponsoredFarm[];
|
|
193
205
|
}
|
|
194
206
|
export interface CommitKickstarterPayload {
|
|
195
207
|
wallet: string;
|
|
@@ -86,6 +86,21 @@ export declare const commitKickstarterEIP712Types: {
|
|
|
86
86
|
readonly type: "uint256";
|
|
87
87
|
}];
|
|
88
88
|
};
|
|
89
|
+
export declare const payProtocolDepositUsingStakedControlEIP712Types: {
|
|
90
|
+
readonly PayProtocolDepositUsingStakedControl: readonly [{
|
|
91
|
+
readonly name: "amount";
|
|
92
|
+
readonly type: "uint256";
|
|
93
|
+
}, {
|
|
94
|
+
readonly name: "applicationId";
|
|
95
|
+
readonly type: "string";
|
|
96
|
+
}, {
|
|
97
|
+
readonly name: "nonce";
|
|
98
|
+
readonly type: "uint256";
|
|
99
|
+
}, {
|
|
100
|
+
readonly name: "deadline";
|
|
101
|
+
readonly type: "uint256";
|
|
102
|
+
}];
|
|
103
|
+
};
|
|
89
104
|
export declare const stakeSignatureRequestSchema: z.ZodObject<{
|
|
90
105
|
wallet: z.ZodString;
|
|
91
106
|
signature: z.ZodString;
|
|
@@ -128,11 +143,20 @@ export declare const commitKickstarterSignatureRequestSchema: z.ZodObject<{
|
|
|
128
143
|
kickstarterId: z.ZodString;
|
|
129
144
|
deadline: z.ZodString;
|
|
130
145
|
}, z.core.$strip>;
|
|
146
|
+
export declare const payProtocolDepositUsingStakedControlSignatureRequestSchema: z.ZodObject<{
|
|
147
|
+
wallet: z.ZodString;
|
|
148
|
+
signature: z.ZodString;
|
|
149
|
+
nonce: z.ZodString;
|
|
150
|
+
amount: z.ZodString;
|
|
151
|
+
applicationId: z.ZodString;
|
|
152
|
+
deadline: z.ZodString;
|
|
153
|
+
}, z.core.$strip>;
|
|
131
154
|
export type StakeSignatureRequest = z.infer<typeof stakeSignatureRequestSchema>;
|
|
132
155
|
export type UnstakeUnlockSignatureRequest = z.infer<typeof unstakeUnlockSignatureRequestSchema>;
|
|
133
156
|
export type UnstakeMoveSignatureRequest = z.infer<typeof unstakeMoveSignatureRequestSchema>;
|
|
134
157
|
export type RestakeSignatureRequest = z.infer<typeof restakeSignatureRequestSchema>;
|
|
135
158
|
export type CommitKickstarterSignatureRequest = z.infer<typeof commitKickstarterSignatureRequestSchema>;
|
|
159
|
+
export type PayProtocolDepositUsingStakedControlSignatureRequest = z.infer<typeof payProtocolDepositUsingStakedControlSignatureRequestSchema>;
|
|
136
160
|
export type StakeMessage = {
|
|
137
161
|
nonce: bigint;
|
|
138
162
|
amount: bigint;
|
|
@@ -165,6 +189,12 @@ export type CommitKickstarterMessage = {
|
|
|
165
189
|
kickstarterId: string;
|
|
166
190
|
deadline: bigint;
|
|
167
191
|
};
|
|
192
|
+
export type PayProtocolDepositUsingStakedControlMessage = {
|
|
193
|
+
amount: bigint;
|
|
194
|
+
applicationId: string;
|
|
195
|
+
nonce: bigint;
|
|
196
|
+
deadline: bigint;
|
|
197
|
+
};
|
|
168
198
|
export type SignatureValidationReason = "deadline_expired" | "signature_failed" | "signer_mismatch" | null;
|
|
169
199
|
export type SignatureValidationResult = {
|
|
170
200
|
valid: boolean;
|
|
@@ -176,14 +206,17 @@ type UnstakeUnlockMessageInput = Pick<UnstakeUnlockSignatureRequest, "nonce" | "
|
|
|
176
206
|
type UnstakeMoveMessageInput = Pick<UnstakeMoveSignatureRequest, "nonce" | "amount" | "fromZoneId" | "toZoneId" | "deadline">;
|
|
177
207
|
type RestakeMessageInput = Pick<RestakeSignatureRequest, "nonce" | "amount" | "fromZoneId" | "toZoneId" | "deadline">;
|
|
178
208
|
type CommitKickstarterMessageInput = Pick<CommitKickstarterSignatureRequest, "nonce" | "amount" | "kickstarterId" | "deadline">;
|
|
209
|
+
type PayProtocolDepositUsingStakedControlMessageInput = Pick<PayProtocolDepositUsingStakedControlSignatureRequest, "amount" | "applicationId" | "nonce" | "deadline">;
|
|
179
210
|
export declare function buildStakeMessage(req: StakeMessageInput): StakeMessage;
|
|
180
211
|
export declare function buildUnstakeUnlockMessage(req: UnstakeUnlockMessageInput): UnstakeUnlockMessage;
|
|
181
212
|
export declare function buildUnstakeMoveMessage(req: UnstakeMoveMessageInput): UnstakeMoveMessage;
|
|
182
213
|
export declare function buildRestakeMessage(req: RestakeMessageInput): RestakeMessage;
|
|
183
214
|
export declare function buildCommitKickstarterMessage(req: CommitKickstarterMessageInput): CommitKickstarterMessage;
|
|
215
|
+
export declare function buildPayProtocolDepositUsingStakedControlMessage(req: PayProtocolDepositUsingStakedControlMessageInput): PayProtocolDepositUsingStakedControlMessage;
|
|
184
216
|
export declare function validateStakeSignature(input: StakeSignatureRequest, domain?: ReturnType<typeof stakeControlEIP712Domain>): Promise<SignatureValidationResult>;
|
|
185
217
|
export declare function validateUnstakeUnlockSignature(input: UnstakeUnlockSignatureRequest, domain?: ReturnType<typeof stakeControlEIP712Domain>): Promise<SignatureValidationResult>;
|
|
186
218
|
export declare function validateUnstakeMoveSignature(input: UnstakeMoveSignatureRequest, domain?: ReturnType<typeof stakeControlEIP712Domain>): Promise<SignatureValidationResult>;
|
|
187
219
|
export declare function validateRestakeSignature(input: RestakeSignatureRequest, domain?: ReturnType<typeof stakeControlEIP712Domain>): Promise<SignatureValidationResult>;
|
|
188
220
|
export declare function validateCommitKickstarterSignature(input: CommitKickstarterSignatureRequest, domain?: ReturnType<typeof stakeControlEIP712Domain>): Promise<SignatureValidationResult>;
|
|
221
|
+
export declare function validatePayProtocolDepositUsingStakedControlSignature(input: PayProtocolDepositUsingStakedControlSignatureRequest, domain?: ReturnType<typeof stakeControlEIP712Domain>): Promise<SignatureValidationResult>;
|
|
189
222
|
export {};
|