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:
woodser 2021-09-14 08:27:45 -04:00 committed by GitHub
parent bea11ab1f4
commit f83fcb0d84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 14215 additions and 4100 deletions

View File

@ -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. 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. Install protobuf for your system, e.g. on mac: `brew install protobuf`
2. `./bin/build_protobuf.sh` 3. `./bin/build_protobuf.sh`

View File

@ -1,8 +1,13 @@
#!/bin/sh #!/bin/sh
// generate imports for haveno services and types using grpc-web
cd ./config || exit 1 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 ../ cd ../
mv ./config/grpc_grpc_web_pb.js ./src || exit 1
mv ./config/grpc_pb.js ./src || exit 1 // move imports to src folder
mv ./config/pb_pb.js ./src || exit 1 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

View File

@ -116,10 +116,10 @@ message CreateOfferRequest {
string price = 3; string price = 3;
bool useMarketBasedPrice = 4; bool useMarketBasedPrice = 4;
double marketPriceMargin = 5; double marketPriceMargin = 5;
uint64 amount = 6; uint64 amount = 6 [jstype = JS_STRING];
uint64 minAmount = 7; uint64 minAmount = 7 [jstype = JS_STRING];
double buyerSecurityDeposit = 8; double buyerSecurityDeposit = 8;
uint64 triggerPrice = 9; uint64 triggerPrice = 9 [jstype = JS_STRING];
string paymentAccountId = 10; string paymentAccountId = 10;
string makerFeeCurrencyCode = 11; string makerFeeCurrencyCode = 11;
} }
@ -606,10 +606,10 @@ message BtcBalanceInfo {
} }
message XmrBalanceInfo { message XmrBalanceInfo {
uint64 unlockedBalance = 1; uint64 unlockedBalance = 1 [jstype = JS_STRING];
uint64 lockedBalance = 2; uint64 lockedBalance = 2 [jstype = JS_STRING];
uint64 reservedOfferBalance = 3; uint64 reservedOfferBalance = 3 [jstype = JS_STRING];
uint64 reservedTradeBalance = 4; uint64 reservedTradeBalance = 4 [jstype = JS_STRING];
} }
message AddressBalanceInfo { message AddressBalanceInfo {

View File

@ -2361,7 +2361,7 @@ message BlockChainExplorer {
message PaymentAccount { message PaymentAccount {
string id = 1; string id = 1;
int64 creation_date = 2; int64 creation_date = 2 [jstype = JS_STRING];
PaymentMethod payment_method = 3; PaymentMethod payment_method = 3;
string account_name = 4; string account_name = 4;
repeated TradeCurrency trade_currencies = 5; repeated TradeCurrency trade_currencies = 5;
@ -2371,8 +2371,8 @@ message PaymentAccount {
message PaymentMethod { message PaymentMethod {
string id = 1; string id = 1;
int64 max_trade_period = 2; int64 max_trade_period = 2 [jstype = JS_STRING];
int64 max_trade_limit = 3; int64 max_trade_limit = 3 [jstype = JS_STRING];
} }
// Currency // Currency

View File

@ -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_UI_VERSION = "1.6.2";
const HAVENO_DAEMON_URL = "http://localhost:8080"; 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 () => { test("Can get the user's balances", async () => {
let balances: HavenoBalances = await daemon.getBalances(); let balances: XmrBalanceInfo = await daemon.getBalances();
expect(balances.unlockedBalance); expect(balances.getUnlockedbalance()); // TODO: correct camelcase in grpc
expect(balances.lockedBalance); expect(balances.getLockedbalance());
expect(balances.reservedOfferBalance); expect(balances.getReservedofferbalance());
expect(balances.reservedTradeBalance); expect(balances.getReservedtradebalance());
}); });
test("Can get offers", async() => { test("Can get offers", async () => {
let offers: HavenoOffer[] = await daemon.getOffers("SELL", "XMR"); let offers: OfferInfo[] = await daemon.getOffers("BUY");
for (let offer of offers) { for (let offer of offers) {
testOffer(offer); testOffer(offer);
} }
}); });
function testOffer(offer: HavenoOffer) { test("Can get the user's created offers", async () => {
expect(offer.id).toHaveLength; 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 // TODO: test rest of offer
} }

View File

@ -1,10 +1,7 @@
/** import * as grpcWeb from 'grpc-web';
* These imports are generated by protoc-gen-grpc-web (created with `sudo make install-plugin` in grpc-web) using the following command: import {GetVersionClient, WalletsClient, OffersClient, PaymentAccountsClient} from './protobuf/GrpcServiceClientPb';
* import {GetVersionRequest, GetVersionReply, GetBalancesRequest, GetBalancesReply, XmrBalanceInfo, GetOffersRequest, GetOffersReply, OfferInfo, GetPaymentAccountsRequest, GetPaymentAccountsReply} from './protobuf/grpc_pb';
* `protoc -I=./ *.proto --js_out=import_style=commonjs:./ --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./` import {PaymentAccount} from './protobuf/pb_pb';
*/
const {GetVersionRequest, WalletsClient, OffersClient} = require('./grpc_grpc_web_pb.js');
const {GetVersionClient, GetBalancesRequest, GetOffersRequest} = require('./grpc_pb.js');
/** /**
* Haveno daemon client using gRPC. * Haveno daemon client using gRPC.
@ -13,10 +10,11 @@ class HavenoDaemon {
// instance variables // instance variables
_url: string; _url: string;
_password?: string; _password: string;
_getVersionClient: any; _getVersionClient: GetVersionClient;
_walletsClient?: any; _walletsClient: WalletsClient;
_offersClient?: any; _offersClient: OffersClient;
_paymentAccountsClient: PaymentAccountsClient;
/** /**
* Construct a client connected to a Haveno daemon. * Construct a client connected to a Haveno daemon.
@ -24,9 +22,13 @@ class HavenoDaemon {
* @param {string} url - Haveno daemon url * @param {string} url - Haveno daemon url
* @param {string} password - Haveno daemon password if applicable * @param {string} password - Haveno daemon password if applicable
*/ */
constructor(url: string, password?: string) { constructor(url: string, password: string) {
this._url = url; this._url = url;
this._password = password; 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 * @return {string} the Haveno daemon version
*/ */
async getVersion(): Promise<string> { async getVersion(): Promise<string> {
if (!this._getVersionClient) this._getVersionClient = new GetVersionClient(this._url);
let request = new GetVersionRequest();
let that = this; let that = this;
let request = new GetVersionRequest();
return new Promise(function(resolve, reject) { 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); if (err) reject(err);
else resolve(response.getVersion()); else resolve(response.getVersion());
}); });
@ -49,164 +50,73 @@ class HavenoDaemon {
/** /**
* Get the user's balances. * Get the user's balances.
* *
* @return {HavenoBalances} the user's balances * @return {XmrBalanceInfo} the user's balances
*/ */
async getBalances(): Promise<HavenoBalances> { async getBalances(): Promise<XmrBalanceInfo> {
if (!this._walletsClient) this._walletsClient = new WalletsClient(this._url);
let request = new GetBalancesRequest();
let that = this; let that = this;
let request = new GetBalancesRequest();
return new Promise(function(resolve, reject) { 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); if (err) reject(err);
else resolve(new HavenoBalances( else resolve(response.getBalances()?.getXmr());
BigInt(response.getBalances().getXmr().getUnlockedbalance()),
BigInt(response.getBalances().getXmr().getLockedbalance()),
BigInt(response.getBalances().getXmr().getReservedofferbalance()),
BigInt(response.getBalances().getXmr().getReservedtradebalance())));
}); });
}); });
} }
/** /**
* Get available offers. * Get available offers to buy or sell XMR.
* *
* @param {string} direction - one of "BUY" or "SELL" * @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[]> { async getOffers(direction: string): Promise<OfferInfo[]> {
if (!this._offersClient) this._offersClient = new OffersClient(this._url);
let request = new GetOffersRequest() let request = new GetOffersRequest()
.setDirection(direction) .setDirection(direction)
.setCurrencycode(currencyCode); .setCurrencycode("XMR");
let that = this; let that = this;
return new Promise(function(resolve, reject) { 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); if (err) reject(err);
else { else resolve(response.getOffersList());
let offers: HavenoOffer[] = []; });
for (let offer of response.getOffersList()) { });
offers.push(new HavenoOffer( }
offer.getId(),
offer.getDirection(), /**
offer.getPrice(), * Get user's created offers to buy or sell XMR.
offer.getUsemarketbasedprice(), *
offer.getMarketpricemargin(), * @param {string} direction - one of "BUY" or "SELL"
offer.getAmount(), *
offer.getMinamount(), * @return {OfferInfo[]} the user's created offers
offer.getVolume(), */
offer.getMinvolume(), async getMyOffers(direction: string): Promise<OfferInfo[]> {
offer.getBuyersecuritydeposit(), let that = this;
offer.getTriggerprice(), let request = new GetOffersRequest()
offer.getIscurrencyformakerfeebtc(), .setDirection(direction)
offer.getPaymentaccountid(), .setCurrencycode("XMR");
offer.getPaymentmethodid(), return new Promise(function(resolve, reject) {
offer.getPaymentmethodshortname(), that._offersClient.getMyOffers(request, {password: that._password}, function(err: grpcWeb.Error, response: GetOffersReply) {
offer.getBasecurrencycode(), if (err) reject(err);
offer.getCountercurrencycode(), else resolve(response.getOffersList());
offer.getDate(), });
offer.getState(), });
offer.getSellersecuritydeposit(), }
offer.getOfferfeepaymenttxid(),
offer.getTxfee(), /**
offer.getMakerfee() * Get payment accounts.
)); *
} * @return {PaymentAccount[]} the payment accounts
resolve(offers); */
} 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 { export {HavenoDaemon};
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};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2053
src/protobuf/grpc_pb.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3757,10 +3757,10 @@ proto.io.bisq.protobuffer.CreateOfferRequest.toObject = function(includeInstance
price: jspb.Message.getFieldWithDefault(msg, 3, ""), price: jspb.Message.getFieldWithDefault(msg, 3, ""),
usemarketbasedprice: jspb.Message.getBooleanFieldWithDefault(msg, 4, false), usemarketbasedprice: jspb.Message.getBooleanFieldWithDefault(msg, 4, false),
marketpricemargin: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0), marketpricemargin: jspb.Message.getFloatingPointFieldWithDefault(msg, 5, 0.0),
amount: jspb.Message.getFieldWithDefault(msg, 6, 0), amount: jspb.Message.getFieldWithDefault(msg, 6, "0"),
minamount: jspb.Message.getFieldWithDefault(msg, 7, 0), minamount: jspb.Message.getFieldWithDefault(msg, 7, "0"),
buyersecuritydeposit: jspb.Message.getFloatingPointFieldWithDefault(msg, 8, 0.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, ""), paymentaccountid: jspb.Message.getFieldWithDefault(msg, 10, ""),
makerfeecurrencycode: jspb.Message.getFieldWithDefault(msg, 11, "") makerfeecurrencycode: jspb.Message.getFieldWithDefault(msg, 11, "")
}; };
@ -3820,11 +3820,11 @@ proto.io.bisq.protobuffer.CreateOfferRequest.deserializeBinaryFromReader = funct
msg.setMarketpricemargin(value); msg.setMarketpricemargin(value);
break; break;
case 6: case 6:
var value = /** @type {number} */ (reader.readUint64()); var value = /** @type {string} */ (reader.readUint64String());
msg.setAmount(value); msg.setAmount(value);
break; break;
case 7: case 7:
var value = /** @type {number} */ (reader.readUint64()); var value = /** @type {string} */ (reader.readUint64String());
msg.setMinamount(value); msg.setMinamount(value);
break; break;
case 8: case 8:
@ -3832,7 +3832,7 @@ proto.io.bisq.protobuffer.CreateOfferRequest.deserializeBinaryFromReader = funct
msg.setBuyersecuritydeposit(value); msg.setBuyersecuritydeposit(value);
break; break;
case 9: case 9:
var value = /** @type {number} */ (reader.readUint64()); var value = /** @type {string} */ (reader.readUint64String());
msg.setTriggerprice(value); msg.setTriggerprice(value);
break; break;
case 10: case 10:
@ -3908,15 +3908,15 @@ proto.io.bisq.protobuffer.CreateOfferRequest.serializeBinaryToWriter = function(
); );
} }
f = message.getAmount(); f = message.getAmount();
if (f !== 0) { if (parseInt(f, 10) !== 0) {
writer.writeUint64( writer.writeUint64String(
6, 6,
f f
); );
} }
f = message.getMinamount(); f = message.getMinamount();
if (f !== 0) { if (parseInt(f, 10) !== 0) {
writer.writeUint64( writer.writeUint64String(
7, 7,
f f
); );
@ -3929,8 +3929,8 @@ proto.io.bisq.protobuffer.CreateOfferRequest.serializeBinaryToWriter = function(
); );
} }
f = message.getTriggerprice(); f = message.getTriggerprice();
if (f !== 0) { if (parseInt(f, 10) !== 0) {
writer.writeUint64( writer.writeUint64String(
9, 9,
f f
); );
@ -4044,37 +4044,37 @@ proto.io.bisq.protobuffer.CreateOfferRequest.prototype.setMarketpricemargin = fu
/** /**
* optional uint64 amount = 6; * optional uint64 amount = 6;
* @return {number} * @return {string}
*/ */
proto.io.bisq.protobuffer.CreateOfferRequest.prototype.getAmount = function() { 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 * @return {!proto.io.bisq.protobuffer.CreateOfferRequest} returns this
*/ */
proto.io.bisq.protobuffer.CreateOfferRequest.prototype.setAmount = function(value) { 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; * optional uint64 minAmount = 7;
* @return {number} * @return {string}
*/ */
proto.io.bisq.protobuffer.CreateOfferRequest.prototype.getMinamount = function() { 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 * @return {!proto.io.bisq.protobuffer.CreateOfferRequest} returns this
*/ */
proto.io.bisq.protobuffer.CreateOfferRequest.prototype.setMinamount = function(value) { 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; * optional uint64 triggerPrice = 9;
* @return {number} * @return {string}
*/ */
proto.io.bisq.protobuffer.CreateOfferRequest.prototype.getTriggerprice = function() { 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 * @return {!proto.io.bisq.protobuffer.CreateOfferRequest} returns this
*/ */
proto.io.bisq.protobuffer.CreateOfferRequest.prototype.setTriggerprice = function(value) { 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) { proto.io.bisq.protobuffer.XmrBalanceInfo.toObject = function(includeInstance, msg) {
var f, obj = { var f, obj = {
unlockedbalance: jspb.Message.getFieldWithDefault(msg, 1, 0), unlockedbalance: jspb.Message.getFieldWithDefault(msg, 1, "0"),
lockedbalance: jspb.Message.getFieldWithDefault(msg, 2, 0), lockedbalance: jspb.Message.getFieldWithDefault(msg, 2, "0"),
reservedofferbalance: jspb.Message.getFieldWithDefault(msg, 3, 0), reservedofferbalance: jspb.Message.getFieldWithDefault(msg, 3, "0"),
reservedtradebalance: jspb.Message.getFieldWithDefault(msg, 4, 0) reservedtradebalance: jspb.Message.getFieldWithDefault(msg, 4, "0")
}; };
if (includeInstance) { if (includeInstance) {
@ -16574,19 +16574,19 @@ proto.io.bisq.protobuffer.XmrBalanceInfo.deserializeBinaryFromReader = function(
var field = reader.getFieldNumber(); var field = reader.getFieldNumber();
switch (field) { switch (field) {
case 1: case 1:
var value = /** @type {number} */ (reader.readUint64()); var value = /** @type {string} */ (reader.readUint64String());
msg.setUnlockedbalance(value); msg.setUnlockedbalance(value);
break; break;
case 2: case 2:
var value = /** @type {number} */ (reader.readUint64()); var value = /** @type {string} */ (reader.readUint64String());
msg.setLockedbalance(value); msg.setLockedbalance(value);
break; break;
case 3: case 3:
var value = /** @type {number} */ (reader.readUint64()); var value = /** @type {string} */ (reader.readUint64String());
msg.setReservedofferbalance(value); msg.setReservedofferbalance(value);
break; break;
case 4: case 4:
var value = /** @type {number} */ (reader.readUint64()); var value = /** @type {string} */ (reader.readUint64String());
msg.setReservedtradebalance(value); msg.setReservedtradebalance(value);
break; break;
default: default:
@ -16619,29 +16619,29 @@ proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.serializeBinary = function()
proto.io.bisq.protobuffer.XmrBalanceInfo.serializeBinaryToWriter = function(message, writer) { proto.io.bisq.protobuffer.XmrBalanceInfo.serializeBinaryToWriter = function(message, writer) {
var f = undefined; var f = undefined;
f = message.getUnlockedbalance(); f = message.getUnlockedbalance();
if (f !== 0) { if (parseInt(f, 10) !== 0) {
writer.writeUint64( writer.writeUint64String(
1, 1,
f f
); );
} }
f = message.getLockedbalance(); f = message.getLockedbalance();
if (f !== 0) { if (parseInt(f, 10) !== 0) {
writer.writeUint64( writer.writeUint64String(
2, 2,
f f
); );
} }
f = message.getReservedofferbalance(); f = message.getReservedofferbalance();
if (f !== 0) { if (parseInt(f, 10) !== 0) {
writer.writeUint64( writer.writeUint64String(
3, 3,
f f
); );
} }
f = message.getReservedtradebalance(); f = message.getReservedtradebalance();
if (f !== 0) { if (parseInt(f, 10) !== 0) {
writer.writeUint64( writer.writeUint64String(
4, 4,
f f
); );
@ -16651,73 +16651,73 @@ proto.io.bisq.protobuffer.XmrBalanceInfo.serializeBinaryToWriter = function(mess
/** /**
* optional uint64 unlockedBalance = 1; * optional uint64 unlockedBalance = 1;
* @return {number} * @return {string}
*/ */
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.getUnlockedbalance = function() { 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 * @return {!proto.io.bisq.protobuffer.XmrBalanceInfo} returns this
*/ */
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.setUnlockedbalance = function(value) { 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; * optional uint64 lockedBalance = 2;
* @return {number} * @return {string}
*/ */
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.getLockedbalance = function() { 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 * @return {!proto.io.bisq.protobuffer.XmrBalanceInfo} returns this
*/ */
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.setLockedbalance = function(value) { 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; * optional uint64 reservedOfferBalance = 3;
* @return {number} * @return {string}
*/ */
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.getReservedofferbalance = function() { 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 * @return {!proto.io.bisq.protobuffer.XmrBalanceInfo} returns this
*/ */
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.setReservedofferbalance = function(value) { 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; * optional uint64 reservedTradeBalance = 4;
* @return {number} * @return {string}
*/ */
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.getReservedtradebalance = function() { 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 * @return {!proto.io.bisq.protobuffer.XmrBalanceInfo} returns this
*/ */
proto.io.bisq.protobuffer.XmrBalanceInfo.prototype.setReservedtradebalance = function(value) { 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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff