@imtbl/sdk 0.36.5 → 0.37.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 +1 -1
- package/dist/browser/checkout/sdk.js +6 -6
- package/dist/browser/checkout/widgets.js +53 -53
- package/dist/checkout.d.ts +38 -22
- package/dist/checkout.js +109 -76
- 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 +112 -78
- package/dist/index.d.ts +43 -26
- package/dist/index.js +112 -78
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4234,7 +4234,7 @@ class MultiRollupApiClients {
|
|
|
4234
4234
|
}
|
|
4235
4235
|
|
|
4236
4236
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4237
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
4237
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.37.0' };
|
|
4238
4238
|
const createConfig = ({ basePath, headers, }) => {
|
|
4239
4239
|
if (!basePath.trim()) {
|
|
4240
4240
|
throw Error('basePath can not be empty');
|
|
@@ -4294,7 +4294,7 @@ class APIError extends Error {
|
|
|
4294
4294
|
|
|
4295
4295
|
/* eslint-disable implicit-arrow-linebreak */
|
|
4296
4296
|
const defaultHeaders = {
|
|
4297
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
4297
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.37.0',
|
|
4298
4298
|
};
|
|
4299
4299
|
/**
|
|
4300
4300
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4733,7 +4733,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4733
4733
|
chainID,
|
|
4734
4734
|
coreContractAddress,
|
|
4735
4735
|
registrationContractAddress,
|
|
4736
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
4736
|
+
sdkVersion: 'ts-immutable-sdk-0.37.0',
|
|
4737
4737
|
});
|
|
4738
4738
|
/**
|
|
4739
4739
|
* Sets `sdkVersion` at the time of build
|
|
@@ -12232,13 +12232,13 @@ var ProtocolData;
|
|
|
12232
12232
|
})(ProtocolData.order_type || (ProtocolData.order_type = {}));
|
|
12233
12233
|
})(ProtocolData || (ProtocolData = {}));
|
|
12234
12234
|
|
|
12235
|
-
var FeeType;
|
|
12235
|
+
var FeeType$1;
|
|
12236
12236
|
(function (FeeType) {
|
|
12237
12237
|
FeeType["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
|
|
12238
12238
|
FeeType["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
|
|
12239
12239
|
FeeType["PROTOCOL"] = "PROTOCOL";
|
|
12240
12240
|
FeeType["ROYALTY"] = "ROYALTY";
|
|
12241
|
-
})(FeeType || (FeeType = {}));
|
|
12241
|
+
})(FeeType$1 || (FeeType$1 = {}));
|
|
12242
12242
|
var TransactionPurpose;
|
|
12243
12243
|
(function (TransactionPurpose) {
|
|
12244
12244
|
TransactionPurpose["APPROVAL"] = "APPROVAL";
|
|
@@ -12800,7 +12800,7 @@ class ImmutableApiClient {
|
|
|
12800
12800
|
],
|
|
12801
12801
|
fees: makerFees.map((x) => ({
|
|
12802
12802
|
amount: x.amount,
|
|
12803
|
-
type: FeeType.MAKER_ECOSYSTEM,
|
|
12803
|
+
type: FeeType$1.MAKER_ECOSYSTEM,
|
|
12804
12804
|
recipient_address: x.recipientAddress,
|
|
12805
12805
|
})),
|
|
12806
12806
|
end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
|
|
@@ -13014,7 +13014,7 @@ class Orderbook {
|
|
|
13014
13014
|
order_id: listingId,
|
|
13015
13015
|
fees: takerFees.map((fee) => ({
|
|
13016
13016
|
amount: fee.amount,
|
|
13017
|
-
type: FeeType.TAKER_ECOSYSTEM,
|
|
13017
|
+
type: FeeType$1.TAKER_ECOSYSTEM,
|
|
13018
13018
|
recipient_address: fee.recipientAddress,
|
|
13019
13019
|
})),
|
|
13020
13020
|
},
|
|
@@ -13037,7 +13037,7 @@ class Orderbook {
|
|
|
13037
13037
|
order_id: listingRequest.listingId,
|
|
13038
13038
|
fees: listingRequest.takerFees.map((fee) => ({
|
|
13039
13039
|
amount: fee.amount,
|
|
13040
|
-
type: FeeType.TAKER_ECOSYSTEM,
|
|
13040
|
+
type: FeeType$1.TAKER_ECOSYSTEM,
|
|
13041
13041
|
recipient_address: fee.recipientAddress,
|
|
13042
13042
|
})),
|
|
13043
13043
|
})));
|
|
@@ -13168,7 +13168,7 @@ const constants = {
|
|
|
13168
13168
|
var orderbook = /*#__PURE__*/Object.freeze({
|
|
13169
13169
|
__proto__: null,
|
|
13170
13170
|
get ActionType () { return ActionType; },
|
|
13171
|
-
get FeeType () { return FeeType; },
|
|
13171
|
+
get FeeType () { return FeeType$1; },
|
|
13172
13172
|
get OrderStatusName () { return OrderStatusName; },
|
|
13173
13173
|
Orderbook: Orderbook,
|
|
13174
13174
|
get SignablePurpose () { return SignablePurpose; },
|
|
@@ -35053,6 +35053,21 @@ var RoutingOutcomeType;
|
|
|
35053
35053
|
RoutingOutcomeType["NO_ROUTES_FOUND"] = "NO_ROUTES_FOUND";
|
|
35054
35054
|
RoutingOutcomeType["NO_ROUTE_OPTIONS"] = "NO_ROUTE_OPTIONS";
|
|
35055
35055
|
})(RoutingOutcomeType || (RoutingOutcomeType = {}));
|
|
35056
|
+
/**
|
|
35057
|
+
* An enum representing the funding step types
|
|
35058
|
+
* @enum {string}
|
|
35059
|
+
* @property {string} GAS - If the fee is a gas fee.
|
|
35060
|
+
* @property {string} BRIDGE_FEE - If the fee is a bridge fee.
|
|
35061
|
+
* @property {string} SWAP_FEE - If the fee is a swap fee.
|
|
35062
|
+
* @property {string} IMMUTABLE_FEE - If the fee is an immutable fee.
|
|
35063
|
+
*/
|
|
35064
|
+
var FeeType;
|
|
35065
|
+
(function (FeeType) {
|
|
35066
|
+
FeeType["GAS"] = "GAS";
|
|
35067
|
+
FeeType["BRIDGE_FEE"] = "BRIDGE_FEE";
|
|
35068
|
+
FeeType["SWAP_FEE"] = "SWAP_FEE";
|
|
35069
|
+
FeeType["IMMUTABLE_FEE"] = "IMMUTABLE_FEE";
|
|
35070
|
+
})(FeeType || (FeeType = {}));
|
|
35056
35071
|
/**
|
|
35057
35072
|
* An enum representing the funding step types
|
|
35058
35073
|
* @enum {string}
|
|
@@ -35658,7 +35673,7 @@ const GAS_OVERRIDES = {
|
|
|
35658
35673
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
35659
35674
|
};
|
|
35660
35675
|
|
|
35661
|
-
const SDK_VERSION_MARKER = '0.
|
|
35676
|
+
const SDK_VERSION_MARKER = '0.37.0';
|
|
35662
35677
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
35663
35678
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
35664
35679
|
|
|
@@ -36552,8 +36567,8 @@ const erc20ItemAggregator = (itemRequirements) => {
|
|
|
36552
36567
|
aggregatedItemRequirements.push(itemRequirement);
|
|
36553
36568
|
return;
|
|
36554
36569
|
}
|
|
36555
|
-
const {
|
|
36556
|
-
const key = `${
|
|
36570
|
+
const { tokenAddress, spenderAddress, amount } = itemRequirement;
|
|
36571
|
+
const key = `${tokenAddress}${spenderAddress}`;
|
|
36557
36572
|
const aggregateItem = aggregatedMap.get(key);
|
|
36558
36573
|
if (aggregateItem && aggregateItem.type === ItemType.ERC20) {
|
|
36559
36574
|
aggregateItem.amount = BigNumber$1.from(aggregateItem.amount).add(amount);
|
|
@@ -36619,10 +36634,10 @@ const hasERC20Allowances = async (provider, ownerAddress, itemRequirements) => {
|
|
|
36619
36634
|
for (const itemRequirement of itemRequirements) {
|
|
36620
36635
|
if (itemRequirement.type !== ItemType.ERC20)
|
|
36621
36636
|
continue;
|
|
36622
|
-
const {
|
|
36623
|
-
const key = `${
|
|
36637
|
+
const { tokenAddress, spenderAddress } = itemRequirement;
|
|
36638
|
+
const key = `${tokenAddress}${spenderAddress}`;
|
|
36624
36639
|
erc20s.set(key, itemRequirement);
|
|
36625
|
-
allowancePromises.set(key, getERC20Allowance(provider, ownerAddress,
|
|
36640
|
+
allowancePromises.set(key, getERC20Allowance(provider, ownerAddress, tokenAddress, spenderAddress));
|
|
36626
36641
|
}
|
|
36627
36642
|
const allowances = await Promise.all(allowancePromises.values());
|
|
36628
36643
|
const allowancePromiseIds = Array.from(allowancePromises.keys());
|
|
@@ -36641,8 +36656,8 @@ const hasERC20Allowances = async (provider, ownerAddress, itemRequirements) => {
|
|
|
36641
36656
|
continue;
|
|
36642
36657
|
}
|
|
36643
36658
|
sufficient = false; // Set sufficient false on the root of the return object when an ERC20 is insufficient
|
|
36644
|
-
const {
|
|
36645
|
-
const key = `${
|
|
36659
|
+
const { tokenAddress, spenderAddress } = itemRequirement;
|
|
36660
|
+
const key = `${tokenAddress}${spenderAddress}`;
|
|
36646
36661
|
const delta = itemRequirement.amount.sub(allowances[index]);
|
|
36647
36662
|
// Create maps for both the insufficient ERC20 data and the transaction promises using the same key so the results can be merged
|
|
36648
36663
|
insufficientERC20s.set(key, {
|
|
@@ -36652,7 +36667,7 @@ const hasERC20Allowances = async (provider, ownerAddress, itemRequirements) => {
|
|
|
36652
36667
|
itemRequirement,
|
|
36653
36668
|
approvalTransaction: undefined,
|
|
36654
36669
|
});
|
|
36655
|
-
transactionPromises.set(key, getERC20ApprovalTransaction(provider, ownerAddress,
|
|
36670
|
+
transactionPromises.set(key, getERC20ApprovalTransaction(provider, ownerAddress, tokenAddress, spenderAddress, delta));
|
|
36656
36671
|
}
|
|
36657
36672
|
// Resolves the approval transactions and merges them with the insufficient ERC20 data
|
|
36658
36673
|
const transactions = await Promise.all(transactionPromises.values());
|
|
@@ -36837,8 +36852,8 @@ const erc20BalanceAggregator = (itemRequirements) => {
|
|
|
36837
36852
|
aggregatedItemRequirements.push(itemRequirement);
|
|
36838
36853
|
return;
|
|
36839
36854
|
}
|
|
36840
|
-
const {
|
|
36841
|
-
const key = `${
|
|
36855
|
+
const { tokenAddress, amount } = itemRequirement;
|
|
36856
|
+
const key = `${tokenAddress}`;
|
|
36842
36857
|
const aggregateItem = aggregatedMap.get(key);
|
|
36843
36858
|
if (aggregateItem && aggregateItem.type === ItemType.ERC20) {
|
|
36844
36859
|
aggregateItem.amount = BigNumber$1.from(aggregateItem.amount).add(amount);
|
|
@@ -36871,14 +36886,21 @@ const balanceAggregator = (itemRequirements) => erc721BalanceAggregator(erc20Bal
|
|
|
36871
36886
|
/* eslint-disable arrow-body-style */
|
|
36872
36887
|
const getTokensFromRequirements = (itemRequirements) => itemRequirements
|
|
36873
36888
|
.map((itemRequirement) => {
|
|
36874
|
-
|
|
36875
|
-
|
|
36876
|
-
|
|
36877
|
-
|
|
36889
|
+
switch (itemRequirement.type) {
|
|
36890
|
+
case ItemType.ERC20:
|
|
36891
|
+
return {
|
|
36892
|
+
address: itemRequirement.tokenAddress,
|
|
36893
|
+
};
|
|
36894
|
+
case ItemType.NATIVE:
|
|
36895
|
+
return {
|
|
36896
|
+
address: NATIVE,
|
|
36897
|
+
};
|
|
36898
|
+
case ItemType.ERC721:
|
|
36899
|
+
default:
|
|
36900
|
+
return {
|
|
36901
|
+
address: itemRequirement.contractAddress,
|
|
36902
|
+
};
|
|
36878
36903
|
}
|
|
36879
|
-
return {
|
|
36880
|
-
address: itemRequirement.contractAddress,
|
|
36881
|
-
};
|
|
36882
36904
|
});
|
|
36883
36905
|
/**
|
|
36884
36906
|
* Gets the balance requirement with delta for an ERC721 requirement.
|
|
@@ -36928,7 +36950,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
|
|
|
36928
36950
|
// Get the requirements related balance
|
|
36929
36951
|
if (itemRequirement.type === ItemType.ERC20) {
|
|
36930
36952
|
itemBalanceResult = balances.find((balance) => {
|
|
36931
|
-
return balance.token?.address === itemRequirement.
|
|
36953
|
+
return balance.token?.address === itemRequirement.tokenAddress;
|
|
36932
36954
|
});
|
|
36933
36955
|
}
|
|
36934
36956
|
else if (itemRequirement.type === ItemType.NATIVE) {
|
|
@@ -36992,7 +37014,7 @@ const getTokenBalanceRequirement = (itemRequirement, balances) => {
|
|
|
36992
37014
|
token: {
|
|
36993
37015
|
name,
|
|
36994
37016
|
symbol,
|
|
36995
|
-
address: itemRequirement.
|
|
37017
|
+
address: itemRequirement.tokenAddress,
|
|
36996
37018
|
decimals,
|
|
36997
37019
|
},
|
|
36998
37020
|
};
|
|
@@ -37151,7 +37173,7 @@ const getGasItemRequirement = (gas, transactionOrGas) => {
|
|
|
37151
37173
|
return {
|
|
37152
37174
|
type: ItemType.ERC20,
|
|
37153
37175
|
amount: gas,
|
|
37154
|
-
|
|
37176
|
+
tokenAddress: transactionOrGas.gasToken.tokenAddress,
|
|
37155
37177
|
spenderAddress: '',
|
|
37156
37178
|
};
|
|
37157
37179
|
};
|
|
@@ -37374,36 +37396,37 @@ const quoteFetcher = async (config, chainId, walletAddress, requiredToken, swapp
|
|
|
37374
37396
|
}
|
|
37375
37397
|
};
|
|
37376
37398
|
|
|
37377
|
-
const constructFees$1 = (
|
|
37399
|
+
const constructFees$1 = (approvalGasFee, swapGasFee, swapFees) => {
|
|
37378
37400
|
let approvalGasFeeAmount = BigNumber$1.from(0);
|
|
37379
37401
|
let approvalGasFeeFormatted = '0';
|
|
37380
37402
|
let approvalToken;
|
|
37381
|
-
if (
|
|
37382
|
-
approvalGasFeeAmount =
|
|
37383
|
-
approvalGasFeeFormatted = utils$2.formatUnits(
|
|
37403
|
+
if (approvalGasFee) {
|
|
37404
|
+
approvalGasFeeAmount = approvalGasFee.value;
|
|
37405
|
+
approvalGasFeeFormatted = utils$2.formatUnits(approvalGasFee.value, approvalGasFee.token.decimals);
|
|
37384
37406
|
approvalToken = {
|
|
37385
|
-
name:
|
|
37386
|
-
symbol:
|
|
37387
|
-
address:
|
|
37388
|
-
decimals:
|
|
37407
|
+
name: approvalGasFee.token.name ?? '',
|
|
37408
|
+
symbol: approvalGasFee.token.symbol ?? '',
|
|
37409
|
+
address: approvalGasFee.token.address,
|
|
37410
|
+
decimals: approvalGasFee.token.decimals,
|
|
37389
37411
|
};
|
|
37390
37412
|
}
|
|
37391
37413
|
let swapGasFeeAmount = BigNumber$1.from(0);
|
|
37392
37414
|
let swapGasFeeFormatted = '0';
|
|
37393
37415
|
let swapGasToken;
|
|
37394
|
-
if (
|
|
37395
|
-
swapGasFeeAmount =
|
|
37396
|
-
swapGasFeeFormatted = utils$2.formatUnits(
|
|
37416
|
+
if (swapGasFee) {
|
|
37417
|
+
swapGasFeeAmount = swapGasFee.value;
|
|
37418
|
+
swapGasFeeFormatted = utils$2.formatUnits(swapGasFee.value, swapGasFee.token.decimals);
|
|
37397
37419
|
swapGasToken = {
|
|
37398
|
-
name:
|
|
37399
|
-
symbol:
|
|
37400
|
-
address:
|
|
37401
|
-
decimals:
|
|
37420
|
+
name: swapGasFee.token.name ?? '',
|
|
37421
|
+
symbol: swapGasFee.token.symbol ?? '',
|
|
37422
|
+
address: swapGasFee.token.address,
|
|
37423
|
+
decimals: swapGasFee.token.decimals,
|
|
37402
37424
|
};
|
|
37403
37425
|
}
|
|
37404
37426
|
const fees = [];
|
|
37405
37427
|
for (const swapFee of swapFees) {
|
|
37406
37428
|
fees.push({
|
|
37429
|
+
type: FeeType.SWAP_FEE,
|
|
37407
37430
|
amount: swapFee.amount.value,
|
|
37408
37431
|
formattedAmount: utils$2.formatUnits(swapFee.amount.value, swapFee.amount.token.decimals),
|
|
37409
37432
|
token: {
|
|
@@ -37415,12 +37438,14 @@ const constructFees$1 = (approvalGasFees, swapGasFees, swapFees) => {
|
|
|
37415
37438
|
});
|
|
37416
37439
|
}
|
|
37417
37440
|
return {
|
|
37418
|
-
|
|
37441
|
+
approvalGasFee: {
|
|
37442
|
+
type: FeeType.GAS,
|
|
37419
37443
|
amount: approvalGasFeeAmount,
|
|
37420
37444
|
formattedAmount: approvalGasFeeFormatted,
|
|
37421
37445
|
token: approvalToken,
|
|
37422
37446
|
},
|
|
37423
|
-
|
|
37447
|
+
swapGasFee: {
|
|
37448
|
+
type: FeeType.GAS,
|
|
37424
37449
|
amount: swapGasFeeAmount,
|
|
37425
37450
|
formattedAmount: swapGasFeeFormatted,
|
|
37426
37451
|
token: swapGasToken,
|
|
@@ -37505,7 +37530,7 @@ const checkUserCanCoverApprovalFees = (l2Balances, approval) => {
|
|
|
37505
37530
|
// The user has enough to cover approval gas fees
|
|
37506
37531
|
return { sufficient: true, approvalGasFee, approvalGasTokenAddress };
|
|
37507
37532
|
};
|
|
37508
|
-
const checkUserCanCoverSwapFees = (l2Balances, approvalFees,
|
|
37533
|
+
const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFee, swapFees, tokenBeingSwapped) => {
|
|
37509
37534
|
// Set up a map of token addresses to amounts for each of the swap fees
|
|
37510
37535
|
const feeMap = new Map();
|
|
37511
37536
|
// Add the approval fee to list of fees
|
|
@@ -37513,13 +37538,13 @@ const checkUserCanCoverSwapFees = (l2Balances, approvalFees, swapGasFees, swapFe
|
|
|
37513
37538
|
feeMap.set(approvalFees.approvalGasTokenAddress, approvalFees.approvalGasFee);
|
|
37514
37539
|
}
|
|
37515
37540
|
// Add the swap gas fee to list of fees
|
|
37516
|
-
if (
|
|
37517
|
-
const fee = feeMap.get(
|
|
37541
|
+
if (swapGasFee) {
|
|
37542
|
+
const fee = feeMap.get(swapGasFee.token.address);
|
|
37518
37543
|
if (fee) {
|
|
37519
|
-
feeMap.set(
|
|
37544
|
+
feeMap.set(swapGasFee.token.address, fee.add(swapGasFee.value));
|
|
37520
37545
|
}
|
|
37521
37546
|
else {
|
|
37522
|
-
feeMap.set(
|
|
37547
|
+
feeMap.set(swapGasFee.token.address, swapGasFee.value);
|
|
37523
37548
|
}
|
|
37524
37549
|
}
|
|
37525
37550
|
// Add the token being swapped to list of fees to ensure the user can cover the fee + the token swap
|
|
@@ -37773,31 +37798,39 @@ const hasSufficientL1Eth = (tokenBalanceResult, totalFees) => {
|
|
|
37773
37798
|
const balance = getEthBalance(tokenBalanceResult);
|
|
37774
37799
|
return balance.gte(totalFees);
|
|
37775
37800
|
};
|
|
37776
|
-
const constructFees = (
|
|
37801
|
+
const constructFees = (bridgeGasFee, bridgeFee, imtblFee, approvalGasFee, token) => {
|
|
37777
37802
|
const bridgeFeeDecimals = token?.decimals ?? DEFAULT_TOKEN_DECIMALS$1;
|
|
37803
|
+
const bridgeFees = [];
|
|
37804
|
+
if (bridgeFee.gt(0)) {
|
|
37805
|
+
bridgeFees.push({
|
|
37806
|
+
type: FeeType.BRIDGE_FEE,
|
|
37807
|
+
amount: bridgeFee,
|
|
37808
|
+
formattedAmount: utils$2.formatUnits(bridgeFee, bridgeFeeDecimals),
|
|
37809
|
+
token,
|
|
37810
|
+
});
|
|
37811
|
+
}
|
|
37812
|
+
if (imtblFee.gt(0)) {
|
|
37813
|
+
bridgeFees.push({
|
|
37814
|
+
type: FeeType.IMMUTABLE_FEE,
|
|
37815
|
+
amount: imtblFee,
|
|
37816
|
+
formattedAmount: utils$2.formatUnits(imtblFee, bridgeFeeDecimals),
|
|
37817
|
+
token,
|
|
37818
|
+
});
|
|
37819
|
+
}
|
|
37778
37820
|
return {
|
|
37779
|
-
|
|
37780
|
-
|
|
37781
|
-
|
|
37821
|
+
approvalGasFee: {
|
|
37822
|
+
type: FeeType.GAS,
|
|
37823
|
+
amount: approvalGasFee,
|
|
37824
|
+
formattedAmount: utils$2.formatUnits(approvalGasFee, DEFAULT_TOKEN_DECIMALS$1),
|
|
37782
37825
|
token,
|
|
37783
37826
|
},
|
|
37784
|
-
|
|
37785
|
-
|
|
37786
|
-
|
|
37827
|
+
bridgeGasFee: {
|
|
37828
|
+
type: FeeType.GAS,
|
|
37829
|
+
amount: bridgeGasFee,
|
|
37830
|
+
formattedAmount: utils$2.formatUnits(bridgeGasFee, DEFAULT_TOKEN_DECIMALS$1),
|
|
37787
37831
|
token,
|
|
37788
37832
|
},
|
|
37789
|
-
bridgeFees
|
|
37790
|
-
{
|
|
37791
|
-
amount: bridgeFee,
|
|
37792
|
-
formattedAmount: utils$2.formatUnits(bridgeFee, bridgeFeeDecimals),
|
|
37793
|
-
token,
|
|
37794
|
-
},
|
|
37795
|
-
{
|
|
37796
|
-
amount: imtblFee,
|
|
37797
|
-
formattedAmount: utils$2.formatUnits(imtblFee, bridgeFeeDecimals),
|
|
37798
|
-
token,
|
|
37799
|
-
},
|
|
37800
|
-
],
|
|
37833
|
+
bridgeFees,
|
|
37801
37834
|
};
|
|
37802
37835
|
};
|
|
37803
37836
|
const constructBridgeFundingRoute = (chainId, balance, bridgeRequirement, itemType, fees) => ({
|
|
@@ -38656,13 +38689,13 @@ const calculateFees = (orderFees, weiAmount, decimals = 18) => {
|
|
|
38656
38689
|
return calculateFeesResult;
|
|
38657
38690
|
};
|
|
38658
38691
|
|
|
38659
|
-
const getItemRequirement = (type,
|
|
38692
|
+
const getItemRequirement = (type, tokenAddress, amount, spenderAddress) => {
|
|
38660
38693
|
switch (type) {
|
|
38661
38694
|
case ItemType.ERC20:
|
|
38662
38695
|
return {
|
|
38663
38696
|
type,
|
|
38664
38697
|
amount,
|
|
38665
|
-
|
|
38698
|
+
tokenAddress,
|
|
38666
38699
|
spenderAddress,
|
|
38667
38700
|
};
|
|
38668
38701
|
case ItemType.NATIVE:
|
|
@@ -38885,7 +38918,7 @@ const getBuyToken = (buyToken, decimals = 18) => {
|
|
|
38885
38918
|
return {
|
|
38886
38919
|
type: ItemType.ERC20,
|
|
38887
38920
|
amount: bnAmount.toString(),
|
|
38888
|
-
contractAddress: buyToken.
|
|
38921
|
+
contractAddress: buyToken.tokenAddress,
|
|
38889
38922
|
};
|
|
38890
38923
|
};
|
|
38891
38924
|
const sell = async (config, provider, orders) => {
|
|
@@ -38899,7 +38932,7 @@ const sell = async (config, provider, orders) => {
|
|
|
38899
38932
|
let decimals = 18;
|
|
38900
38933
|
if (buyToken.type === ItemType.ERC20) {
|
|
38901
38934
|
// get this from the allowed list
|
|
38902
|
-
const buyTokenContract = new Contract$1(buyToken.
|
|
38935
|
+
const buyTokenContract = new Contract$1(buyToken.tokenAddress, JSON.stringify(ERC20ABI), provider);
|
|
38903
38936
|
decimals = await measureAsyncExecution(config, 'Time to get decimals of token contract for the buy token', buyTokenContract.decimals());
|
|
38904
38937
|
}
|
|
38905
38938
|
const buyTokenOrNative = getBuyToken(buyToken, decimals);
|
|
@@ -39051,8 +39084,8 @@ async function getItemRequirementsFromRequirements(provider, requirements) {
|
|
|
39051
39084
|
const decimalPromises = [];
|
|
39052
39085
|
requirements.forEach((itemRequirementParam) => {
|
|
39053
39086
|
if (itemRequirementParam.type === ItemType.ERC20) {
|
|
39054
|
-
const {
|
|
39055
|
-
decimalPromises.push(getTokenContract(
|
|
39087
|
+
const { tokenAddress } = itemRequirementParam;
|
|
39088
|
+
decimalPromises.push(getTokenContract(tokenAddress, ERC20ABI, provider).decimals());
|
|
39056
39089
|
}
|
|
39057
39090
|
});
|
|
39058
39091
|
const decimals = await Promise.all(decimalPromises);
|
|
@@ -39367,7 +39400,7 @@ class Checkout {
|
|
|
39367
39400
|
try {
|
|
39368
39401
|
itemRequirements = await getItemRequirementsFromRequirements(web3Provider, params.itemRequirements);
|
|
39369
39402
|
}
|
|
39370
|
-
catch {
|
|
39403
|
+
catch (error) {
|
|
39371
39404
|
throw new CheckoutError('Failed to map item requirements', CheckoutErrorType.ITEM_REQUIREMENTS_ERROR);
|
|
39372
39405
|
}
|
|
39373
39406
|
return await smartCheckout(this.config, web3Provider, itemRequirements, params.transactionOrGasAmount);
|
|
@@ -39448,6 +39481,7 @@ var checkout = /*#__PURE__*/Object.freeze({
|
|
|
39448
39481
|
get ConnectEventType () { return ConnectEventType; },
|
|
39449
39482
|
get ConnectTargetLayer () { return ConnectTargetLayer; },
|
|
39450
39483
|
get ExchangeType () { return ExchangeType; },
|
|
39484
|
+
get FeeType () { return FeeType; },
|
|
39451
39485
|
get FundingStepType () { return FundingStepType; },
|
|
39452
39486
|
get GasEstimateType () { return GasEstimateType; },
|
|
39453
39487
|
get GasTokenType () { return GasTokenType; },
|
package/dist/passport.js
CHANGED
|
@@ -2349,7 +2349,7 @@ class MultiRollupApiClients {
|
|
|
2349
2349
|
}
|
|
2350
2350
|
|
|
2351
2351
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2352
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
2352
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.37.0' };
|
|
2353
2353
|
const createConfig = ({ basePath, headers, }) => {
|
|
2354
2354
|
if (!basePath.trim()) {
|
|
2355
2355
|
throw Error('basePath can not be empty');
|
|
@@ -2405,7 +2405,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
2405
2405
|
chainID,
|
|
2406
2406
|
coreContractAddress,
|
|
2407
2407
|
registrationContractAddress,
|
|
2408
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
2408
|
+
sdkVersion: 'ts-immutable-sdk-0.37.0',
|
|
2409
2409
|
});
|
|
2410
2410
|
/**
|
|
2411
2411
|
* Sets `sdkVersion` at the time of build
|
package/package.json
CHANGED