@b3dotfun/sdk 0.1.66-alpha.0 → 0.1.66-alpha.1
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/app.shared.js +8 -0
- package/dist/cjs/global-account/react/hooks/useFirstEOA.d.ts +4 -4
- package/dist/esm/app.shared.js +8 -0
- package/dist/esm/global-account/react/hooks/useFirstEOA.d.ts +4 -4
- package/dist/types/global-account/react/hooks/useFirstEOA.d.ts +4 -4
- package/package.json +1 -1
- package/src/app.shared.ts +11 -0
package/dist/cjs/app.shared.js
CHANGED
|
@@ -8,6 +8,7 @@ const authentication_client_1 = require("@feathersjs/authentication-client");
|
|
|
8
8
|
const js_cookie_1 = __importDefault(require("js-cookie"));
|
|
9
9
|
const constants_1 = require("./shared/constants");
|
|
10
10
|
exports.B3_API_URL = process.env.EXPO_PUBLIC_B3_API || process.env.NEXT_PUBLIC_B3_API || process.env.PUBLIC_B3_API || "https://api.b3.fun";
|
|
11
|
+
const DEV_USER_GROUP = 4;
|
|
11
12
|
const authenticate = async (app, accessToken, identityToken, params) => {
|
|
12
13
|
const fullToken = `${accessToken}+${identityToken}`;
|
|
13
14
|
// Do not authenticate if there is no token
|
|
@@ -22,6 +23,13 @@ const authenticate = async (app, accessToken, identityToken, params) => {
|
|
|
22
23
|
}, {
|
|
23
24
|
query: params || {},
|
|
24
25
|
});
|
|
26
|
+
// Extend cookie expiration to 30 days for dev users
|
|
27
|
+
if (response?.user?.userGroups?.includes(DEV_USER_GROUP)) {
|
|
28
|
+
const token = js_cookie_1.default.get(constants_1.B3_AUTH_COOKIE_NAME);
|
|
29
|
+
if (token) {
|
|
30
|
+
js_cookie_1.default.set(constants_1.B3_AUTH_COOKIE_NAME, token, { expires: 30 });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
25
33
|
return response;
|
|
26
34
|
}
|
|
27
35
|
catch (error) {
|
|
@@ -7451,6 +7451,8 @@ export declare function useFirstEOA(chain?: {
|
|
|
7451
7451
|
[x: `bool[${string}]`]: undefined;
|
|
7452
7452
|
[x: `bytes[${string}]`]: undefined;
|
|
7453
7453
|
[x: `bytes1[${string}]`]: undefined;
|
|
7454
|
+
[x: `bytes4[${string}]`]: undefined;
|
|
7455
|
+
[x: `bytes30[${string}]`]: undefined;
|
|
7454
7456
|
[x: `bytes18[${string}]`]: undefined;
|
|
7455
7457
|
[x: `bytes6[${string}]`]: undefined;
|
|
7456
7458
|
[x: `bytes9[${string}]`]: undefined;
|
|
@@ -7458,7 +7460,6 @@ export declare function useFirstEOA(chain?: {
|
|
|
7458
7460
|
[x: `bytes10[${string}]`]: undefined;
|
|
7459
7461
|
[x: `bytes2[${string}]`]: undefined;
|
|
7460
7462
|
[x: `bytes3[${string}]`]: undefined;
|
|
7461
|
-
[x: `bytes4[${string}]`]: undefined;
|
|
7462
7463
|
[x: `bytes5[${string}]`]: undefined;
|
|
7463
7464
|
[x: `bytes7[${string}]`]: undefined;
|
|
7464
7465
|
[x: `bytes11[${string}]`]: undefined;
|
|
@@ -7479,7 +7480,6 @@ export declare function useFirstEOA(chain?: {
|
|
|
7479
7480
|
[x: `bytes27[${string}]`]: undefined;
|
|
7480
7481
|
[x: `bytes28[${string}]`]: undefined;
|
|
7481
7482
|
[x: `bytes29[${string}]`]: undefined;
|
|
7482
|
-
[x: `bytes30[${string}]`]: undefined;
|
|
7483
7483
|
[x: `bytes31[${string}]`]: undefined;
|
|
7484
7484
|
[x: `bytes32[${string}]`]: undefined;
|
|
7485
7485
|
[x: `int[${string}]`]: undefined;
|
|
@@ -7553,6 +7553,8 @@ export declare function useFirstEOA(chain?: {
|
|
|
7553
7553
|
bool?: undefined;
|
|
7554
7554
|
bytes?: undefined;
|
|
7555
7555
|
bytes1?: undefined;
|
|
7556
|
+
bytes4?: undefined;
|
|
7557
|
+
bytes30?: undefined;
|
|
7556
7558
|
bytes18?: undefined;
|
|
7557
7559
|
bytes6?: undefined;
|
|
7558
7560
|
bytes9?: undefined;
|
|
@@ -7560,7 +7562,6 @@ export declare function useFirstEOA(chain?: {
|
|
|
7560
7562
|
bytes10?: undefined;
|
|
7561
7563
|
bytes2?: undefined;
|
|
7562
7564
|
bytes3?: undefined;
|
|
7563
|
-
bytes4?: undefined;
|
|
7564
7565
|
bytes5?: undefined;
|
|
7565
7566
|
bytes7?: undefined;
|
|
7566
7567
|
bytes11?: undefined;
|
|
@@ -7581,7 +7582,6 @@ export declare function useFirstEOA(chain?: {
|
|
|
7581
7582
|
bytes27?: undefined;
|
|
7582
7583
|
bytes28?: undefined;
|
|
7583
7584
|
bytes29?: undefined;
|
|
7584
|
-
bytes30?: undefined;
|
|
7585
7585
|
bytes31?: undefined;
|
|
7586
7586
|
bytes32?: undefined;
|
|
7587
7587
|
int56?: undefined;
|
package/dist/esm/app.shared.js
CHANGED
|
@@ -2,6 +2,7 @@ import { AuthenticationClient } from "@feathersjs/authentication-client";
|
|
|
2
2
|
import Cookies from "js-cookie";
|
|
3
3
|
import { B3_AUTH_COOKIE_NAME } from "./shared/constants/index.js";
|
|
4
4
|
export const B3_API_URL = process.env.EXPO_PUBLIC_B3_API || process.env.NEXT_PUBLIC_B3_API || process.env.PUBLIC_B3_API || "https://api.b3.fun";
|
|
5
|
+
const DEV_USER_GROUP = 4;
|
|
5
6
|
export const authenticate = async (app, accessToken, identityToken, params) => {
|
|
6
7
|
const fullToken = `${accessToken}+${identityToken}`;
|
|
7
8
|
// Do not authenticate if there is no token
|
|
@@ -16,6 +17,13 @@ export const authenticate = async (app, accessToken, identityToken, params) => {
|
|
|
16
17
|
}, {
|
|
17
18
|
query: params || {},
|
|
18
19
|
});
|
|
20
|
+
// Extend cookie expiration to 30 days for dev users
|
|
21
|
+
if (response?.user?.userGroups?.includes(DEV_USER_GROUP)) {
|
|
22
|
+
const token = Cookies.get(B3_AUTH_COOKIE_NAME);
|
|
23
|
+
if (token) {
|
|
24
|
+
Cookies.set(B3_AUTH_COOKIE_NAME, token, { expires: 30 });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
19
27
|
return response;
|
|
20
28
|
}
|
|
21
29
|
catch (error) {
|
|
@@ -7451,6 +7451,8 @@ export declare function useFirstEOA(chain?: {
|
|
|
7451
7451
|
[x: `bool[${string}]`]: undefined;
|
|
7452
7452
|
[x: `bytes[${string}]`]: undefined;
|
|
7453
7453
|
[x: `bytes1[${string}]`]: undefined;
|
|
7454
|
+
[x: `bytes4[${string}]`]: undefined;
|
|
7455
|
+
[x: `bytes30[${string}]`]: undefined;
|
|
7454
7456
|
[x: `bytes18[${string}]`]: undefined;
|
|
7455
7457
|
[x: `bytes6[${string}]`]: undefined;
|
|
7456
7458
|
[x: `bytes9[${string}]`]: undefined;
|
|
@@ -7458,7 +7460,6 @@ export declare function useFirstEOA(chain?: {
|
|
|
7458
7460
|
[x: `bytes10[${string}]`]: undefined;
|
|
7459
7461
|
[x: `bytes2[${string}]`]: undefined;
|
|
7460
7462
|
[x: `bytes3[${string}]`]: undefined;
|
|
7461
|
-
[x: `bytes4[${string}]`]: undefined;
|
|
7462
7463
|
[x: `bytes5[${string}]`]: undefined;
|
|
7463
7464
|
[x: `bytes7[${string}]`]: undefined;
|
|
7464
7465
|
[x: `bytes11[${string}]`]: undefined;
|
|
@@ -7479,7 +7480,6 @@ export declare function useFirstEOA(chain?: {
|
|
|
7479
7480
|
[x: `bytes27[${string}]`]: undefined;
|
|
7480
7481
|
[x: `bytes28[${string}]`]: undefined;
|
|
7481
7482
|
[x: `bytes29[${string}]`]: undefined;
|
|
7482
|
-
[x: `bytes30[${string}]`]: undefined;
|
|
7483
7483
|
[x: `bytes31[${string}]`]: undefined;
|
|
7484
7484
|
[x: `bytes32[${string}]`]: undefined;
|
|
7485
7485
|
[x: `int[${string}]`]: undefined;
|
|
@@ -7553,6 +7553,8 @@ export declare function useFirstEOA(chain?: {
|
|
|
7553
7553
|
bool?: undefined;
|
|
7554
7554
|
bytes?: undefined;
|
|
7555
7555
|
bytes1?: undefined;
|
|
7556
|
+
bytes4?: undefined;
|
|
7557
|
+
bytes30?: undefined;
|
|
7556
7558
|
bytes18?: undefined;
|
|
7557
7559
|
bytes6?: undefined;
|
|
7558
7560
|
bytes9?: undefined;
|
|
@@ -7560,7 +7562,6 @@ export declare function useFirstEOA(chain?: {
|
|
|
7560
7562
|
bytes10?: undefined;
|
|
7561
7563
|
bytes2?: undefined;
|
|
7562
7564
|
bytes3?: undefined;
|
|
7563
|
-
bytes4?: undefined;
|
|
7564
7565
|
bytes5?: undefined;
|
|
7565
7566
|
bytes7?: undefined;
|
|
7566
7567
|
bytes11?: undefined;
|
|
@@ -7581,7 +7582,6 @@ export declare function useFirstEOA(chain?: {
|
|
|
7581
7582
|
bytes27?: undefined;
|
|
7582
7583
|
bytes28?: undefined;
|
|
7583
7584
|
bytes29?: undefined;
|
|
7584
|
-
bytes30?: undefined;
|
|
7585
7585
|
bytes31?: undefined;
|
|
7586
7586
|
bytes32?: undefined;
|
|
7587
7587
|
int56?: undefined;
|
|
@@ -7451,6 +7451,8 @@ export declare function useFirstEOA(chain?: {
|
|
|
7451
7451
|
[x: `bool[${string}]`]: undefined;
|
|
7452
7452
|
[x: `bytes[${string}]`]: undefined;
|
|
7453
7453
|
[x: `bytes1[${string}]`]: undefined;
|
|
7454
|
+
[x: `bytes4[${string}]`]: undefined;
|
|
7455
|
+
[x: `bytes30[${string}]`]: undefined;
|
|
7454
7456
|
[x: `bytes18[${string}]`]: undefined;
|
|
7455
7457
|
[x: `bytes6[${string}]`]: undefined;
|
|
7456
7458
|
[x: `bytes9[${string}]`]: undefined;
|
|
@@ -7458,7 +7460,6 @@ export declare function useFirstEOA(chain?: {
|
|
|
7458
7460
|
[x: `bytes10[${string}]`]: undefined;
|
|
7459
7461
|
[x: `bytes2[${string}]`]: undefined;
|
|
7460
7462
|
[x: `bytes3[${string}]`]: undefined;
|
|
7461
|
-
[x: `bytes4[${string}]`]: undefined;
|
|
7462
7463
|
[x: `bytes5[${string}]`]: undefined;
|
|
7463
7464
|
[x: `bytes7[${string}]`]: undefined;
|
|
7464
7465
|
[x: `bytes11[${string}]`]: undefined;
|
|
@@ -7479,7 +7480,6 @@ export declare function useFirstEOA(chain?: {
|
|
|
7479
7480
|
[x: `bytes27[${string}]`]: undefined;
|
|
7480
7481
|
[x: `bytes28[${string}]`]: undefined;
|
|
7481
7482
|
[x: `bytes29[${string}]`]: undefined;
|
|
7482
|
-
[x: `bytes30[${string}]`]: undefined;
|
|
7483
7483
|
[x: `bytes31[${string}]`]: undefined;
|
|
7484
7484
|
[x: `bytes32[${string}]`]: undefined;
|
|
7485
7485
|
[x: `int[${string}]`]: undefined;
|
|
@@ -7553,6 +7553,8 @@ export declare function useFirstEOA(chain?: {
|
|
|
7553
7553
|
bool?: undefined;
|
|
7554
7554
|
bytes?: undefined;
|
|
7555
7555
|
bytes1?: undefined;
|
|
7556
|
+
bytes4?: undefined;
|
|
7557
|
+
bytes30?: undefined;
|
|
7556
7558
|
bytes18?: undefined;
|
|
7557
7559
|
bytes6?: undefined;
|
|
7558
7560
|
bytes9?: undefined;
|
|
@@ -7560,7 +7562,6 @@ export declare function useFirstEOA(chain?: {
|
|
|
7560
7562
|
bytes10?: undefined;
|
|
7561
7563
|
bytes2?: undefined;
|
|
7562
7564
|
bytes3?: undefined;
|
|
7563
|
-
bytes4?: undefined;
|
|
7564
7565
|
bytes5?: undefined;
|
|
7565
7566
|
bytes7?: undefined;
|
|
7566
7567
|
bytes11?: undefined;
|
|
@@ -7581,7 +7582,6 @@ export declare function useFirstEOA(chain?: {
|
|
|
7581
7582
|
bytes27?: undefined;
|
|
7582
7583
|
bytes28?: undefined;
|
|
7583
7584
|
bytes29?: undefined;
|
|
7584
|
-
bytes30?: undefined;
|
|
7585
7585
|
bytes31?: undefined;
|
|
7586
7586
|
bytes32?: undefined;
|
|
7587
7587
|
int56?: undefined;
|
package/package.json
CHANGED
package/src/app.shared.ts
CHANGED
|
@@ -6,6 +6,8 @@ import { B3_AUTH_COOKIE_NAME } from "./shared/constants";
|
|
|
6
6
|
export const B3_API_URL =
|
|
7
7
|
process.env.EXPO_PUBLIC_B3_API || process.env.NEXT_PUBLIC_B3_API || process.env.PUBLIC_B3_API || "https://api.b3.fun";
|
|
8
8
|
|
|
9
|
+
const DEV_USER_GROUP = 4;
|
|
10
|
+
|
|
9
11
|
export const authenticate = async (
|
|
10
12
|
app: ClientApplication,
|
|
11
13
|
accessToken: string,
|
|
@@ -30,6 +32,15 @@ export const authenticate = async (
|
|
|
30
32
|
query: params || {},
|
|
31
33
|
},
|
|
32
34
|
);
|
|
35
|
+
|
|
36
|
+
// Extend cookie expiration to 30 days for dev users
|
|
37
|
+
if (response?.user?.userGroups?.includes(DEV_USER_GROUP)) {
|
|
38
|
+
const token = Cookies.get(B3_AUTH_COOKIE_NAME);
|
|
39
|
+
if (token) {
|
|
40
|
+
Cookies.set(B3_AUTH_COOKIE_NAME, token, { expires: 30 });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
33
44
|
return response;
|
|
34
45
|
} catch (error) {
|
|
35
46
|
return null;
|