@kaspacom/kcc20-tx-builder 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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.2
4
+
5
+ - Reuse authenticated profile scripts during native holder consolidation, including the independent Argent implementation.
6
+ - Use each authenticated token profile's consolidation input limit: eight for platform KCC20 and three for Argent. Keep transaction mass and signature checks. Wrapped orderbook limits are unchanged.
7
+ - Native consolidation planning now requires `tokenProfileId` from authenticated token readiness; unknown profiles fail before signing. The engine independently authenticates source scripts and does not trust requested limits.
8
+
9
+
3
10
  ## 0.6.0
4
11
 
5
12
  - Remove manual token profile review and funded proof flags from runtime capability checks.
@@ -5948,6 +5948,11 @@ function createKcc20PsktBuilderEngine(options) {
5948
5948
  if (requestedMinterUtxos.length === 0) {
5949
5949
  throw new Error("active KCC20 mint-authority UTXO is required");
5950
5950
  }
5951
+ // The caller submits larger updates as sequential batches. Never truncate
5952
+ // this array: every supplied authority must be represented in the result.
5953
+ if (requestedMinterUtxos.length > 5) {
5954
+ throw new Error("Public mint availability updates support at most 5 authorities per transaction");
5955
+ }
5951
5956
  if (typeof params.active !== "boolean") {
5952
5957
  throw new Error("active must be a boolean");
5953
5958
  }
@@ -6201,8 +6206,16 @@ function createKcc20PsktBuilderEngine(options) {
6201
6206
  const holderUtxos = Array.isArray(params.activeHolderUtxos)
6202
6207
  ? params.activeHolderUtxos
6203
6208
  : [];
6204
- if (holderUtxos.length < 2 || holderUtxos.length > 3) {
6205
- throw new Error("between two and three KCC20 holder UTXOs are required");
6209
+ if (holderUtxos.length < 2) {
6210
+ throw new Error("at least two KCC20 holder UTXOs are required");
6211
+ }
6212
+ const maximumProfileInputs = Math.max(0, ...tokenProfiles.profiles.map((p) => p.maxTokenInputs));
6213
+ if (holderUtxos.length > maximumProfileInputs) {
6214
+ throw new Error(`consolidation exceeds the token profile input bound (${maximumProfileInputs})`);
6215
+ }
6216
+ const sourceOutpoints = holderUtxos.map((u) => `${(0, sale_common_js_1.requireHex32)(u.txidHex, "holder txid")}:${parseVout(u.vout, "holder vout")}`);
6217
+ if (new Set(sourceOutpoints).size !== holderUtxos.length) {
6218
+ throw new Error("consolidation requires distinct holder outpoints");
6206
6219
  }
6207
6220
  const covenantId = (0, sale_common_js_1.requireHex32)(params.activeHolderNativeCovenantId || params.covenantId, "canonical covenant id");
6208
6221
  const appCanonicalTokenId = (0, sale_common_js_1.requireHex32)(params.appCanonicalCovenantId || params.covenantId || covenantId, "app canonical token id");
@@ -6226,7 +6239,7 @@ function createKcc20PsktBuilderEngine(options) {
6226
6239
  }
6227
6240
  const profile = resolvedArtifacts[0].profile;
6228
6241
  if (holderUtxos.length > profile.maxTokenInputs) {
6229
- throw new Error("consolidation exceeds the token profile input bound");
6242
+ throw new Error(`consolidation exceeds the token profile input bound (${profile.maxTokenInputs})`);
6230
6243
  }
6231
6244
  const artifact = resolvedArtifacts[0].artifact;
6232
6245
  for (const peerState of states.slice(1)) {
@@ -6242,7 +6255,8 @@ function createKcc20PsktBuilderEngine(options) {
6242
6255
  const txid = (0, sale_common_js_1.requireHex32)(utxo.txidHex, `holder ${index} txid`);
6243
6256
  const vout = parseVout(utxo.vout, `holder ${index} vout`);
6244
6257
  const address = requireKaspaAddress(utxo.address);
6245
- const script = (0, sale_common_js_1.buildNativeKcc20ScriptForState)(artifact.script, states[index]);
6258
+ // Resolution already authenticated this profile's complete state layout.
6259
+ const script = resolvedArtifacts[index].script;
6246
6260
  assertScriptAddress(kw, script, address, network, `holder ${index} UTXO address`);
6247
6261
  return { txid, vout, address, script };
6248
6262
  });