@imtbl/sdk 0.27.1 → 0.27.3
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.js +2 -2
- package/dist/checkout_sdk.d.ts +10 -1
- package/dist/checkout_sdk.js +40 -3
- package/dist/checkout_widgets.js +1 -1
- 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 +47 -11
- package/dist/index.d.ts +10 -1
- package/dist/index.js +47 -11
- package/dist/passport.js +2 -2
- package/dist/provider.js +4 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3674,7 +3674,7 @@ class MultiRollupApiClients {
|
|
|
3674
3674
|
}
|
|
3675
3675
|
|
|
3676
3676
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3677
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.27.
|
|
3677
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.27.3' };
|
|
3678
3678
|
const createConfig = ({ basePath, headers, }) => {
|
|
3679
3679
|
if (!basePath.trim()) {
|
|
3680
3680
|
throw Error('basePath can not be empty');
|
|
@@ -3734,7 +3734,7 @@ class APIError extends Error {
|
|
|
3734
3734
|
|
|
3735
3735
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3736
3736
|
const defaultHeaders = {
|
|
3737
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.
|
|
3737
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.3',
|
|
3738
3738
|
};
|
|
3739
3739
|
/**
|
|
3740
3740
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4138,7 +4138,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4138
4138
|
chainID,
|
|
4139
4139
|
coreContractAddress,
|
|
4140
4140
|
registrationContractAddress,
|
|
4141
|
-
sdkVersion: 'ts-immutable-sdk-0.27.
|
|
4141
|
+
sdkVersion: 'ts-immutable-sdk-0.27.3',
|
|
4142
4142
|
});
|
|
4143
4143
|
/**
|
|
4144
4144
|
* Sets `sdkVersion` at the time of build
|
|
@@ -12430,7 +12430,6 @@ async function createOrder({ signers, request, config, }) {
|
|
|
12430
12430
|
asset_id_buy: resp.asset_id_buy,
|
|
12431
12431
|
asset_id_sell: resp.asset_id_sell,
|
|
12432
12432
|
expiration_timestamp: resp.expiration_timestamp,
|
|
12433
|
-
include_fees: true,
|
|
12434
12433
|
fees: request.fees,
|
|
12435
12434
|
nonce: resp.nonce,
|
|
12436
12435
|
stark_key: resp.stark_key,
|
|
@@ -12441,14 +12440,14 @@ async function createOrder({ signers, request, config, }) {
|
|
|
12441
12440
|
xImxEthAddress: ethAddress,
|
|
12442
12441
|
xImxEthSignature: ethSignature,
|
|
12443
12442
|
};
|
|
12444
|
-
const createOrderResponse = await ordersApi.
|
|
12443
|
+
const createOrderResponse = await ordersApi.createOrderV3(orderParams);
|
|
12445
12444
|
return {
|
|
12446
12445
|
...createOrderResponse.data,
|
|
12447
12446
|
};
|
|
12448
12447
|
}
|
|
12449
12448
|
async function cancelOrder({ signers, request, config, }) {
|
|
12450
12449
|
const ordersApi = new coreSdk.OrdersApi(config.immutableXConfig.apiConfiguration);
|
|
12451
|
-
const getSignableCancelOrderResponse = await ordersApi.
|
|
12450
|
+
const getSignableCancelOrderResponse = await ordersApi.getSignableCancelOrderV3({
|
|
12452
12451
|
getSignableCancelOrderRequest: {
|
|
12453
12452
|
order_id: request.order_id,
|
|
12454
12453
|
},
|
|
@@ -12457,7 +12456,7 @@ async function cancelOrder({ signers, request, config, }) {
|
|
|
12457
12456
|
const ethSignature = await signRaw(signableMessage, signers.ethSigner);
|
|
12458
12457
|
const starkSignature = await signers.starkSigner.signMessage(payloadHash);
|
|
12459
12458
|
const ethAddress = await signers.ethSigner.getAddress();
|
|
12460
|
-
const cancelOrderResponse = await ordersApi.
|
|
12459
|
+
const cancelOrderResponse = await ordersApi.cancelOrderV3({
|
|
12461
12460
|
id: request.order_id.toString(),
|
|
12462
12461
|
cancelOrderRequest: {
|
|
12463
12462
|
order_id: request.order_id,
|
|
@@ -12758,7 +12757,7 @@ async function createTrade({ signers: { ethSigner, starkSigner }, request, confi
|
|
|
12758
12757
|
const { signable_message: signableMessage, payload_hash: payloadHash } = signableResult.data;
|
|
12759
12758
|
const ethSignature = await signRaw(signableMessage, ethSigner);
|
|
12760
12759
|
const starkSignature = await starkSigner.signMessage(payloadHash);
|
|
12761
|
-
const createTradeResponse = await tradesApi.
|
|
12760
|
+
const createTradeResponse = await tradesApi.createTradeV3({
|
|
12762
12761
|
createTradeRequest: {
|
|
12763
12762
|
amount_buy: signableResult.data.amount_buy,
|
|
12764
12763
|
amount_sell: signableResult.data.amount_sell,
|
|
@@ -29059,11 +29058,11 @@ const $d85ad1457a3f1a83$var$ZKEVM_NATIVE_TOKEN = {
|
|
|
29059
29058
|
decimals: $d85ad1457a3f1a83$export$903389470ba9433c,
|
|
29060
29059
|
address: $d85ad1457a3f1a83$export$b80040cb173ba6e9
|
|
29061
29060
|
};
|
|
29062
|
-
|
|
29061
|
+
const $d85ad1457a3f1a83$export$89133ca13c5ee30 = {
|
|
29063
29062
|
[$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://api.dev.immutable.com",
|
|
29064
29063
|
[(Environment$1).SANDBOX]: "https://api.sandbox.immutable.com",
|
|
29065
29064
|
[(Environment$1).PRODUCTION]: "https://api.immutable.com"
|
|
29066
|
-
}
|
|
29065
|
+
};
|
|
29067
29066
|
const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
|
|
29068
29067
|
[$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://checkout-api.dev.immutable.com",
|
|
29069
29068
|
[(Environment$1).SANDBOX]: "https://checkout-api.sandbox.immutable.com",
|
|
@@ -32791,6 +32790,35 @@ async function $d35036efee31c5d1$export$dc8635800ef20f4b(provider, requirements)
|
|
|
32791
32790
|
|
|
32792
32791
|
|
|
32793
32792
|
|
|
32793
|
+
|
|
32794
|
+
|
|
32795
|
+
|
|
32796
|
+
|
|
32797
|
+
const $5e9bcae98dc8ff19$export$1165ca270f090a66 = (isDevelopment, isProduction)=>{
|
|
32798
|
+
const postEndpoint = ()=>{
|
|
32799
|
+
if (isDevelopment) return ($d85ad1457a3f1a83$export$89133ca13c5ee30)[$d85ad1457a3f1a83$export$7d3a9eeba384fa59];
|
|
32800
|
+
if (isProduction) return ($d85ad1457a3f1a83$export$89133ca13c5ee30)[(Environment$1).PRODUCTION];
|
|
32801
|
+
return ($d85ad1457a3f1a83$export$89133ca13c5ee30)[(Environment$1).SANDBOX];
|
|
32802
|
+
};
|
|
32803
|
+
const checkDexAvailability = async ()=>{
|
|
32804
|
+
let response;
|
|
32805
|
+
try {
|
|
32806
|
+
response = await (0, globalAxios$1).post(`${postEndpoint()}/v1/availability/checkout/swap`);
|
|
32807
|
+
} catch (error) {
|
|
32808
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${error.message}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
|
|
32809
|
+
}
|
|
32810
|
+
if (response.status === 403) return false;
|
|
32811
|
+
if (response.status === 204) return true;
|
|
32812
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${response.status} ${response.statusText}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
|
|
32813
|
+
};
|
|
32814
|
+
return {
|
|
32815
|
+
checkDexAvailability: checkDexAvailability
|
|
32816
|
+
};
|
|
32817
|
+
};
|
|
32818
|
+
|
|
32819
|
+
|
|
32820
|
+
|
|
32821
|
+
|
|
32794
32822
|
const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
|
|
32795
32823
|
baseConfig: {
|
|
32796
32824
|
environment: (Environment$1).SANDBOX
|
|
@@ -32800,6 +32828,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
32800
32828
|
config;
|
|
32801
32829
|
fiatRampService;
|
|
32802
32830
|
readOnlyProviders;
|
|
32831
|
+
availability;
|
|
32803
32832
|
/**
|
|
32804
32833
|
* Constructs a new instance of the CheckoutModule class.
|
|
32805
32834
|
* @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
|
|
@@ -32807,6 +32836,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
32807
32836
|
this.config = new ($4013c5c91bb535f6$export$4823433c4a67bbc6)(config);
|
|
32808
32837
|
this.fiatRampService = new ($a77d203f701a3b72$export$1453e9b801542ef4)(this.config);
|
|
32809
32838
|
this.readOnlyProviders = new Map();
|
|
32839
|
+
this.availability = ($5e9bcae98dc8ff19$export$1165ca270f090a66)(this.config.isDevelopment, this.config.isProduction);
|
|
32810
32840
|
}
|
|
32811
32841
|
/**
|
|
32812
32842
|
* Creates a provider using the given parameters.
|
|
@@ -33016,6 +33046,12 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
33016
33046
|
*/ async getExchangeFeeEstimate() {
|
|
33017
33047
|
return await this.fiatRampService.feeEstimate();
|
|
33018
33048
|
}
|
|
33049
|
+
/**
|
|
33050
|
+
* Fetches Swap widget availability.
|
|
33051
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean.
|
|
33052
|
+
*/ async isSwapAvailable() {
|
|
33053
|
+
return this.availability.checkDexAvailability();
|
|
33054
|
+
}
|
|
33019
33055
|
}
|
|
33020
33056
|
|
|
33021
33057
|
var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
@@ -33063,7 +33099,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
33063
33099
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
33064
33100
|
|
|
33065
33101
|
|
|
33066
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.
|
|
33102
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.3";
|
|
33067
33103
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
33068
33104
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
33069
33105
|
|
package/dist/index.d.ts
CHANGED
|
@@ -15299,7 +15299,7 @@ type BuyResultSuccess = {
|
|
|
15299
15299
|
* @property {CheckoutStatus.FAILED} status - The status to indicate failure
|
|
15300
15300
|
* @property {string} transactionHash - The transaction hash of the failed transaction
|
|
15301
15301
|
* @property {string} reason - The reason for the failure
|
|
15302
|
-
* @property {SmartCheckoutSufficient
|
|
15302
|
+
* @property {SmartCheckoutSufficient} smartCheckoutResult - The sufficient result of smart checkout
|
|
15303
15303
|
*/
|
|
15304
15304
|
type BuyResultFailed = {
|
|
15305
15305
|
status: CheckoutStatus.FAILED;
|
|
@@ -16384,9 +16384,13 @@ declare class FiatRampService {
|
|
|
16384
16384
|
feeEstimate(): Promise<OnRampProviderFees>;
|
|
16385
16385
|
createWidgetUrl(params: FiatRampWidgetParams): Promise<string>;
|
|
16386
16386
|
}
|
|
16387
|
+
type AvailabilityService = {
|
|
16388
|
+
checkDexAvailability: () => Promise<boolean>;
|
|
16389
|
+
};
|
|
16387
16390
|
declare class Checkout {
|
|
16388
16391
|
readonly config: CheckoutConfiguration;
|
|
16389
16392
|
readonly fiatRampService: FiatRampService;
|
|
16393
|
+
readonly availability: AvailabilityService;
|
|
16390
16394
|
/**
|
|
16391
16395
|
* Constructs a new instance of the CheckoutModule class.
|
|
16392
16396
|
* @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
|
|
@@ -16504,6 +16508,11 @@ declare class Checkout {
|
|
|
16504
16508
|
* @returns {Promise<OnRampProviderFees>} - A promise that resolves to OnRampProviderFees.
|
|
16505
16509
|
*/
|
|
16506
16510
|
getExchangeFeeEstimate(): Promise<OnRampProviderFees>;
|
|
16511
|
+
/**
|
|
16512
|
+
* Fetches Swap widget availability.
|
|
16513
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean.
|
|
16514
|
+
*/
|
|
16515
|
+
isSwapAvailable(): Promise<boolean>;
|
|
16507
16516
|
}
|
|
16508
16517
|
|
|
16509
16518
|
type checkout_sdk_d_AllowedNetworkConfig = AllowedNetworkConfig;
|
package/dist/index.js
CHANGED
|
@@ -3652,7 +3652,7 @@ class MultiRollupApiClients {
|
|
|
3652
3652
|
}
|
|
3653
3653
|
|
|
3654
3654
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3655
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.27.
|
|
3655
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.27.3' };
|
|
3656
3656
|
const createConfig = ({ basePath, headers, }) => {
|
|
3657
3657
|
if (!basePath.trim()) {
|
|
3658
3658
|
throw Error('basePath can not be empty');
|
|
@@ -3712,7 +3712,7 @@ class APIError extends Error {
|
|
|
3712
3712
|
|
|
3713
3713
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3714
3714
|
const defaultHeaders = {
|
|
3715
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.
|
|
3715
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.27.3',
|
|
3716
3716
|
};
|
|
3717
3717
|
/**
|
|
3718
3718
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -4116,7 +4116,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4116
4116
|
chainID,
|
|
4117
4117
|
coreContractAddress,
|
|
4118
4118
|
registrationContractAddress,
|
|
4119
|
-
sdkVersion: 'ts-immutable-sdk-0.27.
|
|
4119
|
+
sdkVersion: 'ts-immutable-sdk-0.27.3',
|
|
4120
4120
|
});
|
|
4121
4121
|
/**
|
|
4122
4122
|
* Sets `sdkVersion` at the time of build
|
|
@@ -12408,7 +12408,6 @@ async function createOrder({ signers, request, config, }) {
|
|
|
12408
12408
|
asset_id_buy: resp.asset_id_buy,
|
|
12409
12409
|
asset_id_sell: resp.asset_id_sell,
|
|
12410
12410
|
expiration_timestamp: resp.expiration_timestamp,
|
|
12411
|
-
include_fees: true,
|
|
12412
12411
|
fees: request.fees,
|
|
12413
12412
|
nonce: resp.nonce,
|
|
12414
12413
|
stark_key: resp.stark_key,
|
|
@@ -12419,14 +12418,14 @@ async function createOrder({ signers, request, config, }) {
|
|
|
12419
12418
|
xImxEthAddress: ethAddress,
|
|
12420
12419
|
xImxEthSignature: ethSignature,
|
|
12421
12420
|
};
|
|
12422
|
-
const createOrderResponse = await ordersApi.
|
|
12421
|
+
const createOrderResponse = await ordersApi.createOrderV3(orderParams);
|
|
12423
12422
|
return {
|
|
12424
12423
|
...createOrderResponse.data,
|
|
12425
12424
|
};
|
|
12426
12425
|
}
|
|
12427
12426
|
async function cancelOrder({ signers, request, config, }) {
|
|
12428
12427
|
const ordersApi = new OrdersApi$1(config.immutableXConfig.apiConfiguration);
|
|
12429
|
-
const getSignableCancelOrderResponse = await ordersApi.
|
|
12428
|
+
const getSignableCancelOrderResponse = await ordersApi.getSignableCancelOrderV3({
|
|
12430
12429
|
getSignableCancelOrderRequest: {
|
|
12431
12430
|
order_id: request.order_id,
|
|
12432
12431
|
},
|
|
@@ -12435,7 +12434,7 @@ async function cancelOrder({ signers, request, config, }) {
|
|
|
12435
12434
|
const ethSignature = await signRaw(signableMessage, signers.ethSigner);
|
|
12436
12435
|
const starkSignature = await signers.starkSigner.signMessage(payloadHash);
|
|
12437
12436
|
const ethAddress = await signers.ethSigner.getAddress();
|
|
12438
|
-
const cancelOrderResponse = await ordersApi.
|
|
12437
|
+
const cancelOrderResponse = await ordersApi.cancelOrderV3({
|
|
12439
12438
|
id: request.order_id.toString(),
|
|
12440
12439
|
cancelOrderRequest: {
|
|
12441
12440
|
order_id: request.order_id,
|
|
@@ -12736,7 +12735,7 @@ async function createTrade({ signers: { ethSigner, starkSigner }, request, confi
|
|
|
12736
12735
|
const { signable_message: signableMessage, payload_hash: payloadHash } = signableResult.data;
|
|
12737
12736
|
const ethSignature = await signRaw(signableMessage, ethSigner);
|
|
12738
12737
|
const starkSignature = await starkSigner.signMessage(payloadHash);
|
|
12739
|
-
const createTradeResponse = await tradesApi.
|
|
12738
|
+
const createTradeResponse = await tradesApi.createTradeV3({
|
|
12740
12739
|
createTradeRequest: {
|
|
12741
12740
|
amount_buy: signableResult.data.amount_buy,
|
|
12742
12741
|
amount_sell: signableResult.data.amount_sell,
|
|
@@ -29037,11 +29036,11 @@ const $d85ad1457a3f1a83$var$ZKEVM_NATIVE_TOKEN = {
|
|
|
29037
29036
|
decimals: $d85ad1457a3f1a83$export$903389470ba9433c,
|
|
29038
29037
|
address: $d85ad1457a3f1a83$export$b80040cb173ba6e9
|
|
29039
29038
|
};
|
|
29040
|
-
|
|
29039
|
+
const $d85ad1457a3f1a83$export$89133ca13c5ee30 = {
|
|
29041
29040
|
[$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://api.dev.immutable.com",
|
|
29042
29041
|
[(Environment$1).SANDBOX]: "https://api.sandbox.immutable.com",
|
|
29043
29042
|
[(Environment$1).PRODUCTION]: "https://api.immutable.com"
|
|
29044
|
-
}
|
|
29043
|
+
};
|
|
29045
29044
|
const $d85ad1457a3f1a83$export$161d4a74df65fc08 = {
|
|
29046
29045
|
[$d85ad1457a3f1a83$export$7d3a9eeba384fa59]: "https://checkout-api.dev.immutable.com",
|
|
29047
29046
|
[(Environment$1).SANDBOX]: "https://checkout-api.sandbox.immutable.com",
|
|
@@ -32769,6 +32768,35 @@ async function $d35036efee31c5d1$export$dc8635800ef20f4b(provider, requirements)
|
|
|
32769
32768
|
|
|
32770
32769
|
|
|
32771
32770
|
|
|
32771
|
+
|
|
32772
|
+
|
|
32773
|
+
|
|
32774
|
+
|
|
32775
|
+
const $5e9bcae98dc8ff19$export$1165ca270f090a66 = (isDevelopment, isProduction)=>{
|
|
32776
|
+
const postEndpoint = ()=>{
|
|
32777
|
+
if (isDevelopment) return ($d85ad1457a3f1a83$export$89133ca13c5ee30)[$d85ad1457a3f1a83$export$7d3a9eeba384fa59];
|
|
32778
|
+
if (isProduction) return ($d85ad1457a3f1a83$export$89133ca13c5ee30)[(Environment$1).PRODUCTION];
|
|
32779
|
+
return ($d85ad1457a3f1a83$export$89133ca13c5ee30)[(Environment$1).SANDBOX];
|
|
32780
|
+
};
|
|
32781
|
+
const checkDexAvailability = async ()=>{
|
|
32782
|
+
let response;
|
|
32783
|
+
try {
|
|
32784
|
+
response = await (0, globalAxios$1).post(`${postEndpoint()}/v1/availability/checkout/swap`);
|
|
32785
|
+
} catch (error) {
|
|
32786
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${error.message}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
|
|
32787
|
+
}
|
|
32788
|
+
if (response.status === 403) return false;
|
|
32789
|
+
if (response.status === 204) return true;
|
|
32790
|
+
throw new ($a8bc256d81a5e2c1$export$b722478a3cbfa3bc)(`Error fetching from api: ${response.status} ${response.statusText}`, ($a8bc256d81a5e2c1$export$e3dc0620abde7f5a).API_ERROR);
|
|
32791
|
+
};
|
|
32792
|
+
return {
|
|
32793
|
+
checkDexAvailability: checkDexAvailability
|
|
32794
|
+
};
|
|
32795
|
+
};
|
|
32796
|
+
|
|
32797
|
+
|
|
32798
|
+
|
|
32799
|
+
|
|
32772
32800
|
const $a8cb37a3fc8eb863$var$SANDBOX_CONFIGURATION = {
|
|
32773
32801
|
baseConfig: {
|
|
32774
32802
|
environment: (Environment$1).SANDBOX
|
|
@@ -32778,6 +32806,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
32778
32806
|
config;
|
|
32779
32807
|
fiatRampService;
|
|
32780
32808
|
readOnlyProviders;
|
|
32809
|
+
availability;
|
|
32781
32810
|
/**
|
|
32782
32811
|
* Constructs a new instance of the CheckoutModule class.
|
|
32783
32812
|
* @param {CheckoutModuleConfiguration} [config=SANDBOX_CONFIGURATION] - The configuration object for the CheckoutModule.
|
|
@@ -32785,6 +32814,7 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
32785
32814
|
this.config = new ($4013c5c91bb535f6$export$4823433c4a67bbc6)(config);
|
|
32786
32815
|
this.fiatRampService = new ($a77d203f701a3b72$export$1453e9b801542ef4)(this.config);
|
|
32787
32816
|
this.readOnlyProviders = new Map();
|
|
32817
|
+
this.availability = ($5e9bcae98dc8ff19$export$1165ca270f090a66)(this.config.isDevelopment, this.config.isProduction);
|
|
32788
32818
|
}
|
|
32789
32819
|
/**
|
|
32790
32820
|
* Creates a provider using the given parameters.
|
|
@@ -32994,6 +33024,12 @@ class $a8cb37a3fc8eb863$export$1f60ba4ec72508a0 {
|
|
|
32994
33024
|
*/ async getExchangeFeeEstimate() {
|
|
32995
33025
|
return await this.fiatRampService.feeEstimate();
|
|
32996
33026
|
}
|
|
33027
|
+
/**
|
|
33028
|
+
* Fetches Swap widget availability.
|
|
33029
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean.
|
|
33030
|
+
*/ async isSwapAvailable() {
|
|
33031
|
+
return this.availability.checkDexAvailability();
|
|
33032
|
+
}
|
|
32997
33033
|
}
|
|
32998
33034
|
|
|
32999
33035
|
var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
@@ -33041,7 +33077,7 @@ var $045213b18e9f1f94$export$75be0f6af9650f2c;
|
|
|
33041
33077
|
})($045213b18e9f1f94$export$75be0f6af9650f2c || ($045213b18e9f1f94$export$75be0f6af9650f2c = {}));
|
|
33042
33078
|
|
|
33043
33079
|
|
|
33044
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.
|
|
33080
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.27.3";
|
|
33045
33081
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
33046
33082
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
33047
33083
|
|
package/dist/passport.js
CHANGED
|
@@ -2072,7 +2072,7 @@ class MultiRollupApiClients {
|
|
|
2072
2072
|
}
|
|
2073
2073
|
|
|
2074
2074
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2075
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.27.
|
|
2075
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.27.3' };
|
|
2076
2076
|
const createConfig = ({ basePath, headers, }) => {
|
|
2077
2077
|
if (!basePath.trim()) {
|
|
2078
2078
|
throw Error('basePath can not be empty');
|
|
@@ -2128,7 +2128,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
2128
2128
|
chainID,
|
|
2129
2129
|
coreContractAddress,
|
|
2130
2130
|
registrationContractAddress,
|
|
2131
|
-
sdkVersion: 'ts-immutable-sdk-0.27.
|
|
2131
|
+
sdkVersion: 'ts-immutable-sdk-0.27.3',
|
|
2132
2132
|
});
|
|
2133
2133
|
/**
|
|
2134
2134
|
* Sets `sdkVersion` at the time of build
|
package/dist/provider.js
CHANGED
|
@@ -219,7 +219,6 @@ async function createOrder({ signers, request, config, }) {
|
|
|
219
219
|
asset_id_buy: resp.asset_id_buy,
|
|
220
220
|
asset_id_sell: resp.asset_id_sell,
|
|
221
221
|
expiration_timestamp: resp.expiration_timestamp,
|
|
222
|
-
include_fees: true,
|
|
223
222
|
fees: request.fees,
|
|
224
223
|
nonce: resp.nonce,
|
|
225
224
|
stark_key: resp.stark_key,
|
|
@@ -230,14 +229,14 @@ async function createOrder({ signers, request, config, }) {
|
|
|
230
229
|
xImxEthAddress: ethAddress,
|
|
231
230
|
xImxEthSignature: ethSignature,
|
|
232
231
|
};
|
|
233
|
-
const createOrderResponse = await ordersApi.
|
|
232
|
+
const createOrderResponse = await ordersApi.createOrderV3(orderParams);
|
|
234
233
|
return {
|
|
235
234
|
...createOrderResponse.data,
|
|
236
235
|
};
|
|
237
236
|
}
|
|
238
237
|
async function cancelOrder({ signers, request, config, }) {
|
|
239
238
|
const ordersApi = new OrdersApi(config.immutableXConfig.apiConfiguration);
|
|
240
|
-
const getSignableCancelOrderResponse = await ordersApi.
|
|
239
|
+
const getSignableCancelOrderResponse = await ordersApi.getSignableCancelOrderV3({
|
|
241
240
|
getSignableCancelOrderRequest: {
|
|
242
241
|
order_id: request.order_id,
|
|
243
242
|
},
|
|
@@ -246,7 +245,7 @@ async function cancelOrder({ signers, request, config, }) {
|
|
|
246
245
|
const ethSignature = await signRaw(signableMessage, signers.ethSigner);
|
|
247
246
|
const starkSignature = await signers.starkSigner.signMessage(payloadHash);
|
|
248
247
|
const ethAddress = await signers.ethSigner.getAddress();
|
|
249
|
-
const cancelOrderResponse = await ordersApi.
|
|
248
|
+
const cancelOrderResponse = await ordersApi.cancelOrderV3({
|
|
250
249
|
id: request.order_id.toString(),
|
|
251
250
|
cancelOrderRequest: {
|
|
252
251
|
order_id: request.order_id,
|
|
@@ -547,7 +546,7 @@ async function createTrade({ signers: { ethSigner, starkSigner }, request, confi
|
|
|
547
546
|
const { signable_message: signableMessage, payload_hash: payloadHash } = signableResult.data;
|
|
548
547
|
const ethSignature = await signRaw(signableMessage, ethSigner);
|
|
549
548
|
const starkSignature = await starkSigner.signMessage(payloadHash);
|
|
550
|
-
const createTradeResponse = await tradesApi.
|
|
549
|
+
const createTradeResponse = await tradesApi.createTradeV3({
|
|
551
550
|
createTradeRequest: {
|
|
552
551
|
amount_buy: signableResult.data.amount_buy,
|
|
553
552
|
amount_sell: signableResult.data.amount_sell,
|
package/package.json
CHANGED