@render-foundation/utils 0.0.256 → 0.0.258
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/client/dispersed.js.map +1 -1
- package/lib/cjs/client/pg/base.js.map +1 -1
- package/lib/cjs/client/pg/v2Client.js +121 -89
- package/lib/cjs/client/pg/v2Client.js.map +1 -1
- package/lib/esm/src/client/dispersed.js.map +1 -1
- package/lib/esm/src/client/pg/base.js.map +1 -1
- package/lib/esm/src/client/pg/v2Client.js +107 -74
- package/lib/esm/src/client/pg/v2Client.js.map +1 -1
- package/lib/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/types/src/client/dispersed.d.ts +0 -3
- package/lib/types/src/client/dispersed.d.ts.map +1 -1
- package/lib/types/src/client/pg/base.d.ts +5 -1
- package/lib/types/src/client/pg/base.d.ts.map +1 -1
- package/lib/types/src/client/pg/v2Client.d.ts +1 -8
- package/lib/types/src/client/pg/v2Client.d.ts.map +1 -1
- package/lib/types/src/dbTypesV2.d.ts +0 -9
- package/lib/types/src/dbTypesV2.d.ts.map +1 -1
- package/lib/types/src/index.d.ts +1 -1
- package/lib/types/src/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispersed.js","sourceRoot":"","sources":["../../../src/client/dispersed.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAAuD;AACvD,4DAA8B;AAE9B;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,MAAM,GACV,kEAAkE,CAAA;AAEpE,sDAAsD;AACtD,MAAM,uBAAuB,GAAG,KAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"dispersed.js","sourceRoot":"","sources":["../../../src/client/dispersed.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAAuD;AACvD,4DAA8B;AAE9B;;;;;;;;;;GAUG;AAEH,+DAA+D;AAC/D,MAAM,MAAM,GACV,k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M,CAAA;YACf,CAAC;SAAA;KACF,CAAA;AACH,CAAC,CAAA;AAxGY,QAAA,eAAe,mBAwG3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/client/pg/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,2BAA6C;AAE7C,yCACC;AAAC,MAAM,CAAC,SAAiB,CAAC,MAAM,GAAG;IAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAA;AACxB,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/client/pg/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,2BAA6C;AAE7C,yCACC;AAAC,MAAM,CAAC,SAAiB,CAAC,MAAM,GAAG;IAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAA;AACxB,CAAC,CAAA;AAmED,MAAa,QAAQ;IAMnB;QALS,oCAAoB;QAE7B,oCAA8C;QAC9C,mCAAgC;QAahC,YAAO,GAAG,CAAC,KAAyB,EAAQ,EAAE;YAC5C,IAAI,uBAAA,IAAI,yBAAS,EAAE;gBACjB,uBAAA,IAAI,yBAAS,MAAb,IAAI,EAAU,KAAK,CAAC,CAAA;aACrB;QACH,CAAC,CAAA;QAED,WAAM,GAAG,CAAC,MAAY,EAAQ,EAAE;YAC9B,IAAI,uBAAA,IAAI,wBAAQ,EAAE;gBAChB,uBAAA,IAAI,wBAAQ,MAAZ,IAAI,EAAS,MAAM,CAAC,CAAA;aACrB;QACH,CAAC,CAAA;QApBC,uBAAA,IAAI,qBAAY,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACjD,uBAAA,IAAI,oBAAW,MAAM,MAAA,CAAA;YACrB,uBAAA,IAAI,qBAAY,OAAO,MAAA,CAAA;QACzB,CAAC,CAAC,MAAA,CAAA;IACJ,CAAC;IAED,IAAI,OAAO;QACT,OAA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AAG,MAAA,WAAW,CAAC,MAAM,mCAAI,EAAE,CAAA;YACjC,EAAE,GAAG,MAAM,CAAA,CAAC,2BAA2B;SACxC;QAED,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;QAEhE,IAAI,EAAE,EAAE;YACN,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;YACxC,oDAAoD;YACpD,OAAM;SACP;QACD,OAAO,CAAC,CAAA;IACV,CAAC,CAGA;IAAC,IAAY,CAAC,UAAU,GAAG,SAAS,CAAA;AACvC,CAAC;AA1CD,wDA0CC"}
|
|
@@ -1558,7 +1558,7 @@ const pgClient = (config) => {
|
|
|
1558
1558
|
});
|
|
1559
1559
|
},
|
|
1560
1560
|
fetchBurns(db, f, log = logger_1.consoleLogger) {
|
|
1561
|
-
var _a, _b;
|
|
1561
|
+
var _a, _b, _c;
|
|
1562
1562
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1563
1563
|
let q = db.trx
|
|
1564
1564
|
.selectFrom('burn')
|
|
@@ -1606,6 +1606,7 @@ const pgClient = (config) => {
|
|
|
1606
1606
|
eurToUsdc: r.eur_to_usdc,
|
|
1607
1607
|
markedBurnedAt: r.marked_burned_at,
|
|
1608
1608
|
tags: r.tags ? r.tags.split(',') : [],
|
|
1609
|
+
fromEscrowUsdc: BigInt((_c = r.from_escrow_usdc) !== null && _c !== void 0 ? _c : 0),
|
|
1609
1610
|
});
|
|
1610
1611
|
burnIdToIdx[r.id] = burns.length - 1;
|
|
1611
1612
|
}
|
|
@@ -1631,75 +1632,138 @@ const pgClient = (config) => {
|
|
|
1631
1632
|
fetchBurnsPage(db, f, log = logger_1.consoleLogger) {
|
|
1632
1633
|
var _a;
|
|
1633
1634
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1636
|
-
.
|
|
1637
|
-
.
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
if (f.
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1635
|
+
const params = [];
|
|
1636
|
+
const p = (v) => {
|
|
1637
|
+
params.push(v);
|
|
1638
|
+
return `$${params.length}`;
|
|
1639
|
+
};
|
|
1640
|
+
// Decode cursor — supports new {t,id,ea} format and legacy bare-id format.
|
|
1641
|
+
let cursorEa;
|
|
1642
|
+
let cursorType;
|
|
1643
|
+
let cursorId;
|
|
1644
|
+
if (f.cursor) {
|
|
1645
|
+
const raw = atob(f.cursor);
|
|
1646
|
+
try {
|
|
1647
|
+
const c = JSON.parse(raw);
|
|
1648
|
+
cursorEa = c.ea;
|
|
1649
|
+
cursorType = c.t;
|
|
1650
|
+
cursorId = c.id;
|
|
1651
|
+
}
|
|
1652
|
+
catch (_b) {
|
|
1653
|
+
// Legacy cursor: bare burn.id — treat as buy-burn cursor.
|
|
1654
|
+
cursorId = Number(raw);
|
|
1655
|
+
cursorType = 'buy';
|
|
1656
|
+
}
|
|
1652
1657
|
}
|
|
1658
|
+
// Shared WHERE fragments pushed into each union leg for index use.
|
|
1659
|
+
const dateFilters = [];
|
|
1660
|
+
if (f.executedAfter)
|
|
1661
|
+
dateFilters.push(`st.executed_at >= ${p(f.executedAfter)}`);
|
|
1662
|
+
if (f.executedBefore)
|
|
1663
|
+
dateFilters.push(`st.executed_at <= ${p(f.executedBefore)}`);
|
|
1664
|
+
const sigFilter = f.sig ? `st.sig = ${p(f.sig)}` : '';
|
|
1665
|
+
// Buy-burn leg
|
|
1666
|
+
const buyWhere = [...dateFilters];
|
|
1667
|
+
if (!f.inclManual)
|
|
1668
|
+
buyWhere.push('b.usdc_spent > 0');
|
|
1669
|
+
if (sigFilter)
|
|
1670
|
+
buyWhere.push(sigFilter);
|
|
1653
1671
|
if (f.jobId !== undefined) {
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1672
|
+
buyWhere.push(`b.id IN (SELECT burn_id FROM job WHERE id = ${p(f.jobId)})`);
|
|
1673
|
+
}
|
|
1674
|
+
const buyWhereClause = buyWhere.length ? `WHERE ${buyWhere.join(' AND ')}` : '';
|
|
1675
|
+
const buySql = `
|
|
1676
|
+
SELECT 'buy'::text AS type, b.id::bigint AS sortid, b.id AS id,
|
|
1677
|
+
st.executed_at, st.executed_at::text AS executed_at_raw, b.priced_at, b.burned::text AS burned,
|
|
1678
|
+
b.usdc_spent::text AS usdc_spent, b.quote_amt::text AS quote_amt,
|
|
1679
|
+
b.tags, st.sig, b.render_to_usdc, b.eur_to_usdc,
|
|
1680
|
+
coalesce(b.from_escrow_usdc, 0)::text AS from_escrow_usdc,
|
|
1681
|
+
b.down_correction_id, b.escrow_correction_id,
|
|
1682
|
+
b.marked_burned_at
|
|
1683
|
+
FROM burn b
|
|
1684
|
+
INNER JOIN sol_tx st ON st.id = b.sol_tx_id
|
|
1685
|
+
${buyWhereClause}`;
|
|
1686
|
+
// Grant-burn leg
|
|
1687
|
+
const grantWhere = [...dateFilters];
|
|
1688
|
+
if (sigFilter)
|
|
1689
|
+
grantWhere.push(sigFilter);
|
|
1690
|
+
if (f.jobId !== undefined) {
|
|
1691
|
+
grantWhere.push(`gb.id IN (SELECT grant_burn_id FROM job WHERE id = ${p(f.jobId)})`);
|
|
1692
|
+
}
|
|
1693
|
+
const grantWhereClause = grantWhere.length ? `WHERE ${grantWhere.join(' AND ')}` : '';
|
|
1694
|
+
const grantSql = `
|
|
1695
|
+
SELECT 'grant'::text AS type, gb.id::bigint AS sortid, gb.id AS id,
|
|
1696
|
+
st.executed_at, st.executed_at::text AS executed_at_raw, null::timestamp AS priced_at, gb.burned::text AS burned,
|
|
1697
|
+
'0' AS usdc_spent, '0' AS quote_amt,
|
|
1698
|
+
gb.tags, st.sig, null::float8 AS render_to_usdc, null::float8 AS eur_to_usdc,
|
|
1699
|
+
'0' AS from_escrow_usdc,
|
|
1700
|
+
null::bigint AS down_correction_id, null::bigint AS escrow_correction_id,
|
|
1701
|
+
gb.marked_burned_at
|
|
1702
|
+
FROM grant_burn gb
|
|
1703
|
+
INNER JOIN sol_tx st ON st.id = gb.sol_tx_id
|
|
1704
|
+
${grantWhereClause}`;
|
|
1705
|
+
// Cursor filter on the outer query — row comparison for deterministic paging.
|
|
1706
|
+
let cursorFilter = '';
|
|
1707
|
+
if (cursorEa && cursorType && cursorId !== undefined) {
|
|
1708
|
+
cursorFilter = `WHERE (u.executed_at, u.type, u.sortid) > (${p(cursorEa)}, ${p(cursorType)}, ${p(cursorId)})`;
|
|
1709
|
+
}
|
|
1710
|
+
else if (cursorId !== undefined) {
|
|
1711
|
+
// Legacy cursor fallback: only buy burns, ordered by id.
|
|
1712
|
+
cursorFilter = `WHERE u.type = 'buy' AND u.sortid > ${p(cursorId)}`;
|
|
1664
1713
|
}
|
|
1665
1714
|
const limit = (_a = f.limit) !== null && _a !== void 0 ? _a : 1000;
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1715
|
+
const sql = `
|
|
1716
|
+
SELECT u.* FROM (
|
|
1717
|
+
${buySql}
|
|
1718
|
+
UNION ALL
|
|
1719
|
+
${grantSql}
|
|
1720
|
+
) u
|
|
1721
|
+
${cursorFilter}
|
|
1722
|
+
ORDER BY u.executed_at ASC, u.type, u.sortid
|
|
1723
|
+
LIMIT ${p(limit)}`;
|
|
1724
|
+
const { rows } = yield (0, base_1.timedQuery)(pgPool, sql, params, 'fetchBurnsPage', log);
|
|
1669
1725
|
const burns = rows.map((r) => {
|
|
1670
|
-
var _a, _b;
|
|
1726
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1671
1727
|
return ({
|
|
1672
1728
|
jobs: [],
|
|
1673
1729
|
id: Number(r.id),
|
|
1674
|
-
|
|
1730
|
+
type: r.type,
|
|
1731
|
+
renderToUsdc: (_a = r.render_to_usdc) !== null && _a !== void 0 ? _a : undefined,
|
|
1675
1732
|
solTx: r.sig,
|
|
1676
1733
|
executedAt: r.executed_at,
|
|
1677
|
-
pricedAt: r.priced_at,
|
|
1678
|
-
usdcSpent: BigInt((
|
|
1679
|
-
quoteAmt: BigInt((
|
|
1734
|
+
pricedAt: (_b = r.priced_at) !== null && _b !== void 0 ? _b : undefined,
|
|
1735
|
+
usdcSpent: BigInt((_c = r.usdc_spent) !== null && _c !== void 0 ? _c : 0),
|
|
1736
|
+
quoteAmt: BigInt((_d = r.quote_amt) !== null && _d !== void 0 ? _d : 0),
|
|
1680
1737
|
burned: BigInt(r.burned),
|
|
1681
|
-
eurToUsdc: r.eur_to_usdc,
|
|
1738
|
+
eurToUsdc: (_e = r.eur_to_usdc) !== null && _e !== void 0 ? _e : undefined,
|
|
1682
1739
|
markedBurnedAt: r.marked_burned_at,
|
|
1683
1740
|
tags: r.tags ? r.tags.split(',') : [],
|
|
1741
|
+
fromEscrowUsdc: BigInt((_f = r.from_escrow_usdc) !== null && _f !== void 0 ? _f : 0),
|
|
1742
|
+
downCorrectionId: r.down_correction_id ? Number(r.down_correction_id) : undefined,
|
|
1743
|
+
escrowCorrectionId: r.escrow_correction_id ? Number(r.escrow_correction_id) : undefined,
|
|
1684
1744
|
});
|
|
1685
1745
|
});
|
|
1686
1746
|
return {
|
|
1687
1747
|
burns,
|
|
1688
|
-
// Only hand back a cursor on a full page; a short page means we're done.
|
|
1689
1748
|
cursor: burns.length === limit
|
|
1690
|
-
? btoa(
|
|
1749
|
+
? btoa(JSON.stringify({
|
|
1750
|
+
ea: rows[burns.length - 1].executed_at_raw,
|
|
1751
|
+
t: rows[burns.length - 1].type,
|
|
1752
|
+
id: rows[burns.length - 1].sortid,
|
|
1753
|
+
}))
|
|
1691
1754
|
: undefined,
|
|
1692
1755
|
};
|
|
1693
1756
|
});
|
|
1694
1757
|
},
|
|
1695
|
-
fetchBurnJobs(db, burnId, log = logger_1.consoleLogger) {
|
|
1758
|
+
fetchBurnJobs(db, burnId, burnType = 'buy', log = logger_1.consoleLogger) {
|
|
1696
1759
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1760
|
+
const fk = burnType === 'grant' ? 'grant_burn_id' : 'burn_id';
|
|
1697
1761
|
const rows = yield db.trx
|
|
1698
1762
|
.selectFrom('job')
|
|
1699
1763
|
.selectAll('job')
|
|
1700
|
-
.where(
|
|
1764
|
+
.where(fk, '=', String(burnId))
|
|
1701
1765
|
.execute();
|
|
1702
|
-
log.debug(`fetchBurnJobs
|
|
1766
|
+
log.debug(`fetchBurnJobs ${burnType} ${burnId} -> ${rows.length} jobs`);
|
|
1703
1767
|
return rows.map((r) => ({
|
|
1704
1768
|
id: Number(r.id),
|
|
1705
1769
|
completedAt: r.completed_at,
|
|
@@ -1722,8 +1786,8 @@ const pgClient = (config) => {
|
|
|
1722
1786
|
.innerJoin('sol_tx', 'sol_tx.id', 'burn.sol_tx_id')
|
|
1723
1787
|
.select(({ fn }) => [
|
|
1724
1788
|
dayExpr.as('day'),
|
|
1725
|
-
|
|
1726
|
-
|
|
1789
|
+
(0, kysely_1.sql) `SUM(burn.burned + CASE WHEN COALESCE(burn.from_escrow_usdc, 0) > 0 AND burn.render_to_usdc > 0 THEN (burn.from_escrow_usdc::numeric / burn.render_to_usdc * 100)::bigint ELSE 0 END)`.as('render_burned'),
|
|
1790
|
+
(0, kysely_1.sql) `SUM(burn.usdc_spent + COALESCE(burn.from_escrow_usdc, 0))`.as('usdc_spent'),
|
|
1727
1791
|
fn.count('burn.id').as('burn_count'),
|
|
1728
1792
|
])
|
|
1729
1793
|
.groupBy((0, kysely_1.sql) `date_trunc('day', sol_tx.executed_at)`)
|
|
@@ -2022,23 +2086,7 @@ const pgClient = (config) => {
|
|
|
2022
2086
|
});
|
|
2023
2087
|
},
|
|
2024
2088
|
insertDispersedOutbox(p, log = logger_1.consoleLogger) {
|
|
2025
|
-
var _a;
|
|
2026
2089
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2027
|
-
// Check if dispersed_obligation table exists BEFORE the transaction so a missing table never
|
|
2028
|
-
// poisons the txn (PG aborts the entire transaction on any error, even a caught one).
|
|
2029
|
-
let hasObligationTable = false;
|
|
2030
|
-
if ((_a = p.obligations) === null || _a === void 0 ? void 0 : _a.length) {
|
|
2031
|
-
try {
|
|
2032
|
-
const { rows } = yield (0, base_1.timedQuery)(pgPool, `SELECT 1 FROM information_schema.tables WHERE table_name = 'dispersed_obligation' LIMIT 1`, [], 'checkObligationTable', log);
|
|
2033
|
-
hasObligationTable = rows.length > 0;
|
|
2034
|
-
}
|
|
2035
|
-
catch (_b) {
|
|
2036
|
-
hasObligationTable = false;
|
|
2037
|
-
}
|
|
2038
|
-
if (!hasObligationTable) {
|
|
2039
|
-
log.warn(`dispersed obligations: table not found (migration 44 pending); skipping for tx ${p.txSignature}`);
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
2090
|
// The outbox row is the durable, crash-safe anchor persisted BEFORE broadcast. When it carries a
|
|
2043
2091
|
// burn-correction draw, we increment consumed_render in the SAME transaction as the insert, bounded
|
|
2044
2092
|
// so it can never exceed amount_render. Row + counter are therefore atomic and inseparable: no
|
|
@@ -2046,8 +2094,8 @@ const pgClient = (config) => {
|
|
|
2046
2094
|
// (decremented again by voidDispersedOutbox). If the bounded increment can't fit (a concurrent draw
|
|
2047
2095
|
// took the room), the whole txn rolls back and we return {inserted:false} — the caller must NOT
|
|
2048
2096
|
// broadcast (no row, no counter change, no burn).
|
|
2049
|
-
|
|
2050
|
-
var _c, _d, _e, _f, _g, _h, _j
|
|
2097
|
+
return yield db.transaction().execute((trx) => __awaiter(this, void 0, void 0, function* () {
|
|
2098
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2051
2099
|
const res = yield trx
|
|
2052
2100
|
.insertInto(exports.DISPERSED_SETTLEMENT_TABLE)
|
|
2053
2101
|
.values({
|
|
@@ -2057,17 +2105,17 @@ const pgClient = (config) => {
|
|
|
2057
2105
|
settled_amount: p.settledAmount,
|
|
2058
2106
|
burned_amount: p.burnedAmount,
|
|
2059
2107
|
executed_at: p.executedAt,
|
|
2060
|
-
eur_render: (
|
|
2061
|
-
last_valid_block_height: (
|
|
2062
|
-
usdc_spent: (
|
|
2063
|
-
correction_id: (
|
|
2064
|
-
correction_render: (
|
|
2065
|
-
usage_from: (
|
|
2066
|
-
usage_to: (
|
|
2108
|
+
eur_render: (_a = p.eurRender) !== null && _a !== void 0 ? _a : null,
|
|
2109
|
+
last_valid_block_height: (_b = p.lastValidBlockHeight) !== null && _b !== void 0 ? _b : null,
|
|
2110
|
+
usdc_spent: (_c = p.usdcSpent) !== null && _c !== void 0 ? _c : null,
|
|
2111
|
+
correction_id: (_d = p.correctionId) !== null && _d !== void 0 ? _d : null,
|
|
2112
|
+
correction_render: (_e = p.correctionRender) !== null && _e !== void 0 ? _e : null,
|
|
2113
|
+
usage_from: (_f = p.usageFrom) !== null && _f !== void 0 ? _f : null,
|
|
2114
|
+
usage_to: (_g = p.usageTo) !== null && _g !== void 0 ? _g : null,
|
|
2067
2115
|
})
|
|
2068
2116
|
.onConflict((oc) => oc.column('tx_signature').doNothing())
|
|
2069
2117
|
.executeTakeFirst();
|
|
2070
|
-
const inserted = ((
|
|
2118
|
+
const inserted = ((_h = res.numInsertedOrUpdatedRows) !== null && _h !== void 0 ? _h : BigInt(0)) > BigInt(0);
|
|
2071
2119
|
// Only reserve when the row was actually inserted (a tx_signature conflict is a no-op → no double
|
|
2072
2120
|
// count) and it drew a correction.
|
|
2073
2121
|
if (inserted &&
|
|
@@ -2082,35 +2130,19 @@ const pgClient = (config) => {
|
|
|
2082
2130
|
.where('id', '=', String(p.correctionId))
|
|
2083
2131
|
.where((eb) => eb((0, kysely_1.sql) `consumed_render + ${p.correctionRender}::numeric`, '<=', eb.ref('amount_render')))
|
|
2084
2132
|
.executeTakeFirst();
|
|
2085
|
-
if (((
|
|
2133
|
+
if (((_j = upd.numUpdatedRows) !== null && _j !== void 0 ? _j : BigInt(0)) === BigInt(0)) {
|
|
2086
2134
|
// Would exceed amount_render (concurrent draw won the room) — roll back the whole txn.
|
|
2087
2135
|
log.warn(`dispersed correction ${p.correctionId}: draw ${p.correctionRender} would over-consume; rejecting outbox insert for tx ${p.txSignature}`);
|
|
2088
2136
|
throw new DispersedCorrectionRejected();
|
|
2089
2137
|
}
|
|
2090
2138
|
}
|
|
2091
|
-
|
|
2092
|
-
for (const o of p.obligations) {
|
|
2093
|
-
yield trx
|
|
2094
|
-
.insertInto('dispersed_obligation')
|
|
2095
|
-
.values({
|
|
2096
|
-
settlement_tx_sig: p.txSignature,
|
|
2097
|
-
uuid: o.uuid,
|
|
2098
|
-
amount_eur: o.amountEur,
|
|
2099
|
-
opened_at: o.openedAt,
|
|
2100
|
-
authorization_uuid: (_o = o.authorizationUuid) !== null && _o !== void 0 ? _o : null,
|
|
2101
|
-
})
|
|
2102
|
-
.onConflict((oc) => oc.column('uuid').doNothing())
|
|
2103
|
-
.execute();
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
log.debug(`dispersed outbox tx ${p.txSignature}: ${res.numInsertedOrUpdatedRows} row(s), ${hasObligationTable ? ((_q = (_p = p.obligations) === null || _p === void 0 ? void 0 : _p.length) !== null && _q !== void 0 ? _q : 0) : 0} obligations`);
|
|
2139
|
+
log.debug(`dispersed outbox tx ${p.txSignature}: ${res.numInsertedOrUpdatedRows} row(s)`);
|
|
2107
2140
|
return { inserted };
|
|
2108
2141
|
})).catch((e) => {
|
|
2109
2142
|
if (e instanceof DispersedCorrectionRejected)
|
|
2110
2143
|
return { inserted: false };
|
|
2111
2144
|
throw e;
|
|
2112
2145
|
});
|
|
2113
|
-
return result;
|
|
2114
2146
|
});
|
|
2115
2147
|
},
|
|
2116
2148
|
getOutstandingDispersedCorrection(log = logger_1.consoleLogger) {
|