@cubee_ee/sdk 0.2.3 → 0.2.4

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.
@@ -98,6 +98,91 @@ export declare const CUBIC_POOL_IDL: {
98
98
  name: string;
99
99
  type: string;
100
100
  })[];
101
+ } | {
102
+ name: string;
103
+ docs: string[];
104
+ discriminator: number[];
105
+ accounts: ({
106
+ name: string;
107
+ docs: string[];
108
+ writable: boolean;
109
+ signer?: undefined;
110
+ } | {
111
+ name: string;
112
+ docs: string[];
113
+ writable?: undefined;
114
+ signer?: undefined;
115
+ } | {
116
+ name: string;
117
+ docs: string[];
118
+ signer: boolean;
119
+ writable?: undefined;
120
+ } | {
121
+ name: string;
122
+ docs: string[];
123
+ writable: boolean;
124
+ signer: boolean;
125
+ } | {
126
+ name: string;
127
+ docs?: undefined;
128
+ writable?: undefined;
129
+ signer?: undefined;
130
+ })[];
131
+ args: {
132
+ name: string;
133
+ type: string;
134
+ }[];
135
+ } | {
136
+ name: string;
137
+ docs: string[];
138
+ discriminator: number[];
139
+ accounts: ({
140
+ name: string;
141
+ writable: boolean;
142
+ docs?: undefined;
143
+ signer?: undefined;
144
+ } | {
145
+ name: string;
146
+ docs: string[];
147
+ writable?: undefined;
148
+ signer?: undefined;
149
+ } | {
150
+ name: string;
151
+ docs: string[];
152
+ writable: boolean;
153
+ signer: boolean;
154
+ } | {
155
+ name: string;
156
+ writable?: undefined;
157
+ docs?: undefined;
158
+ signer?: undefined;
159
+ })[];
160
+ args: never[];
161
+ } | {
162
+ name: string;
163
+ docs: string[];
164
+ discriminator: number[];
165
+ accounts: ({
166
+ name: string;
167
+ docs: string[];
168
+ writable: boolean;
169
+ signer?: undefined;
170
+ } | {
171
+ name: string;
172
+ signer: boolean;
173
+ docs?: undefined;
174
+ writable?: undefined;
175
+ })[];
176
+ args: {
177
+ name: string;
178
+ type: {
179
+ vec: {
180
+ defined: {
181
+ name: string;
182
+ };
183
+ };
184
+ };
185
+ }[];
101
186
  } | {
102
187
  name: string;
103
188
  docs: string[];
@@ -184,6 +269,37 @@ export declare const CUBIC_POOL_IDL: {
184
269
  };
185
270
  })[];
186
271
  };
272
+ } | {
273
+ name: string;
274
+ type: {
275
+ kind: string;
276
+ fields: ({
277
+ name: string;
278
+ docs: string[];
279
+ type: string;
280
+ } | {
281
+ name: string;
282
+ type: string;
283
+ docs?: undefined;
284
+ } | {
285
+ name: string;
286
+ docs: string[];
287
+ type: {
288
+ array: (number | {
289
+ defined: {
290
+ name: string;
291
+ };
292
+ })[];
293
+ };
294
+ } | {
295
+ name: string;
296
+ docs: string[];
297
+ type: {
298
+ array: (string | number)[];
299
+ };
300
+ })[];
301
+ };
302
+ docs?: undefined;
187
303
  } | {
188
304
  name: string;
189
305
  docs: string[];
@@ -205,7 +321,11 @@ export declare const CUBIC_POOL_IDL: {
205
321
  kind: string;
206
322
  fields: {
207
323
  name: string;
208
- type: string;
324
+ type: {
325
+ defined: {
326
+ name: string;
327
+ };
328
+ };
209
329
  }[];
210
330
  };
211
331
  docs?: undefined;
@@ -652,6 +772,91 @@ export declare const IDLS: {
652
772
  name: string;
653
773
  type: string;
654
774
  })[];
775
+ } | {
776
+ name: string;
777
+ docs: string[];
778
+ discriminator: number[];
779
+ accounts: ({
780
+ name: string;
781
+ docs: string[];
782
+ writable: boolean;
783
+ signer?: undefined;
784
+ } | {
785
+ name: string;
786
+ docs: string[];
787
+ writable?: undefined;
788
+ signer?: undefined;
789
+ } | {
790
+ name: string;
791
+ docs: string[];
792
+ signer: boolean;
793
+ writable?: undefined;
794
+ } | {
795
+ name: string;
796
+ docs: string[];
797
+ writable: boolean;
798
+ signer: boolean;
799
+ } | {
800
+ name: string;
801
+ docs?: undefined;
802
+ writable?: undefined;
803
+ signer?: undefined;
804
+ })[];
805
+ args: {
806
+ name: string;
807
+ type: string;
808
+ }[];
809
+ } | {
810
+ name: string;
811
+ docs: string[];
812
+ discriminator: number[];
813
+ accounts: ({
814
+ name: string;
815
+ writable: boolean;
816
+ docs?: undefined;
817
+ signer?: undefined;
818
+ } | {
819
+ name: string;
820
+ docs: string[];
821
+ writable?: undefined;
822
+ signer?: undefined;
823
+ } | {
824
+ name: string;
825
+ docs: string[];
826
+ writable: boolean;
827
+ signer: boolean;
828
+ } | {
829
+ name: string;
830
+ writable?: undefined;
831
+ docs?: undefined;
832
+ signer?: undefined;
833
+ })[];
834
+ args: never[];
835
+ } | {
836
+ name: string;
837
+ docs: string[];
838
+ discriminator: number[];
839
+ accounts: ({
840
+ name: string;
841
+ docs: string[];
842
+ writable: boolean;
843
+ signer?: undefined;
844
+ } | {
845
+ name: string;
846
+ signer: boolean;
847
+ docs?: undefined;
848
+ writable?: undefined;
849
+ })[];
850
+ args: {
851
+ name: string;
852
+ type: {
853
+ vec: {
854
+ defined: {
855
+ name: string;
856
+ };
857
+ };
858
+ };
859
+ }[];
655
860
  } | {
656
861
  name: string;
657
862
  docs: string[];
@@ -738,6 +943,37 @@ export declare const IDLS: {
738
943
  };
739
944
  })[];
740
945
  };
946
+ } | {
947
+ name: string;
948
+ type: {
949
+ kind: string;
950
+ fields: ({
951
+ name: string;
952
+ docs: string[];
953
+ type: string;
954
+ } | {
955
+ name: string;
956
+ type: string;
957
+ docs?: undefined;
958
+ } | {
959
+ name: string;
960
+ docs: string[];
961
+ type: {
962
+ array: (number | {
963
+ defined: {
964
+ name: string;
965
+ };
966
+ })[];
967
+ };
968
+ } | {
969
+ name: string;
970
+ docs: string[];
971
+ type: {
972
+ array: (string | number)[];
973
+ };
974
+ })[];
975
+ };
976
+ docs?: undefined;
741
977
  } | {
742
978
  name: string;
743
979
  docs: string[];
@@ -759,7 +995,11 @@ export declare const IDLS: {
759
995
  kind: string;
760
996
  fields: {
761
997
  name: string;
762
- type: string;
998
+ type: {
999
+ defined: {
1000
+ name: string;
1001
+ };
1002
+ };
763
1003
  }[];
764
1004
  };
765
1005
  docs?: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceR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;;;;;;;;;;;;;;;;;;;;;;;;;CAA0B,CAAC;AAElE,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIP,CAAC"}
@@ -17,7 +17,7 @@ export interface SdkError {
17
17
  /** Original error for debugging; never render this to end users. */
18
18
  cause?: unknown;
19
19
  }
20
- export type SdkErrorCode = "rpc_unavailable" | "rpc_timeout" | "rpc_rate_limited" | "account_not_found" | "invalid_input" | "math_overflow" | "parse_failure" | "backend_unavailable" | "backend_invalid_response" | "insufficient_funds" | "pool_disabled" | "swaps_disabled" | "unsupported_pool_state" | "slippage_exceeded" | "simulation_failed" | "tx_build_failed" | "alt_fetch_failed" | "unknown";
20
+ export type SdkErrorCode = "rpc_unavailable" | "rpc_timeout" | "rpc_rate_limited" | "account_not_found" | "invalid_input" | "math_overflow" | "parse_failure" | "backend_unavailable" | "backend_invalid_response" | "insufficient_funds" | "pool_disabled" | "swaps_disabled" | "unsupported_pool_state" | "slippage_exceeded" | "simulation_failed" | "tx_build_failed" | "alt_fetch_failed" | "auth_failed" | "unknown";
21
21
  export declare const ok: <T>(data: T) => SdkResult<T>;
22
22
  export declare const err: (code: SdkErrorCode, humanMessage: string, cause?: unknown) => SdkResult<never>;
23
23
  //# sourceMappingURL=result.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/types/result.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IACnB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GACrB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,QAAQ;IACvB,oCAAoC;IACpC,IAAI,EAAE,YAAY,CAAC;IACnB,yDAAyD;IACzD,YAAY,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,aAAa,GACb,kBAAkB,GAClB,mBAAmB,GACnB,eAAe,GACf,eAAe,GACf,eAAe,GACf,qBAAqB,GACrB,0BAA0B,GAC1B,oBAAoB,GACpB,eAAe,GACf,gBAAgB,GAChB,wBAAwB,GACxB,mBAAmB,GACnB,mBAAmB,GACnB,iBAAiB,GACjB,kBAAkB,GAClB,SAAS,CAAC;AAEd,eAAO,MAAM,EAAE,GAAI,CAAC,EAAE,MAAM,CAAC,KAAG,SAAS,CAAC,CAAC,CAAyB,CAAC;AACrE,eAAO,MAAM,GAAG,GACd,MAAM,YAAY,EAClB,cAAc,MAAM,EACpB,QAAQ,OAAO,KACd,SAAS,CAAC,KAAK,CAGhB,CAAC"}
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/types/result.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IACnB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GACrB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,QAAQ;IACvB,oCAAoC;IACpC,IAAI,EAAE,YAAY,CAAC;IACnB,yDAAyD;IACzD,YAAY,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,aAAa,GACb,kBAAkB,GAClB,mBAAmB,GACnB,eAAe,GACf,eAAe,GACf,eAAe,GACf,qBAAqB,GACrB,0BAA0B,GAC1B,oBAAoB,GACpB,eAAe,GACf,gBAAgB,GAChB,wBAAwB,GACxB,mBAAmB,GACnB,mBAAmB,GACnB,iBAAiB,GACjB,kBAAkB,GAClB,aAAa,GACb,SAAS,CAAC;AAEd,eAAO,MAAM,EAAE,GAAI,CAAC,EAAE,MAAM,CAAC,KAAG,SAAS,CAAC,CAAC,CAAyB,CAAC;AACrE,eAAO,MAAM,GAAG,GACd,MAAM,YAAY,EAClB,cAAc,MAAM,EACpB,QAAQ,OAAO,KACd,SAAS,CAAC,KAAK,CAGhB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/types/result.ts"],"names":[],"mappings":";;;AAqCO,MAAM,EAAE,GAAG,CAAI,IAAO,EAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAAxD,QAAA,EAAE,MAAsD;AAC9D,MAAM,GAAG,GAAG,CACjB,IAAkB,EAClB,YAAoB,EACpB,KAAe,EACG,EAAE,CAAC,CAAC;IACtB,EAAE,EAAE,KAAK;IACT,KAAK,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE;CACrC,CAAC,CAAC;AAPU,QAAA,GAAG,OAOb"}
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/types/result.ts"],"names":[],"mappings":";;;AAsCO,MAAM,EAAE,GAAG,CAAI,IAAO,EAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAAxD,QAAA,EAAE,MAAsD;AAC9D,MAAM,GAAG,GAAG,CACjB,IAAkB,EAClB,YAAoB,EACpB,KAAe,EACG,EAAE,CAAC,CAAC;IACtB,EAAE,EAAE,KAAK;IACT,KAAK,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE;CACrC,CAAC,CAAC;AAPU,QAAA,GAAG,OAOb"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cubee_ee/sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -131,6 +131,19 @@ export interface LeaderboardEpochResponse {
131
131
  epochs: EpochHistoryEntry[];
132
132
  }
133
133
 
134
+ // ── Auth types ──
135
+
136
+ export interface NonceResponse {
137
+ nonce: string;
138
+ message: string;
139
+ }
140
+
141
+ export interface AuthVerifyResponse {
142
+ accessToken: string;
143
+ wallet: string;
144
+ expiresIn: string;
145
+ }
146
+
134
147
  /**
135
148
  * REST wrapper around the Cube backend. Every method is a SdkResult; no
136
149
  * exceptions escape. If a request fails, the result carries a
@@ -280,6 +293,36 @@ export class CubeBackendClient {
280
293
  return this.get<StatsSeries>(`/api/stats/${kind}?${qs.toString()}`);
281
294
  }
282
295
 
296
+ // ── Auth ──
297
+
298
+ /** Request a SIWS nonce + pre-built message for the given wallet. */
299
+ getNonce(wallet: string): Promise<SdkResult<NonceResponse>> {
300
+ return this.get<NonceResponse>(
301
+ `/api/auth/nonce?wallet=${encodeURIComponent(wallet)}`,
302
+ );
303
+ }
304
+
305
+ /** Submit signed SIWS message to receive a JWT access token. */
306
+ verifySignature(
307
+ message: string,
308
+ signature: string,
309
+ ): Promise<SdkResult<AuthVerifyResponse>> {
310
+ return this.post<AuthVerifyResponse>("/api/auth/verify", {
311
+ message,
312
+ signature,
313
+ });
314
+ }
315
+
316
+ /** Set the JWT token for subsequent authenticated requests. */
317
+ setAccessToken(token: string): void {
318
+ this.headers["Authorization"] = `Bearer ${token}`;
319
+ }
320
+
321
+ /** Clear the JWT token (logout). */
322
+ clearAccessToken(): void {
323
+ delete this.headers["Authorization"];
324
+ }
325
+
283
326
  /** Generic GET with retry. Callers that need it for other endpoints. */
284
327
  get<T>(path: string): Promise<SdkResult<T>> {
285
328
  return this.request<T>("GET", path);