-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/wt 1898 provider updated event (#1126)
Co-authored-by: Zach Couchman <[email protected]> Co-authored-by: Deepti Luthra <[email protected]>
- Loading branch information
1 parent
b81ef0b
commit 35290bd
Showing
47 changed files
with
670 additions
and
600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/checkout/sdk/src/widgets/definitions/configurations/bridge.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { WidgetConfiguration } from './widget'; | ||
|
||
export type BridgeWidgetConfiguration = { | ||
} & WidgetConfiguration; |
4 changes: 4 additions & 0 deletions
4
packages/checkout/sdk/src/widgets/definitions/configurations/connect.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { WidgetConfiguration } from './widget'; | ||
|
||
export type ConnectWidgetConfiguration = { | ||
} & WidgetConfiguration; |
8 changes: 8 additions & 0 deletions
8
packages/checkout/sdk/src/widgets/definitions/configurations/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export * from './connect'; | ||
export * from './bridge'; | ||
export * from './wallet'; | ||
export * from './swap'; | ||
export * from './onramp'; | ||
export * from './sale'; | ||
export * from './theme'; | ||
export * from './widget'; |
4 changes: 4 additions & 0 deletions
4
packages/checkout/sdk/src/widgets/definitions/configurations/onramp.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { WidgetConfiguration } from './widget'; | ||
|
||
export type OnrampWidgetConfiguration = { | ||
} & WidgetConfiguration; |
4 changes: 4 additions & 0 deletions
4
packages/checkout/sdk/src/widgets/definitions/configurations/sale.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { WidgetConfiguration } from './widget'; | ||
|
||
export type SaleWidgetConfiguration = { | ||
} & WidgetConfiguration; |
4 changes: 4 additions & 0 deletions
4
packages/checkout/sdk/src/widgets/definitions/configurations/swap.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { WidgetConfiguration } from './widget'; | ||
|
||
export type SwapWidgetConfiguration = { | ||
} & WidgetConfiguration; |
7 changes: 7 additions & 0 deletions
7
packages/checkout/sdk/src/widgets/definitions/configurations/theme.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* Enum representing the themes for the widgets. | ||
*/ | ||
export enum WidgetTheme { | ||
LIGHT = 'light', | ||
DARK = 'dark', | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/checkout/sdk/src/widgets/definitions/configurations/wallet.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* eslint-disable max-len */ | ||
import { WidgetConfiguration } from './widget'; | ||
|
||
export type WalletWidgetConfiguration = { | ||
} & WidgetConfiguration; |
9 changes: 9 additions & 0 deletions
9
packages/checkout/sdk/src/widgets/definitions/configurations/widget.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { WidgetTheme } from './theme'; | ||
|
||
/** | ||
* Represents the local configuration options for the Checkout Widgets. | ||
* @property {WidgetTheme | undefined} theme - The theme of the Checkout Widget (default: "DARK") | ||
*/ | ||
export type WidgetConfiguration = { | ||
theme?: WidgetTheme; | ||
}; |
17 changes: 17 additions & 0 deletions
17
packages/checkout/sdk/src/widgets/definitions/events/widgets.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,28 @@ | ||
import { Web3Provider } from '@ethersproject/providers'; | ||
|
||
/** | ||
* Enum representing the events emitted by the widgets. | ||
*/ | ||
export enum IMTBLWidgetEvents { | ||
IMTBL_WIDGETS_PROVIDER = 'imtbl-widgets-provider', | ||
IMTBL_CONNECT_WIDGET_EVENT = 'imtbl-connect-widget', | ||
IMTBL_WALLET_WIDGET_EVENT = 'imtbl-wallet-widget', | ||
IMTBL_SWAP_WIDGET_EVENT = 'imtbl-swap-widget', | ||
IMTBL_BRIDGE_WIDGET_EVENT = 'imtbl-bridge-widget', | ||
IMTBL_ONRAMP_WIDGET_EVENT = 'imtbl-onramp-widget', | ||
IMTBL_SALE_WIDGET_EVENT = 'imtbl-sale-widget', | ||
} | ||
|
||
/** | ||
* Enum for events raised for about provider objects | ||
*/ | ||
export enum ProviderEventType { | ||
PROVIDER_UPDATED = 'PROVIDER_UPDATED', | ||
} | ||
|
||
/** | ||
* Payload type for the PROVIDER_UPDATED event | ||
*/ | ||
export type ProviderUpdated = { | ||
provider: Web3Provider; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
packages/checkout/sdk/src/widgets/definitions/parameters/bridge.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
/* eslint-disable max-len */ | ||
import { Web3Provider } from '@ethersproject/providers'; | ||
import { WalletProviderName } from '../../../types'; | ||
|
||
/** | ||
* Bridge Widget parameters | ||
* @property {string | undefined} fromContractAddress - The contract address of the token to bridge from, used to populate the bridge form token field | ||
* @property {string | undefined} amount - The formatted amount to bridge, used to populate the bridge form amount field | ||
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the bridge widget | ||
* @property {Web3Provider | undefined} web3Provider - The ethers Web3Provider | ||
*/ | ||
export type BridgeWidgetParams = { | ||
fromContractAddress?: string; | ||
amount?: string; | ||
walletProviderName?: WalletProviderName | ||
web3Provider?: Web3Provider | ||
}; |
3 changes: 0 additions & 3 deletions
3
packages/checkout/sdk/src/widgets/definitions/parameters/connect.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
import { Web3Provider } from '@ethersproject/providers'; | ||
|
||
export enum ConnectTargetLayer { | ||
LAYER1 = 'LAYER1', | ||
LAYER2 = 'LAYER2', | ||
} | ||
|
||
export type ConnectWidgetParams = { | ||
web3Provider?: Web3Provider; | ||
}; |
3 changes: 0 additions & 3 deletions
3
packages/checkout/sdk/src/widgets/definitions/parameters/onramp.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
import { Web3Provider } from '@ethersproject/providers'; | ||
import { WalletProviderName } from '../../../types'; | ||
/** | ||
* OnRamp Widget parameters | ||
* @property {string | undefined} contractAddress - The contract address of the token to onramp | ||
* @property {string | undefined} amount - The formatted amount to onramp, used to populate the onramp form amount field | ||
* @property {WalletProviderName | undefined} walletProviderName - The wallet provider name to use for the onramp widget | ||
* @property {Web3Provider | undefined} web3Provider - The ethers Web3Provider | ||
*/ | ||
export type OnRampWidgetParams = { | ||
contractAddress?: string; | ||
amount?: string; | ||
walletProviderName?: WalletProviderName; | ||
web3Provider?: Web3Provider; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.