Skip to content

Commit

Permalink
Update node verge to 0.0.4 (unlock wallet)
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin.piekarek committed Apr 26, 2018
1 parent cf32bfa commit 878aaef
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 292 deletions.
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"name": "verge-node-typescript",
"version": "0.0.2",
"version": "0.0.4",
"description": "NodeJS typescript RPC client for VERGE currency",
"keywords": [
"verge"
],
"keywords": ["verge"],
"repository": "git://github.com/marpme/verge-node-typescript.git",
"author": "VERGE",
"main": "dist/index.js",
Expand All @@ -20,7 +18,7 @@
"scripts": {
"dist": "tsc",
"watch": "tsc -w",
"start": "tsc && node .\\dist\\index.js",
"start": "tsc && node ./dist/index.js",
"lint": "tslint 'src/**/*.ts'"
},
"devDependencies": {
Expand Down
154 changes: 79 additions & 75 deletions src/API.ts
Original file line number Diff line number Diff line change
@@ -1,78 +1,80 @@
import { Client } from './Client'
import { Transaction } from './Transaction'
import { Block } from './Block'
import { WalletInfo } from './WalletInfo'
import { Peer } from './Peer'

export abstract class API {
commands: Array<string> = new Array(
'addMultiSigAddress',
'backupWallet',
'createRawTransaction',
'decodeRawTransaction',
'dumpPrivKey',
'encryptWallet',
'getAccount',
'getAccountAddress',
'getAddressesByAccount',
'getBalance',
'getBlock',
'getBlockCount',
'getBlockHash',
'getConnectionCount',
'getDifficulty',
'getGenerate',
'getHashesPerSec',
'getInfo',
'getMemoryPool',
'getMiningInfo',
'getNewAddress',
'getRawTransaction',
'getReceivedByAccount',
'getReceivedByAddress',
'getTransaction',
'getWork',
'help',
'importPrivKey',
'importAddress',
'keyPoolRefill',
'listAccounts',
'listReceivedByAccount',
'listReceivedByAddress',
'listSinceBlock',
'listTransactions',
'listUnspent',
'move',
'sendFrom',
'sendMany',
'sendRawTransaction',
'sendToAddress',
'setAccount',
'setGenerate',
'setTxFee',
'signMessage',
'signRawTransaction',
'stop',
'validateAddress',
'verifyMessage',
'walletLock',
'walletPassphrase',
'walletPassphraseChange'
)

isCommand(command: string): boolean {
const lowerCommand: string = command.toLowerCase()

var lowerCaseCommands = this.getCommands().map((item: string) =>
item.toLowerCase()
)

return lowerCaseCommands.indexOf(lowerCommand) !== -1
}

getCommands(): Array<string> {
return this.commands
}

/*abstract addMultiSigAddress(
commands: Array<string> = new Array(
'addMultiSigAddress',
'backupWallet',
'createRawTransaction',
'decodeRawTransaction',
'dumpPrivKey',
'encryptWallet',
'getAccount',
'getAccountAddress',
'getAddressesByAccount',
'getBalance',
'getBlock',
'getBlockCount',
'getBlockHash',
'getConnectionCount',
'getDifficulty',
'getGenerate',
'getHashesPerSec',
'getInfo',
'getMemoryPool',
'getMiningInfo',
'getNewAddress',
'getRawTransaction',
'getReceivedByAccount',
'getReceivedByAddress',
'getTransaction',
'getWork',
'help',
'importPrivKey',
'importAddress',
'keyPoolRefill',
'listAccounts',
'listReceivedByAccount',
'listReceivedByAddress',
'listSinceBlock',
'listTransactions',
'listUnspent',
'move',
'sendFrom',
'sendMany',
'sendRawTransaction',
'sendToAddress',
'setAccount',
'setGenerate',
'setTxFee',
'signMessage',
'signRawTransaction',
'stop',
'validateAddress',
'verifyMessage',
'walletLock',
'walletPassphrase',
'walletPassphraseChange'
)

isCommand(command: string): boolean {
const lowerCommand: string = command.toLowerCase()

var lowerCaseCommands = this.getCommands().map((item: string) =>
item.toLowerCase()
)

return lowerCaseCommands.indexOf(lowerCommand) !== -1
}

getCommands(): Array<string> {
return this.commands
}

/*abstract addMultiSigAddress(
nrequire: string,
keys: string[],
account: string
Expand All @@ -95,9 +97,9 @@ export abstract class API {
abstract getAccountAddress(account: string): Promise<string>
abstract getAddressesByAccount(account: string): Promise<string>*/

abstract getBalance(account?: string): Promise<number>
abstract getBalance(account?: string): Promise<number>

/*abstract getBlock(hash: string, txinfo?: string): Promise<Block>
/*abstract getBlock(hash: string, txinfo?: string): Promise<Block>
abstract getBlockCount(): Client
Expand All @@ -109,11 +111,13 @@ export abstract class API {
abstract getGenerate(): Client
abstract getHashesPerSec(): Client
abstract getHashesPerSec(): Client*/

abstract getInfo(): Client
abstract getInfo(): Promise<WalletInfo>

abstract getMemoryPool(): Client
abstract getPeerInfo(): Promise<Array<Peer>>

/*abstract getMemoryPool(): Client
abstract getMiningInfo(): Client
Expand Down
Loading

0 comments on commit 878aaef

Please sign in to comment.