@imtbl/sdk 0.29.0-alpha.1 → 0.30.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/dist/blockchain_data.js +151 -12
- package/dist/browser/checkout/sdk.js +6 -6
- package/dist/browser/checkout/widgets.js +1 -1
- package/dist/checkout_sdk.js +152 -13
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +12 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +226 -20
- package/dist/index.js +226 -20
- package/dist/passport.js +202 -16
- package/package.json +1 -4
package/dist/index.cjs
CHANGED
|
@@ -2642,14 +2642,18 @@ const PassportApiAxiosParamCreator = function (configuration) {
|
|
|
2642
2642
|
/**
|
|
2643
2643
|
* Create a counterfactual address for a user based on their Ethereum address
|
|
2644
2644
|
* @summary Create a counterfactual address
|
|
2645
|
+
* @param {string} chainName
|
|
2645
2646
|
* @param {CreateCounterfactualAddressRequest} createCounterfactualAddressRequest
|
|
2646
2647
|
* @param {*} [options] Override http request option.
|
|
2647
2648
|
* @throws {RequiredError}
|
|
2648
2649
|
*/
|
|
2649
|
-
createCounterfactualAddress: async (createCounterfactualAddressRequest, options = {}) => {
|
|
2650
|
+
createCounterfactualAddress: async (chainName, createCounterfactualAddressRequest, options = {}) => {
|
|
2651
|
+
// verify required parameter 'chainName' is not null or undefined
|
|
2652
|
+
assertParamExists$1('createCounterfactualAddress', 'chainName', chainName);
|
|
2650
2653
|
// verify required parameter 'createCounterfactualAddressRequest' is not null or undefined
|
|
2651
2654
|
assertParamExists$1('createCounterfactualAddress', 'createCounterfactualAddressRequest', createCounterfactualAddressRequest);
|
|
2652
|
-
const localVarPath = `/passport
|
|
2655
|
+
const localVarPath = `/v1/chains/{chain_name}/passport/counterfactual-address`
|
|
2656
|
+
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
|
|
2653
2657
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
2654
2658
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
|
|
2655
2659
|
let baseOptions;
|
|
@@ -2672,16 +2676,85 @@ const PassportApiAxiosParamCreator = function (configuration) {
|
|
|
2672
2676
|
options: localVarRequestOptions,
|
|
2673
2677
|
};
|
|
2674
2678
|
},
|
|
2679
|
+
/**
|
|
2680
|
+
* Create a counterfactual address for a user based on their Ethereum address
|
|
2681
|
+
* @summary Create a counterfactual address
|
|
2682
|
+
* @param {CreateCounterfactualAddressRequestDeprecated} createCounterfactualAddressRequestDeprecated
|
|
2683
|
+
* @param {*} [options] Override http request option.
|
|
2684
|
+
* @throws {RequiredError}
|
|
2685
|
+
*/
|
|
2686
|
+
createCounterfactualAddressDeprecated: async (createCounterfactualAddressRequestDeprecated, options = {}) => {
|
|
2687
|
+
// verify required parameter 'createCounterfactualAddressRequestDeprecated' is not null or undefined
|
|
2688
|
+
assertParamExists$1('createCounterfactualAddressDeprecated', 'createCounterfactualAddressRequestDeprecated', createCounterfactualAddressRequestDeprecated);
|
|
2689
|
+
const localVarPath = `/passport-mr/v1/counterfactual-address`;
|
|
2690
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
2691
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
|
|
2692
|
+
let baseOptions;
|
|
2693
|
+
if (configuration) {
|
|
2694
|
+
baseOptions = configuration.baseOptions;
|
|
2695
|
+
}
|
|
2696
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
2697
|
+
const localVarHeaderParameter = {};
|
|
2698
|
+
const localVarQueryParameter = {};
|
|
2699
|
+
// authentication BearerAuth required
|
|
2700
|
+
// http bearer authentication required
|
|
2701
|
+
await setBearerAuthToObject$1(localVarHeaderParameter, configuration);
|
|
2702
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
2703
|
+
setSearchParams$1(localVarUrlObj, localVarQueryParameter);
|
|
2704
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
2705
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
2706
|
+
localVarRequestOptions.data = serializeDataIfNeeded$1(createCounterfactualAddressRequestDeprecated, localVarRequestOptions, configuration);
|
|
2707
|
+
return {
|
|
2708
|
+
url: toPathString$1(localVarUrlObj),
|
|
2709
|
+
options: localVarRequestOptions,
|
|
2710
|
+
};
|
|
2711
|
+
},
|
|
2675
2712
|
/**
|
|
2676
2713
|
* Get all the Ethereum linked addresses for a user based on its userId
|
|
2677
2714
|
* @summary Get Ethereum linked addresses for a user
|
|
2678
2715
|
* @param {string} userId The user\'s userId
|
|
2716
|
+
* @param {string} chainName
|
|
2679
2717
|
* @param {*} [options] Override http request option.
|
|
2680
2718
|
* @throws {RequiredError}
|
|
2681
2719
|
*/
|
|
2682
|
-
getLinkedAddresses: async (userId, options = {}) => {
|
|
2720
|
+
getLinkedAddresses: async (userId, chainName, options = {}) => {
|
|
2683
2721
|
// verify required parameter 'userId' is not null or undefined
|
|
2684
2722
|
assertParamExists$1('getLinkedAddresses', 'userId', userId);
|
|
2723
|
+
// verify required parameter 'chainName' is not null or undefined
|
|
2724
|
+
assertParamExists$1('getLinkedAddresses', 'chainName', chainName);
|
|
2725
|
+
const localVarPath = `/v1/chains/{chain_name}/passport/users/{user_id}/linked-addresses`
|
|
2726
|
+
.replace(`{${"user_id"}}`, encodeURIComponent(String(userId)))
|
|
2727
|
+
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
|
|
2728
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
2729
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
|
|
2730
|
+
let baseOptions;
|
|
2731
|
+
if (configuration) {
|
|
2732
|
+
baseOptions = configuration.baseOptions;
|
|
2733
|
+
}
|
|
2734
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
2735
|
+
const localVarHeaderParameter = {};
|
|
2736
|
+
const localVarQueryParameter = {};
|
|
2737
|
+
// authentication BearerAuth required
|
|
2738
|
+
// http bearer authentication required
|
|
2739
|
+
await setBearerAuthToObject$1(localVarHeaderParameter, configuration);
|
|
2740
|
+
setSearchParams$1(localVarUrlObj, localVarQueryParameter);
|
|
2741
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
2742
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
2743
|
+
return {
|
|
2744
|
+
url: toPathString$1(localVarUrlObj),
|
|
2745
|
+
options: localVarRequestOptions,
|
|
2746
|
+
};
|
|
2747
|
+
},
|
|
2748
|
+
/**
|
|
2749
|
+
* Get all the Ethereum linked addresses for a user based on its userId
|
|
2750
|
+
* @summary Get Ethereum linked addresses for a user
|
|
2751
|
+
* @param {string} userId The user\'s userId
|
|
2752
|
+
* @param {*} [options] Override http request option.
|
|
2753
|
+
* @throws {RequiredError}
|
|
2754
|
+
*/
|
|
2755
|
+
getLinkedAddressesDeprecated: async (userId, options = {}) => {
|
|
2756
|
+
// verify required parameter 'userId' is not null or undefined
|
|
2757
|
+
assertParamExists$1('getLinkedAddressesDeprecated', 'userId', userId);
|
|
2685
2758
|
const localVarPath = `/passport-mr/v1/users/{userId}/linked-addresses`
|
|
2686
2759
|
.replace(`{${"userId"}}`, encodeURIComponent(String(userId)));
|
|
2687
2760
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
@@ -2716,12 +2789,36 @@ const PassportApiFp = function (configuration) {
|
|
|
2716
2789
|
/**
|
|
2717
2790
|
* Create a counterfactual address for a user based on their Ethereum address
|
|
2718
2791
|
* @summary Create a counterfactual address
|
|
2792
|
+
* @param {string} chainName
|
|
2719
2793
|
* @param {CreateCounterfactualAddressRequest} createCounterfactualAddressRequest
|
|
2720
2794
|
* @param {*} [options] Override http request option.
|
|
2721
2795
|
* @throws {RequiredError}
|
|
2722
2796
|
*/
|
|
2723
|
-
async createCounterfactualAddress(createCounterfactualAddressRequest, options) {
|
|
2724
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createCounterfactualAddress(createCounterfactualAddressRequest, options);
|
|
2797
|
+
async createCounterfactualAddress(chainName, createCounterfactualAddressRequest, options) {
|
|
2798
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.createCounterfactualAddress(chainName, createCounterfactualAddressRequest, options);
|
|
2799
|
+
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
2800
|
+
},
|
|
2801
|
+
/**
|
|
2802
|
+
* Create a counterfactual address for a user based on their Ethereum address
|
|
2803
|
+
* @summary Create a counterfactual address
|
|
2804
|
+
* @param {CreateCounterfactualAddressRequestDeprecated} createCounterfactualAddressRequestDeprecated
|
|
2805
|
+
* @param {*} [options] Override http request option.
|
|
2806
|
+
* @throws {RequiredError}
|
|
2807
|
+
*/
|
|
2808
|
+
async createCounterfactualAddressDeprecated(createCounterfactualAddressRequestDeprecated, options) {
|
|
2809
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.createCounterfactualAddressDeprecated(createCounterfactualAddressRequestDeprecated, options);
|
|
2810
|
+
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
2811
|
+
},
|
|
2812
|
+
/**
|
|
2813
|
+
* Get all the Ethereum linked addresses for a user based on its userId
|
|
2814
|
+
* @summary Get Ethereum linked addresses for a user
|
|
2815
|
+
* @param {string} userId The user\'s userId
|
|
2816
|
+
* @param {string} chainName
|
|
2817
|
+
* @param {*} [options] Override http request option.
|
|
2818
|
+
* @throws {RequiredError}
|
|
2819
|
+
*/
|
|
2820
|
+
async getLinkedAddresses(userId, chainName, options) {
|
|
2821
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getLinkedAddresses(userId, chainName, options);
|
|
2725
2822
|
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
2726
2823
|
},
|
|
2727
2824
|
/**
|
|
@@ -2731,8 +2828,8 @@ const PassportApiFp = function (configuration) {
|
|
|
2731
2828
|
* @param {*} [options] Override http request option.
|
|
2732
2829
|
* @throws {RequiredError}
|
|
2733
2830
|
*/
|
|
2734
|
-
async
|
|
2735
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.
|
|
2831
|
+
async getLinkedAddressesDeprecated(userId, options) {
|
|
2832
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getLinkedAddressesDeprecated(userId, options);
|
|
2736
2833
|
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
2737
2834
|
},
|
|
2738
2835
|
};
|
|
@@ -2752,7 +2849,17 @@ const PassportApiFactory = function (configuration, basePath, axios) {
|
|
|
2752
2849
|
* @throws {RequiredError}
|
|
2753
2850
|
*/
|
|
2754
2851
|
createCounterfactualAddress(requestParameters, options) {
|
|
2755
|
-
return localVarFp.createCounterfactualAddress(requestParameters.createCounterfactualAddressRequest, options).then((request) => request(axios, basePath));
|
|
2852
|
+
return localVarFp.createCounterfactualAddress(requestParameters.chainName, requestParameters.createCounterfactualAddressRequest, options).then((request) => request(axios, basePath));
|
|
2853
|
+
},
|
|
2854
|
+
/**
|
|
2855
|
+
* Create a counterfactual address for a user based on their Ethereum address
|
|
2856
|
+
* @summary Create a counterfactual address
|
|
2857
|
+
* @param {PassportApiCreateCounterfactualAddressDeprecatedRequest} requestParameters Request parameters.
|
|
2858
|
+
* @param {*} [options] Override http request option.
|
|
2859
|
+
* @throws {RequiredError}
|
|
2860
|
+
*/
|
|
2861
|
+
createCounterfactualAddressDeprecated(requestParameters, options) {
|
|
2862
|
+
return localVarFp.createCounterfactualAddressDeprecated(requestParameters.createCounterfactualAddressRequestDeprecated, options).then((request) => request(axios, basePath));
|
|
2756
2863
|
},
|
|
2757
2864
|
/**
|
|
2758
2865
|
* Get all the Ethereum linked addresses for a user based on its userId
|
|
@@ -2762,7 +2869,17 @@ const PassportApiFactory = function (configuration, basePath, axios) {
|
|
|
2762
2869
|
* @throws {RequiredError}
|
|
2763
2870
|
*/
|
|
2764
2871
|
getLinkedAddresses(requestParameters, options) {
|
|
2765
|
-
return localVarFp.getLinkedAddresses(requestParameters.userId, options).then((request) => request(axios, basePath));
|
|
2872
|
+
return localVarFp.getLinkedAddresses(requestParameters.userId, requestParameters.chainName, options).then((request) => request(axios, basePath));
|
|
2873
|
+
},
|
|
2874
|
+
/**
|
|
2875
|
+
* Get all the Ethereum linked addresses for a user based on its userId
|
|
2876
|
+
* @summary Get Ethereum linked addresses for a user
|
|
2877
|
+
* @param {PassportApiGetLinkedAddressesDeprecatedRequest} requestParameters Request parameters.
|
|
2878
|
+
* @param {*} [options] Override http request option.
|
|
2879
|
+
* @throws {RequiredError}
|
|
2880
|
+
*/
|
|
2881
|
+
getLinkedAddressesDeprecated(requestParameters, options) {
|
|
2882
|
+
return localVarFp.getLinkedAddressesDeprecated(requestParameters.userId, options).then((request) => request(axios, basePath));
|
|
2766
2883
|
},
|
|
2767
2884
|
};
|
|
2768
2885
|
};
|
|
@@ -2782,7 +2899,18 @@ class PassportApi extends BaseAPI$1 {
|
|
|
2782
2899
|
* @memberof PassportApi
|
|
2783
2900
|
*/
|
|
2784
2901
|
createCounterfactualAddress(requestParameters, options) {
|
|
2785
|
-
return PassportApiFp(this.configuration).createCounterfactualAddress(requestParameters.createCounterfactualAddressRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2902
|
+
return PassportApiFp(this.configuration).createCounterfactualAddress(requestParameters.chainName, requestParameters.createCounterfactualAddressRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2903
|
+
}
|
|
2904
|
+
/**
|
|
2905
|
+
* Create a counterfactual address for a user based on their Ethereum address
|
|
2906
|
+
* @summary Create a counterfactual address
|
|
2907
|
+
* @param {PassportApiCreateCounterfactualAddressDeprecatedRequest} requestParameters Request parameters.
|
|
2908
|
+
* @param {*} [options] Override http request option.
|
|
2909
|
+
* @throws {RequiredError}
|
|
2910
|
+
* @memberof PassportApi
|
|
2911
|
+
*/
|
|
2912
|
+
createCounterfactualAddressDeprecated(requestParameters, options) {
|
|
2913
|
+
return PassportApiFp(this.configuration).createCounterfactualAddressDeprecated(requestParameters.createCounterfactualAddressRequestDeprecated, options).then((request) => request(this.axios, this.basePath));
|
|
2786
2914
|
}
|
|
2787
2915
|
/**
|
|
2788
2916
|
* Get all the Ethereum linked addresses for a user based on its userId
|
|
@@ -2793,7 +2921,18 @@ class PassportApi extends BaseAPI$1 {
|
|
|
2793
2921
|
* @memberof PassportApi
|
|
2794
2922
|
*/
|
|
2795
2923
|
getLinkedAddresses(requestParameters, options) {
|
|
2796
|
-
return PassportApiFp(this.configuration).getLinkedAddresses(requestParameters.userId, options).then((request) => request(this.axios, this.basePath));
|
|
2924
|
+
return PassportApiFp(this.configuration).getLinkedAddresses(requestParameters.userId, requestParameters.chainName, options).then((request) => request(this.axios, this.basePath));
|
|
2925
|
+
}
|
|
2926
|
+
/**
|
|
2927
|
+
* Get all the Ethereum linked addresses for a user based on its userId
|
|
2928
|
+
* @summary Get Ethereum linked addresses for a user
|
|
2929
|
+
* @param {PassportApiGetLinkedAddressesDeprecatedRequest} requestParameters Request parameters.
|
|
2930
|
+
* @param {*} [options] Override http request option.
|
|
2931
|
+
* @throws {RequiredError}
|
|
2932
|
+
* @memberof PassportApi
|
|
2933
|
+
*/
|
|
2934
|
+
getLinkedAddressesDeprecated(requestParameters, options) {
|
|
2935
|
+
return PassportApiFp(this.configuration).getLinkedAddressesDeprecated(requestParameters.userId, options).then((request) => request(this.axios, this.basePath));
|
|
2797
2936
|
}
|
|
2798
2937
|
}
|
|
2799
2938
|
|
|
@@ -3653,7 +3792,7 @@ class MultiRollupApiClients {
|
|
|
3653
3792
|
}
|
|
3654
3793
|
|
|
3655
3794
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3656
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
3795
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.30.0' };
|
|
3657
3796
|
const createConfig = ({ basePath, headers, }) => {
|
|
3658
3797
|
if (!basePath.trim()) {
|
|
3659
3798
|
throw Error('basePath can not be empty');
|
|
@@ -3713,7 +3852,7 @@ class APIError extends Error {
|
|
|
3713
3852
|
|
|
3714
3853
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3715
3854
|
const defaultHeaders = {
|
|
3716
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
3855
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.30.0',
|
|
3717
3856
|
};
|
|
3718
3857
|
/**
|
|
3719
3858
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4124,7 +4263,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4124
4263
|
chainID,
|
|
4125
4264
|
coreContractAddress,
|
|
4126
4265
|
registrationContractAddress,
|
|
4127
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
4266
|
+
sdkVersion: 'ts-immutable-sdk-0.30.0',
|
|
4128
4267
|
});
|
|
4129
4268
|
/**
|
|
4130
4269
|
* Sets `sdkVersion` at the time of build
|
|
@@ -8639,6 +8778,41 @@ const withPassportError = async (fn, customErrorType) => {
|
|
|
8639
8778
|
}
|
|
8640
8779
|
};
|
|
8641
8780
|
|
|
8781
|
+
/**
|
|
8782
|
+
* Enum representing different chain IDs.
|
|
8783
|
+
* @enum {number}
|
|
8784
|
+
* @property {number} IMTBL_ZKEVM_MAINNET - The chain ID for IMTBL ZKEVM Mainnet.
|
|
8785
|
+
* @property {number} IMTBL_ZKEVM_TESTNET - The chain ID for IMTBL ZKEVM Testnet.
|
|
8786
|
+
* @property {number} IMTBL_ZKEVM_DEVNET - The chain ID for IMTBL ZKEVM Devnet.
|
|
8787
|
+
* @property {number} ETHEREUM - The chain ID for Ethereum.
|
|
8788
|
+
* @property {number} SEPOLIA - The chain ID for Sepolia.
|
|
8789
|
+
*/
|
|
8790
|
+
var ChainId$1;
|
|
8791
|
+
(function (ChainId) {
|
|
8792
|
+
ChainId[ChainId["IMTBL_ZKEVM_MAINNET"] = 13371] = "IMTBL_ZKEVM_MAINNET";
|
|
8793
|
+
ChainId[ChainId["IMTBL_ZKEVM_TESTNET"] = 13472] = "IMTBL_ZKEVM_TESTNET";
|
|
8794
|
+
ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] = 13433] = "IMTBL_ZKEVM_DEVNET";
|
|
8795
|
+
ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM";
|
|
8796
|
+
ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
|
|
8797
|
+
})(ChainId$1 || (ChainId$1 = {}));
|
|
8798
|
+
/**
|
|
8799
|
+
* Enum representing different chain names.
|
|
8800
|
+
* @enum {number}
|
|
8801
|
+
* @property {number} IMTBL_ZKEVM_MAINNET - The chain name for IMTBL ZKEVM Mainnet.
|
|
8802
|
+
* @property {number} IMTBL_ZKEVM_TESTNET - The chain name for IMTBL ZKEVM Testnet.
|
|
8803
|
+
* @property {number} IMTBL_ZKEVM_DEVNET - The chain name for IMTBL ZKEVM Devnet.
|
|
8804
|
+
* @property {number} ETHEREUM - The chain name for Ethereum.
|
|
8805
|
+
* @property {number} SEPOLIA - The chain name for Sepolia.
|
|
8806
|
+
*/
|
|
8807
|
+
var ChainName$1;
|
|
8808
|
+
(function (ChainName) {
|
|
8809
|
+
ChainName["ETHEREUM"] = "Ethereum";
|
|
8810
|
+
ChainName["SEPOLIA"] = "Sepolia";
|
|
8811
|
+
ChainName["IMTBL_ZKEVM_TESTNET"] = "Immutable zkEVM Test";
|
|
8812
|
+
ChainName["IMTBL_ZKEVM_DEVNET"] = "Immutable zkEVM Dev";
|
|
8813
|
+
ChainName["IMTBL_ZKEVM_MAINNET"] = "Immutable zkEVM";
|
|
8814
|
+
})(ChainName$1 || (ChainName$1 = {}));
|
|
8815
|
+
|
|
8642
8816
|
const keyCrendentials = 'passport_credentials';
|
|
8643
8817
|
const KEY_PKCE_STATE = 'pkce_state';
|
|
8644
8818
|
const KEY_PKCE_VERIFIER = 'pkce_verifier';
|
|
@@ -10404,18 +10578,47 @@ class RelayerClient {
|
|
|
10404
10578
|
}
|
|
10405
10579
|
}
|
|
10406
10580
|
|
|
10581
|
+
const CHAIN_NAME_MAP = new Map([
|
|
10582
|
+
[
|
|
10583
|
+
ChainId$1.ETHEREUM,
|
|
10584
|
+
ChainName$1.ETHEREUM,
|
|
10585
|
+
],
|
|
10586
|
+
[
|
|
10587
|
+
ChainId$1.SEPOLIA,
|
|
10588
|
+
ChainName$1.SEPOLIA,
|
|
10589
|
+
],
|
|
10590
|
+
[
|
|
10591
|
+
ChainId$1.IMTBL_ZKEVM_MAINNET,
|
|
10592
|
+
ChainName$1.IMTBL_ZKEVM_MAINNET,
|
|
10593
|
+
],
|
|
10594
|
+
[
|
|
10595
|
+
ChainId$1.IMTBL_ZKEVM_TESTNET,
|
|
10596
|
+
ChainName$1.IMTBL_ZKEVM_TESTNET,
|
|
10597
|
+
],
|
|
10598
|
+
[
|
|
10599
|
+
ChainId$1.IMTBL_ZKEVM_DEVNET,
|
|
10600
|
+
ChainName$1.IMTBL_ZKEVM_DEVNET,
|
|
10601
|
+
],
|
|
10602
|
+
]);
|
|
10603
|
+
|
|
10407
10604
|
const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
|
|
10408
|
-
async function registerZkEvmUser({ authManager, config, magicProvider, multiRollupApiClients, accessToken, }) {
|
|
10605
|
+
async function registerZkEvmUser({ authManager, config, magicProvider, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
|
|
10409
10606
|
const web3Provider = new providers.Web3Provider(magicProvider);
|
|
10410
10607
|
const ethSigner = web3Provider.getSigner();
|
|
10411
10608
|
const ethereumAddress = await ethSigner.getAddress();
|
|
10412
10609
|
const ethereumSignature = await signRaw(MESSAGE_TO_SIGN, ethSigner);
|
|
10413
10610
|
const headers = { Authorization: `Bearer ${accessToken}` };
|
|
10611
|
+
const { chainId } = await jsonRpcProvider.ready;
|
|
10414
10612
|
try {
|
|
10613
|
+
const chainName = CHAIN_NAME_MAP.get(chainId);
|
|
10614
|
+
if (!chainName) {
|
|
10615
|
+
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${chainId}`);
|
|
10616
|
+
}
|
|
10415
10617
|
await multiRollupApiClients.passportApi.createCounterfactualAddress({
|
|
10618
|
+
chainName,
|
|
10416
10619
|
createCounterfactualAddressRequest: {
|
|
10417
|
-
ethereumAddress,
|
|
10418
|
-
ethereumSignature,
|
|
10620
|
+
ethereum_address: ethereumAddress,
|
|
10621
|
+
ethereum_signature: ethereumSignature,
|
|
10419
10622
|
},
|
|
10420
10623
|
}, { headers });
|
|
10421
10624
|
}
|
|
@@ -10439,7 +10642,7 @@ async function registerZkEvmUser({ authManager, config, magicProvider, multiRoll
|
|
|
10439
10642
|
return user;
|
|
10440
10643
|
}
|
|
10441
10644
|
|
|
10442
|
-
const loginZkEvmUser = async ({ authManager, config, magicAdapter, multiRollupApiClients, }) => {
|
|
10645
|
+
const loginZkEvmUser = async ({ authManager, config, magicAdapter, multiRollupApiClients, jsonRpcProvider, }) => {
|
|
10443
10646
|
const user = await authManager.getUser() || await authManager.getUserDeviceFlow() || await authManager.login();
|
|
10444
10647
|
if (!user.idToken) {
|
|
10445
10648
|
throw new Error('User is missing idToken');
|
|
@@ -10453,6 +10656,7 @@ const loginZkEvmUser = async ({ authManager, config, magicAdapter, multiRollupAp
|
|
|
10453
10656
|
magicProvider,
|
|
10454
10657
|
multiRollupApiClients,
|
|
10455
10658
|
accessToken: user.accessToken,
|
|
10659
|
+
jsonRpcProvider,
|
|
10456
10660
|
});
|
|
10457
10661
|
return {
|
|
10458
10662
|
user: userZkevm,
|
|
@@ -10667,6 +10871,7 @@ class ZkEvmProvider {
|
|
|
10667
10871
|
config: this.config,
|
|
10668
10872
|
magicAdapter: this.magicAdapter,
|
|
10669
10873
|
multiRollupApiClients: this.multiRollupApiClients,
|
|
10874
|
+
jsonRpcProvider: this.jsonRpcProvider,
|
|
10670
10875
|
});
|
|
10671
10876
|
this.user = user;
|
|
10672
10877
|
this.magicProvider = magicProvider;
|
|
@@ -10971,9 +11176,10 @@ class Passport {
|
|
|
10971
11176
|
}
|
|
10972
11177
|
const headers = { Authorization: `Bearer ${user.accessToken}` };
|
|
10973
11178
|
const linkedAddressesResult = await this.multiRollupApiClients.passportApi.getLinkedAddresses({
|
|
11179
|
+
chainName: ChainName$1.ETHEREUM,
|
|
10974
11180
|
userId: user?.profile.sub,
|
|
10975
11181
|
}, { headers });
|
|
10976
|
-
return linkedAddressesResult.data.
|
|
11182
|
+
return linkedAddressesResult.data.linked_addresses;
|
|
10977
11183
|
}
|
|
10978
11184
|
}
|
|
10979
11185
|
|
|
@@ -33812,7 +34018,7 @@ async function getItemRequirementsFromRequirements(provider, requirements) {
|
|
|
33812
34018
|
return itemRequirements;
|
|
33813
34019
|
}
|
|
33814
34020
|
|
|
33815
|
-
const SDK_VERSION_MARKER = '0.
|
|
34021
|
+
const SDK_VERSION_MARKER = '0.30.0';
|
|
33816
34022
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
33817
34023
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
33818
34024
|
|