@imtbl/sdk 1.5.0 → 1.5.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/dist/blockchain_data.js +2 -2
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/browser/checkout/widgets.js +50 -50
- package/dist/checkout.d.ts +45 -5
- package/dist/checkout.js +56 -9
- package/dist/config.js +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +98 -47
- package/dist/index.d.ts +52 -4
- package/dist/index.js +98 -47
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +43 -39
- package/dist/x.js +2 -2
- package/package.json +1 -1
package/dist/checkout.d.ts
CHANGED
|
@@ -21615,7 +21615,7 @@ type SellResultInsufficientFunds = {
|
|
|
21615
21615
|
/** The insufficient result of smart checkout */
|
|
21616
21616
|
smartCheckoutResult: SmartCheckoutInsufficient;
|
|
21617
21617
|
};
|
|
21618
|
-
type CancelResult = CancelResultSuccess | CancelResultFailed | CancelResultFulfillmentsUnsettled;
|
|
21618
|
+
type CancelResult = CancelResultSuccess | CancelResultFailed | CancelResultFulfillmentsUnsettled | CancelResultGasless;
|
|
21619
21619
|
/**
|
|
21620
21620
|
* Represents the result of {@link Checkout.cancel}
|
|
21621
21621
|
* @property {CheckoutStatus.SUCCESS} status
|
|
@@ -21644,18 +21644,58 @@ type CancelResultFailed = {
|
|
|
21644
21644
|
* @property {SendTransactionResult[]} transactions
|
|
21645
21645
|
*/
|
|
21646
21646
|
type CancelResultFulfillmentsUnsettled = {
|
|
21647
|
-
/** The status to indicate
|
|
21647
|
+
/** The status to indicate the fulfillments have not yet settled on chain. */
|
|
21648
21648
|
status: CheckoutStatus.FULFILLMENTS_UNSETTLED;
|
|
21649
21649
|
/** Array of transaction results */
|
|
21650
21650
|
transactions: TransactionResponse[];
|
|
21651
21651
|
};
|
|
21652
|
+
/**
|
|
21653
|
+
* Represents the result of {@link Checkout.cancel} when using gasless cancel
|
|
21654
|
+
* @property {SuccessfulGaslessCancellation[]} successfulCancellations
|
|
21655
|
+
* @property {FailedGaslessCancellation[]} failedCancellations
|
|
21656
|
+
* @property {PendingGaslessCancellation[]} pendingCancellations
|
|
21657
|
+
*/
|
|
21658
|
+
type CancelResultGasless = {
|
|
21659
|
+
successfulCancellations: SuccessfulGaslessCancellation[];
|
|
21660
|
+
failedCancellations: FailedGaslessCancellation[];
|
|
21661
|
+
pendingCancellations: PendingGaslessCancellation[];
|
|
21662
|
+
};
|
|
21663
|
+
/**
|
|
21664
|
+
* Represents a successful gasless cancellation
|
|
21665
|
+
* @property {string} orderId
|
|
21666
|
+
*/
|
|
21667
|
+
type SuccessfulGaslessCancellation = {
|
|
21668
|
+
/** The order id of the successful cancellation */
|
|
21669
|
+
orderId: string;
|
|
21670
|
+
};
|
|
21671
|
+
/**
|
|
21672
|
+
* Represents a failed gasless cancellation
|
|
21673
|
+
* @property {string} orderId
|
|
21674
|
+
* @property {string} reason
|
|
21675
|
+
*/
|
|
21676
|
+
type FailedGaslessCancellation = {
|
|
21677
|
+
/** The order id of the failed cancellation */
|
|
21678
|
+
orderId: string;
|
|
21679
|
+
/** The reason for failure */
|
|
21680
|
+
reason: string;
|
|
21681
|
+
};
|
|
21682
|
+
/**
|
|
21683
|
+
* Represents a pending gasless cancellation
|
|
21684
|
+
* @property {string} orderId
|
|
21685
|
+
*/
|
|
21686
|
+
type PendingGaslessCancellation = {
|
|
21687
|
+
/** The order id of the pending cancellation */
|
|
21688
|
+
orderId: string;
|
|
21689
|
+
};
|
|
21652
21690
|
/**
|
|
21653
21691
|
* Represents the overrides available for {@link Checkout.cancel}
|
|
21654
21692
|
* @property {boolean} waitFulfillmentSettlements
|
|
21655
21693
|
*/
|
|
21656
21694
|
type CancelOverrides = {
|
|
21657
|
-
/** If the
|
|
21695
|
+
/** If the cancel should wait for the fulfillment transactions to settle */
|
|
21658
21696
|
waitFulfillmentSettlements?: boolean;
|
|
21697
|
+
/** If the cancel should use the gasless option */
|
|
21698
|
+
useGaslessCancel?: boolean;
|
|
21659
21699
|
};
|
|
21660
21700
|
/**
|
|
21661
21701
|
* An enum representing the checkout status types
|
|
@@ -21674,7 +21714,7 @@ declare enum CheckoutStatus {
|
|
|
21674
21714
|
/**
|
|
21675
21715
|
* The type representing the order to buy
|
|
21676
21716
|
* @property {string} orderId
|
|
21677
|
-
* @property {
|
|
21717
|
+
* @property {OrderFee[]} takerFees
|
|
21678
21718
|
*/
|
|
21679
21719
|
type BuyOrder = {
|
|
21680
21720
|
/** the id of the order to buy */
|
|
@@ -23991,4 +24031,4 @@ declare class BlockExplorerService {
|
|
|
23991
24031
|
static getTransactionLink(chainId: ChainId, hash: string): string | undefined;
|
|
23992
24032
|
}
|
|
23993
24033
|
|
|
23994
|
-
export { AllowedNetworkConfig, AvailableRoutingOptions, BalanceDelta, BlockExplorerService, BridgeClaimWithdrawalFailed, BridgeClaimWithdrawalSuccess, BridgeEventType, BridgeFailed, BridgeFundingStep, BridgeTransactionSent, BridgeWidgetConfiguration, BridgeWidgetParams, BuyOrder, BuyOverrides, BuyParams, BuyResult, BuyResultFailed, BuyResultFulfillmentsUnsettled, BuyResultInsufficientFunds, BuyResultSuccess, BuyToken, CancelOverrides, CancelParams, CancelResult, CancelResultFailed, CancelResultFulfillmentsUnsettled, CancelResultSuccess, ChainId, ChainName, ChainSlug, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutBridgeConfiguration, CheckoutConfiguration, CheckoutErrorType, CheckoutModuleConfiguration, CheckoutOnRampConfiguration, CheckoutStatus, CheckoutSwapConfiguration, CheckoutWidgetsConfig, ConnectEventType, ConnectParams, ConnectResult, ConnectTargetLayer, ConnectWidgetConfiguration, ConnectWidgetParams, ConnectionFailed, ConnectionSuccess, CreateProviderParams, CreateProviderResult, DexConfig, ERC20ItemRequirement, ERC721Balance, ERC721ItemRequirement, ErrorType, ExchangeType, Fee, FeePercentage, FeeToken, FeeType, FiatRampParams, FulfillmentTransaction, FundingItem, FundingRoute, FundingStep, FundingStepType, GasAmount, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasToken, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetTokenInfoParams, GetWalletAllowListParams, GetWalletAllowListResult, IMMUTABLE_API_BASE_URL, IMTBLWidgetEvents, IWidgetsFactory, ItemBalance, ItemType, LanguageChanged, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, NoRouteOptions, NoRoutesFound, OnRampEventType, OnRampFailed, OnRampFundingStep, OnRampProviderFees, OnRampSuccess, OnRampWidgetParams, OnrampWidgetConfiguration, OrchestrationEvent, OrchestrationEventData, OrchestrationEventType, OrderFee, ProviderEvent, ProviderEventType, ProviderUpdated, RemoteConfiguration, RequestBridgeEvent, RequestConnectEvent, RequestOnrampEvent, RequestSwapEvent, RequestWalletEvent, RoutesFound, RoutingOutcome, RoutingOutcomeType, SaleEventType, SaleFailed, SaleItem, SalePaymentMethod, SalePaymentTypes, SaleSuccess, SaleTransactionSuccess, SaleWidgetConfiguration, SaleWidgetParams, SellOrder, SellParams, SellResult, SellResultFailed, SellResultInsufficientFunds, SellResultSuccess, SellToken, SemanticVersion, SendTransactionParams, SendTransactionResult, SmartCheckoutInsufficient, SmartCheckoutParams, SmartCheckoutResult, SmartCheckoutRouter, SmartCheckoutSufficient, SwapEventType, SwapFailed, SwapFundingStep, SwapRejected, SwapSuccess, SwapWidgetConfiguration, SwapWidgetParams, SwitchNetworkParams, SwitchNetworkResult, TokenAmountEstimate, TokenBalance, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, TransactionRequirement, WalletDisconnect, WalletEventType, WalletFilter, WalletFilterTypes, WalletInfo, WalletNetworkSwitch, WalletProviderName, WalletWidgetConfiguration, WalletWidgetParams, Widget, WidgetConfiguration, WidgetConfigurations, WidgetEvent, WidgetEventData, WidgetEventTypes, WidgetLanguage, WidgetParameters, WidgetProperties, WidgetTheme, WidgetType };
|
|
24034
|
+
export { AllowedNetworkConfig, AvailableRoutingOptions, BalanceDelta, BlockExplorerService, BridgeClaimWithdrawalFailed, BridgeClaimWithdrawalSuccess, BridgeEventType, BridgeFailed, BridgeFundingStep, BridgeTransactionSent, BridgeWidgetConfiguration, BridgeWidgetParams, BuyOrder, BuyOverrides, BuyParams, BuyResult, BuyResultFailed, BuyResultFulfillmentsUnsettled, BuyResultInsufficientFunds, BuyResultSuccess, BuyToken, CancelOverrides, CancelParams, CancelResult, CancelResultFailed, CancelResultFulfillmentsUnsettled, CancelResultGasless, CancelResultSuccess, ChainId, ChainName, ChainSlug, CheckConnectionParams, CheckConnectionResult, Checkout, CheckoutBridgeConfiguration, CheckoutConfiguration, CheckoutErrorType, CheckoutModuleConfiguration, CheckoutOnRampConfiguration, CheckoutStatus, CheckoutSwapConfiguration, CheckoutWidgetsConfig, ConnectEventType, ConnectParams, ConnectResult, ConnectTargetLayer, ConnectWidgetConfiguration, ConnectWidgetParams, ConnectionFailed, ConnectionSuccess, CreateProviderParams, CreateProviderResult, DexConfig, ERC20ItemRequirement, ERC721Balance, ERC721ItemRequirement, ErrorType, ExchangeType, FailedGaslessCancellation, Fee, FeePercentage, FeeToken, FeeType, FiatRampParams, FulfillmentTransaction, FundingItem, FundingRoute, FundingStep, FundingStepType, GasAmount, GasEstimateBridgeToL2Result, GasEstimateParams, GasEstimateSwapResult, GasEstimateTokenConfig, GasEstimateType, GasToken, GasTokenType, GetAllBalancesParams, GetAllBalancesResult, GetBalanceParams, GetBalanceResult, GetNetworkAllowListParams, GetNetworkAllowListResult, GetNetworkParams, GetTokenAllowListParams, GetTokenAllowListResult, GetTokenInfoParams, GetWalletAllowListParams, GetWalletAllowListResult, IMMUTABLE_API_BASE_URL, IMTBLWidgetEvents, IWidgetsFactory, ItemBalance, ItemType, LanguageChanged, NativeItemRequirement, NetworkFilter, NetworkFilterTypes, NetworkInfo, NoRouteOptions, NoRoutesFound, OnRampEventType, OnRampFailed, OnRampFundingStep, OnRampProviderFees, OnRampSuccess, OnRampWidgetParams, OnrampWidgetConfiguration, OrchestrationEvent, OrchestrationEventData, OrchestrationEventType, OrderFee, PendingGaslessCancellation, ProviderEvent, ProviderEventType, ProviderUpdated, RemoteConfiguration, RequestBridgeEvent, RequestConnectEvent, RequestOnrampEvent, RequestSwapEvent, RequestWalletEvent, RoutesFound, RoutingOutcome, RoutingOutcomeType, SaleEventType, SaleFailed, SaleItem, SalePaymentMethod, SalePaymentTypes, SaleSuccess, SaleTransactionSuccess, SaleWidgetConfiguration, SaleWidgetParams, SellOrder, SellParams, SellResult, SellResultFailed, SellResultInsufficientFunds, SellResultSuccess, SellToken, SemanticVersion, SendTransactionParams, SendTransactionResult, SmartCheckoutInsufficient, SmartCheckoutParams, SmartCheckoutResult, SmartCheckoutRouter, SmartCheckoutSufficient, SuccessfulGaslessCancellation, SwapEventType, SwapFailed, SwapFundingStep, SwapRejected, SwapSuccess, SwapWidgetConfiguration, SwapWidgetParams, SwitchNetworkParams, SwitchNetworkResult, TokenAmountEstimate, TokenBalance, TokenFilter, TokenFilterTypes, TokenInfo, TransactionOrGasType, TransactionRequirement, WalletDisconnect, WalletEventType, WalletFilter, WalletFilterTypes, WalletInfo, WalletNetworkSwitch, WalletProviderName, WalletWidgetConfiguration, WalletWidgetParams, Widget, WidgetConfiguration, WidgetConfigurations, WidgetEvent, WidgetEventData, WidgetEventTypes, WidgetLanguage, WidgetParameters, WidgetProperties, WidgetTheme, WidgetType };
|
package/dist/checkout.js
CHANGED
|
@@ -138,7 +138,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
141
|
-
const SDK_VERSION$1 = '1.5.
|
|
141
|
+
const SDK_VERSION$1 = '1.5.1';
|
|
142
142
|
let initialised$1 = false;
|
|
143
143
|
const isInitialised$1 = () => initialised$1;
|
|
144
144
|
const getReferrer$1 = () => {
|
|
@@ -17088,7 +17088,7 @@ const flattenProperties = (properties) => {
|
|
|
17088
17088
|
};
|
|
17089
17089
|
|
|
17090
17090
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
17091
|
-
const SDK_VERSION = '1.5.
|
|
17091
|
+
const SDK_VERSION = '1.5.1';
|
|
17092
17092
|
let initialised = false;
|
|
17093
17093
|
const isInitialised = () => initialised;
|
|
17094
17094
|
const getReferrer = () => {
|
|
@@ -27266,7 +27266,7 @@ class APIError extends Error {
|
|
|
27266
27266
|
|
|
27267
27267
|
/* eslint-disable implicit-arrow-linebreak */
|
|
27268
27268
|
const defaultHeaders = {
|
|
27269
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.5.
|
|
27269
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.5.1',
|
|
27270
27270
|
};
|
|
27271
27271
|
/**
|
|
27272
27272
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -28633,7 +28633,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
28633
28633
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
28634
28634
|
};
|
|
28635
28635
|
|
|
28636
|
-
const SDK_VERSION_MARKER = '1.5.
|
|
28636
|
+
const SDK_VERSION_MARKER = '1.5.1';
|
|
28637
28637
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
28638
28638
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
28639
28639
|
|
|
@@ -31895,9 +31895,7 @@ const buy = async (config, provider, orders, overrides = {
|
|
|
31895
31895
|
};
|
|
31896
31896
|
};
|
|
31897
31897
|
|
|
31898
|
-
const
|
|
31899
|
-
waitFulfillmentSettlements: true,
|
|
31900
|
-
}) => {
|
|
31898
|
+
const cancelOnChain = async (config, orderbook, provider, orderIds, waitFulfillmentSettlements) => {
|
|
31901
31899
|
let unsignedCancelOrderTransaction;
|
|
31902
31900
|
if (orderIds.length === 0) {
|
|
31903
31901
|
throw new CheckoutError('No orderIds were provided to the orderIds array. Please provide at least one orderId.', CheckoutErrorType.CANCEL_ORDER_LISTING_ERROR);
|
|
@@ -31906,7 +31904,6 @@ const cancel = async (config, provider, orderIds, overrides = {
|
|
|
31906
31904
|
const orderId = orderIds[0];
|
|
31907
31905
|
try {
|
|
31908
31906
|
const offererAddress = await measureAsyncExecution(config, 'Time to get the address from the provider', provider.getSigner().getAddress());
|
|
31909
|
-
const orderbook = createOrderbookInstance(config);
|
|
31910
31907
|
const cancelOrderResponse = await measureAsyncExecution(config, 'Time to get the cancel order from the orderbook', orderbook.cancelOrdersOnChain([orderId], offererAddress));
|
|
31911
31908
|
unsignedCancelOrderTransaction = await cancelOrderResponse.cancellationAction.buildTransaction();
|
|
31912
31909
|
}
|
|
@@ -31916,7 +31913,7 @@ const cancel = async (config, provider, orderIds, overrides = {
|
|
|
31916
31913
|
error: err,
|
|
31917
31914
|
});
|
|
31918
31915
|
}
|
|
31919
|
-
if (
|
|
31916
|
+
if (waitFulfillmentSettlements) {
|
|
31920
31917
|
const result = await signFulfillmentTransactions(provider, [unsignedCancelOrderTransaction]);
|
|
31921
31918
|
if (result.type === SignTransactionStatusType.FAILED) {
|
|
31922
31919
|
return {
|
|
@@ -31944,6 +31941,56 @@ const cancel = async (config, provider, orderIds, overrides = {
|
|
|
31944
31941
|
transactions,
|
|
31945
31942
|
};
|
|
31946
31943
|
};
|
|
31944
|
+
const gaslessCancel = async (orderbook, provider, orderIds) => {
|
|
31945
|
+
try {
|
|
31946
|
+
const signer = provider.getSigner();
|
|
31947
|
+
const address = await signer.getAddress();
|
|
31948
|
+
const { signableAction } = await orderbook.prepareOrderCancellations(orderIds);
|
|
31949
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
31950
|
+
const signedMessage = await signer._signTypedData(signableAction.message.domain, signableAction.message.types, signableAction.message.value);
|
|
31951
|
+
const { result } = await orderbook.cancelOrders(orderIds, address, signedMessage);
|
|
31952
|
+
const successfulCancellations = [];
|
|
31953
|
+
const failedCancellations = [];
|
|
31954
|
+
const pendingCancellations = [];
|
|
31955
|
+
for (const success of result.successful_cancellations) {
|
|
31956
|
+
successfulCancellations.push({
|
|
31957
|
+
orderId: success,
|
|
31958
|
+
});
|
|
31959
|
+
}
|
|
31960
|
+
for (const failed of result.failed_cancellations) {
|
|
31961
|
+
failedCancellations.push({
|
|
31962
|
+
orderId: failed.order,
|
|
31963
|
+
reason: failed.reason_code,
|
|
31964
|
+
});
|
|
31965
|
+
}
|
|
31966
|
+
for (const pending of result.pending_cancellations) {
|
|
31967
|
+
pendingCancellations.push({
|
|
31968
|
+
orderId: pending,
|
|
31969
|
+
});
|
|
31970
|
+
}
|
|
31971
|
+
return {
|
|
31972
|
+
successfulCancellations,
|
|
31973
|
+
failedCancellations,
|
|
31974
|
+
pendingCancellations,
|
|
31975
|
+
};
|
|
31976
|
+
}
|
|
31977
|
+
catch (err) {
|
|
31978
|
+
throw new CheckoutError('An error occurred while cancelling the order listing', CheckoutErrorType.CANCEL_ORDER_LISTING_ERROR, {
|
|
31979
|
+
orderIds,
|
|
31980
|
+
error: err,
|
|
31981
|
+
});
|
|
31982
|
+
}
|
|
31983
|
+
};
|
|
31984
|
+
const cancel = async (config, provider, orderIds, overrides = {
|
|
31985
|
+
waitFulfillmentSettlements: true,
|
|
31986
|
+
useGaslessCancel: false,
|
|
31987
|
+
}) => {
|
|
31988
|
+
const orderbook = createOrderbookInstance(config);
|
|
31989
|
+
if (overrides.useGaslessCancel) {
|
|
31990
|
+
return await gaslessCancel(orderbook, provider, orderIds);
|
|
31991
|
+
}
|
|
31992
|
+
return await cancelOnChain(config, orderbook, provider, orderIds, overrides.waitFulfillmentSettlements ?? true);
|
|
31993
|
+
};
|
|
31947
31994
|
|
|
31948
31995
|
const getERC721Requirement = (id, contractAddress, spenderAddress) => ({
|
|
31949
31996
|
type: ItemType.ERC721,
|
package/dist/config.js
CHANGED
|
@@ -127,7 +127,7 @@ const flattenProperties = (properties) => {
|
|
|
127
127
|
};
|
|
128
128
|
|
|
129
129
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
130
|
-
const SDK_VERSION = '1.5.
|
|
130
|
+
const SDK_VERSION = '1.5.1';
|
|
131
131
|
let initialised = false;
|
|
132
132
|
const isInitialised = () => initialised;
|
|
133
133
|
const getReferrer = () => {
|