@inversealtruism/cairnx-core 0.1.30 → 0.1.31
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.cjs +12 -0
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +11 -0
- package/package.json +14 -6
package/dist/index.cjs
CHANGED
|
@@ -126,6 +126,7 @@ __export(index_exports, {
|
|
|
126
126
|
offer: () => offer,
|
|
127
127
|
offerCancelAll: () => offerCancelAll,
|
|
128
128
|
offerExpiryHeightOf: () => offerExpiryHeightOf,
|
|
129
|
+
paidToFromOutputs: () => paidToFromOutputs,
|
|
129
130
|
parseAmount: () => parseAmount,
|
|
130
131
|
parseRecord: () => parseRecord,
|
|
131
132
|
payloadHash: () => import_csd_codec4.payloadHash,
|
|
@@ -1404,6 +1405,16 @@ function requiredClaimDepth(valueSats, height) {
|
|
|
1404
1405
|
return { depth: max, reversalPct: Math.pow(r, max) * 100, capped: true };
|
|
1405
1406
|
}
|
|
1406
1407
|
|
|
1408
|
+
// src/paidto.ts
|
|
1409
|
+
function paidToFromOutputs(outputs) {
|
|
1410
|
+
const m = /* @__PURE__ */ Object.create(null);
|
|
1411
|
+
for (const o of outputs) {
|
|
1412
|
+
if (typeof o.value !== "number" || !Number.isSafeInteger(o.value) || o.value < 0) continue;
|
|
1413
|
+
m[o.addr] = (BigInt(m[o.addr] ?? "0") + BigInt(o.value)).toString();
|
|
1414
|
+
}
|
|
1415
|
+
return m;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1407
1418
|
// src/index.ts
|
|
1408
1419
|
var import_csd_codec4 = require("@inversealtruism/csd-codec");
|
|
1409
1420
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1514,6 +1525,7 @@ var import_csd_codec4 = require("@inversealtruism/csd-codec");
|
|
|
1514
1525
|
offer,
|
|
1515
1526
|
offerCancelAll,
|
|
1516
1527
|
offerExpiryHeightOf,
|
|
1528
|
+
paidToFromOutputs,
|
|
1517
1529
|
parseAmount,
|
|
1518
1530
|
parseRecord,
|
|
1519
1531
|
payloadHash,
|
package/dist/index.d.cts
CHANGED
|
@@ -429,4 +429,9 @@ declare function requiredClaimDepth(valueSats: number | bigint, height: number):
|
|
|
429
429
|
capped: boolean;
|
|
430
430
|
};
|
|
431
431
|
|
|
432
|
-
|
|
432
|
+
declare function paidToFromOutputs(outputs: readonly {
|
|
433
|
+
addr: string;
|
|
434
|
+
value: number;
|
|
435
|
+
}[]): Record<string, string>;
|
|
436
|
+
|
|
437
|
+
export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, BID_KEYS, type BalanceState, type BidRecord, type BidState, type BidStatus, type BuiltRecord, CLAIM_ATTACKER_Q, CLAIM_COOLDOWN_BLOCKS, CLAIM_FILL_GRACE_BLOCKS, CLAIM_MIN_DEPTH, CLAIM_WINDOW_BLOCKS, CLAIM_WINDOW_BLOCKS_V20, COMMIT_MAX_BLOCKS, COMMIT_REVEAL_MIN_DEPTH, CONF_TOKEN_FILL, type CairnXRecord, type CairnXState, type ChainEvent, DEPLOY_FEE, DEPLOY_KEYS, DOMAIN, type DeployRecord, FEE_BPS, FEE_BPS_V16, FINALIZE_TIP_MARGIN, type FillEntry, type Give, HASH_RE, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MINT_KEYS, type MintRecord, NAME_FEE_LEN3_V24, NAME_FEE_LEN4_V24, NAME_FEE_LONG_V24, NAME_FEE_MID_V24, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_KEYS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, NFINALIZE_KEYS, NPROFILE_KEYS, type NameCommitRecord, type NameFinalizeRecord, type NameProfileRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, OFFER_KEYS, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, PKEY, PROFILE_MAX_KEYS, PROFILE_MAX_VALUE_BYTES, type ProposeEvent, REBATE_BPS, REBATE_FLAT, REG_COMMIT_MAX_BLOCKS, REG_FINALIZE_GRACE_BLOCKS, RESERVED_NAMES, SALT_RE, SCORE_CANCEL, SCORE_CLAIM, SCORE_FILL, TICKER_RE, TRANSFER_KEYS, TREASURY_ADDR, type TokenMetaRecord, type TokenState, type TransferRecord, V11_HEIGHT, V12_HEIGHT, V13_HEIGHT, V14_HEIGHT, V15_HEIGHT, V16_HEIGHT, V17_HEIGHT, V18_HEIGHT, V19_HEIGHT, V20_HEIGHT, V21_HEIGHT, V22_HEIGHT, V23_HEIGHT, V24_HEIGHT, V25_HEIGHT, V26_HEIGHT, type Want, ZERO_ADDR, bid, buildRecord, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, deploy, epochOf, expiredClaimFee, isName, isNameGive, isTokenWant, makerRebate, mint, nameClaim, nameCommit, nameCommitRecord, nameFinalize, nameProfile, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, offerExpiryHeightOf, paidToFromOutputs, parseAmount, parseRecord, requiredClaimDepth, resolve, tokenMeta, tradeFee, transfer };
|
package/dist/index.d.ts
CHANGED
|
@@ -429,4 +429,9 @@ declare function requiredClaimDepth(valueSats: number | bigint, height: number):
|
|
|
429
429
|
capped: boolean;
|
|
430
430
|
};
|
|
431
431
|
|
|
432
|
-
|
|
432
|
+
declare function paidToFromOutputs(outputs: readonly {
|
|
433
|
+
addr: string;
|
|
434
|
+
value: number;
|
|
435
|
+
}[]): Record<string, string>;
|
|
436
|
+
|
|
437
|
+
export { ACTIVATION_HEIGHT, ADDR_RE, AMOUNT_RE, type AppliedEvent, type AttestEvent, BID_KEYS, type BalanceState, type BidRecord, type BidState, type BidStatus, type BuiltRecord, CLAIM_ATTACKER_Q, CLAIM_COOLDOWN_BLOCKS, CLAIM_FILL_GRACE_BLOCKS, CLAIM_MIN_DEPTH, CLAIM_WINDOW_BLOCKS, CLAIM_WINDOW_BLOCKS_V20, COMMIT_MAX_BLOCKS, COMMIT_REVEAL_MIN_DEPTH, CONF_TOKEN_FILL, type CairnXRecord, type CairnXState, type ChainEvent, DEPLOY_FEE, DEPLOY_KEYS, DOMAIN, type DeployRecord, FEE_BPS, FEE_BPS_V16, FINALIZE_TIP_MARGIN, type FillEntry, type Give, HASH_RE, MAX_ACTIVE_CLAIMS, MAX_AMOUNT, MAX_OFFER_EPOCHS, MAX_PENDING_REG, MAX_RECORD_BYTES, MINT_KEYS, type MintRecord, NAME_FEE_LEN3_V24, NAME_FEE_LEN4_V24, NAME_FEE_LONG_V24, NAME_FEE_MID_V24, NAME_FEE_SHORT_V18, NAME_FEE_V18, NAME_GRACE_EPOCHS, NAME_KEYS, NAME_PREMIUM_DECAY_EPOCHS, NAME_PREMIUM_START, NAME_RE, NAME_TERM_EPOCHS, NFINALIZE_KEYS, NPROFILE_KEYS, type NameCommitRecord, type NameFinalizeRecord, type NameProfileRecord, type NameRecord, type NameRenewRecord, type NameSetRecord, type NameState, type NameXferRecord, OFFER_KEYS, type OfferCancelAllRecord, type OfferRecord, type OfferState, type OfferStatus, PKEY, PROFILE_MAX_KEYS, PROFILE_MAX_VALUE_BYTES, type ProposeEvent, REBATE_BPS, REBATE_FLAT, REG_COMMIT_MAX_BLOCKS, REG_FINALIZE_GRACE_BLOCKS, RESERVED_NAMES, SALT_RE, SCORE_CANCEL, SCORE_CLAIM, SCORE_FILL, TICKER_RE, TRANSFER_KEYS, TREASURY_ADDR, type TokenMetaRecord, type TokenState, type TransferRecord, V11_HEIGHT, V12_HEIGHT, V13_HEIGHT, V14_HEIGHT, V15_HEIGHT, V16_HEIGHT, V17_HEIGHT, V18_HEIGHT, V19_HEIGHT, V20_HEIGHT, V21_HEIGHT, V22_HEIGHT, V23_HEIGHT, V24_HEIGHT, V25_HEIGHT, V26_HEIGHT, type Want, ZERO_ADDR, bid, buildRecord, canonicalState, claimGraceOf, claimWindowAt, claimWindowOf, deploy, epochOf, expiredClaimFee, isName, isNameGive, isTokenWant, makerRebate, mint, nameClaim, nameCommit, nameCommitRecord, nameFinalize, nameProfile, nameRegFee, nameRenew, nameSet, nameXfer, offer, offerCancelAll, offerExpiryHeightOf, paidToFromOutputs, parseAmount, parseRecord, requiredClaimDepth, resolve, tokenMeta, tradeFee, transfer };
|
package/dist/index.js
CHANGED
|
@@ -1265,6 +1265,16 @@ function requiredClaimDepth(valueSats, height) {
|
|
|
1265
1265
|
return { depth: max, reversalPct: Math.pow(r, max) * 100, capped: true };
|
|
1266
1266
|
}
|
|
1267
1267
|
|
|
1268
|
+
// src/paidto.ts
|
|
1269
|
+
function paidToFromOutputs(outputs) {
|
|
1270
|
+
const m = /* @__PURE__ */ Object.create(null);
|
|
1271
|
+
for (const o of outputs) {
|
|
1272
|
+
if (typeof o.value !== "number" || !Number.isSafeInteger(o.value) || o.value < 0) continue;
|
|
1273
|
+
m[o.addr] = (BigInt(m[o.addr] ?? "0") + BigInt(o.value)).toString();
|
|
1274
|
+
}
|
|
1275
|
+
return m;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1268
1278
|
// src/index.ts
|
|
1269
1279
|
import {
|
|
1270
1280
|
canonicalJson as canonicalJson2,
|
|
@@ -1383,6 +1393,7 @@ export {
|
|
|
1383
1393
|
offer,
|
|
1384
1394
|
offerCancelAll,
|
|
1385
1395
|
offerExpiryHeightOf,
|
|
1396
|
+
paidToFromOutputs,
|
|
1386
1397
|
parseAmount,
|
|
1387
1398
|
parseRecord,
|
|
1388
1399
|
payloadHash2 as payloadHash,
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inversealtruism/cairnx-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": ">=18"
|
|
6
|
+
},
|
|
4
7
|
"description": "CairnX — tokens, atomic DvP trades and leased .csd names on Compute Substrate, as a pure deterministic convention library (Ordinals/Runes class). Ships the normative CONVENTION.md and the conformance vectors.",
|
|
5
8
|
"type": "module",
|
|
6
9
|
"main": "./dist/index.cjs",
|
|
@@ -8,9 +11,14 @@
|
|
|
8
11
|
"types": "./dist/index.d.ts",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
"import": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"require": {
|
|
19
|
+
"types": "./dist/index.d.cts",
|
|
20
|
+
"default": "./dist/index.cjs"
|
|
21
|
+
}
|
|
14
22
|
}
|
|
15
23
|
},
|
|
16
24
|
"files": [
|
|
@@ -22,7 +30,7 @@
|
|
|
22
30
|
"test/vectors"
|
|
23
31
|
],
|
|
24
32
|
"dependencies": {
|
|
25
|
-
"@inversealtruism/csd-codec": "0.1.
|
|
33
|
+
"@inversealtruism/csd-codec": "0.1.15"
|
|
26
34
|
},
|
|
27
35
|
"license": "MIT",
|
|
28
36
|
"sideEffects": false,
|
|
@@ -37,6 +45,6 @@
|
|
|
37
45
|
"homepage": "https://cairn-substrate.com/trade",
|
|
38
46
|
"scripts": {
|
|
39
47
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
40
|
-
"test": "tsx test/vectors.test.ts && tsx test/name-decoy.test.ts && tsx test/client-helpers.test.ts"
|
|
48
|
+
"test": "tsx test/vectors.test.ts && tsx test/name-decoy.test.ts && tsx test/client-helpers.test.ts && tsx test/paidto.test.ts"
|
|
41
49
|
}
|
|
42
50
|
}
|