Skip to content

Commit

Permalink
Merge pull request #205 from lidofinance/feature/si-1729-support-ambi…
Browse files Browse the repository at this point in the history
…re-extension

Support ambire extension
  • Loading branch information
Jeday authored Dec 13, 2024
2 parents 1add0ff + fe5d324 commit 6bbf93d
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 23 deletions.
27 changes: 26 additions & 1 deletion apps/demo-react/components/wallet-info/wallet-info-content.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import { useAccount } from 'wagmi';
import { useCapabilities } from 'wagmi/experimental';
import { Close } from '@lidofinance/lido-ui';
import { useWeb3, useSupportedChains } from 'reef-knot/web3-react';
import { useConnectorInfo } from 'reef-knot/core-react';
import { useAccount } from 'wagmi';

import {
HeadingStyle,
Expand All @@ -22,6 +23,7 @@ export const WalletInfoContent = ({
const { setIsWalletInfoIsOpen } = useClientConfig();
const connectorInfo = useConnectorInfo();
const supportedChainsData = useSupportedChains();
const capabilities = useCapabilities();
const { isUnsupported } = supportedChainsData;
const supportedChainIds = supportedChainsData.supportedChains.map(
(c) => c.chainId,
Expand Down Expand Up @@ -98,6 +100,29 @@ export const WalletInfoContent = ({
</code>
</div>

<HeadingStyle>EIP-5792 Capabilities</HeadingStyle>
<div>
<code>
<DataTableRowStyle title="loading">
{String(capabilities.isLoading)}
</DataTableRowStyle>
<DataTableRowStyle title="error">
{capabilities.error?.message ?? '-'}
</DataTableRowStyle>
{capabilities.data &&
Object.entries(capabilities.data)
.filter(([chain]) => supportedChainIds.includes(Number(chain)))
.map(([chain, enabledCapabilties]) => (
<DataTableRowStyle key="chain" title={chain} highlight>
{Object.entries(enabledCapabilties)
.filter(([, capability]) => capability.supported)
.map(([capabilityTitle]) => capabilityTitle)
.join(',')}
</DataTableRowStyle>
))}
</code>
</div>

<ChainsConfig />

{children}
Expand Down
6 changes: 6 additions & 0 deletions packages/reef-knot/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# reef-knot

## 7.1.1

### Patch Changes

- @reef-knot/wallets-list@4.1.1

## 7.1.0

### Minor Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/reef-knot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reef-knot",
"version": "7.1.0",
"version": "7.1.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
Expand Down Expand Up @@ -45,7 +45,7 @@
"@reef-knot/core-react": "6.0.0",
"@reef-knot/web3-react": "6.0.0",
"@reef-knot/ui-react": "2.1.5",
"@reef-knot/wallets-list": "4.1.0",
"@reef-knot/wallets-list": "4.1.1",
"@reef-knot/wallets-helpers": "2.1.1",
"@reef-knot/types": "4.0.0",
"@reef-knot/ledger-connector": "4.2.0"
Expand Down
7 changes: 7 additions & 0 deletions packages/wallets-list/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @reef-knot/wallets-list

## 4.1.1

### Patch Changes

- Updated dependencies [c5965d1]
- @reef-knot/wallet-adapter-ambire@5.0.0

## 4.1.0

### Minor Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/wallets-list/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reef-knot/wallets-list",
"version": "4.1.0",
"version": "4.1.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
Expand Down Expand Up @@ -42,7 +42,7 @@
"@reef-knot/wallet-adapter-okx": "4.0.0",
"@reef-knot/wallet-adapter-exodus": "4.0.0",
"@reef-knot/wallet-adapter-walletconnect": "4.0.0",
"@reef-knot/wallet-adapter-ambire": "4.0.0",
"@reef-knot/wallet-adapter-ambire": "5.0.0",
"@reef-knot/wallet-adapter-binance-wallet": "3.0.0",
"@reef-knot/wallet-adapter-bitkeep": "4.0.0",
"@reef-knot/wallet-adapter-coin98": "4.0.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/wallets/ambire/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @reef-knot/wallet-adapter-ambire

## 5.0.0

### Major Changes

- c5965d1: Migrate Ambire Wallet Connector to extension

## 4.0.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/wallets/ambire/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reef-knot/wallet-adapter-ambire",
"version": "4.0.0",
"version": "5.0.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
Expand Down
32 changes: 15 additions & 17 deletions packages/wallets/ambire/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
import { WalletAdapterType } from '@reef-knot/types';
import { getWalletConnectConnector } from '@reef-knot/wallets-helpers';
import { injected } from 'wagmi/connectors';
import type { WalletAdapterType } from '@reef-knot/types';
import {
getTargetEIP6963,
isProviderExistsEIP6963,
} from '@reef-knot/wallets-helpers';
import WalletIcon from './icons/ambire.svg';

export const id = 'ambire';
export const name = 'Ambire';
export const rdns = 'com.ambire.wallet';

export const Ambire: WalletAdapterType = ({ walletconnectProjectId }) => ({
export const Ambire: WalletAdapterType = ({ providersStore }) => ({
walletName: name,
walletId: id,
type: getWalletConnectConnector.type,
type: injected.type,
icon: WalletIcon,
createConnectorFn: getWalletConnectConnector({
projectId: walletconnectProjectId,
}),
walletconnectExtras: {
connectionViaURI: {
createConnectorFn: getWalletConnectConnector({
qrcode: false,
projectId: walletconnectProjectId,
}),
condition: true, // Actually, Ambire will always use this connector
redirectLink: 'https://wallet.ambire.com/?uri=',
closeRedirectionWindow: false,
},
detector: () => isProviderExistsEIP6963(providersStore, rdns),
downloadURLs: {
default: 'https://www.ambire.com/',
},
createConnectorFn: injected({
target: () => getTargetEIP6963(providersStore, rdns),
}),
});

0 comments on commit 6bbf93d

Please sign in to comment.