MCPcopy Index your code
hub / github.com/bitpay/bitcore / setWallet

Method setWallet

packages/bitcore-node/src/rpc.ts:144–161  ·  view source on GitHub ↗
(walletName?: string)

Source from the content-addressed store, hash-verified

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>;

Callers 3

getnewaddressMethod · 0.95
signrawtxMethod · 0.95
sendtoaddressMethod · 0.95

Calls 1

callMethod · 0.95

Tested by

no test coverage detected