daqing/moon-pay-sdk/cmd/wxlogin does not have a README file

    Automation

    pub suberror Automation {
    Launch(String)
    Connect(String)
    Protocol(String)
    Timeout(String)
    }

    The single error kind of the automation layer.
    impl Show for Automation

    Automator

    pub struct Automator {
    ws :
    Conn

    seq : Int
    }

    Automation of WeChat DevTools over the miniprogram-automator wire protocol. This speaks the same WebSocket JSON as the official npm package: requests are {id, method, params}, answers are {id, result} or {id, error: {message}}; unsolicited events carry a method but no id.

    Calls are strictly one-in-flight: send writes a request, then drains frames until the answer with the matching id shows up, dropping any events along the way. That mirrors how this SDK uses the protocol (probe, then one wx.login) and keeps the plumbing synchronous.

    Automator::call_wx_method

    async fn Automator::call_wx_method(self : Automator, api : String) -> Json

    App.callWxMethod — invoke one wx.* API inside the running mini program and return the method's own result object.

    Automator::close

    async fn Automator::close(self : Automator) -> Unit

    Close the socket; DevTools and its project window stay open.

    Automator::connect

    async fn Automator::connect(endpoint : String) -> Automator

    Connect to a DevTools automation endpoint (ws://127.0.0.1:9420).

    Automator::get_info

    async fn Automator::get_info(self : Automator) -> Json

    Tool.getInfo — base info about the connected DevTools session; used as a liveness probe before the real call.

    Automator::send

    async fn Automator::send(self : Automator, api~ : String, params? : Json) -> Json

    Send one protocol request and await its answer. Frames that carry no matching id (server-pushed events) are skipped.

    fetch_login_code

    async fn fetch_login_code(endpoint~ : String) -> String

    One-shot automation: connect, probe, call wx.login, return res.code. The whole flow is bounded by a 120s timeout.

    launch_devtools

    async fn launch_devtools(cli_path~ : String, project_path~ : String, port~ : Int, trust_project? : Bool) -> Unit

    Launch DevTools itself: <cli> auto --project <path> --auto-port <port>[--trust-project] — the exact argv miniprogram-automator's launcher sends. The cli output streams through with a [devtools cli] prefix; the call returns once the automation port answers a WebSocket probe.

    login_code_from

    fn login_code_from(result : Json) -> String raise

    Read res.code out of a wx.login result.