Skip to content

Latest commit

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

[toc]

Introduction

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

DApp Development

How To Connect Aptos DApp in HyperPay

Connect Document

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 web3-onboard to integrate the wallet, nothing needs to be done. Hyperpay DAppBrowser can directly display relevant wallet information, as shown in the following picture: Web3 Onborad Demo web3-onboard supports wallets:
exportenumProviderLabel{AlphaWallet='AlphaWallet',AToken='AToken',Binance='Binance Smart Wallet',Bitpie='Bitpie',BlockWallet='BlockWallet',Brave='Brave Wallet',Coinbase='Coinbase Wallet',Dcent=`D'CENT`,Detected='Detected Wallet',Frame='Frame',HuobiWallet='Huobi Wallet',HyperPay='HyperPay',ImToken='imToken',Liquality='Liquality',MeetOne='MeetOne',MetaMask='MetaMask',MyKey='MyKey',Opera='Opera Wallet',OwnBit='OwnBit',Status='Status Wallet',Trust='Trust Wallet',TokenPocket='TokenPocket',TP='TP Wallet',WalletIo='Wallet.io',XDEFI='XDEFI Wallet',OneInch='1inch Wallet',Tokenary='Tokenary Wallet',Tally='Tally Wallet'}
  1. If EVM DApp wants to display HyperPay directly. We can provide wallet logo, etc.

How To Connect Wallet

EVM(Ethereum) Connect

The Metamask protocol is a universal wallet connection scheme for Ethereum or EVM chains. HyperPay complies with the Metamask protocol by default, and will implant window.ethereum object in the webview. Developers can directly develop follow MetaMask Documents.

(function(){varconfig={address: "\(address.lowercased())",chainId: \(chainId),rpcUrl: "\(rpcUrl)"};window.ethereum=newhiWallet.Provider(config);window.web3=newhiWallet.Web3(window.ethereum);window.isHyperPay=true;})();

EVM DAppBrowser Methods Supports

enumDAppMethod:String,Decodable,CaseIterable{case signTransaction
case signPersonalMessage
case signMessage
case signTypedMessage
case ecRecover
case requestAccounts
case watchAsset
case addEthereumChain
case switchEthereumChain
}

Solana DApp Connect

You can also refer to solana-web3. We use the official wallet-adapter as the connection method wallet-adapter and support npmjs wallet-adapter-hyperpay If Solana DApp wants to show HyperPay wallet info in DAppBrowser.

constwallets=useMemo(()=>[newHyperPayWalletAdapter(),newPhantomWalletAdapter(),newCoinbaseWalletAdapter(),],);

IsInstalled

constisHyperPayInstalled=window.isHyperPay&&window.hyperPay.solana

connect(request authorization to connect)

asyncconnect(){if(this.publicKey){this.emit("connect",this.publicKey);}else{this.publicKey=awaitwindow.hyperPay.solana.getAccount()this.emit("connect",this.publicKey);}}

signTransaction

signTransaction(transaction){returnthis._request({method: "signTransaction",params: {transaction:transaction,message: transaction.serializeMessage().toString("hex")}},true);}

signAllTransactions

signAllTransactions(transactions){constmessage=transactions.map(transaction=>{returntransaction.serializeMessage().toString("hex");});returnthis._request({method: "signAllTransactions",params: {transactions:transactions,message: message.join(","),}},true);}

SOLANA DAppBrowser Methods Supports

enumDAppMethod:String,Decodable,CaseIterable{case signTransaction
case signAllTransactions
case signMessage
case connect
case disconnect
case requestAccounts
case getAccount
}

solana demo

web3.js

Resources

website

logo image

etc.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors