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
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.
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.
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.
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.
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.
val instance = ConnectManager.getInstance()// to, nonce, gasPrice, gas, value, data are arbitrary data.// Each should be modified according to its purpose.ConnectManager.sendTransaction(WCEthereumTransaction(chainId ="8217", from = instance?.userAddress ?: "0x0", to ="0x0", // Contract Address nonce ="0x0001", gasPrice ="0x9184e72a000", gas ="0x76c0",value="0x0", data = "0xa9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
))
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.
Network
MainNet
TestNet
Klaytn
8217
1001
Polygon
137
80001
SignTransaction
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
val instance = ConnectManager.getInstance()// to, nonce, gasPrice, gas, value, data are arbitrary data.// Each should be modified according to its purpose.ConnectManager.signTransaction(WCEthereumTransaction(, from = instance?.userAddress ?: "0x0", to ="0x0", // Contract Address nonce ="0x0001", gasPrice ="0x9184e72a000", gas ="0x76c0",value="0x0", data = "0xa9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
))
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.
val instance = ConnectManager.getInstance()ConnectManager.personalSign("message".encodeHex())
The success and failure results of PersonalSign are forwarded to ConnectManager.wcResultResponse Listener.