@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/checkout.js
CHANGED
|
@@ -16538,14 +16538,24 @@ var FailedOrderCancellation;
|
|
|
16538
16538
|
/* eslint-disable */
|
|
16539
16539
|
var Fee;
|
|
16540
16540
|
(function (Fee) {
|
|
16541
|
-
(function (
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
})(Fee.
|
|
16541
|
+
(function (type) {
|
|
16542
|
+
type["ROYALTY"] = "ROYALTY";
|
|
16543
|
+
type["MAKER_ECOSYSTEM"] = "MAKER_ECOSYSTEM";
|
|
16544
|
+
type["TAKER_ECOSYSTEM"] = "TAKER_ECOSYSTEM";
|
|
16545
|
+
type["PROTOCOL"] = "PROTOCOL";
|
|
16546
|
+
})(Fee.type || (Fee.type = {}));
|
|
16547
16547
|
})(Fee || (Fee = {}));
|
|
16548
16548
|
|
|
16549
|
+
/* istanbul ignore file */
|
|
16550
|
+
/* tslint:disable */
|
|
16551
|
+
/* eslint-disable */
|
|
16552
|
+
var Order;
|
|
16553
|
+
(function (Order) {
|
|
16554
|
+
(function (type) {
|
|
16555
|
+
type["LISTING"] = "LISTING";
|
|
16556
|
+
})(Order.type || (Order.type = {}));
|
|
16557
|
+
})(Order || (Order = {}));
|
|
16558
|
+
|
|
16549
16559
|
/* istanbul ignore file */
|
|
16550
16560
|
/* tslint:disable */
|
|
16551
16561
|
/* eslint-disable */
|
|
@@ -16598,14 +16608,14 @@ var ActionType;
|
|
|
16598
16608
|
|
|
16599
16609
|
function mapFromOpenApiOrder(order) {
|
|
16600
16610
|
const buyItems = order.buy.map((item) => {
|
|
16601
|
-
if (item.
|
|
16611
|
+
if (item.type === 'ERC20') {
|
|
16602
16612
|
return {
|
|
16603
16613
|
type: 'ERC20',
|
|
16604
16614
|
contractAddress: item.contract_address,
|
|
16605
16615
|
amount: item.amount,
|
|
16606
16616
|
};
|
|
16607
16617
|
}
|
|
16608
|
-
if (item.
|
|
16618
|
+
if (item.type === 'NATIVE') {
|
|
16609
16619
|
return {
|
|
16610
16620
|
type: 'NATIVE',
|
|
16611
16621
|
amount: item.amount,
|
|
@@ -16614,7 +16624,7 @@ function mapFromOpenApiOrder(order) {
|
|
|
16614
16624
|
throw new Error('Buy items must be either ERC20 or NATIVE');
|
|
16615
16625
|
});
|
|
16616
16626
|
const sellItems = order.sell.map((item) => {
|
|
16617
|
-
if (item.
|
|
16627
|
+
if (item.type === 'ERC721') {
|
|
16618
16628
|
return {
|
|
16619
16629
|
type: 'ERC721',
|
|
16620
16630
|
contractAddress: item.contract_address,
|
|
@@ -16625,20 +16635,22 @@ function mapFromOpenApiOrder(order) {
|
|
|
16625
16635
|
});
|
|
16626
16636
|
return {
|
|
16627
16637
|
id: order.id,
|
|
16638
|
+
type: order.type,
|
|
16628
16639
|
accountAddress: order.account_address,
|
|
16629
16640
|
buy: buyItems,
|
|
16630
16641
|
sell: sellItems,
|
|
16631
16642
|
fees: order.fees.map((fee) => ({
|
|
16632
16643
|
amount: fee.amount,
|
|
16633
|
-
|
|
16634
|
-
type: fee.
|
|
16644
|
+
recipientAddress: fee.recipient_address,
|
|
16645
|
+
type: fee.type,
|
|
16635
16646
|
})),
|
|
16636
16647
|
chain: order.chain,
|
|
16637
16648
|
createdAt: order.created_at,
|
|
16638
16649
|
endAt: order.end_at,
|
|
16650
|
+
orderHash: order.order_hash,
|
|
16639
16651
|
protocolData: {
|
|
16640
|
-
counter: order.protocol_data.counter,
|
|
16641
16652
|
orderType: order.protocol_data.order_type,
|
|
16653
|
+
counter: order.protocol_data.counter,
|
|
16642
16654
|
seaportAddress: order.protocol_data.seaport_address,
|
|
16643
16655
|
seaportVersion: order.protocol_data.seaport_version,
|
|
16644
16656
|
zoneAddress: order.protocol_data.zone_address,
|
|
@@ -16652,14 +16664,14 @@ function mapFromOpenApiOrder(order) {
|
|
|
16652
16664
|
}
|
|
16653
16665
|
function mapFromOpenApiTrade(trade) {
|
|
16654
16666
|
const buyItems = trade.buy.map((item) => {
|
|
16655
|
-
if (item.
|
|
16667
|
+
if (item.type === 'ERC20') {
|
|
16656
16668
|
return {
|
|
16657
16669
|
type: 'ERC20',
|
|
16658
16670
|
contractAddress: item.contract_address,
|
|
16659
16671
|
amount: item.amount,
|
|
16660
16672
|
};
|
|
16661
16673
|
}
|
|
16662
|
-
if (item.
|
|
16674
|
+
if (item.type === 'NATIVE') {
|
|
16663
16675
|
return {
|
|
16664
16676
|
type: 'NATIVE',
|
|
16665
16677
|
amount: item.amount,
|
|
@@ -16668,7 +16680,7 @@ function mapFromOpenApiTrade(trade) {
|
|
|
16668
16680
|
throw new Error('Buy items must be either ERC20 or NATIVE');
|
|
16669
16681
|
});
|
|
16670
16682
|
const sellItems = trade.sell.map((item) => {
|
|
16671
|
-
if (item.
|
|
16683
|
+
if (item.type === 'ERC721') {
|
|
16672
16684
|
return {
|
|
16673
16685
|
type: 'ERC721',
|
|
16674
16686
|
contractAddress: item.contract_address,
|
|
@@ -16684,8 +16696,8 @@ function mapFromOpenApiTrade(trade) {
|
|
|
16684
16696
|
sell: sellItems,
|
|
16685
16697
|
buyerFees: trade.buyer_fees.map((fee) => ({
|
|
16686
16698
|
amount: fee.amount,
|
|
16687
|
-
|
|
16688
|
-
type: fee.
|
|
16699
|
+
recipientAddress: fee.recipient_address,
|
|
16700
|
+
type: fee.type,
|
|
16689
16701
|
})),
|
|
16690
16702
|
chain: trade.chain,
|
|
16691
16703
|
indexedAt: trade.indexed_at,
|
|
@@ -16799,7 +16811,7 @@ chainId) {
|
|
|
16799
16811
|
|
|
16800
16812
|
function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress) {
|
|
16801
16813
|
const considerationItems = order.buy.map((buyItem) => {
|
|
16802
|
-
switch (buyItem.
|
|
16814
|
+
switch (buyItem.type) {
|
|
16803
16815
|
case 'NATIVE':
|
|
16804
16816
|
return {
|
|
16805
16817
|
startAmount: buyItem.amount,
|
|
@@ -16831,9 +16843,9 @@ function mapImmutableOrderToSeaportOrderComponents(order, counter, zoneAddress)
|
|
|
16831
16843
|
});
|
|
16832
16844
|
const fees = order.fees.map((fee) => ({
|
|
16833
16845
|
amount: fee.amount,
|
|
16834
|
-
itemType: order.buy[0].
|
|
16835
|
-
recipient: fee.
|
|
16836
|
-
token: order.buy[0].
|
|
16846
|
+
itemType: order.buy[0].type === 'ERC20' ? ItemType$1.ERC20 : ItemType$1.NATIVE,
|
|
16847
|
+
recipient: fee.recipient_address,
|
|
16848
|
+
token: order.buy[0].type === 'ERC20'
|
|
16837
16849
|
? order.buy[0].contract_address
|
|
16838
16850
|
: constants$1.AddressZero,
|
|
16839
16851
|
identifierOrCriteria: '0',
|
|
@@ -17125,11 +17137,10 @@ class ImmutableApiClient {
|
|
|
17125
17137
|
return this.orderbookService.createListing({
|
|
17126
17138
|
chainName: this.chainName,
|
|
17127
17139
|
requestBody: {
|
|
17128
|
-
order_hash: orderHash,
|
|
17129
17140
|
account_address: orderComponents.offerer,
|
|
17130
17141
|
buy: [
|
|
17131
17142
|
{
|
|
17132
|
-
|
|
17143
|
+
type: Number(orderComponents.consideration[0].itemType)
|
|
17133
17144
|
=== ItemType$1.NATIVE
|
|
17134
17145
|
? 'NATIVE'
|
|
17135
17146
|
: 'ERC20',
|
|
@@ -17139,10 +17150,11 @@ class ImmutableApiClient {
|
|
|
17139
17150
|
],
|
|
17140
17151
|
fees: makerFees.map((x) => ({
|
|
17141
17152
|
amount: x.amount,
|
|
17142
|
-
|
|
17143
|
-
|
|
17153
|
+
type: FeeType.MAKER_ECOSYSTEM,
|
|
17154
|
+
recipient_address: x.recipientAddress,
|
|
17144
17155
|
})),
|
|
17145
17156
|
end_at: new Date(parseInt(`${orderComponents.endTime.toString()}000`, 10)).toISOString(),
|
|
17157
|
+
order_hash: orderHash,
|
|
17146
17158
|
protocol_data: {
|
|
17147
17159
|
order_type: ProtocolData.order_type.FULL_RESTRICTED,
|
|
17148
17160
|
zone_address: orderComponents.zone,
|
|
@@ -17155,7 +17167,7 @@ class ImmutableApiClient {
|
|
|
17155
17167
|
{
|
|
17156
17168
|
contract_address: orderComponents.offer[0].token,
|
|
17157
17169
|
token_id: orderComponents.offer[0].identifierOrCriteria,
|
|
17158
|
-
|
|
17170
|
+
type: 'ERC721',
|
|
17159
17171
|
},
|
|
17160
17172
|
],
|
|
17161
17173
|
signature: orderSignature,
|
|
@@ -17188,8 +17200,8 @@ function getOrderbookConfig(environment) {
|
|
|
17188
17200
|
switch (environment) {
|
|
17189
17201
|
case Environment$1.SANDBOX:
|
|
17190
17202
|
return {
|
|
17191
|
-
seaportContractAddress: '
|
|
17192
|
-
zoneContractAddress: '
|
|
17203
|
+
seaportContractAddress: '0x3A0C2Ba54D6CBd3121F01b96dFd20e99D1696C9D',
|
|
17204
|
+
zoneContractAddress: '0x2EA937879beeF3393853A74Ad62F9ad7DA0B9E81',
|
|
17193
17205
|
apiEndpoint: 'https://api.sandbox.immutable.com',
|
|
17194
17206
|
chainName: TESTNET_CHAIN_NAME,
|
|
17195
17207
|
provider: new providers.JsonRpcProvider('https://rpc.testnet.immutable.com'),
|
|
@@ -17352,8 +17364,8 @@ class Orderbook {
|
|
|
17352
17364
|
order_id: listingId,
|
|
17353
17365
|
fees: takerFees.map((fee) => ({
|
|
17354
17366
|
amount: fee.amount,
|
|
17355
|
-
|
|
17356
|
-
|
|
17367
|
+
type: FeeType.TAKER_ECOSYSTEM,
|
|
17368
|
+
recipient_address: fee.recipientAddress,
|
|
17357
17369
|
})),
|
|
17358
17370
|
},
|
|
17359
17371
|
]);
|
|
@@ -17375,8 +17387,8 @@ class Orderbook {
|
|
|
17375
17387
|
order_id: listingRequest.listingId,
|
|
17376
17388
|
fees: listingRequest.takerFees.map((fee) => ({
|
|
17377
17389
|
amount: fee.amount,
|
|
17378
|
-
|
|
17379
|
-
|
|
17390
|
+
type: FeeType.TAKER_ECOSYSTEM,
|
|
17391
|
+
recipient_address: fee.recipientAddress,
|
|
17380
17392
|
})),
|
|
17381
17393
|
})));
|
|
17382
17394
|
try {
|
|
@@ -20987,7 +20999,7 @@ class APIError extends Error {
|
|
|
20987
20999
|
|
|
20988
21000
|
/* eslint-disable implicit-arrow-linebreak */
|
|
20989
21001
|
const defaultHeaders = {
|
|
20990
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
21002
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.35.0',
|
|
20991
21003
|
};
|
|
20992
21004
|
/**
|
|
20993
21005
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -22264,7 +22276,7 @@ const GAS_OVERRIDES = {
|
|
|
22264
22276
|
maxPriorityFeePerGas: BigNumber$1.from(101e9),
|
|
22265
22277
|
};
|
|
22266
22278
|
|
|
22267
|
-
const SDK_VERSION_MARKER = '0.
|
|
22279
|
+
const SDK_VERSION_MARKER = '0.35.0';
|
|
22268
22280
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
22269
22281
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
22270
22282
|
|
|
@@ -25295,7 +25307,7 @@ const calculateFees = (orderFees, weiAmount, decimals = 18) => {
|
|
|
25295
25307
|
if (currentFeeBn.gt(0)) {
|
|
25296
25308
|
calculateFeesResult.push({
|
|
25297
25309
|
amount: currentFeeBn.toString(),
|
|
25298
|
-
|
|
25310
|
+
recipientAddress: orderFee.recipient,
|
|
25299
25311
|
});
|
|
25300
25312
|
}
|
|
25301
25313
|
} // 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.0',
|
|
21
21
|
});
|
|
22
22
|
/**
|
|
23
23
|
* Sets `sdkVersion` at the time of build
|