Skip to main content

AddAssetSellOffer

AddAssetSellOffer is used to add a sell offer for a specific asset. If a sell offer already exists for the asset, it will be updated.

Source: rfqrpc/rfq.proto

gRPC

rpc AddAssetSellOffer (AddAssetSellOfferRequest) returns (AddAssetSellOfferResponse);

REST

HTTP MethodPath
POST /v1/taproot-assets/rfq/selloffer/asset-id/{asset_specifier.asset_id_str}

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('rfqrpc/rfq.proto', loaderOptions);
const rfqrpc = grpc.loadPackageDefinition(packageDefinition).rfqrpc;
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 rfqrpc.Rfq(GRPC_HOST, creds);
let request = {
asset_specifier: <AssetSpecifier>,
max_units: <uint64>,
};
client.addAssetSellOffer(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// }

Messages

rfqrpc.AddAssetSellOfferRequest

Source: rfqrpc/rfq.proto

FieldgRPC TypeREST TypeREST Placement
asset_specifier
AssetSpecifierobjectmixed
max_units
uint64stringbody

rfqrpc.AddAssetSellOfferResponse

Source: rfqrpc/rfq.proto

note

This response has no parameters.

Nested Messages

rfqrpc.AssetSpecifier

FieldgRPC TypeREST Type
asset_id
bytesstring
asset_id_str
stringstring
group_key
bytesstring
group_key_str
stringstring