@0xsequence/provider
Advanced tools
Comparing version 0.8.3 to 0.8.4
# @0xsequence/provider | ||
## 0.8.4 | ||
### Patch Changes | ||
- - minor improvements, name updates and comments | ||
- Updated dependencies [undefined] | ||
- @0xsequence/abi@0.8.4 | ||
- @0xsequence/auth@0.8.4 | ||
- @0xsequence/config@0.8.4 | ||
- @0xsequence/network@0.8.4 | ||
- @0xsequence/transactions@0.8.4 | ||
- @0xsequence/utils@0.8.4 | ||
- @0xsequence/wallet@0.8.4 | ||
## 0.8.3 | ||
@@ -4,0 +18,0 @@ |
@@ -21,3 +21,3 @@ import { ProviderMessageRequest, ProviderMessageResponse, WalletMessageEvent, ProviderMessageRequestHandler, MessageToSign } from '../types'; | ||
setDefaultChain(chainId: string | number): void; | ||
getNetworks(): Promise<NetworkConfig[]>; | ||
getNetworks(jsonRpcResponse?: boolean): Promise<NetworkConfig[]>; | ||
notifyNetworks(networks: NetworkConfig[]): void; | ||
@@ -24,0 +24,0 @@ notifyLogin(accountAddress: string): void; |
{ | ||
"name": "@0xsequence/provider", | ||
"version": "0.8.3", | ||
"version": "0.8.4", | ||
"description": "provider sub-package for Sequence", | ||
@@ -16,9 +16,9 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/provider", | ||
"dependencies": { | ||
"@0xsequence/abi": "^0.8.3", | ||
"@0xsequence/auth": "^0.8.3", | ||
"@0xsequence/config": "^0.8.3", | ||
"@0xsequence/network": "^0.8.3", | ||
"@0xsequence/transactions": "^0.8.3", | ||
"@0xsequence/utils": "^0.8.3", | ||
"@0xsequence/wallet": "^0.8.3", | ||
"@0xsequence/abi": "^0.8.4", | ||
"@0xsequence/auth": "^0.8.4", | ||
"@0xsequence/config": "^0.8.4", | ||
"@0xsequence/network": "^0.8.4", | ||
"@0xsequence/transactions": "^0.8.4", | ||
"@0xsequence/utils": "^0.8.4", | ||
"@0xsequence/wallet": "^0.8.4", | ||
"@ethersproject/abstract-signer": "5.0.11", | ||
@@ -25,0 +25,0 @@ "@ethersproject/hash": "^5.0.10", |
@@ -65,3 +65,3 @@ import { ethers } from 'ethers' | ||
// notify networks once the user has authenticated to avoid non-authed access | ||
const networks = await this.walletRequestHandler.getNetworks() | ||
const networks = await this.walletRequestHandler.getNetworks(true) | ||
if (networks && networks.length > 0) { | ||
@@ -68,0 +68,0 @@ this.notifyNetworks(networks) |
@@ -323,3 +323,3 @@ import EventEmitter from 'eventemitter3' | ||
// This is handled by this.getNetworks() but noted here for future readers. | ||
response.result = await this.getNetworks() | ||
response.result = await this.getNetworks(true) | ||
break | ||
@@ -376,3 +376,3 @@ } | ||
} | ||
response.result = await this.getNetworks() | ||
response.result = await this.getNetworks(true) | ||
break | ||
@@ -430,12 +430,16 @@ } | ||
async getNetworks(): Promise<NetworkConfig[]> { | ||
async getNetworks(jsonRpcResponse?: boolean): Promise<NetworkConfig[]> { | ||
const networks = await this.signer.getNetworks() | ||
// omit provider and relayer objects as they are not serializable | ||
return networks.map(n => { | ||
const network: NetworkConfig = { ...n } | ||
network.provider = undefined | ||
network.relayer = undefined | ||
return network | ||
}) | ||
if (jsonRpcResponse) { | ||
// omit provider and relayer objects as they are not serializable | ||
return networks.map(n => { | ||
const network: NetworkConfig = { ...n } | ||
network.provider = undefined | ||
network.relayer = undefined | ||
return network | ||
}) | ||
} else { | ||
return networks | ||
} | ||
} | ||
@@ -442,0 +446,0 @@ |
@@ -219,2 +219,5 @@ import { Networks, NetworkConfig, WalletContext, sequenceContext, ChainId, getNetworkId, JsonRpcSender, | ||
getAddress = async (): Promise<string> => { | ||
if (!this.isLoggedIn()) { | ||
throw new Error('login first') | ||
} | ||
const session = this.getSession() | ||
@@ -225,8 +228,5 @@ return session.accountAddress | ||
getNetworks = async (chainId?: ChainId): Promise<NetworkConfig[]> => { | ||
if (!this.isLoggedIn()) { | ||
if (!this.isLoggedIn() || !this.networks) { | ||
throw new Error('login first') | ||
} | ||
if (!this.networks) { | ||
throw new Error('network has not been set by session. login first.') | ||
} | ||
if (chainId) { | ||
@@ -233,0 +233,0 @@ // filter list to just the specific chain requested |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
349222
8540
Updated@0xsequence/abi@^0.8.4
Updated@0xsequence/auth@^0.8.4
Updated@0xsequence/config@^0.8.4
Updated@0xsequence/network@^0.8.4
Updated@0xsequence/utils@^0.8.4
Updated@0xsequence/wallet@^0.8.4