Skip to content

Commit 0f70ff3

Browse files
authored
Merge pull request #531 from LIT-Protocol/feature/lit-3596-lit-protocolcontracts-sdk-using-chronicle-instead-of-vesuvius-fix
fix: wrong rpc in pkp ethers
2 parents c1bb847 + e2abe90 commit 0f70ff3

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

packages/pkp-ethers/src/lib/pkp-ethers.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,21 @@ export class PKPEthersWallet
8383
constructor(prop: PKPEthersWalletProp) {
8484
this.pkpBase = PKPBase.createInstance(prop);
8585

86-
this.rpcProvider = new ethers.providers.JsonRpcProvider(
87-
prop.rpc ?? LIT_CHAINS['chronicleTestnet'].rpcUrls[0]
88-
);
86+
/**
87+
* @depreacted This is a quick patch for 6.1.1 - Proper fix is handled in this PR
88+
* https://github.com/LIT-Protocol/js-sdk/pull/523
89+
*/
90+
const rpcUrl =
91+
prop.rpc ||
92+
(prop.litNodeClient.config.litNetwork === 'datil-dev'
93+
? LIT_CHAINS['chronicleTestnet'].rpcUrls[0]
94+
: LIT_CHAINS['datilDevnet'].rpcUrls[0]);
95+
96+
if (!rpcUrl) {
97+
throw new Error('rpcUrl is required');
98+
}
8999

100+
this.rpcProvider = new ethers.providers.JsonRpcProvider(rpcUrl);
90101
this.provider = prop.provider ?? this.rpcProvider;
91102

92103
defineReadOnly(this, '_isSigner', true);

0 commit comments

Comments
 (0)