@coinbase/cdp-core 0.0.80 → 0.0.82
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/esm/index.native.js +15 -13
- package/dist/esm/index.native10.js +1 -1
- package/dist/esm/index.native11.js +1 -1
- package/dist/esm/index.native116.js +1 -1
- package/dist/esm/index.native117.js +1 -1
- package/dist/esm/index.native12.js +1 -1
- package/dist/esm/index.native13.js +1 -1
- package/dist/esm/index.native14.js +1 -1
- package/dist/esm/index.native16.js +1 -1
- package/dist/esm/index.native160.js +6 -32
- package/dist/esm/index.native161.js +32 -6
- package/dist/esm/index.native17.js +1 -1
- package/dist/esm/index.native18.js +1 -1
- package/dist/esm/index.native19.js +1 -1
- package/dist/esm/index.native20.js +1 -1
- package/dist/esm/index.native21.js +1 -1
- package/dist/esm/index.native22.js +1 -1
- package/dist/esm/index.native23.js +1 -1
- package/dist/esm/index.native24.js +1 -1
- package/dist/esm/index.native25.js +1 -1
- package/dist/esm/index.native26.js +1 -1
- package/dist/esm/index.native28.js +1 -1
- package/dist/esm/index.native29.js +1 -1
- package/dist/esm/index.native30.js +1 -1
- package/dist/esm/index.native31.js +1 -1
- package/dist/esm/index.native32.js +1 -1
- package/dist/esm/index.native33.js +1 -1
- package/dist/esm/index.native37.js +1 -1
- package/dist/esm/index.native39.js +1 -1
- package/dist/esm/index.native4.js +1 -1
- package/dist/esm/index.native46.js +27 -31
- package/dist/esm/index.native47.js +31 -27
- package/dist/esm/index.native49.js +1 -1
- package/dist/esm/index.native5.js +1 -1
- package/dist/esm/index.native50.js +1 -1
- package/dist/esm/index.native60.js +1 -1
- package/dist/esm/index.native74.js +1 -1
- package/dist/esm/index.native9.js +1 -1
- package/dist/esm/index.web.js +9 -7
- package/dist/esm/index.web10.js +2 -2
- package/dist/esm/index.web100.js +6 -127
- package/dist/esm/index.web101.js +40 -21
- package/dist/esm/index.web102.js +53 -10
- package/dist/esm/index.web103.js +125 -102
- package/dist/esm/index.web104.js +23 -6
- package/dist/esm/index.web105.js +13 -3
- package/dist/esm/index.web106.js +104 -14
- package/dist/esm/index.web107.js +6 -34
- package/dist/esm/index.web108.js +3 -79
- package/dist/esm/index.web109.js +15 -2
- package/dist/esm/index.web11.js +2 -2
- package/dist/esm/index.web110.js +35 -2
- package/dist/esm/index.web111.js +77 -11
- package/dist/esm/index.web112.js +2 -38
- package/dist/esm/index.web113.js +2 -7
- package/dist/esm/index.web114.js +10 -32
- package/dist/esm/index.web115.js +37 -8
- package/dist/esm/index.web116.js +5 -9
- package/dist/esm/index.web117.js +34 -11
- package/dist/esm/index.web118.js +8 -13
- package/dist/esm/index.web119.js +9 -17
- package/dist/esm/index.web12.js +2 -2
- package/dist/esm/index.web120.js +11 -5
- package/dist/esm/index.web121.js +14 -5
- package/dist/esm/index.web122.js +18 -10
- package/dist/esm/index.web123.js +8 -2
- package/dist/esm/index.web124.js +5 -66
- package/dist/esm/index.web125.js +10 -364
- package/dist/esm/index.web13.js +1 -1
- package/dist/esm/index.web131.js +5 -2
- package/dist/esm/index.web132.js +18 -4
- package/dist/esm/index.web133.js +7 -18
- package/dist/esm/index.web134.js +3 -7
- package/dist/esm/index.web135.js +19 -3
- package/dist/esm/index.web136.js +8 -19
- package/dist/esm/index.web137.js +7 -8
- package/dist/esm/index.web138.js +71 -7
- package/dist/esm/index.web139.js +17 -70
- package/dist/esm/index.web140.js +3 -18
- package/dist/esm/index.web141.js +4 -3
- package/dist/esm/index.web142.js +4 -4
- package/dist/esm/index.web143.js +4 -4
- package/dist/esm/index.web144.js +19 -4
- package/dist/esm/index.web145.js +48 -15
- package/dist/esm/index.web146.js +17 -52
- package/dist/esm/index.web147.js +23 -17
- package/dist/esm/index.web148.js +8 -23
- package/dist/esm/index.web149.js +33 -8
- package/dist/esm/index.web15.js +1 -1
- package/dist/esm/index.web150.js +7 -33
- package/dist/esm/index.web151.js +20 -7
- package/dist/esm/index.web152.js +4 -20
- package/dist/esm/index.web153.js +5 -21
- package/dist/esm/index.web154.js +48 -5
- package/dist/esm/index.web155.js +2 -48
- package/dist/esm/index.web156.js +18 -17
- package/dist/esm/index.web157.js +20 -80
- package/dist/esm/index.web158.js +79 -103
- package/dist/esm/index.web159.js +101 -30
- package/dist/esm/index.web16.js +1 -1
- package/dist/esm/index.web160.js +32 -6
- package/dist/esm/index.web161.js +6 -4
- package/dist/esm/index.web162.js +1 -1
- package/dist/esm/index.web169.js +2 -4
- package/dist/esm/index.web17.js +1 -1
- package/dist/esm/index.web170.js +108 -46
- package/dist/esm/index.web171.js +2 -8
- package/dist/esm/index.web172.js +4 -2
- package/dist/esm/index.web173.js +35 -374
- package/dist/esm/index.web174.js +2 -836
- package/dist/esm/index.web175.js +67 -36
- package/dist/esm/index.web176.js +35 -2
- package/dist/esm/index.web177.js +20 -69
- package/dist/esm/index.web178.js +7 -34
- package/dist/esm/index.web179.js +2 -21
- package/dist/esm/index.web18.js +1 -1
- package/dist/esm/index.web180.js +378 -5
- package/dist/esm/index.web181.js +836 -2
- package/dist/esm/index.web182.js +46 -108
- package/dist/esm/index.web183.js +5 -2
- package/dist/esm/index.web19.js +1 -1
- package/dist/esm/index.web192.js +2 -15
- package/dist/esm/index.web195.js +15 -2
- package/dist/esm/index.web2.js +2 -2
- package/dist/esm/index.web20.js +2 -2
- package/dist/esm/index.web21.js +2 -2
- package/dist/esm/index.web22.js +2 -2
- package/dist/esm/index.web23.js +2 -2
- package/dist/esm/index.web24.js +2 -2
- package/dist/esm/index.web25.js +2 -2
- package/dist/esm/index.web27.js +1 -1
- package/dist/esm/index.web28.js +2 -2
- package/dist/esm/index.web29.js +2 -2
- package/dist/esm/index.web3.js +1 -1
- package/dist/esm/index.web30.js +3 -3
- package/dist/esm/index.web31.js +2 -2
- package/dist/esm/index.web32.js +2 -2
- package/dist/esm/index.web36.js +1 -1
- package/dist/esm/index.web38.js +2 -2
- package/dist/esm/index.web47.js +1 -1
- package/dist/esm/index.web48.js +27 -31
- package/dist/esm/index.web49.js +32 -3
- package/dist/esm/index.web5.js +1 -1
- package/dist/esm/index.web50.js +3 -9
- package/dist/esm/index.web51.js +8 -64
- package/dist/esm/index.web52.js +47 -70
- package/dist/esm/index.web53.js +87 -23
- package/dist/esm/index.web54.js +23 -17
- package/dist/esm/index.web55.js +16 -26
- package/dist/esm/index.web60.js +12 -12
- package/dist/esm/index.web62.js +1 -1
- package/dist/esm/index.web67.js +2 -2
- package/dist/esm/index.web70.js +1 -1
- package/dist/esm/index.web74.js +1 -1
- package/dist/esm/index.web75.js +1 -1
- package/dist/esm/index.web79.js +3 -3
- package/dist/esm/index.web8.js +1 -1
- package/dist/esm/index.web80.js +12 -12
- package/dist/esm/index.web81.js +12 -12
- package/dist/esm/index.web82.js +2 -4
- package/dist/esm/index.web83.js +66 -2
- package/dist/esm/index.web84.js +364 -17
- package/dist/esm/index.web85.js +2 -46
- package/dist/esm/index.web86.js +2 -14
- package/dist/esm/index.web87.js +16 -54
- package/dist/esm/index.web88.js +45 -6
- package/dist/esm/index.web89.js +13 -21
- package/dist/esm/index.web9.js +7 -7
- package/dist/esm/index.web90.js +55 -11
- package/dist/esm/index.web91.js +6 -3
- package/dist/esm/index.web92.js +21 -3
- package/dist/esm/index.web93.js +11 -34
- package/dist/esm/index.web94.js +3 -12
- package/dist/esm/index.web95.js +3 -4
- package/dist/esm/index.web96.js +31 -25
- package/dist/esm/index.web97.js +12 -6
- package/dist/esm/index.web98.js +4 -42
- package/dist/esm/index.web99.js +27 -54
- package/dist/native/index.native.js +15 -13
- package/dist/native/index.native10.js +1 -1
- package/dist/native/index.native11.js +1 -1
- package/dist/native/index.native116.js +1 -1
- package/dist/native/index.native117.js +1 -1
- package/dist/native/index.native12.js +1 -1
- package/dist/native/index.native13.js +1 -1
- package/dist/native/index.native14.js +1 -1
- package/dist/native/index.native16.js +1 -1
- package/dist/native/index.native160.js +6 -32
- package/dist/native/index.native161.js +32 -6
- package/dist/native/index.native17.js +1 -1
- package/dist/native/index.native18.js +1 -1
- package/dist/native/index.native19.js +1 -1
- package/dist/native/index.native20.js +1 -1
- package/dist/native/index.native21.js +1 -1
- package/dist/native/index.native22.js +1 -1
- package/dist/native/index.native23.js +1 -1
- package/dist/native/index.native24.js +1 -1
- package/dist/native/index.native25.js +1 -1
- package/dist/native/index.native26.js +1 -1
- package/dist/native/index.native28.js +1 -1
- package/dist/native/index.native29.js +1 -1
- package/dist/native/index.native30.js +1 -1
- package/dist/native/index.native31.js +1 -1
- package/dist/native/index.native32.js +1 -1
- package/dist/native/index.native33.js +1 -1
- package/dist/native/index.native37.js +1 -1
- package/dist/native/index.native39.js +1 -1
- package/dist/native/index.native4.js +1 -1
- package/dist/native/index.native46.js +27 -31
- package/dist/native/index.native47.js +31 -27
- package/dist/native/index.native49.js +1 -1
- package/dist/native/index.native5.js +1 -1
- package/dist/native/index.native50.js +1 -1
- package/dist/native/index.native60.js +1 -1
- package/dist/native/index.native74.js +1 -1
- package/dist/native/index.native9.js +1 -1
- package/dist/native-types/index.d.ts +1 -0
- package/dist/native-types/index.native.d.ts +1 -0
- package/dist/native-types/index.web.d.ts +1 -0
- package/dist/native-types/version.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.native.d.ts +1 -0
- package/dist/types/index.web.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index.web.js +9 -7
- package/dist/web/index.web10.js +2 -2
- package/dist/web/index.web100.js +6 -127
- package/dist/web/index.web101.js +40 -21
- package/dist/web/index.web102.js +53 -10
- package/dist/web/index.web103.js +125 -102
- package/dist/web/index.web104.js +23 -6
- package/dist/web/index.web105.js +13 -3
- package/dist/web/index.web106.js +104 -14
- package/dist/web/index.web107.js +6 -34
- package/dist/web/index.web108.js +3 -79
- package/dist/web/index.web109.js +15 -2
- package/dist/web/index.web11.js +2 -2
- package/dist/web/index.web110.js +35 -2
- package/dist/web/index.web111.js +77 -11
- package/dist/web/index.web112.js +2 -38
- package/dist/web/index.web113.js +2 -7
- package/dist/web/index.web114.js +10 -32
- package/dist/web/index.web115.js +37 -8
- package/dist/web/index.web116.js +5 -9
- package/dist/web/index.web117.js +34 -11
- package/dist/web/index.web118.js +8 -13
- package/dist/web/index.web119.js +9 -17
- package/dist/web/index.web12.js +2 -2
- package/dist/web/index.web120.js +11 -5
- package/dist/web/index.web121.js +14 -5
- package/dist/web/index.web122.js +18 -10
- package/dist/web/index.web123.js +8 -2
- package/dist/web/index.web124.js +5 -66
- package/dist/web/index.web125.js +10 -364
- package/dist/web/index.web13.js +1 -1
- package/dist/web/index.web131.js +5 -2
- package/dist/web/index.web132.js +18 -4
- package/dist/web/index.web133.js +7 -18
- package/dist/web/index.web134.js +3 -7
- package/dist/web/index.web135.js +19 -3
- package/dist/web/index.web136.js +8 -19
- package/dist/web/index.web137.js +7 -8
- package/dist/web/index.web138.js +71 -7
- package/dist/web/index.web139.js +17 -70
- package/dist/web/index.web140.js +3 -18
- package/dist/web/index.web141.js +4 -3
- package/dist/web/index.web142.js +4 -4
- package/dist/web/index.web143.js +4 -4
- package/dist/web/index.web144.js +19 -4
- package/dist/web/index.web145.js +48 -15
- package/dist/web/index.web146.js +17 -52
- package/dist/web/index.web147.js +23 -17
- package/dist/web/index.web148.js +8 -23
- package/dist/web/index.web149.js +33 -8
- package/dist/web/index.web15.js +1 -1
- package/dist/web/index.web150.js +7 -33
- package/dist/web/index.web151.js +20 -7
- package/dist/web/index.web152.js +4 -20
- package/dist/web/index.web153.js +5 -21
- package/dist/web/index.web154.js +48 -5
- package/dist/web/index.web155.js +2 -48
- package/dist/web/index.web156.js +18 -17
- package/dist/web/index.web157.js +20 -80
- package/dist/web/index.web158.js +79 -103
- package/dist/web/index.web159.js +101 -30
- package/dist/web/index.web16.js +1 -1
- package/dist/web/index.web160.js +32 -6
- package/dist/web/index.web161.js +6 -4
- package/dist/web/index.web162.js +1 -1
- package/dist/web/index.web169.js +2 -4
- package/dist/web/index.web17.js +1 -1
- package/dist/web/index.web170.js +108 -46
- package/dist/web/index.web171.js +2 -8
- package/dist/web/index.web172.js +4 -2
- package/dist/web/index.web173.js +35 -374
- package/dist/web/index.web174.js +2 -836
- package/dist/web/index.web175.js +67 -36
- package/dist/web/index.web176.js +35 -2
- package/dist/web/index.web177.js +20 -69
- package/dist/web/index.web178.js +7 -34
- package/dist/web/index.web179.js +2 -21
- package/dist/web/index.web18.js +1 -1
- package/dist/web/index.web180.js +378 -5
- package/dist/web/index.web181.js +836 -2
- package/dist/web/index.web182.js +46 -108
- package/dist/web/index.web183.js +5 -2
- package/dist/web/index.web19.js +1 -1
- package/dist/web/index.web192.js +2 -15
- package/dist/web/index.web195.js +15 -2
- package/dist/web/index.web2.js +2 -2
- package/dist/web/index.web20.js +2 -2
- package/dist/web/index.web21.js +2 -2
- package/dist/web/index.web22.js +2 -2
- package/dist/web/index.web23.js +2 -2
- package/dist/web/index.web24.js +2 -2
- package/dist/web/index.web25.js +2 -2
- package/dist/web/index.web27.js +1 -1
- package/dist/web/index.web28.js +2 -2
- package/dist/web/index.web29.js +2 -2
- package/dist/web/index.web3.js +1 -1
- package/dist/web/index.web30.js +3 -3
- package/dist/web/index.web31.js +2 -2
- package/dist/web/index.web32.js +2 -2
- package/dist/web/index.web36.js +1 -1
- package/dist/web/index.web38.js +2 -2
- package/dist/web/index.web47.js +1 -1
- package/dist/web/index.web48.js +27 -31
- package/dist/web/index.web49.js +32 -3
- package/dist/web/index.web5.js +1 -1
- package/dist/web/index.web50.js +3 -9
- package/dist/web/index.web51.js +8 -64
- package/dist/web/index.web52.js +47 -70
- package/dist/web/index.web53.js +87 -23
- package/dist/web/index.web54.js +23 -17
- package/dist/web/index.web55.js +16 -26
- package/dist/web/index.web60.js +12 -12
- package/dist/web/index.web62.js +1 -1
- package/dist/web/index.web67.js +2 -2
- package/dist/web/index.web70.js +1 -1
- package/dist/web/index.web74.js +1 -1
- package/dist/web/index.web75.js +1 -1
- package/dist/web/index.web79.js +3 -3
- package/dist/web/index.web8.js +1 -1
- package/dist/web/index.web80.js +12 -12
- package/dist/web/index.web81.js +12 -12
- package/dist/web/index.web82.js +2 -4
- package/dist/web/index.web83.js +66 -2
- package/dist/web/index.web84.js +364 -17
- package/dist/web/index.web85.js +2 -46
- package/dist/web/index.web86.js +2 -14
- package/dist/web/index.web87.js +16 -54
- package/dist/web/index.web88.js +45 -6
- package/dist/web/index.web89.js +13 -21
- package/dist/web/index.web9.js +7 -7
- package/dist/web/index.web90.js +55 -11
- package/dist/web/index.web91.js +6 -3
- package/dist/web/index.web92.js +21 -3
- package/dist/web/index.web93.js +11 -34
- package/dist/web/index.web94.js +3 -12
- package/dist/web/index.web95.js +3 -4
- package/dist/web/index.web96.js +31 -25
- package/dist/web/index.web97.js +12 -6
- package/dist/web/index.web98.js +4 -42
- package/dist/web/index.web99.js +27 -54
- package/dist/web-types/index.d.ts +1 -0
- package/dist/web-types/index.native.d.ts +1 -0
- package/dist/web-types/index.web.d.ts +1 -0
- package/dist/web-types/version.d.ts +1 -1
- package/package.json +2 -2
package/dist/esm/index.web52.js
CHANGED
|
@@ -1,90 +1,67 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
|
|
5
|
-
class
|
|
6
|
-
oauthFlowState = null;
|
|
7
|
-
oauthStateChangeCallbacks = [];
|
|
1
|
+
import { AuthManager as a } from "./index.web38.js";
|
|
2
|
+
import { getConfig as o } from "./index.web48.js";
|
|
3
|
+
import { CustomAuthError as s } from "./index.web39.js";
|
|
4
|
+
const n = 60 * 60 * 1e3;
|
|
5
|
+
class l extends a {
|
|
8
6
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* Signs out the user, clearing all authentication state.
|
|
8
|
+
* For custom auth, we only clear local state without calling the CDP logout API,
|
|
9
|
+
* as authentication is managed by the external identity provider.
|
|
12
10
|
*/
|
|
13
|
-
async
|
|
14
|
-
this.
|
|
11
|
+
async signOut() {
|
|
12
|
+
await this.clearAuthState();
|
|
15
13
|
}
|
|
16
14
|
/**
|
|
17
|
-
*
|
|
15
|
+
* Gets the access token by calling the customAuth.getJwt callback.
|
|
16
|
+
* Returns null if the user is not signed in.
|
|
18
17
|
*
|
|
19
|
-
* @
|
|
18
|
+
* @returns The access token from the custom auth provider.
|
|
20
19
|
*/
|
|
21
|
-
async
|
|
22
|
-
|
|
20
|
+
async getToken() {
|
|
21
|
+
const e = o();
|
|
22
|
+
if (!e.customAuth)
|
|
23
|
+
return console.error("Custom auth configuration not found"), await this.clearAuthState(), null;
|
|
24
|
+
try {
|
|
25
|
+
const t = await e.customAuth.getJwt();
|
|
26
|
+
return t ? (this.authState && (this.authState.accessToken = t, this.authState.expiresAt = Date.now() + n), t) : (await this.clearAuthState(), null);
|
|
27
|
+
} catch (t) {
|
|
28
|
+
const r = new s(
|
|
29
|
+
t instanceof Error ? t.message : "Failed to get custom auth JWT"
|
|
30
|
+
);
|
|
31
|
+
return console.error(r), await this.clearAuthState(), null;
|
|
32
|
+
}
|
|
23
33
|
}
|
|
24
34
|
/**
|
|
25
|
-
*
|
|
35
|
+
* Internal async initialization logic for custom auth.
|
|
36
|
+
* No-op for custom auth since tokens are provided via customAuth.getJwt callback.
|
|
37
|
+
* Unlike standard CDP auth, custom auth doesn't need token refresh or OAuth handling.
|
|
26
38
|
*/
|
|
27
|
-
async
|
|
28
|
-
this.oauthFlowState = null, this.oauthStateChangeCallbacks.forEach((t) => t(null));
|
|
39
|
+
async _doInitialize() {
|
|
29
40
|
}
|
|
30
41
|
/**
|
|
31
|
-
*
|
|
42
|
+
* Custom auth always fetches fresh tokens, so never needs to "refresh" in the traditional sense.
|
|
32
43
|
*
|
|
33
|
-
* @returns
|
|
44
|
+
* @returns Always false since custom auth doesn't use token refresh logic.
|
|
34
45
|
*/
|
|
35
|
-
|
|
36
|
-
return
|
|
46
|
+
shouldRefreshToken() {
|
|
47
|
+
return !1;
|
|
37
48
|
}
|
|
38
49
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @returns A promise that resolves when the OAuth code is handled.
|
|
43
|
-
* @throws An error if the URL is required and not provided.
|
|
50
|
+
* Custom auth doesn't use CDP's token refresh mechanism.
|
|
51
|
+
* Tokens are always provided fresh from the customAuth.getJwt callback.
|
|
52
|
+
* This method should never be called, but we override it as a defensive measure.
|
|
44
53
|
*/
|
|
45
|
-
async
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
providerType: e,
|
|
54
|
-
status: "error",
|
|
55
|
-
errorDescription: s ?? u,
|
|
56
|
-
code: r,
|
|
57
|
-
flowId: o,
|
|
58
|
-
error: s
|
|
59
|
-
});
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (!r || !e || !o)
|
|
63
|
-
return;
|
|
64
|
-
await this.setOAuthFlowState({
|
|
65
|
-
providerType: e,
|
|
66
|
-
status: "pending",
|
|
67
|
-
code: r,
|
|
68
|
-
flowId: o
|
|
69
|
-
}), await i({
|
|
70
|
-
code: r,
|
|
71
|
-
providerType: e,
|
|
72
|
-
flowId: o
|
|
73
|
-
}), await this.setOAuthFlowState({
|
|
74
|
-
providerType: e,
|
|
75
|
-
status: "success",
|
|
76
|
-
code: r,
|
|
77
|
-
flowId: o
|
|
78
|
-
});
|
|
79
|
-
} catch (a) {
|
|
80
|
-
const e = a instanceof Error ? a.message : "Unknown error";
|
|
81
|
-
await h().cleanupOAuthParams(), await this.setOAuthFlowState({
|
|
82
|
-
status: "error",
|
|
83
|
-
errorDescription: e
|
|
84
|
-
});
|
|
85
|
-
}
|
|
54
|
+
async refreshAccessToken() {
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Custom auth provides fresh tokens on each request via customAuth.getJwt,
|
|
58
|
+
* so no scheduled refresh is needed. This method is a no-op for custom auth.
|
|
59
|
+
*/
|
|
60
|
+
scheduleTokenRefresh() {
|
|
61
|
+
this.cancelTokenRefresh();
|
|
86
62
|
}
|
|
87
63
|
}
|
|
88
64
|
export {
|
|
89
|
-
|
|
65
|
+
n as CUSTOM_AUTH_REFRESH_BUFFER_MS,
|
|
66
|
+
l as CustomAuthManager
|
|
90
67
|
};
|
package/dist/esm/index.web53.js
CHANGED
|
@@ -1,26 +1,90 @@
|
|
|
1
|
+
import { verifyOAuth as i } from "./index.web9.js";
|
|
2
|
+
import { getPlatformOAuth as h } from "./index.web4.js";
|
|
1
3
|
import "@coinbase/cdp-api-client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
4
|
+
import "viem";
|
|
5
|
+
class A {
|
|
6
|
+
oauthFlowState = null;
|
|
7
|
+
oauthStateChangeCallbacks = [];
|
|
8
|
+
/**
|
|
9
|
+
* Adds a callback to be called when the OAuth state changes.
|
|
10
|
+
*
|
|
11
|
+
* @param callback - The function to call when the OAuth state changes.
|
|
12
|
+
*/
|
|
13
|
+
async addOAuthStateChangeCallback(t) {
|
|
14
|
+
this.oauthStateChangeCallbacks.push(t), t(this.oauthFlowState);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Sets the OAuth flow state.
|
|
18
|
+
*
|
|
19
|
+
* @param oauthFlowState - The OAuth flow state.
|
|
20
|
+
*/
|
|
21
|
+
async setOAuthFlowState(t) {
|
|
22
|
+
this.oauthFlowState = t, this.oauthStateChangeCallbacks.forEach((a) => a(this.oauthFlowState));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Clears the OAuth flow state.
|
|
26
|
+
*/
|
|
27
|
+
async clearOAuthFlowState() {
|
|
28
|
+
this.oauthFlowState = null, this.oauthStateChangeCallbacks.forEach((t) => t(null));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets the OAuth flow state.
|
|
32
|
+
*
|
|
33
|
+
* @returns The OAuth flow state.
|
|
34
|
+
*/
|
|
35
|
+
async getOAuthFlowState() {
|
|
36
|
+
return this.oauthFlowState;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Handles the OAuth code.
|
|
40
|
+
*
|
|
41
|
+
* @param url - The URL to handle.
|
|
42
|
+
* @returns A promise that resolves when the OAuth code is handled.
|
|
43
|
+
* @throws An error if the URL is required and not provided.
|
|
44
|
+
*/
|
|
45
|
+
async handleOAuthCode(t) {
|
|
46
|
+
try {
|
|
47
|
+
const a = await h().getOAuthParams(t);
|
|
48
|
+
if (await h().cleanupOAuthParams(), !a)
|
|
49
|
+
return;
|
|
50
|
+
const { providerType: e, code: r, flowId: o, error: s, errorDescription: u } = a;
|
|
51
|
+
if (s || u) {
|
|
52
|
+
await this.setOAuthFlowState({
|
|
53
|
+
providerType: e,
|
|
54
|
+
status: "error",
|
|
55
|
+
errorDescription: s ?? u,
|
|
56
|
+
code: r,
|
|
57
|
+
flowId: o,
|
|
58
|
+
error: s
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!r || !e || !o)
|
|
63
|
+
return;
|
|
64
|
+
await this.setOAuthFlowState({
|
|
65
|
+
providerType: e,
|
|
66
|
+
status: "pending",
|
|
67
|
+
code: r,
|
|
68
|
+
flowId: o
|
|
69
|
+
}), await i({
|
|
70
|
+
code: r,
|
|
71
|
+
providerType: e,
|
|
72
|
+
flowId: o
|
|
73
|
+
}), await this.setOAuthFlowState({
|
|
74
|
+
providerType: e,
|
|
75
|
+
status: "success",
|
|
76
|
+
code: r,
|
|
77
|
+
flowId: o
|
|
78
|
+
});
|
|
79
|
+
} catch (a) {
|
|
80
|
+
const e = a instanceof Error ? a.message : "Unknown error";
|
|
81
|
+
await h().cleanupOAuthParams(), await this.setOAuthFlowState({
|
|
82
|
+
status: "error",
|
|
83
|
+
errorDescription: e
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
23
88
|
export {
|
|
24
|
-
|
|
25
|
-
e as toAuthStateUser
|
|
89
|
+
A as OAuthManager
|
|
26
90
|
};
|
package/dist/esm/index.web54.js
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import "@coinbase/cdp-api-client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
const e = (t) => ({
|
|
3
|
+
userId: t.userId,
|
|
4
|
+
// Deprecated fields - keep for backward compatibility
|
|
5
|
+
evmAccounts: t.evmAccounts?.map((c) => c) ?? [],
|
|
6
|
+
evmSmartAccounts: t.evmSmartAccounts?.map((c) => c) ?? [],
|
|
7
|
+
solanaAccounts: t.solanaAccounts?.map((c) => c) ?? [],
|
|
8
|
+
// New account object fields
|
|
9
|
+
evmAccountObjects: t.evmAccountObjects,
|
|
10
|
+
evmSmartAccountObjects: t.evmSmartAccountObjects,
|
|
11
|
+
solanaAccountObjects: t.solanaAccountObjects,
|
|
12
|
+
authenticationMethods: t.authenticationMethods.reduce((c, a) => (c[a.type] = a, c), {}),
|
|
13
|
+
mfaMethods: t.mfaMethods,
|
|
14
|
+
lastAuthenticatedAt: t.lastAuthenticatedAt
|
|
15
|
+
}), s = (t, c, a) => {
|
|
16
|
+
const o = new Date(c).getTime();
|
|
17
|
+
return {
|
|
18
|
+
accessToken: t,
|
|
19
|
+
expiresAt: o,
|
|
20
|
+
user: e(a)
|
|
21
|
+
};
|
|
22
|
+
};
|
|
17
23
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
s as toAuthState,
|
|
25
|
+
e as toAuthStateUser
|
|
20
26
|
};
|
package/dist/esm/index.web55.js
CHANGED
|
@@ -1,30 +1,20 @@
|
|
|
1
1
|
import "@coinbase/cdp-api-client";
|
|
2
2
|
import "viem";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
e = t;
|
|
18
|
-
}, s = () => {
|
|
19
|
-
if (!e)
|
|
20
|
-
throw new Error("SDK not initialized");
|
|
21
|
-
return e;
|
|
22
|
-
};
|
|
3
|
+
const u = async (c) => await c.isSignedIn();
|
|
4
|
+
async function A(c, a, r) {
|
|
5
|
+
if (!await u(a))
|
|
6
|
+
throw new Error("User not signed in");
|
|
7
|
+
const t = a.getUser();
|
|
8
|
+
if ("evmAccount" in c && !(t.evmAccounts?.find((n) => n === c.evmAccount) || t.evmAccountObjects?.find((n) => n.address === c.evmAccount)))
|
|
9
|
+
throw new Error("EVM account not found");
|
|
10
|
+
if ("evmSmartAccount" in c && !(t.evmSmartAccounts?.find((n) => n === c.evmSmartAccount) || t.evmSmartAccountObjects?.find((n) => n.address === c.evmSmartAccount)))
|
|
11
|
+
throw new Error("EVM Smart Account not found");
|
|
12
|
+
if ("solanaAccount" in c && !(t.solanaAccounts?.find((n) => n === c.solanaAccount) || t.solanaAccountObjects?.find((n) => n.address === c.solanaAccount)))
|
|
13
|
+
throw new Error("Solana account not found");
|
|
14
|
+
const e = await a.getWalletSecretId();
|
|
15
|
+
return r({ ...c, user: t, walletSecretId: e });
|
|
16
|
+
}
|
|
23
17
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
s as getCoreOAuthManager,
|
|
27
|
-
a as setConfig,
|
|
28
|
-
l as setCoreAuthManager,
|
|
29
|
-
h as setCoreOAuthManager
|
|
18
|
+
u as isSignedIn,
|
|
19
|
+
A as withAuth
|
|
30
20
|
};
|
package/dist/esm/index.web60.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { serializeAuthorizationList as v } from "./index.
|
|
2
|
-
import { blobsToCommitments as H } from "./index.
|
|
3
|
-
import { blobsToProofs as V } from "./index.
|
|
4
|
-
import { commitmentsToVersionedHashes as k } from "./index.
|
|
5
|
-
import { toBlobSidecars as B } from "./index.
|
|
6
|
-
import { concatHex as T } from "./index.
|
|
7
|
-
import { trim as F } from "./index.
|
|
8
|
-
import { numberToHex as s, bytesToHex as S } from "./index.
|
|
9
|
-
import { toRlp as b } from "./index.
|
|
10
|
-
import { assertTransactionEIP1559 as _, assertTransactionEIP2930 as C, assertTransactionEIP4844 as R, assertTransactionEIP7702 as Y, assertTransactionLegacy as j } from "./index.
|
|
11
|
-
import { getTransactionType as q } from "./index.
|
|
12
|
-
import { serializeAccessList as h } from "./index.
|
|
1
|
+
import { serializeAuthorizationList as v } from "./index.web87.js";
|
|
2
|
+
import { blobsToCommitments as H } from "./index.web118.js";
|
|
3
|
+
import { blobsToProofs as V } from "./index.web119.js";
|
|
4
|
+
import { commitmentsToVersionedHashes as k } from "./index.web120.js";
|
|
5
|
+
import { toBlobSidecars as B } from "./index.web121.js";
|
|
6
|
+
import { concatHex as T } from "./index.web94.js";
|
|
7
|
+
import { trim as F } from "./index.web100.js";
|
|
8
|
+
import { numberToHex as s, bytesToHex as S } from "./index.web88.js";
|
|
9
|
+
import { toRlp as b } from "./index.web101.js";
|
|
10
|
+
import { assertTransactionEIP1559 as _, assertTransactionEIP2930 as C, assertTransactionEIP4844 as R, assertTransactionEIP7702 as Y, assertTransactionLegacy as j } from "./index.web111.js";
|
|
11
|
+
import { getTransactionType as q } from "./index.web109.js";
|
|
12
|
+
import { serializeAccessList as h } from "./index.web122.js";
|
|
13
13
|
function re(e, t) {
|
|
14
14
|
const i = q(e);
|
|
15
15
|
return i === "eip1559" ? J(e, t) : i === "eip2930" ? K(e, t) : i === "eip4844" ? D(e, t) : i === "eip7702" ? w(e, t) : M(e);
|
package/dist/esm/index.web62.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getTransactionEncoder as u, getTransactionDecoder as f, address as g } from "@solana/kit";
|
|
2
2
|
import { getCurrentUserSync as l } from "./index.web13.js";
|
|
3
3
|
import { signSolanaTransaction as m } from "./index.web9.js";
|
|
4
|
-
import { encodeBase64 as T, decodeBase64 as h } from "./index.
|
|
4
|
+
import { encodeBase64 as T, decodeBase64 as h } from "./index.web49.js";
|
|
5
5
|
function E(n) {
|
|
6
6
|
const o = l();
|
|
7
7
|
if (!o || !o.solanaAccountObjects?.length)
|
package/dist/esm/index.web67.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InvalidAddressError as s } from "./index.
|
|
2
|
-
import { isAddress as a } from "./index.
|
|
1
|
+
import { InvalidAddressError as s } from "./index.web114.js";
|
|
2
|
+
import { isAddress as a } from "./index.web93.js";
|
|
3
3
|
function r(n) {
|
|
4
4
|
if (typeof n == "string") {
|
|
5
5
|
if (!a(n, { strict: !1 }))
|
package/dist/esm/index.web70.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Analytics as E } from "./index.web2.js";
|
|
2
2
|
import "./index.web3.js";
|
|
3
3
|
import { VERSION as r } from "./index.web8.js";
|
|
4
|
-
import "./index.
|
|
4
|
+
import "./index.web50.js";
|
|
5
5
|
import { APIError as c, ErrorType as P, HttpErrorType as U, OAuth2ProviderType as F, SendEvmTransactionWithEndUserAccountBodyNetwork as I, SendSolanaTransactionWithEndUserAccountBodyNetwork as d } from "@coinbase/cdp-api-client";
|
|
6
6
|
import "@solana/web3.js";
|
|
7
7
|
import "bs58";
|
package/dist/esm/index.web74.js
CHANGED
package/dist/esm/index.web75.js
CHANGED
package/dist/esm/index.web79.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./index.
|
|
2
|
-
import { BaseError as P } from "./index.
|
|
3
|
-
import { parse as y, parseError as j, InternalError as g } from "./index.
|
|
1
|
+
import "./index.web82.js";
|
|
2
|
+
import { BaseError as P } from "./index.web83.js";
|
|
3
|
+
import { parse as y, parseError as j, InternalError as g } from "./index.web84.js";
|
|
4
4
|
class u extends Error {
|
|
5
5
|
constructor(e, t) {
|
|
6
6
|
super(t), Object.defineProperty(this, "name", {
|
package/dist/esm/index.web8.js
CHANGED
package/dist/esm/index.web80.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { handleAccounts as t } from "./index.
|
|
2
|
-
import { handleEthSign as e } from "./index.
|
|
3
|
-
import { handleGetCallsStatus as a } from "./index.
|
|
4
|
-
import { handleGetCapabilities as n } from "./index.
|
|
5
|
-
import { handlePersonalSign as o } from "./index.
|
|
6
|
-
import { handleRequestAccounts as r } from "./index.
|
|
7
|
-
import { handleSendCalls as i } from "./index.
|
|
8
|
-
import { handleSendTransaction as l } from "./index.
|
|
9
|
-
import { handleSignTypedData as h } from "./index.
|
|
10
|
-
import { handleChainId as s } from "./index.
|
|
11
|
-
import { handleDisconnect as m } from "./index.
|
|
12
|
-
import { handleSwitchEthereumChain as d } from "./index.
|
|
1
|
+
import { handleAccounts as t } from "./index.web131.js";
|
|
2
|
+
import { handleEthSign as e } from "./index.web132.js";
|
|
3
|
+
import { handleGetCallsStatus as a } from "./index.web133.js";
|
|
4
|
+
import { handleGetCapabilities as n } from "./index.web134.js";
|
|
5
|
+
import { handlePersonalSign as o } from "./index.web135.js";
|
|
6
|
+
import { handleRequestAccounts as r } from "./index.web136.js";
|
|
7
|
+
import { handleSendCalls as i } from "./index.web137.js";
|
|
8
|
+
import { handleSendTransaction as l } from "./index.web138.js";
|
|
9
|
+
import { handleSignTypedData as h } from "./index.web139.js";
|
|
10
|
+
import { handleChainId as s } from "./index.web140.js";
|
|
11
|
+
import { handleDisconnect as m } from "./index.web141.js";
|
|
12
|
+
import { handleSwitchEthereumChain as d } from "./index.web142.js";
|
|
13
13
|
function D() {
|
|
14
14
|
return {
|
|
15
15
|
eth_accounts: t,
|
package/dist/esm/index.web81.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { handleChainId as t } from "./index.
|
|
2
|
-
import { handleDisconnect as e } from "./index.
|
|
3
|
-
import { handleSwitchEthereumChain as a } from "./index.
|
|
4
|
-
import { handleAccounts as n } from "./index.
|
|
5
|
-
import { handleEthSign as o } from "./index.
|
|
6
|
-
import { handleGetCallsStatus as r } from "./index.
|
|
7
|
-
import { handleGetCapabilities as i } from "./index.
|
|
8
|
-
import { handlePersonalSign as l } from "./index.
|
|
9
|
-
import { handleRequestAccounts as h } from "./index.
|
|
10
|
-
import { handleSendCalls as m } from "./index.
|
|
11
|
-
import { handleSendTransaction as s } from "./index.
|
|
12
|
-
import { handleSignTypedData as d } from "./index.
|
|
1
|
+
import { handleChainId as t } from "./index.web140.js";
|
|
2
|
+
import { handleDisconnect as e } from "./index.web141.js";
|
|
3
|
+
import { handleSwitchEthereumChain as a } from "./index.web142.js";
|
|
4
|
+
import { handleAccounts as n } from "./index.web143.js";
|
|
5
|
+
import { handleEthSign as o } from "./index.web144.js";
|
|
6
|
+
import { handleGetCallsStatus as r } from "./index.web145.js";
|
|
7
|
+
import { handleGetCapabilities as i } from "./index.web146.js";
|
|
8
|
+
import { handlePersonalSign as l } from "./index.web147.js";
|
|
9
|
+
import { handleRequestAccounts as h } from "./index.web148.js";
|
|
10
|
+
import { handleSendCalls as m } from "./index.web149.js";
|
|
11
|
+
import { handleSendTransaction as s } from "./index.web150.js";
|
|
12
|
+
import { handleSignTypedData as d } from "./index.web151.js";
|
|
13
13
|
function E() {
|
|
14
14
|
return {
|
|
15
15
|
eth_accounts: n,
|
package/dist/esm/index.web82.js
CHANGED
package/dist/esm/index.web83.js
CHANGED
|
@@ -1,4 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
import { getVersion as n } from "./index.web152.js";
|
|
2
|
+
class s extends Error {
|
|
3
|
+
constructor(r, e = {}) {
|
|
4
|
+
const a = (() => {
|
|
5
|
+
if (e.cause instanceof s) {
|
|
6
|
+
if (e.cause.details)
|
|
7
|
+
return e.cause.details;
|
|
8
|
+
if (e.cause.shortMessage)
|
|
9
|
+
return e.cause.shortMessage;
|
|
10
|
+
}
|
|
11
|
+
return e.cause && "details" in e.cause && typeof e.cause.details == "string" ? e.cause.details : e.cause?.message ? e.cause.message : e.details;
|
|
12
|
+
})(), u = e.cause instanceof s && e.cause.docsPath || e.docsPath, c = `https://oxlib.sh${u ?? ""}`, l = [
|
|
13
|
+
r || "An error occurred.",
|
|
14
|
+
...e.metaMessages ? ["", ...e.metaMessages] : [],
|
|
15
|
+
...a || u ? [
|
|
16
|
+
"",
|
|
17
|
+
a ? `Details: ${a}` : void 0,
|
|
18
|
+
u ? `See: ${c}` : void 0
|
|
19
|
+
] : []
|
|
20
|
+
].filter((d) => typeof d == "string").join(`
|
|
21
|
+
`);
|
|
22
|
+
super(l, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
|
|
23
|
+
enumerable: !0,
|
|
24
|
+
configurable: !0,
|
|
25
|
+
writable: !0,
|
|
26
|
+
value: void 0
|
|
27
|
+
}), Object.defineProperty(this, "docs", {
|
|
28
|
+
enumerable: !0,
|
|
29
|
+
configurable: !0,
|
|
30
|
+
writable: !0,
|
|
31
|
+
value: void 0
|
|
32
|
+
}), Object.defineProperty(this, "docsPath", {
|
|
33
|
+
enumerable: !0,
|
|
34
|
+
configurable: !0,
|
|
35
|
+
writable: !0,
|
|
36
|
+
value: void 0
|
|
37
|
+
}), Object.defineProperty(this, "shortMessage", {
|
|
38
|
+
enumerable: !0,
|
|
39
|
+
configurable: !0,
|
|
40
|
+
writable: !0,
|
|
41
|
+
value: void 0
|
|
42
|
+
}), Object.defineProperty(this, "cause", {
|
|
43
|
+
enumerable: !0,
|
|
44
|
+
configurable: !0,
|
|
45
|
+
writable: !0,
|
|
46
|
+
value: void 0
|
|
47
|
+
}), Object.defineProperty(this, "name", {
|
|
48
|
+
enumerable: !0,
|
|
49
|
+
configurable: !0,
|
|
50
|
+
writable: !0,
|
|
51
|
+
value: "BaseError"
|
|
52
|
+
}), Object.defineProperty(this, "version", {
|
|
53
|
+
enumerable: !0,
|
|
54
|
+
configurable: !0,
|
|
55
|
+
writable: !0,
|
|
56
|
+
value: `ox@${n()}`
|
|
57
|
+
}), this.cause = e.cause, this.details = a, this.docs = c, this.docsPath = u, this.shortMessage = r;
|
|
58
|
+
}
|
|
59
|
+
walk(r) {
|
|
60
|
+
return i(this, r);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function i(t, r) {
|
|
64
|
+
return r?.(t) ? t : t && typeof t == "object" && "cause" in t && t.cause ? i(t.cause, r) : r ? null : t;
|
|
65
|
+
}
|
|
2
66
|
export {
|
|
3
|
-
|
|
67
|
+
s as BaseError
|
|
4
68
|
};
|