diff --git a/src/connectors/argentMobile/index.ts b/src/connectors/argentMobile/index.ts index bc9512b..05641f9 100644 --- a/src/connectors/argentMobile/index.ts +++ b/src/connectors/argentMobile/index.ts @@ -2,7 +2,7 @@ import type { AccountChangeEventHandler, StarknetWindowObject, } from "get-starknet-core" -import type { AccountInterface } from "starknet" +import type { AccountInterface, ProviderInterface } from "starknet" import { constants } from "starknet" import { DEFAULT_ARGENT_MOBILE_ICON, DEFAULT_PROJECT_ID } from "./constants" import { @@ -26,6 +26,7 @@ export interface ArgentMobileConnectorOptions { description?: string url?: string icons?: string[] + provider?: ProviderInterface } export class ArgentMobileConnector extends Connector { @@ -153,6 +154,10 @@ export class ArgentMobileConnector extends Connector { description, url, icons, + rpcUrl: + chainId === constants.NetworkName.SN_MAIN + ? "https://cloud.argent-api.com/v1/starknet/goerli/rpc/v0.5" + : "https://api.hydrogen.argent47.net/v1/starknet/goerli/rpc/v0.5", } if (projectId === DEFAULT_PROJECT_ID) { @@ -171,6 +176,14 @@ export class ArgentMobileConnector extends Connector { } const _wallet = await getStarknetWindowObject(options) + + const { provider } = this._options + if (provider) { + Object.assign(_wallet, { + provider, + }) + } + console.log(_wallet.provider) this._wallet = _wallet // wallet connect rpc enable diff --git a/src/connectors/argentMobile/modal/starknet/adapter.ts b/src/connectors/argentMobile/modal/starknet/adapter.ts index 8c4152a..eabd13d 100644 --- a/src/connectors/argentMobile/modal/starknet/adapter.ts +++ b/src/connectors/argentMobile/modal/starknet/adapter.ts @@ -11,7 +11,7 @@ import type { ProviderInterface, SignerInterface, } from "starknet" -import { Provider, constants } from "starknet" +import { RpcProvider, constants } from "starknet" import type { NamespaceAdapterOptions } from "../adapter" import { NamespaceAdapter } from "../adapter" @@ -84,12 +84,7 @@ export class StarknetAdapter this.remoteSigner = new StarknetRemoteSigner(this.walletRpc) - if (rpcUrl) { - this.provider = new Provider({ rpc: { nodeUrl: rpcUrl } }) - } else { - const network = this.getNetworkName(this.chainId) - this.provider = new Provider({ sequencer: { network } }) - } + this.provider = new RpcProvider({ nodeUrl: rpcUrl }) this.account = new StarknetRemoteAccount( this.provider, "", diff --git a/src/helpers/defaultConnectors.ts b/src/helpers/defaultConnectors.ts index acda731..14b6659 100644 --- a/src/helpers/defaultConnectors.ts +++ b/src/helpers/defaultConnectors.ts @@ -29,8 +29,12 @@ export const defaultConnectors = ({ ) } - defaultConnectors.push(new ArgentMobileConnector(argentMobileOptions)) - defaultConnectors.push(new WebWalletConnector({ url: webWalletUrl })) + defaultConnectors.push( + new ArgentMobileConnector({ ...argentMobileOptions, provider }), + ) + defaultConnectors.push( + new WebWalletConnector({ url: webWalletUrl, provider }), + ) return defaultConnectors }