@1sat/actions 0.0.196 → 0.0.198
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/apply/applyIntent.d.ts +7 -15
- package/dist/apply/applyIntent.d.ts.map +1 -1
- package/dist/apply/applyIntent.js +75 -25
- package/dist/apply/applyIntent.js.map +1 -1
- package/dist/apply/index.d.ts +1 -1
- package/dist/apply/index.d.ts.map +1 -1
- package/dist/apply/index.js +1 -1
- package/dist/apply/index.js.map +1 -1
- package/dist/apply/inscribeSigma.d.ts +1 -1
- package/dist/apply/inscribeSigma.d.ts.map +1 -1
- package/dist/apply/inscribeSigma.js +20 -13
- package/dist/apply/inscribeSigma.js.map +1 -1
- package/dist/apply/prepare.d.ts +18 -7
- package/dist/apply/prepare.d.ts.map +1 -1
- package/dist/apply/prepare.js +10 -20
- package/dist/apply/prepare.js.map +1 -1
- package/dist/apply/registry.d.ts +3 -2
- package/dist/apply/registry.d.ts.map +1 -1
- package/dist/apply/registry.js +5 -26
- package/dist/apply/registry.js.map +1 -1
- package/dist/collections/index.d.ts.map +1 -1
- package/dist/collections/index.js +77 -51
- package/dist/collections/index.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/cosign/finalize.js +1 -2
- package/dist/cosign/finalize.js.map +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/inscriptions/index.d.ts.map +1 -1
- package/dist/inscriptions/index.js +34 -39
- package/dist/inscriptions/index.js.map +1 -1
- package/dist/locks/index.d.ts +1 -1
- package/dist/locks/index.d.ts.map +1 -1
- package/dist/locks/index.js +28 -13
- package/dist/locks/index.js.map +1 -1
- package/dist/opns/index.d.ts.map +1 -1
- package/dist/opns/index.js +60 -50
- package/dist/opns/index.js.map +1 -1
- package/dist/ordinals/index.d.ts +1 -2
- package/dist/ordinals/index.d.ts.map +1 -1
- package/dist/ordinals/index.js +84 -93
- package/dist/ordinals/index.js.map +1 -1
- package/dist/pipeline/index.d.ts +4 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +4 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/runPipeline.d.ts +30 -0
- package/dist/pipeline/runPipeline.d.ts.map +1 -0
- package/dist/pipeline/runPipeline.js +85 -0
- package/dist/pipeline/runPipeline.js.map +1 -0
- package/dist/pipeline/spendTargets.d.ts +52 -0
- package/dist/pipeline/spendTargets.d.ts.map +1 -0
- package/dist/pipeline/spendTargets.js +87 -0
- package/dist/pipeline/spendTargets.js.map +1 -0
- package/dist/pipeline/unlockInput.d.ts +49 -0
- package/dist/pipeline/unlockInput.d.ts.map +1 -0
- package/dist/pipeline/unlockInput.js +316 -0
- package/dist/pipeline/unlockInput.js.map +1 -0
- package/dist/signing/index.d.ts +1 -1
- package/dist/signing/index.d.ts.map +1 -1
- package/dist/signing/index.js +1 -1
- package/dist/signing/index.js.map +1 -1
- package/dist/signing/sigma.d.ts +13 -17
- package/dist/signing/sigma.d.ts.map +1 -1
- package/dist/signing/sigma.js +37 -40
- package/dist/signing/sigma.js.map +1 -1
- package/dist/sweep/index.d.ts.map +1 -1
- package/dist/sweep/index.js +20 -17
- package/dist/sweep/index.js.map +1 -1
- package/dist/sync/syncCosignDeliveries.d.ts.map +1 -1
- package/dist/sync/syncCosignDeliveries.js +30 -20
- package/dist/sync/syncCosignDeliveries.js.map +1 -1
- package/dist/tokens/index.d.ts +8 -0
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +246 -174
- package/dist/tokens/index.js.map +1 -1
- package/dist/types.d.ts +16 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/bsv21Remittance.d.ts +63 -0
- package/dist/utils/bsv21Remittance.d.ts.map +1 -0
- package/dist/utils/bsv21Remittance.js +146 -0
- package/dist/utils/bsv21Remittance.js.map +1 -0
- package/dist/utils/bsv21Remittance.test.d.ts +2 -0
- package/dist/utils/bsv21Remittance.test.d.ts.map +1 -0
- package/dist/utils/bsv21Remittance.test.js +115 -0
- package/dist/utils/bsv21Remittance.test.js.map +1 -0
- package/dist/utils/createTrackedAction.d.ts +42 -38
- package/dist/utils/createTrackedAction.d.ts.map +1 -1
- package/dist/utils/createTrackedAction.js +154 -77
- package/dist/utils/createTrackedAction.js.map +1 -1
- package/dist/utils/hasOneSatModule.d.ts +14 -0
- package/dist/utils/hasOneSatModule.d.ts.map +1 -0
- package/dist/utils/hasOneSatModule.js +31 -0
- package/dist/utils/hasOneSatModule.js.map +1 -0
- package/dist/utils/internalizeBeef.d.ts.map +1 -1
- package/dist/utils/internalizeBeef.js +37 -12
- package/dist/utils/internalizeBeef.js.map +1 -1
- package/dist/utils/loadBasketOutput.d.ts +1 -1
- package/dist/utils/loadBasketOutput.d.ts.map +1 -1
- package/dist/utils/loadBasketOutput.js +11 -3
- package/dist/utils/loadBasketOutput.js.map +1 -1
- package/dist/utils/moveBasket.d.ts +37 -0
- package/dist/utils/moveBasket.d.ts.map +1 -0
- package/dist/utils/moveBasket.js +115 -0
- package/dist/utils/moveBasket.js.map +1 -0
- package/dist/utils/ordinalRemittance.d.ts +33 -0
- package/dist/utils/ordinalRemittance.d.ts.map +1 -0
- package/dist/utils/ordinalRemittance.js +70 -0
- package/dist/utils/ordinalRemittance.js.map +1 -0
- package/dist/utils/ordinalSeedTags.d.ts +5 -3
- package/dist/utils/ordinalSeedTags.d.ts.map +1 -1
- package/dist/utils/ordinalSeedTags.js +34 -7
- package/dist/utils/ordinalSeedTags.js.map +1 -1
- package/dist/utils/resolveDestination.d.ts +3 -6
- package/dist/utils/resolveDestination.d.ts.map +1 -1
- package/dist/utils/resolveDestination.js +5 -1
- package/dist/utils/resolveDestination.js.map +1 -1
- package/dist/utils/signOrdinalInput.d.ts +3 -2
- package/dist/utils/signOrdinalInput.d.ts.map +1 -1
- package/dist/utils/signOrdinalInput.js +18 -13
- package/dist/utils/signOrdinalInput.js.map +1 -1
- package/dist/utils/stampBsv21OutputCi.d.ts +16 -0
- package/dist/utils/stampBsv21OutputCi.d.ts.map +1 -0
- package/dist/utils/stampBsv21OutputCi.js +90 -0
- package/dist/utils/stampBsv21OutputCi.js.map +1 -0
- package/dist/utils/stampOrdinalOutputCi.d.ts +15 -0
- package/dist/utils/stampOrdinalOutputCi.d.ts.map +1 -0
- package/dist/utils/stampOrdinalOutputCi.js +103 -0
- package/dist/utils/stampOrdinalOutputCi.js.map +1 -0
- package/dist/utils/walletMetadataCi.d.ts +23 -0
- package/dist/utils/walletMetadataCi.d.ts.map +1 -0
- package/dist/utils/walletMetadataCi.js +70 -0
- package/dist/utils/walletMetadataCi.js.map +1 -0
- package/package.json +7 -7
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CreateActionArgs, type WalletInterface } from '@bsv/sdk';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* re-exports it, and `prepare.ts` (the base-wallet path) calls it. Reaching for
|
|
7
|
-
* `P1SAT_APPLY_REGISTRY` directly instead skips the stamping — that is exactly
|
|
8
|
-
* the bug this split exists to prevent.
|
|
9
|
-
*
|
|
10
|
-
* Mutates `args` in place (never replace inputs/outputs arrays). Unknown
|
|
11
|
-
* labeled intents fail closed.
|
|
12
|
-
*
|
|
13
|
-
* @param wallet - Base wallet only (field-sig / nested CA must not hit WPM)
|
|
14
|
-
* @param args - createAction args to mutate
|
|
15
|
-
* @param intent - Explicit intent; falls back to `p 1sat intent …` label
|
|
3
|
+
* Authoritative enrich (local pipeline + module embellish):
|
|
4
|
+
* managed `id:` tags, seals, script-derived tags, BSV-21 + ordinal/OpNS CI.
|
|
5
|
+
* Does **not** add module dispatch labels — those are opt-in via prepare.
|
|
16
6
|
*/
|
|
17
|
-
export declare function
|
|
7
|
+
export declare function applyP1SatCreateAction(wallet: WalletInterface, args: CreateActionArgs): Promise<void>;
|
|
8
|
+
/** @deprecated Use {@link applyP1SatCreateAction} */
|
|
9
|
+
export declare function applyP1SatIntent(wallet: WalletInterface, args: CreateActionArgs, _intent?: string): Promise<void>;
|
|
18
10
|
//# sourceMappingURL=applyIntent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyIntent.d.ts","sourceRoot":"","sources":["../../src/apply/applyIntent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"applyIntent.d.ts","sourceRoot":"","sources":["../../src/apply/applyIntent.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,gBAAgB,EAKrB,KAAK,eAAe,EACpB,MAAM,UAAU,CAAA;AAQjB;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC3C,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,gBAAgB,GACpB,OAAO,CAAC,IAAI,CAAC,CAef;AAED,qDAAqD;AACrD,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,gBAAgB,EACtB,OAAO,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -1,32 +1,82 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { OPNS_BASKET, ORDINALS_BASKET } from '@1sat/types';
|
|
2
|
+
import { LockingScript, PushDrop, Script, Utils, } from '@bsv/sdk';
|
|
3
|
+
import { stampManagedOutputIds } from '../utils/createTrackedAction';
|
|
4
|
+
import { stampBsv21OutputCustomInstructions } from '../utils/stampBsv21OutputCi';
|
|
5
|
+
import { stampOrdinalOutputCustomInstructions } from '../utils/stampOrdinalOutputCi';
|
|
6
|
+
import { applyInscribeSigma } from './inscribeSigma';
|
|
7
|
+
import { applyOpnsRegister } from './opnsRegister';
|
|
3
8
|
import { stampScriptDerivedTags } from './stampScriptTags';
|
|
4
9
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* re-exports it, and `prepare.ts` (the base-wallet path) calls it. Reaching for
|
|
9
|
-
* `P1SAT_APPLY_REGISTRY` directly instead skips the stamping — that is exactly
|
|
10
|
-
* the bug this split exists to prevent.
|
|
11
|
-
*
|
|
12
|
-
* Mutates `args` in place (never replace inputs/outputs arrays). Unknown
|
|
13
|
-
* labeled intents fail closed.
|
|
14
|
-
*
|
|
15
|
-
* @param wallet - Base wallet only (field-sig / nested CA must not hit WPM)
|
|
16
|
-
* @param args - createAction args to mutate
|
|
17
|
-
* @param intent - Explicit intent; falls back to `p 1sat intent …` label
|
|
10
|
+
* Authoritative enrich (local pipeline + module embellish):
|
|
11
|
+
* managed `id:` tags, seals, script-derived tags, BSV-21 + ordinal/OpNS CI.
|
|
12
|
+
* Does **not** add module dispatch labels — those are opt-in via prepare.
|
|
18
13
|
*/
|
|
19
|
-
export async function
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
await fn(wallet, args);
|
|
14
|
+
export async function applyP1SatCreateAction(wallet, args) {
|
|
15
|
+
stampManagedOutputIds(args);
|
|
16
|
+
if (hasUnsealedOpnsRegister(args)) {
|
|
17
|
+
await applyOpnsRegister(wallet, args);
|
|
18
|
+
}
|
|
19
|
+
if (hasUnsealedSigmaInscribe(args)) {
|
|
20
|
+
await applyInscribeSigma(wallet, args);
|
|
27
21
|
}
|
|
28
|
-
// After apply, so seals (PushDrop, sigma) are already on the outputs and the
|
|
29
|
-
// tags are stamped from the scripts that will actually be committed.
|
|
30
22
|
stampScriptDerivedTags(args);
|
|
23
|
+
// Tags/script + spent-input carry → CI. Keeps derivation.
|
|
24
|
+
// Same path for local (WPM encrypts after) and module (may re-encrypt).
|
|
25
|
+
await stampBsv21OutputCustomInstructions(wallet, args);
|
|
26
|
+
await stampOrdinalOutputCustomInstructions(wallet, args);
|
|
27
|
+
}
|
|
28
|
+
/** @deprecated Use {@link applyP1SatCreateAction} */
|
|
29
|
+
export async function applyP1SatIntent(wallet, args, _intent) {
|
|
30
|
+
await applyP1SatCreateAction(wallet, args);
|
|
31
|
+
}
|
|
32
|
+
function hasUnsealedOpnsRegister(args) {
|
|
33
|
+
const outputs = args.outputs;
|
|
34
|
+
if (!outputs?.length || !args.inputs?.[0]?.outpoint)
|
|
35
|
+
return false;
|
|
36
|
+
const out = outputs.find((o) => o.basket === OPNS_BASKET) ??
|
|
37
|
+
outputs.find((o) => o.satoshis === 1);
|
|
38
|
+
if (!out?.lockingScript)
|
|
39
|
+
return false;
|
|
40
|
+
try {
|
|
41
|
+
const fields = PushDrop.decode(LockingScript.fromHex(out.lockingScript)).fields;
|
|
42
|
+
const last = fields[fields.length - 1];
|
|
43
|
+
return !!last?.length && last.every((b) => b === 0);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function hasUnsealedSigmaInscribe(args) {
|
|
50
|
+
// Already has anchor input — sealed or mid-flight.
|
|
51
|
+
if (args.inputs?.length)
|
|
52
|
+
return false;
|
|
53
|
+
const outputs = args.outputs;
|
|
54
|
+
if (!outputs?.length)
|
|
55
|
+
return false;
|
|
56
|
+
const out = outputs.find((o) => o.basket === ORDINALS_BASKET) ?? outputs[0];
|
|
57
|
+
if (!out?.lockingScript)
|
|
58
|
+
return false;
|
|
59
|
+
try {
|
|
60
|
+
const script = Script.fromHex(out.lockingScript);
|
|
61
|
+
const bin = script.toBinary();
|
|
62
|
+
// SIGMA ascii in script + likely zero-filled compact sig region
|
|
63
|
+
const sigma = Utils.toArray('SIGMA');
|
|
64
|
+
return containsSubarray(bin, sigma);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function containsSubarray(hay, needle) {
|
|
71
|
+
if (needle.length === 0 || hay.length < needle.length)
|
|
72
|
+
return false;
|
|
73
|
+
outer: for (let i = 0; i <= hay.length - needle.length; i++) {
|
|
74
|
+
for (let j = 0; j < needle.length; j++) {
|
|
75
|
+
if (hay[i + j] !== needle[j])
|
|
76
|
+
continue outer;
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
31
81
|
}
|
|
32
82
|
//# sourceMappingURL=applyIntent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyIntent.js","sourceRoot":"","sources":["../../src/apply/applyIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"applyIntent.js","sourceRoot":"","sources":["../../src/apply/applyIntent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAEN,aAAa,EACb,QAAQ,EACR,MAAM,EACN,KAAK,GAEL,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,kCAAkC,EAAE,MAAM,6BAA6B,CAAA;AAChF,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAA;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAE1D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC3C,MAAuB,EACvB,IAAsB;IAEtB,qBAAqB,CAAC,IAAI,CAAC,CAAA;IAE3B,IAAI,uBAAuB,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,MAAM,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACtC,CAAC;IACD,IAAI,wBAAwB,CAAC,IAAI,CAAC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AAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;gBAAE,SAAS,KAAK,CAAA;QAC7C,CAAC;QACD,OAAO,IAAI,CAAA;IACZ,CAAC;IACD,OAAO,KAAK,CAAA;AACb,CAAC"}
|
package/dist/apply/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { applyP1SatIntent } from './applyIntent';
|
|
1
|
+
export { applyP1SatCreateAction, applyP1SatIntent } from './applyIntent';
|
|
2
2
|
export type { ApplyFn } from './registry';
|
|
3
3
|
export { P1SAT_APPLY_REGISTRY } from './registry';
|
|
4
4
|
export { applyInscribeSigma, sigmaAnchorKeyId } from './inscribeSigma';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/apply/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/apply/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACxE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/apply/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { applyP1SatIntent } from './applyIntent';
|
|
1
|
+
export { applyP1SatCreateAction, applyP1SatIntent } from './applyIntent';
|
|
2
2
|
export { P1SAT_APPLY_REGISTRY } from './registry';
|
|
3
3
|
export { applyInscribeSigma, sigmaAnchorKeyId } from './inscribeSigma';
|
|
4
4
|
export { applyOpnsRegister } from './opnsRegister';
|
package/dist/apply/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apply/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apply/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -7,7 +7,7 @@ import { type CreateActionArgs, type WalletInterface } from '@bsv/sdk';
|
|
|
7
7
|
export declare function sigmaAnchorKeyId(actionId: string): string;
|
|
8
8
|
/**
|
|
9
9
|
* Multi-step sigma inscribe apply on **base** wallet only:
|
|
10
|
-
* 1. Anchor createAction (noSend,
|
|
10
|
+
* 1. Anchor createAction (noSend, signAndProcess default)
|
|
11
11
|
* 2. Sigma-sign inscription script
|
|
12
12
|
* 3. Push anchor input + seal sigma script in place
|
|
13
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inscribeSigma.d.ts","sourceRoot":"","sources":["../../src/apply/inscribeSigma.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,gBAAgB,EAIrB,KAAK,eAAe,EACpB,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"inscribeSigma.d.ts","sourceRoot":"","sources":["../../src/apply/inscribeSigma.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,gBAAgB,EAIrB,KAAK,eAAe,EACpB,MAAM,UAAU,CAAA;AAUjB;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,gBAAgB,GACpB,OAAO,CAAC,IAAI,CAAC,CAgGf"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ORDINALS_BASKET, P1SAT_PROTOCOL, SIGMA_BASKET } from '@1sat/types';
|
|
2
2
|
import { P2PKH, PublicKey, Script, } from '@bsv/sdk';
|
|
3
|
+
import { PENDING_RESOLVED_SPENDS_KEY, } from '../pipeline/spendTargets';
|
|
3
4
|
import { sealSigma } from '../signing/sigma';
|
|
4
|
-
import {
|
|
5
|
+
import { stampManagedOutputIds } from '../utils/createTrackedAction';
|
|
5
6
|
/**
|
|
6
7
|
* Anchor keyID for a given action. Derived from the action id so the action's
|
|
7
8
|
* sign callback and apply arrive at the same value independently, and so the
|
|
@@ -12,7 +13,7 @@ export function sigmaAnchorKeyId(actionId) {
|
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* Multi-step sigma inscribe apply on **base** wallet only:
|
|
15
|
-
* 1. Anchor createAction (noSend,
|
|
16
|
+
* 1. Anchor createAction (noSend, signAndProcess default)
|
|
16
17
|
* 2. Sigma-sign inscription script
|
|
17
18
|
* 3. Push anchor input + seal sigma script in place
|
|
18
19
|
*/
|
|
@@ -34,7 +35,7 @@ export async function applyInscribeSigma(wallet, args) {
|
|
|
34
35
|
chain: 'main',
|
|
35
36
|
isBaseWallet: true,
|
|
36
37
|
};
|
|
37
|
-
const anchorKeyID = sigmaAnchorKeyId(
|
|
38
|
+
const anchorKeyID = sigmaAnchorKeyId(stampManagedOutputIds(args));
|
|
38
39
|
const { publicKey: anchorPubKey } = await wallet.getPublicKey({
|
|
39
40
|
protocolID: P1SAT_PROTOCOL,
|
|
40
41
|
keyID: anchorKeyID,
|
|
@@ -43,7 +44,11 @@ export async function applyInscribeSigma(wallet, args) {
|
|
|
43
44
|
});
|
|
44
45
|
const anchorAddress = PublicKey.fromString(anchorPubKey).toAddress();
|
|
45
46
|
const anchorLockingScript = new P2PKH().lock(anchorAddress);
|
|
46
|
-
const
|
|
47
|
+
const anchorCi = JSON.stringify({
|
|
48
|
+
protocolID: P1SAT_PROTOCOL,
|
|
49
|
+
keyID: anchorKeyID,
|
|
50
|
+
});
|
|
51
|
+
const anchorResult = await wallet.createAction({
|
|
47
52
|
description: 'Sigma anchor output',
|
|
48
53
|
outputs: [
|
|
49
54
|
{
|
|
@@ -51,10 +56,7 @@ export async function applyInscribeSigma(wallet, args) {
|
|
|
51
56
|
satoshis: 2,
|
|
52
57
|
outputDescription: 'Sigma anchor',
|
|
53
58
|
basket: SIGMA_BASKET,
|
|
54
|
-
customInstructions:
|
|
55
|
-
protocolID: P1SAT_PROTOCOL,
|
|
56
|
-
keyID: anchorKeyID,
|
|
57
|
-
}),
|
|
59
|
+
customInstructions: anchorCi,
|
|
58
60
|
},
|
|
59
61
|
],
|
|
60
62
|
options: {
|
|
@@ -62,14 +64,11 @@ export async function applyInscribeSigma(wallet, args) {
|
|
|
62
64
|
randomizeOutputs: false,
|
|
63
65
|
acceptDelayedBroadcast: true,
|
|
64
66
|
},
|
|
65
|
-
}
|
|
67
|
+
});
|
|
66
68
|
if (!anchorResult.txid || !anchorResult.tx) {
|
|
67
69
|
throw new Error('ordinal.inscribe-sigma apply: anchor failed');
|
|
68
70
|
}
|
|
69
71
|
const sigmaScript = await sealSigma(ctx, placeholderScript, { txid: anchorResult.txid, vout: 0 }, 0, 0);
|
|
70
|
-
if (sigmaScript.toHex().length !== out.lockingScript.length) {
|
|
71
|
-
throw new Error('ordinal.inscribe-sigma apply: sealed script size differs from placeholder');
|
|
72
|
-
}
|
|
73
72
|
out.lockingScript = sigmaScript.toHex();
|
|
74
73
|
// Mutate inputs array in place (or initialize then push).
|
|
75
74
|
if (!args.inputs) {
|
|
@@ -81,7 +80,7 @@ export async function applyInscribeSigma(wallet, args) {
|
|
|
81
80
|
inputDescription: 'Sigma anchor',
|
|
82
81
|
unlockingScriptLength: 108,
|
|
83
82
|
});
|
|
84
|
-
args.inputBEEF = anchorResult.tx;
|
|
83
|
+
args.inputBEEF = Array.from(anchorResult.tx);
|
|
85
84
|
args.options = {
|
|
86
85
|
...args.options,
|
|
87
86
|
randomizeOutputs: false,
|
|
@@ -91,5 +90,13 @@ export async function applyInscribeSigma(wallet, args) {
|
|
|
91
90
|
trustSelf: 'known',
|
|
92
91
|
sendWith: [anchorResult.txid],
|
|
93
92
|
};
|
|
93
|
+
// Output record for finalize — we just created it; no DB round-trip.
|
|
94
|
+
const anchorRecord = {
|
|
95
|
+
outpoint: `${anchorResult.txid}.0`,
|
|
96
|
+
customInstructions: anchorCi,
|
|
97
|
+
};
|
|
98
|
+
const stash = args;
|
|
99
|
+
const prev = stash[PENDING_RESOLVED_SPENDS_KEY] ?? [];
|
|
100
|
+
stash[PENDING_RESOLVED_SPENDS_KEY] = [...prev, anchorRecord];
|
|
94
101
|
}
|
|
95
102
|
//# sourceMappingURL=inscribeSigma.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inscribeSigma.js","sourceRoot":"","sources":["../../src/apply/inscribeSigma.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AA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.ts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
|
+
import type { PermissionSchemeId } from '@1sat/types';
|
|
1
2
|
import type { CreateActionArgs } from '@bsv/sdk';
|
|
2
3
|
import type { OneSatContext } from '../types';
|
|
4
|
+
export interface PrepareP1SatOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Opt-in permission module. Default **false**.
|
|
7
|
+
* When true: dispatch labels only (pipeline runs inside module after approve).
|
|
8
|
+
* @deprecated Prefer usePermissionModule on executeTrackedAction.
|
|
9
|
+
*/
|
|
10
|
+
usePermissionModule?: boolean;
|
|
11
|
+
/** @deprecated use usePermissionModule */
|
|
12
|
+
useOneSatModule?: boolean;
|
|
13
|
+
/** @deprecated use usePermissionModule */
|
|
14
|
+
useModule?: boolean;
|
|
15
|
+
/** Scheme for dispatch label when module opt-in is set. Default `1sat`. */
|
|
16
|
+
permissionScheme?: PermissionSchemeId;
|
|
17
|
+
}
|
|
3
18
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* The action id is stamped here, ahead of apply, so both the base-wallet path
|
|
8
|
-
* (apply below) and the gated path (apply inside the module) see the same
|
|
9
|
-
* value and derive identical intermediate keyIDs.
|
|
19
|
+
* Lightweight prepare: stamp ids; optionally add module dispatch labels.
|
|
20
|
+
* Seals/completion live in the shared pipeline.
|
|
10
21
|
*/
|
|
11
|
-
export declare function prepareP1SatArgs(ctx: OneSatContext, args: CreateActionArgs,
|
|
22
|
+
export declare function prepareP1SatArgs(ctx: OneSatContext, args: CreateActionArgs, opts?: PrepareP1SatOptions): Promise<CreateActionArgs>;
|
|
12
23
|
//# sourceMappingURL=prepare.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../src/apply/prepare.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../src/apply/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAM7C,MAAM,WAAW,mBAAmB;IACnC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,0CAA0C;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,kBAAkB,CAAA;CACrC;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACrC,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,gBAAgB,EACtB,IAAI,GAAE,mBAAwB,GAC5B,OAAO,CAAC,gBAAgB,CAAC,CAY3B"}
|
package/dist/apply/prepare.js
CHANGED
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { applyP1SatIntent } from './applyIntent';
|
|
1
|
+
import { PERMISSION_SCHEMES } from '@1sat/types';
|
|
2
|
+
import { ensureSchemeDispatchLabel, stampManagedOutputIds, } from '../utils/createTrackedAction';
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* The action id is stamped here, ahead of apply, so both the base-wallet path
|
|
9
|
-
* (apply below) and the gated path (apply inside the module) see the same
|
|
10
|
-
* value and derive identical intermediate keyIDs.
|
|
4
|
+
* Lightweight prepare: stamp ids; optionally add module dispatch labels.
|
|
5
|
+
* Seals/completion live in the shared pipeline.
|
|
11
6
|
*/
|
|
12
|
-
export async function prepareP1SatArgs(ctx, args,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (ctx.isBaseWallet) {
|
|
19
|
-
// The shared entrypoint, not the registry directly — it dispatches by
|
|
20
|
-
// intent *and* stamps script-derived tags afterwards. Calling the registry
|
|
21
|
-
// here would skip the stamping on every base-wallet action.
|
|
22
|
-
await applyP1SatIntent(ctx.wallet, args, intent);
|
|
7
|
+
export async function prepareP1SatArgs(ctx, args, opts = {}) {
|
|
8
|
+
void ctx;
|
|
9
|
+
const useModule = opts.usePermissionModule ?? opts.useOneSatModule ?? opts.useModule ?? false;
|
|
10
|
+
stampManagedOutputIds(args);
|
|
11
|
+
if (useModule) {
|
|
12
|
+
ensureSchemeDispatchLabel(args, opts.permissionScheme ?? PERMISSION_SCHEMES.ONESAT);
|
|
23
13
|
}
|
|
24
14
|
return args;
|
|
25
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../src/apply/prepare.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../src/apply/prepare.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAGhD,OAAO,EACN,yBAAyB,EACzB,qBAAqB,GACrB,MAAM,8BAA8B,CAAA;AAiBrC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,GAAkB,EAClB,IAAsB,EACtB,OAA4B,EAAE;IAE9B,KAAK,GAAG,CAAA;IACR,MAAM,SAAS,GACd,IAAI,CAAC,mBAAmB,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,SAAS,IAAI,KAAK,CAAA;IAC5E,qBAAqB,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,SAAS,EAAE,CAAC;QACf,yBAAyB,CACxB,IAAI,EACJ,IAAI,CAAC,gBAAgB,IAAI,kBAAkB,CAAC,MAAM,CAClD,CAAA;IACF,CAAC;IACD,OAAO,IAAI,CAAA;AACZ,CAAC"}
|
package/dist/apply/registry.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { CreateActionArgs, WalletInterface } from '@bsv/sdk';
|
|
2
2
|
export type ApplyFn = (wallet: WalletInterface, args: CreateActionArgs) => Promise<void>;
|
|
3
3
|
/**
|
|
4
|
-
* Intent
|
|
5
|
-
*
|
|
4
|
+
* @deprecated Intent registry retired — apply is script-driven via
|
|
5
|
+
* {@link applyP1SatCreateAction}. Kept as a single default entry for any
|
|
6
|
+
* leftover callers.
|
|
6
7
|
*/
|
|
7
8
|
export declare const P1SAT_APPLY_REGISTRY: Record<string, ApplyFn>;
|
|
8
9
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/apply/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/apply/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAGjE,MAAM,MAAM,OAAO,GAAG,CACrB,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,gBAAgB,KAClB,OAAO,CAAC,IAAI,CAAC,CAAA;AAElB;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAExD,CAAA"}
|
package/dist/apply/registry.js
CHANGED
|
@@ -1,31 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { applyOpnsRegister } from './opnsRegister';
|
|
3
|
-
import { applyValidateOnly } from './validateOnly';
|
|
1
|
+
import { applyP1SatCreateAction } from './applyIntent';
|
|
4
2
|
/**
|
|
5
|
-
* Intent
|
|
6
|
-
*
|
|
3
|
+
* @deprecated Intent registry retired — apply is script-driven via
|
|
4
|
+
* {@link applyP1SatCreateAction}. Kept as a single default entry for any
|
|
5
|
+
* leftover callers.
|
|
7
6
|
*/
|
|
8
7
|
export const P1SAT_APPLY_REGISTRY = {
|
|
9
|
-
|
|
10
|
-
'opns.deregister': applyValidateOnly,
|
|
11
|
-
'opns.list': applyValidateOnly,
|
|
12
|
-
'opns.transfer': applyValidateOnly,
|
|
13
|
-
'opns.cancel-listing': applyValidateOnly,
|
|
14
|
-
'opns.purchase': applyValidateOnly,
|
|
15
|
-
'ordinal.transfer': applyValidateOnly,
|
|
16
|
-
'ordinal.list': applyValidateOnly,
|
|
17
|
-
'ordinal.cancel-listing': applyValidateOnly,
|
|
18
|
-
'ordinal.purchase': applyValidateOnly,
|
|
19
|
-
'ordinal.burn': applyValidateOnly,
|
|
20
|
-
'ordinal.inscribe': applyValidateOnly,
|
|
21
|
-
'ordinal.inscribe-sigma': applyInscribeSigma,
|
|
22
|
-
'ordinal.mint-collection': applyValidateOnly,
|
|
23
|
-
'ordinal.mint-item': applyValidateOnly,
|
|
24
|
-
'lock.lock': applyValidateOnly,
|
|
25
|
-
'lock.unlock': applyValidateOnly,
|
|
26
|
-
'bsv21.transfer': applyValidateOnly,
|
|
27
|
-
'bsv21.purchase': applyValidateOnly,
|
|
28
|
-
'bsv21.mint': applyValidateOnly,
|
|
29
|
-
'bsv21.deploy': applyValidateOnly,
|
|
8
|
+
default: applyP1SatCreateAction,
|
|
30
9
|
};
|
|
31
10
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/apply/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/apply/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAOtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA4B;IAC5D,OAAO,EAAE,sBAAsB;CAC/B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EACX,wBAAwB,EAExB,mBAAmB,EAEnB,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EACX,wBAAwB,EAExB,mBAAmB,EAEnB,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,MAAM,aAAa,CAAA;AAUpB,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAiB,MAAM,UAAU,CAAA;AAYpE,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACzD,qDAAqD;IACrD,aAAa,EAAE,MAAM,CAAA;IACrB,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAA;IACnB,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,6BAA6B;IAC7B,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,qCAAqC;IACrC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAA;IACrB,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,oBAAoB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,uBAAwB,SAAQ,aAAa;IAC7D,kCAAkC;IAClC,aAAa,EAAE,MAAM,CAAA;IACrB,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,2EAA2E;IAC3E,YAAY,EAAE,MAAM,CAAA;IACpB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2BAA2B;IAC3B,MAAM,CAAC,EAAE,mBAAmB,EAAE,CAAA;IAC9B,gCAAgC;IAChC,WAAW,CAAC,EAAE,wBAAwB,EAAE,CAAA;IACxC,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,wBAAwB;IACxC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AA2KD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,mBAAmB,EAAE,oBAAoB,CA4J3E,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CACtC,uBAAuB,EACvB,wBAAwB,CA4JxB,CAAA;AAMD,0CAA0C;AAC1C,eAAO,MAAM,kBAAkB,mHAAuC,CAAA"}
|
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
* pointing to the parent collection's origin outpoint.
|
|
13
13
|
*/
|
|
14
14
|
import { Inscription, MAP as MAPTemplate } from '@1sat/templates';
|
|
15
|
-
import {
|
|
15
|
+
import { P1SAT_PROTOCOL } from '@1sat/types';
|
|
16
16
|
import { parseOutpoint } from '@1sat/utils';
|
|
17
17
|
import { P2PKH, PublicKey, Script, Utils } from '@bsv/sdk';
|
|
18
18
|
import { prepareP1SatArgs } from '../apply';
|
|
19
19
|
import { MAX_INSCRIPTION_BYTES, ORDINALS_BASKET, } from '../constants';
|
|
20
|
-
import {
|
|
20
|
+
import { appendSigmaPlaceholder } from '../signing/sigma';
|
|
21
|
+
import { executeTrackedAction, } from '../utils/createTrackedAction';
|
|
22
|
+
import { buildOrdinalCustomInstructions } from '../utils/ordinalRemittance';
|
|
21
23
|
// ============================================================================
|
|
22
24
|
// Internal helpers
|
|
23
25
|
// ============================================================================
|
|
@@ -96,6 +98,46 @@ function buildInscriptionScript(address, base64Content, contentType, map, parent
|
|
|
96
98
|
});
|
|
97
99
|
return new Script(inscription.lock().chunks);
|
|
98
100
|
}
|
|
101
|
+
/** Type tag: single full MIME, params stripped (BRC-147). */
|
|
102
|
+
function typeTag(contentType) {
|
|
103
|
+
const base = contentType.split(';')[0]?.trim() || contentType;
|
|
104
|
+
return `type:${base}`;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Mint path with real Sigma seal (placeholder → apply seals anchor + sig).
|
|
108
|
+
*/
|
|
109
|
+
async function mintWithSigma(ctx, opts) {
|
|
110
|
+
const placeholderScript = await appendSigmaPlaceholder(ctx, opts.lockingScript);
|
|
111
|
+
const args = await prepareP1SatArgs(ctx, {
|
|
112
|
+
description: opts.description,
|
|
113
|
+
outputs: [
|
|
114
|
+
{
|
|
115
|
+
lockingScript: placeholderScript.toHex(),
|
|
116
|
+
satoshis: 1,
|
|
117
|
+
outputDescription: opts.outputDescription,
|
|
118
|
+
basket: ORDINALS_BASKET,
|
|
119
|
+
tags: opts.tags,
|
|
120
|
+
customInstructions: opts.customInstructions,
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
options: {
|
|
124
|
+
acceptDelayedBroadcast: false,
|
|
125
|
+
randomizeOutputs: false,
|
|
126
|
+
},
|
|
127
|
+
}, {
|
|
128
|
+
usePermissionModule: opts.useModule,
|
|
129
|
+
permissionScheme: '1sat',
|
|
130
|
+
});
|
|
131
|
+
// spends empty: pipeline embellish adds Sigma anchor input and unlocks it
|
|
132
|
+
const result = await executeTrackedAction(ctx.wallet, args, opts.fundingProvider, undefined, undefined, {
|
|
133
|
+
spends: [],
|
|
134
|
+
usePermissionModule: opts.useModule,
|
|
135
|
+
permissionScheme: '1sat',
|
|
136
|
+
});
|
|
137
|
+
if (!result.txid)
|
|
138
|
+
return { error: 'no-txid-returned' };
|
|
139
|
+
return { txid: result.txid, tx: result.tx };
|
|
140
|
+
}
|
|
99
141
|
// ============================================================================
|
|
100
142
|
// Actions
|
|
101
143
|
// ============================================================================
|
|
@@ -178,35 +220,27 @@ export const mintCollection = {
|
|
|
178
220
|
const map = buildCollectionMap(input);
|
|
179
221
|
const lockingScript = buildInscriptionScript(address, input.base64Content, input.contentType, map);
|
|
180
222
|
const tags = [
|
|
181
|
-
|
|
223
|
+
typeTag(input.contentType),
|
|
182
224
|
'origin',
|
|
183
|
-
`name:${input.name.slice(0, 64)}`,
|
|
184
225
|
'subType:collection',
|
|
185
226
|
];
|
|
186
|
-
const
|
|
227
|
+
const displayName = input.name.slice(0, 64);
|
|
228
|
+
const result = await mintWithSigma(ctx, {
|
|
187
229
|
description: `Create collection: ${input.name}`,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
},
|
|
201
|
-
],
|
|
202
|
-
options: {
|
|
203
|
-
acceptDelayedBroadcast: false,
|
|
204
|
-
randomizeOutputs: false,
|
|
205
|
-
},
|
|
206
|
-
}, P1SAT_INTENTS.ORDINAL_MINT_COLLECTION);
|
|
207
|
-
const result = await executeTrackedAction(ctx.wallet, args, input.fundingProvider);
|
|
230
|
+
outputDescription: 'Collection inscription',
|
|
231
|
+
lockingScript,
|
|
232
|
+
tags,
|
|
233
|
+
customInstructions: buildOrdinalCustomInstructions({
|
|
234
|
+
protocolID: P1SAT_PROTOCOL,
|
|
235
|
+
keyID,
|
|
236
|
+
tags,
|
|
237
|
+
name: displayName,
|
|
238
|
+
}),
|
|
239
|
+
fundingProvider: input.fundingProvider,
|
|
240
|
+
useModule: input.useModule,
|
|
241
|
+
});
|
|
208
242
|
if (!result.txid) {
|
|
209
|
-
return { error: 'no-txid-returned' };
|
|
243
|
+
return { error: result.error ?? 'no-txid-returned' };
|
|
210
244
|
}
|
|
211
245
|
const collectionId = `${result.txid}_0`;
|
|
212
246
|
if (ctx.debug && ctx.log) {
|
|
@@ -330,36 +364,28 @@ export const mintCollectionItem = {
|
|
|
330
364
|
const map = buildCollectionItemMap(input);
|
|
331
365
|
const lockingScript = buildInscriptionScript(address, input.base64Content, input.contentType, map, parentBytes);
|
|
332
366
|
const tags = [
|
|
333
|
-
|
|
367
|
+
typeTag(input.contentType),
|
|
334
368
|
'origin',
|
|
335
|
-
`name:${input.name.slice(0, 64)}`,
|
|
336
369
|
'subType:collectionItem',
|
|
337
|
-
`
|
|
370
|
+
`collection:${input.collectionId}`,
|
|
338
371
|
];
|
|
339
|
-
const
|
|
372
|
+
const displayName = input.name.slice(0, 64);
|
|
373
|
+
const result = await mintWithSigma(ctx, {
|
|
340
374
|
description: `Create collection item: ${input.name}`,
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
},
|
|
354
|
-
],
|
|
355
|
-
options: {
|
|
356
|
-
acceptDelayedBroadcast: false,
|
|
357
|
-
randomizeOutputs: false,
|
|
358
|
-
},
|
|
359
|
-
}, P1SAT_INTENTS.ORDINAL_MINT_ITEM);
|
|
360
|
-
const result = await executeTrackedAction(ctx.wallet, mintItemArgs, input.fundingProvider);
|
|
375
|
+
outputDescription: 'Collection item inscription',
|
|
376
|
+
lockingScript,
|
|
377
|
+
tags,
|
|
378
|
+
customInstructions: buildOrdinalCustomInstructions({
|
|
379
|
+
protocolID: P1SAT_PROTOCOL,
|
|
380
|
+
keyID,
|
|
381
|
+
tags,
|
|
382
|
+
name: displayName,
|
|
383
|
+
}),
|
|
384
|
+
fundingProvider: input.fundingProvider,
|
|
385
|
+
useModule: input.useModule,
|
|
386
|
+
});
|
|
361
387
|
if (!result.txid) {
|
|
362
|
-
return { error: 'no-txid-returned' };
|
|
388
|
+
return { error: result.error ?? 'no-txid-returned' };
|
|
363
389
|
}
|
|
364
390
|
if (ctx.debug && ctx.log) {
|
|
365
391
|
ctx.log({
|