(walletName?: string)
| 142 | } |
| 143 | |
| 144 | async setWallet(walletName?: string) { |
| 145 | if (!this.walletName && !walletName) { |
| 146 | throw new Error('No wallet name specified'); |
| 147 | } |
| 148 | if (this.walletName == walletName) { |
| 149 | return; |
| 150 | } |
| 151 | |
| 152 | walletName = walletName || this.walletName; |
| 153 | try { |
| 154 | await this.call('createwallet', [walletName]); |
| 155 | } catch (err: any) { |
| 156 | if (!err.message.includes('already exists')) { |
| 157 | throw err; |
| 158 | } |
| 159 | } |
| 160 | this.walletName = walletName; |
| 161 | } |
| 162 | |
| 163 | async block(hash: string): Promise<RPCBlock<string>> { |
| 164 | return (await this.call('getblock', [hash, 1])) as RPCBlock<string>; |
no test coverage detected