Skip to content

Commit

Permalink
ci: print the prettier version
Browse files Browse the repository at this point in the history
TICKET: COIN-2220
  • Loading branch information
louib-bitgo committed Nov 11, 2024
1 parent 1a285e6 commit 906eadf
Show file tree
Hide file tree
Showing 46 changed files with 225 additions and 144 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 8 additions & 8 deletions modules/abstract-cosmos/resources/MsgCompiled.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down Expand Up @@ -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;
};

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions modules/abstract-eth/src/abstractEthLikeNewCoins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion modules/bitgo/.mocharc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ reporter: 'min'
reporter-option:
- 'cdn=true'
- 'json=false'
exit: true
exit: true
2 changes: 1 addition & 1 deletion modules/bitgo/test/integration/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>Mocha</title>
Expand Down
34 changes: 17 additions & 17 deletions modules/bitgo/test/integration/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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());
}
);
});
});

Expand Down
12 changes: 6 additions & 6 deletions modules/bitgo/test/v2/unit/coins/utxo/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ function run<TNumber extends number | bigint = number>(
v === undefined || v instanceof utxolib.bitgo.UtxoPsbt
? undefined
: v instanceof utxolib.bitgo.UtxoTransaction
? transactionToObj<TNumber>(v)
: transactionHexToObj(v.txHex, coin.network, amountType)
? transactionToObj<TNumber>(v)
: transactionHexToObj(v.txHex, coin.network, amountType)
) as TransactionObjStages;
}

Expand Down Expand Up @@ -563,10 +563,10 @@ function run<TNumber extends number | bigint = number>(
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
Expand Down
5 changes: 2 additions & 3 deletions modules/bitgo/test/v2/unit/internal/tssUtils/ecdsa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion modules/blake2b-wasm/example.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<title>Blake2b-WASM Demo</title>
Expand Down
5 changes: 4 additions & 1 deletion modules/blockapis/src/BaseHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}

Expand Down
5 changes: 4 additions & 1 deletion modules/blockapis/src/CachingHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 4 additions & 1 deletion modules/blockapis/src/impl/BlockchairApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 5 additions & 1 deletion modules/blockapis/test/UtxoApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ class TestCase<T> {
* @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.
Expand Down
9 changes: 6 additions & 3 deletions modules/bls-dkg/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
18 changes: 9 additions & 9 deletions modules/express/EXTERNAL_SIGNER.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
7 changes: 4 additions & 3 deletions modules/express/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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. |
Expand Down
3 changes: 1 addition & 2 deletions modules/express/bin/bitgo-express
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
8 changes: 5 additions & 3 deletions modules/express/src/clientRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1229,9 +1229,11 @@ function prepareBitGo(config: Config) {
}
type RequestHandlerResponse = string | unknown | undefined | { status: number; body: unknown };
interface RequestHandler extends express.RequestHandler<ParamsDictionary, any, RequestHandlerResponse> {
(req: express.Request, res: express.Response, next: express.NextFunction):
| RequestHandlerResponse
| Promise<RequestHandlerResponse>;
(
req: express.Request,
res: express.Response,
next: express.NextFunction
): RequestHandlerResponse | Promise<RequestHandlerResponse>;
}

function handleRequestHandlerError(res: express.Response, error: unknown) {
Expand Down
16 changes: 8 additions & 8 deletions modules/sdk-coin-ada/src/lib/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions modules/sdk-coin-algo/src/lib/keyRegistrationBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit 906eadf

Please sign in to comment.