@imtbl/sdk 0.34.1-alpha → 0.35.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 +2 -2
- package/dist/browser/checkout/widgets.js +51 -51
- package/dist/checkout.js +47 -35
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +5 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +49 -37
- package/dist/index.d.ts +50 -16
- package/dist/index.js +49 -37
- 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/index.cjs
CHANGED
|
@@ -3791,7 +3791,7 @@ class MultiRollupApiClients {
|
|
|
3791
3791
|
}
|
|
3792
3792
|
|
|
3793
3793
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3794
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
3794
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.35.0' };
|
|
3795
3795
|
const createConfig = ({ basePath, headers, }) => {
|
|
3796
3796
|
if (!basePath.trim()) {
|
|
3797
3797
|
throw Error('basePath can not be empty');
|
|
@@ -3851,7 +3851,7 @@ class APIError extends Error {
|
|
|
3851
3851
|
|
|
3852
3852
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3853
3853
|
const defaultHeaders = {
|
|
3854
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
3854
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.35.0',
|
|
3855
3855
|
};
|
|
3856
3856
|
/**
|
|
3857
3857
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4262,7 +4262,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4262
4262
|
chainID,
|
|
4263
4263
|
coreContractAddress,
|
|
4264
4264
|
registrationContractAddress,
|
|
4265
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
4265
|
+
sdkVersion: 'ts-immutable-sdk-0.35.0',
|
|
4266
4266
|
});
|
|
4267
4267
|
/**
|
|
4268
4268
|
* Sets `sdkVersion` at the time of build
|
|
@@ -11720,14 +11720,24 @@ var FailedOrderCancellation;
|
|
|
11720
11720
|
/* eslint-disable */
|
|
11721
11721
|
var Fee;
|
|
11722
11722
|
(function (Fee) {
|
|
11723
|
-
(function (
|
|
11724
|
-
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
})(Fee.
|
|
11723
|
+
(function (type) {
|
|
11724
|
+
type["ROYALTY"] = "ROYALTY";
|
|
11725
|
+
type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
|
|
11726
|
+
type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
|
|
11727
|
+
type["PROTOCOL"] = "PROTOCOL";
|
|
11728
|
+
})(Fee.type || (Fee.type = {}));
|
|
11729
11729
|
})(Fee || (Fee = {}));
|
|
11730
11730
|
|
|
11731
|
+
/* istanbul ignore file */
|
|
11732
|
+
/* tslint:disable */
|
|
11733
|
+
/* eslint-disable */
|
|
11734
|
+
var Order;
|
|
11735
|
+
(function (Order) {
|
|
11736
|
+
(function (type) {
|
|
11737
|
+
type["LISTING"] = "LISTING";
|
|
11738
|
+
})(Order.type || (Order.type = {}));
|
|
11739
|
+
})(Order || (Order = {}));
|
|
11740
|
+
|
|
11731
11741
|
/* istanbul ignore file */
|
|
11732
11742
|
/* tslint:disable */
|
|
11733
11743
|
/* eslint-disable */
|
|
@@ -11780,14 +11790,14 @@ var ActionType;
|
|
|
11780
11790
|
|
|
11781
11791
|
function mapFromOpenApiOrder(order) {
|
|
11782
11792
|
const buyItems = order.buy.map((item) => {
|
|
11783
|
-
if (item.
|
|
11793
|
+
if (item.type === 'ERC20') {
|
|
11784
11794
|
return {
|
|
11785
11795
|
type: 'ERC20',
|
|
11786
11796
|
contractAddress: item.contract_address,
|
|
11787
11797
|
amount: item.amount,
|
|
11788
11798
|
};
|
|
11789
11799
|
}
|
|
11790
|
-
if (item.
|
|
11800
|
+
if (item.type === 'NATIVE') {
|
|
11791
11801
|
return {
|
|
11792
11802
|
type: 'NATIVE',
|
|
11793
11803
|
amount: item.amount,
|
|
@@ -11796,7 +11806,7 @@ function mapFromOpenApiOrder(order) {
|
|
|
11796
11806
|
throw new Error('Buy items must be either ERC20 or NATIVE');
|
|
11797
11807
|
});
|
|
11798
11808
|
const sellItems = order.sell.map((item) => {
|
|
11799
|
-
if (item.
|
|
11809
|
+
if (item.type === 'ERC721') {
|
|
11800
11810
|
return {
|
|
11801
11811
|
type: 'ERC721',
|
|
11802
11812
|
contractAddress: item.contract_address,
|
|
@@ -11807,20 +11817,22 @@ function mapFromOpenApiOrder(order) {
|
|
|
11807
11817
|
});
|
|
11808
11818
|
return {
|
|
11809
11819
|
id: order.id,
|
|
11820
|
+
type: order.type,
|
|
11810
11821
|
accountAddress: order.account_address,
|
|
11811
11822
|
buy: buyItems,
|
|
11812
11823
|
sell: sellItems,
|
|
11813
11824
|
fees: order.fees.map((fee) => ({
|
|
11814
11825
|
amount: fee.amount,
|
|
11815
|
-
|
|
11816
|
-
type: fee.
|
|
11826
|
+
recipientAddress: fee.recipient_address,
|
|
11827
|
+
type: fee.type,
|
|
11817
11828
|
})),
|
|
11818
11829
|
chain: order.chain,
|
|
11819
11830
|
createdAt: order.created_at,
|
|
11820
11831
|
endAt: order.end_at,
|
|
11832
|
+
orderHash: order.order_hash,
|
|
11821
11833
|
protocolData: {
|
|
11822
|
-
counter: order.protocol_data.counter,
|
|
11823
11834
|
orderType: order.protocol_data.order_type,
|
|
11835
|
+
counter: order.protocol_data.counter,
|
|
11824
11836
|
seaportAddress: order.protocol_data.seaport_address,
|
|
11825
11837
|
seaportVersion: order.protocol_data.seaport_version,
|
|
11826
11838
|
zoneAddress: order.protocol_data.zone_address,
|
|
@@ -11834,14 +11846,14 @@ function mapFromOpenApiOrder(order) {
|
|
|
11834
11846
|
}
|
|
11835
11847
|
function mapFromOpenApiTrade(trade) {
|
|
11836
11848
|
const buyItems = trade.buy.map((item) => {
|
|
11837
|
-
if (item.
|
|
11849
|
+
if (item.type === 'ERC20') {
|
|
11838
11850
|
return {
|
|
11839
11851
|
type: 'ERC20',
|
|
11840
11852
|
contractAddress: item.contract_address,
|
|
11841
11853
|
amount: item.amount,
|
|
11842
11854
|
};
|
|
11843
11855
|
}
|
|
11844
|
-
if (item.
|
|
11856
|
+
if (item.type === 'NATIVE') {
|
|
11845
11857
|
return {
|
|
11846
11858
|
type: 'NATIVE',
|
|
11847
11859
|
amount: item.amount,
|
|
@@ -11850,7 +11862,7 @@ function mapFromOpenApiTrade(trade) {
|
|
|
11850
11862
|
throw new Error('Buy items must be either ERC20 or NATIVE');
|
|
11851
11863
|
});
|
|
11852
11864
|
const sellItems = trade.sell.map((item) => {
|
|
11853
|
-
if (item.
|
|
11865
|
+
if (item.type === 'ERC721') {
|
|
11854
11866
|
return {
|
|
11855
11867
|
type: 'ERC721',
|
|
11856
11868
|
contractAddress: item.contract_address,
|
|
@@ -11866,8 +11878,8 @@ function mapFromOpenApiTrade(trade) {
|
|
|
11866
11878
|
sell: sellItems,
|
|
11867
11879
|
buyerFees: trade.buyer_fees.map((fee) => ({
|
|
11868
11880
|
amount: fee.amount,
|
|
11869
|
-
|
|
11870
|
-
type: fee.
|
|
11881
|
+
recipientAddress: fee.recipient_address,
|
|
11882
|
+
type: fee.type,
|
|
11871
11883
|
})),
|
|
11872
11884
|
chain: trade.chain,
|
|
11873
11885
|
indexedAt: trade.indexed_at,
|
|
@@ -11981,7 +11993,7 @@ chainId) {
|
|
|
11981
11993
|
|
|
11982
11994
|
function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress) {
|
|
11983
11995
|
const considerationItems = order.buy.map((buyItem) => {
|
|
11984
|
-
switch (buyItem.
|
|
11996
|
+
switch (buyItem.type) {
|
|
11985
11997
|
case 'NATIVE':
|
|
11986
11998
|
return {
|
|
11987
11999
|
startAmount: buyItem.amount,
|
|
@@ -12013,9 +12025,9 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
|
|
|
12013
12025
|
});
|
|
12014
12026
|
const fees = order.fees.map((fee) => ({
|
|
12015
12027
|
amount: fee.amount,
|
|
12016
|
-
itemType: order.buy[0].
|
|
12017
|
-
recipient: fee.
|
|
12018
|
-
token: order.buy[0].
|
|
12028
|
+
itemType: order.buy[0].type === 'ERC20' ? ItemType$1.ERC20 : ItemType$1.NATIVE,
|
|
12029
|
+
recipient: fee.recipient_address,
|
|
12030
|
+
token: order.buy[0].type === 'ERC20'
|
|
12019
12031
|
? order.buy[0].contract_address
|
|
12020
12032
|
: ethers.constants.AddressZero,
|
|
12021
12033
|
identifierOrCriteria: '0',
|
|
@@ -12307,11 +12319,10 @@ class ImmutableApiClient {
|
|
|
12307
12319
|
return this.orderbookService.createListing({
|
|
12308
12320
|
chainName: this.chainName,
|
|
12309
12321
|
requestBody: {
|
|
12310
|
-
order_hash: orderHash,
|
|
12311
12322
|
account_address: orderComponents.offerer,
|
|
12312
12323
|
buy: [
|
|
12313
12324
|
{
|
|
12314
|
-
|
|
12325
|
+
type: Number(orderComponents.consideration[0].itemType)
|
|
12315
12326
|
=== ItemType$1.NATIVE
|
|
12316
12327
|
? 'NATIVE'
|
|
12317
12328
|
: 'ERC20',
|
|
@@ -12321,10 +12332,11 @@ class ImmutableApiClient {
|
|
|
12321
12332
|
],
|
|
12322
12333
|
fees: makerFees.map((x) => ({
|
|
12323
12334
|
amount: x.amount,
|
|
12324
|
-
|
|
12325
|
-
|
|
12335
|
+
type: FeeType.MAKER_ECOSYSTEM,
|
|
12336
|
+
recipient_address: x.recipientAddress,
|
|
12326
12337
|
})),
|
|
12327
12338
|
end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
|
|
12339
|
+
order_hash: orderHash,
|
|
12328
12340
|
protocol_data: {
|
|
12329
12341
|
order_type: ProtocolData.order_type.FULL_RESTRICTED,
|
|
12330
12342
|
zone_address: orderComponents.zone,
|
|
@@ -12337,7 +12349,7 @@ class ImmutableApiClient {
|
|
|
12337
12349
|
{
|
|
12338
12350
|
contract_address: orderComponents.offer[0].token,
|
|
12339
12351
|
token_id: orderComponents.offer[0].identifierOrCriteria,
|
|
12340
|
-
|
|
12352
|
+
type: 'ERC721',
|
|
12341
12353
|
},
|
|
12342
12354
|
],
|
|
12343
12355
|
signature: orderSignature,
|
|
@@ -12370,8 +12382,8 @@ function getOrderbookConfig(environment) {
|
|
|
12370
12382
|
switch (environment) {
|
|
12371
12383
|
case Environment$1.SANDBOX:
|
|
12372
12384
|
return {
|
|
12373
|
-
seaportContractAddress: '
|
|
12374
|
-
zoneContractAddress: '
|
|
12385
|
+
seaportContractAddress: '0x3A0C2Ba54D6CBd3121F01b96dFd20e99D1696C9D',
|
|
12386
|
+
zoneContractAddress: '0x2EA937879beeF3393853A74Ad62F9ad7DA0B9E81',
|
|
12375
12387
|
apiEndpoint: 'https://api.sandbox.immutable.com',
|
|
12376
12388
|
chainName: TESTNET_CHAIN_NAME,
|
|
12377
12389
|
provider: new ethers.providers.JsonRpcProvider('https://rpc.testnet.immutable.com'),
|
|
@@ -12534,8 +12546,8 @@ class Orderbook {
|
|
|
12534
12546
|
order_id: listingId,
|
|
12535
12547
|
fees: takerFees.map((fee) => ({
|
|
12536
12548
|
amount: fee.amount,
|
|
12537
|
-
|
|
12538
|
-
|
|
12549
|
+
type: FeeType.TAKER_ECOSYSTEM,
|
|
12550
|
+
recipient_address: fee.recipientAddress,
|
|
12539
12551
|
})),
|
|
12540
12552
|
},
|
|
12541
12553
|
]);
|
|
@@ -12557,8 +12569,8 @@ class Orderbook {
|
|
|
12557
12569
|
order_id: listingRequest.listingId,
|
|
12558
12570
|
fees: listingRequest.takerFees.map((fee) => ({
|
|
12559
12571
|
amount: fee.amount,
|
|
12560
|
-
|
|
12561
|
-
|
|
12572
|
+
type: FeeType.TAKER_ECOSYSTEM,
|
|
12573
|
+
recipient_address: fee.recipientAddress,
|
|
12562
12574
|
})),
|
|
12563
12575
|
})));
|
|
12564
12576
|
try {
|
|
@@ -30572,7 +30584,7 @@ const GAS_OVERRIDES = {
|
|
|
30572
30584
|
maxPriorityFeePerGas: ethers.BigNumber.from(101e9),
|
|
30573
30585
|
};
|
|
30574
30586
|
|
|
30575
|
-
const SDK_VERSION_MARKER = '0.
|
|
30587
|
+
const SDK_VERSION_MARKER = '0.35.0';
|
|
30576
30588
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
30577
30589
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
30578
30590
|
|
|
@@ -33603,7 +33615,7 @@ const calculateFees = (orderFees, weiAmount, decimals = 18) => {
|
|
|
33603
33615
|
if (currentFeeBn.gt(0)) {
|
|
33604
33616
|
calculateFeesResult.push({
|
|
33605
33617
|
amount: currentFeeBn.toString(),
|
|
33606
|
-
|
|
33618
|
+
recipientAddress: orderFee.recipient,
|
|
33607
33619
|
});
|
|
33608
33620
|
}
|
|
33609
33621
|
} // for
|
package/dist/index.d.ts
CHANGED
|
@@ -14919,17 +14919,17 @@ type Fee$2 = {
|
|
|
14919
14919
|
/**
|
|
14920
14920
|
* Fee type
|
|
14921
14921
|
*/
|
|
14922
|
-
|
|
14922
|
+
type: Fee$2.type;
|
|
14923
14923
|
/**
|
|
14924
14924
|
* Wallet address of fee recipient
|
|
14925
14925
|
*/
|
|
14926
|
-
|
|
14926
|
+
recipient_address: string;
|
|
14927
14927
|
};
|
|
14928
14928
|
declare namespace Fee$2 {
|
|
14929
14929
|
/**
|
|
14930
14930
|
* Fee type
|
|
14931
14931
|
*/
|
|
14932
|
-
enum
|
|
14932
|
+
enum type {
|
|
14933
14933
|
ROYALTY = "ROYALTY",
|
|
14934
14934
|
MAKER_ECOSYSTEM = "MAKER_ECOSYSTEM",
|
|
14935
14935
|
TAKER_ECOSYSTEM = "TAKER_ECOSYSTEM",
|
|
@@ -14937,17 +14937,36 @@ declare namespace Fee$2 {
|
|
|
14937
14937
|
}
|
|
14938
14938
|
}
|
|
14939
14939
|
|
|
14940
|
+
type ERC1155Item = {
|
|
14941
|
+
/**
|
|
14942
|
+
* Token type user is offering, which in this case is ERC1155
|
|
14943
|
+
*/
|
|
14944
|
+
type: 'ERC1155';
|
|
14945
|
+
/**
|
|
14946
|
+
* Address of ERC1155 token
|
|
14947
|
+
*/
|
|
14948
|
+
contract_address: string;
|
|
14949
|
+
/**
|
|
14950
|
+
* ID of ERC1155 token
|
|
14951
|
+
*/
|
|
14952
|
+
token_id: string;
|
|
14953
|
+
/**
|
|
14954
|
+
* A string representing the price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
|
|
14955
|
+
*/
|
|
14956
|
+
amount: string;
|
|
14957
|
+
};
|
|
14958
|
+
|
|
14940
14959
|
type ERC20Item$1 = {
|
|
14941
14960
|
/**
|
|
14942
14961
|
* Token type user is offering, which in this case is ERC20
|
|
14943
14962
|
*/
|
|
14944
|
-
|
|
14963
|
+
type: 'ERC20';
|
|
14945
14964
|
/**
|
|
14946
14965
|
* Address of ERC20 token
|
|
14947
14966
|
*/
|
|
14948
14967
|
contract_address: string;
|
|
14949
14968
|
/**
|
|
14950
|
-
* A string representing the
|
|
14969
|
+
* A string representing the price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
|
|
14951
14970
|
*/
|
|
14952
14971
|
amount: string;
|
|
14953
14972
|
};
|
|
@@ -14956,7 +14975,7 @@ type ERC721Item$1 = {
|
|
|
14956
14975
|
/**
|
|
14957
14976
|
* Token type user is offering, which in this case is ERC721
|
|
14958
14977
|
*/
|
|
14959
|
-
|
|
14978
|
+
type: 'ERC721';
|
|
14960
14979
|
/**
|
|
14961
14980
|
* Address of ERC721 token
|
|
14962
14981
|
*/
|
|
@@ -14971,28 +14990,28 @@ type NativeItem$1 = {
|
|
|
14971
14990
|
/**
|
|
14972
14991
|
* Token type user is offering, which in this case is the native IMX token
|
|
14973
14992
|
*/
|
|
14974
|
-
|
|
14993
|
+
type: 'NATIVE';
|
|
14975
14994
|
/**
|
|
14976
|
-
* A string representing the
|
|
14995
|
+
* A string representing the price at which the user is willing to sell the token. This value is provided in the smallest unit of the token (e.g., wei for Ethereum).
|
|
14977
14996
|
*/
|
|
14978
14997
|
amount: string;
|
|
14979
14998
|
};
|
|
14980
14999
|
|
|
14981
|
-
type Item = (NativeItem$1 | ERC20Item$1 | ERC721Item$1);
|
|
15000
|
+
type Item = (NativeItem$1 | ERC20Item$1 | ERC721Item$1 | ERC1155Item);
|
|
14982
15001
|
|
|
14983
15002
|
type ProtocolData = {
|
|
14984
15003
|
/**
|
|
14985
|
-
*
|
|
15004
|
+
* Seaport order type
|
|
14986
15005
|
*/
|
|
14987
15006
|
order_type: ProtocolData.order_type;
|
|
14988
|
-
/**
|
|
14989
|
-
* Immutable zone address
|
|
14990
|
-
*/
|
|
14991
|
-
zone_address: string;
|
|
14992
15007
|
/**
|
|
14993
15008
|
* big.Int or uint256 string for order counter
|
|
14994
15009
|
*/
|
|
14995
15010
|
counter: string;
|
|
15011
|
+
/**
|
|
15012
|
+
* Immutable zone address
|
|
15013
|
+
*/
|
|
15014
|
+
zone_address: string;
|
|
14996
15015
|
/**
|
|
14997
15016
|
* Immutable Seaport contract address
|
|
14998
15017
|
*/
|
|
@@ -15004,7 +15023,7 @@ type ProtocolData = {
|
|
|
15004
15023
|
};
|
|
15005
15024
|
declare namespace ProtocolData {
|
|
15006
15025
|
/**
|
|
15007
|
-
*
|
|
15026
|
+
* Seaport order type
|
|
15008
15027
|
*/
|
|
15009
15028
|
enum order_type {
|
|
15010
15029
|
FULL_RESTRICTED = "FULL_RESTRICTED"
|
|
@@ -15156,6 +15175,7 @@ type Order$1 = {
|
|
|
15156
15175
|
* Global Order identifier
|
|
15157
15176
|
*/
|
|
15158
15177
|
id: string;
|
|
15178
|
+
order_hash: string;
|
|
15159
15179
|
protocol_data: ProtocolData;
|
|
15160
15180
|
/**
|
|
15161
15181
|
* A random value added to the create Order request
|
|
@@ -15171,11 +15191,23 @@ type Order$1 = {
|
|
|
15171
15191
|
*/
|
|
15172
15192
|
start_at: string;
|
|
15173
15193
|
status: OrderStatus;
|
|
15194
|
+
/**
|
|
15195
|
+
* Order type
|
|
15196
|
+
*/
|
|
15197
|
+
type: Order$1.type;
|
|
15174
15198
|
/**
|
|
15175
15199
|
* Time the Order is last updated
|
|
15176
15200
|
*/
|
|
15177
15201
|
updated_at: string;
|
|
15178
15202
|
};
|
|
15203
|
+
declare namespace Order$1 {
|
|
15204
|
+
/**
|
|
15205
|
+
* Order type
|
|
15206
|
+
*/
|
|
15207
|
+
enum type {
|
|
15208
|
+
LISTING = "LISTING"
|
|
15209
|
+
}
|
|
15210
|
+
}
|
|
15179
15211
|
|
|
15180
15212
|
type FulfillableOrder = {
|
|
15181
15213
|
extra_data: string;
|
|
@@ -15538,7 +15570,7 @@ declare enum FeeType {
|
|
|
15538
15570
|
ROYALTY = "ROYALTY"
|
|
15539
15571
|
}
|
|
15540
15572
|
interface FeeValue {
|
|
15541
|
-
|
|
15573
|
+
recipientAddress: string;
|
|
15542
15574
|
amount: string;
|
|
15543
15575
|
}
|
|
15544
15576
|
interface Fee$1 extends FeeValue {
|
|
@@ -15608,6 +15640,7 @@ interface CancelOrdersOnChainResponse {
|
|
|
15608
15640
|
}
|
|
15609
15641
|
interface Order {
|
|
15610
15642
|
id: string;
|
|
15643
|
+
type: 'LISTING';
|
|
15611
15644
|
accountAddress: string;
|
|
15612
15645
|
buy: (ERC20Item | NativeItem)[];
|
|
15613
15646
|
sell: ERC721Item[];
|
|
@@ -15626,6 +15659,7 @@ interface Order {
|
|
|
15626
15659
|
* Time after which the Order is expired
|
|
15627
15660
|
*/
|
|
15628
15661
|
endAt: string;
|
|
15662
|
+
orderHash: string;
|
|
15629
15663
|
protocolData: {
|
|
15630
15664
|
orderType: 'FULL_RESTRICTED';
|
|
15631
15665
|
zoneAddress: string;
|
package/dist/index.js
CHANGED
|
@@ -3769,7 +3769,7 @@ class MultiRollupApiClients {
|
|
|
3769
3769
|
}
|
|
3770
3770
|
|
|
3771
3771
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3772
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
3772
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.35.0' };
|
|
3773
3773
|
const createConfig = ({ basePath, headers, }) => {
|
|
3774
3774
|
if (!basePath.trim()) {
|
|
3775
3775
|
throw Error('basePath can not be empty');
|
|
@@ -3829,7 +3829,7 @@ class APIError extends Error {
|
|
|
3829
3829
|
|
|
3830
3830
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3831
3831
|
const defaultHeaders = {
|
|
3832
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
3832
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.35.0',
|
|
3833
3833
|
};
|
|
3834
3834
|
/**
|
|
3835
3835
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4240,7 +4240,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4240
4240
|
chainID,
|
|
4241
4241
|
coreContractAddress,
|
|
4242
4242
|
registrationContractAddress,
|
|
4243
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
4243
|
+
sdkVersion: 'ts-immutable-sdk-0.35.0',
|
|
4244
4244
|
});
|
|
4245
4245
|
/**
|
|
4246
4246
|
* Sets `sdkVersion` at the time of build
|
|
@@ -11698,14 +11698,24 @@ var FailedOrderCancellation;
|
|
|
11698
11698
|
/* eslint-disable */
|
|
11699
11699
|
var Fee;
|
|
11700
11700
|
(function (Fee) {
|
|
11701
|
-
(function (
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
})(Fee.
|
|
11701
|
+
(function (type) {
|
|
11702
|
+
type["ROYALTY"] = "ROYALTY";
|
|
11703
|
+
type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
|
|
11704
|
+
type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
|
|
11705
|
+
type["PROTOCOL"] = "PROTOCOL";
|
|
11706
|
+
})(Fee.type || (Fee.type = {}));
|
|
11707
11707
|
})(Fee || (Fee = {}));
|
|
11708
11708
|
|
|
11709
|
+
/* istanbul ignore file */
|
|
11710
|
+
/* tslint:disable */
|
|
11711
|
+
/* eslint-disable */
|
|
11712
|
+
var Order;
|
|
11713
|
+
(function (Order) {
|
|
11714
|
+
(function (type) {
|
|
11715
|
+
type["LISTING"] = "LISTING";
|
|
11716
|
+
})(Order.type || (Order.type = {}));
|
|
11717
|
+
})(Order || (Order = {}));
|
|
11718
|
+
|
|
11709
11719
|
/* istanbul ignore file */
|
|
11710
11720
|
/* tslint:disable */
|
|
11711
11721
|
/* eslint-disable */
|
|
@@ -11758,14 +11768,14 @@ var ActionType;
|
|
|
11758
11768
|
|
|
11759
11769
|
function mapFromOpenApiOrder(order) {
|
|
11760
11770
|
const buyItems = order.buy.map((item) => {
|
|
11761
|
-
if (item.
|
|
11771
|
+
if (item.type === 'ERC20') {
|
|
11762
11772
|
return {
|
|
11763
11773
|
type: 'ERC20',
|
|
11764
11774
|
contractAddress: item.contract_address,
|
|
11765
11775
|
amount: item.amount,
|
|
11766
11776
|
};
|
|
11767
11777
|
}
|
|
11768
|
-
if (item.
|
|
11778
|
+
if (item.type === 'NATIVE') {
|
|
11769
11779
|
return {
|
|
11770
11780
|
type: 'NATIVE',
|
|
11771
11781
|
amount: item.amount,
|
|
@@ -11774,7 +11784,7 @@ function mapFromOpenApiOrder(order) {
|
|
|
11774
11784
|
throw new Error('Buy items must be either ERC20 or NATIVE');
|
|
11775
11785
|
});
|
|
11776
11786
|
const sellItems = order.sell.map((item) => {
|
|
11777
|
-
if (item.
|
|
11787
|
+
if (item.type === 'ERC721') {
|
|
11778
11788
|
return {
|
|
11779
11789
|
type: 'ERC721',
|
|
11780
11790
|
contractAddress: item.contract_address,
|
|
@@ -11785,20 +11795,22 @@ function mapFromOpenApiOrder(order) {
|
|
|
11785
11795
|
});
|
|
11786
11796
|
return {
|
|
11787
11797
|
id: order.id,
|
|
11798
|
+
type: order.type,
|
|
11788
11799
|
accountAddress: order.account_address,
|
|
11789
11800
|
buy: buyItems,
|
|
11790
11801
|
sell: sellItems,
|
|
11791
11802
|
fees: order.fees.map((fee) => ({
|
|
11792
11803
|
amount: fee.amount,
|
|
11793
|
-
|
|
11794
|
-
type: fee.
|
|
11804
|
+
recipientAddress: fee.recipient_address,
|
|
11805
|
+
type: fee.type,
|
|
11795
11806
|
})),
|
|
11796
11807
|
chain: order.chain,
|
|
11797
11808
|
createdAt: order.created_at,
|
|
11798
11809
|
endAt: order.end_at,
|
|
11810
|
+
orderHash: order.order_hash,
|
|
11799
11811
|
protocolData: {
|
|
11800
|
-
counter: order.protocol_data.counter,
|
|
11801
11812
|
orderType: order.protocol_data.order_type,
|
|
11813
|
+
counter: order.protocol_data.counter,
|
|
11802
11814
|
seaportAddress: order.protocol_data.seaport_address,
|
|
11803
11815
|
seaportVersion: order.protocol_data.seaport_version,
|
|
11804
11816
|
zoneAddress: order.protocol_data.zone_address,
|
|
@@ -11812,14 +11824,14 @@ function mapFromOpenApiOrder(order) {
|
|
|
11812
11824
|
}
|
|
11813
11825
|
function mapFromOpenApiTrade(trade) {
|
|
11814
11826
|
const buyItems = trade.buy.map((item) => {
|
|
11815
|
-
if (item.
|
|
11827
|
+
if (item.type === 'ERC20') {
|
|
11816
11828
|
return {
|
|
11817
11829
|
type: 'ERC20',
|
|
11818
11830
|
contractAddress: item.contract_address,
|
|
11819
11831
|
amount: item.amount,
|
|
11820
11832
|
};
|
|
11821
11833
|
}
|
|
11822
|
-
if (item.
|
|
11834
|
+
if (item.type === 'NATIVE') {
|
|
11823
11835
|
return {
|
|
11824
11836
|
type: 'NATIVE',
|
|
11825
11837
|
amount: item.amount,
|
|
@@ -11828,7 +11840,7 @@ function mapFromOpenApiTrade(trade) {
|
|
|
11828
11840
|
throw new Error('Buy items must be either ERC20 or NATIVE');
|
|
11829
11841
|
});
|
|
11830
11842
|
const sellItems = trade.sell.map((item) => {
|
|
11831
|
-
if (item.
|
|
11843
|
+
if (item.type === 'ERC721') {
|
|
11832
11844
|
return {
|
|
11833
11845
|
type: 'ERC721',
|
|
11834
11846
|
contractAddress: item.contract_address,
|
|
@@ -11844,8 +11856,8 @@ function mapFromOpenApiTrade(trade) {
|
|
|
11844
11856
|
sell: sellItems,
|
|
11845
11857
|
buyerFees: trade.buyer_fees.map((fee) => ({
|
|
11846
11858
|
amount: fee.amount,
|
|
11847
|
-
|
|
11848
|
-
type: fee.
|
|
11859
|
+
recipientAddress: fee.recipient_address,
|
|
11860
|
+
type: fee.type,
|
|
11849
11861
|
})),
|
|
11850
11862
|
chain: trade.chain,
|
|
11851
11863
|
indexedAt: trade.indexed_at,
|
|
@@ -11959,7 +11971,7 @@ chainId) {
|
|
|
11959
11971
|
|
|
11960
11972
|
function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress) {
|
|
11961
11973
|
const considerationItems = order.buy.map((buyItem) => {
|
|
11962
|
-
switch (buyItem.
|
|
11974
|
+
switch (buyItem.type) {
|
|
11963
11975
|
case 'NATIVE':
|
|
11964
11976
|
return {
|
|
11965
11977
|
startAmount: buyItem.amount,
|
|
@@ -11991,9 +12003,9 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
|
|
|
11991
12003
|
});
|
|
11992
12004
|
const fees = order.fees.map((fee) => ({
|
|
11993
12005
|
amount: fee.amount,
|
|
11994
|
-
itemType: order.buy[0].
|
|
11995
|
-
recipient: fee.
|
|
11996
|
-
token: order.buy[0].
|
|
12006
|
+
itemType: order.buy[0].type === 'ERC20' ? ItemType$1.ERC20 : ItemType$1.NATIVE,
|
|
12007
|
+
recipient: fee.recipient_address,
|
|
12008
|
+
token: order.buy[0].type === 'ERC20'
|
|
11997
12009
|
? order.buy[0].contract_address
|
|
11998
12010
|
: constants$1.AddressZero,
|
|
11999
12011
|
identifierOrCriteria: '0',
|
|
@@ -12285,11 +12297,10 @@ class ImmutableApiClient {
|
|
|
12285
12297
|
return this.orderbookService.createListing({
|
|
12286
12298
|
chainName: this.chainName,
|
|
12287
12299
|
requestBody: {
|
|
12288
|
-
order_hash: orderHash,
|
|
12289
12300
|
account_address: orderComponents.offerer,
|
|
12290
12301
|
buy: [
|
|
12291
12302
|
{
|
|
12292
|
-
|
|
12303
|
+
type: Number(orderComponents.consideration[0].itemType)
|
|
12293
12304
|
=== ItemType$1.NATIVE
|
|
12294
12305
|
? 'NATIVE'
|
|
12295
12306
|
: 'ERC20',
|
|
@@ -12299,10 +12310,11 @@ class ImmutableApiClient {
|
|
|
12299
12310
|
],
|
|
12300
12311
|
fees: makerFees.map((x) => ({
|
|
12301
12312
|
amount: x.amount,
|
|
12302
|
-
|
|
12303
|
-
|
|
12313
|
+
type: FeeType.MAKER_ECOSYSTEM,
|
|
12314
|
+
recipient_address: x.recipientAddress,
|
|
12304
12315
|
})),
|
|
12305
12316
|
end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
|
|
12317
|
+
order_hash: orderHash,
|
|
12306
12318
|
protocol_data: {
|
|
12307
12319
|
order_type: ProtocolData.order_type.FULL_RESTRICTED,
|
|
12308
12320
|
zone_address: orderComponents.zone,
|
|
@@ -12315,7 +12327,7 @@ class ImmutableApiClient {
|
|
|
12315
12327
|
{
|
|
12316
12328
|
contract_address: orderComponents.offer[0].token,
|
|
12317
12329
|
token_id: orderComponents.offer[0].identifierOrCriteria,
|
|
12318
|
-
|
|
12330
|
+
type: 'ERC721',
|
|
12319
12331
|
},
|
|
12320
12332
|
],
|
|
12321
12333
|
signature: orderSignature,
|
|
@@ -12348,8 +12360,8 @@ function getOrderbookConfig(environment) {
|
|
|
12348
12360
|
switch (environment) {
|
|
12349
12361
|
case Environment$1.SANDBOX:
|
|
12350
12362
|
return {
|
|
12351
|
-
seaportContractAddress: '
|
|
12352
|
-
zoneContractAddress: '
|
|
12363
|
+
seaportContractAddress: '0x3A0C2Ba54D6CBd3121F01b96dFd20e99D1696C9D',
|
|
12364
|
+
zoneContractAddress: '0x2EA937879beeF3393853A74Ad62F9ad7DA0B9E81',
|
|
12353
12365
|
apiEndpoint: 'https://api.sandbox.immutable.com',
|
|
12354
12366
|
chainName: TESTNET_CHAIN_NAME,
|
|
12355
12367
|
provider: new providers.JsonRpcProvider('https://rpc.testnet.immutable.com'),
|
|
@@ -12512,8 +12524,8 @@ class Orderbook {
|
|
|
12512
12524
|
order_id: listingId,
|
|
12513
12525
|
fees: takerFees.map((fee) => ({
|
|
12514
12526
|
amount: fee.amount,
|
|
12515
|
-
|
|
12516
|
-
|
|
12527
|
+
type: FeeType.TAKER_ECOSYSTEM,
|
|
12528
|
+
recipient_address: fee.recipientAddress,
|
|
12517
12529
|
})),
|
|
12518
12530
|
},
|
|
12519
12531
|
]);
|
|
@@ -12535,8 +12547,8 @@ class Orderbook {
|
|
|
12535
12547
|
order_id: listingRequest.listingId,
|
|
12536
12548
|
fees: listingRequest.takerFees.map((fee) => ({
|
|
12537
12549
|
amount: fee.amount,
|
|
12538
|
-
|
|
12539
|
-
|
|
12550
|
+
type: FeeType.TAKER_ECOSYSTEM,
|
|
12551
|
+
recipient_address: fee.recipientAddress,
|
|
12540
12552
|
})),
|
|
12541
12553
|
})));
|
|
12542
12554
|
try {
|
|
@@ -30550,7 +30562,7 @@ const GAS_OVERRIDES = {
|
|
|
30550
30562
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
30551
30563
|
};
|
|
30552
30564
|
|
|
30553
|
-
const SDK_VERSION_MARKER = '0.
|
|
30565
|
+
const SDK_VERSION_MARKER = '0.35.0';
|
|
30554
30566
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
30555
30567
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
30556
30568
|
|
|
@@ -33581,7 +33593,7 @@ const calculateFees = (orderFees, weiAmount, decimals = 18) => {
|
|
|
33581
33593
|
if (currentFeeBn.gt(0)) {
|
|
33582
33594
|
calculateFeesResult.push({
|
|
33583
33595
|
amount: currentFeeBn.toString(),
|
|
33584
|
-
|
|
33596
|
+
recipientAddress: orderFee.recipient,
|
|
33585
33597
|
});
|
|
33586
33598
|
}
|
|
33587
33599
|
} // for
|