Page MenuHomePhabricator

[Cashtab] [Extension and components] Pass address to web page
AbandonedPublic

Authored by bytesofman on Oct 13 2022, 17:20.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

T2550

Allow a user to pass ecash address from extension to a webpage

Test Plan
cd web/cashtab
npm run extension

Navigate to brave://extensions and update. Make sure only this local version is active, not the published version

cd web/cashtab-components
npm run storybook

Open the extension at least once. This triggers the storage migration of the address to the extension storage API, which is necessary for it to be available to the web page.
Navigate to the GetAddress component
Confirm address appears after button is clicked

Diff Detail

Repository
rABC Bitcoin ABC
Branch
extension-address-api
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 20596
Build 40857: Build Diffcashtab-components-tests · cashtab-tests
Build 40856: arc lint + arc unit

Event Timeline

bytesofman planned changes to this revision.EditedOct 13 2022, 17:21

To do

  • Add address to extension storage API
  • Create a component to fetch the address from the extension
  • Get the extension to post a message to the web page with the address
  • Get the cashtab component to get the message and update the component

Tail of the build log:

npm WARN EBADENGINE   package: 'postcss-overflow-shorthand@3.0.4',
npm WARN EBADENGINE   required: { node: '^12 || ^14 || >=16' },
npm WARN EBADENGINE   current: { node: 'v15.14.0', npm: '7.7.6' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'postcss-place@7.0.5',
npm WARN EBADENGINE   required: { node: '^12 || ^14 || >=16' },
npm WARN EBADENGINE   current: { node: 'v15.14.0', npm: '7.7.6' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'postcss-preset-env@7.8.2',
npm WARN EBADENGINE   required: { node: '^12 || ^14 || >=16' },
npm WARN EBADENGINE   current: { node: 'v15.14.0', npm: '7.7.6' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'postcss-pseudo-class-any-link@7.1.6',
npm WARN EBADENGINE   required: { node: '^12 || ^14 || >=16' },
npm WARN EBADENGINE   current: { node: 'v15.14.0', npm: '7.7.6' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'postcss-selector-not@6.0.1',
npm WARN EBADENGINE   required: { node: '^12 || ^14 || >=16' },
npm WARN EBADENGINE   current: { node: 'v15.14.0', npm: '7.7.6' }
npm WARN EBADENGINE }
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated text-encoding@0.6.4: no longer maintained
npm WARN deprecated ts-custom-error@2.2.2: npm package tarball contains useless codeclimate-reporter binary, please update to version 3.1.1. See https://github.com/adriengibrat/ts-custom-error/issues/32

> cashtab@1.0.0 prepare
> cd ../.. && husky install web/cashtab/.husky

husky - Git hooks installed

added 1807 packages, and audited 1808 packages in 27s

232 packages are looking for funding
  run `npm fund` for details

5 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice 
npm notice New major version of npm available! 7.7.6 -> 8.19.2
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.19.2>
npm notice Run `npm install -g npm@8.19.2` to update!
npm notice 

> cashtab@1.0.0 build
> node scripts/build.js

Creating an optimized production build...
Failed to compile.

Module not found: Error: Can't resolve 'utils/extensionMethods' in '/work/web/cashtab/src/components'


Build cashtab-tests failed with exit code 1

Removing debug logging, simplifying storage functions

Reverting changes to Cashtab App.js caused by testing in extension build script

Reverting changes to non-extension App.css caused by errors in extension build script testing

This works okay, but there's a lot going on here and it's pretty complicated to review. This diff will serve as a proof of concept. I'll break it down into a stacked diff for production.