New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@exodus/address-provider

Package Overview
Dependencies
Maintainers
0
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@exodus/address-provider - npm Package Compare versions

Comparing version 4.2.0 to 5.0.0

api/index.js

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

## [5.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/address-provider@4.2.0...@exodus/address-provider@5.0.0) (2023-07-05)
### ⚠ BREAKING CHANGES
- export feature definition from address-provider (#2155)
### Features
- `useCache` option in addressesProvider ([#2122](https://github.com/ExodusMovement/exodus-hydra/issues/2122)) ([7849973](https://github.com/ExodusMovement/exodus-hydra/commit/7849973a85086128370c208bdb8cf5b014366f5b))
- **address-provider:** move mock config atom and setter ([#2235](https://github.com/ExodusMovement/exodus-hydra/issues/2235)) ([b051025](https://github.com/ExodusMovement/exodus-hydra/commit/b0510256d557246589f939b64bec7e38b17ef779))
- export feature definition from address-provider ([#2155](https://github.com/ExodusMovement/exodus-hydra/issues/2155)) ([a4f8da3](https://github.com/ExodusMovement/exodus-hydra/commit/a4f8da39400bac23f3d84afdb56315b5a8a37567))
## [4.2.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/address-provider@4.1.1...@exodus/address-provider@4.2.0) (2023-06-22)

@@ -8,0 +20,0 @@

12

module/address-provider.js

@@ -12,3 +12,3 @@ export class AddressProvider {

const provider = this.#getAddressProvider({ walletAccount })
return provider.getAddress(opts)
return provider.getAddress({ useCache: true, ...opts })
}

@@ -43,3 +43,3 @@

const provider = this.#getAddressProvider({ walletAccount })
return provider.getReceiveAddress(opts)
return provider.getReceiveAddress({ useCache: false, ...opts })
}

@@ -50,3 +50,3 @@

const provider = this.#getAddressProvider({ walletAccount })
return provider.getChangeAddress(opts)
return provider.getChangeAddress({ useCache: false, ...opts })
}

@@ -57,8 +57,9 @@

const provider = this.#getAddressProvider({ walletAccount })
return provider.getReceiveAddresses(opts)
return provider.getReceiveAddresses({ useCache: false, ...opts })
}
getChangeAddresses = async (opts) => {
const { walletAccount } = opts
const provider = this.#getAddressProvider({ walletAccount })
return provider.getChangeAddresses(opts)
return provider.getChangeAddresses({ useCache: false, ...opts })
}

@@ -71,2 +72,3 @@ }

id: 'addressProvider',
type: 'module',
factory: createAddressProvider,

@@ -73,0 +75,0 @@ dependencies: ['getAddressProvider'],

@@ -26,2 +26,3 @@ import { get, set } from 'lodash'

id: 'addressCache',
type: 'module',
factory: createAddressCache,

@@ -28,0 +29,0 @@ }

@@ -9,3 +9,3 @@ import addressProviderDefinition from './address-provider'

export default function createAddressProviderDependencies({ mockAddresses, useTrezor } = {}) {
export default function createAddressProviderModuleDefinitions({ mockAddresses, useTrezor } = {}) {
const dependencies = [

@@ -19,2 +19,3 @@ {

: seedAddressProviderDefinition,
writesAtoms: mockAddresses ? ['mockConfigAtom'] : [],
},

@@ -24,2 +25,3 @@ {

id: 'getAddressProvider',
type: 'module',
factory:

@@ -26,0 +28,0 @@ ({ seedAddressProvider, trezorAddressProvider }) =>

import { Address } from '@exodus/models'
import { get } from 'lodash'
import { get, merge } from 'lodash'
import { SeedAddressProvider } from './seed-address-provider'

@@ -9,3 +9,3 @@

#assetsModule
#mockAddresses
#mockConfigAtom

@@ -16,6 +16,3 @@ constructor({ addressCache = createAddressCache(), assetsModule, mockConfigAtom, ...rest }) {

this.#assetsModule = assetsModule
mockConfigAtom.get().then((mockConfig) => {
this.#mockAddresses = mockConfig?.addresses
})
this.#mockConfigAtom = mockConfigAtom
}

@@ -29,3 +26,5 @@

const mockAddressString = get(this.#mockAddresses, [
const mockAddresses = await this.#mockConfigAtom.get()
const mockAddressString = get(mockAddresses?.addresses, [
walletAccount.toString(),

@@ -47,2 +46,10 @@ asset.baseAsset?.name || assetName,

}
setDebugAddress = async ({ walletAccount, assetName, address }) => {
const currentConfig = await this.#mockConfigAtom.get()
const newAddress = { [walletAccount.toString()]: { [assetName]: { address } } }
const newConfig = merge({}, currentConfig, { addresses: newAddress })
await this.#mockConfigAtom.set(newConfig)
}
}

@@ -54,2 +61,3 @@

id: 'mockableAddressProvider',
type: 'module',
factory: createMockableAddressProvider,

@@ -56,0 +64,0 @@ dependencies: [

@@ -45,2 +45,3 @@ import { Address, AddressSet, WalletAccount } from '@exodus/models'

addressIndex: 'Number',
useCache: '?Boolean',
},

@@ -51,3 +52,3 @@ opts,

const { purpose, assetName, walletAccount, chainIndex, addressIndex } = opts
const { purpose, assetName, walletAccount, chainIndex, addressIndex, useCache = true } = opts

@@ -69,3 +70,3 @@ const asset = this.#getAsset(assetName)

const cached = await this.#addressCache.get(cachePath)
const cached = useCache ? await this.#addressCache.get(cachePath) : undefined
if (cached) return cached

@@ -88,3 +89,3 @@

getDefaultAddress = async (opts) => {
const { assetName, walletAccount, chainIndex, purpose } = opts
const { assetName, walletAccount, chainIndex, purpose, useCache } = opts
const asset = this.#getAsset(assetName)

@@ -98,2 +99,3 @@ const defaults = getDefaultPathIndexes(asset)

addressIndex: defaults.addressIndex,
useCache,
})

@@ -108,2 +110,3 @@ }

chainIndex: 'Number',
useCache: '?Boolean',
},

@@ -113,3 +116,3 @@ opts,

)
const { walletAccount, assetName, chainIndex } = opts
const { walletAccount, assetName, chainIndex, useCache } = opts
const asset = this.#getAsset(assetName)

@@ -129,2 +132,3 @@ const purpose = opts.purpose ?? getDefaultPurpose({ asset, walletAccount })

addressIndex,
useCache,
})

@@ -199,2 +203,3 @@ }

chainIndex: 'Number',
useCache: '?Boolean',
},

@@ -205,3 +210,3 @@ opts,

const { walletAccount, chainIndex, assetName } = opts
const { walletAccount, chainIndex, assetName, useCache } = opts
const asset = this.#getAsset(assetName)

@@ -238,2 +243,3 @@ if (!asset.api.hasFeature('multipleAddresses')) {

addressIndex: chain[chainIndex] || 0,
useCache,
})

@@ -289,2 +295,3 @@ )

id: 'seedAddressProvider',
type: 'module',
factory: createSeedAddressProvider,

@@ -291,0 +298,0 @@ dependencies: [

@@ -35,2 +35,3 @@ import typeforce from '@exodus/typeforce'

addressIndex: 'Number',
useCache: '?Boolean',
},

@@ -41,3 +42,10 @@ opts,

const { purpose: initialPurpose, assetName, walletAccount, chainIndex, addressIndex } = opts
const {
purpose: initialPurpose,
assetName,
walletAccount,
chainIndex,
addressIndex,
useCache = true,
} = opts

@@ -77,3 +85,3 @@ const asset = this.#getAsset(assetName)

const cached = await this.#addressCache.get(cachePath)
const cached = useCache ? await this.#addressCache.get(cachePath) : undefined
if (cached) return cached

@@ -98,3 +106,3 @@

getDefaultAddress = async ({ walletAccount, assetName, purpose, chainIndex }) => {
getDefaultAddress = async ({ walletAccount, assetName, purpose, chainIndex, useCache }) => {
typeforce(

@@ -120,6 +128,7 @@ {

walletAccount,
useCache,
})
}
getUnusedAddress = async ({ walletAccount, assetName, purpose, chainIndex }) => {
getUnusedAddress = async ({ walletAccount, assetName, purpose, chainIndex, useCache }) => {
typeforce(

@@ -146,2 +155,3 @@ {

walletAccount,
useCache,
})

@@ -215,3 +225,3 @@ }

getReceiveAddress = async ({ assetName, walletAccount, addressIndex, purpose }) => {
getReceiveAddress = async ({ assetName, walletAccount, addressIndex, purpose, useCache }) => {
typeforce(

@@ -237,2 +247,3 @@ {

walletAccount,
useCache,
})

@@ -272,3 +283,3 @@ }

getChangeAddress = async ({ assetName, walletAccount, addressIndex, purpose }) => {
getChangeAddress = async ({ assetName, walletAccount, addressIndex, purpose, useCache }) => {
typeforce(

@@ -294,2 +305,3 @@ {

walletAccount,
useCache,
})

@@ -310,2 +322,3 @@ }

id: 'trezorAddressProvider',
type: 'module',
factory: createTrezorAddressProvider,

@@ -312,0 +325,0 @@ dependencies: ['logger', 'assetsModule', 'addressCache', 'accountsAtom'],

{
"name": "@exodus/address-provider",
"version": "4.2.0",
"description": "Address provider gateway that delegates to registered address provider based on wallet account source",
"author": "Exodus Movement Inc",
"version": "5.0.0",
"description": "Address provider for deriving and tracking used and unused addresses.",
"author": "Exodus Movement Inc.",
"license": "UNLICENSED",

@@ -12,4 +12,7 @@ "scripts": {

},
"main": "module/index.js",
"main": "index.js",
"files": [
"index.js",
"api",
"atoms",
"module",

@@ -27,3 +30,3 @@ "CHANGELOG.md"

"dependencies": {
"@exodus/atoms": "^5.1.0",
"@exodus/atoms": "^5.2.1",
"@exodus/key-identifier-provider": "^1.2.0",

@@ -55,3 +58,3 @@ "@exodus/models": "^8.9.0",

},
"gitHead": "f475ba3cbfb086a2e0c3908372ffa851180dbf27"
"gitHead": "48de555ca2972a750f2323731d7db3cf63d2839c"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc