@kaspacom/kcc20-tx-builder 0.6.1 → 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.
@@ -6206,8 +6206,16 @@ function createKcc20PsktBuilderEngine(options) {
6206
6206
  const holderUtxos = Array.isArray(params.activeHolderUtxos)
6207
6207
  ? params.activeHolderUtxos
6208
6208
  : [];
6209
- if (holderUtxos.length < 2 || holderUtxos.length > 3) {
6210
- 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");
6211
6219
  }
6212
6220
  const covenantId = (0, sale_common_js_1.requireHex32)(params.activeHolderNativeCovenantId || params.covenantId, "canonical covenant id");
6213
6221
  const appCanonicalTokenId = (0, sale_common_js_1.requireHex32)(params.appCanonicalCovenantId || params.covenantId || covenantId, "app canonical token id");
@@ -6231,7 +6239,7 @@ function createKcc20PsktBuilderEngine(options) {
6231
6239
  }
6232
6240
  const profile = resolvedArtifacts[0].profile;
6233
6241
  if (holderUtxos.length > profile.maxTokenInputs) {
6234
- throw new Error("consolidation exceeds the token profile input bound");
6242
+ throw new Error(`consolidation exceeds the token profile input bound (${profile.maxTokenInputs})`);
6235
6243
  }
6236
6244
  const artifact = resolvedArtifacts[0].artifact;
6237
6245
  for (const peerState of states.slice(1)) {
@@ -6247,7 +6255,8 @@ function createKcc20PsktBuilderEngine(options) {
6247
6255
  const txid = (0, sale_common_js_1.requireHex32)(utxo.txidHex, `holder ${index} txid`);
6248
6256
  const vout = parseVout(utxo.vout, `holder ${index} vout`);
6249
6257
  const address = requireKaspaAddress(utxo.address);
6250
- 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;
6251
6260
  assertScriptAddress(kw, script, address, network, `holder ${index} UTXO address`);
6252
6261
  return { txid, vout, address, script };
6253
6262
  });