@imtbl/checkout-sdk 2.1.7 → 2.1.8-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.
@@ -9,3 +9,4 @@ export * from './widget';
9
9
  export * from './addTokens';
10
10
  export * from './commerce';
11
11
  export * from './purchase';
12
+ export * from './transfer';
@@ -0,0 +1,5 @@
1
+ import { WidgetConfiguration } from './widget';
2
+ /**
3
+ * Transfer Widget Configuration represents the configuration options for the Transfer Widget.
4
+ */
5
+ export type TransferWidgetConfiguration = {} & WidgetConfiguration;
@@ -9,3 +9,4 @@ export * from './onramp';
9
9
  export * from './commerce';
10
10
  export * from './addTokens';
11
11
  export * from './purchase';
12
+ export * from './transfer';
@@ -0,0 +1,25 @@
1
+ export declare enum TransferEventType {
2
+ CLOSE_WIDGET = "close-widget",
3
+ REJECTED = "rejected",
4
+ SUCCESS = "success",
5
+ FAILURE = "failure"
6
+ }
7
+ /**
8
+ * Represents a successful transfer.
9
+ */
10
+ export type TransferSuccess = {
11
+ transactionHash: string;
12
+ };
13
+ /**
14
+ * Type representing a transfer failure
15
+ * @property {string} reason
16
+ */
17
+ export type TransferFailed = {
18
+ reason: string;
19
+ timestamp: number;
20
+ };
21
+ /**
22
+ * Type representing a transfer rejected
23
+ * @property {string} reason
24
+ */
25
+ export type TransferRejected = {};
@@ -13,7 +13,8 @@ export declare enum IMTBLWidgetEvents {
13
13
  IMTBL_SALE_WIDGET_EVENT = "imtbl-sale-widget",
14
14
  IMTBL_COMMERCE_WIDGET_EVENT = "imtbl-commerce-widget",
15
15
  IMTBL_ADD_TOKENS_WIDGET_EVENT = "imtbl-add-tokens-widget",
16
- IMTBL_PURCHASE_WIDGET_EVENT = "imtbl-purchase-widget"
16
+ IMTBL_PURCHASE_WIDGET_EVENT = "imtbl-purchase-widget",
17
+ IMTBL_TRANSFER_WIDGET_EVENT = "imtbl-transfer-widget"
17
18
  }
18
19
  /**
19
20
  * Enum for events raised for about provider objects
@@ -7,6 +7,7 @@ import { OnRampWidgetParams } from './onramp';
7
7
  import { SaleWidgetParams } from './sale';
8
8
  import { AddTokensWidgetParams } from './addTokens';
9
9
  import { PurchaseWidgetParams } from './purchase';
10
+ import { TransferWidgetParams } from './transfer';
10
11
  export declare enum CommerceFlowType {
11
12
  CONNECT = "CONNECT",
12
13
  WALLET = "WALLET",
@@ -15,7 +16,8 @@ export declare enum CommerceFlowType {
15
16
  BRIDGE = "BRIDGE",
16
17
  ONRAMP = "ONRAMP",
17
18
  ADD_TOKENS = "ADD_TOKENS",
18
- PURCHASE = "PURCHASE"
19
+ PURCHASE = "PURCHASE",
20
+ TRANSFER = "TRANSFER"
19
21
  }
20
22
  export type CommerceWidgetConnectFlowParams = {
21
23
  flow: CommerceFlowType.CONNECT;
@@ -41,7 +43,10 @@ export type CommerceWidgetAddTokensFlowParams = {
41
43
  export type CommerceWidgetPurchaseFlowParams = {
42
44
  flow: CommerceFlowType.PURCHASE;
43
45
  } & PurchaseWidgetParams;
44
- export type CommerceWidgetFlowParams = CommerceWidgetConnectFlowParams | CommerceWidgetWalletFlowParams | CommerceWidgetSwapFlowParams | CommerceWidgetBridgeFlowParams | CommerceWidgetOnRampFlowParams | CommerceWidgetSaleFlowParams | CommerceWidgetAddTokensFlowParams | CommerceWidgetPurchaseFlowParams;
46
+ export type CommerceWidgetTransferFlowParams = {
47
+ flow: CommerceFlowType.TRANSFER;
48
+ } & TransferWidgetParams;
49
+ export type CommerceWidgetFlowParams = CommerceWidgetConnectFlowParams | CommerceWidgetWalletFlowParams | CommerceWidgetSwapFlowParams | CommerceWidgetBridgeFlowParams | CommerceWidgetOnRampFlowParams | CommerceWidgetSaleFlowParams | CommerceWidgetAddTokensFlowParams | CommerceWidgetPurchaseFlowParams | CommerceWidgetTransferFlowParams;
45
50
  export type CommerceWidgetParams = {
46
51
  /** The language to use for the Commerce Widget */
47
52
  language?: WidgetLanguage;
@@ -1,4 +1,5 @@
1
1
  export type { AddTokensWidgetParams } from './addTokens';
2
+ export type { TransferWidgetParams } from './transfer';
2
3
  export * from './connect';
3
4
  export * from './bridge';
4
5
  export * from './wallet';
@@ -0,0 +1,13 @@
1
+ import { WidgetLanguage } from '../configurations/widget';
2
+ export type TransferWidgetParams = {
3
+ /** The language to use for the Purchase widget */
4
+ language?: WidgetLanguage;
5
+ /** The amount to transfer */
6
+ amount?: string;
7
+ /** The token address to transfer */
8
+ tokenAddress?: `0x${string}` | 'native';
9
+ /** The to address to transfer to */
10
+ toAddress?: `0x${string}`;
11
+ /** Whether to show the back button */
12
+ showBackButton?: boolean;
13
+ };
@@ -1,8 +1,9 @@
1
1
  import { Environment } from '@imtbl/config';
2
2
  import { BridgeClaimWithdrawalFailed, BridgeClaimWithdrawalSuccess, BridgeEventType, BridgeFailed, BridgeTransactionSent, ConnectEventType, ConnectionFailed, ConnectionSuccess, OnRampEventType, OnRampFailed, OnRampSuccess, OrchestrationEventType, ProviderEventType, ProviderUpdated, RequestBridgeEvent, RequestConnectEvent, RequestOnrampEvent, RequestSwapEvent, RequestWalletEvent, SaleEventType, SaleFailed, SalePaymentMethod, SalePaymentToken, SaleSuccess, SaleTransactionSuccess, SwapEventType, SwapFailed, SwapRejected, SwapSuccess, WalletConnectProviderChanged, WalletDisconnect, WalletEventType, WalletNetworkSwitch, CommerceEventType, CommerceProviderUpdatedEvent, CommerceSuccessEvent, CommerceFailureEvent, CommerceUserActionEvent, RequestAddTokensEvent, RequestGoBackEvent, AddTokensEventType, AddTokensConnectSuccess, AddTokensSuccess, AddTokensFailed, PurchaseConnectSuccess, PurchaseEventType, PurchaseFailed, PurchaseSuccess } from './events';
3
- import { BridgeWidgetParams, ConnectWidgetParams, SwapWidgetParams, WalletWidgetParams, OnRampWidgetParams, CommerceWidgetParams, AddTokensWidgetParams, SaleWidgetParams, PurchaseWidgetParams } from './parameters';
4
- import { BridgeWidgetConfiguration, ConnectWidgetConfiguration, OnrampWidgetConfiguration, SaleWidgetConfiguration, SwapWidgetConfiguration, WalletWidgetConfiguration, CommerceWidgetConfiguration, AddTokensWidgetConfiguration, WidgetTheme, PurchaseWidgetConfiguration } from './configurations';
3
+ import { BridgeWidgetParams, ConnectWidgetParams, SwapWidgetParams, WalletWidgetParams, OnRampWidgetParams, CommerceWidgetParams, AddTokensWidgetParams, SaleWidgetParams, PurchaseWidgetParams, TransferWidgetParams } from './parameters';
4
+ import { BridgeWidgetConfiguration, ConnectWidgetConfiguration, OnrampWidgetConfiguration, SaleWidgetConfiguration, SwapWidgetConfiguration, WalletWidgetConfiguration, CommerceWidgetConfiguration, AddTokensWidgetConfiguration, WidgetTheme, PurchaseWidgetConfiguration, TransferWidgetConfiguration } from './configurations';
5
5
  import { WrappedBrowserProvider } from '../../types';
6
+ import { TransferEventType, TransferFailed, TransferRejected, TransferSuccess } from './events/transfer';
6
7
  /**
7
8
  * Enum representing the list of widget types.
8
9
  */
@@ -15,7 +16,8 @@ export declare enum WidgetType {
15
16
  SALE = "sale",
16
17
  IMMUTABLE_COMMERCE = "immutableCommerce",
17
18
  ADD_TOKENS = "addTokens",
18
- PURCHASE = "purchase"
19
+ PURCHASE = "purchase",
20
+ TRANSFER = "transfer"
19
21
  }
20
22
  /**
21
23
  * Widget properties definition for each widget. Used for creating and updating widgets
@@ -34,6 +36,7 @@ export type WidgetConfigurations = {
34
36
  [WidgetType.ADD_TOKENS]: AddTokensWidgetConfiguration;
35
37
  [WidgetType.PURCHASE]: PurchaseWidgetConfiguration;
36
38
  [WidgetType.IMMUTABLE_COMMERCE]: CommerceWidgetConfiguration;
39
+ [WidgetType.TRANSFER]: TransferWidgetConfiguration;
37
40
  };
38
41
  export type WidgetParameters = {
39
42
  [WidgetType.CONNECT]: ConnectWidgetParams;
@@ -45,6 +48,7 @@ export type WidgetParameters = {
45
48
  [WidgetType.ADD_TOKENS]: AddTokensWidgetParams;
46
49
  [WidgetType.PURCHASE]: PurchaseWidgetParams;
47
50
  [WidgetType.IMMUTABLE_COMMERCE]: CommerceWidgetParams;
51
+ [WidgetType.TRANSFER]: TransferWidgetParams;
48
52
  };
49
53
  /**
50
54
  * Represents all the possible event types that are emitted by the widgets.
@@ -140,6 +144,12 @@ export type WidgetEventData = {
140
144
  [PurchaseEventType.SUCCESS]: PurchaseSuccess;
141
145
  [PurchaseEventType.FAILURE]: PurchaseFailed;
142
146
  } & OrchestrationMapping & ProviderEventMapping;
147
+ [WidgetType.TRANSFER]: {
148
+ [TransferEventType.CLOSE_WIDGET]: {};
149
+ [TransferEventType.SUCCESS]: TransferSuccess;
150
+ [TransferEventType.FAILURE]: TransferFailed;
151
+ [TransferEventType.REJECTED]: TransferRejected;
152
+ } & OrchestrationMapping & ProviderEventMapping;
143
153
  };
144
154
  /**
145
155
  * Represents an event emitted by a widget. The event type should match the event data
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@imtbl/checkout-sdk",
3
3
  "description": "Immutable Checkout SDK",
4
- "version": "2.1.7",
4
+ "version": "2.1.8-alpha.1",
5
5
  "author": "immutable",
6
6
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
7
7
  "dependencies": {
8
- "@imtbl/blockchain-data": "2.1.7",
9
- "@imtbl/bridge-sdk": "2.1.7",
10
- "@imtbl/config": "2.1.7",
11
- "@imtbl/dex-sdk": "2.1.7",
12
- "@imtbl/generated-clients": "2.1.7",
13
- "@imtbl/metrics": "2.1.7",
14
- "@imtbl/orderbook": "2.1.7",
15
- "@imtbl/passport": "2.1.7",
8
+ "@imtbl/blockchain-data": "2.1.8-alpha.1",
9
+ "@imtbl/bridge-sdk": "2.1.8-alpha.1",
10
+ "@imtbl/config": "2.1.8-alpha.1",
11
+ "@imtbl/dex-sdk": "2.1.8-alpha.1",
12
+ "@imtbl/generated-clients": "2.1.8-alpha.1",
13
+ "@imtbl/metrics": "2.1.8-alpha.1",
14
+ "@imtbl/orderbook": "2.1.8-alpha.1",
15
+ "@imtbl/passport": "2.1.8-alpha.1",
16
16
  "@metamask/detect-provider": "^2.0.0",
17
17
  "axios": "^1.6.5",
18
18
  "ethers": "^6.13.4",