Export protobuf types (#100)

* update to monero-javascript v0.7.0
* bump to version v0.0.2
* terminate monero-javascript worker at end of tests
This commit is contained in:
woodser 2022-05-10 09:55:41 -04:00 committed by GitHub
parent 5d89d3973f
commit befdf7b33e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 70674 additions and 41155 deletions

View File

@ -28,7 +28,7 @@ await alice.disconnect();
## TypeDocs
See haveno-ts [typedocs](https://haveno-dex.github.io/haveno-ts/classes/HavenoClient.HavenoClient-1.html).
See [typedocs](https://haveno-dex.github.io/haveno-ts/classes/HavenoClient.HavenoClient-1.html).
## Run tests

View File

@ -3,7 +3,7 @@ import { GetVersionClient, AccountClient, MoneroConnectionsClient, DisputesClien
import { MarketPriceInfo, MarketDepthInfo, XmrBalanceInfo, OfferInfo, TradeInfo, XmrTx, XmrDestination, NotificationMessage, UrlConnection } from "./protobuf/grpc_pb";
import { PaymentMethod, PaymentAccount, Attachment, DisputeResult, Dispute, ChatMessage, MoneroNodeSettings } from "./protobuf/pb_pb";
/**
* Haveno daemon client using gRPC.
* Haveno daemon client.
*/
export default class HavenoClient {
_appName: string | undefined;

View File

@ -5,7 +5,7 @@ import { GetVersionClient, AccountClient, MoneroConnectionsClient, DisputesClien
import { GetVersionRequest, IsAppInitializedRequest, RegisterDisputeAgentRequest, MarketPriceRequest, MarketPricesRequest, MarketDepthRequest, GetBalancesRequest, GetMyOfferRequest, GetOffersRequest, GetPaymentMethodsRequest, GetPaymentAccountFormRequest, CreatePaymentAccountRequest, GetPaymentAccountsRequest, CreateCryptoCurrencyPaymentAccountRequest, CreateOfferRequest, CancelOfferRequest, TakeOfferRequest, GetTradeRequest, GetTradesRequest, GetNewDepositAddressRequest, ConfirmPaymentStartedRequest, ConfirmPaymentReceivedRequest, GetXmrTxsRequest, CreateXmrTxRequest, RelayXmrTxRequest, CreateAccountRequest, AccountExistsRequest, DeleteAccountRequest, OpenAccountRequest, IsAccountOpenRequest, CloseAccountRequest, ChangePasswordRequest, BackupAccountRequest, RestoreAccountRequest, StopRequest, NotificationMessage, RegisterNotificationListenerRequest, SendNotificationRequest, UrlConnection, AddConnectionRequest, RemoveConnectionRequest, GetConnectionRequest, GetConnectionsRequest, SetConnectionRequest, CheckConnectionRequest, CheckConnectionsRequest, StartCheckingConnectionsRequest, StopCheckingConnectionsRequest, GetBestAvailableConnectionRequest, SetAutoSwitchRequest, GetDisputeRequest, GetDisputesRequest, OpenDisputeRequest, ResolveDisputeRequest, SendDisputeChatMessageRequest, SendChatMessageRequest, GetChatMessagesRequest, StartMoneroNodeRequest, StopMoneroNodeRequest, IsMoneroNodeRunningRequest, GetMoneroNodeSettingsRequest } from "./protobuf/grpc_pb";
import { AvailabilityResult } from "./protobuf/pb_pb";
/**
* Haveno daemon client using gRPC.
* Haveno daemon client.
*/
export default class HavenoClient {
/**

5
dist/index.d.ts vendored
View File

@ -1,3 +1,6 @@
import HavenoClient from "./HavenoClient";
import HavenoUtils from "./utils/HavenoUtils";
export { HavenoClient, HavenoUtils };
export { HavenoClient };
export { HavenoUtils };
export * from "./protobuf/grpc_pb";
export * from "./protobuf/pb_pb";

7
dist/index.js vendored
View File

@ -1,4 +1,9 @@
import HavenoClient from "./HavenoClient";
import HavenoUtils from "./utils/HavenoUtils";
export { HavenoClient, HavenoUtils };
export { HavenoClient };
export { HavenoUtils };
export * from "./protobuf/grpc_pb";
export * from "./protobuf/pb_pb";
//export { GetVersionRequest, GetVersionReply, IsAppInitializedRequest, IsAppInitializedReply, RegisterDisputeAgentRequest, MarketPriceRequest, MarketPriceReply, MarketPricesRequest, MarketPricesReply, MarketPriceInfo, MarketDepthRequest, MarketDepthReply, MarketDepthInfo, GetBalancesRequest, GetBalancesReply, XmrBalanceInfo, GetMyOfferRequest, GetMyOfferReply, GetOffersRequest, GetOffersReply, OfferInfo, GetPaymentMethodsRequest, GetPaymentMethodsReply, GetPaymentAccountFormRequest, CreatePaymentAccountRequest, CreatePaymentAccountReply, GetPaymentAccountFormReply, GetPaymentAccountsRequest, GetPaymentAccountsReply, CreateCryptoCurrencyPaymentAccountRequest, CreateCryptoCurrencyPaymentAccountReply, CreateOfferRequest, CreateOfferReply, CancelOfferRequest, TakeOfferRequest, TakeOfferReply, TradeInfo, GetTradeRequest, GetTradeReply, GetTradesRequest, GetTradesReply, GetNewDepositAddressRequest, GetNewDepositAddressReply, ConfirmPaymentStartedRequest, ConfirmPaymentReceivedRequest, XmrTx, GetXmrTxsRequest, GetXmrTxsReply, XmrDestination, CreateXmrTxRequest, CreateXmrTxReply, RelayXmrTxRequest, RelayXmrTxReply, CreateAccountRequest, AccountExistsRequest, AccountExistsReply, DeleteAccountRequest, OpenAccountRequest, IsAccountOpenRequest, IsAccountOpenReply, CloseAccountRequest, ChangePasswordRequest, BackupAccountRequest, BackupAccountReply, RestoreAccountRequest, StopRequest, NotificationMessage, RegisterNotificationListenerRequest, SendNotificationRequest, UrlConnection, AddConnectionRequest, RemoveConnectionRequest, GetConnectionRequest, GetConnectionsRequest, SetConnectionRequest, CheckConnectionRequest, CheckConnectionsReply, CheckConnectionsRequest, StartCheckingConnectionsRequest, StopCheckingConnectionsRequest, GetBestAvailableConnectionRequest, SetAutoSwitchRequest, CheckConnectionReply, GetConnectionsReply, GetConnectionReply, GetBestAvailableConnectionReply, GetDisputeRequest, GetDisputeReply, GetDisputesRequest, GetDisputesReply, OpenDisputeRequest, ResolveDisputeRequest, SendDisputeChatMessageRequest, SendChatMessageRequest, GetChatMessagesRequest, GetChatMessagesReply, StartMoneroNodeRequest, StopMoneroNodeRequest, IsMoneroNodeRunningRequest, IsMoneroNodeRunningReply, GetMoneroNodeSettingsRequest, GetMoneroNodeSettingsReply } from "./protobuf/grpc_pb";
//export { PaymentMethod, PaymentAccount, AvailabilityResult, Attachment, DisputeResult, Dispute, ChatMessage, MoneroNodeSettings } from "./protobuf/pb_pb";
//# sourceMappingURL=index.js.map

2
dist/index.js.map vendored
View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,YAAY,EAAE,WAAW,EAAC,CAAA"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,WAAW,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,8vEAA8vE;AAC9vE,4JAA4J"}

File diff suppressed because it is too large Load Diff

11015
dist/protobuf/grpc_pb.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7972
dist/protobuf/pb_pb.d.ts vendored

File diff suppressed because it is too large Load Diff

26792
dist/protobuf/pb_pb.js vendored

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

38
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "haveno-ts",
"version": "0.0.1",
"version": "0.0.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "haveno-ts",
"version": "0.0.1",
"version": "0.0.2",
"license": "Apache-2.0",
"dependencies": {
"@types/node": "^17.0.30",
@ -28,7 +28,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"jest": "^26.6.0",
"monero-javascript": "^0.6.4",
"monero-javascript": "^0.7.0",
"typedoc": "^0.22.15",
"typedoc-plugin-missing-exports": "^0.22.6",
"typedoc-plugin-rename-defaults": "^0.5.1",
@ -4098,12 +4098,12 @@
}
},
"node_modules/async": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz",
"integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==",
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
"dev": true,
"dependencies": {
"lodash": "^4.17.10"
"lodash": "^4.17.14"
}
},
"node_modules/asynckit": {
@ -11056,13 +11056,13 @@
}
},
"node_modules/monero-javascript": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/monero-javascript/-/monero-javascript-0.6.4.tgz",
"integrity": "sha512-svBDjVJozEOQGxqysgSDcn1tggwS3tiEeJgGEOvzhsKasW97S/C+wBhNxGW+0J14bPVbqnhJIB0fFhcpKyn4zw==",
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/monero-javascript/-/monero-javascript-0.7.0.tgz",
"integrity": "sha512-ToKxMOUZurFgV1LGn31Jf6knIDoWuCZ4huFbfr6IsDaryh9gow+yujANb4l9ROaYlf5t0/lHKWNmR/dL7EODMg==",
"dev": true,
"dependencies": {
"ajv": "^6.12.6",
"async": "2.6.1",
"async": "2.6.4",
"crypto-js": "^4.0.0",
"html5-fs": "0.1.1",
"net": "^1.0.2",
@ -17170,12 +17170,12 @@
"dev": true
},
"async": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz",
"integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==",
"version": "2.6.4",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.4.tgz",
"integrity": "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==",
"dev": true,
"requires": {
"lodash": "^4.17.10"
"lodash": "^4.17.14"
}
},
"asynckit": {
@ -22536,13 +22536,13 @@
}
},
"monero-javascript": {
"version": "0.6.4",
"resolved": "https://registry.npmjs.org/monero-javascript/-/monero-javascript-0.6.4.tgz",
"integrity": "sha512-svBDjVJozEOQGxqysgSDcn1tggwS3tiEeJgGEOvzhsKasW97S/C+wBhNxGW+0J14bPVbqnhJIB0fFhcpKyn4zw==",
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/monero-javascript/-/monero-javascript-0.7.0.tgz",
"integrity": "sha512-ToKxMOUZurFgV1LGn31Jf6knIDoWuCZ4huFbfr6IsDaryh9gow+yujANb4l9ROaYlf5t0/lHKWNmR/dL7EODMg==",
"dev": true,
"requires": {
"ajv": "^6.12.6",
"async": "2.6.1",
"async": "2.6.4",
"crypto-js": "^4.0.0",
"html5-fs": "0.1.1",
"net": "^1.0.2",

View File

@ -1,6 +1,6 @@
{
"name": "haveno-ts",
"version": "0.0.1",
"version": "0.0.2",
"description": "Haveno TypeScript interface",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@ -8,7 +8,7 @@
"scripts": {
"prepare": "scripts/build_protobuf.sh",
"pretest": "scripts/build_protobuf.sh",
"build": "tsc",
"build": "./scripts/build_dist.sh",
"test": "jest ",
"eslint": "eslint .",
"eslintfix": "eslint src/* --fix",
@ -48,7 +48,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"jest": "^26.6.0",
"monero-javascript": "^0.6.4",
"monero-javascript": "^0.7.0",
"typedoc": "^0.22.15",
"typedoc-plugin-missing-exports": "^0.22.6",
"typedoc-plugin-rename-defaults": "^0.5.1",

11
scripts/build_dist.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# run typescript compiler
tsc
# copy protobuf models to dist
mkdir -p dist/protobuf || exit 1
cp src/protobuf/grpc_pb.d.ts dist/protobuf/grpc_pb.d.ts || exit 1
cp src/protobuf/grpc_pb.js dist/protobuf/grpc_pb.js || exit 1
cp src/protobuf/pb_pb.d.ts dist/protobuf/pb_pb.d.ts || exit 1
cp src/protobuf/pb_pb.js dist/protobuf/pb_pb.js || exit 1

View File

@ -212,13 +212,16 @@ beforeEach(async () => {
});
afterAll(async () => {
monerod.worker.terminate(); // TODO (woodser): support terminating daemon and full wallet worker, e.g. daemon.disconnect()
// release haveno processes
const promises = [];
for (const havenod of startupHavenods) {
if (havenod.getProcess()) promises.push(releaseHavenoProcess(havenod));
else promises.push(havenod.disconnect());
promises.push(havenod.getProcess() ? releaseHavenoProcess(havenod) : havenod.disconnect());
}
return Promise.all(promises);
await Promise.all(promises);
// terminate monero-javascript worker
(await monerojs.LibraryUtils.getWorker()).terminate();
});
// ----------------------------------- TESTS ----------------------------------
@ -611,7 +614,7 @@ test("Has a Monero wallet", async () => {
// get new deposit addresses
for (let i = 0; i < 0; i++) {
const address = await alice.getNewDepositAddress();
MoneroUtils.validateAddress(address, MoneroNetworkType.STAGNET);
await MoneroUtils.validateAddress(address, MoneroNetworkType.STAGNET);
}
// create withdraw tx

View File

@ -7,7 +7,7 @@ import { GetVersionRequest, GetVersionReply, IsAppInitializedRequest, IsAppIniti
import { PaymentMethod, PaymentAccount, AvailabilityResult, Attachment, DisputeResult, Dispute, ChatMessage, MoneroNodeSettings } from "./protobuf/pb_pb";
/**
* Haveno daemon client using gRPC.
* Haveno daemon client.
*/
export default class HavenoClient {

View File

@ -1,4 +1,7 @@
import HavenoClient from "./HavenoClient";
import HavenoUtils from "./utils/HavenoUtils";
export {HavenoClient, HavenoUtils}
export { HavenoClient };
export { HavenoUtils };
export * from "./protobuf/grpc_pb";
export * from "./protobuf/pb_pb";

View File

@ -22,6 +22,6 @@
"isolatedModules": true,
"jsx": "react-jsx"
},
"include": ["src"],
"include": ["src/index.ts"],
"exclude": ["node_modules", "**/*.test.ts"]
}