Skip to content

Commit

Permalink
fixes for wallet rpc and update version
Browse files Browse the repository at this point in the history
  • Loading branch information
elvece committed Oct 31, 2024
1 parent c6b7209 commit 4ed639d
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 179 deletions.
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM btcpayserver/monero:0.18.3.3 AS monero-wallet-rpc
FROM --platform=$BUILDPLATFORM btcpayserver/monero:0.18.3.3 AS monero-wallet-rpc

FROM nicolasdorier/nbxplorer:2.5.5 AS nbx-builder
FROM nicolasdorier/nbxplorer:2.5.9 AS nbx-builder

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS actions-builder
ARG TARGETARCH
Expand All @@ -10,7 +10,7 @@ RUN dotnet restore "utils/actions/actions.csproj" -a $TARGETARCH
WORKDIR "/actions"
RUN dotnet build "utils/actions/actions.csproj" -c Release -a $TARGETARCH -o /actions/build

FROM --platform=$BUILDPLATFORM btcpayserver/btcpayserver:1.13.5-altcoins
FROM --platform=$BUILDPLATFORM btcpayserver/btcpayserver:2.0.0-altcoins

COPY --from=nbx-builder "/app" /nbxplorer
COPY --from=actions-builder "/actions/build" /actions
Expand All @@ -36,7 +36,6 @@ RUN apt-get update \
&& apt-get clean autoclean \
&& rm -rf /var/lib/apt/lists/*


# install S6 overlay for proces mgmt
# https://github.com/just-containers/s6-overlay
ARG S6_OVERLAY_VERSION=3.1.2.1
Expand Down
2 changes: 1 addition & 1 deletion manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id: btcpayserver
title: BTCPay Server
version: 1.13.5.1
version: 2.0.0.1
release-notes: |
* Adds optional Monero integration for payment processing
license: mit
Expand Down
28 changes: 0 additions & 28 deletions scripts/migrations/1_13_5_1_down_migration.ts

This file was deleted.

35 changes: 0 additions & 35 deletions scripts/migrations/1_13_5_1_up_migration.ts

This file was deleted.

30 changes: 30 additions & 0 deletions scripts/migrations/2_0_0_1_down_migration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { types as T, matches } from "../deps.ts";

const { shape, string } = matches;

export const migration_down_2_0_0_1 = (config: T.Config): T.Config => {
if (Object.keys(config).length === 0) {
// service was never configured
return config;
}

const matchAltcoinConfig = shape(
{
altcoins: shape({
monero: shape({
status: string,
}),
}),
},
["altcoins"]
);

if (!matchAltcoinConfig.test(config)) {
throw `Incorrect shape for config: ${matchAltcoinConfig.errorMessage(config)}`;
}

if (config.altcoins) {
delete config.altcoins;
}
return config;
};
34 changes: 34 additions & 0 deletions scripts/migrations/2_0_0_1_up_migration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { types as T, matches } from "../deps.ts";

const { shape, string } = matches;

export const migration_up_2_0_0_1 = (config: T.Config): T.Config => {
if (Object.keys(config).length === 0) {
// service was never configured
return config;
}

const altcoinsConfig = shape({
monero: shape({
status: string,
}),
});

const matchConfigWithAltcoins = shape({
altcoins: altcoinsConfig,
});

if (!matchConfigWithAltcoins.test(config)) {
const newAltcoinsConfig: typeof altcoinsConfig._TYPE = {
monero: {
status: "disabled",
},
};
return {
...config,
altcoins: newAltcoinsConfig,
};
} else {
return config;
}
};
127 changes: 64 additions & 63 deletions scripts/procedures/migrations.ts
Original file line number Diff line number Diff line change
@@ -1,71 +1,72 @@
import { types as T, compat } from "../deps.ts"
import { types as T, compat } from "../deps.ts";
import { migration_up_1_4_7 } from "../migrations/1_4_7_up_migration.ts";
import { migration_down_1_4_7 } from "../migrations/1_4_7_down_migration.ts";
import { migration_up_1_10_3 } from "../migrations/1_10_3_up_migration.ts";
import { migration_up_1_13_5_1 } from "../migrations/1_13_5_1_up_migration.ts";
import { migration_down_1_13_5_1 } from "../migrations/1_13_5_1_down_migration.ts";
import { migration_up_2_0_0_1 } from "../migrations/2_0_0_1_up_migration.ts";
import { migration_down_2_0_0_1 } from "../migrations/2_0_0_1_down_migration.ts";

export const migration: T.ExpectedExports.migration = async (effects, version, ...args) => {
export const migration: T.ExpectedExports.migration = async (
effects,
version,
...args
) => {
await effects.createDir({
path: "start9",
volumeId: "main"
volumeId: "main",
});
return compat.migrations
.fromMapping(
{
// 1.1.2.5: initial (updated) version released with eOS 0.3.0 - bitcoin config was internal (proxy) or external
"1.4.7.1": {
up: compat.migrations.updateConfig(
(config) => {
return migration_up_1_4_7(config)
},
false,
{ version: "1.4.7.1", type: "up" },
),
down: compat.migrations.updateConfig(
(config) => {
return migration_down_1_4_7(config)
},
true,
{ version: "1.4.7.1", type: "down" },
),
},
// 1.4.7.3: JS config/properties conversion occurred
"1.10.2": {
up: compat.migrations.updateConfig(
(config) => {
return migration_up_1_10_3(config)
},
true,
{ version: "1.10.2", type: "up"}
),
down: compat.migrations.updateConfig(
(_config) => {
throw new Error(
"Cannot downgrade this version"
)
},
true,
{ version: "1.10.2", type: "down" },
),
},
"1.13.5.1": {
up: compat.migrations.updateConfig(
(config) => {
return migration_up_1_13_5_1(config)
},
true,
{ version: "1.13.5.1", type: "up"}
),
down: compat.migrations.updateConfig(
(config) => {
return migration_down_1_13_5_1(config)
},
true,
{ version: "1.13.5.1", type: "down" },
),
},
return compat.migrations.fromMapping(
{
// 1.1.2.5: initial (updated) version released with eOS 0.3.0 - bitcoin config was internal (proxy) or external
"1.4.7.1": {
up: compat.migrations.updateConfig(
(config) => {
return migration_up_1_4_7(config);
},
false,
{ version: "1.4.7.1", type: "up" }
),
down: compat.migrations.updateConfig(
(config) => {
return migration_down_1_4_7(config);
},
true,
{ version: "1.4.7.1", type: "down" }
),
},
"1.13.5.1",
)(effects, version, ...args)
}
// 1.4.7.3: JS config/properties conversion occurred
"1.10.2": {
up: compat.migrations.updateConfig(
(config) => {
return migration_up_1_10_3(config);
},
true,
{ version: "1.10.2", type: "up" }
),
down: compat.migrations.updateConfig(
(_config) => {
throw new Error("Cannot downgrade this version");
},
true,
{ version: "1.10.2", type: "down" }
),
},
"2.0.0.1": {
up: compat.migrations.updateConfig(
(config) => {
return migration_up_2_0_0_1(config);
},
true,
{ version: "2.0.0.1", type: "up" }
),
down: compat.migrations.updateConfig(
(config) => {
return migration_down_2_0_0_1(config);
},
true,
{ version: "2.0.0.1", type: "down" }
),
},
},
"2.0.0.1"
)(effects, version, ...args);
};
3 changes: 2 additions & 1 deletion utils/config/monero-wallet-rpc.btcpayserver.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ rpc-bind-port=MONERO_BTCPAY_WALLET_RPC_PORT

shared-ringdb-dir=MONERO_DIR

MONERO_DAEMON_RPC_CREDENTIALS
# if empty, placeholder for if/when monerod rpc credentials are enabled
#daemon-login=

tx-notify=/usr/bin/curl -so /dev/null -X GET http://127.0.0.1:23000/monerolikedaemoncallback/tx?cryptoCode=xmr&hash=%s
Loading

0 comments on commit 4ed639d

Please sign in to comment.