@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.js
CHANGED
|
@@ -2620,14 +2620,18 @@ const PassportApiAxiosParamCreator = function (configuration) {
|
|
|
2620
2620
|
/**
|
|
2621
2621
|
* Create a counterfactual address for a user based on their Ethereum address
|
|
2622
2622
|
* @summary Create a counterfactual address
|
|
2623
|
+
* @param {string} chainName
|
|
2623
2624
|
* @param {CreateCounterfactualAddressRequest} createCounterfactualAddressRequest
|
|
2624
2625
|
* @param {*} [options] Override http request option.
|
|
2625
2626
|
* @throws {RequiredError}
|
|
2626
2627
|
*/
|
|
2627
|
-
createCounterfactualAddress: async (createCounterfactualAddressRequest, options = {}) => {
|
|
2628
|
+
createCounterfactualAddress: async (chainName, createCounterfactualAddressRequest, options = {}) => {
|
|
2629
|
+
// verify required parameter 'chainName' is not null or undefined
|
|
2630
|
+
assertParamExists$1('createCounterfactualAddress', 'chainName', chainName);
|
|
2628
2631
|
// verify required parameter 'createCounterfactualAddressRequest' is not null or undefined
|
|
2629
2632
|
assertParamExists$1('createCounterfactualAddress', 'createCounterfactualAddressRequest', createCounterfactualAddressRequest);
|
|
2630
|
-
const localVarPath = `/passport
|
|
2633
|
+
const localVarPath = `/v1/chains/{chain_name}/passport/counterfactual-address`
|
|
2634
|
+
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
|
|
2631
2635
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
2632
2636
|
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
|
|
2633
2637
|
let baseOptions;
|
|
@@ -2650,16 +2654,85 @@ const PassportApiAxiosParamCreator = function (configuration) {
|
|
|
2650
2654
|
options: localVarRequestOptions,
|
|
2651
2655
|
};
|
|
2652
2656
|
},
|
|
2657
|
+
/**
|
|
2658
|
+
* Create a counterfactual address for a user based on their Ethereum address
|
|
2659
|
+
* @summary Create a counterfactual address
|
|
2660
|
+
* @param {CreateCounterfactualAddressRequestDeprecated} createCounterfactualAddressRequestDeprecated
|
|
2661
|
+
* @param {*} [options] Override http request option.
|
|
2662
|
+
* @throws {RequiredError}
|
|
2663
|
+
*/
|
|
2664
|
+
createCounterfactualAddressDeprecated: async (createCounterfactualAddressRequestDeprecated, options = {}) => {
|
|
2665
|
+
// verify required parameter 'createCounterfactualAddressRequestDeprecated' is not null or undefined
|
|
2666
|
+
assertParamExists$1('createCounterfactualAddressDeprecated', 'createCounterfactualAddressRequestDeprecated', createCounterfactualAddressRequestDeprecated);
|
|
2667
|
+
const localVarPath = `/passport-mr/v1/counterfactual-address`;
|
|
2668
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
2669
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
|
|
2670
|
+
let baseOptions;
|
|
2671
|
+
if (configuration) {
|
|
2672
|
+
baseOptions = configuration.baseOptions;
|
|
2673
|
+
}
|
|
2674
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
2675
|
+
const localVarHeaderParameter = {};
|
|
2676
|
+
const localVarQueryParameter = {};
|
|
2677
|
+
// authentication BearerAuth required
|
|
2678
|
+
// http bearer authentication required
|
|
2679
|
+
await setBearerAuthToObject$1(localVarHeaderParameter, configuration);
|
|
2680
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
2681
|
+
setSearchParams$1(localVarUrlObj, localVarQueryParameter);
|
|
2682
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
2683
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
2684
|
+
localVarRequestOptions.data = serializeDataIfNeeded$1(createCounterfactualAddressRequestDeprecated, localVarRequestOptions, configuration);
|
|
2685
|
+
return {
|
|
2686
|
+
url: toPathString$1(localVarUrlObj),
|
|
2687
|
+
options: localVarRequestOptions,
|
|
2688
|
+
};
|
|
2689
|
+
},
|
|
2653
2690
|
/**
|
|
2654
2691
|
* Get all the Ethereum linked addresses for a user based on its userId
|
|
2655
2692
|
* @summary Get Ethereum linked addresses for a user
|
|
2656
2693
|
* @param {string} userId The user\'s userId
|
|
2694
|
+
* @param {string} chainName
|
|
2657
2695
|
* @param {*} [options] Override http request option.
|
|
2658
2696
|
* @throws {RequiredError}
|
|
2659
2697
|
*/
|
|
2660
|
-
getLinkedAddresses: async (userId, options = {}) => {
|
|
2698
|
+
getLinkedAddresses: async (userId, chainName, options = {}) => {
|
|
2661
2699
|
// verify required parameter 'userId' is not null or undefined
|
|
2662
2700
|
assertParamExists$1('getLinkedAddresses', 'userId', userId);
|
|
2701
|
+
// verify required parameter 'chainName' is not null or undefined
|
|
2702
|
+
assertParamExists$1('getLinkedAddresses', 'chainName', chainName);
|
|
2703
|
+
const localVarPath = `/v1/chains/{chain_name}/passport/users/{user_id}/linked-addresses`
|
|
2704
|
+
.replace(`{${"user_id"}}`, encodeURIComponent(String(userId)))
|
|
2705
|
+
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
|
|
2706
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
2707
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
|
|
2708
|
+
let baseOptions;
|
|
2709
|
+
if (configuration) {
|
|
2710
|
+
baseOptions = configuration.baseOptions;
|
|
2711
|
+
}
|
|
2712
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
2713
|
+
const localVarHeaderParameter = {};
|
|
2714
|
+
const localVarQueryParameter = {};
|
|
2715
|
+
// authentication BearerAuth required
|
|
2716
|
+
// http bearer authentication required
|
|
2717
|
+
await setBearerAuthToObject$1(localVarHeaderParameter, configuration);
|
|
2718
|
+
setSearchParams$1(localVarUrlObj, localVarQueryParameter);
|
|
2719
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
2720
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
2721
|
+
return {
|
|
2722
|
+
url: toPathString$1(localVarUrlObj),
|
|
2723
|
+
options: localVarRequestOptions,
|
|
2724
|
+
};
|
|
2725
|
+
},
|
|
2726
|
+
/**
|
|
2727
|
+
* Get all the Ethereum linked addresses for a user based on its userId
|
|
2728
|
+
* @summary Get Ethereum linked addresses for a user
|
|
2729
|
+
* @param {string} userId The user\'s userId
|
|
2730
|
+
* @param {*} [options] Override http request option.
|
|
2731
|
+
* @throws {RequiredError}
|
|
2732
|
+
*/
|
|
2733
|
+
getLinkedAddressesDeprecated: async (userId, options = {}) => {
|
|
2734
|
+
// verify required parameter 'userId' is not null or undefined
|
|
2735
|
+
assertParamExists$1('getLinkedAddressesDeprecated', 'userId', userId);
|
|
2663
2736
|
const localVarPath = `/passport-mr/v1/users/{userId}/linked-addresses`
|
|
2664
2737
|
.replace(`{${"userId"}}`, encodeURIComponent(String(userId)));
|
|
2665
2738
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
@@ -2694,12 +2767,36 @@ const PassportApiFp = function (configuration) {
|
|
|
2694
2767
|
/**
|
|
2695
2768
|
* Create a counterfactual address for a user based on their Ethereum address
|
|
2696
2769
|
* @summary Create a counterfactual address
|
|
2770
|
+
* @param {string} chainName
|
|
2697
2771
|
* @param {CreateCounterfactualAddressRequest} createCounterfactualAddressRequest
|
|
2698
2772
|
* @param {*} [options] Override http request option.
|
|
2699
2773
|
* @throws {RequiredError}
|
|
2700
2774
|
*/
|
|
2701
|
-
async createCounterfactualAddress(createCounterfactualAddressRequest, options) {
|
|
2702
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createCounterfactualAddress(createCounterfactualAddressRequest, options);
|
|
2775
|
+
async createCounterfactualAddress(chainName, createCounterfactualAddressRequest, options) {
|
|
2776
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.createCounterfactualAddress(chainName, createCounterfactualAddressRequest, options);
|
|
2777
|
+
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
2778
|
+
},
|
|
2779
|
+
/**
|
|
2780
|
+
* Create a counterfactual address for a user based on their Ethereum address
|
|
2781
|
+
* @summary Create a counterfactual address
|
|
2782
|
+
* @param {CreateCounterfactualAddressRequestDeprecated} createCounterfactualAddressRequestDeprecated
|
|
2783
|
+
* @param {*} [options] Override http request option.
|
|
2784
|
+
* @throws {RequiredError}
|
|
2785
|
+
*/
|
|
2786
|
+
async createCounterfactualAddressDeprecated(createCounterfactualAddressRequestDeprecated, options) {
|
|
2787
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.createCounterfactualAddressDeprecated(createCounterfactualAddressRequestDeprecated, options);
|
|
2788
|
+
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
2789
|
+
},
|
|
2790
|
+
/**
|
|
2791
|
+
* Get all the Ethereum linked addresses for a user based on its userId
|
|
2792
|
+
* @summary Get Ethereum linked addresses for a user
|
|
2793
|
+
* @param {string} userId The user\'s userId
|
|
2794
|
+
* @param {string} chainName
|
|
2795
|
+
* @param {*} [options] Override http request option.
|
|
2796
|
+
* @throws {RequiredError}
|
|
2797
|
+
*/
|
|
2798
|
+
async getLinkedAddresses(userId, chainName, options) {
|
|
2799
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getLinkedAddresses(userId, chainName, options);
|
|
2703
2800
|
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
2704
2801
|
},
|
|
2705
2802
|
/**
|
|
@@ -2709,8 +2806,8 @@ const PassportApiFp = function (configuration) {
|
|
|
2709
2806
|
* @param {*} [options] Override http request option.
|
|
2710
2807
|
* @throws {RequiredError}
|
|
2711
2808
|
*/
|
|
2712
|
-
async
|
|
2713
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.
|
|
2809
|
+
async getLinkedAddressesDeprecated(userId, options) {
|
|
2810
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.getLinkedAddressesDeprecated(userId, options);
|
|
2714
2811
|
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
2715
2812
|
},
|
|
2716
2813
|
};
|
|
@@ -2730,7 +2827,17 @@ const PassportApiFactory = function (configuration, basePath, axios) {
|
|
|
2730
2827
|
* @throws {RequiredError}
|
|
2731
2828
|
*/
|
|
2732
2829
|
createCounterfactualAddress(requestParameters, options) {
|
|
2733
|
-
return localVarFp.createCounterfactualAddress(requestParameters.createCounterfactualAddressRequest, options).then((request) => request(axios, basePath));
|
|
2830
|
+
return localVarFp.createCounterfactualAddress(requestParameters.chainName, requestParameters.createCounterfactualAddressRequest, options).then((request) => request(axios, basePath));
|
|
2831
|
+
},
|
|
2832
|
+
/**
|
|
2833
|
+
* Create a counterfactual address for a user based on their Ethereum address
|
|
2834
|
+
* @summary Create a counterfactual address
|
|
2835
|
+
* @param {PassportApiCreateCounterfactualAddressDeprecatedRequest} requestParameters Request parameters.
|
|
2836
|
+
* @param {*} [options] Override http request option.
|
|
2837
|
+
* @throws {RequiredError}
|
|
2838
|
+
*/
|
|
2839
|
+
createCounterfactualAddressDeprecated(requestParameters, options) {
|
|
2840
|
+
return localVarFp.createCounterfactualAddressDeprecated(requestParameters.createCounterfactualAddressRequestDeprecated, options).then((request) => request(axios, basePath));
|
|
2734
2841
|
},
|
|
2735
2842
|
/**
|
|
2736
2843
|
* Get all the Ethereum linked addresses for a user based on its userId
|
|
@@ -2740,7 +2847,17 @@ const PassportApiFactory = function (configuration, basePath, axios) {
|
|
|
2740
2847
|
* @throws {RequiredError}
|
|
2741
2848
|
*/
|
|
2742
2849
|
getLinkedAddresses(requestParameters, options) {
|
|
2743
|
-
return localVarFp.getLinkedAddresses(requestParameters.userId, options).then((request) => request(axios, basePath));
|
|
2850
|
+
return localVarFp.getLinkedAddresses(requestParameters.userId, requestParameters.chainName, options).then((request) => request(axios, basePath));
|
|
2851
|
+
},
|
|
2852
|
+
/**
|
|
2853
|
+
* Get all the Ethereum linked addresses for a user based on its userId
|
|
2854
|
+
* @summary Get Ethereum linked addresses for a user
|
|
2855
|
+
* @param {PassportApiGetLinkedAddressesDeprecatedRequest} requestParameters Request parameters.
|
|
2856
|
+
* @param {*} [options] Override http request option.
|
|
2857
|
+
* @throws {RequiredError}
|
|
2858
|
+
*/
|
|
2859
|
+
getLinkedAddressesDeprecated(requestParameters, options) {
|
|
2860
|
+
return localVarFp.getLinkedAddressesDeprecated(requestParameters.userId, options).then((request) => request(axios, basePath));
|
|
2744
2861
|
},
|
|
2745
2862
|
};
|
|
2746
2863
|
};
|
|
@@ -2760,7 +2877,18 @@ class PassportApi extends BaseAPI$1 {
|
|
|
2760
2877
|
* @memberof PassportApi
|
|
2761
2878
|
*/
|
|
2762
2879
|
createCounterfactualAddress(requestParameters, options) {
|
|
2763
|
-
return PassportApiFp(this.configuration).createCounterfactualAddress(requestParameters.createCounterfactualAddressRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2880
|
+
return PassportApiFp(this.configuration).createCounterfactualAddress(requestParameters.chainName, requestParameters.createCounterfactualAddressRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* Create a counterfactual address for a user based on their Ethereum address
|
|
2884
|
+
* @summary Create a counterfactual address
|
|
2885
|
+
* @param {PassportApiCreateCounterfactualAddressDeprecatedRequest} requestParameters Request parameters.
|
|
2886
|
+
* @param {*} [options] Override http request option.
|
|
2887
|
+
* @throws {RequiredError}
|
|
2888
|
+
* @memberof PassportApi
|
|
2889
|
+
*/
|
|
2890
|
+
createCounterfactualAddressDeprecated(requestParameters, options) {
|
|
2891
|
+
return PassportApiFp(this.configuration).createCounterfactualAddressDeprecated(requestParameters.createCounterfactualAddressRequestDeprecated, options).then((request) => request(this.axios, this.basePath));
|
|
2764
2892
|
}
|
|
2765
2893
|
/**
|
|
2766
2894
|
* Get all the Ethereum linked addresses for a user based on its userId
|
|
@@ -2771,7 +2899,18 @@ class PassportApi extends BaseAPI$1 {
|
|
|
2771
2899
|
* @memberof PassportApi
|
|
2772
2900
|
*/
|
|
2773
2901
|
getLinkedAddresses(requestParameters, options) {
|
|
2774
|
-
return PassportApiFp(this.configuration).getLinkedAddresses(requestParameters.userId, options).then((request) => request(this.axios, this.basePath));
|
|
2902
|
+
return PassportApiFp(this.configuration).getLinkedAddresses(requestParameters.userId, requestParameters.chainName, options).then((request) => request(this.axios, this.basePath));
|
|
2903
|
+
}
|
|
2904
|
+
/**
|
|
2905
|
+
* Get all the Ethereum linked addresses for a user based on its userId
|
|
2906
|
+
* @summary Get Ethereum linked addresses for a user
|
|
2907
|
+
* @param {PassportApiGetLinkedAddressesDeprecatedRequest} requestParameters Request parameters.
|
|
2908
|
+
* @param {*} [options] Override http request option.
|
|
2909
|
+
* @throws {RequiredError}
|
|
2910
|
+
* @memberof PassportApi
|
|
2911
|
+
*/
|
|
2912
|
+
getLinkedAddressesDeprecated(requestParameters, options) {
|
|
2913
|
+
return PassportApiFp(this.configuration).getLinkedAddressesDeprecated(requestParameters.userId, options).then((request) => request(this.axios, this.basePath));
|
|
2775
2914
|
}
|
|
2776
2915
|
}
|
|
2777
2916
|
|
|
@@ -3631,7 +3770,7 @@ class MultiRollupApiClients {
|
|
|
3631
3770
|
}
|
|
3632
3771
|
|
|
3633
3772
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3634
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
3773
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.30.0' };
|
|
3635
3774
|
const createConfig = ({ basePath, headers, }) => {
|
|
3636
3775
|
if (!basePath.trim()) {
|
|
3637
3776
|
throw Error('basePath can not be empty');
|
|
@@ -3691,7 +3830,7 @@ class APIError extends Error {
|
|
|
3691
3830
|
|
|
3692
3831
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3693
3832
|
const defaultHeaders = {
|
|
3694
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
3833
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.30.0',
|
|
3695
3834
|
};
|
|
3696
3835
|
/**
|
|
3697
3836
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4102,7 +4241,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4102
4241
|
chainID,
|
|
4103
4242
|
coreContractAddress,
|
|
4104
4243
|
registrationContractAddress,
|
|
4105
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
4244
|
+
sdkVersion: 'ts-immutable-sdk-0.30.0',
|
|
4106
4245
|
});
|
|
4107
4246
|
/**
|
|
4108
4247
|
* Sets `sdkVersion` at the time of build
|
|
@@ -8617,6 +8756,41 @@ const withPassportError = async (fn, customErrorType) => {
|
|
|
8617
8756
|
}
|
|
8618
8757
|
};
|
|
8619
8758
|
|
|
8759
|
+
/**
|
|
8760
|
+
* Enum representing different chain IDs.
|
|
8761
|
+
* @enum {number}
|
|
8762
|
+
* @property {number} IMTBL_ZKEVM_MAINNET - The chain ID for IMTBL ZKEVM Mainnet.
|
|
8763
|
+
* @property {number} IMTBL_ZKEVM_TESTNET - The chain ID for IMTBL ZKEVM Testnet.
|
|
8764
|
+
* @property {number} IMTBL_ZKEVM_DEVNET - The chain ID for IMTBL ZKEVM Devnet.
|
|
8765
|
+
* @property {number} ETHEREUM - The chain ID for Ethereum.
|
|
8766
|
+
* @property {number} SEPOLIA - The chain ID for Sepolia.
|
|
8767
|
+
*/
|
|
8768
|
+
var ChainId$1;
|
|
8769
|
+
(function (ChainId) {
|
|
8770
|
+
ChainId[ChainId["IMTBL_ZKEVM_MAINNET"] = 13371] = "IMTBL_ZKEVM_MAINNET";
|
|
8771
|
+
ChainId[ChainId["IMTBL_ZKEVM_TESTNET"] = 13472] = "IMTBL_ZKEVM_TESTNET";
|
|
8772
|
+
ChainId[ChainId["IMTBL_ZKEVM_DEVNET"] = 13433] = "IMTBL_ZKEVM_DEVNET";
|
|
8773
|
+
ChainId[ChainId["ETHEREUM"] = 1] = "ETHEREUM";
|
|
8774
|
+
ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
|
|
8775
|
+
})(ChainId$1 || (ChainId$1 = {}));
|
|
8776
|
+
/**
|
|
8777
|
+
* Enum representing different chain names.
|
|
8778
|
+
* @enum {number}
|
|
8779
|
+
* @property {number} IMTBL_ZKEVM_MAINNET - The chain name for IMTBL ZKEVM Mainnet.
|
|
8780
|
+
* @property {number} IMTBL_ZKEVM_TESTNET - The chain name for IMTBL ZKEVM Testnet.
|
|
8781
|
+
* @property {number} IMTBL_ZKEVM_DEVNET - The chain name for IMTBL ZKEVM Devnet.
|
|
8782
|
+
* @property {number} ETHEREUM - The chain name for Ethereum.
|
|
8783
|
+
* @property {number} SEPOLIA - The chain name for Sepolia.
|
|
8784
|
+
*/
|
|
8785
|
+
var ChainName$1;
|
|
8786
|
+
(function (ChainName) {
|
|
8787
|
+
ChainName["ETHEREUM"] = "Ethereum";
|
|
8788
|
+
ChainName["SEPOLIA"] = "Sepolia";
|
|
8789
|
+
ChainName["IMTBL_ZKEVM_TESTNET"] = "Immutable zkEVM Test";
|
|
8790
|
+
ChainName["IMTBL_ZKEVM_DEVNET"] = "Immutable zkEVM Dev";
|
|
8791
|
+
ChainName["IMTBL_ZKEVM_MAINNET"] = "Immutable zkEVM";
|
|
8792
|
+
})(ChainName$1 || (ChainName$1 = {}));
|
|
8793
|
+
|
|
8620
8794
|
const keyCrendentials = 'passport_credentials';
|
|
8621
8795
|
const KEY_PKCE_STATE = 'pkce_state';
|
|
8622
8796
|
const KEY_PKCE_VERIFIER = 'pkce_verifier';
|
|
@@ -10382,18 +10556,47 @@ class RelayerClient {
|
|
|
10382
10556
|
}
|
|
10383
10557
|
}
|
|
10384
10558
|
|
|
10559
|
+
const CHAIN_NAME_MAP = new Map([
|
|
10560
|
+
[
|
|
10561
|
+
ChainId$1.ETHEREUM,
|
|
10562
|
+
ChainName$1.ETHEREUM,
|
|
10563
|
+
],
|
|
10564
|
+
[
|
|
10565
|
+
ChainId$1.SEPOLIA,
|
|
10566
|
+
ChainName$1.SEPOLIA,
|
|
10567
|
+
],
|
|
10568
|
+
[
|
|
10569
|
+
ChainId$1.IMTBL_ZKEVM_MAINNET,
|
|
10570
|
+
ChainName$1.IMTBL_ZKEVM_MAINNET,
|
|
10571
|
+
],
|
|
10572
|
+
[
|
|
10573
|
+
ChainId$1.IMTBL_ZKEVM_TESTNET,
|
|
10574
|
+
ChainName$1.IMTBL_ZKEVM_TESTNET,
|
|
10575
|
+
],
|
|
10576
|
+
[
|
|
10577
|
+
ChainId$1.IMTBL_ZKEVM_DEVNET,
|
|
10578
|
+
ChainName$1.IMTBL_ZKEVM_DEVNET,
|
|
10579
|
+
],
|
|
10580
|
+
]);
|
|
10581
|
+
|
|
10385
10582
|
const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
|
|
10386
|
-
async function registerZkEvmUser({ authManager, config, magicProvider, multiRollupApiClients, accessToken, }) {
|
|
10583
|
+
async function registerZkEvmUser({ authManager, config, magicProvider, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
|
|
10387
10584
|
const web3Provider = new Web3Provider(magicProvider);
|
|
10388
10585
|
const ethSigner = web3Provider.getSigner();
|
|
10389
10586
|
const ethereumAddress = await ethSigner.getAddress();
|
|
10390
10587
|
const ethereumSignature = await signRaw(MESSAGE_TO_SIGN, ethSigner);
|
|
10391
10588
|
const headers = { Authorization: `Bearer ${accessToken}` };
|
|
10589
|
+
const { chainId } = await jsonRpcProvider.ready;
|
|
10392
10590
|
try {
|
|
10591
|
+
const chainName = CHAIN_NAME_MAP.get(chainId);
|
|
10592
|
+
if (!chainName) {
|
|
10593
|
+
throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, `Chain name does not exist on for chain id ${chainId}`);
|
|
10594
|
+
}
|
|
10393
10595
|
await multiRollupApiClients.passportApi.createCounterfactualAddress({
|
|
10596
|
+
chainName,
|
|
10394
10597
|
createCounterfactualAddressRequest: {
|
|
10395
|
-
ethereumAddress,
|
|
10396
|
-
ethereumSignature,
|
|
10598
|
+
ethereum_address: ethereumAddress,
|
|
10599
|
+
ethereum_signature: ethereumSignature,
|
|
10397
10600
|
},
|
|
10398
10601
|
}, { headers });
|
|
10399
10602
|
}
|
|
@@ -10417,7 +10620,7 @@ async function registerZkEvmUser({ authManager, config, magicProvider, multiRoll
|
|
|
10417
10620
|
return user;
|
|
10418
10621
|
}
|
|
10419
10622
|
|
|
10420
|
-
const loginZkEvmUser = async ({ authManager, config, magicAdapter, multiRollupApiClients, }) => {
|
|
10623
|
+
const loginZkEvmUser = async ({ authManager, config, magicAdapter, multiRollupApiClients, jsonRpcProvider, }) => {
|
|
10421
10624
|
const user = await authManager.getUser() || await authManager.getUserDeviceFlow() || await authManager.login();
|
|
10422
10625
|
if (!user.idToken) {
|
|
10423
10626
|
throw new Error('User is missing idToken');
|
|
@@ -10431,6 +10634,7 @@ const loginZkEvmUser = async ({ authManager, config, magicAdapter, multiRollupAp
|
|
|
10431
10634
|
magicProvider,
|
|
10432
10635
|
multiRollupApiClients,
|
|
10433
10636
|
accessToken: user.accessToken,
|
|
10637
|
+
jsonRpcProvider,
|
|
10434
10638
|
});
|
|
10435
10639
|
return {
|
|
10436
10640
|
user: userZkevm,
|
|
@@ -10645,6 +10849,7 @@ class ZkEvmProvider {
|
|
|
10645
10849
|
config: this.config,
|
|
10646
10850
|
magicAdapter: this.magicAdapter,
|
|
10647
10851
|
multiRollupApiClients: this.multiRollupApiClients,
|
|
10852
|
+
jsonRpcProvider: this.jsonRpcProvider,
|
|
10648
10853
|
});
|
|
10649
10854
|
this.user = user;
|
|
10650
10855
|
this.magicProvider = magicProvider;
|
|
@@ -10949,9 +11154,10 @@ class Passport {
|
|
|
10949
11154
|
}
|
|
10950
11155
|
const headers = { Authorization: `Bearer ${user.accessToken}` };
|
|
10951
11156
|
const linkedAddressesResult = await this.multiRollupApiClients.passportApi.getLinkedAddresses({
|
|
11157
|
+
chainName: ChainName$1.ETHEREUM,
|
|
10952
11158
|
userId: user?.profile.sub,
|
|
10953
11159
|
}, { headers });
|
|
10954
|
-
return linkedAddressesResult.data.
|
|
11160
|
+
return linkedAddressesResult.data.linked_addresses;
|
|
10955
11161
|
}
|
|
10956
11162
|
}
|
|
10957
11163
|
|
|
@@ -33790,7 +33996,7 @@ async function getItemRequirementsFromRequirements(provider, requirements) {
|
|
|
33790
33996
|
return itemRequirements;
|
|
33791
33997
|
}
|
|
33792
33998
|
|
|
33793
|
-
const SDK_VERSION_MARKER = '0.
|
|
33999
|
+
const SDK_VERSION_MARKER = '0.30.0';
|
|
33794
34000
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
33795
34001
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
33796
34002
|
|