Functions
Descriptions of NEOPIN Connect functions
Last updated
Descriptions of NEOPIN Connect functions
Last updated
The following information is deprecated and may limit its use. Please refer to the WalletConnect 2.0 tab for the latest version of NEOPIN wallet integration: WalletConnect 2.0
Type | Descriptions |
---|---|
Create a Session with DeepLink structure to open a Socket and connect to BridgeServer.
When the BridgeServer is connected, events are forwarded to the ConnectManager.wcConnect Listener. When the connection is confirmed, send requestSession(wc_sessionRequest). Call WalletSample via DeepLink.
Touching the Connect button in WalletSample sends an event to the DAppSample's ConnectManager.wcSessionApprove Listener. When canceled, an event is forwarded to ConnectManager.wcSessionReject Listener.
Create a Session with DeepLink structure to open a Socket and connect to BridgeServer.
When the BridgeServer is connected, events are forwarded to the ConnectManager.wcConnect Listener. When the connection is confirmed, send a requestSession(wc_sessionRequest). Use DeepLink to generate a QRCode image and display it on the screen. Run WalletSample and scan the QRCode.
Touching the Connect button in WalletSample sends an event to the DAppSample's ConnectManager.wcSessionApprove Listener. When canceled, an event is forwarded to ConnectManager.wcSessionReject Listener. When sessionApprove is reached, the QRCode image is removed from the screen.
Disconnect from DApp: Call ConnectManager.disconnect().
Disconnect from Wallet: When disconnected from Wallet, an event is forwarded to ConnectManager.wcDisconnect Listener.
Method to check the Address and ChainId of the currently connected Wallet.
Call ConnectManager.getAccounts().
The event is forwarded to ConnectManager.wcResultResponse Listener.
Method to communicate with Wallet.
To use NEOPIN Connect eth_sendTransaction in DApp, the following procedure is required.
Create and send a WCEthereumTransaction object to ConncetManager.sendTransaction(). You have to create and insert the data that goes into WCEthereumTransaction yourself.
The success and failure results of SendTransaction are forwarded to ConnectManager.wcResultResponse Listener.
When creating a Client.Transaction object for SendTransaction, specify the ChainID of the target network. (*Required)
NEOPIN Connect supports a variety of networks, so specifying a chainID is required.
Transfer to the NEOPIN Wallet.
Please create a Transaction object after checking Address(From, To).
After sending the Transaction to the Wallet, you can receive Response only when the wallet gives a response value.
Signs a transaction that can be submitted to the network
The success and failure results of SignTransaction are forwarded to ConnectManager.wcResultResponse Listener.
The sign method calculates an Ethereum specific signature with:sign(keccack256("\\x19Ethereum Signed Message:\\n" + len(message) + message)))
.
Adding a prefix to the message makes the calculated signature recognisable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.
Note See ecRecover to verify the signature.
The success and failure results of PersonalSign are forwarded to ConnectManager.wcResultResponse Listener.
Network | MainNet | TestNet |
---|---|---|
setClient(wcSession: WCSession, peerMeta: WCPeerMeta): Creates and receives WCSession, WCPeerMeta, connects the Bridge Server, and creates an Instance with the connected session.
requestSession(id: String): Requests a session connection to the Wallet by calling requestSession (wc_sessionRequest) with the peerId received during connect.
wcConnect Listener: Called when connecting to the Bridge Server.
wcSessionApprove Listener: Called when a connection with the Wallet is complete.
wcSessionReject Listener: Called when connection with the Wallet fails.
disconnect(): Calls KillSession(wc_sessionUpdate approved=false) if there is a connected session, and disconnects WebSocket if WebSocket is open.
wcDisconnect Listener: Called when a Disconnect request (KillSession request) is received, or when a SocketException error occurs.
getAccounts(): When sessionApprove is reached, userAddress and network(ChainId) are set. If you want to check again while connected, you can check again by sending getAccounts (get_accounts) to your wallet.
wcResultResponse Listener: Receives success or failure response values.
sendTransaction(transaction: WCEthereumTransaction): Creates and transmits WCEthereumTransaction data to the Wallet to execute a transaction.
wcResultResponse Listener: Receives success or failure response values. This value is the return hash value of the executed contract when the transaction is successful.
Signs a transaction that can be submitted to the network
The sign method calculates an Ethereum specific signature with:sign(keccack256("\x19Ethereum Signed Message:\n" + len(message) + message))).
Klaytn
8217
1001
Polygon
137
80001