Skip to content

Commit

Permalink
try to add connect #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ridel1e committed Sep 30, 2023
1 parent 9614105 commit 15423a2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/@types/dapp-cardano-wallet-web-bridge.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ namespace CardanoBridge {
}

export interface ConnectorAPI {
name?: string;
enable(): Promise<ConnectorContextApi>;
isEnabled(): Promise<boolean>;
experimental?: any;
}
}

declare let cardano: { [key: string]: CardanoBridge.ConnectorAPI };

declare let initCardanoDAppConnectorBridge: (callback: (connector: CardanoBridge.ConnectorAPI) => void) => void;

Check failure on line 47 in src/@types/dapp-cardano-wallet-web-bridge.d.ts

View workflow job for this annotation

GitHub Actions / Build Artifacts

Replace `callback:·(connector:·CardanoBridge.ConnectorAPI)·=>·void` with `⏎··callback:·(connector:·CardanoBridge.ConnectorAPI)·=>·void,⏎`
2 changes: 2 additions & 0 deletions src/common/streams/appTick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ export const appTick$ = appTicksStarted$.pipe(
publishReplay(1),
refCount(),
);

export const testText$ = new BehaviorSubject('test');
7 changes: 7 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as ReactDOM from 'react-dom';
import { ApplicationInitializer } from './App';
import { IOSNotSupportedScreen } from './components/IOSNotSupportedScreen/IOSNotSupportedScreen';
import { SettingsProvider } from './context';
import { testText$ } from "./common/streams/appTick";

Check failure on line 11 in src/index.tsx

View workflow job for this annotation

GitHub Actions / Build Artifacts

Replace `"./common/streams/appTick"` with `'./common/streams/appTick'`

const init = () => {
const container = document.getElementById('app');
Expand All @@ -33,3 +34,9 @@ const init = () => {
};

init();

if (initCardanoDAppConnectorBridge) {
initCardanoDAppConnectorBridge(connector => {

Check failure on line 39 in src/index.tsx

View workflow job for this annotation

GitHub Actions / Build Artifacts

Replace `connector` with `(connector)`
testText$.next(connector.name || 'no');
})

Check failure on line 41 in src/index.tsx

View workflow job for this annotation

GitHub Actions / Build Artifacts

Insert `;`
}
4 changes: 3 additions & 1 deletion src/pages/Swap/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import { SwapFormModel } from './SwapFormModel';
import { SwapGraph } from './SwapGraph/SwapGraph';
import { SwitchButton } from './SwitchButton/SwitchButton';
import { YieldFarmingBadge } from './YieldFarmingBadge/YieldFarmingBadge';
import { testText$ } from "../../common/streams/appTick";

Check failure on line 83 in src/pages/Swap/Swap.tsx

View workflow job for this annotation

GitHub Actions / Build Artifacts

Replace `"../../common/streams/appTick"` with `'../../common/streams/appTick'`

const swapParamsCache$ = new BehaviorSubject<
| undefined
Expand Down Expand Up @@ -110,6 +111,7 @@ const getAvailablePools = (xId?: string, yId?: string): Observable<AmmPool[]> =>
xId && yId ? getAmmPoolsByAssetPair(xId, yId) : of([]);

export const Swap = (): JSX.Element => {
const [testText] = useObservable(testText$);
const [SwapCollapse] = useObservable(swapCollapse$);
const [selectedNetwork] = useSelectedNetwork();
const { slippage } = useSettings();
Expand Down Expand Up @@ -504,7 +506,7 @@ export const Swap = (): JSX.Element => {
<Flex row align="center">
<Flex.Item flex={1}>
<Typography.Title level={4}>
<Trans>Swap</Trans>
<Trans>Swap</Trans> {testText}
</Typography.Title>
</Flex.Item>
<Button
Expand Down

0 comments on commit 15423a2

Please sign in to comment.