@imtbl/sdk 1.15.4-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 +33 -33
- package/dist/index.d.ts +9 -2
- package/dist/index.js +35 -35
- 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 +63 -32
- 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 } = elliptic;
|
|
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,10 +7,8 @@ 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 {
|
|
12
|
-
import * as ethereumjsWallet from 'ethereumjs-wallet';
|
|
13
|
-
import { hdkey as hdkey$1 } from 'ethereumjs-wallet';
|
|
10
|
+
import { ec, curves } from 'elliptic';
|
|
11
|
+
import { hdkey } from 'ethereumjs-wallet';
|
|
14
12
|
import 'assert';
|
|
15
13
|
import { utils, Contract, ContractFactory, ethers } from 'ethers';
|
|
16
14
|
export { Signer as EthSigner } from '@ethersproject/abstract-signer';
|
|
@@ -8956,7 +8954,7 @@ const flattenProperties = (properties) => {
|
|
|
8956
8954
|
};
|
|
8957
8955
|
|
|
8958
8956
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
8959
|
-
const SDK_VERSION = '1.15.
|
|
8957
|
+
const SDK_VERSION = '1.15.5-alpha';
|
|
8960
8958
|
const getReferrer = () => {
|
|
8961
8959
|
if (isNode()) {
|
|
8962
8960
|
return '';
|
|
@@ -9134,7 +9132,7 @@ errorBoundary(getGlobalisedValue('setPassportClientId', setPassportClientIdFn));
|
|
|
9134
9132
|
const setPublishableApiKeyFn = (publishableApiKey) => {
|
|
9135
9133
|
storeDetail(Detail.PUBLISHABLE_API_KEY, publishableApiKey);
|
|
9136
9134
|
};
|
|
9137
|
-
errorBoundary(getGlobalisedValue('setPublishableApiKey', setPublishableApiKeyFn));
|
|
9135
|
+
const setPublishableApiKey = errorBoundary(getGlobalisedValue('setPublishableApiKey', setPublishableApiKeyFn));
|
|
9138
9136
|
errorBoundary(getGlobalisedValue('getDetail', getDetail$1));
|
|
9139
9137
|
|
|
9140
9138
|
var Environment;
|
|
@@ -9162,15 +9160,48 @@ class ImmutableConfiguration {
|
|
|
9162
9160
|
track('config', 'created_imtbl_config');
|
|
9163
9161
|
}
|
|
9164
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
|
+
};
|
|
9165
9196
|
|
|
9166
9197
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
9167
9198
|
class ApiConfiguration extends index$2.Configuration {
|
|
9168
9199
|
}
|
|
9169
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.15.
|
|
9200
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.15.5-alpha' };
|
|
9170
9201
|
/**
|
|
9171
9202
|
* @dev use createImmutableXConfiguration instead
|
|
9172
9203
|
*/
|
|
9173
|
-
const createConfig = ({ coreContractAddress, registrationContractAddress, chainID, basePath, headers, sdkVersion, }) => {
|
|
9204
|
+
const createConfig = ({ coreContractAddress, registrationContractAddress, chainID, basePath, headers, sdkVersion, baseConfig, }) => {
|
|
9174
9205
|
if (!basePath.trim()) {
|
|
9175
9206
|
throw Error('basePath can not be empty');
|
|
9176
9207
|
}
|
|
@@ -9178,7 +9209,11 @@ const createConfig = ({ coreContractAddress, registrationContractAddress, chainI
|
|
|
9178
9209
|
defaultHeaders['x-sdk-version'] = sdkVersion;
|
|
9179
9210
|
}
|
|
9180
9211
|
// eslint-disable-next-line no-param-reassign
|
|
9181
|
-
headers = {
|
|
9212
|
+
headers = {
|
|
9213
|
+
...(headers || {}),
|
|
9214
|
+
...(addKeysToHeadersOverride(baseConfig, { headers })?.headers || {}),
|
|
9215
|
+
...defaultHeaders,
|
|
9216
|
+
};
|
|
9182
9217
|
const apiConfigOptions = {
|
|
9183
9218
|
basePath,
|
|
9184
9219
|
baseOptions: { headers },
|
|
@@ -9196,30 +9231,27 @@ const createConfig = ({ coreContractAddress, registrationContractAddress, chainI
|
|
|
9196
9231
|
* createImmutableXConfiguration to create a custom ImmutableXConfiguration
|
|
9197
9232
|
* other than the production and sandbox defined below.
|
|
9198
9233
|
*/
|
|
9199
|
-
const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress, registrationContractAddress, }) => createConfig({
|
|
9234
|
+
const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress, registrationContractAddress, baseConfig, }) => createConfig({
|
|
9200
9235
|
basePath,
|
|
9201
9236
|
chainID,
|
|
9202
9237
|
coreContractAddress,
|
|
9203
9238
|
registrationContractAddress,
|
|
9204
|
-
sdkVersion: 'ts-immutable-sdk-1.15.
|
|
9239
|
+
sdkVersion: 'ts-immutable-sdk-1.15.5-alpha',
|
|
9240
|
+
baseConfig,
|
|
9205
9241
|
});
|
|
9206
|
-
|
|
9207
|
-
* Sets `sdkVersion` at the time of build
|
|
9208
|
-
*/
|
|
9209
|
-
const production = () => createImmutableXConfiguration({
|
|
9242
|
+
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
|
9210
9243
|
basePath: 'https://api.x.immutable.com',
|
|
9211
9244
|
chainID: 1,
|
|
9212
9245
|
coreContractAddress: '0x5FDCCA53617f4d2b9134B29090C87D01058e27e9',
|
|
9213
9246
|
registrationContractAddress: '0x72a06bf2a1CE5e39cBA06c0CAb824960B587d64c',
|
|
9247
|
+
baseConfig,
|
|
9214
9248
|
});
|
|
9215
|
-
|
|
9216
|
-
* Sets `sdkVersion` at the time of build
|
|
9217
|
-
*/
|
|
9218
|
-
const sandbox = () => createImmutableXConfiguration({
|
|
9249
|
+
const sandbox = ({ baseConfig }) => createImmutableXConfiguration({
|
|
9219
9250
|
basePath: 'https://api.sandbox.x.immutable.com',
|
|
9220
9251
|
chainID: 11155111,
|
|
9221
9252
|
coreContractAddress: '0x2d5C349fD8464DA06a3f90b4B0E9195F3d1b7F98',
|
|
9222
9253
|
registrationContractAddress: '0xDbA6129C02E69405622fAdc3d5A7f8d23eac3b97',
|
|
9254
|
+
baseConfig,
|
|
9223
9255
|
});
|
|
9224
9256
|
class ImxConfiguration {
|
|
9225
9257
|
immutableXConfig;
|
|
@@ -9232,15 +9264,15 @@ class ImxConfiguration {
|
|
|
9232
9264
|
else {
|
|
9233
9265
|
switch (baseConfig.environment) {
|
|
9234
9266
|
case Environment.SANDBOX: {
|
|
9235
|
-
this.immutableXConfig = sandbox();
|
|
9267
|
+
this.immutableXConfig = sandbox({ baseConfig });
|
|
9236
9268
|
break;
|
|
9237
9269
|
}
|
|
9238
9270
|
case Environment.PRODUCTION: {
|
|
9239
|
-
this.immutableXConfig = production();
|
|
9271
|
+
this.immutableXConfig = production({ baseConfig });
|
|
9240
9272
|
break;
|
|
9241
9273
|
}
|
|
9242
9274
|
default: {
|
|
9243
|
-
this.immutableXConfig = sandbox();
|
|
9275
|
+
this.immutableXConfig = sandbox({ baseConfig });
|
|
9244
9276
|
}
|
|
9245
9277
|
}
|
|
9246
9278
|
}
|
|
@@ -9264,9 +9296,9 @@ const imxClientConfig = (configOptions) => {
|
|
|
9264
9296
|
if (Object.values(Environment).indexOf(configOptions.environment) === -1) {
|
|
9265
9297
|
throw new Error(`Invalid environment: ${configOptions.environment}`);
|
|
9266
9298
|
}
|
|
9267
|
-
const clientConfig =
|
|
9299
|
+
const clientConfig = {
|
|
9268
9300
|
baseConfig: new ImmutableConfiguration(configOptions),
|
|
9269
|
-
}
|
|
9301
|
+
};
|
|
9270
9302
|
return clientConfig;
|
|
9271
9303
|
};
|
|
9272
9304
|
|
|
@@ -11416,7 +11448,7 @@ const DEFAULT_ACCOUNT_APPLICATION = 'immutablex';
|
|
|
11416
11448
|
const DEFAULT_ACCOUNT_INDEX = '1';
|
|
11417
11449
|
const prime = new BN('800000000000011000000000000000000000000000000000000000000000001', 16);
|
|
11418
11450
|
const order = new BN('08000000 00000010 ffffffff ffffffff b781126d cae7b232 1e66a241 adc64d2f', 16);
|
|
11419
|
-
const starkEc = new ec
|
|
11451
|
+
const starkEc = new ec(new curves.PresetCurve({
|
|
11420
11452
|
type: 'short',
|
|
11421
11453
|
prime: null,
|
|
11422
11454
|
p: prime,
|
|
@@ -11489,7 +11521,7 @@ function grindKey$1(privateKey) {
|
|
|
11489
11521
|
return key.mod(ORDER).toString('hex');
|
|
11490
11522
|
}
|
|
11491
11523
|
function getPrivateKeyFromPath$1(seed, path) {
|
|
11492
|
-
return hdkey
|
|
11524
|
+
return hdkey
|
|
11493
11525
|
.fromMasterSeed(Buffer.from(seed.slice(2), 'hex')) // assuming seed is '0x...'
|
|
11494
11526
|
.derivePath(path)
|
|
11495
11527
|
.getWallet()
|
|
@@ -11580,8 +11612,6 @@ async function getStarkPublicKeyFromImx(ethAddress) {
|
|
|
11580
11612
|
return undefined;
|
|
11581
11613
|
}
|
|
11582
11614
|
|
|
11583
|
-
const { ec, curves } = elliptic;
|
|
11584
|
-
const { hdkey } = ethereumjsWallet;
|
|
11585
11615
|
/*
|
|
11586
11616
|
Stark-friendly elliptic curve
|
|
11587
11617
|
|
|
@@ -12108,6 +12138,7 @@ class Workflows {
|
|
|
12108
12138
|
|
|
12109
12139
|
class IMXClient {
|
|
12110
12140
|
immutableX;
|
|
12141
|
+
imxConfig;
|
|
12111
12142
|
assetApi;
|
|
12112
12143
|
balanceApi;
|
|
12113
12144
|
collectionApi;
|
|
@@ -12128,8 +12159,8 @@ class IMXClient {
|
|
|
12128
12159
|
withdrawalsApi;
|
|
12129
12160
|
workflows;
|
|
12130
12161
|
constructor(config) {
|
|
12131
|
-
|
|
12132
|
-
this.immutableX = new ImxApiClients(imxConfig.immutableXConfig.apiConfiguration);
|
|
12162
|
+
this.imxConfig = new ImxConfiguration(config);
|
|
12163
|
+
this.immutableX = new ImxApiClients(this.imxConfig.immutableXConfig.apiConfiguration);
|
|
12133
12164
|
this.assetApi = this.immutableX.assetApi;
|
|
12134
12165
|
this.balanceApi = this.immutableX.balanceApi;
|
|
12135
12166
|
this.collectionApi = this.immutableX.collectionApi;
|
|
@@ -12148,7 +12179,7 @@ class IMXClient {
|
|
|
12148
12179
|
this.transfersApi = this.immutableX.transfersApi;
|
|
12149
12180
|
this.usersApi = this.immutableX.usersApi;
|
|
12150
12181
|
this.withdrawalsApi = this.immutableX.withdrawalsApi;
|
|
12151
|
-
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);
|
|
12152
12183
|
}
|
|
12153
12184
|
/**
|
|
12154
12185
|
* Get details of a Deposit with the given ID
|
|
@@ -16361,4 +16392,4 @@ class ProviderConfiguration {
|
|
|
16361
16392
|
}
|
|
16362
16393
|
}
|
|
16363
16394
|
|
|
16364
|
-
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