@imtbl/sdk 0.34.1-alpha → 0.35.1
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 +56 -56
- package/dist/checkout.js +95 -98
- 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 +97 -100
- package/dist/index.d.ts +50 -16
- package/dist/index.js +97 -100
- package/dist/orderbook.d.ts +50 -16
- package/dist/orderbook.js +44 -32
- package/dist/passport.js +2 -2
- package/package.json +1 -1
package/dist/checkout.js
CHANGED
|
@@ -14673,7 +14673,6 @@ class UniswapV3Pool__factory extends ContractFactory {
|
|
|
14673
14673
|
}
|
|
14674
14674
|
}
|
|
14675
14675
|
|
|
14676
|
-
const DEFAULT_GAS_QUOTE = 2000000;
|
|
14677
14676
|
// TODO: Better description of function and args
|
|
14678
14677
|
async function multicallSingleCallDataMultipleContracts(multicallContract, functionName, addresses) {
|
|
14679
14678
|
// Encode args - generate calldata for contract
|
|
@@ -14695,22 +14694,6 @@ async function multicallSingleCallDataMultipleContracts(multicallContract, funct
|
|
|
14695
14694
|
}
|
|
14696
14695
|
return multicallContract.callStatic.multicall(calls);
|
|
14697
14696
|
}
|
|
14698
|
-
// TODO: Better description of function and args
|
|
14699
|
-
async function multicallMultipleCallDataSingContract(multicallContract, calldata, address, options) {
|
|
14700
|
-
// Create call objects
|
|
14701
|
-
const calls = new Array(calldata.length);
|
|
14702
|
-
// TODO: use object.keys of something similar to avoid iterating over
|
|
14703
|
-
// entire object prototype
|
|
14704
|
-
// eslint-disable-next-line no-restricted-syntax, guard-for-in
|
|
14705
|
-
for (const i in calldata) {
|
|
14706
|
-
calls[i] = {
|
|
14707
|
-
target: address,
|
|
14708
|
-
callData: calldata[i],
|
|
14709
|
-
gasLimit: options?.gasRequired ?? DEFAULT_GAS_QUOTE,
|
|
14710
|
-
};
|
|
14711
|
-
}
|
|
14712
|
-
return multicallContract.callStatic.multicall(calls);
|
|
14713
|
-
}
|
|
14714
14697
|
const getCallData = (methodName, contractInterface) => {
|
|
14715
14698
|
// Create ethers function fragment
|
|
14716
14699
|
const fragment = contractInterface?.getFunction(methodName);
|
|
@@ -14870,35 +14853,27 @@ const getDefaultDeadlineSeconds = () => Math.floor(Date.now() / 1000) + DEFAULT_
|
|
|
14870
14853
|
|
|
14871
14854
|
const amountIndex = 0;
|
|
14872
14855
|
const gasEstimateIndex = 3;
|
|
14873
|
-
async function getQuotesForRoutes(
|
|
14874
|
-
const
|
|
14856
|
+
async function getQuotesForRoutes(provider, quoterContractAddress, routes, amountSpecified, tradeType) {
|
|
14857
|
+
const callDatas = routes.map((route) => SwapQuoter.quoteCallParameters(route, toCurrencyAmount(amountSpecified), tradeType, {
|
|
14875
14858
|
useQuoterV2: true,
|
|
14876
14859
|
}).calldata);
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
|
|
14880
|
-
|
|
14881
|
-
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
}
|
|
14885
|
-
const decodedQuoteResults = [];
|
|
14886
|
-
// TODO: for..in loops iterate over the entire prototype chain,
|
|
14887
|
-
// Use Object.{keys,values,entries}, and iterate over the resulting array.
|
|
14888
|
-
// eslint-disable-next-line no-restricted-syntax, guard-for-in
|
|
14889
|
-
for (const i in quoteResults.returnData) {
|
|
14890
|
-
const functionSig = callData[i].substring(0, 10);
|
|
14860
|
+
const promises = await Promise.allSettled(callDatas.map((data) => provider.send('eth_call', [
|
|
14861
|
+
{ to: quoterContractAddress, data }, 'latest',
|
|
14862
|
+
])));
|
|
14863
|
+
const decodedQuoteResults = promises.reduce((quoteResults, promiseResult, i) => {
|
|
14864
|
+
if (promiseResult.status === 'rejected')
|
|
14865
|
+
return quoteResults;
|
|
14866
|
+
const functionSig = callDatas[i].substring(0, 10);
|
|
14891
14867
|
const returnTypes = quoteReturnMapping[functionSig];
|
|
14892
14868
|
if (!returnTypes) {
|
|
14893
14869
|
throw new Error('No quoting function signature found');
|
|
14894
14870
|
}
|
|
14895
|
-
if (
|
|
14871
|
+
if (promiseResult.value === '0x') {
|
|
14896
14872
|
// There is no quote result for the swap using this route, so don't include it in results
|
|
14897
|
-
|
|
14898
|
-
continue;
|
|
14873
|
+
return quoteResults;
|
|
14899
14874
|
}
|
|
14900
14875
|
try {
|
|
14901
|
-
const decodedQuoteResult =
|
|
14876
|
+
const decodedQuoteResult = utils.defaultAbiCoder.decode(returnTypes, promiseResult.value);
|
|
14902
14877
|
if (decodedQuoteResult) {
|
|
14903
14878
|
// The 0th element in each decoded data is going to be the amountOut or amountIn.
|
|
14904
14879
|
const quoteAmount = decodedQuoteResult[amountIndex];
|
|
@@ -14906,11 +14881,11 @@ async function getQuotesForRoutes(multicallContract, quoterContractAddress, rout
|
|
|
14906
14881
|
throw new Error('Expected BigNumber');
|
|
14907
14882
|
const input = uniswapTokenToERC20(routes[i].input);
|
|
14908
14883
|
const output = uniswapTokenToERC20(routes[i].output);
|
|
14909
|
-
|
|
14884
|
+
quoteResults.push({
|
|
14910
14885
|
route: routes[i],
|
|
14911
14886
|
amountIn: tradeType === TradeType.EXACT_INPUT ? amountSpecified : newAmount(quoteAmount, input),
|
|
14912
14887
|
amountOut: tradeType === TradeType.EXACT_INPUT ? newAmount(quoteAmount, output) : amountSpecified,
|
|
14913
|
-
gasEstimate:
|
|
14888
|
+
gasEstimate: BigNumber$1.from(decodedQuoteResult[gasEstimateIndex]),
|
|
14914
14889
|
tradeType,
|
|
14915
14890
|
});
|
|
14916
14891
|
}
|
|
@@ -14920,7 +14895,8 @@ async function getQuotesForRoutes(multicallContract, quoterContractAddress, rout
|
|
|
14920
14895
|
// Other quotes for routes may still succeed, so do nothing
|
|
14921
14896
|
// and continue processing
|
|
14922
14897
|
}
|
|
14923
|
-
|
|
14898
|
+
return quoteResults;
|
|
14899
|
+
}, new Array());
|
|
14924
14900
|
return decodedQuoteResults;
|
|
14925
14901
|
}
|
|
14926
14902
|
|
|
@@ -15048,19 +15024,24 @@ const fetchValidPools = async (multicallContract, erc20Pair, commonRoutingERC20s
|
|
|
15048
15024
|
|
|
15049
15025
|
class Router {
|
|
15050
15026
|
provider;
|
|
15027
|
+
multicallContract;
|
|
15051
15028
|
routingTokens;
|
|
15052
15029
|
routingContracts;
|
|
15053
|
-
constructor(provider, routingTokens, routingContracts) {
|
|
15030
|
+
constructor(provider, multicallContract, routingTokens, routingContracts) {
|
|
15054
15031
|
this.provider = provider;
|
|
15032
|
+
this.multicallContract = multicallContract;
|
|
15033
|
+
this.routingTokens = routingTokens;
|
|
15034
|
+
this.routingContracts = routingContracts;
|
|
15035
|
+
this.provider = provider;
|
|
15036
|
+
this.multicallContract = multicallContract;
|
|
15055
15037
|
this.routingTokens = routingTokens;
|
|
15056
15038
|
this.routingContracts = routingContracts;
|
|
15057
15039
|
}
|
|
15058
15040
|
async findOptimalRoute(amountSpecified, otherToken, tradeType, maxHops = 2) {
|
|
15059
15041
|
const [tokenIn, tokenOut] = this.determineERC20InAndERC20Out(tradeType, amountSpecified, otherToken);
|
|
15060
|
-
const multicallContract = Multicall__factory.connect(this.routingContracts.multicallAddress, this.provider);
|
|
15061
15042
|
const erc20Pair = [tokenIn, tokenOut];
|
|
15062
15043
|
// Get all pools and use these to get all possible routes.
|
|
15063
|
-
const pools = await fetchValidPools(multicallContract, erc20Pair, this.routingTokens, this.routingContracts.
|
|
15044
|
+
const pools = await fetchValidPools(this.multicallContract, erc20Pair, this.routingTokens, this.routingContracts.coreFactory);
|
|
15064
15045
|
const noValidPools = pools.length === 0;
|
|
15065
15046
|
if (noValidPools) {
|
|
15066
15047
|
throw new NoRoutesAvailableError();
|
|
@@ -15074,10 +15055,10 @@ class Router {
|
|
|
15074
15055
|
throw new NoRoutesAvailableError();
|
|
15075
15056
|
}
|
|
15076
15057
|
// Get the best quote from all of the given routes
|
|
15077
|
-
return await this.getBestQuoteFromRoutes(
|
|
15058
|
+
return await this.getBestQuoteFromRoutes(routes, amountSpecified, tradeType);
|
|
15078
15059
|
}
|
|
15079
|
-
async getBestQuoteFromRoutes(
|
|
15080
|
-
const quotes = await getQuotesForRoutes(
|
|
15060
|
+
async getBestQuoteFromRoutes(routes, amountSpecified, tradeType) {
|
|
15061
|
+
const quotes = await getQuotesForRoutes(this.provider, this.routingContracts.quoterV2, routes, amountSpecified, tradeType);
|
|
15081
15062
|
if (quotes.length === 0) {
|
|
15082
15063
|
throw new NoRoutesAvailableError();
|
|
15083
15064
|
}
|
|
@@ -15806,6 +15787,7 @@ const toPublicQuote = (amount, amountWithMaxSlippage, slippage, fees) => ({
|
|
|
15806
15787
|
});
|
|
15807
15788
|
class Exchange {
|
|
15808
15789
|
provider;
|
|
15790
|
+
batchProvider;
|
|
15809
15791
|
router;
|
|
15810
15792
|
chainId;
|
|
15811
15793
|
nativeToken;
|
|
@@ -15823,12 +15805,16 @@ class Exchange {
|
|
|
15823
15805
|
this.secondaryFees = config.secondaryFees;
|
|
15824
15806
|
this.routerContractAddress = config.chain.contracts.peripheryRouter;
|
|
15825
15807
|
this.secondaryFeeContractAddress = config.chain.contracts.secondaryFee;
|
|
15826
|
-
this.provider = new ethers.providers.
|
|
15827
|
-
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15808
|
+
this.provider = new ethers.providers.StaticJsonRpcProvider({
|
|
15809
|
+
url: config.chain.rpcUrl,
|
|
15810
|
+
skipFetchSetup: true,
|
|
15811
|
+
}, config.chain.chainId);
|
|
15812
|
+
this.batchProvider = new ethers.providers.JsonRpcBatchProvider({
|
|
15813
|
+
url: config.chain.rpcUrl,
|
|
15814
|
+
skipFetchSetup: true,
|
|
15815
|
+
}, config.chain.chainId);
|
|
15816
|
+
const multicallContract = Multicall__factory.connect(config.chain.contracts.multicall, this.provider);
|
|
15817
|
+
this.router = new Router(this.batchProvider, multicallContract, config.chain.commonRoutingTokens, config.chain.contracts);
|
|
15832
15818
|
}
|
|
15833
15819
|
static validate(tokenInAddress, tokenOutAddress, maxHops, slippagePercent, fromAddress) {
|
|
15834
15820
|
assert(isValidNonZeroAddress(fromAddress), new InvalidAddressError('invalid from address'));
|
|
@@ -15840,11 +15826,11 @@ class Exchange {
|
|
|
15840
15826
|
assert(slippagePercent <= 50, new InvalidSlippageError('slippage percent must be less than or equal to 50'));
|
|
15841
15827
|
assert(slippagePercent >= 0, new InvalidSlippageError('slippage percent must be greater than or equal to 0'));
|
|
15842
15828
|
}
|
|
15843
|
-
async getSecondaryFees() {
|
|
15829
|
+
async getSecondaryFees(provider) {
|
|
15844
15830
|
if (this.secondaryFees.length === 0) {
|
|
15845
15831
|
return [];
|
|
15846
15832
|
}
|
|
15847
|
-
const secondaryFeeContract = SecondaryFee__factory.connect(this.secondaryFeeContractAddress,
|
|
15833
|
+
const secondaryFeeContract = SecondaryFee__factory.connect(this.secondaryFeeContractAddress, provider);
|
|
15848
15834
|
if (await secondaryFeeContract.paused()) {
|
|
15849
15835
|
// Do not use secondary fees if the contract is paused
|
|
15850
15836
|
return [];
|
|
@@ -15865,11 +15851,13 @@ class Exchange {
|
|
|
15865
15851
|
async getUnsignedSwapTx(fromAddress, tokenInLiteral, tokenOutLiteral, amount, slippagePercent, maxHops, deadline, tradeType) {
|
|
15866
15852
|
Exchange.validate(tokenInLiteral, tokenOutLiteral, maxHops, slippagePercent, fromAddress);
|
|
15867
15853
|
// get the decimals of the tokens that will be swapped
|
|
15868
|
-
const
|
|
15869
|
-
getTokenDecimals(tokenInLiteral, this.
|
|
15870
|
-
getTokenDecimals(tokenOutLiteral, this.
|
|
15871
|
-
this.getSecondaryFees(),
|
|
15872
|
-
|
|
15854
|
+
const promises = [
|
|
15855
|
+
getTokenDecimals(tokenInLiteral, this.batchProvider, this.nativeToken),
|
|
15856
|
+
getTokenDecimals(tokenOutLiteral, this.batchProvider, this.nativeToken),
|
|
15857
|
+
this.getSecondaryFees(this.batchProvider),
|
|
15858
|
+
fetchGasPrice(this.batchProvider, this.nativeToken),
|
|
15859
|
+
];
|
|
15860
|
+
const [tokenInDecimals, tokenOutDecimals, secondaryFees, gasPrice] = await Promise.all(promises);
|
|
15873
15861
|
const tokenIn = this.parseTokenLiteral(tokenInLiteral, tokenInDecimals);
|
|
15874
15862
|
const tokenOut = this.parseTokenLiteral(tokenOutLiteral, tokenOutDecimals);
|
|
15875
15863
|
// determine which amount was specified for the swap from the TradeType
|
|
@@ -15878,10 +15866,7 @@ class Exchange {
|
|
|
15878
15866
|
const fees = new Fees(secondaryFees, tokenIn);
|
|
15879
15867
|
const ourQuoteReqAmount = getOurQuoteReqAmount(amountSpecified, fees, tradeType, this.nativeTokenService);
|
|
15880
15868
|
// Quotes will always use ERC20s. If the user-specified token is Native, we use the Wrapped Native Token pool
|
|
15881
|
-
const
|
|
15882
|
-
this.router.findOptimalRoute(ourQuoteReqAmount, this.nativeTokenService.maybeWrapToken(otherToken), tradeType, maxHops),
|
|
15883
|
-
fetchGasPrice(this.provider, this.nativeToken),
|
|
15884
|
-
]);
|
|
15869
|
+
const ourQuote = await this.router.findOptimalRoute(ourQuoteReqAmount, this.nativeTokenService.maybeWrapToken(otherToken), tradeType, maxHops);
|
|
15885
15870
|
const adjustedQuote = adjustQuoteWithFees(ourQuote, amountSpecified, fees, this.nativeTokenService);
|
|
15886
15871
|
const swap = getSwap(tokenIn, tokenOut, adjustedQuote, fromAddress, slippagePercent, deadline, this.routerContractAddress, this.secondaryFeeContractAddress, gasPrice, secondaryFees);
|
|
15887
15872
|
const { quotedAmount, quotedAmountWithMaxSlippage } = prepareUserQuote(this.nativeTokenService, adjustedQuote, slippagePercent, otherToken);
|
|
@@ -16538,14 +16523,24 @@ var FailedOrderCancellation;
|
|
|
16538
16523
|
/* eslint-disable */
|
|
16539
16524
|
var Fee;
|
|
16540
16525
|
(function (Fee) {
|
|
16541
|
-
(function (
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
})(Fee.
|
|
16526
|
+
(function (type) {
|
|
16527
|
+
type["ROYALTY"] = "ROYALTY";
|
|
16528
|
+
type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
|
|
16529
|
+
type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
|
|
16530
|
+
type["PROTOCOL"] = "PROTOCOL";
|
|
16531
|
+
})(Fee.type || (Fee.type = {}));
|
|
16547
16532
|
})(Fee || (Fee = {}));
|
|
16548
16533
|
|
|
16534
|
+
/* istanbul ignore file */
|
|
16535
|
+
/* tslint:disable */
|
|
16536
|
+
/* eslint-disable */
|
|
16537
|
+
var Order;
|
|
16538
|
+
(function (Order) {
|
|
16539
|
+
(function (type) {
|
|
16540
|
+
type["LISTING"] = "LISTING";
|
|
16541
|
+
})(Order.type || (Order.type = {}));
|
|
16542
|
+
})(Order || (Order = {}));
|
|
16543
|
+
|
|
16549
16544
|
/* istanbul ignore file */
|
|
16550
16545
|
/* tslint:disable */
|
|
16551
16546
|
/* eslint-disable */
|
|
@@ -16598,14 +16593,14 @@ var ActionType;
|
|
|
16598
16593
|
|
|
16599
16594
|
function mapFromOpenApiOrder(order) {
|
|
16600
16595
|
const buyItems = order.buy.map((item) => {
|
|
16601
|
-
if (item.
|
|
16596
|
+
if (item.type === 'ERC20') {
|
|
16602
16597
|
return {
|
|
16603
16598
|
type: 'ERC20',
|
|
16604
16599
|
contractAddress: item.contract_address,
|
|
16605
16600
|
amount: item.amount,
|
|
16606
16601
|
};
|
|
16607
16602
|
}
|
|
16608
|
-
if (item.
|
|
16603
|
+
if (item.type === 'NATIVE') {
|
|
16609
16604
|
return {
|
|
16610
16605
|
type: 'NATIVE',
|
|
16611
16606
|
amount: item.amount,
|
|
@@ -16614,7 +16609,7 @@ function mapFromOpenApiOrder(order) {
|
|
|
16614
16609
|
throw new Error('Buy items must be either ERC20 or NATIVE');
|
|
16615
16610
|
});
|
|
16616
16611
|
const sellItems = order.sell.map((item) => {
|
|
16617
|
-
if (item.
|
|
16612
|
+
if (item.type === 'ERC721') {
|
|
16618
16613
|
return {
|
|
16619
16614
|
type: 'ERC721',
|
|
16620
16615
|
contractAddress: item.contract_address,
|
|
@@ -16625,20 +16620,22 @@ function mapFromOpenApiOrder(order) {
|
|
|
16625
16620
|
});
|
|
16626
16621
|
return {
|
|
16627
16622
|
id: order.id,
|
|
16623
|
+
type: order.type,
|
|
16628
16624
|
accountAddress: order.account_address,
|
|
16629
16625
|
buy: buyItems,
|
|
16630
16626
|
sell: sellItems,
|
|
16631
16627
|
fees: order.fees.map((fee) => ({
|
|
16632
16628
|
amount: fee.amount,
|
|
16633
|
-
|
|
16634
|
-
type: fee.
|
|
16629
|
+
recipientAddress: fee.recipient_address,
|
|
16630
|
+
type: fee.type,
|
|
16635
16631
|
})),
|
|
16636
16632
|
chain: order.chain,
|
|
16637
16633
|
createdAt: order.created_at,
|
|
16638
16634
|
endAt: order.end_at,
|
|
16635
|
+
orderHash: order.order_hash,
|
|
16639
16636
|
protocolData: {
|
|
16640
|
-
counter: order.protocol_data.counter,
|
|
16641
16637
|
orderType: order.protocol_data.order_type,
|
|
16638
|
+
counter: order.protocol_data.counter,
|
|
16642
16639
|
seaportAddress: order.protocol_data.seaport_address,
|
|
16643
16640
|
seaportVersion: order.protocol_data.seaport_version,
|
|
16644
16641
|
zoneAddress: order.protocol_data.zone_address,
|
|
@@ -16652,14 +16649,14 @@ function mapFromOpenApiOrder(order) {
|
|
|
16652
16649
|
}
|
|
16653
16650
|
function mapFromOpenApiTrade(trade) {
|
|
16654
16651
|
const buyItems = trade.buy.map((item) => {
|
|
16655
|
-
if (item.
|
|
16652
|
+
if (item.type === 'ERC20') {
|
|
16656
16653
|
return {
|
|
16657
16654
|
type: 'ERC20',
|
|
16658
16655
|
contractAddress: item.contract_address,
|
|
16659
16656
|
amount: item.amount,
|
|
16660
16657
|
};
|
|
16661
16658
|
}
|
|
16662
|
-
if (item.
|
|
16659
|
+
if (item.type === 'NATIVE') {
|
|
16663
16660
|
return {
|
|
16664
16661
|
type: 'NATIVE',
|
|
16665
16662
|
amount: item.amount,
|
|
@@ -16668,7 +16665,7 @@ function mapFromOpenApiTrade(trade) {
|
|
|
16668
16665
|
throw new Error('Buy items must be either ERC20 or NATIVE');
|
|
16669
16666
|
});
|
|
16670
16667
|
const sellItems = trade.sell.map((item) => {
|
|
16671
|
-
if (item.
|
|
16668
|
+
if (item.type === 'ERC721') {
|
|
16672
16669
|
return {
|
|
16673
16670
|
type: 'ERC721',
|
|
16674
16671
|
contractAddress: item.contract_address,
|
|
@@ -16684,8 +16681,8 @@ function mapFromOpenApiTrade(trade) {
|
|
|
16684
16681
|
sell: sellItems,
|
|
16685
16682
|
buyerFees: trade.buyer_fees.map((fee) => ({
|
|
16686
16683
|
amount: fee.amount,
|
|
16687
|
-
|
|
16688
|
-
type: fee.
|
|
16684
|
+
recipientAddress: fee.recipient_address,
|
|
16685
|
+
type: fee.type,
|
|
16689
16686
|
})),
|
|
16690
16687
|
chain: trade.chain,
|
|
16691
16688
|
indexedAt: trade.indexed_at,
|
|
@@ -16799,7 +16796,7 @@ chainId) {
|
|
|
16799
16796
|
|
|
16800
16797
|
function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress) {
|
|
16801
16798
|
const considerationItems = order.buy.map((buyItem) => {
|
|
16802
|
-
switch (buyItem.
|
|
16799
|
+
switch (buyItem.type) {
|
|
16803
16800
|
case 'NATIVE':
|
|
16804
16801
|
return {
|
|
16805
16802
|
startAmount: buyItem.amount,
|
|
@@ -16831,9 +16828,9 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
|
|
|
16831
16828
|
});
|
|
16832
16829
|
const fees = order.fees.map((fee) => ({
|
|
16833
16830
|
amount: fee.amount,
|
|
16834
|
-
itemType: order.buy[0].
|
|
16835
|
-
recipient: fee.
|
|
16836
|
-
token: order.buy[0].
|
|
16831
|
+
itemType: order.buy[0].type === 'ERC20' ? ItemType$1.ERC20 : ItemType$1.NATIVE,
|
|
16832
|
+
recipient: fee.recipient_address,
|
|
16833
|
+
token: order.buy[0].type === 'ERC20'
|
|
16837
16834
|
? order.buy[0].contract_address
|
|
16838
16835
|
: constants$1.AddressZero,
|
|
16839
16836
|
identifierOrCriteria: '0',
|
|
@@ -17125,11 +17122,10 @@ class ImmutableApiClient {
|
|
|
17125
17122
|
return this.orderbookService.createListing({
|
|
17126
17123
|
chainName: this.chainName,
|
|
17127
17124
|
requestBody: {
|
|
17128
|
-
order_hash: orderHash,
|
|
17129
17125
|
account_address: orderComponents.offerer,
|
|
17130
17126
|
buy: [
|
|
17131
17127
|
{
|
|
17132
|
-
|
|
17128
|
+
type: Number(orderComponents.consideration[0].itemType)
|
|
17133
17129
|
=== ItemType$1.NATIVE
|
|
17134
17130
|
? 'NATIVE'
|
|
17135
17131
|
: 'ERC20',
|
|
@@ -17139,10 +17135,11 @@ class ImmutableApiClient {
|
|
|
17139
17135
|
],
|
|
17140
17136
|
fees: makerFees.map((x) => ({
|
|
17141
17137
|
amount: x.amount,
|
|
17142
|
-
|
|
17143
|
-
|
|
17138
|
+
type: FeeType.MAKER_ECOSYSTEM,
|
|
17139
|
+
recipient_address: x.recipientAddress,
|
|
17144
17140
|
})),
|
|
17145
17141
|
end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
|
|
17142
|
+
order_hash: orderHash,
|
|
17146
17143
|
protocol_data: {
|
|
17147
17144
|
order_type: ProtocolData.order_type.FULL_RESTRICTED,
|
|
17148
17145
|
zone_address: orderComponents.zone,
|
|
@@ -17155,7 +17152,7 @@ class ImmutableApiClient {
|
|
|
17155
17152
|
{
|
|
17156
17153
|
contract_address: orderComponents.offer[0].token,
|
|
17157
17154
|
token_id: orderComponents.offer[0].identifierOrCriteria,
|
|
17158
|
-
|
|
17155
|
+
type: 'ERC721',
|
|
17159
17156
|
},
|
|
17160
17157
|
],
|
|
17161
17158
|
signature: orderSignature,
|
|
@@ -17188,8 +17185,8 @@ function getOrderbookConfig(environment) {
|
|
|
17188
17185
|
switch (environment) {
|
|
17189
17186
|
case Environment$1.SANDBOX:
|
|
17190
17187
|
return {
|
|
17191
|
-
seaportContractAddress: '
|
|
17192
|
-
zoneContractAddress: '
|
|
17188
|
+
seaportContractAddress: '0x3A0C2Ba54D6CBd3121F01b96dFd20e99D1696C9D',
|
|
17189
|
+
zoneContractAddress: '0x2EA937879beeF3393853A74Ad62F9ad7DA0B9E81',
|
|
17193
17190
|
apiEndpoint: 'https://api.sandbox.immutable.com',
|
|
17194
17191
|
chainName: TESTNET_CHAIN_NAME,
|
|
17195
17192
|
provider: new providers.JsonRpcProvider('https://rpc.testnet.immutable.com'),
|
|
@@ -17352,8 +17349,8 @@ class Orderbook {
|
|
|
17352
17349
|
order_id: listingId,
|
|
17353
17350
|
fees: takerFees.map((fee) => ({
|
|
17354
17351
|
amount: fee.amount,
|
|
17355
|
-
|
|
17356
|
-
|
|
17352
|
+
type: FeeType.TAKER_ECOSYSTEM,
|
|
17353
|
+
recipient_address: fee.recipientAddress,
|
|
17357
17354
|
})),
|
|
17358
17355
|
},
|
|
17359
17356
|
]);
|
|
@@ -17375,8 +17372,8 @@ class Orderbook {
|
|
|
17375
17372
|
order_id: listingRequest.listingId,
|
|
17376
17373
|
fees: listingRequest.takerFees.map((fee) => ({
|
|
17377
17374
|
amount: fee.amount,
|
|
17378
|
-
|
|
17379
|
-
|
|
17375
|
+
type: FeeType.TAKER_ECOSYSTEM,
|
|
17376
|
+
recipient_address: fee.recipientAddress,
|
|
17380
17377
|
})),
|
|
17381
17378
|
})));
|
|
17382
17379
|
try {
|
|
@@ -20987,7 +20984,7 @@ class APIError extends Error {
|
|
|
20987
20984
|
|
|
20988
20985
|
/* eslint-disable implicit-arrow-linebreak */
|
|
20989
20986
|
const defaultHeaders = {
|
|
20990
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
20987
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.35.1',
|
|
20991
20988
|
};
|
|
20992
20989
|
/**
|
|
20993
20990
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -22264,7 +22261,7 @@ const GAS_OVERRIDES = {
|
|
|
22264
22261
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
22265
22262
|
};
|
|
22266
22263
|
|
|
22267
|
-
const SDK_VERSION_MARKER = '0.
|
|
22264
|
+
const SDK_VERSION_MARKER = '0.35.1';
|
|
22268
22265
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
22269
22266
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
22270
22267
|
|
|
@@ -25295,7 +25292,7 @@ const calculateFees = (orderFees, weiAmount, decimals = 18) => {
|
|
|
25295
25292
|
if (currentFeeBn.gt(0)) {
|
|
25296
25293
|
calculateFeesResult.push({
|
|
25297
25294
|
amount: currentFeeBn.toString(),
|
|
25298
|
-
|
|
25295
|
+
recipientAddress: orderFee.recipient,
|
|
25299
25296
|
});
|
|
25300
25297
|
}
|
|
25301
25298
|
} // for
|
|
@@ -17,7 +17,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
17
17
|
chainID,
|
|
18
18
|
coreContractAddress,
|
|
19
19
|
registrationContractAddress,
|
|
20
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
20
|
+
sdkVersion: 'ts-immutable-sdk-0.35.1',
|
|
21
21
|
});
|
|
22
22
|
/**
|
|
23
23
|
* Sets `sdkVersion` at the time of build
|