fix
This commit is contained in:
parent
15187227e9
commit
aa27f4ff18
@ -11,12 +11,12 @@ RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg -
|
||||
apt update && apt install -y nodejs
|
||||
|
||||
# laconic-so
|
||||
#RUN curl -LO https://git.vdb.to/cerc-io/stack-orchestrator/releases/download/latest/laconic-so && \
|
||||
# chmod +x ./laconic-so && \
|
||||
# mv ./laconic-so /usr/bin/laconic-so
|
||||
RUN curl -LO https://git.vdb.to/cerc-io/stack-orchestrator/releases/download/latest/laconic-so && \
|
||||
chmod +x ./laconic-so && \
|
||||
mv ./laconic-so /usr/bin/laconic-so
|
||||
|
||||
# for testing, put so in the root of this repo prior to running `build-containers`
|
||||
COPY laconic-so /usr/bin/laconic-so
|
||||
#COPY laconic-so /usr/bin/laconic-so
|
||||
|
||||
# laconic-registry-cli
|
||||
RUN npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ && \
|
||||
|
@ -36,7 +36,7 @@
|
||||
"author": "Jakub Synowiec <jsynowiec@users.noreply.github.com>",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@cerc-io/laconic-sdk": "^0.1.15",
|
||||
"@cerc-io/registry-sdk": "^0.2.11",
|
||||
"@openpgp/web-stream-tools": "^0.1.3",
|
||||
"axios": "^1.6.7",
|
||||
"body-parser": "^1.20.2",
|
||||
|
@ -1,9 +1,8 @@
|
||||
import {getRegistry, Config} from './config.js';
|
||||
import {getRegistry} from './config.js';
|
||||
import {Registry} from '@cerc-io/registry-sdk';
|
||||
|
||||
import stringify from 'json-stable-stringify';
|
||||
import {createHash} from 'crypto';
|
||||
import {verifyAtomPayment} from './atomPayments.js';
|
||||
|
||||
function generateHostnameForApp(app) {
|
||||
const lastPart = app.attributes.name.split('/').pop();
|
||||
|
@ -122,68 +122,17 @@ class PaymentProcessor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify LNT payment using existing laconic registry
|
||||
* Verify LNT payment - delegated to stack-orchestrator
|
||||
* Since stack-orchestrator already handles LNT verification efficiently,
|
||||
* we only need to handle ATOM verification here
|
||||
*/
|
||||
private async verifyLNTPayment(txHash: string, request: any): Promise<VerificationResult> {
|
||||
try {
|
||||
// Use the registry from regHelper to get transaction
|
||||
const registry = getRegistry();
|
||||
const tx = await registry.getTx(txHash);
|
||||
|
||||
if (!tx) {
|
||||
// LNT verification is handled by stack-orchestrator
|
||||
// We assume if it's not an ATOM payment, stack-orchestrator will handle it
|
||||
return {
|
||||
valid: false,
|
||||
reason: 'Transaction not found in laconic registry'
|
||||
};
|
||||
}
|
||||
|
||||
if (tx.code !== 0) {
|
||||
return {
|
||||
valid: false,
|
||||
reason: `Transaction failed with code ${tx.code}: ${tx.log}`
|
||||
};
|
||||
}
|
||||
|
||||
// Get the deployer record to check payment address
|
||||
const deployer = await this.regHelper.getRecord(request.attributes.deployer);
|
||||
if (!deployer) {
|
||||
return {
|
||||
valid: false,
|
||||
reason: 'Deployer record not found'
|
||||
};
|
||||
}
|
||||
|
||||
const paymentAddress = deployer.attributes.paymentAddress;
|
||||
const minPayment = parseInt(deployer.attributes.minimumPayment?.replace(/[^0-9]/g, '') || '0');
|
||||
|
||||
if (tx.recipient !== paymentAddress) {
|
||||
return {
|
||||
valid: false,
|
||||
reason: `Payment recipient ${tx.recipient} does not match deployer payment address ${paymentAddress}`
|
||||
};
|
||||
}
|
||||
|
||||
const payDenom = tx.amount.replace(/[0-9]/g, '');
|
||||
if (payDenom !== 'alnt') {
|
||||
return {
|
||||
valid: false,
|
||||
reason: `Payment denomination ${payDenom} is not 'alnt'`
|
||||
};
|
||||
}
|
||||
|
||||
const payAmount = parseInt(tx.amount.replace(/[^0-9]/g, ''));
|
||||
if (payAmount < minPayment) {
|
||||
return {
|
||||
valid: false,
|
||||
reason: `Payment amount ${payAmount} is less than minimum ${minPayment}`
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
valid: true,
|
||||
amount: tx.amount,
|
||||
sender: tx.sender,
|
||||
chainUsed: 'LNT'
|
||||
reason: 'LNT verification delegated to stack-orchestrator'
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
@ -359,6 +308,7 @@ class PaymentProcessor {
|
||||
// });
|
||||
// }
|
||||
|
||||
console.log(`Configured ${configs.length} payment chains`);
|
||||
return configs;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user