mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-02-03 01:49:54 -05:00
switch api to use typescript auto-generated from protobuf using grpc-web (#11)
haveno daemon can get payment accounts and the user's created offers
This commit is contained in:
parent
bea11ab1f4
commit
f83fcb0d84
@ -22,4 +22,4 @@ This application is a basic [create-react-app](https://github.com/facebook/creat
|
||||
|
||||
1. Copy grpc.proto and pb.proto from Haveno's [protobuf definitions](https://github.com/haveno-dex/haveno/tree/master/proto/src/main/proto) to ./config.
|
||||
2. Install protobuf for your system, e.g. on mac: `brew install protobuf`
|
||||
2. `./bin/build_protobuf.sh`
|
||||
3. `./bin/build_protobuf.sh`
|
@ -1,8 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
// generate imports for haveno services and types using grpc-web
|
||||
cd ./config || exit 1
|
||||
protoc -I=./ *.proto --js_out=import_style=commonjs:./ --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./ || exit 1
|
||||
protoc -I=./ *.proto --js_out=import_style=commonjs,binary:./ --grpc-web_out=import_style=typescript,mode=grpcwebtext:./ || exit 1
|
||||
cd ../
|
||||
mv ./config/grpc_grpc_web_pb.js ./src || exit 1
|
||||
mv ./config/grpc_pb.js ./src || exit 1
|
||||
mv ./config/pb_pb.js ./src || exit 1
|
||||
|
||||
// move imports to src folder
|
||||
mv ./config/grpc_pb.d.ts ./src/protobuf || exit 1
|
||||
mv ./config/grpc_pb.js ./src/protobuf || exit 1
|
||||
mv ./config/pb_pb.d.ts ./src/protobuf || exit 1
|
||||
mv ./config/pb_pb.js ./src/protobuf || exit 1
|
||||
mv ./config/GrpcServiceClientPb.ts ./src/protobuf || exit 1
|
@ -116,10 +116,10 @@ message CreateOfferRequest {
|
||||
string price = 3;
|
||||
bool useMarketBasedPrice = 4;
|
||||
double marketPriceMargin = 5;
|
||||
uint64 amount = 6;
|
||||
uint64 minAmount = 7;
|
||||
uint64 amount = 6 [jstype = JS_STRING];
|
||||
uint64 minAmount = 7 [jstype = JS_STRING];
|
||||
double buyerSecurityDeposit = 8;
|
||||
uint64 triggerPrice = 9;
|
||||
uint64 triggerPrice = 9 [jstype = JS_STRING];
|
||||
string paymentAccountId = 10;
|
||||
string makerFeeCurrencyCode = 11;
|
||||
}
|
||||
@ -606,10 +606,10 @@ message BtcBalanceInfo {
|
||||
}
|
||||
|
||||
message XmrBalanceInfo {
|
||||
uint64 unlockedBalance = 1;
|
||||
uint64 lockedBalance = 2;
|
||||
uint64 reservedOfferBalance = 3;
|
||||
uint64 reservedTradeBalance = 4;
|
||||
uint64 unlockedBalance = 1 [jstype = JS_STRING];
|
||||
uint64 lockedBalance = 2 [jstype = JS_STRING];
|
||||
uint64 reservedOfferBalance = 3 [jstype = JS_STRING];
|
||||
uint64 reservedTradeBalance = 4 [jstype = JS_STRING];
|
||||
}
|
||||
|
||||
message AddressBalanceInfo {
|
||||
|
@ -2361,7 +2361,7 @@ message BlockChainExplorer {
|
||||
|
||||
message PaymentAccount {
|
||||
string id = 1;
|
||||
int64 creation_date = 2;
|
||||
int64 creation_date = 2 [jstype = JS_STRING];
|
||||
PaymentMethod payment_method = 3;
|
||||
string account_name = 4;
|
||||
repeated TradeCurrency trade_currencies = 5;
|
||||
@ -2371,8 +2371,8 @@ message PaymentAccount {
|
||||
|
||||
message PaymentMethod {
|
||||
string id = 1;
|
||||
int64 max_trade_period = 2;
|
||||
int64 max_trade_limit = 3;
|
||||
int64 max_trade_period = 2 [jstype = JS_STRING];
|
||||
int64 max_trade_limit = 3 [jstype = JS_STRING];
|
||||
}
|
||||
|
||||
// Currency
|
||||
|
@ -1,4 +1,6 @@
|
||||
import {HavenoDaemon, HavenoBalances, HavenoOffer} from "./HavenoDaemon";
|
||||
import {HavenoDaemon} from "./HavenoDaemon";
|
||||
import {XmrBalanceInfo, OfferInfo} from './protobuf/grpc_pb';
|
||||
import {PaymentAccount} from './protobuf/pb_pb';
|
||||
|
||||
const HAVENO_UI_VERSION = "1.6.2";
|
||||
const HAVENO_DAEMON_URL = "http://localhost:8080";
|
||||
@ -12,21 +14,40 @@ test("Can get the version", async () => {
|
||||
});
|
||||
|
||||
test("Can get the user's balances", async () => {
|
||||
let balances: HavenoBalances = await daemon.getBalances();
|
||||
expect(balances.unlockedBalance);
|
||||
expect(balances.lockedBalance);
|
||||
expect(balances.reservedOfferBalance);
|
||||
expect(balances.reservedTradeBalance);
|
||||
let balances: XmrBalanceInfo = await daemon.getBalances();
|
||||
expect(balances.getUnlockedbalance()); // TODO: correct camelcase in grpc
|
||||
expect(balances.getLockedbalance());
|
||||
expect(balances.getReservedofferbalance());
|
||||
expect(balances.getReservedtradebalance());
|
||||
});
|
||||
|
||||
test("Can get offers", async() => {
|
||||
let offers: HavenoOffer[] = await daemon.getOffers("SELL", "XMR");
|
||||
test("Can get offers", async () => {
|
||||
let offers: OfferInfo[] = await daemon.getOffers("BUY");
|
||||
for (let offer of offers) {
|
||||
testOffer(offer);
|
||||
}
|
||||
});
|
||||
|
||||
function testOffer(offer: HavenoOffer) {
|
||||
expect(offer.id).toHaveLength;
|
||||
test("Can get the user's created offers", async () => {
|
||||
let offers: OfferInfo[] = await daemon.getMyOffers("SELL");
|
||||
for (let offer of offers) {
|
||||
testOffer(offer);
|
||||
}
|
||||
});
|
||||
|
||||
test("Can get payment accounts", async () => {
|
||||
let paymentAccounts: PaymentAccount[] = await daemon.getPaymentAccounts();
|
||||
for (let paymentAccount of paymentAccounts) {
|
||||
testPaymentAccount(paymentAccount);
|
||||
}
|
||||
});
|
||||
|
||||
function testPaymentAccount(paymentAccount: PaymentAccount) {
|
||||
expect(paymentAccount.getId()).toHaveLength;
|
||||
// TODO: test rest of offer
|
||||
}
|
||||
|
||||
function testOffer(offer: OfferInfo) {
|
||||
expect(offer.getId()).toHaveLength;
|
||||
// TODO: test rest of offer
|
||||
}
|
@ -1,10 +1,7 @@
|
||||
/**
|
||||
* These imports are generated by protoc-gen-grpc-web (created with `sudo make install-plugin` in grpc-web) using the following command:
|
||||
*
|
||||
* `protoc -I=./ *.proto --js_out=import_style=commonjs:./ --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./`
|
||||
*/
|
||||
const {GetVersionRequest, WalletsClient, OffersClient} = require('./grpc_grpc_web_pb.js');
|
||||
const {GetVersionClient, GetBalancesRequest, GetOffersRequest} = require('./grpc_pb.js');
|
||||
import * as grpcWeb from 'grpc-web';
|
||||
import {GetVersionClient, WalletsClient, OffersClient, PaymentAccountsClient} from './protobuf/GrpcServiceClientPb';
|
||||
import {GetVersionRequest, GetVersionReply, GetBalancesRequest, GetBalancesReply, XmrBalanceInfo, GetOffersRequest, GetOffersReply, OfferInfo, GetPaymentAccountsRequest, GetPaymentAccountsReply} from './protobuf/grpc_pb';
|
||||
import {PaymentAccount} from './protobuf/pb_pb';
|
||||
|
||||
/**
|
||||
* Haveno daemon client using gRPC.
|
||||
@ -13,10 +10,11 @@ class HavenoDaemon {
|
||||
|
||||
// instance variables
|
||||
_url: string;
|
||||
_password?: string;
|
||||
_getVersionClient: any;
|
||||
_walletsClient?: any;
|
||||
_offersClient?: any;
|
||||
_password: string;
|
||||
_getVersionClient: GetVersionClient;
|
||||
_walletsClient: WalletsClient;
|
||||
_offersClient: OffersClient;
|
||||
_paymentAccountsClient: PaymentAccountsClient;
|
||||
|
||||
/**
|
||||
* Construct a client connected to a Haveno daemon.
|
||||
@ -24,9 +22,13 @@ class HavenoDaemon {
|
||||
* @param {string} url - Haveno daemon url
|
||||
* @param {string} password - Haveno daemon password if applicable
|
||||
*/
|
||||
constructor(url: string, password?: string) {
|
||||
constructor(url: string, password: string) {
|
||||
this._url = url;
|
||||
this._password = password;
|
||||
this._getVersionClient = new GetVersionClient(this._url);
|
||||
this._walletsClient = new WalletsClient(this._url);
|
||||
this._offersClient = new OffersClient(this._url);
|
||||
this._paymentAccountsClient = new PaymentAccountsClient(this._url);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -35,11 +37,10 @@ class HavenoDaemon {
|
||||
* @return {string} the Haveno daemon version
|
||||
*/
|
||||
async getVersion(): Promise<string> {
|
||||
if (!this._getVersionClient) this._getVersionClient = new GetVersionClient(this._url);
|
||||
let request = new GetVersionRequest();
|
||||
let that = this;
|
||||
let request = new GetVersionRequest();
|
||||
return new Promise(function(resolve, reject) {
|
||||
that._getVersionClient.getVersion(request, {password: that._password}, function(err: any, response: any) {
|
||||
that._getVersionClient.getVersion(request, {password: that._password}, function(err: grpcWeb.Error, response: GetVersionReply) {
|
||||
if (err) reject(err);
|
||||
else resolve(response.getVersion());
|
||||
});
|
||||
@ -49,164 +50,73 @@ class HavenoDaemon {
|
||||
/**
|
||||
* Get the user's balances.
|
||||
*
|
||||
* @return {HavenoBalances} the user's balances
|
||||
* @return {XmrBalanceInfo} the user's balances
|
||||
*/
|
||||
async getBalances(): Promise<HavenoBalances> {
|
||||
if (!this._walletsClient) this._walletsClient = new WalletsClient(this._url);
|
||||
let request = new GetBalancesRequest();
|
||||
async getBalances(): Promise<XmrBalanceInfo> {
|
||||
let that = this;
|
||||
let request = new GetBalancesRequest();
|
||||
return new Promise(function(resolve, reject) {
|
||||
that._walletsClient.getBalances(request, {password: that._password}, function(err: any, response: any) {
|
||||
that._walletsClient.getBalances(request, {password: that._password}, function(err: grpcWeb.Error, response: GetBalancesReply) {
|
||||
if (err) reject(err);
|
||||
else resolve(new HavenoBalances(
|
||||
BigInt(response.getBalances().getXmr().getUnlockedbalance()),
|
||||
BigInt(response.getBalances().getXmr().getLockedbalance()),
|
||||
BigInt(response.getBalances().getXmr().getReservedofferbalance()),
|
||||
BigInt(response.getBalances().getXmr().getReservedtradebalance())));
|
||||
else resolve(response.getBalances()?.getXmr());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get available offers.
|
||||
* Get available offers to buy or sell XMR.
|
||||
*
|
||||
* @param {string} direction - one of "BUY" or "SELL"
|
||||
* @param {string} currencyCode - the currency being bought or sold, e.g. "ETH"
|
||||
*
|
||||
* @return {HavenoOffer[]} available offers
|
||||
* @return {OfferInfo[]} available offers
|
||||
*/
|
||||
async getOffers(direction: string, currencyCode: string): Promise<HavenoOffer[]> {
|
||||
if (!this._offersClient) this._offersClient = new OffersClient(this._url);
|
||||
async getOffers(direction: string): Promise<OfferInfo[]> {
|
||||
let request = new GetOffersRequest()
|
||||
.setDirection(direction)
|
||||
.setCurrencycode(currencyCode);
|
||||
.setCurrencycode("XMR");
|
||||
let that = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
that._offersClient.getOffers(request, {password: that._password}, function(err: any, response: any) {
|
||||
that._offersClient.getOffers(request, {password: that._password}, function(err: grpcWeb.Error, response: GetOffersReply) {
|
||||
if (err) reject(err);
|
||||
else {
|
||||
let offers: HavenoOffer[] = [];
|
||||
for (let offer of response.getOffersList()) {
|
||||
offers.push(new HavenoOffer(
|
||||
offer.getId(),
|
||||
offer.getDirection(),
|
||||
offer.getPrice(),
|
||||
offer.getUsemarketbasedprice(),
|
||||
offer.getMarketpricemargin(),
|
||||
offer.getAmount(),
|
||||
offer.getMinamount(),
|
||||
offer.getVolume(),
|
||||
offer.getMinvolume(),
|
||||
offer.getBuyersecuritydeposit(),
|
||||
offer.getTriggerprice(),
|
||||
offer.getIscurrencyformakerfeebtc(),
|
||||
offer.getPaymentaccountid(),
|
||||
offer.getPaymentmethodid(),
|
||||
offer.getPaymentmethodshortname(),
|
||||
offer.getBasecurrencycode(),
|
||||
offer.getCountercurrencycode(),
|
||||
offer.getDate(),
|
||||
offer.getState(),
|
||||
offer.getSellersecuritydeposit(),
|
||||
offer.getOfferfeepaymenttxid(),
|
||||
offer.getTxfee(),
|
||||
offer.getMakerfee()
|
||||
));
|
||||
}
|
||||
resolve(offers);
|
||||
}
|
||||
else resolve(response.getOffersList());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user's created offers to buy or sell XMR.
|
||||
*
|
||||
* @param {string} direction - one of "BUY" or "SELL"
|
||||
*
|
||||
* @return {OfferInfo[]} the user's created offers
|
||||
*/
|
||||
async getMyOffers(direction: string): Promise<OfferInfo[]> {
|
||||
let that = this;
|
||||
let request = new GetOffersRequest()
|
||||
.setDirection(direction)
|
||||
.setCurrencycode("XMR");
|
||||
return new Promise(function(resolve, reject) {
|
||||
that._offersClient.getMyOffers(request, {password: that._password}, function(err: grpcWeb.Error, response: GetOffersReply) {
|
||||
if (err) reject(err);
|
||||
else resolve(response.getOffersList());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get payment accounts.
|
||||
*
|
||||
* @return {PaymentAccount[]} the payment accounts
|
||||
*/
|
||||
async getPaymentAccounts(): Promise<PaymentAccount[]> {
|
||||
let that = this;
|
||||
return new Promise(function(resolve, reject) {
|
||||
that._paymentAccountsClient.getPaymentAccounts(new GetPaymentAccountsRequest(), {password: that._password}, function(err: grpcWeb.Error, response: GetPaymentAccountsReply) {
|
||||
if (err) reject(err);
|
||||
else resolve(response.getPaymentaccountsList());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class HavenoBalances {
|
||||
unlockedBalance: bigint;
|
||||
lockedBalance: bigint;
|
||||
reservedOfferBalance: bigint;
|
||||
reservedTradeBalance: bigint;
|
||||
constructor(unlockedBalance: bigint,
|
||||
lockedBalance: bigint,
|
||||
reservedOfferBalance: bigint,
|
||||
reservedTradeBalance: bigint) {
|
||||
this.unlockedBalance = unlockedBalance;
|
||||
this.lockedBalance = lockedBalance;
|
||||
this.reservedOfferBalance = reservedOfferBalance;
|
||||
this.reservedTradeBalance = reservedTradeBalance;
|
||||
}
|
||||
}
|
||||
|
||||
class HavenoOffer {
|
||||
id: string;
|
||||
direction: string;
|
||||
price: bigint;
|
||||
useMarketBasedPrice: boolean;
|
||||
marketPriceMargin: number;
|
||||
amount: bigint;
|
||||
minAmount: bigint;
|
||||
volume: bigint;
|
||||
minVolume: bigint;
|
||||
buyerSecurityDeposit: bigint;
|
||||
triggerPrice: bigint;
|
||||
isCurrencyForMakerFeeBtc: boolean;
|
||||
paymentAccountId: string;
|
||||
paymentMethodId: string;
|
||||
paymentMethodShortName: string;
|
||||
baseCurrencyCode: string;
|
||||
counterCurrencyCode: string;
|
||||
date: bigint;
|
||||
state: string;
|
||||
sellerSecurityDeposit: bigint;
|
||||
offerFeePaymentTxId: string;
|
||||
txFee: bigint;
|
||||
makerFee: bigint;
|
||||
constructor(id: string,
|
||||
direction: string,
|
||||
price: bigint,
|
||||
useMarketBasedPrice: boolean,
|
||||
marketPriceMargin: number,
|
||||
amount: bigint,
|
||||
minAmount: bigint,
|
||||
volume: bigint,
|
||||
minVolume: bigint,
|
||||
buyerSecurityDeposit: bigint,
|
||||
triggerPrice: bigint,
|
||||
isCurrencyForMakerFeeBtc: boolean,
|
||||
paymentAccountId: string,
|
||||
paymentMethodId: string,
|
||||
paymentMethodShortName: string,
|
||||
baseCurrencyCode: string,
|
||||
counterCurrencyCode: string,
|
||||
date: bigint,
|
||||
state: string,
|
||||
sellerSecurityDeposit: bigint,
|
||||
offerFeePaymentTxId: string,
|
||||
txFee: bigint,
|
||||
makerFee: bigint,) {
|
||||
this.id = id;
|
||||
this.direction = direction;
|
||||
this.price = price;
|
||||
this.useMarketBasedPrice = useMarketBasedPrice;
|
||||
this.marketPriceMargin = marketPriceMargin;
|
||||
this.amount = amount;
|
||||
this.minAmount = minAmount;
|
||||
this.volume = volume;
|
||||
this.minVolume = minVolume;
|
||||
this.buyerSecurityDeposit = buyerSecurityDeposit;
|
||||
this.triggerPrice = triggerPrice;
|
||||
this.isCurrencyForMakerFeeBtc = isCurrencyForMakerFeeBtc;
|
||||
this.paymentAccountId = paymentAccountId;
|
||||
this.paymentMethodId = paymentMethodId;
|
||||
this.paymentMethodShortName = paymentMethodShortName;
|
||||
this.baseCurrencyCode = baseCurrencyCode;
|
||||
this.counterCurrencyCode = counterCurrencyCode;
|
||||
this.date = date;
|
||||
this.state = state;
|
||||
this.sellerSecurityDeposit = sellerSecurityDeposit;
|
||||
this.offerFeePaymentTxId = offerFeePaymentTxId;
|
||||
this.txFee = txFee;
|
||||
this.makerFee = makerFee;
|
||||
}
|
||||
}
|
||||
|
||||
export {HavenoDaemon, HavenoBalances, HavenoOffer};
|
||||
export {HavenoDaemon};
|
File diff suppressed because it is too large
Load Diff
1788
src/protobuf/GrpcServiceClientPb.ts
Normal file
1788
src/protobuf/GrpcServiceClientPb.ts
Normal file
File diff suppressed because it is too large
Load Diff
2053
src/protobuf/grpc_pb.d.ts
vendored
Normal file
2053
src/protobuf/grpc_pb.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -3757,10 +3757,10 @@ proto.io.bisq.protobuffer.CreateOfferRequest.toObject = function(includeInstance
|
||||
price: jspb.Message.getFieldWithDefault(msg, 3, ""),
|
||||
usemarketbasedprice: jspb.Message.getBooleanFieldWithDefault(msg, 4, false),
|
||||
marketpricemargin: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0),
|
||||
amount: jspb.Message.getFieldWithDefault(msg, 6, 0),
|
||||
minamount: jspb.Message.getFieldWithDefault(msg, 7, 0),
|
||||
amount: jspb.Message.getFieldWithDefault(msg, 6, "0"),
|
||||
minamount: jspb.Message.getFieldWithDefault(msg, 7, "0"),
|
||||
buyersecuritydeposit: jspb.Message.getFloatingPointFieldWithDefault(msg, 8, 0.0),
|
||||
triggerprice: jspb.Message.getFieldWithDefault(msg, 9, 0),
|
||||
triggerprice: jspb.Message.getFieldWithDefault(msg, 9, "0"),
|
||||
paymentaccountid: jspb.Message.getFieldWithDefault(msg, 10, ""),
|
||||
makerfeecurrencycode: jspb.Message.getFieldWithDefault(msg, 11, "")
|
||||
};
|
||||
@ -3820,11 +3820,11 @@ proto.io.bisq.protobuffer.CreateOfferRequest.deserializeBinaryFromReader = funct
|
||||
msg.setMarketpricemargin(value);
|
||||
break;
|
||||
case 6:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
var value = /** @type {string} */ (reader.readUint64String());
|
||||
msg.setAmount(value);
|
||||
break;
|
||||
case 7:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
var value = /** @type {string} */ (reader.readUint64String());
|
||||
msg.setMinamount(value);
|
||||
break;
|
||||
case 8:
|
||||
@ -3832,7 +3832,7 @@ proto.io.bisq.protobuffer.CreateOfferRequest.deserializeBinaryFromReader = funct
|
||||
msg.setBuyersecuritydeposit(value);
|
||||
break;
|
||||
case 9:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
var value = /** @type {string} */ (reader.readUint64String());
|
||||
msg.setTriggerprice(value);
|
||||
break;
|
||||
case 10:
|
||||
@ -3908,15 +3908,15 @@ proto.io.bisq.protobuffer.CreateOfferRequest.serializeBinaryToWriter = function(
|
||||
);
|
||||
}
|
||||
f = message.getAmount();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
if (parseInt(f, 10) !== 0) {
|
||||
writer.writeUint64String(
|
||||
6,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getMinamount();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
if (parseInt(f, 10) !== 0) {
|
||||
writer.writeUint64String(
|
||||
7,
|
||||
f
|
||||
);
|
||||
@ -3929,8 +3929,8 @@ proto.io.bisq.protobuffer.CreateOfferRequest.serializeBinaryToWriter = function(
|
||||
);
|
||||
}
|
||||
f = message.getTriggerprice();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
if (parseInt(f, 10) !== 0) {
|
||||
writer.writeUint64String(
|
||||
9,
|
||||
f
|
||||
);
|
||||
@ -4044,37 +4044,37 @@ proto.io.bisq.protobuffer.CreateOfferRequest.prototype.setMarketpricemargin = fu
|
||||
|
||||
/**
|
||||
* optional uint64 amount = 6;
|
||||
* @return {number}
|
||||
* @return {string}
|
||||
*/
|
||||
proto.io.bisq.protobuffer.CreateOfferRequest.prototype.getAmount = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "0"));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {string} value
|
||||
* @return {!proto.io.bisq.protobuffer.CreateOfferRequest} returns this
|
||||
*/
|
||||
proto.io.bisq.protobuffer.CreateOfferRequest.prototype.setAmount = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 6, value);
|
||||
return jspb.Message.setProto3StringIntField(this, 6, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional uint64 minAmount = 7;
|
||||
* @return {number}
|
||||
* @return {string}
|
||||
*/
|
||||
proto.io.bisq.protobuffer.CreateOfferRequest.prototype.getMinamount = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0));
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "0"));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {string} value
|
||||
* @return {!proto.io.bisq.protobuffer.CreateOfferRequest} returns this
|
||||
*/
|
||||
proto.io.bisq.protobuffer.CreateOfferRequest.prototype.setMinamount = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 7, value);
|
||||
return jspb.Message.setProto3StringIntField(this, 7, value);
|
||||
};
|
||||
|
||||
|
||||
@ -4098,19 +4098,19 @@ proto.io.bisq.protobuffer.CreateOfferRequest.prototype.setBuyersecuritydeposit =
|
||||
|
||||
/**
|
||||
* optional uint64 triggerPrice = 9;
|
||||
* @return {number}
|
||||
* @return {string}
|
||||
*/
|
||||
proto.io.bisq.protobuffer.CreateOfferRequest.prototype.getTriggerprice = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0));
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 9, "0"));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {string} value
|
||||
* @return {!proto.io.bisq.protobuffer.CreateOfferRequest} returns this
|
||||
*/
|
||||
proto.io.bisq.protobuffer.CreateOfferRequest.prototype.setTriggerprice = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 9, value);
|
||||
return jspb.Message.setProto3StringIntField(this, 9, value);
|
||||
};
|
||||
|
||||
|
||||
@ -16533,10 +16533,10 @@ proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.toObject = function(opt_inclu
|
||||
*/
|
||||
proto.io.bisq.protobuffer.XmrBalanceInfo.toObject = function(includeInstance, msg) {
|
||||
var f, obj = {
|
||||
unlockedbalance: jspb.Message.getFieldWithDefault(msg, 1, 0),
|
||||
lockedbalance: jspb.Message.getFieldWithDefault(msg, 2, 0),
|
||||
reservedofferbalance: jspb.Message.getFieldWithDefault(msg, 3, 0),
|
||||
reservedtradebalance: jspb.Message.getFieldWithDefault(msg, 4, 0)
|
||||
unlockedbalance: jspb.Message.getFieldWithDefault(msg, 1, "0"),
|
||||
lockedbalance: jspb.Message.getFieldWithDefault(msg, 2, "0"),
|
||||
reservedofferbalance: jspb.Message.getFieldWithDefault(msg, 3, "0"),
|
||||
reservedtradebalance: jspb.Message.getFieldWithDefault(msg, 4, "0")
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
@ -16574,19 +16574,19 @@ proto.io.bisq.protobuffer.XmrBalanceInfo.deserializeBinaryFromReader = function(
|
||||
var field = reader.getFieldNumber();
|
||||
switch (field) {
|
||||
case 1:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
var value = /** @type {string} */ (reader.readUint64String());
|
||||
msg.setUnlockedbalance(value);
|
||||
break;
|
||||
case 2:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
var value = /** @type {string} */ (reader.readUint64String());
|
||||
msg.setLockedbalance(value);
|
||||
break;
|
||||
case 3:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
var value = /** @type {string} */ (reader.readUint64String());
|
||||
msg.setReservedofferbalance(value);
|
||||
break;
|
||||
case 4:
|
||||
var value = /** @type {number} */ (reader.readUint64());
|
||||
var value = /** @type {string} */ (reader.readUint64String());
|
||||
msg.setReservedtradebalance(value);
|
||||
break;
|
||||
default:
|
||||
@ -16619,29 +16619,29 @@ proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.serializeBinary = function()
|
||||
proto.io.bisq.protobuffer.XmrBalanceInfo.serializeBinaryToWriter = function(message, writer) {
|
||||
var f = undefined;
|
||||
f = message.getUnlockedbalance();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
if (parseInt(f, 10) !== 0) {
|
||||
writer.writeUint64String(
|
||||
1,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getLockedbalance();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
if (parseInt(f, 10) !== 0) {
|
||||
writer.writeUint64String(
|
||||
2,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getReservedofferbalance();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
if (parseInt(f, 10) !== 0) {
|
||||
writer.writeUint64String(
|
||||
3,
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getReservedtradebalance();
|
||||
if (f !== 0) {
|
||||
writer.writeUint64(
|
||||
if (parseInt(f, 10) !== 0) {
|
||||
writer.writeUint64String(
|
||||
4,
|
||||
f
|
||||
);
|
||||
@ -16651,73 +16651,73 @@ proto.io.bisq.protobuffer.XmrBalanceInfo.serializeBinaryToWriter = function(mess
|
||||
|
||||
/**
|
||||
* optional uint64 unlockedBalance = 1;
|
||||
* @return {number}
|
||||
* @return {string}
|
||||
*/
|
||||
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.getUnlockedbalance = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "0"));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {string} value
|
||||
* @return {!proto.io.bisq.protobuffer.XmrBalanceInfo} returns this
|
||||
*/
|
||||
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.setUnlockedbalance = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 1, value);
|
||||
return jspb.Message.setProto3StringIntField(this, 1, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional uint64 lockedBalance = 2;
|
||||
* @return {number}
|
||||
* @return {string}
|
||||
*/
|
||||
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.getLockedbalance = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0"));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {string} value
|
||||
* @return {!proto.io.bisq.protobuffer.XmrBalanceInfo} returns this
|
||||
*/
|
||||
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.setLockedbalance = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 2, value);
|
||||
return jspb.Message.setProto3StringIntField(this, 2, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional uint64 reservedOfferBalance = 3;
|
||||
* @return {number}
|
||||
* @return {string}
|
||||
*/
|
||||
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.getReservedofferbalance = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "0"));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {string} value
|
||||
* @return {!proto.io.bisq.protobuffer.XmrBalanceInfo} returns this
|
||||
*/
|
||||
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.setReservedofferbalance = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 3, value);
|
||||
return jspb.Message.setProto3StringIntField(this, 3, value);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* optional uint64 reservedTradeBalance = 4;
|
||||
* @return {number}
|
||||
* @return {string}
|
||||
*/
|
||||
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.getReservedtradebalance = function() {
|
||||
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
|
||||
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "0"));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @param {string} value
|
||||
* @return {!proto.io.bisq.protobuffer.XmrBalanceInfo} returns this
|
||||
*/
|
||||
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.setReservedtradebalance = function(value) {
|
||||
return jspb.Message.setProto3IntField(this, 4, value);
|
||||
return jspb.Message.setProto3StringIntField(this, 4, value);
|
||||
};
|
||||
|
||||
|
10004
src/protobuf/pb_pb.d.ts
vendored
Normal file
10004
src/protobuf/pb_pb.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user