Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-schrammel committed Apr 4, 2024
2 parents 0f00383 + 66e26fb commit c2d606f
Show file tree
Hide file tree
Showing 88 changed files with 1,572 additions and 635 deletions.
6 changes: 4 additions & 2 deletions .env.d.ts
Expand Up @@ -6,7 +6,8 @@ declare global {
ZORA_MAINNET_RPC: string;
BASE_MAINNET_RPC: string;
ETHERSCAN_API_KEY: string;
SEGMENT_WRITE_KEY: string;
RUDDERSTACK_WRITE_KEY: string;
RUDDERSTACK_DATA_PLANE: string;
SENTRY_DSN: string;
DATA_API_KEY: string;
DATA_ENDPOINT: string;
Expand All @@ -32,18 +33,19 @@ declare global {
BASE_MAINNET_RPC: string;
ZORA_MAINNET_RPC: string;
BSC_MAINNET_RPC: string;
ETH_GOERLI_RPC: string;
ETH_SEPOLIA_RPC: string;
ETH_HOLESKY_RPC: string;
OPTIMISM_SEPOLIA_RPC: string;
BSC_TESTNET_RPC: string;
POLYGON_MUMBAI_RPC: string;
POLYGON_AMOY_RPC: string;
ARBITRUM_SEPOLIA_RPC: string;
BASE_SEPOLIA_RPC: string;
ZORA_SEPOLIA_RPC: string;
AVALANCHE_MAINNET_RPC: string;
AVALANCHE_FUJI_RPC: string;
BLAST_MAINNET_RPC: string;
BLAST_SEPOLIA_RPC: string;
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion .env.example
@@ -1,6 +1,7 @@
ALCHEMY_API_KEY=
ETHERSCAN_API_KEY=
SEGMENT_WRITE_KEY=
RUDDERSTACK_WRITE_KEY=
RUDDERSTACK_DATA_PLANE=
SENTRY_DSN=
DATA_API_KEY=
DATA_ENDPOINT=
Expand Down
83 changes: 80 additions & 3 deletions CHANGELOG.md
Expand Up @@ -21,6 +21,80 @@ and this project adheres to [Semantic Versioning](http://semver.org/)

### Testing

## [v1.4.41](https://github.com/rainbow-me/browser-extension/releases/tag/v1.4.41)

### Added

- You can now swap tokens on Blast and Zora with Rainbow's slick cross-chain swaps #1442
- Right-click a spam token or a regret to hide it from your wallet. You can always search for these tokens to unhide in the future with the Magic Menu #1402
- Blast Sepolia is now supported in Testnet Mode #1396

### Changed

- Approve and Swap gas estimations are now more reliable #1395
- Removed L2 support confirmations in Send when interacting with your own wallets #1429
- Re-ordered Settings menus to be even cleaner for our recent additions like Approvals #1438
- Removed automatic filtering for tokens with URLs like Ether.fi with our improved spam detection #1430
- Supported the `return` hokey in the Save Contact flow #1398

### Fixed

- Fixed ENS Profile resolution spamming utilized for the NFT Gallery that caused inadvertent performance issues #1433
- Fixed accidental clicks when interacting with the right-click menus #1432
- Activity Details will now properly restore after opening and closing Rainbow #1427
- Corrected “Pin Extension” guide location for Arc Browser #1437
- Fixed spacing in the Wallet Group selector #1436

### Removed

- Removed deprecated Goerli network #1414

### Internal

- Added and reverted changes to unique asset ids due to transaction fetching issues #1421
- Reduced Imigix usage for NFT thumbnails for trusted sources #1428
- Improved type safety of keychain manager #1434
- Merging PKs to HD Groups wherever possible in keychain #1434
- Migrated to Rudderstack from Segment for analytics #1410

## [v1.4.34](https://github.com/rainbow-me/browser-extension/releases/tag/v1.4.34)

### Added

- You can now bridge ETH to Blast with Rainbow #1411

### Fixed

- Fixed an incorrect date calculate on the weekly Points drop breakdowns #1409
- Fixed an issue where the Connect banner would not always appear upon switching wallets #1404
- Resolved a color clash issue with the buttons on the Connect banners #1407
- Fixed a crash when inspecting the Activity Details for certain airdropped tokens #1412

### Removed

- Removed deprecated Arbitrum Goerli network #1397

### Internal

- Limited the number of Webpack circular dependencies to 2 and resolved a handful of instances #1401

### Testing

- Pinned e2e browser to Chrome 121 to mitigate Ledger dependency bundle failures in later versions of Chromedriver #1420

## [v1.4.25](https://github.com/rainbow-me/browser-extension/releases/tag/v1.4.25)

### Changed

- Improved Token Charts cursor hover and scroll feel #1394
- Emitting `accountsChanged` upon disconnect to align with MetaMask RPC #1388

### Fixed

- Resolved issue where users may only see a Cancel button on dApp requests for Custom Networks #1405
- Fixed `sendAsync` RPC call crash #1392
- Fixed rejection errors upon approving `wallet_watchAsset` RPC requests #1387

## [v1.4.22](https://github.com/rainbow-me/browser-extension/releases/tag/v1.4.22)

### Added
Expand All @@ -34,7 +108,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/)
- When Bridging assets, you can now right-click on a pending transaction to track the status on the Socketscan explorer #1377
- Swaps are even faster now that we automatically populate your input token and provide a default amount #1378
- Updated Weekly Points Overview with new line items for Referrals and Bonus Redemptions #1389
- Removed deprecated Optimism Goerli network #1351

### Fixed

Expand All @@ -47,14 +120,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/)
- Improved percentage formatting, fallback icons, and disappearing row on Swap Review #1380
- Fixed Activity Details animations and inconsistencies #1384

### Removed

- Removed deprecated Optimism Goerli network #1351

## [v1.4.12](https://github.com/rainbow-me/browser-extension/releases/tag/v1.4.12)

### Added

- You can now remove a Wallet Group in Settings to cleanup your unused wallets. Always make sure to backup your Secret Recovery Phrase first #1331
- Added Custom Network autofill support for Blast and Redstone Holesky #1373 #1358

### Changed
### Removed

- Removed support for deprecated Zora Goerli testnet #1367

Expand Down Expand Up @@ -95,7 +172,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/)

- NFTs are now supported across major Custom Networks and Testnets #1336

### Changed
### Removed

- Removed Base Goerli network that has been deprecated #1342

Expand Down
2 changes: 2 additions & 0 deletions e2e/parallel/shortcuts-home.test.ts
Expand Up @@ -197,6 +197,7 @@ describe.runIf(browser !== 'firefox')(
});

it('should be able to navigate to highlight transaction + open context menu with keyboard', async () => {
await findElementByText(driver, 'Tokens');
await executePerformShortcut({ driver, key: 'ARROW_RIGHT' });
await findElementByText(driver, 'Activity');
await executePerformShortcut({
Expand All @@ -207,6 +208,7 @@ describe.runIf(browser !== 'firefox')(
await executePerformShortcut({ driver, key: 'ENTER' });
await findElementByText(driver, 'Copy Tx Hash');
await executePerformShortcut({ driver, key: 'ESCAPE' });
await delayTime('short');
const txHash = await isElementFoundByText({
text: 'Copy Tx Hash',
driver,
Expand Down
8 changes: 4 additions & 4 deletions e2e/parallel/shortcuts-settings.test.ts
Expand Up @@ -105,15 +105,15 @@ describe.runIf(browser !== 'firefox')(

it('should be able to navigate to Networks using keyboard', async () => {
await delayTime('medium');
await executePerformShortcut({ driver, key: 'TAB', timesToPress: 5 });
await executePerformShortcut({ driver, key: 'TAB', timesToPress: 2 });
await executePerformShortcut({ driver, key: 'ARROW_RIGHT' });
await checkExtensionURL(driver, 'networks');
await executePerformShortcut({ driver, key: 'ARROW_LEFT' });
});

it('should be able to navigate to Privacy & Security using keyboard', async () => {
await delayTime('medium');
await executePerformShortcut({ driver, key: 'TAB', timesToPress: 4 });
await executePerformShortcut({ driver, key: 'TAB', timesToPress: 7 });
await executePerformShortcut({ driver, key: 'ARROW_RIGHT' });
await checkExtensionURL(driver, 'privacy');
});
Expand Down Expand Up @@ -189,7 +189,7 @@ describe.runIf(browser !== 'firefox')(
await executePerformShortcut({ driver, key: 'DECIMAL' });
await executePerformShortcut({ driver, key: 'ARROW_DOWN' });
await executePerformShortcut({ driver, key: 'ENTER' });
await executePerformShortcut({ driver, key: 'TAB', timesToPress: 4 });
await executePerformShortcut({ driver, key: 'TAB', timesToPress: 7 });
await executePerformShortcut({ driver, key: 'ENTER' });
await checkExtensionURL(driver, 'privacy');
});
Expand Down Expand Up @@ -414,7 +414,7 @@ describe.runIf(browser !== 'firefox')(
await executePerformShortcut({
driver,
key: 'TAB',
timesToPress: 11,
timesToPress: 10,
});
await executePerformShortcut({ driver, key: 'ENTER' });
const systemOption = await findElementByText(driver, 'System');
Expand Down
2 changes: 1 addition & 1 deletion e2e/serial/send/2_shortcuts-sendFlow.test.ts
Expand Up @@ -99,7 +99,6 @@ describe('Complete send flow via shortcuts and keyboard navigation', () => {

it('should be able to save contact', async () => {
await executePerformShortcut({ driver, key: 'DECIMAL' });
await executePerformShortcut({ driver, key: 'TAB' });
await driver.actions().sendKeys('0xtester.eth').perform();
await executePerformShortcut({ driver, key: 'TAB' });
await executePerformShortcut({ driver, key: 'ENTER' });
Expand Down Expand Up @@ -216,6 +215,7 @@ describe('Complete send flow via shortcuts and keyboard navigation', () => {
await executePerformShortcut({ driver, key: 'ARROW_LEFT' });
await executePerformShortcut({ driver, key: 'TAB', timesToPress: 8 });
await executePerformShortcut({ driver, key: 'SPACE' });
await delayTime('long');
await executePerformShortcut({ driver, key: 'ARROW_DOWN' });
await executePerformShortcut({ driver, key: 'ENTER' });
await checkExtensionURL(driver, 'send');
Expand Down
8 changes: 4 additions & 4 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "browser-extension",
"license": "GPL-3.0-only",
"version": "1.4.38",
"version": "1.4.47",
"scripts": {
"//enable dev mode": "",
"devmode:on": "sed -i'' -e 's/IS_DEV.*/IS_DEV=true/g' .env",
Expand Down Expand Up @@ -103,9 +103,9 @@
"@radix-ui/react-tabs": "1.0.4",
"@radix-ui/react-tooltip": "1.0.3",
"@rainbow-me/provider": "0.0.7",
"@rainbow-me/swaps": "0.10.0",
"@rainbow-me/swaps": "0.13.0",
"@rudderstack/analytics-js-service-worker": "3.0.6",
"@scure/bip39": "1.2.1",
"@segment/analytics-node": "1.0.0-beta.24",
"@sentry/browser": "7.69.0",
"@sentry/tracing": "7.69.0",
"@tanstack/query-async-storage-persister": "4.29.19",
Expand Down Expand Up @@ -254,7 +254,7 @@
"socket.io-parser": "4.2.3",
"tough-cookie": "4.1.3",
"graphql": "16.8.1",
"vite": "4.5.2",
"vite": "4.5.3",
"chai": "4.3.10",
"supports-color": "5.5.0",
"postcss": "8.4.31",
Expand Down
2 changes: 1 addition & 1 deletion src/analytics/README.md
@@ -1,6 +1,6 @@
# `~/analytics`

Our Segment wrapper.
Our RudderStack wrapper.

```typescript
import { analytics } from '~/analytics';
Expand Down
47 changes: 19 additions & 28 deletions src/analytics/index.ts
@@ -1,9 +1,9 @@
import { Analytics as AnalyticsNode } from '@segment/analytics-node';
import { Analytics as RudderAnalytics } from '@rudderstack/analytics-js-service-worker';

import { EventProperties, event } from '~/analytics/event';
import { UserProperties } from '~/analytics/userProperties';
import { analyticsDisabledStore } from '~/core/state/currentSettings/analyticsDisabled';
import { RainbowError, logger } from '~/logger';
import { logger } from '~/logger';

import { version } from '../../package.json';

Expand All @@ -12,7 +12,7 @@ const IS_TESTING = process.env.IS_TESTING === 'true';

/**
* Metadata about the current application and browser/device.
* `context` doesn't come for free in @segment/analytics-node
* `context` doesn't come for free in @rudderstack/analytics-js-service-worker
*/
const context = {
direct: true /* collect ip address for geoip */,
Expand All @@ -31,24 +31,17 @@ const context = {
};

export class Analytics {
client?: AnalyticsNode;
client?: RudderAnalytics;
deviceId?: string;
event = event;
disabled = true; // to do: check user setting here

constructor() {
/**
* Using @segment/analytics-node beta because analytics-node is deprecated.
* https://github.com/segmentio/analytics-next/tree/master/packages/node#readme
* @segment/analytics-next relies on a remote fetch plugin architecture
* that isn't viable in manifest v3 and extensions are not officially supported:
* - When connected to Analytics.js 2.0 source, we load a light-weight plugin on the
* webpage for session tracking and enrichment as an alternative to Amplitude SDK.
* - We do not provide a way to disable loading the session plugin for Amplitude at
* the moment, unfortunately. With that said, I have logged this as a feature request
* - We do not formally support loading Segment, including our Analytics.js library, within
* Chrome extensions. There have been stories of people getting this working, but it's not
* something we would be able to support, although you can go ahead and give it a try.
* Adopted `@rudderstack/analytics-js-service-worker` which mirrors
* `@rudderstack/rudder-sdk-node` and doesn't rely on the remote fetch
* plugin architecture as `@rudderstack/analytics-js` v3.
* https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/v3/#plugins
*/

// wait for analyticsDisabledStore to be initialized and turn it on if enabled
Expand All @@ -59,20 +52,18 @@ export class Analytics {
}, 10);

try {
this.client = new AnalyticsNode({
maxEventsInBatch: 1 /* replicate analytics-next flushing behavior */,
writeKey: process.env.SEGMENT_WRITE_KEY,
}).on('error', ({ code, reason }) =>
logger.error(new RainbowError('Segment error'), { code, reason }),
this.client = new RudderAnalytics(
process.env.RUDDERSTACK_WRITE_KEY,
`${process.env.RUDDERSTACK_DATA_PLANE}/v1/batch`,
);
logger.debug(`Segment initialized`);
logger.debug(`RudderStack initialized`);
} catch (e) {
logger.debug(`Segment failed to initialize`);
logger.debug(`RudderStack failed to initialize`);
}
}

/**
* Sends an `identify` event to Segment along with the traits you pass in
* Sends an `identify` event to RudderStack along with the traits you pass in
* here. This uses the `deviceId` as the identifier, and attaches the hashed
* wallet address as a property, if available.
*/
Expand All @@ -88,7 +79,7 @@ export class Analytics {
}

/**
* Sends a `screen` event to Segment.
* Sends a `screen` event to RudderStack.
*/
screen(name: string, params: Record<string, string> = {}): void {
if (this.disabled || IS_DEV || IS_TESTING || !this.deviceId) return;
Expand All @@ -103,7 +94,7 @@ export class Analytics {
}

/**
* Send an event to Segment. Param `event` must exist in
* Send an event to RudderStack. Param `event` must exist in
* `~/analytics/event`, and if properties are associated with it, they must
* be defined as part of `EventProperties` in the same file
*/
Expand Down Expand Up @@ -131,7 +122,7 @@ export class Analytics {
}

/**
* Set `deviceId` for use as the identifier in Segment. This DOES NOT call
* Set `deviceId` for use as the identifier in RudderStack. This DOES NOT call
* `identify()`, you must do that on your own.
*/
setDeviceId(deviceId: string) {
Expand All @@ -140,14 +131,14 @@ export class Analytics {
}

/**
* Enable Segment tracking. Defaults to enabled.
* Enable RudderStack tracking. Defaults to enabled.
*/
enable() {
this.disabled = false;
}

/**
* Disable Segment tracking. Defaults to enabled.
* Disable RudderStack tracking. Defaults to enabled.
*/
disable() {
this.disabled = true;
Expand Down

0 comments on commit c2d606f

Please sign in to comment.