diff --git a/common/changes/@cityofzion/wallet-connect-sdk-wallet-core/CU-86drptvzx_2024-07-25-17-10.json b/common/changes/@cityofzion/wallet-connect-sdk-wallet-core/CU-86drptvzx_2024-07-25-17-10.json new file mode 100644 index 0000000..3520e7a --- /dev/null +++ b/common/changes/@cityofzion/wallet-connect-sdk-wallet-core/CU-86drptvzx_2024-07-25-17-10.json @@ -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" +} \ No newline at end of file diff --git a/packages/wallet-connect-sdk-wallet-core/src/adapters/AbstractWalletConnectEIP155Adapter.ts b/packages/wallet-connect-sdk-wallet-core/src/adapters/AbstractWalletConnectEIP155Adapter.ts index e5247a8..f4d414b 100644 --- a/packages/wallet-connect-sdk-wallet-core/src/adapters/AbstractWalletConnectEIP155Adapter.ts +++ b/packages/wallet-connect-sdk-wallet-core/src/adapters/AbstractWalletConnectEIP155Adapter.ts @@ -98,6 +98,41 @@ export abstract class AbstractWalletConnectEIP155Adapter { return hash } + async eth_call(args: TAdapterMethodParam): Promise { + 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 { + const { wallet } = await this.getServices(args) + return [await wallet.getAddress()] + } + + async eth_sendRawTransaction(args: TAdapterMethodParam): Promise { + 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 { + throw new Error('It is impossible to switch the Ethereum chain') + } + + wallet_getPermissions(): Promise { + throw new Error('It is impossible to get the permissions') + } + + wallet_requestPermissions(): Promise { + throw new Error('It is impossible to request the permissions') + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars async getCustomSigner(args: TAdapterMethodParam): Promise { return undefined