@chainvue/verus-sdk 0.15.0 → 0.16.0
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/README.md +9 -0
- package/dist/assemble/assembler.d.ts +2 -8
- package/dist/assemble/assembler.d.ts.map +1 -1
- package/dist/assemble/assembler.js +30 -20
- package/dist/assemble/assembler.js.map +1 -1
- package/dist/assemble/fundedIdentityUpdate.d.ts +0 -3
- package/dist/assemble/fundedIdentityUpdate.d.ts.map +1 -1
- package/dist/assemble/fundedIdentityUpdate.js +22 -14
- package/dist/assemble/fundedIdentityUpdate.js.map +1 -1
- package/dist/bundle.js +173 -159
- package/dist/constants/index.d.ts +8 -2
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +9 -3
- package/dist/constants/index.js.map +1 -1
- package/dist/currency/index.d.ts.map +1 -1
- package/dist/currency/index.js +0 -3
- package/dist/currency/index.js.map +1 -1
- package/dist/currency/launch.d.ts.map +1 -1
- package/dist/currency/launch.js +0 -2
- package/dist/currency/launch.js.map +1 -1
- package/dist/fee/index.d.ts +116 -0
- package/dist/fee/index.d.ts.map +1 -0
- package/dist/fee/index.js +228 -0
- package/dist/fee/index.js.map +1 -0
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +2 -16
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/multisig.d.ts.map +1 -1
- package/dist/identity/multisig.js +23 -18
- package/dist/identity/multisig.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -33
- package/dist/index.js.map +1 -1
- package/dist/offers/identity.d.ts.map +1 -1
- package/dist/offers/identity.js +40 -32
- package/dist/offers/identity.js.map +1 -1
- package/dist/offers/reclaim.d.ts.map +1 -1
- package/dist/offers/reclaim.js +29 -21
- package/dist/offers/reclaim.js.map +1 -1
- package/dist/offers/taker.d.ts.map +1 -1
- package/dist/offers/taker.js +22 -17
- package/dist/offers/taker.js.map +1 -1
- package/dist/transfer/index.d.ts.map +1 -1
- package/dist/transfer/index.js +0 -2
- package/dist/transfer/index.js.map +1 -1
- package/dist/utxo/index.d.ts +11 -8
- package/dist/utxo/index.d.ts.map +1 -1
- package/dist/utxo/index.js +20 -37
- package/dist/utxo/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -22,8 +22,14 @@ export declare const CONSENSUS_BRANCH_ID = 1991772603;
|
|
|
22
22
|
export declare const VERSION_GROUP_ID = 2301567109;
|
|
23
23
|
/** Default transaction version */
|
|
24
24
|
export declare const TX_VERSION = 4;
|
|
25
|
-
/**
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The daemon's standard transaction fee unit: 10000 sat = 0.0001 VRSC. A
|
|
27
|
+
* CONSTANT, not a rate — VerusCoin charges it once per output, never per byte
|
|
28
|
+
* (wallet.h:51 `static const CAmount DEFAULT_TRANSACTION_FEE = 0.0001 * COIN;`
|
|
29
|
+
* with COIN = 100000000, amount.h:16). See `src/fee/index.ts` for the rule it
|
|
30
|
+
* feeds.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DEFAULT_TRANSACTION_FEE = 10000n;
|
|
27
33
|
/** Minimum output value (dust threshold) */
|
|
28
34
|
export declare const DUST_THRESHOLD = 546n;
|
|
29
35
|
/** Default registration fee: 100 VRSC in satoshis */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAE5C,eAAO,MAAM,cAAc;;;;;;;;;;;;;CAajB,CAAC;AAEX,kCAAkC;AAClC,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C,+BAA+B;AAC/B,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAE3C,kCAAkC;AAClC,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAE5C,eAAO,MAAM,cAAc;;;;;;;;;;;;;CAajB,CAAC;AAEX,kCAAkC;AAClC,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C,+BAA+B;AAC/B,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAE3C,kCAAkC;AAClC,eAAO,MAAM,UAAU,IAAI,CAAC;AAE5B;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,SAAU,CAAC;AAE/C,4CAA4C;AAC5C,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,qDAAqD;AACrD,eAAO,MAAM,wBAAwB,eAAkB,CAAC;AAExD,wDAAwD;AACxD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,0DAA0D;AAC1D,eAAO,MAAM,oBAAoB,SAAU,CAAC;AAE5C,8DAA8D;AAC9D,eAAO,MAAM,yBAAyB,uCAAuC,CAAC;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,4CAA4C;AAC5C,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,wCAAwC;AACxC,eAAO,MAAM,kBAAkB,KAAO,CAAC;AAEvC,wBAAwB;AACxB,eAAO,MAAM,kBAAkB,KAAO,CAAC;AAEvC,gCAAgC;AAChC,eAAO,MAAM,UAAU,MAAO,CAAC;AAE/B,6CAA6C;AAC7C,eAAO,MAAM,4BAA4B,IAAM,CAAC;AAEhD,4BAA4B;AAC5B,eAAO,MAAM,oBAAoB,IAAM,CAAC;AAExC,sCAAsC;AACtC,eAAO,MAAM,WAAW,IAAI,CAAC"}
|
package/dist/constants/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Verus protocol constants and network configuration
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.HASH_SHA256 = exports.IDENTITY_FLAG_LOCKED = exports.IDENTITY_FLAG_ACTIVECURRENCY = exports.WIF_PREFIX = exports.SCRIPT_HASH_PREFIX = exports.PUBKEY_HASH_PREFIX = exports.I_ADDR_VERSION = exports.DEFAULT_EXPIRY_DELTA = exports.RESERVE_TRANSFER_EVAL_PKH = exports.RESERVE_TRANSFER_FEE = exports.DEFAULT_REFERRAL_LEVELS = exports.DEFAULT_REGISTRATION_FEE = exports.DUST_THRESHOLD = exports.
|
|
6
|
+
exports.HASH_SHA256 = exports.IDENTITY_FLAG_LOCKED = exports.IDENTITY_FLAG_ACTIVECURRENCY = exports.WIF_PREFIX = exports.SCRIPT_HASH_PREFIX = exports.PUBKEY_HASH_PREFIX = exports.I_ADDR_VERSION = exports.DEFAULT_EXPIRY_DELTA = exports.RESERVE_TRANSFER_EVAL_PKH = exports.RESERVE_TRANSFER_FEE = exports.DEFAULT_REFERRAL_LEVELS = exports.DEFAULT_REGISTRATION_FEE = exports.DUST_THRESHOLD = exports.DEFAULT_TRANSACTION_FEE = exports.TX_VERSION = exports.VERSION_GROUP_ID = exports.CONSENSUS_BRANCH_ID = exports.NETWORK_CONFIG = void 0;
|
|
7
7
|
exports.NETWORK_CONFIG = {
|
|
8
8
|
mainnet: {
|
|
9
9
|
chainId: 'i5w5MuNik5NtLcYmNzcvaoixooEebB6MGV',
|
|
@@ -24,8 +24,14 @@ exports.CONSENSUS_BRANCH_ID = 0x76b809bb;
|
|
|
24
24
|
exports.VERSION_GROUP_ID = 0x892f2085;
|
|
25
25
|
/** Default transaction version */
|
|
26
26
|
exports.TX_VERSION = 4;
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* The daemon's standard transaction fee unit: 10000 sat = 0.0001 VRSC. A
|
|
29
|
+
* CONSTANT, not a rate — VerusCoin charges it once per output, never per byte
|
|
30
|
+
* (wallet.h:51 `static const CAmount DEFAULT_TRANSACTION_FEE = 0.0001 * COIN;`
|
|
31
|
+
* with COIN = 100000000, amount.h:16). See `src/fee/index.ts` for the rule it
|
|
32
|
+
* feeds.
|
|
33
|
+
*/
|
|
34
|
+
exports.DEFAULT_TRANSACTION_FEE = 10000n;
|
|
29
35
|
/** Minimum output value (dust threshold) */
|
|
30
36
|
exports.DUST_THRESHOLD = 546n;
|
|
31
37
|
/** Default registration fee: 100 VRSC in satoshis */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIU,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE;QACP,OAAO,EAAE,oCAAoC;QAC7C,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,IAAI;QAChB,GAAG,EAAE,IAAI;KACV;IACD,OAAO,EAAE;QACP,OAAO,EAAE,oCAAoC;QAC7C,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,IAAI;QAChB,GAAG,EAAE,IAAI;KACV;CACO,CAAC;AAEX,kCAAkC;AACrB,QAAA,mBAAmB,GAAG,UAAU,CAAC;AAE9C,+BAA+B;AAClB,QAAA,gBAAgB,GAAG,UAAU,CAAC;AAE3C,kCAAkC;AACrB,QAAA,UAAU,GAAG,CAAC,CAAC;AAE5B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIU,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE;QACP,OAAO,EAAE,oCAAoC;QAC7C,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,IAAI;QAChB,GAAG,EAAE,IAAI;KACV;IACD,OAAO,EAAE;QACP,OAAO,EAAE,oCAAoC;QAC7C,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,IAAI;QAChB,GAAG,EAAE,IAAI;KACV;CACO,CAAC;AAEX,kCAAkC;AACrB,QAAA,mBAAmB,GAAG,UAAU,CAAC;AAE9C,+B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D,YAAY,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAIlF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,YAAY,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAK9F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAKrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAIpF;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,OAAO,GACf,oBAAoB,CAiEtB"}
|
package/dist/currency/index.js
CHANGED
|
@@ -103,9 +103,6 @@ function defineCurrency(params, network) {
|
|
|
103
103
|
{ script: currencyDefScript, nativeSat: currencyDefValue },
|
|
104
104
|
],
|
|
105
105
|
changeAddress: params.changeAddress,
|
|
106
|
-
// The identity + currency-definition outputs can be large; size the fee from
|
|
107
|
-
// their real byte length so the tx isn't estimated below the relay minimum.
|
|
108
|
-
extraOutputBytes: identityOutputScript.length + currencyDefScript.length,
|
|
109
106
|
label: 'currency definition',
|
|
110
107
|
});
|
|
111
108
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/currency/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;AAiDH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/currency/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;AAiDH,wCAoEC;AAnHD,qCAAqC;AACrC,6CAAsE;AAA7D,+GAAA,gBAAgB,OAAA;AAAE,kHAAA,mBAAmB,OAAA;AAG9C,qEAAqE;AACrE,iDAOyB;AANvB,4HAAA,2BAA2B,OAAA;AAC3B,8HAAA,6BAA6B,OAAA;AAC7B,gHAAA,eAAe,OAAA;AACf,4HAAA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AE,OAAO,GACf,sBAAsB,CA4DxB"}
|
package/dist/currency/launch.js
CHANGED
|
@@ -69,7 +69,6 @@ function buildCurrencyLaunchTransaction(params, network) {
|
|
|
69
69
|
script: Buffer.from(o.script, 'hex'),
|
|
70
70
|
nativeSat: o.value,
|
|
71
71
|
}));
|
|
72
|
-
const extraOutputBytes = consensusOutputs.reduce((sum, o) => sum + o.script.length, 0);
|
|
73
72
|
const assembled = (0, fundedIdentityUpdate_js_1.assembleFundedIdentityUpdate)({
|
|
74
73
|
network,
|
|
75
74
|
wif: params.wif,
|
|
@@ -81,7 +80,6 @@ function buildCurrencyLaunchTransaction(params, network) {
|
|
|
81
80
|
identityUtxo: params.identityUtxo,
|
|
82
81
|
outputs: consensusOutputs,
|
|
83
82
|
changeAddress: params.changeAddress ?? identityAddress,
|
|
84
|
-
extraOutputBytes,
|
|
85
83
|
label: 'currency launch',
|
|
86
84
|
});
|
|
87
85
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launch.js","sourceRoot":"","sources":["../../src/currency/launch.ts"],"names":[],"mappings":";;AAwEA,
|
|
1
|
+
{"version":3,"file":"launch.js","sourceRoot":"","sources":["../../src/currency/launch.ts"],"names":[],"mappings":";;AAwEA,wEA+DC;AAvID;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qDAA+C;AAE/C,oDAA6E;AAE7E,kDAAiD;AACjD,mDAA0D;AAC1D,+CAA+C;AAC/C,4CAAsE;AACtE,iFAAmF;AACnF,6CAA0D;AAsC1D;;;;GAIG;AACH,SAAgB,8BAA8B,CAC5C,MAA8B,EAC9B,OAAgB;IAEhB,MAAM,QAAQ,GAAG,IAAA,sBAAW,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACpB,MAAM,IAAI,2BAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,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G,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/D,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC;QACpC,SAAS,EAAE,CAAC,CAAC,KAAK;KACnB,CAAC,CAAC,CAAC;IACJ,MAAM,SAAS,GAAG,IAAA,sDAA4B,EAAC;QAC7C,OAAO;QACP,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,6EAA6E;QAC7E,yEAAyE;QACzE,uDAAuD;QACvD,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,MAAM,GAAG,+BAAoB;QACzE,OAAO,EAAE,MAAM,CAAC,YAAY;QAC5B,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,OAAO,EAAE,gBAAgB;QACzB,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,eAAe;QACtD,KAAK,EAAE,iBAAiB;KACzB,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ,EAAE,SAAS,CAAC,QAAQ;QAC5B,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,GAAG,EAAE,SAAS,CAAC,GAAG;QAClB,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,UAAU,EAAE,SAAS,CAAC,UAAU;QAChC,eAAe,EAAE,eAAe;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The daemon's miner-fee rule, ported offline.
|
|
3
|
+
*
|
|
4
|
+
* VerusCoin does NOT price a transaction by its size. There is no byte-rate
|
|
5
|
+
* anywhere on the acceptance path: `AcceptToMemoryPool`'s minimum is
|
|
6
|
+
* `GetMinRelayFeeByOutputs` (VerusCoin src/main.cpp:2270 →
|
|
7
|
+
* src/pbaas/reserves.cpp:7906), which contains no size term at all. The
|
|
8
|
+
* size-based `GetMinRelayFee` survives in exactly one call site, and it is the
|
|
9
|
+
* absurdly-HIGH-fee ceiling (src/main.cpp:2326, inside `if (fRejectAbsurdFee …)`);
|
|
10
|
+
* the `minRelayTxFee` CFeeRate is otherwise only the dust threshold
|
|
11
|
+
* (src/main.cpp:878) and the miner's block-template sort (src/miner.cpp:3309).
|
|
12
|
+
* Measured: VRSC txid 87c5bb69a41d778903b899d8880191ede6e93e9da5c64bc90170bd8265e97150
|
|
13
|
+
* (block 4,163,006) is 185,212 bytes with 1,255 inputs and one output, and paid
|
|
14
|
+
* exactly 10,000 satoshis — 54 sat/kB, under the 100 sat/kB `minRelayTxFee`, and
|
|
15
|
+
* mined.
|
|
16
|
+
*
|
|
17
|
+
* The real rule is per OUTPUT:
|
|
18
|
+
*
|
|
19
|
+
* fee = 10_000 × (identityFeeFactor or 1) // base
|
|
20
|
+
* + 10_000 × (recipient outputs beyond the first) // per-output
|
|
21
|
+
* + 10_000 per output script over 2000 bytes // large-script
|
|
22
|
+
* (+10_000 more over 4000 bytes)
|
|
23
|
+
*
|
|
24
|
+
* Two twins implement it. `estimateMinerFee` ports the SENDER side —
|
|
25
|
+
* `GetMinRelayFeeForOutputs` / `GetMinRelayFeeForBuilder`
|
|
26
|
+
* (src/rpc/pbaasrpc.cpp:10732 / :10556), which allow ONE free output and are what
|
|
27
|
+
* the daemon's own wallet pays. `relayMinimumFee` ports the MEMPOOL side —
|
|
28
|
+
* `GetMinRelayFeeByOutputs` (src/pbaas/reserves.cpp:7906), which allows THREE and
|
|
29
|
+
* counts change, and is used here only as a fail-closed postcondition. Paying the
|
|
30
|
+
* stricter sender rule keeps every SDK transaction on the safe side of consensus.
|
|
31
|
+
*
|
|
32
|
+
* Live confirmation of the per-output term: VRSC txid
|
|
33
|
+
* 5e8d94dd72f64a5e59eb0158138c9e11209d74a423cf295a2171b7ee0ec3422a — 1 input,
|
|
34
|
+
* 17 vouts (16 recipients + 1 change back to the input address), 755 bytes, fee
|
|
35
|
+
* 160,000 = 10,000 + 15 × 10,000. No sat/byte rate explains it.
|
|
36
|
+
*
|
|
37
|
+
* All amounts are bigint satoshis.
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* The daemon's per-output large-script surcharge threshold:
|
|
41
|
+
* `CScript::MAX_SCRIPT_ELEMENT_SIZE / 3` (src/pbaas/reserves.cpp:7959,
|
|
42
|
+
* src/rpc/pbaasrpc.cpp:10786). `MAX_SCRIPT_ELEMENT_SIZE` is a runtime-mutable
|
|
43
|
+
* static (src/script/script.h:518) set to `MAX_SCRIPT_ELEMENT_SIZE_PBAAS = 6000`
|
|
44
|
+
* once PBaaS activates (src/script/script.h:36, src/main.cpp:3376-3382), so the
|
|
45
|
+
* threshold is 2000 on both live chains. A pre-PBaaS chain would use the SMALLER
|
|
46
|
+
* 3073/1024, i.e. charge the surcharge sooner — this is the one constant to
|
|
47
|
+
* revisit if a non-PBaaS chain is ever targeted.
|
|
48
|
+
*/
|
|
49
|
+
export declare const LARGE_SCRIPT_FEE_THRESHOLD = 2000;
|
|
50
|
+
/**
|
|
51
|
+
* `identityFeeFactor`, summed over every identity output a transaction carries.
|
|
52
|
+
* Port of src/main.cpp:2216-2233 (consensus) and src/rpc/pbaasrpc.cpp:10690-10715
|
|
53
|
+
* (the RPC twin):
|
|
54
|
+
*
|
|
55
|
+
* factor += ceil(serSize / 128) // only when the contentMultiMap is non-empty
|
|
56
|
+
* factor += contentMap.size()
|
|
57
|
+
* factor += max(primaryAddresses - 1, 0)
|
|
58
|
+
* factor += max(privateAddresses - 1, 0)
|
|
59
|
+
*
|
|
60
|
+
* where `serSize = GetSerializeSize(identity) - GetSerializeSize(identity with the
|
|
61
|
+
* contentMultiMap cleared)` (src/main.cpp:2222) — the serialized size of the
|
|
62
|
+
* contentMultiMap itself, NOT the output script's length and NOT the transaction's
|
|
63
|
+
* size. So content costs 10,000 satoshis per 128 bytes ≈ 78.1 sat/byte. Measured
|
|
64
|
+
* on VRSC: identity updates whose identity script ran 444 / 463 / 595 / 1474 /
|
|
65
|
+
* 2072 bytes paid 10,000 / 20,000 / 30,000 / 100,000 / 140,000 — pure multiples
|
|
66
|
+
* of 10,000 that track the content, never the 905-2695-byte transactions.
|
|
67
|
+
*
|
|
68
|
+
* The SDK's identity serialization is byte-locked to the daemon's by the golden
|
|
69
|
+
* snapshots, so this delta is exact rather than an estimate.
|
|
70
|
+
*/
|
|
71
|
+
export declare function computeIdentityFeeFactor(outputScripts: readonly Buffer[]): number;
|
|
72
|
+
/**
|
|
73
|
+
* What this SDK pays: the daemon's SENDER-side minimum for a transaction whose
|
|
74
|
+
* NON-CHANGE outputs have these scripts. Port of `GetMinRelayFeeForOutputs`
|
|
75
|
+
* (src/rpc/pbaasrpc.cpp:10732) / `GetMinRelayFeeForBuilder` (:10556) with
|
|
76
|
+
* `idExtraLimit` pinned to 0 (see {@link ID_EXTRA_LIMIT}).
|
|
77
|
+
*
|
|
78
|
+
* The daemon's input term is `max(SpendCount() - 1, 0)`, and `SpendCount()` is
|
|
79
|
+
* the count of SAPLING spends (src/transaction_builder.h:123-126) — always 0 for
|
|
80
|
+
* the transparent transactions this SDK builds. There is no per-input fee, which
|
|
81
|
+
* is why a 1,255-input transaction pays 10,000.
|
|
82
|
+
*
|
|
83
|
+
* @param outputScripts scriptPubKeys of the declared (non-change) outputs.
|
|
84
|
+
*/
|
|
85
|
+
export declare function estimateMinerFee(outputScripts: readonly Buffer[]): bigint;
|
|
86
|
+
/**
|
|
87
|
+
* The daemon's mempool ACCEPTANCE floor for a transaction with these FINAL vout
|
|
88
|
+
* scripts (change included). Port of `GetMinRelayFeeByOutputs`
|
|
89
|
+
* (src/pbaas/reserves.cpp:7906), the value `AcceptToMemoryPool` compares `nFees`
|
|
90
|
+
* against (src/main.cpp:2270, :2280, :2296).
|
|
91
|
+
*
|
|
92
|
+
* This is looser than {@link estimateMinerFee} — it allows three free outputs
|
|
93
|
+
* rather than one — so it is used only as a postcondition, never to size a fee.
|
|
94
|
+
*/
|
|
95
|
+
export declare function relayMinimumFee(outputScripts: readonly Buffer[]): bigint;
|
|
96
|
+
/**
|
|
97
|
+
* Fail closed if the fee we chose would not clear the daemon's relay minimum for
|
|
98
|
+
* the transaction we actually built.
|
|
99
|
+
*
|
|
100
|
+
* `estimateMinerFee >= relayMinimumFee` holds by construction for every shape the
|
|
101
|
+
* SDK emits: the sender rule's allowance is 1 output against the mempool's 3, and
|
|
102
|
+
* the SDK adds at most 2 change outputs. The ONE way this can fire is a CHANGE
|
|
103
|
+
* output whose script exceeds the 2000-byte surcharge threshold (a token-change
|
|
104
|
+
* reserve output bundling ~48 currencies), which cannot be known before selection.
|
|
105
|
+
* Handing the caller a typed error there is strictly better than handing them a
|
|
106
|
+
* transaction that lands in the daemon's free-transaction rate limiter
|
|
107
|
+
* (src/main.cpp:2296-2317) — where acceptance depends on network-wide free-relay
|
|
108
|
+
* volume at that moment, and is an outright reject above 15,000 bytes.
|
|
109
|
+
*
|
|
110
|
+
* Asserted on the miner fee alone, not `fee + burnSat`: stricter, and every
|
|
111
|
+
* declared-burn path still clears it.
|
|
112
|
+
*
|
|
113
|
+
* @param outputScripts scriptPubKeys of the FINAL vout set, change included.
|
|
114
|
+
*/
|
|
115
|
+
export declare function assertFeeMeetsRelayMinimum(fee: bigint, outputScripts: readonly Buffer[], label: string): void;
|
|
116
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fee/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAMH;;;;;;;;;GASG;AACH,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAiD/C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAqBjF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAkBzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAYxE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,KAAK,EAAE,MAAM,GACZ,IAAI,CAQN"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The daemon's miner-fee rule, ported offline.
|
|
4
|
+
*
|
|
5
|
+
* VerusCoin does NOT price a transaction by its size. There is no byte-rate
|
|
6
|
+
* anywhere on the acceptance path: `AcceptToMemoryPool`'s minimum is
|
|
7
|
+
* `GetMinRelayFeeByOutputs` (VerusCoin src/main.cpp:2270 →
|
|
8
|
+
* src/pbaas/reserves.cpp:7906), which contains no size term at all. The
|
|
9
|
+
* size-based `GetMinRelayFee` survives in exactly one call site, and it is the
|
|
10
|
+
* absurdly-HIGH-fee ceiling (src/main.cpp:2326, inside `if (fRejectAbsurdFee …)`);
|
|
11
|
+
* the `minRelayTxFee` CFeeRate is otherwise only the dust threshold
|
|
12
|
+
* (src/main.cpp:878) and the miner's block-template sort (src/miner.cpp:3309).
|
|
13
|
+
* Measured: VRSC txid 87c5bb69a41d778903b899d8880191ede6e93e9da5c64bc90170bd8265e97150
|
|
14
|
+
* (block 4,163,006) is 185,212 bytes with 1,255 inputs and one output, and paid
|
|
15
|
+
* exactly 10,000 satoshis — 54 sat/kB, under the 100 sat/kB `minRelayTxFee`, and
|
|
16
|
+
* mined.
|
|
17
|
+
*
|
|
18
|
+
* The real rule is per OUTPUT:
|
|
19
|
+
*
|
|
20
|
+
* fee = 10_000 × (identityFeeFactor or 1) // base
|
|
21
|
+
* + 10_000 × (recipient outputs beyond the first) // per-output
|
|
22
|
+
* + 10_000 per output script over 2000 bytes // large-script
|
|
23
|
+
* (+10_000 more over 4000 bytes)
|
|
24
|
+
*
|
|
25
|
+
* Two twins implement it. `estimateMinerFee` ports the SENDER side —
|
|
26
|
+
* `GetMinRelayFeeForOutputs` / `GetMinRelayFeeForBuilder`
|
|
27
|
+
* (src/rpc/pbaasrpc.cpp:10732 / :10556), which allow ONE free output and are what
|
|
28
|
+
* the daemon's own wallet pays. `relayMinimumFee` ports the MEMPOOL side —
|
|
29
|
+
* `GetMinRelayFeeByOutputs` (src/pbaas/reserves.cpp:7906), which allows THREE and
|
|
30
|
+
* counts change, and is used here only as a fail-closed postcondition. Paying the
|
|
31
|
+
* stricter sender rule keeps every SDK transaction on the safe side of consensus.
|
|
32
|
+
*
|
|
33
|
+
* Live confirmation of the per-output term: VRSC txid
|
|
34
|
+
* 5e8d94dd72f64a5e59eb0158138c9e11209d74a423cf295a2171b7ee0ec3422a — 1 input,
|
|
35
|
+
* 17 vouts (16 recipients + 1 change back to the input address), 755 bytes, fee
|
|
36
|
+
* 160,000 = 10,000 + 15 × 10,000. No sat/byte rate explains it.
|
|
37
|
+
*
|
|
38
|
+
* All amounts are bigint satoshis.
|
|
39
|
+
*/
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.LARGE_SCRIPT_FEE_THRESHOLD = void 0;
|
|
42
|
+
exports.computeIdentityFeeFactor = computeIdentityFeeFactor;
|
|
43
|
+
exports.estimateMinerFee = estimateMinerFee;
|
|
44
|
+
exports.relayMinimumFee = relayMinimumFee;
|
|
45
|
+
exports.assertFeeMeetsRelayMinimum = assertFeeMeetsRelayMinimum;
|
|
46
|
+
const boundary_js_1 = require("../fork/boundary.js");
|
|
47
|
+
const index_js_1 = require("../constants/index.js");
|
|
48
|
+
const errors_js_1 = require("../errors.js");
|
|
49
|
+
/**
|
|
50
|
+
* The daemon's per-output large-script surcharge threshold:
|
|
51
|
+
* `CScript::MAX_SCRIPT_ELEMENT_SIZE / 3` (src/pbaas/reserves.cpp:7959,
|
|
52
|
+
* src/rpc/pbaasrpc.cpp:10786). `MAX_SCRIPT_ELEMENT_SIZE` is a runtime-mutable
|
|
53
|
+
* static (src/script/script.h:518) set to `MAX_SCRIPT_ELEMENT_SIZE_PBAAS = 6000`
|
|
54
|
+
* once PBaaS activates (src/script/script.h:36, src/main.cpp:3376-3382), so the
|
|
55
|
+
* threshold is 2000 on both live chains. A pre-PBaaS chain would use the SMALLER
|
|
56
|
+
* 3073/1024, i.e. charge the surcharge sooner — this is the one constant to
|
|
57
|
+
* revisit if a non-PBaaS chain is ever targeted.
|
|
58
|
+
*/
|
|
59
|
+
exports.LARGE_SCRIPT_FEE_THRESHOLD = 2000;
|
|
60
|
+
/**
|
|
61
|
+
* `idExtraLimit` — the extra free-output allowance the daemon grants a
|
|
62
|
+
* transaction carrying an identity RESERVATION output, worth
|
|
63
|
+
* `parentCurrency.IDReferralLevels() + 2` outputs (src/pbaas/reserves.cpp:7918,
|
|
64
|
+
* src/rpc/pbaasrpc.cpp:10745). Reading `IDReferralLevels()` needs a `getcurrency`
|
|
65
|
+
* call, which this offline SDK cannot make. A GUESSED allowance can only
|
|
66
|
+
* underpay; taking NO allowance can only overpay, so it is fixed at 0 here. The
|
|
67
|
+
* cost is ≤ 0.0003 VRSC of extra miner fee on a registration that already burns
|
|
68
|
+
* 100 VRSC.
|
|
69
|
+
*/
|
|
70
|
+
const ID_EXTRA_LIMIT = 0;
|
|
71
|
+
/**
|
|
72
|
+
* The daemon's per-output surcharge for an oversized script:
|
|
73
|
+
* `minFee += DEFAULT_TRANSACTION_FEE + ((extraSize - extraOutputCostThreshold) > 0 ? DEFAULT_TRANSACTION_FEE : 0)`
|
|
74
|
+
* with `extraSize = max(scriptLen - threshold, 0)` (src/pbaas/reserves.cpp:7980).
|
|
75
|
+
* So: over 2000 bytes costs one extra fee, over 4000 costs two.
|
|
76
|
+
*/
|
|
77
|
+
function largeScriptSurcharge(scriptLength) {
|
|
78
|
+
if (scriptLength > 2 * exports.LARGE_SCRIPT_FEE_THRESHOLD)
|
|
79
|
+
return 2n * index_js_1.DEFAULT_TRANSACTION_FEE;
|
|
80
|
+
if (scriptLength > exports.LARGE_SCRIPT_FEE_THRESHOLD)
|
|
81
|
+
return index_js_1.DEFAULT_TRANSACTION_FEE;
|
|
82
|
+
return 0n;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Parse an EVAL_IDENTITY_PRIMARY output script back into its Identity, or null
|
|
86
|
+
* for any other output. Mirrors the daemon's own walk over `tx.vout`
|
|
87
|
+
* (src/main.cpp:2206-2216): it tests `IsPayToCryptoCondition(p) && p.IsValid() &&
|
|
88
|
+
* p.vData.size() && p.evalCode == EVAL_IDENTITY_PRIMARY`. Anything that is not a
|
|
89
|
+
* smart-transaction script (P2PKH, P2ID, a reserve output, a commitment) fails to
|
|
90
|
+
* unpack and is simply not an identity output — the same conclusion the daemon
|
|
91
|
+
* reaches, so a failed parse is the normal path, not an error.
|
|
92
|
+
*
|
|
93
|
+
* The returned Identity is a fresh parse owned by the caller, so
|
|
94
|
+
* {@link computeIdentityFeeFactor} may mutate it.
|
|
95
|
+
*/
|
|
96
|
+
function parseIdentityOutput(script) {
|
|
97
|
+
try {
|
|
98
|
+
const parsed = new boundary_js_1.IdentityScript();
|
|
99
|
+
parsed.fromBuffer(script);
|
|
100
|
+
if (parsed.paramsOptCC.eval_code.toNumber() !== boundary_js_1.EVALS.EVAL_IDENTITY_PRIMARY)
|
|
101
|
+
return null;
|
|
102
|
+
return parsed.getIdentity();
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* `identityFeeFactor`, summed over every identity output a transaction carries.
|
|
110
|
+
* Port of src/main.cpp:2216-2233 (consensus) and src/rpc/pbaasrpc.cpp:10690-10715
|
|
111
|
+
* (the RPC twin):
|
|
112
|
+
*
|
|
113
|
+
* factor += ceil(serSize / 128) // only when the contentMultiMap is non-empty
|
|
114
|
+
* factor += contentMap.size()
|
|
115
|
+
* factor += max(primaryAddresses - 1, 0)
|
|
116
|
+
* factor += max(privateAddresses - 1, 0)
|
|
117
|
+
*
|
|
118
|
+
* where `serSize = GetSerializeSize(identity) - GetSerializeSize(identity with the
|
|
119
|
+
* contentMultiMap cleared)` (src/main.cpp:2222) — the serialized size of the
|
|
120
|
+
* contentMultiMap itself, NOT the output script's length and NOT the transaction's
|
|
121
|
+
* size. So content costs 10,000 satoshis per 128 bytes ≈ 78.1 sat/byte. Measured
|
|
122
|
+
* on VRSC: identity updates whose identity script ran 444 / 463 / 595 / 1474 /
|
|
123
|
+
* 2072 bytes paid 10,000 / 20,000 / 30,000 / 100,000 / 140,000 — pure multiples
|
|
124
|
+
* of 10,000 that track the content, never the 905-2695-byte transactions.
|
|
125
|
+
*
|
|
126
|
+
* The SDK's identity serialization is byte-locked to the daemon's by the golden
|
|
127
|
+
* snapshots, so this delta is exact rather than an estimate.
|
|
128
|
+
*/
|
|
129
|
+
function computeIdentityFeeFactor(outputScripts) {
|
|
130
|
+
let factor = 0;
|
|
131
|
+
for (const script of outputScripts) {
|
|
132
|
+
const identity = parseIdentityOutput(script);
|
|
133
|
+
if (identity === null)
|
|
134
|
+
continue;
|
|
135
|
+
factor += identity.content_map?.size ?? 0;
|
|
136
|
+
factor += Math.max((identity.primary_addresses?.length ?? 0) - 1, 0);
|
|
137
|
+
factor += Math.max((identity.private_addresses?.length ?? 0) - 1, 0);
|
|
138
|
+
// The daemon only charges the content factor when the multimap is non-empty
|
|
139
|
+
// (`if (identity.contentMultiMap.size())`, src/main.cpp:2221). Clearing it
|
|
140
|
+
// here mutates only our private parse.
|
|
141
|
+
if ((identity.content_multimap?.kv_content?.size ?? 0) > 0) {
|
|
142
|
+
const withContent = identity.getByteLength();
|
|
143
|
+
identity.clearContentMultiMap();
|
|
144
|
+
const serSize = withContent - identity.getByteLength();
|
|
145
|
+
factor += Math.ceil(serSize / 128);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return factor;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* What this SDK pays: the daemon's SENDER-side minimum for a transaction whose
|
|
152
|
+
* NON-CHANGE outputs have these scripts. Port of `GetMinRelayFeeForOutputs`
|
|
153
|
+
* (src/rpc/pbaasrpc.cpp:10732) / `GetMinRelayFeeForBuilder` (:10556) with
|
|
154
|
+
* `idExtraLimit` pinned to 0 (see {@link ID_EXTRA_LIMIT}).
|
|
155
|
+
*
|
|
156
|
+
* The daemon's input term is `max(SpendCount() - 1, 0)`, and `SpendCount()` is
|
|
157
|
+
* the count of SAPLING spends (src/transaction_builder.h:123-126) — always 0 for
|
|
158
|
+
* the transparent transactions this SDK builds. There is no per-input fee, which
|
|
159
|
+
* is why a 1,255-input transaction pays 10,000.
|
|
160
|
+
*
|
|
161
|
+
* @param outputScripts scriptPubKeys of the declared (non-change) outputs.
|
|
162
|
+
*/
|
|
163
|
+
function estimateMinerFee(outputScripts) {
|
|
164
|
+
const factor = BigInt(computeIdentityFeeFactor(outputScripts));
|
|
165
|
+
const count = outputScripts.length;
|
|
166
|
+
// `CAmount minFee = identityFeeFactor * DEFAULT_TRANSACTION_FEE;` then
|
|
167
|
+
// `if (!minFee) minFee = DEFAULT_TRANSACTION_FEE;` (pbaasrpc.cpp:10735, :10765).
|
|
168
|
+
let fee = factor > 0n ? factor * index_js_1.DEFAULT_TRANSACTION_FEE : index_js_1.DEFAULT_TRANSACTION_FEE;
|
|
169
|
+
// `minFee += max(tOutputs.size() - (1 + idExtraLimit), 0) * DEFAULT_TRANSACTION_FEE`
|
|
170
|
+
// (pbaasrpc.cpp:10771). The z-output terms are 0 — this SDK builds none.
|
|
171
|
+
fee += BigInt(Math.max(count - (1 + ID_EXTRA_LIMIT), 0)) * index_js_1.DEFAULT_TRANSACTION_FEE;
|
|
172
|
+
// `if (!(identityFeeFactor && tOutputs.size() <= (1 + idExtraLimit)))` — an
|
|
173
|
+
// identity factor already prices its own oversized output (pbaasrpc.cpp:10782).
|
|
174
|
+
if (!(factor > 0n && count <= 1 + ID_EXTRA_LIMIT)) {
|
|
175
|
+
for (const script of outputScripts)
|
|
176
|
+
fee += largeScriptSurcharge(script.length);
|
|
177
|
+
}
|
|
178
|
+
return fee;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The daemon's mempool ACCEPTANCE floor for a transaction with these FINAL vout
|
|
182
|
+
* scripts (change included). Port of `GetMinRelayFeeByOutputs`
|
|
183
|
+
* (src/pbaas/reserves.cpp:7906), the value `AcceptToMemoryPool` compares `nFees`
|
|
184
|
+
* against (src/main.cpp:2270, :2280, :2296).
|
|
185
|
+
*
|
|
186
|
+
* This is looser than {@link estimateMinerFee} — it allows three free outputs
|
|
187
|
+
* rather than one — so it is used only as a postcondition, never to size a fee.
|
|
188
|
+
*/
|
|
189
|
+
function relayMinimumFee(outputScripts) {
|
|
190
|
+
const factor = BigInt(computeIdentityFeeFactor(outputScripts));
|
|
191
|
+
const count = outputScripts.length;
|
|
192
|
+
let fee = factor > 0n ? factor * index_js_1.DEFAULT_TRANSACTION_FEE : index_js_1.DEFAULT_TRANSACTION_FEE;
|
|
193
|
+
// `if (tx.vout.size() > (3 + idExtraLimit)) minFee += max(vout.size() - (3 + idExtraLimit), 0) * …`
|
|
194
|
+
// (reserves.cpp:7943).
|
|
195
|
+
fee += BigInt(Math.max(count - (3 + ID_EXTRA_LIMIT), 0)) * index_js_1.DEFAULT_TRANSACTION_FEE;
|
|
196
|
+
if (!(factor > 0n && count <= 3 + ID_EXTRA_LIMIT)) {
|
|
197
|
+
for (const script of outputScripts)
|
|
198
|
+
fee += largeScriptSurcharge(script.length);
|
|
199
|
+
}
|
|
200
|
+
return fee;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Fail closed if the fee we chose would not clear the daemon's relay minimum for
|
|
204
|
+
* the transaction we actually built.
|
|
205
|
+
*
|
|
206
|
+
* `estimateMinerFee >= relayMinimumFee` holds by construction for every shape the
|
|
207
|
+
* SDK emits: the sender rule's allowance is 1 output against the mempool's 3, and
|
|
208
|
+
* the SDK adds at most 2 change outputs. The ONE way this can fire is a CHANGE
|
|
209
|
+
* output whose script exceeds the 2000-byte surcharge threshold (a token-change
|
|
210
|
+
* reserve output bundling ~48 currencies), which cannot be known before selection.
|
|
211
|
+
* Handing the caller a typed error there is strictly better than handing them a
|
|
212
|
+
* transaction that lands in the daemon's free-transaction rate limiter
|
|
213
|
+
* (src/main.cpp:2296-2317) — where acceptance depends on network-wide free-relay
|
|
214
|
+
* volume at that moment, and is an outright reject above 15,000 bytes.
|
|
215
|
+
*
|
|
216
|
+
* Asserted on the miner fee alone, not `fee + burnSat`: stricter, and every
|
|
217
|
+
* declared-burn path still clears it.
|
|
218
|
+
*
|
|
219
|
+
* @param outputScripts scriptPubKeys of the FINAL vout set, change included.
|
|
220
|
+
*/
|
|
221
|
+
function assertFeeMeetsRelayMinimum(fee, outputScripts, label) {
|
|
222
|
+
const minimum = relayMinimumFee(outputScripts);
|
|
223
|
+
if (fee < minimum) {
|
|
224
|
+
throw new errors_js_1.TransactionBuildError(`${label}: miner fee ${fee} is below the daemon's relay minimum ${minimum} for this ` +
|
|
225
|
+
`transaction's ${outputScripts.length} output(s); it would not reliably relay.`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fee/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;;;AAsFH,4DAqBC;AAeD,4CAkBC;AAWD,0CAYC;AAqBD,gEAYC;AAlMD,qDAAsE;AACtE,oDAAgE;AAChE,4CAAqD;AAErD;;;;;;;;;GASG;AACU,QAAA,0BAA0B,GAAG,IAAI,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB;;;;;GAKG;AACH,SAAS,oBAAoB,CAAC,YAAoB;IAChD,IAAI,YAAY,GAAG,CAAC,GAAG,kC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sBAAsB,CAmDxB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,OAAO,GACf,sBAAsB,CAuDxB;AA6LD;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,OAAO,EAChB,SAAS,GAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,QAAmB,EACzE,gBAAgB,CAAC,EAAE;IAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1E,oBAAoB,CAoOtB"}
|
package/dist/identity/index.js
CHANGED
|
@@ -684,9 +684,6 @@ function _buildVrscRegistration(params, identityScript, reservationScript, ident
|
|
|
684
684
|
{ script: reservationScript, nativeSat: 0n },
|
|
685
685
|
],
|
|
686
686
|
changeAddress: params.changeAddress,
|
|
687
|
-
// Legacy fee estimate: identity + referrals + reservation, plus the one extra
|
|
688
|
-
// change slot the original path counted on top of selectUtxos' own reserve.
|
|
689
|
-
feeOutputCount: 2 + referralOutputs.length + 1,
|
|
690
687
|
fee: {
|
|
691
688
|
policy: 'declared',
|
|
692
689
|
burnSat: registrationOutlay - totalReferralPayments,
|
|
@@ -735,11 +732,8 @@ function _buildSubIdRegistration(params, identityScript, reservationScript, iden
|
|
|
735
732
|
'(from `getcurrency <parent>`), or 0n if it charges none.');
|
|
736
733
|
}
|
|
737
734
|
const nativeImportFee = params.nativeImportFee;
|
|
738
|
-
// The identity + reservation outputs carry 0 native
|
|
739
|
-
//
|
|
740
|
-
// makes them multi-KB), so the fee is sized from their real bytes — matching
|
|
741
|
-
// the VRSC/update/define paths — instead of the fixed smart-output estimate.
|
|
742
|
-
// The fee output carries the parent-currency registration fee (a reserve output
|
|
735
|
+
// The identity + reservation outputs carry 0 native, and the fee output
|
|
736
|
+
// carries the parent-currency registration fee (a reserve output
|
|
743
737
|
// for pp2, a reserve transfer for pp1); the parent's idimportfees leaves as a
|
|
744
738
|
// DECLARED native burn. Verified live on VRSCTEST: a sub-ID under `ownora`
|
|
745
739
|
// (1.0 token fee) paid 0.02 native.
|
|
@@ -756,10 +750,6 @@ function _buildSubIdRegistration(params, identityScript, reservationScript, iden
|
|
|
756
750
|
{ script: reservationScript, nativeSat: 0n },
|
|
757
751
|
],
|
|
758
752
|
changeAddress: params.changeAddress,
|
|
759
|
-
// Legacy fee estimate: identity + fee + reservation, plus the one extra change
|
|
760
|
-
// slot the original path counted on top of selectUtxos' own reserve.
|
|
761
|
-
feeOutputCount: 4,
|
|
762
|
-
extraOutputBytes: identityScript.length + reservationScript.length + feeOutput.script.length,
|
|
763
753
|
fee: {
|
|
764
754
|
policy: 'declared',
|
|
765
755
|
burnSat: nativeImportFee,
|
|
@@ -969,10 +959,6 @@ function buildAndSignIdentityUpdate(params, network, operation = 'update', lockU
|
|
|
969
959
|
identityUtxo: params.identityUtxo,
|
|
970
960
|
outputs: unfundedTx.outs.map((o) => ({ script: o.script, nativeSat: BigInt(o.value) })),
|
|
971
961
|
changeAddress: params.changeAddress,
|
|
972
|
-
// The identity output embeds the full serialized identity (a large
|
|
973
|
-
// contentMultimap can make it multi-KB); size the fee from the unfunded tx's
|
|
974
|
-
// real bytes so a big update isn't fee-estimated below the relay minimum.
|
|
975
|
-
extraOutputBytes: unfundedHex.length / 2,
|
|
976
962
|
label: `identity ${operation}`,
|
|
977
963
|
});
|
|
978
964
|
return {
|