@1sat/types 0.0.39 → 0.0.40
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/constants.d.ts +114 -137
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +234 -179
- package/dist/constants.js.map +1 -1
- package/dist/intentLabel.test.js +54 -11
- package/dist/intentLabel.test.js.map +1 -1
- package/dist/ordinalTags.d.ts +22 -27
- package/dist/ordinalTags.d.ts.map +1 -1
- package/dist/ordinalTags.js +94 -40
- package/dist/ordinalTags.js.map +1 -1
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -6,22 +6,44 @@ export declare const MAP_PREFIX = "1PuQa7K62MiKCtssSLKy1kh56WWU7MtUR5";
|
|
|
6
6
|
/** Ordinal inscription marker */
|
|
7
7
|
export declare const ORD_PREFIX = "ord";
|
|
8
8
|
export declare const FUNDING_BASKET = "default";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Preferred inventory baskets (BRC-147 collectables = `1sat`). Plain names —
|
|
11
|
+
* not P-baskets. Permission routing for createAction stays on `p 1sat …`
|
|
12
|
+
* **labels**; basket list/internalize uses the known-set check in the module
|
|
13
|
+
* when registered, else generic WPM basket access.
|
|
14
|
+
*
|
|
15
|
+
* Legacy `p 1sat …` baskets are not dual-read — migrate once via
|
|
16
|
+
* {@link LEGACY_P1SAT_BASKET_MIGRATIONS} / `moveBasketOutputs`.
|
|
17
|
+
*/
|
|
18
|
+
/** Collectables / ordinals inventory (BRC-147). */
|
|
19
|
+
export declare const ONESAT_BASKET = "1sat";
|
|
20
|
+
/** @deprecated Prefer {@link ONESAT_BASKET}; same string. */
|
|
21
|
+
export declare const ORDINALS_BASKET = "1sat";
|
|
22
|
+
export declare const BSV21_BASKET = "bsv21";
|
|
23
|
+
/** @deprecated Auth UTXOs live in {@link BSV21_BASKET} with {@link BSV21_AUTH_TAG}. */
|
|
24
|
+
export declare const BSV21_AUTH_BASKET = "bsv21";
|
|
25
|
+
/** Tag on mint-authority BSV21 outputs (no amt). */
|
|
26
|
+
export declare const BSV21_AUTH_TAG = "bsv21:auth";
|
|
13
27
|
/** Tag on a single-CA deploy output; tokenId is the outpoint (`txid_vout`). */
|
|
14
28
|
export declare const BSV21_DEPLOY_TAG = "bsv21:deploy";
|
|
15
|
-
export declare const OPNS_BASKET = "
|
|
29
|
+
export declare const OPNS_BASKET = "opns";
|
|
16
30
|
/**
|
|
17
31
|
* Host-wallet basket for subscription receipt dust (1 sat to host).
|
|
18
32
|
* Customer identity is **not** in the locking script — only wallet-local tags.
|
|
19
33
|
*/
|
|
20
|
-
export declare const HOSTING_BASKET = "
|
|
21
|
-
export declare const LOCK_BASKET = "
|
|
22
|
-
export declare const SIGMA_BASKET = "
|
|
23
|
-
export declare const BSOCIAL_BASKET = "
|
|
34
|
+
export declare const HOSTING_BASKET = "hosting";
|
|
35
|
+
export declare const LOCK_BASKET = "lock";
|
|
36
|
+
export declare const SIGMA_BASKET = "sigma";
|
|
37
|
+
export declare const BSOCIAL_BASKET = "bsocial";
|
|
24
38
|
export declare const BAP_BASKET = "bap";
|
|
39
|
+
/** All preferred 1Sat asset baskets (for module basket-access gating). */
|
|
40
|
+
export declare const ONESAT_ASSET_BASKETS: readonly string[];
|
|
41
|
+
/** Legacy P-basket → preferred basket. Migrate only; no dual-read. */
|
|
42
|
+
export declare const LEGACY_P1SAT_BASKET_MIGRATIONS: ReadonlyArray<{
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
}>;
|
|
46
|
+
export declare function isOneSatAssetBasket(basket: string): boolean;
|
|
25
47
|
/**
|
|
26
48
|
* Holding basket for plain BSV received at the user's P1SAT-derived
|
|
27
49
|
* deposit address. UTXOs land here via `internalizeBeef` and stay until
|
|
@@ -55,10 +77,20 @@ export declare const ONESAT_MAINNET_CONTENT_URL = "https://api.1sat.app/content"
|
|
|
55
77
|
/** 1Sat API content URL (testnet) */
|
|
56
78
|
export declare const ONESAT_TESTNET_CONTENT_URL = "https://testnet.api.1sat.app/content";
|
|
57
79
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
80
|
+
* Preferred default key-derivation protocol for new 1Sat asset outputs.
|
|
81
|
+
* Plain name — not a BRC-99 P-protocol. Spends always use whatever
|
|
82
|
+
* `protocolID` was recorded in customInstructions (including legacy
|
|
83
|
+
* `[0,'p 1sat']` rows).
|
|
84
|
+
*/
|
|
85
|
+
export declare const ONESAT_PROTOCOL: [0 | 1 | 2, string];
|
|
86
|
+
/**
|
|
87
|
+
* BRC-98 / BRC-165 module probe protocol (`p <scheme> <rest>` → `p 1sat probe`).
|
|
88
|
+
* Used by {@link hasOneSatModule}. Not for inventory keys or spend unlock CI.
|
|
89
|
+
*/
|
|
90
|
+
export declare const P1SAT_MODULE_PROTOCOL: [0 | 1 | 2, string];
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated Prefer {@link ONESAT_PROTOCOL} for new keys.
|
|
93
|
+
* Module probe is {@link P1SAT_MODULE_PROTOCOL}. Same as ONESAT_PROTOCOL.
|
|
62
94
|
*/
|
|
63
95
|
export declare const P1SAT_PROTOCOL: [0 | 1 | 2, string];
|
|
64
96
|
/** customInstructions.template when the name is locked with signed PushDrop */
|
|
@@ -80,107 +112,40 @@ export declare function hostingExpTag(expiresAtUnix: number): string;
|
|
|
80
112
|
export declare function readHostingPayer(tags: string[] | undefined): string | undefined;
|
|
81
113
|
export declare function readHostingExp(tags: string[] | undefined): number | undefined;
|
|
82
114
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* to capture the hashOutputs commitment for any 1Sat-asset createAction.
|
|
86
|
-
*
|
|
87
|
-
* Asset-specific labels (built via {@link buildInputAssetLabel} /
|
|
88
|
-
* {@link buildOutputAssetLabel}) carry per-asset lookup keys the module
|
|
89
|
-
* uses to render the prompt with rich detail (ordinal name, token amount,
|
|
90
|
-
* etc.). The wallet-toolbox enforces a `'p <scheme> <payload>'` shape, so
|
|
91
|
-
* a bare `'p 1sat'` is invalid; we use `'p 1sat action'` as the fallback.
|
|
92
|
-
*/
|
|
93
|
-
export declare const P1SAT_LABEL = "p 1sat action";
|
|
94
|
-
/**
|
|
95
|
-
* Intent label prefix. Payload is `<domain>.<verb>` (e.g. `opns.register`).
|
|
96
|
-
* When present, replaces the need for bare {@link P1SAT_LABEL} as the
|
|
97
|
-
* WPM dispatch trigger for createAction.
|
|
115
|
+
* Registered permission scheme ids. Each maps to one primary storage basket
|
|
116
|
+
* of the same name (except where a profile documents otherwise).
|
|
98
117
|
*/
|
|
99
|
-
export declare const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
readonly
|
|
103
|
-
readonly
|
|
104
|
-
readonly OPNS_LIST: "opns.list";
|
|
105
|
-
readonly OPNS_TRANSFER: "opns.transfer";
|
|
106
|
-
readonly OPNS_CANCEL_LISTING: "opns.cancel-listing";
|
|
107
|
-
readonly OPNS_PURCHASE: "opns.purchase";
|
|
108
|
-
readonly ORDINAL_TRANSFER: "ordinal.transfer";
|
|
109
|
-
readonly ORDINAL_LIST: "ordinal.list";
|
|
110
|
-
readonly ORDINAL_CANCEL_LISTING: "ordinal.cancel-listing";
|
|
111
|
-
readonly ORDINAL_PURCHASE: "ordinal.purchase";
|
|
112
|
-
readonly ORDINAL_BURN: "ordinal.burn";
|
|
113
|
-
readonly ORDINAL_INSCRIBE: "ordinal.inscribe";
|
|
114
|
-
readonly ORDINAL_INSCRIBE_SIGMA: "ordinal.inscribe-sigma";
|
|
115
|
-
readonly ORDINAL_MINT_COLLECTION: "ordinal.mint-collection";
|
|
116
|
-
readonly ORDINAL_MINT_ITEM: "ordinal.mint-item";
|
|
117
|
-
readonly LOCK_LOCK: "lock.lock";
|
|
118
|
-
readonly LOCK_UNLOCK: "lock.unlock";
|
|
119
|
-
readonly BSV21_TRANSFER: "bsv21.transfer";
|
|
120
|
-
readonly BSV21_PURCHASE: "bsv21.purchase";
|
|
121
|
-
readonly BSV21_MINT: "bsv21.mint";
|
|
122
|
-
readonly BSV21_DEPLOY: "bsv21.deploy";
|
|
118
|
+
export declare const PERMISSION_SCHEMES: {
|
|
119
|
+
readonly ONESAT: "1sat";
|
|
120
|
+
readonly OPNS: "opns";
|
|
121
|
+
readonly BSV21: "bsv21";
|
|
122
|
+
readonly LOCK: "lock";
|
|
123
123
|
};
|
|
124
|
-
export type
|
|
125
|
-
/**
|
|
126
|
-
export declare const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
* First `p 1sat intent …` label payload, or undefined.
|
|
137
|
-
*/
|
|
138
|
-
export declare function parseIntentLabel(labels: string[] | undefined): string | undefined;
|
|
139
|
-
/**
|
|
140
|
-
* Action-id label prefix. Payload is the hex actionId that also appears in
|
|
141
|
-
* each basketed output's `id:<actionId>_<index>` tag.
|
|
142
|
-
*
|
|
143
|
-
* The actionId is the action's correlator: it is stamped before apply runs,
|
|
144
|
-
* so both the action and apply can derive the same intermediate keyIDs
|
|
145
|
-
* (e.g. the Sigma anchor) without passing anything between them. Nothing may
|
|
146
|
-
* travel back from apply to the action — `WalletPermissionsManager` rebuilds
|
|
147
|
-
* `labels` into a new array before the module sees the args, so writes there
|
|
148
|
-
* are not visible to the caller.
|
|
149
|
-
*/
|
|
150
|
-
export declare const P1SAT_ACTION_ID_LABEL_PREFIX = "p 1sat action-id ";
|
|
151
|
-
/**
|
|
152
|
-
* Build `p 1sat action-id <actionId>`.
|
|
153
|
-
*/
|
|
154
|
-
export declare function buildActionIdLabel(actionId: string): string;
|
|
155
|
-
/**
|
|
156
|
-
* First `p 1sat action-id …` label payload, or undefined.
|
|
157
|
-
*/
|
|
158
|
-
export declare function parseActionIdLabel(labels: string[] | undefined): string | undefined;
|
|
124
|
+
export type PermissionSchemeId = (typeof PERMISSION_SCHEMES)[keyof typeof PERMISSION_SCHEMES];
|
|
125
|
+
/** Scheme ids that ship with the shared permission-module toolkit. */
|
|
126
|
+
export declare const PERMISSION_SCHEME_IDS: readonly PermissionSchemeId[];
|
|
127
|
+
export declare function isPermissionSchemeId(s: string): s is PermissionSchemeId;
|
|
128
|
+
/** Primary storage basket for a scheme (today: scheme id === basket name). */
|
|
129
|
+
export declare function basketForScheme(scheme: PermissionSchemeId): string;
|
|
130
|
+
/** Scheme that owns a storage basket, if any. */
|
|
131
|
+
export declare function schemeForBasket(basket: string): PermissionSchemeId | undefined;
|
|
132
|
+
/** Dispatch label: `p <scheme> action` — routes createAction when no input label. */
|
|
133
|
+
export declare function buildActionDispatchLabel(scheme: PermissionSchemeId): string;
|
|
134
|
+
/** @deprecated Prefer {@link buildActionDispatchLabel}(`1sat`). */
|
|
135
|
+
export declare const P1SAT_LABEL: string;
|
|
159
136
|
/**
|
|
160
|
-
* True if labels already route createAction to
|
|
161
|
-
*
|
|
137
|
+
* True if labels already route createAction to `scheme` (any well-formed
|
|
138
|
+
* `p <scheme> <payload>` label, including bare action dispatch).
|
|
162
139
|
*/
|
|
140
|
+
export declare function hasSchemeDispatchLabel(labels: string[] | undefined, scheme: PermissionSchemeId): boolean;
|
|
141
|
+
/** True if any known asset scheme is addressed by a P-label. */
|
|
142
|
+
export declare function hasAssetDispatchLabel(labels: string[] | undefined): boolean;
|
|
143
|
+
/** @deprecated Prefer {@link hasSchemeDispatchLabel} / {@link hasAssetDispatchLabel}. */
|
|
163
144
|
export declare function hasP1SatDispatchLabel(labels: string[] | undefined): boolean;
|
|
164
|
-
/**
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
*/
|
|
169
|
-
export declare const P1SAT_BASKET_PREFIX = "p 1sat ";
|
|
170
|
-
/**
|
|
171
|
-
* Label prefix recognized by the 1Sat permission module. Carries the
|
|
172
|
-
* `'p 1sat'` dispatch trigger; payload is `'<basket-suffix> <id>'`
|
|
173
|
-
* where `<basket-suffix>` is the asset basket name with the shared
|
|
174
|
-
* `'p 1sat '` prefix stripped (e.g. `'ordinals'`, `'bsv21'`). Encoding
|
|
175
|
-
* only the suffix keeps the payload space-free so the parser can split
|
|
176
|
-
* cleanly on the boundary between basket and id.
|
|
177
|
-
*
|
|
178
|
-
* Outputs don't need a label: the SDK sets tags directly on
|
|
179
|
-
* `args.outputs[i].tags` (unencrypted, visible to the module), and
|
|
180
|
-
* `args.outputs[i].lockingScript` is cryptographically committed to
|
|
181
|
-
* the final tx. The module reads both directly.
|
|
182
|
-
*/
|
|
183
|
-
export declare const P1SAT_INPUT_LABEL_PREFIX = "p 1sat input ";
|
|
145
|
+
/** Ensure `p <scheme> action` is present (unless another payload label for that scheme exists). */
|
|
146
|
+
export declare function ensureSchemeActionLabel(labels: string[] | undefined, scheme: PermissionSchemeId): string[];
|
|
147
|
+
/** @deprecated Prefer {@link ensureSchemeActionLabel}(`labels`, `1sat`). */
|
|
148
|
+
export declare function ensureP1SatActionLabel(labels: string[] | undefined): string[];
|
|
184
149
|
/**
|
|
185
150
|
* Byte length of the zero-filled signature field carried by an unsealed
|
|
186
151
|
* `opns.register` lock. The action emits the complete PushDrop script with
|
|
@@ -190,40 +155,52 @@ export declare const P1SAT_INPUT_LABEL_PREFIX = "p 1sat input ";
|
|
|
190
155
|
*/
|
|
191
156
|
export declare const OPNS_REGISTER_SIG_PLACEHOLDER_LEN = 72;
|
|
192
157
|
/**
|
|
193
|
-
* Build
|
|
194
|
-
* input asset record in the wallet's storage.
|
|
195
|
-
*
|
|
196
|
-
* `id` is the per-output asset id assigned by `createTrackedAction`
|
|
197
|
-
* (`id:<actionId>_<vout>`) — the value stored on the input's `id:` tag,
|
|
198
|
-
* without the `id:` prefix. The module resolves the record via
|
|
199
|
-
* `listOutputs({ basket, tags: [id:<id>], tagQueryMode: 'all' })` — a
|
|
200
|
-
* single indexed lookup, not a basket scan.
|
|
201
|
-
*
|
|
202
|
-
* Inputs without an `id:` tag (e.g. created before tracked-action ids
|
|
203
|
-
* existed) can't be enriched; callers should skip emitting the label
|
|
204
|
-
* for those rather than scanning by outpoint.
|
|
158
|
+
* Build `p <scheme> input id <key>` for a held row.
|
|
205
159
|
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* with the basket↔id space delimiter. Non-P1Sat baskets pass through
|
|
209
|
-
* unstripped — those won't resolve in the permission module and the
|
|
210
|
-
* input simply drops from enrichment (graceful degradation to the
|
|
211
|
-
* generic transaction approval UI).
|
|
212
|
-
*
|
|
213
|
-
* @param basket - Asset basket (typically a P1Sat basket constant).
|
|
214
|
-
* @param id - The asset id, i.e. the `id:` tag value on the input.
|
|
160
|
+
* `id` is the bare BRC-164 `id:` tag value (no `id:` prefix) and MUST NOT
|
|
161
|
+
* contain spaces. `basket` selects the scheme (scheme id === basket name).
|
|
215
162
|
*/
|
|
216
163
|
export declare function buildInputAssetLabel(basket: string, id: string): string;
|
|
217
164
|
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
165
|
+
* Build `p <scheme> input <outpoint>` for an external (non-wallet) spend
|
|
166
|
+
* (outpoint is one of the action's beefed inputs).
|
|
167
|
+
*/
|
|
168
|
+
export declare function buildExternalInputLabel(scheme: PermissionSchemeId, outpoint: string): string;
|
|
169
|
+
export interface ParsedInputAssetLabel {
|
|
170
|
+
scheme: PermissionSchemeId;
|
|
171
|
+
basket: string;
|
|
172
|
+
id: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Parse held-row input labels (`p <scheme> input id <key>` only).
|
|
176
|
+
*/
|
|
177
|
+
export declare function parseInputAssetLabels(labels: string[] | undefined): ParsedInputAssetLabel[];
|
|
178
|
+
export type ParsedInputLabel = {
|
|
179
|
+
kind: 'id';
|
|
180
|
+
scheme: PermissionSchemeId;
|
|
181
|
+
basket: string;
|
|
182
|
+
id: string;
|
|
183
|
+
} | {
|
|
184
|
+
kind: 'outpoint';
|
|
185
|
+
scheme: PermissionSchemeId;
|
|
186
|
+
outpoint: string;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Parse a single `p <scheme> input …` label.
|
|
190
|
+
*
|
|
191
|
+
* - Held: `p <scheme> input id <key>`
|
|
192
|
+
* - External: `p <scheme> input <outpoint>` (outpoint-shaped single token)
|
|
193
|
+
*/
|
|
194
|
+
export declare function parseOneInputLabel(label: string): ParsedInputLabel | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* BRC-111 P-label for BSV21 token history filtering via listActions.
|
|
197
|
+
* Routes through the `bsv21` permission scheme.
|
|
223
198
|
*/
|
|
224
|
-
export declare const
|
|
199
|
+
export declare const BSV21_TOKEN_LABEL_PREFIX = "p bsv21 token ";
|
|
200
|
+
/** @deprecated Prefer {@link BSV21_TOKEN_LABEL_PREFIX}. */
|
|
201
|
+
export declare const P1SAT_TOKEN_LABEL_PREFIX = "p bsv21 token ";
|
|
225
202
|
/**
|
|
226
|
-
* Build a BSV21 token label, e.g. `'p
|
|
203
|
+
* Build a BSV21 token history label, e.g. `'p bsv21 token <tokenId>'`.
|
|
227
204
|
*/
|
|
228
205
|
export declare function buildTokenLabel(tokenId: string): string;
|
|
229
206
|
/**
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,oDAAoD;AACpD,eAAO,MAAM,UAAU,uCAAuC,CAAA;AAE9D,iCAAiC;AACjC,eAAO,MAAM,UAAU,QAAQ,CAAA;AAM/B,eAAO,MAAM,cAAc,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,oDAAoD;AACpD,eAAO,MAAM,UAAU,uCAAuC,CAAA;AAE9D,iCAAiC;AACjC,eAAO,MAAM,UAAU,QAAQ,CAAA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BAAiB,EAAE,MAAM,CAAA;IACzB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAA;CACjB;AAMD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAmB,CAAA;AACrD,eAAO,MAAM,uBAAuB,QAAgB,CAAA;AAMpD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAc,CAAA;AACpD,sDAAsD;AACtD,eAAO,MAAM,yBAAyB,iBAAiB,CAAA;AACvD,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,iBAAiB,CAAA"}
|
package/dist/constants.js
CHANGED
|
@@ -12,32 +12,60 @@ export const ORD_PREFIX = 'ord';
|
|
|
12
12
|
// Basket Names
|
|
13
13
|
// ============================================================================
|
|
14
14
|
export const FUNDING_BASKET = 'default';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export const
|
|
15
|
+
/**
|
|
16
|
+
* Preferred inventory baskets (BRC-147 collectables = `1sat`). Plain names —
|
|
17
|
+
* not P-baskets. Permission routing for createAction stays on `p 1sat …`
|
|
18
|
+
* **labels**; basket list/internalize uses the known-set check in the module
|
|
19
|
+
* when registered, else generic WPM basket access.
|
|
20
|
+
*
|
|
21
|
+
* Legacy `p 1sat …` baskets are not dual-read — migrate once via
|
|
22
|
+
* {@link LEGACY_P1SAT_BASKET_MIGRATIONS} / `moveBasketOutputs`.
|
|
23
|
+
*/
|
|
24
|
+
/** Collectables / ordinals inventory (BRC-147). */
|
|
25
|
+
export const ONESAT_BASKET = '1sat';
|
|
26
|
+
/** @deprecated Prefer {@link ONESAT_BASKET}; same string. */
|
|
27
|
+
export const ORDINALS_BASKET = ONESAT_BASKET;
|
|
28
|
+
export const BSV21_BASKET = 'bsv21';
|
|
29
|
+
/** @deprecated Auth UTXOs live in {@link BSV21_BASKET} with {@link BSV21_AUTH_TAG}. */
|
|
30
|
+
export const BSV21_AUTH_BASKET = BSV21_BASKET;
|
|
31
|
+
/** Tag on mint-authority BSV21 outputs (no amt). */
|
|
32
|
+
export const BSV21_AUTH_TAG = 'bsv21:auth';
|
|
26
33
|
/** Tag on a single-CA deploy output; tokenId is the outpoint (`txid_vout`). */
|
|
27
34
|
export const BSV21_DEPLOY_TAG = 'bsv21:deploy';
|
|
28
|
-
export const OPNS_BASKET = '
|
|
35
|
+
export const OPNS_BASKET = 'opns';
|
|
29
36
|
/**
|
|
30
37
|
* Host-wallet basket for subscription receipt dust (1 sat to host).
|
|
31
38
|
* Customer identity is **not** in the locking script — only wallet-local tags.
|
|
32
39
|
*/
|
|
33
|
-
export const HOSTING_BASKET = '
|
|
34
|
-
export const LOCK_BASKET = '
|
|
35
|
-
export const SIGMA_BASKET = '
|
|
36
|
-
export const BSOCIAL_BASKET = '
|
|
37
|
-
// BAP records are 0-sat data outputs (identity registry), never externally
|
|
38
|
-
// spendable. They don't interact with the WPM double-encryption path so
|
|
39
|
-
// they stay non-P.
|
|
40
|
+
export const HOSTING_BASKET = 'hosting';
|
|
41
|
+
export const LOCK_BASKET = 'lock';
|
|
42
|
+
export const SIGMA_BASKET = 'sigma';
|
|
43
|
+
export const BSOCIAL_BASKET = 'bsocial';
|
|
40
44
|
export const BAP_BASKET = 'bap';
|
|
45
|
+
/** All preferred 1Sat asset baskets (for module basket-access gating). */
|
|
46
|
+
export const ONESAT_ASSET_BASKETS = [
|
|
47
|
+
ONESAT_BASKET,
|
|
48
|
+
BSV21_BASKET,
|
|
49
|
+
OPNS_BASKET,
|
|
50
|
+
HOSTING_BASKET,
|
|
51
|
+
LOCK_BASKET,
|
|
52
|
+
SIGMA_BASKET,
|
|
53
|
+
BSOCIAL_BASKET,
|
|
54
|
+
BAP_BASKET,
|
|
55
|
+
];
|
|
56
|
+
/** Legacy P-basket → preferred basket. Migrate only; no dual-read. */
|
|
57
|
+
export const LEGACY_P1SAT_BASKET_MIGRATIONS = [
|
|
58
|
+
{ from: 'p 1sat ordinals', to: ONESAT_BASKET },
|
|
59
|
+
{ from: 'p 1sat bsv21', to: BSV21_BASKET },
|
|
60
|
+
{ from: 'p 1sat opns', to: OPNS_BASKET },
|
|
61
|
+
{ from: 'p 1sat hosting', to: HOSTING_BASKET },
|
|
62
|
+
{ from: 'p 1sat lock', to: LOCK_BASKET },
|
|
63
|
+
{ from: 'p 1sat sigma', to: SIGMA_BASKET },
|
|
64
|
+
{ from: 'p 1sat bsocial', to: BSOCIAL_BASKET },
|
|
65
|
+
];
|
|
66
|
+
export function isOneSatAssetBasket(basket) {
|
|
67
|
+
return ONESAT_ASSET_BASKETS.includes(basket);
|
|
68
|
+
}
|
|
41
69
|
/**
|
|
42
70
|
* Holding basket for plain BSV received at the user's P1SAT-derived
|
|
43
71
|
* deposit address. UTXOs land here via `internalizeBeef` and stay until
|
|
@@ -80,12 +108,23 @@ export const ONESAT_TESTNET_CONTENT_URL = 'https://testnet.api.1sat.app/content'
|
|
|
80
108
|
// Protocol IDs
|
|
81
109
|
// ============================================================================
|
|
82
110
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
111
|
+
* Preferred default key-derivation protocol for new 1Sat asset outputs.
|
|
112
|
+
* Plain name — not a BRC-99 P-protocol. Spends always use whatever
|
|
113
|
+
* `protocolID` was recorded in customInstructions (including legacy
|
|
114
|
+
* `[0,'p 1sat']` rows).
|
|
87
115
|
*/
|
|
88
|
-
|
|
116
|
+
// BRC-100 / wallet-toolbox require protocol names length ≥ 5 ("1sat" is 4).
|
|
117
|
+
export const ONESAT_PROTOCOL = [0, 'onesat'];
|
|
118
|
+
/**
|
|
119
|
+
* BRC-98 / BRC-165 module probe protocol (`p <scheme> <rest>` → `p 1sat probe`).
|
|
120
|
+
* Used by {@link hasOneSatModule}. Not for inventory keys or spend unlock CI.
|
|
121
|
+
*/
|
|
122
|
+
export const P1SAT_MODULE_PROTOCOL = [0, 'p 1sat probe'];
|
|
123
|
+
/**
|
|
124
|
+
* @deprecated Prefer {@link ONESAT_PROTOCOL} for new keys.
|
|
125
|
+
* Module probe is {@link P1SAT_MODULE_PROTOCOL}. Same as ONESAT_PROTOCOL.
|
|
126
|
+
*/
|
|
127
|
+
export const P1SAT_PROTOCOL = ONESAT_PROTOCOL;
|
|
89
128
|
// ============================================================================
|
|
90
129
|
// OpNS identity bind (PushDrop on name UTXO)
|
|
91
130
|
// ============================================================================
|
|
@@ -137,141 +176,76 @@ export function readHostingExp(tags) {
|
|
|
137
176
|
}
|
|
138
177
|
return undefined;
|
|
139
178
|
}
|
|
179
|
+
// ============================================================================
|
|
180
|
+
// Permission schemes (BRC-99) — one scheme id per asset class
|
|
181
|
+
// ============================================================================
|
|
140
182
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* to capture the hashOutputs commitment for any 1Sat-asset createAction.
|
|
144
|
-
*
|
|
145
|
-
* Asset-specific labels (built via {@link buildInputAssetLabel} /
|
|
146
|
-
* {@link buildOutputAssetLabel}) carry per-asset lookup keys the module
|
|
147
|
-
* uses to render the prompt with rich detail (ordinal name, token amount,
|
|
148
|
-
* etc.). The wallet-toolbox enforces a `'p <scheme> <payload>'` shape, so
|
|
149
|
-
* a bare `'p 1sat'` is invalid; we use `'p 1sat action'` as the fallback.
|
|
150
|
-
*/
|
|
151
|
-
export const P1SAT_LABEL = 'p 1sat action';
|
|
152
|
-
/**
|
|
153
|
-
* Intent label prefix. Payload is `<domain>.<verb>` (e.g. `opns.register`).
|
|
154
|
-
* When present, replaces the need for bare {@link P1SAT_LABEL} as the
|
|
155
|
-
* WPM dispatch trigger for createAction.
|
|
183
|
+
* Registered permission scheme ids. Each maps to one primary storage basket
|
|
184
|
+
* of the same name (except where a profile documents otherwise).
|
|
156
185
|
*/
|
|
157
|
-
export const
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
OPNS_LIST: 'opns.list',
|
|
163
|
-
OPNS_TRANSFER: 'opns.transfer',
|
|
164
|
-
OPNS_CANCEL_LISTING: 'opns.cancel-listing',
|
|
165
|
-
OPNS_PURCHASE: 'opns.purchase',
|
|
166
|
-
ORDINAL_TRANSFER: 'ordinal.transfer',
|
|
167
|
-
ORDINAL_LIST: 'ordinal.list',
|
|
168
|
-
ORDINAL_CANCEL_LISTING: 'ordinal.cancel-listing',
|
|
169
|
-
ORDINAL_PURCHASE: 'ordinal.purchase',
|
|
170
|
-
ORDINAL_BURN: 'ordinal.burn',
|
|
171
|
-
ORDINAL_INSCRIBE: 'ordinal.inscribe',
|
|
172
|
-
ORDINAL_INSCRIBE_SIGMA: 'ordinal.inscribe-sigma',
|
|
173
|
-
ORDINAL_MINT_COLLECTION: 'ordinal.mint-collection',
|
|
174
|
-
ORDINAL_MINT_ITEM: 'ordinal.mint-item',
|
|
175
|
-
LOCK_LOCK: 'lock.lock',
|
|
176
|
-
LOCK_UNLOCK: 'lock.unlock',
|
|
177
|
-
BSV21_TRANSFER: 'bsv21.transfer',
|
|
178
|
-
BSV21_PURCHASE: 'bsv21.purchase',
|
|
179
|
-
BSV21_MINT: 'bsv21.mint',
|
|
180
|
-
BSV21_DEPLOY: 'bsv21.deploy',
|
|
186
|
+
export const PERMISSION_SCHEMES = {
|
|
187
|
+
ONESAT: '1sat',
|
|
188
|
+
OPNS: 'opns',
|
|
189
|
+
BSV21: 'bsv21',
|
|
190
|
+
LOCK: 'lock',
|
|
181
191
|
};
|
|
182
|
-
/**
|
|
183
|
-
export const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
192
|
+
/** Scheme ids that ship with the shared permission-module toolkit. */
|
|
193
|
+
export const PERMISSION_SCHEME_IDS = [
|
|
194
|
+
PERMISSION_SCHEMES.ONESAT,
|
|
195
|
+
PERMISSION_SCHEMES.OPNS,
|
|
196
|
+
PERMISSION_SCHEMES.BSV21,
|
|
197
|
+
PERMISSION_SCHEMES.LOCK,
|
|
198
|
+
];
|
|
199
|
+
const PERMISSION_SCHEME_SET = new Set(PERMISSION_SCHEME_IDS);
|
|
200
|
+
export function isPermissionSchemeId(s) {
|
|
201
|
+
return PERMISSION_SCHEME_SET.has(s);
|
|
189
202
|
}
|
|
190
|
-
/**
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
export function buildIntentLabel(intent) {
|
|
194
|
-
return `${P1SAT_INTENT_LABEL_PREFIX}${intent}`;
|
|
203
|
+
/** Primary storage basket for a scheme (today: scheme id === basket name). */
|
|
204
|
+
export function basketForScheme(scheme) {
|
|
205
|
+
return scheme;
|
|
195
206
|
}
|
|
196
|
-
/**
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
if (!labels)
|
|
201
|
-
return undefined;
|
|
202
|
-
for (const label of labels) {
|
|
203
|
-
if (!label.startsWith(P1SAT_INTENT_LABEL_PREFIX))
|
|
204
|
-
continue;
|
|
205
|
-
const intent = label.slice(P1SAT_INTENT_LABEL_PREFIX.length).trim();
|
|
206
|
-
if (intent)
|
|
207
|
-
return intent;
|
|
208
|
-
}
|
|
209
|
-
return undefined;
|
|
207
|
+
/** Scheme that owns a storage basket, if any. */
|
|
208
|
+
export function schemeForBasket(basket) {
|
|
209
|
+
const b = basket.trim();
|
|
210
|
+
return isPermissionSchemeId(b) ? b : undefined;
|
|
210
211
|
}
|
|
211
|
-
/**
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
*
|
|
215
|
-
* The actionId is the action's correlator: it is stamped before apply runs,
|
|
216
|
-
* so both the action and apply can derive the same intermediate keyIDs
|
|
217
|
-
* (e.g. the Sigma anchor) without passing anything between them. Nothing may
|
|
218
|
-
* travel back from apply to the action — `WalletPermissionsManager` rebuilds
|
|
219
|
-
* `labels` into a new array before the module sees the args, so writes there
|
|
220
|
-
* are not visible to the caller.
|
|
221
|
-
*/
|
|
222
|
-
export const P1SAT_ACTION_ID_LABEL_PREFIX = 'p 1sat action-id ';
|
|
223
|
-
/**
|
|
224
|
-
* Build `p 1sat action-id <actionId>`.
|
|
225
|
-
*/
|
|
226
|
-
export function buildActionIdLabel(actionId) {
|
|
227
|
-
return `${P1SAT_ACTION_ID_LABEL_PREFIX}${actionId}`;
|
|
212
|
+
/** Dispatch label: `p <scheme> action` — routes createAction when no input label. */
|
|
213
|
+
export function buildActionDispatchLabel(scheme) {
|
|
214
|
+
return `p ${scheme} action`;
|
|
228
215
|
}
|
|
216
|
+
/** @deprecated Prefer {@link buildActionDispatchLabel}(`1sat`). */
|
|
217
|
+
export const P1SAT_LABEL = buildActionDispatchLabel(PERMISSION_SCHEMES.ONESAT);
|
|
229
218
|
/**
|
|
230
|
-
*
|
|
219
|
+
* True if labels already route createAction to `scheme` (any well-formed
|
|
220
|
+
* `p <scheme> <payload>` label, including bare action dispatch).
|
|
231
221
|
*/
|
|
232
|
-
export function
|
|
233
|
-
if (!labels)
|
|
234
|
-
return
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
continue;
|
|
238
|
-
const actionId = label.slice(P1SAT_ACTION_ID_LABEL_PREFIX.length).trim();
|
|
239
|
-
if (actionId)
|
|
240
|
-
return actionId;
|
|
241
|
-
}
|
|
242
|
-
return undefined;
|
|
222
|
+
export function hasSchemeDispatchLabel(labels, scheme) {
|
|
223
|
+
if (!labels?.length)
|
|
224
|
+
return false;
|
|
225
|
+
const prefix = `p ${scheme} `;
|
|
226
|
+
return labels.some((l) => l.startsWith(prefix) && l.length > prefix.length);
|
|
243
227
|
}
|
|
244
|
-
/**
|
|
245
|
-
|
|
246
|
-
* (bare action label or any intent label).
|
|
247
|
-
*/
|
|
248
|
-
export function hasP1SatDispatchLabel(labels) {
|
|
228
|
+
/** True if any known asset scheme is addressed by a P-label. */
|
|
229
|
+
export function hasAssetDispatchLabel(labels) {
|
|
249
230
|
if (!labels?.length)
|
|
250
231
|
return false;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
232
|
+
return PERMISSION_SCHEME_IDS.some((s) => hasSchemeDispatchLabel(labels, s));
|
|
233
|
+
}
|
|
234
|
+
/** @deprecated Prefer {@link hasSchemeDispatchLabel} / {@link hasAssetDispatchLabel}. */
|
|
235
|
+
export function hasP1SatDispatchLabel(labels) {
|
|
236
|
+
return hasSchemeDispatchLabel(labels, PERMISSION_SCHEMES.ONESAT);
|
|
237
|
+
}
|
|
238
|
+
/** Ensure `p <scheme> action` is present (unless another payload label for that scheme exists). */
|
|
239
|
+
export function ensureSchemeActionLabel(labels, scheme) {
|
|
240
|
+
const next = labels ?? [];
|
|
241
|
+
if (hasSchemeDispatchLabel(next, scheme))
|
|
242
|
+
return next;
|
|
243
|
+
return [...next, buildActionDispatchLabel(scheme)];
|
|
244
|
+
}
|
|
245
|
+
/** @deprecated Prefer {@link ensureSchemeActionLabel}(`labels`, `1sat`). */
|
|
246
|
+
export function ensureP1SatActionLabel(labels) {
|
|
247
|
+
return ensureSchemeActionLabel(labels, PERMISSION_SCHEMES.ONESAT);
|
|
254
248
|
}
|
|
255
|
-
/**
|
|
256
|
-
* Shared `'p 1sat '` prefix on every 1Sat asset basket. Used by the
|
|
257
|
-
* WalletPermissionsManager to route basket-scoped calls (listOutputs,
|
|
258
|
-
* internalizeAction, etc.) through the 1Sat permission module.
|
|
259
|
-
*/
|
|
260
|
-
export const P1SAT_BASKET_PREFIX = 'p 1sat ';
|
|
261
|
-
/**
|
|
262
|
-
* Label prefix recognized by the 1Sat permission module. Carries the
|
|
263
|
-
* `'p 1sat'` dispatch trigger; payload is `'<basket-suffix> <id>'`
|
|
264
|
-
* where `<basket-suffix>` is the asset basket name with the shared
|
|
265
|
-
* `'p 1sat '` prefix stripped (e.g. `'ordinals'`, `'bsv21'`). Encoding
|
|
266
|
-
* only the suffix keeps the payload space-free so the parser can split
|
|
267
|
-
* cleanly on the boundary between basket and id.
|
|
268
|
-
*
|
|
269
|
-
* Outputs don't need a label: the SDK sets tags directly on
|
|
270
|
-
* `args.outputs[i].tags` (unencrypted, visible to the module), and
|
|
271
|
-
* `args.outputs[i].lockingScript` is cryptographically committed to
|
|
272
|
-
* the final tx. The module reads both directly.
|
|
273
|
-
*/
|
|
274
|
-
export const P1SAT_INPUT_LABEL_PREFIX = 'p 1sat input ';
|
|
275
249
|
/**
|
|
276
250
|
* Byte length of the zero-filled signature field carried by an unsealed
|
|
277
251
|
* `opns.register` lock. The action emits the complete PushDrop script with
|
|
@@ -281,48 +255,129 @@ export const P1SAT_INPUT_LABEL_PREFIX = 'p 1sat input ';
|
|
|
281
255
|
*/
|
|
282
256
|
export const OPNS_REGISTER_SIG_PLACEHOLDER_LEN = 72;
|
|
283
257
|
/**
|
|
284
|
-
* Build
|
|
285
|
-
* input asset record in the wallet's storage.
|
|
286
|
-
*
|
|
287
|
-
* `id` is the per-output asset id assigned by `createTrackedAction`
|
|
288
|
-
* (`id:<actionId>_<vout>`) — the value stored on the input's `id:` tag,
|
|
289
|
-
* without the `id:` prefix. The module resolves the record via
|
|
290
|
-
* `listOutputs({ basket, tags: [id:<id>], tagQueryMode: 'all' })` — a
|
|
291
|
-
* single indexed lookup, not a basket scan.
|
|
292
|
-
*
|
|
293
|
-
* Inputs without an `id:` tag (e.g. created before tracked-action ids
|
|
294
|
-
* existed) can't be enriched; callers should skip emitting the label
|
|
295
|
-
* for those rather than scanning by outpoint.
|
|
258
|
+
* Build `p <scheme> input id <key>` for a held row.
|
|
296
259
|
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* with the basket↔id space delimiter. Non-P1Sat baskets pass through
|
|
300
|
-
* unstripped — those won't resolve in the permission module and the
|
|
301
|
-
* input simply drops from enrichment (graceful degradation to the
|
|
302
|
-
* generic transaction approval UI).
|
|
303
|
-
*
|
|
304
|
-
* @param basket - Asset basket (typically a P1Sat basket constant).
|
|
305
|
-
* @param id - The asset id, i.e. the `id:` tag value on the input.
|
|
260
|
+
* `id` is the bare BRC-164 `id:` tag value (no `id:` prefix) and MUST NOT
|
|
261
|
+
* contain spaces. `basket` selects the scheme (scheme id === basket name).
|
|
306
262
|
*/
|
|
307
263
|
export function buildInputAssetLabel(basket, id) {
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
264
|
+
const b = basket.trim();
|
|
265
|
+
const assetId = id.trim();
|
|
266
|
+
if (!b)
|
|
267
|
+
throw new Error('Input label requires a basket name');
|
|
268
|
+
if (!assetId || /\s/.test(assetId)) {
|
|
269
|
+
throw new Error('Input id must be a non-empty string without spaces');
|
|
270
|
+
}
|
|
271
|
+
const scheme = schemeForBasket(b);
|
|
272
|
+
if (!scheme) {
|
|
273
|
+
throw new Error(`No permission scheme for basket "${b}"`);
|
|
274
|
+
}
|
|
275
|
+
return `p ${scheme} input id ${assetId}`;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Build `p <scheme> input <outpoint>` for an external (non-wallet) spend
|
|
279
|
+
* (outpoint is one of the action's beefed inputs).
|
|
280
|
+
*/
|
|
281
|
+
export function buildExternalInputLabel(scheme, outpoint) {
|
|
282
|
+
const op = outpoint.trim();
|
|
283
|
+
if (!op || /\s/.test(op)) {
|
|
284
|
+
throw new Error('External input outpoint must be a single token');
|
|
285
|
+
}
|
|
286
|
+
if (!isOutpointToken(op)) {
|
|
287
|
+
throw new Error('External input label requires an outpoint-shaped token');
|
|
288
|
+
}
|
|
289
|
+
return `p ${scheme} input ${op}`;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Parse held-row input labels (`p <scheme> input id <key>` only).
|
|
293
|
+
*/
|
|
294
|
+
export function parseInputAssetLabels(labels) {
|
|
295
|
+
if (!labels?.length)
|
|
296
|
+
return [];
|
|
297
|
+
const refs = [];
|
|
298
|
+
for (const label of labels) {
|
|
299
|
+
const parsed = parseOneInputLabel(label);
|
|
300
|
+
if (!parsed || parsed.kind !== 'id')
|
|
301
|
+
continue;
|
|
302
|
+
refs.push({
|
|
303
|
+
scheme: parsed.scheme,
|
|
304
|
+
basket: parsed.basket,
|
|
305
|
+
id: parsed.id,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
return refs;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Parse a single `p <scheme> input …` label.
|
|
312
|
+
*
|
|
313
|
+
* - Held: `p <scheme> input id <key>`
|
|
314
|
+
* - External: `p <scheme> input <outpoint>` (outpoint-shaped single token)
|
|
315
|
+
*/
|
|
316
|
+
export function parseOneInputLabel(label) {
|
|
317
|
+
if (!label.startsWith('p '))
|
|
318
|
+
return undefined;
|
|
319
|
+
const rest = label.slice(2);
|
|
320
|
+
const sp = rest.indexOf(' ');
|
|
321
|
+
if (sp <= 0)
|
|
322
|
+
return undefined;
|
|
323
|
+
const schemeTok = rest.slice(0, sp);
|
|
324
|
+
if (!isPermissionSchemeId(schemeTok))
|
|
325
|
+
return undefined;
|
|
326
|
+
const afterScheme = rest.slice(sp + 1).trim();
|
|
327
|
+
if (!afterScheme.startsWith('input '))
|
|
328
|
+
return undefined;
|
|
329
|
+
const payload = afterScheme.slice('input '.length).trim();
|
|
330
|
+
if (!payload)
|
|
331
|
+
return undefined;
|
|
332
|
+
// Held: `input id <key>`
|
|
333
|
+
if (payload.startsWith('id ')) {
|
|
334
|
+
const key = payload.slice(3).trim();
|
|
335
|
+
if (!key || /\s/.test(key) || isOutpointToken(key))
|
|
336
|
+
return undefined;
|
|
337
|
+
return {
|
|
338
|
+
kind: 'id',
|
|
339
|
+
scheme: schemeTok,
|
|
340
|
+
basket: basketForScheme(schemeTok),
|
|
341
|
+
id: key,
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
// External: single outpoint-shaped token only
|
|
345
|
+
if (!payload.includes(' ') && isOutpointToken(payload)) {
|
|
346
|
+
return {
|
|
347
|
+
kind: 'outpoint',
|
|
348
|
+
scheme: schemeTok,
|
|
349
|
+
outpoint: normalizeOutpointDot(payload),
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
return undefined;
|
|
353
|
+
}
|
|
354
|
+
function isOutpointToken(s) {
|
|
355
|
+
if (s.length < 66)
|
|
356
|
+
return false;
|
|
357
|
+
const sep = s[64];
|
|
358
|
+
if (sep !== '.' && sep !== '_')
|
|
359
|
+
return false;
|
|
360
|
+
const txid = s.slice(0, 64);
|
|
361
|
+
const vout = s.slice(65);
|
|
362
|
+
return /^[0-9a-fA-F]{64}$/.test(txid) && /^\d+$/.test(vout);
|
|
363
|
+
}
|
|
364
|
+
function normalizeOutpointDot(s) {
|
|
365
|
+
if (s.length >= 66 && s[64] === '_')
|
|
366
|
+
return `${s.slice(0, 64)}.${s.slice(65)}`;
|
|
367
|
+
return s;
|
|
312
368
|
}
|
|
313
369
|
/**
|
|
314
|
-
* BRC-111 P-label
|
|
315
|
-
*
|
|
316
|
-
* `wallet.listActions({ labels: [...] })`. As a `'p 1sat '`-prefixed label
|
|
317
|
-
* it routes through the 1Sat permission module instead of triggering the
|
|
318
|
-
* wallet-toolbox's per-label Protocol Permission prompt.
|
|
370
|
+
* BRC-111 P-label for BSV21 token history filtering via listActions.
|
|
371
|
+
* Routes through the `bsv21` permission scheme.
|
|
319
372
|
*/
|
|
320
|
-
export const
|
|
373
|
+
export const BSV21_TOKEN_LABEL_PREFIX = 'p bsv21 token ';
|
|
374
|
+
/** @deprecated Prefer {@link BSV21_TOKEN_LABEL_PREFIX}. */
|
|
375
|
+
export const P1SAT_TOKEN_LABEL_PREFIX = BSV21_TOKEN_LABEL_PREFIX;
|
|
321
376
|
/**
|
|
322
|
-
* Build a BSV21 token label, e.g. `'p
|
|
377
|
+
* Build a BSV21 token history label, e.g. `'p bsv21 token <tokenId>'`.
|
|
323
378
|
*/
|
|
324
379
|
export function buildTokenLabel(tokenId) {
|
|
325
|
-
return `${
|
|
380
|
+
return `${BSV21_TOKEN_LABEL_PREFIX}${tokenId}`;
|
|
326
381
|
}
|
|
327
382
|
/**
|
|
328
383
|
* Read the asset id (the `id:` tag value) off a wallet output's tags.
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sour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D,+EAA+E;AAC/E,gDAAgD;AAChD,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,GAAG,IAAI,CAAA;AACpD,sDAAsD;AACtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,cAAc,CAAA;AACvD,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAA"}
|
package/dist/intentLabel.test.js
CHANGED
|
@@ -1,16 +1,59 @@
|
|
|
1
1
|
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import {
|
|
3
|
-
describe('
|
|
4
|
-
test('
|
|
5
|
-
|
|
6
|
-
expect(
|
|
7
|
-
expect(
|
|
2
|
+
import { P1SAT_LABEL, buildActionDispatchLabel, buildExternalInputLabel, buildInputAssetLabel, ensureSchemeActionLabel, hasAssetDispatchLabel, hasSchemeDispatchLabel, parseInputAssetLabels, parseOneInputLabel, } from './constants';
|
|
3
|
+
describe('scheme dispatch labels', () => {
|
|
4
|
+
test('buildActionDispatchLabel', () => {
|
|
5
|
+
expect(buildActionDispatchLabel('1sat')).toBe('p 1sat action');
|
|
6
|
+
expect(buildActionDispatchLabel('opns')).toBe('p opns action');
|
|
7
|
+
expect(P1SAT_LABEL).toBe('p 1sat action');
|
|
8
8
|
});
|
|
9
|
-
test('
|
|
10
|
-
expect(
|
|
11
|
-
expect(
|
|
12
|
-
expect(
|
|
13
|
-
expect(
|
|
9
|
+
test('hasSchemeDispatchLabel / hasAssetDispatchLabel', () => {
|
|
10
|
+
expect(hasSchemeDispatchLabel([P1SAT_LABEL], '1sat')).toBe(true);
|
|
11
|
+
expect(hasSchemeDispatchLabel(['p opns input id abc'], 'opns')).toBe(true);
|
|
12
|
+
expect(hasSchemeDispatchLabel(['p opns input id abc'], '1sat')).toBe(false);
|
|
13
|
+
expect(hasAssetDispatchLabel(['p bsv21 action'])).toBe(true);
|
|
14
|
+
expect(hasAssetDispatchLabel(['p 1sat'])).toBe(false);
|
|
15
|
+
expect(hasAssetDispatchLabel(undefined)).toBe(false);
|
|
16
|
+
});
|
|
17
|
+
test('ensureSchemeActionLabel', () => {
|
|
18
|
+
expect(ensureSchemeActionLabel(undefined, '1sat')).toEqual([P1SAT_LABEL]);
|
|
19
|
+
expect(ensureSchemeActionLabel(['other'], 'opns')).toEqual([
|
|
20
|
+
'other',
|
|
21
|
+
'p opns action',
|
|
22
|
+
]);
|
|
23
|
+
expect(ensureSchemeActionLabel([P1SAT_LABEL], '1sat')).toEqual([
|
|
24
|
+
P1SAT_LABEL,
|
|
25
|
+
]);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
describe('input labels', () => {
|
|
29
|
+
test('held: p <scheme> input id <key>', () => {
|
|
30
|
+
const label = buildInputAssetLabel('1sat', 'id1');
|
|
31
|
+
expect(label).toBe('p 1sat input id id1');
|
|
32
|
+
expect(parseInputAssetLabels([label])).toEqual([
|
|
33
|
+
{ scheme: '1sat', basket: '1sat', id: 'id1' },
|
|
34
|
+
]);
|
|
35
|
+
});
|
|
36
|
+
test('opns / bsv21', () => {
|
|
37
|
+
expect(buildInputAssetLabel('opns', 'abc')).toBe('p opns input id abc');
|
|
38
|
+
expect(buildInputAssetLabel('bsv21', 'tok')).toBe('p bsv21 input id tok');
|
|
39
|
+
expect(parseInputAssetLabels(['p opns input id abc'])).toEqual([
|
|
40
|
+
{ scheme: 'opns', basket: 'opns', id: 'abc' },
|
|
41
|
+
]);
|
|
42
|
+
});
|
|
43
|
+
test('rejects legacy basket-middle and bare-key forms', () => {
|
|
44
|
+
expect(parseOneInputLabel('p 1sat input opns oldid')).toBeUndefined();
|
|
45
|
+
expect(parseOneInputLabel('p 1sat input barekey')).toBeUndefined();
|
|
46
|
+
expect(parseInputAssetLabels(['p 1sat input opns oldid'])).toEqual([]);
|
|
47
|
+
});
|
|
48
|
+
test('external: p <scheme> input <outpoint>', () => {
|
|
49
|
+
const op = `${'aa'.repeat(32)}.0`;
|
|
50
|
+
const label = buildExternalInputLabel('1sat', op);
|
|
51
|
+
expect(label).toBe(`p 1sat input ${op}`);
|
|
52
|
+
expect(parseOneInputLabel(label)).toEqual({
|
|
53
|
+
kind: 'outpoint',
|
|
54
|
+
scheme: '1sat',
|
|
55
|
+
outpoint: op,
|
|
56
|
+
});
|
|
14
57
|
});
|
|
15
58
|
});
|
|
16
59
|
//# sourceMappingURL=intentLabel.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intentLabel.test.js","sourceRoot":"","sources":["../src/intentLabel.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACjD,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"intentLabel.test.js","sourceRoot":"","sources":["../src/intentLabel.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACjD,OAAO,EACN,WAAW,EACX,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,GAClB,MAAM,aAAa,CAAA;AAEpB,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACvC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QAC9D,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QAC9D,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,gDAAgD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,sBAAsB,CAAC,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,CAA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AAC,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAA;QACxC,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;YACzC,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,EAAE;SACZ,CAAC,CAAA;IACH,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
package/dist/ordinalTags.d.ts
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
import type { OrdfsMetadata } from './services';
|
|
2
|
-
/** Longest
|
|
2
|
+
/** Longest display name we put in customInstructions (not tags). */
|
|
3
3
|
export declare const MAX_NAME_TAG_LENGTH = 64;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* Emits:
|
|
16
|
-
* - `origin:<outpoint>` — the resolved genesis. **Omitted entirely when
|
|
17
|
-
* unknown**; an empty `origin:` reads as a resolved value and is never
|
|
18
|
-
* correct. The bare `origin` marker is a separate thing, set only on the
|
|
19
|
-
* inscription transaction itself, where the output cannot know its own
|
|
20
|
-
* outpoint.
|
|
21
|
-
* - `type:<category>` **and** `type:<base>` — hierarchical, so callers can
|
|
22
|
-
* query broadly (`type:image`) or exactly (`type:image/png`).
|
|
23
|
-
* - `name:<name>` — from MAP `name`, else `subTypeData.name`, truncated.
|
|
5
|
+
* Ordinals / indexer outpoint form: `txid_vout`.
|
|
6
|
+
* Accepts dotted (BRC-100) or underscore input. Used for origin tags, CI
|
|
7
|
+
* origin, BSV21 tokenId-style ids, and OrdFS keys.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatOrdinalOutpoint(outpoint: string): string;
|
|
10
|
+
/** @deprecated Use {@link formatOrdinalOutpoint} */
|
|
11
|
+
export declare const formatOriginOutpoint: typeof formatOrdinalOutpoint;
|
|
12
|
+
/**
|
|
13
|
+
* Canonical identity tags for an ordinal (BRC-147).
|
|
24
14
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
15
|
+
* Emits filter tags (lowercase-safe). Does **not** emit `name:` (→ CI `name`).
|
|
16
|
+
* Bare `origin` is only for the mint out itself (caller stamps that).
|
|
27
17
|
*/
|
|
28
18
|
export declare function ordinalTagsFromMetadata(metadata: Partial<OrdfsMetadata> | undefined, fallbackOrigin?: string): string[];
|
|
29
19
|
/**
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
* Single `type:<mime>` tag. Strips `;…` parameters. No category dual-tag.
|
|
21
|
+
*/
|
|
22
|
+
export declare function contentTypeTag(contentType: string | undefined): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Use {@link contentTypeTag}. Returns 0–1 tags for spread compat.
|
|
34
25
|
*/
|
|
35
26
|
export declare function contentTypeTags(contentType: string | undefined): string[];
|
|
36
|
-
/** MAP
|
|
27
|
+
/** Parse MAP `subTypeData` (object or JSON string). */
|
|
28
|
+
export declare function parseMapSubTypeData(map: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
|
|
29
|
+
/** MAP name, falling back to `subTypeData.name`. For CI `name`, not tags. */
|
|
37
30
|
export declare function nameFromMap(map: Record<string, unknown> | undefined): string | undefined;
|
|
31
|
+
/** Truncate display name for CI. */
|
|
32
|
+
export declare function displayNameForCi(name: string | undefined): string | undefined;
|
|
38
33
|
//# sourceMappingURL=ordinalTags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ordinalTags.d.ts","sourceRoot":"","sources":["../src/ordinalTags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,
|
|
1
|
+
{"version":3,"file":"ordinalTags.d.ts","sourceRoot":"","sources":["../src/ordinalTags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C,oEAAoE;AACpE,eAAO,MAAM,mBAAmB,KAAK,CAAA;AAErC;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAW9D;AAED,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,8BAAwB,CAAA;AAEzD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACtC,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS,EAC5C,cAAc,CAAC,EAAE,MAAM,GACrB,MAAM,EAAE,CAuCV;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC7B,WAAW,EAAE,MAAM,GAAG,SAAS,GAC7B,MAAM,GAAG,SAAS,CAIpB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,CAGzE;AAED,uDAAuD;AACvD,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACtC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAiBrC;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,CAC1B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACtC,MAAM,GAAG,SAAS,CAOpB;AAED,oCAAoC;AACpC,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAG7E"}
|
package/dist/ordinalTags.js
CHANGED
|
@@ -1,64 +1,118 @@
|
|
|
1
|
-
/** Longest
|
|
1
|
+
/** Longest display name we put in customInstructions (not tags). */
|
|
2
2
|
export const MAX_NAME_TAG_LENGTH = 64;
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
4
|
+
* Ordinals / indexer outpoint form: `txid_vout`.
|
|
5
|
+
* Accepts dotted (BRC-100) or underscore input. Used for origin tags, CI
|
|
6
|
+
* origin, BSV21 tokenId-style ids, and OrdFS keys.
|
|
7
|
+
*/
|
|
8
|
+
export function formatOrdinalOutpoint(outpoint) {
|
|
9
|
+
const s = outpoint.trim();
|
|
10
|
+
if (s.length >= 66) {
|
|
11
|
+
const sep = s[64];
|
|
12
|
+
if (sep === '.' || sep === '_') {
|
|
13
|
+
return `${s.slice(0, 64)}_${s.slice(65)}`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const dot = s.indexOf('.');
|
|
17
|
+
if (dot === 64)
|
|
18
|
+
return `${s.slice(0, 64)}_${s.slice(65)}`;
|
|
19
|
+
return s.replace('.', '_');
|
|
20
|
+
}
|
|
21
|
+
/** @deprecated Use {@link formatOrdinalOutpoint} */
|
|
22
|
+
export const formatOriginOutpoint = formatOrdinalOutpoint;
|
|
23
|
+
/**
|
|
24
|
+
* Canonical identity tags for an ordinal (BRC-147).
|
|
23
25
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
+
* Emits filter tags (lowercase-safe). Does **not** emit `name:` (→ CI `name`).
|
|
27
|
+
* Bare `origin` is only for the mint out itself (caller stamps that).
|
|
26
28
|
*/
|
|
27
29
|
export function ordinalTagsFromMetadata(metadata, fallbackOrigin) {
|
|
28
30
|
const tags = [];
|
|
29
31
|
const origin = metadata?.origin || fallbackOrigin;
|
|
30
32
|
if (origin)
|
|
31
|
-
tags.push(`origin:${origin}`);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
tags.push(`origin:${formatOrdinalOutpoint(origin)}`);
|
|
34
|
+
const map = metadata?.map;
|
|
35
|
+
const subTypeData = parseMapSubTypeData(map);
|
|
36
|
+
// Display pointer when media is not at origin (e.g. OrdFS parent / MAP content)
|
|
37
|
+
const content = typeof map?.content === 'string'
|
|
38
|
+
? map.content
|
|
39
|
+
: typeof metadata?.parent === 'string'
|
|
40
|
+
? metadata.parent
|
|
41
|
+
: undefined;
|
|
42
|
+
if (content)
|
|
43
|
+
tags.push(`content:${formatOrdinalOutpoint(content)}`);
|
|
44
|
+
// collectionId is often nested: MAP subTypeData JSON (collection items)
|
|
45
|
+
const collectionId = typeof map?.collectionId === 'string'
|
|
46
|
+
? map.collectionId
|
|
47
|
+
: typeof map?.collection === 'string'
|
|
48
|
+
? map.collection
|
|
49
|
+
: typeof subTypeData?.collectionId === 'string'
|
|
50
|
+
? subTypeData.collectionId
|
|
51
|
+
: typeof subTypeData?.collection === 'string'
|
|
52
|
+
? subTypeData.collection
|
|
53
|
+
: undefined;
|
|
54
|
+
if (collectionId) {
|
|
55
|
+
tags.push(`collection:${formatOrdinalOutpoint(collectionId)}`);
|
|
56
|
+
}
|
|
57
|
+
const app = typeof map?.app === 'string' ? map.app : undefined;
|
|
58
|
+
if (app)
|
|
59
|
+
tags.push(`app:${app}`);
|
|
60
|
+
const typeTag = contentTypeTag(metadata?.contentType);
|
|
61
|
+
if (typeTag)
|
|
62
|
+
tags.push(typeTag);
|
|
37
63
|
return tags;
|
|
38
64
|
}
|
|
39
65
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* `image/png; charset=x` yields `type:image` and `type:image/png`. Returns
|
|
43
|
-
* empty for a missing or blank content type — an empty `type:` is never useful.
|
|
66
|
+
* Single `type:<mime>` tag. Strips `;…` parameters. No category dual-tag.
|
|
44
67
|
*/
|
|
45
|
-
export function
|
|
68
|
+
export function contentTypeTag(contentType) {
|
|
46
69
|
const base = contentType?.split(';')[0]?.trim();
|
|
47
70
|
if (!base)
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
return category && category !== base
|
|
51
|
-
? [`type:${category}`, `type:${base}`]
|
|
52
|
-
: [`type:${base}`];
|
|
71
|
+
return undefined;
|
|
72
|
+
return `type:${base}`;
|
|
53
73
|
}
|
|
54
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated Use {@link contentTypeTag}. Returns 0–1 tags for spread compat.
|
|
76
|
+
*/
|
|
77
|
+
export function contentTypeTags(contentType) {
|
|
78
|
+
const t = contentTypeTag(contentType);
|
|
79
|
+
return t ? [t] : [];
|
|
80
|
+
}
|
|
81
|
+
/** Parse MAP `subTypeData` (object or JSON string). */
|
|
82
|
+
export function parseMapSubTypeData(map) {
|
|
83
|
+
if (!map)
|
|
84
|
+
return undefined;
|
|
85
|
+
const raw = map.subTypeData;
|
|
86
|
+
if (raw && typeof raw === 'object' && !Array.isArray(raw)) {
|
|
87
|
+
return raw;
|
|
88
|
+
}
|
|
89
|
+
if (typeof raw === 'string' && raw.trim()) {
|
|
90
|
+
try {
|
|
91
|
+
const o = JSON.parse(raw);
|
|
92
|
+
if (o && typeof o === 'object' && !Array.isArray(o)) {
|
|
93
|
+
return o;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
/* ignore */
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
/** MAP name, falling back to `subTypeData.name`. For CI `name`, not tags. */
|
|
55
103
|
export function nameFromMap(map) {
|
|
56
104
|
if (!map)
|
|
57
105
|
return undefined;
|
|
58
106
|
if (typeof map.name === 'string' && map.name)
|
|
59
107
|
return map.name;
|
|
60
|
-
const subTypeData = map
|
|
108
|
+
const subTypeData = parseMapSubTypeData(map);
|
|
61
109
|
const subName = subTypeData?.name;
|
|
62
110
|
return typeof subName === 'string' && subName ? subName : undefined;
|
|
63
111
|
}
|
|
112
|
+
/** Truncate display name for CI. */
|
|
113
|
+
export function displayNameForCi(name) {
|
|
114
|
+
if (!name?.trim())
|
|
115
|
+
return undefined;
|
|
116
|
+
return name.trim().slice(0, MAX_NAME_TAG_LENGTH);
|
|
117
|
+
}
|
|
64
118
|
//# sourceMappingURL=ordinalTags.js.map
|
package/dist/ordinalTags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ordinalTags.js","sourceRoot":"","sources":["../src/ordinalTags.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"ordinalTags.js","sourceRoot":"","sources":["../src/ordinalTags.ts"],"names":[],"mappings":"AAEA,oEAAoE;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAErC;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAgB;IACrD,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;IACzB,IAAI,CAAC,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QACpB,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAA;QACjB,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;YAChC,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAA;QAC1C,CAAC;IACF,CAAC;IACD,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC1B,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAA;IACzD,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAC3B,CAAC;AAED,oDAAoD;AACpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAAqB,CAAA;AAEzD;;;;;GAKG;AACH,M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