Skip to content

Commit

Permalink
[core] AptosConnect Telegram support (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
hardsetting authored Oct 8, 2024
1 parent bde8112 commit 67440bf
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 26 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-boats-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@aptos-labs/wallet-adapter-core": minor
---

Bumped `@aptos-connect/wallet-adapter-plugin` to 2.1.0 to enable Telegram support
1 change: 1 addition & 0 deletions apps/nextjs-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-toast": "^1.1.5",
"@telegram-apps/sdk": "^2.0.0",
"@trustwallet/aptos-wallet-adapter": "^0.1.6",
"antd": "^5.1.2",
"class-variance-authority": "^0.7.0",
Expand Down
8 changes: 7 additions & 1 deletion apps/nextjs-example/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
isAptosNetwork,
useWallet,
} from "@aptos-labs/wallet-adapter-react";
import { init as initTelegram } from "@telegram-apps/sdk";
import { AlertCircle } from "lucide-react";
import Image from "next/image";

Expand All @@ -40,13 +41,18 @@ import { registerWallet } from "@aptos-labs/wallet-standard";

// Example of how to register a browser extension wallet plugin.
// Browser extension wallets should call registerWallet once on page load.
// When you click "Connect Wallet", you should see "Example Wallet"
// When you click "Connect Wallet", you should see "Example Wallet"
(function () {
if (typeof window === "undefined") return;
const myWallet = new MyWallet();
registerWallet(myWallet);
})();

const isTelegramMiniApp = typeof window !== 'undefined' && (window as any).TelegramWebviewProxy !== undefined;
if (isTelegramMiniApp) {
initTelegram();
}

export default function Home() {
const { account, connected, network, wallet, changeNetwork } = useWallet();

Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-adapter-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"typescript": "^4.5.3"
},
"dependencies": {
"@aptos-connect/wallet-adapter-plugin": "^2.0.2",
"@aptos-connect/wallet-adapter-plugin": "^2.1.1",
"@aptos-labs/wallet-standard": "^0.2.0",
"@atomrigslab/aptos-wallet-adapter": "^0.1.20",
"@mizuwallet-sdk/aptos-wallet-adapter": "^0.2.5",
Expand Down
102 changes: 78 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 67440bf

Please sign in to comment.