@0xsequence/auth
Advanced tools
Comparing version 0.0.0-20240812142652 to 0.0.0-20240814043648
@@ -160,9 +160,6 @@ 'use strict'; | ||
const ethAuth = new ethauth.ETHAuth(); | ||
const chainId = BigInt(this.settings.sequenceApiChainId); | ||
const found = network.findNetworkConfig(this.account.networks, chainId); | ||
if (!found) { | ||
throw Error('No network found'); | ||
} | ||
ethAuth.chainId = Number(chainId); | ||
const network$1 = new ethers.ethers.Network(found.name, chainId); | ||
const chainId = ethers.ethers.BigNumber.from(this.settings.sequenceApiChainId); | ||
const network$1 = network.findNetworkConfig(this.account.networks, chainId); | ||
if (!network$1) throw Error('No network found'); | ||
ethAuth.chainId = chainId.toNumber(); | ||
@@ -172,4 +169,5 @@ // TODO: Modify ETHAuth so it can take a provider instead of a url | ||
// Can't pass jwt here since this is used for getting the jwt | ||
ethAuth.provider = new ethers.ethers.JsonRpcProvider(utils.getFetchRequest(found.rpcUrl, this.projectAccessKey), network$1, { | ||
staticNetwork: network$1 | ||
ethAuth.provider = new ethers.ethers.providers.StaticJsonRpcProvider(utils.getEthersConnectionInfo(network$1.rpcUrl, this.projectAccessKey), { | ||
name: '', | ||
chainId: chainId.toNumber() | ||
}); | ||
@@ -235,15 +233,12 @@ await ethAuth.decodeProof(proofString); | ||
const ethAuth = new ethauth.ETHAuth(); | ||
const chainId = BigInt(this.settings.sequenceApiChainId); | ||
const found = network.findNetworkConfig(this.account.networks, chainId); | ||
if (!found) { | ||
throw Error('No network found'); | ||
} | ||
ethAuth.chainId = Number(chainId); | ||
const network$1 = new ethers.ethers.Network(found.name, chainId); | ||
const chainId = ethers.ethers.BigNumber.from(this.settings.sequenceApiChainId); | ||
const network$1 = network.findNetworkConfig(this.account.networks, chainId); | ||
if (!network$1) throw Error('No network found'); | ||
ethAuth.chainId = chainId.toNumber(); | ||
// TODO: Modify ETHAuth so it can take a provider instead of a url | ||
// ----- | ||
// Can't pass jwt here since this is used for getting the jwt | ||
ethAuth.provider = new ethers.ethers.JsonRpcProvider(utils.getFetchRequest(found.rpcUrl, this.projectAccessKey), network$1, { | ||
staticNetwork: network$1 | ||
ethAuth.provider = new ethers.ethers.providers.StaticJsonRpcProvider(utils.getEthersConnectionInfo(network$1.rpcUrl, this.projectAccessKey), { | ||
name: '', | ||
chainId: chainId.toNumber() | ||
}); | ||
@@ -279,3 +274,3 @@ const expiration = this.now() + this.expiration - EXPIRATION_JWT_MARGIN; | ||
const signAuthorization = async (signer, chainId, options) => { | ||
const address = ethers.ethers.getAddress(await signer.getAddress()); | ||
const address = ethers.ethers.utils.getAddress(await signer.getAddress()); | ||
if (!address || address === '' || address === '0x') { | ||
@@ -522,3 +517,3 @@ throw ErrAccountIsRequired; | ||
const newConfig = account$1.coders.config.editConfig(nextConfig, { | ||
checkpoint: account$1.coders.config.checkpointOf(prevConfig) + 1n | ||
checkpoint: account$1.coders.config.checkpointOf(prevConfig).add(1) | ||
}); | ||
@@ -525,0 +520,0 @@ await account$1.updateConfig(newConfig); |
@@ -160,9 +160,6 @@ 'use strict'; | ||
const ethAuth = new ethauth.ETHAuth(); | ||
const chainId = BigInt(this.settings.sequenceApiChainId); | ||
const found = network.findNetworkConfig(this.account.networks, chainId); | ||
if (!found) { | ||
throw Error('No network found'); | ||
} | ||
ethAuth.chainId = Number(chainId); | ||
const network$1 = new ethers.ethers.Network(found.name, chainId); | ||
const chainId = ethers.ethers.BigNumber.from(this.settings.sequenceApiChainId); | ||
const network$1 = network.findNetworkConfig(this.account.networks, chainId); | ||
if (!network$1) throw Error('No network found'); | ||
ethAuth.chainId = chainId.toNumber(); | ||
@@ -172,4 +169,5 @@ // TODO: Modify ETHAuth so it can take a provider instead of a url | ||
// Can't pass jwt here since this is used for getting the jwt | ||
ethAuth.provider = new ethers.ethers.JsonRpcProvider(utils.getFetchRequest(found.rpcUrl, this.projectAccessKey), network$1, { | ||
staticNetwork: network$1 | ||
ethAuth.provider = new ethers.ethers.providers.StaticJsonRpcProvider(utils.getEthersConnectionInfo(network$1.rpcUrl, this.projectAccessKey), { | ||
name: '', | ||
chainId: chainId.toNumber() | ||
}); | ||
@@ -235,15 +233,12 @@ await ethAuth.decodeProof(proofString); | ||
const ethAuth = new ethauth.ETHAuth(); | ||
const chainId = BigInt(this.settings.sequenceApiChainId); | ||
const found = network.findNetworkConfig(this.account.networks, chainId); | ||
if (!found) { | ||
throw Error('No network found'); | ||
} | ||
ethAuth.chainId = Number(chainId); | ||
const network$1 = new ethers.ethers.Network(found.name, chainId); | ||
const chainId = ethers.ethers.BigNumber.from(this.settings.sequenceApiChainId); | ||
const network$1 = network.findNetworkConfig(this.account.networks, chainId); | ||
if (!network$1) throw Error('No network found'); | ||
ethAuth.chainId = chainId.toNumber(); | ||
// TODO: Modify ETHAuth so it can take a provider instead of a url | ||
// ----- | ||
// Can't pass jwt here since this is used for getting the jwt | ||
ethAuth.provider = new ethers.ethers.JsonRpcProvider(utils.getFetchRequest(found.rpcUrl, this.projectAccessKey), network$1, { | ||
staticNetwork: network$1 | ||
ethAuth.provider = new ethers.ethers.providers.StaticJsonRpcProvider(utils.getEthersConnectionInfo(network$1.rpcUrl, this.projectAccessKey), { | ||
name: '', | ||
chainId: chainId.toNumber() | ||
}); | ||
@@ -279,3 +274,3 @@ const expiration = this.now() + this.expiration - EXPIRATION_JWT_MARGIN; | ||
const signAuthorization = async (signer, chainId, options) => { | ||
const address = ethers.ethers.getAddress(await signer.getAddress()); | ||
const address = ethers.ethers.utils.getAddress(await signer.getAddress()); | ||
if (!address || address === '' || address === '0x') { | ||
@@ -522,3 +517,3 @@ throw ErrAccountIsRequired; | ||
const newConfig = account$1.coders.config.editConfig(nextConfig, { | ||
checkpoint: account$1.coders.config.checkpointOf(prevConfig) + 1n | ||
checkpoint: account$1.coders.config.checkpointOf(prevConfig).add(1) | ||
}); | ||
@@ -525,0 +520,0 @@ await account$1.updateConfig(newConfig); |
@@ -8,3 +8,3 @@ import { ethers } from 'ethers'; | ||
import { SequenceMetadata } from '@0xsequence/metadata'; | ||
import { getFetchRequest, jwtDecodeClaims } from '@0xsequence/utils'; | ||
import { getEthersConnectionInfo, jwtDecodeClaims } from '@0xsequence/utils'; | ||
import { trackers } from '@0xsequence/sessions'; | ||
@@ -157,9 +157,6 @@ import { Orchestrator } from '@0xsequence/signhub'; | ||
const ethAuth = new ETHAuth(); | ||
const chainId = BigInt(this.settings.sequenceApiChainId); | ||
const found = findNetworkConfig(this.account.networks, chainId); | ||
if (!found) { | ||
throw Error('No network found'); | ||
} | ||
ethAuth.chainId = Number(chainId); | ||
const network = new ethers.Network(found.name, chainId); | ||
const chainId = ethers.BigNumber.from(this.settings.sequenceApiChainId); | ||
const network = findNetworkConfig(this.account.networks, chainId); | ||
if (!network) throw Error('No network found'); | ||
ethAuth.chainId = chainId.toNumber(); | ||
@@ -169,4 +166,5 @@ // TODO: Modify ETHAuth so it can take a provider instead of a url | ||
// Can't pass jwt here since this is used for getting the jwt | ||
ethAuth.provider = new ethers.JsonRpcProvider(getFetchRequest(found.rpcUrl, this.projectAccessKey), network, { | ||
staticNetwork: network | ||
ethAuth.provider = new ethers.providers.StaticJsonRpcProvider(getEthersConnectionInfo(network.rpcUrl, this.projectAccessKey), { | ||
name: '', | ||
chainId: chainId.toNumber() | ||
}); | ||
@@ -232,15 +230,12 @@ await ethAuth.decodeProof(proofString); | ||
const ethAuth = new ETHAuth(); | ||
const chainId = BigInt(this.settings.sequenceApiChainId); | ||
const found = findNetworkConfig(this.account.networks, chainId); | ||
if (!found) { | ||
throw Error('No network found'); | ||
} | ||
ethAuth.chainId = Number(chainId); | ||
const network = new ethers.Network(found.name, chainId); | ||
const chainId = ethers.BigNumber.from(this.settings.sequenceApiChainId); | ||
const network = findNetworkConfig(this.account.networks, chainId); | ||
if (!network) throw Error('No network found'); | ||
ethAuth.chainId = chainId.toNumber(); | ||
// TODO: Modify ETHAuth so it can take a provider instead of a url | ||
// ----- | ||
// Can't pass jwt here since this is used for getting the jwt | ||
ethAuth.provider = new ethers.JsonRpcProvider(getFetchRequest(found.rpcUrl, this.projectAccessKey), network, { | ||
staticNetwork: network | ||
ethAuth.provider = new ethers.providers.StaticJsonRpcProvider(getEthersConnectionInfo(network.rpcUrl, this.projectAccessKey), { | ||
name: '', | ||
chainId: chainId.toNumber() | ||
}); | ||
@@ -276,3 +271,3 @@ const expiration = this.now() + this.expiration - EXPIRATION_JWT_MARGIN; | ||
const signAuthorization = async (signer, chainId, options) => { | ||
const address = ethers.getAddress(await signer.getAddress()); | ||
const address = ethers.utils.getAddress(await signer.getAddress()); | ||
if (!address || address === '' || address === '0x') { | ||
@@ -519,3 +514,3 @@ throw ErrAccountIsRequired; | ||
const newConfig = account.coders.config.editConfig(nextConfig, { | ||
checkpoint: account.coders.config.checkpointOf(prevConfig) + 1n | ||
checkpoint: account.coders.config.checkpointOf(prevConfig).add(1) | ||
}); | ||
@@ -522,0 +517,0 @@ await account.updateConfig(newConfig); |
{ | ||
"name": "@0xsequence/auth", | ||
"version": "0.0.0-20240812142652", | ||
"version": "0.0.0-20240814043648", | ||
"description": "auth sub-package for Sequence", | ||
@@ -12,26 +12,26 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/auth", | ||
"dependencies": { | ||
"@0xsequence/ethauth": "^1.0.0", | ||
"@0xsequence/abi": "0.0.0-20240812142652", | ||
"@0xsequence/account": "0.0.0-20240812142652", | ||
"@0xsequence/api": "0.0.0-20240812142652", | ||
"@0xsequence/core": "0.0.0-20240812142652", | ||
"@0xsequence/indexer": "0.0.0-20240812142652", | ||
"@0xsequence/metadata": "0.0.0-20240812142652", | ||
"@0xsequence/migration": "0.0.0-20240812142652", | ||
"@0xsequence/network": "0.0.0-20240812142652", | ||
"@0xsequence/sessions": "0.0.0-20240812142652", | ||
"@0xsequence/signhub": "0.0.0-20240812142652", | ||
"@0xsequence/wallet": "0.0.0-20240812142652", | ||
"@0xsequence/utils": "0.0.0-20240812142652" | ||
"@0xsequence/ethauth": "^0.8.1", | ||
"@0xsequence/abi": "0.0.0-20240814043648", | ||
"@0xsequence/account": "0.0.0-20240814043648", | ||
"@0xsequence/api": "0.0.0-20240814043648", | ||
"@0xsequence/core": "0.0.0-20240814043648", | ||
"@0xsequence/indexer": "0.0.0-20240814043648", | ||
"@0xsequence/metadata": "0.0.0-20240814043648", | ||
"@0xsequence/migration": "0.0.0-20240814043648", | ||
"@0xsequence/network": "0.0.0-20240814043648", | ||
"@0xsequence/sessions": "0.0.0-20240814043648", | ||
"@0xsequence/signhub": "0.0.0-20240814043648", | ||
"@0xsequence/wallet": "0.0.0-20240814043648", | ||
"@0xsequence/utils": "0.0.0-20240814043648" | ||
}, | ||
"peerDependencies": { | ||
"ethers": ">=6" | ||
"ethers": ">=5.5 < 6" | ||
}, | ||
"devDependencies": { | ||
"@0xsequence/wallet-contracts": "^3.0.1", | ||
"@0xsequence/wallet-contracts": "^1.10.0", | ||
"concurrently": "^7.5.0", | ||
"ethers": "^6.13.0", | ||
"ethers": "^5.7.2", | ||
"hardhat": "^2.20.1", | ||
"mockttp": "^3.6.0", | ||
"@0xsequence/tests": "0.0.0-20240812142652" | ||
"@0xsequence/tests": "0.0.0-20240814043648" | ||
}, | ||
@@ -45,3 +45,3 @@ "files": [ | ||
"test:run": "pnpm test:file tests/**/*.spec.ts", | ||
"test:file": "NODE_OPTIONS='--import tsx' mocha --timeout 60000", | ||
"test:file": "NODE_OPTIONS='--import tsx' mocha --timeout 30000", | ||
"test:concurrently": "concurrently -k --success first 'pnpm start:hardhat > /dev/null' ", | ||
@@ -48,0 +48,0 @@ "start:hardhat": "hardhat node --port 9546", |
@@ -38,3 +38,3 @@ import { ethers } from 'ethers' | ||
): Promise<ETHAuthProof> => { | ||
const address = ethers.getAddress(await signer.getAddress()) | ||
const address = ethers.utils.getAddress(await signer.getAddress()) | ||
if (!address || address === '' || address === '0x') { | ||
@@ -41,0 +41,0 @@ throw ErrAccountIsRequired |
@@ -11,3 +11,3 @@ import { commons } from '@0xsequence/core' | ||
): ValidatorFunc => { | ||
return async (_provider: ethers.JsonRpcProvider, chainId: number, proof: Proof): Promise<{ isValid: boolean }> => { | ||
return async (_provider: ethers.providers.JsonRpcProvider, chainId: number, proof: Proof): Promise<{ isValid: boolean }> => { | ||
const digest = proof.messageDigest() | ||
@@ -14,0 +14,0 @@ const isValid = await readerFor(chainId).isValidSignature(proof.address, digest, proof.signature) |
@@ -7,3 +7,3 @@ import { Account } from '@0xsequence/account' | ||
import { ChainIdLike, findNetworkConfig } from '@0xsequence/network' | ||
import { getFetchRequest } from '@0xsequence/utils' | ||
import { getEthersConnectionInfo } from '@0xsequence/utils' | ||
import { ethers } from 'ethers' | ||
@@ -205,17 +205,17 @@ | ||
const ethAuth = new ETHAuth() | ||
const chainId = BigInt(this.settings.sequenceApiChainId) | ||
const found = findNetworkConfig(this.account.networks, chainId) | ||
if (!found) { | ||
throw Error('No network found') | ||
} | ||
ethAuth.chainId = Number(chainId) | ||
const chainId = ethers.BigNumber.from(this.settings.sequenceApiChainId) | ||
const network = findNetworkConfig(this.account.networks, chainId) | ||
if (!network) throw Error('No network found') | ||
ethAuth.chainId = chainId.toNumber() | ||
const network = new ethers.Network(found.name, chainId) | ||
// TODO: Modify ETHAuth so it can take a provider instead of a url | ||
// ----- | ||
// Can't pass jwt here since this is used for getting the jwt | ||
ethAuth.provider = new ethers.JsonRpcProvider(getFetchRequest(found.rpcUrl, this.projectAccessKey), network, { | ||
staticNetwork: network | ||
}) | ||
ethAuth.provider = new ethers.providers.StaticJsonRpcProvider( | ||
getEthersConnectionInfo(network.rpcUrl, this.projectAccessKey), | ||
{ | ||
name: '', | ||
chainId: chainId.toNumber() | ||
} | ||
) | ||
@@ -295,17 +295,16 @@ await ethAuth.decodeProof(proofString) | ||
const ethAuth = new ETHAuth() | ||
const chainId = BigInt(this.settings.sequenceApiChainId) | ||
const found = findNetworkConfig(this.account.networks, chainId) | ||
if (!found) { | ||
throw Error('No network found') | ||
} | ||
ethAuth.chainId = Number(chainId) | ||
const network = new ethers.Network(found.name, chainId) | ||
const chainId = ethers.BigNumber.from(this.settings.sequenceApiChainId) | ||
const network = findNetworkConfig(this.account.networks, chainId) | ||
if (!network) throw Error('No network found') | ||
ethAuth.chainId = chainId.toNumber() | ||
// TODO: Modify ETHAuth so it can take a provider instead of a url | ||
// ----- | ||
// Can't pass jwt here since this is used for getting the jwt | ||
ethAuth.provider = new ethers.JsonRpcProvider(getFetchRequest(found.rpcUrl, this.projectAccessKey), network, { | ||
staticNetwork: network | ||
}) | ||
ethAuth.provider = new ethers.providers.StaticJsonRpcProvider( | ||
getEthersConnectionInfo(network.rpcUrl, this.projectAccessKey), | ||
{ | ||
name: '', | ||
chainId: chainId.toNumber() | ||
} | ||
) | ||
@@ -312,0 +311,0 @@ const expiration = this.now() + this.expiration - EXPIRATION_JWT_MARGIN |
@@ -263,3 +263,3 @@ import { ChainId, NetworkConfig, allNetworks, findNetworkConfig } from '@0xsequence/network' | ||
const newConfig = account.coders.config.editConfig(nextConfig, { | ||
checkpoint: account.coders.config.checkpointOf(prevConfig) + 1n | ||
checkpoint: account.coders.config.checkpointOf(prevConfig).add(1) | ||
}) | ||
@@ -266,0 +266,0 @@ |
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
121085
2744
+ Added@0xsequence/abi@0.0.0-20240814043648(transitive)
+ Added@0xsequence/account@0.0.0-20240814043648(transitive)
+ Added@0xsequence/api@0.0.0-20240814043648(transitive)
+ Added@0xsequence/core@0.0.0-20240814043648(transitive)
+ Added@0xsequence/ethauth@0.8.1(transitive)
+ Added@0xsequence/indexer@0.0.0-20240814043648(transitive)
+ Added@0xsequence/metadata@0.0.0-20240814043648(transitive)
+ Added@0xsequence/migration@0.0.0-20240814043648(transitive)
+ Added@0xsequence/network@0.0.0-20240814043648(transitive)
+ Added@0xsequence/relayer@0.0.0-20240814043648(transitive)
+ Added@0xsequence/replacer@0.0.0-20240814043648(transitive)
+ Added@0xsequence/sessions@0.0.0-20240814043648(transitive)
+ Added@0xsequence/signhub@0.0.0-20240814043648(transitive)
+ Added@0xsequence/utils@0.0.0-20240814043648(transitive)
+ Added@0xsequence/wallet@0.0.0-20240814043648(transitive)
+ Added@ethersproject/abi@5.7.0(transitive)
+ Added@ethersproject/abstract-provider@5.7.0(transitive)
+ Added@ethersproject/abstract-signer@5.7.0(transitive)
+ Added@ethersproject/address@5.7.0(transitive)
+ Added@ethersproject/base64@5.7.0(transitive)
+ Added@ethersproject/basex@5.7.0(transitive)
+ Added@ethersproject/bignumber@5.7.0(transitive)
+ Added@ethersproject/bytes@5.7.0(transitive)
+ Added@ethersproject/constants@5.7.0(transitive)
+ Added@ethersproject/contracts@5.7.0(transitive)
+ Added@ethersproject/hash@5.7.0(transitive)
+ Added@ethersproject/hdnode@5.7.0(transitive)
+ Added@ethersproject/json-wallets@5.7.0(transitive)
+ Added@ethersproject/keccak256@5.7.0(transitive)
+ Added@ethersproject/logger@5.7.0(transitive)
+ Added@ethersproject/networks@5.7.1(transitive)
+ Added@ethersproject/pbkdf2@5.7.0(transitive)
+ Added@ethersproject/properties@5.7.0(transitive)
+ Added@ethersproject/providers@5.7.2(transitive)
+ Added@ethersproject/random@5.7.0(transitive)
+ Added@ethersproject/rlp@5.7.0(transitive)
+ Added@ethersproject/sha2@5.7.0(transitive)
+ Added@ethersproject/signing-key@5.7.0(transitive)
+ Added@ethersproject/solidity@5.7.0(transitive)
+ Added@ethersproject/strings@5.7.0(transitive)
+ Added@ethersproject/transactions@5.7.0(transitive)
+ Added@ethersproject/units@5.7.0(transitive)
+ Added@ethersproject/wallet@5.7.0(transitive)
+ Added@ethersproject/web@5.7.1(transitive)
+ Added@ethersproject/wordlists@5.7.0(transitive)
+ Addedaes-js@3.0.0(transitive)
+ Addedbech32@1.1.4(transitive)
+ Addedbn.js@4.12.05.2.1(transitive)
+ Addedbrorand@1.1.0(transitive)
+ Addedelliptic@6.5.4(transitive)
+ Addedethers@5.7.2(transitive)
+ Addedhash.js@1.1.7(transitive)
+ Addedhmac-drbg@1.0.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedjs-sha3@0.8.0(transitive)
+ Addedminimalistic-assert@1.0.1(transitive)
+ Addedminimalistic-crypto-utils@1.0.1(transitive)
+ Addedscrypt-js@3.0.1(transitive)
+ Addedws@7.4.6(transitive)
- Removed@0xsequence/abi@0.0.0-20240812142652(transitive)
- Removed@0xsequence/account@0.0.0-20240812142652(transitive)
- Removed@0xsequence/api@0.0.0-20240812142652(transitive)
- Removed@0xsequence/core@0.0.0-20240812142652(transitive)
- Removed@0xsequence/ethauth@1.0.0(transitive)
- Removed@0xsequence/indexer@0.0.0-20240812142652(transitive)
- Removed@0xsequence/metadata@0.0.0-20240812142652(transitive)
- Removed@0xsequence/migration@0.0.0-20240812142652(transitive)
- Removed@0xsequence/network@0.0.0-20240812142652(transitive)
- Removed@0xsequence/relayer@0.0.0-20240812142652(transitive)
- Removed@0xsequence/replacer@0.0.0-20240812142652(transitive)
- Removed@0xsequence/sessions@0.0.0-20240812142652(transitive)
- Removed@0xsequence/signhub@0.0.0-20240812142652(transitive)
- Removed@0xsequence/utils@0.0.0-20240812142652(transitive)
- Removed@0xsequence/wallet@0.0.0-20240812142652(transitive)
- Removed@adraffy/ens-normalize@1.10.1(transitive)
- Removed@noble/curves@1.2.0(transitive)
- Removed@noble/hashes@1.3.2(transitive)
- Removed@types/node@18.15.13(transitive)
- Removedaes-js@4.0.0-beta.5(transitive)
- Removedethers@6.13.2(transitive)
- Removedtslib@2.4.0(transitive)
- Removedws@8.17.1(transitive)
Updated@0xsequence/ethauth@^0.8.1