Skip to content
Open
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
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/android/src/main/assets/
/lib/
/types.js
/types.js.flow
/types.mjs
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"standard-kit/prettier",
"standard-kit/prettier/node",
"standard-kit/prettier/jsx",
"standard-kit/prettier/flow",
"standard-kit/prettier/typescript"
],
"parserOptions": {
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/android/src/main/assets/
/lib/
/types.js
/types.js.flow
/types.mjs

# Package managers:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

- removed: `EdgeCurrencyInfo.metaTokens`
- removed: `EdgeNetworkFee` and `EdgeNetworkFee2` type definitions.
- removed: Flow type definitions. We only support TypeScript now.

## 2.43.3 (2026-03-10)

- fixed: Fixed IndexDB cache issue on Android causing failed mixFetch initialization.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This library implements the Edge login system. It runs inside a client applicati

## Documentation

We have documentation at https://developer.airbitz.co/javascript/, but our [Flow types](./src/types/types.js) are the best, most up-to-date reference for what this library contains.
Our [type definitions](./src/types/types.ts) are the best, most up-to-date reference for what this library contains.

## Account Management UI

Expand Down
5 changes: 0 additions & 5 deletions flow-typed/react-native-libs.js

This file was deleted.

5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@
"/README.md",
"/src/types/",
"/types.d.ts",
"/types.js.flow",
"/types.js",
"/types.mjs"
],
"scripts": {
"build.lib": "sucrase ./src -q -d ./lib -t typescript,jsx",
"build.node": "rollup -c",
"build.react-native": "webpack",
"build.types": "node -r sucrase/register ./scripts/make-types.ts && flow",
"clean": "rimraf lib android/src/main/assets",
"fix.android": "(cd android; ./format-java.sh)",
"fix.ios": "swift-format format -i ios/*.swift",
Expand Down Expand Up @@ -129,14 +127,12 @@
"copy-webpack-plugin": "^13.0.1",
"eslint": "^7.32.0",
"eslint-config-standard-kit": "0.15.1",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-simple-import-sort": "^6.0.1",
"flow-bin": "^0.89.0",
"husky": "^7.0.0",
"lint-staged": "^10.2.11",
"mocha": "^10.1.0",
Expand All @@ -145,7 +141,6 @@
"process": "^0.11.10",
"rimraf": "^3.0.2",
"rollup": "^2.44.0",
"rollup-plugin-flow-entry": "^0.3.6",
"rollup-plugin-mjs-entry": "^0.1.1",
"stream-browserify": "^3.0.0",
"sucrase": "^3.20.0",
Expand Down
15 changes: 2 additions & 13 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import babel from '@rollup/plugin-babel'
import resolve from '@rollup/plugin-node-resolve'
import flowEntry from 'rollup-plugin-flow-entry'
import mjs from 'rollup-plugin-mjs-entry'

import packageJson from './package.json'
Expand All @@ -25,22 +24,12 @@ export default [
external,
input: './src/index.ts',
output: { file: packageJson.main, format: 'cjs' },
plugins: [
resolve(resolveOpts),
babel(babelOpts),
flowEntry({ types: './lib/flow/exports.js' }),
mjs()
]
plugins: [resolve(resolveOpts), babel(babelOpts), mjs()]
},
{
external,
input: './src/types/types.ts',
output: { file: './types.js', format: 'cjs' },
plugins: [
resolve(resolveOpts),
babel(babelOpts),
flowEntry({ types: './lib/flow/types.js' }),
mjs()
]
plugins: [resolve(resolveOpts), babel(babelOpts), mjs()]
}
]
57 changes: 0 additions & 57 deletions scripts/make-types.ts

This file was deleted.

19 changes: 1 addition & 18 deletions src/core/account/custom-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,6 @@ function contractToTokenId(contractAddress: string): string {
return contractAddress.toLowerCase().replace(/^0x/, '')
}

function upgradeMetaTokens(metaTokens: EdgeMetaToken[]): EdgeTokenMap {
const out: EdgeTokenMap = {}
for (const metaToken of metaTokens) {
const { contractAddress } = metaToken
if (contractAddress == null) continue
out[contractToTokenId(contractAddress)] = {
currencyCode: metaToken.currencyCode,
denominations: metaToken.denominations,
displayName: metaToken.currencyName,
networkLocation: { contractAddress: metaToken.contractAddress }
}
}
return out
}

export function makeMetaToken(token: EdgeToken): EdgeMetaToken {
const { currencyCode, displayName, denominations, networkLocation } = token
const cleanLocation = asMaybeContractLocation(networkLocation)
Expand Down Expand Up @@ -137,9 +122,7 @@ export async function loadBuiltinTokens(
Object.keys(state.plugins.currency).map(async pluginId => {
const plugin = state.plugins.currency[pluginId]
const tokens: EdgeTokenMap =
plugin.getBuiltinTokens == null
? upgradeMetaTokens(plugin.currencyInfo.metaTokens ?? [])
: await plugin.getBuiltinTokens()
plugin.getBuiltinTokens == null ? {} : await plugin.getBuiltinTokens()
dispatch({
type: 'ACCOUNT_BUILTIN_TOKENS_LOADED',
payload: { accountId, pluginId, tokens }
Expand Down
8 changes: 4 additions & 4 deletions src/core/context/internal-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ export class EdgeInternalStuff extends Bridgeable<{}> {
}

/**
* Our public Flow types don't include the internal stuff,
* so this function hacks around Flow to retrieve it.
* Our public types don't include the internal stuff,
* so this function hacks around those to retrieve it.
*/
export function getInternalStuff(context: EdgeContext): EdgeInternalStuff {
const flowHack: any = context
return flowHack.$internalStuff
const typeHack: any = context
return typeHack.$internalStuff
}
6 changes: 3 additions & 3 deletions src/core/login/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export function searchTree<T>(
): T | undefined {
if (predicate(node)) return node

const flowHack: any = node
if (flowHack.children != null) {
for (const child of flowHack.children) {
const typeHack: any = node
if (typeHack.children != null) {
for (const child of typeHack.children) {
const out = searchTree(child, predicate)
if (out != null) return out
}
Expand Down
29 changes: 3 additions & 26 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,7 @@ export interface EdgeTokenMap {
[tokenId: string]: EdgeToken
}

/**
* Available tokens stored in the `EdgeCurrencyInfo`,
* or parsed out of URI's.
*/
/** @deprecated Use EdgeToken instead */
export interface EdgeMetaToken {

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.

Do we need to keep the type around?

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.

It's still used in the legacy URL parsing API.

currencyCode: string
currencyName: string
Expand Down Expand Up @@ -550,9 +547,6 @@ export interface EdgeCurrencyInfo {
/** @deprecated The default user settings are always `{}` */
defaultSettings?: JsonObject

/** @deprecated Use EdgeCurrencyPlugin.getBuiltinTokens instead */
metaTokens?: EdgeMetaToken[]

/** @deprecated Use memoOptions instead. */
memoMaxLength?: number // Max number of text characters, if supported

Expand Down Expand Up @@ -822,13 +816,13 @@ export interface EdgeSyncStatus {
totalRatio: number

/** How far along the chain we are, for chains that scan by blocks. */
blockRatio?: [number, number] // [ourHeight: number, chainHeight: number]
blockRatio?: [ourHeight: number, chainHeight: number]

/**
* Free-form values to show the user, for engines with unusual info.
* For example: `{ "donwload speed": "1 KB/s" }`
*/
otherParams?: { [name: string]: string } // Record<string, string>
otherParams?: Record<string, string>
}

export interface EdgeTxidMap {
Expand Down Expand Up @@ -2220,20 +2214,3 @@ export interface EdgeFakeWorld {
readonly goOffline: (offline?: boolean) => Promise<void>
readonly dumpFakeUser: (account: EdgeAccount) => Promise<EdgeFakeUser>
}

// ---------------------------------------------------------------------
// deprecated types
// ---------------------------------------------------------------------

/** @deprecated use EdgeTxAmount instead */
export interface EdgeNetworkFee {
readonly currencyCode: string
readonly nativeAmount: string
}

/** @deprecated use EdgeTxAmount instead */
export interface EdgeNetworkFee2 {
readonly nativeAmount: string
readonly currencyPluginId: string
readonly tokenId: EdgeTokenId
}
1 change: 0 additions & 1 deletion test/fake/fake-broken-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const brokenEnginePlugin: EdgeCurrencyPlugin = {
displayName: 'Broken Engine',
chainDisplayName: 'Broken Chain',
assetDisplayName: 'Broke Coin',
metaTokens: [],
pluginId: 'broken-engine',
transactionExplorer: '',
walletType: 'wallet:broken'
Expand Down
1 change: 0 additions & 1 deletion test/fake/fake-currency-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const fakeCurrencyInfo: EdgeCurrencyInfo = {

// Deprecated:
defaultSettings: {},
metaTokens: [],
memoType: 'text'
}

Expand Down
28 changes: 0 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2728,14 +2728,6 @@ eslint-plugin-es@^3.0.0:
eslint-utils "^2.0.0"
regexpp "^3.0.0"

eslint-plugin-flowtype@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-5.2.0.tgz#a4bef5dc18f9b2bdb41569a4ab05d73805a3d261"
integrity sha512-z7ULdTxuhlRJcEe1MVljePXricuPOrsWfScRXFhNzVD5dmTHWjIF57AxD0e7AbEoLSbjSsaA5S+hCg43WvpXJQ==
dependencies:
lodash "^4.17.15"
string-natural-compare "^3.0.1"

eslint-plugin-import@^2.25.3:
version "2.25.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.25.3.tgz#a554b5f66e08fb4f6dc99221866e57cfff824766"
Expand Down Expand Up @@ -3174,11 +3166,6 @@ flatted@^3.1.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.0.tgz#a5d06b4a8b01e3a63771daa5cb7a1903e2e57067"
integrity sha512-tW+UkmtNg/jv9CSofAKvgVcO7c2URjhTdW1ZTkcAritblu8tajiYy7YisnIflEwtKssCtOxpnBRoCB7iap0/TA==

flow-bin@^0.89.0:
version "0.89.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.89.0.tgz#6bd29c2af7e0f429797f820662f33749105c32fa"
integrity sha512-DkO4PsXYrl53V6G5+t5HbRMC5ajYUQej2LEGPUZ+j9okTb41Sn5j9vfxsCpXMEAslYnQoysHhYu4GUZsQX/DrQ==

follow-redirects@^1.0.0:
version "1.15.6"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b"
Expand Down Expand Up @@ -4031,11 +4018,6 @@ lodash.truncate@^4.4.2:
resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193"
integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=

lodash@^4.17.15:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

log-symbols@4.1.0, log-symbols@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503"
Expand Down Expand Up @@ -4961,11 +4943,6 @@ rimraf@^3.0.2:
dependencies:
glob "^7.1.3"

rollup-plugin-flow-entry@^0.3.6:
version "0.3.6"
resolved "https://registry.yarnpkg.com/rollup-plugin-flow-entry/-/rollup-plugin-flow-entry-0.3.6.tgz#30f6c6e2d693766379078242a6e01d5cec1f55e9"
integrity sha512-/czSXbCDciVG/3kUrbc57ldpKsu234oTwc6r6O9+KgeGzfJCaqtShCfpJDsiix7ZQ48ISG6iPsMTjbUcL5hLbw==

rollup-plugin-mjs-entry@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-mjs-entry/-/rollup-plugin-mjs-entry-0.1.1.tgz#b3ab47e8d49ddb1916e36ba2480dc8a62a22d533"
Expand Down Expand Up @@ -5340,11 +5317,6 @@ string-argv@0.3.1:
resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da"
integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==

string-natural-compare@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4"
integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw==

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
Expand Down
Loading