@1sat/actions 0.0.49 → 0.0.51

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.
Files changed (58) hide show
  1. package/dist/funding/index.d.ts +25 -0
  2. package/dist/funding/index.d.ts.map +1 -0
  3. package/dist/funding/index.js +2 -0
  4. package/dist/funding/index.js.map +1 -0
  5. package/dist/identity/index.d.ts +39 -29
  6. package/dist/identity/index.d.ts.map +1 -1
  7. package/dist/identity/index.js +199 -169
  8. package/dist/identity/index.js.map +1 -1
  9. package/dist/index.d.ts +3 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/inscriptions/index.d.ts +2 -2
  14. package/dist/inscriptions/index.d.ts.map +1 -1
  15. package/dist/inscriptions/index.js +7 -7
  16. package/dist/inscriptions/index.js.map +1 -1
  17. package/dist/locks/index.d.ts +3 -3
  18. package/dist/locks/index.d.ts.map +1 -1
  19. package/dist/locks/index.js +4 -4
  20. package/dist/locks/index.js.map +1 -1
  21. package/dist/opns/index.d.ts +3 -3
  22. package/dist/opns/index.d.ts.map +1 -1
  23. package/dist/opns/index.js +5 -5
  24. package/dist/opns/index.js.map +1 -1
  25. package/dist/ordinals/index.d.ts +5 -5
  26. package/dist/ordinals/index.d.ts.map +1 -1
  27. package/dist/ordinals/index.js +9 -9
  28. package/dist/ordinals/index.js.map +1 -1
  29. package/dist/payments/index.d.ts +4 -4
  30. package/dist/payments/index.d.ts.map +1 -1
  31. package/dist/payments/index.js +5 -5
  32. package/dist/payments/index.js.map +1 -1
  33. package/dist/signing/aip.d.ts +21 -6
  34. package/dist/signing/aip.d.ts.map +1 -1
  35. package/dist/signing/aip.js +48 -8
  36. package/dist/signing/aip.js.map +1 -1
  37. package/dist/signing/index.d.ts +1 -1
  38. package/dist/signing/index.d.ts.map +1 -1
  39. package/dist/signing/index.js +1 -1
  40. package/dist/signing/index.js.map +1 -1
  41. package/dist/social/index.d.ts +2 -2
  42. package/dist/social/index.d.ts.map +1 -1
  43. package/dist/social/index.js +3 -2
  44. package/dist/social/index.js.map +1 -1
  45. package/dist/sweep/index.js +5 -5
  46. package/dist/sweep/index.js.map +1 -1
  47. package/dist/tokens/index.d.ts +3 -3
  48. package/dist/tokens/index.d.ts.map +1 -1
  49. package/dist/tokens/index.js +5 -5
  50. package/dist/tokens/index.js.map +1 -1
  51. package/dist/types.d.ts +10 -0
  52. package/dist/types.d.ts.map +1 -1
  53. package/dist/types.js.map +1 -1
  54. package/dist/utils/createTrackedAction.d.ts +17 -0
  55. package/dist/utils/createTrackedAction.d.ts.map +1 -1
  56. package/dist/utils/createTrackedAction.js +51 -8
  57. package/dist/utils/createTrackedAction.js.map +1 -1
  58. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ import type { AtomicBEEF, CreateActionArgs } from '@bsv/sdk';
2
+ /**
3
+ * External funding provider for actions where a third party pays
4
+ * for the transaction instead of the wallet.
5
+ *
6
+ * Receives the full CreateActionArgs so it can build the exact transaction
7
+ * the caller described (inputs, outputs, ordering), adding its own funding.
8
+ *
9
+ * Implementations handle funding strategy (free tier, metered, paid plans, etc.)
10
+ * and return the broadcasted transaction as BEEF for wallet internalization.
11
+ */
12
+ export interface FundingProvider {
13
+ /**
14
+ * Build, fund, and broadcast a transaction from the given action args.
15
+ *
16
+ * @param args - Full CreateActionArgs (inputs, outputs, options)
17
+ * @returns txid and BEEF of the broadcasted transaction
18
+ */
19
+ fund(args: CreateActionArgs): Promise<FundingResult>;
20
+ }
21
+ export interface FundingResult {
22
+ txid: string;
23
+ tx: AtomicBEEF;
24
+ }
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/funding/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE5D;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC/B;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;CACpD;AAED,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,UAAU,CAAA;CACd"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/funding/index.ts"],"names":[],"mappings":""}
@@ -1,39 +1,44 @@
1
1
  /**
2
2
  * Identity Module
3
3
  *
4
- * BAP identity actions: attestations and alias/profile updates.
5
- * Uses the wallet's BAP signing key ([1, "sigma"] / "identity") via applyAip.
4
+ * BAP identity actions using the wallet's identity-{N} key derivation scheme.
6
5
  *
7
- * Prerequisite: Sigma Identity must seed the wallet's `bap` basket with
8
- * an output tagged `type:id` and `bapId:<hash>` so actions can resolve
9
- * the BAP identity key from wallet state.
6
+ * Key hierarchy:
7
+ * identity-0 = root key (BAP ID source, signs initial publish)
8
+ * identity-{N} = current signing key (N tracked via seq tags on outputs)
9
+ *
10
+ * All keys derived at protocolID=[1,"sigma"], keyID="identity-{N}".
11
+ */
12
+ import type { Action, ActionOptions, OneSatContext } from '../types';
13
+ /**
14
+ * Compute the BAP ID deterministically from the wallet's identity-0 key.
15
+ *
16
+ * BAP ID = base58(ripemd160(sha256(identity-0.address)))
17
+ *
18
+ * This always returns a value — every wallet can derive identity-0.
10
19
  */
11
- import type { Action, OneSatContext } from '../types';
20
+ export declare function computeBapId(ctx: OneSatContext): Promise<string>;
12
21
  /**
13
- * Resolve the BAP identity key from the wallet's `bap` basket.
22
+ * Resolve the BAP ID if the identity has been published.
14
23
  *
15
- * Looks for an output tagged `type:id` and extracts the `bapId:` tag value.
16
- * Returns null if no identity output exists (Sigma Identity hasn't seeded
17
- * the wallet yet).
24
+ * Returns the BAP ID if a `type:id` output exists in the BAP basket,
25
+ * null if the identity hasn't been published yet.
18
26
  */
19
27
  export declare function resolveBapId(ctx: OneSatContext): Promise<string | null>;
20
- export interface PublishIdentityRequest {
21
- /** Pre-signed BAP ID locking script hex (AIP-signed with root key) */
22
- signedScript: string;
23
- }
24
- export interface AttestRequest {
28
+ export interface AttestRequest extends ActionOptions {
25
29
  /** SHA-256 hash of the attestation URN (urn:bap:id:attribute:value:nonce) */
26
30
  attestationHash: string;
27
31
  /** Attestation sequence number (default "0") */
28
32
  counter?: string;
29
33
  }
30
- export interface UpdateProfileRequest {
34
+ export interface UpdateProfileRequest extends ActionOptions {
31
35
  /** Schema.org profile data (e.g. { "@type": "Person", "name": "Alice" }) */
32
36
  profile: Record<string, unknown>;
33
37
  }
34
38
  export interface IdentityResponse {
35
39
  txid?: string;
36
40
  rawtx?: string;
41
+ bapId?: string;
37
42
  error?: string;
38
43
  }
39
44
  export interface ProfileResponse {
@@ -42,31 +47,36 @@ export interface ProfileResponse {
42
47
  error?: string;
43
48
  }
44
49
  /**
45
- * Publish a BAP ID record using a pre-signed locking script.
50
+ * Publish the initial BAP ID record.
46
51
  *
47
- * The caller (Sigma Identity) signs the ID OP_RETURN with the root key
48
- * via PrivateKeySigner + AIP. This action validates the script, verifies
49
- * the AIP signature, confirms the currentAddress matches this wallet,
50
- * then funds the transaction via the BRC-100 wallet. The output lands
51
- * in the `bap` basket so that resolveBapId() can find it.
52
+ * Derives identity-0 (root key), computes the BAP ID, and publishes
53
+ * the ID record signed by identity-0 via AIP. The output lands in
54
+ * the `bap` basket tagged with seq:1.
52
55
  *
53
- * For Droplit-funded onboarding, use internalizeAction() directly instead.
56
+ * Returns an error if an identity has already been published.
54
57
  */
55
- export declare const publishIdentity: Action<PublishIdentityRequest, IdentityResponse>;
58
+ export declare const publishIdentity: Action<ActionOptions, IdentityResponse>;
59
+ /**
60
+ * Rotate the BAP signing key.
61
+ *
62
+ * Finds the current signing key (highest sequence), derives the next
63
+ * key (identity-{N+1}), builds a new BAP ID record declaring the new
64
+ * currentAddress, signs it with the outgoing key, and publishes.
65
+ * The previous ID output is relinquished.
66
+ */
67
+ export declare const rotateIdentity: Action<ActionOptions, IdentityResponse>;
56
68
  /**
57
69
  * Publish a BAP ATTEST transaction.
58
70
  *
59
71
  * OP_RETURN: BAP_PREFIX | "ATTEST" | attestation_hash | counter
60
- * Signed with AIP via the wallet's BAP signing key.
72
+ * Signed with AIP via the current signing key.
61
73
  */
62
74
  export declare const attest: Action<AttestRequest, IdentityResponse>;
63
75
  /**
64
76
  * Publish a BAP ALIAS transaction to update the identity's profile.
65
77
  *
66
78
  * OP_RETURN: BAP_PREFIX | "ALIAS" | bap_id | profile_json
67
- * Signed with AIP via the wallet's BAP signing key.
68
- *
69
- * The BAP ID is resolved from the wallet's `bap` basket (seeded by Sigma Identity).
79
+ * Signed with AIP via the current signing key.
70
80
  */
71
81
  export declare const updateProfile: Action<UpdateProfileRequest, IdentityResponse>;
72
82
  /**
@@ -77,5 +87,5 @@ export declare const updateProfile: Action<UpdateProfileRequest, IdentityRespons
77
87
  */
78
88
  export declare const getProfile: Action<Record<string, never>, ProfileResponse>;
79
89
  /** All identity actions for registry */
80
- export declare const identityActions: (Action<PublishIdentityRequest, IdentityResponse> | Action<AttestRequest, IdentityResponse> | Action<UpdateProfileRequest, IdentityResponse> | Action<Record<string, never>, ProfileResponse>)[];
90
+ export declare const identityActions: (Action<AttestRequest, IdentityResponse> | Action<UpdateProfileRequest, IdentityResponse> | Action<Record<string, never>, ProfileResponse>)[];
81
91
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAkBH,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAUrD;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,C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