@1sat/actions 0.0.122 → 0.0.123
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/cosign/buildDestination.d.ts +31 -0
- package/dist/cosign/buildDestination.d.ts.map +1 -0
- package/dist/cosign/buildDestination.js +30 -0
- package/dist/cosign/buildDestination.js.map +1 -0
- package/dist/cosign/index.d.ts +1 -0
- package/dist/cosign/index.d.ts.map +1 -1
- package/dist/cosign/index.js +1 -0
- package/dist/cosign/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* buildCosignDestination — derive a cosign-wrapped lockingScript for a
|
|
3
|
+
* recipient, using the caller's wallet as the BRC-42 partner.
|
|
4
|
+
*
|
|
5
|
+
* Resulting script pattern:
|
|
6
|
+
* OP_DUP OP_HASH160 <derivedAddrHash> OP_EQUALVERIFY OP_CHECKSIGVERIFY
|
|
7
|
+
* <cosignerIdentityKey> OP_CHECKSIG
|
|
8
|
+
*
|
|
9
|
+
* Spending later requires both the recipient's signature (over the derived key)
|
|
10
|
+
* and the cosigner's signature.
|
|
11
|
+
*
|
|
12
|
+
* The caller passes `cosignerIdentityKey` in — this helper does not look up any
|
|
13
|
+
* cosigner config endpoint. That keeps the action reusable across cosigner
|
|
14
|
+
* backends.
|
|
15
|
+
*/
|
|
16
|
+
import { type LockingScript } from '@bsv/sdk';
|
|
17
|
+
import type { OneSatContext } from '../types';
|
|
18
|
+
export interface BuildCosignDestinationInput {
|
|
19
|
+
/** Recipient's identity public key (hex). */
|
|
20
|
+
recipientIdentityKey: string;
|
|
21
|
+
/** Cosigner's identity public key (hex). Embedded in the script as second-signer. */
|
|
22
|
+
cosignerIdentityKey: string;
|
|
23
|
+
/** keyID used for the BRC-42 derivation between caller and recipient. */
|
|
24
|
+
keyID: string;
|
|
25
|
+
}
|
|
26
|
+
export interface BuildCosignDestinationResult {
|
|
27
|
+
lockingScript: LockingScript;
|
|
28
|
+
address: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function buildCosignDestination(ctx: OneSatContext, input: BuildCosignDestinationInput): Promise<BuildCosignDestinationResult>;
|
|
31
|
+
//# sourceMappingURL=buildDestination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildDestination.d.ts","sourceRoot":"","sources":["../../src/cosign/buildDestination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,UAAU,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAG7C,MAAM,WAAW,2BAA2B;IAC3C,6CAA6C;IAC7C,oBAAoB,EAAE,MAAM,CAAA;IAC5B,qFAAqF;IACrF,mBAAmB,EAAE,MAAM,CAAA;IAC3B,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,4BAA4B;IAC5C,aAAa,EAAE,aAAa,CAAA;IAC5B,OAAO,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,sBAAsB,CAC3C,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,2BAA2B,GAChC,OAAO,CAAC,4BAA4B,CAAC,CAUvC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* buildCosignDestination — derive a cosign-wrapped lockingScript for a
|
|
3
|
+
* recipient, using the caller's wallet as the BRC-42 partner.
|
|
4
|
+
*
|
|
5
|
+
* Resulting script pattern:
|
|
6
|
+
* OP_DUP OP_HASH160 <derivedAddrHash> OP_EQUALVERIFY OP_CHECKSIGVERIFY
|
|
7
|
+
* <cosignerIdentityKey> OP_CHECKSIG
|
|
8
|
+
*
|
|
9
|
+
* Spending later requires both the recipient's signature (over the derived key)
|
|
10
|
+
* and the cosigner's signature.
|
|
11
|
+
*
|
|
12
|
+
* The caller passes `cosignerIdentityKey` in — this helper does not look up any
|
|
13
|
+
* cosigner config endpoint. That keeps the action reusable across cosigner
|
|
14
|
+
* backends.
|
|
15
|
+
*/
|
|
16
|
+
import { Cosign } from '@1sat/templates';
|
|
17
|
+
import { PublicKey } from '@bsv/sdk';
|
|
18
|
+
import { COSIGN_PROTOCOL_ID } from './types';
|
|
19
|
+
export async function buildCosignDestination(ctx, input) {
|
|
20
|
+
const { publicKey: recipientDerivedPub } = await ctx.wallet.getPublicKey({
|
|
21
|
+
protocolID: COSIGN_PROTOCOL_ID,
|
|
22
|
+
keyID: input.keyID,
|
|
23
|
+
counterparty: input.recipientIdentityKey,
|
|
24
|
+
forSelf: false,
|
|
25
|
+
});
|
|
26
|
+
const address = PublicKey.fromString(recipientDerivedPub).toAddress();
|
|
27
|
+
const lockingScript = Cosign.lock(address, input.cosignerIdentityKey);
|
|
28
|
+
return { lockingScript, address };
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=buildDestination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildDestination.js","sourceRoot":"","sources":["../../src/cosign/buildDestination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAsB,SAAS,EAAE,MAAM,UAAU,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAgB5C,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC3C,GAAkB,EAClB,KAAkC;IAElC,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC;QACxE,UAAU,EAAE,kBAAkB;QAC9B,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,YAAY,EAAE,KAAK,CAAC,oBAAoB;QACxC,OAAO,EAAE,KAAK;KACd,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,SAAS,EAAE,CAAA;IACrE,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IACrE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,CAAA;AAClC,CAAC"}
|
package/dist/cosign/index.d.ts
CHANGED
|
@@ -12,4 +12,5 @@
|
|
|
12
12
|
export { COSIGN_DEFAULT_SIGHASH, COSIGN_PROTOCOL_ID, type CosignOwnerSig, type CosignRecipientPayload, type CosignSessionDestinationMeta, type CosignSessionInputMeta, type CosignSessionStore, type CosignTokenInput, type CosignTransferBurn, type CosignTransferDestination, type CosignTransferSession, type FinalizeCosignBsv21TransferInput, type FinalizeCosignBsv21TransferResult, InMemoryCosignSessionStore, type PrepareCosignBsv21TransferInput, type PrepareCosignBsv21TransferResult, } from './types';
|
|
13
13
|
export { prepareCosignBsv21Transfer } from './prepare';
|
|
14
14
|
export { finalizeCosignBsv21Transfer } from './finalize';
|
|
15
|
+
export { buildCosignDestination, type BuildCosignDestinationInput, type BuildCosignDestinationResult, } from './buildDestination';
|
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cosign/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACN,sBAAsB,EACtB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,gCAAgC,EACrC,KAAK,iCAAiC,EACtC,0BAA0B,EAC1B,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,GACrC,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cosign/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACN,sBAAsB,EACtB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,gCAAgC,EACrC,KAAK,iCAAiC,EACtC,0BAA0B,EAC1B,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,GACrC,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,EACN,sBAAsB,EACtB,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,GACjC,MAAM,oBAAoB,CAAA"}
|
package/dist/cosign/index.js
CHANGED
|
@@ -12,4 +12,5 @@
|
|
|
12
12
|
export { COSIGN_DEFAULT_SIGHASH, COSIGN_PROTOCOL_ID, InMemoryCosignSessionStore, } from './types';
|
|
13
13
|
export { prepareCosignBsv21Transfer } from './prepare';
|
|
14
14
|
export { finalizeCosignBsv21Transfer } from './finalize';
|
|
15
|
+
export { buildCosignDestination, } from './buildDestination';
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
package/dist/cosign/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cosign/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACN,sBAAsB,EACtB,kBAAkB,EAYlB,0BAA0B,GAG1B,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cosign/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACN,sBAAsB,EACtB,kBAAkB,EAYlB,0BAA0B,GAG1B,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,EACN,sBAAsB,GAGtB,MAAM,oBAAoB,CAAA"}
|