liusong1111 / synapse-extension

MIT License
0 stars 0 forks source link

[api style] prefer JSON RPC #8

Open liusong1111 opened 4 years ago

liusong1111 commented 4 years ago

https://www.jsonrpc.org/specification

use JSON RPC to uniform api calls

https://github.com/rebase-network/synapse-extension/blob/af0985a81b5a6d578b3605bb459b4487283ffab4/src/utils/apis.ts#L91

    if (result.errCode !== 0) {
      console.log(/result error/, JSON.stringify(result));
      return result;
    }
    return result.data;

https://github.com/rebase-network/synapse-extension/blob/49abe23a48ef9469d6d7228c8662fd6a6e7214d1/src/background/messageHandlers/index.ts#L31

      const messageHandled = _.has(message, 'success');
      if (messageHandled) return;