xek-sdk
Version:
SDK for katana blockchain
87 lines (59 loc) • 2.27 kB
Markdown
# Class Wallet
## Methods
- `generateWallet(walletName, password)`
+ Parameters:
+ walletName: name of wallet will be created.
+ password: password for encrypting private key.
+ Returns:
+ Success: (Promise) wallet with mnemonic, public key, address and encryption of private key.
+ Other: Error
- `encryptWallet(privateKey, password)`
+ Parameters:
+ privateKey: private key will be encrypted.
+ password: password will be used to when encrypting
+ Return :
+ Success: encryption of private key and password
+ Other: Error
- `decryptWallet(cipherText, password)`
+ Parameters:
+ cipherText: encryption of private key.
+ password: password is used for decryption.
+ Returns:
+ Success: address, public key and private key as Json
+ Other: Error
- `restoreWallet(mnemonic, walletName, password)`
+ Parameters:
+ mnemonic: mnemonic passphrase will be used to restore wallet, examples: `abandon abandon ...`
+ walletName: name of wallet
+ password: password will be used to encrypt private key.
+ Returns:
+ Success:(Promise) wallet name, public key, address, private key as Json.
+ Other: Error
- `getAddressFromPublicKey(publicKey)`
+ Parameters:
+ publicKey: public key of wallet.
+ Returns:
+ Success: address from public key
+ Other: Error
- `getPublicKeyOffline(privateKey, curveType)`
+ Parameters:
+ privateKey: private key of wallet.
+ curveType: type of curve algorithm.
+ Returns:
+ Success: public key from private key
+ Other: Error
- `signatureOffline(txData, privateKey)`
+ Parameters:
+ txData: data will be signed.
+ privateKey: private key will be used to signing txData.
+ Returns:
+ Success: signature
+ Other: Error
- `verifyTransaction(tx)`
+ Parameters:
+ tx: transaction need verifying
+ Returns:
+ True: if transaction is valid
+ False: otherwise
## Source code
- [code](#)