Skip to content

Commit

Permalink
Version beta-0.0.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
rino-releases committed Nov 15, 2023
1 parent b5d2b77 commit c72f720
Show file tree
Hide file tree
Showing 41 changed files with 4,707 additions and 627 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ARG NODE_VERSION="${NODE_VERSION:-16.20.2}"
FROM node:${NODE_VERSION}-buster-slim AS build-stage
FROM node:${NODE_VERSION}-bullseye-slim AS build-stage

WORKDIR /app
COPY . .

RUN yarn install --frozen-lockfile \
&& yarn build

FROM node:${NODE_VERSION}-buster-slim AS runtime-stage
FROM node:${NODE_VERSION}-bullseye-slim AS runtime-stage

ARG USERID=1000
RUN mkdir -p /app
Expand Down
2,241 changes: 2,241 additions & 0 deletions docs/index.html

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion nest-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"deleteOutDir": true
"deleteOutDir": true,
"plugins": ["@nestjs/swagger/plugin"]
}
}
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SDK",
"version": "0.0.1",
"version": "0.0.2",
"description": "",
"author": "",
"private": true,
Expand All @@ -20,7 +20,9 @@
"test:watch": "jest --watch --config ./src/jest-unittests.json -w 1",
"test:cov": "jest --coverage --config ./src/jest-unittests.json -w 1",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
"test:e2e": "jest --config ./test/jest-e2e.json",
"compile": "tsc",
"generate:docs": "ts-node src/generateDocs && redoc-cli bundle -o docs/index.html swagger.json && rm swagger.json"
},
"dependencies": {
"@nestjs/axios": "^2.0.0",
Expand All @@ -29,7 +31,7 @@
"@nestjs/core": "^9.0.0",
"@nestjs/platform-express": "^9.0.0",
"@nestjs/swagger": "^6.3.0",
"@rino-wallet/monero-javascript": "0.0.35",
"@rino-wallet/monero-javascript": "0.0.36",
"axios": "^1.4.0",
"class-transformer": "^0.5.1",
"joi": "^17.9.2",
Expand Down Expand Up @@ -57,6 +59,7 @@
"husky": "^8.0.3",
"jest": "29.3.1",
"prettier": "^2.3.2",
"redoc-cli": "^0.13.21",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "29.0.3",
Expand Down
29 changes: 10 additions & 19 deletions src/__mock__/http.service.mock.map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import config from "../config/test.config";
import { accountInfoMock } from "./account.info.mock";
import { walletMock } from "./wallet.mock";
import { taskResponseMock } from "./task.response.mock";
import { getResponseEntityMock } from "./response.entity.mock";
import { walletActivitiesMock } from "./wallet.activities.mock";
import { walletMembersMock } from "./wallet.members.mock";
import { walletPendingTransfersMock } from "./wallet.pending.transfers.mock";
Expand All @@ -27,33 +26,25 @@ export const httpServiceMockMap: Record<string, any> = {

[`GET /wallets/${WALLET_ID}`]: walletMock,

[`GET /wallets/${WALLET_ID}/activity`]:
getResponseEntityMock(walletActivitiesMock),
[`GET /wallets/${WALLET_ID}/activity`]: walletActivitiesMock,

[`GET /wallets/${WALLET_ID}/members`]:
getResponseEntityMock(walletMembersMock),
[`GET /wallets/${WALLET_ID}/members`]: walletMembersMock,

[`GET /wallets/${WALLET_ID}/pending_transfers`]: getResponseEntityMock(
walletPendingTransfersMock,
),
[`GET /wallets/${WALLET_ID}/pending_transfers`]: walletPendingTransfersMock,

[`GET /wallets/${WALLET_ID}/pending_transfers/${PENDING_TRANSFER_ID}`]:
walletPendingTransfersMock.find((item) => item.id === PENDING_TRANSFER_ID),
walletPendingTransfersMock.results.find(
(item) => item.id === PENDING_TRANSFER_ID,
),

[`GET /wallets/${WALLET_ID}/removed_spenders`]: getResponseEntityMock(
walletRemovedSpendersMock,
),
[`GET /wallets/${WALLET_ID}/removed_spenders`]: walletRemovedSpendersMock,

[`GET /wallets/${WALLET_ID}/subaddresses`]: getResponseEntityMock(
walletSubaddressesMock,
),
[`GET /wallets/${WALLET_ID}/subaddresses`]: walletSubaddressesMock,

[`GET /wallets/${WALLET_ID}/transactions`]: getResponseEntityMock(
walletTransactionsMock,
),
[`GET /wallets/${WALLET_ID}/transactions`]: walletTransactionsMock,

[`GET /wallets/${WALLET_ID}/transactions/${TRANSACTION_ID}`]:
walletTransactionsMock.find((item) => item.id === TRANSACTION_ID),
walletTransactionsMock.results.find((item) => item.id === TRANSACTION_ID),

[`GET /tasks/${TASK_ID}`]: taskResponseMock,

Expand Down
16 changes: 11 additions & 5 deletions src/__mock__/http.service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,17 @@ const createHttpString = (
) => {
let query = "";
if (config && config.params) {
query =
"?" +
Object.entries(config.params)
.map((entry) => entry.join("="))
.join("&");
const entries = Object.entries(config.params).filter(
([_, value]) => !!value,
);

if (entries && entries.length > 0) {
query =
"?" +
Object.entries(config.params)
.map((entry) => entry.join("="))
.join("&");
}
}
return `${method} ${url}${query}`;
};
1 change: 0 additions & 1 deletion src/__mock__/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from "./account.info.mock";
export * from "./http.service.mock";
export * from "./monero.service.mock";
export * from "./response.entity.mock";
export * from "./rino.service.mock";
export * from "./task.response.mock";
export * from "./wallet.mock";
Expand Down
2 changes: 1 addition & 1 deletion src/__mock__/monero.wallet.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const createMockMoneroSubaddresses = (
unlockedBalance: new Uint8Array(0),
numUnspentOutputs: 0,
numBlocksToUnlock: 0,
address: walletSubaddressesMock[0].address,
address: walletSubaddressesMock.results[0].address,
label: undefined,
isUsed: false,
},
Expand Down
8 changes: 0 additions & 8 deletions src/__mock__/response.entity.mock.ts

This file was deleted.

15 changes: 9 additions & 6 deletions src/__mock__/rino.service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,29 @@ export const rinoServiceMock = createMock<RinoService>({
getWalletPendingTransfers: jest.fn(() => of(walletPendingTransfersMock)),
getWalletPendingTransfer: jest.fn(() =>
of(
walletPendingTransfersMock.find(
walletPendingTransfersMock.results.find(
(item) => item.id === PENDING_TRANSFER_ID,
),
),
),
getWalletSubaddresses: jest.fn(() => of(walletSubaddressesMock)),
createWalletSubaddress: jest.fn(() => of(walletSubaddressesMock[0])),
getWalletSubaddress: jest.fn(() => of(walletSubaddressesMock.results[0])),
createWalletSubaddress: jest.fn(() => of(walletSubaddressesMock.results[0])),
updateWalletSubaddress: jest.fn(() =>
of(walletSubaddressesMock.find((item) => item.address === ADDRESS)),
of(walletSubaddressesMock.results.find((item) => item.address === ADDRESS)),
),
partialUpdateWalletSubaddress: jest.fn(() =>
of(walletSubaddressesMock.find((item) => item.address === ADDRESS)),
of(walletSubaddressesMock.results.find((item) => item.address === ADDRESS)),
),
getWalletTransactions: jest.fn(() => of(walletTransactionsMock)),
getWalletTransaction: jest.fn(() =>
of(walletTransactionsMock.find((item) => item.id === TRANSACTION_ID)),
of(
walletTransactionsMock.results.find((item) => item.id === TRANSACTION_ID),
),
),
createWalletUnsignedTransaction: jest.fn(() => of("task_id")),
submitWalletTransaction: jest.fn(() => of("task_id")),
signWalletSubaddress: jest.fn(() => of(walletSubaddressesMock[0])),
signWalletSubaddress: jest.fn(() => of(walletSubaddressesMock.results[0])),
exportTransactions: jest.fn((type) => {
let file;

Expand Down
19 changes: 16 additions & 3 deletions src/__mock__/task.response.mock.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
TaskResponseCreateTxResult,
TaskResponseEntity,
TaskResponseSubmitTxResult,
WalletTransactionSubmitResultResponse,
} from "../entities";

export const taskResponseMock: TaskResponseEntity = {
Expand All @@ -26,9 +26,10 @@ export const taskResponseCreateTxResultMock: TaskResponseCreateTxResult = {
multisig_hex: "string",
};

export const taskResponseSubmitTxResultMock: TaskResponseSubmitTxResult = {
export const submitResultMock: WalletTransactionSubmitResultResponse = {
created_at: "string",
updated_at: "string",
wallet_id: "string",
txid: "string",
amount: "string",
timestamp: "string",
Expand All @@ -42,5 +43,17 @@ export const taskResponseSubmitTxResultMock: TaskResponseSubmitTxResult = {
ip_addr: "string",
euro_amount: "string",
destinations: [],
wallet: "wallet",
wallet: {
created_at: "string",
updated_at: "string",
id: "string",
balance: "string",
unlocked_balance: "string",
creation_height: 0,
height: "string",
last_interaction_at: "string",
last_sync_at: "string",
address: "string",
status: "string",
},
};
Loading

0 comments on commit c72f720

Please sign in to comment.