Skip to content

Commit

Permalink
Merge branch 'main' into feat/audit
Browse files Browse the repository at this point in the history
  • Loading branch information
danroc authored Oct 19, 2024
2 parents 9849f76 + fa3f69c commit 6438ddb
Show file tree
Hide file tree
Showing 23 changed files with 248 additions and 131 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: yarn
- run: yarn install --immutable --immutable-cache
- run: yarn install --immutable
- name: Get commit SHA
id: commit-sha
run: echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"cSpell.words": ["bech32", "p2wpkh", "sendmany", "syncpack"]
"cSpell.words": ["bech32", "p2wpkh", "syncpack"]
}
2 changes: 1 addition & 1 deletion jest.config.packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
collectCoverage: true,

// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: ['./src/**/*.ts'],
collectCoverageFrom: ['./src/**/*.ts', '!./src/**/*.test-d.ts'],

// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/accounts-monorepo",
"version": "3.0.0",
"version": "7.0.0",
"private": true,
"description": "Monorepo for MetaMask accounts related packages",
"repository": {
Expand Down Expand Up @@ -33,10 +33,8 @@
"readme:update": "ts-node scripts/update-readme-content.ts",
"release": "./scripts/release.sh",
"setup": "yarn install",
"test": "yarn test:packages",
"test:clean": "yarn workspaces foreach --all --parallel --verbose run test:clean && yarn test",
"test:packages": "yarn test:verbose --silent --collectCoverage=false --reporters=jest-silent-reporter",
"test:verbose": "yarn workspaces foreach --all --parallel --verbose run test:verbose"
"test": "yarn workspaces foreach --all --parallel --verbose run test",
"test:clean": "yarn workspaces foreach --all --parallel --verbose run test:clean"
},
"resolutions": {
"@types/node": "^20.12.12",
Expand Down
9 changes: 8 additions & 1 deletion packages/keyring-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [9.0.0]

### Changed

- **BREAKING:** Rename `btc_sendmany` method to `sendBitcoin` ([#73](https://github.com/MetaMask/accounts/pull/73))

## [8.1.3]

### Changed
Expand Down Expand Up @@ -412,7 +418,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- SnapController keyring client. It is intended to be used by MetaMask to talk to the snap.
- Helper functions to create keyring handler in the snap.

[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.3...HEAD
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@9.0.0...HEAD
[9.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.3...@metamask/keyring-api@9.0.0
[8.1.3]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.2...@metamask/keyring-api@8.1.3
[8.1.2]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.1...@metamask/keyring-api@8.1.2
[8.1.1]: https://github.com/MetaMask/accounts/compare/@metamask/keyring-api@8.1.0...@metamask/keyring-api@8.1.1
Expand Down
32 changes: 9 additions & 23 deletions packages/keyring-api/docs/btc-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,26 @@
Here we document the Bitcoin methods that an account Snap may implement to
support requests originated from dapps.

## btc_sendmany
## sendBitcoin

This method is similar to the `sendmany` RPC method from Bitcoin Core, but its
parameters are passed in an object instead of an array, and are named in
camelCase. Also, dummy values aren't allowed.
Send bitcoins to one or more recipients.

### Parameters

- **Transaction intent (required)**
- Type: `object`
- Properties:
- `amounts`
- `recipients`
- Description: A JSON object with recipient addresses and amounts.
- Type: `object`
- Properties:
- `[key]: string`: Address of the recipient
- `[value]: string`: Amount to send to the recipient in BTC
- `comment` (optional)
- Description: A comment.
- Type: `string`
- `subtractFeeFrom` (optional)
- Description: The fee will be equally deducted from the amount of each
selected address. Those recipients will receive less bitcoins than you
enter in their corresponding amount field. If no addresses are specified
here, the sender pays the fee.
- Type: `array`
- Items:
- Type: `string`
- `[key]: string`: Address of the recipient.
- `[value]: string`: Amount to send to the recipient in **BTC**.
- `replaceable` (optional)
- Description: Allow this transaction to be replaced by a transaction
with higher fees via BIP 125.
- Type: `boolean`
- Default: `true`

### Returns

Expand All @@ -51,15 +39,13 @@ camelCase. Also, dummy values aren't allowed.

```json
{
"method": "btc_sendmany",
"method": "sendBitcoin",
"params": {
"amounts": {
"recipients": {
"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl": "0.01",
"bc1q02ad21edsxd23d32dfgqqsz4vv4nmtfzuklhy3": "0.02"
},
"comment": "testing",
"subtractFeeFrom": ["bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl"],
"replaceable": false
"replaceable": true
}
}
```
Expand Down
7 changes: 3 additions & 4 deletions packages/keyring-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/keyring-api",
"version": "8.1.3",
"version": "9.0.0",
"description": "MetaMask Keyring API",
"keywords": [
"metamask",
Expand Down Expand Up @@ -32,7 +32,6 @@
"test:clean": "jest --clearCache",
"test:source": "jest && jest-it-up",
"test:types": "tsd",
"test:verbose": "jest --verbose",
"test:watch": "jest --watch"
},
"dependencies": {
Expand All @@ -48,7 +47,7 @@
"@lavamoat/allow-scripts": "^3.2.1",
"@lavamoat/preinstall-always-fail": "^2.1.0",
"@metamask/auto-changelog": "^3.4.4",
"@metamask/providers": "^17.2.0",
"@metamask/providers": "^18.1.0",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.12",
"@types/webextension-polyfill": "^0.12.1",
Expand All @@ -64,7 +63,7 @@
"typescript": "~5.4.5"
},
"peerDependencies": {
"@metamask/providers": "^17.2.0"
"@metamask/providers": "^18.1.0"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
4 changes: 2 additions & 2 deletions packages/keyring-api/src/btc/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const BtcP2wpkhAddressStruct = refine(
*/
export enum BtcMethod {
// General transaction methods
SendMany = 'btc_sendmany',
SendBitcoin = 'sendBitcoin',
}

export const BtcP2wpkhAccountStruct = object({
Expand All @@ -44,7 +44,7 @@ export const BtcP2wpkhAccountStruct = object({
/**
* Account supported methods.
*/
methods: array(enums([`${BtcMethod.SendMany}`])),
methods: array(enums([`${BtcMethod.SendBitcoin}`])),
});

export type BtcP2wpkhAccount = Infer<typeof BtcP2wpkhAccountStruct>;
3 changes: 1 addition & 2 deletions packages/keyring-eth-hd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/eth-hd-keyring",
"publish:preview": "yarn npm publish --tag preview",
"test": "jest",
"test:clean": "jest --clearCache",
"test:verbose": "jest --verbose"
"test:clean": "jest --clearCache"
},
"dependencies": {
"@ethereumjs/util": "^8.1.0",
Expand Down
18 changes: 17 additions & 1 deletion packages/keyring-eth-ledger-bridge/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [5.0.1]

### Changed

- Bump `@ledgerhq/hw-app-eth` dependency to `^6.39.0` ([#68](https://github.com/MetaMask/accounts/pull/68))
- This new dependency version reduces the resulting package bundle size.

## [5.0.0]

### Changed

- **BREAKING**: `addAccounts` will now only return newly created accounts ([#63](https://github.com/MetaMask/accounts/pull/63))
- This keyring was initially returning every accounts (previous and new ones), which is different from what is expected in the [`Keyring` interface].(https://github.com/MetaMask/utils/blob/v9.2.1/src/keyring.ts#L65)

## [4.1.4]

### Changed
Expand Down Expand Up @@ -184,7 +198,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Support new versions of ethereumjs/tx ([#68](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/68))

[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@4.1.4...HEAD
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@5.0.1...HEAD
[5.0.1]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@5.0.0...@metamask/eth-ledger-bridge-keyring@5.0.1
[5.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@4.1.4...@metamask/eth-ledger-bridge-keyring@5.0.0
[4.1.4]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@4.1.3...@metamask/eth-ledger-bridge-keyring@4.1.4
[4.1.3]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@4.1.2...@metamask/eth-ledger-bridge-keyring@4.1.3
[4.1.2]: https://github.com/MetaMask/accounts/compare/@metamask/eth-ledger-bridge-keyring@4.1.1...@metamask/eth-ledger-bridge-keyring@4.1.2
Expand Down
2 changes: 1 addition & 1 deletion packages/keyring-eth-ledger-bridge/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = merge(baseConfig, {
// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
branches: 90.64,
branches: 90.14,
functions: 95.95,
lines: 94.76,
statements: 94.81,
Expand Down
5 changes: 2 additions & 3 deletions packages/keyring-eth-ledger-bridge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/eth-ledger-bridge-keyring",
"version": "4.1.4",
"version": "5.0.1",
"description": "A MetaMask compatible keyring, for ledger hardware wallets",
"keywords": [
"ethereum",
Expand Down Expand Up @@ -33,14 +33,13 @@
"publish:preview": "yarn npm publish --tag preview",
"test": "jest && jest-it-up",
"test:clean": "jest --clearCache",
"test:verbose": "jest --verbose",
"test:watch": "jest --watch"
},
"dependencies": {
"@ethereumjs/rlp": "^5.0.2",
"@ethereumjs/tx": "^4.2.0",
"@ethereumjs/util": "^8.1.0",
"@ledgerhq/hw-app-eth": "^6.38.1",
"@ledgerhq/hw-app-eth": "^6.39.0",
"@metamask/eth-sig-util": "^7.0.3",
"hdkey": "^2.1.0"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/keyring-eth-simple/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ module.exports = merge(baseConfig, {
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['./src/tests'],

// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: ['./src/**/*.ts', '!./src/sample.ts'],

// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
Expand Down
1 change: 0 additions & 1 deletion packages/keyring-eth-simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"sample": "ts-node src/sample.ts",
"test": "jest",
"test:clean": "jest --clearCache",
"test:verbose": "jest --verbose",
"test:watch": "jest --watch"
},
"dependencies": {
Expand Down
10 changes: 9 additions & 1 deletion packages/keyring-eth-trezor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [4.0.0]

### Changed

- **BREAKING**: `addAccounts` will now only return newly created accounts ([#64](https://github.com/MetaMask/accounts/pull/64))
- This keyring was initially returning every accounts (previous and new ones), which is different from what is expected in the [`Keyring` interface].(https://github.com/MetaMask/utils/blob/v9.2.1/src/keyring.ts#L65)

## [3.1.3]

### Changed
Expand Down Expand Up @@ -120,7 +127,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Support new versions of ethereumjs/tx ([#88](https://github.com/metamask/eth-trezor-keyring/pull/88))

[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.1.3...HEAD
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@4.0.0...HEAD
[4.0.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.1.3...@metamask/eth-trezor-keyring@4.0.0
[3.1.3]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.1.2...@metamask/eth-trezor-keyring@3.1.3
[3.1.2]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.1.1...@metamask/eth-trezor-keyring@3.1.2
[3.1.1]: https://github.com/MetaMask/accounts/compare/@metamask/eth-trezor-keyring@3.1.0...@metamask/eth-trezor-keyring@3.1.1
Expand Down
4 changes: 2 additions & 2 deletions packages/keyring-eth-trezor/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ module.exports = merge(baseConfig, {
global: {
branches: 48.27,
functions: 91.22,
lines: 89.89,
statements: 90.1,
lines: 89.94,
statements: 90.15,
},
},
});
3 changes: 1 addition & 2 deletions packages/keyring-eth-trezor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/eth-trezor-keyring",
"version": "3.1.3",
"version": "4.0.0",
"description": "A MetaMask compatible keyring, for trezor hardware wallets",
"keywords": [
"ethereum",
Expand Down Expand Up @@ -33,7 +33,6 @@
"publish:preview": "yarn npm publish --tag preview",
"test": "jest && jest-it-up",
"test:clean": "jest --clearCache",
"test:verbose": "jest --verbose",
"test:watch": "jest --watch"
},
"dependencies": {
Expand Down
14 changes: 13 additions & 1 deletion packages/keyring-snap-bridge/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [4.4.0]

### Added

- Sanitize redirect URL ([#70](https://github.com/MetaMask/accounts/pull/70))

### Changed

- Bump `@metamask/*` dependencies and add `@lavamoat/preinstall-always-fail` ([#65](https://github.com/MetaMask/accounts/pull/65)), ([#59](https://github.com/MetaMask/accounts/pull/59)), ([#58](https://github.com/MetaMask/accounts/pull/58))
- Use TypeScript 5 ([#55](https://github.com/MetaMask/accounts/pull/55))

## [4.3.6]

### Changed
Expand Down Expand Up @@ -342,7 +353,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial release.

[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@4.3.6...HEAD
[Unreleased]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@4.4.0...HEAD
[4.4.0]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@4.3.6...@metamask/eth-snap-keyring@4.4.0
[4.3.6]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@4.3.5...@metamask/eth-snap-keyring@4.3.6
[4.3.5]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@4.3.4...@metamask/eth-snap-keyring@4.3.5
[4.3.4]: https://github.com/MetaMask/accounts/compare/@metamask/eth-snap-keyring@4.3.3...@metamask/eth-snap-keyring@4.3.4
Expand Down
3 changes: 1 addition & 2 deletions packages/keyring-snap-bridge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/eth-snap-keyring",
"version": "4.3.6",
"version": "4.4.0",
"description": "Snaps keyring bridge.",
"repository": {
"type": "git",
Expand All @@ -21,7 +21,6 @@
"publish:preview": "yarn npm publish --tag preview",
"test": "jest && jest-it-up",
"test:clean": "jest --clearCache",
"test:verbose": "jest --verbose",
"test:watch": "jest --watch"
},
"dependencies": {
Expand Down
Loading

0 comments on commit 6438ddb

Please sign in to comment.