@imtbl/sdk 0.44.2 → 0.44.4-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/README.md +1 -144
- package/dist/blockchain_data.js +1 -1
- package/dist/browser/checkout/sdk.js +3 -3
- package/dist/browser/checkout/widgets.js +54 -54
- package/dist/checkout.d.ts +12553 -2151
- package/dist/checkout.js +94 -59
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +98 -62
- package/dist/index.d.ts +10410 -2
- package/dist/index.js +98 -62
- package/dist/passport.d.ts +11314 -552
- package/dist/passport.js +4 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -28,147 +28,4 @@ Please note that alpha releases are still in development and may contain bugs or
|
|
|
28
28
|
|
|
29
29
|
## Changelog
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
#### Changed (breaking)
|
|
34
|
-
|
|
35
|
-
##### The `connectImx` method no longer registers users on Immutable X
|
|
36
|
-
|
|
37
|
-
This method was previously responsible for automatically [registering a user](https://docs.immutable.com/docs/x/how-to-register-users/)
|
|
38
|
-
the first time they connect to Immutable X.
|
|
39
|
-
|
|
40
|
-
###### Before
|
|
41
|
-
|
|
42
|
-
```ts
|
|
43
|
-
const passport = new Passport(...);
|
|
44
|
-
const provider = await passport.connectImx();
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
###### After
|
|
48
|
-
|
|
49
|
-
Passport now allows you to manage the registration process yourself through the `isRegisteredOffchain` and
|
|
50
|
-
`registerOffchain` functions.
|
|
51
|
-
|
|
52
|
-
This gives you the advantage of potentially displaying a custom UI informing the user that they’re being registered,
|
|
53
|
-
as opposed to the previous experience where the user was waiting until the `connectImx` step completed all the steps.
|
|
54
|
-
|
|
55
|
-
```ts
|
|
56
|
-
const passport = new Passport(...);
|
|
57
|
-
const provider = await passport.connectImx();
|
|
58
|
-
|
|
59
|
-
if (!await provider.isRegisteredOffchain()) {
|
|
60
|
-
// Potentially inform the user the user that are about to be
|
|
61
|
-
// registered on Immutable X
|
|
62
|
-
await provider.registerOffchain();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// The user's wallet is registered, they are now ready to use Immutable X
|
|
66
|
-
const response = await provider.transfer(...);
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
##### Passport is now a client-side only module
|
|
70
|
-
|
|
71
|
-
This change is only relevant if you are using server-side rendering (SSR).
|
|
72
|
-
|
|
73
|
-
Passport has a dependency on browser-specific primitives, such as the `window` object, and therefore is intended to be
|
|
74
|
-
used in a client-side environment only.
|
|
75
|
-
|
|
76
|
-
Depending on your framework, you may need to update how you were instantiating the Passport instance to ensure
|
|
77
|
-
this happens on the client.
|
|
78
|
-
|
|
79
|
-
### [0.28.2] - 30-10-2023
|
|
80
|
-
|
|
81
|
-
#### Added
|
|
82
|
-
|
|
83
|
-
We have added a new `login` method that allows you to authenticate users without necessarily instantiating their wallets.
|
|
84
|
-
|
|
85
|
-
##### Before
|
|
86
|
-
|
|
87
|
-
Previously, you had to authenticate users as follows:
|
|
88
|
-
|
|
89
|
-
```ts
|
|
90
|
-
const passport = new Passport(...);
|
|
91
|
-
const provider = await passport.connectImx();
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
The `connectImx` function performed the following tasks under the hood:
|
|
95
|
-
|
|
96
|
-
- Completed the OIDC authentication flow to log the user in
|
|
97
|
-
- Instantiated their wallet based on their identity
|
|
98
|
-
- Registered the user on the Immutable X ecosystem
|
|
99
|
-
|
|
100
|
-
Although this simple API was simple and convenient, we have decided to decouple it into explicit methods based on customer feedback to provide you with more flexibility.
|
|
101
|
-
|
|
102
|
-
##### After
|
|
103
|
-
|
|
104
|
-
From now on, you can authenticate users as follows:
|
|
105
|
-
|
|
106
|
-
```ts
|
|
107
|
-
const passport = new Passport(...);
|
|
108
|
-
const user = await passport.login();
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
The login method only authenticates the user. This allows you to separate the authentication process from wallet
|
|
112
|
-
instantiation and the registration step, giving you greater control and flexibility in managing user
|
|
113
|
-
authentication within your application.
|
|
114
|
-
|
|
115
|
-
This is especially useful if your application only uses Passport for authentication and does not leverage
|
|
116
|
-
the wallet component.
|
|
117
|
-
|
|
118
|
-
However, if you want to instantiate the wallet, you can do so as follows:
|
|
119
|
-
|
|
120
|
-
```ts
|
|
121
|
-
const passport = new Passport(...);
|
|
122
|
-
const user = await passport.login(); // Optional
|
|
123
|
-
|
|
124
|
-
const provider = await passport.connectImx();
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Depending on your application, you may decide to only log in the user when they click on “Sign in with Passport”
|
|
128
|
-
using `login`, and instantiate the wallet using `connectImx` in the background, ensuring a seamless
|
|
129
|
-
and user-friendly experience.
|
|
130
|
-
|
|
131
|
-
Note that the `connectImx` method will attempt to log the user in automatically if you haven’t explicitly called login
|
|
132
|
-
before connecting to Immutable X.
|
|
133
|
-
|
|
134
|
-
The following code will have the same outcome as the snippet above, but it's important to note that the `Promise`
|
|
135
|
-
returned by `connectImx` will not resolve until the user has successfully logged in and their wallet has been
|
|
136
|
-
instantiated, potentially leading to a less streamlined user experience.
|
|
137
|
-
|
|
138
|
-
```ts
|
|
139
|
-
const passport = new Passport(...);
|
|
140
|
-
const provider = await passport.connectImx();
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
Find more information about authenticating users in the [Passport Login documentation](https://docs.immutable.com/docs/x/passport/identity/login#1-trigger-the-login-process).
|
|
144
|
-
|
|
145
|
-
#### Deprecated
|
|
146
|
-
|
|
147
|
-
Following the introduction of the `login` method, we have deprecated the `connectImxSilent` method.
|
|
148
|
-
|
|
149
|
-
This method was previously used for [rehydrating the session of previously authenticated users](https://docs.immutable.com/docs/x/passport/identity/login/#3-maintaining-the-login-status)
|
|
150
|
-
on page reloads.
|
|
151
|
-
|
|
152
|
-
##### Before
|
|
153
|
-
|
|
154
|
-
```ts
|
|
155
|
-
// On page load, attempt to re-authenticate the user without propting them to
|
|
156
|
-
// sign in based on their cached session and initialise the wallet.
|
|
157
|
-
const provider = await passport.connectImxSilent();
|
|
158
|
-
|
|
159
|
-
if (!provider) {
|
|
160
|
-
// The user session couldn't be recovered. The user will have to explicitly
|
|
161
|
-
// sign in again by clicking a button that trigger passport.connectImx()
|
|
162
|
-
}
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
##### After
|
|
166
|
-
```ts
|
|
167
|
-
// On page load, attempt to re-authenticate the user without propting them to
|
|
168
|
-
// sign in based on their cached session.
|
|
169
|
-
const user = await passport.login({ useCachedSession: true });
|
|
170
|
-
if (user) {
|
|
171
|
-
// The user session is still valid, we can now initialise the wallet
|
|
172
|
-
const provider = await passport.connectImx();
|
|
173
|
-
}
|
|
174
|
-
```
|
|
31
|
+
Please visit the [GitHub Releases](https://github.com/immutable/ts-immutable-sdk/releases) page for changelog information.
|
package/dist/blockchain_data.js
CHANGED
|
@@ -4153,7 +4153,7 @@ class APIError extends Error {
|
|
|
4153
4153
|
|
|
4154
4154
|
/* eslint-disable implicit-arrow-linebreak */
|
|
4155
4155
|
const defaultHeaders = {
|
|
4156
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.
|
|
4156
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.44.4-alpha.1',
|
|
4157
4157
|
};
|
|
4158
4158
|
/**
|
|
4159
4159
|
* createAPIConfiguration to create a custom Configuration
|