Skip to content

Latest commit

 

History

History
88 lines (77 loc) · 2.46 KB

HowToConnectAptosDApp.md

File metadata and controls

88 lines (77 loc) · 2.46 KB

[toc]

Introduction

This doc will show how to connect the Aptos DApps in HyperPay wallet.

DApp Development

HyperPay wallet supports Aptos devnet.You can add aptos network in lastest version. Add aptos in hyperpay Aptos assets

How To Show HyperPay Wallet

If DApp wants to show HyperPay wallet info in DAppBrowser. There are several ways to do.

  1. If DApp uses aptos-wallet-adapter to integrate the wallet, nothing needs to be done. Hyperpay DAppBrowser can directly display relevant wallet information, as shown in the following picture: aptos-wallet-adapter Demo aptos-wallet-adapter supports wallets:
{
  Aptos official wallet
  Martian wallet
  Fewcha wallet
  Hippo wallet
  Hippo web wallet
  Pontem Wallet
  Spika wallet
  HyperPay wallet 
  etc...
}
  1. If DApp wants to display HyperPay directly. We can provide wallet logo, etc.

How To Connect Wallet

Aptos DAppBrowser Methods Supports

enum DAppMethod: String, Decodable, CaseIterable {
    case connect
    case disconnect
    case signMessage
    case signTransaction
    case account
    case signAndSubmitTransaction
    case signTransaction
}

Aptos DApp Connect

You can also refer to aptos-core. We use the wallet-adapter as the connection method wallet-adapter and support npmjs wallet-adapter If Aptos DApp wants to show HyperPay wallet info in DAppBrowser.

  const wallets = useMemo(
    () => [
      new HyperPayWalletAdapter(),
      new HippoExtensionWalletAdapter(),
      new MartianWalletAdapter(),
      new AptosWalletAdapter(),
      new FewchaWalletAdapter(),
      new PontemWalletAdapter(),
      new SpikaWalletAdapter()
    ],
    []
  );

IsInstalled

const isHyperPayInstalled =  window.isHyperPay || window.hyperpay

connect(request authorization to connect)

await window.hyperpay.connect();

Once the mobile application is connected to HyperPay wallet, it will be able to read the connected account's address and publicKey

account

const account = await window.hyperpay.account();
console.log(account);

Resources

website

logo image

etc.