Skip to content

Commit

Permalink
fix: Prevent window.keplr override by setting configurable: false
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryz0nd committed Feb 28, 2025
1 parent 4a836ad commit d05d1ff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/provider/src/inject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function defineUnwritablePropertyIfPossible(o: any, p: string, value: any) {
Object.defineProperty(o, p, {
value,
writable: false,
configurable: false,
});
} else {
o[p] = value;
Expand Down Expand Up @@ -532,6 +533,7 @@ export class InjectedKeplr implements IKeplr, KeplrCoreTypes {
Object.defineProperty(this, fieldName, {
value: (this as any)[fieldName],
writable: false,
configurable: false,
});
}

Expand All @@ -542,6 +544,7 @@ export class InjectedKeplr implements IKeplr, KeplrCoreTypes {
Object.defineProperty(this.eventListener, fieldName, {
value: (this.eventListener as any)[fieldName],
writable: false,
configurable: false,
});
}
}
Expand All @@ -556,6 +559,7 @@ export class InjectedKeplr implements IKeplr, KeplrCoreTypes {
Object.defineProperty(this, methodName, {
value: (this as any)[methodName].bind(this),
writable: false,
configurable: false,
});
}
}
Expand Down

0 comments on commit d05d1ff

Please sign in to comment.