diff --git a/wallets/provider-clover/package.json b/wallets/provider-clover/package.json index b3114dcd5..b8d1ccb45 100644 --- a/wallets/provider-clover/package.json +++ b/wallets/provider-clover/package.json @@ -27,7 +27,10 @@ "bs58": "^5.0.0", "rango-types": "^0.1.74" }, + "peerDependencies": { + "@solana/web3.js": "^1.94.0" + }, "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/wallets/provider-clover/src/signer.ts b/wallets/provider-clover/src/signer.ts index 6cd776039..107c5c555 100644 --- a/wallets/provider-clover/src/signer.ts +++ b/wallets/provider-clover/src/signer.ts @@ -1,6 +1,7 @@ import type { SignerFactory } from 'rango-types'; import { getNetworkInstance, Networks } from '@rango-dev/wallets-shared'; +import { PublicKey } from '@solana/web3.js'; import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types'; import { CustomSolanaSigner } from './solana-signer.js'; @@ -9,10 +10,25 @@ export default async function getSigners( provider: any ): Promise { const ethProvider = getNetworkInstance(provider, Networks.ETHEREUM); + // const solProvider = getNetworkInstance(provider, Networks.SOLANA); + const solAccountAddress = await solProvider.getAccount(); + const proxiedSolProvider = new Proxy(solProvider, { + get(target, prop, rec) { + if (prop === 'publicKey') { + return new PublicKey(solAccountAddress); + } + + return Reflect.get(target, prop, rec); + }, + }); + const signers = new DefaultSignerFactory(); const { DefaultEvmSigner } = await import('@rango-dev/signer-evm'); signers.registerSigner(TxType.EVM, new DefaultEvmSigner(ethProvider)); - signers.registerSigner(TxType.SOLANA, new CustomSolanaSigner(solProvider)); + signers.registerSigner( + TxType.SOLANA, + new CustomSolanaSigner(proxiedSolProvider) + ); return signers; }