Skip to main content

SubscribeSendAssetEventNtfns

SubscribeSendAssetEventNtfns registers a subscription to the event notification stream which relates to the asset sending process.

Source: tapdevrpc/tapdev.proto

gRPC

info

This is a server-streaming RPC

rpc SubscribeSendAssetEventNtfns (SubscribeSendAssetEventNtfnsRequest) returns (stream SendAssetEvent);

Code Samples

const fs = require('fs');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const GRPC_HOST = 'localhost:10029'
const MACAROON_PATH = 'TAPROOT-ASSETS_DIR/regtest/taproot-assets.macaroon'
const TLS_PATH = 'TAPROOT-ASSETS_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync('tapdevrpc/tapdev.proto', loaderOptions);
const tapdevrpc = grpc.loadPackageDefinition(packageDefinition).tapdevrpc;
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';
const tlsCert = fs.readFileSync(TLS_PATH);
const sslCreds = grpc.credentials.createSsl(tlsCert);
const macaroon = fs.readFileSync(MACAROON_PATH).toString('hex');
const macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) {
let metadata = new grpc.Metadata();
metadata.add('macaroon', macaroon);
callback(null, metadata);
});
let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
let client = new tapdevrpc.TapDev(GRPC_HOST, creds);
let request = {};
let call = client.subscribeSendAssetEventNtfns(request);
call.on('data', function(response) {
// A response was received from the server.
console.log(response);
});
call.on('status', function(status) {
// The current status of the stream.
});
call.on('end', function() {
// The server has closed the stream.
});
// Console output:
// {
// "execute_send_state_event": <ExecuteSendStateEvent>,
// "proof_transfer_backoff_wait_event": <ProofTransferBackoffWaitEvent>,
// }

Messages

tapdevrpc.SubscribeSendAssetEventNtfnsRequest

Source: tapdevrpc/tapdev.proto

note

This request has no parameters.

tapdevrpc.SendAssetEvent

Source: tapdevrpc/tapdev.proto

FieldgRPC TypeREST Type
execute_send_state_event
ExecuteSendStateEventobject
proof_transfer_backoff_wait_event
ProofTransferBackoffWaitEventobject

Nested Messages

tapdevrpc.ExecuteSendStateEvent

FieldgRPC TypeREST Type
timestamp
int64string
send_state
stringstring

tapdevrpc.ProofTransferBackoffWaitEvent

FieldgRPC TypeREST Type
timestamp
int64string
backoff
int64string
tries_counter
int64string
transfer_type
ProofTransferTypestring

Enums

tapdevrpc.ProofTransferType

NameNumber
PROOF_TRANSFER_TYPE_SEND
0
PROOF_TRANSFER_TYPE_RECEIVE
1