Skip to content
Merged
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
4 changes: 4 additions & 0 deletions packages/bitcoin-wallet-snap/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Process the entire requested account range as a single batch instead of chunks of 100, so the existing-accounts lookup and state I/O happen once per request ([#221](https://github.com/MetaMask/internal-snaps/pull/221))
- Split the chain `stopGap` configuration into `{ discovery: 5, scan: 20 }` so account discovery keeps the cheap probe while full account scans use the BIP44 gap limit ([#224](https://github.com/MetaMask/internal-snaps/pull/224))

### Removed

- **BREAKING** Remove the `onAssetsLookup`, `onAssetsConversion`, `onAssetHistoricalPrice`, and `onAssetsMarketData` asset handler entry points, along with the now-unused `AssetsHandler`, `AssetsUseCases`, `InMemoryCache`, `ICache`, and the `endowment:assets` permission ([#260](https://github.com/MetaMask/internal-snaps/pull/260))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a catch. Well there are some inconsistencies where sometimes there is the colon and sometimes not but yes the convention prefers to have the colon.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100%! I will fix it at release time


### Fixed

- Coalesce concurrent account synchronization runs so stacked triggers (the 30s cronjob, `onActive`, and background events scheduled by `setSelectedAccounts`) share one run instead of duplicating network fetches, state writes, and keyring events ([#221](https://github.com/MetaMask/internal-snaps/pull/221))
Expand Down
8 changes: 4 additions & 4 deletions packages/bitcoin-wallet-snap/jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ const config = {
// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
branches: 65.5,
functions: 61.63,
lines: 75.29,
statements: 74.57,
branches: 72.43,
functions: 57.43,
lines: 81.02,
statements: 80.75,
},
},

Expand Down
11 changes: 1 addition & 10 deletions packages/bitcoin-wallet-snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/internal-snaps.git"
},
"source": {
"shasum": "OTDuRBGySZDr4ORVHDw93PFlyEWUOUA9wtUXm4HgHiY=",
"shasum": "aFQ3IzhV1Uq960fx3NsYY0RhOmZiB+KVOvkvBFvcMPQ=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down Expand Up @@ -87,15 +87,6 @@
}
}
]
},
"endowment:assets": {
"scopes": [
"bip122:000000000019d6689c085ae165831e93",
"bip122:000000000933ea01ad0ee984209779ba",
"bip122:00000000da84f2bafbbc53dee25a72ae",
"bip122:00000008819873e925422c1ff0f99f7c",
"bip122:regtest"
]
}
},
"platformVersion": "12.0.1",
Expand Down
1 change: 0 additions & 1 deletion packages/bitcoin-wallet-snap/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,5 @@ export const Config: SnapConfig = {
priceApi: {
url: fromEnv('PRICE_API_URL', 'https://price.api.cx.metamask.io'),
},
conversionsExpirationInterval: 60,
defaultAddressType: fromEnv('DEFAULT_ADDRESS_TYPE', 'p2wpkh') as AddressType,
};
8 changes: 0 additions & 8 deletions packages/bitcoin-wallet-snap/src/entities/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,6 @@ export const addressTypeToPurpose: Record<AddressType, Purpose> = {
p2tr: Purpose.Taproot,
};

export const purposeToAddressType: Record<Purpose, AddressType> = {
[Purpose.Legacy]: 'p2pkh',
[Purpose.Segwit]: 'p2sh',
[Purpose.Multisig]: 'p2wsh',
[Purpose.NativeSegwit]: 'p2wpkh',
[Purpose.Taproot]: 'p2tr',
};

export const networkToCoinType: Record<Network, Slip44> = {
bitcoin: Slip44.Bitcoin,
testnet: Slip44.Testnet,
Expand Down
1 change: 0 additions & 1 deletion packages/bitcoin-wallet-snap/src/entities/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export type SnapConfig = {
fallbackFeeRate: number;
ratesRefreshInterval: string;
priceApi: PriceApiConfig;
conversionsExpirationInterval: number;
defaultAddressType: AddressType;
};

Expand Down
23 changes: 1 addition & 22 deletions packages/bitcoin-wallet-snap/src/entities/rates.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import type {
HistoricalPriceValue,
FungibleAssetMarketData,
} from '@metamask/snaps-sdk';
import type { CaipAssetType } from '@metamask/utils';

export type TimePeriod = 'P1D' | 'P7D' | 'P1M' | 'P3M' | 'P1Y' | 'P1000Y';

export type AssetRate = [CaipAssetType, SpotPrice | null];
import type { FungibleAssetMarketData } from '@metamask/snaps-sdk';

export type SpotPrice = {
price: number;
Expand All @@ -21,17 +13,4 @@ export type AssetRatesClient = {
* @param baseCurrency - the currency to get prices for. Defaults to 'bitcoin'.
*/
spotPrices(vsCurrency?: string, baseCurrency?: string): Promise<SpotPrice>;

/**
* Returns a list of historical prices for a token against another.
*
* @param timePeriod - the time period to fetch prices for.
* @param vsCurrency - the currency to convert prices to. Defaults to 'usd'.
* @param baseCurrency - the currency to get prices for. Defaults to 'bitcoin'.
*/
historicalPrices(
timePeriod: TimePeriod,
vsCurrency?: string,
baseCurrency?: string,
): Promise<HistoricalPriceValue[]>;
};
237 changes: 0 additions & 237 deletions packages/bitcoin-wallet-snap/src/handlers/AssetsHandler.test.ts

This file was deleted.

Loading