Skip to content

Commit

Permalink
fix: update deps; add mainnet to abstract chains (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
coffeexcoin authored Feb 7, 2025
1 parent 2a72470 commit 838858a
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
}
},
"dependencies": {
"@abstract-foundation/agw-client": "^1.1.1"
"@abstract-foundation/agw-client": "^1.4.0"
},
"peerDependencies": {
"@privy-io/cross-app-connect": "^0.1.4",
"@privy-io/cross-app-connect": "^0.1.5",
"@dynamic-labs/ethereum-core": "^4.0.0-alpha.35",
"@dynamic-labs/ethereum": "^4.0.0-alpha.35",
"@dynamic-labs/utils": "^4.0.0-alpha.35",
"@dynamic-labs/wallet-connector-core": "^4.0.0-alpha.35",
"viem": "^2.21.29"
"viem": "^2.22.17"
},
"devDependencies": {
"@dynamic-labs/utils": "^4.0.0-alpha.35"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type EthereumWalletConnectorOpts } from '@dynamic-labs/ethereum-core';
import { EthereumInjectedConnector, type IEthereum } from '@dynamic-labs/ethereum';
import { toPrivyWalletProvider } from '@privy-io/cross-app-connect'
import { transformEIP1193Provider } from '@abstract-foundation/agw-client';
import { abstractTestnet } from 'viem/chains';
import { abstractTestnet, abstract } from 'viem/chains';
import { DynamicError } from '@dynamic-labs/utils';
import { logger } from '@dynamic-labs/wallet-connector-core';
import { toHex, type Chain as ViemChain } from 'viem';
Expand Down Expand Up @@ -39,10 +39,9 @@ export class AbstractEvmWalletConnector extends EthereumInjectedConnector {
if (network.chainId === abstractTestnet.id) {
this.abstractNetworks.push(abstractTestnet);
}
// TODO: add mainnet once viem definition is added
// if (network.chainId === abstract.id) {
// this.abstractNetworks.push(abstract);
// }
if (network.chainId === abstract.id) {
this.abstractNetworks.push(abstract);
}
}
}

Expand Down Expand Up @@ -87,6 +86,11 @@ export class AbstractEvmWalletConnector extends EthereumInjectedConnector {
// chain = abstract; // TODO: default to the abstract mainnet once viem definition is added
chain = abstractTestnet;
}
// @ts-expect-error Chain is never undefined here; it is checked in the above if statement
} else if (!this.abstractNetworks.some(n => n.id === chain.id)) {
// use the first configured abstract network from the connector options
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
chain = this.abstractNetworks[0]!;
}

const privyProvider = toPrivyWalletProvider({
Expand Down
Loading

0 comments on commit 838858a

Please sign in to comment.