@chainvue/verus-sdk 0.15.0 → 0.17.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 +179 -160
- package/dist/constants/index.d.ts +31 -3
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +32 -4
- 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 +26 -3
- package/dist/transfer/index.js.map +1 -1
- package/dist/types/index.d.ts +12 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/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
package/dist/bundle.js
CHANGED
|
@@ -9592,7 +9592,7 @@ var require_Identity = __commonJS({
|
|
|
9592
9592
|
exports2.IDENTITY_MAX_UNLOCK_DELAY = new bn_js_1.BN(60).mul(new bn_js_1.BN(24)).mul(new bn_js_1.BN(22)).mul(new bn_js_1.BN(365));
|
|
9593
9593
|
exports2.IDENTITY_MAX_NAME_LEN = new bn_js_1.BN(64);
|
|
9594
9594
|
var { BufferReader, BufferWriter } = bufferutils_1.default;
|
|
9595
|
-
var
|
|
9595
|
+
var Identity8 = class _Identity extends Principal_1.Principal {
|
|
9596
9596
|
constructor(data) {
|
|
9597
9597
|
super(data);
|
|
9598
9598
|
if (data === null || data === void 0 ? void 0 : data.version)
|
|
@@ -9959,14 +9959,14 @@ var require_Identity = __commonJS({
|
|
|
9959
9959
|
return _Identity.internalFromJson(json, _Identity);
|
|
9960
9960
|
}
|
|
9961
9961
|
};
|
|
9962
|
-
exports2.Identity =
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9962
|
+
exports2.Identity = Identity8;
|
|
9963
|
+
Identity8.VERSION_INVALID = new bn_js_1.BN(0);
|
|
9964
|
+
Identity8.VERSION_VERUSID = new bn_js_1.BN(1);
|
|
9965
|
+
Identity8.VERSION_VAULT = new bn_js_1.BN(2);
|
|
9966
|
+
Identity8.VERSION_PBAAS = new bn_js_1.BN(3);
|
|
9967
|
+
Identity8.VERSION_CURRENT = Identity8.VERSION_PBAAS;
|
|
9968
|
+
Identity8.VERSION_FIRSTVALID = new bn_js_1.BN(1);
|
|
9969
|
+
Identity8.VERSION_LASTVALID = new bn_js_1.BN(3);
|
|
9970
9970
|
}
|
|
9971
9971
|
});
|
|
9972
9972
|
|
|
@@ -11091,7 +11091,7 @@ var require_IdentityScript = __commonJS({
|
|
|
11091
11091
|
var IdentityID_1 = require_IdentityID();
|
|
11092
11092
|
var cccustom_1 = require_cccustom();
|
|
11093
11093
|
var KeyID_1 = require_KeyID();
|
|
11094
|
-
var
|
|
11094
|
+
var IdentityScript4 = class _IdentityScript extends SmartTransactionScript_1.SmartTransactionScript {
|
|
11095
11095
|
constructor(master, params) {
|
|
11096
11096
|
super(master, params);
|
|
11097
11097
|
}
|
|
@@ -11171,7 +11171,7 @@ var require_IdentityScript = __commonJS({
|
|
|
11171
11171
|
return identity;
|
|
11172
11172
|
}
|
|
11173
11173
|
};
|
|
11174
|
-
exports2.IdentityScript =
|
|
11174
|
+
exports2.IdentityScript = IdentityScript4;
|
|
11175
11175
|
}
|
|
11176
11176
|
});
|
|
11177
11177
|
|
|
@@ -20877,7 +20877,7 @@ var require_optccparams = __commonJS({
|
|
|
20877
20877
|
"node_modules/.pnpm/@bitgo+utxo-lib@https+++codeload.github.com+VerusCoin+BitGoJS+tar.gz+9701df63b479984f27_7b6d2dd0c6d9d9555ac626a4a148d56a/node_modules/@bitgo/utxo-lib/dist/src/optccparams.js"(exports2, module2) {
|
|
20878
20878
|
"use strict";
|
|
20879
20879
|
var bscript = require_script2();
|
|
20880
|
-
var
|
|
20880
|
+
var EVALS3 = require_evals2();
|
|
20881
20881
|
var varuint = require_varuint_bitcoin();
|
|
20882
20882
|
var TxDestination3 = require_tx_destination();
|
|
20883
20883
|
var bufferutils = require_bufferutils2();
|
|
@@ -20917,27 +20917,27 @@ var require_optccparams = __commonJS({
|
|
|
20917
20917
|
}
|
|
20918
20918
|
OptCCParams4.prototype.getParamObject = function() {
|
|
20919
20919
|
switch (this.evalCode) {
|
|
20920
|
-
case
|
|
20920
|
+
case EVALS3.EVAL_NONE: {
|
|
20921
20921
|
return null;
|
|
20922
20922
|
}
|
|
20923
|
-
case
|
|
20924
|
-
case
|
|
20925
|
-
case
|
|
20926
|
-
case
|
|
20927
|
-
case
|
|
20928
|
-
case
|
|
20929
|
-
case
|
|
20930
|
-
case
|
|
20931
|
-
case
|
|
20932
|
-
case
|
|
20933
|
-
case
|
|
20934
|
-
case
|
|
20935
|
-
case
|
|
20936
|
-
case
|
|
20937
|
-
case
|
|
20938
|
-
case
|
|
20939
|
-
case
|
|
20940
|
-
case
|
|
20923
|
+
case EVALS3.EVAL_STAKEGUARD:
|
|
20924
|
+
case EVALS3.EVAL_CURRENCY_DEFINITION:
|
|
20925
|
+
case EVALS3.EVAL_NOTARY_EVIDENCE:
|
|
20926
|
+
case EVALS3.EVAL_EARNEDNOTARIZATION:
|
|
20927
|
+
case EVALS3.EVAL_ACCEPTEDNOTARIZATION:
|
|
20928
|
+
case EVALS3.EVAL_FINALIZE_NOTARIZATION:
|
|
20929
|
+
case EVALS3.EVAL_CURRENCYSTATE:
|
|
20930
|
+
case EVALS3.EVAL_RESERVE_TRANSFER:
|
|
20931
|
+
case EVALS3.EVAL_RESERVE_OUTPUT:
|
|
20932
|
+
case EVALS3.EVAL_RESERVE_DEPOSIT:
|
|
20933
|
+
case EVALS3.EVAL_CROSSCHAIN_EXPORT:
|
|
20934
|
+
case EVALS3.EVAL_CROSSCHAIN_IMPORT:
|
|
20935
|
+
case EVALS3.EVAL_IDENTITY_PRIMARY:
|
|
20936
|
+
case EVALS3.EVAL_IDENTITY_COMMITMENT:
|
|
20937
|
+
case EVALS3.EVAL_IDENTITY_RESERVATION:
|
|
20938
|
+
case EVALS3.EVAL_FINALIZE_EXPORT:
|
|
20939
|
+
case EVALS3.EVAL_FEE_POOL:
|
|
20940
|
+
case EVALS3.EVAL_NOTARY_SIGNATURE: {
|
|
20941
20941
|
if (this.vData.length) {
|
|
20942
20942
|
return this.vData[0];
|
|
20943
20943
|
} else {
|
|
@@ -20952,28 +20952,28 @@ var require_optccparams = __commonJS({
|
|
|
20952
20952
|
OptCCParams4.prototype.isValid = function() {
|
|
20953
20953
|
var validEval = false;
|
|
20954
20954
|
switch (this.evalCode) {
|
|
20955
|
-
case
|
|
20955
|
+
case EVALS3.EVAL_NONE: {
|
|
20956
20956
|
validEval = true;
|
|
20957
20957
|
break;
|
|
20958
20958
|
}
|
|
20959
|
-
case
|
|
20960
|
-
case
|
|
20961
|
-
case
|
|
20962
|
-
case
|
|
20963
|
-
case
|
|
20964
|
-
case
|
|
20965
|
-
case
|
|
20966
|
-
case
|
|
20967
|
-
case
|
|
20968
|
-
case
|
|
20969
|
-
case
|
|
20970
|
-
case
|
|
20971
|
-
case
|
|
20972
|
-
case
|
|
20973
|
-
case
|
|
20974
|
-
case
|
|
20975
|
-
case
|
|
20976
|
-
case
|
|
20959
|
+
case EVALS3.EVAL_STAKEGUARD:
|
|
20960
|
+
case EVALS3.EVAL_CURRENCY_DEFINITION:
|
|
20961
|
+
case EVALS3.EVAL_NOTARY_EVIDENCE:
|
|
20962
|
+
case EVALS3.EVAL_EARNEDNOTARIZATION:
|
|
20963
|
+
case EVALS3.EVAL_ACCEPTEDNOTARIZATION:
|
|
20964
|
+
case EVALS3.EVAL_FINALIZE_NOTARIZATION:
|
|
20965
|
+
case EVALS3.EVAL_CURRENCYSTATE:
|
|
20966
|
+
case EVALS3.EVAL_RESERVE_TRANSFER:
|
|
20967
|
+
case EVALS3.EVAL_RESERVE_OUTPUT:
|
|
20968
|
+
case EVALS3.EVAL_RESERVE_DEPOSIT:
|
|
20969
|
+
case EVALS3.EVAL_CROSSCHAIN_EXPORT:
|
|
20970
|
+
case EVALS3.EVAL_CROSSCHAIN_IMPORT:
|
|
20971
|
+
case EVALS3.EVAL_IDENTITY_PRIMARY:
|
|
20972
|
+
case EVALS3.EVAL_IDENTITY_COMMITMENT:
|
|
20973
|
+
case EVALS3.EVAL_IDENTITY_RESERVATION:
|
|
20974
|
+
case EVALS3.EVAL_FINALIZE_EXPORT:
|
|
20975
|
+
case EVALS3.EVAL_FEE_POOL:
|
|
20976
|
+
case EVALS3.EVAL_NOTARY_SIGNATURE: {
|
|
20977
20977
|
validEval = this.vData && this.vData.length > 0;
|
|
20978
20978
|
}
|
|
20979
20979
|
}
|
|
@@ -32216,9 +32216,9 @@ __export(src_exports, {
|
|
|
32216
32216
|
CURRENCY_OPTION: () => CURRENCY_OPTION,
|
|
32217
32217
|
CURRENCY_TYPE_ORDER: () => CURRENCY_TYPE_ORDER,
|
|
32218
32218
|
DEFAULT_EXPIRY_DELTA: () => DEFAULT_EXPIRY_DELTA,
|
|
32219
|
-
DEFAULT_FEE_PER_KB: () => DEFAULT_FEE_PER_KB,
|
|
32220
32219
|
DEFAULT_REFERRAL_LEVELS: () => DEFAULT_REFERRAL_LEVELS,
|
|
32221
32220
|
DEFAULT_REGISTRATION_FEE: () => DEFAULT_REGISTRATION_FEE,
|
|
32221
|
+
DEFAULT_TRANSACTION_FEE: () => DEFAULT_TRANSACTION_FEE,
|
|
32222
32222
|
DUST_THRESHOLD: () => DUST_THRESHOLD,
|
|
32223
32223
|
HASH_SHA256: () => HASH_SHA256,
|
|
32224
32224
|
IDENTITY_FLAG_ACTIVECURRENCY: () => IDENTITY_FLAG_ACTIVECURRENCY,
|
|
@@ -32230,6 +32230,7 @@ __export(src_exports, {
|
|
|
32230
32230
|
InvalidNameError: () => InvalidNameError,
|
|
32231
32231
|
InvalidSeedError: () => InvalidSeedError,
|
|
32232
32232
|
InvalidWifError: () => InvalidWifError,
|
|
32233
|
+
LARGE_SCRIPT_FEE_THRESHOLD: () => LARGE_SCRIPT_FEE_THRESHOLD,
|
|
32233
32234
|
NETWORK_CONFIG: () => NETWORK_CONFIG,
|
|
32234
32235
|
NOTARIZATION_PROTOCOL: () => NOTARIZATION_PROTOCOL,
|
|
32235
32236
|
PROOF_PROTOCOL: () => PROOF_PROTOCOL,
|
|
@@ -32244,12 +32245,16 @@ __export(src_exports, {
|
|
|
32244
32245
|
VerusSDK: () => VerusSDK,
|
|
32245
32246
|
WIF_PREFIX: () => WIF_PREFIX,
|
|
32246
32247
|
address: () => address_exports,
|
|
32248
|
+
assertFeeMeetsRelayMinimum: () => assertFeeMeetsRelayMinimum,
|
|
32247
32249
|
buildCurrencyDefinitionScript: () => buildCurrencyDefinitionScript,
|
|
32248
32250
|
buildCurrencyLaunchOutputs: () => buildCurrencyLaunchOutputs,
|
|
32249
32251
|
buildCurrencyLaunchTransaction: () => buildCurrencyLaunchTransaction,
|
|
32250
32252
|
buildReserveTransferOutput: () => buildReserveTransferOutput,
|
|
32251
32253
|
classifyCurrency: () => classifyCurrency,
|
|
32254
|
+
computeIdentityFeeFactor: () => computeIdentityFeeFactor,
|
|
32252
32255
|
currency: () => currency_exports,
|
|
32256
|
+
estimateMinerFee: () => estimateMinerFee,
|
|
32257
|
+
fee: () => fee_exports,
|
|
32253
32258
|
identity: () => public_exports2,
|
|
32254
32259
|
identityMultisig: () => multisig_exports,
|
|
32255
32260
|
isIAddress: () => isIAddress2,
|
|
@@ -32260,6 +32265,7 @@ __export(src_exports, {
|
|
|
32260
32265
|
message: () => message_exports,
|
|
32261
32266
|
offers: () => public_exports,
|
|
32262
32267
|
parseSats: () => parseSats,
|
|
32268
|
+
relayMinimumFee: () => relayMinimumFee,
|
|
32263
32269
|
serializeCurrencyDefinition: () => serializeCurrencyDefinition,
|
|
32264
32270
|
signing: () => signing_exports,
|
|
32265
32271
|
toCoins: () => toCoins,
|
|
@@ -32321,7 +32327,7 @@ var NETWORK_CONFIG = {
|
|
|
32321
32327
|
var CONSENSUS_BRANCH_ID = 1991772603;
|
|
32322
32328
|
var VERSION_GROUP_ID = 2301567109;
|
|
32323
32329
|
var TX_VERSION = 4;
|
|
32324
|
-
var
|
|
32330
|
+
var DEFAULT_TRANSACTION_FEE = 10000n;
|
|
32325
32331
|
var DUST_THRESHOLD = 546n;
|
|
32326
32332
|
var DEFAULT_REGISTRATION_FEE = 10000000000n;
|
|
32327
32333
|
var DEFAULT_REFERRAL_LEVELS = 3;
|
|
@@ -32667,16 +32673,10 @@ var utxo_exports = {};
|
|
|
32667
32673
|
__export(utxo_exports, {
|
|
32668
32674
|
assertTokenConservation: () => assertTokenConservation,
|
|
32669
32675
|
decodeUtxo: () => decodeUtxo,
|
|
32670
|
-
estimateFee: () => estimateFee,
|
|
32671
32676
|
isSmartTransactionScript: () => isSmartTransactionScript,
|
|
32672
32677
|
selectUtxos: () => selectUtxos
|
|
32673
32678
|
});
|
|
32674
32679
|
var { unpackOutput } = import_utxo_lib.smarttxs;
|
|
32675
|
-
var INPUT_SIZE = 180;
|
|
32676
|
-
var P2PKH_OUTPUT_SIZE = 34;
|
|
32677
|
-
var SMART_OUTPUT_SIZE = 200;
|
|
32678
|
-
var TX_OVERHEAD = 60;
|
|
32679
|
-
var MIN_FEE = 10000n;
|
|
32680
32680
|
function isSmartTransactionScript(script2) {
|
|
32681
32681
|
try {
|
|
32682
32682
|
const chunks = import_utxo_lib.script.decompile(script2);
|
|
@@ -32735,13 +32735,12 @@ function assertTokenConservation(selected, spentToOutputs, currencyChanges, syst
|
|
|
32735
32735
|
}
|
|
32736
32736
|
}
|
|
32737
32737
|
}
|
|
32738
|
-
function
|
|
32739
|
-
|
|
32740
|
-
|
|
32741
|
-
|
|
32742
|
-
|
|
32743
|
-
}
|
|
32744
|
-
function selectUtxos(utxos, requiredNative, requiredCurrencies = /* @__PURE__ */ new Map(), numOutputs = 2, systemId = NETWORK_CONFIG.mainnet.chainId, feePerKb = DEFAULT_FEE_PER_KB, hasSmartOutputs = false, extraOutputBytes = 0) {
|
|
32738
|
+
function selectUtxos(utxos, requiredNative, requiredCurrencies, fee, systemId = NETWORK_CONFIG.mainnet.chainId) {
|
|
32739
|
+
if (typeof fee !== "bigint" || fee < DEFAULT_TRANSACTION_FEE) {
|
|
32740
|
+
throw new TransactionBuildError(
|
|
32741
|
+
`selectUtxos: fee must be a bigint of at least ${DEFAULT_TRANSACTION_FEE} satoshis (compute it with estimateMinerFee), got ${String(fee)}`
|
|
32742
|
+
);
|
|
32743
|
+
}
|
|
32745
32744
|
const seenOutpoints = /* @__PURE__ */ new Set();
|
|
32746
32745
|
for (const u of utxos) {
|
|
32747
32746
|
const outpoint = `${u.txid}:${u.outputIndex}`;
|
|
@@ -32807,21 +32806,6 @@ function selectUtxos(utxos, requiredNative, requiredCurrencies = /* @__PURE__ */
|
|
|
32807
32806
|
if (at !== bt) return at - bt;
|
|
32808
32807
|
return b.satoshis > a.satoshis ? 1 : b.satoshis < a.satoshis ? -1 : 0;
|
|
32809
32808
|
});
|
|
32810
|
-
const countCurrencyChanges = () => {
|
|
32811
|
-
let n = 0;
|
|
32812
|
-
for (const [currency, needed] of remaining) {
|
|
32813
|
-
if (currency !== systemId && needed < 0n) n++;
|
|
32814
|
-
}
|
|
32815
|
-
return n;
|
|
32816
|
-
};
|
|
32817
|
-
let changeOutputCount = countCurrencyChanges();
|
|
32818
|
-
let fee = estimateFee(
|
|
32819
|
-
selected.length + 1,
|
|
32820
|
-
numOutputs + 1 + changeOutputCount,
|
|
32821
|
-
feePerKb,
|
|
32822
|
-
hasSmartOutputs,
|
|
32823
|
-
extraOutputBytes
|
|
32824
|
-
);
|
|
32825
32809
|
while (remainingNative + fee > 0n) {
|
|
32826
32810
|
const next = nativeOnly.shift();
|
|
32827
32811
|
if (!next) {
|
|
@@ -32838,14 +32822,6 @@ function selectUtxos(utxos, requiredNative, requiredCurrencies = /* @__PURE__ */
|
|
|
32838
32822
|
if (currency === systemId || amount <= 0n) continue;
|
|
32839
32823
|
remaining.set(currency, (remaining.get(currency) || 0n) - amount);
|
|
32840
32824
|
}
|
|
32841
|
-
changeOutputCount = countCurrencyChanges();
|
|
32842
|
-
fee = estimateFee(
|
|
32843
|
-
selected.length,
|
|
32844
|
-
numOutputs + 1 + changeOutputCount,
|
|
32845
|
-
feePerKb,
|
|
32846
|
-
hasSmartOutputs,
|
|
32847
|
-
extraOutputBytes
|
|
32848
|
-
);
|
|
32849
32825
|
}
|
|
32850
32826
|
const totalNativeIn = selected.reduce((sum, u) => sum + u.satoshis, 0n);
|
|
32851
32827
|
const actualNativeChange = totalNativeIn - requiredNative - fee;
|
|
@@ -32865,6 +32841,78 @@ function selectUtxos(utxos, requiredNative, requiredCurrencies = /* @__PURE__ */
|
|
|
32865
32841
|
};
|
|
32866
32842
|
}
|
|
32867
32843
|
|
|
32844
|
+
// src/fee/index.ts
|
|
32845
|
+
var fee_exports = {};
|
|
32846
|
+
__export(fee_exports, {
|
|
32847
|
+
LARGE_SCRIPT_FEE_THRESHOLD: () => LARGE_SCRIPT_FEE_THRESHOLD,
|
|
32848
|
+
assertFeeMeetsRelayMinimum: () => assertFeeMeetsRelayMinimum,
|
|
32849
|
+
computeIdentityFeeFactor: () => computeIdentityFeeFactor,
|
|
32850
|
+
estimateMinerFee: () => estimateMinerFee,
|
|
32851
|
+
relayMinimumFee: () => relayMinimumFee
|
|
32852
|
+
});
|
|
32853
|
+
var LARGE_SCRIPT_FEE_THRESHOLD = 2e3;
|
|
32854
|
+
var ID_EXTRA_LIMIT = 0;
|
|
32855
|
+
function largeScriptSurcharge(scriptLength) {
|
|
32856
|
+
if (scriptLength > 2 * LARGE_SCRIPT_FEE_THRESHOLD) return 2n * DEFAULT_TRANSACTION_FEE;
|
|
32857
|
+
if (scriptLength > LARGE_SCRIPT_FEE_THRESHOLD) return DEFAULT_TRANSACTION_FEE;
|
|
32858
|
+
return 0n;
|
|
32859
|
+
}
|
|
32860
|
+
function parseIdentityOutput(script2) {
|
|
32861
|
+
try {
|
|
32862
|
+
const parsed = new boundary_exports.IdentityScript();
|
|
32863
|
+
parsed.fromBuffer(script2);
|
|
32864
|
+
if (parsed.paramsOptCC.eval_code.toNumber() !== boundary_exports.EVALS.EVAL_IDENTITY_PRIMARY) return null;
|
|
32865
|
+
return parsed.getIdentity();
|
|
32866
|
+
} catch {
|
|
32867
|
+
return null;
|
|
32868
|
+
}
|
|
32869
|
+
}
|
|
32870
|
+
function computeIdentityFeeFactor(outputScripts) {
|
|
32871
|
+
let factor = 0;
|
|
32872
|
+
for (const script2 of outputScripts) {
|
|
32873
|
+
const identity = parseIdentityOutput(script2);
|
|
32874
|
+
if (identity === null) continue;
|
|
32875
|
+
factor += identity.content_map?.size ?? 0;
|
|
32876
|
+
factor += Math.max((identity.primary_addresses?.length ?? 0) - 1, 0);
|
|
32877
|
+
factor += Math.max((identity.private_addresses?.length ?? 0) - 1, 0);
|
|
32878
|
+
if ((identity.content_multimap?.kv_content?.size ?? 0) > 0) {
|
|
32879
|
+
const withContent = identity.getByteLength();
|
|
32880
|
+
identity.clearContentMultiMap();
|
|
32881
|
+
const serSize = withContent - identity.getByteLength();
|
|
32882
|
+
factor += Math.ceil(serSize / 128);
|
|
32883
|
+
}
|
|
32884
|
+
}
|
|
32885
|
+
return factor;
|
|
32886
|
+
}
|
|
32887
|
+
function estimateMinerFee(outputScripts) {
|
|
32888
|
+
const factor = BigInt(computeIdentityFeeFactor(outputScripts));
|
|
32889
|
+
const count = outputScripts.length;
|
|
32890
|
+
let fee = factor > 0n ? factor * DEFAULT_TRANSACTION_FEE : DEFAULT_TRANSACTION_FEE;
|
|
32891
|
+
fee += BigInt(Math.max(count - (1 + ID_EXTRA_LIMIT), 0)) * DEFAULT_TRANSACTION_FEE;
|
|
32892
|
+
if (!(factor > 0n && count <= 1 + ID_EXTRA_LIMIT)) {
|
|
32893
|
+
for (const script2 of outputScripts) fee += largeScriptSurcharge(script2.length);
|
|
32894
|
+
}
|
|
32895
|
+
return fee;
|
|
32896
|
+
}
|
|
32897
|
+
function relayMinimumFee(outputScripts) {
|
|
32898
|
+
const factor = BigInt(computeIdentityFeeFactor(outputScripts));
|
|
32899
|
+
const count = outputScripts.length;
|
|
32900
|
+
let fee = factor > 0n ? factor * DEFAULT_TRANSACTION_FEE : DEFAULT_TRANSACTION_FEE;
|
|
32901
|
+
fee += BigInt(Math.max(count - (3 + ID_EXTRA_LIMIT), 0)) * DEFAULT_TRANSACTION_FEE;
|
|
32902
|
+
if (!(factor > 0n && count <= 3 + ID_EXTRA_LIMIT)) {
|
|
32903
|
+
for (const script2 of outputScripts) fee += largeScriptSurcharge(script2.length);
|
|
32904
|
+
}
|
|
32905
|
+
return fee;
|
|
32906
|
+
}
|
|
32907
|
+
function assertFeeMeetsRelayMinimum(fee, outputScripts, label) {
|
|
32908
|
+
const minimum = relayMinimumFee(outputScripts);
|
|
32909
|
+
if (fee < minimum) {
|
|
32910
|
+
throw new TransactionBuildError(
|
|
32911
|
+
`${label}: miner fee ${fee} is below the daemon's relay minimum ${minimum} for this transaction's ${outputScripts.length} output(s); it would not reliably relay.`
|
|
32912
|
+
);
|
|
32913
|
+
}
|
|
32914
|
+
}
|
|
32915
|
+
|
|
32868
32916
|
// src/identity/index.ts
|
|
32869
32917
|
var import_crypto2 = require("crypto");
|
|
32870
32918
|
var import_bn = __toESM(require("bn.js"));
|
|
@@ -32924,16 +32972,8 @@ function assembleFundedIdentityUpdate(intent) {
|
|
|
32924
32972
|
const verusNetwork = getNetwork(intent.network === "testnet");
|
|
32925
32973
|
const systemId = NETWORK_CONFIG[intent.network].chainId;
|
|
32926
32974
|
const requiredNative = intent.outputs.reduce((sum, o) => sum + o.nativeSat, 0n);
|
|
32927
|
-
const
|
|
32928
|
-
|
|
32929
|
-
requiredNative,
|
|
32930
|
-
/* @__PURE__ */ new Map(),
|
|
32931
|
-
intent.outputs.length,
|
|
32932
|
-
systemId,
|
|
32933
|
-
void 0,
|
|
32934
|
-
true,
|
|
32935
|
-
intent.extraOutputBytes
|
|
32936
|
-
);
|
|
32975
|
+
const minerFee = estimateMinerFee(intent.outputs.map((o) => o.script));
|
|
32976
|
+
const selection = selectUtxos(intent.funding, requiredNative, /* @__PURE__ */ new Map(), minerFee, systemId);
|
|
32937
32977
|
assertTokenConservation(selection.selected, /* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), systemId, intent.label);
|
|
32938
32978
|
const txb = new import_utxo_lib.TransactionBuilder(verusNetwork);
|
|
32939
32979
|
txb.setVersion(4);
|
|
@@ -32990,12 +33030,9 @@ function assembleFundedIdentityUpdate(intent) {
|
|
|
32990
33030
|
}
|
|
32991
33031
|
);
|
|
32992
33032
|
const allUtxos = [...selection.selected, idUtxo];
|
|
32993
|
-
|
|
32994
|
-
|
|
32995
|
-
|
|
32996
|
-
selection.fee,
|
|
32997
|
-
intent.label
|
|
32998
|
-
);
|
|
33033
|
+
const completedOuts = import_utxo_lib.Transaction.fromHex(completedHex, verusNetwork).outs;
|
|
33034
|
+
assertNativeConservation(allUtxos, completedOuts, selection.fee, intent.label);
|
|
33035
|
+
assertFeeMeetsRelayMinimum(selection.fee, completedOuts.map((o) => o.script), intent.label);
|
|
32999
33036
|
const { signedTx, txid } = signTransactionSmart(completedHex, intent.wif, allUtxos, verusNetwork);
|
|
33000
33037
|
return {
|
|
33001
33038
|
signedTx,
|
|
@@ -33610,9 +33647,6 @@ function _buildVrscRegistration(params, identityScript, reservationScript, ident
|
|
|
33610
33647
|
{ script: reservationScript, nativeSat: 0n }
|
|
33611
33648
|
],
|
|
33612
33649
|
changeAddress: params.changeAddress,
|
|
33613
|
-
// Legacy fee estimate: identity + referrals + reservation, plus the one extra
|
|
33614
|
-
// change slot the original path counted on top of selectUtxos' own reserve.
|
|
33615
|
-
feeOutputCount: 2 + referralOutputs.length + 1,
|
|
33616
33650
|
fee: {
|
|
33617
33651
|
policy: "declared",
|
|
33618
33652
|
burnSat: registrationOutlay - totalReferralPayments,
|
|
@@ -33676,10 +33710,6 @@ function _buildSubIdRegistration(params, identityScript, reservationScript, iden
|
|
|
33676
33710
|
{ script: reservationScript, nativeSat: 0n }
|
|
33677
33711
|
],
|
|
33678
33712
|
changeAddress: params.changeAddress,
|
|
33679
|
-
// Legacy fee estimate: identity + fee + reservation, plus the one extra change
|
|
33680
|
-
// slot the original path counted on top of selectUtxos' own reserve.
|
|
33681
|
-
feeOutputCount: 4,
|
|
33682
|
-
extraOutputBytes: identityScript.length + reservationScript.length + feeOutput.script.length,
|
|
33683
33713
|
fee: {
|
|
33684
33714
|
policy: "declared",
|
|
33685
33715
|
burnSat: nativeImportFee,
|
|
@@ -33854,10 +33884,6 @@ function buildAndSignIdentityUpdate(params, network, operation = "update", lockU
|
|
|
33854
33884
|
identityUtxo: params.identityUtxo,
|
|
33855
33885
|
outputs: unfundedTx.outs.map((o) => ({ script: o.script, nativeSat: BigInt(o.value) })),
|
|
33856
33886
|
changeAddress: params.changeAddress,
|
|
33857
|
-
// The identity output embeds the full serialized identity (a large
|
|
33858
|
-
// contentMultimap can make it multi-KB); size the fee from the unfunded tx's
|
|
33859
|
-
// real bytes so a big update isn't fee-estimated below the relay minimum.
|
|
33860
|
-
extraOutputBytes: unfundedHex.length / 2,
|
|
33861
33887
|
label: `identity ${operation}`
|
|
33862
33888
|
});
|
|
33863
33889
|
return {
|
|
@@ -33904,15 +33930,13 @@ function assembleAndSign(intent) {
|
|
|
33904
33930
|
for (const [c, v] of o.carries) requiredCurrencies.set(c, (requiredCurrencies.get(c) ?? 0n) + v);
|
|
33905
33931
|
}
|
|
33906
33932
|
}
|
|
33933
|
+
const minerFee = estimateMinerFee(intent.outputs.map((o) => o.script));
|
|
33907
33934
|
const selection = selectUtxos(
|
|
33908
33935
|
intent.funding,
|
|
33909
33936
|
requiredNative,
|
|
33910
33937
|
requiredCurrencies,
|
|
33911
|
-
|
|
33912
|
-
systemId
|
|
33913
|
-
void 0,
|
|
33914
|
-
intent.hasSmartOutputs ?? true,
|
|
33915
|
-
intent.extraOutputBytes ?? 0
|
|
33938
|
+
minerFee,
|
|
33939
|
+
systemId
|
|
33916
33940
|
);
|
|
33917
33941
|
const txb = new import_utxo_lib.TransactionBuilder(verusNetwork);
|
|
33918
33942
|
txb.setVersion(4);
|
|
@@ -33958,6 +33982,7 @@ function assembleAndSign(intent) {
|
|
|
33958
33982
|
const leadingNative = leading.reduce((sum, u) => sum + u.satoshis, 0n);
|
|
33959
33983
|
const expectedFee = selection.fee + burnSat + leadingNative;
|
|
33960
33984
|
assertNativeConservation(allUtxos, unsignedTx.outs, expectedFee, intent.label);
|
|
33985
|
+
assertFeeMeetsRelayMinimum(selection.fee, unsignedTx.outs.map((o) => o.script), intent.label);
|
|
33961
33986
|
const maxFeeSats = intent.fee.policy === "declared" ? expectedFee : void 0;
|
|
33962
33987
|
const { signedTx, txid } = signTransactionSmart(unsignedTx.toHex(), intent.wif, allUtxos, verusNetwork, maxFeeSats);
|
|
33963
33988
|
return {
|
|
@@ -34068,10 +34093,15 @@ function sendCurrency(params, network) {
|
|
|
34068
34093
|
if (out.feeCurrency !== void 0 && out.feeCurrency !== systemId && out.feeSatoshis === void 0) {
|
|
34069
34094
|
throw new TransactionBuildError("feeSatoshis is required when feeCurrency is a non-native token (the exact fee is conversion-dependent \u2014 query the node and pass it explicitly)");
|
|
34070
34095
|
}
|
|
34096
|
+
if (out.exportTo !== void 0 && out.feeSatoshis === void 0) {
|
|
34097
|
+
throw new TransactionBuildError("feeSatoshis is required when exportTo is set (the cross-chain import fee is set by the destination system \u2014 query the node and pass it explicitly)");
|
|
34098
|
+
}
|
|
34071
34099
|
}
|
|
34072
34100
|
const txOutputs = params.outputs.map((out) => {
|
|
34073
34101
|
const forcesReserveTransfer = out.mintnew || out.burn || out.burnweight;
|
|
34074
34102
|
const feecurrency = out.feeCurrency ?? (forcesReserveTransfer ? systemId : void 0);
|
|
34103
|
+
const isReserveTransfer = feecurrency !== void 0 || out.convertTo !== void 0 || out.exportTo !== void 0 || out.via !== void 0;
|
|
34104
|
+
const feesatoshis = out.feeSatoshis ?? (isReserveTransfer ? RESERVE_TRANSFER_FEE : void 0);
|
|
34075
34105
|
return {
|
|
34076
34106
|
currency: out.currency,
|
|
34077
34107
|
satoshis: out.satoshis.toString(10),
|
|
@@ -34081,7 +34111,7 @@ function sendCurrency(params, network) {
|
|
|
34081
34111
|
...out.via !== void 0 ? { via: out.via } : {},
|
|
34082
34112
|
...out.bridgeId !== void 0 ? { bridgeid: out.bridgeId } : {},
|
|
34083
34113
|
...feecurrency !== void 0 ? { feecurrency } : {},
|
|
34084
|
-
...
|
|
34114
|
+
...feesatoshis !== void 0 ? { feesatoshis: feesatoshis.toString(10) } : {},
|
|
34085
34115
|
...out.preconvert !== void 0 ? { preconvert: out.preconvert } : {},
|
|
34086
34116
|
...out.mintnew !== void 0 ? { mintnew: out.mintnew } : {},
|
|
34087
34117
|
...out.burn !== void 0 ? { burn: out.burn } : {},
|
|
@@ -34095,9 +34125,6 @@ function sendCurrency(params, network) {
|
|
|
34095
34125
|
expiryHeight
|
|
34096
34126
|
);
|
|
34097
34127
|
const unfundedTx = import_utxo_lib.Transaction.fromHex(unfundedTxHex, verusNetwork);
|
|
34098
|
-
const hasSmartOutputs = params.outputs.some(
|
|
34099
|
-
(o) => o.convertTo || o.exportTo || o.via || o.mintnew || o.burn || o.burnweight || o.currency !== systemId
|
|
34100
|
-
);
|
|
34101
34128
|
const requiredCurrencies = /* @__PURE__ */ new Map();
|
|
34102
34129
|
for (const out of params.outputs) {
|
|
34103
34130
|
if (out.currency !== systemId && !out.mintnew) {
|
|
@@ -34120,7 +34147,6 @@ function sendCurrency(params, network) {
|
|
|
34120
34147
|
funding: params.utxos,
|
|
34121
34148
|
outputs: unfundedTx.outs.map((o) => ({ script: o.script, nativeSat: BigInt(o.value) })),
|
|
34122
34149
|
changeAddress: params.changeAddress,
|
|
34123
|
-
hasSmartOutputs,
|
|
34124
34150
|
requiredCurrencies,
|
|
34125
34151
|
changeStrategy: "separate",
|
|
34126
34152
|
fee: { policy: "estimate" },
|
|
@@ -35123,7 +35149,6 @@ function buildCurrencyLaunchTransaction(params, network) {
|
|
|
35123
35149
|
script: Buffer.from(o.script, "hex"),
|
|
35124
35150
|
nativeSat: o.value
|
|
35125
35151
|
}));
|
|
35126
|
-
const extraOutputBytes = consensusOutputs.reduce((sum, o) => sum + o.script.length, 0);
|
|
35127
35152
|
const assembled = assembleFundedIdentityUpdate({
|
|
35128
35153
|
network,
|
|
35129
35154
|
wif: params.wif,
|
|
@@ -35135,7 +35160,6 @@ function buildCurrencyLaunchTransaction(params, network) {
|
|
|
35135
35160
|
identityUtxo: params.identityUtxo,
|
|
35136
35161
|
outputs: consensusOutputs,
|
|
35137
35162
|
changeAddress: params.changeAddress ?? identityAddress,
|
|
35138
|
-
extraOutputBytes,
|
|
35139
35163
|
label: "currency launch"
|
|
35140
35164
|
});
|
|
35141
35165
|
return {
|
|
@@ -35242,9 +35266,6 @@ function defineCurrency(params, network) {
|
|
|
35242
35266
|
{ script: currencyDefScript, nativeSat: currencyDefValue }
|
|
35243
35267
|
],
|
|
35244
35268
|
changeAddress: params.changeAddress,
|
|
35245
|
-
// The identity + currency-definition outputs can be large; size the fee from
|
|
35246
|
-
// their real byte length so the tx isn't estimated below the relay minimum.
|
|
35247
|
-
extraOutputBytes: identityOutputScript.length + currencyDefScript.length,
|
|
35248
35269
|
label: "currency definition"
|
|
35249
35270
|
});
|
|
35250
35271
|
return {
|
|
@@ -35436,16 +35457,8 @@ function completeOffer(params, network) {
|
|
|
35436
35457
|
}
|
|
35437
35458
|
const wantedTokenReq = wantingNative ? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Map([[params.want.currency, params.want.amount]]);
|
|
35438
35459
|
const requiredNative = wantingNative ? params.want.amount : 0n;
|
|
35439
|
-
const
|
|
35440
|
-
|
|
35441
|
-
requiredNative,
|
|
35442
|
-
wantedTokenReq,
|
|
35443
|
-
3,
|
|
35444
|
-
systemId,
|
|
35445
|
-
void 0,
|
|
35446
|
-
true,
|
|
35447
|
-
150
|
|
35448
|
-
);
|
|
35460
|
+
const minerFee = estimateMinerFee(tx.outs.map((o) => o.script));
|
|
35461
|
+
const selection = selectUtxos(params.takerUtxos, requiredNative, wantedTokenReq, minerFee, systemId);
|
|
35449
35462
|
const takerInputs = [];
|
|
35450
35463
|
for (const u of selection.selected) {
|
|
35451
35464
|
const idx = tx.addInput(Buffer.from(u.txid, "hex").reverse(), u.outputIndex, 4294967295);
|
|
@@ -35470,6 +35483,7 @@ function completeOffer(params, network) {
|
|
|
35470
35483
|
const takerNativeIn = selection.selected.reduce((s, u) => s + u.satoshis, 0n);
|
|
35471
35484
|
const allInputsNative = commitmentNative + takerNativeIn;
|
|
35472
35485
|
assertNativeConservation([{ satoshis: allInputsNative }], tx.outs, selection.fee, "takeOffer");
|
|
35486
|
+
assertFeeMeetsRelayMinimum(selection.fee, tx.outs.map((o) => o.script), "takeOffer");
|
|
35473
35487
|
const { signedTx, txid } = signTakerInputs(tx.toHex(), takerInputs, params.wif, network);
|
|
35474
35488
|
return { swapTx: signedTx, txid };
|
|
35475
35489
|
}
|
|
@@ -35500,19 +35514,21 @@ function buildReclaimOffer(params, network) {
|
|
|
35500
35514
|
commitmentScript
|
|
35501
35515
|
);
|
|
35502
35516
|
if (offeringNative) {
|
|
35503
|
-
const
|
|
35517
|
+
const payScript = nativePaymentScript2(params.makerAddress);
|
|
35518
|
+
const fee = estimateMinerFee([payScript]);
|
|
35504
35519
|
const outAmount = params.offered.amount - fee;
|
|
35505
35520
|
if (outAmount <= DUST_THRESHOLD) {
|
|
35506
35521
|
throw new TransactionBuildError(
|
|
35507
35522
|
`buildReclaimOffer: reclaimed native value ${params.offered.amount} is too small to cover the fee ${fee} above dust`
|
|
35508
35523
|
);
|
|
35509
35524
|
}
|
|
35510
|
-
txb.addOutput(
|
|
35525
|
+
txb.addOutput(payScript, toSafeNumber(outAmount));
|
|
35511
35526
|
const tx2 = import_utxo_lib.Transaction.fromHex(txb.buildIncomplete().toHex(), verusNetwork);
|
|
35512
35527
|
const takerInputs2 = [
|
|
35513
35528
|
{ index: 0, prevOutScript: commitmentScript, value: params.commitment.value }
|
|
35514
35529
|
];
|
|
35515
35530
|
assertNativeConservation([{ satoshis: params.commitment.value }], tx2.outs, fee, "reclaimOffer");
|
|
35531
|
+
assertFeeMeetsRelayMinimum(fee, tx2.outs.map((o) => o.script), "reclaimOffer");
|
|
35516
35532
|
const { signedTx: signedTx2, txid: txid2 } = signTakerInputs(tx2.toHex(), takerInputs2, params.wif, network);
|
|
35517
35533
|
return { reclaimTx: signedTx2, txid: txid2 };
|
|
35518
35534
|
}
|
|
@@ -35531,7 +35547,8 @@ function buildReclaimOffer(params, network) {
|
|
|
35531
35547
|
const takerInputs = [
|
|
35532
35548
|
{ index: 0, prevOutScript: commitmentScript, value: 0n }
|
|
35533
35549
|
];
|
|
35534
|
-
const
|
|
35550
|
+
const minerFee = estimateMinerFee([tokenOut.script]);
|
|
35551
|
+
const selection = selectUtxos(feeUtxos, 0n, /* @__PURE__ */ new Map(), minerFee, systemId);
|
|
35535
35552
|
if (selection.currencyChanges.size > 0) {
|
|
35536
35553
|
throw new TransactionBuildError(
|
|
35537
35554
|
"buildReclaimOffer: feeUtxos must carry only the native coin; a token-bearing UTXO was selected and its reserve value would be lost."
|
|
@@ -35554,6 +35571,7 @@ function buildReclaimOffer(params, network) {
|
|
|
35554
35571
|
}
|
|
35555
35572
|
const feeNativeIn = selection.selected.reduce((s, u) => s + u.satoshis, 0n);
|
|
35556
35573
|
assertNativeConservation([{ satoshis: feeNativeIn }], tx.outs, selection.fee, "reclaimOffer");
|
|
35574
|
+
assertFeeMeetsRelayMinimum(selection.fee, tx.outs.map((o) => o.script), "reclaimOffer");
|
|
35557
35575
|
const { signedTx, txid } = signTakerInputs(tx.toHex(), takerInputs, params.wif, network);
|
|
35558
35576
|
return { reclaimTx: signedTx, txid };
|
|
35559
35577
|
}
|
|
@@ -35577,7 +35595,8 @@ function assertExpiryHeight(expiryHeight) {
|
|
|
35577
35595
|
function fundFeeAndSignIdentityTaker(args) {
|
|
35578
35596
|
const systemId = NETWORK_CONFIG[args.network].chainId;
|
|
35579
35597
|
const verusNetwork = getNetwork(args.network === "testnet");
|
|
35580
|
-
const
|
|
35598
|
+
const minerFee = estimateMinerFee(args.tx.outs.map((o) => o.script));
|
|
35599
|
+
const selection = selectUtxos(args.takerUtxos, 0n, /* @__PURE__ */ new Map(), minerFee, systemId);
|
|
35581
35600
|
if (selection.currencyChanges.size > 0) {
|
|
35582
35601
|
throw new TransactionBuildError(
|
|
35583
35602
|
`${args.label}: the fee UTXOs must carry only the native coin; a token-bearing UTXO was selected and its reserve value would be lost.`
|
|
@@ -35606,6 +35625,7 @@ function fundFeeAndSignIdentityTaker(args) {
|
|
|
35606
35625
|
selection.fee,
|
|
35607
35626
|
args.label
|
|
35608
35627
|
);
|
|
35628
|
+
assertFeeMeetsRelayMinimum(selection.fee, args.tx.outs.map((o) => o.script), args.label);
|
|
35609
35629
|
const { signedTx, txid } = signTakerInputs(args.tx.toHex(), takerInputs, args.wif, args.network);
|
|
35610
35630
|
return { swapTx: signedTx, txid };
|
|
35611
35631
|
}
|
|
@@ -35636,16 +35656,8 @@ function completeSellIdentityOffer(params, network) {
|
|
|
35636
35656
|
tx.addOutput(buildTransferredIdentity(params.identityJson, params.newPrimaryAddresses), 0);
|
|
35637
35657
|
const wantedTokenReq = wantingNative ? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Map([[params.want.currency, params.want.amount]]);
|
|
35638
35658
|
const requiredNative = wantingNative ? params.want.amount : 0n;
|
|
35639
|
-
const
|
|
35640
|
-
|
|
35641
|
-
requiredNative,
|
|
35642
|
-
wantedTokenReq,
|
|
35643
|
-
3,
|
|
35644
|
-
systemId,
|
|
35645
|
-
void 0,
|
|
35646
|
-
true,
|
|
35647
|
-
150
|
|
35648
|
-
);
|
|
35659
|
+
const minerFee = estimateMinerFee(tx.outs.map((o) => o.script));
|
|
35660
|
+
const selection = selectUtxos(params.takerUtxos, requiredNative, wantedTokenReq, minerFee, systemId);
|
|
35649
35661
|
const takerInputs = [];
|
|
35650
35662
|
for (const u of selection.selected) {
|
|
35651
35663
|
const idx = tx.addInput(Buffer.from(u.txid, "hex").reverse(), u.outputIndex, 4294967295);
|
|
@@ -35663,6 +35675,7 @@ function completeSellIdentityOffer(params, network) {
|
|
|
35663
35675
|
assertTokenConservation(selection.selected, wantedTokenReq, selection.currencyChanges, systemId, "takeSellIdentityOffer");
|
|
35664
35676
|
const takerNativeIn = selection.selected.reduce((s, u) => s + u.satoshis, 0n);
|
|
35665
35677
|
assertNativeConservation([{ satoshis: takerNativeIn }], tx.outs, selection.fee, "takeSellIdentityOffer");
|
|
35678
|
+
assertFeeMeetsRelayMinimum(selection.fee, tx.outs.map((o) => o.script), "takeSellIdentityOffer");
|
|
35666
35679
|
const { signedTx, txid } = signTakerInputs(tx.toHex(), takerInputs, params.wif, network);
|
|
35667
35680
|
return { swapTx: signedTx, txid };
|
|
35668
35681
|
}
|
|
@@ -35731,8 +35744,7 @@ function completeBuyIdentityOffer(params, network) {
|
|
|
35731
35744
|
changeAddress: params.changeAddress,
|
|
35732
35745
|
wif: params.wif,
|
|
35733
35746
|
network,
|
|
35734
|
-
label: "takeBuyIdentityOffer"
|
|
35735
|
-
extraOutputBytes: 300
|
|
35747
|
+
label: "takeBuyIdentityOffer"
|
|
35736
35748
|
});
|
|
35737
35749
|
}
|
|
35738
35750
|
function buildSwapIdentityOffer(params, network) {
|
|
@@ -35782,8 +35794,7 @@ function completeSwapIdentityOffer(params, network) {
|
|
|
35782
35794
|
changeAddress: params.changeAddress,
|
|
35783
35795
|
wif: params.wif,
|
|
35784
35796
|
network,
|
|
35785
|
-
label: "takeSwapIdentityOffer"
|
|
35786
|
-
extraOutputBytes: 500
|
|
35797
|
+
label: "takeSwapIdentityOffer"
|
|
35787
35798
|
});
|
|
35788
35799
|
}
|
|
35789
35800
|
|
|
@@ -35819,7 +35830,8 @@ function buildMultisigIdentityUpdate(params, network) {
|
|
|
35819
35830
|
throw new TransactionBuildError("buildMultisigIdentityUpdate: funding must include native UTXOs for the fee");
|
|
35820
35831
|
}
|
|
35821
35832
|
const newIdScript = buildIdentityScript(boundary_exports.Identity.fromJson(params.newIdentity));
|
|
35822
|
-
const
|
|
35833
|
+
const minerFee = estimateMinerFee([newIdScript]);
|
|
35834
|
+
const selection = selectUtxos(params.funding, 0n, /* @__PURE__ */ new Map(), minerFee, systemId);
|
|
35823
35835
|
if (selection.currencyChanges.size > 0) {
|
|
35824
35836
|
throw new TransactionBuildError(
|
|
35825
35837
|
"buildMultisigIdentityUpdate: funding must carry only the native coin; a token-bearing UTXO was selected and its reserve value would be lost."
|
|
@@ -35857,6 +35869,7 @@ function buildMultisigIdentityUpdate(params, network) {
|
|
|
35857
35869
|
const tx = import_utxo_lib.Transaction.fromHex(completedHex, verusNetwork);
|
|
35858
35870
|
const funderNativeIn = selection.selected.reduce((s, u) => s + u.satoshis, 0n);
|
|
35859
35871
|
assertNativeConservation([{ satoshis: funderNativeIn }], tx.outs, selection.fee, "multisigIdentityUpdate");
|
|
35872
|
+
assertFeeMeetsRelayMinimum(selection.fee, tx.outs.map((o) => o.script), "multisigIdentityUpdate");
|
|
35860
35873
|
const funderKey = import_utxo_lib.ECPair.fromWIF(params.funderWif, verusNetwork);
|
|
35861
35874
|
for (let i = 0; i < selection.selected.length; i++) {
|
|
35862
35875
|
const u = selection.selected[i];
|
|
@@ -36225,9 +36238,9 @@ __export(public_exports2, {
|
|
|
36225
36238
|
CURRENCY_OPTION,
|
|
36226
36239
|
CURRENCY_TYPE_ORDER,
|
|
36227
36240
|
DEFAULT_EXPIRY_DELTA,
|
|
36228
|
-
DEFAULT_FEE_PER_KB,
|
|
36229
36241
|
DEFAULT_REFERRAL_LEVELS,
|
|
36230
36242
|
DEFAULT_REGISTRATION_FEE,
|
|
36243
|
+
DEFAULT_TRANSACTION_FEE,
|
|
36231
36244
|
DUST_THRESHOLD,
|
|
36232
36245
|
HASH_SHA256,
|
|
36233
36246
|
IDENTITY_FLAG_ACTIVECURRENCY,
|
|
@@ -36239,6 +36252,7 @@ __export(public_exports2, {
|
|
|
36239
36252
|
InvalidNameError,
|
|
36240
36253
|
InvalidSeedError,
|
|
36241
36254
|
InvalidWifError,
|
|
36255
|
+
LARGE_SCRIPT_FEE_THRESHOLD,
|
|
36242
36256
|
NETWORK_CONFIG,
|
|
36243
36257
|
NOTARIZATION_PROTOCOL,
|
|
36244
36258
|
PROOF_PROTOCOL,
|
|
@@ -36253,12 +36267,16 @@ __export(public_exports2, {
|
|
|
36253
36267
|
VerusSDK,
|
|
36254
36268
|
WIF_PREFIX,
|
|
36255
36269
|
address,
|
|
36270
|
+
assertFeeMeetsRelayMinimum,
|
|
36256
36271
|
buildCurrencyDefinitionScript,
|
|
36257
36272
|
buildCurrencyLaunchOutputs,
|
|
36258
36273
|
buildCurrencyLaunchTransaction,
|
|
36259
36274
|
buildReserveTransferOutput,
|
|
36260
36275
|
classifyCurrency,
|
|
36276
|
+
computeIdentityFeeFactor,
|
|
36261
36277
|
currency,
|
|
36278
|
+
estimateMinerFee,
|
|
36279
|
+
fee,
|
|
36262
36280
|
identity,
|
|
36263
36281
|
identityMultisig,
|
|
36264
36282
|
isIAddress,
|
|
@@ -36269,6 +36287,7 @@ __export(public_exports2, {
|
|
|
36269
36287
|
message,
|
|
36270
36288
|
offers,
|
|
36271
36289
|
parseSats,
|
|
36290
|
+
relayMinimumFee,
|
|
36272
36291
|
serializeCurrencyDefinition,
|
|
36273
36292
|
signing,
|
|
36274
36293
|
toCoins,
|