@argent/x-shared 1.32.3 → 1.32.5

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,11 +1,12 @@
1
1
  import { Address } from '../chains/starknet/address';
2
- import { OnchainRecovery, StartOnchainRecovery } from './schema';
2
+ import { ActiveOnchainRecovery, OnchainRecovery, StartOnchainRecovery } from './schema';
3
3
 
4
4
  /**
5
5
  * IOnchainRecoveryService interface
6
6
  */
7
7
  export interface IOnchainRecoveryService {
8
+ getRecovery(address: Address, recoveryId: number): Promise<OnchainRecovery | null>;
9
+ getActiveRecovery(address: Address): Promise<ActiveOnchainRecovery | null>;
8
10
  startRecovery(address: Address, feeToken: Address, publicKey: string, privateKey: string): Promise<StartOnchainRecovery>;
9
- getRecovery(address: Address, recoveryId?: number): Promise<OnchainRecovery>;
10
- cancelRecovery(address: Address, feeToken: Address, publicKey: string, privateKey: string): Promise<void>;
11
+ completeRecovery(address: Address, recoveryId: number): Promise<OnchainRecovery>;
11
12
  }
@@ -1,7 +1,7 @@
1
1
  import { Address } from '../chains/starknet/address';
2
2
  import { IHttpService } from '../http';
3
3
  import { IOnchainRecoveryService } from './IOnchainRecoveryService';
4
- import { OnchainRecovery, StartOnchainRecovery } from './schema';
4
+ import { ActiveOnchainRecovery, OnchainRecovery, StartOnchainRecovery } from './schema';
5
5
 
6
6
  /**
7
7
  * RecoveryService class implements IRecoveryService interface.
@@ -11,28 +11,35 @@ export declare class OnchainRecoveryService implements IOnchainRecoveryService {
11
11
  private readonly httpService;
12
12
  constructor(apiBase: string, httpService: IHttpService);
13
13
  /**
14
- * Starts the recovery process for a given address.
15
- * @param address - The address to recover.
16
- * @param feeToken - The token to be used for the recovery fee.
17
- * @param publicKey - The public key of the signer.
18
- * @param privateKey - The private key of the signer.
19
- * @returns A promise that resolves to the recovery details.
14
+ * Retrieves the on-chain recovery details for a given address and recovery ID.
15
+ * If no recovery ID is provided, it retrieves the latest recovery details.
16
+ * @param address - The address to retrieve the recovery details.
17
+ * @param recoveryId - The recovery ID to retrieve the details.
18
+ * @returns A promise that resolves to the on-chain recovery details.
20
19
  */
21
- startRecovery(address: Address, feeToken: Address, publicKey: string, privateKey: string): Promise<StartOnchainRecovery>;
20
+ getRecovery(address: Address, recoveryId: number): Promise<OnchainRecovery | null>;
22
21
  /**
23
22
  * Retrieves the on-chain recovery details for a given address and recovery ID.
24
23
  * If no recovery ID is provided, it retrieves the latest recovery details.
25
- * @param address - The address to retrieve the recovery details for.
26
- * @param recoveryId - (Optional) The recovery ID to retrieve the details for. If not provided, retrieves the latest recovery details.
24
+ * @param address - The address to retrieve the current active recovery details.
27
25
  * @returns A promise that resolves to the on-chain recovery details.
28
26
  */
29
- getRecovery(address: Address, recoveryId?: number): Promise<OnchainRecovery>;
27
+ getActiveRecovery(address: Address): Promise<ActiveOnchainRecovery | null>;
30
28
  /**
31
- * Cancels the on-chain recovery process for a given address.
32
- * @param address - The address for which to cancel the recovery process.
29
+ * Starts the recovery process for a given address.
30
+ * @param address - The address to recover.
31
+ * @param feeToken - The token to be used for the recovery fee.
33
32
  * @param publicKey - The public key of the signer.
34
33
  * @param privateKey - The private key of the signer.
35
- * @returns A promise that resolves when the recovery process is successfully canceled.
34
+ * @returns A promise that resolves to the recovery details.
35
+ */
36
+ startRecovery(address: Address, feeToken: Address, publicKey: string, privateKey: string): Promise<StartOnchainRecovery>;
37
+ /**
38
+ * Completes the recovery process for a given address and recovery ID.
39
+ * @param address - The address to recover.
40
+ * @param recoveryId - The recovery ID to complete.
41
+ * @returns A promise that resolves to the recovery details
42
+ *
36
43
  */
37
- cancelRecovery(address: Address, publicKey: string, privateKey: string): Promise<void>;
44
+ completeRecovery(address: Address, recoveryId: number): Promise<OnchainRecovery>;
38
45
  }
@@ -1,5 +1,14 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ export declare enum RecoveryStatusEnum {
4
+ NOT_STARTED = "NOT_STARTED",
5
+ ONGOING = "ONGOING",
6
+ AWAITING_FUNDS = "AWAITING_FUNDS",
7
+ AWAITING_COMPLETION = "AWAITING_COMPLETION",
8
+ COMPLETED = "COMPLETED",
9
+ CANCELLED = "CANCELLED",
10
+ ERROR = "ERROR"
11
+ }
3
12
  export declare const startOnchainRecoverySchema: z.ZodObject<{
4
13
  recoveryId: z.ZodNumber;
5
14
  }, "strip", z.ZodTypeAny, {
@@ -60,20 +69,80 @@ export declare const recoveryBodySchema: z.ZodObject<{
60
69
  };
61
70
  };
62
71
  }>;
63
- export declare const recoveryStatusSchema: z.ZodEnum<["ONGOING", "COMPLETED", "ERROR", "CANCELLED", "AWAITING_FUNDS"]>;
64
- export declare const onchainRecoverySchema: z.ZodObject<{
65
- status: z.ZodOptional<z.ZodEnum<["ONGOING", "COMPLETED", "ERROR", "CANCELLED", "AWAITING_FUNDS"]>>;
66
- recoveryId: z.ZodOptional<z.ZodNumber>;
72
+ export declare const recoveryStatusSchema: z.ZodNativeEnum<typeof RecoveryStatusEnum>;
73
+ export declare const recoveryBaseSchema: z.ZodObject<{
74
+ recoveryId: z.ZodNumber;
75
+ status: z.ZodNativeEnum<typeof RecoveryStatusEnum>;
67
76
  completionTime: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
68
77
  }, "strip", z.ZodTypeAny, {
69
- status?: "ONGOING" | "COMPLETED" | "ERROR" | "CANCELLED" | "AWAITING_FUNDS" | undefined;
70
- recoveryId?: number | undefined;
78
+ status: RecoveryStatusEnum;
79
+ recoveryId: number;
71
80
  completionTime?: number[] | undefined;
72
81
  }, {
73
- status?: "ONGOING" | "COMPLETED" | "ERROR" | "CANCELLED" | "AWAITING_FUNDS" | undefined;
74
- recoveryId?: number | undefined;
82
+ status: RecoveryStatusEnum;
83
+ recoveryId: number;
75
84
  completionTime?: number[] | undefined;
76
85
  }>;
86
+ export declare const activeOnchainRecoverySchema: z.ZodObject<{
87
+ activeRecovery: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodObject<{
88
+ recoveryId: z.ZodNumber;
89
+ status: z.ZodNativeEnum<typeof RecoveryStatusEnum>;
90
+ completionTime: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
91
+ }, "strip", z.ZodTypeAny, {
92
+ status: RecoveryStatusEnum;
93
+ recoveryId: number;
94
+ completionTime?: number[] | undefined;
95
+ }, {
96
+ status: RecoveryStatusEnum;
97
+ recoveryId: number;
98
+ completionTime?: number[] | undefined;
99
+ }>>, z.ZodNull]>>;
100
+ minFees: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ activeRecovery?: {
103
+ status: RecoveryStatusEnum;
104
+ recoveryId: number;
105
+ completionTime?: number[] | undefined;
106
+ } | null | undefined;
107
+ minFees?: Record<string, number> | undefined;
108
+ }, {
109
+ activeRecovery?: {
110
+ status: RecoveryStatusEnum;
111
+ recoveryId: number;
112
+ completionTime?: number[] | undefined;
113
+ } | null | undefined;
114
+ minFees?: Record<string, number> | undefined;
115
+ }>;
116
+ export declare const onchainRecoverySchema: z.ZodObject<{
117
+ recovery: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodObject<{
118
+ recoveryId: z.ZodNumber;
119
+ status: z.ZodNativeEnum<typeof RecoveryStatusEnum>;
120
+ completionTime: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ status: RecoveryStatusEnum;
123
+ recoveryId: number;
124
+ completionTime?: number[] | undefined;
125
+ }, {
126
+ status: RecoveryStatusEnum;
127
+ recoveryId: number;
128
+ completionTime?: number[] | undefined;
129
+ }>>, z.ZodNull]>>;
130
+ minFees: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ minFees?: Record<string, number> | undefined;
133
+ recovery?: {
134
+ status: RecoveryStatusEnum;
135
+ recoveryId: number;
136
+ completionTime?: number[] | undefined;
137
+ } | null | undefined;
138
+ }, {
139
+ minFees?: Record<string, number> | undefined;
140
+ recovery?: {
141
+ status: RecoveryStatusEnum;
142
+ recoveryId: number;
143
+ completionTime?: number[] | undefined;
144
+ } | null | undefined;
145
+ }>;
77
146
  export declare const startOnchainRecoveryErrorStatusSchema: z.ZodEnum<["undeployedAccount", "notEnoughToPayFees"]>;
78
147
  export declare const startOnchainRecoveryErrorSchema: z.ZodObject<{
79
148
  status: z.ZodEnum<["undeployedAccount", "notEnoughToPayFees"]>;
@@ -84,6 +153,7 @@ export declare const startOnchainRecoveryErrorSchema: z.ZodObject<{
84
153
  }>;
85
154
  export type StartOnchainRecovery = z.infer<typeof startOnchainRecoverySchema>;
86
155
  export type OnchainRecovery = z.infer<typeof onchainRecoverySchema>;
156
+ export type ActiveOnchainRecovery = z.infer<typeof activeOnchainRecoverySchema>;
87
157
  export type RecoveryStatus = z.infer<typeof recoveryStatusSchema>;
88
158
  export type StartOnchainRecoveryError = z.infer<typeof startOnchainRecoveryErrorSchema>;
89
159
  export type StartOnchainRecoveryErrorStatus = z.infer<typeof startOnchainRecoveryErrorStatusSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@argent/x-shared",
3
- "version": "1.32.3",
3
+ "version": "1.32.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/argentlabs/x-shared.git"