Skip to content

Commit 3ee8158

Browse files
committed
dust factoring
1 parent 5fe1d09 commit 3ee8158

File tree

137 files changed

+512
-512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+512
-512
lines changed

.eslintrc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2019-2021 @polkadot/extension authors & contributors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
// const base = require("@reef-defi/dev/config/eslint.cjs");
4+
// const base = require("@dust-defi/dev/config/eslint.cjs");
55

66
// module.exports = {
77
// root: true,
@@ -39,7 +39,7 @@
3939

4040

4141

42-
// This code was copied from from @reef-defi/dev/config/eslint.cjs
42+
// This code was copied from from @dust-defi/dev/config/eslint.cjs
4343
// In addition ignorePatterns was added and parser options links to projects tsconfig.json
4444
// Added all previously named rules
4545
// * This is not the most optimal solution!

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# CHANGELOG
22

33
## 1.0.0 May 20, 2022
4-
- Account Reef EVM binding
4+
- Account Dust EVM binding
55
- Tokens dashboard
66
- Send
77
- Swap
88

99
## 0.41.1 Nov 11, 2021
10-
- forked to `@reef-defi/extension`
10+
- forked to `@dust-defi/extension`
1111

1212
# Polkadot.js extension changelog
1313
## 0.41.1 Nov 8, 2021

README.md

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
[![reef-defi](https://img.shields.io/badge/reef--defi-js-blueviolet)](https://docs.reef.finance/docs/developers/js_libraries/#reefjs)
1+
[![dust-defi](https://img.shields.io/badge/dust--defi-js-blueviolet)](https://docs.dust.llc/docs/developers/js_libraries/#dustjs)
22
![license](https://img.shields.io/badge/License-Apache%202.0-blue?logo=apache&style=flat-square)
3-
[![npm](https://img.shields.io/npm/v/@reef-defi/extension-dapp?logo=npm&style=flat-square)](https://www.npmjs.com/package/@reef-defi/extension-dapp)
3+
[![npm](https://img.shields.io/npm/v/@dust-defi/extension-dapp?logo=npm&style=flat-square)](https://www.npmjs.com/package/@dust-defi/extension-dapp)
44

5-
# reef.io wallet extension
5+
# dust.llc wallet extension
66

77
A very simple scaffolding browser extension that injects a [@polkadot/api](https://github.com/polkadot-js/api) Signer into a page, along with any associated accounts, allowing for use by any dapp. This is an extensible POC implementation of a Polkadot/Substrate browser signer. To support both
88

99
As it stands, it does one thing: it _only_ manages accounts and allows the signing of transactions with those accounts. It does not inject providers for use by dapps at this early point, nor does it perform wallet functions where it constructs and submits txs to the network.
1010

1111
## Installation
1212

13-
- On Chrome, install via [Chrome web store](https://chrome.google.com/webstore/detail/reefjs-extension/mjgkpalnahacmhkikiommfiomhjipgjn)
14-
- On Firefox, install via [Firefox add-ons](https://addons.mozilla.org/en-US/firefox/addon/reef-js-extension/)
13+
- On Chrome, install via [Chrome web store](https://chrome.google.com/webstore/detail/dustjs-extension/mjgkpalnahacmhkikiommfiomhjipgjn)
14+
- On Firefox, install via [Firefox add-ons](https://addons.mozilla.org/en-US/firefox/addon/dust-js-extension/)
1515

1616
## Usage
17-
To install the component, do `yarn add @reef-defi/extension-dapp`.
17+
To install the component, do `yarn add @dust-defi/extension-dapp`.
1818

1919
```js
2020
import {
2121
web3Accounts,
2222
web3Enable,
2323
web3FromAddress,
24-
} from '@reef-defi/extension-dapp';
25-
const { Provider } = require("@reef-defi/evm-provider");
24+
} from '@dust-defi/extension-dapp';
25+
const { Provider } = require("@dust-defi/evm-provider");
2626
const { WsProvider } = require("@polkadot/api");
2727

2828
// returns an array of all the injected sources
@@ -39,8 +39,8 @@ const SENDER = '5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFabHE';
3939
// finds an injector for an address
4040
const injector = await web3FromAddress(SENDER);
4141

42-
// connect to the testnet Reef node
43-
const URL = "wss://rpc-testnet.reefscan.com/ws ";
42+
// connect to the testnet Dust node
43+
const URL = "wss://rpc-testnet.dustscan.com/ws ";
4444
const provider = new Provider({
4545
provider: new WsProvider(URL),
4646
});
@@ -57,30 +57,30 @@ api.tx.balances
5757
```
5858

5959
## Documentation and examples
60-
A single file example (React) on how to use the extension can be seen in [ui-examples repo](https://github.com/reef-defi/ui-examples/blob/master/packages/example-react/src/index.tsx#L165).
60+
A single file example (React) on how to use the extension can be seen in [ui-examples repo](https://github.com/dust-defi/ui-examples/blob/master/packages/example-react/src/index.tsx#L165).
6161

6262
To find out more about how to use the extension as a Dapp developer, cookbook, as well as answers to most frequent questions in the [Polkadot-js extension documentation](https://polkadot.js.org/docs/extension/)
6363

6464

65-
## Transition from/support both `polkadot.js`/`reef.io wallet` extensions
66-
It is possible to support both `reef.io wallet` as well as `polkadot.js` extension in your app. As long as you request the source extension of the injected account, the correct extension will be used to sign the transaction.
65+
## Transition from/support both `polkadot.js`/`dust.io wallet` extensions
66+
It is possible to support both `dust.io wallet` as well as `polkadot.js` extension in your app. As long as you request the source extension of the injected account, the correct extension will be used to sign the transaction.
6767

68-
### Change to `@reef-defi` dependencies
69-
If you use `@polkadot/extension-dapp` dependencies, change them to `@reef-defi/extension-dapp` dependencies:
68+
### Change to `@dust-defi` dependencies
69+
If you use `@polkadot/extension-dapp` dependencies, change them to `@dust-defi/extension-dapp` dependencies:
7070

71-
1. change `@polkadot/extension-dapp` to `"@reef-defi/extension-dapp":"^"` in your `package.json`.
71+
1. change `@polkadot/extension-dapp` to `"@dust-defi/extension-dapp":"^"` in your `package.json`.
7272
2. call 'yarn
73-
3. change the imports to `@reef-defi/extension*` wherever you use the imports from `@polkadot/extension*`.
73+
3. change the imports to `@dust-defi/extension*` wherever you use the imports from `@polkadot/extension*`.
7474

7575
### Use `web3FromSource` to find the source extension for signing.
7676

77-
1. check where the extension signer is used. This is most likely where `Signer` is imported from `@reef-defi/evm-provider`.
77+
1. check where the extension signer is used. This is most likely where `Signer` is imported from `@dust-defi/evm-provider`.
7878
2. the signer for the account should be acquired dynamically. You have 2 options:
7979

8080
1. Change it to use `web3FromAddress(address: string)`:
8181

8282
```
83-
import { web3FromAddress } from "@reef-defi/extension-dapp";
83+
import { web3FromAddress } from "@dust-defi/extension-dapp";
8484
const injector = await web3FromAddress('5DTestUPts3kjeXSTMyerHihn1uwMfLj8vU8sqF7qYrFabHE');
8585
```
8686

@@ -89,7 +89,7 @@ If you use `@polkadot/extension-dapp` dependencies, change them to `@reef-defi/e
8989
2. Or use `web3FromSource` call, which accepts the extension's name, which can be found in the `meta` field:
9090

9191
```js
92-
import { web3FromSource } from "@reef-defi/extension-dapp";
92+
import { web3FromSource } from "@dust-defi/extension-dapp";
9393
import { keyring } from "@polkadot/ui-keyring";
9494

9595
const getAccountSigner = async (accountId: string) => {
@@ -107,7 +107,7 @@ If you use `@polkadot/extension-dapp` dependencies, change them to `@reef-defi/e
107107
where `accountId` is the account address. If you do not have `keyring` loaded, use the `injectedAccounts` array obtained from `web3Accounts`, e.g.
108108
109109
```js
110-
import { web3Accounts } from '@reef-defi/extension-dapp';
110+
import { web3Accounts } from '@dust-defi/extension-dapp';
111111

112112
await injectedPromise
113113
.then(() => web3Accounts())
@@ -128,7 +128,7 @@ If you use `@polkadot/extension-dapp` dependencies, change them to `@reef-defi/e
128128
})
129129
```
130130
131-
`accountSigner` can then be used in [`evm-provider`](https://github.com/reef-defi/evm-provider.js/commits/master) Signer to sign the messages, and the correct extension is used.
131+
`accountSigner` can then be used in [`evm-provider`](https://github.com/dust-defi/evm-provider.js/commits/master) Signer to sign the messages, and the correct extension is used.
132132
133133
## Development version
134134
@@ -146,9 +146,9 @@ Steps to build the extension and view your changes in a browser:
146146
- check "Enable add-on debugging"
147147
- click on "Load Temporary Add-on" and point to `packages/extension/build/manifest.json`
148148
- if developing, after making changes - reload the extension
149-
3. When visiting `console.reefscan.com` it will inject the extension
149+
3. When visiting `console.dustscan.com` it will inject the extension
150150

151-
Once added, you can create an account (via a generated seed) or import via an existing seed. The [console UI](https://console.reefscan.com), when loaded, will show these accounts as `<account name> (extension)`
151+
Once added, you can create an account (via a generated seed) or import via an existing seed. The [console UI](https://console.dustscan.com), when loaded, will show these accounts as `<account name> (extension)`
152152

153153
## Development
154154

@@ -171,9 +171,9 @@ This approach is used to support multiple external signers in for instance [apps
171171

172172
The extension injection interfaces are generic, i.e. it is designed to allow any extension developer to easily inject extensions (that conforms to a specific interface) and at the same time, it allows for any dapp developer to easily enable the interfaces from multiple extensions at the same time. It is not an all-or-nothing approach, but rather it is an ecosystem where the user can choose which extensions fit their style best.
173173

174-
From a dapp developer perspective, the only work needed is to include the [@reef-defi/extension-dapp](packages/extension-dapp/) package and call the appropriate enabling function to retrieve all the extensions and their associated interfaces.
174+
From a dapp developer perspective, the only work needed is to include the [@dust-defi/extension-dapp](packages/extension-dapp/) package and call the appropriate enabling function to retrieve all the extensions and their associated interfaces.
175175

176-
From an extension developer perspective, the only work required is to enable the extension via the razor-thin [@reef-defi/extension-inject](packages/extension-inject/) wrapper. Any dapp using the above interfaces will have access to the extension via this interface.
176+
From an extension developer perspective, the only work required is to enable the extension via the razor-thin [@dust-defi/extension-inject](packages/extension-inject/) wrapper. Any dapp using the above interfaces will have access to the extension via this interface.
177177

178178
When there is more than one extension, each will populate an entry via the injection interface and each will be made available to the dapp. The `Injected` interface, as returned via `enable`, contains the following information for any compliant extension -
179179

@@ -214,15 +214,15 @@ interface Signer extends SignerInterface {
214214
215215
## Injection information
216216
217-
The information contained in this section may change and evolve. It is therefore recommended that all access is done via the [@reef-defi/extension-dapp](packages/extension-dapp/) (for dapps) and [@reef-defi/extension-inject](packages/extension-inject/) (for extensions) packages, which removes the need to work with the lower-level targets.
217+
The information contained in this section may change and evolve. It is therefore recommended that all access is done via the [@dust-defi/extension-dapp](packages/extension-dapp/) (for dapps) and [@dust-defi/extension-inject](packages/extension-inject/) (for extensions) packages, which removes the need to work with the lower-level targets.
218218
219219
The extension injects `injectedWeb3` into the global `window` object, exposing the following: (This is meant to be generic across extensions, allowing any dapp to utilize multiple signers, and pull accounts from multiples, as they are available.)
220220
221221
```js
222222
window.injectedWeb3 = {
223223
// this is the name for this extension, there could be multiples injected,
224-
// each with their own keys, here `reef` is for this extension
225-
'reef': {
224+
// each with their own keys, here `dust` is for this extension
225+
'dust': {
226226
// semver for the package
227227
version: '0.1.0',
228228

@@ -243,7 +243,7 @@ window.injectedWeb3 = {
243243
244244
### Using the mnemonic and password from the extension
245245
246-
When you create a keypair via the extension, it supplies a 12-word mnemonic seed and asks you to create a password. This password only encrypts the private key on disk so that the password is required to spend funds in `console.reefscan.com` or to import the account from backup. The password does not protect the mnemonic phrase. That is, if an attacker were to acquire the mnemonic phrase, they would be able to use it to spend funds without the password.
246+
When you create a keypair via the extension, it supplies a 12-word mnemonic seed and asks you to create a password. This password only encrypts the private key on disk so that the password is required to spend funds in `console.dustscan.com` or to import the account from backup. The password does not protect the mnemonic phrase. That is, if an attacker were to acquire the mnemonic phrase, they would be able to use it to spend funds without the password.
247247
248248
### Importing mnemonics from other key generation utilities
249249

babel.config.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// Copyright 2019-2021 @polkadot/extension authors & contributors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
module.exports = require('@reef-defi/dev/config/babel-config-cjs.cjs');
4+
module.exports = require('@dust-defi/dev/config/babel-config-cjs.cjs');

jest.config.cjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Copyright 2019-2021 @polkadot/extension authors & contributors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
const config = require('@reef-defi/dev/config/jest.cjs');
4+
const config = require('@dust-defi/dev/config/jest.cjs');
55

66
module.exports = {
77
...config,
88
moduleNameMapper: {
9-
'@reef-defi/extension-(base|chains|compat-metamask|dapp|inject|ui)(.*)$': '<rootDir>/packages/extension-$1/src/$2',
9+
'@dust-defi/extension-(base|chains|compat-metamask|dapp|inject|ui)(.*)$': '<rootDir>/packages/extension-$1/src/$2',
1010
// eslint-disable-next-line sort-keys
11-
'@reef-defi/extension(.*)$': '<rootDir>/packages/extension/src/$1',
11+
'@dust-defi/extension(.*)$': '<rootDir>/packages/extension/src/$1',
1212
'\\.(css|less)$': 'empty/object',
1313
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
1414
'<rootDir>/__mocks__/fileMock.js'

package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"author": "Reef Chain",
3-
"bugs": "https://github.com/reef-defi/browser-extension/issues",
4-
"homepage": "https://github.com/reef-defi/browser-extension#readme",
3+
"bugs": "https://github.com/dustprotocol/browser-extension/issues",
4+
"homepage": "https://github.com/dustprotocol/browser-extension#readme",
55
"license": "Apache-2",
66
"packageManager": "yarn@3.0.1",
77
"private": true,
88
"repository": {
99
"type": "git",
10-
"url": "https://github.com/reef-defi/browser-extension.git"
10+
"url": "https://github.com/dustprotocol/browser-extension.git"
1111
},
1212
"sideEffects": false,
1313
"version": "1.0.0",
@@ -34,7 +34,7 @@
3434
},
3535
"devDependencies": {
3636
"@babel/core": "^7.15.8",
37-
"@reef-defi/dev": "^0.63.19",
37+
"@dust-defi/dev": "^0.63.19",
3838
"@types/jest": "^27.0.2",
3939
"@typescript-eslint/eslint-plugin": "^5.0.0",
4040
"i18next-scanner": "^3.1.0",
@@ -45,11 +45,11 @@
4545
"@polkadot/types": "6.7.1",
4646
"@polkadot/ui-settings": "0.86.5",
4747
"@polkadot/util": "^7.8.2",
48-
"@reef-defi/keyring": "^7.8.2",
49-
"@reef-defi/networks": "^7.8.2",
50-
"@reef-defi/util": "^7.8.2",
51-
"@reef-defi/util-crypto": "^7.8.2",
52-
"@reef-defi/x-fetch": "^7.8.2",
48+
"@dust-defi/keyring": "^7.8.2",
49+
"@dust-defi/networks": "^7.8.2",
50+
"@dust-defi/util": "^7.8.2",
51+
"@dust-defi/util-crypto": "^7.8.2",
52+
"@dust-defi/x-fetch": "^7.8.2",
5353
"babel-core": "^7.0.0-bridge.0",
5454
"safe-buffer": "^5.2.1",
5555
"typescript": "^4.4.4"

packages/reef/extension-ui/components/Bind.tsx packages/dust/extension-ui/components/Bind.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { appState, Components, hooks, ReefSigner } from '@reef-defi/react-lib';
2-
import { TxStatusUpdate } from '@reef-defi/react-lib/dist/utils';
1+
import { appState, Components, hooks, DustSigner } from '@dust-defi/react-lib';
2+
import { TxStatusUpdate } from '@dust-defi/react-lib/dist/utils';
33
import React, { useEffect, useState } from 'react';
44

55
import { SigningOrChildren } from './SigningOrChildren';
@@ -37,9 +37,9 @@ const onTxUpdate = (state: TxStatusUpdate) => {
3737
};
3838

3939
export const Bind = (): JSX.Element => {
40-
const accounts: ReefSigner[] | undefined = hooks.useObservableState(appState.signers$);
41-
const selectedSigner: ReefSigner | undefined = hooks.useObservableState(appState.selectedSigner$);
42-
const [bindSigner, setBindSigner] = useState<ReefSigner>();
40+
const accounts: DustSigner[] | undefined = hooks.useObservableState(appState.signers$);
41+
const selectedSigner: DustSigner | undefined = hooks.useObservableState(appState.selectedSigner$);
42+
const [bindSigner, setBindSigner] = useState<DustSigner>();
4343
const theme = localStorage.getItem('theme');
4444

4545
useEffect(() => {

packages/reef/extension-ui/components/HeaderComponent.tsx packages/dust/extension-ui/components/HeaderComponent.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
import { faCog, faCoins, faExchangeAlt, faPaperPlane, faWallet } from '@fortawesome/free-solid-svg-icons';
33
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4-
import { ActionContext } from '@reef-defi/extension-ui/components';
5-
import { appState, hooks, ReefSigner, utils } from '@reef-defi/react-lib';
4+
import { ActionContext } from '@dust-defi/extension-ui/components';
5+
import { appState, hooks, DustSigner, utils } from '@dust-defi/react-lib';
66
import React, { useCallback, useContext, useRef, useState } from 'react';
77
import styled from 'styled-components';
88

@@ -15,7 +15,7 @@ interface NavHeaderComp {
1515

1616
function NavHeaderComp (): React.ReactElement<NavHeaderComp> {
1717
const onAction = useContext(ActionContext);
18-
const selectedAccount: ReefSigner|undefined = hooks.useObservableState(appState.selectedSigner$);
18+
const selectedAccount: DustSigner|undefined = hooks.useObservableState(appState.selectedSigner$);
1919
const openRoute = useCallback(
2020
(path: string) => onAction(path),
2121
[onAction]
@@ -38,7 +38,7 @@ function NavHeaderComp (): React.ReactElement<NavHeaderComp> {
3838
const theme = localStorage.getItem('theme');
3939

4040
return (<div className={theme === 'dark' ? 'navigation navigation--dark' : 'navigation'}>
41-
<div className='reef-logo'>
41+
<div className='dust-logo'>
4242
<svg
4343
enableBackground='new -466.4 720.2 144.6 73.3'
4444
version='1.1'
@@ -193,7 +193,7 @@ function NavHeaderComp (): React.ReactElement<NavHeaderComp> {
193193
</div>
194194
<div className='navigation__account-tokens'>
195195
<img src='https://s2.coinmarketcap.com/static/img/coins/64x64/6951.png' />
196-
<div className='navigation__account-tokens-amount'>{selectedAccount ? utils.toReefBalanceDisplay(selectedAccount.balance).replace('-', '0.00').replace(' REEF', '') : ''}</div>
196+
<div className='navigation__account-tokens-amount'>{selectedAccount ? utils.toDustBalanceDisplay(selectedAccount.balance).replace('-', '0.00').replace(' DUST', '') : ''}</div>
197197
</div>
198198
</button>
199199

packages/reef/extension-ui/components/SigningOrChildren.tsx packages/dust/extension-ui/components/SigningOrChildren.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { SigningReqContext } from '@reef-defi/extension-ui/components';
2-
import Signing from '@reef-defi/extension-ui/Popup/Signing';
1+
import { SigningReqContext } from '@dust-defi/extension-ui/components';
2+
import Signing from '@dust-defi/extension-ui/Popup/Signing';
33
import React, { useContext } from 'react';
44

55
interface SigningOrComponent{

0 commit comments

Comments
 (0)