@imtbl/sdk 0.28.10-alpha.1 → 0.29.0-alpha.1
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/README.md +147 -0
- package/dist/blockchain_data.d.ts +14 -5
- package/dist/blockchain_data.js +4 -4
- package/dist/browser/checkout/sdk.js +2 -2
- package/dist/browser/checkout/widgets.js +51 -51
- package/dist/checkout_sdk.d.ts +462 -216
- package/dist/checkout_sdk.js +6 -24
- package/dist/config.d.ts +18 -6
- package/dist/config.js +21 -20
- package/dist/immutablex_client.d.ts +14 -5
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +10 -10
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +174 -122
- package/dist/index.d.ts +471 -216
- package/dist/index.js +174 -122
- package/dist/orderbook.d.ts +14 -5
- package/dist/passport.d.ts +14 -5
- package/dist/passport.js +146 -98
- package/dist/provider.d.ts +14 -5
- package/package.json +1 -1
package/dist/checkout_sdk.js
CHANGED
|
@@ -20,27 +20,9 @@ class ImmutableConfiguration {
|
|
|
20
20
|
environment;
|
|
21
21
|
rateLimitingKey;
|
|
22
22
|
apiKey;
|
|
23
|
-
|
|
23
|
+
publishableKey;
|
|
24
24
|
constructor(options) {
|
|
25
25
|
this.environment = options.environment;
|
|
26
|
-
if (options.rateLimitingKey) {
|
|
27
|
-
this.rateLimitingKey = options.rateLimitingKey;
|
|
28
|
-
globalAxios.defaults.headers.common['x-api-key'] = this.rateLimitingKey;
|
|
29
|
-
}
|
|
30
|
-
if (options.apiKey) {
|
|
31
|
-
if (!options.apiKey.startsWith('sk_imapik-')) {
|
|
32
|
-
throw new Error('Invalid API key');
|
|
33
|
-
}
|
|
34
|
-
this.apiKey = options.apiKey;
|
|
35
|
-
globalAxios.defaults.headers.common['x-immutable-api-key'] = this.apiKey;
|
|
36
|
-
}
|
|
37
|
-
if (options.clientAppId) {
|
|
38
|
-
if (!options.clientAppId.startsWith('cai_imapik-')) {
|
|
39
|
-
throw new Error('Invalid Client App Id');
|
|
40
|
-
}
|
|
41
|
-
this.clientAppId = options.clientAppId;
|
|
42
|
-
globalAxios.defaults.headers.common['x-immutable-client-app-id'] = this.clientAppId;
|
|
43
|
-
}
|
|
44
26
|
}
|
|
45
27
|
}
|
|
46
28
|
|
|
@@ -18111,7 +18093,7 @@ const CollectionsApiAxiosParamCreator = function (configuration) {
|
|
|
18111
18093
|
const localVarHeaderParameter = {};
|
|
18112
18094
|
const localVarQueryParameter = {};
|
|
18113
18095
|
// authentication ImmutableApiKey required
|
|
18114
|
-
await setApiKeyToObject(localVarHeaderParameter, "x-immutable-api-
|
|
18096
|
+
await setApiKeyToObject(localVarHeaderParameter, "x-immutable-api-key", configuration);
|
|
18115
18097
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
18116
18098
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
18117
18099
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -18421,7 +18403,7 @@ const MetadataApiAxiosParamCreator = function (configuration) {
|
|
|
18421
18403
|
const localVarHeaderParameter = {};
|
|
18422
18404
|
const localVarQueryParameter = {};
|
|
18423
18405
|
// authentication ImmutableApiKey required
|
|
18424
|
-
await setApiKeyToObject(localVarHeaderParameter, "x-immutable-api-
|
|
18406
|
+
await setApiKeyToObject(localVarHeaderParameter, "x-immutable-api-key", configuration);
|
|
18425
18407
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
18426
18408
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
18427
18409
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -18461,7 +18443,7 @@ const MetadataApiAxiosParamCreator = function (configuration) {
|
|
|
18461
18443
|
const localVarHeaderParameter = {};
|
|
18462
18444
|
const localVarQueryParameter = {};
|
|
18463
18445
|
// authentication ImmutableApiKey required
|
|
18464
|
-
await setApiKeyToObject(localVarHeaderParameter, "x-immutable-api-
|
|
18446
|
+
await setApiKeyToObject(localVarHeaderParameter, "x-immutable-api-key", configuration);
|
|
18465
18447
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
18466
18448
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
18467
18449
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -20790,7 +20772,7 @@ class APIError extends Error {
|
|
|
20790
20772
|
|
|
20791
20773
|
/* eslint-disable implicit-arrow-linebreak */
|
|
20792
20774
|
const defaultHeaders = {
|
|
20793
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
20775
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.29.0-alpha.1',
|
|
20794
20776
|
};
|
|
20795
20777
|
/**
|
|
20796
20778
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -25507,7 +25489,7 @@ async function getItemRequirementsFromRequirements(provider, requirements) {
|
|
|
25507
25489
|
return itemRequirements;
|
|
25508
25490
|
}
|
|
25509
25491
|
|
|
25510
|
-
const SDK_VERSION_MARKER = '0.
|
|
25492
|
+
const SDK_VERSION_MARKER = '0.29.0-alpha.1';
|
|
25511
25493
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
25512
25494
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
25513
25495
|
|
package/dist/config.d.ts
CHANGED
|
@@ -6,17 +6,29 @@ declare class ImmutableConfiguration {
|
|
|
6
6
|
readonly environment: Environment;
|
|
7
7
|
readonly rateLimitingKey?: string;
|
|
8
8
|
readonly apiKey?: string;
|
|
9
|
-
readonly
|
|
9
|
+
readonly publishableKey?: string;
|
|
10
10
|
constructor(options: {
|
|
11
11
|
environment: Environment;
|
|
12
|
-
rateLimitingKey?: string;
|
|
13
|
-
apiKey?: string;
|
|
14
|
-
clientAppId?: string;
|
|
15
12
|
});
|
|
16
13
|
}
|
|
14
|
+
declare const addApiKeyToAxiosHeader: (apiKey: string) => void;
|
|
15
|
+
declare const addPublishableKeyToAxiosHeader: (publishableKey: string) => void;
|
|
16
|
+
declare const addRateLimitingKeyToAxiosHeader: (rateLimitingKey: string) => void;
|
|
17
|
+
type ImmutableConfigurationWithRequireableFields<T> = ImmutableConfiguration & (T extends {
|
|
18
|
+
apiKey: 'required';
|
|
19
|
+
} ? Required<{
|
|
20
|
+
apiKey: string;
|
|
21
|
+
}> : {}) & (T extends {
|
|
22
|
+
publishableKey: 'required';
|
|
23
|
+
} ? Required<{
|
|
24
|
+
publishableKey: string;
|
|
25
|
+
}> : {});
|
|
26
|
+
type ImmutableConfigurationWithOmitableFields<T> = (T extends {
|
|
27
|
+
apiKey: 'omit';
|
|
28
|
+
} ? Omit<ImmutableConfigurationWithRequireableFields<T>, 'apiKey'> : ImmutableConfigurationWithRequireableFields<T>);
|
|
17
29
|
interface ModuleConfiguration<T> {
|
|
18
|
-
baseConfig:
|
|
30
|
+
baseConfig: ImmutableConfigurationWithOmitableFields<T>;
|
|
19
31
|
overrides?: T;
|
|
20
32
|
}
|
|
21
33
|
|
|
22
|
-
export { Environment, ImmutableConfiguration, ModuleConfiguration };
|
|
34
|
+
export { Environment, ImmutableConfiguration, ModuleConfiguration, addApiKeyToAxiosHeader, addPublishableKeyToAxiosHeader, addRateLimitingKeyToAxiosHeader };
|
package/dist/config.js
CHANGED
|
@@ -9,28 +9,29 @@ class ImmutableConfiguration {
|
|
|
9
9
|
environment;
|
|
10
10
|
rateLimitingKey;
|
|
11
11
|
apiKey;
|
|
12
|
-
|
|
12
|
+
publishableKey;
|
|
13
13
|
constructor(options) {
|
|
14
14
|
this.environment = options.environment;
|
|
15
|
-
if (options.rateLimitingKey) {
|
|
16
|
-
this.rateLimitingKey = options.rateLimitingKey;
|
|
17
|
-
axios.defaults.headers.common['x-api-key'] = this.rateLimitingKey;
|
|
18
|
-
}
|
|
19
|
-
if (options.apiKey) {
|
|
20
|
-
if (!options.apiKey.startsWith('sk_imapik-')) {
|
|
21
|
-
throw new Error('Invalid API key');
|
|
22
|
-
}
|
|
23
|
-
this.apiKey = options.apiKey;
|
|
24
|
-
axios.defaults.headers.common['x-immutable-api-key'] = this.apiKey;
|
|
25
|
-
}
|
|
26
|
-
if (options.clientAppId) {
|
|
27
|
-
if (!options.clientAppId.startsWith('cai_imapik-')) {
|
|
28
|
-
throw new Error('Invalid Client App Id');
|
|
29
|
-
}
|
|
30
|
-
this.clientAppId = options.clientAppId;
|
|
31
|
-
axios.defaults.headers.common['x-immutable-client-app-id'] = this.clientAppId;
|
|
32
|
-
}
|
|
33
15
|
}
|
|
34
16
|
}
|
|
17
|
+
const API_KEY_PREFIX = 'sk_imapik-';
|
|
18
|
+
const PUBLISHABLE_KEY_PREFIX = 'pk_imapik-';
|
|
19
|
+
const PUBLISHABLE_KEY_LENGTH = 30;
|
|
20
|
+
const addApiKeyToAxiosHeader = (apiKey) => {
|
|
21
|
+
if (!apiKey.startsWith(API_KEY_PREFIX)) {
|
|
22
|
+
throw new Error('Invalid API key. Create your api key in Immutable developer hub. https://hub.immutable.com');
|
|
23
|
+
}
|
|
24
|
+
axios.defaults.headers.common['x-immutable-api-key'] = apiKey;
|
|
25
|
+
};
|
|
26
|
+
const addPublishableKeyToAxiosHeader = (publishableKey) => {
|
|
27
|
+
if (!publishableKey.startsWith(PUBLISHABLE_KEY_PREFIX) || publishableKey.length !== PUBLISHABLE_KEY_LENGTH) {
|
|
28
|
+
throw new Error('Invalid Publishable key. Create your Publishable key in Immutable developer hub.'
|
|
29
|
+
+ ' https://hub.immutable.com');
|
|
30
|
+
}
|
|
31
|
+
axios.defaults.headers.common['x-immutable-publishable-key'] = publishableKey;
|
|
32
|
+
};
|
|
33
|
+
const addRateLimitingKeyToAxiosHeader = (rateLimitingKey) => {
|
|
34
|
+
axios.defaults.headers.common['x-api-key'] = rateLimitingKey;
|
|
35
|
+
};
|
|
35
36
|
|
|
36
|
-
export { Environment, ImmutableConfiguration };
|
|
37
|
+
export { Environment, ImmutableConfiguration, addApiKeyToAxiosHeader, addPublishableKeyToAxiosHeader, addRateLimitingKeyToAxiosHeader };
|
|
@@ -9742,16 +9742,25 @@ declare class ImmutableConfiguration {
|
|
|
9742
9742
|
readonly environment: Environment;
|
|
9743
9743
|
readonly rateLimitingKey?: string;
|
|
9744
9744
|
readonly apiKey?: string;
|
|
9745
|
-
readonly
|
|
9745
|
+
readonly publishableKey?: string;
|
|
9746
9746
|
constructor(options: {
|
|
9747
9747
|
environment: Environment;
|
|
9748
|
-
rateLimitingKey?: string;
|
|
9749
|
-
apiKey?: string;
|
|
9750
|
-
clientAppId?: string;
|
|
9751
9748
|
});
|
|
9752
9749
|
}
|
|
9750
|
+
type ImmutableConfigurationWithRequireableFields<T> = ImmutableConfiguration & (T extends {
|
|
9751
|
+
apiKey: 'required';
|
|
9752
|
+
} ? Required<{
|
|
9753
|
+
apiKey: string;
|
|
9754
|
+
}> : {}) & (T extends {
|
|
9755
|
+
publishableKey: 'required';
|
|
9756
|
+
} ? Required<{
|
|
9757
|
+
publishableKey: string;
|
|
9758
|
+
}> : {});
|
|
9759
|
+
type ImmutableConfigurationWithOmitableFields<T> = (T extends {
|
|
9760
|
+
apiKey: 'omit';
|
|
9761
|
+
} ? Omit<ImmutableConfigurationWithRequireableFields<T>, 'apiKey'> : ImmutableConfigurationWithRequireableFields<T>);
|
|
9753
9762
|
interface ModuleConfiguration<T> {
|
|
9754
|
-
baseConfig:
|
|
9763
|
+
baseConfig: ImmutableConfigurationWithOmitableFields<T>;
|
|
9755
9764
|
overrides?: T;
|
|
9756
9765
|
}
|
|
9757
9766
|
|
|
@@ -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.29.0-alpha.1',
|
|
21
21
|
});
|
|
22
22
|
/**
|
|
23
23
|
* Sets `sdkVersion` at the time of build
|