@edge-markets/connect 1.2.0 → 1.4.0
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/README.md +11 -18
- package/dist/index.d.mts +437 -292
- package/dist/index.d.ts +437 -292
- package/dist/index.js +23 -33
- package/dist/index.mjs +21 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @edge-markets/connect
|
|
2
2
|
|
|
3
3
|
Core types, configuration, and utilities for EDGE Connect SDK.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @edge-markets/connect
|
|
9
9
|
# or
|
|
10
|
-
pnpm add @
|
|
10
|
+
pnpm add @edge-markets/connect
|
|
11
11
|
# or
|
|
12
|
-
yarn add @
|
|
12
|
+
yarn add @edge-markets/connect
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
@@ -24,7 +24,7 @@ import type {
|
|
|
24
24
|
Balance,
|
|
25
25
|
Transfer,
|
|
26
26
|
EdgeTokens,
|
|
27
|
-
} from '@
|
|
27
|
+
} from '@edge-markets/connect'
|
|
28
28
|
|
|
29
29
|
// Types are generated from the OpenAPI spec
|
|
30
30
|
const user: User = {
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
getEnvironmentConfig,
|
|
46
46
|
EDGE_SCOPES,
|
|
47
47
|
formatScopeForEnvironment,
|
|
48
|
-
} from '@
|
|
48
|
+
} from '@edge-markets/connect'
|
|
49
49
|
|
|
50
50
|
const config = getEnvironmentConfig('staging')
|
|
51
51
|
console.log(config.apiBaseUrl) // https://...
|
|
@@ -64,10 +64,11 @@ import {
|
|
|
64
64
|
EdgeError,
|
|
65
65
|
EdgeConsentRequiredError,
|
|
66
66
|
isConsentRequiredError,
|
|
67
|
-
} from '@
|
|
67
|
+
} from '@edge-markets/connect'
|
|
68
68
|
|
|
69
69
|
try {
|
|
70
|
-
const
|
|
70
|
+
const client = edge.forUser(accessToken)
|
|
71
|
+
const balance = await client.getBalance()
|
|
71
72
|
} catch (error) {
|
|
72
73
|
if (isConsentRequiredError(error)) {
|
|
73
74
|
// User needs to grant consent - redirect to EdgeLink
|
|
@@ -124,17 +125,9 @@ isApiError(error) // API error
|
|
|
124
125
|
|
|
125
126
|
## Related Packages
|
|
126
127
|
|
|
127
|
-
- `@
|
|
128
|
-
- `@
|
|
128
|
+
- `@edge-markets/connect-link` - Browser SDK for popup authentication
|
|
129
|
+
- `@edge-markets/connect-node` - Server SDK for token exchange and API calls
|
|
129
130
|
|
|
130
131
|
## License
|
|
131
132
|
|
|
132
133
|
MIT
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|