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

add a 'BchdGrpcNetworkProvider' #252

Open
mr-zwets opened this issue Dec 20, 2024 · 0 comments
Open

add a 'BchdGrpcNetworkProvider' #252

mr-zwets opened this issue Dec 20, 2024 · 0 comments
Labels
javascript-sdk Relates to the CashScript JavaScript SDK

Comments

@mr-zwets
Copy link
Member

We might also want to add a BchdGrpcNetworkProvider

I experimented with the BCHD grpc years ago, i used the library @improbable-eng/grpc-web back then but now grpc-web seems to be the standard. I simply copy/pasted the bchrpc folder from bchd-block-explorer back then.

There's old documentation in the BCHD repo, but it's probably out-of-date: https://github.com/gcash/bchd/tree/master/bchrpc/documentation/client-usage-examples/nodejs-grpc

I used

import * as pb from "./bchrpc/bchrpc_pb_service";
import { GetAddressTransactionsRequest } from "./bchrpc/bchrpc_pb";

const client = new pb.bchrpcClient("https://ryzen.electroncash.de:8335");

and then something like

let getAddressTransactionsRequest = new GetAddressTransactionsRequest();
getAddressTransactionsRequest.setAddress(address);

console.log("getAddressTransactions");

const cancel = client.getAddressTransactions(getAddressTransactionsRequest, headers, function (error, response) {
    if (error) {
        // todo: show error modal
        console.log("error getAddressTransactions:", error.code, error.message);
    } else {
        console.log("getAddressTransactions");
        let message = new GetAddressTransactionsResponse();
        message = response;
    }
});
@mr-zwets mr-zwets added the javascript-sdk Relates to the CashScript JavaScript SDK label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript-sdk Relates to the CashScript JavaScript SDK
Projects
None yet
Development

No branches or pull requests

1 participant