soroswap / soroswap-router-sdk

Library used on Frontend to compute the best route for a trade
https://soroswap-router-sdk.soroswap.finance/
GNU General Public License v3.0
2 stars 0 forks source link

Type error: SorobanContextType incompatible type. #21

Open MattPoblete opened 1 month ago

MattPoblete commented 1 month ago

The props:

  connectors: Connector[]
  setActiveConnectorAndConnect?: (connector: Connector) => void
  server?: SorobanRpc.Server
  serverHorizon?: StellarSdk.Horizon.Server

of SorobanContextType in utils/contractInvoke/types.ts:60 are incompatibles with the SorobanContextType provided by @soroban-react/core

chopan123 commented 1 month ago

@abstract829

abstract829 commented 1 month ago

Should change in the connect type

export type Connector = {
    id: string
    name: string
    shortName?: string
    iconUrl: string | (() => Promise<string>)
    iconBackground: string
    installed?: boolean
    downloadUrls?: {
      android?: string
      ios?: string
      browserExtension?: string
      qrCode?: string
    }
    isConnected: () => boolean // should return Promise<boolean>
    getNetworkDetails: () => Promise<NetworkDetails>
    getPublicKey: () => Promise<string>
    signTransaction: (
      xdr: string,
      opts?: {
        network?: string
        networkPassphrase?: string
        accountToSign?: string
      }
    ) => Promise<string>
}

but the correct way to avoid this type errors happen again in the future should be to move the SorobanContextType from @soroban-react/contracts to @soroban-react/types so we could use the package here instead of clone the types