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
Method for connecting with the NEOPIN Wallet, and the URL is returned when the connection is made.
ex) ConnectManager.shared.connect()
Method for disconnecting from the NEOPIN Wallet.
Disconnect is recommended in the following cases.
When the app is terminated or forcibly terminated. (AppDelegate.applicationWillTerminate)
When the transaction with NEOPIN Wallet is finished.
When a certain time passes after connecting to NEOPIN Wallet.
ex) ConnectManager.shared.disconnect()
Method for obtaining the address of the NEOPIN Wallet.
Addresses can be imported only when Wallet is connected.
ex) ConnectManager.shared.getMyAccount()
Among the methods for communicating with the NEOPIN Wallet, this is the most important method. After sending a Transaction to the wallet, you must give a response value from the Wallet to receive it as a Response.
When creating a Transaction in this method, be sure to check the variable values (from, to, data, gas, gasPrice, value, nonce, type, accessList, chainId, maxPriorityFeePerGas, maxFeePerGas).
When creating a Client.Transaction object for SendTransaction, specify the ChainID of the target network. (*Required)
Data, one of the values of Transaction, must be entered as encodedData that complies with ERC-20 “Transfer”. Please refer to the example.
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))).
Connect
Method for connecting with the NEOPIN Wallet, and the URL is returned when the connection is made.
The code block below is a code that requests connection to the NEOPIN Wallet through ConnectManager and opens the NEOPIN Wallet through the obtained URL.
You must request a connection and approve it in the NEOPIN Wallet to connect to the Wallet.
Create Transaction by filling in the remaining values.
When creating a Transaction in this method, be sure to check the variable values. In this project, an arbitrary value is set. (from, to, data, gas, gasPrice, value, nonce, type, accessList, chainId, maxPriorityFeePerGas, maxFeePerGas).
staticfunctransaction(fromaddress: String,to: String) -> Client.Transaction? {// MARK: - transferFucntion(address, value)guardlet amount = Web3.Utils.parseToBigUInt("10000", units: .eth)else { returnnil }guardlet data = ABIHelper.encode( param: [ to asAnyObject, amount asAnyObject ], function: ABIHelper.getTransferFunction())else { returnnil }return PodsNeopinConnect.Client.Transaction( from: address, to: to, data: data, gas:"0x76c0", gasPrice:"0x", value:"0x", nonce:"0x", //Update to the latest nonce from the NEOPIN Wallet. type:nil, accessList:nil, chainId:nil, maxPriorityFeePerGas:nil, maxFeePerGas:nil)}
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.
The sign method calculates an Ethereum specific signature with:sign(keccack256("\\x19Ethereum Signed Message:\\n" + len(message) + message))).
By 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.