@0xsequence/auth
Advanced tools
Comparing version 0.0.0-20240626143910 to 0.0.0-20240703210534
@@ -160,6 +160,9 @@ 'use strict'; | ||
const ethAuth = new ethauth.ETHAuth(); | ||
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(); | ||
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); | ||
@@ -169,5 +172,4 @@ // 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.providers.StaticJsonRpcProvider(utils.getEthersConnectionInfo(network$1.rpcUrl, this.projectAccessKey), { | ||
name: '', | ||
chainId: chainId.toNumber() | ||
ethAuth.provider = new ethers.ethers.JsonRpcProvider(utils.getFetchRequest(found.rpcUrl, this.projectAccessKey), network$1, { | ||
staticNetwork: network$1 | ||
}); | ||
@@ -233,12 +235,15 @@ await ethAuth.decodeProof(proofString); | ||
const ethAuth = new ethauth.ETHAuth(); | ||
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(); | ||
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); | ||
// 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.providers.StaticJsonRpcProvider(utils.getEthersConnectionInfo(network$1.rpcUrl, this.projectAccessKey), { | ||
name: '', | ||
chainId: chainId.toNumber() | ||
ethAuth.provider = new ethers.ethers.JsonRpcProvider(utils.getFetchRequest(found.rpcUrl, this.projectAccessKey), network$1, { | ||
staticNetwork: network$1 | ||
}); | ||
@@ -274,3 +279,3 @@ const expiration = this.now() + this.expiration - EXPIRATION_JWT_MARGIN; | ||
const signAuthorization = async (signer, chainId, options) => { | ||
const address = ethers.ethers.utils.getAddress(await signer.getAddress()); | ||
const address = ethers.ethers.getAddress(await signer.getAddress()); | ||
if (!address || address === '' || address === '0x') { | ||
@@ -517,3 +522,3 @@ throw ErrAccountIsRequired; | ||
const newConfig = account$1.coders.config.editConfig(nextConfig, { | ||
checkpoint: account$1.coders.config.checkpointOf(prevConfig).add(1) | ||
checkpoint: account$1.coders.config.checkpointOf(prevConfig) + 1n | ||
}); | ||
@@ -520,0 +525,0 @@ await account$1.updateConfig(newConfig); |
@@ -160,6 +160,9 @@ 'use strict'; | ||
const ethAuth = new ethauth.ETHAuth(); | ||
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(); | ||
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); | ||
@@ -169,5 +172,4 @@ // 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.providers.StaticJsonRpcProvider(utils.getEthersConnectionInfo(network$1.rpcUrl, this.projectAccessKey), { | ||
name: '', | ||
chainId: chainId.toNumber() | ||
ethAuth.provider = new ethers.ethers.JsonRpcProvider(utils.getFetchRequest(found.rpcUrl, this.projectAccessKey), network$1, { | ||
staticNetwork: network$1 | ||
}); | ||
@@ -233,12 +235,15 @@ await ethAuth.decodeProof(proofString); | ||
const ethAuth = new ethauth.ETHAuth(); | ||
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(); | ||
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); | ||
// 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.providers.StaticJsonRpcProvider(utils.getEthersConnectionInfo(network$1.rpcUrl, this.projectAccessKey), { | ||
name: '', | ||
chainId: chainId.toNumber() | ||
ethAuth.provider = new ethers.ethers.JsonRpcProvider(utils.getFetchRequest(found.rpcUrl, this.projectAccessKey), network$1, { | ||
staticNetwork: network$1 | ||
}); | ||
@@ -274,3 +279,3 @@ const expiration = this.now() + this.expiration - EXPIRATION_JWT_MARGIN; | ||
const signAuthorization = async (signer, chainId, options) => { | ||
const address = ethers.ethers.utils.getAddress(await signer.getAddress()); | ||
const address = ethers.ethers.getAddress(await signer.getAddress()); | ||
if (!address || address === '' || address === '0x') { | ||
@@ -517,3 +522,3 @@ throw ErrAccountIsRequired; | ||
const newConfig = account$1.coders.config.editConfig(nextConfig, { | ||
checkpoint: account$1.coders.config.checkpointOf(prevConfig).add(1) | ||
checkpoint: account$1.coders.config.checkpointOf(prevConfig) + 1n | ||
}); | ||
@@ -520,0 +525,0 @@ await account$1.updateConfig(newConfig); |
@@ -8,3 +8,3 @@ import { ethers } from 'ethers'; | ||
import { SequenceMetadata } from '@0xsequence/metadata'; | ||
import { getEthersConnectionInfo, jwtDecodeClaims } from '@0xsequence/utils'; | ||
import { getFetchRequest, jwtDecodeClaims } from '@0xsequence/utils'; | ||
import { trackers } from '@0xsequence/sessions'; | ||
@@ -157,6 +157,9 @@ import { Orchestrator } from '@0xsequence/signhub'; | ||
const ethAuth = new ETHAuth(); | ||
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 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); | ||
@@ -166,5 +169,4 @@ // 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.providers.StaticJsonRpcProvider(getEthersConnectionInfo(network.rpcUrl, this.projectAccessKey), { | ||
name: '', | ||
chainId: chainId.toNumber() | ||
ethAuth.provider = new ethers.JsonRpcProvider(getFetchRequest(found.rpcUrl, this.projectAccessKey), network, { | ||
staticNetwork: network | ||
}); | ||
@@ -230,12 +232,15 @@ await ethAuth.decodeProof(proofString); | ||
const ethAuth = new ETHAuth(); | ||
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 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); | ||
// 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.providers.StaticJsonRpcProvider(getEthersConnectionInfo(network.rpcUrl, this.projectAccessKey), { | ||
name: '', | ||
chainId: chainId.toNumber() | ||
ethAuth.provider = new ethers.JsonRpcProvider(getFetchRequest(found.rpcUrl, this.projectAccessKey), network, { | ||
staticNetwork: network | ||
}); | ||
@@ -271,3 +276,3 @@ const expiration = this.now() + this.expiration - EXPIRATION_JWT_MARGIN; | ||
const signAuthorization = async (signer, chainId, options) => { | ||
const address = ethers.utils.getAddress(await signer.getAddress()); | ||
const address = ethers.getAddress(await signer.getAddress()); | ||
if (!address || address === '' || address === '0x') { | ||
@@ -514,3 +519,3 @@ throw ErrAccountIsRequired; | ||
const newConfig = account.coders.config.editConfig(nextConfig, { | ||
checkpoint: account.coders.config.checkpointOf(prevConfig).add(1) | ||
checkpoint: account.coders.config.checkpointOf(prevConfig) + 1n | ||
}); | ||
@@ -517,0 +522,0 @@ await account.updateConfig(newConfig); |
{ | ||
"name": "@0xsequence/auth", | ||
"version": "0.0.0-20240626143910", | ||
"version": "0.0.0-20240703210534", | ||
"description": "auth sub-package for Sequence", | ||
@@ -12,26 +12,26 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/auth", | ||
"dependencies": { | ||
"@0xsequence/ethauth": "^0.8.1", | ||
"@0xsequence/abi": "0.0.0-20240626143910", | ||
"@0xsequence/account": "0.0.0-20240626143910", | ||
"@0xsequence/api": "0.0.0-20240626143910", | ||
"@0xsequence/indexer": "0.0.0-20240626143910", | ||
"@0xsequence/core": "0.0.0-20240626143910", | ||
"@0xsequence/metadata": "0.0.0-20240626143910", | ||
"@0xsequence/migration": "0.0.0-20240626143910", | ||
"@0xsequence/network": "0.0.0-20240626143910", | ||
"@0xsequence/sessions": "0.0.0-20240626143910", | ||
"@0xsequence/signhub": "0.0.0-20240626143910", | ||
"@0xsequence/wallet": "0.0.0-20240626143910", | ||
"@0xsequence/utils": "0.0.0-20240626143910" | ||
"@0xsequence/ethauth": "^1.0.0", | ||
"@0xsequence/abi": "0.0.0-20240703210534", | ||
"@0xsequence/account": "0.0.0-20240703210534", | ||
"@0xsequence/api": "0.0.0-20240703210534", | ||
"@0xsequence/core": "0.0.0-20240703210534", | ||
"@0xsequence/indexer": "0.0.0-20240703210534", | ||
"@0xsequence/metadata": "0.0.0-20240703210534", | ||
"@0xsequence/migration": "0.0.0-20240703210534", | ||
"@0xsequence/network": "0.0.0-20240703210534", | ||
"@0xsequence/sessions": "0.0.0-20240703210534", | ||
"@0xsequence/signhub": "0.0.0-20240703210534", | ||
"@0xsequence/wallet": "0.0.0-20240703210534", | ||
"@0xsequence/utils": "0.0.0-20240703210534" | ||
}, | ||
"peerDependencies": { | ||
"ethers": ">=5.5 < 6" | ||
"ethers": ">=6" | ||
}, | ||
"devDependencies": { | ||
"@0xsequence/wallet-contracts": "^1.10.0", | ||
"@0xsequence/wallet-contracts": "^3.0.1", | ||
"concurrently": "^7.5.0", | ||
"ethers": "^5.7.2", | ||
"ethers": "^6.13.0", | ||
"hardhat": "^2.20.1", | ||
"mockttp": "^3.6.0", | ||
"@0xsequence/tests": "0.0.0-20240626143910" | ||
"@0xsequence/tests": "0.0.0-20240703210534" | ||
}, | ||
@@ -45,3 +45,3 @@ "files": [ | ||
"test:run": "pnpm test:file tests/**/*.spec.ts", | ||
"test:file": "NODE_OPTIONS='--import tsx' mocha --timeout 30000", | ||
"test:file": "NODE_OPTIONS='--import tsx' mocha --timeout 60000", | ||
"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.utils.getAddress(await signer.getAddress()) | ||
const address = ethers.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.providers.JsonRpcProvider, chainId: number, proof: Proof): Promise<{ isValid: boolean }> => { | ||
return async (_provider: ethers.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 { getEthersConnectionInfo } from '@0xsequence/utils' | ||
import { getFetchRequest } from '@0xsequence/utils' | ||
import { ethers } from 'ethers' | ||
@@ -205,17 +205,17 @@ | ||
const ethAuth = new ETHAuth() | ||
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 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) | ||
// 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.providers.StaticJsonRpcProvider( | ||
getEthersConnectionInfo(network.rpcUrl, this.projectAccessKey), | ||
{ | ||
name: '', | ||
chainId: chainId.toNumber() | ||
} | ||
) | ||
ethAuth.provider = new ethers.JsonRpcProvider(getFetchRequest(found.rpcUrl, this.projectAccessKey), network, { | ||
staticNetwork: network | ||
}) | ||
@@ -295,16 +295,17 @@ await ethAuth.decodeProof(proofString) | ||
const ethAuth = new ETHAuth() | ||
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 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) | ||
// 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.providers.StaticJsonRpcProvider( | ||
getEthersConnectionInfo(network.rpcUrl, this.projectAccessKey), | ||
{ | ||
name: '', | ||
chainId: chainId.toNumber() | ||
} | ||
) | ||
ethAuth.provider = new ethers.JsonRpcProvider(getFetchRequest(found.rpcUrl, this.projectAccessKey), network, { | ||
staticNetwork: network | ||
}) | ||
@@ -311,0 +312,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).add(1) | ||
checkpoint: account.coders.config.checkpointOf(prevConfig) + 1n | ||
}) | ||
@@ -266,0 +266,0 @@ |
121107
2754
+ Added@0xsequence/abi@0.0.0-20240703210534(transitive)
+ Added@0xsequence/account@0.0.0-20240703210534(transitive)
+ Added@0xsequence/api@0.0.0-20240703210534(transitive)
+ Added@0xsequence/core@0.0.0-20240703210534(transitive)
+ Added@0xsequence/ethauth@1.0.0(transitive)
+ Added@0xsequence/indexer@0.0.0-20240703210534(transitive)
+ Added@0xsequence/metadata@0.0.0-20240703210534(transitive)
+ Added@0xsequence/migration@0.0.0-20240703210534(transitive)
+ Added@0xsequence/network@0.0.0-20240703210534(transitive)
+ Added@0xsequence/relayer@0.0.0-20240703210534(transitive)
+ Added@0xsequence/replacer@0.0.0-20240703210534(transitive)
+ Added@0xsequence/sessions@0.0.0-20240703210534(transitive)
+ Added@0xsequence/signhub@0.0.0-20240703210534(transitive)
+ Added@0xsequence/utils@0.0.0-20240703210534(transitive)
+ Added@0xsequence/wallet@0.0.0-20240703210534(transitive)
+ Added@adraffy/ens-normalize@1.10.1(transitive)
+ Added@noble/curves@1.2.0(transitive)
+ Added@noble/hashes@1.3.2(transitive)
+ Added@types/node@22.7.5(transitive)
+ Addedaes-js@4.0.0-beta.5(transitive)
+ Addedethers@6.13.5(transitive)
+ Addedtslib@2.7.0(transitive)
+ Addedundici-types@6.19.8(transitive)
+ Addedws@8.17.1(transitive)
- Removed@0xsequence/abi@0.0.0-20240626143910(transitive)
- Removed@0xsequence/account@0.0.0-20240626143910(transitive)
- Removed@0xsequence/api@0.0.0-20240626143910(transitive)
- Removed@0xsequence/core@0.0.0-20240626143910(transitive)
- Removed@0xsequence/ethauth@0.8.1(transitive)
- Removed@0xsequence/indexer@0.0.0-20240626143910(transitive)
- Removed@0xsequence/metadata@0.0.0-20240626143910(transitive)
- Removed@0xsequence/migration@0.0.0-20240626143910(transitive)
- Removed@0xsequence/network@0.0.0-20240626143910(transitive)
- Removed@0xsequence/relayer@0.0.0-20240626143910(transitive)
- Removed@0xsequence/replacer@0.0.0-20240626143910(transitive)
- Removed@0xsequence/sessions@0.0.0-20240626143910(transitive)
- Removed@0xsequence/signhub@0.0.0-20240626143910(transitive)
- Removed@0xsequence/utils@0.0.0-20240626143910(transitive)
- Removed@0xsequence/wallet@0.0.0-20240626143910(transitive)
- Removed@ethersproject/abi@5.7.0(transitive)
- Removed@ethersproject/abstract-provider@5.7.0(transitive)
- Removed@ethersproject/abstract-signer@5.7.0(transitive)
- Removed@ethersproject/address@5.7.0(transitive)
- Removed@ethersproject/base64@5.7.0(transitive)
- Removed@ethersproject/basex@5.7.0(transitive)
- Removed@ethersproject/bignumber@5.7.0(transitive)
- Removed@ethersproject/bytes@5.7.0(transitive)
- Removed@ethersproject/constants@5.7.0(transitive)
- Removed@ethersproject/contracts@5.7.0(transitive)
- Removed@ethersproject/hash@5.7.0(transitive)
- Removed@ethersproject/hdnode@5.7.0(transitive)
- Removed@ethersproject/json-wallets@5.7.0(transitive)
- Removed@ethersproject/keccak256@5.7.0(transitive)
- Removed@ethersproject/logger@5.7.0(transitive)
- Removed@ethersproject/networks@5.7.1(transitive)
- Removed@ethersproject/pbkdf2@5.7.0(transitive)
- Removed@ethersproject/properties@5.7.0(transitive)
- Removed@ethersproject/providers@5.7.2(transitive)
- Removed@ethersproject/random@5.7.0(transitive)
- Removed@ethersproject/rlp@5.7.0(transitive)
- Removed@ethersproject/sha2@5.7.0(transitive)
- Removed@ethersproject/signing-key@5.7.0(transitive)
- Removed@ethersproject/solidity@5.7.0(transitive)
- Removed@ethersproject/strings@5.7.0(transitive)
- Removed@ethersproject/transactions@5.7.0(transitive)
- Removed@ethersproject/units@5.7.0(transitive)
- Removed@ethersproject/wallet@5.7.0(transitive)
- Removed@ethersproject/web@5.7.1(transitive)
- Removed@ethersproject/wordlists@5.7.0(transitive)
- Removedaes-js@3.0.0(transitive)
- Removedbech32@1.1.4(transitive)
- Removedbn.js@4.12.15.2.1(transitive)
- Removedbrorand@1.1.0(transitive)
- Removedelliptic@6.5.4(transitive)
- Removedethers@5.7.2(transitive)
- Removedhash.js@1.1.7(transitive)
- Removedhmac-drbg@1.0.1(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjs-sha3@0.8.0(transitive)
- Removedminimalistic-assert@1.0.1(transitive)
- Removedminimalistic-crypto-utils@1.0.1(transitive)
- Removedscrypt-js@3.0.1(transitive)
- Removedws@7.4.6(transitive)
Updated@0xsequence/ethauth@^1.0.0