@cashu/coco-expo-sqlite 2.0.0-rc.1 → 2.0.0-rc.3
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/dist/index.js +169 -76
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DEFAULT_UNIT, QuoteIdentityConflictError, deserializeAmount, deserializeToken, getMintQuoteAmount, getMintQuoteRemoteState, isMintQuotePending, isStatefulMintQuote, normalizeMeltMethodData, normalizeMintUrl, normalizeUnit, operationHistoryId, parseHistoryEntryId, projectLegacyHistoryRow, serializeAmount, stringifyJson } from "@cashu/coco-core/adapter";
|
|
1
|
+
import { DEFAULT_UNIT, QuoteIdentityConflictError, deriveBolt11MintQuoteState, deserializeAmount, deserializeToken, getMintQuoteAmount, getMintQuoteRemoteState, isMintQuotePending, isStatefulMintQuote, normalizeMeltMethodData, normalizeMintUrl, normalizeUnit, operationHistoryId, parseHistoryEntryId, projectLegacyHistoryRow, serializeAmount, stringifyJson } from "@cashu/coco-core/adapter";
|
|
2
|
+
import { Amount } from "@cashu/cashu-ts";
|
|
2
3
|
|
|
3
4
|
//#region ../sql-storage/src/schema.ts
|
|
4
5
|
const SEND_OPERATION_METHOD_MIGRATION_IDS = ["012_send_operations_method", "013_send_operations_method"];
|
|
@@ -1323,6 +1324,50 @@ const MIGRATIONS = [
|
|
|
1323
1324
|
ON coco_cashu_canonical_mint_quotes(mintUrl, quoteId);
|
|
1324
1325
|
CREATE UNIQUE INDEX IF NOT EXISTS ux_coco_cashu_melt_quotes_identity
|
|
1325
1326
|
ON coco_cashu_melt_quotes(mintUrl, quoteId);
|
|
1327
|
+
`
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
id: "037_mint_quote_accounting",
|
|
1331
|
+
sql: `
|
|
1332
|
+
ALTER TABLE coco_cashu_canonical_mint_quotes
|
|
1333
|
+
ADD COLUMN amountPaid TEXT NOT NULL DEFAULT '0';
|
|
1334
|
+
ALTER TABLE coco_cashu_canonical_mint_quotes
|
|
1335
|
+
ADD COLUMN amountIssued TEXT NOT NULL DEFAULT '0';
|
|
1336
|
+
ALTER TABLE coco_cashu_canonical_mint_quotes
|
|
1337
|
+
ADD COLUMN remoteUpdatedAt INTEGER;
|
|
1338
|
+
|
|
1339
|
+
UPDATE coco_cashu_canonical_mint_quotes
|
|
1340
|
+
SET amountPaid = CASE
|
|
1341
|
+
WHEN reusable = 1
|
|
1342
|
+
THEN COALESCE(
|
|
1343
|
+
CAST(json_extract(
|
|
1344
|
+
CASE WHEN json_valid(quoteDataJson) THEN quoteDataJson ELSE '{}' END,
|
|
1345
|
+
'$.amountPaid'
|
|
1346
|
+
) AS TEXT),
|
|
1347
|
+
'0'
|
|
1348
|
+
)
|
|
1349
|
+
WHEN state IN ('PAID', 'ISSUED')
|
|
1350
|
+
THEN COALESCE(CAST(amount AS TEXT), '0')
|
|
1351
|
+
ELSE '0'
|
|
1352
|
+
END,
|
|
1353
|
+
amountIssued = CASE
|
|
1354
|
+
WHEN reusable = 1
|
|
1355
|
+
THEN COALESCE(
|
|
1356
|
+
CAST(json_extract(
|
|
1357
|
+
CASE WHEN json_valid(quoteDataJson) THEN quoteDataJson ELSE '{}' END,
|
|
1358
|
+
'$.amountIssued'
|
|
1359
|
+
) AS TEXT),
|
|
1360
|
+
'0'
|
|
1361
|
+
)
|
|
1362
|
+
WHEN state = 'ISSUED'
|
|
1363
|
+
THEN COALESCE(CAST(amount AS TEXT), '0')
|
|
1364
|
+
ELSE '0'
|
|
1365
|
+
END,
|
|
1366
|
+
remoteUpdatedAt = NULL,
|
|
1367
|
+
quoteDataJson = CASE
|
|
1368
|
+
WHEN json_valid(quoteDataJson) THEN quoteDataJson
|
|
1369
|
+
ELSE '{}'
|
|
1370
|
+
END;
|
|
1326
1371
|
`
|
|
1327
1372
|
}
|
|
1328
1373
|
];
|
|
@@ -1465,6 +1510,10 @@ function hexToBytes(hexString) {
|
|
|
1465
1510
|
function bytesToHex(bytes) {
|
|
1466
1511
|
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1467
1512
|
}
|
|
1513
|
+
function assertFieldPresent(value, field, operationId) {
|
|
1514
|
+
if (value == null) throw new Error(`Invalid operation row ${operationId}: missing required field "${field}"`);
|
|
1515
|
+
return value;
|
|
1516
|
+
}
|
|
1468
1517
|
|
|
1469
1518
|
//#endregion
|
|
1470
1519
|
//#region ../sql-storage/src/repositories/KeysetRepository.ts
|
|
@@ -1910,7 +1959,29 @@ var SqliteMeltQuoteRepository = class {
|
|
|
1910
1959
|
quoteId: quote.quoteId
|
|
1911
1960
|
});
|
|
1912
1961
|
if (identityOwner && identityOwner.method !== quote.method) throw new QuoteIdentityConflictError("melt", normalizedMintUrl, quote.quoteId, [identityOwner.method, quote.method], `Melt quote ${quote.quoteId} at ${normalizedMintUrl} already exists for method ${identityOwner.method}`);
|
|
1913
|
-
|
|
1962
|
+
const row = {
|
|
1963
|
+
mintUrl: normalizedMintUrl,
|
|
1964
|
+
method: quote.method,
|
|
1965
|
+
quoteId: quote.quoteId,
|
|
1966
|
+
state: quote.state,
|
|
1967
|
+
request: quote.request,
|
|
1968
|
+
amount: serializeAmount(quote.amount),
|
|
1969
|
+
unit: quote.unit,
|
|
1970
|
+
fee_reserve: quote.method === "onchain" ? null : serializeAmount(quote.fee_reserve),
|
|
1971
|
+
expiry: quote.expiry,
|
|
1972
|
+
payment_preimage: quote.method === "onchain" ? null : quote.payment_preimage ?? null,
|
|
1973
|
+
fee_options_json: quote.method === "onchain" ? stringifyJson(quote.fee_options.map((option) => ({
|
|
1974
|
+
...option,
|
|
1975
|
+
fee_reserve: serializeAmount(option.fee_reserve)
|
|
1976
|
+
}))) : null,
|
|
1977
|
+
outpoint: quote.method === "onchain" ? quote.outpoint ?? null : null,
|
|
1978
|
+
changeJson: quote.change ? stringifyJson(quote.change) : null,
|
|
1979
|
+
lastObservedRemoteState: quote.lastObservedRemoteState ?? quote.state,
|
|
1980
|
+
lastObservedRemoteStateAt: quote.lastObservedRemoteStateAt ?? now,
|
|
1981
|
+
createdAt: quote.createdAt,
|
|
1982
|
+
updatedAt: quote.updatedAt || now
|
|
1983
|
+
};
|
|
1984
|
+
const persisted = await this.db.get(`INSERT INTO coco_cashu_melt_quotes
|
|
1914
1985
|
(mintUrl, method, quoteId, state, request, amount, unit, fee_reserve, expiry,
|
|
1915
1986
|
payment_preimage, fee_options_json, outpoint, changeJson, lastObservedRemoteState,
|
|
1916
1987
|
lastObservedRemoteStateAt, createdAt, updatedAt)
|
|
@@ -1928,28 +1999,30 @@ var SqliteMeltQuoteRepository = class {
|
|
|
1928
1999
|
changeJson=excluded.changeJson,
|
|
1929
2000
|
lastObservedRemoteState=excluded.lastObservedRemoteState,
|
|
1930
2001
|
lastObservedRemoteStateAt=excluded.lastObservedRemoteStateAt,
|
|
1931
|
-
updatedAt=excluded.updatedAt
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
2002
|
+
updatedAt=excluded.updatedAt
|
|
2003
|
+
RETURNING mintUrl, method, quoteId, state, request, amount, unit, fee_reserve, expiry,
|
|
2004
|
+
payment_preimage, fee_options_json, outpoint, changeJson,
|
|
2005
|
+
lastObservedRemoteState, lastObservedRemoteStateAt, createdAt, updatedAt`, [
|
|
2006
|
+
row.mintUrl,
|
|
2007
|
+
row.method,
|
|
2008
|
+
row.quoteId,
|
|
2009
|
+
row.state,
|
|
2010
|
+
row.request,
|
|
2011
|
+
row.amount,
|
|
2012
|
+
row.unit,
|
|
2013
|
+
row.fee_reserve ?? null,
|
|
2014
|
+
row.expiry,
|
|
2015
|
+
row.payment_preimage ?? null,
|
|
2016
|
+
row.fee_options_json ?? null,
|
|
2017
|
+
row.outpoint ?? null,
|
|
2018
|
+
row.changeJson ?? null,
|
|
2019
|
+
row.lastObservedRemoteState ?? null,
|
|
2020
|
+
row.lastObservedRemoteStateAt ?? null,
|
|
2021
|
+
row.createdAt,
|
|
2022
|
+
row.updatedAt
|
|
1952
2023
|
]);
|
|
2024
|
+
if (!persisted) throw new Error(`Melt quote ${quote.quoteId} for ${quote.method} at ${normalizedMintUrl} was not returned after persistence`);
|
|
2025
|
+
return rowToQuote(persisted);
|
|
1953
2026
|
}
|
|
1954
2027
|
async getPendingMeltQuotes(method) {
|
|
1955
2028
|
return (await this.db.all(`SELECT mintUrl, method, quoteId, state, request, amount, unit, fee_reserve, expiry,
|
|
@@ -1984,19 +2057,21 @@ function rowToMintQuote(row) {
|
|
|
1984
2057
|
expiry: row.expiry,
|
|
1985
2058
|
pubkey,
|
|
1986
2059
|
reusable: true,
|
|
2060
|
+
amountPaid: deserializeAmount(row.amountPaid),
|
|
2061
|
+
amountIssued: deserializeAmount(row.amountIssued),
|
|
2062
|
+
remoteUpdatedAt: row.remoteUpdatedAt,
|
|
1987
2063
|
quoteData: {
|
|
1988
2064
|
pubkey,
|
|
1989
|
-
...amount !== void 0 ? { amount } : {}
|
|
1990
|
-
amountPaid: deserializeAmount(quoteData.amountPaid ?? 0),
|
|
1991
|
-
amountIssued: deserializeAmount(quoteData.amountIssued ?? 0)
|
|
2065
|
+
...amount !== void 0 ? { amount } : {}
|
|
1992
2066
|
},
|
|
1993
|
-
lastObservedRemoteStateAt: row.lastObservedRemoteStateAt ?? void 0,
|
|
1994
2067
|
createdAt: row.createdAt,
|
|
1995
2068
|
updatedAt: row.updatedAt
|
|
1996
2069
|
};
|
|
1997
2070
|
}
|
|
1998
2071
|
const amount = deserializeAmount(quoteData.amount ?? row.amount ?? 0);
|
|
1999
|
-
const
|
|
2072
|
+
const amountPaid = deserializeAmount(row.amountPaid);
|
|
2073
|
+
const amountIssued = deserializeAmount(row.amountIssued);
|
|
2074
|
+
const state = deriveBolt11MintQuoteState(amountPaid, amountIssued);
|
|
2000
2075
|
return {
|
|
2001
2076
|
mintUrl: row.mintUrl,
|
|
2002
2077
|
method: "bolt11",
|
|
@@ -2008,9 +2083,10 @@ function rowToMintQuote(row) {
|
|
|
2008
2083
|
unit: row.unit,
|
|
2009
2084
|
expiry: row.expiry,
|
|
2010
2085
|
pubkey: row.pubkey ?? void 0,
|
|
2011
|
-
lastObservedRemoteState: row.lastObservedRemoteState ?? state,
|
|
2012
|
-
lastObservedRemoteStateAt: row.lastObservedRemoteStateAt ?? void 0,
|
|
2013
2086
|
reusable: false,
|
|
2087
|
+
amountPaid,
|
|
2088
|
+
amountIssued,
|
|
2089
|
+
remoteUpdatedAt: row.remoteUpdatedAt,
|
|
2014
2090
|
quoteData: { amount },
|
|
2015
2091
|
createdAt: row.createdAt,
|
|
2016
2092
|
updatedAt: row.updatedAt
|
|
@@ -2022,16 +2098,10 @@ function serializeQuoteData(quote) {
|
|
|
2022
2098
|
const amount = quote.quoteData.amount ?? quote.amount;
|
|
2023
2099
|
return stringifyJson({
|
|
2024
2100
|
pubkey: quote.quoteData.pubkey,
|
|
2025
|
-
...amount !== void 0 ? { amount: serializeAmount(amount) } : {}
|
|
2026
|
-
amountPaid: serializeAmount(quote.quoteData.amountPaid),
|
|
2027
|
-
amountIssued: serializeAmount(quote.quoteData.amountIssued)
|
|
2101
|
+
...amount !== void 0 ? { amount: serializeAmount(amount) } : {}
|
|
2028
2102
|
});
|
|
2029
2103
|
}
|
|
2030
|
-
return stringifyJson({
|
|
2031
|
-
pubkey: quote.quoteData.pubkey,
|
|
2032
|
-
amountPaid: serializeAmount(quote.quoteData.amountPaid),
|
|
2033
|
-
amountIssued: serializeAmount(quote.quoteData.amountIssued)
|
|
2034
|
-
});
|
|
2104
|
+
return stringifyJson({ pubkey: quote.quoteData.pubkey });
|
|
2035
2105
|
}
|
|
2036
2106
|
var SqliteMintQuoteRepository = class {
|
|
2037
2107
|
db;
|
|
@@ -2041,7 +2111,7 @@ var SqliteMintQuoteRepository = class {
|
|
|
2041
2111
|
async getMintQuoteById(identity) {
|
|
2042
2112
|
const normalizedMintUrl = normalizeMintUrl(identity.mintUrl);
|
|
2043
2113
|
const rows = await this.db.all(`SELECT mintUrl, method, quoteId, state, request, amount, unit, expiry, pubkey,
|
|
2044
|
-
quoteDataJson,
|
|
2114
|
+
quoteDataJson, amountPaid, amountIssued, remoteUpdatedAt, reusable,
|
|
2045
2115
|
createdAt, updatedAt
|
|
2046
2116
|
FROM coco_cashu_canonical_mint_quotes
|
|
2047
2117
|
WHERE mintUrl = ? AND quoteId = ?`, [normalizedMintUrl, identity.quoteId]);
|
|
@@ -2050,7 +2120,7 @@ var SqliteMintQuoteRepository = class {
|
|
|
2050
2120
|
}
|
|
2051
2121
|
async getMintQuote(mintUrl, method, quoteId) {
|
|
2052
2122
|
const row = await this.db.get(`SELECT mintUrl, method, quoteId, state, request, amount, unit, expiry, pubkey,
|
|
2053
|
-
quoteDataJson,
|
|
2123
|
+
quoteDataJson, amountPaid, amountIssued, remoteUpdatedAt, reusable,
|
|
2054
2124
|
createdAt, updatedAt
|
|
2055
2125
|
FROM coco_cashu_canonical_mint_quotes
|
|
2056
2126
|
WHERE mintUrl = ? AND method = ? AND quoteId = ? LIMIT 1`, [
|
|
@@ -2072,8 +2142,8 @@ var SqliteMintQuoteRepository = class {
|
|
|
2072
2142
|
const amount = getMintQuoteAmount(quote);
|
|
2073
2143
|
await this.db.run(`INSERT INTO coco_cashu_canonical_mint_quotes
|
|
2074
2144
|
(mintUrl, method, quoteId, state, request, amount, unit, expiry, pubkey, quoteDataJson,
|
|
2075
|
-
|
|
2076
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
2145
|
+
amountPaid, amountIssued, remoteUpdatedAt, reusable, createdAt, updatedAt)
|
|
2146
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
2077
2147
|
ON CONFLICT(mintUrl, method, quoteId) DO UPDATE SET
|
|
2078
2148
|
state=excluded.state,
|
|
2079
2149
|
request=excluded.request,
|
|
@@ -2082,8 +2152,9 @@ var SqliteMintQuoteRepository = class {
|
|
|
2082
2152
|
expiry=excluded.expiry,
|
|
2083
2153
|
pubkey=excluded.pubkey,
|
|
2084
2154
|
quoteDataJson=excluded.quoteDataJson,
|
|
2085
|
-
|
|
2086
|
-
|
|
2155
|
+
amountPaid=excluded.amountPaid,
|
|
2156
|
+
amountIssued=excluded.amountIssued,
|
|
2157
|
+
remoteUpdatedAt=excluded.remoteUpdatedAt,
|
|
2087
2158
|
reusable=excluded.reusable,
|
|
2088
2159
|
updatedAt=excluded.updatedAt`, [
|
|
2089
2160
|
normalizedMintUrl,
|
|
@@ -2096,8 +2167,9 @@ var SqliteMintQuoteRepository = class {
|
|
|
2096
2167
|
quote.expiry,
|
|
2097
2168
|
quote.pubkey ?? null,
|
|
2098
2169
|
serializeQuoteData(quote),
|
|
2099
|
-
|
|
2100
|
-
quote.
|
|
2170
|
+
serializeAmount(quote.amountPaid),
|
|
2171
|
+
serializeAmount(quote.amountIssued),
|
|
2172
|
+
quote.remoteUpdatedAt,
|
|
2101
2173
|
quote.reusable ? 1 : 0,
|
|
2102
2174
|
quote.createdAt,
|
|
2103
2175
|
quote.updatedAt || now
|
|
@@ -2105,8 +2177,25 @@ var SqliteMintQuoteRepository = class {
|
|
|
2105
2177
|
}
|
|
2106
2178
|
async setMintQuoteState(mintUrl, method, quoteId, state, observedAt = Date.now()) {
|
|
2107
2179
|
await this.db.run(`UPDATE coco_cashu_canonical_mint_quotes
|
|
2108
|
-
SET state =
|
|
2109
|
-
|
|
2180
|
+
SET state = CASE
|
|
2181
|
+
WHEN ? = 'ISSUED' OR amountIssued = amount THEN 'ISSUED'
|
|
2182
|
+
WHEN ? IN ('PAID', 'ISSUED') OR amountPaid = amount THEN 'PAID'
|
|
2183
|
+
ELSE 'UNPAID'
|
|
2184
|
+
END,
|
|
2185
|
+
amountPaid = CASE WHEN ? IN ('PAID', 'ISSUED') THEN amount ELSE amountPaid END,
|
|
2186
|
+
amountIssued = CASE WHEN ? = 'ISSUED' THEN amount ELSE amountIssued END,
|
|
2187
|
+
updatedAt = CASE WHEN updatedAt > ? THEN updatedAt ELSE ? END
|
|
2188
|
+
WHERE mintUrl = ? AND method = ? AND quoteId = ?
|
|
2189
|
+
AND method = 'bolt11'
|
|
2190
|
+
AND amount IS NOT NULL
|
|
2191
|
+
AND remoteUpdatedAt IS NULL
|
|
2192
|
+
AND (
|
|
2193
|
+
(amountPaid = '0' AND amountIssued = '0') OR
|
|
2194
|
+
(amountPaid = amount AND amountIssued = '0') OR
|
|
2195
|
+
(amountPaid = amount AND amountIssued = amount)
|
|
2196
|
+
)`, [
|
|
2197
|
+
state,
|
|
2198
|
+
state,
|
|
2110
2199
|
state,
|
|
2111
2200
|
state,
|
|
2112
2201
|
observedAt,
|
|
@@ -2118,10 +2207,10 @@ var SqliteMintQuoteRepository = class {
|
|
|
2118
2207
|
}
|
|
2119
2208
|
async getPendingMintQuotes(method) {
|
|
2120
2209
|
return (await this.db.all(`SELECT mintUrl, method, quoteId, state, request, amount, unit, expiry, pubkey,
|
|
2121
|
-
quoteDataJson,
|
|
2210
|
+
quoteDataJson, amountPaid, amountIssued, remoteUpdatedAt, reusable,
|
|
2122
2211
|
createdAt, updatedAt
|
|
2123
2212
|
FROM coco_cashu_canonical_mint_quotes
|
|
2124
|
-
|
|
2213
|
+
${method ? "WHERE method = ?" : ""}`, method ? [method] : [])).map(rowToMintQuote).filter(isMintQuotePending);
|
|
2125
2214
|
}
|
|
2126
2215
|
};
|
|
2127
2216
|
|
|
@@ -2137,24 +2226,28 @@ var SqliteLegacyMintQuoteRepository = class {
|
|
|
2137
2226
|
FROM coco_cashu_mint_quotes
|
|
2138
2227
|
WHERE state != 'ISSUED' ${normalizedMintUrl ? "AND mintUrl = ?" : ""}`, normalizedMintUrl ? [normalizedMintUrl] : []);
|
|
2139
2228
|
const now = Date.now();
|
|
2140
|
-
return rows.map((row) =>
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2229
|
+
return rows.map((row) => {
|
|
2230
|
+
const amount = deserializeAmount(row.amount);
|
|
2231
|
+
return {
|
|
2232
|
+
mintUrl: row.mintUrl,
|
|
2233
|
+
method: "bolt11",
|
|
2234
|
+
quoteId: row.quote,
|
|
2235
|
+
quote: row.quote,
|
|
2236
|
+
state: row.state,
|
|
2237
|
+
request: row.request,
|
|
2238
|
+
amount,
|
|
2239
|
+
unit: row.unit,
|
|
2240
|
+
expiry: row.expiry,
|
|
2241
|
+
pubkey: row.pubkey ?? void 0,
|
|
2242
|
+
reusable: false,
|
|
2243
|
+
amountPaid: row.state === "PAID" ? amount : Amount.zero(),
|
|
2244
|
+
amountIssued: Amount.zero(),
|
|
2245
|
+
remoteUpdatedAt: null,
|
|
2246
|
+
quoteData: { amount },
|
|
2247
|
+
createdAt: now,
|
|
2248
|
+
updatedAt: now
|
|
2249
|
+
};
|
|
2250
|
+
});
|
|
2158
2251
|
}
|
|
2159
2252
|
};
|
|
2160
2253
|
|
|
@@ -2228,7 +2321,7 @@ const projectionSelect = `
|
|
|
2228
2321
|
NULL AS inputProofsJson,
|
|
2229
2322
|
NULL AS metadata,
|
|
2230
2323
|
op.id AS operationId,
|
|
2231
|
-
q.
|
|
2324
|
+
q.state AS remoteState,
|
|
2232
2325
|
op.error
|
|
2233
2326
|
FROM coco_cashu_mint_operations op
|
|
2234
2327
|
LEFT JOIN coco_cashu_canonical_mint_quotes q
|
|
@@ -2490,8 +2583,8 @@ function rowToOperation$4(row) {
|
|
|
2490
2583
|
};
|
|
2491
2584
|
const preparedData = {
|
|
2492
2585
|
needsSwap: row.needsSwap === 1,
|
|
2493
|
-
fee: deserializeAmount(row.fee
|
|
2494
|
-
inputAmount: deserializeAmount(row.inputAmount
|
|
2586
|
+
fee: deserializeAmount(assertFieldPresent(row.fee, "fee", row.id)),
|
|
2587
|
+
inputAmount: deserializeAmount(assertFieldPresent(row.inputAmount, "inputAmount", row.id)),
|
|
2495
2588
|
inputProofSecrets: row.inputProofSecretsJson ? JSON.parse(row.inputProofSecretsJson) : [],
|
|
2496
2589
|
outputData: row.outputDataJson ? JSON.parse(row.outputDataJson) : void 0
|
|
2497
2590
|
};
|
|
@@ -2662,11 +2755,11 @@ const rowToOperation$3 = (row) => {
|
|
|
2662
2755
|
};
|
|
2663
2756
|
const preparedData = {
|
|
2664
2757
|
quoteId: row.quoteId ?? "",
|
|
2665
|
-
amount: deserializeAmount(row.amount
|
|
2666
|
-
fee_reserve: deserializeAmount(row.fee_reserve
|
|
2667
|
-
swap_fee: deserializeAmount(row.swap_fee
|
|
2758
|
+
amount: deserializeAmount(assertFieldPresent(row.amount, "amount", row.id)),
|
|
2759
|
+
fee_reserve: deserializeAmount(assertFieldPresent(row.fee_reserve, "fee_reserve", row.id)),
|
|
2760
|
+
swap_fee: deserializeAmount(assertFieldPresent(row.swap_fee, "swap_fee", row.id)),
|
|
2668
2761
|
needsSwap: row.needsSwap === 1,
|
|
2669
|
-
inputAmount: deserializeAmount(row.inputAmount
|
|
2762
|
+
inputAmount: deserializeAmount(assertFieldPresent(row.inputAmount, "inputAmount", row.id)),
|
|
2670
2763
|
inputProofSecrets: row.inputProofSecretsJson ? JSON.parse(row.inputProofSecretsJson) : [],
|
|
2671
2764
|
changeOutputData: row.changeOutputDataJson ? JSON.parse(row.changeOutputDataJson) : {
|
|
2672
2765
|
keep: [],
|
|
@@ -3091,7 +3184,7 @@ function rowToOperation$1(row) {
|
|
|
3091
3184
|
state: "init"
|
|
3092
3185
|
};
|
|
3093
3186
|
const preparedData = {
|
|
3094
|
-
fee: deserializeAmount(row.fee
|
|
3187
|
+
fee: deserializeAmount(assertFieldPresent(row.fee, "fee", row.id)),
|
|
3095
3188
|
outputData: row.outputDataJson ? JSON.parse(row.outputDataJson) : void 0
|
|
3096
3189
|
};
|
|
3097
3190
|
switch (row.state) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cashu/coco-expo-sqlite",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"README.md"
|
|
16
16
|
],
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@cashu/coco-adapter-tests": "2.0.0-rc.
|
|
19
|
-
"@cashu/coco-sql-storage": "2.0.0-rc.
|
|
18
|
+
"@cashu/coco-adapter-tests": "2.0.0-rc.3",
|
|
19
|
+
"@cashu/coco-sql-storage": "2.0.0-rc.3"
|
|
20
20
|
},
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"test": "bun test"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@cashu/cashu-ts": "4
|
|
34
|
+
"@cashu/cashu-ts": "5.0.0-rc.4",
|
|
35
35
|
"typescript": "^5",
|
|
36
36
|
"expo-sqlite": "*",
|
|
37
|
-
"@cashu/coco-core": "2.0.0-rc.
|
|
37
|
+
"@cashu/coco-core": "2.0.0-rc.3"
|
|
38
38
|
}
|
|
39
39
|
}
|