@kaspacom/kcc20-tx-builder 0.8.0-fee.5 → 0.8.0-fee.7

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.
@@ -1,4 +1,4 @@
1
- export declare const KCC20_BUILDER_KEYS: readonly ["kcc20.deploy-token", "kcc20.mint", "kcc20.set-public-mint-active", "kcc20.transfer", "kcc20.consolidate-holders", "kcc20.reveal-token", "kcc20wrapper.deploy-market", "kcc20wrapper.wrap", "kcc20wrapper.unwrap", "kcc20orderbook.create-bid", "kcc20orderbook.create-ask", "kcc20orderbook.fill-ask", "kcc20orderbook.fill-bid", "kcc20orderbook.sweep-asks", "kcc20orderbook.sweep-bids", "kcc20orderbook.consolidate-holders", "kcc20orderbook.cancel-ask", "kcc20orderbook.cancel-bid", "fee-ticket.deploy-root", "fee-ticket.update-denomination", "fee-ticket.create-from-utility-burn", "fee-ticket.burn", "fee-ticket.transfer", "kcc20fee.create-account", "kcc20fee.bind-account", "kcc20fee.deploy-market-genesis", "kcc20fee.bind-market", "kcc20fee.wrap", "kcc20fee.unwrap", "kcc20fee.create-ask", "kcc20fee.cancel-ask", "kcc20fee.create-bid", "kcc20fee.cancel-bid", "kcc20fee.buy-ask", "kcc20fee.buy-two-asks", "kcc20fee.claim", "kcc20fee.rotate-account", "kcc20-snapshot.deploy-bootstrap", "kcc20-snapshot.deploy-controller", "kcc20-snapshot.start", "kcc20-snapshot.claim"];
1
+ export declare const KCC20_BUILDER_KEYS: readonly ["kcc20.deploy-token", "kcc20.mint", "kcc20.set-public-mint-active", "kcc20.transfer", "kcc20.consolidate-holders", "kcc20.reveal-token", "kcc20wrapper.deploy-market", "kcc20wrapper.wrap", "kcc20wrapper.unwrap", "kcc20orderbook.create-bid", "kcc20orderbook.create-ask", "kcc20orderbook.fill-ask", "kcc20orderbook.fill-bid", "kcc20orderbook.sweep-asks", "kcc20orderbook.sweep-bids", "kcc20orderbook.consolidate-holders", "kcc20orderbook.cancel-ask", "kcc20orderbook.cancel-bid", "fee-ticket.deploy-root", "fee-ticket.update-denomination", "fee-ticket.create-from-utility-burn", "fee-ticket.burn", "fee-ticket.transfer", "kcc20fee.create-account", "kcc20fee.bind-account", "kcc20fee.deploy-market-genesis", "kcc20fee.bind-market", "kcc20fee.wrap", "kcc20fee.unwrap", "kcc20fee.merge-holders", "kcc20fee.create-ask", "kcc20fee.cancel-ask", "kcc20fee.create-bid", "kcc20fee.cancel-bid", "kcc20fee.buy-ask", "kcc20fee.buy-two-asks", "kcc20fee.sell-into-bids", "kcc20fee.claim", "kcc20fee.rotate-account", "kcc20-snapshot.deploy-bootstrap", "kcc20-snapshot.deploy-controller", "kcc20-snapshot.start", "kcc20-snapshot.claim"];
2
2
  export type Kcc20BuilderKey = (typeof KCC20_BUILDER_KEYS)[number];
3
3
  export declare function isKcc20BuilderKey(value: string): value is Kcc20BuilderKey;
4
4
  export declare const BACKEND_ONLY_BUILDER_KEYS: readonly ["kcc20orderbook.matcher-settle-crossed"];
@@ -33,12 +33,14 @@ exports.KCC20_BUILDER_KEYS = [
33
33
  "kcc20fee.bind-market",
34
34
  "kcc20fee.wrap",
35
35
  "kcc20fee.unwrap",
36
+ "kcc20fee.merge-holders",
36
37
  "kcc20fee.create-ask",
37
38
  "kcc20fee.cancel-ask",
38
39
  "kcc20fee.create-bid",
39
40
  "kcc20fee.cancel-bid",
40
41
  "kcc20fee.buy-ask",
41
42
  "kcc20fee.buy-two-asks",
43
+ "kcc20fee.sell-into-bids",
42
44
  "kcc20fee.claim",
43
45
  "kcc20fee.rotate-account",
44
46
  "kcc20-snapshot.deploy-bootstrap",
@@ -1 +1 @@
1
- {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/operations.ts"],"names":[],"mappings":";;;AA8CA,8CAEC;AAQD,0DAOC;AA/DY,QAAA,kBAAkB,GAAG;IAChC,oBAAoB;IACpB,YAAY;IACZ,8BAA8B;IAC9B,gBAAgB;IAChB,2BAA2B;IAC3B,oBAAoB;IACpB,4BAA4B;IAC5B,mBAAmB;IACnB,qBAAqB;IACrB,2BAA2B;IAC3B,2BAA2B;IAC3B,yBAAyB;IACzB,yBAAyB;IACzB,2BAA2B;IAC3B,2BAA2B;IAC3B,oCAAoC;IACpC,2BAA2B;IAC3B,2BAA2B;IAC3B,wBAAwB;IACxB,gCAAgC;IAChC,qCAAqC;IACrC,iBAAiB;IACjB,qBAAqB;IACrB,yBAAyB;IACzB,uBAAuB;IACvB,gCAAgC;IAChC,sBAAsB;IACtB,eAAe;IACf,iBAAiB;IACjB,qBAAqB;IACrB,qBAAqB;IACrB,qBAAqB;IACrB,qBAAqB;IACrB,kBAAkB;IAClB,uBAAuB;IACvB,gBAAgB;IAChB,yBAAyB;IACzB,iCAAiC;IACjC,kCAAkC;IAClC,sBAAsB;IACtB,sBAAsB;CACd,CAAC;AAIX,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,OAAQ,0BAAwC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAEY,QAAA,yBAAyB,GAAG;IACvC,uCAAuC;CAC/B,CAAC;AAIX,SAAgB,uBAAuB,CACrC,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACxB,iCAA+C,CAAC,QAAQ,CAAC,KAAK,CAAC,CACjE,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/operations.ts"],"names":[],"mappings":";;;AAgDA,8CAEC;AAQD,0DAOC;AAjEY,QAAA,kBAAkB,GAAG;IAChC,oBAAoB;IACpB,YAAY;IACZ,8BAA8B;IAC9B,gBAAgB;IAChB,2BAA2B;IAC3B,oBAAoB;IACpB,4BAA4B;IAC5B,mBAAmB;IACnB,qBAAqB;IACrB,2BAA2B;IAC3B,2BAA2B;IAC3B,yBAAyB;IACzB,yBAAyB;IACzB,2BAA2B;IAC3B,2BAA2B;IAC3B,oCAAoC;IACpC,2BAA2B;IAC3B,2BAA2B;IAC3B,wBAAwB;I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,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxD,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrE,qCAAqC,CAAC,KAAK,EAAE;QAC3C,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC5C,QAAQ,EAAE,oBAAoB,CAAC;CAChC;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,6BAA6B,GACrC,sBAAsB,CAuygBxB"}
package/dist/engine.js CHANGED
@@ -4001,8 +4001,9 @@ export function createKcc20PsktBuilderEngine(options) {
4001
4001
  return { schema: OUTPUT_SCHEMA,
4002
4002
  psktTransactionJson: feeResult.transaction.serializeToSafeJSON(),
4003
4003
  signInputs: [{ index: fundingInputIndex, sighashType: 1 }], scripts,
4004
- // Follower input 1 has a 600-unit budget without constrained consensus proof.
4005
- submitTransactionSupported: false,
4004
+ // The pinned two-ask follower and optional ticket budgets passed the
4005
+ // signed consensus proof in kaspa-covenants PR #718.
4006
+ submitTransactionSupported: true,
4006
4007
  metadata: { builderKey: "kcc20fee.buy-two-asks",
4007
4008
  operation: "fee-market-buy-two-asks", network, walletAddress,
4008
4009
  tokenId, marketId, policyId, fillCount: 2,
@@ -4128,14 +4129,23 @@ export function createKcc20PsktBuilderEngine(options) {
4128
4129
  String(utxo.state.wrapper_spk_hash).toLowerCase() !== holderPlan.wrapper.scriptHash) {
4129
4130
  throw new Error(`bid ${slot} differs from fixed market policy`);
4130
4131
  }
4132
+ // The indexer adds policy summary fields for API consumers. They are not
4133
+ // part of the on-chain bid state and must not enter script reconstruction.
4134
+ const { creatorFeeBps: indexedCreatorFeeBps, feePolicyVersion: indexedFeePolicyVersion, ...bidState } = utxo.state;
4135
+ if ((indexedCreatorFeeBps !== undefined &&
4136
+ Number(indexedCreatorFeeBps) !== params.feePolicy.creatorFeeBps) ||
4137
+ (indexedFeePolicyVersion !== undefined &&
4138
+ Number(indexedFeePolicyVersion) !== params.feePolicy.version)) {
4139
+ throw new Error(`bid ${slot} indexed policy summary differs from fixed policy`);
4140
+ }
4131
4141
  const bidScript = buildKcc20FeeMarketRoleScript({ artifact: artifacts.bid,
4132
- role: "bid", state: utxo.state });
4142
+ role: "bid", state: bidState });
4133
4143
  const buyerPlan = prepareKcc20FeeMarketWrappedHolder({ ...base,
4134
4144
  recipientOwner: buyer, recipientOwnerScheme: scheme,
4135
4145
  recipientPayoutScriptHash: payoutHash, tokenAmount: fill });
4136
4146
  const continuation = remaining > 0n
4137
4147
  ? buildKcc20FeeMarketRoleScript({ artifact: artifacts.bid,
4138
- role: "bid", state: { ...utxo.state, amount: remaining.toString() } })
4148
+ role: "bid", state: { ...bidState, amount: remaining.toString() } })
4139
4149
  : null;
4140
4150
  const fee = calculateKcc20EscrowFees({ grossSompi: gross,
4141
4151
  creatorFeeBps: params.feePolicy.creatorFeeBps, protocolWaived: Boolean(ticket) });