Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
b9fc65ec
Unverified
Commit
b9fc65ec
authored
Sep 21, 2023
by
Zach Pomerantz
Committed by
GitHub
Sep 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: lazy-load safe only if iframed (#7360)
parent
d73c368e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
@web3-react+gnosis-safe+8.2.3.patch
patches/@web3-react+gnosis-safe+8.2.3.patch
+15
-0
eagerlyConnect.ts
src/connection/eagerlyConnect.ts
+7
-1
No files found.
patches/@web3-react+gnosis-safe+8.2.3.patch
0 → 100644
View file @
b9fc65ec
diff --git a/node_modules/@web3-react/gnosis-safe/dist/index.js b/node_modules/@web3-react/gnosis-safe/dist/index.js
index 015a33c..4cd7cde 100644
--- a/node_modules/@web3-react/gnosis-safe/dist/index.js
+++ b/node_modules/@web3-react/gnosis-safe/dist/index.js
@@ -68,8 +68,8 @@
class GnosisSafe extends types_1.Connector {
if (this.eagerConnection)
return;
// kick off import early to minimize waterfalls
- const SafeAppProviderPromise = Promise.resolve().then(() => __importStar(require('@safe-global/safe-apps-provider'))).then(({ SafeAppProvider }) => SafeAppProvider);
- yield (this.eagerConnection = Promise.resolve().then(() => __importStar(require('@safe-global/safe-apps-sdk'))).then((m) => __awaiter(this, void 0, void 0, function* () {
+ const SafeAppProviderPromise = Promise.resolve().then(async () => __importStar(await import('@safe-global/safe-apps-provider'))).then(({ SafeAppProvider }) => SafeAppProvider);
+ yield (this.eagerConnection = Promise.resolve().then(async () => __importStar(await import('@safe-global/safe-apps-sdk'))).then((m) => __awaiter(this, void 0, void 0, function* () {
this.sdk = new m.default(this.options);
const safe = yield Promise.race([
this.sdk.safe.getInfo(),
src/connection/eagerlyConnect.ts
View file @
b9fc65ec
...
@@ -20,8 +20,14 @@ async function connect(connector: Connector, type: ConnectionType) {
...
@@ -20,8 +20,14 @@ async function connect(connector: Connector, type: ConnectionType) {
}
}
}
}
connect
(
gnosisSafeConnection
.
connector
,
ConnectionType
.
GNOSIS_SAFE
)
// The Safe connector will only work from safe.global, which iframes;
// it is only necessary to try (and to load all the deps) if we are in an iframe.
if
(
window
!==
window
.
parent
)
{
connect
(
gnosisSafeConnection
.
connector
,
ConnectionType
.
GNOSIS_SAFE
)
}
connect
(
networkConnection
.
connector
,
ConnectionType
.
NETWORK
)
connect
(
networkConnection
.
connector
,
ConnectionType
.
NETWORK
)
const
selectedWallet
=
toConnectionType
(
localStorage
.
getItem
(
selectedWalletKey
)
??
undefined
)
const
selectedWallet
=
toConnectionType
(
localStorage
.
getItem
(
selectedWalletKey
)
??
undefined
)
if
(
selectedWallet
)
{
if
(
selectedWallet
)
{
const
selectedConnection
=
getConnection
(
selectedWallet
)
const
selectedConnection
=
getConnection
(
selectedWallet
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment