Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extension wallet integration doc #480

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add extension wallet integration doc
Lbqds committed Jan 16, 2025
commit 1137a164865cbc0f47a0d5d9cbf544cf4cccf474
29 changes: 29 additions & 0 deletions docs/integration/extension-wallet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
sidebar_position: 70
title: Extension Wallet
sidebar_label: Extension Wallet
---

To enable dApps to automatically detect extension wallets that support Alephium, these wallets must adhere to the following standard, which is inspired by [EIP-6963](https://eips.ethereum.org/EIPS/eip-6963):

```typescript
function announceProvider() {
const event = new CustomEvent('announceAlephiumProvider', {
detail: Object.freeze({ provider: alephiumWindowObject })
})
const handler = () => window.dispatchEvent(event)
handler()
window.addEventListener('requestAlephiumProvider', handler)
}
```

The extension wallets must call the `announceProvider` function in `inpage.js`.

The `alephiumWindowObject` must inherit from the [`InteractiveSignerProvider`](https://github.com/alephium/alephium-web3/blob/db71321796e69944710368c6a1182a4473def4e6/packages/web3/src/signer/signer.ts#L81) and include the following four fields:

1. `name`: The wallet name, **please note that `alephium` cannot be used as the wallet name**
2. `id`: The wallet ID, **please note that `alephium` cannot be used as the wallet ID**
3. `icon`: The wallet icon
4. `version`: The wallet version

For more details, you can refer to the code in the Alephium extension wallet [here](https://github.com/alephium/extension-wallet/blob/e3f10da92580e7f6447c27c6d158f6ac46301b55/packages/extension/src/inpage/alephiumWindowObject.ts#L38).
1 change: 1 addition & 0 deletions docs/integration/index.md
Original file line number Diff line number Diff line change
@@ -6,3 +6,4 @@ Follow these guides to integrate Alephium to your platform:
* [Mining Pool Integration](/integration/mining)
* [Exchange Integration](/integration/exchange)
* [WalletConnect Integration](/integration/walletconnect)
* [Extension Wallet Integration](/integration/extension-wallet)
2 changes: 1 addition & 1 deletion docs/integration/integration-more.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 70
sidebar_position: 80
title: More and Troubleshooting
sidebar_label: More and troubleshooting
---