@imtbl/sdk 0.28.5 → 0.28.6-alpha

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.
@@ -9732,12 +9732,6 @@ interface IMXProvider {
9732
9732
  * @return {Promise<RegisterUserResponse>} Returns a promise that resolves with the user registration response
9733
9733
  */
9734
9734
  registerOffchain(): Promise<RegisterUserResponse>;
9735
- /**
9736
- * Checks if a User is registered off-chain
9737
- *
9738
- * @return {Promise<boolean>} Returns a promise that resolves with true if the User is registered with IMX, false otherwise
9739
- */
9740
- isRegisteredOffchain(): Promise<boolean>;
9741
9735
  /**
9742
9736
  * Checks if a User is registered on-chain
9743
9737
  *
@@ -10190,7 +10184,7 @@ type UserProfile = {
10190
10184
  };
10191
10185
  declare enum Networks {
10192
10186
  PRODUCTION = "mainnet",
10193
- SANDBOX = "sepolia"
10187
+ SANDBOX = "goerli"
10194
10188
  }
10195
10189
  interface OidcConfiguration {
10196
10190
  clientId: string;
package/dist/passport.js CHANGED
@@ -2072,7 +2072,7 @@ class MultiRollupApiClients {
2072
2072
  }
2073
2073
 
2074
2074
  // eslint-disable-next-line @typescript-eslint/naming-convention
2075
- const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.28.5' };
2075
+ const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.28.6-alpha' };
2076
2076
  const createConfig = ({ basePath, headers, }) => {
2077
2077
  if (!basePath.trim()) {
2078
2078
  throw Error('basePath can not be empty');
@@ -2128,7 +2128,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
2128
2128
  chainID,
2129
2129
  coreContractAddress,
2130
2130
  registrationContractAddress,
2131
- sdkVersion: 'ts-immutable-sdk-0.28.5',
2131
+ sdkVersion: 'ts-immutable-sdk-0.28.6-alpha',
2132
2132
  });
2133
2133
  /**
2134
2134
  * Sets `sdkVersion` at the time of build
@@ -7056,63 +7056,39 @@ class AuthManager {
7056
7056
  }
7057
7057
  }
7058
7058
 
7059
- const lazyLoad = (promiseToAwait, initialiseFunction) => (promiseToAwait().then(initialiseFunction));
7060
- const lazyDocumentReady = (initialiseFunction) => {
7061
- const documentReadyPromise = () => new Promise((resolve) => {
7062
- if (window.document.readyState === 'complete') {
7063
- resolve();
7064
- }
7065
- else {
7066
- const onReadyStateChange = () => {
7067
- if (window.document.readyState === 'complete') {
7068
- resolve();
7069
- window.document.removeEventListener('readystatechange', onReadyStateChange);
7070
- }
7071
- };
7072
- window.document.addEventListener('readystatechange', onReadyStateChange);
7073
- }
7074
- });
7075
- return lazyLoad(documentReadyPromise, initialiseFunction);
7076
- };
7077
-
7078
7059
  class MagicAdapter {
7079
7060
  config;
7080
- lazyMagicClient;
7061
+ magicClient;
7081
7062
  constructor(config) {
7082
7063
  this.config = config;
7083
7064
  if (typeof window !== 'undefined') {
7084
- this.lazyMagicClient = lazyDocumentReady(() => {
7085
- const client = new Magic(this.config.magicPublishableApiKey, {
7086
- extensions: [new OpenIdExtension()],
7087
- network: this.config.network,
7088
- });
7089
- client.preload();
7090
- return client;
7091
- });
7065
+ this.magicClient = this.initMagicClient();
7066
+ this.magicClient.preload();
7092
7067
  }
7093
7068
  }
7094
- get magicClient() {
7095
- if (!this.lazyMagicClient) {
7096
- throw new Error('Cannot perform this action outside of the browser');
7097
- }
7098
- return this.lazyMagicClient;
7099
- }
7100
7069
  async login(idToken) {
7101
7070
  return withPassportError(async () => {
7102
- const magicClient = await this.magicClient;
7103
- await magicClient.openid.loginWithOIDC({
7071
+ if (!this.magicClient) {
7072
+ this.magicClient = this.initMagicClient();
7073
+ }
7074
+ await this.magicClient.openid.loginWithOIDC({
7104
7075
  jwt: idToken,
7105
7076
  providerId: this.config.magicProviderId,
7106
7077
  });
7107
- return magicClient.rpcProvider;
7078
+ return this.magicClient.rpcProvider;
7108
7079
  }, PassportErrorType.WALLET_CONNECTION_ERROR);
7109
7080
  }
7110
7081
  async logout() {
7111
- const magicClient = await this.magicClient;
7112
- if (magicClient.user) {
7113
- await magicClient.user.logout();
7082
+ if (this.magicClient?.user) {
7083
+ await this.magicClient.user.logout();
7114
7084
  }
7115
7085
  }
7086
+ initMagicClient() {
7087
+ return new Magic(this.config.magicPublishableApiKey, {
7088
+ extensions: [new OpenIdExtension()],
7089
+ network: this.config.network,
7090
+ });
7091
+ }
7116
7092
  }
7117
7093
 
7118
7094
  const getStarkSigner = async (signer) => withPassportError(async () => {
@@ -7339,7 +7315,7 @@ var PassportEvents;
7339
7315
  var Networks;
7340
7316
  (function (Networks) {
7341
7317
  Networks["PRODUCTION"] = "mainnet";
7342
- Networks["SANDBOX"] = "sepolia";
7318
+ Networks["SANDBOX"] = "goerli";
7343
7319
  })(Networks || (Networks = {}));
7344
7320
 
7345
7321
  async function exchangeTransfer({ user, starkSigner, request, exchangesApi, }) {
@@ -7688,11 +7664,6 @@ class PassportImxProvider {
7688
7664
  }
7689
7665
  // TODO: Remove once implemented
7690
7666
  // eslint-disable-next-line class-methods-use-this
7691
- isRegisteredOffchain() {
7692
- throw new PassportError('Operation not supported', PassportErrorType.OPERATION_NOT_SUPPORTED_ERROR);
7693
- }
7694
- // TODO: Remove once implemented
7695
- // eslint-disable-next-line class-methods-use-this
7696
7667
  isRegisteredOnchain() {
7697
7668
  throw new PassportError('Operation not supported', PassportErrorType.OPERATION_NOT_SUPPORTED_ERROR);
7698
7669
  }
@@ -833,12 +833,6 @@ interface IMXProvider {
833
833
  * @return {Promise<RegisterUserResponse>} Returns a promise that resolves with the user registration response
834
834
  */
835
835
  registerOffchain(): Promise<RegisterUserResponse>;
836
- /**
837
- * Checks if a User is registered off-chain
838
- *
839
- * @return {Promise<boolean>} Returns a promise that resolves with true if the User is registered with IMX, false otherwise
840
- */
841
- isRegisteredOffchain(): Promise<boolean>;
842
836
  /**
843
837
  * Checks if a User is registered on-chain
844
838
  *
@@ -916,7 +910,6 @@ declare class GenericIMXProvider implements IMXProvider {
916
910
  private readonly signers;
917
911
  constructor(config: ProviderConfiguration$1, ethSigner: Signer, starkSigner: StarkSigner);
918
912
  getAddress(): Promise<string>;
919
- isRegisteredOffchain(): Promise<boolean>;
920
913
  registerOffchain(): Promise<RegisterUserResponse>;
921
914
  batchNftTransfer(request: Array<NftTransferDetails>): Promise<CreateTransferResponse>;
922
915
  cancelOrder(request: GetSignableCancelOrderRequest): Promise<CancelOrderResponse>;
package/dist/provider.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { Config, TransfersApi, OrdersApi, UsersApi, Contracts, TradesApi, ExchangesApi, WithdrawalsApi, MintsApi, DepositsApi, EncodingApi, TokensApi } from '@imtbl/core-sdk';
2
2
  import BN from 'bn.js';
3
3
  import * as encUtils from 'enc-utils';
4
- import { AxiosError } from 'axios';
5
4
  import { parseUnits } from '@ethersproject/units';
6
5
  import { BigNumber } from '@ethersproject/bignumber';
7
6
  import { ethers } from 'ethers';
8
7
  import detectEthereumProvider from '@metamask/detect-provider';
8
+ import 'axios';
9
9
 
10
10
  // used to sign message with L1 keys. Used for registration
11
11
  function serializeEthSignature(sig) {
@@ -285,22 +285,6 @@ async function registerOffchain(signers, config) {
285
285
  });
286
286
  return registeredUser.data;
287
287
  }
288
- async function isRegisteredOffchain(ethAddress, config) {
289
- try {
290
- const usersApi = new UsersApi(config.immutableXConfig.apiConfiguration);
291
- const getUsersResult = await usersApi.getUsers({
292
- user: ethAddress,
293
- });
294
- const { accounts } = getUsersResult.data;
295
- return accounts?.length > 0;
296
- }
297
- catch (ex) {
298
- if (ex instanceof AxiosError && ex.response?.status === 404) {
299
- return false;
300
- }
301
- throw ex;
302
- }
303
- }
304
288
  async function isRegisteredOnChain(starkPublicKey, ethSigner, config) {
305
289
  await validateChain(ethSigner, config.immutableXConfig);
306
290
  const registrationContract = Contracts.Registration.connect(config.immutableXConfig.ethConfiguration.registrationContractAddress, ethSigner);
@@ -836,11 +820,7 @@ class GenericIMXProvider {
836
820
  this.signers = { ethSigner, starkSigner };
837
821
  }
838
822
  async getAddress() {
839
- return this.signers.ethSigner.getAddress();
840
- }
841
- async isRegisteredOffchain() {
842
- const ethAddress = await this.getAddress();
843
- return isRegisteredOffchain(ethAddress, this.config);
823
+ return await this.signers.ethSigner.getAddress();
844
824
  }
845
825
  registerOffchain() {
846
826
  return registerOffchain(this.signers, this.config);
package/package.json CHANGED
@@ -1,32 +1,47 @@
1
1
  {
2
2
  "name": "@imtbl/sdk",
3
3
  "description": "Immutable Unified SDK",
4
- "version": "0.28.5",
4
+ "version": "0.28.6-alpha",
5
5
  "author": "Immutable",
6
6
  "browser": "./dist/index.browser.js",
7
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
8
8
  "dependencies": {
9
9
  "@0xsequence/abi": "^0.43.34",
10
10
  "@0xsequence/config": "^0.43.34",
11
+ "@biom3/design-tokens": "0.2.4-beta",
12
+ "@biom3/react": "^0.10.12",
11
13
  "@ethersproject/abi": "^5.7.0",
12
14
  "@ethersproject/abstract-signer": "^5.7.0",
13
15
  "@ethersproject/providers": "^5.7.2",
14
16
  "@ethersproject/wallet": "^5.7.0",
15
17
  "@imtbl/core-sdk": "^2.4.0",
18
+ "@imtbl/react-analytics": "0.2.1-alpha",
16
19
  "@jest/globals": "^29.5.0",
17
- "@magic-ext/oidc": "^4.2.0",
20
+ "@magic-ext/oidc": "^1.0.1",
18
21
  "@metamask/detect-provider": "^2.0.0",
19
22
  "@opensea/seaport-js": "2.0.7",
20
23
  "@uniswap/router-sdk": "^1.4.0",
21
24
  "@uniswap/sdk-core": "^3.0.1",
22
25
  "@uniswap/v3-sdk": "^3.9.0",
26
+ "assert": "^2.0.0",
23
27
  "axios": "^1.3.5",
24
28
  "bn.js": "^5.2.1",
29
+ "buffer": "^6.0.3",
30
+ "crypto-browserify": "^3.12.0",
25
31
  "enc-utils": "^3.0.0",
26
32
  "ethers": "^5.7.2",
33
+ "https-browserify": "^1.0.0",
27
34
  "jwt-decode": "^3.1.2",
28
- "magic-sdk": "^21.2.0",
29
- "oidc-client-ts": "^2.2.1"
35
+ "magic-sdk": "^13.3.1",
36
+ "oidc-client-ts": "^2.2.1",
37
+ "os-browserify": "^0.3.0",
38
+ "pako": "^2.1.0",
39
+ "react": "^18.2.0",
40
+ "react-dom": "^18.2.0",
41
+ "react-router-dom": "^6.11.0",
42
+ "stream-browserify": "^3.0.0",
43
+ "stream-http": "^3.2.0",
44
+ "url": "^0.11.0"
30
45
  },
31
46
  "devDependencies": {
32
47
  "@imtbl/blockchain-data": "0.0.0",
@@ -94,10 +109,6 @@
94
109
  "./checkout_sdk": {
95
110
  "types": "./dist/checkout_sdk.d.ts",
96
111
  "import": "./dist/checkout_sdk.js"
97
- },
98
- "./checkout_widgets": {
99
- "types": "./dist/checkout_widgets.d.ts",
100
- "import": "./dist/checkout_widgets.js"
101
112
  }
102
113
  },
103
114
  "files": [