Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions packages/wallet/dapp-client/src/ChainSessionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -781,19 +781,6 @@ export class ChainSessionManager {
}
}

/**
* Fetches fee tokens for a chain.
* @returns {GetFeeTokensResponse}
* @throws {FeeOptionError} If fetching fee tokens fails.
*/
async getFeeTokens(): Promise<GetFeeTokensResponse> {
try {
return await this.relayer.feeTokens()
} catch (err) {
throw new FeeOptionError(`Failed to get fee tokens: ${err instanceof Error ? err.message : String(err)}`)
}
}

/**
* Builds, signs, and sends a batch of transactions.
* @param transactions The transactions to be sent.
Expand Down
12 changes: 7 additions & 5 deletions packages/wallet/dapp-client/src/DappClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
} from './types/index.js'
import { TypedData } from 'ox/TypedData'
import { KEYMACHINE_URL, NODES_URL, RELAYER_URL } from './utils/constants.js'
import { getRelayerUrl, getRpcUrl } from './utils/index.js'

export type DappClientEventListener = (data?: any) => void

Expand Down Expand Up @@ -568,11 +569,12 @@ export class DappClient {
* @throws If the fee tokens cannot be fetched. {@link InitializationError}
*/
async getFeeTokens(chainId: number): Promise<GetFeeTokensResponse> {
if (!this.isInitialized) throw new InitializationError('Not initialized')
const chainSessionManager = this.getChainSessionManager(chainId)
if (!chainSessionManager.isInitialized)
throw new InitializationError(`ChainSessionManager for chain ${chainId} is not initialized.`)
return await chainSessionManager.getFeeTokens()
const relayer = new Relayer.Standard.Rpc.RpcRelayer(
getRelayerUrl(chainId, this.relayerUrl),
chainId,
getRpcUrl(chainId, this.nodesUrl, this.projectAccessKey),
)
return await relayer.feeTokens()
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/wallet/dapp-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type {
SendWalletTransactionPayload,
SendWalletTransactionResponse,
WalletActionResponse,
GetFeeTokensResponse,
} from './types/index.js'
export { RequestActionType, TransportMode } from './types/index.js'
export {
Expand Down