@chainvue/verus-sdk 0.6.0 → 0.6.2
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/bundle.js +235 -65
- package/dist/currency/index.d.ts.map +1 -1
- package/dist/currency/index.js +34 -3
- package/dist/currency/index.js.map +1 -1
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +187 -14
- package/dist/identity/index.js.map +1 -1
- package/dist/signing/index.d.ts.map +1 -1
- package/dist/signing/index.js +6 -0
- package/dist/signing/index.js.map +1 -1
- package/dist/transfer/index.d.ts.map +1 -1
- package/dist/transfer/index.js +15 -3
- package/dist/transfer/index.js.map +1 -1
- package/dist/utxo/index.d.ts +2 -2
- package/dist/utxo/index.d.ts.map +1 -1
- package/dist/utxo/index.js +43 -12
- package/dist/utxo/index.js.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -9233,7 +9233,7 @@ var require_ecpair = __commonJS({
|
|
|
9233
9233
|
var curve = ecurve.getCurveByName("secp256k1");
|
|
9234
9234
|
var secp256k1Ecurve = ecdsa.__curve;
|
|
9235
9235
|
var fastcurve = require_fastcurve();
|
|
9236
|
-
function
|
|
9236
|
+
function ECPair4(d, Q, options) {
|
|
9237
9237
|
if (options) {
|
|
9238
9238
|
typeforce({
|
|
9239
9239
|
compressed: types.maybe(types.Boolean),
|
|
@@ -9256,7 +9256,7 @@ var require_ecpair = __commonJS({
|
|
|
9256
9256
|
this.compressed = options.compressed === void 0 ? true : options.compressed;
|
|
9257
9257
|
this.network = options.network || NETWORKS.bitcoin;
|
|
9258
9258
|
}
|
|
9259
|
-
Object.defineProperty(
|
|
9259
|
+
Object.defineProperty(ECPair4.prototype, "Q", {
|
|
9260
9260
|
get: function() {
|
|
9261
9261
|
if (!this.__Q && this.d) {
|
|
9262
9262
|
var qBuf = fastcurve.publicKeyCreate(this.d.toBuffer(32), false);
|
|
@@ -9270,22 +9270,22 @@ var require_ecpair = __commonJS({
|
|
|
9270
9270
|
return this.__Q;
|
|
9271
9271
|
}
|
|
9272
9272
|
});
|
|
9273
|
-
|
|
9273
|
+
ECPair4.recoverFromSignature = function(hashBuffer, compactSigBuffer, network) {
|
|
9274
9274
|
var compactParsed = sig.parseCompact(compactSigBuffer);
|
|
9275
9275
|
var der = compactParsed.signature.toDER();
|
|
9276
9276
|
var recovery = compactParsed.i & 3;
|
|
9277
9277
|
var nobleSig = secp256k1.Signature.fromDER(der).addRecoveryBit(recovery);
|
|
9278
9278
|
var pubBytes = nobleSig.recoverPublicKey(hashBuffer).toRawBytes(true);
|
|
9279
|
-
return
|
|
9279
|
+
return ECPair4.fromPublicKeyBuffer(Buffer.from(pubBytes), network);
|
|
9280
9280
|
};
|
|
9281
|
-
|
|
9281
|
+
ECPair4.fromPublicKeyBuffer = function(buffer, network) {
|
|
9282
9282
|
var Q = ecurve.Point.decodeFrom(secp256k1Ecurve, buffer);
|
|
9283
|
-
return new
|
|
9283
|
+
return new ECPair4(null, Q, {
|
|
9284
9284
|
compressed: Q.compressed,
|
|
9285
9285
|
network
|
|
9286
9286
|
});
|
|
9287
9287
|
};
|
|
9288
|
-
|
|
9288
|
+
ECPair4.fromWIF = function(string, network, skipVersionCheck) {
|
|
9289
9289
|
if (skipVersionCheck === void 0) {
|
|
9290
9290
|
skipVersionCheck = false;
|
|
9291
9291
|
}
|
|
@@ -9303,12 +9303,12 @@ var require_ecpair = __commonJS({
|
|
|
9303
9303
|
throw new Error("Invalid network version");
|
|
9304
9304
|
}
|
|
9305
9305
|
var d = BigInteger.fromBuffer(decoded.privateKey);
|
|
9306
|
-
return new
|
|
9306
|
+
return new ECPair4(d, null, {
|
|
9307
9307
|
compressed: decoded.compressed,
|
|
9308
9308
|
network
|
|
9309
9309
|
});
|
|
9310
9310
|
};
|
|
9311
|
-
|
|
9311
|
+
ECPair4.makeRandom = function(options) {
|
|
9312
9312
|
options = options || {};
|
|
9313
9313
|
var rng = options.rng || randomBytes3;
|
|
9314
9314
|
var d;
|
|
@@ -9317,18 +9317,18 @@ var require_ecpair = __commonJS({
|
|
|
9317
9317
|
typeforce(types.Buffer256bit, buffer);
|
|
9318
9318
|
d = BigInteger.fromBuffer(buffer);
|
|
9319
9319
|
} while (d.signum() <= 0 || d.compareTo(secp256k1Ecurve.n) >= 0);
|
|
9320
|
-
return new
|
|
9320
|
+
return new ECPair4(d, null, options);
|
|
9321
9321
|
};
|
|
9322
|
-
|
|
9322
|
+
ECPair4.prototype.getAddress = function() {
|
|
9323
9323
|
return baddress.toBase58Check(bcrypto.hash160(this.getPublicKeyBuffer()), this.getNetwork().pubKeyHash);
|
|
9324
9324
|
};
|
|
9325
|
-
|
|
9325
|
+
ECPair4.prototype.getNetwork = function() {
|
|
9326
9326
|
return this.network;
|
|
9327
9327
|
};
|
|
9328
|
-
|
|
9328
|
+
ECPair4.prototype.getPublicKeyBuffer = function() {
|
|
9329
9329
|
return this.Q.getEncoded(this.compressed);
|
|
9330
9330
|
};
|
|
9331
|
-
|
|
9331
|
+
ECPair4.prototype.sign = function(hash) {
|
|
9332
9332
|
if (!this.d)
|
|
9333
9333
|
throw new Error("Missing private key");
|
|
9334
9334
|
var sig2 = fastcurve.sign(hash, this.d);
|
|
@@ -9336,26 +9336,26 @@ var require_ecpair = __commonJS({
|
|
|
9336
9336
|
return sig2;
|
|
9337
9337
|
return ecdsa.sign(hash, this.d);
|
|
9338
9338
|
};
|
|
9339
|
-
|
|
9339
|
+
ECPair4.prototype.toWIF = function() {
|
|
9340
9340
|
if (!this.d)
|
|
9341
9341
|
throw new Error("Missing private key");
|
|
9342
9342
|
return wif.encode(this.network.wif, this.d.toBuffer(32), this.compressed);
|
|
9343
9343
|
};
|
|
9344
|
-
|
|
9344
|
+
ECPair4.prototype.verify = function(hash, signature) {
|
|
9345
9345
|
var fastsig = fastcurve.verify(hash, signature, this.getPublicKeyBuffer());
|
|
9346
9346
|
if (fastsig !== void 0)
|
|
9347
9347
|
return fastsig;
|
|
9348
9348
|
return ecdsa.verify(hash, signature, this.Q);
|
|
9349
9349
|
};
|
|
9350
|
-
|
|
9350
|
+
ECPair4.fromPrivateKeyBuffer = function(buffer, network) {
|
|
9351
9351
|
var keyutil = require_keyutil();
|
|
9352
9352
|
return keyutil.privateKeyBufferToECPair(buffer, network);
|
|
9353
9353
|
};
|
|
9354
|
-
|
|
9354
|
+
ECPair4.prototype.getPrivateKeyBuffer = function() {
|
|
9355
9355
|
var keyutil = require_keyutil();
|
|
9356
9356
|
return keyutil.privateKeyBufferFromECPair(this);
|
|
9357
9357
|
};
|
|
9358
|
-
module2.exports =
|
|
9358
|
+
module2.exports = ECPair4;
|
|
9359
9359
|
}
|
|
9360
9360
|
});
|
|
9361
9361
|
|
|
@@ -9367,16 +9367,16 @@ var require_keyutil = __commonJS({
|
|
|
9367
9367
|
exports2.privateKeyBufferToECPair = privateKeyBufferToECPair;
|
|
9368
9368
|
exports2.privateKeyBufferFromECPair = privateKeyBufferFromECPair;
|
|
9369
9369
|
var BigInteger = require_lib();
|
|
9370
|
-
var
|
|
9370
|
+
var ECPair4 = require_ecpair();
|
|
9371
9371
|
function privateKeyBufferToECPair(buffer, network) {
|
|
9372
9372
|
if (!Buffer.isBuffer(buffer) || buffer.length !== 32) {
|
|
9373
9373
|
throw new Error("invalid private key buffer");
|
|
9374
9374
|
}
|
|
9375
9375
|
var d = BigInteger.fromBuffer(buffer);
|
|
9376
|
-
return new
|
|
9376
|
+
return new ECPair4(d, null, { network });
|
|
9377
9377
|
}
|
|
9378
9378
|
function privateKeyBufferFromECPair(ecPair) {
|
|
9379
|
-
if (!(ecPair instanceof
|
|
9379
|
+
if (!(ecPair instanceof ECPair4)) {
|
|
9380
9380
|
throw new TypeError("invalid argument ecpair");
|
|
9381
9381
|
}
|
|
9382
9382
|
if (!ecPair.d)
|
|
@@ -10983,7 +10983,7 @@ var require_signature = __commonJS({
|
|
|
10983
10983
|
var opcodes3 = require_bitcoin_ops();
|
|
10984
10984
|
var script = require_script();
|
|
10985
10985
|
var crypto2 = require_crypto();
|
|
10986
|
-
var
|
|
10986
|
+
var ECPair4 = require_ecpair();
|
|
10987
10987
|
var Transaction4 = require_transaction();
|
|
10988
10988
|
var ECSignature = require_ecsignature();
|
|
10989
10989
|
var networks3 = require_networks();
|
|
@@ -11106,7 +11106,7 @@ var require_signature = __commonJS({
|
|
|
11106
11106
|
if (matchedPublicKeyIndices[publicKeyIndex]) {
|
|
11107
11107
|
continue;
|
|
11108
11108
|
}
|
|
11109
|
-
var publicKey =
|
|
11109
|
+
var publicKey = ECPair4.fromPublicKeyBuffer(publicKeyBuffer);
|
|
11110
11110
|
if (publicKey.verify(signatureHash, signature)) {
|
|
11111
11111
|
isSignatureValid = true;
|
|
11112
11112
|
matchedPublicKeyIndices[publicKeyIndex] = true;
|
|
@@ -11835,7 +11835,7 @@ var require_transaction_builder = __commonJS({
|
|
|
11835
11835
|
btemplates.types.SMART_TRANSACTION
|
|
11836
11836
|
];
|
|
11837
11837
|
var P2SH = SIGNABLE.concat([btemplates.types.P2WPKH, btemplates.types.P2WSH]);
|
|
11838
|
-
var
|
|
11838
|
+
var ECPair4 = require_ecpair();
|
|
11839
11839
|
var ECSignature = require_ecsignature();
|
|
11840
11840
|
var Transaction4 = require_transaction();
|
|
11841
11841
|
var SmartTransactionSignatures = require_smart_transaction_signatures();
|
|
@@ -11991,7 +11991,7 @@ var require_transaction_builder = __commonJS({
|
|
|
11991
11991
|
network = network || networks3.bitcoin;
|
|
11992
11992
|
var unmatched = input.signatures.concat();
|
|
11993
11993
|
input.signatures = input.pubKeys.map(function(pubKey) {
|
|
11994
|
-
var keyPair =
|
|
11994
|
+
var keyPair = ECPair4.fromPublicKeyBuffer(pubKey);
|
|
11995
11995
|
var match;
|
|
11996
11996
|
unmatched.some(function(signature, i) {
|
|
11997
11997
|
if (!signature)
|
|
@@ -12911,7 +12911,7 @@ var require_hdnode = __commonJS({
|
|
|
12911
12911
|
var types = require_types();
|
|
12912
12912
|
var NETWORKS = require_networks();
|
|
12913
12913
|
var BigInteger = require_lib();
|
|
12914
|
-
var
|
|
12914
|
+
var ECPair4 = require_ecpair();
|
|
12915
12915
|
var ecurve = require_lib2();
|
|
12916
12916
|
var curve = ecurve.getCurveByName("secp256k1");
|
|
12917
12917
|
var fastcurve = require_fastcurve();
|
|
@@ -12939,7 +12939,7 @@ var require_hdnode = __commonJS({
|
|
|
12939
12939
|
var IL = I.slice(0, 32);
|
|
12940
12940
|
var IR = I.slice(32);
|
|
12941
12941
|
var pIL = BigInteger.fromBuffer(IL);
|
|
12942
|
-
var keyPair = new
|
|
12942
|
+
var keyPair = new ECPair4(pIL, null, {
|
|
12943
12943
|
network
|
|
12944
12944
|
});
|
|
12945
12945
|
return new HDNode(keyPair, IR);
|
|
@@ -12979,11 +12979,11 @@ var require_hdnode = __commonJS({
|
|
|
12979
12979
|
if (buffer.readUInt8(45) !== 0)
|
|
12980
12980
|
throw new Error("Invalid private key");
|
|
12981
12981
|
var d = BigInteger.fromBuffer(buffer.slice(46, 78));
|
|
12982
|
-
keyPair = new
|
|
12982
|
+
keyPair = new ECPair4(d, null, { network });
|
|
12983
12983
|
} else {
|
|
12984
12984
|
var Q = ecurve.Point.decodeFrom(curve, buffer.slice(45, 78));
|
|
12985
12985
|
curve.validate(Q);
|
|
12986
|
-
keyPair = new
|
|
12986
|
+
keyPair = new ECPair4(null, Q, { network });
|
|
12987
12987
|
}
|
|
12988
12988
|
var hd = new HDNode(keyPair, chainCode);
|
|
12989
12989
|
hd.depth = depth;
|
|
@@ -13007,7 +13007,7 @@ var require_hdnode = __commonJS({
|
|
|
13007
13007
|
return this.keyPair.getPublicKeyBuffer();
|
|
13008
13008
|
};
|
|
13009
13009
|
HDNode.prototype.neutered = function() {
|
|
13010
|
-
var neuteredKeyPair = new
|
|
13010
|
+
var neuteredKeyPair = new ECPair4(null, this.keyPair.Q, {
|
|
13011
13011
|
network: this.keyPair.network
|
|
13012
13012
|
});
|
|
13013
13013
|
var neutered = new HDNode(neuteredKeyPair, this.chainCode);
|
|
@@ -13068,7 +13068,7 @@ var require_hdnode = __commonJS({
|
|
|
13068
13068
|
if (ki.signum() === 0) {
|
|
13069
13069
|
return this.derive(index + 1);
|
|
13070
13070
|
}
|
|
13071
|
-
derivedKeyPair = new
|
|
13071
|
+
derivedKeyPair = new ECPair4(ki, null, {
|
|
13072
13072
|
network: this.keyPair.network
|
|
13073
13073
|
});
|
|
13074
13074
|
} else {
|
|
@@ -13077,7 +13077,7 @@ var require_hdnode = __commonJS({
|
|
|
13077
13077
|
if (curve.isInfinity(Ki)) {
|
|
13078
13078
|
return this.derive(index + 1);
|
|
13079
13079
|
}
|
|
13080
|
-
derivedKeyPair = new
|
|
13080
|
+
derivedKeyPair = new ECPair4(null, Ki, {
|
|
13081
13081
|
network: this.keyPair.network
|
|
13082
13082
|
});
|
|
13083
13083
|
}
|
|
@@ -13127,7 +13127,7 @@ var require_hdnode = __commonJS({
|
|
|
13127
13127
|
};
|
|
13128
13128
|
HDNode.prototype.cloneKeypair = function() {
|
|
13129
13129
|
var k = this.keyPair;
|
|
13130
|
-
var result = new
|
|
13130
|
+
var result = new ECPair4(k.d, k.d ? null : k.Q, {
|
|
13131
13131
|
network: k.network,
|
|
13132
13132
|
compressed: k.compressed
|
|
13133
13133
|
});
|
|
@@ -13154,7 +13154,7 @@ var require_identity_signature = __commonJS({
|
|
|
13154
13154
|
var sha256 = require_crypto().sha256;
|
|
13155
13155
|
var createHash3 = require("create-hash");
|
|
13156
13156
|
var ECSignature = require_ecsignature();
|
|
13157
|
-
var
|
|
13157
|
+
var ECPair4 = require_ecpair();
|
|
13158
13158
|
var VERUS_DATA_SIGNATURE_PREFIX_STRING = "Verus signed data:\n";
|
|
13159
13159
|
var bufferWriter = new bufferutils.BufferWriter(Buffer2.alloc(VERUS_DATA_SIGNATURE_PREFIX_STRING.length + 1));
|
|
13160
13160
|
bufferWriter.writeVarSlice(Buffer2.from("Verus signed data:\n", "utf-8"));
|
|
@@ -13221,7 +13221,7 @@ var require_identity_signature = __commonJS({
|
|
|
13221
13221
|
var compactSig;
|
|
13222
13222
|
for (recid = 0; recid < 4; recid++) {
|
|
13223
13223
|
compactSig = signature.toCompact(recid, true);
|
|
13224
|
-
var recoveredKeyPair =
|
|
13224
|
+
var recoveredKeyPair = ECPair4.recoverFromSignature(buffer, compactSig, this.network);
|
|
13225
13225
|
if (recoveredKeyPair.getAddress() === signingAddress) {
|
|
13226
13226
|
this.signatures.push(compactSig);
|
|
13227
13227
|
return compactSig;
|
|
@@ -13237,7 +13237,7 @@ var require_identity_signature = __commonJS({
|
|
|
13237
13237
|
for (var i = 0; i < this.signatures.length; i++) {
|
|
13238
13238
|
try {
|
|
13239
13239
|
var sig = ECSignature.parseCompact(this.signatures[i]);
|
|
13240
|
-
var pubKeyPair =
|
|
13240
|
+
var pubKeyPair = ECPair4.recoverFromSignature(hash, sig.signature.toCompact(sig.i, true), this.network);
|
|
13241
13241
|
if (pubKeyPair.getAddress() === signingAddress) {
|
|
13242
13242
|
var verification = pubKeyPair.verify(hash, sig.signature);
|
|
13243
13243
|
results.push(verification);
|
|
@@ -32539,6 +32539,11 @@ function resolveExpiryHeight(expiryHeight) {
|
|
|
32539
32539
|
`Invalid expiryHeight: must be a non-negative integer (got ${expiryHeight})`
|
|
32540
32540
|
);
|
|
32541
32541
|
}
|
|
32542
|
+
if (expiryHeight >= 5e8) {
|
|
32543
|
+
throw new TransactionBuildError(
|
|
32544
|
+
`Invalid expiryHeight: must be below 500000000 (got ${expiryHeight}); this looks like a timestamp, not a block height`
|
|
32545
|
+
);
|
|
32546
|
+
}
|
|
32542
32547
|
return expiryHeight;
|
|
32543
32548
|
}
|
|
32544
32549
|
function getNetwork(testnet = false) {
|
|
@@ -32657,13 +32662,13 @@ function decodeUtxo(utxo, systemId) {
|
|
|
32657
32662
|
}
|
|
32658
32663
|
return { ...utxo, currencyValues };
|
|
32659
32664
|
}
|
|
32660
|
-
function estimateFee(numInputs, numOutputs, feePerKb = DEFAULT_FEE_PER_KB, hasSmartOutputs = false) {
|
|
32665
|
+
function estimateFee(numInputs, numOutputs, feePerKb = DEFAULT_FEE_PER_KB, hasSmartOutputs = false, extraBytes = 0) {
|
|
32661
32666
|
const outputSize = hasSmartOutputs ? SMART_OUTPUT_SIZE : P2PKH_OUTPUT_SIZE;
|
|
32662
|
-
const txSize = TX_OVERHEAD + numInputs * INPUT_SIZE + numOutputs * outputSize;
|
|
32667
|
+
const txSize = TX_OVERHEAD + numInputs * INPUT_SIZE + numOutputs * outputSize + extraBytes;
|
|
32663
32668
|
const fee = (BigInt(txSize) * feePerKb + 999n) / 1000n;
|
|
32664
32669
|
return fee > MIN_FEE ? fee : MIN_FEE;
|
|
32665
32670
|
}
|
|
32666
|
-
function selectUtxos(utxos, requiredNative, requiredCurrencies = /* @__PURE__ */ new Map(), numOutputs = 2, systemId = NETWORK_CONFIG.mainnet.chainId, feePerKb = DEFAULT_FEE_PER_KB, hasSmartOutputs = false) {
|
|
32671
|
+
function selectUtxos(utxos, requiredNative, requiredCurrencies = /* @__PURE__ */ new Map(), numOutputs = 2, systemId = NETWORK_CONFIG.mainnet.chainId, feePerKb = DEFAULT_FEE_PER_KB, hasSmartOutputs = false, extraOutputBytes = 0) {
|
|
32667
32672
|
const seenOutpoints = /* @__PURE__ */ new Set();
|
|
32668
32673
|
for (const u of utxos) {
|
|
32669
32674
|
const outpoint = `${u.txid}:${u.outputIndex}`;
|
|
@@ -32712,18 +32717,32 @@ function selectUtxos(utxos, requiredNative, requiredCurrencies = /* @__PURE__ */
|
|
|
32712
32717
|
}
|
|
32713
32718
|
}
|
|
32714
32719
|
}
|
|
32715
|
-
const
|
|
32716
|
-
|
|
32717
|
-
|
|
32718
|
-
if (currency !== systemId && needed < 0n) {
|
|
32719
|
-
changeOutputCount++;
|
|
32720
|
+
const carriesToken = (u) => {
|
|
32721
|
+
for (const [currency, amount] of u.currencyValues) {
|
|
32722
|
+
if (currency !== systemId && amount > 0n) return true;
|
|
32720
32723
|
}
|
|
32721
|
-
|
|
32724
|
+
return false;
|
|
32725
|
+
};
|
|
32726
|
+
const nativeOnly = decoded.filter((u) => !selected.includes(u)).sort((a, b) => {
|
|
32727
|
+
const at = carriesToken(a) ? 1 : 0;
|
|
32728
|
+
const bt = carriesToken(b) ? 1 : 0;
|
|
32729
|
+
if (at !== bt) return at - bt;
|
|
32730
|
+
return b.satoshis > a.satoshis ? 1 : b.satoshis < a.satoshis ? -1 : 0;
|
|
32731
|
+
});
|
|
32732
|
+
const countCurrencyChanges = () => {
|
|
32733
|
+
let n = 0;
|
|
32734
|
+
for (const [currency, needed] of remaining) {
|
|
32735
|
+
if (currency !== systemId && needed < 0n) n++;
|
|
32736
|
+
}
|
|
32737
|
+
return n;
|
|
32738
|
+
};
|
|
32739
|
+
let changeOutputCount = countCurrencyChanges();
|
|
32722
32740
|
let fee = estimateFee(
|
|
32723
32741
|
selected.length + 1,
|
|
32724
32742
|
numOutputs + 1 + changeOutputCount,
|
|
32725
32743
|
feePerKb,
|
|
32726
|
-
hasSmartOutputs
|
|
32744
|
+
hasSmartOutputs,
|
|
32745
|
+
extraOutputBytes
|
|
32727
32746
|
);
|
|
32728
32747
|
while (remainingNative + fee > 0n) {
|
|
32729
32748
|
const next = nativeOnly.shift();
|
|
@@ -32737,11 +32756,17 @@ function selectUtxos(utxos, requiredNative, requiredCurrencies = /* @__PURE__ */
|
|
|
32737
32756
|
}
|
|
32738
32757
|
selected.push(next);
|
|
32739
32758
|
remainingNative -= next.satoshis;
|
|
32759
|
+
for (const [currency, amount] of next.currencyValues) {
|
|
32760
|
+
if (currency === systemId || amount <= 0n) continue;
|
|
32761
|
+
remaining.set(currency, (remaining.get(currency) || 0n) - amount);
|
|
32762
|
+
}
|
|
32763
|
+
changeOutputCount = countCurrencyChanges();
|
|
32740
32764
|
fee = estimateFee(
|
|
32741
32765
|
selected.length,
|
|
32742
32766
|
numOutputs + 1 + changeOutputCount,
|
|
32743
32767
|
feePerKb,
|
|
32744
|
-
hasSmartOutputs
|
|
32768
|
+
hasSmartOutputs,
|
|
32769
|
+
extraOutputBytes
|
|
32745
32770
|
);
|
|
32746
32771
|
}
|
|
32747
32772
|
const totalNativeIn = selected.reduce((sum, u) => sum + u.satoshis, 0n);
|
|
@@ -32895,6 +32920,38 @@ var HASH160_BYTE_LENGTH = 20;
|
|
|
32895
32920
|
var HASH256_BYTE_LENGTH = 32;
|
|
32896
32921
|
var NULL_ID_HASH = Buffer.alloc(HASH160_BYTE_LENGTH, 0);
|
|
32897
32922
|
var EVAL_IDENTITY_ADVANCEDRESERVATION = 10;
|
|
32923
|
+
function assertAddressVersion(address, expectedVersion, label) {
|
|
32924
|
+
let version;
|
|
32925
|
+
try {
|
|
32926
|
+
version = (0, import_verus_typescript_primitives4.fromBase58Check)(address).version;
|
|
32927
|
+
} catch {
|
|
32928
|
+
throw new TransactionBuildError(`${label} is not a valid base58check address: ${JSON.stringify(address)}`);
|
|
32929
|
+
}
|
|
32930
|
+
if (version !== expectedVersion) {
|
|
32931
|
+
const want = expectedVersion === I_ADDR_VERSION ? "an identity i-address" : "an R-address";
|
|
32932
|
+
throw new TransactionBuildError(
|
|
32933
|
+
`${label} must be ${want} (version ${expectedVersion}), got version ${version}: ${address}`
|
|
32934
|
+
);
|
|
32935
|
+
}
|
|
32936
|
+
}
|
|
32937
|
+
function validateMinSigs(minSigs, primaryCount) {
|
|
32938
|
+
if (!Number.isInteger(minSigs) || minSigs < 1 || minSigs > primaryCount) {
|
|
32939
|
+
throw new TransactionBuildError(
|
|
32940
|
+
`minSigs must be an integer between 1 and the number of primary addresses (${primaryCount}), got ${minSigs}`
|
|
32941
|
+
);
|
|
32942
|
+
}
|
|
32943
|
+
}
|
|
32944
|
+
function validateUpdateAddressParams(params) {
|
|
32945
|
+
params.primaryAddresses?.forEach(
|
|
32946
|
+
(a, i) => assertAddressVersion(a, PUBKEY_HASH_PREFIX, `primaryAddresses[${i}]`)
|
|
32947
|
+
);
|
|
32948
|
+
if (params.revocationAuthority) {
|
|
32949
|
+
assertAddressVersion(params.revocationAuthority, I_ADDR_VERSION, "revocationAuthority");
|
|
32950
|
+
}
|
|
32951
|
+
if (params.recoveryAuthority) {
|
|
32952
|
+
assertAddressVersion(params.recoveryAuthority, I_ADDR_VERSION, "recoveryAuthority");
|
|
32953
|
+
}
|
|
32954
|
+
}
|
|
32898
32955
|
function generateSalt() {
|
|
32899
32956
|
return (0, import_crypto2.randomBytes)(HASH256_BYTE_LENGTH);
|
|
32900
32957
|
}
|
|
@@ -33052,6 +33109,12 @@ function calculateRegistrationFees(hasReferral, totalFee = DEFAULT_REGISTRATION_
|
|
|
33052
33109
|
return { issuerFee, referralAmount, totalRequired };
|
|
33053
33110
|
}
|
|
33054
33111
|
function createIdentityObject(params) {
|
|
33112
|
+
params.primaryAddresses.forEach(
|
|
33113
|
+
(addr, i) => assertAddressVersion(addr, PUBKEY_HASH_PREFIX, `primaryAddresses[${i}]`)
|
|
33114
|
+
);
|
|
33115
|
+
assertAddressVersion(params.revocationAuthority, I_ADDR_VERSION, "revocationAuthority");
|
|
33116
|
+
assertAddressVersion(params.recoveryAuthority, I_ADDR_VERSION, "recoveryAuthority");
|
|
33117
|
+
validateMinSigs(params.minSigs ?? 1, params.primaryAddresses.length);
|
|
33055
33118
|
const primaryKeys = params.primaryAddresses.map((addr) => import_verus_typescript_primitives2.KeyID.fromAddress(addr));
|
|
33056
33119
|
const identity = new import_verus_typescript_primitives2.Identity({
|
|
33057
33120
|
version: import_verus_typescript_primitives2.Identity.VERSION_CURRENT,
|
|
@@ -33109,7 +33172,17 @@ function buildRegistrationFeeOutput(parentCurrencyId, feeAmount, systemId, _cont
|
|
|
33109
33172
|
return { script: script.toBuffer(), nativeValue: RESERVE_TRANSFER_FEE };
|
|
33110
33173
|
}
|
|
33111
33174
|
function buildTokenChangeOutput(changeAddress, currencyChanges) {
|
|
33112
|
-
const
|
|
33175
|
+
const version = (0, import_verus_typescript_primitives4.fromBase58Check)(changeAddress).version;
|
|
33176
|
+
let destination;
|
|
33177
|
+
if (version === I_ADDR_VERSION) {
|
|
33178
|
+
destination = new import_verus_typescript_primitives2.TxDestination(import_verus_typescript_primitives2.IdentityID.fromAddress(changeAddress));
|
|
33179
|
+
} else if (version === PUBKEY_HASH_PREFIX) {
|
|
33180
|
+
destination = new import_verus_typescript_primitives2.TxDestination(import_verus_typescript_primitives2.KeyID.fromAddress(changeAddress));
|
|
33181
|
+
} else {
|
|
33182
|
+
throw new TransactionBuildError(
|
|
33183
|
+
`token change address must be an R-address or identity i-address, got version ${version}: ${changeAddress}`
|
|
33184
|
+
);
|
|
33185
|
+
}
|
|
33113
33186
|
const valueMap = /* @__PURE__ */ new Map();
|
|
33114
33187
|
for (const [currency, amount] of currencyChanges) {
|
|
33115
33188
|
if (amount > 0n) {
|
|
@@ -33166,9 +33239,10 @@ function buildAndSignCommitment(params, network) {
|
|
|
33166
33239
|
}
|
|
33167
33240
|
const verusNetwork = getNetwork(network === "testnet");
|
|
33168
33241
|
const networkConfig = NETWORK_CONFIG[network];
|
|
33242
|
+
const controlAddress = import_utxo_lib3.ECPair.fromWIF(params.wif, verusNetwork).getAddress();
|
|
33169
33243
|
const commitment = prepareNameCommitment(
|
|
33170
33244
|
params.name,
|
|
33171
|
-
|
|
33245
|
+
controlAddress,
|
|
33172
33246
|
params.referral,
|
|
33173
33247
|
params.parent,
|
|
33174
33248
|
network
|
|
@@ -33197,7 +33271,11 @@ function buildAndSignCommitment(params, network) {
|
|
|
33197
33271
|
}
|
|
33198
33272
|
txb.addOutput(commitment.commitmentScript, 0);
|
|
33199
33273
|
if (selection.nativeChange > 0n) {
|
|
33200
|
-
|
|
33274
|
+
if (params.changeAddress.startsWith("i")) {
|
|
33275
|
+
txb.addOutput(identityPaymentScript(params.changeAddress), toSafeNumber(selection.nativeChange));
|
|
33276
|
+
} else {
|
|
33277
|
+
txb.addOutput(params.changeAddress, toSafeNumber(selection.nativeChange));
|
|
33278
|
+
}
|
|
33201
33279
|
}
|
|
33202
33280
|
const unsignedTx = txb.buildIncomplete();
|
|
33203
33281
|
const { signedTx, txid } = signTransactionSmart(
|
|
@@ -33268,6 +33346,12 @@ function _buildVrscRegistration(params, identityScript, reservationScript, ident
|
|
|
33268
33346
|
const referralOutputs = [];
|
|
33269
33347
|
if (hasReferral) {
|
|
33270
33348
|
const chain = params.referralChain && params.referralChain.length > 0 ? params.referralChain : commitData.referral ? [commitData.referral] : [];
|
|
33349
|
+
const referralLevels = params.referralLevels ?? DEFAULT_REFERRAL_LEVELS;
|
|
33350
|
+
if (chain.length > referralLevels) {
|
|
33351
|
+
throw new TransactionBuildError(
|
|
33352
|
+
`referralChain has ${chain.length} entries but at most ${referralLevels} referral levels are allowed`
|
|
33353
|
+
);
|
|
33354
|
+
}
|
|
33271
33355
|
for (const referrerAddr of chain) {
|
|
33272
33356
|
referralOutputs.push({
|
|
33273
33357
|
script: buildReferralPaymentScript(referrerAddr),
|
|
@@ -33277,7 +33361,7 @@ function _buildVrscRegistration(params, identityScript, reservationScript, ident
|
|
|
33277
33361
|
}
|
|
33278
33362
|
const totalFee = params.registrationFee ?? DEFAULT_REGISTRATION_FEE;
|
|
33279
33363
|
const totalReferralPayments = referralOutputs.reduce((sum, o) => sum + o.value, 0n);
|
|
33280
|
-
const requiredNative = totalFee;
|
|
33364
|
+
const requiredNative = hasReferral ? fees.issuerFee : totalFee;
|
|
33281
33365
|
const numOutputs = 2 + referralOutputs.length + 1;
|
|
33282
33366
|
const selection = selectUtxos(
|
|
33283
33367
|
params.utxos,
|
|
@@ -33313,11 +33397,15 @@ function _buildVrscRegistration(params, identityScript, reservationScript, ident
|
|
|
33313
33397
|
}
|
|
33314
33398
|
txb.addOutput(reservationScript, 0);
|
|
33315
33399
|
if (selection.nativeChange > 0n) {
|
|
33316
|
-
|
|
33400
|
+
if (params.changeAddress.startsWith("i")) {
|
|
33401
|
+
txb.addOutput(identityPaymentScript(params.changeAddress), toSafeNumber(selection.nativeChange));
|
|
33402
|
+
} else {
|
|
33403
|
+
txb.addOutput(params.changeAddress, toSafeNumber(selection.nativeChange));
|
|
33404
|
+
}
|
|
33317
33405
|
}
|
|
33318
33406
|
const unsignedTx = txb.buildIncomplete();
|
|
33319
33407
|
const allUtxos = [commitUtxo, ...selection.selected];
|
|
33320
|
-
const expectedImplicitFee = commitUtxo.satoshis +
|
|
33408
|
+
const expectedImplicitFee = commitUtxo.satoshis + requiredNative - totalReferralPayments + selection.fee;
|
|
33321
33409
|
const assembledNativeFee = allUtxos.reduce((sum, u) => sum + u.satoshis, 0n) - unsignedTx.outs.reduce((sum, o) => sum + BigInt(o.value), 0n);
|
|
33322
33410
|
if (assembledNativeFee !== expectedImplicitFee) {
|
|
33323
33411
|
throw new TransactionBuildError(
|
|
@@ -33336,7 +33424,10 @@ function _buildVrscRegistration(params, identityScript, reservationScript, ident
|
|
|
33336
33424
|
txid,
|
|
33337
33425
|
fee: selection.fee,
|
|
33338
33426
|
identityAddress,
|
|
33339
|
-
|
|
33427
|
+
// The registrant's registration outlay: the discounted issuer fee when
|
|
33428
|
+
// referred, the full fee otherwise. (Of this, referralPayments go to the
|
|
33429
|
+
// referrers and the remainder is the implicit miner fee.)
|
|
33430
|
+
registrationFee: requiredNative,
|
|
33340
33431
|
referralPayments: referralOutputs.length,
|
|
33341
33432
|
referralAmountEach: fees.referralAmount,
|
|
33342
33433
|
inputsUsed: allUtxos.length,
|
|
@@ -33402,7 +33493,11 @@ function _buildSubIdRegistration(params, identity, identityScript, reservationSc
|
|
|
33402
33493
|
);
|
|
33403
33494
|
txb.addOutput(tokenChangeScript.script, toSafeNumber(selection.nativeChange));
|
|
33404
33495
|
} else {
|
|
33405
|
-
|
|
33496
|
+
if (params.changeAddress.startsWith("i")) {
|
|
33497
|
+
txb.addOutput(identityPaymentScript(params.changeAddress), toSafeNumber(selection.nativeChange));
|
|
33498
|
+
} else {
|
|
33499
|
+
txb.addOutput(params.changeAddress, toSafeNumber(selection.nativeChange));
|
|
33500
|
+
}
|
|
33406
33501
|
}
|
|
33407
33502
|
}
|
|
33408
33503
|
const unsignedTx = txb.buildIncomplete();
|
|
@@ -33438,12 +33533,29 @@ function buildAndSignIdentityUpdate(params, network, operation = "update", lockU
|
|
|
33438
33533
|
const systemId = networkConfig.chainId;
|
|
33439
33534
|
const identity = new import_verus_typescript_primitives2.Identity();
|
|
33440
33535
|
identity.fromBuffer(Buffer.from(params.identityHex, "hex"));
|
|
33536
|
+
let requiresPrimary = operation === "update" || operation === "lock" || operation === "unlock";
|
|
33537
|
+
if (!requiresPrimary && (operation === "revoke" || operation === "recover")) {
|
|
33538
|
+
const self = identity.getIdentityAddress();
|
|
33539
|
+
const authority = operation === "revoke" ? identity.revocation_authority?.toAddress() : identity.recovery_authority?.toAddress();
|
|
33540
|
+
requiresPrimary = authority === self;
|
|
33541
|
+
}
|
|
33542
|
+
if (requiresPrimary) {
|
|
33543
|
+
const signerAddress = import_utxo_lib3.ECPair.fromWIF(params.wif, verusNetwork).getAddress();
|
|
33544
|
+
const currentPrimaries = (identity.primary_addresses ?? []).map((k) => k.toAddress());
|
|
33545
|
+
if (!currentPrimaries.includes(signerAddress)) {
|
|
33546
|
+
throw new TransactionBuildError(
|
|
33547
|
+
`the provided WIF (${signerAddress}) is not among the identity's primary addresses [${currentPrimaries.join(", ")}]; it cannot authorize a ${operation}.`
|
|
33548
|
+
);
|
|
33549
|
+
}
|
|
33550
|
+
}
|
|
33441
33551
|
switch (operation) {
|
|
33442
33552
|
case "update": {
|
|
33553
|
+
validateUpdateAddressParams(params);
|
|
33443
33554
|
if (params.primaryAddresses) {
|
|
33444
33555
|
identity.setPrimaryAddresses(params.primaryAddresses);
|
|
33445
33556
|
}
|
|
33446
33557
|
if (params.minSigs !== void 0) {
|
|
33558
|
+
validateMinSigs(params.minSigs, identity.primary_addresses?.length ?? 0);
|
|
33447
33559
|
identity.min_sigs = new import_bn.default(params.minSigs);
|
|
33448
33560
|
}
|
|
33449
33561
|
if (params.revocationAuthority) {
|
|
@@ -33465,7 +33577,16 @@ function buildAndSignIdentityUpdate(params, network, operation = "update", lockU
|
|
|
33465
33577
|
if (params.contentMultimap) {
|
|
33466
33578
|
const jsonObj = {};
|
|
33467
33579
|
for (const [key, value] of Object.entries(params.contentMultimap)) {
|
|
33468
|
-
|
|
33580
|
+
assertAddressVersion(key, I_ADDR_VERSION, `contentMultimap key "${key}"`);
|
|
33581
|
+
const items = Array.isArray(value) ? value : [value];
|
|
33582
|
+
for (const item of items) {
|
|
33583
|
+
if (!/^[0-9a-fA-F]*$/.test(item) || item.length % 2 !== 0) {
|
|
33584
|
+
throw new TransactionBuildError(
|
|
33585
|
+
`contentMultimap["${key}"] entries must be even-length hex strings (got ${JSON.stringify(item)})`
|
|
33586
|
+
);
|
|
33587
|
+
}
|
|
33588
|
+
}
|
|
33589
|
+
jsonObj[key] = items;
|
|
33469
33590
|
}
|
|
33470
33591
|
identity.content_multimap = import_verus_typescript_primitives2.ContentMultiMap.fromJson(jsonObj);
|
|
33471
33592
|
}
|
|
@@ -33477,6 +33598,7 @@ function buildAndSignIdentityUpdate(params, network, operation = "update", lockU
|
|
|
33477
33598
|
break;
|
|
33478
33599
|
}
|
|
33479
33600
|
case "recover": {
|
|
33601
|
+
validateUpdateAddressParams(params);
|
|
33480
33602
|
identity.unrevoke();
|
|
33481
33603
|
identity.clearContentMultiMap();
|
|
33482
33604
|
if (params.primaryAddresses) {
|
|
@@ -33499,7 +33621,13 @@ function buildAndSignIdentityUpdate(params, network, operation = "update", lockU
|
|
|
33499
33621
|
break;
|
|
33500
33622
|
}
|
|
33501
33623
|
case "unlock": {
|
|
33502
|
-
|
|
33624
|
+
const unlockExpiry = resolveExpiryHeight(params.expiryHeight);
|
|
33625
|
+
if (unlockExpiry === 0) {
|
|
33626
|
+
throw new TransactionBuildError(
|
|
33627
|
+
"unlock requires a non-zero expiryHeight (currentBlockHeight + DEFAULT_EXPIRY_DELTA): the unlock delay is anchored to it, so 0 would bypass the timelock."
|
|
33628
|
+
);
|
|
33629
|
+
}
|
|
33630
|
+
identity.unlock(new import_bn.default(0), new import_bn.default(unlockExpiry));
|
|
33503
33631
|
break;
|
|
33504
33632
|
}
|
|
33505
33633
|
}
|
|
@@ -33516,7 +33644,11 @@ function buildAndSignIdentityUpdate(params, network, operation = "update", lockU
|
|
|
33516
33644
|
1,
|
|
33517
33645
|
systemId,
|
|
33518
33646
|
void 0,
|
|
33519
|
-
true
|
|
33647
|
+
true,
|
|
33648
|
+
// The identity output embeds the full serialized identity (a large
|
|
33649
|
+
// contentMultimap can make it multi-KB); size the fee from its real bytes
|
|
33650
|
+
// so a big update isn't fee-estimated below the relay minimum.
|
|
33651
|
+
unfundedHex.length / 2
|
|
33520
33652
|
);
|
|
33521
33653
|
const txb = new import_utxo_lib3.TransactionBuilder(verusNetwork);
|
|
33522
33654
|
txb.setVersion(4);
|
|
@@ -33535,12 +33667,21 @@ function buildAndSignIdentityUpdate(params, network, operation = "update", lockU
|
|
|
33535
33667
|
txb.addOutput(out.script, out.value);
|
|
33536
33668
|
}
|
|
33537
33669
|
if (selection.nativeChange > 0n) {
|
|
33538
|
-
|
|
33670
|
+
if (params.changeAddress.startsWith("i")) {
|
|
33671
|
+
txb.addOutput(identityPaymentScript(params.changeAddress), toSafeNumber(selection.nativeChange));
|
|
33672
|
+
} else {
|
|
33673
|
+
txb.addOutput(params.changeAddress, toSafeNumber(selection.nativeChange));
|
|
33674
|
+
}
|
|
33539
33675
|
}
|
|
33540
33676
|
const fundedTx = txb.buildIncomplete();
|
|
33541
33677
|
const fundedHex = fundedTx.toHex();
|
|
33542
33678
|
const prevOutScripts = selection.selected.map((u) => Buffer.from(u.script, "hex"));
|
|
33543
33679
|
const idUtxo = params.identityUtxo;
|
|
33680
|
+
if (idUtxo.satoshis !== 0n) {
|
|
33681
|
+
throw new TransactionBuildError(
|
|
33682
|
+
`identityUtxo carries ${idUtxo.satoshis} native satoshis, which would be burned to miner fee (the recreated identity output is value 0). Spend that value separately before updating.`
|
|
33683
|
+
);
|
|
33684
|
+
}
|
|
33544
33685
|
const completedHex = completeFundedIdentityUpdate(
|
|
33545
33686
|
fundedHex,
|
|
33546
33687
|
verusNetwork,
|
|
@@ -33627,10 +33768,10 @@ function parseAddress(address, addressType) {
|
|
|
33627
33768
|
case "ETH": {
|
|
33628
33769
|
type = import_verus_typescript_primitives5.DEST_ETH;
|
|
33629
33770
|
const addr = address.startsWith("0x") ? address.substring(2) : address;
|
|
33630
|
-
|
|
33631
|
-
|
|
33632
|
-
throw new InvalidAddressError(address, "ETH destination must be 20 bytes of hex");
|
|
33771
|
+
if (!/^[0-9a-fA-F]{40}$/.test(addr)) {
|
|
33772
|
+
throw new InvalidAddressError(address, "ETH destination must be exactly 20 bytes (40 hex chars)");
|
|
33633
33773
|
}
|
|
33774
|
+
destinationBytes = Buffer.from(addr, "hex");
|
|
33634
33775
|
break;
|
|
33635
33776
|
}
|
|
33636
33777
|
default:
|
|
@@ -33694,6 +33835,12 @@ function sendCurrency(params, network) {
|
|
|
33694
33835
|
(requiredCurrencies.get(out.currency) || 0n) + out.satoshis
|
|
33695
33836
|
);
|
|
33696
33837
|
}
|
|
33838
|
+
if (out.feeCurrency !== void 0 && out.feeCurrency !== systemId && out.feeSatoshis !== void 0) {
|
|
33839
|
+
requiredCurrencies.set(
|
|
33840
|
+
out.feeCurrency,
|
|
33841
|
+
(requiredCurrencies.get(out.feeCurrency) || 0n) + out.feeSatoshis
|
|
33842
|
+
);
|
|
33843
|
+
}
|
|
33697
33844
|
}
|
|
33698
33845
|
const selection = selectUtxos(
|
|
33699
33846
|
params.utxos,
|
|
@@ -33968,6 +34115,19 @@ var import_verus_typescript_primitives6 = __toESM(require_dist2());
|
|
|
33968
34115
|
var import_bn3 = __toESM(require("bn.js"));
|
|
33969
34116
|
var { completeFundedIdentityUpdate: completeFundedIdentityUpdate2 } = import_utxo_lib6.smarttxs;
|
|
33970
34117
|
function defineCurrency(params, network) {
|
|
34118
|
+
const wifCheck = validateWif(params.wif);
|
|
34119
|
+
if (!wifCheck.valid) {
|
|
34120
|
+
throw new InvalidWifError(wifCheck.error);
|
|
34121
|
+
}
|
|
34122
|
+
if (!params.identityHex) {
|
|
34123
|
+
throw new TransactionBuildError("identityHex is required");
|
|
34124
|
+
}
|
|
34125
|
+
if (!params.utxos || params.utxos.length === 0) {
|
|
34126
|
+
throw new TransactionBuildError("At least one funding UTXO is required");
|
|
34127
|
+
}
|
|
34128
|
+
if (!params.currencyDefScript) {
|
|
34129
|
+
throw new TransactionBuildError("currencyDefScript is required");
|
|
34130
|
+
}
|
|
33971
34131
|
const verusNetwork = getNetwork(network === "testnet");
|
|
33972
34132
|
const networkConfig = NETWORK_CONFIG[network];
|
|
33973
34133
|
const systemId = networkConfig.chainId;
|
|
@@ -33988,7 +34148,8 @@ function defineCurrency(params, network) {
|
|
|
33988
34148
|
2,
|
|
33989
34149
|
systemId,
|
|
33990
34150
|
void 0,
|
|
33991
|
-
true
|
|
34151
|
+
true,
|
|
34152
|
+
identityOutputScript.length + currencyDefScript.length
|
|
33992
34153
|
);
|
|
33993
34154
|
const txb = new import_utxo_lib6.TransactionBuilder(verusNetwork);
|
|
33994
34155
|
txb.setVersion(4);
|
|
@@ -34005,12 +34166,21 @@ function defineCurrency(params, network) {
|
|
|
34005
34166
|
txb.addOutput(identityOutputScript, 0);
|
|
34006
34167
|
txb.addOutput(currencyDefScript, toSafeNumber(currencyDefValue));
|
|
34007
34168
|
if (selection.nativeChange > 0n) {
|
|
34008
|
-
|
|
34169
|
+
if (params.changeAddress.startsWith("i")) {
|
|
34170
|
+
txb.addOutput(identityPaymentScript(params.changeAddress), toSafeNumber(selection.nativeChange));
|
|
34171
|
+
} else {
|
|
34172
|
+
txb.addOutput(params.changeAddress, toSafeNumber(selection.nativeChange));
|
|
34173
|
+
}
|
|
34009
34174
|
}
|
|
34010
34175
|
const fundedTx = txb.buildIncomplete();
|
|
34011
34176
|
const fundedHex = fundedTx.toHex();
|
|
34012
34177
|
const prevOutScripts = selection.selected.map((u) => Buffer.from(u.script, "hex"));
|
|
34013
34178
|
const idUtxo = params.identityUtxo;
|
|
34179
|
+
if (idUtxo.satoshis !== 0n) {
|
|
34180
|
+
throw new TransactionBuildError(
|
|
34181
|
+
`identityUtxo carries ${idUtxo.satoshis} native satoshis, which would be burned to miner fee (the recreated identity output is value 0). Spend that value separately first.`
|
|
34182
|
+
);
|
|
34183
|
+
}
|
|
34014
34184
|
const completedHex = completeFundedIdentityUpdate2(
|
|
34015
34185
|
fundedHex,
|
|
34016
34186
|
verusNetwork,
|