Skip to content
Closed
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
13 changes: 8 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ jobs:

- name: Install Packages
if: steps.lerna-cache.outputs.cache-hit != 'true' || contains( github.event.pull_request.labels.*.name, 'SKIP_CACHE')
run: yarn install --with-frozen-lockfile

- name: build packages
if: steps.lerna-cache.outputs.cache-hit == 'true'
run: yarn run postinstall
run: yarn install --with-frozen-lockfile --ignore-scripts

- name: Lint Commit Messages
run: |
Expand All @@ -69,6 +65,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 All @@ -78,6 +77,10 @@ jobs:
- name: Check Package Dependencies
run: yarn run check-deps

- name: build packages
if: steps.lerna-cache.outputs.cache-hit == 'true'
run: yarn run postinstall

- name: Unit Test
run: yarn run unit-test-changed
env:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ lab/
.vscode/
.env
.yarn
modules/**/dist/
modules/**/dist/
dist
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
/modules/abstract-cosmos/ @BitGo/ethalt-team
/modules/sdk-coin-ada/ @BitGo/ethalt-team
/modules/sdk-coin-algo/ @BitGo/ethalt-team
/modules/sdk-coin-apt/ @Bitgo/ethalt-team
/modules/sdk-coin-arbeth/ @BitGo/ethalt-team
/modules/sdk-coin-atom/ @BitGo/ethalt-team
/modules/sdk-coin-avaxc/ @BitGo/ethalt-team
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ COPY --from=builder /tmp/bitgo/modules/sdk-api /var/modules/sdk-api/
COPY --from=builder /tmp/bitgo/modules/unspents /var/modules/unspents/
COPY --from=builder /tmp/bitgo/modules/account-lib /var/modules/account-lib/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-algo /var/modules/sdk-coin-algo/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-apt /var/modules/sdk-coin-apt/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-arbeth /var/modules/sdk-coin-arbeth/
COPY --from=builder /tmp/bitgo/modules/abstract-eth /var/modules/abstract-eth/
COPY --from=builder /tmp/bitgo/modules/sdk-coin-atom /var/modules/sdk-coin-atom/
Expand Down Expand Up @@ -126,6 +127,7 @@ cd /var/modules/sdk-api && yarn link && \
cd /var/modules/unspents && yarn link && \
cd /var/modules/account-lib && yarn link && \
cd /var/modules/sdk-coin-algo && yarn link && \
cd /var/modules/sdk-coin-apt && yarn link && \
cd /var/modules/sdk-coin-arbeth && yarn link && \
cd /var/modules/abstract-eth && yarn link && \
cd /var/modules/sdk-coin-atom && yarn link && \
Expand Down Expand Up @@ -200,6 +202,7 @@ RUN cd /var/bitgo-express && \
yarn link @bitgo/unspents && \
yarn link @bitgo/account-lib && \
yarn link @bitgo/sdk-coin-algo && \
yarn link @bitgo/sdk-coin-apt && \
yarn link @bitgo/sdk-coin-arbeth && \
yarn link @bitgo/abstract-eth && \
yarn link @bitgo/sdk-coin-atom && \
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
1 change: 1 addition & 0 deletions modules/bitgo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@bitgo/sdk-api": "^1.56.3",
"@bitgo/sdk-coin-ada": "^4.3.4",
"@bitgo/sdk-coin-algo": "^2.1.43",
"@bitgo/sdk-coin-apt": "^1.0.0",
"@bitgo/sdk-coin-arbeth": "^21.0.37",
"@bitgo/sdk-coin-atom": "^13.1.1",
"@bitgo/sdk-coin-avaxc": "^5.1.6",
Expand Down
4 changes: 4 additions & 0 deletions modules/bitgo/src/v2/coinFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { tokens } from '../config';
import {
Ada,
Algo,
Apt,
Arbeth,
ArbethToken,
Atom,
Expand Down Expand Up @@ -74,6 +75,7 @@ import {
Ton,
Tada,
Talgo,
Tapt,
Tarbeth,
Tatom,
TavaxC,
Expand Down Expand Up @@ -140,6 +142,7 @@ import {
function registerCoinConstructors(globalCoinFactory: CoinFactory): void {
globalCoinFactory.register('ada', Ada.createInstance);
globalCoinFactory.register('algo', Algo.createInstance);
globalCoinFactory.register('apt', Apt.createInstance);
globalCoinFactory.register('arbeth', Arbeth.createInstance);
globalCoinFactory.register('atom', Atom.createInstance);
globalCoinFactory.register('avaxc', AvaxC.createInstance);
Expand Down Expand Up @@ -191,6 +194,7 @@ function registerCoinConstructors(globalCoinFactory: CoinFactory): void {
globalCoinFactory.register('tia', Tia.createInstance);
globalCoinFactory.register('ton', Ton.createInstance);
globalCoinFactory.register('talgo', Talgo.createInstance);
globalCoinFactory.register('tapt', Tapt.createInstance);
globalCoinFactory.register('tarbeth', Tarbeth.createInstance);
globalCoinFactory.register('tada', Tada.createInstance);
globalCoinFactory.register('tatom', Tatom.createInstance);
Expand Down
2 changes: 2 additions & 0 deletions modules/bitgo/src/v2/coins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AbstractUtxoCoin } from '@bitgo/abstract-utxo';
import { AbstractLightningCoin } from '@bitgo/abstract-lightning';
import { Ada, Tada } from '@bitgo/sdk-coin-ada';
import { Algo, AlgoToken, Talgo } from '@bitgo/sdk-coin-algo';
import { Apt, Tapt } from '@bitgo/sdk-coin-apt';
import { Arbeth, Tarbeth, ArbethToken } from '@bitgo/sdk-coin-arbeth';
import { Atom, Tatom } from '@bitgo/sdk-coin-atom';
import { AvaxC, AvaxCToken, TavaxC } from '@bitgo/sdk-coin-avaxc';
Expand Down Expand Up @@ -54,6 +55,7 @@ import { Zketh, Tzketh, ZkethToken } from '@bitgo/sdk-coin-zketh';
export { AbstractUtxoCoin };
export { AbstractLightningCoin };
export { Algo, AlgoToken, Talgo };
export { Apt, Tapt };
export { Arbeth, Tarbeth, ArbethToken };
export { Ada, Tada };
export { Atom, Tatom };
Expand Down
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
3 changes: 3 additions & 0 deletions modules/bitgo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
{
"path": "../sdk-coin-algo"
},
{
"path": "../sdk-coin-apt"
},
{
"path": "../sdk-coin-arbeth"
},
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
Loading