@0xsequence/network
Advanced tools
Comparing version 0.0.0-2021827201516 to 0.0.0-20220418165517
@@ -28,6 +28,3 @@ 'use strict'; | ||
const getAuthNetwork = networks => { | ||
if (!networks || networks.length === 0) return undefined; | ||
if (networks[0] && networks[0].isAuthChain) return networks[0]; | ||
if (networks.length > 1 && networks[1].isAuthChain) return networks[1]; | ||
return undefined; | ||
return networks.find(network => network.isAuthChain); | ||
}; | ||
@@ -275,6 +272,13 @@ const isValidNetworkConfig = (networkConfig, raise = false, skipRelayerCheck = false) => { | ||
ChainId[ChainId["POLYGON_MUMBAI"] = 80001] = "POLYGON_MUMBAI"; | ||
ChainId[ChainId["BSC"] = 56] = "BSC"; | ||
ChainId[ChainId["BSC_TESTNET"] = 97] = "BSC_TESTNET"; | ||
ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM"; | ||
ChainId[ChainId["OPTIMISM_TESTNET"] = 69] = "OPTIMISM_TESTNET"; | ||
ChainId[ChainId["ARBITRUM"] = 42161] = "ARBITRUM"; | ||
ChainId[ChainId["ARBITRUM_TESTNET"] = 421611] = "ARBITRUM_TESTNET"; | ||
ChainId[ChainId["BSC"] = 56] = "BSC"; | ||
ChainId[ChainId["BSC_TESTNET"] = 97] = "BSC_TESTNET"; | ||
ChainId[ChainId["AVALANCHE"] = 43114] = "AVALANCHE"; | ||
ChainId[ChainId["AVALANCHE_TESTNET"] = 43113] = "AVALANCHE_TESTNET"; | ||
ChainId[ChainId["FANTOM"] = 250] = "FANTOM"; | ||
ChainId[ChainId["FANTOM_TESTNET"] = 4002] = "FANTOM_TESTNET"; | ||
ChainId[ChainId["GNOSIS"] = 100] = "GNOSIS"; | ||
})(exports.ChainId || (exports.ChainId = {})); | ||
@@ -309,2 +313,3 @@ | ||
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', | ||
testnet: true, | ||
rpcUrl: utils.urlClean(`${vars.baseRpcUrl}/rinkeby`), | ||
@@ -319,2 +324,3 @@ relayer: { | ||
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', | ||
testnet: true, | ||
rpcUrl: utils.urlClean(`${vars.baseRpcUrl}/goerli`), | ||
@@ -709,8 +715,8 @@ relayer: { | ||
const chainIdLabel = chainId ? ` chainId:${chainId}` : ''; | ||
console.log(`[provider request]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params); | ||
utils.logger.info(`[provider request]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params); | ||
next(request, (error, response) => { | ||
if (error) { | ||
console.warn(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `error:`, error); | ||
utils.logger.warn(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `error:`, error); | ||
} else { | ||
console.log(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `response:`, response); | ||
utils.logger.info(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `response:`, response); | ||
} | ||
@@ -754,3 +760,3 @@ | ||
const SignerJsonRpcMethods = ['personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4', 'eth_sendTransaction', 'eth_sendRawTransaction', 'sequence_getWalletContext', 'sequence_getWalletConfig', 'sequence_getWalletState', 'sequence_getNetworks', 'sequence_updateConfig', 'sequence_publishConfig', 'sequence_estimateGasLimits', 'sequence_gasRefundOptions', 'sequence_getNonce', 'sequence_relay']; | ||
const SignerJsonRpcMethods = ['personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4', 'eth_sendTransaction', 'eth_sendRawTransaction', 'sequence_getWalletContext', 'sequence_getWalletConfig', 'sequence_getWalletState', 'sequence_getNetworks', 'sequence_updateConfig', 'sequence_publishConfig', 'sequence_estimateGasLimits', 'sequence_gasRefundOptions', 'sequence_getNonce', 'sequence_relay', 'eth_decrypt', 'eth_getEncryptionPublicKey', 'wallet_addEthereumChain', 'wallet_switchEthereumChain', 'wallet_registerOnboarding', 'wallet_watchAsset', 'wallet_scanQRCode']; | ||
class SigningProvider { | ||
@@ -757,0 +763,0 @@ constructor(provider) { |
@@ -28,6 +28,3 @@ 'use strict'; | ||
const getAuthNetwork = networks => { | ||
if (!networks || networks.length === 0) return undefined; | ||
if (networks[0] && networks[0].isAuthChain) return networks[0]; | ||
if (networks.length > 1 && networks[1].isAuthChain) return networks[1]; | ||
return undefined; | ||
return networks.find(network => network.isAuthChain); | ||
}; | ||
@@ -275,6 +272,13 @@ const isValidNetworkConfig = (networkConfig, raise = false, skipRelayerCheck = false) => { | ||
ChainId[ChainId["POLYGON_MUMBAI"] = 80001] = "POLYGON_MUMBAI"; | ||
ChainId[ChainId["BSC"] = 56] = "BSC"; | ||
ChainId[ChainId["BSC_TESTNET"] = 97] = "BSC_TESTNET"; | ||
ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM"; | ||
ChainId[ChainId["OPTIMISM_TESTNET"] = 69] = "OPTIMISM_TESTNET"; | ||
ChainId[ChainId["ARBITRUM"] = 42161] = "ARBITRUM"; | ||
ChainId[ChainId["ARBITRUM_TESTNET"] = 421611] = "ARBITRUM_TESTNET"; | ||
ChainId[ChainId["BSC"] = 56] = "BSC"; | ||
ChainId[ChainId["BSC_TESTNET"] = 97] = "BSC_TESTNET"; | ||
ChainId[ChainId["AVALANCHE"] = 43114] = "AVALANCHE"; | ||
ChainId[ChainId["AVALANCHE_TESTNET"] = 43113] = "AVALANCHE_TESTNET"; | ||
ChainId[ChainId["FANTOM"] = 250] = "FANTOM"; | ||
ChainId[ChainId["FANTOM_TESTNET"] = 4002] = "FANTOM_TESTNET"; | ||
ChainId[ChainId["GNOSIS"] = 100] = "GNOSIS"; | ||
})(exports.ChainId || (exports.ChainId = {})); | ||
@@ -309,2 +313,3 @@ | ||
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', | ||
testnet: true, | ||
rpcUrl: utils.urlClean(`${vars.baseRpcUrl}/rinkeby`), | ||
@@ -319,2 +324,3 @@ relayer: { | ||
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', | ||
testnet: true, | ||
rpcUrl: utils.urlClean(`${vars.baseRpcUrl}/goerli`), | ||
@@ -709,8 +715,8 @@ relayer: { | ||
const chainIdLabel = chainId ? ` chainId:${chainId}` : ''; | ||
console.log(`[provider request]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params); | ||
utils.logger.info(`[provider request]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params); | ||
next(request, (error, response) => { | ||
if (error) { | ||
console.warn(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `error:`, error); | ||
utils.logger.warn(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `error:`, error); | ||
} else { | ||
console.log(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `response:`, response); | ||
utils.logger.info(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `response:`, response); | ||
} | ||
@@ -754,3 +760,3 @@ | ||
const SignerJsonRpcMethods = ['personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4', 'eth_sendTransaction', 'eth_sendRawTransaction', 'sequence_getWalletContext', 'sequence_getWalletConfig', 'sequence_getWalletState', 'sequence_getNetworks', 'sequence_updateConfig', 'sequence_publishConfig', 'sequence_estimateGasLimits', 'sequence_gasRefundOptions', 'sequence_getNonce', 'sequence_relay']; | ||
const SignerJsonRpcMethods = ['personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4', 'eth_sendTransaction', 'eth_sendRawTransaction', 'sequence_getWalletContext', 'sequence_getWalletConfig', 'sequence_getWalletState', 'sequence_getNetworks', 'sequence_updateConfig', 'sequence_publishConfig', 'sequence_estimateGasLimits', 'sequence_gasRefundOptions', 'sequence_getNonce', 'sequence_relay', 'eth_decrypt', 'eth_getEncryptionPublicKey', 'wallet_addEthereumChain', 'wallet_switchEthereumChain', 'wallet_registerOnboarding', 'wallet_watchAsset', 'wallet_scanQRCode']; | ||
class SigningProvider { | ||
@@ -757,0 +763,0 @@ constructor(provider) { |
@@ -24,6 +24,3 @@ import { urlClean, logger } from '@0xsequence/utils'; | ||
const getAuthNetwork = networks => { | ||
if (!networks || networks.length === 0) return undefined; | ||
if (networks[0] && networks[0].isAuthChain) return networks[0]; | ||
if (networks.length > 1 && networks[1].isAuthChain) return networks[1]; | ||
return undefined; | ||
return networks.find(network => network.isAuthChain); | ||
}; | ||
@@ -271,6 +268,13 @@ const isValidNetworkConfig = (networkConfig, raise = false, skipRelayerCheck = false) => { | ||
ChainId[ChainId["POLYGON_MUMBAI"] = 80001] = "POLYGON_MUMBAI"; | ||
ChainId[ChainId["BSC"] = 56] = "BSC"; | ||
ChainId[ChainId["BSC_TESTNET"] = 97] = "BSC_TESTNET"; | ||
ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM"; | ||
ChainId[ChainId["OPTIMISM_TESTNET"] = 69] = "OPTIMISM_TESTNET"; | ||
ChainId[ChainId["ARBITRUM"] = 42161] = "ARBITRUM"; | ||
ChainId[ChainId["ARBITRUM_TESTNET"] = 421611] = "ARBITRUM_TESTNET"; | ||
ChainId[ChainId["BSC"] = 56] = "BSC"; | ||
ChainId[ChainId["BSC_TESTNET"] = 97] = "BSC_TESTNET"; | ||
ChainId[ChainId["AVALANCHE"] = 43114] = "AVALANCHE"; | ||
ChainId[ChainId["AVALANCHE_TESTNET"] = 43113] = "AVALANCHE_TESTNET"; | ||
ChainId[ChainId["FANTOM"] = 250] = "FANTOM"; | ||
ChainId[ChainId["FANTOM_TESTNET"] = 4002] = "FANTOM_TESTNET"; | ||
ChainId[ChainId["GNOSIS"] = 100] = "GNOSIS"; | ||
})(ChainId || (ChainId = {})); | ||
@@ -305,2 +309,3 @@ | ||
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', | ||
testnet: true, | ||
rpcUrl: urlClean(`${vars.baseRpcUrl}/rinkeby`), | ||
@@ -315,2 +320,3 @@ relayer: { | ||
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', | ||
testnet: true, | ||
rpcUrl: urlClean(`${vars.baseRpcUrl}/goerli`), | ||
@@ -705,8 +711,8 @@ relayer: { | ||
const chainIdLabel = chainId ? ` chainId:${chainId}` : ''; | ||
console.log(`[provider request]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params); | ||
logger.info(`[provider request]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params); | ||
next(request, (error, response) => { | ||
if (error) { | ||
console.warn(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `error:`, error); | ||
logger.warn(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `error:`, error); | ||
} else { | ||
console.log(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `response:`, response); | ||
logger.info(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `response:`, response); | ||
} | ||
@@ -750,3 +756,3 @@ | ||
const SignerJsonRpcMethods = ['personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4', 'eth_sendTransaction', 'eth_sendRawTransaction', 'sequence_getWalletContext', 'sequence_getWalletConfig', 'sequence_getWalletState', 'sequence_getNetworks', 'sequence_updateConfig', 'sequence_publishConfig', 'sequence_estimateGasLimits', 'sequence_gasRefundOptions', 'sequence_getNonce', 'sequence_relay']; | ||
const SignerJsonRpcMethods = ['personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4', 'eth_sendTransaction', 'eth_sendRawTransaction', 'sequence_getWalletContext', 'sequence_getWalletConfig', 'sequence_getWalletState', 'sequence_getNetworks', 'sequence_updateConfig', 'sequence_publishConfig', 'sequence_estimateGasLimits', 'sequence_gasRefundOptions', 'sequence_getNonce', 'sequence_relay', 'eth_decrypt', 'eth_getEncryptionPublicKey', 'wallet_addEthereumChain', 'wallet_switchEthereumChain', 'wallet_registerOnboarding', 'wallet_watchAsset', 'wallet_scanQRCode']; | ||
class SigningProvider { | ||
@@ -753,0 +759,0 @@ constructor(provider) { |
import { BigNumberish } from 'ethers'; | ||
import { JsonRpcProvider } from '@ethersproject/providers'; | ||
import { Indexer } from '@0xsequence/indexer'; | ||
import { Relayer, RpcRelayerOptions } from '@0xsequence/relayer'; | ||
@@ -12,6 +13,13 @@ export declare enum ChainId { | ||
POLYGON_MUMBAI = 80001, | ||
BSC = 56, | ||
BSC_TESTNET = 97, | ||
OPTIMISM = 10, | ||
OPTIMISM_TESTNET = 69, | ||
ARBITRUM = 42161, | ||
ARBITRUM_TESTNET = 421611, | ||
BSC = 56, | ||
BSC_TESTNET = 97 | ||
AVALANCHE = 43114, | ||
AVALANCHE_TESTNET = 43113, | ||
FANTOM = 250, | ||
FANTOM_TESTNET = 4002, | ||
GNOSIS = 100 | ||
} | ||
@@ -23,5 +31,7 @@ export interface NetworkConfig { | ||
ensAddress?: string; | ||
testnet?: boolean; | ||
rpcUrl?: string; | ||
provider?: JsonRpcProvider; | ||
indexerUrl?: string; | ||
indexer?: Indexer; | ||
relayer?: Relayer | RpcRelayerOptions; | ||
@@ -28,0 +38,0 @@ isDefaultChain?: boolean; |
{ | ||
"name": "@0xsequence/network", | ||
"version": "0.0.0-2021827201516", | ||
"version": "0.0.0-20220418165517", | ||
"description": "network sub-package for Sequence", | ||
@@ -16,5 +16,5 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/network", | ||
"dependencies": { | ||
"@0xsequence/utils": "^0.0.0-2021827201516", | ||
"@ethersproject/providers": "^5.0.24", | ||
"ethers": "^5.0.32" | ||
"@0xsequence/utils": "^0.0.0-20220418165517", | ||
"@ethersproject/providers": "^5.5.1", | ||
"ethers": "^5.5.2" | ||
}, | ||
@@ -21,0 +21,0 @@ "peerDependencies": {}, |
@@ -9,2 +9,3 @@ import { BigNumberish } from 'ethers' | ||
export enum ChainId { | ||
// Ethereum | ||
MAINNET = 1, | ||
@@ -15,8 +16,29 @@ ROPSTEN = 3, | ||
KOVAN = 42, | ||
// Polygon | ||
POLYGON = 137, | ||
POLYGON_MUMBAI = 80001, | ||
// BSC | ||
BSC = 56, | ||
BSC_TESTNET = 97, | ||
// Optimism | ||
OPTIMISM = 10, | ||
OPTIMISM_TESTNET = 69, | ||
// Arbitrum | ||
ARBITRUM = 42161, | ||
ARBITRUM_TESTNET = 421611, | ||
BSC = 56, | ||
BSC_TESTNET = 97 | ||
// Avalanche | ||
AVALANCHE = 43114, | ||
AVALANCHE_TESTNET = 43113, | ||
// Fantom | ||
FANTOM = 250, | ||
FANTOM_TESTNET = 4002, | ||
// Gnosis Chain (XDAI) | ||
GNOSIS = 100 | ||
} | ||
@@ -29,2 +51,3 @@ | ||
ensAddress?: string | ||
testnet?: boolean | ||
@@ -34,2 +57,3 @@ rpcUrl?: string | ||
indexerUrl?: string | ||
indexer?: Indexer | ||
relayer?: Relayer | RpcRelayerOptions | ||
@@ -88,2 +112,3 @@ | ||
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', | ||
testnet: true, | ||
rpcUrl: urlClean(`${vars.baseRpcUrl}/rinkeby`), | ||
@@ -97,2 +122,3 @@ relayer: { url: urlClean(`${vars.baseRelayerUrl}/rinkeby`) }, | ||
ensAddress: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', | ||
testnet: true, | ||
rpcUrl: urlClean(`${vars.baseRpcUrl}/goerli`), | ||
@@ -99,0 +125,0 @@ relayer: { url: urlClean(`${vars.baseRelayerUrl}/goerli`) }, |
import { JsonRpcHandlerFunc, JsonRpcRequest, JsonRpcResponse, JsonRpcResponseCallback, JsonRpcMiddleware } from '../types' | ||
import { logger } from '@0xsequence/utils' | ||
@@ -6,9 +7,9 @@ export const loggingProviderMiddleware: JsonRpcMiddleware = (next: JsonRpcHandlerFunc) => { | ||
const chainIdLabel = chainId ? ` chainId:${chainId}` : '' | ||
console.log(`[provider request]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params) | ||
logger.info(`[provider request]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params) | ||
next(request, (error: any, response?: JsonRpcResponse) => { | ||
if (error) { | ||
console.warn(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `error:`, error) | ||
logger.warn(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `error:`, error) | ||
} else { | ||
console.log(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `response:`, response) | ||
logger.info(`[provider response]${chainIdLabel} id:${request.id} method:${request.method} params:`, request.params, `response:`, response) | ||
} | ||
@@ -15,0 +16,0 @@ callback(error, response) |
@@ -9,3 +9,8 @@ import { JsonRpcHandlerFunc, JsonRpcRequest, JsonRpcResponse, JsonRpcResponseCallback, JsonRpcMiddlewareHandler, JsonRpcHandler } from '../types' | ||
'sequence_updateConfig', 'sequence_publishConfig', 'sequence_estimateGasLimits', 'sequence_gasRefundOptions', | ||
'sequence_getNonce', 'sequence_relay' | ||
'sequence_getNonce', 'sequence_relay', | ||
'eth_decrypt', 'eth_getEncryptionPublicKey', | ||
'wallet_addEthereumChain', 'wallet_switchEthereumChain', | ||
'wallet_registerOnboarding', 'wallet_watchAsset', | ||
'wallet_scanQRCode' | ||
] | ||
@@ -12,0 +17,0 @@ |
@@ -25,6 +25,3 @@ import { ethers, BigNumberish } from 'ethers' | ||
export const getAuthNetwork = (networks: NetworkConfig[]): NetworkConfig | undefined => { | ||
if (!networks || networks.length === 0) return undefined | ||
if (networks[0] && networks[0].isAuthChain) return networks[0] | ||
if (networks.length > 1 && networks[1].isAuthChain) return networks[1] | ||
return undefined | ||
return networks.find(network => network.isAuthChain) | ||
} | ||
@@ -31,0 +28,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
3203
0
118084
43
Updatedethers@^5.5.2