diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e658d3d822..304cb32d2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,6 +69,9 @@ jobs: - name: Dependency Audit run: yarn run improved-yarn-audit --min-severity high + - name: Print prettier version + run: ./node_modules/.bin/prettier --version + - name: Lint Source Code run: yarn run lint diff --git a/modules/abstract-cosmos/resources/MsgCompiled.js b/modules/abstract-cosmos/resources/MsgCompiled.js index e3e3e2b1ae..4ce4bf91ac 100644 --- a/modules/abstract-cosmos/resources/MsgCompiled.js +++ b/modules/abstract-cosmos/resources/MsgCompiled.js @@ -498,8 +498,8 @@ $root.common = (function () { options.longs === String ? $util.Long.prototype.toString.call(message.decimals) : options.longs === Number - ? new $util.LongBits(message.decimals.low >>> 0, message.decimals.high >>> 0).toNumber() - : message.decimals; + ? new $util.LongBits(message.decimals.low >>> 0, message.decimals.high >>> 0).toNumber() + : message.decimals; return object; }; @@ -1678,8 +1678,8 @@ $root.types = (function () { options.bytes === String ? $util.base64.encode(message.signer, 0, message.signer.length) : options.bytes === Array - ? Array.prototype.slice.call(message.signer) - : message.signer; + ? Array.prototype.slice.call(message.signer) + : message.signer; return object; }; @@ -1945,15 +1945,15 @@ $root.types = (function () { options.bytes === String ? $util.base64.encode(message.fromAddress, 0, message.fromAddress.length) : options.bytes === Array - ? Array.prototype.slice.call(message.fromAddress) - : message.fromAddress; + ? Array.prototype.slice.call(message.fromAddress) + : message.fromAddress; if (message.toAddress != null && message.hasOwnProperty('toAddress')) object.toAddress = options.bytes === String ? $util.base64.encode(message.toAddress, 0, message.toAddress.length) : options.bytes === Array - ? Array.prototype.slice.call(message.toAddress) - : message.toAddress; + ? Array.prototype.slice.call(message.toAddress) + : message.toAddress; if (message.amount && message.amount.length) { object.amount = []; for (var j = 0; j < message.amount.length; ++j) diff --git a/modules/abstract-eth/src/abstractEthLikeNewCoins.ts b/modules/abstract-eth/src/abstractEthLikeNewCoins.ts index 3e2d3ba3f7..4fa6a65da2 100644 --- a/modules/abstract-eth/src/abstractEthLikeNewCoins.ts +++ b/modules/abstract-eth/src/abstractEthLikeNewCoins.ts @@ -1367,8 +1367,8 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin { const gasPrice = params.eip1559 ? new optionalDeps.ethUtil.BN(params.eip1559.maxFeePerGas) : params.gasPrice - ? new optionalDeps.ethUtil.BN(this.setGasPrice(params.gasPrice)) - : await this.getGasPriceFromExternalAPI(); + ? new optionalDeps.ethUtil.BN(this.setGasPrice(params.gasPrice)) + : await this.getGasPriceFromExternalAPI(); const bitgoFeeAddressNonce = await this.getAddressNonce(bitgoFeeAddress); diff --git a/modules/bitgo/.mocharc.yml b/modules/bitgo/.mocharc.yml index e45f770826..4d679fec18 100644 --- a/modules/bitgo/.mocharc.yml +++ b/modules/bitgo/.mocharc.yml @@ -4,4 +4,4 @@ reporter: 'min' reporter-option: - 'cdn=true' - 'json=false' -exit: true \ No newline at end of file +exit: true diff --git a/modules/bitgo/test/integration/index.html b/modules/bitgo/test/integration/index.html index 32c4c42e4e..1c7afb24fc 100644 --- a/modules/bitgo/test/integration/index.html +++ b/modules/bitgo/test/integration/index.html @@ -1,4 +1,4 @@ - + Mocha diff --git a/modules/bitgo/test/integration/wallet.ts b/modules/bitgo/test/integration/wallet.ts index 1cea20b960..c5c26154a7 100644 --- a/modules/bitgo/test/integration/wallet.ts +++ b/modules/bitgo/test/integration/wallet.ts @@ -1501,15 +1501,15 @@ describe('Wallet API', function () { amount: 0.01 * 1e8, }); recipients[TestBitGo.TEST_WALLET2_ADDRESS] = 0.01 * 1e8; - return TransactionBuilder.createTransaction({ wallet: wallet1, recipients: recipients }).then(function ( - result - ) { - result.should.have.property('unspents'); - result.txInfo.nP2pkhInputs.should.equal(15); - result.should.have.property('fee'); - result.should.have.property('feeRate'); - result.walletId.should.equal(wallet1.id()); - }); + return TransactionBuilder.createTransaction({ wallet: wallet1, recipients: recipients }).then( + function (result) { + result.should.have.property('unspents'); + result.txInfo.nP2pkhInputs.should.equal(15); + result.should.have.property('fee'); + result.should.have.property('feeRate'); + result.walletId.should.equal(wallet1.id()); + } + ); }); it('Filter uneconomic unspents test, no feerate set', function () { @@ -1658,14 +1658,14 @@ describe('Wallet API', function () { amount: 0.01 * 1e8, }); recipients[TestBitGo.TEST_WALLET2_ADDRESS] = 0.01 * 1e8; - return TransactionBuilder.createTransaction({ wallet: wallet1, recipients: recipients }).then(function ( - result - ) { - result.should.have.property('unspents'); - result.should.have.property('fee'); - result.should.have.property('feeRate'); - result.walletId.should.equal(wallet1.id()); - }); + return TransactionBuilder.createTransaction({ wallet: wallet1, recipients: recipients }).then( + function (result) { + result.should.have.property('unspents'); + result.should.have.property('fee'); + result.should.have.property('feeRate'); + result.walletId.should.equal(wallet1.id()); + } + ); }); }); diff --git a/modules/bitgo/test/v2/unit/coins/utxo/transaction.ts b/modules/bitgo/test/v2/unit/coins/utxo/transaction.ts index ac0c97dcc9..fcdc3314af 100644 --- a/modules/bitgo/test/v2/unit/coins/utxo/transaction.ts +++ b/modules/bitgo/test/v2/unit/coins/utxo/transaction.ts @@ -453,8 +453,8 @@ function run( v === undefined || v instanceof utxolib.bitgo.UtxoPsbt ? undefined : v instanceof utxolib.bitgo.UtxoTransaction - ? transactionToObj(v) - : transactionHexToObj(v.txHex, coin.network, amountType) + ? transactionToObj(v) + : transactionHexToObj(v.txHex, coin.network, amountType) ) as TransactionObjStages; } @@ -563,10 +563,10 @@ function run( stageName === 'prebuild' || pubs === undefined ? 0 : stageName.startsWith('halfSigned') - ? 1 - : stageName.startsWith('fullSigned') - ? 2 - : undefined; + ? 1 + : stageName.startsWith('fullSigned') + ? 2 + : undefined; explanation.inputSignatures.should.eql( // FIXME(BG-35154): implement signature verification for replay protection inputs diff --git a/modules/bitgo/test/v2/unit/internal/tssUtils/ecdsa.ts b/modules/bitgo/test/v2/unit/internal/tssUtils/ecdsa.ts index 7885ac1f20..185c8e012b 100644 --- a/modules/bitgo/test/v2/unit/internal/tssUtils/ecdsa.ts +++ b/modules/bitgo/test/v2/unit/internal/tssUtils/ecdsa.ts @@ -144,9 +144,8 @@ describe('TSS Ecdsa Utils:', async function () { curve: 'secp256k1', }), ]; - [userGpgKey, userLocalBackupGpgKey, thirdPartyBackupGpgKeyPair, bitGoGPGKeyPair] = await Promise.all( - gpgKeyPromises - ); + [userGpgKey, userLocalBackupGpgKey, thirdPartyBackupGpgKeyPair, bitGoGPGKeyPair] = + await Promise.all(gpgKeyPromises); thirdPartyBackupPublicGpgKey = await openpgp.readKey({ armoredKey: thirdPartyBackupGpgKeyPair.publicKey }); bitgoPublicKey = await openpgp.readKey({ armoredKey: bitGoGPGKeyPair.publicKey }); const constants = { diff --git a/modules/blake2b-wasm/example.html b/modules/blake2b-wasm/example.html index 273c311dec..33d1fc09f6 100644 --- a/modules/blake2b-wasm/example.html +++ b/modules/blake2b-wasm/example.html @@ -1,4 +1,4 @@ - + Blake2b-WASM Demo diff --git a/modules/blockapis/src/BaseHttpClient.ts b/modules/blockapis/src/BaseHttpClient.ts index 9066ea8853..f03646d552 100644 --- a/modules/blockapis/src/BaseHttpClient.ts +++ b/modules/blockapis/src/BaseHttpClient.ts @@ -2,7 +2,10 @@ import * as superagent from 'superagent'; import * as Bluebird from 'bluebird'; export class ApiRequestError extends Error { - constructor(public url: string, public reason: Error | string) { + constructor( + public url: string, + public reason: Error | string + ) { super(`error in API request: ${url}: ${reason}`); } diff --git a/modules/blockapis/src/CachingHttpClient.ts b/modules/blockapis/src/CachingHttpClient.ts index c6b6cf2b84..5c1ee1b4b9 100644 --- a/modules/blockapis/src/CachingHttpClient.ts +++ b/modules/blockapis/src/CachingHttpClient.ts @@ -15,7 +15,10 @@ export class CachingHttpClient implements HttpClient { client: BaseHttpClient; isHttpEnabled: boolean; - constructor(private cacheDir: string, { client = new BaseHttpClient(), isHttpEnabled = true } = {}) { + constructor( + private cacheDir: string, + { client = new BaseHttpClient(), isHttpEnabled = true } = {} + ) { this.client = client; this.isHttpEnabled = isHttpEnabled; } diff --git a/modules/blockapis/src/impl/BlockchairApi.ts b/modules/blockapis/src/impl/BlockchairApi.ts index 9b6e5af406..035d6bb6d5 100644 --- a/modules/blockapis/src/impl/BlockchairApi.ts +++ b/modules/blockapis/src/impl/BlockchairApi.ts @@ -118,7 +118,10 @@ export class BlockchairApi implements AddressApi, UtxoApi { return new BlockchairApi(httpClient.withBaseUrl(`https://api.blockchair.com/${blockchain}`), params.apiToken); } - constructor(public client: HttpClient, apiToken?: string) { + constructor( + public client: HttpClient, + apiToken?: string + ) { this.apiToken = apiToken ?? process.env.BLOCKCHAIR_TOKEN; } diff --git a/modules/blockapis/test/UtxoApi.ts b/modules/blockapis/test/UtxoApi.ts index fc3249728d..3290f1db42 100644 --- a/modules/blockapis/test/UtxoApi.ts +++ b/modules/blockapis/test/UtxoApi.ts @@ -48,7 +48,11 @@ class TestCase { * @param methodName - method to test * @param args - method arguments */ - constructor(public coinName: string, public methodName: keyof UtxoApi, public args: unknown[]) {} + constructor( + public coinName: string, + public methodName: keyof UtxoApi, + public args: unknown[] + ) {} /** * Call the method on the given API. diff --git a/modules/bls-dkg/index.js b/modules/bls-dkg/index.js index b37eb2cd95..b6c0b8982f 100644 --- a/modules/bls-dkg/index.js +++ b/modules/bls-dkg/index.js @@ -184,9 +184,12 @@ function mergeSecretShares(shares) { /** Merge public shares to produce a common public key. */ function mergePublicShares(shares) { - const sum = shares.slice(1).reduce((sum, share) => { - return sum.add(bls.PointG1.fromCompressedHex(bigIntToBuffer(share))); - }, bls.PointG1.fromCompressedHex(bigIntToBuffer(shares[0]))); + const sum = shares.slice(1).reduce( + (sum, share) => { + return sum.add(bls.PointG1.fromCompressedHex(bigIntToBuffer(share))); + }, + bls.PointG1.fromCompressedHex(bigIntToBuffer(shares[0])) + ); return bufferToBigInt(sum.toCompressedHex()); } diff --git a/modules/express/EXTERNAL_SIGNER.md b/modules/express/EXTERNAL_SIGNER.md index b3939c073b..654cbb6057 100644 --- a/modules/express/EXTERNAL_SIGNER.md +++ b/modules/express/EXTERNAL_SIGNER.md @@ -30,15 +30,15 @@ The file is located at `src/fetchEncryptedPrivKeys.ts`. Before using this tool, 1. Fill in the `TODOs` by providing a valid `accessToken` as well as the list of `walletIds`, grouped by the cryptocurrency. 2. Using the same information as #1, update the .env file with the `accessToken` and `walletIds` information. -| Name | Value | Description | -| ----------------------------------------- | ------ | ---------------------------------------------- | -| BITGO_EXTERNAL_SIGNER_ENV | string | test | -| BITGO_EXTERNAL_SIGNER_ACCESS_TOKEN | string | Access token used for access BitGo Wallets | -| BITGO_EXTERNAL_SIGNER_WALLET_IDS | string | JSON formatted string of wallets and their | -| | | ids, the secret is optional for unencrypted | -| | | private material | -| BITGO_EXTERNAL_SIGNER_WALLET_IDS_WITH_PRV | string | JSON formatted string of wallets ids and | -| | | their encrypted private keys | +| Name | Value | Description | +| ----------------------------------------- | ------ | ------------------------------------------- | +| BITGO_EXTERNAL_SIGNER_ENV | string | test | +| BITGO_EXTERNAL_SIGNER_ACCESS_TOKEN | string | Access token used for access BitGo Wallets | +| BITGO_EXTERNAL_SIGNER_WALLET_IDS | string | JSON formatted string of wallets and their | +| | | ids, the secret is optional for unencrypted | +| | | private material | +| BITGO_EXTERNAL_SIGNER_WALLET_IDS_WITH_PRV | string | JSON formatted string of wallets ids and | +| | | their encrypted private keys | BITGO_EXTERNAL_SIGNER_WALLET_IDS examples: diff --git a/modules/express/README.md b/modules/express/README.md index aa0f4772a4..a9c9fef10c 100644 --- a/modules/express/README.md +++ b/modules/express/README.md @@ -80,6 +80,7 @@ $ docker run -it --volume /path/to/certs:/private -p 4000:4000 bitgo/express:lat ``` An alternative way to provide the ssl certification is to export them as environment variables. + ```bash $ export BITGO_SSL_KEY=$(cat /private/cert.key) $ export BITGO_SSL_CERT=$(cat /private/cert.cert) @@ -217,10 +218,10 @@ BitGo Express is able to take configuration options from either command line arg | -t | --timeout | `BITGO_TIMEOUT` | 305000 | Number of milliseconds to wait before requests made by `bitgo-express` time out. | | -d | --debug | N/A, use `BITGO_DEBUG_NAMESPACE` instead | N/A | Enable debug output for bitgo-express. This is equivalent to passing `--debugnamespace bitgo:express`. | | -D | --debugnamespace | `BITGO_DEBUG_NAMESPACE` | N/A | Enable debug output for a particular debug namespace. Multiple debug namespaces can be given as a comma separated list. See the [`bitgo` package README](https://github.com/BitGo/BitGoJS/blob/master/modules/bitgo/README.md#available-debug-namespaces) for a complete list of recognized options, in addition to those listed in the table below. | -| -k | --keypath | `BITGO_KEYPATH` | N/A | Path to SSL .key file (either `keypath` or `sslkey` required if running against production environment). | -| N/A | --sslkey | `BITGO_SSL_KEY` | N/A | The SSL key (either `keypath` or `sslkey` required if running against production environment). | +| -k | --keypath | `BITGO_KEYPATH` | N/A | Path to SSL .key file (either `keypath` or `sslkey` required if running against production environment). | +| N/A | --sslkey | `BITGO_SSL_KEY` | N/A | The SSL key (either `keypath` or `sslkey` required if running against production environment). | | -c | --crtpath | `BITGO_CRTPATH` | N/A | Path to SSL .crt file (required if running against production environment). | -| N/A | --sslcert | `BITGO_SSL_CERT` | N/A | The SSL cert (either `crtpath` or `sslcert` required if running against production environment). | +| N/A | --sslcert | `BITGO_SSL_CERT` | N/A | The SSL cert (either `crtpath` or `sslcert` required if running against production environment). | | -u | --customrooturi | `BITGO_CUSTOM_ROOT_URI` | N/A | Force a custom BitGo URI. | | -n | --custombitcoinnetwork | `BITGO_CUSTOM_BITCOIN_NETWORK` | N/A | Force a custom BitGo network | | -l | --logfile | `BITGO_LOGFILE` | N/A | Filepath to write access logs. | diff --git a/modules/express/bin/bitgo-express b/modules/express/bin/bitgo-express index 1954fd323b..1598a57a4c 100755 --- a/modules/express/bin/bitgo-express +++ b/modules/express/bin/bitgo-express @@ -11,8 +11,7 @@ process.on('unhandledRejection', (reason, promise) => { const { init } = require('../dist/src/expressApp'); if (require.main === module) { - init() - .catch(err => { + init().catch((err) => { console.log(`Fatal error: ${err.message}`); console.log(err.stack); }); diff --git a/modules/express/src/clientRoutes.ts b/modules/express/src/clientRoutes.ts index a205cee6ba..e7f466e06d 100755 --- a/modules/express/src/clientRoutes.ts +++ b/modules/express/src/clientRoutes.ts @@ -1229,9 +1229,11 @@ function prepareBitGo(config: Config) { } type RequestHandlerResponse = string | unknown | undefined | { status: number; body: unknown }; interface RequestHandler extends express.RequestHandler { - (req: express.Request, res: express.Response, next: express.NextFunction): - | RequestHandlerResponse - | Promise; + ( + req: express.Request, + res: express.Response, + next: express.NextFunction + ): RequestHandlerResponse | Promise; } function handleRequestHandlerError(res: express.Response, error: unknown) { diff --git a/modules/sdk-coin-ada/src/lib/transaction.ts b/modules/sdk-coin-ada/src/lib/transaction.ts index b834b41dc7..46e4248b4c 100644 --- a/modules/sdk-coin-ada/src/lib/transaction.ts +++ b/modules/sdk-coin-ada/src/lib/transaction.ts @@ -387,14 +387,14 @@ export class Transaction extends BaseTransaction { this._type === TransactionType.Send ? 'Transfer' : this._type === TransactionType.StakingActivate - ? 'StakingActivate' - : this._type === TransactionType.StakingWithdraw - ? 'StakingWithdraw' - : this._type === TransactionType.StakingDeactivate - ? 'StakingDeactivate' - : this._type === TransactionType.StakingPledge - ? 'StakingPledge' - : 'undefined'; + ? 'StakingActivate' + : this._type === TransactionType.StakingWithdraw + ? 'StakingWithdraw' + : this._type === TransactionType.StakingDeactivate + ? 'StakingDeactivate' + : this._type === TransactionType.StakingPledge + ? 'StakingPledge' + : 'undefined'; return { displayOrder, id: txJson.id, diff --git a/modules/sdk-coin-algo/src/lib/keyRegistrationBuilder.ts b/modules/sdk-coin-algo/src/lib/keyRegistrationBuilder.ts index a8be069a16..8c4726bf9e 100644 --- a/modules/sdk-coin-algo/src/lib/keyRegistrationBuilder.ts +++ b/modules/sdk-coin-algo/src/lib/keyRegistrationBuilder.ts @@ -130,8 +130,8 @@ export class KeyRegistrationBuilder extends TransactionBuilder { return this.isOfflineKeyRegAccountLibTransaction() ? this.buildOfflineKeyRegTransaction() : this.isNonParticipationKeyRegAccountLibTransaction() - ? this.buildNonParticipationKeyRegTransaction() - : this.buildOnlineKeyRegTransaction(); + ? this.buildNonParticipationKeyRegTransaction() + : this.buildOnlineKeyRegTransaction(); } private buildOfflineKeyRegTransaction(): algosdk.Transaction { diff --git a/modules/sdk-coin-hbar/src/lib/walletInitializationBuilder.ts b/modules/sdk-coin-hbar/src/lib/walletInitializationBuilder.ts index 64d3ab5f87..46faa2dab6 100644 --- a/modules/sdk-coin-hbar/src/lib/walletInitializationBuilder.ts +++ b/modules/sdk-coin-hbar/src/lib/walletInitializationBuilder.ts @@ -34,14 +34,17 @@ export class WalletInitializationBuilder extends TransactionBuilder { * @returns {proto.ThresholdKey} - The wallet threshold keys */ private buildOwnersKeys(rawKeys = true): proto.ThresholdKey { - return this._owners.reduce((tKeys, key) => { - if (tKeys.keys && tKeys.keys.keys) { - tKeys.keys.keys.push({ - ed25519: toUint8Array(new KeyPair({ pub: key }).getKeys(rawKeys).pub), - }); - } - return tKeys; - }, new proto.ThresholdKey({ threshold: 2, keys: { keys: [] } })); + return this._owners.reduce( + (tKeys, key) => { + if (tKeys.keys && tKeys.keys.keys) { + tKeys.keys.keys.push({ + ed25519: toUint8Array(new KeyPair({ pub: key }).getKeys(rawKeys).pub), + }); + } + return tKeys; + }, + new proto.ThresholdKey({ threshold: 2, keys: { keys: [] } }) + ); } /** @inheritdoc */ diff --git a/modules/sdk-coin-islm/resources/types/ethSecp256k1.ts b/modules/sdk-coin-islm/resources/types/ethSecp256k1.ts index 3d24d5775a..5bc3c2881f 100644 --- a/modules/sdk-coin-islm/resources/types/ethSecp256k1.ts +++ b/modules/sdk-coin-islm/resources/types/ethSecp256k1.ts @@ -166,12 +166,12 @@ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefi export type DeepPartial = T extends Builtin ? T : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial; + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; type KeysOfUnion = T extends T ? keyof T : never; export type Exact = P extends Builtin diff --git a/modules/sdk-coin-sui/src/lib/mystenlab/framework/framework.ts b/modules/sdk-coin-sui/src/lib/mystenlab/framework/framework.ts index b86978b9ac..4ba592a4c5 100644 --- a/modules/sdk-coin-sui/src/lib/mystenlab/framework/framework.ts +++ b/modules/sdk-coin-sui/src/lib/mystenlab/framework/framework.ts @@ -105,8 +105,8 @@ export class Coin { Coin.getBalanceFromCoinStruct(a) < Coin.getBalanceFromCoinStruct(b) ? -1 : Coin.getBalanceFromCoinStruct(a) > Coin.getBalanceFromCoinStruct(b) - ? 1 - : 0 + ? 1 + : 0 ); } diff --git a/modules/sdk-core/src/bitgo/keychain/keychains.ts b/modules/sdk-core/src/bitgo/keychain/keychains.ts index 8c0ff85c03..b08a49539a 100644 --- a/modules/sdk-core/src/bitgo/keychain/keychains.ts +++ b/modules/sdk-core/src/bitgo/keychain/keychains.ts @@ -315,8 +315,8 @@ export class Keychains implements IKeychains { this.baseCoin.getMPCAlgorithm() === 'eddsa' ? EDDSAUtils.default : multisigTypeVersion === 'MPCv2' - ? ECDSAUtils.EcdsaMPCv2Utils - : ECDSAUtils.EcdsaUtils; + ? ECDSAUtils.EcdsaMPCv2Utils + : ECDSAUtils.EcdsaUtils; break; case 'blsdkg': if (_.isUndefined(params.passphrase)) { diff --git a/modules/sdk-core/src/bitgo/utils/postWithCodec.ts b/modules/sdk-core/src/bitgo/utils/postWithCodec.ts index 7a7294c7e2..d8b6279ba0 100644 --- a/modules/sdk-core/src/bitgo/utils/postWithCodec.ts +++ b/modules/sdk-core/src/bitgo/utils/postWithCodec.ts @@ -16,7 +16,7 @@ import { SuperAgent, SuperAgentRequest } from 'superagent'; export function postWithCodec< TAgent extends BitGoBase | SuperAgent, A extends Record, - O extends Record + O extends Record, >( agent: TAgent, url: string, diff --git a/modules/sdk-core/src/bitgo/utils/tss/ecdsa/SMC/utils.ts b/modules/sdk-core/src/bitgo/utils/tss/ecdsa/SMC/utils.ts index abab7eb50f..835105bf8d 100644 --- a/modules/sdk-core/src/bitgo/utils/tss/ecdsa/SMC/utils.ts +++ b/modules/sdk-core/src/bitgo/utils/tss/ecdsa/SMC/utils.ts @@ -21,7 +21,10 @@ import { EcdsaMPCv2KeyGenSendFn, KeyGenSenderForEnterprise } from '../ecdsaMPCv2 export class MPCv2SMCUtils { private MPCv2Utils: EcdsaMPCv2Utils; - constructor(private bitgo: BitGoBase, private baseCoin: IBaseCoin) { + constructor( + private bitgo: BitGoBase, + private baseCoin: IBaseCoin + ) { this.MPCv2Utils = new EcdsaMPCv2Utils(bitgo, baseCoin); } diff --git a/modules/unspents/docs/input-costs.md b/modules/unspents/docs/input-costs.md index 2dfb6af9f8..a0f3838888 100644 --- a/modules/unspents/docs/input-costs.md +++ b/modules/unspents/docs/input-costs.md @@ -1,13 +1,14 @@ # Input Costs + This document contains the worst-case input costs for various script types and spend types. The input costs are calculated using the `Dimensions` class from `@bitgo/unspents`. -| Script Type | Chain Codes | Spend Type | Input Size (Virtual Bytes) | Relative Size (p2trMusig2 = 1.00) | -| --- | --- | --- | --- | --- | -| p2sh | 0/1 | all | 298 | 5.14 | -| p2shP2wsh | 10/11 | all | 140 | 2.41 | -| p2wsh | 20/21 | all | 105 | 1.81 | -| p2tr | 30/31 | Script Path, Level 2 (Backup/User, Backup/BitGo) | 116 | 2.00 | -| p2tr | 30/31 | Script Path, Level 1 (User/BitGo) | 108 | 1.86 | -| p2trMusig2 | 40/41 | Script Path (Backup/User, Backup/BitGo) | 108 | 1.86 | -| p2trMusig2 | 40/41 | Key Path (User/BitGo) | 58 | 1.00 | \ No newline at end of file +| Script Type | Chain Codes | Spend Type | Input Size (Virtual Bytes) | Relative Size (p2trMusig2 = 1.00) | +| ----------- | ----------- | ------------------------------------------------ | -------------------------- | --------------------------------- | +| p2sh | 0/1 | all | 298 | 5.14 | +| p2shP2wsh | 10/11 | all | 140 | 2.41 | +| p2wsh | 20/21 | all | 105 | 1.81 | +| p2tr | 30/31 | Script Path, Level 2 (Backup/User, Backup/BitGo) | 116 | 2.00 | +| p2tr | 30/31 | Script Path, Level 1 (User/BitGo) | 108 | 1.86 | +| p2trMusig2 | 40/41 | Script Path (Backup/User, Backup/BitGo) | 108 | 1.86 | +| p2trMusig2 | 40/41 | Key Path (User/BitGo) | 58 | 1.00 | diff --git a/modules/utxo-bin/README.md b/modules/utxo-bin/README.md index 01d36b8a7c..fbb4257aad 100644 --- a/modules/utxo-bin/README.md +++ b/modules/utxo-bin/README.md @@ -3,7 +3,6 @@ This repository contains a CLI tool for parsing BitGo wallet transactions (withdrawals) and formatting them for terminal output. - # Installation ## npm @@ -75,9 +74,9 @@ utxo-bin -n bitcoin parseTx \ Supported transactions formats are -* full-signed transactions -* half-signed transactions in proprietary bitcoinjs-lib format ("legacy") -* half-signed transactions in PSBT/BIP174 format +- full-signed transactions +- half-signed transactions in proprietary bitcoinjs-lib format ("legacy") +- half-signed transactions in PSBT/BIP174 format Supported encodings are hex and base64. @@ -94,6 +93,7 @@ utxo-bin -n bitcoin parseAddress 3QJmV3qfvL9SuYo34YihAf3sRCW3qSinyC --convert ``` ## Generate addresses + ``` utxo-bin generateAddresses \ --userKey xpub661MyMwAqRbcEvoSo4qrsT5xhByHzUoBjm88hdCPohF1rdQ4TkntuHfccN2N7FbmAmBgmaBxD7VY1QZ43YfgGRLBL37BBkBhYbezgnsPRVP \ diff --git a/modules/utxo-lib/src/bitgo/UtxoPsbt.ts b/modules/utxo-lib/src/bitgo/UtxoPsbt.ts index 22b28b0333..081f2457d3 100644 --- a/modules/utxo-lib/src/bitgo/UtxoPsbt.ts +++ b/modules/utxo-lib/src/bitgo/UtxoPsbt.ts @@ -235,8 +235,8 @@ export class UtxoPsbt = UtxoTransaction { export class UtxoTransactionBuilder< TNumber extends number | bigint = number, - T extends UtxoTransaction = UtxoTransaction + T extends UtxoTransaction = UtxoTransaction, > extends TransactionBuilder { constructor(network: Network, tx?: UtxoTransaction) { super(); diff --git a/modules/utxo-lib/src/bitgo/parseInput.ts b/modules/utxo-lib/src/bitgo/parseInput.ts index 8a499d8c61..55b7183ae0 100644 --- a/modules/utxo-lib/src/bitgo/parseInput.ts +++ b/modules/utxo-lib/src/bitgo/parseInput.ts @@ -635,8 +635,8 @@ export function parsePubScript2Of3( scriptType === 'taprootKeyPathSpend' ? parseTaprootKeyPathPubScript(inputPubScript, scriptType) : scriptType === 'taprootScriptPathSpend' - ? parseTaprootScriptPathPubScript(inputPubScript, scriptType) - : parseP2msPubScript(inputPubScript, scriptType); + ? parseTaprootScriptPathPubScript(inputPubScript, scriptType) + : parseP2msPubScript(inputPubScript, scriptType); if (result instanceof MatchError) { throw new Error(result.message); diff --git a/modules/utxo-lib/src/bitgo/wallet/Psbt.ts b/modules/utxo-lib/src/bitgo/wallet/Psbt.ts index 61fafcc64f..03dbcc3c8c 100644 --- a/modules/utxo-lib/src/bitgo/wallet/Psbt.ts +++ b/modules/utxo-lib/src/bitgo/wallet/Psbt.ts @@ -304,8 +304,8 @@ function parseSignatures( return scriptType === 'taprootKeyPathSpend' ? parseTaprootKeyPathSignatures(input) : scriptType === 'taprootScriptPathSpend' - ? parsePartialOrTapScriptSignatures(input.tapScriptSig) - : parsePartialOrTapScriptSignatures(input.partialSig); + ? parsePartialOrTapScriptSignatures(input.tapScriptSig) + : parsePartialOrTapScriptSignatures(input.partialSig); } function parseScript( @@ -408,8 +408,8 @@ export function toScriptType2Of3s(parsedScriptType: ParsedScriptType2Of3): Scrip return parsedScriptType === 'taprootScriptPathSpend' ? ['p2trMusig2', 'p2tr'] : parsedScriptType === 'taprootKeyPathSpend' - ? ['p2trMusig2'] - : [parsedScriptType]; + ? ['p2trMusig2'] + : [parsedScriptType]; } /** diff --git a/modules/utxo-lib/src/bitgo/wallet/WalletKeys.ts b/modules/utxo-lib/src/bitgo/wallet/WalletKeys.ts index 875750ab78..8d77cf7d0c 100644 --- a/modules/utxo-lib/src/bitgo/wallet/WalletKeys.ts +++ b/modules/utxo-lib/src/bitgo/wallet/WalletKeys.ts @@ -64,7 +64,10 @@ export class DerivedWalletKeys extends WalletKeys { * @param parent - wallet keys to derive from * @param paths - paths to derive with */ - constructor(public parent: RootWalletKeys, public paths: Triple) { + constructor( + public parent: RootWalletKeys, + public paths: Triple + ) { super(parent.triple.map((k, i) => k.derivePath(paths[i])) as Triple); } } diff --git a/modules/utxo-lib/src/bitgo/wallet/psbt/PsbtOutputs.ts b/modules/utxo-lib/src/bitgo/wallet/psbt/PsbtOutputs.ts index 92d34dfd69..ffa013c3b3 100644 --- a/modules/utxo-lib/src/bitgo/wallet/psbt/PsbtOutputs.ts +++ b/modules/utxo-lib/src/bitgo/wallet/psbt/PsbtOutputs.ts @@ -21,8 +21,8 @@ export function deriveKeyPairForOutput(bip32: BIP32Interface, output: PsbtOutput return output.tapBip32Derivation?.length ? UtxoPsbt.deriveKeyPair(bip32, output.tapBip32Derivation, { ignoreY: true }) : output.bip32Derivation?.length - ? UtxoPsbt.deriveKeyPair(bip32, output.bip32Derivation, { ignoreY: false }) - : undefined; + ? UtxoPsbt.deriveKeyPair(bip32, output.bip32Derivation, { ignoreY: false }) + : undefined; } /** diff --git a/modules/utxo-lib/src/bitgo/zcash/ZcashTransaction.ts b/modules/utxo-lib/src/bitgo/zcash/ZcashTransaction.ts index 711677a3f5..50ae6d16b9 100644 --- a/modules/utxo-lib/src/bitgo/zcash/ZcashTransaction.ts +++ b/modules/utxo-lib/src/bitgo/zcash/ZcashTransaction.ts @@ -78,7 +78,11 @@ export class ZcashTransaction extends expiryHeight = 0; consensusBranchId: number; - constructor(public network: ZcashNetwork, tx?: ZcashTransaction, amountType?: 'bigint' | 'number') { + constructor( + public network: ZcashNetwork, + tx?: ZcashTransaction, + amountType?: 'bigint' | 'number' + ) { super(network, tx, amountType); let consensusBranchId; diff --git a/modules/utxo-lib/src/transaction_builder.ts b/modules/utxo-lib/src/transaction_builder.ts index 1cf67d601f..b686811fe7 100644 --- a/modules/utxo-lib/src/transaction_builder.ts +++ b/modules/utxo-lib/src/transaction_builder.ts @@ -163,7 +163,10 @@ export class TransactionBuilder { // WARNING: maximumFeeRate is __NOT__ to be relied on, // it's just another potential safety mechanism (safety in-depth) - constructor(public network: Network = networks.bitcoin, public maximumFeeRate: number = 2500) { + constructor( + public network: Network = networks.bitcoin, + public maximumFeeRate: number = 2500 + ) { this.__PREV_TX_SET = {}; this.__INPUTS = []; this.__TX = new Transaction(); diff --git a/modules/utxo-lib/test/bitgo/psbt/Musig2.ts b/modules/utxo-lib/test/bitgo/psbt/Musig2.ts index f162ed6e6b..7f06c152e1 100644 --- a/modules/utxo-lib/test/bitgo/psbt/Musig2.ts +++ b/modules/utxo-lib/test/bitgo/psbt/Musig2.ts @@ -915,8 +915,8 @@ describe('p2trMusig2', function () { scriptType === 'p2trMusig2' ? psbt.setAllInputsMusig2NonceHD(rootWalletKeys.user) : scriptType === 'p2tr' - ? psbt.signTaprootInputHD(index, rootWalletKeys.user) - : psbt.signInputHD(index, rootWalletKeys.user), + ? psbt.signTaprootInputHD(index, rootWalletKeys.user) + : psbt.signInputHD(index, rootWalletKeys.user), (e: any) => isSegwit(u.chain) && scriptType !== 'p2shP2wsh' ? e.message === `Witness script for input #${index} doesn't match the scriptPubKey in the prevout` diff --git a/modules/utxo-lib/test/bitgo/zcash/hashZip0244.ts b/modules/utxo-lib/test/bitgo/zcash/hashZip0244.ts index d22f324b97..03dde7001e 100644 --- a/modules/utxo-lib/test/bitgo/zcash/hashZip0244.ts +++ b/modules/utxo-lib/test/bitgo/zcash/hashZip0244.ts @@ -15,7 +15,7 @@ type Vector = [ sighash_single: string, sighash_all_anyone: string, sighash_none_anyone: string, - sighash_single_anyone: string + sighash_single_anyone: string, ]; function parseHashType(hashTypeStr: string): number { diff --git a/modules/utxo-lib/test/fixtures_thirdparty/fixtures.ts b/modules/utxo-lib/test/fixtures_thirdparty/fixtures.ts index 33258a4259..7262fae42b 100644 --- a/modules/utxo-lib/test/fixtures_thirdparty/fixtures.ts +++ b/modules/utxo-lib/test/fixtures_thirdparty/fixtures.ts @@ -84,7 +84,7 @@ export type SigHashTestVector = [ script: string, inputIndex: number, hashType: number, - signatureHash: string + signatureHash: string, // BCH and BSV have two extra entries that we don't care abount ]; @@ -94,14 +94,14 @@ export type ZcashSigHashTestVector = [ inputIndex: number, hashType: number, branchId: number, - signatureHash: string + signatureHash: string, ]; export const txValidTestFile = 'tx_valid.json'; export type TxValidVector = [ inputData: [prevoutHash: string, prevoutIndex: string, prevoutScriptPubKey: string][], serializedTransaction: string, - verifyFlags: string + verifyFlags: string, ]; export function testFixture( diff --git a/modules/utxo-lib/test/integration_local_rpc/generate/RpcClient.ts b/modules/utxo-lib/test/integration_local_rpc/generate/RpcClient.ts index 392311516a..dec48c7eb7 100644 --- a/modules/utxo-lib/test/integration_local_rpc/generate/RpcClient.ts +++ b/modules/utxo-lib/test/integration_local_rpc/generate/RpcClient.ts @@ -32,7 +32,11 @@ const BITCOIN_CORE_22_99 = '/Satoshi:22.99.0/'; export class RpcClient { id = 0; - constructor(protected network: Network, protected url: string, protected networkInfo?: NetworkInfo) {} + constructor( + protected network: Network, + protected url: string, + protected networkInfo?: NetworkInfo + ) {} /** * Poor man's Bluebird.map(arr, f, { concurrency }) @@ -198,7 +202,12 @@ export class RpcClient { } export class RpcClientWithWallet extends RpcClient { - constructor(network: Network, url: string, networkInfo: NetworkInfo, private walletName?: string) { + constructor( + network: Network, + url: string, + networkInfo: NetworkInfo, + private walletName?: string + ) { super(network, url, networkInfo); } diff --git a/modules/utxo-ord/src/OrdOutput.ts b/modules/utxo-ord/src/OrdOutput.ts index 81b1be3ca7..0c2da51619 100644 --- a/modules/utxo-ord/src/OrdOutput.ts +++ b/modules/utxo-ord/src/OrdOutput.ts @@ -53,7 +53,11 @@ createOutputs( import { SatRange } from './SatRange'; export class InvalidOrdOutput extends Error { - constructor(message: string, public value: bigint, public ordinals: SatRange[]) { + constructor( + message: string, + public value: bigint, + public ordinals: SatRange[] + ) { super(message); } } @@ -68,7 +72,10 @@ export class OrdOutput { * Required to be ordered and non-overlapping. * Not required to be exhaustive. */ - constructor(public value: bigint, public ordinals: SatRange[] = []) { + constructor( + public value: bigint, + public ordinals: SatRange[] = [] + ) { const maxRange = this.asSatRange(); ordinals.forEach((r, i) => { if (!maxRange.isSupersetOf(r)) { diff --git a/modules/utxo-ord/src/SatRange.ts b/modules/utxo-ord/src/SatRange.ts index 0b2d249f68..f8ae88106a 100644 --- a/modules/utxo-ord/src/SatRange.ts +++ b/modules/utxo-ord/src/SatRange.ts @@ -1,5 +1,9 @@ export class InvalidSatRange extends Error { - constructor(message: string, public start: bigint, public end: bigint) { + constructor( + message: string, + public start: bigint, + public end: bigint + ) { super(message); } } @@ -13,7 +17,10 @@ function toRange(v: bigint | SatRange): SatRange { * Inscriptions have start === end. */ export class SatRange { - constructor(public start: bigint, public end: bigint) { + constructor( + public start: bigint, + public end: bigint + ) { if (start < 0 || end < 0 || end < start) { throw new InvalidSatRange(`Invalid SatRange [${start}, ${end}]`, start, end); } diff --git a/modules/web-demo/cypress/support/component-index.html b/modules/web-demo/cypress/support/component-index.html index ac6e79fd83..faf3b5f43b 100644 --- a/modules/web-demo/cypress/support/component-index.html +++ b/modules/web-demo/cypress/support/component-index.html @@ -1,12 +1,12 @@ - + - - - + + + Components App
- \ No newline at end of file + diff --git a/modules/web-demo/src/index.html b/modules/web-demo/src/index.html index ae2c9a79c3..801903723b 100644 --- a/modules/web-demo/src/index.html +++ b/modules/web-demo/src/index.html @@ -1,4 +1,4 @@ - + diff --git a/package.json b/package.json index 18c07f8959..9de5cfa07f 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.19.1", "eslint-plugin-jsdoc": "^33.0.0", - "eslint-plugin-prettier": "^3.4.0", + "eslint-plugin-prettier": "^5.0.0", "execa": "^5.0.0", "glob": "^7.1.3", "html-webpack-plugin": "^5.5.0", @@ -38,7 +38,7 @@ "nyc": "^15.1.0", "formidable": "3.2.4", "parse-url": "^8.1.0", - "prettier": "^2.3.0", + "prettier": "^3.0.0", "process": "^0.11.10", "rimraf": "^3.0.2", "semver": "^7.3.7", diff --git a/yarn.lock b/yarn.lock index fc9ecc514b..10b3db1232 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3942,6 +3942,11 @@ resolved "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== +"@pkgr/core@^0.1.0": + version "0.1.1" + resolved "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" + integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== + "@polkadot-api/json-rpc-provider-proxy@^0.1.0": version "0.1.0" resolved "https://registry.npmjs.org/@polkadot-api/json-rpc-provider-proxy/-/json-rpc-provider-proxy-0.1.0.tgz#6e191f28e7d0fbbe8b540fc51d12a0adaeba297e" @@ -10052,6 +10057,14 @@ eslint-plugin-prettier@^3.4.0: dependencies: prettier-linter-helpers "^1.0.0" +eslint-plugin-prettier@^5.0.0: + version "5.2.1" + resolved "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz#d1c8f972d8f60e414c25465c163d16f209411f95" + integrity sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw== + dependencies: + prettier-linter-helpers "^1.0.0" + synckit "^0.9.1" + eslint-scope@5.1.1, eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" @@ -16222,10 +16235,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@^2.3.0: - version "2.8.8" - resolved "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" - integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== +prettier@^3.0.0: + version "3.3.3" + resolved "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105" + integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== pretty-bytes@^5.6.0: version "5.6.0" @@ -18618,6 +18631,14 @@ symbol-observable@^2.0.3: resolved "https://registry.npmjs.org/symbol-observable/-/symbol-observable-2.0.3.tgz#5b521d3d07a43c351055fa43b8355b62d33fd16a" integrity sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA== +synckit@^0.9.1: + version "0.9.2" + resolved "https://registry.npmjs.org/synckit/-/synckit-0.9.2.tgz#a3a935eca7922d48b9e7d6c61822ee6c3ae4ec62" + integrity sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw== + dependencies: + "@pkgr/core" "^0.1.0" + tslib "^2.6.2" + syntax-error@^1.1.1: version "1.4.0" resolved "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz#2d9d4ff5c064acb711594a3e3b95054ad51d907c"