Skip to content

Commit

Permalink
fix: createStrategy types
Browse files Browse the repository at this point in the history
  • Loading branch information
billyjacoby committed Oct 7, 2024
1 parent cacaae7 commit 41b773a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 0 additions & 1 deletion etc/replacements.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const isESM = process.env.BUILD_MODE.includes('esm')

const REPLACEMENT_PAIRS = [
{
// path: './src/strategies/wallet-strategy/strategies/Ledger/Base.ts',
path: './src/strategies/Ledger/Base.ts',
cjs: '@ledgerhq/hw-app-eth/lib/services/ledger',
esm: '@ledgerhq/hw-app-eth/lib-es/services/ledger',
Expand Down
9 changes: 8 additions & 1 deletion packages/wallet-ts/src/strategies/types/strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,20 @@ export interface WalletStrategyOptions {
metadata?: Record<string, string | Record<string, string>>
}

export type CreateWalletStrategyArguments = Omit<
WalletStrategyArguments,
'walletStrategies'
>

export interface CosmosWalletStrategyArguments {
chainId: CosmosChainId
wallet?: Wallet

walletStrategies: {
wallet: Wallet
createStrategy: () => ConcreteWalletStrategy
createStrategy: (
args: CreateWalletStrategyArguments,
) => ConcreteWalletStrategy
}[]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const createEnabledStrategies = (
return args.walletStrategies.reduce(
(strategies, wallet) => ({
...strategies,
[wallet.wallet]: wallet.createStrategy(),
[wallet.wallet]: wallet.createStrategy(args),
}),
{} as Record<Wallet, ConcreteWalletStrategy | undefined>,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { TxRaw, toUtf8, TxGrpcApi, TxResponse } from '@injectivelabs/sdk-ts'
import {
ConcreteWalletStrategy,
EthereumWalletStrategyArgs,
CreateWalletStrategyArguments,
} from '@injectivelabs/wallet-ts'
import {
BrowserEip1993Provider,
Expand All @@ -30,7 +31,9 @@ export class Metamask
extends BaseConcreteStrategy
implements ConcreteWalletStrategy
{
constructor(args: EthereumWalletStrategyArgs) {
constructor(
args: CreateWalletStrategyArguments | EthereumWalletStrategyArgs,
) {
super(args)
}

Expand Down

0 comments on commit 41b773a

Please sign in to comment.