@imtbl/sdk 1.7.2 → 1.7.3-alpha.2
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.d.ts +78 -34
- package/dist/blockchain_data.js +2 -2
- package/dist/browser/checkout/BridgeWidget-85db50d2.js +1 -0
- package/dist/browser/checkout/OnRampWidget-58400404.js +1 -0
- package/dist/browser/checkout/SaleWidget-549f0f75.js +2 -0
- package/dist/browser/checkout/SpendingCapHero-24fed6d2.js +1 -0
- package/dist/browser/checkout/SwapWidget-9eecba27.js +1 -0
- package/dist/browser/checkout/TopUpView-26964a9e.js +1 -0
- package/dist/browser/checkout/WalletWidget-7e6fed9c.js +1 -0
- package/dist/browser/checkout/auto-track-da38e5a8.js +1 -0
- package/dist/browser/checkout/balance-310539bb.js +1 -0
- package/dist/browser/checkout/index-392bc434.js +1 -0
- package/dist/browser/checkout/index-3d847e0c.js +1 -0
- package/dist/browser/checkout/index-4e77760b.js +773 -0
- package/dist/browser/checkout/index-8184ffea.js +1 -0
- package/dist/browser/checkout/index-919a5df1.js +1 -0
- package/dist/browser/checkout/index-e6159023.js +1 -0
- package/dist/browser/checkout/index-eb42cd09.js +106 -0
- package/dist/browser/checkout/index.umd-c2e32802.js +1 -0
- package/dist/browser/checkout/is-plan-event-enabled-80f76ce6.js +1 -0
- package/dist/browser/checkout/retry-355e44f2.js +1 -0
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/browser/checkout/useTransakEvents-c6a83ea5.js +2 -0
- package/dist/browser/checkout/widgets-esm.js +1 -0
- package/dist/browser/checkout/widgets.js +50 -51
- package/dist/checkout.d.ts +3 -1
- package/dist/checkout.js +65 -32
- package/dist/config.js +1 -1
- package/dist/index.browser.js +7 -7
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +200 -143
- package/dist/index.d.ts +81 -35
- package/dist/index.js +200 -143
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +136 -112
- package/dist/x.js +2 -2
- package/package.json +1 -1
package/dist/passport.js
CHANGED
|
@@ -9146,7 +9146,7 @@ class MultiRollupApiClients {
|
|
|
9146
9146
|
}
|
|
9147
9147
|
|
|
9148
9148
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9149
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.7.2' };
|
|
9149
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.7.3-alpha.2' };
|
|
9150
9150
|
const createConfig = ({ basePath, headers, }) => {
|
|
9151
9151
|
if (!basePath.trim()) {
|
|
9152
9152
|
throw Error('basePath can not be empty');
|
|
@@ -9325,7 +9325,7 @@ const flattenProperties = (properties) => {
|
|
|
9325
9325
|
};
|
|
9326
9326
|
|
|
9327
9327
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
9328
|
-
const SDK_VERSION = '1.7.2';
|
|
9328
|
+
const SDK_VERSION = '1.7.3-alpha.2';
|
|
9329
9329
|
const getReferrer = () => {
|
|
9330
9330
|
if (isNode()) {
|
|
9331
9331
|
return '';
|
|
@@ -9538,7 +9538,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
9538
9538
|
chainID,
|
|
9539
9539
|
coreContractAddress,
|
|
9540
9540
|
registrationContractAddress,
|
|
9541
|
-
sdkVersion: 'ts-immutable-sdk-1.7.2',
|
|
9541
|
+
sdkVersion: 'ts-immutable-sdk-1.7.3-alpha.2',
|
|
9542
9542
|
});
|
|
9543
9543
|
/**
|
|
9544
9544
|
* Sets `sdkVersion` at the time of build
|
|
@@ -14176,7 +14176,6 @@ const getAuthConfiguration = (config) => {
|
|
|
14176
14176
|
end_session_endpoint: endSessionEndpoint,
|
|
14177
14177
|
},
|
|
14178
14178
|
mergeClaims: true,
|
|
14179
|
-
loadUserInfo: true,
|
|
14180
14179
|
scope: oidcConfiguration.scope,
|
|
14181
14180
|
userStore,
|
|
14182
14181
|
};
|
|
@@ -14217,7 +14216,10 @@ class AuthManager {
|
|
|
14217
14216
|
this.logoutMode = config.oidcConfiguration.logoutMode || 'redirect';
|
|
14218
14217
|
}
|
|
14219
14218
|
static mapOidcUserToDomainModel = (oidcUser) => {
|
|
14220
|
-
|
|
14219
|
+
let passport;
|
|
14220
|
+
if (oidcUser.id_token) {
|
|
14221
|
+
passport = jwt_decode(oidcUser.id_token)?.passport;
|
|
14222
|
+
}
|
|
14221
14223
|
const user = {
|
|
14222
14224
|
expired: oidcUser.expired,
|
|
14223
14225
|
idToken: oidcUser.id_token,
|
|
@@ -15642,9 +15644,7 @@ class JsonRpcError extends Error {
|
|
|
15642
15644
|
}
|
|
15643
15645
|
|
|
15644
15646
|
const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
|
|
15645
|
-
async function registerZkEvmUser({ authManager,
|
|
15646
|
-
const web3Provider = new Web3Provider(magicProvider);
|
|
15647
|
-
const ethSigner = web3Provider.getSigner();
|
|
15647
|
+
async function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
|
|
15648
15648
|
const ethereumAddress = await ethSigner.getAddress();
|
|
15649
15649
|
const ethereumSignature = await signRaw(MESSAGE_TO_SIGN, ethSigner);
|
|
15650
15650
|
const headers = { Authorization: `Bearer ${accessToken}` };
|
|
@@ -15674,32 +15674,6 @@ async function registerZkEvmUser({ authManager, magicProvider, multiRollupApiCli
|
|
|
15674
15674
|
return user;
|
|
15675
15675
|
}
|
|
15676
15676
|
|
|
15677
|
-
const loginZkEvmUser = async ({ authManager, magicAdapter, multiRollupApiClients, jsonRpcProvider, }) => {
|
|
15678
|
-
const user = await authManager.getUserOrLogin();
|
|
15679
|
-
if (!user.idToken) {
|
|
15680
|
-
throw new Error('User is missing idToken');
|
|
15681
|
-
}
|
|
15682
|
-
const magicProvider = await magicAdapter.login(user.idToken);
|
|
15683
|
-
if (!user.zkEvm) {
|
|
15684
|
-
// Generate counterfactual address and retrieve updated Auth0 user
|
|
15685
|
-
const userZkevm = await registerZkEvmUser({
|
|
15686
|
-
authManager,
|
|
15687
|
-
magicProvider,
|
|
15688
|
-
multiRollupApiClients,
|
|
15689
|
-
accessToken: user.accessToken,
|
|
15690
|
-
jsonRpcProvider,
|
|
15691
|
-
});
|
|
15692
|
-
return {
|
|
15693
|
-
user: userZkevm,
|
|
15694
|
-
magicProvider,
|
|
15695
|
-
};
|
|
15696
|
-
}
|
|
15697
|
-
return {
|
|
15698
|
-
user: user,
|
|
15699
|
-
magicProvider,
|
|
15700
|
-
};
|
|
15701
|
-
};
|
|
15702
|
-
|
|
15703
15677
|
const transactionRejectedCrossSdkBridgeError = 'Transaction requires confirmation but this functionality is not'
|
|
15704
15678
|
+ ' supported in this environment. Please contact Immutable support if you need to enable this feature.';
|
|
15705
15679
|
const convertBigNumberishToString = (value) => BigNumber.from(value).toString();
|
|
@@ -15895,7 +15869,7 @@ const getMetaTransactions = async (metaTransaction, nonce, chainId, walletAddres
|
|
|
15895
15869
|
}
|
|
15896
15870
|
return [metaTransaction, feeMetaTransaction];
|
|
15897
15871
|
};
|
|
15898
|
-
const sendTransaction = ({ params,
|
|
15872
|
+
const sendTransaction = ({ params, ethSigner, jsonRpcProvider, relayerClient, guardianClient, zkevmAddress, }) => guardianClient
|
|
15899
15873
|
.withConfirmationScreen({ width: 480, height: 720 })(async () => {
|
|
15900
15874
|
const transactionRequest = params[0];
|
|
15901
15875
|
if (!transactionRequest.to) {
|
|
@@ -15903,8 +15877,6 @@ const sendTransaction = ({ params, magicProvider, jsonRpcProvider, relayerClient
|
|
|
15903
15877
|
}
|
|
15904
15878
|
const { chainId } = await jsonRpcProvider.ready;
|
|
15905
15879
|
const chainIdBigNumber = BigNumber.from(chainId);
|
|
15906
|
-
const magicWeb3Provider = new Web3Provider(magicProvider);
|
|
15907
|
-
const signer = magicWeb3Provider.getSigner();
|
|
15908
15880
|
const nonce = await getNonce(jsonRpcProvider, zkevmAddress);
|
|
15909
15881
|
const metaTransaction = {
|
|
15910
15882
|
to: transactionRequest.to,
|
|
@@ -15913,7 +15885,7 @@ const sendTransaction = ({ params, magicProvider, jsonRpcProvider, relayerClient
|
|
|
15913
15885
|
value: transactionRequest.value,
|
|
15914
15886
|
revertOnError: true,
|
|
15915
15887
|
};
|
|
15916
|
-
const metaTransactions = await getMetaTransactions(metaTransaction, nonce, chainIdBigNumber, zkevmAddress,
|
|
15888
|
+
const metaTransactions = await getMetaTransactions(metaTransaction, nonce, chainIdBigNumber, zkevmAddress, ethSigner, relayerClient);
|
|
15917
15889
|
await guardianClient.validateEVMTransaction({
|
|
15918
15890
|
chainId: getEip155ChainId(chainId),
|
|
15919
15891
|
nonce: convertBigNumberishToString(nonce),
|
|
@@ -15921,7 +15893,7 @@ const sendTransaction = ({ params, magicProvider, jsonRpcProvider, relayerClient
|
|
|
15921
15893
|
});
|
|
15922
15894
|
// NOTE: We sign again because we now are adding the fee transaction, so the
|
|
15923
15895
|
// whole payload is different and needs a new signature.
|
|
15924
|
-
const signedTransactions = await getSignedMetaTransactions(metaTransactions, nonce, chainIdBigNumber, zkevmAddress,
|
|
15896
|
+
const signedTransactions = await getSignedMetaTransactions(metaTransactions, nonce, chainIdBigNumber, zkevmAddress, ethSigner);
|
|
15925
15897
|
const relayerId = await relayerClient.ethSendTransaction(zkevmAddress, signedTransactions);
|
|
15926
15898
|
const retrieveRelayerTransaction = async () => {
|
|
15927
15899
|
const tx = await relayerClient.imGetTransactionByHash(relayerId);
|
|
@@ -15990,7 +15962,7 @@ const transformTypedData = (typedData, chainId) => {
|
|
|
15990
15962
|
}
|
|
15991
15963
|
return transformedTypedData;
|
|
15992
15964
|
};
|
|
15993
|
-
const signTypedDataV4 = async ({ params, method,
|
|
15965
|
+
const signTypedDataV4 = async ({ params, method, ethSigner, jsonRpcProvider, relayerClient, guardianClient, }) => guardianClient
|
|
15994
15966
|
.withConfirmationScreen({ width: 480, height: 720 })(async () => {
|
|
15995
15967
|
const fromAddress = params[0];
|
|
15996
15968
|
const typedDataParam = params[1];
|
|
@@ -16001,106 +15973,158 @@ const signTypedDataV4 = async ({ params, method, magicProvider, jsonRpcProvider,
|
|
|
16001
15973
|
const typedData = transformTypedData(typedDataParam, chainId);
|
|
16002
15974
|
await guardianClient.validateMessage({ chainID: String(chainId), payload: typedData });
|
|
16003
15975
|
const relayerSignature = await relayerClient.imSignTypedData(fromAddress, typedData);
|
|
16004
|
-
|
|
16005
|
-
const signer = magicWeb3Provider.getSigner();
|
|
16006
|
-
return getSignedTypedData(typedData, relayerSignature, BigNumber.from(chainId), fromAddress, signer);
|
|
15976
|
+
return getSignedTypedData(typedData, relayerSignature, BigNumber.from(chainId), fromAddress, ethSigner);
|
|
16007
15977
|
});
|
|
16008
15978
|
|
|
15979
|
+
const isZkEvmUser = (user) => 'zkEvm' in user;
|
|
16009
15980
|
class ZkEvmProvider {
|
|
16010
|
-
authManager;
|
|
16011
|
-
config;
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
jsonRpcProvider; // Used for read
|
|
16015
|
-
|
|
16016
|
-
|
|
16017
|
-
relayerClient;
|
|
16018
|
-
|
|
16019
|
-
|
|
15981
|
+
#authManager;
|
|
15982
|
+
#config;
|
|
15983
|
+
#eventEmitter;
|
|
15984
|
+
#guardianClient;
|
|
15985
|
+
#jsonRpcProvider; // Used for read
|
|
15986
|
+
#magicAdapter;
|
|
15987
|
+
#multiRollupApiClients;
|
|
15988
|
+
#relayerClient;
|
|
15989
|
+
/**
|
|
15990
|
+
* This property is set during `#initialiseEthSigner` and stores the signer in a promise.
|
|
15991
|
+
* This property is not meant to be accessed directly, but through the
|
|
15992
|
+
* `#getSigner` method.
|
|
15993
|
+
* @see getSigner
|
|
15994
|
+
*/
|
|
15995
|
+
#ethSigner;
|
|
15996
|
+
#signerInitialisationError;
|
|
15997
|
+
#zkEvmAddress;
|
|
16020
15998
|
isPassport = true;
|
|
16021
15999
|
constructor({ authManager, magicAdapter, config, multiRollupApiClients, passportEventEmitter, guardianClient, }) {
|
|
16022
|
-
this
|
|
16023
|
-
this
|
|
16024
|
-
this
|
|
16025
|
-
this
|
|
16000
|
+
this.#authManager = authManager;
|
|
16001
|
+
this.#magicAdapter = magicAdapter;
|
|
16002
|
+
this.#config = config;
|
|
16003
|
+
this.#guardianClient = guardianClient;
|
|
16026
16004
|
if (config.crossSdkBridgeEnabled) {
|
|
16027
16005
|
// JsonRpcProvider by default sets the referrer as "client".
|
|
16028
16006
|
// On Unreal 4 this errors as the browser used is expecting a valid URL.
|
|
16029
|
-
this
|
|
16030
|
-
url: this
|
|
16007
|
+
this.#jsonRpcProvider = new JsonRpcProvider({
|
|
16008
|
+
url: this.#config.zkEvmRpcUrl,
|
|
16031
16009
|
fetchOptions: { referrer: 'http://imtblgamesdk.local' },
|
|
16032
16010
|
});
|
|
16033
16011
|
}
|
|
16034
16012
|
else {
|
|
16035
|
-
this
|
|
16013
|
+
this.#jsonRpcProvider = new JsonRpcProvider(this.#config.zkEvmRpcUrl);
|
|
16036
16014
|
}
|
|
16037
|
-
this
|
|
16038
|
-
|
|
16039
|
-
|
|
16040
|
-
|
|
16041
|
-
|
|
16042
|
-
|
|
16043
|
-
this
|
|
16044
|
-
|
|
16015
|
+
this.#relayerClient = new RelayerClient({
|
|
16016
|
+
config: this.#config,
|
|
16017
|
+
jsonRpcProvider: this.#jsonRpcProvider,
|
|
16018
|
+
authManager: this.#authManager,
|
|
16019
|
+
});
|
|
16020
|
+
this.#multiRollupApiClients = multiRollupApiClients;
|
|
16021
|
+
this.#eventEmitter = new TypedEventEmitter();
|
|
16022
|
+
passportEventEmitter.on(PassportEvents.LOGGED_OUT, this.#handleLogout);
|
|
16023
|
+
}
|
|
16024
|
+
#handleLogout = () => {
|
|
16025
|
+
const shouldEmitAccountsChanged = !!this.#zkEvmAddress;
|
|
16026
|
+
this.#ethSigner = undefined;
|
|
16027
|
+
this.#zkEvmAddress = undefined;
|
|
16045
16028
|
if (shouldEmitAccountsChanged) {
|
|
16046
|
-
this
|
|
16029
|
+
this.#eventEmitter.emit(ProviderEvent.ACCOUNTS_CHANGED, []);
|
|
16047
16030
|
}
|
|
16048
16031
|
};
|
|
16049
|
-
|
|
16050
|
-
|
|
16051
|
-
|
|
16052
|
-
|
|
16032
|
+
/**
|
|
16033
|
+
* This method is called by `eth_requestAccounts` and asynchronously initialises the signer.
|
|
16034
|
+
* The signer is stored in a promise so that it can be retrieved by the provider
|
|
16035
|
+
* when needed.
|
|
16036
|
+
*
|
|
16037
|
+
* If an error is thrown during initialisation, it is stored in the `signerInitialisationError`,
|
|
16038
|
+
* so that it doesn't result in an unhandled promise rejection.
|
|
16039
|
+
*
|
|
16040
|
+
* This error is thrown when the signer is requested through:
|
|
16041
|
+
* @see #getSigner
|
|
16042
|
+
*
|
|
16043
|
+
*/
|
|
16044
|
+
async #initialiseEthSigner(user) {
|
|
16045
|
+
const generateSigner = async () => {
|
|
16046
|
+
const magicRpcProvider = await this.#magicAdapter.login(user.idToken);
|
|
16047
|
+
const web3Provider = new Web3Provider(magicRpcProvider);
|
|
16048
|
+
return web3Provider.getSigner();
|
|
16049
|
+
};
|
|
16050
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
16051
|
+
this.#ethSigner = new Promise(async (resolve) => {
|
|
16052
|
+
try {
|
|
16053
|
+
resolve(await generateSigner());
|
|
16054
|
+
}
|
|
16055
|
+
catch (err) {
|
|
16056
|
+
// Capture and store the initialization error
|
|
16057
|
+
this.#signerInitialisationError = err;
|
|
16058
|
+
resolve(undefined);
|
|
16059
|
+
}
|
|
16060
|
+
});
|
|
16061
|
+
}
|
|
16062
|
+
async #getSigner() {
|
|
16063
|
+
const ethSigner = await this.#ethSigner;
|
|
16064
|
+
// Throw the stored error if the signers failed to initialise
|
|
16065
|
+
if (typeof ethSigner === 'undefined') {
|
|
16066
|
+
if (typeof this.#signerInitialisationError !== 'undefined') {
|
|
16067
|
+
throw this.#signerInitialisationError;
|
|
16068
|
+
}
|
|
16069
|
+
throw new Error('Signer failed to initialise');
|
|
16070
|
+
}
|
|
16071
|
+
return ethSigner;
|
|
16053
16072
|
}
|
|
16054
|
-
async performRequest(request) {
|
|
16073
|
+
async #performRequest(request) {
|
|
16055
16074
|
switch (request.method) {
|
|
16056
16075
|
case 'eth_requestAccounts': {
|
|
16057
|
-
if (this
|
|
16058
|
-
return [this
|
|
16076
|
+
if (this.#zkEvmAddress) {
|
|
16077
|
+
return [this.#zkEvmAddress];
|
|
16059
16078
|
}
|
|
16060
|
-
const
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
|
|
16065
|
-
|
|
16066
|
-
|
|
16067
|
-
|
|
16068
|
-
|
|
16069
|
-
|
|
16070
|
-
|
|
16071
|
-
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
|
|
16079
|
+
const user = await this.#authManager.getUserOrLogin();
|
|
16080
|
+
this.#initialiseEthSigner(user);
|
|
16081
|
+
if (!isZkEvmUser(user)) {
|
|
16082
|
+
const ethSigner = await this.#getSigner();
|
|
16083
|
+
const userZkEvm = await registerZkEvmUser({
|
|
16084
|
+
ethSigner,
|
|
16085
|
+
authManager: this.#authManager,
|
|
16086
|
+
multiRollupApiClients: this.#multiRollupApiClients,
|
|
16087
|
+
accessToken: user.accessToken,
|
|
16088
|
+
jsonRpcProvider: this.#jsonRpcProvider,
|
|
16089
|
+
});
|
|
16090
|
+
this.#zkEvmAddress = userZkEvm.zkEvm.ethAddress;
|
|
16091
|
+
}
|
|
16092
|
+
else {
|
|
16093
|
+
this.#zkEvmAddress = user.zkEvm.ethAddress;
|
|
16094
|
+
}
|
|
16095
|
+
this.#eventEmitter.emit(ProviderEvent.ACCOUNTS_CHANGED, [this.#zkEvmAddress]);
|
|
16096
|
+
return [this.#zkEvmAddress];
|
|
16075
16097
|
}
|
|
16076
16098
|
case 'eth_sendTransaction': {
|
|
16077
|
-
if (!this
|
|
16099
|
+
if (!this.#zkEvmAddress) {
|
|
16078
16100
|
throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'Unauthorised - call eth_requestAccounts first');
|
|
16079
16101
|
}
|
|
16102
|
+
const ethSigner = await this.#getSigner();
|
|
16080
16103
|
return sendTransaction({
|
|
16081
16104
|
params: request.params || [],
|
|
16082
|
-
|
|
16083
|
-
guardianClient: this
|
|
16084
|
-
jsonRpcProvider: this
|
|
16085
|
-
relayerClient: this
|
|
16086
|
-
zkevmAddress: this
|
|
16105
|
+
ethSigner,
|
|
16106
|
+
guardianClient: this.#guardianClient,
|
|
16107
|
+
jsonRpcProvider: this.#jsonRpcProvider,
|
|
16108
|
+
relayerClient: this.#relayerClient,
|
|
16109
|
+
zkevmAddress: this.#zkEvmAddress,
|
|
16087
16110
|
});
|
|
16088
16111
|
}
|
|
16089
16112
|
case 'eth_accounts': {
|
|
16090
|
-
return this
|
|
16113
|
+
return this.#zkEvmAddress ? [this.#zkEvmAddress] : [];
|
|
16091
16114
|
}
|
|
16092
16115
|
case 'eth_signTypedData':
|
|
16093
16116
|
case 'eth_signTypedData_v4': {
|
|
16094
|
-
if (!this
|
|
16117
|
+
if (!this.#zkEvmAddress) {
|
|
16095
16118
|
throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'Unauthorised - call eth_requestAccounts first');
|
|
16096
16119
|
}
|
|
16120
|
+
const ethSigner = await this.#getSigner();
|
|
16097
16121
|
return signTypedDataV4({
|
|
16098
16122
|
method: request.method,
|
|
16099
16123
|
params: request.params || [],
|
|
16100
|
-
|
|
16101
|
-
jsonRpcProvider: this
|
|
16102
|
-
relayerClient: this
|
|
16103
|
-
guardianClient: this
|
|
16124
|
+
ethSigner,
|
|
16125
|
+
jsonRpcProvider: this.#jsonRpcProvider,
|
|
16126
|
+
relayerClient: this.#relayerClient,
|
|
16127
|
+
guardianClient: this.#guardianClient,
|
|
16104
16128
|
});
|
|
16105
16129
|
}
|
|
16106
16130
|
// Pass through methods
|
|
@@ -16117,17 +16141,17 @@ class ZkEvmProvider {
|
|
|
16117
16141
|
case 'eth_getTransactionByHash':
|
|
16118
16142
|
case 'eth_getTransactionReceipt':
|
|
16119
16143
|
case 'eth_getTransactionCount': {
|
|
16120
|
-
return this
|
|
16144
|
+
return this.#jsonRpcProvider.send(request.method, request.params || []);
|
|
16121
16145
|
}
|
|
16122
16146
|
default: {
|
|
16123
16147
|
throw new JsonRpcError(ProviderErrorCode.UNSUPPORTED_METHOD, 'Method not supported');
|
|
16124
16148
|
}
|
|
16125
16149
|
}
|
|
16126
16150
|
}
|
|
16127
|
-
async performJsonRpcRequest(request) {
|
|
16151
|
+
async #performJsonRpcRequest(request) {
|
|
16128
16152
|
const { id, jsonrpc } = request;
|
|
16129
16153
|
try {
|
|
16130
|
-
const result = await this
|
|
16154
|
+
const result = await this.#performRequest(request);
|
|
16131
16155
|
return {
|
|
16132
16156
|
id,
|
|
16133
16157
|
jsonrpc,
|
|
@@ -16154,7 +16178,7 @@ class ZkEvmProvider {
|
|
|
16154
16178
|
}
|
|
16155
16179
|
async request(request) {
|
|
16156
16180
|
try {
|
|
16157
|
-
return this
|
|
16181
|
+
return this.#performRequest(request);
|
|
16158
16182
|
}
|
|
16159
16183
|
catch (error) {
|
|
16160
16184
|
if (error instanceof JsonRpcError) {
|
|
@@ -16171,14 +16195,14 @@ class ZkEvmProvider {
|
|
|
16171
16195
|
throw new Error('No callback provided');
|
|
16172
16196
|
}
|
|
16173
16197
|
if (Array.isArray(request)) {
|
|
16174
|
-
Promise.all(request.map(this
|
|
16198
|
+
Promise.all(request.map(this.#performJsonRpcRequest)).then((result) => {
|
|
16175
16199
|
callback(null, result);
|
|
16176
16200
|
}).catch((error) => {
|
|
16177
16201
|
callback(error, []);
|
|
16178
16202
|
});
|
|
16179
16203
|
}
|
|
16180
16204
|
else {
|
|
16181
|
-
this
|
|
16205
|
+
this.#performJsonRpcRequest(request).then((result) => {
|
|
16182
16206
|
callback(null, result);
|
|
16183
16207
|
}).catch((error) => {
|
|
16184
16208
|
callback(error, null);
|
|
@@ -16210,15 +16234,15 @@ class ZkEvmProvider {
|
|
|
16210
16234
|
return this.sendAsync(request, callbackOrParams);
|
|
16211
16235
|
}
|
|
16212
16236
|
if (!Array.isArray(request) && typeof request === 'object') {
|
|
16213
|
-
return this
|
|
16237
|
+
return this.#performJsonRpcRequest(request);
|
|
16214
16238
|
}
|
|
16215
16239
|
throw new JsonRpcError(RpcErrorCode.INVALID_REQUEST, 'Invalid request');
|
|
16216
16240
|
}
|
|
16217
16241
|
on(event, listener) {
|
|
16218
|
-
this
|
|
16242
|
+
this.#eventEmitter.on(event, listener);
|
|
16219
16243
|
}
|
|
16220
16244
|
removeListener(event, listener) {
|
|
16221
|
-
this
|
|
16245
|
+
this.#eventEmitter.removeListener(event, listener);
|
|
16222
16246
|
}
|
|
16223
16247
|
}
|
|
16224
16248
|
|
package/dist/x.js
CHANGED
|
@@ -136,7 +136,7 @@ const flattenProperties = (properties) => {
|
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
139
|
-
const SDK_VERSION = '1.7.2';
|
|
139
|
+
const SDK_VERSION = '1.7.3-alpha.2';
|
|
140
140
|
const getReferrer = () => {
|
|
141
141
|
if (isNode()) {
|
|
142
142
|
return '';
|
|
@@ -328,7 +328,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
328
328
|
chainID,
|
|
329
329
|
coreContractAddress,
|
|
330
330
|
registrationContractAddress,
|
|
331
|
-
sdkVersion: 'ts-immutable-sdk-1.7.2',
|
|
331
|
+
sdkVersion: 'ts-immutable-sdk-1.7.3-alpha.2',
|
|
332
332
|
});
|
|
333
333
|
/**
|
|
334
334
|
* Sets `sdkVersion` at the time of build
|
package/package.json
CHANGED