Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i don`t know Error(throwable=java.lang.Throwable: Batch subscribe error: Connectivity error, please check your Internet connection and try again) #13

Closed
jihongzzang opened this issue Sep 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jihongzzang
Copy link

jihongzzang commented Sep 25, 2024

Describe the bug
why network error and i don`t know this issue

SDK Version

  • Client: [e.g. Kotlin]
  • Version [e.g. 22]

To Reproduce
Steps to reproduce the behavior:

  1. modal Open
  2. metamask button click
  3. connecting....
  4. stuck

Expected behavior
metamask app open, and sign

Device (please complete the following information):

  • Device: [e.g. Pixel]
  • OS: [e.g. Android 12]
  • Browser [e.g. stock browser, chrome]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

- GlobalApplication.kt
 val appMetaData = Core.Model.AppMetaData(
            name = "Fablo-Dev",
            description = "Fablo Dev",
            url = BuildConfig.APPLICATION_ID,
            icons = listOf("https://gblobscdn.gitbook.com/spaces%2F-LJJeCjcLrr53DcT1Ml7%2Favatar.png?alt=media"),
            redirect = "${getString(R.string.scheme_title)}://${getString(R.string.scheme_host_home)}"
        )

        CoreClient.initialize(
            application = this,
            projectId = BuildConfig.WALLET_CONNECT_PROJECT_ID,
            metaData = appMetaData,
        ) {
            Log.d("reown관련", "초기화 성공")
        }


        val recommendedWalletsIds = listOf<String>(
            "1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",
            "4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0"
        )
//
        val excludedWalletIds = listOf<String>(
//            "c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",
        )

        val initParams =
            Modal.Params.Init(
                core = CoreClient,
                recommendedWalletsIds = recommendedWalletsIds,
                excludedWalletIds = excludedWalletIds
            )

        AppKit.initialize(
            init = initParams,
            onSuccess = {
                Log.d("reown관련", "초기화 성공")
                AppKit.setDelegate(DappDelegate)
            },
            onError = { error ->
                Log.d("reown관련", error.toString())
            }
        )

        Log.d("size", AppKitChainsPresets.ethChains.values.toList().size.toString())

        AppKit.setChains(AppKitChainsPresets.ethChains.values.toList())

- AppkitDelegate.kt
object DappDelegate : AppKit.ModalDelegate, CoreClient.CoreDelegate {
    private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
    private val _wcEventModels: MutableSharedFlow<Modal.Model?> = MutableSharedFlow()
    val wcEventModels: SharedFlow<Modal.Model?> = _wcEventModels.asSharedFlow()
    private val _coreEvents: MutableSharedFlow<Core.Model> = MutableSharedFlow()
    val coreEvents: SharedFlow<Core.Model> = _coreEvents.asSharedFlow()
    private val _connectionState: MutableSharedFlow<Modal.Model.ConnectionState> =
        MutableSharedFlow(replay = 1)
    val connectionState: SharedFlow<Modal.Model.ConnectionState> = _connectionState.asSharedFlow()

    var selectedSessionTopic: String? = null
        private set

    init {
        AppKit.setDelegate(this)
        CoreClient.setDelegate(this)
        Log.d("reown관련", "위임성공")
    }

    override fun onConnectionStateChange(state: Modal.Model.ConnectionState) {
        Log.d("reown관련", state.toString())
        scope.launch {
            _connectionState.emit(state)
        }
    }

    override fun onSessionApproved(approvedSession: Modal.Model.ApprovedSession) {
        Log.d("reown관련", "2")
        selectedSessionTopic =
            (approvedSession as Modal.Model.ApprovedSession.WalletConnectSession).topic

        scope.launch {
            _wcEventModels.emit(approvedSession)
        }
    }

    override fun onSessionRejected(rejectedSession: Modal.Model.RejectedSession) {
        Log.d("reown관련", "3")
        scope.launch {
            _wcEventModels.emit(rejectedSession)
        }
    }

    override fun onSessionUpdate(updatedSession: Modal.Model.UpdatedSession) {
        Log.d("reown관련", "4")
        scope.launch {
            _wcEventModels.emit(updatedSession)
        }
    }

    override fun onSessionEvent(sessionEvent: Modal.Model.SessionEvent) {
        Log.d("reown관련", "5")
        scope.launch {
            _wcEventModels.emit(sessionEvent)
        }
    }

    override fun onSessionEvent(sessionEvent: Modal.Model.Event) {
        Log.d("reown관련", "6")
        scope.launch {
            _wcEventModels.emit(sessionEvent)
        }
    }

    override fun onSessionDelete(deletedSession: Modal.Model.DeletedSession) {
        Log.d("reown관련", "6")
        deselectAccountDetails()

        scope.launch {
            _wcEventModels.emit(deletedSession)
        }
    }

    override fun onSessionExtend(session: Modal.Model.Session) {
        Log.d("reown관련", "7")
        scope.launch {
            _wcEventModels.emit(session)
        }
    }

    override fun onSessionRequestResponse(response: Modal.Model.SessionRequestResponse) {
        Log.d("reown관련", "8")
        scope.launch {
            _wcEventModels.emit(response)
        }
    }

    override fun onSessionAuthenticateResponse(sessionUpdateResponse: Modal.Model.SessionAuthenticateResponse) {
        Log.d("reown관련", "9")
        if (sessionUpdateResponse is Modal.Model.SessionAuthenticateResponse.Result) {
            selectedSessionTopic = sessionUpdateResponse.session?.topic
        }
        scope.launch {
            _wcEventModels.emit(sessionUpdateResponse)
        }
    }

    override fun onProposalExpired(proposal: Modal.Model.ExpiredProposal) {
        Log.d("reown관련", "10")
        scope.launch {
            _wcEventModels.emit(proposal)
        }
    }

    override fun onRequestExpired(request: Modal.Model.ExpiredRequest) {
        Log.d("reown관련", "11")
        scope.launch {
            _wcEventModels.emit(request)
        }
    }

    fun deselectAccountDetails() {
        Log.d("reown관련", "12")
        selectedSessionTopic = null
    }

    override fun onError(error: Modal.Model.Error) {
        Log.d("reown관련", error.toString())
        scope.launch {
            _wcEventModels.emit(error)
        }
    }

    override fun onPairingDelete(deletedPairing: Core.Model.DeletedPairing) {
        Log.d("reown관련", "14")
        //Deprecated - pairings are automatically deleted
    }

    override fun onPairingExpired(expiredPairing: Core.Model.ExpiredPairing) {
        Log.d("reown관련", "15")
        //Deprecated - pairings are automatically expired
    }

    override fun onPairingState(pairingState: Core.Model.PairingState) {
        Log.d("reown관련", "16 ${pairingState.isPairingState}")
        Timber.d("hello", "Dapp pairing state: ${pairingState.isPairingState}")
    }
}```
@jihongzzang jihongzzang added the bug Something isn't working label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant