@0xsequence/provider 0.42.7 → 0.42.8
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.
- package/dist/0xsequence-provider.cjs.dev.js +3 -1
- package/dist/0xsequence-provider.cjs.prod.js +3 -1
- package/dist/0xsequence-provider.esm.js +3 -2
- package/dist/declarations/src/utils.d.ts +1 -0
- package/package.json +8 -8
- package/src/transports/window-transport/window-message-provider.ts +2 -2
- package/src/utils.ts +2 -0
|
@@ -1769,6 +1769,7 @@ const recoverWalletConfig = async (address, digest, signature, chainId, walletCo
|
|
|
1769
1769
|
return config$1;
|
|
1770
1770
|
};
|
|
1771
1771
|
const isBrowserExtension = () => window.location.protocol === 'chrome-extension:' || window.location.protocol === 'moz-extension:';
|
|
1772
|
+
const isUnityPlugin = () => !!navigator.userAgent.match(/UnitySequence/i);
|
|
1772
1773
|
/**
|
|
1773
1774
|
* Returns the status of a signer's wallet on given chain by checking wallet deployment and config status
|
|
1774
1775
|
*
|
|
@@ -2746,7 +2747,7 @@ class WindowMessageProvider extends BaseProviderTransport {
|
|
|
2746
2747
|
if (!intent.options) intent.options = {}; // skip setting origin host if we're in an browser extension execution context
|
|
2747
2748
|
// allow origin that is passed in
|
|
2748
2749
|
|
|
2749
|
-
if (!isBrowserExtension()) {
|
|
2750
|
+
if (!isBrowserExtension() && !isUnityPlugin()) {
|
|
2750
2751
|
intent.options.origin = window.location.origin;
|
|
2751
2752
|
}
|
|
2752
2753
|
} // encode intent as base64 url-encoded param
|
|
@@ -4116,6 +4117,7 @@ exports.getWallet = getWallet;
|
|
|
4116
4117
|
exports.initWallet = initWallet;
|
|
4117
4118
|
exports.isBrowserExtension = isBrowserExtension;
|
|
4118
4119
|
exports.isSequenceProvider = isSequenceProvider;
|
|
4120
|
+
exports.isUnityPlugin = isUnityPlugin;
|
|
4119
4121
|
exports.isValidMessageSignature = isValidMessageSignature;
|
|
4120
4122
|
exports.isValidSignature = isValidSignature;
|
|
4121
4123
|
exports.isValidTypedDataSignature = isValidTypedDataSignature;
|
|
@@ -1769,6 +1769,7 @@ const recoverWalletConfig = async (address, digest, signature, chainId, walletCo
|
|
|
1769
1769
|
return config$1;
|
|
1770
1770
|
};
|
|
1771
1771
|
const isBrowserExtension = () => window.location.protocol === 'chrome-extension:' || window.location.protocol === 'moz-extension:';
|
|
1772
|
+
const isUnityPlugin = () => !!navigator.userAgent.match(/UnitySequence/i);
|
|
1772
1773
|
/**
|
|
1773
1774
|
* Returns the status of a signer's wallet on given chain by checking wallet deployment and config status
|
|
1774
1775
|
*
|
|
@@ -2746,7 +2747,7 @@ class WindowMessageProvider extends BaseProviderTransport {
|
|
|
2746
2747
|
if (!intent.options) intent.options = {}; // skip setting origin host if we're in an browser extension execution context
|
|
2747
2748
|
// allow origin that is passed in
|
|
2748
2749
|
|
|
2749
|
-
if (!isBrowserExtension()) {
|
|
2750
|
+
if (!isBrowserExtension() && !isUnityPlugin()) {
|
|
2750
2751
|
intent.options.origin = window.location.origin;
|
|
2751
2752
|
}
|
|
2752
2753
|
} // encode intent as base64 url-encoded param
|
|
@@ -4116,6 +4117,7 @@ exports.getWallet = getWallet;
|
|
|
4116
4117
|
exports.initWallet = initWallet;
|
|
4117
4118
|
exports.isBrowserExtension = isBrowserExtension;
|
|
4118
4119
|
exports.isSequenceProvider = isSequenceProvider;
|
|
4120
|
+
exports.isUnityPlugin = isUnityPlugin;
|
|
4119
4121
|
exports.isValidMessageSignature = isValidMessageSignature;
|
|
4120
4122
|
exports.isValidSignature = isValidSignature;
|
|
4121
4123
|
exports.isValidTypedDataSignature = isValidTypedDataSignature;
|
|
@@ -1765,6 +1765,7 @@ const recoverWalletConfig = async (address, digest, signature, chainId, walletCo
|
|
|
1765
1765
|
return config;
|
|
1766
1766
|
};
|
|
1767
1767
|
const isBrowserExtension = () => window.location.protocol === 'chrome-extension:' || window.location.protocol === 'moz-extension:';
|
|
1768
|
+
const isUnityPlugin = () => !!navigator.userAgent.match(/UnitySequence/i);
|
|
1768
1769
|
/**
|
|
1769
1770
|
* Returns the status of a signer's wallet on given chain by checking wallet deployment and config status
|
|
1770
1771
|
*
|
|
@@ -2742,7 +2743,7 @@ class WindowMessageProvider extends BaseProviderTransport {
|
|
|
2742
2743
|
if (!intent.options) intent.options = {}; // skip setting origin host if we're in an browser extension execution context
|
|
2743
2744
|
// allow origin that is passed in
|
|
2744
2745
|
|
|
2745
|
-
if (!isBrowserExtension()) {
|
|
2746
|
+
if (!isBrowserExtension() && !isUnityPlugin()) {
|
|
2746
2747
|
intent.options.origin = window.location.origin;
|
|
2747
2748
|
}
|
|
2748
2749
|
} // encode intent as base64 url-encoded param
|
|
@@ -4081,4 +4082,4 @@ const getWallet = () => {
|
|
|
4081
4082
|
return walletInstance;
|
|
4082
4083
|
};
|
|
4083
4084
|
|
|
4084
|
-
export { BaseInjectedTransport, BaseProviderTransport, BaseWalletTransport, CHANNEL_ID, DefaultProviderConfig, ErrSignedInRequired, EventType, ExtensionMessageHandler, ExtensionMessageProvider, InitState, LocalStorage, LocalStore, LocalWeb3Provider, MuxMessageProvider, OpenState, PROVIDER_OPEN_TIMEOUT, ProviderError, ProxyMessageChannel, ProxyMessageChannelPort, ProxyMessageHandler, ProxyMessageProvider, UnrealMessageHandler, UnrealMessageProvider, Wallet, WalletRequestHandler, Web3Provider, Web3Signer, WindowMessageHandler, WindowMessageProvider, WindowSessionParams, getWallet, initWallet, isBrowserExtension, isSequenceProvider, isValidMessageSignature, isValidSignature, isValidTypedDataSignature, isWalletUpToDate, messageToBytes, nextMessageIdx, prefixEIP191Message, recoverWalletConfig };
|
|
4085
|
+
export { BaseInjectedTransport, BaseProviderTransport, BaseWalletTransport, CHANNEL_ID, DefaultProviderConfig, ErrSignedInRequired, EventType, ExtensionMessageHandler, ExtensionMessageProvider, InitState, LocalStorage, LocalStore, LocalWeb3Provider, MuxMessageProvider, OpenState, PROVIDER_OPEN_TIMEOUT, ProviderError, ProxyMessageChannel, ProxyMessageChannelPort, ProxyMessageHandler, ProxyMessageProvider, UnrealMessageHandler, UnrealMessageProvider, Wallet, WalletRequestHandler, Web3Provider, Web3Signer, WindowMessageHandler, WindowMessageProvider, WindowSessionParams, getWallet, initWallet, isBrowserExtension, isSequenceProvider, isUnityPlugin, isValidMessageSignature, isValidSignature, isValidTypedDataSignature, isWalletUpToDate, messageToBytes, nextMessageIdx, prefixEIP191Message, recoverWalletConfig };
|
|
@@ -11,6 +11,7 @@ export declare const isValidMessageSignature: (address: string, message: string
|
|
|
11
11
|
export declare const isValidTypedDataSignature: (address: string, typedData: TypedData, signature: string, provider: Web3Provider | ethers.providers.Web3Provider, chainId?: number | undefined, walletContext?: WalletContext | undefined) => Promise<boolean | undefined>;
|
|
12
12
|
export declare const recoverWalletConfig: (address: string, digest: BytesLike, signature: string | DecodedSignature, chainId: BigNumberish, walletContext?: WalletContext | undefined) => Promise<WalletConfig>;
|
|
13
13
|
export declare const isBrowserExtension: () => boolean;
|
|
14
|
+
export declare const isUnityPlugin: () => boolean;
|
|
14
15
|
/**
|
|
15
16
|
* Returns the status of a signer's wallet on given chain by checking wallet deployment and config status
|
|
16
17
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/provider",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.8",
|
|
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",
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"typecheck": "tsc --noEmit"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@0xsequence/abi": "^0.42.
|
|
17
|
-
"@0xsequence/auth": "^0.42.
|
|
18
|
-
"@0xsequence/config": "^0.42.
|
|
19
|
-
"@0xsequence/network": "^0.42.
|
|
20
|
-
"@0xsequence/transactions": "^0.42.
|
|
21
|
-
"@0xsequence/utils": "^0.42.
|
|
22
|
-
"@0xsequence/wallet": "^0.42.
|
|
16
|
+
"@0xsequence/abi": "^0.42.8",
|
|
17
|
+
"@0xsequence/auth": "^0.42.8",
|
|
18
|
+
"@0xsequence/config": "^0.42.8",
|
|
19
|
+
"@0xsequence/network": "^0.42.8",
|
|
20
|
+
"@0xsequence/transactions": "^0.42.8",
|
|
21
|
+
"@0xsequence/utils": "^0.42.8",
|
|
22
|
+
"@0xsequence/wallet": "^0.42.8",
|
|
23
23
|
"@ethersproject/abstract-signer": "^5.5.0",
|
|
24
24
|
"@ethersproject/hash": "^5.5.0",
|
|
25
25
|
"@ethersproject/providers": "^5.5.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenWalletIntent, ProviderMessage, InitState, EventType, WindowSessionParams } from '../../types'
|
|
2
2
|
import { BaseProviderTransport } from '../base-provider-transport'
|
|
3
3
|
import { logger, base64EncodeObject } from '@0xsequence/utils'
|
|
4
|
-
import { isBrowserExtension } from '../../utils'
|
|
4
|
+
import { isBrowserExtension, isUnityPlugin } from '../../utils'
|
|
5
5
|
|
|
6
6
|
// ..
|
|
7
7
|
let registeredWindowMessageProvider: WindowMessageProvider | undefined
|
|
@@ -92,7 +92,7 @@ export class WindowMessageProvider extends BaseProviderTransport {
|
|
|
92
92
|
|
|
93
93
|
// skip setting origin host if we're in an browser extension execution context
|
|
94
94
|
// allow origin that is passed in
|
|
95
|
-
if (!isBrowserExtension()) {
|
|
95
|
+
if (!isBrowserExtension() && !isUnityPlugin()) {
|
|
96
96
|
intent.options.origin = window.location.origin
|
|
97
97
|
}
|
|
98
98
|
}
|
package/src/utils.ts
CHANGED
|
@@ -86,6 +86,8 @@ export const recoverWalletConfig = async (
|
|
|
86
86
|
export const isBrowserExtension = (): boolean =>
|
|
87
87
|
window.location.protocol === 'chrome-extension:' || window.location.protocol === 'moz-extension:'
|
|
88
88
|
|
|
89
|
+
export const isUnityPlugin = (): boolean => !!navigator.userAgent.match(/UnitySequence/i)
|
|
90
|
+
|
|
89
91
|
/**
|
|
90
92
|
* Returns the status of a signer's wallet on given chain by checking wallet deployment and config status
|
|
91
93
|
*
|