Skip to content

Commit

Permalink
CU-86drptvzx - WC - GhostMarket via WC asks for ethereum methods we d…
Browse files Browse the repository at this point in the history
…ont support. Implement them
  • Loading branch information
lopescode committed Jul 25, 2024
1 parent f6bf387 commit 2335ff8
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/wallet-connect-sdk-wallet-core",
"comment": "adding eth methods",
"type": "patch"
}
],
"packageName": "@cityofzion/wallet-connect-sdk-wallet-core"
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,41 @@ export abstract class AbstractWalletConnectEIP155Adapter {
return hash
}

async eth_call(args: TAdapterMethodParam): Promise<string> {
const param = this.resolveParams(args.request.params.request.params[0])

const { wallet, provider } = await this.getServices(args)
const connectedWallet = wallet.connect(provider)

return await connectedWallet.call(param)
}

async eth_requestAccounts(args: TAdapterMethodParam): Promise<string[]> {
const { wallet } = await this.getServices(args)
return [await wallet.getAddress()]
}

async eth_sendRawTransaction(args: TAdapterMethodParam): Promise<string> {
const { provider } = await this.getServices(args)

const { hash } = await provider.sendTransaction(args.request.params.request.params[0])

return hash
}

// TODO: It'll be implemented in this issue: #86du71hh4 WC - Ghostmarket via WC asks for wallet methods we don't support
wallet_switchEthereumChain(): Promise<boolean> {
throw new Error('It is impossible to switch the Ethereum chain')
}

wallet_getPermissions(): Promise<string[]> {
throw new Error('It is impossible to get the permissions')
}

wallet_requestPermissions(): Promise<string[]> {
throw new Error('It is impossible to request the permissions')
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async getCustomSigner(args: TAdapterMethodParam): Promise<TCustomSigner | undefined> {
return undefined
Expand Down

0 comments on commit 2335ff8

Please sign in to comment.