Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/bitcore-cli/src/cli-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type ICliOptions } from '../types/cli';
import { type IWallet } from '../types/wallet';
import { Utils } from './utils';

export function getCommands(args: { wallet: IWallet, opts?: ICliOptions }) {
export function getCommands(args: { wallet: IWallet; opts?: ICliOptions }) {
const { wallet } = args;

const COMMANDS = {
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-cli/src/commands/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function command(args: CommonArgs) {
return opts;
}

export async function getAddresses(args: CommonArgs<{ pageSize?: number; page?: number; }>) {
export async function getAddresses(args: CommonArgs<{ pageSize?: number; page?: number }>) {
const { wallet, opts } = args;
if (opts.command) {
Object.assign(opts, command(args));
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-cli/src/commands/derive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function command(args: CommonArgs) {
return opts;
}

export async function deriveKey(args: CommonArgs<{ path?: string; }>) {
export async function deriveKey(args: CommonArgs<{ path?: string }>) {
const { wallet, opts } = args;
if (opts.command) {
Object.assign(opts, command(args));
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-cli/src/commands/join/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { joinThresholdSigWallet } from './joinThresholdSig';
import type { CommonArgs } from '../../../types/cli';


export async function joinWallet(args: CommonArgs<{ mnemonic?: string; }>) {
export async function joinWallet(args: CommonArgs<{ mnemonic?: string }>) {
const { wallet, opts } = args;

const chain = await getChain();
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-cli/src/commands/join/joinMultiSig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getCopayerName, getPassword } from '../../prompts';
import { Utils } from '../../utils';
import type { CommonArgs } from '../../../types/cli';

export async function joinMultiSigWallet(args: CommonArgs<{ mnemonic?: string; }>) {
export async function joinMultiSigWallet(args: CommonArgs<{ mnemonic?: string }>) {
const { wallet, opts } = args;
const { verbose, mnemonic } = opts;

Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-cli/src/commands/join/joinThresholdSig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Utils } from '../../utils';
import type { CommonArgs } from '../../../types/cli';

export async function joinThresholdSigWallet(
args: CommonArgs<{ mnemonic?: string; }> & { chain: string; }
args: CommonArgs<{ mnemonic?: string }> & { chain: string }
) {
const { wallet, chain, opts } = args;
const { verbose, mnemonic } = opts;
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-cli/src/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export async function getCopayerName() {
return copayerName as string;
};

export async function getAddressType(args: { chain: string; network?: Network; isMultiSig?: boolean; isTss?: boolean; }) {
export async function getAddressType(args: { chain: string; network?: Network; isMultiSig?: boolean; isTss?: boolean }) {
const { chain, network, isMultiSig, isTss } = args;
let addressTypes = Constants.ADDRESS_TYPE[chain.toUpperCase()];
if (!addressTypes) {
Expand Down
4 changes: 2 additions & 2 deletions packages/bitcore-cli/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ export class Utils {
}

static async paginate(
fn: (page: number, action?: string) => Promise<{ result?: any[], extraChoices?: prompt.Option<string>[] }>,
fn: (page: number, action?: string) => Promise<{ result?: any[]; extraChoices?: prompt.Option<string>[] }>,
opts?: {
pageSize?: number;
initialPage?: number | string; // Initial page, default is 1
/** Only applies if there are no extraChoices */
exitOn1Page?: boolean
exitOn1Page?: boolean;
}
) {
const { pageSize = 10, exitOn1Page = true, initialPage } = opts || {};
Expand Down
8 changes: 4 additions & 4 deletions packages/bitcore-cli/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class Wallet implements IWallet {
async getClient(args: {
mustBeNew?: boolean;
mustExist?: boolean;
doNotComplete?: boolean
doNotComplete?: boolean;
}): Promise<ClientType> {
const { mustBeNew, mustExist, doNotComplete } = args;

Expand Down Expand Up @@ -176,7 +176,7 @@ export class Wallet implements IWallet {
return { key, creds: this.client.toObj() };
}

async register(args: { copayerName: string; }) {
async register(args: { copayerName: string }) {
if (!this.client) {
await this.getClient({ mustExist: true });
}
Expand All @@ -185,7 +185,7 @@ export class Wallet implements IWallet {
return secret as string | undefined;
}

async load(opts?: { doNotComplete?: boolean; allowCache?: boolean; }) {
async load(opts?: { doNotComplete?: boolean; allowCache?: boolean }) {
const { doNotComplete, allowCache } = opts || {};

let walletData: WalletData | EncryptionTypes.IEncrypted = allowCache ? this.#walletData : null;
Expand Down Expand Up @@ -245,7 +245,7 @@ export class Wallet implements IWallet {
return key;
};

async save(opts?: { encryptAll?: boolean; }) {
async save(opts?: { encryptAll?: boolean }) {
const { encryptAll } = opts || {};
try {
if (!this.#walletData) {
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-cli/types/create.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export interface CreateWalletArgs {
verbose: boolean;
mnemonic?: string;
isMultiParty?: boolean;
}
};
}
10 changes: 5 additions & 5 deletions packages/bitcore-cli/types/wallet.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface IWallet {
getClient(args: {
mustBeNew?: boolean;
mustExist?: boolean;
doNotComplete?: boolean
doNotComplete?: boolean;
}): Promise<ClientType>;
create(args: {
coin?: string;
Expand All @@ -56,9 +56,9 @@ export interface IWallet {
addressType?: string;
copayerName: string;
}): Promise<{ key: TssKeyType; creds: Credentials }>;
register(args: { copayerName: string; }): Promise<string | undefined>;
load(opts?: { doNotComplete?: boolean; allowCache?: boolean; }): Promise<KeyType | TssKeyType>;
save(opts?: { encryptAll?: boolean; }): Promise<void>;
register(args: { copayerName: string }): Promise<string | undefined>;
load(opts?: { doNotComplete?: boolean; allowCache?: boolean }): Promise<KeyType | TssKeyType>;
save(opts?: { encryptAll?: boolean }): Promise<void>;
export(args: {
filename: string;
exportPassword?: string;
Expand All @@ -75,7 +75,7 @@ export interface IWallet {
getNativeCurrency(fallback?: boolean): Promise<ITokenObj | null>;
getPasswordWithRetry(): Promise<string>;
signTxp(args: { txp: Txp }): Promise<Array<string>>;
signAndBroadcastTxp(args: { txp: Txp; }): Promise<Txp>;
signAndBroadcastTxp(args: { txp: Txp }): Promise<Txp>;
signMessage(args: {
message: string;
derivationPath: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class Client {
});
}

async getTransaction(params: { txid: string, populated?: boolean }) {
async getTransaction(params: { txid: string; populated?: boolean }) {
const { txid, populated } = params;
const url = `${this.apiUrl}/tx/${txid}${populated ? '/populated' : ''}`;
return this._request({ method: 'GET', url, json: true });
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-client/src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export class Storage {
return this.storageType.getAddress({ name, address, keepAlive: true, open: true });
}

async getAddresses(params: { name: string, limit?: number, skip?: number }) {
async getAddresses(params: { name: string; limit?: number; skip?: number }) {
const { name, limit, skip } = params;
return this.storageType.getAddresses({ name, limit, skip });
}
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-client/src/storage/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class Mongo {
}
}

async getAddress(params: { name: string; address: string, keepAlive: boolean; open: boolean }) {
async getAddress(params: { name: string; address: string; keepAlive: boolean; open: boolean }) {
const { name, address, keepAlive, open } = params;
const data = await this.getKey({ address, name, keepAlive, open });
if (!data) {
Expand Down
10 changes: 5 additions & 5 deletions packages/bitcore-client/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ export class Wallet {
* @param params.hex Return the balance in hex
* @returns
*/
getBalance(params: { time?: string, token?: string, tokenName?: string, address?: string; hex?: boolean } = {}) {
getBalance(params: { time?: string; token?: string; tokenName?: string; address?: string; hex?: boolean } = {}) {
const { time, token, tokenName, address, hex } = params;
let payload;
if (token || tokenName) {
Expand All @@ -348,7 +348,7 @@ export class Wallet {
return this.client.getBalance({ payload, pubKey: this.authPubKey, time, address, hex });
}

getNetworkFee(params: { target?: number, txType?: number } = {}) {
getNetworkFee(params: { target?: number; txType?: number } = {}) {
const target = params.target || 2;
const txType = params.txType;
return this.client.getFee({ target, txType });
Expand Down Expand Up @@ -400,7 +400,7 @@ export class Wallet {
* @param tokenName The `name` field on the token object
* @param token The `symbol` field on the token object (deprecated)
*/
getTokenObj(params: { tokenName?: string, token?: string }) {
getTokenObj(params: { tokenName?: string; token?: string }) {
const { tokenName, token } = params || {};
if (!tokenName && !token) {
return null;
Expand Down Expand Up @@ -590,12 +590,12 @@ export class Wallet {
return this.client.broadcast({ payload });
}

async getTransactionByTxid(params: { txid: string, populated?: boolean }) {
async getTransactionByTxid(params: { txid: string; populated?: boolean }) {
const { txid, populated } = params;
return this.client.getTransaction({ txid, populated });
}

async importKeys(params: { keys: KeyImport[], rederiveAddys?: boolean }) {
async importKeys(params: { keys: KeyImport[]; rederiveAddys?: boolean }) {
const { encryptionKey } = this.unlocked;
const { rederiveAddys } = params;
let { keys } = params;
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-wallet-client/src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3990,7 +3990,7 @@ export interface Status {
address: string;
amount: number;
path: string;
}>
}>;
};
customData?: {
walletPrivKey?: string; // used for multisig join secret
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-wallet-client/src/lib/bulkclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,5 +260,5 @@ export interface StatusAll {
wallet?: {
status: string;
secret?: string;
}
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface IBaseEncrypted {
ts: number;
mode: 'ccm';
adata: string;
cipher: 'aes',
cipher: 'aes';
ct: string;
}

Expand Down
16 changes: 8 additions & 8 deletions packages/bitcore-wallet-client/src/lib/key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export interface KeyOptions {
seedData?: any;
passphrase?: string; // seed passphrase
password?: string; // encrypting password
encryptionOpts?: { iter?: number; }; // options for encryption
encryptionOpts?: { iter?: number }; // options for encryption
use0forBCH?: boolean;
useLegacyPurpose?: boolean;
useLegacyCoinType?: boolean;
Expand Down Expand Up @@ -647,7 +647,7 @@ export class Key {
password: PasswordMaybe,
opts: {
path: string;
requestPrivKey?: string | Bitcore.PrivateKey
requestPrivKey?: string | Bitcore.PrivateKey;
}
) {
$.shouldBeString(opts.path);
Expand Down Expand Up @@ -761,7 +761,7 @@ export class Key {
}
};

#setPrivKey(params: { value: any; algo?: KeyAlgorithm; }) {
#setPrivKey(params: { value: any; algo?: KeyAlgorithm }) {
const { value, algo } = params;
switch (algo?.toUpperCase?.()) {
case (Constants.ALGOS.EDDSA):
Expand All @@ -772,7 +772,7 @@ export class Key {
}
}

#setPrivKeyEncrypted(params: { value: string; algo?: KeyAlgorithm; }) {
#setPrivKeyEncrypted(params: { value: string; algo?: KeyAlgorithm }) {
const { value, algo } = params;
switch (algo?.toUpperCase?.()) {
case (Constants.ALGOS.EDDSA):
Expand All @@ -783,7 +783,7 @@ export class Key {
}
}

#setFingerprint(params: { value: string; algo?: KeyAlgorithm; }) {
#setFingerprint(params: { value: string; algo?: KeyAlgorithm }) {
const { value, algo } = params;
switch (algo?.toUpperCase?.()) {
case (Constants.ALGOS.EDDSA):
Expand All @@ -794,7 +794,7 @@ export class Key {
}
}

#getPrivKey(params: { algo?: KeyAlgorithm; } = {}) {
#getPrivKey(params: { algo?: KeyAlgorithm } = {}) {
const { algo } = params;
switch (algo?.toUpperCase?.()) {
case (Constants.ALGOS.EDDSA):
Expand All @@ -804,7 +804,7 @@ export class Key {
}
}

#getPrivKeyEncrypted(params: { algo?: KeyAlgorithm; } = {}) {
#getPrivKeyEncrypted(params: { algo?: KeyAlgorithm } = {}) {
const { algo } = params;
switch (algo?.toUpperCase?.()) {
case (Constants.ALGOS.EDDSA):
Expand All @@ -814,7 +814,7 @@ export class Key {
}
}

#getFingerprint(params: { algo?: KeyAlgorithm; } = {}) {
#getFingerprint(params: { algo?: KeyAlgorithm } = {}) {
const { algo } = params;
switch (algo?.toUpperCase?.()) {
case (Constants.ALGOS.EDDSA):
Expand Down
16 changes: 8 additions & 8 deletions packages/bitcore-wallet-client/src/lib/tsskey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ export interface ITssKey extends Key {
reducedPrivateKeyShare?: Buffer;
reducedPrivateKeyShareEncrypted?: string;
commonKeyChain: string;
},
};
metadata: {
id: string;
m: number;
n: number;
partyId: number;
}
};
};

export interface TssExportedKey extends ExportedKey {
Expand Down Expand Up @@ -313,7 +313,7 @@ export class TssKeyGen extends EventEmitter {
* ECIES.encrypt: Use a deterministic IV
*/
deterministicIv?: boolean;
}
};
}): string {
const { partyId, partyPubKey, opts } = params;
const extra = params.extra || '';
Expand Down Expand Up @@ -648,9 +648,9 @@ export class TssKeyGen extends EventEmitter {
}

async createWallet(params: {
walletName: string,
copayerName: string,
opts?: CreateWalletOpts & { addressType?: string }
walletName: string;
copayerName: string;
opts?: CreateWalletOpts & { addressType?: string };
}) {
const { walletName, copayerName, opts = {} } = params;
const key = this.getTssKey();
Expand Down Expand Up @@ -684,11 +684,11 @@ export class TssKeyGen extends EventEmitter {
}

async joinWallet(params: {
copayerName: string,
copayerName: string;
opts?: {
coin?: string;
dryRun?: boolean;
}
};
}) {
const { copayerName, opts = {} } = params;
const key = this.getTssKey();
Expand Down
Loading