@0xsequence/provider 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -586,48 +586,22 @@ const trimEIP191Prefix = prefixedMessage => {
|
|
|
586
586
|
const prefixRevertedMessage = ethereumSignedMessagePartSlicedArray.slice(prefixCharLenght);
|
|
587
587
|
return prefixRevertedMessage;
|
|
588
588
|
};
|
|
589
|
-
const isValidSignature = async (address, digest, sig, provider
|
|
590
|
-
const
|
|
591
|
-
const reader = new core.commons.reader.OnChainReader(provider, contexts || deployedContexts);
|
|
589
|
+
const isValidSignature = async (address, digest, sig, provider) => {
|
|
590
|
+
const reader = new core.commons.reader.OnChainReader(provider);
|
|
592
591
|
return reader.isValidSignature(address, digest, sig);
|
|
593
592
|
};
|
|
594
593
|
|
|
595
594
|
// Verify message signature
|
|
596
|
-
const isValidMessageSignature = async (address, message, signature, provider
|
|
597
|
-
const deployedContexts = core.allVersions.map(v => v.DeployedWalletContext);
|
|
595
|
+
const isValidMessageSignature = async (address, message, signature, provider) => {
|
|
598
596
|
const prefixed = prefixEIP191Message(message);
|
|
599
597
|
const digest = utils.encodeMessageDigest(prefixed);
|
|
600
|
-
return isValidSignature(address, digest, signature, provider
|
|
598
|
+
return isValidSignature(address, digest, signature, provider);
|
|
601
599
|
};
|
|
602
600
|
|
|
603
601
|
// Verify typedData signature
|
|
604
|
-
const isValidTypedDataSignature = (address, typedData, signature, provider
|
|
605
|
-
|
|
606
|
-
return isValidSignature(address, utils.encodeTypedDataDigest(typedData), signature, provider, contexts || deployedContexts);
|
|
602
|
+
const isValidTypedDataSignature = (address, typedData, signature, provider) => {
|
|
603
|
+
return isValidSignature(address, utils.encodeTypedDataDigest(typedData), signature, provider);
|
|
607
604
|
};
|
|
608
|
-
|
|
609
|
-
// export const recoverWalletConfig = async (
|
|
610
|
-
// address: string,
|
|
611
|
-
// digest: BytesLike,
|
|
612
|
-
// signature: string | commons.signature.UnrecoveredSignature | commons.signature.Signature<commons.config.Config>,
|
|
613
|
-
// chainId: BigNumberish,
|
|
614
|
-
// walletContext?: WalletContext
|
|
615
|
-
// ): Promise<commons.config.Config> => {
|
|
616
|
-
// const subDigest = packMessageData(address, chainId, digest)
|
|
617
|
-
// const config = await recoverConfig(subDigest, signature)
|
|
618
|
-
|
|
619
|
-
// if (walletContext) {
|
|
620
|
-
// const recoveredWalletAddress = addressOf(config, walletContext)
|
|
621
|
-
// if (config.address && config.address !== recoveredWalletAddress) {
|
|
622
|
-
// throw new Error('recovered address does not match the WalletConfig address, check the WalletContext')
|
|
623
|
-
// } else {
|
|
624
|
-
// config.address = recoveredWalletAddress
|
|
625
|
-
// }
|
|
626
|
-
// }
|
|
627
|
-
|
|
628
|
-
// return config
|
|
629
|
-
// }
|
|
630
|
-
|
|
631
605
|
const isBrowserExtension = () => window.location.protocol === 'chrome-extension:' || window.location.protocol === 'moz-extension:';
|
|
632
606
|
const isUnityPlugin = () => !!navigator.userAgent.match(/UnitySequence/i);
|
|
633
607
|
|
|
@@ -3261,7 +3235,7 @@ class WalletUtils {
|
|
|
3261
3235
|
async isValidSignature(address, digest, signature, chainId) {
|
|
3262
3236
|
const provider = this.wallet.getProvider(chainId);
|
|
3263
3237
|
if (!provider) throw new Error(`unable to get provider for chainId ${chainId}`);
|
|
3264
|
-
return isValidSignature(address, digest, signature, provider
|
|
3238
|
+
return isValidSignature(address, digest, signature, provider);
|
|
3265
3239
|
}
|
|
3266
3240
|
|
|
3267
3241
|
// Verify message signature
|
|
@@ -3270,7 +3244,7 @@ class WalletUtils {
|
|
|
3270
3244
|
if (!provider) throw new Error(`unable to get provider for chainId ${chainId}`);
|
|
3271
3245
|
const prefixed = prefixEIP191Message(message);
|
|
3272
3246
|
const digest = utils.encodeMessageDigest(prefixed);
|
|
3273
|
-
return isValidSignature(address, digest, signature, provider
|
|
3247
|
+
return isValidSignature(address, digest, signature, provider);
|
|
3274
3248
|
}
|
|
3275
3249
|
|
|
3276
3250
|
// Verify typedData signature
|
|
@@ -586,48 +586,22 @@ const trimEIP191Prefix = prefixedMessage => {
|
|
|
586
586
|
const prefixRevertedMessage = ethereumSignedMessagePartSlicedArray.slice(prefixCharLenght);
|
|
587
587
|
return prefixRevertedMessage;
|
|
588
588
|
};
|
|
589
|
-
const isValidSignature = async (address, digest, sig, provider
|
|
590
|
-
const
|
|
591
|
-
const reader = new core.commons.reader.OnChainReader(provider, contexts || deployedContexts);
|
|
589
|
+
const isValidSignature = async (address, digest, sig, provider) => {
|
|
590
|
+
const reader = new core.commons.reader.OnChainReader(provider);
|
|
592
591
|
return reader.isValidSignature(address, digest, sig);
|
|
593
592
|
};
|
|
594
593
|
|
|
595
594
|
// Verify message signature
|
|
596
|
-
const isValidMessageSignature = async (address, message, signature, provider
|
|
597
|
-
const deployedContexts = core.allVersions.map(v => v.DeployedWalletContext);
|
|
595
|
+
const isValidMessageSignature = async (address, message, signature, provider) => {
|
|
598
596
|
const prefixed = prefixEIP191Message(message);
|
|
599
597
|
const digest = utils.encodeMessageDigest(prefixed);
|
|
600
|
-
return isValidSignature(address, digest, signature, provider
|
|
598
|
+
return isValidSignature(address, digest, signature, provider);
|
|
601
599
|
};
|
|
602
600
|
|
|
603
601
|
// Verify typedData signature
|
|
604
|
-
const isValidTypedDataSignature = (address, typedData, signature, provider
|
|
605
|
-
|
|
606
|
-
return isValidSignature(address, utils.encodeTypedDataDigest(typedData), signature, provider, contexts || deployedContexts);
|
|
602
|
+
const isValidTypedDataSignature = (address, typedData, signature, provider) => {
|
|
603
|
+
return isValidSignature(address, utils.encodeTypedDataDigest(typedData), signature, provider);
|
|
607
604
|
};
|
|
608
|
-
|
|
609
|
-
// export const recoverWalletConfig = async (
|
|
610
|
-
// address: string,
|
|
611
|
-
// digest: BytesLike,
|
|
612
|
-
// signature: string | commons.signature.UnrecoveredSignature | commons.signature.Signature<commons.config.Config>,
|
|
613
|
-
// chainId: BigNumberish,
|
|
614
|
-
// walletContext?: WalletContext
|
|
615
|
-
// ): Promise<commons.config.Config> => {
|
|
616
|
-
// const subDigest = packMessageData(address, chainId, digest)
|
|
617
|
-
// const config = await recoverConfig(subDigest, signature)
|
|
618
|
-
|
|
619
|
-
// if (walletContext) {
|
|
620
|
-
// const recoveredWalletAddress = addressOf(config, walletContext)
|
|
621
|
-
// if (config.address && config.address !== recoveredWalletAddress) {
|
|
622
|
-
// throw new Error('recovered address does not match the WalletConfig address, check the WalletContext')
|
|
623
|
-
// } else {
|
|
624
|
-
// config.address = recoveredWalletAddress
|
|
625
|
-
// }
|
|
626
|
-
// }
|
|
627
|
-
|
|
628
|
-
// return config
|
|
629
|
-
// }
|
|
630
|
-
|
|
631
605
|
const isBrowserExtension = () => window.location.protocol === 'chrome-extension:' || window.location.protocol === 'moz-extension:';
|
|
632
606
|
const isUnityPlugin = () => !!navigator.userAgent.match(/UnitySequence/i);
|
|
633
607
|
|
|
@@ -3261,7 +3235,7 @@ class WalletUtils {
|
|
|
3261
3235
|
async isValidSignature(address, digest, signature, chainId) {
|
|
3262
3236
|
const provider = this.wallet.getProvider(chainId);
|
|
3263
3237
|
if (!provider) throw new Error(`unable to get provider for chainId ${chainId}`);
|
|
3264
|
-
return isValidSignature(address, digest, signature, provider
|
|
3238
|
+
return isValidSignature(address, digest, signature, provider);
|
|
3265
3239
|
}
|
|
3266
3240
|
|
|
3267
3241
|
// Verify message signature
|
|
@@ -3270,7 +3244,7 @@ class WalletUtils {
|
|
|
3270
3244
|
if (!provider) throw new Error(`unable to get provider for chainId ${chainId}`);
|
|
3271
3245
|
const prefixed = prefixEIP191Message(message);
|
|
3272
3246
|
const digest = utils.encodeMessageDigest(prefixed);
|
|
3273
|
-
return isValidSignature(address, digest, signature, provider
|
|
3247
|
+
return isValidSignature(address, digest, signature, provider);
|
|
3274
3248
|
}
|
|
3275
3249
|
|
|
3276
3250
|
// Verify typedData signature
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter2 } from 'eventemitter2';
|
|
2
2
|
import { logger, encodeMessageDigest, encodeTypedDataDigest, sanitizeNumberString, sanitizeHost, sanitizeAlphanumeric, base64EncodeObject, base64DecodeObject, shallowCopy, resolveProperties, getDefaultConnectionInfo } from '@0xsequence/utils';
|
|
3
3
|
import { ethers, BigNumber, providers } from 'ethers';
|
|
4
|
-
import {
|
|
4
|
+
import { commons, universal } from '@0xsequence/core';
|
|
5
5
|
import { signAuthorization } from '@0xsequence/auth';
|
|
6
6
|
import { getChainId, JsonRpcSender, maybeChainId, allowProviderMiddleware, networkProviderMiddleware, findNetworkConfig, CachedProvider, JsonRpcRouter, loggingProviderMiddleware, exceptionProviderMiddleware, findSupportedNetwork, sortNetworks, EagerProvider, SigningProvider, updateNetworkConfig, ensureValidNetworks } from '@0xsequence/network';
|
|
7
7
|
import { Signer, resolveArrayProperties } from '@0xsequence/wallet';
|
|
@@ -582,48 +582,22 @@ const trimEIP191Prefix = prefixedMessage => {
|
|
|
582
582
|
const prefixRevertedMessage = ethereumSignedMessagePartSlicedArray.slice(prefixCharLenght);
|
|
583
583
|
return prefixRevertedMessage;
|
|
584
584
|
};
|
|
585
|
-
const isValidSignature = async (address, digest, sig, provider
|
|
586
|
-
const
|
|
587
|
-
const reader = new commons.reader.OnChainReader(provider, contexts || deployedContexts);
|
|
585
|
+
const isValidSignature = async (address, digest, sig, provider) => {
|
|
586
|
+
const reader = new commons.reader.OnChainReader(provider);
|
|
588
587
|
return reader.isValidSignature(address, digest, sig);
|
|
589
588
|
};
|
|
590
589
|
|
|
591
590
|
// Verify message signature
|
|
592
|
-
const isValidMessageSignature = async (address, message, signature, provider
|
|
593
|
-
const deployedContexts = allVersions.map(v => v.DeployedWalletContext);
|
|
591
|
+
const isValidMessageSignature = async (address, message, signature, provider) => {
|
|
594
592
|
const prefixed = prefixEIP191Message(message);
|
|
595
593
|
const digest = encodeMessageDigest(prefixed);
|
|
596
|
-
return isValidSignature(address, digest, signature, provider
|
|
594
|
+
return isValidSignature(address, digest, signature, provider);
|
|
597
595
|
};
|
|
598
596
|
|
|
599
597
|
// Verify typedData signature
|
|
600
|
-
const isValidTypedDataSignature = (address, typedData, signature, provider
|
|
601
|
-
|
|
602
|
-
return isValidSignature(address, encodeTypedDataDigest(typedData), signature, provider, contexts || deployedContexts);
|
|
598
|
+
const isValidTypedDataSignature = (address, typedData, signature, provider) => {
|
|
599
|
+
return isValidSignature(address, encodeTypedDataDigest(typedData), signature, provider);
|
|
603
600
|
};
|
|
604
|
-
|
|
605
|
-
// export const recoverWalletConfig = async (
|
|
606
|
-
// address: string,
|
|
607
|
-
// digest: BytesLike,
|
|
608
|
-
// signature: string | commons.signature.UnrecoveredSignature | commons.signature.Signature<commons.config.Config>,
|
|
609
|
-
// chainId: BigNumberish,
|
|
610
|
-
// walletContext?: WalletContext
|
|
611
|
-
// ): Promise<commons.config.Config> => {
|
|
612
|
-
// const subDigest = packMessageData(address, chainId, digest)
|
|
613
|
-
// const config = await recoverConfig(subDigest, signature)
|
|
614
|
-
|
|
615
|
-
// if (walletContext) {
|
|
616
|
-
// const recoveredWalletAddress = addressOf(config, walletContext)
|
|
617
|
-
// if (config.address && config.address !== recoveredWalletAddress) {
|
|
618
|
-
// throw new Error('recovered address does not match the WalletConfig address, check the WalletContext')
|
|
619
|
-
// } else {
|
|
620
|
-
// config.address = recoveredWalletAddress
|
|
621
|
-
// }
|
|
622
|
-
// }
|
|
623
|
-
|
|
624
|
-
// return config
|
|
625
|
-
// }
|
|
626
|
-
|
|
627
601
|
const isBrowserExtension = () => window.location.protocol === 'chrome-extension:' || window.location.protocol === 'moz-extension:';
|
|
628
602
|
const isUnityPlugin = () => !!navigator.userAgent.match(/UnitySequence/i);
|
|
629
603
|
|
|
@@ -3257,7 +3231,7 @@ class WalletUtils {
|
|
|
3257
3231
|
async isValidSignature(address, digest, signature, chainId) {
|
|
3258
3232
|
const provider = this.wallet.getProvider(chainId);
|
|
3259
3233
|
if (!provider) throw new Error(`unable to get provider for chainId ${chainId}`);
|
|
3260
|
-
return isValidSignature(address, digest, signature, provider
|
|
3234
|
+
return isValidSignature(address, digest, signature, provider);
|
|
3261
3235
|
}
|
|
3262
3236
|
|
|
3263
3237
|
// Verify message signature
|
|
@@ -3266,7 +3240,7 @@ class WalletUtils {
|
|
|
3266
3240
|
if (!provider) throw new Error(`unable to get provider for chainId ${chainId}`);
|
|
3267
3241
|
const prefixed = prefixEIP191Message(message);
|
|
3268
3242
|
const digest = encodeMessageDigest(prefixed);
|
|
3269
|
-
return isValidSignature(address, digest, signature, provider
|
|
3243
|
+
return isValidSignature(address, digest, signature, provider);
|
|
3270
3244
|
}
|
|
3271
3245
|
|
|
3272
3246
|
// Verify typedData signature
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
|
|
2
1
|
import { ethers, BytesLike } from 'ethers';
|
|
3
|
-
import { Web3Provider } from './provider';
|
|
4
2
|
import { AccountStatus } from '@0xsequence/account';
|
|
5
|
-
import { commons } from '@0xsequence/core';
|
|
6
3
|
import { TypedData } from '@0xsequence/utils';
|
|
7
4
|
export declare const messageToBytes: (message: BytesLike) => Uint8Array;
|
|
8
5
|
export declare const prefixEIP191Message: (message: BytesLike) => Uint8Array;
|
|
9
6
|
export declare const trimEIP191Prefix: (prefixedMessage: Uint8Array) => Uint8Array;
|
|
10
|
-
export declare const isValidSignature: (address: string, digest: Uint8Array, sig: string, provider:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export declare const isValidMessageSignature: (address: string, message: string | Uint8Array, signature: string, provider: Web3Provider | ethers.providers.Web3Provider, contexts?: {
|
|
14
|
-
[key: number]: commons.context.WalletContext;
|
|
15
|
-
} | undefined) => Promise<boolean>;
|
|
16
|
-
export declare const isValidTypedDataSignature: (address: string, typedData: TypedData, signature: string, provider: Web3Provider | ethers.providers.Web3Provider, contexts?: {
|
|
17
|
-
[key: number]: commons.context.WalletContext;
|
|
18
|
-
} | undefined) => Promise<boolean>;
|
|
7
|
+
export declare const isValidSignature: (address: string, digest: Uint8Array, sig: string, provider: ethers.providers.Provider) => Promise<boolean>;
|
|
8
|
+
export declare const isValidMessageSignature: (address: string, message: string | Uint8Array, signature: string, provider: ethers.providers.Provider) => Promise<boolean>;
|
|
9
|
+
export declare const isValidTypedDataSignature: (address: string, typedData: TypedData, signature: string, provider: ethers.providers.Provider) => Promise<boolean>;
|
|
19
10
|
export declare const isBrowserExtension: () => boolean;
|
|
20
11
|
export declare const isUnityPlugin: () => boolean;
|
|
21
12
|
export declare const isWalletUpToDate: (status: AccountStatus) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/provider",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "provider sub-package for Sequence",
|
|
5
5
|
"repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"eventemitter2": "^6.4.5",
|
|
13
13
|
"webextension-polyfill": "^0.10.0",
|
|
14
|
-
"@0xsequence/abi": "1.0.
|
|
15
|
-
"@0xsequence/
|
|
16
|
-
"@0xsequence/
|
|
17
|
-
"@0xsequence/
|
|
18
|
-
"@0xsequence/
|
|
19
|
-
"@0xsequence/
|
|
20
|
-
"@0xsequence/
|
|
21
|
-
"@0xsequence/
|
|
22
|
-
"@0xsequence/
|
|
14
|
+
"@0xsequence/abi": "1.0.3",
|
|
15
|
+
"@0xsequence/auth": "1.0.3",
|
|
16
|
+
"@0xsequence/migration": "1.0.3",
|
|
17
|
+
"@0xsequence/network": "1.0.3",
|
|
18
|
+
"@0xsequence/account": "1.0.3",
|
|
19
|
+
"@0xsequence/relayer": "1.0.3",
|
|
20
|
+
"@0xsequence/core": "1.0.3",
|
|
21
|
+
"@0xsequence/utils": "1.0.3",
|
|
22
|
+
"@0xsequence/wallet": "1.0.3"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"ethers": ">=5.5 < 6"
|
package/src/utils/index.ts
CHANGED
|
@@ -59,7 +59,7 @@ export class WalletUtils {
|
|
|
59
59
|
): Promise<boolean> {
|
|
60
60
|
const provider = this.wallet.getProvider(chainId)
|
|
61
61
|
if (!provider) throw new Error(`unable to get provider for chainId ${chainId}`)
|
|
62
|
-
return isValidSignature(address, digest, signature, provider
|
|
62
|
+
return isValidSignature(address, digest, signature, provider)
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// Verify message signature
|
|
@@ -73,7 +73,7 @@ export class WalletUtils {
|
|
|
73
73
|
if (!provider) throw new Error(`unable to get provider for chainId ${chainId}`)
|
|
74
74
|
const prefixed = prefixEIP191Message(message)
|
|
75
75
|
const digest = encodeMessageDigest(prefixed)
|
|
76
|
-
return isValidSignature(address, digest, signature, provider
|
|
76
|
+
return isValidSignature(address, digest, signature, provider)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// Verify typedData signature
|
package/src/utils.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ethers, BytesLike } from 'ethers'
|
|
2
|
-
import { Web3Provider } from './provider'
|
|
3
2
|
import { messageIsExemptFromEIP191Prefix } from './eip191exceptions'
|
|
4
3
|
import { AccountStatus } from '@0xsequence/account'
|
|
5
|
-
import { commons
|
|
4
|
+
import { commons } from '@0xsequence/core'
|
|
6
5
|
import { encodeMessageDigest, TypedData, encodeTypedDataDigest } from '@0xsequence/utils'
|
|
7
6
|
|
|
8
7
|
const eip191prefix = ethers.utils.toUtf8Bytes('\x19Ethereum Signed Message:\n')
|
|
@@ -68,11 +67,9 @@ export const isValidSignature = async (
|
|
|
68
67
|
address: string,
|
|
69
68
|
digest: Uint8Array,
|
|
70
69
|
sig: string,
|
|
71
|
-
provider:
|
|
72
|
-
contexts?: { [key: number]: commons.context.WalletContext }
|
|
70
|
+
provider: ethers.providers.Provider
|
|
73
71
|
): Promise<boolean> => {
|
|
74
|
-
const
|
|
75
|
-
const reader = new commons.reader.OnChainReader(provider, contexts || deployedContexts)
|
|
72
|
+
const reader = new commons.reader.OnChainReader(provider)
|
|
76
73
|
return reader.isValidSignature(address, digest, sig)
|
|
77
74
|
}
|
|
78
75
|
|
|
@@ -81,13 +78,11 @@ export const isValidMessageSignature = async (
|
|
|
81
78
|
address: string,
|
|
82
79
|
message: string | Uint8Array,
|
|
83
80
|
signature: string,
|
|
84
|
-
provider:
|
|
85
|
-
contexts?: { [key: number]: commons.context.WalletContext }
|
|
81
|
+
provider: ethers.providers.Provider
|
|
86
82
|
): Promise<boolean> => {
|
|
87
|
-
const deployedContexts = allVersions.map(v => v.DeployedWalletContext)
|
|
88
83
|
const prefixed = prefixEIP191Message(message)
|
|
89
84
|
const digest = encodeMessageDigest(prefixed)
|
|
90
|
-
return isValidSignature(address, digest, signature, provider
|
|
85
|
+
return isValidSignature(address, digest, signature, provider)
|
|
91
86
|
}
|
|
92
87
|
|
|
93
88
|
// Verify typedData signature
|
|
@@ -95,34 +90,11 @@ export const isValidTypedDataSignature = (
|
|
|
95
90
|
address: string,
|
|
96
91
|
typedData: TypedData,
|
|
97
92
|
signature: string,
|
|
98
|
-
provider:
|
|
99
|
-
contexts?: { [key: number]: commons.context.WalletContext }
|
|
93
|
+
provider: ethers.providers.Provider
|
|
100
94
|
): Promise<boolean> => {
|
|
101
|
-
|
|
102
|
-
return isValidSignature(address, encodeTypedDataDigest(typedData), signature, provider, contexts || deployedContexts)
|
|
95
|
+
return isValidSignature(address, encodeTypedDataDigest(typedData), signature, provider)
|
|
103
96
|
}
|
|
104
97
|
|
|
105
|
-
// export const recoverWalletConfig = async (
|
|
106
|
-
// address: string,
|
|
107
|
-
// digest: BytesLike,
|
|
108
|
-
// signature: string | commons.signature.UnrecoveredSignature | commons.signature.Signature<commons.config.Config>,
|
|
109
|
-
// chainId: BigNumberish,
|
|
110
|
-
// walletContext?: WalletContext
|
|
111
|
-
// ): Promise<commons.config.Config> => {
|
|
112
|
-
// const subDigest = packMessageData(address, chainId, digest)
|
|
113
|
-
// const config = await recoverConfig(subDigest, signature)
|
|
114
|
-
|
|
115
|
-
// if (walletContext) {
|
|
116
|
-
// const recoveredWalletAddress = addressOf(config, walletContext)
|
|
117
|
-
// if (config.address && config.address !== recoveredWalletAddress) {
|
|
118
|
-
// throw new Error('recovered address does not match the WalletConfig address, check the WalletContext')
|
|
119
|
-
// } else {
|
|
120
|
-
// config.address = recoveredWalletAddress
|
|
121
|
-
// }
|
|
122
|
-
// }
|
|
123
|
-
|
|
124
|
-
// return config
|
|
125
|
-
// }
|
|
126
98
|
|
|
127
99
|
export const isBrowserExtension = (): boolean =>
|
|
128
100
|
window.location.protocol === 'chrome-extension:' || window.location.protocol === 'moz-extension:'
|