@imtbl/sdk 1.19.2-alpha.1 → 1.19.3-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.
- package/dist/blockchain_data.js +2 -2
- package/dist/browser/checkout/{BridgeWidget-a1459601.js → BridgeWidget-8473be99.js} +1 -1
- package/dist/browser/checkout/{HorizontalMenu-actual-08754aa6.js → HorizontalMenu-actual-fae5016a.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-52218bd1.js → OnRampWidget-541bdaf9.js} +1 -1
- package/dist/browser/checkout/SaleWidget-908b7bab.js +2 -0
- package/dist/browser/checkout/{SpendingCapHero-90db2206.js → SpendingCapHero-09425092.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-3635434d.js → SwapWidget-67de0982.js} +1 -1
- package/dist/browser/checkout/{TopUpView-67c26c0e.js → TopUpView-0a2474da.js} +1 -1
- package/dist/browser/checkout/{WalletWidget-2ed51013.js → WalletWidget-5cd62948.js} +1 -1
- package/dist/browser/checkout/{auto-track-05a079ed.js → auto-track-e4ac1604.js} +1 -1
- package/dist/browser/checkout/{balance-0ee1be7d.js → balance-f3120e67.js} +1 -1
- package/dist/browser/checkout/{index-3f3f2ae3.js → index-4c0f56d2.js} +2 -2
- package/dist/browser/checkout/{index-b7601a04.js → index-4e267d8c.js} +1 -1
- package/dist/browser/checkout/{index-43d8cc45.js → index-62c63421.js} +1 -1
- package/dist/browser/checkout/{index-56a0f324.js → index-99eb8084.js} +1 -1
- package/dist/browser/checkout/{index-6c4db150.js → index-acee0f40.js} +1 -1
- package/dist/browser/checkout/{index-db394721.js → index-dc45747d.js} +1 -1
- package/dist/browser/checkout/index-eab43a8d.js +1 -0
- package/dist/browser/checkout/{index-5adbc757.js → index-fe11d6b1.js} +1 -1
- package/dist/browser/checkout/{index.umd-6ee30c1b.js → index.umd-aaf8e1b4.js} +1 -1
- package/dist/browser/checkout/{retry-27ee3083.js → retry-3152ba85.js} +1 -1
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/browser/checkout/widgets-esm.js +1 -1
- package/dist/browser/checkout/widgets.js +5 -5
- package/dist/checkout.d.ts +239 -603
- package/dist/checkout.js +7 -7
- package/dist/config.js +1 -1
- package/dist/index.browser.js +13 -13
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +77 -87
- package/dist/index.d.ts +1160 -1718
- package/dist/index.js +79 -89
- package/dist/orderbook.js +1 -1
- package/dist/passport.d.ts +478 -838
- package/dist/passport.js +29 -29
- package/dist/x.d.ts +103 -657
- package/dist/x.js +47 -58
- package/package.json +1 -1
- package/dist/browser/checkout/SaleWidget-22fef0b5.js +0 -2
- package/dist/browser/checkout/index-c652c950.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -181,7 +181,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
181
181
|
};
|
|
182
182
|
|
|
183
183
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
184
|
-
const SDK_VERSION$1 = '1.19.
|
|
184
|
+
const SDK_VERSION$1 = '1.19.3-alpha';
|
|
185
185
|
const getReferrer$1 = () => {
|
|
186
186
|
if (isNode$1()) {
|
|
187
187
|
return '';
|
|
@@ -13557,7 +13557,7 @@ class MultiRollupApiClients {
|
|
|
13557
13557
|
}
|
|
13558
13558
|
|
|
13559
13559
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13560
|
-
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.19.
|
|
13560
|
+
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.19.3-alpha' };
|
|
13561
13561
|
const createConfig$1 = ({ basePath, headers, }) => {
|
|
13562
13562
|
if (!basePath.trim()) {
|
|
13563
13563
|
throw Error('basePath can not be empty');
|
|
@@ -13629,7 +13629,7 @@ class APIError extends Error {
|
|
|
13629
13629
|
|
|
13630
13630
|
/* eslint-disable implicit-arrow-linebreak */
|
|
13631
13631
|
const defaultHeaders$1 = {
|
|
13632
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.19.
|
|
13632
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.19.3-alpha',
|
|
13633
13633
|
};
|
|
13634
13634
|
/**
|
|
13635
13635
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -14103,7 +14103,7 @@ var blockchain_data = /*#__PURE__*/Object.freeze({
|
|
|
14103
14103
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
14104
14104
|
class ApiConfiguration extends index$2.Configuration {
|
|
14105
14105
|
}
|
|
14106
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.19.
|
|
14106
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.19.3-alpha' };
|
|
14107
14107
|
/**
|
|
14108
14108
|
* @dev use createImmutableXConfiguration instead
|
|
14109
14109
|
*/
|
|
@@ -14142,7 +14142,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
14142
14142
|
chainID,
|
|
14143
14143
|
coreContractAddress,
|
|
14144
14144
|
registrationContractAddress,
|
|
14145
|
-
sdkVersion: 'ts-immutable-sdk-1.19.
|
|
14145
|
+
sdkVersion: 'ts-immutable-sdk-1.19.3-alpha',
|
|
14146
14146
|
baseConfig,
|
|
14147
14147
|
});
|
|
14148
14148
|
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
|
@@ -25637,9 +25637,9 @@ function digestOfTransactionsAndNonce(nonce, normalisedTransactions) {
|
|
|
25637
25637
|
const packMetaTransactionsNonceData = ethers.utils.defaultAbiCoder.encode(['uint256', META_TRANSACTIONS_TYPE], [nonce, normalisedTransactions]);
|
|
25638
25638
|
return ethers.utils.keccak256(packMetaTransactionsNonceData);
|
|
25639
25639
|
}
|
|
25640
|
-
const getNonce = async (
|
|
25640
|
+
const getNonce = async (jsonRpcProvider, smartContractWalletAddress) => {
|
|
25641
25641
|
try {
|
|
25642
|
-
const contract = new ethers.Contract(smartContractWalletAddress, abi.walletContracts.mainModule.abi,
|
|
25642
|
+
const contract = new ethers.Contract(smartContractWalletAddress, abi.walletContracts.mainModule.abi, jsonRpcProvider);
|
|
25643
25643
|
const result = await contract.nonce();
|
|
25644
25644
|
if (result instanceof ethers.BigNumber) {
|
|
25645
25645
|
return result;
|
|
@@ -25741,11 +25741,11 @@ const getEip155ChainId = (chainId) => `eip155:${chainId}`;
|
|
|
25741
25741
|
|
|
25742
25742
|
class RelayerClient {
|
|
25743
25743
|
config;
|
|
25744
|
-
|
|
25744
|
+
jsonRpcProvider;
|
|
25745
25745
|
authManager;
|
|
25746
|
-
constructor({ config,
|
|
25746
|
+
constructor({ config, jsonRpcProvider, authManager }) {
|
|
25747
25747
|
this.config = config;
|
|
25748
|
-
this.
|
|
25748
|
+
this.jsonRpcProvider = jsonRpcProvider;
|
|
25749
25749
|
this.authManager = authManager;
|
|
25750
25750
|
}
|
|
25751
25751
|
async postToRelayer(request) {
|
|
@@ -25770,7 +25770,7 @@ class RelayerClient {
|
|
|
25770
25770
|
return jsonResponse;
|
|
25771
25771
|
}
|
|
25772
25772
|
async ethSendTransaction(to, data) {
|
|
25773
|
-
const { chainId } = await this.
|
|
25773
|
+
const { chainId } = await this.jsonRpcProvider.ready;
|
|
25774
25774
|
const payload = {
|
|
25775
25775
|
method: 'eth_sendTransaction',
|
|
25776
25776
|
params: [{
|
|
@@ -25791,7 +25791,7 @@ class RelayerClient {
|
|
|
25791
25791
|
return result;
|
|
25792
25792
|
}
|
|
25793
25793
|
async imGetFeeOptions(userAddress, data) {
|
|
25794
|
-
const { chainId } = await this.
|
|
25794
|
+
const { chainId } = await this.jsonRpcProvider.ready;
|
|
25795
25795
|
const payload = {
|
|
25796
25796
|
method: 'im_getFeeOptions',
|
|
25797
25797
|
params: [{
|
|
@@ -25804,7 +25804,7 @@ class RelayerClient {
|
|
|
25804
25804
|
return result;
|
|
25805
25805
|
}
|
|
25806
25806
|
async imSignTypedData(address, eip712Payload) {
|
|
25807
|
-
const { chainId } = await this.
|
|
25807
|
+
const { chainId } = await this.jsonRpcProvider.ready;
|
|
25808
25808
|
const payload = {
|
|
25809
25809
|
method: 'im_signTypedData',
|
|
25810
25810
|
params: [{
|
|
@@ -25851,11 +25851,11 @@ class JsonRpcError extends Error {
|
|
|
25851
25851
|
}
|
|
25852
25852
|
|
|
25853
25853
|
const MESSAGE_TO_SIGN = 'Only sign this message from Immutable Passport';
|
|
25854
|
-
async function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken,
|
|
25854
|
+
async function registerZkEvmUser({ authManager, ethSigner, multiRollupApiClients, accessToken, jsonRpcProvider, }) {
|
|
25855
25855
|
const [ethereumAddress, ethereumSignature, network, chainListResponse] = await Promise.all([
|
|
25856
25856
|
ethSigner.getAddress(),
|
|
25857
25857
|
signRaw(MESSAGE_TO_SIGN, ethSigner),
|
|
25858
|
-
|
|
25858
|
+
jsonRpcProvider.ready,
|
|
25859
25859
|
multiRollupApiClients.chainsApi.listChains(),
|
|
25860
25860
|
]);
|
|
25861
25861
|
const eipChainId = getEip155ChainId(network.chainId);
|
|
@@ -26076,15 +26076,15 @@ const getMetaTransactions = async (metaTransaction, nonce, chainId, walletAddres
|
|
|
26076
26076
|
}
|
|
26077
26077
|
return [metaTransaction, feeMetaTransaction];
|
|
26078
26078
|
};
|
|
26079
|
-
const sendTransaction$1 = ({ params, ethSigner,
|
|
26079
|
+
const sendTransaction$1 = ({ params, ethSigner, jsonRpcProvider, relayerClient, guardianClient, zkevmAddress, }) => guardianClient
|
|
26080
26080
|
.withConfirmationScreen({ width: 480, height: 720 })(async () => {
|
|
26081
26081
|
const transactionRequest = params[0];
|
|
26082
26082
|
if (!transactionRequest.to) {
|
|
26083
26083
|
throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, 'eth_sendTransaction requires a "to" field');
|
|
26084
26084
|
}
|
|
26085
|
-
const { chainId } = await
|
|
26085
|
+
const { chainId } = await jsonRpcProvider.ready;
|
|
26086
26086
|
const chainIdBigNumber = ethers.BigNumber.from(chainId);
|
|
26087
|
-
const nonce = await getNonce(
|
|
26087
|
+
const nonce = await getNonce(jsonRpcProvider, zkevmAddress);
|
|
26088
26088
|
const metaTransaction = {
|
|
26089
26089
|
to: transactionRequest.to,
|
|
26090
26090
|
data: transactionRequest.data,
|
|
@@ -26172,14 +26172,14 @@ const transformTypedData = (typedData, chainId) => {
|
|
|
26172
26172
|
}
|
|
26173
26173
|
return transformedTypedData;
|
|
26174
26174
|
};
|
|
26175
|
-
const signTypedDataV4 = async ({ params, method, ethSigner,
|
|
26175
|
+
const signTypedDataV4 = async ({ params, method, ethSigner, jsonRpcProvider, relayerClient, guardianClient, }) => guardianClient
|
|
26176
26176
|
.withConfirmationScreen({ width: 480, height: 720 })(async () => {
|
|
26177
26177
|
const fromAddress = params[0];
|
|
26178
26178
|
const typedDataParam = params[1];
|
|
26179
26179
|
if (!fromAddress || !typedDataParam) {
|
|
26180
26180
|
throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, `${method} requires an address and a typed data JSON`);
|
|
26181
26181
|
}
|
|
26182
|
-
const { chainId } = await
|
|
26182
|
+
const { chainId } = await jsonRpcProvider.ready;
|
|
26183
26183
|
const typedData = transformTypedData(typedDataParam, chainId);
|
|
26184
26184
|
await guardianClient.validateMessage({ chainID: String(chainId), payload: typedData });
|
|
26185
26185
|
const relayerSignature = await relayerClient.imSignTypedData(fromAddress, typedData);
|
|
@@ -26192,7 +26192,7 @@ class ZkEvmProvider {
|
|
|
26192
26192
|
#config;
|
|
26193
26193
|
#eventEmitter;
|
|
26194
26194
|
#guardianClient;
|
|
26195
|
-
#
|
|
26195
|
+
#jsonRpcProvider; // Used for read
|
|
26196
26196
|
#magicAdapter;
|
|
26197
26197
|
#multiRollupApiClients;
|
|
26198
26198
|
#relayerClient;
|
|
@@ -26212,19 +26212,19 @@ class ZkEvmProvider {
|
|
|
26212
26212
|
this.#config = config;
|
|
26213
26213
|
this.#guardianClient = guardianClient;
|
|
26214
26214
|
if (config.crossSdkBridgeEnabled) {
|
|
26215
|
-
//
|
|
26215
|
+
// JsonRpcProvider by default sets the referrer as "client".
|
|
26216
26216
|
// On Unreal 4 this errors as the browser used is expecting a valid URL.
|
|
26217
|
-
this.#
|
|
26217
|
+
this.#jsonRpcProvider = new providers.JsonRpcProvider({
|
|
26218
26218
|
url: this.#config.zkEvmRpcUrl,
|
|
26219
26219
|
fetchOptions: { referrer: 'http://imtblgamesdk.local' },
|
|
26220
26220
|
});
|
|
26221
26221
|
}
|
|
26222
26222
|
else {
|
|
26223
|
-
this.#
|
|
26223
|
+
this.#jsonRpcProvider = new providers.JsonRpcProvider(this.#config.zkEvmRpcUrl);
|
|
26224
26224
|
}
|
|
26225
26225
|
this.#relayerClient = new RelayerClient({
|
|
26226
26226
|
config: this.#config,
|
|
26227
|
-
|
|
26227
|
+
jsonRpcProvider: this.#jsonRpcProvider,
|
|
26228
26228
|
authManager: this.#authManager,
|
|
26229
26229
|
});
|
|
26230
26230
|
this.#multiRollupApiClients = multiRollupApiClients;
|
|
@@ -26295,7 +26295,7 @@ class ZkEvmProvider {
|
|
|
26295
26295
|
authManager: this.#authManager,
|
|
26296
26296
|
multiRollupApiClients: this.#multiRollupApiClients,
|
|
26297
26297
|
accessToken: user.accessToken,
|
|
26298
|
-
|
|
26298
|
+
jsonRpcProvider: this.#jsonRpcProvider,
|
|
26299
26299
|
});
|
|
26300
26300
|
}
|
|
26301
26301
|
else {
|
|
@@ -26313,7 +26313,7 @@ class ZkEvmProvider {
|
|
|
26313
26313
|
params: request.params || [],
|
|
26314
26314
|
ethSigner,
|
|
26315
26315
|
guardianClient: this.#guardianClient,
|
|
26316
|
-
|
|
26316
|
+
jsonRpcProvider: this.#jsonRpcProvider,
|
|
26317
26317
|
relayerClient: this.#relayerClient,
|
|
26318
26318
|
zkevmAddress: this.#zkEvmAddress,
|
|
26319
26319
|
});
|
|
@@ -26331,7 +26331,7 @@ class ZkEvmProvider {
|
|
|
26331
26331
|
method: request.method,
|
|
26332
26332
|
params: request.params || [],
|
|
26333
26333
|
ethSigner,
|
|
26334
|
-
|
|
26334
|
+
jsonRpcProvider: this.#jsonRpcProvider,
|
|
26335
26335
|
relayerClient: this.#relayerClient,
|
|
26336
26336
|
guardianClient: this.#guardianClient,
|
|
26337
26337
|
});
|
|
@@ -26350,7 +26350,7 @@ class ZkEvmProvider {
|
|
|
26350
26350
|
case 'eth_getTransactionByHash':
|
|
26351
26351
|
case 'eth_getTransactionReceipt':
|
|
26352
26352
|
case 'eth_getTransactionCount': {
|
|
26353
|
-
return this.#
|
|
26353
|
+
return this.#jsonRpcProvider.send(request.method, request.params || []);
|
|
26354
26354
|
}
|
|
26355
26355
|
default: {
|
|
26356
26356
|
throw new JsonRpcError(ProviderErrorCode.UNSUPPORTED_METHOD, 'Method not supported');
|
|
@@ -45437,7 +45437,7 @@ const flattenProperties = (properties) => {
|
|
|
45437
45437
|
};
|
|
45438
45438
|
|
|
45439
45439
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
45440
|
-
const SDK_VERSION = '1.19.
|
|
45440
|
+
const SDK_VERSION = '1.19.3-alpha';
|
|
45441
45441
|
const getReferrer = () => {
|
|
45442
45442
|
if (isNode()) {
|
|
45443
45443
|
return '';
|
|
@@ -50632,7 +50632,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
50632
50632
|
maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
|
|
50633
50633
|
};
|
|
50634
50634
|
|
|
50635
|
-
const SDK_VERSION_MARKER = '1.19.
|
|
50635
|
+
const SDK_VERSION_MARKER = '1.19.3-alpha';
|
|
50636
50636
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
50637
50637
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
50638
50638
|
|
|
@@ -51441,7 +51441,7 @@ async function bridgeToL2GasEstimator(readOnlyProviders, config) {
|
|
|
51441
51441
|
const toChainId = getL2ChainId(config);
|
|
51442
51442
|
const provider = readOnlyProviders.get(fromChainId);
|
|
51443
51443
|
if (!provider)
|
|
51444
|
-
throw new Error(`Missing
|
|
51444
|
+
throw new Error(`Missing JsonRpcProvider for chain id: ${fromChainId}`);
|
|
51445
51445
|
try {
|
|
51446
51446
|
const tokenBridge = createBridgeInstance(fromChainId, toChainId, readOnlyProviders, config);
|
|
51447
51447
|
// This gas estimate does not include an ERC20 approval
|
|
@@ -52368,7 +52368,7 @@ async function createReadOnlyProviders(config, existingReadOnlyProviders) {
|
|
|
52368
52368
|
});
|
|
52369
52369
|
allowedNetworks.networks.forEach((networkInfo) => {
|
|
52370
52370
|
const rpcUrl = config.networkMap.get(networkInfo.chainId)?.rpcUrls[0];
|
|
52371
|
-
const provider = new providers.
|
|
52371
|
+
const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
52372
52372
|
readOnlyProviders.set(networkInfo.chainId, provider);
|
|
52373
52373
|
});
|
|
52374
52374
|
return readOnlyProviders;
|
|
@@ -54767,7 +54767,7 @@ async function validateChain(signer, config) {
|
|
|
54767
54767
|
async function transfer({ signers: { ethSigner, starkSigner }, request, config, }) {
|
|
54768
54768
|
await validateChain(ethSigner, config.immutableXConfig);
|
|
54769
54769
|
const ethAddress = await ethSigner.getAddress();
|
|
54770
|
-
const transfersApi = new
|
|
54770
|
+
const transfersApi = new index$2.TransfersApi(config.immutableXConfig.apiConfiguration);
|
|
54771
54771
|
const transferAmount = request.type === 'ERC721' ? '1' : request.amount;
|
|
54772
54772
|
const signableResult = await transfersApi.getSignableTransferV1({
|
|
54773
54773
|
getSignableTransferRequest: {
|
|
@@ -54807,7 +54807,7 @@ async function transfer({ signers: { ethSigner, starkSigner }, request, config,
|
|
|
54807
54807
|
async function batchTransfer({ signers: { ethSigner, starkSigner }, request, config, }) {
|
|
54808
54808
|
await validateChain(ethSigner, config.immutableXConfig);
|
|
54809
54809
|
const ethAddress = await ethSigner.getAddress();
|
|
54810
|
-
const transfersApi = new
|
|
54810
|
+
const transfersApi = new index$2.TransfersApi(config.immutableXConfig.apiConfiguration);
|
|
54811
54811
|
const signableRequests = request.map((nftTransfer) => ({
|
|
54812
54812
|
amount: '1',
|
|
54813
54813
|
token: convertToSignableToken({
|
|
@@ -54863,7 +54863,7 @@ async function batchTransfer({ signers: { ethSigner, starkSigner }, request, con
|
|
|
54863
54863
|
async function createOrder({ signers, request, config, }) {
|
|
54864
54864
|
await validateChain(signers.ethSigner, config.immutableXConfig);
|
|
54865
54865
|
const ethAddress = await signers.ethSigner.getAddress();
|
|
54866
|
-
const ordersApi = new
|
|
54866
|
+
const ordersApi = new index$2.OrdersApi(config.immutableXConfig.apiConfiguration);
|
|
54867
54867
|
const amountSell = request.sell.type === 'ERC721' ? '1' : request.sell.amount;
|
|
54868
54868
|
const amountBuy = request.buy.type === 'ERC721' ? '1' : request.buy.amount;
|
|
54869
54869
|
const getSignableOrderRequest = {
|
|
@@ -54905,7 +54905,7 @@ async function createOrder({ signers, request, config, }) {
|
|
|
54905
54905
|
};
|
|
54906
54906
|
}
|
|
54907
54907
|
async function cancelOrder({ signers, request, config, }) {
|
|
54908
|
-
const ordersApi = new
|
|
54908
|
+
const ordersApi = new index$2.OrdersApi(config.immutableXConfig.apiConfiguration);
|
|
54909
54909
|
const getSignableCancelOrderResponse = await ordersApi.getSignableCancelOrderV3({
|
|
54910
54910
|
getSignableCancelOrderRequest: {
|
|
54911
54911
|
order_id: request.order_id,
|
|
@@ -54932,7 +54932,7 @@ async function cancelOrder({ signers, request, config, }) {
|
|
|
54932
54932
|
|
|
54933
54933
|
async function registerOffchain(signers, config) {
|
|
54934
54934
|
await validateChain(signers.ethSigner, config.immutableXConfig);
|
|
54935
|
-
const usersApi = new
|
|
54935
|
+
const usersApi = new index$2.UsersApi(config.immutableXConfig.apiConfiguration);
|
|
54936
54936
|
const userAddress = await signers.ethSigner.getAddress();
|
|
54937
54937
|
const starkPublicKey = await signers.starkSigner.getAddress();
|
|
54938
54938
|
const signableResult = await usersApi.getSignableRegistrationOffchain({
|
|
@@ -54956,7 +54956,7 @@ async function registerOffchain(signers, config) {
|
|
|
54956
54956
|
}
|
|
54957
54957
|
async function isRegisteredOffchain(ethAddress, config) {
|
|
54958
54958
|
try {
|
|
54959
|
-
const usersApi = new
|
|
54959
|
+
const usersApi = new index$2.UsersApi(config.immutableXConfig.apiConfiguration);
|
|
54960
54960
|
const getUsersResult = await usersApi.getUsers({
|
|
54961
54961
|
user: ethAddress,
|
|
54962
54962
|
});
|
|
@@ -54972,7 +54972,7 @@ async function isRegisteredOffchain(ethAddress, config) {
|
|
|
54972
54972
|
}
|
|
54973
54973
|
async function isRegisteredOnChain(starkPublicKey, ethSigner, config) {
|
|
54974
54974
|
await validateChain(ethSigner, config.immutableXConfig);
|
|
54975
|
-
const registrationContract =
|
|
54975
|
+
const registrationContract = exportContracts.Registration.connect(config.immutableXConfig.ethConfiguration.registrationContractAddress, ethSigner);
|
|
54976
54976
|
try {
|
|
54977
54977
|
return await registrationContract.isRegistered(starkPublicKey);
|
|
54978
54978
|
}
|
|
@@ -55006,7 +55006,7 @@ const assertIsDefined = (value) => {
|
|
|
55006
55006
|
async function prepareWithdrawalAction(params) {
|
|
55007
55007
|
const { signers: { ethSigner, starkSigner }, type, config, } = params;
|
|
55008
55008
|
await validateChain(ethSigner, params.config);
|
|
55009
|
-
const withdrawalsApi = new
|
|
55009
|
+
const withdrawalsApi = new index$2.WithdrawalsApi(config.apiConfiguration);
|
|
55010
55010
|
const withdrawalAmount = type === 'ERC721' ? '1' : params.amount;
|
|
55011
55011
|
const signableWithdrawalResult = await withdrawalsApi.getSignableWithdrawal({
|
|
55012
55012
|
getSignableWithdrawalRequest: {
|
|
@@ -55034,7 +55034,7 @@ async function prepareWithdrawalAction(params) {
|
|
|
55034
55034
|
}
|
|
55035
55035
|
|
|
55036
55036
|
async function getEncodeAssetInfo(assetType, tokenType, config, tokenData) {
|
|
55037
|
-
const encodingApi = new
|
|
55037
|
+
const encodingApi = new index$2.EncodingApi(config.apiConfiguration);
|
|
55038
55038
|
const result = await encodingApi.encodeAsset({
|
|
55039
55039
|
assetType,
|
|
55040
55040
|
encodeAssetRequest: {
|
|
@@ -55050,14 +55050,14 @@ async function getEncodeAssetInfo(assetType, tokenType, config, tokenData) {
|
|
|
55050
55050
|
async function executeRegisterAndWithdrawERC20({ ethSigner, assetType, starkPublicKey, config, }) {
|
|
55051
55051
|
const etherKey = await ethSigner.getAddress();
|
|
55052
55052
|
const imxConfig = config.immutableXConfig;
|
|
55053
|
-
const usersApi = new
|
|
55053
|
+
const usersApi = new index$2.UsersApi(imxConfig.apiConfiguration);
|
|
55054
55054
|
const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
|
|
55055
|
-
const contract =
|
|
55055
|
+
const contract = exportContracts.Registration.connect(config.immutableXConfig.ethConfiguration.registrationContractAddress, ethSigner);
|
|
55056
55056
|
const populatedTransaction = await contract.populateTransaction.registerAndWithdraw(etherKey, starkPublicKey, signableResult.operator_signature, assetType);
|
|
55057
55057
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
55058
55058
|
}
|
|
55059
55059
|
async function executeWithdrawERC20(ethSigner, assetType, starkPublicKey, config) {
|
|
55060
|
-
const contract =
|
|
55060
|
+
const contract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
|
|
55061
55061
|
const populatedTransaction = await contract.populateTransaction.withdraw(starkPublicKey, assetType);
|
|
55062
55062
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
55063
55063
|
}
|
|
@@ -55080,15 +55080,15 @@ async function completeERC20WithdrawalAction({ ethSigner, starkPublicKey, token,
|
|
|
55080
55080
|
}
|
|
55081
55081
|
|
|
55082
55082
|
async function executeWithdrawMintableERC721(ethSigner, assetType, starkPublicKey, mintingBlob, config) {
|
|
55083
|
-
const contract =
|
|
55083
|
+
const contract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
|
|
55084
55084
|
const populatedTransaction = await contract.populateTransaction.withdrawAndMint(starkPublicKey, assetType, mintingBlob);
|
|
55085
55085
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
55086
55086
|
}
|
|
55087
55087
|
async function executeRegisterAndWithdrawMintableERC721(ethSigner, assetType, starkPublicKey, mintingBlob, config) {
|
|
55088
55088
|
const etherKey = await ethSigner.getAddress();
|
|
55089
|
-
const usersApi = new
|
|
55089
|
+
const usersApi = new index$2.UsersApi(config.apiConfiguration);
|
|
55090
55090
|
const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
|
|
55091
|
-
const contract =
|
|
55091
|
+
const contract = exportContracts.Registration.connect(config.ethConfiguration.registrationContractAddress, ethSigner);
|
|
55092
55092
|
const populatedTransaction = await contract.populateTransaction.regsiterAndWithdrawAndMint(etherKey, starkPublicKey, signableResult.operator_signature, assetType, mintingBlob);
|
|
55093
55093
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
55094
55094
|
}
|
|
@@ -55113,14 +55113,14 @@ async function completeMintableERC721Withdrawal(ethSigner, starkPublicKey, token
|
|
|
55113
55113
|
}
|
|
55114
55114
|
async function executeRegisterAndWithdrawERC721(ethSigner, assetType, starkPublicKey, tokenId, config) {
|
|
55115
55115
|
const etherKey = await ethSigner.getAddress();
|
|
55116
|
-
const usersApi = new
|
|
55116
|
+
const usersApi = new index$2.UsersApi(config.apiConfiguration);
|
|
55117
55117
|
const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
|
|
55118
|
-
const contract =
|
|
55118
|
+
const contract = exportContracts.Registration.connect(config.ethConfiguration.registrationContractAddress, ethSigner);
|
|
55119
55119
|
const populatedTransaction = await contract.populateTransaction.registerAndWithdrawNft(etherKey, starkPublicKey, signableResult.operator_signature, assetType, tokenId);
|
|
55120
55120
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
55121
55121
|
}
|
|
55122
55122
|
async function executeWithdrawERC721(ethSigner, assetType, starkPublicKey, tokenId, config) {
|
|
55123
|
-
const contract =
|
|
55123
|
+
const contract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
|
|
55124
55124
|
const populatedTransaction = await contract.populateTransaction.withdrawNft(starkPublicKey, assetType, tokenId);
|
|
55125
55125
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
55126
55126
|
}
|
|
@@ -55141,7 +55141,7 @@ async function completeERC721WithdrawalAction({ ethSigner, starkPublicKey, token
|
|
|
55141
55141
|
const { tokenAddress } = token;
|
|
55142
55142
|
const { tokenId } = token;
|
|
55143
55143
|
const imxConfig = config.immutableXConfig;
|
|
55144
|
-
const mintsApi = new
|
|
55144
|
+
const mintsApi = new index$2.MintsApi(imxConfig.apiConfiguration);
|
|
55145
55145
|
return await mintsApi
|
|
55146
55146
|
.getMintableTokenDetailsByClientTokenId({
|
|
55147
55147
|
tokenAddress,
|
|
@@ -55166,14 +55166,14 @@ async function completeERC721WithdrawalAction({ ethSigner, starkPublicKey, token
|
|
|
55166
55166
|
|
|
55167
55167
|
async function executeRegisterAndWithdrawEth(ethSigner, assetType, starkPublicKey, config) {
|
|
55168
55168
|
const etherKey = await ethSigner.getAddress();
|
|
55169
|
-
const usersApi = new
|
|
55169
|
+
const usersApi = new index$2.UsersApi(config.apiConfiguration);
|
|
55170
55170
|
const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
|
|
55171
|
-
const contract =
|
|
55171
|
+
const contract = exportContracts.Registration.connect(config.ethConfiguration.registrationContractAddress, ethSigner);
|
|
55172
55172
|
const populatedTransaction = await contract.populateTransaction.registerAndWithdraw(etherKey, starkPublicKey, signableResult.operator_signature, assetType);
|
|
55173
55173
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
55174
55174
|
}
|
|
55175
55175
|
async function executeWithdrawEth(ethSigner, assetType, starkPublicKey, config) {
|
|
55176
|
-
const contract =
|
|
55176
|
+
const contract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
|
|
55177
55177
|
const populatedTransaction = await contract.populateTransaction.withdraw(starkPublicKey, assetType);
|
|
55178
55178
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
55179
55179
|
}
|
|
@@ -55223,7 +55223,7 @@ async function completeWithdrawal({ signers: { ethSigner }, starkPublicKey, toke
|
|
|
55223
55223
|
async function createTrade({ signers: { ethSigner, starkSigner }, request, config, }) {
|
|
55224
55224
|
await validateChain(ethSigner, config.immutableXConfig);
|
|
55225
55225
|
const ethAddress = await ethSigner.getAddress();
|
|
55226
|
-
const tradesApi = new
|
|
55226
|
+
const tradesApi = new index$2.TradesApi(config.immutableXConfig.apiConfiguration);
|
|
55227
55227
|
const signableResult = await tradesApi.getSignableTrade({
|
|
55228
55228
|
getSignableTradeRequest: {
|
|
55229
55229
|
user: ethAddress,
|
|
@@ -55259,13 +55259,13 @@ async function createTrade({ signers: { ethSigner, starkSigner }, request, confi
|
|
|
55259
55259
|
|
|
55260
55260
|
async function executeRegisterAndDepositEth(ethSigner, amount, assetType, starkPublicKey, vaultId, config, usersApi) {
|
|
55261
55261
|
const etherKey = await ethSigner.getAddress();
|
|
55262
|
-
const coreContract =
|
|
55262
|
+
const coreContract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
|
|
55263
55263
|
const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
|
|
55264
55264
|
const populatedTransaction = await coreContract.populateTransaction.registerAndDepositEth(etherKey, starkPublicKey, signableResult.operator_signature, assetType, vaultId);
|
|
55265
55265
|
return ethSigner.sendTransaction({ ...populatedTransaction, value: amount });
|
|
55266
55266
|
}
|
|
55267
55267
|
async function executeDepositEth(ethSigner, amount, assetType, starkPublicKey, vaultId, config) {
|
|
55268
|
-
const coreContract =
|
|
55268
|
+
const coreContract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
|
|
55269
55269
|
const populatedTransaction = await coreContract.populateTransaction['deposit(uint256,uint256,uint256)'](starkPublicKey, assetType, vaultId);
|
|
55270
55270
|
return ethSigner.sendTransaction({ ...populatedTransaction, value: amount });
|
|
55271
55271
|
}
|
|
@@ -55277,9 +55277,9 @@ async function depositEth({ signers: { ethSigner }, deposit, config, }) {
|
|
|
55277
55277
|
};
|
|
55278
55278
|
const amount = units.parseUnits(deposit.amount, 'wei');
|
|
55279
55279
|
const imxConfig = config.immutableXConfig;
|
|
55280
|
-
const depositsApi = new
|
|
55281
|
-
const encodingApi = new
|
|
55282
|
-
const usersApi = new
|
|
55280
|
+
const depositsApi = new index$2.DepositsApi(imxConfig.apiConfiguration);
|
|
55281
|
+
const encodingApi = new index$2.EncodingApi(imxConfig.apiConfiguration);
|
|
55282
|
+
const usersApi = new index$2.UsersApi(imxConfig.apiConfiguration);
|
|
55283
55283
|
const getSignableDepositRequest = {
|
|
55284
55284
|
user,
|
|
55285
55285
|
token: {
|
|
@@ -55311,13 +55311,13 @@ async function depositEth({ signers: { ethSigner }, deposit, config, }) {
|
|
|
55311
55311
|
|
|
55312
55312
|
async function executeRegisterAndDepositERC20(ethSigner, quantizedAmount, assetType, starkPublicKey, vaultId, config, usersApi) {
|
|
55313
55313
|
const etherKey = await ethSigner.getAddress();
|
|
55314
|
-
const coreContract =
|
|
55314
|
+
const coreContract = exportContracts.Core.connect(config.coreContractAddress, ethSigner);
|
|
55315
55315
|
const signableResult = await getSignableRegistrationOnchain(etherKey, starkPublicKey, usersApi);
|
|
55316
55316
|
const populatedTransaction = await coreContract.populateTransaction.registerAndDepositERC20(etherKey, starkPublicKey, signableResult.operator_signature, assetType, vaultId, quantizedAmount);
|
|
55317
55317
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
55318
55318
|
}
|
|
55319
55319
|
async function executeDepositERC20(ethSigner, quantizedAmount, assetType, starkPublicKey, vaultId, config) {
|
|
55320
|
-
const coreContract =
|
|
55320
|
+
const coreContract = exportContracts.Core.connect(config.coreContractAddress, ethSigner);
|
|
55321
55321
|
const populatedTransaction = await coreContract.populateTransaction.depositERC20(starkPublicKey, assetType, vaultId, quantizedAmount);
|
|
55322
55322
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
55323
55323
|
}
|
|
@@ -55325,10 +55325,10 @@ async function depositERC20({ signers: { ethSigner }, deposit, config, }) {
|
|
|
55325
55325
|
await validateChain(ethSigner, config.immutableXConfig);
|
|
55326
55326
|
const { apiConfiguration, ethConfiguration } = config.immutableXConfig;
|
|
55327
55327
|
const user = await ethSigner.getAddress();
|
|
55328
|
-
const tokensApi = new
|
|
55329
|
-
const depositsApi = new
|
|
55330
|
-
const encodingApi = new
|
|
55331
|
-
const usersApi = new
|
|
55328
|
+
const tokensApi = new index$2.TokensApi(apiConfiguration);
|
|
55329
|
+
const depositsApi = new index$2.DepositsApi(apiConfiguration);
|
|
55330
|
+
const encodingApi = new index$2.EncodingApi(apiConfiguration);
|
|
55331
|
+
const usersApi = new index$2.UsersApi(apiConfiguration);
|
|
55332
55332
|
// Get decimals for this specific ERC20
|
|
55333
55333
|
const token = await tokensApi.getToken({ address: deposit.tokenAddress });
|
|
55334
55334
|
// TODO: remove once fixed
|
|
@@ -55340,7 +55340,7 @@ async function depositERC20({ signers: { ethSigner }, deposit, config, }) {
|
|
|
55340
55340
|
};
|
|
55341
55341
|
const amount = units.parseUnits(deposit.amount, 0); // 0 to always use undecimalized value
|
|
55342
55342
|
// Approve whether an amount of token from an account can be spent by a third-party account
|
|
55343
|
-
const tokenContract =
|
|
55343
|
+
const tokenContract = exportContracts.IERC20.connect(deposit.tokenAddress, ethSigner);
|
|
55344
55344
|
const approveTransaction = await tokenContract.populateTransaction.approve(ethConfiguration.coreContractAddress, amount);
|
|
55345
55345
|
await ethSigner.sendTransaction(approveTransaction);
|
|
55346
55346
|
const getSignableDepositRequest = {
|
|
@@ -55378,7 +55378,7 @@ async function depositERC20({ signers: { ethSigner }, deposit, config, }) {
|
|
|
55378
55378
|
}
|
|
55379
55379
|
|
|
55380
55380
|
async function executeDepositERC721(ethSigner, tokenId, assetType, starkPublicKey, vaultId, config) {
|
|
55381
|
-
const coreContract =
|
|
55381
|
+
const coreContract = exportContracts.Core.connect(config.ethConfiguration.coreContractAddress, ethSigner);
|
|
55382
55382
|
const populatedTransaction = await coreContract.populateTransaction.depositNft(starkPublicKey, assetType, vaultId, tokenId);
|
|
55383
55383
|
return ethSigner.sendTransaction(populatedTransaction);
|
|
55384
55384
|
}
|
|
@@ -55386,9 +55386,9 @@ async function depositERC721({ signers: { ethSigner }, deposit, config, }) {
|
|
|
55386
55386
|
await validateChain(ethSigner, config.immutableXConfig);
|
|
55387
55387
|
const user = await ethSigner.getAddress();
|
|
55388
55388
|
const { immutableXConfig } = config;
|
|
55389
|
-
const depositsApi = new
|
|
55390
|
-
const encodingApi = new
|
|
55391
|
-
const usersApi = new
|
|
55389
|
+
const depositsApi = new index$2.DepositsApi(immutableXConfig.apiConfiguration);
|
|
55390
|
+
const encodingApi = new index$2.EncodingApi(immutableXConfig.apiConfiguration);
|
|
55391
|
+
const usersApi = new index$2.UsersApi(immutableXConfig.apiConfiguration);
|
|
55392
55392
|
const data = {
|
|
55393
55393
|
token_address: deposit.tokenAddress,
|
|
55394
55394
|
token_id: deposit.tokenId,
|
|
@@ -55423,7 +55423,7 @@ async function depositERC721({ signers: { ethSigner }, deposit, config, }) {
|
|
|
55423
55423
|
const vaultId = signableDepositResult.data.vault_id;
|
|
55424
55424
|
const isRegistered = await isRegisteredOnChain(starkPublicKey, ethSigner, config);
|
|
55425
55425
|
// Approve whether an amount of token from an account can be spent by a third-party account
|
|
55426
|
-
const tokenContract =
|
|
55426
|
+
const tokenContract = exportContracts.IERC721.connect(deposit.tokenAddress, ethSigner);
|
|
55427
55427
|
const operator = immutableXConfig.ethConfiguration.coreContractAddress;
|
|
55428
55428
|
const isApprovedForAll = await tokenContract.isApprovedForAll(user, operator);
|
|
55429
55429
|
if (!isApprovedForAll) {
|
|
@@ -55431,7 +55431,7 @@ async function depositERC721({ signers: { ethSigner }, deposit, config, }) {
|
|
|
55431
55431
|
}
|
|
55432
55432
|
if (!isRegistered) {
|
|
55433
55433
|
const signableResult = await getSignableRegistrationOnchain(user, starkPublicKey, usersApi);
|
|
55434
|
-
const coreContract =
|
|
55434
|
+
const coreContract = exportContracts.Core.connect(immutableXConfig.ethConfiguration.coreContractAddress, ethSigner);
|
|
55435
55435
|
// Note: proxy registration contract registerAndDepositNft method is not used as
|
|
55436
55436
|
// it currently fails erc721 transfer ownership check
|
|
55437
55437
|
await coreContract.registerUser(user, starkPublicKey, signableResult.operator_signature);
|
|
@@ -55456,7 +55456,7 @@ async function deposit({ signers, deposit, config }) {
|
|
|
55456
55456
|
|
|
55457
55457
|
async function exchangeTransfer({ signers, request, config, }) {
|
|
55458
55458
|
await validateChain(signers.ethSigner, config.immutableXConfig);
|
|
55459
|
-
const exchangeApi = new
|
|
55459
|
+
const exchangeApi = new index$2.ExchangesApi(config.immutableXConfig.apiConfiguration);
|
|
55460
55460
|
const ethAddress = await signers.ethSigner.getAddress();
|
|
55461
55461
|
const transferAmount = request.amount;
|
|
55462
55462
|
const signableResult = await exchangeApi.getExchangeSignableTransfer({
|
|
@@ -55815,18 +55815,8 @@ class ProviderConfiguration {
|
|
|
55815
55815
|
this.immutableXConfig = overrides.immutableXConfig;
|
|
55816
55816
|
}
|
|
55817
55817
|
else {
|
|
55818
|
-
|
|
55819
|
-
|
|
55820
|
-
switch (baseConfig.environment) {
|
|
55821
|
-
case Environment$1.SANDBOX: {
|
|
55822
|
-
this.immutableXConfig = coreSdk.Config.SANDBOX;
|
|
55823
|
-
break;
|
|
55824
|
-
}
|
|
55825
|
-
case Environment$1.PRODUCTION: {
|
|
55826
|
-
this.immutableXConfig = coreSdk.Config.PRODUCTION;
|
|
55827
|
-
break;
|
|
55828
|
-
}
|
|
55829
|
-
}
|
|
55818
|
+
const clientConfig = new ImxConfiguration({ baseConfig });
|
|
55819
|
+
this.immutableXConfig = clientConfig.immutableXConfig;
|
|
55830
55820
|
}
|
|
55831
55821
|
}
|
|
55832
55822
|
}
|