@imtbl/sdk 1.28.1 → 1.28.2
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/sdk.js +4 -4
- package/dist/checkout.js +40 -24
- package/dist/config.js +1 -1
- package/dist/index.browser.js +5 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +42 -26
- package/dist/index.js +43 -27
- package/dist/orderbook.js +38 -22
- package/dist/passport.js +4 -4
- package/dist/x.js +3 -3
- package/package.json +1 -1
package/dist/checkout.js
CHANGED
|
@@ -12,7 +12,7 @@ import { keccak256 as keccak256$1 } from '@ethersproject/solidity';
|
|
|
12
12
|
import { SwapRouter, PaymentsExtended } from '@uniswap/router-sdk';
|
|
13
13
|
import FormData$2 from 'form-data';
|
|
14
14
|
import { Seaport as Seaport$1 } from '@opensea/seaport-js';
|
|
15
|
-
import { JsonRpcProvider, JsonRpcSigner } from 'ethers-v6';
|
|
15
|
+
import { FetchRequest, JsonRpcProvider, JsonRpcSigner } from 'ethers-v6';
|
|
16
16
|
|
|
17
17
|
const isNode$1 = () => typeof window === 'undefined';
|
|
18
18
|
const isBrowser$1 = () => !isNode$1();
|
|
@@ -140,7 +140,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
140
140
|
};
|
|
141
141
|
|
|
142
142
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
143
|
-
const SDK_VERSION$1 = '1.28.
|
|
143
|
+
const SDK_VERSION$1 = '1.28.2';
|
|
144
144
|
const getReferrer$1 = () => {
|
|
145
145
|
if (isNode$1()) {
|
|
146
146
|
return '';
|
|
@@ -17583,7 +17583,7 @@ const flattenProperties = (properties) => {
|
|
|
17583
17583
|
};
|
|
17584
17584
|
|
|
17585
17585
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
17586
|
-
const SDK_VERSION = '1.28.
|
|
17586
|
+
const SDK_VERSION = '1.28.2';
|
|
17587
17587
|
const getReferrer = () => {
|
|
17588
17588
|
if (isNode()) {
|
|
17589
17589
|
return '';
|
|
@@ -22780,11 +22780,13 @@ class Seaport {
|
|
|
22780
22780
|
provider;
|
|
22781
22781
|
seaportContractAddress;
|
|
22782
22782
|
zoneContractAddress;
|
|
22783
|
-
|
|
22783
|
+
rateLimitingKey;
|
|
22784
|
+
constructor(seaportLibFactory, provider, seaportContractAddress, zoneContractAddress, rateLimitingKey) {
|
|
22784
22785
|
this.seaportLibFactory = seaportLibFactory;
|
|
22785
22786
|
this.provider = provider;
|
|
22786
22787
|
this.seaportContractAddress = seaportContractAddress;
|
|
22787
22788
|
this.zoneContractAddress = zoneContractAddress;
|
|
22789
|
+
this.rateLimitingKey = rateLimitingKey;
|
|
22788
22790
|
}
|
|
22789
22791
|
async prepareSeaportOrder(offerer, listingItem, considerationItem, orderStart, orderExpiry) {
|
|
22790
22792
|
const { actions: seaportActions } = await this.createSeaportOrder(offerer, listingItem, considerationItem, orderStart, orderExpiry);
|
|
@@ -22950,11 +22952,7 @@ class Seaport {
|
|
|
22950
22952
|
}
|
|
22951
22953
|
getSeaportLib(order) {
|
|
22952
22954
|
const seaportAddress = order?.protocol_data?.seaport_address ?? this.seaportContractAddress;
|
|
22953
|
-
|
|
22954
|
-
// if (order?.protocol_data?.seaport_version === SEAPORT_CONTRACT_VERSION_V1_5) {
|
|
22955
|
-
// seaportVersion = SEAPORT_CONTRACT_VERSION_V1_5;
|
|
22956
|
-
// }
|
|
22957
|
-
return this.seaportLibFactory.create(seaportVersion, seaportAddress);
|
|
22955
|
+
return this.seaportLibFactory.create(seaportAddress, this.rateLimitingKey);
|
|
22958
22956
|
}
|
|
22959
22957
|
static getExpirationISOTimeFromExtraData(extraData) {
|
|
22960
22958
|
// Expirtaion bytes in SIP7 extra data [21:29]
|
|
@@ -23077,12 +23075,17 @@ class ImmutableApiClientFactory {
|
|
|
23077
23075
|
chainName;
|
|
23078
23076
|
seaportAddress;
|
|
23079
23077
|
orderbookClient;
|
|
23080
|
-
constructor(apiEndpoint, chainName, seaportAddress) {
|
|
23078
|
+
constructor(apiEndpoint, chainName, seaportAddress, rateLimitingKey) {
|
|
23081
23079
|
this.chainName = chainName;
|
|
23082
23080
|
this.seaportAddress = seaportAddress;
|
|
23083
23081
|
this.orderbookClient = new OrderBookClient({
|
|
23084
23082
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
23085
23083
|
BASE: apiEndpoint,
|
|
23084
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
23085
|
+
HEADERS: rateLimitingKey ? {
|
|
23086
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
23087
|
+
'x-api-key': rateLimitingKey,
|
|
23088
|
+
} : undefined,
|
|
23086
23089
|
});
|
|
23087
23090
|
}
|
|
23088
23091
|
create() {
|
|
@@ -23092,15 +23095,24 @@ class ImmutableApiClientFactory {
|
|
|
23092
23095
|
|
|
23093
23096
|
const TESTNET_CHAIN_NAME = 'imtbl-zkevm-testnet';
|
|
23094
23097
|
const MAINNET_CHAIN_NAME = 'imtbl-zkevm-mainnet';
|
|
23095
|
-
function
|
|
23096
|
-
|
|
23098
|
+
function getConfiguredProvider(url, rateLimitingKey) {
|
|
23099
|
+
return new providers.JsonRpcProvider({
|
|
23100
|
+
url,
|
|
23101
|
+
headers: rateLimitingKey ? {
|
|
23102
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
23103
|
+
'x-api-key': rateLimitingKey,
|
|
23104
|
+
} : undefined,
|
|
23105
|
+
});
|
|
23106
|
+
}
|
|
23107
|
+
function getOrderbookConfig(config) {
|
|
23108
|
+
switch (config.baseConfig.environment) {
|
|
23097
23109
|
case Environment$1.SANDBOX:
|
|
23098
23110
|
return {
|
|
23099
23111
|
seaportContractAddress: '0x7d117aA8BD6D31c4fa91722f246388f38ab1942c',
|
|
23100
23112
|
zoneContractAddress: '0x8831867E347AB87FA30199C5B695F0A31604Bb52',
|
|
23101
23113
|
apiEndpoint: 'https://api.sandbox.immutable.com',
|
|
23102
23114
|
chainName: TESTNET_CHAIN_NAME,
|
|
23103
|
-
provider:
|
|
23115
|
+
provider: getConfiguredProvider('https://rpc.testnet.immutable.com', config.baseConfig.rateLimitingKey),
|
|
23104
23116
|
};
|
|
23105
23117
|
// not yet deployed
|
|
23106
23118
|
case Environment$1.PRODUCTION:
|
|
@@ -23109,7 +23121,7 @@ function getOrderbookConfig(environment) {
|
|
|
23109
23121
|
zoneContractAddress: '0x00338b92Bec262078B3e49BF12bbEA058916BF91',
|
|
23110
23122
|
apiEndpoint: 'https://api.immutable.com',
|
|
23111
23123
|
chainName: MAINNET_CHAIN_NAME,
|
|
23112
|
-
provider:
|
|
23124
|
+
provider: getConfiguredProvider('https://rpc.immutable.com', config.baseConfig.rateLimitingKey),
|
|
23113
23125
|
};
|
|
23114
23126
|
default:
|
|
23115
23127
|
return null;
|
|
@@ -23119,8 +23131,12 @@ function getOrderbookConfig(environment) {
|
|
|
23119
23131
|
// The order book module only supports V5 JsonRpcProviders. These are instantiated
|
|
23120
23132
|
// by the environment or by providing an RPC URL override. For this reason we can
|
|
23121
23133
|
// safely instantiate a V6 provider for the V5 provider URL.
|
|
23122
|
-
function convertToV6Provider(provider) {
|
|
23123
|
-
const
|
|
23134
|
+
function convertToV6Provider(provider, rateLimitingKey) {
|
|
23135
|
+
const fetch = new FetchRequest(provider.connection.url);
|
|
23136
|
+
if (rateLimitingKey) {
|
|
23137
|
+
fetch.setHeader('x-api-key', rateLimitingKey);
|
|
23138
|
+
}
|
|
23139
|
+
const overwrittenProvider = new JsonRpcProvider(fetch);
|
|
23124
23140
|
// Need to override the getSigner method to mimic V5 behaviour
|
|
23125
23141
|
overwrittenProvider.getSigner = async function getSigner(address) {
|
|
23126
23142
|
if (address == null) {
|
|
@@ -23150,9 +23166,9 @@ class SeaportLibFactory {
|
|
|
23150
23166
|
this.defaultSeaportContractAddress = defaultSeaportContractAddress;
|
|
23151
23167
|
this.provider = provider;
|
|
23152
23168
|
}
|
|
23153
|
-
create(
|
|
23169
|
+
create(orderSeaportAddress, rateLimitingKey) {
|
|
23154
23170
|
const seaportContractAddress = orderSeaportAddress ?? this.defaultSeaportContractAddress;
|
|
23155
|
-
return new Seaport$1(convertToV6Provider(this.provider), {
|
|
23171
|
+
return new Seaport$1(convertToV6Provider(this.provider, rateLimitingKey), {
|
|
23156
23172
|
balanceAndApprovalChecksOnOrderCreation: true,
|
|
23157
23173
|
overrides: {
|
|
23158
23174
|
contractAddress: seaportContractAddress,
|
|
@@ -23171,13 +23187,13 @@ class Orderbook {
|
|
|
23171
23187
|
seaport;
|
|
23172
23188
|
orderbookConfig;
|
|
23173
23189
|
constructor(config) {
|
|
23174
|
-
const obConfig = getOrderbookConfig(config
|
|
23190
|
+
const obConfig = getOrderbookConfig(config);
|
|
23175
23191
|
const finalConfig = {
|
|
23176
23192
|
...obConfig,
|
|
23177
23193
|
...config.overrides,
|
|
23178
23194
|
};
|
|
23179
23195
|
if (config.overrides?.jsonRpcProviderUrl) {
|
|
23180
|
-
finalConfig.provider =
|
|
23196
|
+
finalConfig.provider = getConfiguredProvider(config.overrides?.jsonRpcProviderUrl, config.baseConfig.rateLimitingKey);
|
|
23181
23197
|
}
|
|
23182
23198
|
if (!finalConfig) {
|
|
23183
23199
|
throw new Error('Orderbook configuration not passed, please specify the environment under config.baseConfig.environment');
|
|
@@ -23187,9 +23203,9 @@ class Orderbook {
|
|
|
23187
23203
|
if (!apiEndpoint) {
|
|
23188
23204
|
throw new Error('API endpoint must be provided');
|
|
23189
23205
|
}
|
|
23190
|
-
this.apiClient = new ImmutableApiClientFactory(apiEndpoint, chainName, this.orderbookConfig.seaportContractAddress).create();
|
|
23206
|
+
this.apiClient = new ImmutableApiClientFactory(apiEndpoint, chainName, this.orderbookConfig.seaportContractAddress, config.baseConfig.rateLimitingKey).create();
|
|
23191
23207
|
const seaportLibFactory = new SeaportLibFactory(this.orderbookConfig.seaportContractAddress, this.orderbookConfig.provider);
|
|
23192
|
-
this.seaport = new Seaport(seaportLibFactory, this.orderbookConfig.provider, this.orderbookConfig.seaportContractAddress, this.orderbookConfig.zoneContractAddress);
|
|
23208
|
+
this.seaport = new Seaport(seaportLibFactory, this.orderbookConfig.provider, this.orderbookConfig.seaportContractAddress, this.orderbookConfig.zoneContractAddress, config.baseConfig.rateLimitingKey);
|
|
23193
23209
|
}
|
|
23194
23210
|
/**
|
|
23195
23211
|
* Return the configuration for the orderbook module.
|
|
@@ -28885,7 +28901,7 @@ class APIError extends Error {
|
|
|
28885
28901
|
|
|
28886
28902
|
/* eslint-disable implicit-arrow-linebreak */
|
|
28887
28903
|
const defaultHeaders = {
|
|
28888
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.28.
|
|
28904
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.28.2',
|
|
28889
28905
|
};
|
|
28890
28906
|
/**
|
|
28891
28907
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -30316,7 +30332,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
30316
30332
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
30317
30333
|
};
|
|
30318
30334
|
|
|
30319
|
-
const SDK_VERSION_MARKER = '1.28.
|
|
30335
|
+
const SDK_VERSION_MARKER = '1.28.2';
|
|
30320
30336
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
30321
30337
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
30322
30338
|
|
package/dist/config.js
CHANGED
|
@@ -128,7 +128,7 @@ const flattenProperties = (properties) => {
|
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
131
|
-
const SDK_VERSION = '1.28.
|
|
131
|
+
const SDK_VERSION = '1.28.2';
|
|
132
132
|
const getReferrer = () => {
|
|
133
133
|
if (isNode()) {
|
|
134
134
|
return '';
|