@imtbl/sdk 1.15.3-alpha → 1.15.5-alpha
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.d.ts +6 -0
- package/dist/checkout.js +4 -4
- package/dist/config.js +1 -1
- package/dist/index.browser.js +14 -14
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +34 -32
- package/dist/index.d.ts +9 -2
- package/dist/index.js +33 -31
- package/dist/orderbook.js +1 -1
- package/dist/passport.d.ts +6 -0
- package/dist/passport.js +59 -26
- package/dist/x.d.ts +6 -3
- package/dist/x.js +61 -28
- package/package.json +1 -1
package/dist/passport.js
CHANGED
|
@@ -7,8 +7,7 @@ import BN from 'bn.js';
|
|
|
7
7
|
import * as encUtils from 'enc-utils';
|
|
8
8
|
import '@ethersproject/bytes';
|
|
9
9
|
import hashJS from 'hash.js';
|
|
10
|
-
import
|
|
11
|
-
import { ec as ec$1, curves as curves$1 } from 'elliptic';
|
|
10
|
+
import { ec, curves } from 'elliptic';
|
|
12
11
|
import 'ethereumjs-wallet';
|
|
13
12
|
import 'assert';
|
|
14
13
|
import { BigNumber, Contract, errors, utils as utils$2, ethers, constants } from 'ethers';
|
|
@@ -11351,7 +11350,7 @@ class MultiRollupApiClients {
|
|
|
11351
11350
|
}
|
|
11352
11351
|
|
|
11353
11352
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11354
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.15.
|
|
11353
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.15.5-alpha' };
|
|
11355
11354
|
const createConfig$1 = ({ basePath, headers, }) => {
|
|
11356
11355
|
if (!basePath.trim()) {
|
|
11357
11356
|
throw Error('basePath can not be empty');
|
|
@@ -11530,7 +11529,7 @@ const flattenProperties = (properties) => {
|
|
|
11530
11529
|
};
|
|
11531
11530
|
|
|
11532
11531
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
11533
|
-
const SDK_VERSION = '1.15.
|
|
11532
|
+
const SDK_VERSION = '1.15.5-alpha';
|
|
11534
11533
|
const getReferrer = () => {
|
|
11535
11534
|
if (isNode()) {
|
|
11536
11535
|
return '';
|
|
@@ -11729,7 +11728,7 @@ const setPassportClientId = errorBoundary(getGlobalisedValue('setPassportClientI
|
|
|
11729
11728
|
const setPublishableApiKeyFn = (publishableApiKey) => {
|
|
11730
11729
|
storeDetail(Detail.PUBLISHABLE_API_KEY, publishableApiKey);
|
|
11731
11730
|
};
|
|
11732
|
-
errorBoundary(getGlobalisedValue('setPublishableApiKey', setPublishableApiKeyFn));
|
|
11731
|
+
const setPublishableApiKey = errorBoundary(getGlobalisedValue('setPublishableApiKey', setPublishableApiKeyFn));
|
|
11733
11732
|
const getDetail = errorBoundary(getGlobalisedValue('getDetail', getDetail$1));
|
|
11734
11733
|
|
|
11735
11734
|
var Environment;
|
|
@@ -11743,15 +11742,48 @@ var KeyHeaders;
|
|
|
11743
11742
|
KeyHeaders["PUBLISHABLE_KEY"] = "x-immutable-publishable-key";
|
|
11744
11743
|
KeyHeaders["RATE_LIMITING_KEY"] = "x-api-key";
|
|
11745
11744
|
})(KeyHeaders || (KeyHeaders = {}));
|
|
11745
|
+
// Adds publishableKey, apiKey, and rateLimitingKey to the headers of the overrides object
|
|
11746
|
+
// if exists in base config. Otherwise returns the overrides object as is.
|
|
11747
|
+
// Use this for openapi generated clients with security headers.
|
|
11748
|
+
const addKeysToHeadersOverride = (baseConfig, overrides) => {
|
|
11749
|
+
if (!baseConfig || (!baseConfig.apiKey && !baseConfig.publishableKey && !baseConfig.rateLimitingKey)) {
|
|
11750
|
+
return overrides;
|
|
11751
|
+
}
|
|
11752
|
+
const newHeaders = {};
|
|
11753
|
+
if (baseConfig.apiKey) {
|
|
11754
|
+
newHeaders[KeyHeaders.API_KEY] = baseConfig.apiKey;
|
|
11755
|
+
}
|
|
11756
|
+
if (baseConfig.publishableKey) {
|
|
11757
|
+
newHeaders[KeyHeaders.PUBLISHABLE_KEY] = baseConfig.publishableKey;
|
|
11758
|
+
setPublishableApiKey(baseConfig.publishableKey);
|
|
11759
|
+
}
|
|
11760
|
+
if (baseConfig.rateLimitingKey) {
|
|
11761
|
+
newHeaders[KeyHeaders.RATE_LIMITING_KEY] = baseConfig.rateLimitingKey;
|
|
11762
|
+
}
|
|
11763
|
+
// If overrides and overrides.headers exist, merge them with newHeaders, giving precedence to existing overrides
|
|
11764
|
+
if (overrides && overrides.headers) {
|
|
11765
|
+
return {
|
|
11766
|
+
...overrides,
|
|
11767
|
+
headers: {
|
|
11768
|
+
...newHeaders,
|
|
11769
|
+
...overrides.headers,
|
|
11770
|
+
},
|
|
11771
|
+
};
|
|
11772
|
+
}
|
|
11773
|
+
return {
|
|
11774
|
+
...overrides,
|
|
11775
|
+
headers: newHeaders,
|
|
11776
|
+
};
|
|
11777
|
+
};
|
|
11746
11778
|
|
|
11747
11779
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
11748
11780
|
class ApiConfiguration extends index$2.Configuration {
|
|
11749
11781
|
}
|
|
11750
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.15.
|
|
11782
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.15.5-alpha' };
|
|
11751
11783
|
/**
|
|
11752
11784
|
* @dev use createImmutableXConfiguration instead
|
|
11753
11785
|
*/
|
|
11754
|
-
const createConfig = ({ coreContractAddress, registrationContractAddress, chainID, basePath, headers, sdkVersion, }) => {
|
|
11786
|
+
const createConfig = ({ coreContractAddress, registrationContractAddress, chainID, basePath, headers, sdkVersion, baseConfig, }) => {
|
|
11755
11787
|
if (!basePath.trim()) {
|
|
11756
11788
|
throw Error('basePath can not be empty');
|
|
11757
11789
|
}
|
|
@@ -11759,7 +11791,11 @@ const createConfig = ({ coreContractAddress, registrationContractAddress, chainI
|
|
|
11759
11791
|
defaultHeaders['x-sdk-version'] = sdkVersion;
|
|
11760
11792
|
}
|
|
11761
11793
|
// eslint-disable-next-line no-param-reassign
|
|
11762
|
-
headers = {
|
|
11794
|
+
headers = {
|
|
11795
|
+
...(headers || {}),
|
|
11796
|
+
...(addKeysToHeadersOverride(baseConfig, { headers })?.headers || {}),
|
|
11797
|
+
...defaultHeaders,
|
|
11798
|
+
};
|
|
11763
11799
|
const apiConfigOptions = {
|
|
11764
11800
|
basePath,
|
|
11765
11801
|
baseOptions: { headers },
|
|
@@ -11777,30 +11813,27 @@ const createConfig = ({ coreContractAddress, registrationContractAddress, chainI
|
|
|
11777
11813
|
* createImmutableXConfiguration to create a custom ImmutableXConfiguration
|
|
11778
11814
|
* other than the production and sandbox defined below.
|
|
11779
11815
|
*/
|
|
11780
|
-
const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress, registrationContractAddress, }) => createConfig({
|
|
11816
|
+
const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress, registrationContractAddress, baseConfig, }) => createConfig({
|
|
11781
11817
|
basePath,
|
|
11782
11818
|
chainID,
|
|
11783
11819
|
coreContractAddress,
|
|
11784
11820
|
registrationContractAddress,
|
|
11785
|
-
sdkVersion: 'ts-immutable-sdk-1.15.
|
|
11821
|
+
sdkVersion: 'ts-immutable-sdk-1.15.5-alpha',
|
|
11822
|
+
baseConfig,
|
|
11786
11823
|
});
|
|
11787
|
-
|
|
11788
|
-
* Sets `sdkVersion` at the time of build
|
|
11789
|
-
*/
|
|
11790
|
-
const production = () => createImmutableXConfiguration({
|
|
11824
|
+
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
|
11791
11825
|
basePath: 'https://api.x.immutable.com',
|
|
11792
11826
|
chainID: 1,
|
|
11793
11827
|
coreContractAddress: '0x5FDCCA53617f4d2b9134B29090C87D01058e27e9',
|
|
11794
11828
|
registrationContractAddress: '0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c',
|
|
11829
|
+
baseConfig,
|
|
11795
11830
|
});
|
|
11796
|
-
|
|
11797
|
-
* Sets `sdkVersion` at the time of build
|
|
11798
|
-
*/
|
|
11799
|
-
const sandbox = () => createImmutableXConfiguration({
|
|
11831
|
+
const sandbox = ({ baseConfig }) => createImmutableXConfiguration({
|
|
11800
11832
|
basePath: 'https://api.sandbox.x.immutable.com',
|
|
11801
11833
|
chainID: 11155111,
|
|
11802
11834
|
coreContractAddress: '0x2d5C349fD8464DA06a3f90b4B0E9195F3d1b7F98',
|
|
11803
11835
|
registrationContractAddress: '0xDbA6129C02E69405622fAdc3d5A7f8d23eac3b97',
|
|
11836
|
+
baseConfig,
|
|
11804
11837
|
});
|
|
11805
11838
|
class ImxConfiguration {
|
|
11806
11839
|
immutableXConfig;
|
|
@@ -11813,15 +11846,15 @@ class ImxConfiguration {
|
|
|
11813
11846
|
else {
|
|
11814
11847
|
switch (baseConfig.environment) {
|
|
11815
11848
|
case Environment.SANDBOX: {
|
|
11816
|
-
this.immutableXConfig = sandbox();
|
|
11849
|
+
this.immutableXConfig = sandbox({ baseConfig });
|
|
11817
11850
|
break;
|
|
11818
11851
|
}
|
|
11819
11852
|
case Environment.PRODUCTION: {
|
|
11820
|
-
this.immutableXConfig = production();
|
|
11853
|
+
this.immutableXConfig = production({ baseConfig });
|
|
11821
11854
|
break;
|
|
11822
11855
|
}
|
|
11823
11856
|
default: {
|
|
11824
|
-
this.immutableXConfig = sandbox();
|
|
11857
|
+
this.immutableXConfig = sandbox({ baseConfig });
|
|
11825
11858
|
}
|
|
11826
11859
|
}
|
|
11827
11860
|
}
|
|
@@ -13968,7 +14001,7 @@ const constantPointsHex = [
|
|
|
13968
14001
|
];
|
|
13969
14002
|
const prime = new BN('800000000000011000000000000000000000000000000000000000000000001', 16);
|
|
13970
14003
|
const order = new BN('08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f', 16);
|
|
13971
|
-
const starkEc = new ec
|
|
14004
|
+
const starkEc = new ec(new curves.PresetCurve({
|
|
13972
14005
|
type: 'short',
|
|
13973
14006
|
prime: null,
|
|
13974
14007
|
p: prime,
|
|
@@ -14012,7 +14045,6 @@ var Errors;
|
|
|
14012
14045
|
Errors["StarkCurveInvalidMessageLength"] = "invalid message length";
|
|
14013
14046
|
})(Errors || (Errors = {}));
|
|
14014
14047
|
|
|
14015
|
-
const { ec, curves } = pkg;
|
|
14016
14048
|
/*
|
|
14017
14049
|
Stark-friendly elliptic curve
|
|
14018
14050
|
|
|
@@ -14376,6 +14408,7 @@ class Workflows {
|
|
|
14376
14408
|
|
|
14377
14409
|
class IMXClient {
|
|
14378
14410
|
immutableX;
|
|
14411
|
+
imxConfig;
|
|
14379
14412
|
assetApi;
|
|
14380
14413
|
balanceApi;
|
|
14381
14414
|
collectionApi;
|
|
@@ -14396,8 +14429,8 @@ class IMXClient {
|
|
|
14396
14429
|
withdrawalsApi;
|
|
14397
14430
|
workflows;
|
|
14398
14431
|
constructor(config) {
|
|
14399
|
-
|
|
14400
|
-
this.immutableX = new ImxApiClients(imxConfig.immutableXConfig.apiConfiguration);
|
|
14432
|
+
this.imxConfig = new ImxConfiguration(config);
|
|
14433
|
+
this.immutableX = new ImxApiClients(this.imxConfig.immutableXConfig.apiConfiguration);
|
|
14401
14434
|
this.assetApi = this.immutableX.assetApi;
|
|
14402
14435
|
this.balanceApi = this.immutableX.balanceApi;
|
|
14403
14436
|
this.collectionApi = this.immutableX.collectionApi;
|
|
@@ -14416,7 +14449,7 @@ class IMXClient {
|
|
|
14416
14449
|
this.transfersApi = this.immutableX.transfersApi;
|
|
14417
14450
|
this.usersApi = this.immutableX.usersApi;
|
|
14418
14451
|
this.withdrawalsApi = this.immutableX.withdrawalsApi;
|
|
14419
|
-
this.workflows = new Workflows(imxConfig.immutableXConfig, this.immutableX.collectionApi, this.immutableX.exchangeApi, this.immutableX.metadataApi, this.immutableX.metadataRefreshesApi, this.immutableX.mintsApi, this.immutableX.primarySalesApi, this.immutableX.projectsApi);
|
|
14452
|
+
this.workflows = new Workflows(this.imxConfig.immutableXConfig, this.immutableX.collectionApi, this.immutableX.exchangeApi, this.immutableX.metadataApi, this.immutableX.metadataRefreshesApi, this.immutableX.mintsApi, this.immutableX.primarySalesApi, this.immutableX.projectsApi);
|
|
14420
14453
|
}
|
|
14421
14454
|
/**
|
|
14422
14455
|
* Get details of a Deposit with the given ID
|
package/dist/x.d.ts
CHANGED
|
@@ -12514,6 +12514,7 @@ interface ImmutableXConfigurationParams {
|
|
|
12514
12514
|
chainID: number;
|
|
12515
12515
|
coreContractAddress: string;
|
|
12516
12516
|
registrationContractAddress: string;
|
|
12517
|
+
baseConfig?: ImmutableConfiguration;
|
|
12517
12518
|
}
|
|
12518
12519
|
interface EthConfiguration$1 {
|
|
12519
12520
|
coreContractAddress: string;
|
|
@@ -12524,6 +12525,7 @@ interface ImxEnvironment extends EthConfiguration$1 {
|
|
|
12524
12525
|
basePath: string;
|
|
12525
12526
|
headers?: Record<string, string>;
|
|
12526
12527
|
sdkVersion?: string;
|
|
12528
|
+
baseConfig?: ImmutableConfiguration;
|
|
12527
12529
|
}
|
|
12528
12530
|
interface ImmutableXConfiguration$1 {
|
|
12529
12531
|
/**
|
|
@@ -12538,12 +12540,12 @@ interface ImmutableXConfiguration$1 {
|
|
|
12538
12540
|
/**
|
|
12539
12541
|
* @dev use createImmutableXConfiguration instead
|
|
12540
12542
|
*/
|
|
12541
|
-
declare const createConfig: ({ coreContractAddress, registrationContractAddress, chainID, basePath, headers, sdkVersion, }: ImxEnvironment) => ImmutableXConfiguration$1;
|
|
12543
|
+
declare const createConfig: ({ coreContractAddress, registrationContractAddress, chainID, basePath, headers, sdkVersion, baseConfig, }: ImxEnvironment) => ImmutableXConfiguration$1;
|
|
12542
12544
|
/**
|
|
12543
12545
|
* createImmutableXConfiguration to create a custom ImmutableXConfiguration
|
|
12544
12546
|
* other than the production and sandbox defined below.
|
|
12545
12547
|
*/
|
|
12546
|
-
declare const createImmutableXConfiguration: ({ basePath, chainID, coreContractAddress, registrationContractAddress, }: ImmutableXConfigurationParams) => ImmutableXConfiguration$1;
|
|
12548
|
+
declare const createImmutableXConfiguration: ({ basePath, chainID, coreContractAddress, registrationContractAddress, baseConfig, }: ImmutableXConfigurationParams) => ImmutableXConfiguration$1;
|
|
12547
12549
|
interface ImxOverrides {
|
|
12548
12550
|
immutableXConfig: ImmutableXConfiguration$1;
|
|
12549
12551
|
}
|
|
@@ -13189,6 +13191,7 @@ declare class Workflows {
|
|
|
13189
13191
|
|
|
13190
13192
|
declare class IMXClient {
|
|
13191
13193
|
private immutableX;
|
|
13194
|
+
imxConfig: ImxConfiguration;
|
|
13192
13195
|
assetApi: AssetsApi;
|
|
13193
13196
|
balanceApi: BalancesApi;
|
|
13194
13197
|
collectionApi: CollectionsApi;
|
|
@@ -16503,4 +16506,4 @@ declare class MetaMaskIMXProvider extends GenericIMXProvider {
|
|
|
16503
16506
|
static signMessage(message: string): Promise<string>;
|
|
16504
16507
|
}
|
|
16505
16508
|
|
|
16506
|
-
export { APIError, AcceptPrimarySaleBadRequestBody, AcceptPrimarySaleForbiddenBody, AcceptPrimarySaleNotFoundBody, AcceptPrimarySaleOKBody, AcceptPrimarySaleUnauthorizedBody, AddMetadataSchemaToCollectionRequest, AnyToken$1 as AnyToken, ApiConfiguration, AssetsApi, AssetsApiGetAssetRequest, AssetsApiListAssetsRequest, BalancesApi, BalancesApiGetBalanceRequest, BalancesApiListBalancesRequest, CancelOrderResponse$1 as CancelOrderResponse, CollectionsApi, CollectionsApiGetCollectionRequest, CollectionsApiListCollectionFiltersRequest, CollectionsApiListCollectionsRequest, ConfigOptions, exportContracts_d as Contracts, CreateCollectionRequest, CreateMetadataRefreshRequest, CreateOrderResponse$1 as CreateOrderResponse, CreatePrimarySaleBadRequestBody, CreatePrimarySaleCreatedBody, CreatePrimarySaleForbiddenBody, CreatePrimarySaleNotFoundBody, CreatePrimarySaleUnauthorizedBody, CreateTradeResponse$1 as CreateTradeResponse, CreateTransferResponseV1$1 as CreateTransferResponseV1, DepositsApi, DepositsApiGetDepositRequest, DepositsApiListDepositsRequest, ERC20Amount$1 as ERC20Amount, ERC20Token$1 as ERC20Token, ERC721Token$1 as ERC721Token, ETHAmount$1 as ETHAmount, ETHToken$1 as ETHToken, EncodingApi, Environment, EthConfiguration$1 as EthConfiguration, Signer as EthSigner, ExchangeTokenAmount$1 as ExchangeTokenAmount, ExchangesApi, ExchangesApiCreateExchangeRequest, ExchangesApiGetExchangeRequest, ExchangesApiGetExchangesRequest, GenericIMXProvider, GetSignableCancelOrderRequest$1 as GetSignableCancelOrderRequest, GetSignableOrderRequest, GetSignableTradeRequest$1 as GetSignableTradeRequest, IMXClient, IMXError, IMXProvider, ImmutableConfiguration, ImmutableX, ImmutableXConfiguration$1 as ImmutableXConfiguration, ImxConfiguration, ImxModuleConfiguration, ImxOverrides, MetaMaskIMXProvider, MetadataApi, MetadataApiGetMetadataSchemaRequest, MetadataRefreshesApi, MetadataSchemaRequest, MetadataSchemaRequestTypeEnum, MintFee, MintRequest, MintTokenDataV2, MintTokensResponse, MintUser, MintsApi, MintsApiGetMintRequest, MintsApiListMintsRequest, MintsApiMintTokensRequest, NftCheckoutPrimaryApi, NftCheckoutPrimaryApiCreateNftPrimaryRequest, NftCheckoutPrimaryApiGetCurrenciesNFTCheckoutPrimaryRequest, NftCheckoutPrimaryApiGetNftPrimaryTransactionRequest, NftCheckoutPrimaryApiGetNftPrimaryTransactionsRequest, NftTransferDetails$1 as NftTransferDetails, OrdersApi, OrdersApiCreateOrderV3Request, OrdersApiGetOrderV3Request, OrdersApiListOrdersV3Request, PrimarySalesApi, PrimarySalesApiCreatePrimarySaleRequest, PrimarySalesApiSignableCreatePrimarySaleRequest, ProjectsApi, ProviderConfiguration, RejectPrimarySaleBadRequestBody, RejectPrimarySaleForbiddenBody, RejectPrimarySaleNotFoundBody, RejectPrimarySaleOKBody, RejectPrimarySaleUnauthorizedBody, SignableToken, StarkExContractVersion, StarkSigner$1 as StarkSigner, TokenAmount$1 as TokenAmount, TokensApi, TokensApiGetTokenRequest, TokensApiListTokensRequest, TradesApi, TradesApiGetTradeV3Request, TradesApiListTradesV3Request, TransfersApi, TransfersApiGetTransferRequest, TransfersApiListTransfersRequest, UnsignedExchangeTransferRequest$1 as UnsignedExchangeTransferRequest, UnsignedMintRequest, UnsignedOrderRequest$1 as UnsignedOrderRequest, UnsignedTransferRequest$1 as UnsignedTransferRequest, UpdateCollectionRequest, UsersApi, WalletConnection, WithdrawalsApi, WithdrawalsApiGetWithdrawalRequest, WithdrawalsApiListWithdrawalsRequest, createConfig, createImmutableXConfiguration, createStarkSigner, generateLegacyStarkPrivateKey, generateStarkPrivateKey, imxClientConfig };
|
|
16509
|
+
export { APIError, AcceptPrimarySaleBadRequestBody, AcceptPrimarySaleForbiddenBody, AcceptPrimarySaleNotFoundBody, AcceptPrimarySaleOKBody, AcceptPrimarySaleUnauthorizedBody, AddMetadataSchemaToCollectionRequest, AnyToken$1 as AnyToken, ApiConfiguration, AssetsApi, AssetsApiGetAssetRequest, AssetsApiListAssetsRequest, BalancesApi, BalancesApiGetBalanceRequest, BalancesApiListBalancesRequest, CancelOrderResponse$1 as CancelOrderResponse, CollectionsApi, CollectionsApiGetCollectionRequest, CollectionsApiListCollectionFiltersRequest, CollectionsApiListCollectionsRequest, ConfigOptions, exportContracts_d as Contracts, CreateCollectionRequest, CreateMetadataRefreshRequest, CreateOrderResponse$1 as CreateOrderResponse, CreatePrimarySaleBadRequestBody, CreatePrimarySaleCreatedBody, CreatePrimarySaleForbiddenBody, CreatePrimarySaleNotFoundBody, CreatePrimarySaleUnauthorizedBody, CreateTradeResponse$1 as CreateTradeResponse, CreateTransferResponseV1$1 as CreateTransferResponseV1, DepositsApi, DepositsApiGetDepositRequest, DepositsApiListDepositsRequest, ERC20Amount$1 as ERC20Amount, ERC20Token$1 as ERC20Token, ERC721Token$1 as ERC721Token, ETHAmount$1 as ETHAmount, ETHToken$1 as ETHToken, EncodingApi, Environment, EthConfiguration$1 as EthConfiguration, Signer as EthSigner, ExchangeTokenAmount$1 as ExchangeTokenAmount, ExchangesApi, ExchangesApiCreateExchangeRequest, ExchangesApiGetExchangeRequest, ExchangesApiGetExchangesRequest, GenericIMXProvider, GetSignableCancelOrderRequest$1 as GetSignableCancelOrderRequest, GetSignableOrderRequest, GetSignableTradeRequest$1 as GetSignableTradeRequest, IMXClient, IMXError, IMXProvider, ImmutableConfiguration, ImmutableX, ImmutableXConfiguration$1 as ImmutableXConfiguration, ImxModuleConfiguration as ImxClientModuleConfiguration, WalletConnection as ImxClientWalletConnection, ImxConfiguration, ImxModuleConfiguration, ImxOverrides, MetaMaskIMXProvider, MetadataApi, MetadataApiGetMetadataSchemaRequest, MetadataRefreshesApi, MetadataSchemaRequest, MetadataSchemaRequestTypeEnum, MintFee, MintRequest, MintTokenDataV2, MintTokensResponse, MintUser, MintsApi, MintsApiGetMintRequest, MintsApiListMintsRequest, MintsApiMintTokensRequest, NftCheckoutPrimaryApi, NftCheckoutPrimaryApiCreateNftPrimaryRequest, NftCheckoutPrimaryApiGetCurrenciesNFTCheckoutPrimaryRequest, NftCheckoutPrimaryApiGetNftPrimaryTransactionRequest, NftCheckoutPrimaryApiGetNftPrimaryTransactionsRequest, NftTransferDetails$1 as NftTransferDetails, OrdersApi, OrdersApiCreateOrderV3Request, OrdersApiGetOrderV3Request, OrdersApiListOrdersV3Request, PrimarySalesApi, PrimarySalesApiCreatePrimarySaleRequest, PrimarySalesApiSignableCreatePrimarySaleRequest, ProjectsApi, ProviderConfiguration, RejectPrimarySaleBadRequestBody, RejectPrimarySaleForbiddenBody, RejectPrimarySaleNotFoundBody, RejectPrimarySaleOKBody, RejectPrimarySaleUnauthorizedBody, SignableToken, StarkExContractVersion, StarkSigner$1 as StarkSigner, TokenAmount$1 as TokenAmount, TokensApi, TokensApiGetTokenRequest, TokensApiListTokensRequest, TradesApi, TradesApiGetTradeV3Request, TradesApiListTradesV3Request, TransfersApi, TransfersApiGetTransferRequest, TransfersApiListTransfersRequest, UnsignedExchangeTransferRequest$1 as UnsignedExchangeTransferRequest, UnsignedMintRequest, UnsignedOrderRequest$1 as UnsignedOrderRequest, UnsignedTransferRequest$1 as UnsignedTransferRequest, UpdateCollectionRequest, UsersApi, WalletConnection, WithdrawalsApi, WithdrawalsApiGetWithdrawalRequest, WithdrawalsApiListWithdrawalsRequest, createConfig, createImmutableXConfiguration, createStarkSigner, generateLegacyStarkPrivateKey, generateStarkPrivateKey, imxClientConfig, createStarkSigner as imxClientCreateStarkSigner, generateLegacyStarkPrivateKey as imxClientGenerateLegacyStarkPrivateKey };
|
package/dist/x.js
CHANGED
|
@@ -7,8 +7,7 @@ import BN from 'bn.js';
|
|
|
7
7
|
import * as encUtils from 'enc-utils';
|
|
8
8
|
import { splitSignature } from '@ethersproject/bytes';
|
|
9
9
|
import hashJS from 'hash.js';
|
|
10
|
-
import
|
|
11
|
-
import { ec as ec$1, curves as curves$1 } from 'elliptic';
|
|
10
|
+
import { ec, curves } from 'elliptic';
|
|
12
11
|
import { hdkey } from 'ethereumjs-wallet';
|
|
13
12
|
import 'assert';
|
|
14
13
|
import { utils, Contract, ContractFactory, ethers } from 'ethers';
|
|
@@ -8955,7 +8954,7 @@ const flattenProperties = (properties) => {
|
|
|
8955
8954
|
};
|
|
8956
8955
|
|
|
8957
8956
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
8958
|
-
const SDK_VERSION = '1.15.
|
|
8957
|
+
const SDK_VERSION = '1.15.5-alpha';
|
|
8959
8958
|
const getReferrer = () => {
|
|
8960
8959
|
if (isNode()) {
|
|
8961
8960
|
return '';
|
|
@@ -9133,7 +9132,7 @@ errorBoundary(getGlobalisedValue('setPassportClientId', setPassportClientIdFn));
|
|
|
9133
9132
|
const setPublishableApiKeyFn = (publishableApiKey) => {
|
|
9134
9133
|
storeDetail(Detail.PUBLISHABLE_API_KEY, publishableApiKey);
|
|
9135
9134
|
};
|
|
9136
|
-
errorBoundary(getGlobalisedValue('setPublishableApiKey', setPublishableApiKeyFn));
|
|
9135
|
+
const setPublishableApiKey = errorBoundary(getGlobalisedValue('setPublishableApiKey', setPublishableApiKeyFn));
|
|
9137
9136
|
errorBoundary(getGlobalisedValue('getDetail', getDetail$1));
|
|
9138
9137
|
|
|
9139
9138
|
var Environment;
|
|
@@ -9161,15 +9160,48 @@ class ImmutableConfiguration {
|
|
|
9161
9160
|
track('config', 'created_imtbl_config');
|
|
9162
9161
|
}
|
|
9163
9162
|
}
|
|
9163
|
+
// Adds publishableKey, apiKey, and rateLimitingKey to the headers of the overrides object
|
|
9164
|
+
// if exists in base config. Otherwise returns the overrides object as is.
|
|
9165
|
+
// Use this for openapi generated clients with security headers.
|
|
9166
|
+
const addKeysToHeadersOverride = (baseConfig, overrides) => {
|
|
9167
|
+
if (!baseConfig || (!baseConfig.apiKey && !baseConfig.publishableKey && !baseConfig.rateLimitingKey)) {
|
|
9168
|
+
return overrides;
|
|
9169
|
+
}
|
|
9170
|
+
const newHeaders = {};
|
|
9171
|
+
if (baseConfig.apiKey) {
|
|
9172
|
+
newHeaders[KeyHeaders.API_KEY] = baseConfig.apiKey;
|
|
9173
|
+
}
|
|
9174
|
+
if (baseConfig.publishableKey) {
|
|
9175
|
+
newHeaders[KeyHeaders.PUBLISHABLE_KEY] = baseConfig.publishableKey;
|
|
9176
|
+
setPublishableApiKey(baseConfig.publishableKey);
|
|
9177
|
+
}
|
|
9178
|
+
if (baseConfig.rateLimitingKey) {
|
|
9179
|
+
newHeaders[KeyHeaders.RATE_LIMITING_KEY] = baseConfig.rateLimitingKey;
|
|
9180
|
+
}
|
|
9181
|
+
// If overrides and overrides.headers exist, merge them with newHeaders, giving precedence to existing overrides
|
|
9182
|
+
if (overrides && overrides.headers) {
|
|
9183
|
+
return {
|
|
9184
|
+
...overrides,
|
|
9185
|
+
headers: {
|
|
9186
|
+
...newHeaders,
|
|
9187
|
+
...overrides.headers,
|
|
9188
|
+
},
|
|
9189
|
+
};
|
|
9190
|
+
}
|
|
9191
|
+
return {
|
|
9192
|
+
...overrides,
|
|
9193
|
+
headers: newHeaders,
|
|
9194
|
+
};
|
|
9195
|
+
};
|
|
9164
9196
|
|
|
9165
9197
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
9166
9198
|
class ApiConfiguration extends index$2.Configuration {
|
|
9167
9199
|
}
|
|
9168
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.15.
|
|
9200
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.15.5-alpha' };
|
|
9169
9201
|
/**
|
|
9170
9202
|
* @dev use createImmutableXConfiguration instead
|
|
9171
9203
|
*/
|
|
9172
|
-
const createConfig = ({ coreContractAddress, registrationContractAddress, chainID, basePath, headers, sdkVersion, }) => {
|
|
9204
|
+
const createConfig = ({ coreContractAddress, registrationContractAddress, chainID, basePath, headers, sdkVersion, baseConfig, }) => {
|
|
9173
9205
|
if (!basePath.trim()) {
|
|
9174
9206
|
throw Error('basePath can not be empty');
|
|
9175
9207
|
}
|
|
@@ -9177,7 +9209,11 @@ const createConfig = ({ coreContractAddress, registrationContractAddress, chainI
|
|
|
9177
9209
|
defaultHeaders['x-sdk-version'] = sdkVersion;
|
|
9178
9210
|
}
|
|
9179
9211
|
// eslint-disable-next-line no-param-reassign
|
|
9180
|
-
headers = {
|
|
9212
|
+
headers = {
|
|
9213
|
+
...(headers || {}),
|
|
9214
|
+
...(addKeysToHeadersOverride(baseConfig, { headers })?.headers || {}),
|
|
9215
|
+
...defaultHeaders,
|
|
9216
|
+
};
|
|
9181
9217
|
const apiConfigOptions = {
|
|
9182
9218
|
basePath,
|
|
9183
9219
|
baseOptions: { headers },
|
|
@@ -9195,30 +9231,27 @@ const createConfig = ({ coreContractAddress, registrationContractAddress, chainI
|
|
|
9195
9231
|
* createImmutableXConfiguration to create a custom ImmutableXConfiguration
|
|
9196
9232
|
* other than the production and sandbox defined below.
|
|
9197
9233
|
*/
|
|
9198
|
-
const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress, registrationContractAddress, }) => createConfig({
|
|
9234
|
+
const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress, registrationContractAddress, baseConfig, }) => createConfig({
|
|
9199
9235
|
basePath,
|
|
9200
9236
|
chainID,
|
|
9201
9237
|
coreContractAddress,
|
|
9202
9238
|
registrationContractAddress,
|
|
9203
|
-
sdkVersion: 'ts-immutable-sdk-1.15.
|
|
9239
|
+
sdkVersion: 'ts-immutable-sdk-1.15.5-alpha',
|
|
9240
|
+
baseConfig,
|
|
9204
9241
|
});
|
|
9205
|
-
|
|
9206
|
-
* Sets `sdkVersion` at the time of build
|
|
9207
|
-
*/
|
|
9208
|
-
const production = () => createImmutableXConfiguration({
|
|
9242
|
+
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
|
9209
9243
|
basePath: 'https://api.x.immutable.com',
|
|
9210
9244
|
chainID: 1,
|
|
9211
9245
|
coreContractAddress: '0x5FDCCA53617f4d2b9134B29090C87D01058e27e9',
|
|
9212
9246
|
registrationContractAddress: '0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c',
|
|
9247
|
+
baseConfig,
|
|
9213
9248
|
});
|
|
9214
|
-
|
|
9215
|
-
* Sets `sdkVersion` at the time of build
|
|
9216
|
-
*/
|
|
9217
|
-
const sandbox = () => createImmutableXConfiguration({
|
|
9249
|
+
const sandbox = ({ baseConfig }) => createImmutableXConfiguration({
|
|
9218
9250
|
basePath: 'https://api.sandbox.x.immutable.com',
|
|
9219
9251
|
chainID: 11155111,
|
|
9220
9252
|
coreContractAddress: '0x2d5C349fD8464DA06a3f90b4B0E9195F3d1b7F98',
|
|
9221
9253
|
registrationContractAddress: '0xDbA6129C02E69405622fAdc3d5A7f8d23eac3b97',
|
|
9254
|
+
baseConfig,
|
|
9222
9255
|
});
|
|
9223
9256
|
class ImxConfiguration {
|
|
9224
9257
|
immutableXConfig;
|
|
@@ -9231,15 +9264,15 @@ class ImxConfiguration {
|
|
|
9231
9264
|
else {
|
|
9232
9265
|
switch (baseConfig.environment) {
|
|
9233
9266
|
case Environment.SANDBOX: {
|
|
9234
|
-
this.immutableXConfig = sandbox();
|
|
9267
|
+
this.immutableXConfig = sandbox({ baseConfig });
|
|
9235
9268
|
break;
|
|
9236
9269
|
}
|
|
9237
9270
|
case Environment.PRODUCTION: {
|
|
9238
|
-
this.immutableXConfig = production();
|
|
9271
|
+
this.immutableXConfig = production({ baseConfig });
|
|
9239
9272
|
break;
|
|
9240
9273
|
}
|
|
9241
9274
|
default: {
|
|
9242
|
-
this.immutableXConfig = sandbox();
|
|
9275
|
+
this.immutableXConfig = sandbox({ baseConfig });
|
|
9243
9276
|
}
|
|
9244
9277
|
}
|
|
9245
9278
|
}
|
|
@@ -9263,9 +9296,9 @@ const imxClientConfig = (configOptions) => {
|
|
|
9263
9296
|
if (Object.values(Environment).indexOf(configOptions.environment) === -1) {
|
|
9264
9297
|
throw new Error(`Invalid environment: ${configOptions.environment}`);
|
|
9265
9298
|
}
|
|
9266
|
-
const clientConfig =
|
|
9299
|
+
const clientConfig = {
|
|
9267
9300
|
baseConfig: new ImmutableConfiguration(configOptions),
|
|
9268
|
-
}
|
|
9301
|
+
};
|
|
9269
9302
|
return clientConfig;
|
|
9270
9303
|
};
|
|
9271
9304
|
|
|
@@ -11415,7 +11448,7 @@ const DEFAULT_ACCOUNT_APPLICATION = 'immutablex';
|
|
|
11415
11448
|
const DEFAULT_ACCOUNT_INDEX = '1';
|
|
11416
11449
|
const prime = new BN('800000000000011000000000000000000000000000000000000000000000001', 16);
|
|
11417
11450
|
const order = new BN('08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f', 16);
|
|
11418
|
-
const starkEc = new ec
|
|
11451
|
+
const starkEc = new ec(new curves.PresetCurve({
|
|
11419
11452
|
type: 'short',
|
|
11420
11453
|
prime: null,
|
|
11421
11454
|
p: prime,
|
|
@@ -11579,7 +11612,6 @@ async function getStarkPublicKeyFromImx(ethAddress) {
|
|
|
11579
11612
|
return undefined;
|
|
11580
11613
|
}
|
|
11581
11614
|
|
|
11582
|
-
const { ec, curves } = pkg;
|
|
11583
11615
|
/*
|
|
11584
11616
|
Stark-friendly elliptic curve
|
|
11585
11617
|
|
|
@@ -12106,6 +12138,7 @@ class Workflows {
|
|
|
12106
12138
|
|
|
12107
12139
|
class IMXClient {
|
|
12108
12140
|
immutableX;
|
|
12141
|
+
imxConfig;
|
|
12109
12142
|
assetApi;
|
|
12110
12143
|
balanceApi;
|
|
12111
12144
|
collectionApi;
|
|
@@ -12126,8 +12159,8 @@ class IMXClient {
|
|
|
12126
12159
|
withdrawalsApi;
|
|
12127
12160
|
workflows;
|
|
12128
12161
|
constructor(config) {
|
|
12129
|
-
|
|
12130
|
-
this.immutableX = new ImxApiClients(imxConfig.immutableXConfig.apiConfiguration);
|
|
12162
|
+
this.imxConfig = new ImxConfiguration(config);
|
|
12163
|
+
this.immutableX = new ImxApiClients(this.imxConfig.immutableXConfig.apiConfiguration);
|
|
12131
12164
|
this.assetApi = this.immutableX.assetApi;
|
|
12132
12165
|
this.balanceApi = this.immutableX.balanceApi;
|
|
12133
12166
|
this.collectionApi = this.immutableX.collectionApi;
|
|
@@ -12146,7 +12179,7 @@ class IMXClient {
|
|
|
12146
12179
|
this.transfersApi = this.immutableX.transfersApi;
|
|
12147
12180
|
this.usersApi = this.immutableX.usersApi;
|
|
12148
12181
|
this.withdrawalsApi = this.immutableX.withdrawalsApi;
|
|
12149
|
-
this.workflows = new Workflows(imxConfig.immutableXConfig, this.immutableX.collectionApi, this.immutableX.exchangeApi, this.immutableX.metadataApi, this.immutableX.metadataRefreshesApi, this.immutableX.mintsApi, this.immutableX.primarySalesApi, this.immutableX.projectsApi);
|
|
12182
|
+
this.workflows = new Workflows(this.imxConfig.immutableXConfig, this.immutableX.collectionApi, this.immutableX.exchangeApi, this.immutableX.metadataApi, this.immutableX.metadataRefreshesApi, this.immutableX.mintsApi, this.immutableX.primarySalesApi, this.immutableX.projectsApi);
|
|
12150
12183
|
}
|
|
12151
12184
|
/**
|
|
12152
12185
|
* Get details of a Deposit with the given ID
|
|
@@ -16359,4 +16392,4 @@ class ProviderConfiguration {
|
|
|
16359
16392
|
}
|
|
16360
16393
|
}
|
|
16361
16394
|
|
|
16362
|
-
export { ApiConfiguration, AssetsApi, BalancesApi, CollectionsApi, exportContracts as Contracts, DepositsApi, EncodingApi, Environment, ExchangesApi, GenericIMXProvider, IMXClient, IMXError, ImmutableConfiguration, ImmutableX, ImxConfiguration, MetaMaskIMXProvider, MetadataApi, MetadataRefreshesApi, MetadataSchemaRequestTypeEnum, MintsApi, NftCheckoutPrimaryApi, OrdersApi, PrimarySalesApi, ProjectsApi, ProviderConfiguration, TokensApi, TradesApi, TransfersApi, UsersApi, WithdrawalsApi, createConfig, createImmutableXConfiguration, createStarkSigner, generateLegacyStarkPrivateKey, generateStarkPrivateKey, imxClientConfig };
|
|
16395
|
+
export { ApiConfiguration, AssetsApi, BalancesApi, CollectionsApi, exportContracts as Contracts, DepositsApi, EncodingApi, Environment, ExchangesApi, GenericIMXProvider, IMXClient, IMXError, ImmutableConfiguration, ImmutableX, ImxConfiguration, MetaMaskIMXProvider, MetadataApi, MetadataRefreshesApi, MetadataSchemaRequestTypeEnum, MintsApi, NftCheckoutPrimaryApi, OrdersApi, PrimarySalesApi, ProjectsApi, ProviderConfiguration, TokensApi, TradesApi, TransfersApi, UsersApi, WithdrawalsApi, createConfig, createImmutableXConfiguration, createStarkSigner, generateLegacyStarkPrivateKey, generateStarkPrivateKey, imxClientConfig, createStarkSigner as imxClientCreateStarkSigner, generateLegacyStarkPrivateKey as imxClientGenerateLegacyStarkPrivateKey };
|
package/package.json
CHANGED