diff --git a/packages/bitcore-cli/src/cli-commands.ts b/packages/bitcore-cli/src/cli-commands.ts index 30342bcc4e7..dd0eeea3564 100644 --- a/packages/bitcore-cli/src/cli-commands.ts +++ b/packages/bitcore-cli/src/cli-commands.ts @@ -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 = { diff --git a/packages/bitcore-cli/src/commands/addresses.ts b/packages/bitcore-cli/src/commands/addresses.ts index 34e763b7df9..4a9434841c6 100755 --- a/packages/bitcore-cli/src/commands/addresses.ts +++ b/packages/bitcore-cli/src/commands/addresses.ts @@ -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)); diff --git a/packages/bitcore-cli/src/commands/derive.ts b/packages/bitcore-cli/src/commands/derive.ts index 0b40cc687e6..b5bdc583aca 100755 --- a/packages/bitcore-cli/src/commands/derive.ts +++ b/packages/bitcore-cli/src/commands/derive.ts @@ -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)); diff --git a/packages/bitcore-cli/src/commands/join/index.ts b/packages/bitcore-cli/src/commands/join/index.ts index ecf9416974e..6929adc3e8b 100644 --- a/packages/bitcore-cli/src/commands/join/index.ts +++ b/packages/bitcore-cli/src/commands/join/index.ts @@ -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(); diff --git a/packages/bitcore-cli/src/commands/join/joinMultiSig.ts b/packages/bitcore-cli/src/commands/join/joinMultiSig.ts index a5047b478c2..ba91a754645 100644 --- a/packages/bitcore-cli/src/commands/join/joinMultiSig.ts +++ b/packages/bitcore-cli/src/commands/join/joinMultiSig.ts @@ -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; diff --git a/packages/bitcore-cli/src/commands/join/joinThresholdSig.ts b/packages/bitcore-cli/src/commands/join/joinThresholdSig.ts index 058e81497b7..483c8b6ef31 100644 --- a/packages/bitcore-cli/src/commands/join/joinThresholdSig.ts +++ b/packages/bitcore-cli/src/commands/join/joinThresholdSig.ts @@ -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; diff --git a/packages/bitcore-cli/src/prompts.ts b/packages/bitcore-cli/src/prompts.ts index 432de3deced..ffacb529aa8 100644 --- a/packages/bitcore-cli/src/prompts.ts +++ b/packages/bitcore-cli/src/prompts.ts @@ -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) { diff --git a/packages/bitcore-cli/src/utils.ts b/packages/bitcore-cli/src/utils.ts index 4507cd3321c..04a3eeec9b1 100644 --- a/packages/bitcore-cli/src/utils.ts +++ b/packages/bitcore-cli/src/utils.ts @@ -137,12 +137,12 @@ export class Utils { } static async paginate( - fn: (page: number, action?: string) => Promise<{ result?: any[], extraChoices?: prompt.Option[] }>, + fn: (page: number, action?: string) => Promise<{ result?: any[]; extraChoices?: prompt.Option[] }>, 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 || {}; diff --git a/packages/bitcore-cli/src/wallet.ts b/packages/bitcore-cli/src/wallet.ts index 7c1b99b6e4d..442c5ae8fbd 100644 --- a/packages/bitcore-cli/src/wallet.ts +++ b/packages/bitcore-cli/src/wallet.ts @@ -94,7 +94,7 @@ export class Wallet implements IWallet { async getClient(args: { mustBeNew?: boolean; mustExist?: boolean; - doNotComplete?: boolean + doNotComplete?: boolean; }): Promise { const { mustBeNew, mustExist, doNotComplete } = args; @@ -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 }); } @@ -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; @@ -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) { diff --git a/packages/bitcore-cli/types/create.d.ts b/packages/bitcore-cli/types/create.d.ts index b1373b1d441..7370b679aac 100644 --- a/packages/bitcore-cli/types/create.d.ts +++ b/packages/bitcore-cli/types/create.d.ts @@ -6,5 +6,5 @@ export interface CreateWalletArgs { verbose: boolean; mnemonic?: string; isMultiParty?: boolean; - } + }; } \ No newline at end of file diff --git a/packages/bitcore-cli/types/wallet.d.ts b/packages/bitcore-cli/types/wallet.d.ts index 1ffe2766198..8ae204b2700 100644 --- a/packages/bitcore-cli/types/wallet.d.ts +++ b/packages/bitcore-cli/types/wallet.d.ts @@ -34,7 +34,7 @@ export interface IWallet { getClient(args: { mustBeNew?: boolean; mustExist?: boolean; - doNotComplete?: boolean + doNotComplete?: boolean; }): Promise; create(args: { coin?: string; @@ -56,9 +56,9 @@ export interface IWallet { addressType?: string; copayerName: string; }): Promise<{ key: TssKeyType; creds: Credentials }>; - register(args: { copayerName: string; }): Promise; - load(opts?: { doNotComplete?: boolean; allowCache?: boolean; }): Promise; - save(opts?: { encryptAll?: boolean; }): Promise; + register(args: { copayerName: string }): Promise; + load(opts?: { doNotComplete?: boolean; allowCache?: boolean }): Promise; + save(opts?: { encryptAll?: boolean }): Promise; export(args: { filename: string; exportPassword?: string; @@ -75,7 +75,7 @@ export interface IWallet { getNativeCurrency(fallback?: boolean): Promise; getPasswordWithRetry(): Promise; signTxp(args: { txp: Txp }): Promise>; - signAndBroadcastTxp(args: { txp: Txp; }): Promise; + signAndBroadcastTxp(args: { txp: Txp }): Promise; signMessage(args: { message: string; derivationPath: string; diff --git a/packages/bitcore-client/src/client.ts b/packages/bitcore-client/src/client.ts index a67b8686306..da0aaef6dc7 100644 --- a/packages/bitcore-client/src/client.ts +++ b/packages/bitcore-client/src/client.ts @@ -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 }); diff --git a/packages/bitcore-client/src/storage.ts b/packages/bitcore-client/src/storage.ts index e46d391a387..ca43ba97198 100644 --- a/packages/bitcore-client/src/storage.ts +++ b/packages/bitcore-client/src/storage.ts @@ -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 }); } diff --git a/packages/bitcore-client/src/storage/mongo.ts b/packages/bitcore-client/src/storage/mongo.ts index 7646c79b072..d0dc10d78c4 100644 --- a/packages/bitcore-client/src/storage/mongo.ts +++ b/packages/bitcore-client/src/storage/mongo.ts @@ -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) { diff --git a/packages/bitcore-client/src/wallet.ts b/packages/bitcore-client/src/wallet.ts index ea42b54194d..1f27282d643 100644 --- a/packages/bitcore-client/src/wallet.ts +++ b/packages/bitcore-client/src/wallet.ts @@ -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) { @@ -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 }); @@ -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; @@ -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; diff --git a/packages/bitcore-wallet-client/src/lib/api.ts b/packages/bitcore-wallet-client/src/lib/api.ts index d091de6e556..9c6635db4ee 100644 --- a/packages/bitcore-wallet-client/src/lib/api.ts +++ b/packages/bitcore-wallet-client/src/lib/api.ts @@ -3990,7 +3990,7 @@ export interface Status { address: string; amount: number; path: string; - }> + }>; }; customData?: { walletPrivKey?: string; // used for multisig join secret diff --git a/packages/bitcore-wallet-client/src/lib/bulkclient.ts b/packages/bitcore-wallet-client/src/lib/bulkclient.ts index 6805d01f8c9..a7513d7aff7 100644 --- a/packages/bitcore-wallet-client/src/lib/bulkclient.ts +++ b/packages/bitcore-wallet-client/src/lib/bulkclient.ts @@ -260,5 +260,5 @@ export interface StatusAll { wallet?: { status: string; secret?: string; - } + }; }; \ No newline at end of file diff --git a/packages/bitcore-wallet-client/src/lib/common/encryption.ts b/packages/bitcore-wallet-client/src/lib/common/encryption.ts index 83f3417d568..c8d68350948 100644 --- a/packages/bitcore-wallet-client/src/lib/common/encryption.ts +++ b/packages/bitcore-wallet-client/src/lib/common/encryption.ts @@ -16,7 +16,7 @@ export interface IBaseEncrypted { ts: number; mode: 'ccm'; adata: string; - cipher: 'aes', + cipher: 'aes'; ct: string; } diff --git a/packages/bitcore-wallet-client/src/lib/key.ts b/packages/bitcore-wallet-client/src/lib/key.ts index 03959d8ab97..dec4fc961f6 100644 --- a/packages/bitcore-wallet-client/src/lib/key.ts +++ b/packages/bitcore-wallet-client/src/lib/key.ts @@ -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; @@ -647,7 +647,7 @@ export class Key { password: PasswordMaybe, opts: { path: string; - requestPrivKey?: string | Bitcore.PrivateKey + requestPrivKey?: string | Bitcore.PrivateKey; } ) { $.shouldBeString(opts.path); @@ -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): @@ -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): @@ -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): @@ -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): @@ -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): @@ -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): diff --git a/packages/bitcore-wallet-client/src/lib/tsskey.ts b/packages/bitcore-wallet-client/src/lib/tsskey.ts index f393873f023..c6bcded0406 100644 --- a/packages/bitcore-wallet-client/src/lib/tsskey.ts +++ b/packages/bitcore-wallet-client/src/lib/tsskey.ts @@ -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 { @@ -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 || ''; @@ -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(); @@ -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(); diff --git a/packages/crypto-wallet-core/package-lock.json b/packages/crypto-wallet-core/package-lock.json index 46347bbab0b..71c04bb948c 100644 --- a/packages/crypto-wallet-core/package-lock.json +++ b/packages/crypto-wallet-core/package-lock.json @@ -17,6 +17,7 @@ "ed25519-hd-key": "^1.3.0", "ethers": "6.13.5", "info": "0.0.6-beta.0", + "ripple-binary-codec": "^1.10.0", "web3": "1.4.0", "xrpl": "2.13.0" }, @@ -1750,9 +1751,10 @@ "dev": true }, "node_modules/base-x": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.8.tgz", - "integrity": "sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA==", + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.11.tgz", + "integrity": "sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA==", + "license": "MIT", "dependencies": { "safe-buffer": "^5.0.1" } @@ -5360,6 +5362,60 @@ "inherits": "^2.0.1" } }, + "node_modules/ripple-address-codec": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-4.3.1.tgz", + "integrity": "sha512-Qa3+9wKVvpL/xYtT6+wANsn0A1QcC5CT6IMZbRJZ/1lGt7gmwIfsrCuz1X0+LCEO7zgb+3UT1I1dc0k/5dwKQQ==", + "license": "ISC", + "dependencies": { + "base-x": "^3.0.9", + "create-hash": "^1.1.2" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/ripple-binary-codec": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-1.11.0.tgz", + "integrity": "sha512-g7+gs3T+NfoeW6vIq5dcN0CkIT4t/zwRzFxz8X2RzfbrWRnewPUKqQbmBgs05tXLX5NuWPaneiaAVpFpYBcdfw==", + "license": "ISC", + "dependencies": { + "assert": "^2.0.0", + "big-integer": "^1.6.48", + "buffer": "6.0.3", + "create-hash": "^1.2.0", + "decimal.js": "^10.2.0", + "ripple-address-codec": "^4.3.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/ripple-binary-codec/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/rlp": { "version": "2.2.6", "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.6.tgz", @@ -7835,14 +7891,6 @@ "ripple-keypairs": "^1.1.5" } }, - "node_modules/xrpl-secret-numbers/node_modules/base-x": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, "node_modules/xrpl-secret-numbers/node_modules/bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", @@ -7872,18 +7920,6 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "node_modules/xrpl-secret-numbers/node_modules/ripple-address-codec": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-4.3.1.tgz", - "integrity": "sha512-Qa3+9wKVvpL/xYtT6+wANsn0A1QcC5CT6IMZbRJZ/1lGt7gmwIfsrCuz1X0+LCEO7zgb+3UT1I1dc0k/5dwKQQ==", - "dependencies": { - "base-x": "^3.0.9", - "create-hash": "^1.1.2" - }, - "engines": { - "node": ">= 10" - } - }, "node_modules/xrpl-secret-numbers/node_modules/ripple-keypairs": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/ripple-keypairs/-/ripple-keypairs-1.3.1.tgz", @@ -7899,42 +7935,11 @@ "node": ">= 10" } }, - "node_modules/xrpl/node_modules/base-x": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, "node_modules/xrpl/node_modules/bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" }, - "node_modules/xrpl/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "node_modules/xrpl/node_modules/elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", @@ -7959,34 +7964,6 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "node_modules/xrpl/node_modules/ripple-address-codec": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-4.3.1.tgz", - "integrity": "sha512-Qa3+9wKVvpL/xYtT6+wANsn0A1QcC5CT6IMZbRJZ/1lGt7gmwIfsrCuz1X0+LCEO7zgb+3UT1I1dc0k/5dwKQQ==", - "dependencies": { - "base-x": "^3.0.9", - "create-hash": "^1.1.2" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/xrpl/node_modules/ripple-binary-codec": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-1.10.0.tgz", - "integrity": "sha512-qWXxubgXBV3h5NTaaLiusZ1FhPqSy+bCYHHarfZ3bMmO2alRa1Ox61jvX1Zyozok8PcF3gs3bKwZci4RTlA07w==", - "dependencies": { - "assert": "^2.0.0", - "big-integer": "^1.6.48", - "buffer": "6.0.3", - "create-hash": "^1.2.0", - "decimal.js": "^10.2.0", - "ripple-address-codec": "^4.3.1" - }, - "engines": { - "node": ">= 10" - } - }, "node_modules/xrpl/node_modules/ripple-keypairs": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/ripple-keypairs/-/ripple-keypairs-1.3.1.tgz", diff --git a/packages/crypto-wallet-core/package.json b/packages/crypto-wallet-core/package.json index 8590a7b0e53..e5e11539347 100644 --- a/packages/crypto-wallet-core/package.json +++ b/packages/crypto-wallet-core/package.json @@ -36,6 +36,7 @@ "ed25519-hd-key": "^1.3.0", "ethers": "6.13.5", "info": "0.0.6-beta.0", + "ripple-binary-codec": "^1.10.0", "web3": "1.4.0", "xrpl": "2.13.0" }, diff --git a/packages/crypto-wallet-core/src/derivation/sol/index.ts b/packages/crypto-wallet-core/src/derivation/sol/index.ts index 3dd7ccc2b31..178cc186f71 100644 --- a/packages/crypto-wallet-core/src/derivation/sol/index.ts +++ b/packages/crypto-wallet-core/src/derivation/sol/index.ts @@ -29,7 +29,7 @@ export class SolDeriver implements IDeriver { return this.derivePrivateKeyWithPath(network, xPriv, path, addressType); }; - deriveChild(masterKey: { key: Buffer, chainCode: Buffer }, path: string) { + deriveChild(masterKey: { key: Buffer; chainCode: Buffer }, path: string) { const HARDENED_OFFSET = 0x80000000; const segmented = path .split('/') diff --git a/packages/crypto-wallet-core/src/message/btc.ts b/packages/crypto-wallet-core/src/message/btc.ts index f824e66e958..2f8dca1199b 100644 --- a/packages/crypto-wallet-core/src/message/btc.ts +++ b/packages/crypto-wallet-core/src/message/btc.ts @@ -3,13 +3,13 @@ import { encodeBuffer } from '../utils'; import type { Encoding, HDKeyType, IMessageClass, ISignedMessage, KeyType } from '../types/message'; export class BtcMessage implements IMessageClass { - getMessageHash(args: { message: string, encoding?: Encoding }): Buffer | string { + getMessageHash(args: { message: string; encoding?: Encoding }): Buffer | string { const { message, encoding } = args; const buf = Buffer.from(new BitcoreLib.Message(message).magicHash()); return encodeBuffer(buf, encoding); } - signMessage(args: { message: string, privateKey: KeyType, encoding?: Encoding }): ISignedMessage { + signMessage(args: { message: string; privateKey: KeyType; encoding?: Encoding }): ISignedMessage { const { message, encoding } = args; let { privateKey } = args; privateKey = new BitcoreLib.PrivateKey(privateKey); @@ -20,7 +20,7 @@ export class BtcMessage implements IMessageClass { }; } - signMessageWithPath(args: { message: string, hdPrivateKey: HDKeyType, derivationPath: string, encoding?: Encoding }): ISignedMessage { + signMessageWithPath(args: { message: string; hdPrivateKey: HDKeyType; derivationPath: string; encoding?: Encoding }): ISignedMessage { const { message, hdPrivateKey, derivationPath, encoding } = args; const privateKey = new BitcoreLib.HDPrivateKey(hdPrivateKey).deriveChild(derivationPath).privateKey; return this.signMessage({ message, privateKey, encoding }); diff --git a/packages/crypto-wallet-core/src/message/eth.ts b/packages/crypto-wallet-core/src/message/eth.ts index 19a24b22129..068b4379f62 100644 --- a/packages/crypto-wallet-core/src/message/eth.ts +++ b/packages/crypto-wallet-core/src/message/eth.ts @@ -5,8 +5,8 @@ import type { Encoding, HDKeyType, IMessageClass, ISignedMessage, KeyType } from export class EthMessage implements IMessageClass { getMessageHash(args: { - message: string, - encoding?: Encoding + message: string; + encoding?: Encoding; }): Buffer | string { const { message, encoding } = args; const prefix = '\x19Ethereum Signed Message:\n' + message.length; @@ -16,9 +16,9 @@ export class EthMessage implements IMessageClass { } signMessage(args: { - message: string, - privateKey: KeyType, - encoding?: Encoding + message: string; + privateKey: KeyType; + encoding?: Encoding; }): ISignedMessage { const { message, encoding } = args; let { privateKey } = args; @@ -35,10 +35,10 @@ export class EthMessage implements IMessageClass { } signMessageWithPath(args: { - message: string, - hdPrivateKey: HDKeyType, - derivationPath: string, - encoding?: Encoding + message: string; + hdPrivateKey: HDKeyType; + derivationPath: string; + encoding?: Encoding; }): ISignedMessage { const { message, hdPrivateKey, derivationPath, encoding } = args; const privateKey = new BitcoreLib.HDPrivateKey(hdPrivateKey).deriveChild(derivationPath).privateKey; diff --git a/packages/crypto-wallet-core/src/message/index.ts b/packages/crypto-wallet-core/src/message/index.ts index 5bb07c4f455..8672dd1ca24 100644 --- a/packages/crypto-wallet-core/src/message/index.ts +++ b/packages/crypto-wallet-core/src/message/index.ts @@ -30,10 +30,10 @@ export class MessageProxy { } getMessageHash(args: { - chain: string, - message: string, + chain: string; + message: string; /** The encoding to use for the output. Will return a Buffer if not specified. */ - encoding?: Encoding + encoding?: Encoding; }): Buffer | string { const { message, chain, encoding } = args; const messageClass = this.get(chain); @@ -41,11 +41,11 @@ export class MessageProxy { } signMessage(args: { - chain: string, - message: string, - privateKey: KeyType, + chain: string; + message: string; + privateKey: KeyType; /** The encoding to use for the output. Will return a Buffer if not specified. */ - encoding?: Encoding + encoding?: Encoding; }): ISignedMessage { const { message, chain, privateKey, encoding } = args; const messageClass = this.get(chain); @@ -54,12 +54,12 @@ export class MessageProxy { } signMessageWithPath(args: { - chain: string, - message: string, - hdPrivateKey: HDKeyType, - derivationPath: string, + chain: string; + message: string; + hdPrivateKey: HDKeyType; + derivationPath: string; /** The encoding to use for the output. Will return a Buffer if not specified. */ - encoding?: Encoding + encoding?: Encoding; }): ISignedMessage { const { message, chain, hdPrivateKey, derivationPath, encoding } = args; const messageClass = this.get(chain); diff --git a/packages/crypto-wallet-core/src/transactions/btc/index.ts b/packages/crypto-wallet-core/src/transactions/btc/index.ts index a44cd0f768b..030ec4662c4 100644 --- a/packages/crypto-wallet-core/src/transactions/btc/index.ts +++ b/packages/crypto-wallet-core/src/transactions/btc/index.ts @@ -107,7 +107,7 @@ export class BTCTxProvider { return new this.lib.crypto.Signature({ r, s, i, nhashtype }).toString(); } - applySignature(params: { tx: BitcoreLib.Transaction; signature: SignatureType; index: number; sigtype?: number; }) { + applySignature(params: { tx: BitcoreLib.Transaction; signature: SignatureType; index: number; sigtype?: number }) { const { index, sigtype, tx } = params; let { signature } = params; assert(tx instanceof this.lib.Transaction, 'tx must be an instance of Transaction'); diff --git a/packages/crypto-wallet-core/src/transactions/eth/index.ts b/packages/crypto-wallet-core/src/transactions/eth/index.ts index 0f0174509ce..9a00714a747 100644 --- a/packages/crypto-wallet-core/src/transactions/eth/index.ts +++ b/packages/crypto-wallet-core/src/transactions/eth/index.ts @@ -167,12 +167,12 @@ export class ETHTxProvider { return this.applySignature({ tx, signature }); } - transformSignatureObject(params: { obj: any; }) { + transformSignatureObject(params: { obj: any }) { const { obj } = params; return ethers.Signature.from(obj).serialized; } - getSighash(params: { tx: string; }): string { + getSighash(params: { tx: string }): string { const { tx } = params; return ethers.keccak256(tx).slice(2); // remove 0x prefix } diff --git a/packages/crypto-wallet-core/src/transactions/sol/index.ts b/packages/crypto-wallet-core/src/transactions/sol/index.ts index f99ca085f37..0f6d78386af 100644 --- a/packages/crypto-wallet-core/src/transactions/sol/index.ts +++ b/packages/crypto-wallet-core/src/transactions/sol/index.ts @@ -12,7 +12,7 @@ export class SOLTxProvider { MINIMUM_PRIORITY_FEE = 1000; create(params: { - recipients: Array<{ address: string; amount: string; addressKeyPair?: SolKit.KeyPairSigner; }>; + recipients: Array<{ address: string; amount: string; addressKeyPair?: SolKit.KeyPairSigner }>; from: string; fee?: number; feeRate: number; @@ -180,7 +180,7 @@ export class SOLTxProvider { return SolKit.decompileTransactionMessage(compiledTransactionMessage); } - async sign(params: { tx: string; key: Key; }): Promise { + async sign(params: { tx: string; key: Key }): Promise { const { tx, key } = params; const decodedTx = this.decodeRawTransaction({ rawTx: tx, decodeTransactionMessage: false }); const privKeyBytes = SolKit.getBase58Encoder().encode(key.privKey); @@ -262,7 +262,7 @@ export class SOLTxProvider { return SolKit.getBase64EncodedWireTransaction(signedTx); } - getHash(params: { tx: string; }): string { + getHash(params: { tx: string }): string { const { tx } = params; const decodedTx = this.decodeRawTransaction({ rawTx: tx, decodeTransactionMessage: false }); const pubKeys = Object.keys(decodedTx.signatures); @@ -286,7 +286,7 @@ export class SOLTxProvider { return SolKit.getBase58Decoder().decode(signature); } - getSighash(_params: { tx: string; }): string { + getSighash(_params: { tx: string }): string { return null; // TODO } } \ No newline at end of file diff --git a/packages/crypto-wallet-core/src/transactions/spl/index.ts b/packages/crypto-wallet-core/src/transactions/spl/index.ts index cc82da2132d..6f0311ab27a 100644 --- a/packages/crypto-wallet-core/src/transactions/spl/index.ts +++ b/packages/crypto-wallet-core/src/transactions/spl/index.ts @@ -144,7 +144,7 @@ export class SPLTxProvider extends SOLTxProvider { } interface CreateParams { - recipients: Array<{ address: string; amount: string; addressKeyPair?: SolKit.KeyPairSigner; }>; + recipients: Array<{ address: string; amount: string; addressKeyPair?: SolKit.KeyPairSigner }>; from: string; fee?: number; feeRate: number; @@ -158,7 +158,7 @@ interface CreateParams { computeUnits?: number; memo?: string; // account creation fields - fromKeyPair?: SolKit.KeyPairSigner, + fromKeyPair?: SolKit.KeyPairSigner; space?: number; // amount of space to reserve a new account in bytes instructions?: Array; // SPL token transfer fields (required for token transfers) diff --git a/packages/crypto-wallet-core/src/transactions/xrp/index.ts b/packages/crypto-wallet-core/src/transactions/xrp/index.ts index c811200eeac..194ad00cc4b 100644 --- a/packages/crypto-wallet-core/src/transactions/xrp/index.ts +++ b/packages/crypto-wallet-core/src/transactions/xrp/index.ts @@ -1,8 +1,8 @@ import { createHash } from 'crypto'; +import * as RBC from 'ripple-binary-codec'; +import * as binary from 'ripple-binary-codec/dist/binary'; +import { HashPrefix } from 'ripple-binary-codec/dist/hash-prefixes'; import * as xrpl from 'xrpl'; -import * as RBC from 'xrpl/node_modules/ripple-binary-codec'; -import * as binary from 'xrpl/node_modules/ripple-binary-codec/dist/binary'; -import { HashPrefix } from 'xrpl/node_modules/ripple-binary-codec/dist/hash-prefixes'; import { BTCTxProvider } from '../btc'; import type { Key } from '../../types/derivation'; @@ -88,7 +88,7 @@ export class XRPTxProvider { return this.sha512Half(prefix + tx); } - applySignature(params: { tx: string; signature: string; pubKey: string; }): string { + applySignature(params: { tx: string; signature: string; pubKey: string }): string { const { tx, signature, pubKey } = params; const txJSON = (xrpl.decode(tx) as any) as xrpl.Transaction; txJSON.TxnSignature = signature; @@ -111,7 +111,7 @@ export class XRPTxProvider { .slice(0, 64); } - transformSignatureObject(params: { obj: any; }) { + transformSignatureObject(params: { obj: any }) { const { obj } = params; return new BTCTxProvider().transformSignatureObject({ obj }); } diff --git a/packages/crypto-wallet-core/src/types/message.ts b/packages/crypto-wallet-core/src/types/message.ts index 16a6fdd3eaa..90ef1706459 100644 --- a/packages/crypto-wallet-core/src/types/message.ts +++ b/packages/crypto-wallet-core/src/types/message.ts @@ -9,7 +9,7 @@ export interface ISignedMessage { } export interface IMessageClass { - getMessageHash(args: { message: string, encoding?: Encoding }): Buffer | string; - signMessage(args: { message: string, privateKey: KeyType, encoding?: Encoding }): ISignedMessage; - signMessageWithPath(args: { message: string, hdPrivateKey: HDKeyType, derivationPath: string, encoding?: Encoding }): ISignedMessage; + getMessageHash(args: { message: string; encoding?: Encoding }): Buffer | string; + signMessage(args: { message: string; privateKey: KeyType; encoding?: Encoding }): ISignedMessage; + signMessageWithPath(args: { message: string; hdPrivateKey: HDKeyType; derivationPath: string; encoding?: Encoding }): ISignedMessage; } \ No newline at end of file