@render-foundation/utils 0.0.255 → 0.0.256
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 +89 -121
- 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 +74 -107
- 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 +3 -0
- package/lib/types/src/client/dispersed.d.ts.map +1 -1
- package/lib/types/src/client/pg/base.d.ts +1 -5
- package/lib/types/src/client/pg/base.d.ts.map +1 -1
- package/lib/types/src/client/pg/v2Client.d.ts +8 -1
- package/lib/types/src/client/pg/v2Client.d.ts.map +1 -1
- package/lib/types/src/dbTypesV2.d.ts +9 -0
- 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;AA+DD,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,OA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GAAG,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;
|
|
1562
1562
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1563
1563
|
let q = db.trx
|
|
1564
1564
|
.selectFrom('burn')
|
|
@@ -1606,7 +1606,6 @@ 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),
|
|
1610
1609
|
});
|
|
1611
1610
|
burnIdToIdx[r.id] = burns.length - 1;
|
|
1612
1611
|
}
|
|
@@ -1632,138 +1631,75 @@ const pgClient = (config) => {
|
|
|
1632
1631
|
fetchBurnsPage(db, f, log = logger_1.consoleLogger) {
|
|
1633
1632
|
var _a;
|
|
1634
1633
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
if (f.
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
// Legacy cursor: bare burn.id — treat as buy-burn cursor.
|
|
1654
|
-
cursorId = Number(raw);
|
|
1655
|
-
cursorType = 'buy';
|
|
1656
|
-
}
|
|
1634
|
+
const lastId = f.cursor ? atob(f.cursor) : undefined;
|
|
1635
|
+
let q = db.trx
|
|
1636
|
+
.selectFrom('burn')
|
|
1637
|
+
.selectAll('burn')
|
|
1638
|
+
.innerJoin('sol_tx', 'sol_tx.id', 'burn.sol_tx_id')
|
|
1639
|
+
.select(['sol_tx.executed_at', 'sol_tx.sig']);
|
|
1640
|
+
if (!f.inclManual) {
|
|
1641
|
+
q = q.where('burn.usdc_spent', '>', String(0));
|
|
1642
|
+
}
|
|
1643
|
+
if (f.executedAfter) {
|
|
1644
|
+
q = q.where('sol_tx.executed_at', '>=', f.executedAfter);
|
|
1645
|
+
}
|
|
1646
|
+
if (f.executedBefore) {
|
|
1647
|
+
q = q.where('sol_tx.executed_at', '<=', f.executedBefore);
|
|
1648
|
+
}
|
|
1649
|
+
if (f.sig) {
|
|
1650
|
+
// Exact match, not a prefix: sol_tx.sig is unique, so this is an index hit returning at most one row.
|
|
1651
|
+
q = q.where('sol_tx.sig', '=', f.sig);
|
|
1657
1652
|
}
|
|
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);
|
|
1671
|
-
if (f.jobId !== undefined) {
|
|
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, 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
1653
|
if (f.jobId !== undefined) {
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
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)}`;
|
|
1654
|
+
// "Which burn consumed this job?" — job.burn_id is the FK, so resolve it as a subquery rather than
|
|
1655
|
+
// joining `job` into the page query, which would multiply rows by job count and break both the limit
|
|
1656
|
+
// and the cursor.
|
|
1657
|
+
q = q.where('burn.id', 'in', (eb) => eb
|
|
1658
|
+
.selectFrom('job')
|
|
1659
|
+
.select('job.burn_id')
|
|
1660
|
+
.where('job.id', '=', String(f.jobId)));
|
|
1661
|
+
}
|
|
1662
|
+
if (lastId) {
|
|
1663
|
+
q = q.where('burn.id', '>', lastId);
|
|
1713
1664
|
}
|
|
1714
1665
|
const limit = (_a = f.limit) !== null && _a !== void 0 ? _a : 1000;
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
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);
|
|
1666
|
+
q = q.limit(limit).orderBy('burn.id');
|
|
1667
|
+
const comp = q.compile();
|
|
1668
|
+
const { rows } = yield (0, base_1.timedQuery)(pgPool, comp.sql, comp.parameters, 'fetchBurnsPage', log);
|
|
1725
1669
|
const burns = rows.map((r) => {
|
|
1726
|
-
var _a, _b
|
|
1670
|
+
var _a, _b;
|
|
1727
1671
|
return ({
|
|
1728
1672
|
jobs: [],
|
|
1729
1673
|
id: Number(r.id),
|
|
1730
|
-
|
|
1731
|
-
renderToUsdc: (_a = r.render_to_usdc) !== null && _a !== void 0 ? _a : undefined,
|
|
1674
|
+
renderToUsdc: r.render_to_usdc,
|
|
1732
1675
|
solTx: r.sig,
|
|
1733
1676
|
executedAt: r.executed_at,
|
|
1734
|
-
pricedAt:
|
|
1735
|
-
usdcSpent: BigInt((
|
|
1736
|
-
quoteAmt: BigInt((
|
|
1677
|
+
pricedAt: r.priced_at,
|
|
1678
|
+
usdcSpent: BigInt((_a = r.usdc_spent) !== null && _a !== void 0 ? _a : 0),
|
|
1679
|
+
quoteAmt: BigInt((_b = r.quote_amt) !== null && _b !== void 0 ? _b : 0),
|
|
1737
1680
|
burned: BigInt(r.burned),
|
|
1738
|
-
eurToUsdc:
|
|
1681
|
+
eurToUsdc: r.eur_to_usdc,
|
|
1739
1682
|
markedBurnedAt: r.marked_burned_at,
|
|
1740
1683
|
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,
|
|
1744
1684
|
});
|
|
1745
1685
|
});
|
|
1746
1686
|
return {
|
|
1747
1687
|
burns,
|
|
1688
|
+
// Only hand back a cursor on a full page; a short page means we're done.
|
|
1748
1689
|
cursor: burns.length === limit
|
|
1749
|
-
? btoa(
|
|
1750
|
-
ea: rows[burns.length - 1].executed_at,
|
|
1751
|
-
t: rows[burns.length - 1].type,
|
|
1752
|
-
id: rows[burns.length - 1].sortid,
|
|
1753
|
-
}))
|
|
1690
|
+
? btoa(String(burns[burns.length - 1].id))
|
|
1754
1691
|
: undefined,
|
|
1755
1692
|
};
|
|
1756
1693
|
});
|
|
1757
1694
|
},
|
|
1758
|
-
fetchBurnJobs(db, burnId,
|
|
1695
|
+
fetchBurnJobs(db, burnId, log = logger_1.consoleLogger) {
|
|
1759
1696
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1760
|
-
const fk = burnType === 'grant' ? 'grant_burn_id' : 'burn_id';
|
|
1761
1697
|
const rows = yield db.trx
|
|
1762
1698
|
.selectFrom('job')
|
|
1763
1699
|
.selectAll('job')
|
|
1764
|
-
.where(
|
|
1700
|
+
.where('burn_id', '=', String(burnId))
|
|
1765
1701
|
.execute();
|
|
1766
|
-
log.debug(`fetchBurnJobs
|
|
1702
|
+
log.debug(`fetchBurnJobs burn ${burnId} -> ${rows.length} jobs`);
|
|
1767
1703
|
return rows.map((r) => ({
|
|
1768
1704
|
id: Number(r.id),
|
|
1769
1705
|
completedAt: r.completed_at,
|
|
@@ -1786,8 +1722,8 @@ const pgClient = (config) => {
|
|
|
1786
1722
|
.innerJoin('sol_tx', 'sol_tx.id', 'burn.sol_tx_id')
|
|
1787
1723
|
.select(({ fn }) => [
|
|
1788
1724
|
dayExpr.as('day'),
|
|
1789
|
-
|
|
1790
|
-
|
|
1725
|
+
fn.sum('burn.burned').as('render_burned'),
|
|
1726
|
+
fn.sum('burn.usdc_spent').as('usdc_spent'),
|
|
1791
1727
|
fn.count('burn.id').as('burn_count'),
|
|
1792
1728
|
])
|
|
1793
1729
|
.groupBy((0, kysely_1.sql) `date_trunc('day', sol_tx.executed_at)`)
|
|
@@ -2086,7 +2022,23 @@ const pgClient = (config) => {
|
|
|
2086
2022
|
});
|
|
2087
2023
|
},
|
|
2088
2024
|
insertDispersedOutbox(p, log = logger_1.consoleLogger) {
|
|
2025
|
+
var _a;
|
|
2089
2026
|
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
|
+
}
|
|
2090
2042
|
// The outbox row is the durable, crash-safe anchor persisted BEFORE broadcast. When it carries a
|
|
2091
2043
|
// burn-correction draw, we increment consumed_render in the SAME transaction as the insert, bounded
|
|
2092
2044
|
// so it can never exceed amount_render. Row + counter are therefore atomic and inseparable: no
|
|
@@ -2094,8 +2046,8 @@ const pgClient = (config) => {
|
|
|
2094
2046
|
// (decremented again by voidDispersedOutbox). If the bounded increment can't fit (a concurrent draw
|
|
2095
2047
|
// took the room), the whole txn rolls back and we return {inserted:false} — the caller must NOT
|
|
2096
2048
|
// broadcast (no row, no counter change, no burn).
|
|
2097
|
-
|
|
2098
|
-
var
|
|
2049
|
+
const result = yield db.transaction().execute((trx) => __awaiter(this, void 0, void 0, function* () {
|
|
2050
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
2099
2051
|
const res = yield trx
|
|
2100
2052
|
.insertInto(exports.DISPERSED_SETTLEMENT_TABLE)
|
|
2101
2053
|
.values({
|
|
@@ -2105,17 +2057,17 @@ const pgClient = (config) => {
|
|
|
2105
2057
|
settled_amount: p.settledAmount,
|
|
2106
2058
|
burned_amount: p.burnedAmount,
|
|
2107
2059
|
executed_at: p.executedAt,
|
|
2108
|
-
eur_render: (
|
|
2109
|
-
last_valid_block_height: (
|
|
2110
|
-
usdc_spent: (
|
|
2111
|
-
correction_id: (
|
|
2112
|
-
correction_render: (
|
|
2113
|
-
usage_from: (
|
|
2114
|
-
usage_to: (
|
|
2060
|
+
eur_render: (_c = p.eurRender) !== null && _c !== void 0 ? _c : null,
|
|
2061
|
+
last_valid_block_height: (_d = p.lastValidBlockHeight) !== null && _d !== void 0 ? _d : null,
|
|
2062
|
+
usdc_spent: (_e = p.usdcSpent) !== null && _e !== void 0 ? _e : null,
|
|
2063
|
+
correction_id: (_f = p.correctionId) !== null && _f !== void 0 ? _f : null,
|
|
2064
|
+
correction_render: (_g = p.correctionRender) !== null && _g !== void 0 ? _g : null,
|
|
2065
|
+
usage_from: (_h = p.usageFrom) !== null && _h !== void 0 ? _h : null,
|
|
2066
|
+
usage_to: (_j = p.usageTo) !== null && _j !== void 0 ? _j : null,
|
|
2115
2067
|
})
|
|
2116
2068
|
.onConflict((oc) => oc.column('tx_signature').doNothing())
|
|
2117
2069
|
.executeTakeFirst();
|
|
2118
|
-
const inserted = ((
|
|
2070
|
+
const inserted = ((_k = res.numInsertedOrUpdatedRows) !== null && _k !== void 0 ? _k : BigInt(0)) > BigInt(0);
|
|
2119
2071
|
// Only reserve when the row was actually inserted (a tx_signature conflict is a no-op → no double
|
|
2120
2072
|
// count) and it drew a correction.
|
|
2121
2073
|
if (inserted &&
|
|
@@ -2130,19 +2082,35 @@ const pgClient = (config) => {
|
|
|
2130
2082
|
.where('id', '=', String(p.correctionId))
|
|
2131
2083
|
.where((eb) => eb((0, kysely_1.sql) `consumed_render + ${p.correctionRender}::numeric`, '<=', eb.ref('amount_render')))
|
|
2132
2084
|
.executeTakeFirst();
|
|
2133
|
-
if (((
|
|
2085
|
+
if (((_l = upd.numUpdatedRows) !== null && _l !== void 0 ? _l : BigInt(0)) === BigInt(0)) {
|
|
2134
2086
|
// Would exceed amount_render (concurrent draw won the room) — roll back the whole txn.
|
|
2135
2087
|
log.warn(`dispersed correction ${p.correctionId}: draw ${p.correctionRender} would over-consume; rejecting outbox insert for tx ${p.txSignature}`);
|
|
2136
2088
|
throw new DispersedCorrectionRejected();
|
|
2137
2089
|
}
|
|
2138
2090
|
}
|
|
2139
|
-
|
|
2091
|
+
if (inserted && hasObligationTable && ((_m = p.obligations) === null || _m === void 0 ? void 0 : _m.length)) {
|
|
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`);
|
|
2140
2107
|
return { inserted };
|
|
2141
2108
|
})).catch((e) => {
|
|
2142
2109
|
if (e instanceof DispersedCorrectionRejected)
|
|
2143
2110
|
return { inserted: false };
|
|
2144
2111
|
throw e;
|
|
2145
2112
|
});
|
|
2113
|
+
return result;
|
|
2146
2114
|
});
|
|
2147
2115
|
},
|
|
2148
2116
|
getOutstandingDispersedCorrection(log = logger_1.consoleLogger) {
|